@galacean/effects 2.3.7 → 2.3.8

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.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/appx-adapter/weapp");function r(t,e,r,i,n,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(i,n)}function i(t){return function(){var e=this,i=arguments;return new Promise((function(n,s){var a=t.apply(e,i);function o(t){r(a,n,s,o,u,"next",t)}function u(t){r(a,n,s,o,u,"throw",t)}o(void 0)}))}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}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 a(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):a(t,e)}function o(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function u(t,e,r,i){var n,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,i);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,r,a):n(e,r))||a);return s>3&&a&&Object.defineProperty(e,r,a),a}function h(t,e){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}"function"==typeof SuppressedError&&SuppressedError;var c=new Uint8Array(16);function l(){if(!t&&!(t=void 0!==e.crypto&&e.crypto.getRandomValues&&e.crypto.getRandomValues.bind(e.crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(c)}for(var f=[],p=0;p<256;++p)f.push((p+256).toString(16).slice(1));var d,m={randomUUID:void 0!==e.crypto&&e.crypto.randomUUID&&e.crypto.randomUUID.bind(e.crypto)};function v(t,e,r){if(m.randomUUID&&!e&&!t)return m.randomUUID();var i=(t=t||{}).random||(t.rng||l)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){r=r||0;for(var n=0;n<16;++n)e[r+n]=i[n];return e}return function(t,e){return void 0===e&&(e=0),f[t[e+0]]+f[t[e+1]]+f[t[e+2]]+f[t[e+3]]+"-"+f[t[e+4]]+f[t[e+5]]+"-"+f[t[e+6]]+f[t[e+7]]+"-"+f[t[e+8]]+f[t[e+9]]+"-"+f[t[e+10]]+f[t[e+11]]+f[t[e+12]]+f[t[e+13]]+f[t[e+14]]+f[t[e+15]]}(i)}function y(t,e){return t.includes(e)||t.push(e),t}function g(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function x(t,e,r,i){if(void 0===i&&(i=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*i);Number.isNaN(r)||(n=Math.min(n,r));var s=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(s);return a.set(t),a}return t}function b(t,e){var r=[0,0,0,0];if(H(t)){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else a(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var s=0;s<4;s++)r[s]/=255;return r}function T(t,e,r){if(t.length){for(var i,n=1;n<=t.length-1;n++){var s=t[n-1],a=t[n];if(s.stop<=e&&e<=a.stop){i=_(s.color,a.color,(e-s.stop)/(a.stop-s.stop));break}}return i||(i=t[t.length-1].color),r?i.map((function(t){return t/255})):i}return[0,0,0,0]}function E(t){var e=[];if(a(t,Array)?t.forEach((function(t){var r=t[0],i=t[1],n=t[2],s=t[3],a=t[4];e.push({stop:A(r),color:[i,n,s,a]})})):Object.keys(t).forEach((function(r){var i=b(t[r]);e.push({stop:A(r),color:i})})),(e=e.sort((function(t,e){return t.stop-e.stop}))).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var r=e[e.length-1];1!==r.stop&&e.push({stop:1,color:r.color.slice()})}return e}function _(t,e,r,i){var n=[],s=1-r;if(i)for(var a=0;a<4;a++)n[a]=t[a]*s+e[a]*r;else{for(var o=0;o<3;o++)n[o]=Math.round(Math.sqrt(t[o]*t[o]*s+e[o]*e[o]*r));n[3]=Math.round(t[3]*s+e[3]*r)}return n}function A(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function C(){if("object"==typeof e.screen&&"object"==typeof e.document){var t=Math.max(e.document.documentElement.clientWidth,e.window.innerWidth||0),r=e.screen.width/t;return Math.min(2*r,2)}return 1}function S(){return!!e.navigator.platform&&/iPad|iPhone|iPod/.test(e.navigator.platform)}function w(){return/\b[Aa]ndroid\b/.test(e.navigator.userAgent)}function R(){return w()||/\b(iPad|iPhone|iPod)\b/.test(e.navigator.userAgent)}function O(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function M(){return"miniprogram"===e.window.__wxjs_environment}function P(t){H(t)&&(t=b(t));for(var e=t,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=e[n];return r}function I(t){var e=128,r={width:e,height:1,data:new Uint8Array(512)},i=r.data,n=E(t);if(n.length){i.set(n[0].color,0);for(var s=1;s<127;s++){for(var a=s/e,o=void 0,u=void 0,h=0;h<n.length&&(o=n[h],u=n[h+1],!(o.stop<=a&&u.stop>a));h++);var c=_(o.color,u.color,(a-o.stop)/(u.stop-o.stop));i.set(c,4*s)}i.set(n[n.length-1].color,508)}return r}function L(t,e){void 0===e&&(e=2);var r=t.length;if(r<=1||1===e)return t;if(r<=30){for(var i=1;i<r;i++)V(t,i,e);return t}return D(t,e)}function F(t,e,r){return void 0===r&&(r=2),t.includes(e)?t:(t.push(e),1===t.length||1!==r&&V(t,t.length-1,r),t)}function V(t,e,r){var i=t[e];if(2!==r)for(;e>=1&&t[e-1].priority<i.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>i.priority&&(t[e]=t[e-1],0!=--e););t[e]=i}function D(t,e,r,i){if(void 0===r&&(r=0),void 0===i&&(i=t.length-1),r>=i)return t;for(var n,s=t[r],a=r,o=i;a<o;){if(2===e){for(;t[o].priority>s.priority&&o>=a;)o--;for(;t[a].priority<=s.priority&&a<o;)a++}else{for(;t[o].priority<s.priority&&o>=a;)o--;for(;t[a].priority>=s.priority&&a<o;)a++}var u;u=[t[o],t[a]],t[a]=u[0],t[o]=u[1]}return n=[t[a],t[r]],t[r]=n[0],t[a]=n[1],D(t,e,r,a-1),D(t,e,o+1,i),t}function N(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function k(t){return/^[^\d.][\w-]*$/.test(t)}exports.OrderType=void 0,(d=exports.OrderType||(exports.OrderType={}))[d.none=1]="none",d[d.ascending=2]="ascending",d[d.descending=3]="descending";var z,U="[Galacean Effects]";function B(t){return["%c"+U,"color: #AA0100",""+t]}var G,j={error:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).error.apply(n,[].concat(B(t),[r])),null==z||z("error",t,r)},info:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).debug.apply(n,[].concat(B(t))),null==z||z("info",t,r)},warn:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).warn.apply(n,[].concat(B(t))),null==z||z("warn",t,r)},register:function(t){t&&Y(t)&&(z=t)}};function X(){}function H(t){return"string"==typeof t}exports.DestroyOptions=void 0,(G=exports.DestroyOptions||(exports.DestroyOptions={}))[G.destroy=0]="destroy",G[G.keep=1]="keep",G[G.force=0]="force";var W=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function Y(t){return"[object Function]"===Object.prototype.toString.call(t)}function Z(t){return"[object Object]"===Object.prototype.toString.call(t)}function q(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function K(t,e){return t+Math.random()*(e-t)}function Q(){throw new Error("Destroyed item cannot be used again.")}function J(){return v().replace(/-/g,"")}function $(t,r,i){void 0===r&&(r="base64File"),void 0===i&&(i="");for(var n=t.split(",")[1]||t,s=e.atob(n),a=[],o=0;o<s.length;o+=512){for(var u=s.slice(o,o+512),h=new Array(u.length),c=0;c<u.length;c++)h[c]=u.charCodeAt(c);var l=new Uint8Array(h);a.push(l)}var f=new e.Blob(a,{type:i});return new File([f],r,{type:i})}function tt(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(r){var i=Object.getOwnPropertyDescriptor(e.prototype,r);if(!i)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,r,i)}))}))}var et={},rt=[],it={};function nt(t,e,r){it[t]&&j.error("Duplicate registration for plugin "+t+"."),it[t]=r,et[t]=e,y(rt,t)}var st=function(){function t(){var t={},e=[];rt.forEach((function(r){var i=et[r];e.includes(i)||(e.push(i),t[r]=i)})),this.plugins=Object.keys(t).map((function(t){var e=et[t];if(!e)throw new Error("The plugin '"+t+"' not found."+function(t){var e=at[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+"'":""}(t));var r=new e;return r.name=t,r})).sort((function(t,e){return t.order-e.order}))}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach((function(r){return r.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(r){return r.onCompositionReset(t,e)}))},e.processRawJSON=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("processRawJSON",t,e)]}))}))()},e.processAssets=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("processAssets",t,e)]}))}))()},e.precompile=function(t,e){for(var r,i=s(this.plugins);!(r=i()).done;){r.value.precompile(t,e)}},e.loadResources=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("prepareResource",t,e)]}))}))()},e.callStatic=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var s=this;return i((function(){var e,i,n,a,o,u,c;return h(this,(function(h){for(e=[],i=s.plugins,n=0;n<i.length;n++)a=i[n],o=et[a.name],t in o&&e.push(Promise.resolve(null==(c=o[t])?void 0:(u=c).call.apply(u,[].concat([o],r))));return[2,Promise.all(e)]}))}))()},t}(),at={"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"};var ot,ut,ht,ct,lt,ft,pt,dt,mt,vt,yt,gt,xt,bt,Tt=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 Et(t,e){return Et=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Et(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&&Et(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.LATEST="3.2"}(ot||(ot={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(ut||(ut={})),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"}(ht||(ht={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(ct||(ct={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(lt||(lt={})),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"}(ft||(ft={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(pt||(pt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(dt||(dt={})),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"}(mt||(mt={})),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"}(vt||(vt={})),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"}(gt||(gt={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(xt||(xt={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(bt||(bt={}));var At,Ct,St,wt,Rt,Ot,Mt,Pt,It,Lt,Ft,Vt,Dt,Nt,kt,zt,Ut,Bt,Gt=1,jt=3,Xt=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(At||(At={})),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"}(Ct||(Ct={})),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"}(St||(St={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(wt||(wt={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(Rt||(Rt={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Ot||(Ot={})),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"}(Mt||(Mt={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(Pt||(Pt={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(It||(It={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(Lt||(Lt={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Ft||(Ft={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(Vt||(Vt={})),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"}(Dt||(Dt={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(Nt||(Nt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(kt||(kt={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(zt||(zt={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Ut||(Ut={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Bt||(Bt={}));var Ht,Wt,Yt,Zt,qt,Kt,Qt,Jt,$t,te,ee={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"}(Ht||(Ht={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(Wt||(Wt={})),function(t){t[t.Round=0]="Round",t[t.Bevel=1]="Bevel",t[t.Miter=2]="Miter"}(Yt||(Yt={})),function(t){t.video="video",t.image="image"}(Zt||(Zt={})),function(t){t.video="video",t.audio="audio"}(qt||(qt={})),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.TimelineClip="TimelineClip"}(Kt||(Kt={})),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"}(Qt||(Qt={})),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"}(Jt||(Jt={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}($t||($t={})),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"}(te||(te={}));var re=ot.LATEST,ie=Object.freeze({__proto__:null,LATEST_VERSION:re,get RenderLevel(){return ut},get BlendingMode(){return ht},get SideMode(){return ct},get MaskMode(){return lt},get ParticleEmitterShapeType(){return ft},get PluginType(){return pt},get InteractType(){return dt},get InteractBehavior(){return mt},get ItemType(){return vt},get RenderMode(){return yt},get ParticleOrigin(){return gt},get RenderType(){return xt},get RenderFace(){return bt},get CameraClipMode(){return At},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:Gt,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:jt,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:Xt,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return Ct},get BezierKeyframeType(){return St},get JSONSceneVersion(){return ot},get EndBehavior(){return wt},get ParentItemEndBehavior(){return Rt},get ParticleInteractionBehavior(){return Ot},get ShapeArcMode(){return Mt},get LightType(){return Pt},get ModelBoundingType(){return It},get CameraType(){return Lt},get MaterialType(){return Ft},get MaterialBlending(){return Vt},get RenderMode3D(){return Dt},get TextOverflow(){return Nt},get TextBaseline(){return kt},get TextAlignment(){return zt},get TextWeight(){return Ut},get FontStyle(){return Bt},BuiltinObjectGUID:ee,get ShapePrimitiveType(){return Ht},get LineCap(){return Wt},get LineJoin(){return Yt},get BackgroundType(){return Zt},get MultimediaType(){return qt},get DataType(){return Kt},get GeometryType(){return Qt},get VertexFormatType(){return Jt},get IndexFormatType(){return $t},get VertexBufferSemantic(){return te}});function ne(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function se(t,e,r){return e&&ne(t.prototype,e),r&&ne(t,r),t}var ae=new Map,oe=new Map,ue={};function he(t){return function(e,r){ue[t]&&console.warn("Class "+t+" is already registered."),ue[t]=e}}function ce(t,e){return function(t,e){return function(r,i){var n=function(t){var e=t.constructor;ae.get(e)||ae.set(e,{});return ae.get(e)}(r);n&&(n[i]||(n[i]={type:t,sourceName:e}))}}(t,e)}function le(t){var e=t.constructor;if(oe.get(e))return oe.get(e);var r={};oe.set(e,r);for(var i=t,n=e;n;){var s=ae.get(n);for(var a in s)r[a]=s[a];var o=Object.getPrototypeOf(i);if((n=Object.getPrototypeOf(o).constructor)===Object)break;i=o}return r}var fe=function(){function t(t){this.engine=t,this.guid=J(),this.taggedProperties={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){t.id&&this.setInstanceId(t.id)},e.dispose=function(){},t.is=function(e){return a(e,t)&&"guid"in e},t}(),pe=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 r=e.prototype;return r.onAwake=function(){},r.onEnable=function(){},r.onDisable=function(){},r.onStart=function(){},r.onUpdate=function(t){},r.onLateUpdate=function(t){},r.onDestroy=function(){},r.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},r.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},r.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},r.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},r.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&g(this.item.components,this)},r.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},se(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}(fe);u([ce()],pe.prototype,"_enabled",void 0);var de=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},r.dispose=function(){t.prototype.dispose.call(this)},e}(pe),me=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e._priority=0,e}_t(e,t);var r=e.prototype;return r.render=function(t){},r.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e),this.item.rendererComponents.push(this)},r.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},r.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},r.fromData=function(e){t.prototype.fromData.call(this,e)},r.toData=function(){t.prototype.toData.call(this)},r.dispose=function(){this.item&&g(this.item.rendererComponents,this),t.prototype.dispose.call(this)},se(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}(pe);u([ce()],me.prototype,"materials",void 0),u([ce()],me.prototype,"_priority",void 0);var ve=2*Math.PI,ye=Math.PI/180,ge=180/Math.PI,xe=1e-6;function be(t,e){return Math.abs(t-e)<xe||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var Te=function(t,e,r){return(1-r)*t+r*e};function Ee(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r,s=Math.min(i,n),a=Math.max(i,n);return Math.min(Math.max(t,s),a)}var _e=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 r,i;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):a(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):a(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):a(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):a(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,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,r=this.y-t.y;return Math.sqrt(e*e+r*r)},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=xe,e=this.x,r=this.y;return Math.abs(e)<=t&&Math.abs(r)<=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,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();_e.ONE=new _e(1,1),_e.ZERO=new _e(0,0);var Ae=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}var e=t.prototype;return e.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,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 r,i,n;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):a(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):a(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):a(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):a(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this},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 r=t.x,i=t.y,n=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-n*a,this.y=n*s-r*o,this.z=r*a-i*s,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=xe,e=this,r=e.x,i=e.y,n=e.z;return Math.abs(r)<=t&&Math.abs(i)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new _e(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,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();Ae.X=new Ae(1,0,0),Ae.Y=new Ae(0,1,0),Ae.Z=new Ae(0,0,1),Ae.ONE=new Ae(1,1,1),Ae.ZERO=new Ae(0,0,0);var Ce=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,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 r,i,n,s;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(s=t[e+3])?s:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):a(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):a(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):a(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):a(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,this},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=xe,e=this,r=e.x,i=e.y,n=e.z,s=e.w;return Math.abs(r)<=t&&Math.abs(i)<=t&&Math.abs(n)<=t&&Math.abs(s)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new Ae(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,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();Ce.ONE=new Ce(1,1,1,1),Ce.ZERO=new Ce(0,0,0,0);var Se=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).meshCollider=new Is,e.getHitTestParams=function(t){var r=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,r);var i=e.meshCollider.getBoundingBoxData();if(i)return{type:i.type,triangles:i.area}},e}_t(e,t);var r=e.prototype;return r.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)},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(me);function we(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}u([ce()],Se.prototype,"geometry",void 0),exports.EffectComponent=function(t){function e(e){var r;return(r=t.call(this,e)||this).name="EffectComponent",r}_t(e,t);var r=e.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){var e,r=this.item.time,i=null!=(e=this.material.getVector4("_Time"))?e:new Ce;this.material.setVector4("_Time",i.set(r/20,r,2*r,3*r))},r.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(Se),exports.EffectComponent=u([he(Kt.EffectComponent)],exports.EffectComponent),exports.PostProcessVolume=function(t){function e(e){var r;return(r=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},r.vignette={intensity:0,smoothness:0,roundness:0,active:!1},r.tonemapping={active:!1},r.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},r}return _t(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(de),u([ce()],exports.PostProcessVolume.prototype,"bloom",void 0),u([ce()],exports.PostProcessVolume.prototype,"vignette",void 0),u([ce()],exports.PostProcessVolume.prototype,"tonemapping",void 0),u([ce()],exports.PostProcessVolume.prototype,"colorAdjustments",void 0),exports.PostProcessVolume=u([he(Kt.PostProcessVolume)],exports.PostProcessVolume);var Re=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,r){var i=r/2,n=Math.sin(i),s=t.tempVec0;return s.copyFrom(e).normalize(),this.x=s.x*n,this.y=s.y*n,this.z=s.z*n,this.w=Math.cos(i),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,r=e[0],i=e[4],n=e[8],s=e[1],a=e[5],o=e[9],u=e[2],h=e[6],c=e[10],l=r+a+c;if(l>0){var f=.5/Math.sqrt(l+1);this.w=.25/f,this.x=(h-o)*f,this.y=(n-u)*f,this.z=(s-i)*f}else if(r>a&&r>c){var p=2*Math.sqrt(1+r-a-c);this.w=(h-o)/p,this.x=.25*p,this.y=(i+s)/p,this.z=(n+u)/p,this.negate()}else if(a>c){var d=2*Math.sqrt(1+a-r-c);this.w=(n-u)/d,this.x=(i+s)/d,this.y=.25*d,this.z=(o+h)/d,this.negate()}else{var m=2*Math.sqrt(1+c-r-a);this.w=(s-i)/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 r=t.dot(e)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=r):(this.x=0,this.y=-t.z,this.z=t.y,this.w=r)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=r),this.normalize()},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(Ee(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var r=this.angleTo(t);if(0===r)return this;var i=Math.min(1,e/r);return this.slerp(t,i),this},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 r=t.x,i=t.y,n=t.z,s=t.w,a=e.x,o=e.y,u=e.z,h=e.w;return this.x=r*h+s*a+i*u-n*o,this.y=i*h+s*o+n*a-r*u,this.z=n*h+s*u+r*o-i*a,this.w=s*h-r*a-i*o-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var r=this,i=r.x,n=r.y,s=r.z,a=r.w,o=a*t.w+i*t.x+n*t.y+s*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=a,this.x=i,this.y=n,this.z=s,this;var u=1-o*o;if(u<=Number.EPSILON){var h=1-e;return this.w=h*a+e*this.w,this.x=h*i+e*this.x,this.y=h*n+e*this.y,this.z=h*s+e*this.z,this.normalize(),this}var c=Math.sqrt(u),l=Math.atan2(c,o),f=Math.sin((1-e)*l)/c,p=Math.sin(e*l)/c;return this.w=a*f+this.w*p,this.x=i*f+this.x*p,this.y=n*f+this.y*p,this.z=s*f+this.z*p,this},e.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},e.rotateVector3=function(t,e){var r=this,i=r.x,n=r.y,s=r.z,a=r.w,o=t.x,u=t.y,h=t.z,c=a*o+n*h-s*u,l=a*u+s*o-i*h,f=a*h+i*u-n*o,p=-i*o-n*u-s*h,d=null!=e?e:t;return d.x=c*a+p*-i+l*-s-f*-n,d.y=l*a+p*-n+f*-i-c*-s,d.z=f*a+p*-s+c*-n-l*-i,d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(Ae.ZERO,this,Ae.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,r){return(new t).setFromAxisAngle(e,r)},t.fromVector4=function(e){return(new t).setFromVector4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromRotationMatrix=function(e){return(new t).setFromRotationMatrix(e)},t.fromUnitVectors=function(e,r){return(new t).setFromUnitVectors(e,r)},t}();Re.tempVec0=new Ae;var Oe,Me,Pe=function(){function t(t,e,r,i,n,s,a,o,u,h,c,l,f,p,d,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=1),void 0===l&&(l=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===d&&(d=0),void 0===m&&(m=1),this.elements=[t,e,r,i,n,s,a,o,u,h,c,l,f,p,d,m]}var e=t.prototype;return e.set=function(t,e,r,i,n,s,a,o,u,h,c,l,f,p,d,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=n,v[5]=s,v[6]=a,v[7]=o,v[8]=u,v[9]=h,v[10]=c,v[11]=l,v[12]=f,v[13]=p,v[14]=d,v[15]=m,this},e.setFromRowMajorData=function(t,e,r,i,n,s,a,o,u,h,c,l,f,p,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=i,v[1]=n,v[5]=s,v[9]=a,v[13]=o,v[2]=u,v[6]=h,v[10]=c,v[14]=l,v[3]=f,v[7]=p,v[11]=d,v[15]=m,this},e.setFromColumnVectors=function(t,e,r,i){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,r.x,r.y,r.z,r.w,i.x,i.y,i.z,i.w)},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 r=0;r<16;r++)this.elements[r]=t[e+r];return this},e.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},e.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},e.setFromRotationX=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,r){var i=t.tempVec0;i.copyFrom(e).normalize();var n=Math.cos(r),s=Math.sin(r),a=1-n,o=i.x,u=i.y,h=i.z,c=a*o,l=a*u;return this.set(c*o+n,c*u+s*h,c*h-s*u,0,c*u-s*h,l*u+n,l*h+s*o,0,c*h+s*u,l*h-s*o,a*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(Ae.ZERO,t,Ae.ONE)},e.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},e.setFromBasis=function(t,e,r){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.z,0,0,0,0,1)},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,r,i){var n=t.tempVec0,s=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,r),a.normalize(),n.crossVectors(i,a),n.normalize(),s.crossVectors(a,n);var o=this.elements;return o[0]=n.x,o[1]=s.x,o[2]=a.x,o[3]=0,o[4]=n.y,o[5]=s.y,o[6]=a.y,o[7]=0,o[8]=n.z,o[9]=s.z,o[10]=a.z,o[11]=0,o[12]=-n.dot(e),o[13]=-s.dot(e),o[14]=-a.dot(e),o[15]=1,this},e.addScaledMatrix=function(t,e){for(var r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[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 r=t.elements,i=e.elements,n=this.elements,s=r[0],a=r[4],o=r[8],u=r[12],h=r[1],c=r[5],l=r[9],f=r[13],p=r[2],d=r[6],m=r[10],v=r[14],y=r[3],g=r[7],x=r[11],b=r[15],T=i[0],E=i[4],_=i[8],A=i[12],C=i[1],S=i[5],w=i[9],R=i[13],O=i[2],M=i[6],P=i[10],I=i[14],L=i[3],F=i[7],V=i[11],D=i[15];return n[0]=s*T+a*C+o*O+u*L,n[4]=s*E+a*S+o*M+u*F,n[8]=s*_+a*w+o*P+u*V,n[12]=s*A+a*R+o*I+u*D,n[1]=h*T+c*C+l*O+f*L,n[5]=h*E+c*S+l*M+f*F,n[9]=h*_+c*w+l*P+f*V,n[13]=h*A+c*R+l*I+f*D,n[2]=p*T+d*C+m*O+v*L,n[6]=p*E+d*S+m*M+v*F,n[10]=p*_+d*w+m*P+v*V,n[14]=p*A+d*R+m*I+v*D,n[3]=y*T+g*C+x*O+b*L,n[7]=y*E+g*S+x*M+b*F,n[11]=y*_+g*w+x*P+b*V,n[15]=y*A+g*R+x*I+b*D,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],r=t[4],i=t[8],n=t[12],s=t[1],a=t[5],o=t[9],u=t[13],h=t[2],c=t[6],l=t[10],f=t[14];return t[3]*(+n*o*c-i*u*c-n*a*l+r*u*l+i*a*f-r*o*f)+t[7]*(+e*o*f-e*u*l+n*s*l-i*s*f+i*u*h-n*o*h)+t[11]*(+e*u*c-e*a*f-n*s*c+r*s*f+n*a*h-r*u*h)+t[15]*(-i*a*h-e*o*c+e*a*l+i*s*c-r*s*l+r*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],r=t[1],i=t[2],n=t[3],s=t[4],a=t[5],o=t[6],u=t[7],h=t[8],c=t[9],l=t[10],f=t[11],p=t[12],d=t[13],m=t[14],v=t[15],y=c*m*u-d*l*u+d*o*f-a*m*f-c*o*v+a*l*v,g=p*l*u-h*m*u-p*o*f+s*m*f+h*o*v-s*l*v,x=h*d*u-p*c*u+p*a*f-s*d*f-h*a*v+s*c*v,b=p*c*o-h*d*o-p*a*l+s*d*l+h*a*m-s*c*m,T=e*y+r*g+i*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]=(d*l*n-c*m*n-d*i*f+r*m*f+c*i*v-r*l*v)*E,t[2]=(a*m*n-d*o*n+d*i*u-r*m*u-a*i*v+r*o*v)*E,t[3]=(c*o*n-a*l*n-c*i*u+r*l*u+a*i*f-r*o*f)*E,t[4]=g*E,t[5]=(h*m*n-p*l*n+p*i*f-e*m*f-h*i*v+e*l*v)*E,t[6]=(p*o*n-s*m*n-p*i*u+e*m*u+s*i*v-e*o*v)*E,t[7]=(s*l*n-h*o*n+h*i*u-e*l*u-s*i*f+e*o*f)*E,t[8]=x*E,t[9]=(p*c*n-h*d*n-p*r*f+e*d*f+h*r*v-e*c*v)*E,t[10]=(s*d*n-p*a*n+p*r*u-e*d*u-s*r*v+e*a*v)*E,t[11]=(h*a*n-s*c*n-h*r*u+e*c*u+s*r*f-e*a*f)*E,t[12]=b*E,t[13]=(h*d*i-p*c*i+p*r*l-e*d*l-h*r*m+e*c*m)*E,t[14]=(p*a*i-s*d*i-p*r*o+e*d*o+s*r*m-e*a*m)*E,t[15]=(s*c*i-h*a*i+h*r*o-e*c*o-s*r*l+e*a*l)*E,this},e.extractBasis=function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},e.compose=function(t,e,r,i){void 0===i&&(i=Ae.ZERO);var n=this.elements,s=e.x,a=e.y,o=e.z,u=e.w,h=-i.x,c=-i.y,l=-i.z,f=s+s,p=a+a,d=o+o,m=s*f,v=s*p,y=s*d,g=a*p,x=a*d,b=o*d,T=u*f,E=u*p,_=u*d,A=r.x,C=r.y,S=r.z;return n[0]=(1-(g+b))*A,n[1]=(v+_)*A,n[2]=(y-E)*A,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)*S,n[9]=(x-T)*S,n[10]=(1-(m+g))*S,n[11]=0,n[12]=h*n[0]+c*n[4]+l*n[8]-h+t.x,n[13]=h*n[1]+c*n[5]+l*n[9]-c+t.y,n[14]=h*n[2]+c*n[6]+l*n[10]-l+t.z,this},e.decompose=function(e,r,i){var n=t.tempVec0,s=this.elements,a=n.set(s[0],s[1],s[2]).length(),o=n.set(s[4],s[5],s[6]).length(),u=n.set(s[8],s[9],s[10]).length();this.determinant()<0&&(a=-a),e.x=s[12],e.y=s[13],e.z=s[14];var h=t.tempMat0;h.copyFrom(this);var c=1/a,l=1/o,f=1/u;return h.elements[0]*=c,h.elements[1]*=c,h.elements[2]*=c,h.elements[4]*=l,h.elements[5]*=l,h.elements[6]*=l,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,r.setFromRotationMatrix(h),i.x=a,i.y=o,i.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 Ae,e=new Re,r=new Ae;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},e.orthographic=function(t,e,r,i,n,s){var a=1/(e-t),o=1/(r-i),u=1/(s-n),h=-(e+t)*a,c=-(r+i)*o,l=-(s+n)*u;a*=2,o*=2,u*=-2;var f=this.elements;return f[0]=a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=o,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=c,f[14]=l,f[15]=1,this},e.perspective=function(t,e,r,i,n){var s=1/Math.tan(.5*t),a=1/(r-i),o=this.elements;return o[0]=n?s:s/e,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n?s*e:s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(i+r)*a,o[11]=-1,o[12]=0,o[13]=0,o[14]=2*i*r*a,o[15]=0,null!==i&&i!==1/0||(o[10]=-1,o[14]=-2*r),this},e.projectPoint=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,a=null!=e?e:t;a.x=s[0]*r+s[4]*i+s[8]*n+s[12],a.y=s[1]*r+s[5]*i+s[9]*n+s[13],a.z=s[2]*r+s[6]*i+s[10]*n+s[14];var o=s[3]*r+s[7]*i+s[11]*n+s[15];return a.multiply(1/o)},e.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*r+s[4]*i+s[8]*n+s[12],a.y=s[1]*r+s[5]*i+s[9]*n+s[13],a.z=s[2]*r+s[6]*i+s[10]*n+s[14],a},e.transformNormal=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*r+s[4]*i+s[8]*n,a.y=s[1]*r+s[5]*i+s[9]*n,a.z=s[2]*r+s[6]*i+s[10]*n,a.normalize()},e.transformVector4=function(t,e){var r=t.x,i=t.y,n=t.z,s=t.w,a=this.elements,o=null!=e?e:t;return o.x=a[0]*r+a[4]*i+a[8]*n+a[12]*s,o.y=a[1]*r+a[5]*i+a[9]*n+a[13]*s,o.z=a[2]*r+a[6]*i+a[10]*n+a[14]*s,o.w=a[3]*r+a[7]*i+a[11]*n+a[15]*s,o},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!be(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,r,i){return(new t).lookAt(e,r,i)},t.fromPerspective=function(e,r,i,n,s){return(new t).perspective(e,r,i,n,s)},t.fromColumnVectors=function(e,r,i,n){return(new t).setFromColumnVectors(e,r,i,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromScale=function(e,r,i){return(new t).setFromScale(e,r,i)},t.fromTranslation=function(e,r,i){return(new t).setFromTranslation(e,r,i)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,r){return(new t).setFromRotationAxis(e,r)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,r,i){return(new t).setFromShear(e,r,i)},t.fromBasis=function(e,r,i){return(new t).setFromBasis(e,r,i)},t.fromRowMajorData=function(e,r,i,n,s,a,o,u,h,c,l,f,p,d,m,v){return new t(e,s,h,p,r,a,c,d,i,o,l,m,n,u,f,v)},t}();function Ie(){return Ie=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Ie.apply(this,arguments)}Pe.IDENTITY=new Pe(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),Pe.ZERO=new Pe(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Pe.tempVec0=new Ae,Pe.tempVec1=new Ae,Pe.tempVec2=new Ae,Pe.tempMat0=new Pe,exports.TextureLoadAction=void 0,(Oe=exports.TextureLoadAction||(exports.TextureLoadAction={}))[Oe.whatever=0]="whatever",Oe[Oe.clear=2]="clear",exports.TextureSourceType=void 0,(Me=exports.TextureSourceType||(exports.TextureSourceType={}))[Me.none=0]="none",Me[Me.data=1]="data",Me[Me.image=2]="image",Me[Me.compressed=3]="compressed",Me[Me.video=4]="video",Me[Me.canvas=5]="canvas",Me[Me.framebuffer=6]="framebuffer",Me[Me.mipmaps=7]="mipmaps";var Le=function(){function t(){this.callbacks={}}var r=t.prototype;return r.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},r.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},r.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},r.download=function(t,r,i,n){var s=this;if(void 0===r&&(r="json"),!this.start(t,i,n)){var a=new e.XMLHttpRequest,o=function(){s.finish(t,a.status,a.response)};a.responseType=r,a.addEventListener("load",(function(){200==a.status?s.finish(t,200,a.response):o()})),a.addEventListener("error",o),a.open("GET",t,!0),a.send()}},r.start=function(t,e,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},r.finish=function(t,e,r){var i=this.callbacks[t];delete this.callbacks[t];for(var n=200==e?[r]:[e,r],s=n.length-1,a=i.length;s<a;s+=2)i[s].apply(null,n)},t}(),Fe=!1,Ve=!1;function De(t,e){return Ne.apply(this,arguments)}function Ne(){return(Ne=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:return!Fe&&e?[3,2]:[4,Ue(t)];case 1:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,Ue(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),Fe=!0,[4,Ue(t)];case 5:return[2,{image:r.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function ke(t,e){return ze.apply(this,arguments)}function ze(){return(ze=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:return!Ve&&e?[3,2]:[4,Ue(t)];case 1:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,Ue(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),Ve=!0,[4,Ue(t)];case 5:return[2,{image:r.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function Ue(t){return Be.apply(this,arguments)}function Be(){return(Be=i((function(t){var r,i;return h(this,(function(n){if(r="",a(t,e.HTMLImageElement)){if(t.complete)return[2,t];r=t.src}else a(t,e.Blob)?(r=e.URL.createObjectURL(t),i=!0):"string"==typeof t&&(r=t);if(!r)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,n){var s=new e.Image;/^data:/.test(r)||(s.crossOrigin="*"),s.onload=function(){return s.onload=null,i&&e.URL.revokeObjectURL(r),t(s)},s.onerror=function(t){return s.onerror=null,i&&e.URL.revokeObjectURL(r),n("Load image fail: "+r+", reason: "+JSON.stringify(t))},s.src=r}))]}))}))).apply(this,arguments)}function Ge(t){return je.apply(this,arguments)}function je(){return(je=i((function(t){return h(this,(function(e){return[2,new Promise((function(e,r){(new Le).downloadBinary(t,e,(function(e,i){r("Couldn't load bins "+t+": status "+e+", "+i)}))}))]}))}))).apply(this,arguments)}function Xe(){return(Xe=i((function(t){return h(this,(function(e){return[2,new Promise((function(e,r){(new Le).downloadBlob(t,e,(function(e,i){r("Couldn't load blob "+t+": status "+e+", "+i)}))}))]}))}))).apply(this,arguments)}function He(t){return We.apply(this,arguments)}function We(){return(We=i((function(t){var r;return h(this,(function(i){return r=e.document.createElement("video"),"string"==typeof t?r.src=t:r.srcObject=t,r.crossOrigin="anonymous",r.muted=!0,w()&&r.setAttribute("renderer","standard"),r.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var i=r.play();i?i.then((function(){return t(r)})):r.addEventListener("loadeddata",(function e(){t(r),r.removeEventListener("loadeddata",e)}),!0),r.addEventListener("error",(function(t){e("Load video fail.")}))}))]}))}))).apply(this,arguments)}function Ye(t,e){return Ze.apply(this,arguments)}function Ze(){return(Ze=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:if(!Array.isArray(t))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,5]),[4,e(t[0])];case 2:return[2,r.sent()];case 3:return r.sent(),[4,e(t[1])];case 4:return[2,r.sent()];case 5:return[2,e(t)]}}))}))).apply(this,arguments)}function qe(t,e,r){return Ke.apply(this,arguments)}function Ke(){return(Ke=i((function(t,e,r,i){var n,s,a,o,u,c,l,f,p;return h(this,(function(h){switch(h.label){case 0:return void 0===i&&(i=[]),34067!==t.target?[3,2]:(n=t.mipmaps,s=t.target,a=n.map((function(t){return Promise.all(t.map((function(t){return t.id?r[t.id]:Qe(t,e)})))})),[4,Promise.all(a)]);case 1:return o=h.sent(),[2,Ie({keepImageSource:!1},t,{mipmaps:o,sourceFrom:{target:s,type:exports.TextureSourceType.mipmaps}})];case 2:return u=t.mipmaps,c=t.target,l=u.map((function(t){return Qe(t,e)})),[4,Promise.all(l)];case 3:return f=h.sent(),p=i[u[0][1][0]].url,[2,Ie({keepImageSource:!1},t,{mipmaps:f,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{target:c,bin:p,type:exports.TextureSourceType.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function Qe(t,e){return Je.apply(this,arguments)}function Je(){return Je=i((function(t,r){var i,n,s,a,o;return h(this,(function(u){if(i=t[1],n=i[0],s=i[1],a=i[2],!(o=r[n]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,Ue(new e.Blob([new Uint8Array(o,s,a)]))]}))})),Je.apply(this,arguments)}function $e(t,e,r){var i;if(void 0===e&&(e="webgl"),"webgl2"===e&&((i=t.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),i&&"webgl"!==e||(i=t.getContext("webgl",r)),!i)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i}function tr(t){var r=t.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var n=t.createQuery(),s=i((function(){return h(this,(function(i){return[2,new Promise((function(i,a){if(n){var o=t.getQueryParameter(n,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(r.GPU_DISJOINT_EXT);if(o&&!u){var h=t.getQueryParameter(n,t.QUERY_RESULT);i(h/1e3/1e3)}(o||u)&&(t.deleteQuery(n),n=null),null!==o&&n&&e.window.setTimeout((function(){s().then(i).catch}),1)}}))]}))}));if(!n)return;return{begin:function(){n&&t.beginQuery(r.TIME_ELAPSED_EXT,n)},end:function(){t.endQuery(r.TIME_ELAPSED_EXT)},getTime:s}}}var er=[],rr={};function ir(){"function"==typeof e.WebGL2RenderingContext?sr(e.WebGL2RenderingContext):void 0!==e.WebGLRenderingContext?(sr(e.WebGLRenderingContext),sr(e.WebGLRenderingContext.prototype)):er.push("iOS16 lockdown mode, WebGL Constants not in global"),er.length||"HALF_FLOAT"in rr||(rr.HALF_FLOAT=5131)}function nr(t){return void 0!==e.WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function sr(t){for(var e in t)/^[A-Z_]/.test(e)&&(rr[e]=t[e])}function ar(t){switch(t){case Jt.Float32:return e.WebGLRenderingContext.FLOAT;case Jt.Int16:return e.WebGLRenderingContext.SHORT;case Jt.Int8:return e.WebGLRenderingContext.BYTE;case Jt.UInt16:return e.WebGLRenderingContext.UNSIGNED_SHORT;case Jt.UInt8:return e.WebGLRenderingContext.UNSIGNED_BYTE;default:return e.WebGLRenderingContext.FLOAT}}er.length||ir();var or=1,ur=function(t){function e(e){var r;return(r=t.call(this,e)||this).destroyed=!1,r.id="Tex"+or++,r}_t(e,t);var r=e.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(t){var e=t.target,r=void 0===e?rr.TEXTURE_2D:e,i=t.format,n=void 0===i?rr.RGBA:i;return t.sourceType||(t.sourceType="image"in t?exports.TextureSourceType.image:"data"in t?exports.TextureSourceType.data:"video"in t?exports.TextureSourceType.video:0),Ie({minFilter:rr.NEAREST,magFilter:rr.NEAREST,wrapS:rr.CLAMP_TO_EDGE,wrapT:rr.CLAMP_TO_EDGE,target:r,format:rr.RGBA,internalFormat:n,type:rr.UNSIGNED_BYTE},t)},e.fromImage=function(t,r,n){return i((function(){var i,s;return h(this,(function(a){switch(a.label){case 0:return[4,Ue(t)];case 1:return i=a.sent(),(s=e.create(r,Ie({sourceType:exports.TextureSourceType.image,image:i,target:rr.TEXTURE_2D,id:J(),flipY:!0},n))).initialize(),[2,s]}}))}))()},e.fromVideo=function(t,r,n){return i((function(){var i,s;return h(this,(function(a){switch(a.label){case 0:return[4,He(t)];case 1:return i=a.sent(),(s=e.create(r,Ie({sourceType:exports.TextureSourceType.video,video:i,id:J(),flipY:!0},n))).initialize(),[2,s]}}))}))()},se(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(fe);function hr(t,e,r,i){var n,s,a=e.length/r/i;return s=n=4===a||0===a?rr.RGBA:3===a?rr.RGB:2===a?rr.LUMINANCE_ALPHA:rr.LUMINANCE,ur.createWithData(t,{data:e,width:r,height:i},{type:rr.HALF_FLOAT,format:n,internalFormat:s,wrapS:rr.CLAMP_TO_EDGE,wrapT:rr.CLAMP_TO_EDGE})}var cr={type:rr.UNSIGNED_BYTE,format:rr.RGBA,internalFormat:rr.RGBA,wrapS:rr.MIRRORED_REPEAT,wrapT:rr.MIRRORED_REPEAT,minFilter:rr.NEAREST,magFilter:rr.NEAREST};function lr(t){return ur.create(t,Ie({id:ee.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:exports.TextureSourceType.data},cr))}function fr(t){return ur.create(t,Ie({id:ee.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:exports.TextureSourceType.data},cr))}var pr=function(){function t(t,e,r){void 0===r&&(r=0),this.arrayBuffer=t,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[11])throw new Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,s=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===s.getUint32(0,!0);this.glType=s.getUint32(1*n,a),this.glTypeSize=s.getUint32(2*n,a),this.glFormat=s.getUint32(3*n,a),this.glInternalFormat=s.getUint32(4*n,a),this.glBaseInternalFormat=s.getUint32(5*n,a),this.pixelWidth=s.getUint32(6*n,a),this.pixelHeight=s.getUint32(7*n,a),this.pixelDepth=s.getUint32(8*n,a),this.numberOfArrayElements=s.getUint32(9*n,a),this.numberOfFaces=s.getUint32(10*n,a),this.numberOfMipmapLevels=s.getUint32(11*n,a),this.bytesOfKeyValueData=s.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=0:this.loadType=2:j.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+"."):j.warn("Texture arrays not currently supported."):j.warn("Only 2D textures currently supported.")}return t.prototype.mipmaps=function(t){for(var e=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,s=t?this.numberOfMipmapLevels:1,a=0;a<s;a++){for(var o=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,o);e.push({data:h,width:i,height:n}),r+=o+4,r+=3-(o+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function dr(t){var e=new pr(t,1),r=e.numberOfMipmapLevels,i=e.pixelWidth,n=e.pixelHeight,s=e.glType,a=e.numberOfFaces,o=e.glInternalFormat,u=e.glFormat,h=r>=Math.floor(Math.log2(Math.max(i,n))+1);return{sourceType:exports.TextureSourceType.compressed,type:s,target:6===a?rr.TEXTURE_CUBE_MAP:rr.TEXTURE_2D,internalFormat:o,format:u,mipmaps:e.mipmaps(h)}}var mr,vr,yr,gr=function(){function t(){this.reloadPending={}}var r=t.prototype;return r.reload=function(t){var e=this;return i((function(){var r,i;return h(this,(function(n){switch(n.label){case 0:return r=t.id,e.reloadPending[r]?[2]:t.sourceFrom?(e.reloadPending[r]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return i=n.sent(),t.updateSource(i),e.reloadPending[r]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}}))}))()},r.canOffloadTexture=function(t){if(t){var e=t.type;if(e===exports.TextureSourceType.compressed||e===exports.TextureSourceType.image){var r=t.target,i=t.map,n=t.url;return r===rr.TEXTURE_CUBE_MAP?"object"==typeof i&&!!i:H(n)&&n.length>0}if(e===exports.TextureSourceType.mipmaps){var s=t.bin,a=t.mipmaps,o=t.target,u=t.maps,h=t.urls;return s?a.length>0:o===rr.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return H(t)&&t.length>0}))}}return!1},r.loadSource=function(t,e){var r=this;return i((function(){var i,n,s,a,o,u,c,l,f,p,d,m,v,y,g,x,b;return h(this,(function(h){switch(h.label){case 0:return i=t.type,n=t.target,s=t.map,a=t.url,o=t.bin,u=t.mipmaps,c=t.urls,l=t.maps,n!==rr.TEXTURE_CUBE_MAP||i===exports.TextureSourceType.mipmaps?[3,2]:[4,r.loadCubeMap(s)];case 1:return f=h.sent(),[2,Ie({},e,{cube:f,target:rr.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.image,sourceFrom:{type:exports.TextureSourceType.image,map:Ie({},s),target:rr.TEXTURE_CUBE_MAP}})];case 2:return i!==exports.TextureSourceType.image?[3,4]:[4,Ue(a)];case 3:return p=h.sent(),[2,Ie({},e,{image:p,sourceType:exports.TextureSourceType.image,sourceFrom:{type:i,url:a,target:rr.TEXTURE_2D}})];case 4:return i!==exports.TextureSourceType.video?[3,6]:[4,He(a)];case 5:return d=h.sent(),[2,Ie({},e,{video:d,sourceType:exports.TextureSourceType.video})];case 6:return i!==exports.TextureSourceType.compressed?[3,8]:[4,Ge(a)];case 7:return[2,Ie({},dr(h.sent()),e,{sourceFrom:{url:a,type:exports.TextureSourceType.compressed}})];case 8:return i!==exports.TextureSourceType.mipmaps?[3,17]:o?[4,Ge(o)]:[3,13];case 9:return m=h.sent(),v=null!=n?n:rr.TEXTURE_2D,y=v===rr.TEXTURE_2D?u.slice():u.map((function(t){return t.slice()})),n!==rr.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(u.map((function(t){return r.loadMipmapImages(t,m)})))];case 10:return g=h.sent(),[3,12];case 11:g=r.loadMipmapImages(u,m),h.label=12;case 12:return[2,Ie({},e,{mipmaps:g,target:v,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{bin:o,mipmaps:y,target:v,type:exports.TextureSourceType.mipmaps}})];case 13:return n!==rr.TEXTURE_2D&&n?[3,15]:[4,Promise.all(c.map((function(t){return Ue(t)})))];case 14:return x=h.sent(),[2,Ie({},e,{mipmaps:x,target:rr.TEXTURE_2D,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:c.slice(),target:rr.TEXTURE_2D}})];case 15:return n!==rr.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(l.map((function(t){return r.loadCubeMap(t)})))];case 16:return b=h.sent(),[2,Ie({},e,{mipmaps:b,target:rr.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:l.map((function(t){return Ie({},t)})),target:rr.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: "+i+".")}}))}))()},r.loadMipmapImages=function(t,r){return i((function(){return h(this,(function(i){return[2,Promise.all(t.map((function(t){return Ue(new e.Blob([new Uint8Array(r,t[0],t[1])]))})))]}))}))()},r.loadCubeMap=function(t){return i((function(){return h(this,(function(e){return[2,Promise.all(t.map((function(t){return Ue(t)})))]}))}))()},t}();function xr(){return mr||(mr=new gr),mr}exports.ShaderCompileResultStatus=void 0,(vr=exports.ShaderCompileResultStatus||(exports.ShaderCompileResultStatus={}))[vr.noShader=0]="noShader",vr[vr.success=1]="success",vr[vr.fail=2]="fail",vr[vr.compiling=3]="compiling",exports.GLSLVersion=void 0,(yr=exports.GLSLVersion||(exports.GLSLVersion={})).GLSL1="100",yr.GLSL3="300 es";var br=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).source=r,i}return _t(e,t),e}(fe);exports.Shader=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.createVariant=function(t){var e=[];if(t)for(var r,i=s(Object.keys(t));!(r=i()).done;){var n=r.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(fe),exports.Shader=u([he(Kt.Shader)],exports.Shader);var Tr,Er="effects-internal-copy",_r="effects-internal-copy-mesh",Ar="\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}",Cr="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 Sr(t,e){return{name:Er,vertex:Ar,fragment:Cr,glslVersion:2===t?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!e]],cacheId:_r+ +e}}function wr(t){switch(t){case ht.ALPHA:case ht.ADD:case ht.SUBTRACTION:case ht.STRONG_LIGHT:case ht.WEAK_LIGHT:return 1;case ht.SUPERPOSITION:return 2;case ht.BRIGHTNESS:return 3;case ht.MULTIPLY:return 0;default:return 1}}function Rr(t,e){switch(e){case void 0:case ht.ALPHA:t.blendFunction=[rr.ONE,rr.ONE_MINUS_SRC_ALPHA,rr.ONE,rr.ONE_MINUS_SRC_ALPHA];break;case ht.ADD:t.blendFunction=[rr.ONE,rr.ONE,rr.ONE,rr.ONE];break;case ht.SUBTRACTION:t.blendFunction=[rr.ONE,rr.ONE,rr.ZERO,rr.ONE],t.blendEquation=[rr.FUNC_REVERSE_SUBTRACT,rr.FUNC_REVERSE_SUBTRACT];break;case ht.SUPERPOSITION:t.blendFunction=[rr.ONE,rr.ONE,rr.ONE,rr.ONE];break;case ht.MULTIPLY:t.blendFunction=[rr.DST_COLOR,rr.ONE_MINUS_SRC_ALPHA,rr.DST_COLOR,rr.ONE_MINUS_SRC_ALPHA];break;case ht.BRIGHTNESS:t.blendFunction=[rr.ONE,rr.ONE_MINUS_SRC_ALPHA,rr.ONE,rr.ONE_MINUS_SRC_ALPHA];break;case ht.STRONG_LIGHT:t.blendFunction=[rr.DST_COLOR,rr.DST_ALPHA,rr.ZERO,rr.ONE];break;case ht.WEAK_LIGHT:t.blendFunction=[rr.DST_COLOR,rr.ZERO,rr.ZERO,rr.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function Or(t,e){e===ct.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=rr.CW,t.cullFace=e===ct.BACK?rr.BACK:rr.FRONT)}function Mr(t,e){switch(e){case void 0:t.stencilTest=!1;break;case lt.MASK:t.stencilTest=!0,t.stencilFunc=[rr.ALWAYS,rr.ALWAYS],t.stencilOpZPass=[rr.REPLACE,rr.REPLACE];break;case lt.OBSCURED:t.stencilTest=!0,t.stencilFunc=[rr.EQUAL,rr.EQUAL];break;case lt.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[rr.NOTEQUAL,rr.NOTEQUAL];break;case lt.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}exports.ShaderType=void 0,(Tr=exports.ShaderType||(exports.ShaderType={}))[Tr.vertex=0]="vertex",Tr[Tr.fragment=1]="fragment";var Pr,Ir=function(){function t(t){this.destroyed=!1;var e=t.name,r=void 0===e?"defaultDataBlock":e;this.name=r}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(r){e.setUniformValue(r,t[r])}))},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,r){},t}();function Lr(t){return"object"==typeof t&&t&&void 0===t.length&&a(t,ur)}exports.MaterialRenderType=void 0,(Pr=exports.MaterialRenderType||(exports.MaterialRenderType={}))[Pr.normal=0]="normal",Pr[Pr.transformFeedback=1]="transformFeedback";var Fr,Vr,Dr=1,Nr=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).stringTags={},i.enabledMacros={},i.destroyed=!1,i.initialized=!1,i.shaderDirty=!0,r){var n=r.name,s=void 0===n?"Material"+Dr++:n,a=r.renderType,o=void 0===a?0:a,u=r.shader,h=r.uniformSemantics;i.name=s,i.renderType=o,i.shaderSource=u,i.props=r,i.uniformSemantics=Ie({},h)}else i.name="Material"+Dr++,i.renderType=0;return i}_t(e,t);var r=e.prototype;return r.initialize=function(){},r.createShaderVariant=function(){},r.use=function(t,e){},se(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:"colorMask",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(fe),kr={format:rr.RGBA,type:rr.UNSIGNED_BYTE,minFilter:rr.LINEAR,magFilter:rr.LINEAR,wrapS:rr.CLAMP_TO_EDGE,wrapT:rr.CLAMP_TO_EDGE},zr=Symbol("dispose"),Ur=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}var e=t.prototype;return e.requestColorAttachmentTexture=function(t){var e=this,r=t.width,i=t.height,n=t.name,s={sourceType:exports.TextureSourceType.framebuffer,data:{width:r,height:i},name:n},a=[n];Object.getOwnPropertyNames(kr).forEach((function(e){var r,i=null!=(r=t[e])?r:kr[e];s[e]=i,a.push(e,i)}));var o=a.join(":"),u=this.textureCache[o];if(u)this.textureRef[o]++;else{var h=this.engine;N(h),u=ur.create(h,s),this.textureCache[o]=u,this.textureRef[o]=1,u[zr]=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 r=this.textureCache[t];r&&(r[zr](),r.dispose=r[zr]),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 r=t.textureCache[e];r[zr](),r.dispose=r[zr]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),Br=function(){function t(t){void 0===t&&(t={}),this.semantics=Ie({},t)}var e=t.prototype;return e.toObject=function(){return Ie({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var r=this.semantics[t];return Y(r)?r(e):r},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}(),Gr=((Fr={})[rr.FLOAT]=Float32Array.BYTES_PER_ELEMENT,Fr[rr.INT]=Int32Array.BYTES_PER_ELEMENT,Fr[rr.SHORT]=Int16Array.BYTES_PER_ELEMENT,Fr[rr.BYTE]=Int8Array.BYTES_PER_ELEMENT,Fr),jr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}_t(e,t);var r=e.prototype;return r.initialize=function(){},r.flush=function(){},e}(fe);function Xr(t){return t===rr.INT?new Int32Array(0):t===rr.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"}(Vr||(Vr={}));var Hr=function(){function t(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=r,this.z=i,this.order=n}var e=t.prototype;return e.set=function(t,e,r,i){return void 0===i&&(i=this.order),this.x=t,this.y=e,this.z=r,this.order=i,this},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 r=t.elements,i=r[0],n=r[4],s=r[8],a=r[1],o=r[5],u=r[9],h=r[2],c=r[6],l=r[10];switch(e){case Vr.XYZ:this.y=Math.asin(Ee(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(c,o),this.z=0);break;case Vr.YXZ:this.x=Math.asin(-Ee(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(s,l),this.z=Math.atan2(a,o)):(this.y=Math.atan2(-h,i),this.z=0);break;case Vr.ZXY:this.x=Math.asin(Ee(c,-1,1)),Math.abs(c)<.9999999?(this.y=Math.atan2(-h,l),this.z=Math.atan2(-n,o)):(this.y=0,this.z=Math.atan2(a,i));break;case Vr.ZYX:this.y=Math.asin(-Ee(h,-1,1)),Math.abs(h)<.9999999?(this.x=Math.atan2(c,l),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,o));break;case Vr.YZX:this.z=Math.asin(Ee(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,o),this.y=Math.atan2(-h,i)):(this.x=0,this.y=Math.atan2(s,l));break;case Vr.XZY:this.z=Math.asin(-Ee(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(c,o),this.y=Math.atan2(s,i)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=ge,this.y*=ge,this.z*=ge,this.order=e,this},e.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},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,r){var i,n,s,a;return void 0===e&&(e=0),void 0===r&&(r=this.order),this.x=null!=(i=t[e])?i:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(s=t[e+2])?s:0,this.order=null!=(a=t[e+3])?a:r,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 Re;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},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,r=e.x,i=e.y,n=e.z,s=e.order,a=Math.cos(r*ye*.5),o=Math.cos(i*ye*.5),u=Math.cos(n*ye*.5),h=Math.sin(r*ye*.5),c=Math.sin(i*ye*.5),l=Math.sin(n*ye*.5);switch(s){case Vr.XYZ:t.set(h*o*u+a*c*l,a*c*u-h*o*l,a*o*l+h*c*u,a*o*u-h*c*l);break;case Vr.YXZ:t.set(h*o*u+a*c*l,a*c*u-h*o*l,a*o*l-h*c*u,a*o*u+h*c*l);break;case Vr.ZXY:t.set(h*o*u-a*c*l,a*c*u+h*o*l,a*o*l+h*c*u,a*o*u-h*c*l);break;case Vr.ZYX:t.set(h*o*u-a*c*l,a*c*u+h*o*l,a*o*l-h*c*u,a*o*u+h*c*l);break;case Vr.YZX:t.set(h*o*u+a*c*l,a*c*u+h*o*l,a*o*l-h*c*u,a*o*u-h*c*l);break;case Vr.XZY:t.set(h*o*u-a*c*l,a*c*u-h*o*l,a*o*l+h*c*u,a*o*u+h*c*l);break;default:console.error("unknown euler order: "+s)}return t},e.toMatrix4=function(t){var e=t.elements,r=this,i=r.x,n=r.y,s=r.z,a=r.order,o=Math.cos(i*ye),u=Math.sin(i*ye),h=Math.cos(n*ye),c=Math.sin(n*ye),l=Math.cos(s*ye),f=Math.sin(s*ye);if(a===Vr.XYZ){var p=o*l,d=o*f,m=u*l,v=u*f;e[0]=h*l,e[4]=-h*f,e[8]=c,e[1]=d+m*c,e[5]=p-v*c,e[9]=-u*h,e[2]=v-p*c,e[6]=m+d*c,e[10]=o*h}else if(a===Vr.YXZ){var y=h*l,g=h*f,x=c*l,b=c*f;e[0]=y+b*u,e[4]=x*u-g,e[8]=o*c,e[1]=o*f,e[5]=o*l,e[9]=-u,e[2]=g*u-x,e[6]=b+y*u,e[10]=o*h}else if(a===Vr.ZXY){var T=h*l,E=h*f,_=c*l,A=c*f;e[0]=T-A*u,e[4]=-o*f,e[8]=_+E*u,e[1]=E+_*u,e[5]=o*l,e[9]=A-T*u,e[2]=-o*c,e[6]=u,e[10]=o*h}else if(a===Vr.ZYX){var C=o*l,S=o*f,w=u*l,R=u*f;e[0]=h*l,e[4]=w*c-S,e[8]=C*c+R,e[1]=h*f,e[5]=R*c+C,e[9]=S*c-w,e[2]=-c,e[6]=u*h,e[10]=o*h}else if(a===Vr.YZX){var O=o*h,M=o*c,P=u*h,I=u*c;e[0]=h*l,e[4]=I-O*f,e[8]=P*f+M,e[1]=f,e[5]=o*l,e[9]=-u*l,e[2]=-c*l,e[6]=M*f+P,e[10]=O-I*f}else if(a===Vr.XZY){var L=o*h,F=o*c,V=u*h,D=u*c;e[0]=h*l,e[4]=-f,e[8]=c*l,e[1]=L*f+D,e[5]=o*l,e[9]=F*f-V,e[2]=V*f-F,e[6]=u*l,e[10]=D*f+L}else console.error("toMatrix4: Invalid order "+a);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,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,r)},t.fromQuaternion=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,r)},t.fromVector3=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromVector3(e,r)},t.fromArray=function(e,r,i){return void 0===r&&(r=0),void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromArray(e,r,i)},t}();Hr.DEFAULT_ORDER=Vr.ZYX,Hr.tempQuat0=new Re,Hr.tempMat0=new Pe;var Wr=function(){function t(t,e,r,i,n,s,a,o,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=1),this.elements=[t,e,r,i,n,s,a,o,u]}var e=t.prototype;return e.set=function(t,e,r,i,n,s,a,o,u){var h=this.elements;return h[0]=t,h[3]=i,h[6]=a,h[1]=e,h[4]=n,h[7]=o,h[2]=r,h[5]=s,h[8]=u,this},e.setFromRowMajorData=function(t,e,r,i,n,s,a,o,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=r,h[1]=i,h[4]=n,h[7]=s,h[2]=a,h[5]=o,h[8]=u,this},e.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.z)},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 r=0;r<9;r++)this.elements[r]=t[e+r];return this},e.setFromQuaternion=function(t){var e=t.x,r=t.y,i=t.z,n=t.w,s=e+e,a=r+r,o=i+i,u=e*s,h=e*a,c=e*o,l=r*a,f=r*o,p=i*o,d=n*s,m=n*a,v=n*o,y=this.elements;return y[0]=1-(l+p),y[1]=h+v,y[2]=c-m,y[3]=h-v,y[4]=1-(u+p),y[5]=f+d,y[6]=c+m,y[7]=f-d,y[8]=1-(u+l),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 r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.elements,n=i[0],s=i[3],a=i[6],o=i[1],u=i[4],h=i[7];return i[0]=e*n+r*o,i[3]=e*s+r*u,i[6]=e*a+r*h,i[1]=-r*n+e*o,i[4]=-r*s+e*u,i[7]=-r*a+e*h,this},e.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[8],this},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 r=t.elements,i=e.elements,n=this.elements,s=r[0],a=r[3],o=r[6],u=r[1],h=r[4],c=r[7],l=r[2],f=r[5],p=r[8],d=i[0],m=i[3],v=i[6],y=i[1],g=i[4],x=i[7],b=i[2],T=i[5],E=i[8];return n[0]=s*d+a*y+o*b,n[3]=s*m+a*g+o*T,n[6]=s*v+a*x+o*E,n[1]=u*d+h*y+c*b,n[4]=u*m+h*g+c*T,n[7]=u*v+h*x+c*E,n[2]=l*d+f*y+p*b,n[5]=l*m+f*g+p*T,n[8]=l*v+f*x+p*E,this},e.determinant=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],s=t[4],a=t[7],o=t[2],u=t[5],h=t[8];return e*(s*h-u*a)+n*(u*i-r*h)+o*(r*a-s*i)},e.invert=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],s=t[4],a=t[7],o=t[2],u=t[5],h=t[8],c=h*s-u*a,l=u*i-h*r,f=a*r-s*i,p=e*c+n*l+o*f;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var d=1/p;return t[0]=c*d,t[1]=(o*a-h*n)*d,t[2]=(u*n-o*s)*d,t[3]=l*d,t[4]=(h*e-o*i)*d,t[5]=(o*r-u*e)*d,t[6]=f*d,t[7]=(n*i-a*e)*d,t[8]=(s*e-n*r)*d,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 r=t.x,i=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*r+s[3]*i+s[6]*n,a.y=s[1]*r+s[4]*i+s[7]*n,a.z=s[2]*r+s[5]*i+s[8]*n,a},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!be(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,r,i){return(new t).setFromColumnVectors(e,r,i)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,r,i,n,s,a,o,u,h){return new t(e,n,o,r,s,u,i,a,h)},t}(),Yr=function(){function t(t,e){void 0===t&&(t=Ae.ZERO),void 0===e&&(e=Ae.X),this.origin=new Ae,this.direction=new Ae,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 r=e||new Ae;return r.copyFrom(this.origin),r.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 r,i,n,s,a,o,u=this.origin,h=u.x,c=u.y,l=u.z,f=this.direction,p=f.x,d=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,A=1/p,C=1/d,S=1/m;if(A>=0?(r=(y-h)*A,i=(T-h)*A):(r=(T-h)*A,i=(y-h)*A),C>=0?(n=(g-c)*C,s=(E-c)*C):(n=(E-c)*C,s=(g-c)*C),!(r>s||n>i||((n>r||r!=r)&&(r=n),(s<i||i!=i)&&(i=s),(n>r||r!=r)&&(r=n),(s<i||i!=i)&&(i=s),S>=0?(a=(x-l)*S,o=(_-l)*S):(a=(_-l)*S,o=(x-l)*S),r>o||a>i||((a>r||r!=r)&&(r=a),(o<i||i!=i)&&(i=o),i<0))))return r>=0?this.at(r,e):this.at(i,e)},e.intersectPlane=function(t,e){var r=t.normal,i=t.distance,n=r.dot(this.direction);if(0===n)return 0===r.dot(this.origin)+i?(e||new Ae).copyFrom(this.origin):void 0;var s=-(this.origin.dot(r)+i)/n;return s>=0?this.at(s,e):void 0},e.intersectSphere=function(e,r){var i=e.center,n=t.tempVec0.subtractVectors(i,this.origin),s=n.dot(this.direction),a=n.dot(n)-s*s,o=e.radius*e.radius;if(!(a>o)){var u=Math.sqrt(o-a),h=s-u,c=s+u;if(!(c<0))return h>=0?this.at(h,r):this.at(c,r)}},e.intersectTriangle=function(e,r,i){var n,s=e.p0,a=e.p1,o=e.p2,u=t.tempVec0.subtractVectors(a,s),h=t.tempVec1.subtractVectors(o,s),c=t.tempVec2.subtractVectors(this.origin,s),l=t.tempVec3.crossVectors(u,h),f=this.direction.dot(l);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(c,h);var p=n*this.direction.dot(h);if(!(p<0)){u.cross(c);var d=n*this.direction.dot(u);if(!(d<0||p+d>f)){var m=-n*c.dot(l);if(!(m<0))return this.at(m/f,r)}}},t}();Yr.tempVec0=new Ae,Yr.tempVec1=new Ae,Yr.tempVec2=new Ae,Yr.tempVec3=new Ae;var Zr=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,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 r,i,n,s;return void 0===e&&(e=0),this.r=null!=(r=t[e])?r:0,this.g=null!=(i=t[e+1])?i:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(s=t[e+3])?s:0,this},e.setFromHSV=function(t,e,r,i){void 0===i&&(i=1);var n=r*e,s=t/60,a=n*(1-Math.abs(s%2-1)),o=0,u=0,h=0;s>=0&&s<=1?(o=n,u=a):s>=1&&s<=2?(o=a,u=n):s>=2&&s<=3?(u=n,h=a):s>=3&&s<=4?(u=a,h=n):s>=4&&s<=5?(o=a,h=n):s>=5&&s<=6&&(o=n,h=a);var c=r-n;return this.set(o+c,u+c,h+c,i)},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,r=parseInt(t.substring(3,5),16)/255,i=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,i,n)},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):a(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):a(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):a(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):a(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 Ce(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,r=e.r,i=e.g,n=e.b,s=e.a,a=Math.max(r,i,n),o=Math.min(r,i,n),u=a-o,h=0,c=0;return 0!==a&&(c=u/a),a!=o&&(a==r?(h=(i-n)/u,i<n&&(h+=6)):a==i?h=(n-r)/u+2:a==n&&(h=(r-i)/u+4),h*=60),new t(h,c,a,s)},e.toHexString=function(e){void 0===e&&(e=!0);var r=t.ToHex(Math.round(255*this.r)),i=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),s=t.ToHex(Math.round(255*this.a));return e?"#"+r+i+n+s:"#"+r+i+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,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,r,i,n){return void 0===n&&(n=1),(new t).setFromHSV(e,r,i,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();Zr.BLACK=new Zr(0,0,0,1),Zr.BLUE=new Zr(0,0,1,1),Zr.CLEAR=new Zr(0,0,0,0),Zr.CYAN=new Zr(0,1,1,1),Zr.GRAY=new Zr(.5,.5,.5,1),Zr.GREEN=new Zr(0,1,0,1),Zr.MAGENTA=new Zr(1,0,1,1),Zr.RED=new Zr(1,0,0,1),Zr.WHITE=new Zr(1,1,1,1),Zr.YELLOW=new Zr(1,.92,.016,1);var qr,Kr,Qr=function(){function t(t,e){void 0===t&&(t=new Ae(1/0,1/0,1/0)),void 0===e&&(e=new Ae(-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),r=Number(1/0),i=Number(1/0),n=-1/0,s=-1/0,a=-1/0,o=0,u=t.length;o<u;o+=3){var h=t[o],c=t[o+1],l=t[o+2];h<e&&(e=h),c<r&&(r=c),l<i&&(i=l),h>n&&(n=h),c>s&&(s=c),l>a&&(a=l)}return this.min.set(e,r,i),this.max.set(n,s,a),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),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 Ae),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 Ae),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 r=e.geometry;if(void 0!==r){null===r.boundingBox&&r.computeBoundingBox();var i=new t;i.copyFrom(r.boundingBox),i.applyMatrix4(e.matrixWorld),this.union(i)}for(var n=e.children,s=0,a=n.length;s<a;s++)this.expandByObject(n[s]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new Ae),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 Ae;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 Ae),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 Ae),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new Ae),this.isEmpty())return[];var r=[];return r[0]=new Ae(this.min.x,this.min.y,this.min.z),r[1]=new Ae(this.min.x,this.min.y,this.max.z),r[2]=new Ae(this.min.x,this.max.y,this.min.z),r[3]=new Ae(this.min.x,this.max.y,this.max.z),r[4]=new Ae(this.max.x,this.min.y,this.min.z),r[5]=new Ae(this.max.x,this.min.y,this.max.z),r[6]=new Ae(this.max.x,this.max.y,this.min.z),r[7]=new Ae(this.max.x,this.max.y,this.max.z),r.forEach((function(r){r.subtract(e),r.applyMatrix(t),r.add(e)})),r},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new Ae;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}(),Jr=function(){function t(t,e){void 0===t&&(t=Ae.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 r=this.center;if(void 0!==e){r.copyFrom(e);for(var i=0,n=0;n<t.length;n++)i=Math.max(i,r.distanceSquared(t[n]));this.radius=Math.sqrt(i)}else{var s=(new Qr).setFromPoints(t);s.getCenter(r),this.radius=s.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var r=this.center.distanceSquared(t);return void 0===e&&(e=new Ae),e.copyFrom(t),r>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 Qr),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){var e=t.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10],s=Math.sqrt(Math.max(r,i,n));return this.center.applyMatrix(t),this.radius=this.radius*s,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new Ae).subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=.5*(i-this.radius);this.center.add(e.multiply(n/i)),this.radius+=n}return this},e.union=function(t){var e=new Ae,r=new Ae;return r.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(r)),this.expandByPoint(e.copyFrom(t.center).subtract(r)),this},e.intersect=function(t){var e=(new Ae).subtractVectors(this.center,t.center),r=e.length();return r>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(r/2)),this.radius=this.radius+t.radius-r,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new t).copyFrom(this)},t}(),$r=Object.freeze({__proto__:null,get EulerOrder(){return Vr},Euler:Hr,Quaternion:Re,Vector2:_e,Vector3:Ae,Vector4:Ce,Matrix3:Wr,Matrix4:Pe,Ray:Yr,PI2:ve,DEG2RAD:ye,RAD2DEG:ge,NumberEpsilon:xe,isZero:function(t){return isNaN(t)||Math.abs(t)<xe},isEqual:be,damp:function(t,e,r,i){return Te(t,e,1-Math.exp(-r*i))},lerp:Te,degToRad:function(t){return t*ye},radToDeg:function(t){return t*ge},clamp:Ee,Color:Zr,Box3:Qr,Sphere:Jr}),ti=1,ei=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).destroyed=!1,i.visible=!0,r){var n=r.material,s=r.geometry,a=r.name,o=void 0===a?"<unnamed>":a,u=r.priority,h=void 0===u?0:u,c=r.worldMatrix,l=void 0===c?Pe.fromIdentity():c;i.id="Mesh"+ti++,i.name=o,i.geometry=s,i.material=n,i.priority=h,i.worldMatrix=l}else i.id="Mesh"+ti++,i.name="<unnamed>",i.worldMatrix=Pe.fromIdentity(),i._priority=0;return i}_t(e,t);var r=e.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){this.isDestroyed||this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(t,e){e!==exports.DestroyOptions.keep&&this.material.dispose(e),this.material=t},r.restore=function(){},r.dispose=function(t){if(!this.destroyed){(null==t?void 0:t.geometries)!==exports.DestroyOptions.keep&&this.geometry.dispose();var e=null==t?void 0:t.material;e!==exports.DestroyOptions.keep&&this.material.dispose(e),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},se(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(me),ri=1e3;exports.RenderPassAttachmentStorageType=void 0,(qr=exports.RenderPassAttachmentStorageType||(exports.RenderPassAttachmentStorageType={}))[qr.none=0]="none",qr[qr.color=1]="color",qr[qr.stencil_8_opaque=2]="stencil_8_opaque",qr[qr.depth_16_opaque=3]="depth_16_opaque",qr[qr.depth_stencil_opaque=4]="depth_stencil_opaque",qr[qr.depth_16_texture=5]="depth_16_texture",qr[qr.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",exports.TextureStoreAction=void 0,(Kr=exports.TextureStoreAction||(exports.TextureStoreAction={}))[Kr.store=0]="store",Kr[Kr.clear=2]="clear";var ii,ni=function(){function t(t,e){if(this.destroyed=!1,e){var r=e.texture,i=e.size;if(a(r,ur))this.texture=r,this.externalTexture=!0;else if(r){var n=r.wrapT,s=r.wrapS,o=r.minFilter,u=r.magFilter,h=r.internalFormat,c=r.format,l=void 0===c?rr.RGBA:c,f=r.type,p=void 0===f?rr.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:i,format:l,type:p,internalFormat:h||l,wrapT:n,wrapS:s,minFilter:o,magFilter:u,name:e.name},this.texture=ur.create(t,Ie({},this.textureOptions,{sourceType:exports.TextureSourceType.framebuffer,data:{width:i[0],height:i[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},se(t,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),t}();exports.RenderPassDestroyAttachmentType=void 0,(ii=exports.RenderPassDestroyAttachmentType||(exports.RenderPassDestroyAttachmentType={}))[ii.force=0]="force",ii[ii.keep=1]="keep",ii[ii.keepExternal=2]="keepExternal",ii[ii.destroy=0]="destroy";var si=1,ai=function(){function t(t,e){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=e.name,i=void 0===r?"RenderPass_"+si++:r,n=e.clearAction,s=e.semantics,a=e.depthStencilAttachment,o=e.storeAction,u=e.priority,h=void 0===u?0:u,c=e.meshOrder,l=void 0===c?exports.OrderType.ascending:c,f=e.meshes,p=void 0===f?[]:f,d=e.delegate,m=void 0===d?{}:d;this.name=i,this.renderer=t,this.priority=h,this.meshOrder=l,this.meshes=L(p.slice(),this.meshOrder),this.depthStencilType=(null==a?void 0:a.storageType)||0,this.clearAction=Ie({},n),this.storeAction=Ie({colorAction:0,depthAction:0,stencilAction:0},o),this.semantics=new Br(s),this.options=e,this.delegate=m,this.setViewportOptions(e)}var e=t.prototype;return e.addMesh=function(t){F(this.meshes,t,this.meshOrder)},e.removeMesh=function(t){g(this.meshes,t)},e.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),L(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(),r=e[0],i=e[1],n=e[2],s=e[3];t.setViewport(r,i,n,s)}},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 r=t.map((function(t){return t.updateSource({sourceType:exports.TextureSourceType.framebuffer}),new ni(e.renderer.engine,{texture:t})}));this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments=r,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,r=this,i=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var s=this.viewportScale,a=this.isCustomViewport?this.customViewport:[0,0,i.getWidth()*s,i.getHeight()*s],o=[a[2],a[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map((function(t,e){var i;return new ni(r.renderer.engine,Ie({size:o,name:(null==(i=t.texture)?void 0:i.name)||u+"##color_"+e},t))}));this.attachments=h;var c=Bi.create({storeAction:this.storeAction,name:u,viewport:a,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},i);c.bind(),c.unbind(),this.framebuffer=c}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 r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},e.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),r=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:r}}},e.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),r=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:r}}},e.getDepthTexture=function(t,e){if(!this.depthTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},e.getStencilTexture=function(t,e){if(!this.stencilTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},e.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.dispose=function(t){if(!this.destroyed){var e=(null==t?void 0:t.meshes)||void 0;e!==exports.DestroyOptions.keep&&this.meshes.forEach((function(t){t.dispose(e)})),this.meshes.length=0;var r=(null==t?void 0:t.colorAttachment)?t.colorAttachment:0;this.attachments.forEach((function(t){t.externalTexture&&2===r||1===r||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var i,n,s=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:0,a=this.framebuffer;if(a)if(a.dispose({depthStencilAttachment:s}),!(a.externalStorage&&2===s||1===s))null==(i=this.stencilTexture)||i.dispose(),null==(n=this.depthTexture)||n.dispose();this.options=this.renderer=null,this.initialize=Q}},se(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}(),oi="#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);}",ui="precision highp float;attribute vec2 atlasOffset;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(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,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}",hi="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(vParams.z==0.&&color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",ci="#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",li="#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}}",fi="#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}",pi="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",di="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);}",mi="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);}",vi="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);}",yi="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);}",gi="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);}",xi={},bi=function(){function t(){}return t.registerInclude=function(t,e){xi[t]&&j.warn('The "'+t+'" shader include already exist.'),xi[t]=e},t.unRegisterInclude=function(t){delete xi[t]},t.unRegisterAllIncludes=function(){Object.keys(xi).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var r=e.level,i=e.shaderType,n=e.shader,s=e.macros,a=e.removeVersion,o=t.genMacroString(r,s),u=t.genShaderVersion(r),h=t.parseIncludes(n),c=t.isVersion300(h);return h=t.removeWebGLVersion(h),2!==r||c||(h=t.convertTo300(h,i===exports.ShaderType.fragment)),a?o+h:u+o+h},t.convertTo300=function(e,r){if(e=(e=(e=e.replace(/\bvarying\b/g,r?"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,""),r){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 i=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);i&&(e=t.replaceMRTShader(e,i))}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 r;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(r=e.exec(t));){var i=r[1],n=xi[i];if(void 0===n)throw new Error("Can't find include shader name "+i);t=t.replace(r[0],n)}return t},t.genMacroString=function(t,e,r){void 0===r&&(r=!0);var i=[],n="WEBGL"+t;return i.push("#ifndef "+n),i.push("#define "+n),i.push("#endif"),r&&i.push("#define GE_RUNTIME"),e&&e.length&&e.forEach((function(t){var e=t[0],r=t[1];!0===r?i.push("#define "+e):Number.isFinite(r)&&i.push("#define "+e+" "+r)})),i.length?i.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 r=new Set,i="",n=0;n<e.length;n++){var s=e[n].match(/\bgl_FragData\[(.+?)\]/);s&&r.add(s[1])}return r.forEach((function(t){i+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"})),i+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,i)},t}(),Ti=function(t){function e(e,r){var i,n=(i=t.call(this,e,r)||this).renderer.engine,s=jr.create(n,{mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=Nr.create(n,{shader:{vertex:pi,fragment:gi,glslVersion:exports.GLSLVersion.GLSL1}});return a.blending=!1,a.depthTest=!1,a.culling=!1,i.screenMesh=ei.create(n,{geometry:s,material:a,priority:0}),i.priority=5e3,i}_t(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},r.execute=function(t){var e,r,i;t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var n=null!=(i=null==(r=t.renderingData.currentFrame.globalVolume)||null==(e=r.bloom)?void 0:e.threshold)?i:1;this.screenMesh.material.setFloat("_Threshold",n),t.renderMeshes([this.screenMesh])},e}(ai),Ei=function(t){function e(e,r,i){var n;(n=t.call(this,e,i)||this).type=r;var s=n.renderer.engine,a="PostProcess",o=jr.create(s,{name:a,mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u={vertex:pi,fragment:"H"==r?mi:vi,glslVersion:exports.GLSLVersion.GLSL1},h=Nr.create(s,{name:a,shader:u});return h.blending=!1,h.depthTest=!1,h.culling=!1,n.screenMesh=ei.create(s,{name:a,geometry:o,material:h,priority:0}),n.priority=5e3,n}_t(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",Ri(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFramebuffer().getColorTextures()[0])},e}(ai),_i=function(t){function e(e,r){var i,n="PostProcess",s=(i=t.call(this,e,r)||this).renderer.engine,a=jr.create(s,{name:n,mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o={vertex:pi,fragment:yi},u=Nr.create(s,{name:n,shader:o});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=ei.create(s,{name:n,geometry:a,material:u,priority:0}),i.priority=5e3,i}_t(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",Ri(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},e}(ai),Ai=function(t){function e(e,r){var i,n="PostProcess",s=(i=t.call(this,e,{})||this).renderer.engine;i.sceneTextureHandle=r||new ni(s);var a=jr.create(s,{name:n,mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=Nr.create(s,{name:n,shader:{vertex:pi,fragment:di,glslVersion:exports.GLSLVersion.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,i.screenMesh=ei.create(s,{name:n,geometry:a,material:o,priority:0}),i.priority=5e3,i}_t(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear});var e=t.renderingData.currentFrame.globalVolume,r=Ie({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),i=Ie({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=Ie({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),s=Ie({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(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),i.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",i.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",i.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",i.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new _e(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new Ae(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(s.active)),t.renderMeshes([this.screenMesh])},e}(ai),Ci="_effects_default_",Si=1,wi=function(){function t(t){var e;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var r=t.camera,i=t.keepColorBuffer,n=t.renderer,s=t.editorTransform,a=void 0===s?[1,1,0,0]:s,o=t.globalVolume,u=t.postProcessingEnabled,h=void 0!==u&&u,c=t.clearAction,l=void 0===c?{colorAction:exports.TextureLoadAction.whatever,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.whatever}:c,f=n.engine;o&&(this.globalVolume=o),this.globalUniforms=new Li;var p,d=[],m={};if(this.renderer=n,h){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");var v=rr.HALF_FLOAT;d=[{texture:{format:rr.RGBA,type:v,magFilter:rr.LINEAR,minFilter:rr.LINEAR}}],p={storageType:exports.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.clear}}this.drawObjectPass=new ai(n,{name:Ci,priority:ri,meshOrder:exports.OrderType.ascending,depthStencilAttachment:p,attachments:d,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),h){var g=new ni(f),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=new Array(7),T=rr.HALF_FLOAT,E=new Ti(n,{name:"BloomThresholdPass",attachments:[{texture:{format:rr.RGBA,type:T,minFilter:rr.LINEAR,magFilter:rr.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new ni(f);var A=new Ei(n,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:rr.RGBA,type:T,minFilter:rr.LINEAR,magFilter:rr.LINEAR}}]}),C=new Ei(n,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:rr.RGBA,type:T,minFilter:rr.LINEAR,magFilter:rr.LINEAR}}]});C.gaussianResult=b[_],this.addRenderPass(A),this.addRenderPass(C),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var S=0;S<6;S++){var w=new _i(n,{name:"GaussianUpPass"+S,viewport:x,attachments:[{texture:{format:rr.RGBA,type:T,minFilter:rr.LINEAR,magFilter:rr.LINEAR}}]});w.gaussianDownSampleResult=b[5-S],this.addRenderPass(w),x[2]*=2,x[3]*=2}var R=new Ai(n,g);this.addRenderPass(R)}this.semantics=new Br(t.semantics),this.clearAction=l,this.name="RenderFrame"+Si++;var O=y[0];this.emptyTexture=lr(f),this.transparentTexture=fr(f),this.camera=r,this.keepColorBuffer=i,this.renderPassInfoMap.set(O,{listStart:0,listEnd:0,renderPass:O,intermedia:!1}),this.editorTransform=Ce.fromArray(a),t.clearAction||this.resetClearActions(),this.passTextureCache=new Ur(f);var M=f.gpuCapability,P=M.detail,I=Sr(M.level,P.readableDepthStencilTextures&&P.writableFragDepth);null==(e=this.renderer.getShaderLibrary())||e.addShader(I)}var e=t.prototype;return e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose();var e,r,i=(null==t?void 0:t.passes)?t.passes:void 0;(i!==exports.DestroyOptions.keep&&this._renderPasses.forEach((function(t){t.dispose(i)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource)&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(r=this.resource.depthStencil)||null==(e=r.texture)||e.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null);this.destroyed=!0},e.resetRenderPassDefaultAttachment=function(t,e){for(var r,i=this.resource,n=i.color_a,s=i.color_b,a=e;a<t.length;a++){var o,u,h=t[a],c=null==(o=h.attachments[0])?void 0:o.texture;if(c&&r===c){var l=c===n?s:n;h.resetColorAttachments([l])}(c=null==(u=h.attachments[0])?void 0:u.texture)&&(r=c)}},e.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(Ci)||!r.meshes.includes(t)||(e=i,!1)})),e},e.addToRenderPass=function(t,e){var r=this.renderPassInfoMap.get(t),i=e.priority;r&&(0===t.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),t.addMesh(e))},e.getRPAttachments=function(t,e){if(1===(null==t?void 0:t.length)){var r,i=t[0],n=i.texture,s=i.persistent,a=n.format,o=null!=(r=null==e?void 0:e.getInitAttachments())?r:[];if(a===rr.RGBA&&!s){var u=this.resource.color_a;return 0===o.length?[{texture:u}]:[{texture:o[0].texture===u?this.resource.color_b:u}]}}return t},e.resetClearActions=function(){var t=this.renderPasses.length>1?exports.TextureLoadAction.clear:exports.TextureLoadAction.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=exports.TextureLoadAction.whatever)},e.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.createResource=function(){var t=this.renderer.engine;if(!this.resource){var e,r=t.gpuCapability,i=r.detail,n=r.level,s=this.renderer.getWidth(),a=this.renderer.getHeight(),o=2===n?rr.LINEAR:rr.NEAREST,u=ur.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:rr.RGBA,name:"frame_a",minFilter:o,magFilter:o}),h=ur.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:rr.RGBA,data:{width:s,height:a},minFilter:o,magFilter:o,name:"frame_b"}),c=i.readableDepthStencilTextures&&i.writableFragDepth?exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:exports.RenderPassAttachmentStorageType.depth_stencil_opaque,l=new ai(this.renderer,{depthStencilAttachment:{storageType:c},attachments:[{texture:u}]}).initialize(this.renderer),f=new Ii(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,colorAction:exports.TextureLoadAction.clear},meshOrder:exports.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(e=l.getDepthAttachment())?void 0:e.texture})]});this.resource={color_a:l.attachments[0].texture,color_b:h,finalCopyRP:f,depthStencil:l.depthAttachment,resRP:l}}},e.createCopyMesh=function(t){var e,r=Er,i=this.renderer.engine,n=jr.create(i,{name:r,mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=Sr(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(s);var a=Nr.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:r,shader:s});return a.blending=!1,a.depthTest=!1,a.culling=!1,(null==t?void 0:t.blend)&&(a.blending=!0,a.blendFunction=[rr.SRC_ALPHA,rr.ONE_MINUS_SRC_ALPHA,rr.SRC_ALPHA,rr.ONE_MINUS_SRC_ALPHA]),ei.create(i,{name:r,geometry:n,material:a,priority:0})},e.removeRenderPass=function(t){g(this._renderPasses,t)},se(t,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function Ri(t){return t?new _e(t.getWidth(),t.getHeight()):new _e}var Oi,Mi,Pi,Ii=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},r.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Ri(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(ai),Li=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Fi=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,r=t.format,i=t.attachment;this.storageType=e,this.format=r,this.attachment=i}return se(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Vi="function"==typeof e.WebGL2RenderingContext,Di=function(){function t(t){this.setupCapability(t)}var r=t.prototype;return r.setupCapability=function(t){var r,i=Vi&&a(t,e.WebGL2RenderingContext)?2:1,n=2===i,s=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),u=!!t.getExtension("OES_texture_half_float_linear"),h=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=n?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),n&&!u&&(u=Ni(t,t.HALF_FLOAT)),n&&!h&&(h=Ni(t,t.FLOAT)),this.internalFormatDepth16=n?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=n?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var c=n||t.getExtension("OES_texture_float")?t.FLOAT:0,l=n?e.WebGL2RenderingContext.HALF_FLOAT:(null==(r=t.getExtension("OES_texture_half_float"))?void 0:r.HALF_FLOAT_OES)||0,f={floatTexture:c,halfFloatTexture:l,maxSample:n?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:n?!!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:ki(t),halfFloatLinear:u,floatLinear:h,maxTextureAnisotropy:s?t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:n||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:n||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:n||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:n||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:n||!!o,writableFragDepth:n||!!t.getExtension("EXT_frag_depth")};this.detail=f,s&&(this.textureMaxAnisotropyExt=s.TEXTURE_MAX_ANISOTROPY_EXT)},r.framebufferTexture2D=function(t,e,r,i,n){var s=this.drawBufferExtension;if(1===this.level&&!s&&r>0)throw new Error("Draw multiple color buffers not available.");var a=s?s["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r];a?t.framebufferTexture2D(e,a,i,n,0):console.error("Invalid color attachment index: "+r+".")},r.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1!==this.level||r){var i=e.map((function(e,i){return e?r?r["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i]:t.NONE}));r?r.drawBuffersWEBGL(i):t.drawBuffers(i)}else if(e.length>1)throw new Error("Draw buffers not available.")},r.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function Ni(t,e){var r=t.createTexture(),i=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(i=!0),t.deleteTexture(r),i}function ki(t){return t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0}exports.COMPRESSED_TEXTURE=void 0,(Oi=exports.COMPRESSED_TEXTURE||(exports.COMPRESSED_TEXTURE={}))[Oi.NONE=0]="NONE",Oi[Oi.PVRTC=1]="PVRTC",Oi[Oi.ASTC=2]="ASTC",exports.FilterMode=void 0,(Mi=exports.FilterMode||(exports.FilterMode={}))[Mi.Nearest=0]="Nearest",Mi[Mi.Linear=1]="Linear",exports.RenderTextureFormat=void 0,(Pi=exports.RenderTextureFormat||(exports.RenderTextureFormat={}))[Pi.RGBA32=0]="RGBA32",Pi[Pi.RGBAHalf=1]="RGBAHalf";var zi,Ui,Bi=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,r,i){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},se(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),Gi=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,r,i){},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,r){},e.getTemporaryRT=function(t,e,r,i,n,s){return null},e.dispose=function(t){},t}(),ji=(zi=new Float32Array(1),Ui=new Int32Array(zi.buffer),function(t){zi[0]=t;var e=Ui[0],r=e>>16&32768,i=e>>12&2047,n=e>>23&255;return n<103?r:n>142?(r|=31744,r|=(255==n?0:1)&&8388607&e):n<113?r|=((i|=2048)>>114-n)+(i>>113-n&1):(r|=n-112<<10|i>>1,r+=1&i)}),Xi=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),r=0;r<e.length;r++)e[r]=ji(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=ji(t[r])},t}();var Hi,Wi=new Hr,Yi=new Pe;function Zi(t,e,r,i,n,s,a){var o=t,u=i/n,h=i,c=e.speedOverLifetime;c&&(h=c.getIntegrateValue(0,i,n));var l=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;o.copyFrom(s),o.addScaledVector(a,h),o.addScaledVector(r,l);var f=e.linearVelOverLifetime||{},p=e.orbitalVelOverLifetime||{};if(p.enabled){var d=new Ae;p.center&&d.setFromArray(p.center);var m=o.clone().subtract(d),v=p.asRotation,y=["x","y","z"].map((function(t){var e=p[t];return e?v?e.getValue(u):e.getIntegrateValue(0,i,n):0}));Wi.setFromArray(y).negate(),Yi.setFromEuler(Wi);var g=Yi.transformPoint(m);o.addVectors(d,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,i,n);o.x=o.x+_}if(T){var A=x?T.getValue(u):T.getIntegrateValue(0,i,n);o.y=o.y+A}if(E){var C=x?E.getValue(u):E.getIntegrateValue(0,i,n);o.z=o.z+C}}return o}function qi(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function Ki(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function Qi(t,e,r){if(e&&r)for(var i=0,n=e.length;i<n;i++)t[i]=e[i]*r[i];else if(e){if(t!==e)for(var s=0;s<e.length;s++)t[s]=e[s]}else if(r&&t!==r)for(var a=0;a<r.length;a++)t[a]=r[a];return t}var Ji=((Hi={})[gt.PARTICLE_ORIGIN_CENTER]=[0,0],Hi[gt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Hi[gt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Hi[gt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Hi[gt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Hi[gt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Hi[gt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Hi[gt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Hi[gt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Hi);function $i(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function tn(t,e,r){var i=r.position,n=new Ae(t,e,0),s=new Ae;return r.getInverseViewProjectionMatrix().projectPoint(n,s),s.subtract(i),new Yr(i,s)}function en(t,e,r){var i=t.x,n=t.y,s=t.z,a=new Ae(i-e,n+r,s),o=new Ae(i-e,n-r,s),u=new Ae(i+e,n-r,s),h=new Ae(i+e,n+r,s);return[{p0:a,p1:o,p2:u},{p0:a.clone(),p1:u.clone(),p2:h}]}function rn(t,e,r){return void 0===r&&(r=1e-6),Math.abs(t-e)<r}function nn(t,e){void 0===e&&(e=2);var r=Math.pow(10,e);return Math.floor(t*r)/r}var sn={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],r=this.getPointIndexInCurve(t,this.pointIndexCache),i=r.xIndex,n=r.yIndex,s=e[i],a=e[n];return new _e(s,a)},getPointIndexInCurve:function(t,e){var r=t[0],i=t[2],n=r===St.LINE||r===St.EASE_OUT?0:r===St.EASE_IN||r===St.EASE||r===St.HOLD&&i===St.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 r=t[2];return!(e!==St.HOLD||!this.isKeyframeTypeLeftSideEase(r))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var r=t[2];return!(e!==St.HOLD||!this.isKeyframeTypeRightSideEase(r))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[St.EASE,St.EASE_IN,St.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[St.EASE,St.EASE_OUT,St.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var r=t[2];return e===St.HOLD&&[St.HOLD,St.LINE_OUT,St.EASE_OUT].includes(r)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var r=t[2];return e===St.HOLD&&[St.HOLD,St.LINE,St.EASE_IN].includes(r)}},an=function(t,e){this.points=t,this.totalLength=e},on={},un={},hn=.1;function cn(t,e){return 1-3*e+3*t}function ln(t,e){return 3*e-6*t}function fn(t){return 3*t}function pn(t,e,r){return((cn(e,r)*t+ln(e,r))*t+fn(e))*t}function dn(t,e,r){return 3*cn(e,r)*t*t+2*ln(e,r)*t+fn(e)}var mn=function(){function t(t,e,r,i){this.p1=t,this.p2=e,this.p3=r,this.p4=i,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,r,i){var n=nn(e.x-t.x,3)+"_"+nn(e.y-t.y,3)+"_"+nn(e.z-t.z,3)+"&"+nn(r.x-t.x,3)+"_"+nn(r.y-t.y,3)+"_"+nn(r.z-t.z,3)+"&"+nn(i.x-t.x,3)+"_"+nn(i.y-t.y,3)+"_"+nn(i.z-t.z,3);if(un[n])return{data:un[n],interval:t};for(var s=[],a=null,o=0,u=0,h=0;h<300;h+=1){var c=new Ae,l=h/299;u=0,c.x=3*Math.pow(1-l,2)*l*(r.x-t.x)+3*(1-l)*Math.pow(l,2)*(i.x-t.x)+Math.pow(l,3)*(e.x-t.x),c.y=3*Math.pow(1-l,2)*l*(r.y-t.y)+3*(1-l)*Math.pow(l,2)*(i.y-t.y)+Math.pow(l,3)*(e.y-t.y),c.z=3*Math.pow(1-l,2)*l*(r.z-t.z)+3*(1-l)*Math.pow(l,2)*(i.z-t.z)+Math.pow(l,3)*(e.z-t.z),null!==a&&(u+=Math.pow(c.x-a.x,2),u+=Math.pow(c.y-a.y,2),u+=Math.pow(c.z-a.z,2)),a=c,o+=u=Math.sqrt(u),s[h]={partialLength:u,point:c}}var f=new an(s,o);return un[n]=f,{data:f,interval:new Ae(t.x,t.y,t.z)}}(t,e,r,i),s=n.data,a=n.interval;this.lengthData=s,this.interval=a,this.totalLength=s.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(rn(1-t,0))return e.points[299].point.clone().add(this.interval);if(rn(e.totalLength,0))return this.p1.clone();var r=new Ae,i=nn(e.totalLength*t,4),n=this.catching.lastAddedLength,s=this.catching.lastPoint;if(rn(n,i))return e.points[s].point.clone().add(this.interval);var a=!0,o=1;for(i<n&&(o=-1);a;){if(i>=n){if(299===s){r.x=e.points[s].point.x,r.y=e.points[s].point.y,r.z=e.points[s].point.z;break}if(i<n+e.points[s+1].partialLength){var u=(i-n)/e.points[s+1].partialLength;r.x=e.points[s].point.x+(e.points[s+1].point.x-e.points[s].point.x)*u,r.y=e.points[s].point.y+(e.points[s+1].point.y-e.points[s].point.y)*u,r.z=e.points[s].point.z+(e.points[s+1].point.z-e.points[s].point.z)*u;break}}o>0&&s<299?(s+=o,n+=nn(e.points[s].partialLength,5)):o<0&&s>0?(n-=nn(e.points[s].partialLength,5),s+=o):a=!1}return this.catching.lastPoint=s,this.catching.lastAddedLength=n,r.add(this.interval),r},t}(),vn=function(){function t(t,e,r,i){this.p1=t,this.p2=e,this.p3=r,this.p4=i,this.temp=new Re,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):rn(1-t,0)?this.temp.copyFrom(this.p2):(xn.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),yn=function(){function t(t,e,r,i){this.mX1=t,this.mY1=e,this.mX2=r,this.mY2=i,this.precomputed=!1,this.mSampleValues=new Array(11)}var e=t.prototype;return e.precompute=function(){this.precomputed=!0,this.mX1===this.mY1&&this.mX2===this.mY2||this.calcSampleValues()},e.getValue=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:isNaN(this.mY1)||isNaN(this.mY2)?0:0===t||1===t?t:(this.precomputed||this.precompute(),pn(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=pn(t*hn,this.mX1,this.mX2)},e.getTForX=function(t){for(var e=this.mSampleValues,r=0,i=1;10!==i&&e[i]<=t;++i)r+=hn;var n=r+(t-e[--i])/(e[i+1]-e[i])*hn,s=dn(n,this.mX1,this.mX2);return s>=.001?function(t,e,r,i){for(var n=0;n<4;++n){var s=dn(e,r,i);if(0===s)return e;e-=(pn(e,r,i)-t)/s}return e}(t,n,this.mX1,this.mX2):0===s?n:function(t,e,r,i,n){var s,a,o=0;do{(s=pn(a=e+(r-e)/2,i,n)-t)>0?r=a:e=a}while(Math.abs(s)>1e-7&&++o<10);return a}(t,r,r+hn,this.mX1,this.mX2)},t}();function gn(t,e){var r=function(t,e,r){var i=t[1],n=sn.isHoldOutKeyframe(t),s=sn.isHoldInKeyframe(e),a=!s&&sn.isRightSideEase(t),o=!n&&sn.isLeftSideEase(e);if(a&&!o&&!s){var u=new _e(i[i.length-4],i[i.length-3]),h=new _e(i[i.length-2],i[i.length-1]),c=sn.getPointInCurve(e),l=new _e(c.x,c.y);return{type:"ease",p0:u,p1:h,p2:new _e(l.x-(l.x-u.x)/10,l.y),p3:l}}if(!a&&o&&!n){var f=e[1],p=sn.getPointInCurve(t),d=new _e(p.x,p.y),m=new _e(f[0],f[1]),v=new _e(f[2],f[3]);return{type:"ease",p0:d,p1:new _e(d.x+(v.x-d.x)/10,d.y),p2:m,p3:v}}if(a&&o){var y=e[1];return{type:"ease",p0:new _e(i[i.length-4],i[i.length-3]),p1:new _e(i[i.length-2],i[i.length-1]),p2:new _e(y[0],y[1]),p3:new _e(y[2],y[3])}}var g=sn.getPointInCurve(t),x=sn.getPointInCurve(e);n?x.y=g.y:s&&(g.y=x.y);return r?{type:"ease",p0:g,p1:new _e((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new _e((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||s,leftHoldLine:n,rightHoldLine:s}:{type:"line",p0:g,p1:x,isHold:n||s,leftHoldLine:n,rightHoldLine:s}}(t,e,!0),i=r.p0,n=r.p1,s=r.p2,a=r.p3;N(s),N(a);var o,u,h=a.x-i.x,c=a.y-i.y,l=nn((n.x-i.x)/h,5),f=nn((s.x-i.x)/h,5);rn(c,0)?o=u=NaN:(o=nn((n.y-i.y)/c,5),u=nn((s.y-i.y)/c,5)),l<0&&(console.error("Invalid bezier points, x1 < 0",i,n,s,a),l=0),f<0&&(console.error("Invalid bezier points, x2 < 0",i,n,s,a),f=0),l>1&&(console.error("Invalid bezier points, x1 >= 1",i,n,s,a),l=1),f>1&&(console.error("Invalid bezier points, x2 >= 1",i,n,s,a),f=1);var p,d=("bez_"+l+"_"+o+"_"+f+"_"+u).replace(/\./g,"p");return on[d]?p=on[d]:(p=new yn(l,o,f,u),on[d]=p),{points:[i,n,s,a],timeInterval:h,valueInterval:c,curve:p}}var xn=function(){function t(){}return t.slerpFlat=function(t,e,r,i){var n=e.x,s=e.y,a=e.z,o=e.w,u=r.x,h=r.y,c=r.z,l=r.w;if(0===i)return t.x=n,t.y=s,t.z=a,void(t.w=o);if(1===i)return t.x=u,t.y=h,t.z=c,void(t.w=l);if(o!==l||n!==u||s!==h||a!==c){var f=1-i,p=n*u+s*h+a*c+o*l,d=p>=0?1:-1,m=1-p*p;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,p*d);f=Math.sin(f*y)/v,i=Math.sin(i*y)/v}var g=i*d;if(n=n*f+u*g,s=s*f+h*g,a=a*f+c*g,o=o*f+l*g,f===1-i){var x=1/Math.sqrt(n*n+s*s+a*a+o*o);n*=x,s*=x,a*=x,o*=x}}t.x=n,t.y=s,t.z=a,t.w=o},t}(),bn="not_implement",Tn=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(bn)},e.getIntegrateValue=function(t,e,r){throw new Error(bn)},e.getIntegrateByTime=function(t,e){throw new Error(bn)},e.getValue=function(t){throw new Error(bn)},e.getMaxTime=function(){throw new Error(bn)},e.toUniform=function(t){throw new Error(bn)},e.map=function(t){throw new Error(bn)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(bn)},t.getAllData=function(t,e){for(var r=new(e?Xi:Float32Array)(4*t.index),i=0,n=0,s=t.curves;i<s.length;i++){var a=s[i].toData();r.set(a,n),n+=a.length}return e?r.data:r},t}(),En=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.value=t},r.getIntegrateValue=function(t,e,r){return this.value*(e-t)},r.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},r.getValue=function(t){return this.value},r.toUniform=function(){return new Float32Array([0,this.value,0,0])},r.map=function(t){var e=this.value;return this.value=t(e),this},r.getMaxTime=function(){return 0},e}(Tn),_n=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.items=t},r.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},r.map=function(t){return this.items=this.items.map(t),this},e}(Tn),An=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t,e){var r=null!=e?e:Math.random();return this.min+r*(this.max-this.min)},r.getIntegrateValue=function(t,e,r){var i=null!=r?r:1;return(this.min+i*(this.max-this.min))*(e-t)},r.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(Tn),Cn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t){for(var e=this.min,r=this.max,i=[],n=0;n<e.length;n++){var s=Math.random();i[n]=e[n]*(1-s)+r[n]*s}return i},r.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(Tn),Sn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},r.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},r.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=this.min,n=this.max,s=this.xCoord*r;return((i+e/s*(n-i)+i)*e-(i+t/s*(n-i)+i)*t)/2},r.getIntegrateByTime=function(t,e){return Fn(e,0,this.xCoord,this.min,this.max)-Fn(t,0,this.xCoord,this.min,this.max)},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},r.scaleXCoord=function(t){return this.xCoord=t,this},e}(Tn),wn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.stops=E(t)},r.getStops=function(){return this.stops},r.getValue=function(t){for(var e=this.stops,r=e.length-1,i=0;i<r;i++){var n=e[i],s=e[i+1];if(n.stop<=t&&s.stop>t){var a=(t-n.stop)/(s.stop-n.stop);return _(n.color,s.color,a,!0)}}return e[r].color.slice()},e}(Tn),Rn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},r.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var r=e.length-1,i=0;i<r;i++){var n=e[i],s=e[i+1],a=n[0],o=s[0];if(t>=a&&t<=o){var u=(t-a)/(o-a),h=n[1];return h+u*(s[1]-h)}}return e[r][1]},r.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},r.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},r.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,s=e?Fn:Ln,a=0;a<n;a++){var o=r[a],u=r[a+1],h=o[0],c=u[0];if(t>h&&t<=c)return i+s(t,h,c,o[1],u[1]);i+=s(c,h,c,o[1],u[1])}return i},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),r=0,i=0;r<t.length;r++,i+=2)e.set(t[r],i);return e.set(t[t.length-1],e.length-2),e},r.toUniform=function(t){var e=t.index,r=this.keys,i=Math.ceil(r.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},r.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},r.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(Tn),On=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t;this.curveMap={},this.keys=[];for(var r=0;r<e.length-1;r++){var i=gn(e[r],e[r+1]),n=i.points,s=i.curve,a=i.timeInterval,o=i.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())),this.curveMap[u.x+"&"+h.x]={points:n,timeInterval:a,valueInterval:o,curve:s,timeStart:Number(u.x),timeEnd:Number(h.x)}}this.startKeyframe=e[0],this.endKeyframe=e[e.length-1],this.keyTimeData=Object.keys(this.curveMap)},r.getValue=function(t){var e=0,r=this.keyTimeData,i=this.curveMap[r[0]].timeStart,n=this.curveMap[r[r.length-1]].timeEnd;if(t<=i)return sn.getPointIndexInCurve(this.startKeyframe,sn.pointIndexCache),this.startKeyframe[1][sn.pointIndexCache.yIndex];if(t>=n)return sn.getPointIndexInCurve(this.endKeyframe,sn.pointIndexCache),this.endKeyframe[1][sn.pointIndexCache.yIndex];for(var s=0;s<r.length;s++){var a=this.curveMap[r[s]].timeStart,o=this.curveMap[r[s]].timeEnd;if(t>=Number(a)&&t<Number(o)){e=this.getCurveValue(r[s],t);break}}return e},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=(e-t)/r,n=0,s=Object.keys(this.curveMap);if(i<=this.curveMap[s[0]].timeStart)return 0;for(var a=0;a<s.length;a++){var o=this.curveMap[s[a]].timeStart,u=this.curveMap[s[a]].timeEnd;if(i>=Number(u)&&(n+=r*this.getCurveIntegrateValue(s[a],Number(u))),i>=Number(o)&&i<Number(u)){n+=r*this.getCurveIntegrateValue(s[a],i);break}}return n},r.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},r.getCurveIntegrateValue=function(t,e){for(var r=this.curveMap[t],i=r.points[0],n=r.timeInterval,s=r.valueInterval,a=0,o=(e-i.x)/20,u=0;u<=20;u++){var h=u*o/n,c=i.y+s*r.curve.getValue(h);a+=0===u||20===u?c:u%2==1?4*c:2*c}return a*=o/3},r.getCurveValue=function(t,e){var r=this.curveMap[t],i=r.points[0],n=r.timeInterval,s=r.valueInterval,a=(e-i.x)/n,o=r.curve.getValue(a);return i.y+s*o},r.toUniform=function(t){var e=t.index,r=this.keys.length;return t.curves.push(this),t.index=e+r,t.max=Math.max(t.max,r),t.curveCount+=r,new Float32Array([5,e+1/r,e,r])},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4)e.set(t[r],i);return e},r.getMaxTime=function(){var t=this.keyTimeData;return this.curveMap[t[t.length-1]].timeEnd},e}(Tn),Mn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t[0],this.values=t[1]},r.getValue=function(t){for(var e=this.keys,r=this.values,i=0;i<e.length-1;i++){var n=e[i],s=e[i+1];if(n[0]<=t&&s[0]>=t){var a=s[1]-n[1],o=void 0;if(0===a)o=(t-n[0])/(s[0]-n[0]);else o=(Vn(t,n,s)-n[1])/a;return this.calculateVec(i,o)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},r.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=[0,0,0],s=0;s<r.length;s++)n[s]=r[s]*(1-e)+i[s]*e;return n},e}(Tn),Pn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t[0],r=t[1],i=t[2];if(this.curveSegments={},i.length){for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1],o=new Ae(r[n][0],r[n][1],r[n][2]),u=new Ae(r[n+1][0],r[n+1][1],r[n+1][2]),h=new Ae(i[2*n][0],i[2*n][1],i[2*n][2]),c=new Ae(i[2*n+1][0],i[2*n+1][1],i[2*n+1][2]),l=gn(s,a),f=l.points,p=l.curve,d=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new mn(o,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:d,valueInterval:m,easingCurve:p,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},r.getValue=function(t){var e=nn(t,5),r=0,i=new Ae,n=this.keyTimeData;if(!n.length)return i;var s=this.curveSegments[n[0]].timeStart,a=this.curveSegments[n[n.length-1]].timeEnd;if(e<=s)return i=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=a)return i=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 c=this.curveSegments[n[o]].pathCurve;r=this.getPercValue(n[o],e),i=c.getPointInPercent(r)}}return i},r.getPercValue=function(t,e){var r=this.curveSegments[t],i=r.points[0],n=r.timeInterval,s=nn((e-i.x)/n,4);return Ee(r.easingCurve.getValue(s),0,1)},r.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(Tn),In=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t[0],r=t[1],i=t[2];if(this.curveSegments={},i.length)for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1],o=Re.fromArray(r[n]),u=Re.fromArray(r[n+1]),h=Re.fromArray(i[2*n]),c=Re.fromArray(i[2*n+1]),l=gn(s,a),f=l.points,p=l.curve,d=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new vn(o,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:d,valueInterval:m,easingCurve:p,pathCurve:g}}},r.getValue=function(t){var e=0,r=nn(t,5),i=Object.keys(this.curveSegments),n=Number(i[0].split("&")[0]),s=Number(i[i.length-1].split("&")[1]);if(r<=n)return this.curveSegments[i[0]].pathCurve.getPointInPercent(0);if(r>=s)return this.curveSegments[i[i.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<i.length;a++){var o=i[a].split("&"),u=o[0],h=o[1];if(r>=Number(u)&&r<Number(h)){var c=this.curveSegments[i[a]].pathCurve;return e=this.getPercValue(i[a],r),c.getPointInPercent(e)}}return this.curveSegments[i[0]].pathCurve.getPointInPercent(0)},r.getPercValue=function(t,e){var r=this.curveSegments[t],i=r.points[0],n=r.timeInterval,s=nn((e-i.x)/n,4);return Ee(r.easingCurve.getValue(s),0,1)},r.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(Tn);function Ln(t,e,r,i,n){var s=t-e;return(i+i+(n-i)*s/(r-e))*s/2}function Fn(t,e,r,i,n){var s=t*t,a=e*e;return(2*(s*t)*(i-n)+3*s*(e*n-r*i)-a*e*(2*i+n)+3*a*r*i)/(6*(e-r))}function Vn(t,e,r){var i=r[0]-e[0],n=e[3]*i,s=r[2]*i,a=(t-e[0])/i,o=a*a,u=o*a,h=u-2*o+a,c=u-o,l=-2*u+3*o;return(2*u-3*o+1)*e[1]+h*n+c*s+l*r[1]}function Dn(t,e){if(e){var r=e[0],i=e[1];if(r===Ct.CURVE){t.curves.push(i);var n=i.length;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(r===Ct.LINE){var s=i.length;if(2===s&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&s++,i[i.length-1][0]<1&&s++;var a=Math.ceil(s/2);t.lineSegCount+=a,t.curves.push(i),t.index+=a,t.max=Math.max(t.max,a)}else if(r===Ct.BEZIER_CURVE){var o=i.length-1;t.index+=2*o,t.curves.push(i),t.max=Math.max(t.max,2*o),t.curveCount+=2*o}}}function Nn(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function kn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(kn=function(){return!!t})()}function zn(t,e,r){return zn=kn()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&Et(n,r.prototype),n},zn.apply(null,arguments)}var Un,Bn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Ce,e}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.xCurve=Yn(t[0]),this.yCurve=Yn(t[1]),this.zCurve=Yn(t[2]),this.wCurve=Yn(t[3])},r.getValue=function(t){var e=this.xCurve.getValue(t),r=this.yCurve.getValue(t),i=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,r,i,n),this.value},e}(Tn),Gn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new _e,e}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.xCurve=Yn(t[0]),this.yCurve=Yn(t[1])},r.getValue=function(t){var e=this.xCurve.getValue(t),r=this.yCurve.getValue(t);return this.value.set(e,r),this.value},e}(Tn),jn=6,Xn="editor",Hn={"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"},Wn=((Un={})[Ct.RANDOM]=function(t){return a(t[0],Array)?new Cn(t):new An(t)},Un[Ct.CONSTANT]=function(t){return new En(t)},Un[Ct.CONSTANT_VEC2]=function(t){return new En(t)},Un[Ct.CONSTANT_VEC3]=function(t){return new En(t)},Un[Ct.CONSTANT_VEC4]=function(t){return new En(t)},Un[Ct.RGBA_COLOR]=function(t){return new En(t)},Un[Ct.COLORS]=function(t){return new _n(t.map((function(t){return b(t,!1)})))},Un[Ct.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Sn([t[0][1],t[1][1]]):new Rn(t)},Un[Ct.GRADIENT_COLOR]=function(t){return new wn(t)},Un[Ct.LINEAR_PATH]=function(t){return new Mn(t)},Un[Ct.BEZIER_CURVE]=function(t){return 1===t.length?new En(t[0][1][1]):new On(t)},Un[Ct.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new En(zn(Ae,[].concat(t[1][0]))):new Pn(t)},Un[Ct.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new En(zn(Re,[].concat(t[1][0]))):new In(t)},Un[Ct.COLOR_CURVE]=function(t){return new Zn(t)},Un[Ct.VECTOR4_CURVE]=function(t){return new Bn(t)},Un[Ct.VECTOR2_CURVE]=function(t){return new Gn(t)},Un);function Yn(t){if(!t||!isNaN(+t))return new En(t||0);if(a(t,Tn))return t;if(Y(Wn[t[0]]))return Wn[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+Hn["ValueType: 21/22 is not supported"]+".")}var Zn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Zr,e}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.rCurve=Yn(t[0]),this.gCurve=Yn(t[1]),this.bCurve=Yn(t[2]),this.aCurve=Yn(t[3])},r.getValue=function(t){var e=this.rCurve.getValue(t),r=this.gCurve.getValue(t),i=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,r,i,n),this.value},e}(Tn),qn=function(t){function e(e){var r;(r=t.call(this,e)||this).cachePrefix="-",r.color=[1,1,1,1],r.visible=!0,r.isManualTimeSet=!1,r.frameAnimationTime=0,r.getHitTestParams=function(t){var e=r.interaction;if(t||e){var i,n=r.getBoundingBox();if(n)return{behavior:(null==(i=r.interaction)?void 0:i.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:r.renderer.side===ct.FRONT}}},r.renderer={renderMode:yt.MESH,blending:ht.ALPHA,texture:r.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:ct.DOUBLE,mask:0,maskMode:lt.NONE,order:0},r.emptyTexture=r.engine.emptyTexture,r.renderInfo=Kn(we(r));var i=r.createMaterial(r.renderInfo,2);return r.worldMatrix=Pe.fromIdentity(),r.material=i,r.material.setColor("_Color",(new Zr).setFromArray([1,1,1,1])),r.material.setVector4("_TexOffset",(new Ce).setFromArray([0,0,1,1])),r}_t(e,t);var r=e.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){this.color=t,this.material.setColor("_Color",(new Zr).setFromArray(t))},r.setTexture=function(t){var e=this;return i((function(){var r;return h(this,(function(i){switch(i.label){case 0:return"string"!=typeof t?[3,2]:[4,ur.fromImage(t,e.item.engine)];case 1:return r=i.sent(),[3,3];case 2:r=t,i.label=3;case 3:return e.renderer.texture=r,e.material.setTexture("_MainTex",r),[2]}}))}))()},r.setAnimationTime=function(t){this.frameAnimationTime=t,this.isManualTimeSet=!0},r.render=function(t){if(this.getVisible()){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.setVector2("_Size",this.transform.size),this.renderer.renderMode!==yt.BILLBOARD&&this.renderer.renderMode!==yt.VERTICAL_BILLBOARD&&this.renderer.renderMode!==yt.HORIZONTAL_BILLBOARD||this.material.setVector3("_Scale",this.transform.scale),t.drawGeometry(r,e)}},r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},r.getItemInitData=function(){this.geoData=this.getItemGeometryData();var t=this.geoData,e=t.index,r=t.atlasOffset,i=e.length,n=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new e.constructor(i);if(!this.wireframe)for(var s=0;s<i;s++)n[s]=0+e[s];return{atlasOffset:r,index:n}},r.setItem=function(){var t=this.renderer.texture;t&&y([],t),t=this.renderer.texture;var e=this.getItemInitData(),r=this.renderer,i=this.material.getVector4("_TexParams");i&&(i.x=r.occlusion?+r.transparentOcclusion:1,i.y=+this.preMultiAlpha,i.z=r.renderMode,0===i.x?this.material.enableMacro("ALPHA_CLIP"):this.material.disableMacro("ALPHA_CLIP"));var n={atlasOffset:new Float32Array(e.atlasOffset.length),index:new Uint16Array(e.index.length)};n.atlasOffset.set(e.atlasOffset),n.index.set(e.index);var s=this.material,a=this.geometry,o=n.index;a.setIndexData(o),a.setAttributeData("atlasOffset",n.atlasOffset),a.setDrawCount(e.index.length),s.setTexture("_MainTex",t)},r.getItemGeometryData=function(){var t=this.renderer;if(t.shape){for(var e=t.shape,r=e.index,i=void 0===r?[]:r,n=e.aPoint,s=void 0===n?[]:n,a=new Float32Array(s),o=[],u=[],h=0;h<a.length;h+=6)u.push(s[h+2],s[h+3]),o.push(a[h],a[h+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(o)),{index:i,atlasOffset:u}}return this.geometry.setAttributeData("aPos",new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])),{index:[0,1,2,2,1,3],atlasOffset:[0,1,0,0,1,1,1,0]}},r.createGeometry=function(t){return jr.create(this.engine,{attributes:{aPos:{type:rr.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},atlasOffset:{size:2,offset:0,releasable:!0,type:rr.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:4})},r.getMaterialProps=function(t,e){return{shader:Ho(t,e,1)}},r.createMaterial=function(t,e){var r=t.side,i=t.occlusion,n=t.blending,s=t.maskMode,a=t.mask,o=this.getMaterialProps(t,e);this.preMultiAlpha=wr(n);var u=Nr.create(this.engine,o),h={side:r,blending:!0,blendMode:n,mask:a,maskMode:s,depthTest:!0,depthMask:i};return u.blending=h.blending,u.stencilRef=void 0!==h.mask?[h.mask,h.mask]:void 0,u.depthTest=h.depthTest,u.depthMask=h.depthMask,Rr(u,h.blendMode),Mr(u,h.maskMode),Or(u,h.side),u.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',u.hasUniform("_Color")||u.setColor("_Color",new Zr(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new Ce),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new Ce),u},r.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},r.getBoundingBox=function(){if(this.item){var t=this.transform.getWorldMatrix(),e=en(Ae.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:exports.HitTestType.triangle,area:e}}},e}(me);function Kn(t){var e=t.renderer,r=e.blending,i=e.side,n=e.occlusion,s=e.mask,a=e.maskMode,o=e.order,u=+r,h=t.cachePrefix||"-";return{side:i,occlusion:n,blending:r,mask:s,maskMode:a,cachePrefix:h,cacheId:h+"."+ +i+"+"+ +n+"+"+u+"+"+o+"+"+a+"."+s}}var Qn=function(){},Jn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},$n={exports:{}};!function(t){var e;function r(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(t,e,r){var i=e.b-t.b,n=r.b-e.b;return 0<i+n?i<n?e.a-t.a+i/(i+n)*(t.a-r.a):e.a-r.a+n/(i+n)*(r.a-t.a):0}function s(t,e,r){var i=e.b-t.b,n=r.b-e.b;return 0<i+n?(e.a-r.a)*i+(e.a-t.a)*n:0}function a(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(t,e,r){var i=e.a-t.a,n=r.a-e.a;return 0<i+n?i<n?e.b-t.b+i/(i+n)*(t.b-r.b):e.b-r.b+n/(i+n)*(r.b-t.b):0}function u(t,e,r){var i=e.a-t.a,n=r.a-e.a;return 0<i+n?(e.b-r.b)*i+(e.b-t.b)*n:0}function h(t){return i(t.b.a,t.a)}function c(t){return i(t.a,t.b.a)}function l(t,e,r,i){return(t=0>t?0:t)<=(r=0>r?0:r)?0===r?(e+i)/2:e+t/(t+r)*(i-e):i+r/(t+r)*(e-i)}function f(t){var e=y(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function p(t,e){var r=!1,i=!1;t!==e&&(e.a!==t.a&&(i=!0,E(e.a,t.a)),e.d!==t.d&&(r=!0,_(e.d,t.d)),g(e,t),i||(x(e,t.a),t.a.c=t),r||(b(e,t.d),t.d.a=t))}function d(t){var e=t.b,r=!1;t.d!==t.b.d&&(r=!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)),r||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),r=e.b;return g(e,t.e),e.a=t.b.a,x(r,e.a),e.d=r.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 r=!1,i=y(t),n=i.b;return e.d!==t.d&&(r=!0,_(e.d,t.d)),g(i,t.e),g(n,e),i.a=t.b.a,n.a=e.a,i.d=n.d=t.d,t.d.a=n,r||b(i,t.d),i}function y(t){var e=new J,r=new J,i=t.b.h;return r.h=i,i.b.h=e,e.h=t,t.b.h=r,e.b=r,e.c=e,e.e=r,r.b=e,r.c=r,r.e=e}function g(t,e){var r=t.c,i=e.c;r.b.e=e,i.b.e=t,t.c=i,e.c=r}function x(t,e){var r=e.f,i=new et(e,r);r.e=i,e.f=i,r=i.c=t;do{r.a=i,r=r.c}while(r!==t)}function b(t,e){var r=e.d,i=new Q(e,r);r.b=i,e.d=i,i.a=t,i.c=e.c,r=t;do{r.d=i,r=r.e}while(r!==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 r=t.c,i=r;do{i.a=e,i=i.c}while(i!==r);r=t.f,(i=t.e).f=r,r.e=i}function _(t,e){var r=t.a,i=r;do{i.d=e,i=i.e}while(i!==r);r=t.d,(i=t.b).d=r,r.b=i}function A(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 S(t,e){t.f+=e.f,t.b.f+=e.b.f}function w(t,e,r){return t=t.a,e=e.a,r=r.a,e.b.a===t?r.b.a===t?i(e.a,r.a)?0>=s(r.b.a,e.a,r.a):0<=s(e.b.a,r.a,e.a):0>=s(r.b.a,t,r.a):r.b.a===t?0<=s(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(r.b.a,t,r.a))}function R(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function O(t,e){d(t.a),t.c=!1,t.a=e,e.i=t}function M(t){var e=t.a.a;do{t=pt(t)}while(t.a.a===e);return t.c&&(O(t,e=v(ft(t).a.b,t.a.e)),t=pt(t)),t}function P(t,e,r){var i=new lt;return i.a=r,i.e=H(t.f,e.e,i),r.i=i}function I(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 L(t){var e=t.a,r=e.d;r.c=t.d,r.a=e,R(t)}function F(t,e,r){for(t=e,e=e.a;t!==r;){t.c=!1;var i=ft(t),n=i.a;if(n.a!==e.a){if(!i.c){L(t);break}O(i,n=v(e.c.b,n.b))}e.c!==n&&(p($(n),n),p(e,n)),L(t),e=i.a,t=i}return e}function V(t,e,r,i,n,s){var a=!0;do{P(t,e,r.b),r=r.c}while(r!==i);for(null===n&&(n=ft(e).a.b.c);(r=(i=ft(e)).a.b).a===n.a;)r.c!==n&&(p($(r),r),p($(n),r)),i.f=e.f-r.f,i.d=I(t,i.f),e.b=!0,!a&&z(t,e)&&(S(r,n),R(e),d(n)),a=!1,e=i,n=r;e.b=!0,s&&B(t,e)}function D(t,e,r,i,n){var s=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(s,r,i,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=r[0])}function N(t,e,r){var i=[null,null,null,null];i[0]=e.a.d,i[1]=r.a.d,D(t,e.a,i,[.5,.5,0,0],!1),p(e,r)}function k(t,e,r,i,n){var s=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),a=Math.abs(r.b-t.b)+Math.abs(r.a-t.a),o=n+1;i[n]=.5*a/(s+a),i[o]=.5*s/(s+a),t.g[0]+=i[n]*e.g[0]+i[o]*r.g[0],t.g[1]+=i[n]*e.g[1]+i[o]*r.g[1],t.g[2]+=i[n]*e.g[2]+i[o]*r.g[2]}function z(t,e){var n=ft(e),a=e.a,o=n.a;if(i(a.a,o.a)){if(0<s(o.b.a,a.a,o.a))return!1;if(r(a.a,o.a)){if(a.a!==o.a){n=t.e;var u=a.a.h;if(0<=u){var h=(n=n.b).d,c=n.e,l=n.c,f=l[u];h[f]=h[n.a],l[h[f]]=f,f<=--n.a&&(1>=f||i(c[h[f>>1]],c[h[f]])?ht(n,f):ct(n,f)),c[u]=null,l[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;N(t,$(o),a)}}else m(o.b),p(a,$(o)),e.b=n.b=!0}else{if(0>s(a.b.a,o.a,a.a))return!1;pt(e).b=e.b=!0,m(a.b),p($(o),a)}return!0}function U(t,e){var h=ft(e),c=e.a,f=h.a,d=c.a,v=f.a,y=c.b.a,g=f.b.a,x=new et;if(s(y,t.a,d),s(g,t.a,v),d===v||Math.min(d.a,y.a)>Math.max(v.a,g.a))return!1;if(i(d,v)){if(0<s(g,d,v))return!1}else if(0>s(y,v,d))return!1;var b,T,E=y,_=d,A=g,C=v;if(i(E,_)||(b=E,E=_,_=b),i(A,C)||(b=A,A=C,C=b),i(E,A)||(b=E,E=A,A=b,b=_,_=C,C=b),i(A,_)?i(_,C)?(0>(b=n(E,A,_))+(T=n(A,_,C))&&(b=-b,T=-T),x.b=l(b,A.b,T,_.b)):(0>(b=s(E,A,_))+(T=-s(E,C,_))&&(b=-b,T=-T),x.b=l(b,A.b,T,C.b)):x.b=(A.b+_.b)/2,a(E,_)||(b=E,E=_,_=b),a(A,C)||(b=A,A=C,C=b),a(E,A)||(b=E,E=A,A=b,b=_,_=C,C=b),a(A,_)?a(_,C)?(0>(b=o(E,A,_))+(T=o(A,_,C))&&(b=-b,T=-T),x.a=l(b,A.a,T,_.a)):(0>(b=u(E,A,_))+(T=-u(E,C,_))&&(b=-b,T=-T),x.a=l(b,A.a,T,C.a)):x.a=(A.a+_.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=i(d,v)?d:v,i(E,x)&&(x.b=E.b,x.a=E.a),r(x,d)||r(x,v))return z(t,e),!1;if(!r(y,t.a)&&0<=s(y,t.a,x)||!r(g,t.a)&&0>=s(g,t.a,x)){if(g===t.a)return m(c.b),p(f.b,c),c=ft(e=M(e)).a,F(t,ft(e),h),V(t,e,$(c),c,c,!0),!0;if(y===t.a){m(f.b),p(c.e,$(f)),v=(d=h=e).a.b.a;do{d=pt(d)}while(d.a.b.a===v);return d=ft(e=d).a.b.c,h.a=$(f),V(t,e,(f=F(t,h,null)).c,c.b.c,d,!0),!0}return 0<=s(y,t.a,x)&&(pt(e).b=e.b=!0,m(c.b),c.a.b=t.a.b,c.a.a=t.a.a),0>=s(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(c.b),m(f.b),p($(f),c),c.a.b=x.b,c.a.a=x.a,c.a.h=it(t.e,c.a),c=c.a,f=[0,0,0,0],x=[d.d,y.d,v.d,g.d],c.g[0]=c.g[1]=c.g[2]=0,k(c,d,y,f,0),k(c,v,g,f,2),D(t,c,x,f,!0),pt(e).b=e.b=h.b=!0,!1}function B(t,e){for(var r=ft(e);;){for(;r.b;)e=r,r=ft(r);if(!e.b&&(r=e,null===(e=pt(e))||!e.b))break;e.b=!1;var n,a=e.a,o=r.a;if(n=a.b.a!==o.b.a)t:{var u=ft(n=e),h=n.a,c=u.a,l=void 0;if(i(h.b.a,c.b.a)){if(0>s(h.b.a,c.b.a,h.a)){n=!1;break t}pt(n).b=n.b=!0,l=m(h),p(c.b,l),l.d.c=n.d}else{if(0<s(c.b.a,h.b.a,c.a)){n=!1;break t}n.b=u.b=!0,l=m(c),p(h.e,c.b),l.b.d.c=n.d}n=!0}if(n&&(r.c?(R(r),d(o),o=(r=ft(e)).a):e.c&&(R(e),d(a),a=(e=pt(r)).a)),a.a!==o.a)if(a.b.a===o.b.a||e.c||r.c||a.b.a!==t.a&&o.b.a!==t.a)z(t,e);else if(U(t,e))break;a.a===o.a&&a.b.a===o.b.a&&(S(o,a),R(e),d(a),e=pt(r))}}function G(t,e){t.a=e;for(var n=e.c;null===n.i;)if((n=n.c)===e.c){n=t;var a=e;(h=new lt).a=a.c.b;var o=(l=n.f).a;do{o=o.a}while(null!==o.b&&!l.c(l.b,h,o.b));var u=ft(l=o.b),h=l.a;o=u.a;if(0===s(h.b.a,a,h.a))r((h=l.a).a,a)||r(h.b.a,a)||(m(h.b),l.c&&(d(h.c),l.c=!1),p(a.c,h),G(n,a));else{var c=i(o.b.a,h.b.a)?l:u;u=void 0;l.d||c.c?(u=c===l?v(a.c.b,h.e):v(o.b.c.b,a.c).b,c.c?O(c,u):(h=n,(l=P(n,l,u)).f=pt(l).f+l.a.f,l.d=I(h,l.f)),G(n,a)):V(n,l,a.c,a.c,null,!0)}return}if(l=(h=ft(n=M(n.i))).a,(h=F(t,h,null)).c===l){h=(l=h).c,o=ft(n),u=n.a,c=o.a;var l,f=!1;u.b.a!==c.b.a&&U(t,n),r(u.a,t.a)&&(p($(h),u),h=ft(n=M(n)).a,F(t,ft(n),o),f=!0),r(c.a,t.a)&&(p(l,$(c)),l=F(t,o,null),f=!0),f?V(t,n,l.c,h,h,!0):(a=i(c.a,u.a)?$(c):u,V(t,n,a=v(l.c.b,a),a.c,a.c,!1),a.b.i.c=!0,B(t,n))}else V(t,n,h.c,l,l,!0)}function j(t,e){var r=new lt,i=f(t.b);i.a.b=C,i.a.a=e,i.b.a.b=-C,i.b.a.a=e,t.a=i.b.a,r.a=i,r.f=0,r.d=!1,r.c=!1,r.h=!0,r.b=!1,i=H(i=t.f,i.a,r),r.e=i}function X(t){this.a=new W,this.b=t,this.c=w}function H(t,e,r){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,r));return t=new W(r,e.a,e),e.a.c=t,e.a=t}function W(t,e,r){this.b=t||null,this.a=e||this,this.c=r||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 rt(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new st}function it(t,e){if(t.e){var r,i=t.b,n=++i.a;return 2*n>i.f&&(i.f*=2,i.c=at(i.c,i.f+1)),0===i.b?r=n:(r=i.b,i.b=i.c[i.b]),i.e[r]=e,i.c[r]=n,i.d[n]=r,i.h&&ct(i,n),r}return i=t.a++,t.c[i]=e,-(i+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&&i(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 st(){this.d=at([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 at(t,e){for(var r=Array(e),i=0;i<t.length;i++)r[i]=t[i];for(;i<e;i++)r[i]=0;return r}function ot(t){return t.e[t.d[1]]}function ut(t){var e=t.d,r=t.e,i=t.c,n=e[1],s=r[n];return 0<t.a&&(e[1]=e[t.a],i[e[1]]=1,r[n]=null,i[n]=t.b,t.b=n,0<--t.a&&ht(t,1)),s}function ht(t,e){for(var r=t.d,n=t.e,s=t.c,a=e,o=r[a];;){var u=a<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[o],n[h])){r[a]=o,s[o]=a;break}r[a]=h,s[h]=a,a=u}}function ct(t,e){for(var r=t.d,n=t.e,s=t.c,a=e,o=r[a];;){var u=a>>1,h=r[u];if(0===u||i(n[h],n[o])){r[a]=o,s[o]=a;break}r[a]=h,s[h]=a,a=u}}function lt(){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 pt(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,r){this.j[0]=t,this.j[1]=e,this.j[2]=r},e.z=function(t,e){var r=e||null;switch(t){case 100100:case 100106:this.h=r;break;case 100104:case 100110:this.l=r;break;case 100101:case 100107:this.k=r;break;case 100102:case 100108:this.i=r;break;case 100103:case 100109:this.p=r;break;case 100105:case 100111:this.o=r;break;case 100112:this.r=r;break;default:K(this,100900)}},e.C=function(t,e){var r=!1,i=[0,0,0];q(this,2);for(var n=0;3>n;++n){var s=t[n];-1e150>s&&(s=-1e150,r=!0),1e150<s&&(s=1e150,r=!0),i[n]=s}r&&K(this,100155),null===(r=this.q)?p(r=f(this.b),r.b):(m(r),r=r.e),r.a.d=e,r.a.g[0]=i[0],r.a.g[1]=i[1],r.a.g[2]=i[2],r.f=1,r.b.f=-1,this.q=r},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=[l=this.j[0],n=this.j[1],o=this.j[2]];if(0===l&&0===n&&0===o){for(var n=[-2e150,-2e150,-2e150],a=[2e150,2e150,2e150],o=[],u=[],l=(t=this.b.c).e;l!==t;l=l.e)for(var f=0;3>f;++f){var p=l.g[f];p<a[f]&&(a[f]=p,u[f]=l),p>n[f]&&(n[f]=p,o[f]=l)}if(l=0,n[1]-a[1]>n[0]-a[0]&&(l=1),n[2]-a[2]>n[l]-a[l]&&(l=2),a[l]>=n[l])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,a=u[l],o=o[l],u=[0,0,0],a=[a.g[0]-o.g[0],a.g[1]-o.g[1],a.g[2]-o.g[2]],f=[0,0,0],l=t.e;l!==t;l=l.e)f[0]=l.g[0]-o.g[0],f[1]=l.g[1]-o.g[1],f[2]=l.g[2]-o.g[2],u[0]=a[1]*f[2]-a[2]*f[1],u[1]=a[2]*f[0]-a[0]*f[2],u[2]=a[0]*f[1]-a[1]*f[0],(p=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>n&&(n=p,e[0]=u[0],e[1]=u[1],e[2]=u[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[A(a)]=1)}t=!0}for(u=A(e),l=this.b.c,n=(u+1)%3,o=(u+2)%3,u=0<e[u]?1:-1,e=l.e;e!==l;e=e.e)e.b=e.g[n],e.a=u*e.g[o];if(t){for(e=0,l=(t=this.b.a).b;l!==t;l=l.b)if(!(0>=(n=l.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==l.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,l=(e=this.b.b).h;l!==e;l=t)t=l.h,n=l.e,r(l.a,l.b.a)&&l.e.e!==l&&(N(this,n,l),d(l),n=(l=n).e),n.e===l&&(n!==l&&(n!==t&&n!==t.b||(t=t.h),d(n)),l!==t&&l!==t.b||(t=t.h),d(l));for(this.e=e=new rt,l=(t=this.b.c).e;l!==t;l=l.e)l.h=it(e,l);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,r){return i(t[e],t[r])?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(l=this.e,0===l.a)t=ot(l.b);else if(t=l.c[l.d[l.a-1]],0!==l.b.a&&(l=ot(l.b),i(l,t))){t=l;break t}if(null===t||!r(t,e))break;t=nt(this.e),N(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,R(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,l=(e=this.b).a.b;l!==e.a;l=t)t=l.b,(l=l.a).e.e===l&&(S(l.c,l),d(l));if(!this.n){if(e=this.b,this.m)for(l=e.b.h;l!==e.b;l=t)t=l.h,l.b.d.c!==l.d.c?l.f=l.d.c?1:-1:d(l);else for(l=e.a.b;l!==e.a;l=t)if(t=l.b,l.c){for(l=l.a;i(l.b.a,l.a);l=l.c.b);for(;i(l.a,l.b.a);l=l.e);for(n=l.c.b,o=void 0;l.e!==n;)if(i(l.b.a,n.a)){for(;n.e!==l&&(h(n.e)||0>=s(n.a,n.b.a,n.e.b.a));)n=(o=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==l&&(c(l.c.b)||0<=s(l.b.a,l.a,l.c.b.a));)l=(o=v(l,l.c.b)).b;l=l.e}for(;n.e.e!==l;)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),l=t.a;do{this.k&&this.k(l.a.d,this.c),l=l.e}while(l!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,l=!1,n=-1,o=e.a.d;o!==e.a;o=o.d)if(o.c){l||(this.h&&this.h(4,this.c),l=!0),u=o.a;do{t&&(n!==(a=u.b.d.c?0:1)&&(n=a,this.l&&this.l(!!n,this.c))),this.k&&this.k(u.a.d,this.c),u=u.e}while(u!==o.a)}l&&this.i&&this.i(this.c)}if(this.r){for(l=(e=this.b).a.b;l!==e.a;l=t)if(t=l.b,!l.c){o=(n=l.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))),(a=u.b).c===a?E(a.a,null):(a.a.c=a.c,g(a,$(a))),T(u))}while(u!==n);n=l.d,(l=l.b).d=n,n.b=l}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Jn.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=Jn.libtess}($n);var ts=function(){var t=new $n.exports.GluTesselator;return t.gluTessCallback($n.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback($n.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==$n.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback($n.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback($n.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,r){return[t[0],t[1],t[2]]})),t.gluTessCallback($n.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function es(t){ts.gluTessNormal(0,0,1);var e=[];ts.gluTessBeginPolygon(e);for(var r=0;r<t.length;r++){ts.gluTessBeginContour();for(var i=t[r],n=0;n<i.length;n+=2){var s=[i[n],i[n+1],0];ts.gluTessVertex(s,s)}ts.gluTessEndContour()}return ts.gluTessEndPolygon(),e}var rs=function(t){function e(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var s=Array.isArray(r[0])?r[0]:r;if("number"!=typeof s[0]){for(var a=[],o=0,u=s.length;o<u;o++)a.push(s[o].x,s[o].y);s=a}return n.points=s,n.closePath=!0,n}_t(e,t);var r=e.prototype;return r.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},r.contains=function(t,e){for(var r=!1,i=this.points.length/2,n=0,s=i-1;n<i;s=n++){var a=this.points[2*n],o=this.points[2*n+1],u=this.points[2*s],h=this.points[2*s+1];o>e!=h>e&&t<(e-o)/(h-o)*(u-a)+a&&(r=!r)}return r},r.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},r.copyTo=function(t){return t.copyFrom(this),t},r.getX=function(){return this.points[this.points.length-2]},r.getY=function(){return this.points[this.points.length-1]},r.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},r.triangulate=function(t,e,r,i,n){var s=es([t]),a=e.length/2;0===s.length&&this.getLineEndPointsTriangle(t,s);for(var o=0;o<s.length;o++)e[2*r+o]=s[o];for(var u=s.length/2,h=0;h<u;h++)i[n+h]=a+h},r.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw new Error("Invalid points array");if(2!==t.length){var r=t[2]-t[0],i=t[3]-t[1],n=t[0],s=t[1],a=t[0],o=t[1];if(Math.abs(r)>=Math.abs(i))for(var u=0;u<t.length;u+=2){var h=t[u],c=t[u+1];h<n&&(n=h,s=c),h>a&&(a=h,o=c)}else for(var l=0;l<t.length;l+=2){var f=t[l],p=t[l+1];p<s&&(n=f,s=p),p>o&&(a=f,o=p)}e.push(n,s,a,o,a,o)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},se(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(Qn),is=8,ns=1.1920929e-7;function ss(t,e,r,i,n,s,a,o,u,h){var c=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function(t,e,r,i,n,s,a,o,u,h){as(t,e,r,i,n,s,a,o,u,h,0),u.push(a,o)}(e,r,i,n,s,a,o,u,t,c*=c),t}function as(t,e,r,i,n,s,a,o,u,h,c){if(!(c>is)){var l=(t+r)/2,f=(e+i)/2,p=(r+n)/2,d=(i+s)/2,m=(n+a)/2,v=(s+o)/2,y=(l+p)/2,g=(f+d)/2,x=(p+m)/2,b=(d+v)/2,T=(y+x)/2,E=(g+b)/2;if(c>0){var _=a-t,A=o-e,C=Math.abs((r-a)*A-(i-o)*_),S=Math.abs((n-a)*A-(s-o)*_);if(C>ns&&S>ns){if((C+S)*(C+S)<=h*(_*_+A*A))return void u.push(T,E)}else if(C>ns){if(C*C<=h*(_*_+A*A))return void u.push(T,E)}else if(S>ns){if(S*S<=h*(_*_+A*A))return void u.push(T,E)}else if((_=T-(t+a)/2)*_+(A=E-(e+o)/2)*A<=h)return void u.push(T,E)}as(t,e,l,f,y,g,T,E,u,h,c+1),as(T,E,x,b,m,v,a,o,u,h,c+1)}}var os,us=function(t){function e(e,r,i,n){var s;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),(s=t.call(this)||this).type="ellipse",s.x=e,s.y=r,s.halfWidth=i,s.halfHeight=n,s}_t(e,t);var r=e.prototype;return r.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},r.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var r=(t-this.x)/this.halfWidth,i=(e-this.y)/this.halfHeight;return(r*=r)+(i*=i)<=1},r.strokeContains=function(t,e,r){var i=this.halfWidth,n=this.halfHeight;if(i<=0||n<=0)return!1;var s=r/2,a=i-s,o=n-s,u=i+s,h=n+s,c=t-this.x,l=e-this.y;return c*c/(a*a)+l*l/(o*o)>1&&c*c/(u*u)+l*l/(h*h)<=1},r.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},r.copyTo=function(t){return t.copyFrom(this),t},r.getX=function(){return this.x},r.getY=function(){return this.y},r.build=function(t){var e=this.x,r=this.y,i=this.halfWidth,n=this.halfHeight;if(!(i>=0&&n>=0))return t;var s=Math.ceil(5*Math.sqrt(i+n)),a=8*s+0+0;if(0===a)return t;if(0===s)return t[0]=t[6]=e+0,t[1]=t[3]=r+0,t[2]=t[4]=e-0,t[5]=t[7]=r-0,t;var o=0,u=4*s+0+2,h=u,c=a,l=0+i,f=0,p=e+l,d=e-l,m=r+f;t[o++]=p,t[o++]=m,t[--u]=m,t[--u]=d;for(var v=1;v<s;v++){var y=Math.PI/2*(v/s),g=0+Math.cos(y)*i,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=r+x,_=r-x;t[o++]=b,t[o++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--c]=_,t[--c]=b}p=e+(l=0),d=e-l,m=r+(f=0+n);var A=r-f;return t[o++]=p,t[o++]=m,t[--c]=A,t[--c]=p,t},r.triangulate=function(t,e,r,i,n){if(0!==t.length){for(var s=0,a=0,o=0;o<t.length;o+=2)s+=t[o],a+=t[o+1];s/=t.length/2,a/=t.length/2;var u=r;e[2*u]=s,e[2*u+1]=a;for(var h=u++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(i[n++]=u,i[n++]=h,i[n++]=u-1),u++;i[n++]=h+1,i[n++]=h,i[n++]=u-1}},e}(Qn);!function(t){t[t.Star=0]="Star",t[t.Polygon=1]="Polygon"}(os||(os={}));var hs,cs=function(t){function e(e,r,i,n,s,a){var o;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=0),(o=t.call(this)||this).pointCount=e,o.outerRadius=r,o.innerRadius=i,o.outerRoundness=n,o.innerRoundness=s,o.starType=a,o.v=[],o.in=[],o.out=[],o}_t(e,t);var r=e.prototype;return r.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},r.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},r.copyTo=function(t){t.copyFrom(this)},r.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)ss(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 r=this.v.length-1;ss(t,this.v[r-1],this.v[r],this.out[r-1],this.out[r],this.in[0],this.in[1],this.v[0],this.v[1],1)},r.triangulate=function(t,e,r,i,n){for(var s=es([t]),a=e.length/2,o=0;o<s.length;o++)e[2*r+o]=s[o];for(var u=s.length/2,h=0;h<u;h++)i[n+h]=a+h},r.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,r,i,n=2*Math.floor(this.pointCount),s=2*Math.PI/n,a=!0,o=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,c=this.innerRoundness/100,l=2*Math.PI*o/(2*n),f=2*Math.PI*u/(2*n),p=-Math.PI/2;for(t=0;t<n;t++){r=a?h:c,i=a?l:f;var d=(e=a?o:u)*Math.cos(p),m=e*Math.sin(p),v=0===d&&0===m?0:m/Math.sqrt(d*d+m*m),y=0===d&&0===m?0:-d/Math.sqrt(d*d+m*m),g=2*t;this.v[g]=d,this.v[g+1]=m,this.in[g]=d+v*i*r*1,this.in[g+1]=m+y*i*r*1,this.out[g]=d-v*i*r*1,this.out[g+1]=m-y*i*r*1,a=!a,p+=1*s}},r.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),r=2*Math.PI/e,i=this.outerRadius,n=this.outerRoundness/100,s=2*Math.PI*i/(4*e),a=.5*-Math.PI;for(t=0;t<e;t++){var o=i*Math.cos(a),u=i*Math.sin(a),h=0===o&&0===u?0:u/Math.sqrt(o*o+u*u),c=0===o&&0===u?0:-o/Math.sqrt(o*o+u*u),l=2*t;this.v[l]=o,this.v[l+1]=u,this.in[l]=o+h*s*n*1,this.in[l+1]=u+c*s*n*1,this.out[l]=o-h*s*n*1,this.out[l+1]=u-c*s*n*1,a+=1*r}},e}(Qn),ls=function(t){function e(e,r,i,n,s){var a;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=20),(a=t.call(this)||this).x=e,a.y=r,a.width=i,a.height=n,a.roundness=s,a}_t(e,t);var r=e.prototype;return r.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},r.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},r.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},r.copyTo=function(t){return t.copyFrom(this),t},r.build=function(t){var e,r=this.width/2,i=this.height/2,n=this.x+r,s=this.y+i,a=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(r,i)),o=r-a,u=i-e;if(a>=0&&e>=0&&o>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(a+e)),c=8*h+(o?4:0)+(u?4:0);if(0!==c){if(0===h)return t[0]=t[6]=n+o,t[1]=t[3]=s+u,t[2]=t[4]=n-o,void(t[5]=t[7]=s-u);var l=0,f=4*h+(o?2:0)+2,p=f,d=c,m=o+a,v=u,y=n+m,g=n-m,x=s+v;if(t[l++]=y,t[l++]=x,t[--f]=x,t[--f]=g,u){var b=s-v;t[p++]=g,t[p++]=b,t[--d]=b,t[--d]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),_=o+Math.cos(E)*a,A=u+Math.sin(E)*e,C=n+_,S=n-_,w=s+A,R=s-A;t[l++]=C,t[l++]=w,t[--f]=w,t[--f]=S,t[p++]=S,t[p++]=R,t[--d]=R,t[--d]=C}y=n+(m=o),g=n-m,x=s+(v=u+e);var O=s-v;t[l++]=y,t[l++]=x,t[--d]=O,t[--d]=y,o&&(t[l++]=g,t[l++]=x,t[--d]=O,t[--d]=g)}}},r.triangulate=function(t,e,r,i,n){if(0!==t.length){for(var s=0,a=0,o=0;o<t.length;o+=2)s+=t[o],a+=t[o+1];s/=t.length/2,a/=t.length/2;var u=r;e[2*u]=s,e[2*u+1]=a;for(var h=u++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(i[n++]=u,i[n++]=h,i[n++]=u-1),u++;i[n++]=h+1,i[n++]=h,i[n++]=u-1}},e}(Qn),fs=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=s(this.graphicsPath.instructions);!(t=e()).done;){var r=t.value,i=r.action,n=r.data;switch(i){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,r,i,n,s,a){this.ensurePoly();var o=this.currentPoly;return ss(o.points,o.lastX,o.lastY,t,e,r,i,n,s,a),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,r,i,n){return this.drawShape(new us(t,e,r,i),n),this},e.polyStar=function(t,e,r,i,n,s,a){return this.drawShape(new cs(t,e,r,i,n,s),a),this},e.rect=function(t,e,r,i,n,s){return this.drawShape(new ls(t,e,r,i,n),s),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var r=this.currentPoly;return r&&this.endPoly(),(r=new rs).points.push(t,e),this.currentPoly=r,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 rs,this.currentPoly.points.push(0,0))},t}(),ps=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,r,i,n,s,a){return this.instructions.push({action:"bezierCurveTo",data:[t,e,r,i,n,s,a]}),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,r,i,n){return this.instructions.push({action:"ellipse",data:[t,e,r,i,n]}),this.dirty=!0,this},e.rect=function(t,e,r,i,n,s){return this.instructions.push({action:"rect",data:[t,e,r,i,n,s]}),this.dirty=!0,this},e.polyStar=function(t,e,r,i,n,s,a){return this.instructions.push({action:"polyStar",data:[t,e,r,i,n,s,a]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},se(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new fs(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}(),ds=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},se(t,null,[{key:"shared",get:function(){return ms.x=0,ms.y=0,ms}}]),t}(),ms=new ds;function vs(t,e,r,i,n,s,a,o){var u,h;a?(u=i,h=-r):(u=-i,h=r);var c=t-r*n+u,l=e-i*n+h,f=t+r*s+u,p=e+i*s+h;return o.push(c,l),o.push(f,p),2}function ys(t,e,r,i,n,s,a,o){var u=r-t,h=i-e,c=Math.atan2(u,h),l=Math.atan2(n-t,s-e);o&&c<l?c+=2*Math.PI:!o&&c>l&&(l+=2*Math.PI);var f=c,p=l-c,d=Math.abs(p),m=Math.sqrt(u*u+h*h),v=1+(15*d*Math.sqrt(m)/Math.PI>>0),y=p/v;if(f+=y,o){a.push(t,e),a.push(r,i);for(var g=1,x=f;g<v;g++,x+=y)a.push(t,e),a.push(t+Math.sin(x)*m,e+Math.cos(x)*m);a.push(t,e),a.push(n,s)}else{a.push(r,i),a.push(t,e);for(var b=1,T=f;b<v;b++,T+=y)a.push(t+Math.sin(T)*m,e+Math.cos(T)*m),a.push(t,e);a.push(n,s),a.push(t,e)}return 2*v}function gs(t,e,r,i,n,s,a,o,u){var h=1e-4;if(0!==t.length){var c=e,l=c.alignment;if(.5!==e.alignment){var f=function(t){var e=t.length;if(e<6)return 1;for(var r=0,i=0,n=t[e-2],s=t[e-1];i<e;i+=2){var a=t[i],o=t[i+1];r+=(a-n)*(o+s),n=a,s=o}return r<0?-1:1}(t);r&&(f*=-1),l=(l-.5)*f+.5}var p=new ds(t[0],t[1]),d=new ds(t[t.length-2],t[t.length-1]),m=i,v=Math.abs(p.x-d.x)<h&&Math.abs(p.y-d.y)<h;if(m){t=t.slice(),v&&(t.pop(),t.pop(),d.set(t[t.length-2],t[t.length-1]));var y=.5*(p.x+d.x),g=.5*(d.y+p.y);t.unshift(y,g),t.push(y,g)}var x=n,b=t.length/2,T=t.length,E=x.length/2,_=c.width/2,A=_*_,C=c.miterLimit*c.miterLimit,S=t[0],w=t[1],R=t[2],O=t[3],M=0,P=0,I=-(w-O),L=S-R,F=0,V=0,D=Math.sqrt(I*I+L*L)+xe;I/=D,L/=D,I*=_,L*=_;var N=2*(1-l),k=2*l;m||(c.cap===Wt.Round?T+=ys(S-I*(N-k)*.5,w-L*(N-k)*.5,S-I*N,w-L*N,S+I*k,w+L*k,x,!0)+2:c.cap===Wt.Square&&(T+=vs(S,w,I,L,N,k,!0,x))),x.push(S-I*N,w-L*N),x.push(S+I*k,w+L*k);for(var z=1;z<b-1;++z){S=t[2*(z-1)],w=t[2*(z-1)+1],R=t[2*z],O=t[2*z+1],M=t[2*(z+1)],P=t[2*(z+1)+1],I=-(w-O),L=S-R,I/=D=Math.sqrt(I*I+L*L)+xe,L/=D,I*=_,L*=_,F=-(O-P),V=R-M,F/=D=Math.sqrt(F*F+V*V)+xe,V/=D,F*=_,V*=_;var U=R-S,B=w-O,G=R-M,j=P-O,X=U*G+B*j,H=B*G-j*U,W=H<0;if(Math.abs(H)<.001*Math.abs(X))x.push(R-I*N,O-L*N),x.push(R+I*k,O+L*k),X>=0&&(c.join===Yt.Round?T+=ys(R,O,R-I*N,O-L*N,R-F*N,O-V*N,x,!1)+4:T+=2,x.push(R-F*k,O-V*k),x.push(R+F*N,O+V*N));else{var Y=(-I+S)*(-L+O)-(-I+R)*(-L+w),Z=(-F+M)*(-V+O)-(-F+R)*(-V+P),q=(U*Z-G*Y)/H,K=(j*Y-B*Z)/H,Q=(q-R)*(q-R)+(K-O)*(K-O),J=R+(q-R)*N,$=O+(K-O)*N,tt=R-(q-R)*k,et=O-(K-O)*k,rt=W?N:k;Q<=Math.min(U*U+B*B,G*G+j*j)+rt*rt*A?c.join===Yt.Bevel||Q/A>C?(W?(x.push(J,$),x.push(R+I*k,O+L*k),x.push(J,$),x.push(R+F*k,O+V*k)):(x.push(R-I*N,O-L*N),x.push(tt,et),x.push(R-F*N,O-V*N),x.push(tt,et)),T+=2):c.join===Yt.Round?W?(x.push(J,$),x.push(R+I*k,O+L*k),T+=ys(R,O,R+I*k,O+L*k,R+F*k,O+V*k,x,!0)+4,x.push(J,$),x.push(R+F*k,O+V*k)):(x.push(R-I*N,O-L*N),x.push(tt,et),T+=ys(R,O,R-I*N,O-L*N,R-F*N,O-V*N,x,!1)+4,x.push(R-F*N,O-V*N),x.push(tt,et)):(x.push(J,$),x.push(tt,et)):(x.push(R-I*N,O-L*N),x.push(R+I*k,O+L*k),c.join===Yt.Round?T+=W?ys(R,O,R+I*k,O+L*k,R+F*k,O+V*k,x,!0)+2:ys(R,O,R-I*N,O-L*N,R-F*N,O-V*N,x,!1)+2:c.join===Yt.Miter&&Q/A<=C&&(W?(x.push(tt,et),x.push(tt,et)):(x.push(J,$),x.push(J,$)),T+=2),x.push(R-F*N,O-V*N),x.push(R+F*k,O+V*k),T+=2)}}S=t[2*(b-2)],w=t[2*(b-2)+1],R=t[2*(b-1)],I=-(w-(O=t[2*(b-1)+1])),L=S-R,I/=D=Math.sqrt(I*I+L*L)+xe,L/=D,I*=_,L*=_,x.push(R-I*N,O-L*N),x.push(R+I*k,O+L*k),m||(c.cap===Wt.Round?T+=ys(R-I*(N-k)*.5,O-L*(N-k)*.5,R-I*N,O-L*N,R+I*k,O+L*k,x,!1)+2:c.cap===Wt.Square&&(T+=vs(R,O,I,L,N,k,!1,x)));for(var it=E;it<T+E-2;++it)S=x[2*it],w=x[2*it+1],R=x[2*(it+1)],O=x[2*(it+1)+1],M=x[2*(it+2)],P=x[2*(it+2)+1],Math.abs(S*(O-P)+R*(P-w)+M*(w-O))<1e-8||o.push(it,it+1,it+2)}}exports.ShapeComponent=function(t){function e(e){var r;if((r=t.call(this,e)||this).hasStroke=!1,r.hasFill=!1,r.shapeDirty=!0,r.graphicsPath=new ps,r.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",r.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",r.geometry||(r.geometry=jr.create(e,{attributes:{aPos:{type:rr.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{type:rr.FLOAT,size:2,data:new Float32Array}},mode:rr.TRIANGLES,drawCount:4}),r.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0})),!r.material){var i={shader:{vertex:r.vert,fragment:r.frag,glslVersion:exports.GLSLVersion.GLSL1}},n=Nr.create(e,i);n.setColor("_Color",new Zr(1,1,1,1)),n.depthMask=!1,n.depthTest=!0,n.blending=!0,r.material=n;var s=Nr.create(e,i);s.setColor("_Color",new Zr(.25,.25,.25,1)),s.depthMask=!1,s.depthTest=!0,s.blending=!0,r.materials[1]=s}return r.strokeAttributes={width:1,alignment:.5,cap:Wt.Butt,join:Yt.Miter,miterLimit:10,color:new Zr(1,1,1,1)},r.fillAttribute={color:new Zr(1,1,1,1)},r.shapeAttribute={type:Ht.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},r}_t(e,t);var r=e.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.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)},r.buildGeometryFromPath=function(t){var e=t.shapePrimitives,r=[],i=[];if(this.hasFill)for(var n,a=s(e);!(n=a()).done;){var o=n.value.shape,u=[],h=i.length,c=r.length/2;o.build(u),o.triangulate(u,r,c,i,h)}var l=i.length;if(this.hasStroke)for(var f,p=s(e);!(f=p()).done;){var d=f.value.shape,m=[],v=this.strokeAttributes,y=!0;this.shapeAttribute.type===Ht.Custom&&(y=d.closePath),d.build(m),gs(m,v,!1,y,r,0,0,i)}var g=i.length-l,x=r.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<i.length)&&(E=new Uint16Array(i.length));for(var _=0;_<x;_++){var A=3*_,C=2*_,S=2*_;b[A]=r[C],b[A+1]=r[C+1],b[A+2]=0,T[S]=b[A],T[S+1]=b[A+1]}E.set(i),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(i.length);var w=this.geometry.subMeshes[0],R=this.geometry.subMeshes[1];w.indexCount=l,R.offset=2*l,R.indexCount=g},r.buildPath=function(t){switch(this.graphicsPath.clear(),t.type){case Ht.Custom:for(var e,r=this.shapeAttribute,i=r.points,n=r.easingIns,a=r.easingOuts,o=s(r.shapes);!(e=o()).done;){var u=e.value,h=u.indexes,c=i[h[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var l=1;l<h.length;l++){var f=h[l],p=h[l-1],d=i[f.point],m=i[p.point],v=a[p.easingOut],y=n[f.easingIn];this.graphicsPath.bezierCurveTo(v.x+m.x,v.y+m.y,y.x+d.x,y.y+d.y,d.x,d.y,1)}if(u.close){var g=h[0],x=h[h.length-1],b=i[g.point],T=i[x.point],E=a[x.easingOut],_=n[g.easingIn];this.graphicsPath.bezierCurveTo(E.x+T.x,E.y+T.y,_.x+b.x,_.y+b.y,b.x,b.y,1),this.graphicsPath.closePath()}}break;case Ht.Ellipse:var A=t;this.graphicsPath.ellipse(0,0,A.xRadius,A.yRadius);break;case Ht.Rectangle:var C=t;this.graphicsPath.rect(-C.width/2,-C.height/2,C.width,C.height,C.roundness);break;case Ht.Star:var S=t;this.graphicsPath.polyStar(S.pointCount,S.outerRadius,S.innerRadius,S.outerRoundness,S.innerRoundness,os.Star);break;case Ht.Polygon:var w=t;this.graphicsPath.polyStar(w.pointCount,w.radius,w.radius,w.roundness,w.roundness,os.Polygon)}},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shapeDirty=!0;var r=e.stroke;r&&(this.hasStroke=!0,this.strokeAttributes.width=r.width,this.strokeAttributes.color.copyFrom(r.color),this.strokeAttributes.cap=r.cap,this.strokeAttributes.join=r.join);var i=e.fill;switch(i&&(this.hasFill=!0,this.fillAttribute.color.copyFrom(i.color)),e.type){case Ht.Custom:for(var n,a=e,o={type:Ht.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:a.fill},u=s(a.points);!(n=u()).done;){var h=n.value;o.points.push(new _e(h.x,h.y))}for(var c,l=s(a.easingIns);!(c=l()).done;){var f=c.value;o.easingIns.push(new _e(f.x,f.y))}for(var p,d=s(a.easingOuts);!(p=d()).done;){var m=p.value;o.easingOuts.push(new _e(m.x,m.y))}o.shapes=a.shapes,this.shapeAttribute=o;break;case Ht.Ellipse:var v=e,y={type:Ht.Ellipse,xRadius:v.xRadius,yRadius:v.yRadius,fill:v.fill};this.shapeAttribute=y;break;case Ht.Rectangle:var g=e,x={type:Ht.Rectangle,width:g.width,height:g.height,roundness:g.roundness,fill:g.fill};this.shapeAttribute=x;break;case Ht.Star:var b=e,T={type:Ht.Star,pointCount:b.pointCount,innerRadius:b.innerRadius,outerRadius:b.outerRadius,innerRoundness:b.innerRoundness,outerRoundness:b.outerRoundness,fill:b.fill};this.shapeAttribute=T;break;case Ht.Polygon:var E=e,_={type:Ht.Polygon,pointCount:E.pointCount,radius:E.radius,roundness:E.roundness,fill:E.fill};this.shapeAttribute=_}var A=this.material;A.stencilRef=void 0!==e.renderer.mask?[e.renderer.mask,e.renderer.mask]:void 0,Mr(A,e.renderer.maskMode)},se(e,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),e}(Se),exports.ShapeComponent=u([he("ShapeComponent")],exports.ShapeComponent),exports.Fake3DComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).loop=!1,e.amountOfMotion=1,e.animationLength=2,e.mode=1,e.startPositionX=0,e.startPositionY=0,e.startPositionZ=0,e.endPositionX=0,e.endPositionY=0,e.endPositionZ=0,e.amplitudeX=0,e.amplitudeY=0,e.amplitudeZ=0,e.phaseX=0,e.phaseY=0,e.phaseZ=0,e}_t(e,t);var r=e.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(exports.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,r=0,i=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,r=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,i=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var s=t;this.loop&&(s>.5&&(s=1-s),s*=2),e=this.startPositionX*(1-s)+s*this.endPositionX,r=this.startPositionY*(1-s)+s*this.endPositionY,i=this.startPositionZ*(1-s)+s*this.endPositionZ}var a=this.effectComponent.material;a.setFloat("_PosX",e*this.amountOfMotion),a.setFloat("_PosY",r*this.amountOfMotion),a.setFloat("_PosZ",i*this.amountOfMotion)}},e}(pe),u([ce()],exports.Fake3DComponent.prototype,"loop",void 0),u([ce()],exports.Fake3DComponent.prototype,"amountOfMotion",void 0),u([ce()],exports.Fake3DComponent.prototype,"animationLength",void 0),u([ce()],exports.Fake3DComponent.prototype,"mode",void 0),u([ce()],exports.Fake3DComponent.prototype,"startPositionX",void 0),u([ce()],exports.Fake3DComponent.prototype,"startPositionY",void 0),u([ce()],exports.Fake3DComponent.prototype,"startPositionZ",void 0),u([ce()],exports.Fake3DComponent.prototype,"endPositionX",void 0),u([ce()],exports.Fake3DComponent.prototype,"endPositionY",void 0),u([ce()],exports.Fake3DComponent.prototype,"endPositionZ",void 0),u([ce()],exports.Fake3DComponent.prototype,"amplitudeX",void 0),u([ce()],exports.Fake3DComponent.prototype,"amplitudeY",void 0),u([ce()],exports.Fake3DComponent.prototype,"amplitudeZ",void 0),u([ce()],exports.Fake3DComponent.prototype,"phaseX",void 0),u([ce()],exports.Fake3DComponent.prototype,"phaseY",void 0),u([ce()],exports.Fake3DComponent.prototype,"phaseZ",void 0),exports.Fake3DComponent=u([he("Fake3DComponent")],exports.Fake3DComponent),exports.Fake3DAnimationMode=void 0,(hs=exports.Fake3DAnimationMode||(exports.Fake3DAnimationMode={}))[hs.Circular=0]="Circular",hs[hs.Linear=1]="Linear",exports.CameraController=function(t){function e(e,r){var i;return i=t.call(this,e)||this,r&&i.fromData(r),i}_t(e,t);var r=e.prototype;return r.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())}},r.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(de),exports.CameraController=u([he(Kt.CameraController)],exports.CameraController);var xs,bs=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(Tt);exports.HitTestType=void 0,(xs=exports.HitTestType||(exports.HitTestType={}))[xs.triangle=1]="triangle",xs[xs.box=2]="box",xs[xs.sphere=3]="sphere",xs[xs.custom=4]="custom";var Ts="click",Es="touchstart",_s="touchmove",As="touchend",Cs=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var r=t.prototype;return r.bindListeners=function(){var t,r,i,n,s,a=this;s=function(t){return t};var o,u="mousedown",h="mousemove",c="mouseup",l=function(t,r,i,s,o){void 0===s&&(s=0),void 0===o&&(o=0);var u=0,h=0,c=e.performance.now();if(!a.target)return j.warn("Trigger TouchEvent after EventSystem is disposed."),{x:r,y:i,vx:0,vy:h,dx:s,dy:o,ts:c,width:0,height:0,origin:t};var l=a.target,f=l.width,p=l.height;if(n){var d=c-n.ts;u=(s-n.dx)/d||0,h=(o-n.dy)/d||0,n={dx:s,dy:o,ts:c}}return{x:r,y:i,vx:u,vy:h,dx:s,dy:o,ts:c,width:f,height:p,origin:t}};R()&&(s=function(t){var e=t.touches,r=t.changedTouches;return e[0]||r[0]},u="touchstart",h="touchmove",c="touchend"),this.nativeHandlers=((o={})[u]=function(o){if(a.enabled){var u=s(o),h=Ss(u);t=h.x,r=h.y,n=i={clientX:u.clientX,clientY:u.clientY,ts:e.performance.now(),x:t,y:r},a.dispatchEvent(Es,l(o,t,r))}},o[h]=function(e){if(i&&a.enabled){var n=Ss(s(e));t=n.x,r=n.y,a.dispatchEvent(_s,l(e,t,r,t-i.x,r-i.y))}},o[c]=function(e){if(i&&a.enabled){!a.allowPropagation&&e.cancelable&&(e.preventDefault(),e.stopPropagation());var n=s(e),o=Ss(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);t=o.x,r=o.y,u<4&&a.dispatchEvent(Ts,l(e,t,r)),a.dispatchEvent(As,l(e,t,r,t-i.x,r-i.y))}i=0},o),Object.keys(this.nativeHandlers).forEach((function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.nativeHandlers[t])}))},r.dispatchEvent=function(t,e){var r=this.handlers[t];null==r||r.forEach((function(t){return t(e)}))},r.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),y(r,e),function(){g(r,e)}},r.removeEventListener=function(t,e){var r=this.handlers[t];r&&g(r,e)},r.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var r;null==(r=t.target)||r.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={},this.target=null)},t}();function Ss(t){var e=t.target,r=t.clientX,i=t.clientY,n=e.getBoundingClientRect(),s=n.left,a=n.top;return{x:(r-s)/n.width*2-1,y:1-(i-a)/n.height*2}}var ws=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(Tt),Rs=1,Os=function(){function t(t,e,r,i){this.transform=r,this.engine=i,this.color=t.options.previewColor;var n=this.createMaterial(e),s=this.createGeometry();this.mesh=this.createMesh(s,n),this.updateMesh()}var e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new Ae,n=new Re,s=this.transform.scale.clone();this.transform.assignWorldTRS(i,n,s),e.x=s.x,e.y=s.y,r.x=i.x,r.y=i.y,r.z=i.z,t.setVector2("uSize",e),t.setVector4("uPos",r),t.setQuaternion("uQuat",n)},e.createMaterial=function(t){var e,r=[["ENV_EDITOR",(null==(e=this.engine.renderer)?void 0:e.env)===Xn]],i=Yn(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:exports.GLSLVersion.GLSL1,cacheId:t.cachePrefix+"_effects_interact",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},s=Nr.create(this.engine,n);return s.blending=!0,s.depthTest=!1,s.setVector4("uPos",new Ce(0,0,0,0)),s.setVector2("uSize",new _e(1,1)),s.setVector4("uColor",new Ce(i[0]/255,i[1]/255,i[2]/255,i[3])),s.setQuaternion("uQuat",new Re(0,0,0,0)),s},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return jr.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:t.length,indices:{data:t},mode:rr.LINES,maxVertex:4})},e.createMesh=function(t,e){return ei.create(this.engine,{name:"Interact_preview"+Rs++,priority:0,worldMatrix:Pe.fromIdentity(),geometry:t,material:e})},t}();function Ms(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}exports.InteractComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.duringPlay=!1,e._interactive=!0,e.getHitTestParams=function(t){if(e.clickable){var r=e.item.props.content.options.behavior,i=e.getBoundingBox();return i?{type:i.type,triangles:i.area,behavior:r}:void 0}},e}_t(e,t);var r=e.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.props.content.options,e=this.item.engine.renderer.env,r=this.item.composition,i=this.interactData.options,n=i.type,s=i.showPreview;if(n===dt.CLICK&&(this.clickable=!0,s&&e===Xn)){var a=null==r?void 0:r.getRendererOptions();void 0!==a&&(this.previewContent=new Os(this.item.props.content,a,this.transform,this.engine))}t.type===dt.DRAG&&(e!==Xn||t.enableInEditor)&&(null==r?void 0:r.event)&&this.beginDragTarget(t,r.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){t.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,r=this.item.engine.renderer.env;if(e===dt.CLICK)this.clickable=!0;else if(e===dt.DRAG){var i,n=this.interactData.options,s=n.enableInEditor;if(r!==Xn||s)(null==(i=this.item.composition)?void 0:i.event)&&this.beginDragTarget(n,this.item.composition.event)}},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.item.time>0&&this.item.time-t/1e3<=0){var r,i=this.item.props.content.options;null==(r=this.item.composition)||r.addInteractiveItem(this.item,i.type)}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,Ms(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var r,i,n=t.cameraParam,s=n.position,a=n.fov,o=e.dy,u=e.dx*e.width/e.height,h=s[2],c=Math.tan(a*Math.PI/180/2)*Math.abs(h),l=o*c,f=u*c,p=this.dragRange,d=p.dxRange,m=p.dyRange,v=s[0]-this.dragRatio[0]*f,y=s[1]-this.dragRatio[1]*l,g=d[0],x=d[1],b=m[0],T=m[1];if(v=Ee(v,g,x),y=Ee(y,b,T),v!==g&&v!==x&&g!==x)null==(r=e.origin)||r.preventDefault();if(y!==b&&y!==T&&b!==T)null==(i=e.origin)||i.preventDefault();this.item.composition.camera.position=new Ae(v,y,h)}},r.beginDragTarget=function(t,r){var i=this;if("camera"===t.target){var n,s={touchstart:function(t){var e;if(i.canInteract()){i.dragEvent=null,i.bouncingArg=null;var r=null==(e=i.item.composition)?void 0:e.camera;n={x:t.x,y:t.y,cameraParam:{position:(null==r?void 0:r.position.toArray())||[0,0,8],fov:(null==r?void 0:r.fov)||60}}}},touchmove:function(t){i.handleDragMove(n,t),i.bouncingArg=t},touchend:function(t){if(i.canInteract()){var e=i.bouncingArg;if(!Ms(e,3)&&e){e.vx*=5,e.vy*=5,i.dragEvent=Ie({},n)}n=null}}};Object.keys(s).forEach((function(t){r.addEventListener(t,s[t])})),s.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(s).forEach((function(t){r.removeEventListener(t,s[t])}))}}},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=en(Ae.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:exports.HitTestType.triangle,area:e}},r.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===dt.DRAG){var r=e.options;r.dxRange&&(this.dragRange.dxRange=r.dxRange),r.dyRange&&(this.dragRange.dyRange=r.dyRange)}},r.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},se(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(me),exports.InteractComponent=u([he(Kt.InteractComponent)],exports.InteractComponent);var Ps,Is=function(){function t(){this.triangles=[],this.worldMatrix=new Pe}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,r=-Number.MAX_VALUE,i=Number.MAX_VALUE,n=Number.MAX_VALUE,a=s(this.boundingBoxData.area);!(t=a()).done;){var o=t.value;e=Math.max(o.p0.x,o.p1.x,o.p2.x,e),r=Math.max(o.p0.y,o.p1.y,o.p2.y,r),i=Math.min(o.p0.x,o.p1.x,o.p2.x,i),n=Math.min(o.p0.y,o.p1.y,o.p2.y,n)}var u=[],h=new Ae(i,r,0),c=new Ae(e,r,0),l=new Ae(e,n,0),f=new Ae(i,n,0);return u.push({p0:h,p1:c,p2:l}),u.push({p0:h,p1:l,p2:f}),this.applyWorldMatrix(u),{type:exports.HitTestType.triangle,area:u}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t),this.geometry=t;for(var r,i=[],n=s(this.triangles);!(r=n()).done;){var a=r.value;i.push({p0:a.p0,p1:a.p1,p2:a.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxData={type:exports.HitTestType.triangle,area:i}},e.geometryToTriangles=function(t){var e=t.getIndexData(),r=t.getAttributeData("aPos"),i=[];if(!e||!r)return i;for(var n,a=s(t.subMeshes);!(n=a()).done;){var o=n.value;if(void 0!==o.indexCount)for(var u=e.BYTES_PER_ELEMENT,h=o.offset/u,c=h+o.indexCount,l=h;l<c;l+=3){var f=3*e[l],p=3*e[l+1],d=3*e[l+2],m={x:r[f],y:r[f+1],z:r[f+2]},v={x:r[p],y:r[p+1],z:r[p+2]},y={x:r[d],y:r[d+1],z:r[d+2]};i.push({p0:m,p1:v,p2:y})}}return i},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new Ae),t.p1=e.worldMatrix.transformPoint(t.p1,new Ae),t.p2=e.worldMatrix.transformPoint(t.p2,new Ae)})),t},t}(),Ls=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return _t(e,t),e}(Tt),Fs=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,r=s(this.playableOutputs);!(e=r()).done;){e.value.context.deltaTime=t}for(var i,n=s(this.playableOutputs);!(i=n()).done;){var a=i.value;this.prepareFrameWithRoot(a)}for(var o,u=s(this.playableOutputs);!(o=u()).done;){var h=o.value;this.processFrameWithRoot(h)}},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}(),Vs=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}(),Ds=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}(),Ns=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(fe);!function(t){t[t.Playing=0]="Playing",t[t.Paused=1]="Paused"}(Ps||(Ps={}));var ks=function(){var t=this,e=this;this.listeners={},this.off=function(e,r){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter((function(t){return t.listener!==r})))},this.on=function(e,r,i){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:r,options:i}),function(){return t.off(e,r)}},this.once=function(e,r){t.on(e,r,{once:!0})},this.emit=function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];var s;null==(s=e.listeners[t])||s.forEach((function(r){var n=r.listener,s=r.options;n.apply(void 0,[].concat(i)),(null==s?void 0:s.once)&&e.off(t,n)}))},this.getListeners=function(e){var r;return(null==(r=t.listeners[e])?void 0:r.map((function(t){return t.listener})))||[]}},zs=new Re,Us=1,Bs=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new Ae(0,0,0),this.quat=new Re(0,0,0,1),this.rotation=new Hr(0,0,0),this.scale=new Ae(1,1,1),this.anchor=new Ae(0,0,0),this.size=new _e(1,1),this.children=[],this.worldMatrix=Pe.fromIdentity(),this.localMatrix=Pe.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new Ae(0,0,0),quat:new Re(0,0,0,1),scale:new Ae(1,1,1)},this.name="transform_"+Us++,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,r){this.position.x===t&&this.position.y===e&&this.position.z===r||(this.position.x=t,this.position.y=e,this.position.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,r){0===t&&0===e&&0===r||(this.position.x+=t,this.position.y+=e,this.position.z+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,r){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===r||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=r,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,r,i){this.quat.x===t&&this.quat.y===e&&this.quat.z===r&&this.quat.w===i||(this.quat.x=t,this.quat.y=e,this.quat.z=r,this.quat.w=i,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,r){this.scale.x===t&&this.scale.y===e&&this.scale.z===r||(this.scale.x=t,this.scale.y=e,this.scale.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},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,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,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 r=t.position,i=t.rotation,n=t.scale,s=t.size,o=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),r&&(a(r,Ae)?this.setPosition(r.x,r.y,r.z):this.setPosition(r[0],r[1],r[2])),o)a(o,Re)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(i){var c=e?-1:1;a(i,Hr)?this.setRotation(i.x*c,i.y*c,i.z*c):this.setRotation(i[0]*c,i[1]*c,i[2]*c)}n&&(a(n,Ae)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),s&&this.setSize(s.x,s.y),h&&(a(h,_e)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){y(this.children,t)},e.removeChild=function(t){g(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Hr)},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 Hr)},e.assignWorldTRS=function(t,e,r){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),r&&r.copyFrom(this.worldTRSCache.scale)},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={position:(new Ae).copyFrom(t.position),rotation:new Hr(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:(new Ae).copyFrom(t.scale)};this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t.getRotation=function(t,e){var r=zs.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},se(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}(),Gs=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=js(this.arc,this.arcMode,t)*ye,r=Math.cos(e)*this.radius,i=Math.sin(e)*this.radius,n=new Ae(r,i,0),s=Math.tan(this.angle*ye),a=n.clone().multiply(s);return a.z+=1,{position:n.multiply(K(0,1)),direction:a.normalize()}},t}();function js(t,e,r){if(e===Mt.RANDOM)t=K(0,t);else if(e===Mt.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===Mt.BIDIRECTIONAL_CYCLE){var n=r.index/(r.total+1),s=n-Math.floor(n);t*=Math.floor(n)%2?1-s:s}else e===Mt.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var Xs,Hs=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=js(this.arc,this.arcMode,t)*ye,r=new Ae(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),Ws=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=K(-this._d,this._d),r=K(-this._h,this._h);return{direction:new Ae(0,0,1),position:new Ae(e,r,0)}},t}(),Ys=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=js(this.arc,this.arcMode,t)*ye,r=new Ae(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,s=Math.atan2(n,i),a=Math.tan(e),o=new Ae;return e<s?o.set(i,i*a,0):e>=s&&e<Math.PI-s?o.set(n/a,n,0):e<Math.PI+s?o.set(-i,-i*a,0):e<2*Math.PI-s?o.set(-n/a,-n,0):o.set(i,i*a,0),{direction:r,position:o}},t}(),Zs=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Mt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):K(0,1);return{direction:new Ae(0,1,0),position:new Ae(this._d*(e-.5),0,0)}},t}(),qs=new Pe,Ks=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=this.donutRadius,r=this.radius-e,i=K(0,2*Math.PI),n=js(this.arc,this.arcMode,t)*ye,s=qs.setFromRotationZ(n),a=new Ae(Math.cos(i),Math.sin(i),0),o=new Ae(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:s.transformNormal(a),position:s.transformPoint(o)}},t}(),Qs=new Pe,Js=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}var e=t.prototype;return e.getHorizontalAngle=function(){return K(-90,90)},e.generate=function(t){var e=js(this.arc,this.arcMode,t)*ye,r=this.getHorizontalAngle()*ye,i=this.radius,n=new Ae(Math.cos(r),0,Math.sin(r)),s=Qs.setFromRotationZ(e).transformNormal(n);return{position:s.clone().multiply(i),direction:s}},t}(),$s=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.getHorizontalAngle=function(){return K(0,90)},e}(Js),ta=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=Ee(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,r=e.length/2-1,i=Math.floor(js(r,this.arcMode,t)),n=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,s=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new Ae(n,s,0);return{position:new Ae(n*this.width,s*this.height,0),direction:a.normalize()}},t}(),ea=function(){function t(){}return t.prototype.generate=function(){return{position:new Ae,direction:new Ae}},t}(),ra=((Xs={})[ft.NONE]=ea,Xs[ft.CONE]=Gs,Xs[ft.SPHERE]=Js,Xs[ft.HEMISPHERE]=$s,Xs[ft.CIRCLE]=Hs,Xs[ft.DONUT]=Ks,Xs[ft.RECTANGLE]=Ws,Xs[ft.EDGE]=Zs,Xs[ft.RECTANGLE_EDGE]=Ys,Xs[ft.TEXTURE]=ta,Xs);function ia(t){if(!t)return new ea;var e=Ie({radius:1,arc:360,angle:0,arcMode:Mt.RANDOM},t),r=t.type,i=ra[r];if(!i)throw new Error("Invalid shape: "+r+".");var n=new i(e);if(r!==ft.NONE){var s=t.alignSpeedDirection,a=t.upDirection,o=void 0===a?[0,0,1]:a;n.alignSpeedDirection=s,n.upDirection=Ae.fromArray(o).normalize()}return n}function na(t,e,r,i,n){var s,a;if(n===function(t,e,r,i){for(var n=0,s=e,a=r-i;s<r;s+=i)n+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return n}(t,e,r,i)>0)for(s=e;s<r;s+=i)a=Ea(s,t[s],t[s+1],a);else for(s=r-i;s>=e;s-=i)a=Ea(s,t[s],t[s+1],a);return a&&va(a,a.next)&&(_a(a),a=a.next),a}function sa(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!va(i,i.next)&&0!==ma(i.prev,i,i.next))i=i.next;else{if(_a(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function aa(t){var e=t.prev,r=t,i=t.next;if(ma(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(pa(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&ma(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function oa(t,e,r,i){var n=t.prev,s=t,a=t.next;if(ma(n,s,a)>=0)return!1;for(var o=n.x<s.x?n.x<a.x?n.x:a.x:s.x<a.x?s.x:a.x,u=n.y<s.y?n.y<a.y?n.y:a.y:s.y<a.y?s.y:a.y,h=n.x>s.x?n.x>a.x?n.x:a.x:s.x>a.x?s.x:a.x,c=n.y>s.y?n.y>a.y?n.y:a.y:s.y>a.y?s.y:a.y,l=la(o,u,e,r,i),f=la(h,c,e,r,i),p=t.prevZ,d=t.nextZ;p&&p.z>=l&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&pa(n.x,n.y,s.x,s.y,a.x,a.y,p.x,p.y)&&ma(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&pa(n.x,n.y,s.x,s.y,a.x,a.y,d.x,d.y)&&ma(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=l;){if(p!==t.prev&&p!==t.next&&pa(n.x,n.y,s.x,s.y,a.x,a.y,p.x,p.y)&&ma(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&pa(n.x,n.y,s.x,s.y,a.x,a.y,d.x,d.y)&&ma(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function ua(t,e){return t.x-e.x}function ha(t,e){if(e=function(t,e){var r,i=e,n=t.x,s=t.y,a=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var o=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>a){if(a=o,o===n){if(s===i.y)return i;if(s===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!r)return null;if(n===a)return r;var u,h=r,c=r.x,l=r.y,f=1/0;i=r;do{n>=i.x&&i.x>=c&&n!==i.x&&pa(s<l?n:a,s,c,l,s<l?a:n,s,i.x,i.y)&&(u=Math.abs(s-i.y)/(n-i.x),ba(i,t)&&(u<f||u===f&&(i.x>r.x||i.x===r.x&&ca(r,i)))&&(r=i,f=u)),i=i.next}while(i!==h);return r}(t,e),e){var r=Ta(e,t);sa(e,e.next),sa(r,r.next)}}function ca(t,e){return ma(t.prev,t,e.prev)<0&&ma(e.next,t,t.next)<0}function la(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function fa(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function pa(t,e,r,i,n,s,a,o){return(n-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(i-o)-(r-a)*(e-o)>=0&&(r-a)*(s-o)-(n-a)*(i-o)>=0}function da(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&ya(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(ba(t,e)&&ba(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(ma(t.prev,t,e.prev)||ma(t,e.prev,e))||va(t,e)&&ma(t.prev,t,t.next)>0&&ma(e.prev,e,e.next)>0)}function ma(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function va(t,e){return t.x===e.x&&t.y===e.y}function ya(t,e,r,i){var n=xa(ma(t,e,r)),s=xa(ma(t,e,i)),a=xa(ma(r,i,t)),o=xa(ma(r,i,e));return n!==s&&a!==o||(!(0!==n||!ga(t,r,e))||(!(0!==s||!ga(t,i,e))||(!(0!==a||!ga(r,t,i))||!(0!==o||!ga(r,e,i)))))}function ga(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function xa(t){return t>0?1:t<0?-1:0}function ba(t,e){return ma(t.prev,t,t.next)<0?ma(t,e,t.next)>=0&&ma(t,t.prev,e)>=0:ma(t,e,t.prev)<0||ma(t,t.next,e)<0}function Ta(t,e){var r=new Aa(t.i,t.x,t.y),i=new Aa(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function Ea(t,e,r,i){var n=new Aa(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function _a(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 Aa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Ca=0;function Sa(t,e,r,i){r=r||2,Ca=i||0;var n,s,a,o,u,h,c,l=e&&e.length,f=l?e[0]*r:t.length,p=na(t,0,f,r,!0),d=[];if(!p||p.next===p.prev)return d;if(l&&(p=function(t,e,r,i){var n,s,a,o=[];for(n=0,s=e.length;n<s;n++)(a=na(t,e[n]*i,n<s-1?e[n+1]*i:t.length,i,!1))===a.next&&(a.steiner=!0),o.push(fa(a));for(o.sort(ua),n=0;n<o.length;n++)ha(o[n],r),r=sa(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=a=t[0],s=o=t[1];for(var m=r;m<f;m+=r)(u=t[m])<n&&(n=u),(h=t[m+1])<s&&(s=h),u>a&&(a=u),h>o&&(o=h);c=0!==(c=Math.max(a-n,o-s))?1/c:0}return wa(p,d,r,n,s,c),d}function wa(t,e,r,i,n,s,a){if(t){!a&&s&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=la(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,s,a,o,u,h=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,i=r,o=0,e=0;e<h&&(o++,i=i.nextZ);e++);for(u=h;o>0||u>0&&i;)0!==o&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,o--):(n=i,i=i.nextZ,u--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=i}s.nextZ=null,h*=2}while(a>1)}(n)}(t,i,n,s);for(var o,u,h=t;t.prev!==t.next;)if(o=t.prev,u=t.next,s?oa(t,i,n,s):aa(t))e.push(o.i/r+Ca),e.push(t.i/r+Ca),e.push(u.i/r+Ca),_a(t),t=u.next,h=u.next;else if((t=u)===h){a?1===a?wa(t=Ra(sa(t),e,r),e,r,i,n,s,2):2===a&&Oa(t,e,r,i,n,s):wa(sa(t),e,r,i,n,s,1);break}}}function Ra(t,e,r){var i=t;do{var n=i.prev,s=i.next.next;!va(n,s)&&ya(n,i,i.next,s)&&ba(n,s)&&ba(s,n)&&(e.push(n.i/r+Ca),e.push(i.i/r+Ca),e.push(s.i/r+Ca),_a(i),_a(i.next),i=t=s),i=i.next}while(i!==t);return sa(i)}function Oa(t,e,r,i,n,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&da(a,o)){var u=Ta(a,o);return a=sa(a,a.next),u=sa(u,u.next),wa(a,e,r,i,n,s),void wa(u,e,r,i,n,s)}o=o.next}a=a.next}while(a!==t)}var Ma=2;function Pa(t,e){for(var r=t.s,i=t.p,n=r[1],s=i[1],a=0,o=0;o<n.length;o++){a+=n[o].length-1}var u,h=new Float32Array(a*jn),c=e.indexBase,l=void 0===c?0:c,f=e.uvTransform,p=0,d=0,m=0,v=1,y=1;f&&(d=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=s[b],_=s[b+1]||s[0],A=T,C=[0,0],S=0;S<A.length-1;S++){Fa(C,A[S],E,_,E[4],E[5],_[2],_[3]),R(C[0],C[1])}var w=Sa(Array.from(h),null,jn,l);return{aPoint:h,index:new Uint16Array(w)};function R(t,e){h[p++]=t/2,h[p++]=e/2,f?(g[0]=t,g[1]=e,La(g,g,x),h[p++]=d+(g[0]+1)/2*v,h[p++]=m+(g[1]+1)/2*y):(h[p++]=(t+1)/2,h[p++]=(e+1)/2),p+=Ma}}function Ia(t,e){for(var r=[],i=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[Ct.SHAPE_POINTS,t.p],s:[Ct.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[Ct.SHAPE_POINTS,t.g.p],s:[Ct.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,s=0,a=0,o=0;o<i.length;o++){var u=Pa(i[o],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,r.push(u),s+=u.aPoint.length,a+=u.index.length}if(1===r.length)return r[0];for(var h=new Float32Array(s),c=new Uint16Array(a),l=0,f=0,p=0;l<r[l];l++){var d=r[l];h.set(d.aPoint,f),f+=d.aPoint.length,c.set(d.index,p),p+=d.index.length}return{aPoint:h,index:c}}function La(t,e,r){var i=Math.cos(r),n=Math.sin(r),s=e[0],a=e[1];return t[0]=i*s+n*a,t[1]=-n*s+i*a,t}function Fa(t,e,r,i,n,s,a,o){var u=1-e,h=u*u*u,c=3*e*u*u,l=3*e*e*u,f=e*e*e;return t[0]=h*r[0]+c*n+l*a+f*i[0],t[1]=h*r[1]+c*s+l*o+f*i[1],t}var Va=function(){function t(t){var e=t.time,r=t.interval,i=t.count,n=t.cycles,s=t.probability;this.time=+e||0,this.interval=+r||1,this.count=a(i,Tn)?i:Yn(i),this.cycles=+n||1/0,this.probability=isNaN(s)?1:+s,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}(),Da=function(t){this.content=t},Na=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 r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},e.shiftNode=function(t){var e=new Da(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(this.sort(r.content,e.content)<=0))return r.pre?this.insertNode(r.pre,e):(this.first=e,e.next=r,r.pre=e),e;if(!r.next)return this.insertNode(r,e),this.last=e;r=r.next}},e.pushNode=function(t){var e=new Da(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(this.sort(e.content,r.content)<=0))return this.insertNode(r,e),r===this.last&&(this.last=e),e;if(this.first===r)return r.pre=e,e.next=r,this.first=e;r=r.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var r=this.first=e.next;r&&(r.pre=null)}else if((e=this.last)===t){var i=this.last=e.pre;i&&(i.next=null)}else if(t){var n=t.pre,s=t.next;n.next=s,s&&(s.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var r=this.first,i=0;if(r)do{t.call(e||this,r.content,i++)}while(r=r.next)},e.forEachReverse=function(t,e){var r=this.last,i=this.length-1;if(r)do{t.call(e||this,r.content,i--)}while(r=r.pre)},e.getNodeByIndex=function(t){var e=0,r=this.first;if(!r||t>=this.length||t<0)return null;for(;e<t;)r=r.next,e++;return r},t}(),ka="lookup_texture",za="offscreen_canvas",Ua={};function Ba(t){return Ua[t]}var Ga=new Ae,ja=new Ae,Xa=function(){function t(t,e){this.pointStart=[];var r,i=e.colorOverLifetime,n=e.colorOverTrail,s=e.maxTrailCount,o=e.opacityOverLifetime,u=void 0===o?Yn(1):o,h=e.widthOverTrail,c=e.name,l=e.occlusion,f=e.blending,p=e.maskMode,d=e.textureMap,m=void 0===d?[0,0,1,1]:d,v=e.texture,y=e.transparentOcclusion,g=e.minimumVertexDistance,x=e.lifetime,b=e.matrix,T=t.gpuCapability,E=T.detail,_=T.level,A=Math.max(e.pointCountPerTrail,2),C={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},S=E.maxVertexTextures>0,w=(null!=(r=t.renderer)?r:{}).env,R={},O=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",w===Xn]],M=s>64,P=0;i&&(O.push(["COLOR_OVER_LIFETIME",!0]),P|=1,R.uColorOverLifetime=ur.createWithData(t,I(i))),n&&(O.push(["COLOR_OVER_TRAIL",!0]),P|=4,R.uColorOverTrail=ur.createWithData(t,I(n))),M?(O.push(["ATTR_TRAIL_START",1]),P|=8):R.uTrailStart=new Float32Array(s),R.uOpacityOverLifetimeValue=u.toUniform(C);var L=h.toUniform(C);O.push(["VERT_CURVE_VALUE_COUNT",C.index],["VERT_MAX_KEY_FRAME_COUNT",C.max]),R.uVCurveValues=Tn.getAllData(C);var F={shader:{vertex:fi,fragment:ci,macros:O,glslVersion:1===_?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+P+"+"+C.index+"+"+C.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},V=A*s*2,D=(A-1)*s,N=Float32Array.BYTES_PER_ELEMENT,k=12*N,z={attributes:{aColor:{size:4,stride:k,data:new Float32Array(12*V)},aSeed:{size:1,stride:k,offset:4*N,dataSource:"aColor"},aInfo:{size:3,stride:k,offset:5*N,dataSource:"aColor"},aPos:{size:4,stride:k,offset:8*N,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(V)},aDir:{size:3,data:new Float32Array(3*V)}},indices:{data:new Uint16Array(6*V)},drawCount:6*D,name:"trail#"+c,bufferUsage:rr.DYNAMIC_DRAW};if(M)z.attributes.aTrailStart={size:1,data:new Float32Array(V)};else{var U=new Float32Array(V);z.attributes.aTrailStartIndex={size:1,data:U};for(var B=0;B<s;B++)for(var G=2*A,j=B*G,X=0;X<G;X++)U[j+X]=B}var H=wr(f),W=Nr.create(t,F);W.blending=!0,W.depthMask=l,W.depthTest=!0,Mr(W,p),Rr(W,f);var Y=this.mesh=ei.create(t,{name:"MTrail_"+c,material:W,geometry:jr.create(t,z)}),Z=null!=v?v:ur.createWithData(t);Object.keys(R).map((function(t){var e=R[t];if(a(e,ur))W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var r=[],i=0;i<e.length;i+=4){var n=new Ce(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}W.setVector4Array(t,r)}else W.setVector4(t,Ce.fromArray(e))})),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",Ce.fromArray(L)),W.setVector2("uTexOffset",new _e(0,0)),W.setVector4("uTextureMap",Ce.fromArray(m)),W.setVector4("uParams",new Ce(0,A-1,0,0)),W.setTexture("uMaskTex",Z),W.setVector4("uColorParams",new Ce(v?1:0,+H,0,+(l&&!y))),this.maxTrailCount=s,this.pointCountPerTrail=A,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(s)}var e=t.prototype;return e.addPoint=function(t,e,r){r=r||{};var i=this.trailCursors[t],n=this.pointCountPerTrail,s=this.geometry,a=n-1,o=i%n,u=(i-1)%n,h=(i-2)%n,c=this.getTrailPosition(t,u,Ga);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+o,f=Za(c,e),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,v=6*l,y=new Float32Array(6);y.set(f,0),y.set(f,3),s.setAttributeSubData("aDir",v,y),s.setAttributeSubData("aTime",2*l,new Float32Array([p,p]));var g=r.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(g,0),x.set(d,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(g,12),x.set(d,16),x[19]=1,x.set(b,20),x[23]=-.5*m,s.setAttributeSubData("aColor",24*l,x),u>=0){var T=this.getTrailPosition(t,h,ja),E=new Float32Array(Za(T,c,e)),_=6*(t*n+u);s.setAttributeSubData("aDir",_,E),s.setAttributeSubData("aDir",_+3,E);var A=t*n*2,C=new Uint16Array([2*u+A,2*u+1+A,2*o+A,2*o+A,2*u+1+A,2*o+1+A]),S=6*(t*a+(i-1)%a);s.setIndexSubData(S,C)}i=++this.trailCursors[t];var w=this.mesh.material,R=w.getVector4("uParams"),O=d[2];if(this.useAttributeTrailStart){for(var M=2*n,P=new Float32Array(M),I=0;I<M;I++)P[I]=O;s.setAttributeSubData("aTrailStart",t*P.length,P)}else{var L=w.getFloats("uTrailStart");null!=L&&(L[t]=O,w.setFloats("uTrailStart",L))}R&&(R.y=Math.max(R.y,i-1)-Math.max(0,i-n),w.setVector4("uParams",R))}},e.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=24*(t*i+e)+8,s=this.geometry.getAttributeData("aColor");return N(s),r.x=s[n],r.y=s[1+n],r.z=s[2+n],r}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();N(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");N(e);for(var r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();N(r),r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),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){},se(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}(),Ha=new Ae,Wa=new Ae,Ya=new Ae;function Za(t,e,r){var i=Ha;return t||r?(t?r?(Wa.subtractVectors(e,t).normalize(),Wa.subtractVectors(r,e),Ya.copyFrom(Wa).normalize(),i.addVectors(Wa,Ya)):i.subtractVectors(e,t):i.subtractVectors(r,e),i.normalize().toArray()):[0,0,0]}var qa=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).lastTime=0,e}_t(e,t);var r=e.prototype;return r.start=function(t){var e=t.output.getUserData();!this.particleSystem&&a(e,exports.VFXItem)&&(this.particleSystem=e.getComponent(exports.ParticleSystem),this.particleSystem&&(this.particleSystem.name=e.name,this.particleSystem.startEmit(),this.particleSystem.initEmitterTransform()))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){var r=t.deltaTime;this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),Math.abs(this.time-this.lastTime)<.001&&(r=0),e.update(r)}this.lastTime=this.time},e}(Vs),Ka=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){return new qa(t)},e}(Ns),Qa={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"},Ja=function(){function t(t,e){var r;this.particleCount=0,this.cachedRotationVector3=new Ae,this.cachedRotationMatrix=new Wr,this.cachedLinearMove=new Ae,this.tempMatrix3=new Wr,this.VERT_MAX_KEY_FRAME_COUNT=0;var i,n,s=(null!=(r=t.renderer)?r:{}).env,o=e.speedOverLifetime,u=e.colorOverLifetime,h=e.linearVelOverLifetime,c=e.orbitalVelOverLifetime,l=e.sizeOverLifetime,f=e.rotationOverLifetime,p=e.sprite,d=e.gravityModifier,m=e.maxCount,v=e.textureFlip,y=e.useSprite,g=e.name,x=e.gravity,b=e.forceTarget,T=e.side,E=e.occlusion,_=e.anchor,A=e.blending,C=e.maskMode,S=e.mask,w=e.transparentOcclusion,R=e.meshSlots,O=e.renderMode,M=void 0===O?0:O,P=e.diffuse,L=void 0===P?ur.createWithData(t):P,F=t.gpuCapability.detail,V=F.halfFloatTexture,D=F.maxVertexUniforms,N=[["RENDER_MODE",+M],["ENV_EDITOR",s===Xn]],k=t.gpuCapability.level,z={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},U={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},B=D>0,G={},j=0,X=0;(this.useSprite=y,B&&N.push(["ENABLE_VERTEX_TEXTURE",!0]),o&&(N.push(["SPEED_OVER_LIFETIME",!0]),X|=2,G.uSpeedLifetimeValue=o.toUniform(z)),(null==p?void 0:p.animate)&&(N.push(["USE_SPRITE",!0]),X|=4,G.uFSprite=G.uSprite=new Float32Array([p.col,p.row,p.total,p.blend?1:0]),this.useSprite=!0),(null==u?void 0:u.color)&&(N.push(["COLOR_OVER_LIFETIME",!0]),X|=16,G.uColorOverLifetime=a(u.color,ur)?u.color:ur.createWithData(t,I(u.color))),(null==u?void 0:u.opacity)?G.uOpacityOverLifetimeValue=u.opacity.toUniform(z):G.uOpacityOverLifetimeValue=Yn(1).toUniform(z),["x","y","z"].forEach((function(t,e){var r=0,n=0;(null==h?void 0:h[t])&&(G["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(z),r=1,X|=1<<7+e,h.enabled=!0),N.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==c?void 0:c[t])&&(G["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=c[t].toUniform(z),n=1,X|=1<<10+e,i=!0,c.enabled=!0),N.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==h?void 0:h.asMovement)&&(N.push(["AS_LINEAR_MOVEMENT",!0]),X|=32),i&&((null==c?void 0:c.asRotation)&&(N.push(["AS_ORBITAL_MOVEMENT",!0]),X|=64),G.uOrbCenter=new Float32Array((null==c?void 0:c.center)||[0,0,0])),G.uSizeByLifetimeValue=null==l?void 0:l.x.toUniform(z),null==l?void 0:l.separateAxes)&&(N.push(["SIZE_Y_BY_LIFE",1]),X|=16384,G.uSizeYByLifetimeValue=null==l||null==(n=l.y)?void 0:n.toUniform(z));(null==f?void 0:f.z)&&(G.uRZByLifeTimeValue=f.z.toUniform(z),X|=32768,N.push(["ROT_Z_LIFETIME",1])),(null==f?void 0:f.x)&&(G.uRXByLifeTimeValue=f.x.toUniform(z),X|=65536,N.push(["ROT_X_LIFETIME",1])),(null==f?void 0:f.y)&&(G.uRYByLifeTimeValue=f.y.toUniform(z),X|=1<<17,N.push(["ROT_Y_LIFETIME",1])),(null==f?void 0:f.asRotation)&&(N.push(["ROT_LIFETIME_AS_MOVEMENT",1]),X|=1<<18),G.uGravityModifierValue=d.toUniform(z),b&&(N.push(["FINAL_TARGET",!0]),X|=1<<19,G.uFinalTarget=new Float32Array(b.target||[0,0,0]),G.uForceCurve=b.curve.toUniform(z)),V&&U.max?(X|=1<<20,G.uFCurveValueTexture=hr(t,Tn.getAllData(U,!0),U.index,1)):G.uFCurveValues=Tn.getAllData(U);var H=z.max+z.curves.length-32>D;if(2===k&&(z.max=-1,z.index=R?R[0]:to(z.index),U.index>0&&(U.max=-1,U.index=R?R[1]:to(U.index))),H&&V&&B){var W=hr(t,Tn.getAllData(z,!0),z.index,1);G.uVCurveValueTexture=W,j=1}else G.uVCurveValues=Tn.getAllData(z);var Y=["-p:",M,X,z.index,z.max,U.index,U.max].join("+");N.push(["VERT_CURVE_VALUE_COUNT",z.index],["FRAG_CURVE_VALUE_COUNT",U.index],["VERT_MAX_KEY_FRAME_COUNT",z.max],["FRAG_MAX_KEY_FRAME_COUNT",U.max]),this.VERT_MAX_KEY_FRAME_COUNT=z.max;var Z={shader:{fragment:ci,vertex:"#define LOOKUP_TEXTURE_CURVE "+j+"\n"+li,glslVersion:1===k?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,cacheId:Y,macros:N,name:"particle#"+g},uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},q=wr(A);G.uTexOffset=new Float32Array(L?[1/L.getWidth(),1/L.getHeight()]:[0,0]),G.uMaskTex=L,G.uColorParams=new Float32Array([L?1:0,+q,0,+(!!E&&!w)]),G.uParams=[0,0,0,0],G.uAcceleration=[(null==x?void 0:x[0])||0,(null==x?void 0:x[1])||0,(null==x?void 0:x[2])||0,0];var K=Nr.create(t,Z);K.blending=!0,K.depthTest=!0,K.depthMask=!!E,K.stencilRef=S?[S,S]:void 0,Mr(K,C),Rr(K,A),Or(K,T),Object.keys(G).map((function(t){var e=G[t];if(a(e,ur))K.setTexture(t,e);else{var r=[];switch(Qa[t]){case"vec4":K.setVector4(t,Ce.fromArray(e));break;case"vec3":K.setVector3(t,Ae.fromArray(e));break;case"vec2":K.setVector2(t,_e.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new Ce(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}K.setVector4Array(t,r),r.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),K.setVector3("emissionColor",new Ae(0,0,0)),K.setFloat("emissionIntensity",0);var Q=jr.create(t,function(t,e,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,s={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*i,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*i,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*i,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*i,data:new Float32Array(0)},aSeed:{size:1,offset:3*i,stride:8*i,dataSource:"aRot"},aColor:{size:4,offset:4*i,stride:8*i,dataSource:"aRot"},aOffset:{size:4,stride:4*i,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*i,data:new Float32Array(0)},aRotation1:{size:3,offset:3*i,stride:9*i,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*i,stride:9*i,dataSource:"aRotation0"}};e&&(s.aSprite={size:3,stride:3*i,data:new Float32Array(0)});return{attributes:s,indices:{data:new Uint16Array(0)},name:r,maxVertex:t}}(4*m,this.useSprite,"particle#"+g)),J=ei.create(t,{name:"MParticle_"+g,material:K,geometry:Q});this.anchor=_,this.mesh=J,this.geometry=J.firstGeometry(),this.forceTarget=b,this.sizeOverLifetime=l,this.speedOverLifetime=o,this.linearVelOverLifetime=h,this.orbitalVelOverLifetime=c,this.orbitalVelOverLifetime=c,this.gravityModifier=d,this.rotationOverLifetime=f,this.maxCount=m,this.textureOffsets=v?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var e=t.prototype;return e.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),r=32*t+4;return N(e),[e[r],e[r+1],e[r+2],e[r+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(),r=t.getIndexData(),i=0;i<e.length;i++){var n=e[i],s=t.getAttributeData(n);s&&t.setAttributeData(n,new s.constructor(0))}t.setIndexData(new r.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),r=Math.ceil(e.length/12);this.applyTranslation(r,t),this.applyRotation(r,t),this.applyLinearMove(r,t)},e.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),r=0;r<e.length;r+=4)e[r+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var r=this.maxCount;if(t<r){var i=t+1,n=4*i,s=this.geometry,a=i>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 c=new Ae,l=new Re,f=new Ae(1,1,1);e.transform.assignWorldTRS(c,l,f);var p,d=Bs.getRotation(l,new Hr),m=c.toArray(),v=d.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],b=[0,0,1,1],T=e.vel,E=e.color,_=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],A=Math.random();h&&(p=e.sprite);for(var C=0;C<4;C++){var S=2*C,w=3*C,R=4*C,O=12*C,M=8*C;u.aPos.set(m,O),T.fill(u.aPos,O+3),u.aRot.set(v,M),u.aRot[M+3]=A,u.aRot.set(E,M+4),h&&u.aSprite.set(p,w);var P=e.uv||b;if(P){var I=h?1-y[S+1]:y[S+1];g[0]=P[0]+y[S]*P[2],g[1]=P[1]+I*P[3]}u.aOffset.set(g,R);for(var L=C+C,F=(_[L]-this.anchor.x)*f.x,V=(_[L+1]-this.anchor.y)*f.y,D=0;D<3;D++)u.aPos[O+6+D]=e.dirX.getElement(D)*F,u.aPos[O+9+D]=e.dirY.getElement(D)*V}var k=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(a){var z=x(s.getIndexData(),6*i,6*r,o);z.set(k,6*t),s.setIndexData(z),this.maxParticleBufferCount=z.length/6}else s.setIndexSubData(6*t,k);Object.keys(u).forEach((function(e){var i=u[e],h=s.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(a){var c=s.getAttributeData(e);N(c);var l=x(c,n*h,4*r*h,o);l.set(i,i.length*t),s.setAttributeData(e,l)}else s.setAttributeSubData(e,i.length*t,i)})),this.particleCount=Math.max(i,this.particleCount),s.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var r=this.time,i=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),s=this.geometry.getAttributeData("aOffset");i.length<3*t&&(i=this.expandArray(i,3*t));for(var a=0,o=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),c=this.mesh.material.getVector4("uGravityModifierValue"),l=0;l<t;l+=4){var f=12*l+3;a=n[f],o=n[f+1],u=n[f+2];var p=r-s[4*l+2],d=s[4*l+3];if(h&&c){var m=this.gravityModifier.getIntegrateValue(0,p,d),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(p/d);a=a*x+v,o=o*x+y,u=u*x+g}else a+=v,o+=y,u+=g}var b=3*l;if(s[4*l+2]<r){var T=a*(e/1e3),E=o*(e/1e3),_=u*(e/1e3);i[b]+=T,i[b+1]+=E,i[b+2]+=_,i[b+3]+=T,i[b+4]+=E,i[b+5]+=_,i[b+6]+=T,i[b+7]+=E,i[b+8]+=_,i[b+9]+=T,i[b+10]+=E,i[b+11]+=_}}this.geometry.setAttributeData("aTranslation",i)},e.applyRotation=function(t,e){var r=this.geometry.getAttributeData("aRotation0"),i=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),s=this.geometry.getAttributeData("aSeed"),o=this.time,u=this.cachedRotationMatrix;r.length<9*t&&(r=this.expandArray(r,9*t));for(var h=0;h<t;h+=4){var c=Ee((o-i[4*h+2])/i[4*h+3],0,1),l=8*h,f=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),p=s[8*h+3],d=f;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(a(this.rotationOverLifetime.x,An)?d.x+=this.rotationOverLifetime.x.getValue(c,p):d.x+=this.rotationOverLifetime.x.getValue(c)),this.rotationOverLifetime.y&&(a(this.rotationOverLifetime.y,An)?d.y+=this.rotationOverLifetime.y.getValue(c,p):d.y+=this.rotationOverLifetime.y.getValue(c)),this.rotationOverLifetime.z&&(a(this.rotationOverLifetime.z,An)?d.z+=this.rotationOverLifetime.z.getValue(c,p):d.z+=this.rotationOverLifetime.z.getValue(c))):u.setZero(),0===d.dot(d)&&u.identity();var m=Math.PI/180,v=d.x*m,y=d.y*m,g=d.z*m,x=Math.sin(v),b=Math.sin(y),T=Math.sin(g),E=Math.cos(v),_=Math.cos(y),A=Math.cos(g);u.set(A,-T,0,T,A,0,0,0,1),u.multiply(this.tempMatrix3.set(_,0,b,0,1,0,-b,0,_)),u.multiply(this.tempMatrix3.set(1,0,0,0,E,-x,0,x,E));var C=9*h,S=u.elements;r.set(S,C),h+4<=t&&(r.set(S,C+9),r.set(S,C+18),r.set(S,C+27))}this.geometry.setAttributeData("aRotation0",r)},e.applyLinearMove=function(t,e){var r=this.geometry.getAttributeData("aLinearMove"),i=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),s=this.time;r.length<3*t&&(r=this.expandArray(r,3*t));var o=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=s-i[4*u+2],c=i[4*u+3],l=h/c,f=n[8*u+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(a(this.linearVelOverLifetime.x,An)?o.x=this.linearVelOverLifetime.x.getValue(l,f):o.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(a(this.linearVelOverLifetime.y,An)?o.y=this.linearVelOverLifetime.y.getValue(l,f):o.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(a(this.linearVelOverLifetime.z,An)?o.z=this.linearVelOverLifetime.z.getValue(l,f):o.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(a(this.linearVelOverLifetime.x,An)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.y&&(a(this.linearVelOverLifetime.y,An)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.z&&(a(this.linearVelOverLifetime.z,An)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,c)));var p=3*u;r[p]=o.x,r[p+1]=o.y,r[p+2]=o.z,r[p+3]=o.x,r[p+4]=o.y,r[p+5]=o.z,r[p+6]=o.x,r[p+7]=o.y,r[p+8]=o.z,r[p+9]=o.x,r[p+10]=o.y,r[p+11]=o.z}this.geometry.setAttributeData("aLinearMove",r)},e.expandArray=function(t,e){var r=new Float32Array(e);return r.set(t),r},t}(),$a=[10,32,64,160];function to(t){for(var e=0;e<$a.length;e++){var r=$a[e];if(r>t)return r}return t||$a[0]}var eo=function(t){function e(e,r,i){var n;(n=t.call(this,e)||this).name="ParticleSystemRenderer",r&&(n.particleMesh=new Ja(e,r)),i&&(n.trailMesh=new Xa(e,i));var s=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(s.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=s,n}_t(e,t);var r=e.prototype;return r.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=s(this.meshes);!(t=e()).done;){t.value.onStart()}},r.onUpdate=function(t){var e,r=this.particleMesh.time,i=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new Ce;this.particleMesh.mesh.material.setVector4("uParams",i.set(r,this.item.duration,0,0))},r.render=function(t){for(var e,r=s(this.meshes);!(e=r()).done;){e.value.render(t)}},r.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},r.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},r.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},r.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},r.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},r.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach((function(r){t.push(e[r])})),this.trailMesh){var r=this.trailMesh.mesh.material.textures;Object.keys(r).forEach((function(e){t.push(r[e])}))}return t},r.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},r.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},r.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},r.hasTrail=function(){return void 0!==this.trailMesh},r.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},r.addTrailPoint=function(t,e,r){var i;null==(i=this.trailMesh)||i.addPoint(t,e,r)},r.setTrailStartPosition=function(t,e){var r;null==(r=this.trailMesh)||r.setPointStartPos(t,e)},r.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(me);exports.ParticleSystem=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).destroyed=!1,i.getHitTestParams=function(t){var e=i.interaction;if(t||e)return{type:exports.HitTestType.custom,collect:function(t){return i.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===Ot.removeParticle,ray:t})}}},r&&i.fromData(r),i}_t(e,t);var r=e.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),r=this.item.transform.rotation.clone(),i=this.props.emitterTransform&&this.props.emitterTransform.path;i&&(i[0]===Ct.CONSTANT_VEC3?e.add(i[1]):t=Yn(i)),this.basicTransform={position:e,rotation:r,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 s=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(s)}},r.updateEmitterTransform=function(t){var e=this.basicTransform,r=e.path,i=e.position.clone();if(r){var n=this.item.duration;i.add(r.getValue(t/n))}if(this.transform.setPosition(i.x,i.y,i.z),this.options.particleFollowParent){var s=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(s)}},r.addParticle=function(t,e){var r,i=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(i.length<e)r=n[1]=i.length;else{var s=i.first;i.removeNode(s),r=n[1]=s.content[1]}i.pushNode(n),this.renderer.setParticlePoint(r,t),this.clearPointTrail(r),this.transform.parentTransform&&this.renderer.setTrailStartPosition(r,this.transform.parentTransform.position.clone())},r.setVisible=function(t){this.renderer.setVisible(t)},r.setOpacity=function(t){var e,r=this.renderer.particleMesh.mesh.material,i=this.renderer.particleMesh.mesh.geometry,n=(null==(e=r.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new Ce(n[0],n[1],n[2],t));for(var s=i.getAttributeData("aColor")||[],a=0;a<s.length;a+=32)s[8*a+7]=t},r.setColor=function(t,e,r,i){var n,s=this.renderer.particleMesh.mesh.material,a=this.renderer.particleMesh.mesh.geometry,o=(null==(n=s.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];s.setVector4("uOpacityOverLifetimeValue",new Ce(o[0],o[1],o[2],i));for(var u=a.getAttributeData("aColor")||[],h=0;h<u.length;h+=32)u[8*h+4]=t,u[8*h+5]=e,u[8*h+6]=r,u[8*h+7]=i},r.setParentTransform=function(t){},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.reset=function(){this.renderer.reset(),this.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new Na((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},r.update=function(t){var e=this;if(this.started&&!this.frozen){var r=this.lastUpdate+t/1e3,i=this.options,n=this.loopStartTime,s=this.emission;this.lastUpdate=r,this.upDirectionWorld=null,this.renderer.updateTime(r,t);var a=this.particleLink,o=(r-n)/this.item.duration,u=this.timePassed,h=!1,c=function(){e.trails&&!h&&(h=!0,a.forEach((function(t){var r=t[0],i=t[1],n=t[2],s=t[3];r<u?e.clearPointTrail(i):u>n&&e.updatePointTrail(i,o,s,n)})))};if(this.ended){if(this.item.endBehavior!==wt.restart&&wt.destroy===this.item.endBehavior){var l=a.last;l&&l.content[0]<this.lastUpdate&&(this.destroyed=!0)}}else{var f=this.item.duration,p=this.lifetime;if(u<f){var d=1/s.rateOverTime.getValue(p),m=Math.floor((u-this.lastEmitTime)/d),v=m,y=d/m,g=r,x=i.maxCount;this.updateEmitterTransform(u);for(var b=function(){var t=a.first;return e.emissionStopped||a.length===x&&t&&t.content[0]-n>u},T=0;T<v&&T<x&&!b();T++){var E=this.createPoint(p);E.delay+=g+T*y,this.addParticle(E,x),this.lastEmitTime=u}for(var _=s.bursts,A=(null==_?void 0:_.length)-1,C=0;A>=0&&C<x&&!b();A--){var S=_[A],w=!S.disabled&&S.getGeneratorOptions(u,p);if(w){var R=s.burstOffsets[A],O=R&&R[w.cycleIndex]||[0,0,0];S.once&&this.removeBurst(A);for(var M=0;M<w.count&&C<x;M++){var P;if(b())break;var I=this.initPoint(this.shape.generate({total:w.total,index:w.index,burstIndex:M,burstCount:w.count}));I.delay+=g,C++,(P=I.transform).translate.apply(P,[].concat(O)),this.addParticle(I,x)}}}}else if(this.item.endBehavior===wt.restart)c(),this.loopStartTime=r-f,this.lastEmitTime-=f,this.lastUpdate-=f,s.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=f,t[2]-=f,t[3].delay-=f})),this.renderer.minusTimeForLoop(f);else{this.ended=!0,this.item.endBehavior===wt.freeze&&(this.frozen=!0)}}c()}},r.onDestroy=function(){this.item&&this.item.composition&&(this.item.composition.destroyTextures(this.getTextures()),this.meshes.forEach((function(t){return t.dispose({material:{textures:exports.DestroyOptions.keep}})})))},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,r=[],i=this.particleCount,n=0;if(!t||!e)return r;for(var s=t.last,a=!1;!a;){var o=s.content[0],u=s.content[3];if(o>this.timePassed){var h=this.getPointPosition(u);r.push({center:h,size:u.transform.scale}),s.pre?s=s.pre:a=!0}++n>i&&(a=!0)}return r},r.raycast=function(t){var e=this.particleLink,r=this.renderer;if(e&&r){var i=e.last,n=[],s=new Ae,a=!1;if(i&&i.content)do{var o=i.content,u=o[0],h=o[1];o[2];var c=o[3];if(!(u>this.timePassed))break;var l=this.getPointPosition(c),f=t.ray,p=!1;f&&(p=!!f.intersectSphere({center:l,radius:t.radius},s)),p&&(t.removeParticle&&(r.removeParticlePoint(h),this.clearPointTrail(h),i.content=[0]),n.push(l),t.multiple||(a=!0))}while((i=i.pre)&&!a);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,r,i){var n=this.renderer;if(n.hasTrail()){var s=this.trails,a=this.getPointPosition(r),o=s.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=r.transform.getWorldScale().toArray(),h=1,c=s.lifetime.getValue(e);if(s.sizeAffectsWidth&&(h*=u[0]),s.sizeAffectsLifetime&&(c*=u[0]),s.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&a.subtract(l)}n.addTrailPoint(t,a,{color:o,lifetime:c,size:h,time:i})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,s=t.gravity,a=void 0===s?[]:s,o=this.options.forceTarget,u=this.lastUpdate-n,h=new Ae,c=Ae.fromArray(a);e.assignWorldTRS(h);var l=Zi(new Ae,this.options,c,u,i,h,r);if(o){var f=o.target||[0,0,0],p=o.curve.getValue(u/i),d=1-p;l.x=l.x*d+f[0]*p,l.y=l.y*d+f[1]*p,l.z=l.z*d+f[2]*p}return l},r.initPoint=function(t){var e=this.options,r=this.lifetime,i=this.shape,n=e.startSpeed.getValue(r),s=e.particleFollowParent?Pe.IDENTITY:this.transform.getWorldMatrix(),a=t.position,o=s.transformPoint(a,new Ae),u=new Bs({position:o,valid:!0}),h=t.direction;if(h=s.transformNormal(h,ro).normalize(),e.startTurbulence&&e.turbulence){for(var c=0;c<3;c++)oo.setElement(c,e.turbulence[c].getValue(r));uo.setFromVector3(oo.negate()),co.setFromEuler(uo).transformNormal(h).normalize()}var l,f=so,p=ao;i.alignSpeedDirection?(p.copyFrom(h),this.upDirectionWorld||(i.upDirection?this.upDirectionWorld=i.upDirection.clone():this.upDirectionWorld=Ae.Z.clone(),s.transformNormal(this.upDirectionWorld)),f.crossVectors(p,this.upDirectionWorld).normalize(),f.isZero()&&f.set(1,0,0)):(f.set(1,0,0),p.set(0,1,0));var d=this.textureSheetAnimation;d&&d.animate&&((l=ho)[0]=d.animationDelay.getValue(r),l[1]=d.animationDuration.getValue(r),l[2]=d.cycles.getValue(r));var m=no;e.start3DRotation?m.set(e.startRotationX.getValue(r),e.startRotationY.getValue(r),e.startRotationZ.getValue(r)):e.startRotation?m.set(0,0,e.startRotation.getValue(r)):m.set(0,0,0),u.setRotation(m.x,m.y,m.z);var v=e.startColor.getValue(r);3===v.length&&(v[3]=1);var y=io;if(e.start3DSize)y.x=e.startSizeX.getValue(r),y.y=e.startSizeY.getValue(r);else{var g=e.startSize.getValue(r),x=e.sizeAspect.getValue(r);y.x=g,y.y=0===x?0:g/x}var b=h.clone();if(b.multiply(n),!e.particleFollowParent){var T=new Ae;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(r),lifetime:e.startLifetime.getValue(r),uv:fo(this.uvs,!0),gravity:e.gravity,sprite:l,dirY:p,dirX:f,transform:u}},r.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&a(e,Array)){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return-1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.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))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:exports.HitTestType.sphere,area:t}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e;this.props=r,this.destroyed=!1;var i,n,s,o,u,h=r.options,c=r.positionOverLifetime,l=void 0===c?{}:c,f=r.shape,p=null==l?void 0:l.gravityOverLifetime,d=qi(null==l?void 0:l.gravity),m=r.textureSheetAnimation,v=m?{animationDelay:Yn(m.animationDelay||0),animationDuration:Yn(m.animationDuration||1),cycles:Yn(m.cycles||1),animate:m.animate,col:m.col,row:m.row,total:m.total||m.col*m.row}:void 0,y=!!(f&&f.turbulenceX||(null==f?void 0:f.turbulenceY)||(null==f?void 0:f.turbulenceZ));y&&(i=[Yn(null!=(n=f.turbulenceX)?n:0),Yn(null!=(s=f.turbulenceY)?s:0),Yn(null!=(o=f.turbulenceZ)?o:0)]);this.name="ParticleSystem",this.shape=ia(f),this.emission={rateOverTime:Yn(r.emission.rateOverTime),burstOffsets:lo(null!=(u=r.emission.burstOffsets)?u:[]),bursts:(r.emission.bursts||[]).map((function(t){return new Va(t)}))},this.textureSheetAnimation=v;var g,x,b=r.renderer||{},T=r.rotationOverLifetime;T&&((g={}).asRotation=!!T.asRotation,g.z=T.z?Yn(T.z):Yn(0),T.separateAxes&&(g.x=T.x&&Yn(T.x),g.y=T.y&&Yn(T.y))),(null==l?void 0:l.forceTarget)&&(x={target:l.target||[0,0,0],curve:Yn(l.forceCurve||[Ct.LINE,[[0,0],[1,1]]])});var E={x:l.linearX&&Yn(l.linearX||0),y:l.linearY&&Yn(l.linearY||0),z:l.linearZ&&Yn(l.linearZ||0),asMovement:l.asMovement},_={x:l.orbitalX&&Yn(l.orbitalX),y:l.orbitalY&&Yn(l.orbitalY),z:l.orbitalZ&&Yn(l.orbitalZ),center:l.orbCenter,asRotation:l.asRotation},A=r.sizeOverLifetime||{},C=r.colorOverLifetime,S=(null==A?void 0:A.separateAxes)?{separateAxes:!0,x:Yn(A.x),y:Yn(A.y)}:{separateAxes:!1,x:Yn(("size"in A?A.size:A.x)||1)};b.anchor=b.anchor||[0,0];var w,R,O=_e.fromArray(b.anchor);this.options={particleFollowParent:!!h.particleFollowParent,startLifetime:Yn(h.startLifetime),startDelay:Yn(h.startDelay||0),startSpeed:Yn(l.startSpeed||0),startColor:Yn(h.startColor),looping:!1,maxCount:null!=(w=h.maxCount)?w:0,gravityModifier:Yn(p||0),gravity:d,start3DSize:!!h.start3DSize,startTurbulence:y,turbulence:i,speedOverLifetime:l.speedOverLifetime&&Yn(l.speedOverLifetime),linearVelOverLifetime:E,orbitalVelOverLifetime:_,forceTarget:x},h.startRotationZ&&(this.options.startRotation=Yn(h.startRotationZ||0)),(h.startRotationX||h.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=Yn(h.startRotationX||0),this.options.startRotationY=Yn(h.startRotationY||0),this.options.startRotationZ=Yn(h.startRotationZ||0)),h.start3DSize?(this.options.startSizeX=Yn(h.startSizeX),this.options.startSizeY=Yn(h.startSizeY)):(this.options.startSize=Yn(h.startSize),this.options.sizeAspect=Yn(h.sizeAspect||1));var M={meshSlots:h.meshSlots,name:this.name,matrix:Pe.IDENTITY,shaderCachePrefix:"",renderMode:b.renderMode||yt.BILLBOARD,side:b.side||ct.DOUBLE,gravity:d,blending:b.blending||ht.ALPHA,rotationOverLifetime:g,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:v,occlusion:!!b.occlusion,transparentOcclusion:!!b.transparentOcclusion,maxCount:h.maxCount,mask:b.mask,maskMode:null!=(R=b.maskMode)?R:lt.NONE,forceTarget:x,diffuse:b.texture,sizeOverLifetime:S,anchor:O};if(C){var P=C.color,I=C.opacity;M.colorOverLifetime={},I&&(M.colorOverLifetime.opacity=Yn(C.opacity)),P&&(P[0]===Ct.GRADIENT_COLOR?M.colorOverLifetime.color=C.color[1]:P[0]===Ct.RGBA_COLOR?M.colorOverLifetime.color=ur.createWithData(this.engine,{data:new Uint8Array(P[1]),width:1,height:1}):a(P,ur)&&(M.colorOverLifetime.color=P))}var L,F=[],V=[0,0,1,1];if(r.splits){var D=r.splits[0];V=(L=D[4])?[D[0],D[1],D[3],D[2]]:[D[0],D[1],D[2],D[3]]}if(v&&!v.animate)for(var N=L?v.row:v.col,k=L?v.col:v.row,z=v.total||N*k,U=0,B=0;B<N;B++)for(var G=0;G<k&&U<z;G++,U++)F.push([B*V[2]/N+V[0],G*V[3]/k+V[1],V[2]/N,V[3]/k]);else F.push(V);this.uvs=F,M.textureFlip=L;var j,X=r.trails;X&&(this.trails={lifetime:Yn(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},j={name:"Trail",matrix:Pe.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:h.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture,opacityOverLifetime:Yn(X.opacityOverLifetime||1),widthOverTrail:Yn(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion,textureMap:X.textureMap,mask:b.mask,maskMode:b.maskMode},X.colorOverLifetime&&X.colorOverLifetime[0]===Ct.GRADIENT_COLOR&&(j.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===Ct.GRADIENT_COLOR&&(j.colorOverTrail=X.colorOverTrail[1])),this.renderer=new eo(this.engine,M,j),this.renderer.item=this.item,this.meshes=this.renderer.meshes;var H,W=r.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(H=W.radius)?H:.4,behavior:W.behavior});this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},se(e,[{key:"timePassed",get:function(){return this.lastUpdate-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{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}(pe),exports.ParticleSystem=u([he(Kt.ParticleSystem)],exports.ParticleSystem);var ro=new Ae,io=new _e,no=new Hr,so=new Ae,ao=new Ae,oo=new Ae,uo=new Hr,ho=[0,0,0],co=new Pe;function lo(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var r=a(t,Array),i=r?t[0]:t.index,n=e[i];n||(n=e[i]=[]),r?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function fo(t,e){var r=Math.floor(Math.random()*t.length),i=t[r];return e||t.splice(r,1),i}var po,mo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}_t(e,t);var r=e.prototype;return r.processFrame=function(t){for(var e,r=s(this.clipPlayables);!(e=r()).done;){e.value.processFrame(t)}this.evaluate(t)},r.setClipWeight=function(t,e){if(a(t,Vs)){for(var r=0;r<this.clipPlayables.length;r++)if(this.clipPlayables[r]===t)return void(this.clipWeights[r]=e)}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},r.getClipWeight=function(t){return this.clipWeights[t]},r.getClipPlayable=function(t){return this.clipPlayables[t]},r.evaluate=function(t){},e}(Vs),vo=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(a(e,exports.VFXItem)){for(var r=e,i=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){i=!0;break}i?(r.transform.setValid(!0),r.setActive(!0)):(r.transform.setValid(!1),r.setActive(!1))}},e}(mo),yo=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}(Vs),go=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 r=!1;if(this.propertyValue=e[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var i=0;i<this.clipPlayables.length;i++){var n=this.getClipWeight(i);if(n>0){var s=this.getClipPlayable(i);if(!a(s,yo)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var o=s.value;this.addWeightedValue(o,n),r=!0}}r&&(e[this.propertyName]=this.propertyValue)}}},e}(mo),xo=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.setZero()},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.r+=t.r*e,r.g+=t.g*e,r.b+=t.b*e,r.a+=t.a*e},e}(go),bo=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue=0},r.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(go),To=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.evaluate=function(t){},e}(mo),Eo=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.evaluate=function(t){},e}(mo),_o=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();a(e,No)&&(e.time=this.getTime())},e}(Vs),Ao=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(a(e,No)){for(var r=e,i=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){i=!0;break}i?r.item.setActive(!0):r.item.setActive(!1)}},e}(mo),Co=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.evaluate=function(t){},e}(mo),So=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.x+=t.x*e,r.y+=t.y*e,r.z+=t.z*e,r.w+=t.w*e},e}(go),wo=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.x+=t.x*e,r.y+=t.y*e},e}(go),Ro=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,r=this.duration;return e-r>0&&(this.endBehavior===wt.restart?e%=r:this.endBehavior===wt.freeze&&(e=Math.min(r,e))),e},t}();exports.TrackAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}_t(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},r.createTrackMixer=function(t){return new mo(t)},r.createOutput=function(){return new Ds},r.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},r.createMixerPlayableGraph=function(t,e){for(var r,i=[],n=s(this.clips);!(r=n()).done;){var a=r.value;i.push(a)}return this.compileClips(t,i,e)},r.compileClips=function(t,e,r){for(var i,n=this.createTrackMixer(t),a=s(e);!(i=a()).done;){var o=i.value,u=this.createClipPlayable(t,o);u.setDuration(o.duration);var h=new Oo(o,u,n,this);r.push(h),n.clipPlayables.push(u),n.setClipWeight(u,0)}return n},r.createPlayable=function(t){return new Vs(t)},r.getChildTracks=function(){return this.children},r.addChild=function(t){this.children.push(t),t.parent=this},r.createClip=function(t,e){var r=new Ro;return r.asset=new t(this.engine),r.name=e||"TimelineClip"+r.id,this.addClip(r),r},r.getClips=function(){return this.clips},r.findClip=function(t){for(var e,r=s(this.clips);!(e=r()).done;){var i=e.value;if(i.name===t)return i}},r.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},r.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},r.fromData=function(e){t.prototype.fromData.call(this,e);for(var r,i=s(this.children);!(r=i()).done;){r.value.parent=this}},e}(Ns),u([ce(Ro)],exports.TrackAsset.prototype,"clips",void 0),u([ce()],exports.TrackAsset.prototype,"children",void 0),exports.TrackAsset=u([he(Kt.TrackAsset)],exports.TrackAsset),exports.TrackType=void 0,(po=exports.TrackType||(exports.TrackType={}))[po.MasterTrack=0]="MasterTrack",po[po.ObjectTrack=1]="ObjectTrack";var Oo=function(){function t(t,e,r,i){this.clip=t,this.playable=e,this.parentMixer=r,this.track=i,a(this.track.boundObject,exports.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(exports.ParticleSystem))}return t.prototype.evaluateAt=function(t){var e=this.clip,r=1,i=!1,n=!1,s=this.track.boundObject;t>=e.start+e.duration&&e.endBehavior===wt.destroy?a(s,exports.VFXItem)&&exports.VFXItem.isParticle(s)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,i=!0):t-this.clip.start>=0?(r=1,n=!0):t<e.start&&(r=0),n&&this.playable.getPlayState()!==Ps.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var o=parseFloat(e.toLocalTime(t).toFixed(3));this.playable.setTime(o),i&&this.playable.getPlayState()===Ps.Playing&&this.playable.pause()},se(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}();exports.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){return new vo(t)},e}(exports.TrackAsset),exports.ActivationTrack=u([he(Kt.ActivationTrack)],exports.ActivationTrack);var Mo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}_t(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,r=0;r<t.length-1;r++){var i=e[t[r]];void 0===i&&console.error("The "+t[r]+" property of "+e+" was not found"),e=i}this.boundObject=e},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=this.path.split(".");this.propertyNames=r},e}(exports.TrackAsset);u([ce()],Mo.prototype,"path",void 0),exports.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.createTrackMixer=function(t){var e=new bo(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},r.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,r=0;r<t.length-1;r++){var i=e[t[r]];void 0===i&&console.error("The "+t[r]+" property of "+e+" was not found"),e=i}this.boundObject=e},e}(Mo),exports.FloatPropertyTrack=u([he(Kt.FloatPropertyTrack)],exports.FloatPropertyTrack),exports.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){return new Eo(t)},e}(exports.TrackAsset),exports.SpriteColorTrack=u([he(Kt.SpriteColorTrack)],exports.SpriteColorTrack),exports.SubCompositionTrack=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){if(!this.parent||!a(this.parent.boundObject,exports.VFXItem))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(No)},r.createTrackMixer=function(t){return new Ao(t)},e}(exports.TrackAsset),exports.SubCompositionTrack=u([he(Kt.SubCompositionTrack)],exports.SubCompositionTrack),exports.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){return new Co(t)},e}(exports.TrackAsset),exports.TransformTrack=u([he(Kt.TransformTrack)],exports.TransformTrack),exports.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.updateAnimatedObject=function(){a(this.parent.boundObject,me)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(exports.TrackAsset),u([ce()],exports.MaterialTrack.prototype,"index",void 0),exports.MaterialTrack=u([he("MaterialTrack")],exports.MaterialTrack);var Po=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){return new To(t)},e}(exports.TrackAsset);exports.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){var e=new So(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(Mo),exports.Vector4PropertyTrack=u([he(Kt.Vector4PropertyTrack)],exports.Vector4PropertyTrack),exports.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){var e=new wo(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(Mo),exports.Vector2PropertyTrack=u([he("Vector2PropertyTrack")],exports.Vector2PropertyTrack),exports.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){var e=new xo(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(Mo),exports.ColorPropertyTrack=u([he(Kt.ColorPropertyTrack)],exports.ColorPropertyTrack),exports.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){var e=new yo(t);return e.curve=Yn(this.curveData),e.value=e.curve.getValue(0),e},e}(Ns),u([ce()],exports.ColorPropertyPlayableAsset.prototype,"curveData",void 0),exports.ColorPropertyPlayableAsset=u([he(Kt.ColorPropertyPlayableAsset)],exports.ColorPropertyPlayableAsset),exports.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){var e=new yo(t);return e.curve=Yn(this.curveData),e.value=e.curve.getValue(0),e},e}(Ns),u([ce()],exports.FloatPropertyPlayableAsset.prototype,"curveData",void 0),exports.FloatPropertyPlayableAsset=u([he(Kt.FloatPropertyPlayableAsset)],exports.FloatPropertyPlayableAsset),exports.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){return new _o(t)},e}(Ns),exports.SubCompositionPlayableAsset=u([he(Kt.SubCompositionPlayableAsset)],exports.SubCompositionPlayableAsset),exports.ObjectBindingTrack=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){},r.create=function(t){if(a(this.boundObject,exports.VFXItem)){var e=this.boundObject;if(e.getComponent(exports.ParticleSystem)){var r=t.createTrack(Po,this,"ParticleTrack");r.boundObject=this.boundObject;var i=r.createClip(Ka);i.start=e.start,i.duration=e.duration,i.endBehavior=e.endBehavior}}},e}(exports.TrackAsset),exports.ObjectBindingTrack=u([he(Kt.ObjectBindingTrack)],exports.ObjectBindingTrack);var Io=function(){function t(t,e,r){this.children=[],this.trackAsset=t,this.mixer=e,this.output=r}return t.prototype.addChild=function(t){this.children.push(t)},t}();exports.TimelineAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}_t(e,t);var r=e.prototype;return r.createPlayable=function(t){for(var e,r=new Lo(t),i=s(this.tracks);!(e=i()).done;){var n=e.value;a(n,exports.ObjectBindingTrack)&&n.create(this)}return this.sortTracks(this.tracks),r.compileTracks(t,this.flattenedTracks),r},r.createTrack=function(t,e,r){var i=new t(this.engine);return i.name=r||t.name,e.addChild(i),this.invalidate(),i},r.invalidate=function(){this.cacheFlattenedTracks=null},r.addSubTracksRecursive=function(t,e){for(var r,i=s(t.getChildTracks());!(r=i()).done;){var n=r.value;e.push(n)}for(var a,o=s(t.getChildTracks());!(a=o()).done;){var u=a.value;this.addSubTracksRecursive(u,e)}},r.sortTracks=function(t){for(var e=[],r=0;r<t.length;r++)e.push(new Fo(t[r],r));e.sort(Vo),t.length=0;for(var i,n=s(e);!(i=n()).done;){var a=i.value;t.push(a.track)}},r.fromData=function(t){},se(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=s(this.tracks);!(t=e()).done;){var r=t.value;this.cacheFlattenedTracks.push(r),this.addSubTracksRecursive(r,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(Ns),u([ce()],exports.TimelineAsset.prototype,"tracks",void 0),exports.TimelineAsset=u([he(Kt.TimelineAsset)],exports.TimelineAsset);var Lo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clips=[],e.masterTrackInstances=[],e}_t(e,t);var r=e.prototype;return r.prepareFrame=function(t){},r.evaluate=function(){for(var t,e=this.getTime(),r=s(this.clips);!(t=r()).done;){t.value.evaluateAt(e)}},r.compileTracks=function(t,e){for(var r,i=e,n={},a=s(i);!(r=a()).done;){var o=r.value,u=o.createPlayableGraph(t,this.clips),h=o.createOutput();h.setUserData(o.boundObject),t.addOutput(h),h.setSourcePlayable(u);var c=new Io(o,u,h);n[o.getInstanceId()]=c,o.parent||this.masterTrackInstances.push(c)}for(var l,f=s(i);!(l=f()).done;)for(var p,d=l.value,m=n[d.getInstanceId()],v=s(d.getChildTracks());!(p=v()).done;){var y=n[p.value.getInstanceId()];m.addChild(y)}},e}(Vs),Fo=function(t,e){this.track=t,this.originalIndex=e};function Vo(t,e){var r=t.track.boundObject,i=e.track.boundObject;return a(r,exports.VFXItem)&&a(i,exports.VFXItem)?exports.VFXItem.isAncestor(r,i)?-1:exports.VFXItem.isAncestor(i,r)?1:t.originalIndex-e.originalIndex:t.originalIndex-e.originalIndex}exports.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){var e=new yo(t);return e.curve=Yn(this.curveData),e.value=e.curve.getValue(0),e},e}(Ns),u([ce()],exports.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector4PropertyPlayableAsset=u([he(Kt.Vector4PropertyPlayableAsset)],exports.Vector4PropertyPlayableAsset),exports.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){var e=new yo(t);return e.curve=Yn(this.curveData),e.value=e.curve.getValue(0),e},e}(Ns),u([ce()],exports.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector2PropertyPlayableAsset=u([he(Kt.Vector2PropertyPlayableAsset)],exports.Vector2PropertyPlayableAsset);var Do,No=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).time=0,e.startTime=0,e.items=[],e.state=Ps.Playing,e.reusable=!1,e.sceneBindings=[],e.graph=new Fs,e}_t(e,t);var r=e.prototype;return r.onStart=function(){var t;this.timelineAsset||(this.timelineAsset=new exports.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==wt.destroy&&this.setReusable(!0),null==(t=this.item.composition)||t.refContent.push(this.item)},r.setReusable=function(t){for(var r,i=s(this.timelineAsset.tracks);!(r=i()).done;){var n=r.value.boundObject;if(a(n,exports.VFXItem)){var o=n.getComponent(e);o&&o.setReusable(t)}}},r.getReusable=function(){return this.reusable},r.pause=function(){this.state=Ps.Paused},r.resume=function(){this.state=Ps.Playing},r.onUpdate=function(t){if(this.state!==Ps.Paused){var e=this.time;this.timelinePlayable.setTime(e),this.resolveBindings(),this.timelinePlayable.evaluate(),this.graph.evaluate(t)}},r.onEnable=function(){for(var t,e=s(this.items);!(t=e()).done;){t.value.setActive(!0)}},r.onDisable=function(){for(var t,e=s(this.items);!(t=e()).done;){t.value.setActive(!1)}},r.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},r.hitTest=function(t,e,r,i,n,s){for(var a,u=function(s){var o=a.items[s];if(o.isActive&&o.transform.getValid()&&!exports.VFXItem.isComposition(o)&&!l(o)){var u=o.getHitTestParams(n);if(u){var f=!1,p=new Ae;if(u.type===exports.HitTestType.triangle)for(var d=u.triangles,m=u.backfaceCulling,v=0;v<d.length;v++){var y=d[v];if(t.intersectTriangle(y,p,m)){f=!0,h.push(p);break}}else if(u.type===exports.HitTestType.box){var g=u.center,x=u.size,b=g.clone().addScaledVector(x,.5),T=g.clone().addScaledVector(x,-.5);t.intersectBox({min:b,max:T},p)&&(f=!0,h.push(p))}else if(u.type===exports.HitTestType.sphere){var E=u.center,_=u.radius;t.intersectSphere({center:E,radius:_},p)&&(f=!0,h.push(p))}else if(u.type===exports.HitTestType.custom){var A=u.collect(t,new _e(e,r));A&&A.length>0&&(A.forEach((function(t){h.push(t)})),f=!0)}if(f){var C={compContent:a.item,id:o.id,name:o.name,position:h[h.length-1],parentId:o.parentId,hitPositions:h,behavior:u.behavior};if(o.emit("click",C),i.push(C),c(C))return{v:i}}}}},h=[],c=(null==s?void 0:s.stop)||X,l=(null==s?void 0:s.skip)||X,f=(null==s?void 0:s.maxCount)||this.items.length,p=0;p<this.items.length&&i.length<f;p++){var d=(a=this,u(p));if("object"===o(d))return d.v}return i},r.setChildrenRenderOrder=function(t){for(var r,i=s(this.items);!(r=i()).done;){var n=r.value;n.renderOrder=t++;var a=n.getComponent(e);a&&(t=a.setChildrenRenderOrder(t))}return t},r.fromData=function(e){var r;t.prototype.fromData.call(this,e),this.items=e.items,this.startTime=null!=(r=e.startTime)?r:0,this.sceneBindings=e.sceneBindings,this.timelineAsset=e.timelineAsset},r.resolveBindings=function(){for(var t,e=s(this.sceneBindings);!(t=e()).done;){var r=t.value;r.key.boundObject=r.value}for(var i,n=s(this.timelineAsset.tracks);!(i=n()).done;){var a=i.value;this.updateTrackAnimatedObject(a)}},r.updateTrackAnimatedObject=function(t){for(var e,r=s(t.getChildTracks());!(e=r()).done;){var i=e.value;i.updateAnimatedObject(),this.updateTrackAnimatedObject(i)}},e}(de),ko=function(){function t(){}return t.collectSerializableObject=function(e,r){if(!r[e.getInstanceId()]){e.toData(),r[e.getInstanceId()]=e;var i=le(e);if(i)for(var n,a=s(Object.keys(i));!(n=a()).done;){var o=n.value,u=e.taggedProperties[o];if(void 0===u&&(u=e[o]),fe.is(u))t.collectSerializableObject(u,r);else if(W(u))for(var h,c=s(u);!(h=c()).done;){var l=h.value;fe.is(l)&&t.collectSerializableObject(l,r)}else if(Z(u))for(var f,p=s(Object.keys(u));!(f=p()).done;){var d=u[f.value];fe.is(d)&&t.collectSerializableObject(d,r)}}}},t.serializeEffectObject=function(e){var r={},i=Ie({},e.engine.jsonSceneData);t.collectSerializableObject(e,r);for(var n,a=s(Object.keys(r));!(n=a()).done;){var o=r[n.value];i[o.getInstanceId()]||(i[o.getInstanceId()]={}),t.serialize(o,i[o.getInstanceId()])}return i},t.serialize=function(e,r){e.toData(),r||(r={});var i=le(e);if(i)for(var n,a=s(Object.keys(i));!(n=a()).done;){var o=n.value,u=e[o];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(u)?r[o]=u:W(u)?(r[o]||(r[o]=[]),t.serializeArrayProperty(u,r[o],0)):fe.is(u)?r[o]={id:u.getInstanceId()}:Z(u)&&(r[o]||(r[o]={}),t.serializeObjectProperty(u,r[o],0))}for(var h,c=s(Object.keys(e.taggedProperties));!(h=c()).done;){var l=h.value,f=e.taggedProperties[l];"number"==typeof f||"string"==typeof f||"boolean"==typeof f||t.checkTypedArray(f)?r[l]=f:W(f)?(r[l]||(r[l]=[]),t.serializeArrayProperty(f,r[l],0)):fe.is(f)?r[l]={id:f.getInstanceId()}:Z(f)&&(r[l]||(r[l]={}),t.serializeObjectProperty(f,r[l],0))}return r},t.deserialize=function(e,r){for(var i,n=r.taggedProperties,a=le(r),o=r.engine,u=s(Object.keys(e));!(i=u()).done;){var h=i.value;if(!a||!a[h]){var c=e[h];n[h]=t.deserializeProperty(c,o,0)}}if(a)for(var l,f=s(Object.keys(a));!(l=f()).done;){var p=l.value,d=e[p];if(void 0!==d){var m=a[p].type;r[p]=t.deserializeProperty(d,o,0,m)}}r.fromData(n)},t.deserializeAsync=function(e,r){return i((function(){var i,n,a,o,u,c,l,f,p,d,m,v;return h(this,(function(h){switch(h.label){case 0:i=r.taggedProperties,n=le(r),a=r.engine,o=s(Object.keys(e)),h.label=1;case 1:return(u=o()).done?[3,4]:(c=u.value,n&&n[c]?[3,3]:(l=e[c],[4,t.deserializePropertyAsync(l,a,0)]));case 2:i[c]=h.sent(),h.label=3;case 3:return[3,1];case 4:if(!n)return[3,8];f=s(Object.keys(n)),h.label=5;case 5:return(p=f()).done?[3,8]:(d=p.value,void 0===(m=e[d])?[3,7]:(v=n[d].type,[4,t.deserializePropertyAsync(m,a,0,v)]));case 6:r[d]=h.sent(),h.label=7;case 7:return[3,5];case 8:return r.fromData(i),[2]}}))}))()},t.checkTypedArray=function(t){return a(t,Int8Array)||a(t,Uint8Array)||a(t,Uint8ClampedArray)||a(t,Int16Array)||a(t,Uint16Array)||a(t,Int32Array)||a(t,Uint32Array)||a(t,Float32Array)||a(t,Float64Array)||a(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(Z(t)&&1===Object.keys(t).length&&"id"in t&&H(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return Z(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return q(t)||a(t,e.HTMLImageElement)},t.deserializeProperty=function(e,r,i,n){if(!(i>14)){if(W(e)){for(var a,o=[],u=s(e);!(a=u()).done;){var h=a.value;o.push(t.deserializeProperty(h,r,i+1,n))}return o}if(t.checkDataPath(e))return r.assetLoader.loadGUID(e.id);if(Z(e)&&e.constructor===Object){var c;c=n?new n:{};for(var l,f=s(Object.keys(e));!(l=f()).done;){var p=l.value;c[p]=t.deserializeProperty(e[p],r,i+1)}return c}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.deserializePropertyAsync=function(e,r,n,a){return i((function(){var i,o,u,c,l,f,p,d,m;return h(this,(function(h){switch(h.label){case 0:if(n>14)return console.error("The nested object layers of the serialized data exceed the maximum limit."),[2];if(!W(e))return[3,5];i=[],o=s(e),h.label=1;case 1:return(u=o()).done?[3,4]:(c=u.value,l=i.push,[4,t.deserializePropertyAsync(c,r,n+1,a)]);case 2:l.apply(i,[h.sent()]),h.label=3;case 3:return[3,1];case 4:return[2,i];case 5:return t.checkDataPath(e)?[4,r.assetLoader.loadGUIDAsync(e.id)]:[3,7];case 6:return[2,h.sent()];case 7:if(!Z(e)||e.constructor!==Object)return[3,12];f=a?new a:{},p=s(Object.keys(e)),h.label=8;case 8:return(d=p()).done?[3,11]:(m=d.value,[4,t.deserializePropertyAsync(e[m],r,n+1)]);case 9:f[m]=h.sent(),h.label=10;case 10:return[3,8];case 11:return[2,f];case 12:return[2,e];case 13:return[2]}}))}))()},t.serializeObjectProperty=function(e,r,i){if(i>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{r||(r={});for(var n,a=s(Object.keys(e));!(n=a()).done;){var o=n.value,u=e[o];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(e)?r[o]=u:W(u)?(r[o]||(r[o]=[]),t.serializeArrayProperty(u,r[o],i+1)):fe.is(u)?r[o]={id:u.getInstanceId()}:Z(u)&&(r[o]||(r[o]={}),t.serializeObjectProperty(u,r[o],i+1))}}},t.serializeArrayProperty=function(e,r,i){if(i>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{r||(r=[]);for(var n=0;n<e.length;n++){var s=e[n];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?r[n]=s:W(s)?(r[n]||(r[n]=[]),t.serializeArrayProperty(s,r[n],i+1)):fe.is(s)?r[n]={id:s.getInstanceId()}:Z(s)&&(r[n]||(r[n]={}),t.serializeObjectProperty(s,r[n],i+1))}}},t}();exports.VFXItem=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).children=[],i.transform=new Bs,i.time=0,i.duration=0,i.start=0,i.endBehavior=wt.forward,i.type=vt.base,i.isDuringPlay=!1,i.components=[],i.rendererComponents=[],i.active=!0,i.visible=!0,i.speed=1,i.listIndex=0,i.isEnabled=!1,i.eventProcessor=new ks,i.name="VFXItem",i.transform.name=i.name,i.transform.engine=e,r&&i.fromData(r),i}_t(e,t);var r=e.prototype;return r.on=function(t,e,r){this.eventProcessor.on(t,e,r)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.emit=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],r))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.setSpeed=function(t){this.speed=t},r.getSpeed=function(){return this.speed},r.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},r.getComponent=function(t){for(var e,r,i=s(this.components);!(r=i()).done;){var n=r.value;if(a(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,r=[],i=s(this.components);!(e=i()).done;){var n=e.value;a(n,t)&&r.push(n)}return r},r.setParent=function(t){(t!==this||t)&&(this.parent&&g(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())},r.setColor=function(t,e,r,i){},r.setOpacity=function(t){},r.setActive=function(t){this.active!==t&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,r=s(this.components);!(e=r()).done;){e.value.enabled=t}this.visible=t},r.getVisible=function(){return this.visible},r.getWorldTransform=function(t){var e=null!=t?t:new Bs({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.translate=function(t,e,r){this.transform.translate(t,e,r)},r.rotate=function(t,e,r){var i=new Hr(t,e,r),n=Re.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},r.setPositionByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,s=i.y,a=this.composition.renderer.getWidth()/2,o=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/a-1)*n,(1-2*e/o)*s,r)}},r.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},r.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},r.setScale=function(t,e,r){this.transform.setScale(t,e,r)},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.getCurrentPosition=function(){var t=new Ae;return this.transform.assignWorldTRS(t),t},r.find=function(t){var e;if(this.name===t)return this;var r=[];(e=r).push.apply(e,[].concat(this.children));for(var i=0;i<r.length;){var n,s=r[i];if(i++,s.name===t)return s;(n=r).push.apply(n,[].concat(s.children))}},r.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=s(this.children);!(t=e()).done;){var r=t.value;r.isDuringPlay||r.beginPlay()}},r.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},r.onEnable=function(){this.isEnabled=!0;for(var t,e=s(this.components);!(t=e()).done;){var r=t.value;r.enabled&&!r.isStartCalled&&(r.onStart(),r.isStartCalled=!0)}for(var i,n=s(this.components);!(i=n()).done;){var a=i.value;a.enabled&&!a.isEnableCalled&&a.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=s(this.components);!(t=e()).done;){var r=t.value;r.enabled&&r.isEnableCalled&&r.disable()}},r.fromData=function(r){t.prototype.fromData.call(this,r);var i=r.id,n=r.name,o=r.delay,u=r.parentId,h=r.endBehavior,c=r.transform,l=r.duration,f=void 0===l?0:l;this.props=r,this.type=r.type,this.id=i.toString(),this.name=n,this.start=o||this.start;var p={};if(c){var d;if(p.position=(new Ae).copyFrom(c.position),c.quat)p.quat=new Re(c.quat.x,c.quat.y,c.quat.z,c.quat.w);else p.rotation=(new Hr).copyFrom(null!=(d=c.eulerHint)?d:c.rotation);p.scale=(new Ae).copyFrom(c.scale),c.size&&(p.size=(new _e).copyFrom(c.size)),c.anchor&&(p.anchor=(new _e).copyFrom(c.anchor)),this.transform.setTransform(p)}if(this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=u,this.duration=f,this.endBehavior=h,r.content||(r.content={options:{}}),f<0)throw new Error("Item duration can't be less than 0, see "+Hn["Item duration can't be less than 0"]+".");this.rendererComponents.length=0;for(var m,v=s(this.components);!(m=v()).done;){var y=m.value;y.item=this,a(y,me)&&this.rendererComponents.push(y),a(y,exports.ParticleSystem)&&(this.components.includes(y.renderer)||this.components.push(y.renderer),this.rendererComponents.push(y.renderer))}e.isComposition(this)&&this.instantiatePreComposition()},r.toData=function(){var t,e;(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=Kt.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.taggedProperties.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.taggedProperties.components){this.taggedProperties.components=[];for(var r,i=s(this.components);!(r=i()).done;){var n=r.value;a(n,exports.EffectComponent)&&this.taggedProperties.components.push(n)}}this.taggedProperties.content={}},r.translateByPixel=function(t,e){if(this.composition){var r=this.composition.renderer.canvas.getBoundingClientRect(),i=r.width,n=r.height,s=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(s),o=a.x,u=a.y;this.transform.translate(2*t*o/i,-2*e*u/n,0)}},r.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=s(this.components.slice());!(t=e()).done;){t.value.dispose()}this.components=[],this._content=void 0,this._composition=null,this.transform.setValid(!1)}},r.resetChildrenParent=function(){for(var t,e=s(this.children);!(t=e()).done;){var r=t.value;this.parent&&r.setParent(this.parent)}var i;this.parent&&g(null==(i=this.parent)?void 0:i.children,this)},r.instantiatePreComposition=function(){var t=this.props.content.options.refId,e=this.engine.findEffectsObjectData(t);if(!e)throw new Error("Referenced precomposition with Id: "+t+" does not exist.");var r=this.addComponent(No);ko.deserialize(e,r);for(var i,n=s(r.items);!(i=n()).done;){var a=i.value;a.setInstanceId(J());for(var o,u=s(a.components);!(o=u()).done;){o.value.setInstanceId(J())}}},e.isComposition=function(t){return t.type===vt.composition},e.isSprite=function(t){return t.type===vt.sprite},e.isParticle=function(t){return t.type===vt.particle},e.isNull=function(t){return t.type===vt.null},e.isTree=function(t){return t.type===vt.tree},e.isCamera=function(t){return t.type===vt.camera},e.isAncestor=function(t,e){for(var r=e.parent;r;){if(r===t)return!0;r=r.parent}return!1},se(e,[{key:"content",get:function(){return this._content}},{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,r=s(this.children);!(e=r()).done;){var i=e.value;i.composition||(i.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,r=s(this.rendererComponents);!(e=r()).done;){e.value.priority=t}}}},{key:"isActive",get:function(){return this.active}},{key:"isVisible",get:function(){return this.visible}}]),e}(fe),u([ce()],exports.VFXItem.prototype,"components",void 0),exports.VFXItem=u([he(Kt.VFXItemData)],exports.VFXItem),exports.Item=void 0,(Do=exports.Item||(exports.Item={})).is=function(t,e){return t.type===e},Do.isComposition=function(t){return t.type===vt.composition},Do.isParticle=function(t){return t.type===vt.particle},Do.isNull=function(t){return t.type===vt.null};var zo=[1,1,1,1],Uo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}_t(e,t);var r=e.prototype;return r.processFrame=function(t){var e,r=t.output.getUserData();if(a(r,exports.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(r)),!this.activeMaterial){var i,n;this.activeMaterial=null==(i=this.activeComponent)?void 0:i.material;var s=null==(n=this.activeMaterial)?void 0:n.getColor("_Color");s&&(this.startColor=s.toArray())}null==(e=this.activeComponent)||e.setAnimationTime(this.time);var o,u,h,c=Ki(zo,1),l=this.time/r.duration,f=this.opacityOverLifetime,p=this.colorOverLifetime;if(p&&(c=T(p,l,!0),o=!0),f&&(c[3]*=f.getValue(l),o=!0),o)Qi(this.renderColor,c,this.startColor),null==(h=this.activeMaterial)||null==(u=h.getColor("_Color"))||u.setFromArray(this.renderColor)}},r.create=function(t){this.clipData=t;var e,r=t.colorOverLifetime;r&&(this.opacityOverLifetime=Yn(null!=(e=r.opacity)?e:1),r.color&&r.color[0]===Ct.GRADIENT_COLOR&&(this.colorOverLifetime=E(r.color[1])));return this},r.getActiveComponent=function(t){return t.getComponent(qn)},e}(Vs),Bo=[[0,0,1,1,void 0]],Go=0;function jo(t){return t.maxVertexUniforms>=256?exports.maxSpriteMeshItemCount=32:t.maxVertexUniforms>=128?exports.maxSpriteMeshItemCount=16:void 0}function Xo(t,e){var r=null!=e?e:{},i=r.env,n=void 0===i?"":i,s=r.wireframe,a=[["ENV_EDITOR",n===Xn]];return{fragment:s?oi:hi,vertex:ui,glslVersion:1===t?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,macros:a,shared:!0}}function Ho(t,e,r,i){var n=Xo(r,{wireframe:t.wireframe,env:i});return n.shared=!0,n}exports.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.createPlayable=function(t){var e=new Uo(t);return e.create(this.data),e},r.fromData=function(t){this.data=t},e}(Ns),exports.SpriteColorPlayableAsset=u([he(Kt.SpriteColorPlayableAsset)],exports.SpriteColorPlayableAsset),exports.SpriteComponent=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).splits=Bo,i.frameAnimationLoop=!1,i.name="MSprite"+Go++,i.geometry=i.createGeometry(rr.TRIANGLES),i.setItem(),r&&i.fromData(r),i}_t(e,t);var r=e.prototype;return r.onUpdate=function(t){var e=this;this.isManualTimeSet||(this.frameAnimationTime+=t/1e3,this.isManualTimeSet=!1);var r=this.frameAnimationTime,i=this.item.duration;r>i&&this.frameAnimationLoop&&(r%=i);var n=Math.min(Math.max(r/i,0),1),s=this.textureSheetAnimation,a=this.renderer.texture.source.video;if(a&&(0===r?a.pause():a.play().catch((function(t){e.engine.renderErrors.add(t)}))),s){var o,u,h,c,l,f=s.total||s.row*s.col,p=0,d=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],p=y[0],d=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/s.row*m,c=1/s.col*v):(h=1/s.col*m,c=1/s.row*v),s.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/s.col),b=g-x*s.col;l=u?[h*x,c*(s.col-b)]:[h*b,c*(1+x)]}else l=[0,c];null==(o=this.material.getVector4("_TexOffset"))||o.setFromArray([p+l[0],v+d-l[1],h,c])}},r.onDestroy=function(){var t=this.getTextures();this.item&&this.item.composition&&this.item.composition.destroyTextures(t),t.forEach((function(t){var e=t.source;e.sourceType===exports.TextureSourceType.video&&(null==e?void 0:e.video)&&(e.video.pause(),e.video.src="",e.video.load())}))},r.createGeometry=function(t){var e=12*this.splits.length;return jr.create(this.engine,{attributes:{aPos:{type:rr.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},atlasOffset:{size:2,offset:0,releasable:!0,type:rr.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},r.getItemGeometryData=function(){var t=this.splits,e=this.textureSheetAnimation,r=this.renderer;if(r.shape){for(var i=r.shape,n=i.index,s=void 0===n?[]:n,a=i.aPoint,o=void 0===a?[]:a,u=new Float32Array(o),h=[],c=[],l=0;l<u.length;l+=6)u[l]*=1,u[l+1]*=1,c.push(o[l+2],o[l+3]),h.push(u[l],u[l+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(h)),{index:s,atlasOffset:c}}var f=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],p=[],d=[],m=2,v=2;1===t.length&&(m=1,v=1);for(var y=[],g=0;g<m;g++)for(var x=0;x<v;x++){var b=4*(2*x+g),T=e?[0,0,1,1,t[0][4]]:t[2*x+g],E=T[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],_=((g+g+1)/m-1)/2,A=((x+x+1)/v-1)/2,C=T[0],S=T[1],w=T[4]?T[3]:T[2],R=T[4]?T[2]:T[3],O=[f[0]/m+_,f[1]/v+A,f[2]/m+_,f[3]/v+A,f[4]/m+_,f[5]/v+A,f[6]/m+_,f[7]/v+A];p.push(E[0]*w+C,E[1]*R+S,E[2]*w+C,E[3]*R+S,E[4]*w+C,E[5]*R+S,E[6]*w+C,E[7]*R+S),y.push(1*O[0],1*O[1],0,1*O[2],1*O[3],0,1*O[4],1*O[5],0,1*O[6],1*O[7],0),d.push(b,1+b,2+b,2+b,1+b,3+b)}return this.geometry.setAttributeData("aPos",new Float32Array(y)),{index:d,atlasOffset:p}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r,i,n,s,a,o,u=e.interaction,h=e.options,c=e.listIndex,l=void 0===c?0:c,f=e.renderer;f||(f={}),this.interaction=u,this.renderer={renderMode:null!=(r=f.renderMode)?r:yt.MESH,blending:null!=(i=f.blending)?i:ht.ALPHA,texture:null!=(n=f.texture)?n:this.engine.emptyTexture,occlusion:!!f.occlusion,transparentOcclusion:!!f.transparentOcclusion||f.maskMode===lt.MASK,side:null!=(s=f.side)?s:ct.DOUBLE,shape:f.shape,mask:null!=(a=f.mask)?a:0,maskMode:null!=(o=f.maskMode)?o:lt.NONE,order:l},this.emptyTexture=this.engine.emptyTexture,this.splits=e.splits||Bo,this.textureSheetAnimation=e.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=Kn(this);var p=this.createGeometry(rr.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=Pe.fromIdentity(),this.material=d,this.geometry=p;var m=h.startColor||[1,1,1,1];this.material.setColor("_Color",(new Zr).setFromArray(m)),this.material.setVector4("_TexOffset",(new Ce).setFromArray([0,0,1,1])),this.setItem()},e}(qn),exports.SpriteComponent=u([he(Kt.SpriteComponent)],exports.SpriteComponent),exports.maxSpriteMeshItemCount=8;var Wo=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(Tt),Yo=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(Tt),Zo=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,r){return this.findCurveValue(t,e)?this.curveValues[t+e].value=r:this.curveValues[t+e]={componentType:t,propertyName:e,value:r},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},t}(),qo=function(t){function e(e){var r;return(r=t.call(this,e)||this).animationStream=new Zo(we(r)),r}return _t(e,t),e}(Vs),Ko=new Hr,Qo=new Ae(1,1,1),Jo=new Ae,$o=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new Ae(e.x,e.y,e.x)};var r,i=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,s=this.data.sizeOverLifetime;if(i&&0!==Object.keys(i).length){this.positionOverLifetime=i,i.path&&(this.originalTransform.path=Yn(i.path));var a=i.linearX||i.linearY||i.linearZ;a&&(this.linearVelOverLifetime={x:i.linearX&&Yn(i.linearX),y:i.linearY&&Yn(i.linearY),z:i.linearZ&&Yn(i.linearZ),asMovement:i.asMovement,enabled:!!a});var o=i.orbitalX||i.orbitalY||i.orbitalZ;o&&(this.orbitalVelOverLifetime={x:i.orbitalX&&Yn(i.orbitalX),y:i.orbitalY&&Yn(i.orbitalY),z:i.orbitalZ&&Yn(i.orbitalZ),center:qi(i.orbCenter),asRotation:i.asRotation,enabled:!!o}),this.speedOverLifetime=i.speedOverLifetime&&Yn(i.speedOverLifetime)}if(s&&(s.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Yn(s.x||1),this.sizeYOverLifetime=Yn(s.y||1),this.sizeZOverLifetime=Yn(s.z||1)):this.sizeXOverLifetime=Yn(s.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:Yn(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=Yn(n.x||0),u.y=Yn(n.y||0)}this.gravity=Ae.fromArray((null==i?void 0:i.gravity)||[]),this.gravityModifier=Yn(null!=(r=null==i?void 0:i.gravityOverLifetime)?r:0),this.direction=(null==i?void 0:i.direction)?Ae.fromArray(i.direction).normalize():new Ae,this.startSpeed=(null==i?void 0:i.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();a(e,exports.VFXItem)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.boundObject,r=e.duration,i=this.time/r;if(i=i<0?0:i>1?1:i,this.sizeXOverLifetime){Qo.x=this.sizeXOverLifetime.getValue(i),this.sizeSeparateAxes?(Qo.y=this.sizeYOverLifetime.getValue(i),Qo.z=this.sizeZOverLifetime.getValue(i)):Qo.z=Qo.y=Qo.x;var n=this.originalTransform.scale;e.transform.setScale(Qo.x*n.x,Qo.y*n.y,Qo.z*n.z)}if(this.rotationOverLifetime){var s=function(e){return t.rotationOverLifetime.asRotation?e.getValue(i):e.getIntegrateValue(0,i,r)},a=s(this.rotationOverLifetime.z),o=this.rotationOverLifetime.separateAxes;Ko.x=o?s(this.rotationOverLifetime.x):0,Ko.y=o?s(this.rotationOverLifetime.y):0,Ko.z=a;var u=Ko.addEulers(this.originalTransform.rotation,Ko);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=Jo;Zi(h,this,this.gravity,this.time,r,this.originalTransform.position,this.velocity),this.originalTransform.path&&h.add(this.originalTransform.path.getValue(i)),e.transform.setPosition(h.x,h.y,h.z)}},e}(qo);exports.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.createPlayable=function(t){var e=new $o(t);return e.data=this.transformAnimationData,e},r.fromData=function(t){this.transformAnimationData=t},e}(Ns),exports.TransformPlayableAsset=u([he(Kt.TransformPlayableAsset)],exports.TransformPlayableAsset);var tu=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();a(e,exports.VFXItem)&&(e.time=this.time)},e}(Vs);exports.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){return new tu(t)},e}(Ns),exports.ActivationPlayableAsset=u([he(Kt.ActivationPlayableAsset)],exports.ActivationPlayableAsset),exports.AnimationClip=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.scaleCurves=[],e.floatCurves=[],e}_t(e,t);var r=e.prototype;return r.sampleAnimation=function(t,e){var r=e/t.duration;r=r<0?0:r>1?1:r;for(var i,n=s(this.positionCurves);!(i=n()).done;){var a=i.value,o=a.keyFrames.getValue(r),u=this.findTarget(t,a.path);null==u||u.transform.setPosition(o.x,o.y,o.z)}for(var h,c=s(this.rotationCurves);!(h=c()).done;){var l=h.value,f=l.keyFrames.getValue(r),p=this.findTarget(t,l.path);null==p||p.transform.setQuaternion(f.x,f.y,f.z,f.w)}for(var d,m=s(this.scaleCurves);!(d=m()).done;){var v=d.value,y=v.keyFrames.getValue(r),g=this.findTarget(t,v.path);null==g||g.transform.setScale(y.x,y.y,y.z)}},r.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.floatCurves.length=0;for(var e,r=s(t.positionCurves);!(e=r()).done;){var i=e.value,n={path:i.path,keyFrames:Yn(i.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var a,o=s(t.rotationCurves);!(a=o()).done;){var u=a.value,h={path:u.path,keyFrames:Yn(u.keyFrames)};this.duration=Math.max(this.duration,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}for(var c,l=s(t.scaleCurves);!(c=l()).done;){var f=c.value,p={path:f.path,keyFrames:Yn(f.keyFrames)};this.duration=Math.max(this.duration,p.keyFrames.getMaxTime()),this.scaleCurves.push(p)}for(var d,m=s(t.floatCurves);!(d=m()).done;){var v=d.value,y={path:v.path,keyFrames:Yn(v.keyFrames),property:v.property,className:v.className};this.duration=Math.max(this.duration,y.keyFrames.getMaxTime()),this.floatCurves.push(y)}},r.findTarget=function(t,e){for(var r,i=t,n=s(e);!(r=n()).done;){for(var a,o=r.value,u=!1,h=s(i.children);!(a=h()).done;){var c=a.value;if(c.name===o){i=c,u=!0;break}}if(!u)return}return i},e}(fe),exports.AnimationClip=u([he(Kt.AnimationClip)],exports.AnimationClip);var eu=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();a(e,exports.VFXItem)&&e.composition&&this.clip.sampleAnimation(e,this.time)},e}(Vs);function ru(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?we(t):e}var iu=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=void 0===e?100:e,i=t.textWidth,n=void 0===i?100:i,s=t.textOverflow,a=void 0===s?Nt.clip:s,o=t.textBaseline,u=void 0===o?kt.top:o,h=t.textAlign,c=void 0===h?zt.left:h,l=t.text,f=void 0===l?" ":l,p=t.letterSpace,d=void 0===p?0:p,m=t.autoWidth,v=void 0!==m&&m,y=t.fontSize,g=t.lineHeight,x=void 0===g?y:g,b=y+d;this.autoWidth=v,this.maxTextWidth=f.length*b,this.width=n,this.height=r,this.letterSpace=d,this.overflow=a,this.textBaseline=u,this.textAlign=c,this.lineHeight=x}var e=t.prototype;return e.getOffsetY=function(t,e,r,i){var n=t.outlineWidth,s=t.fontScale,a=(r-i)/3,o=i+n*s,u=r*(e-1),h=0;switch(this.textBaseline){case kt.top:h=o+a;break;case kt.middle:h=(this.height*s-u+o)/2;break;case kt.bottom:h=this.height*s-u-a}return h},e.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case zt.left:r=t.outlineWidth*t.fontScale;break;case zt.middle:r=(this.width*t.fontScale-e)/2;break;case zt.right:r=this.width*t.fontScale-e}return r},e.setSize=function(t,e){this.width=t,this.height=e},t}(),nu=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,r,i,n,s,a,o=t.textColor,u=void 0===o?[1,1,1,1]:o,h=t.fontSize,c=void 0===h?40:h,l=t.outline,f=t.shadow,p=t.fontWeight,d=void 0===p?"normal":p,m=t.fontStyle,v=void 0===m?"normal":m,y=t.fontFamily,g=void 0===y?"sans-serif":y;(this.textColor=u,this.textWeight=d,this.fontStyle=v,this.fontFamily=g,this.fontSize=c,l)&&(this.isOutlined=!0,this.outlineColor=null!=(e=l.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(r=l.outlineWidth)?r:1,this.fontOffset+=this.outlineWidth);f&&(this.hasShadow=!0,this.shadowBlur=null!=(i=f.shadowBlur)?i:2,this.shadowColor=null!=(n=f.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(s=f.shadowOffsetX)?s:0,this.shadowOffsetY=null!=(a=f.shadowOffsetY)?a:0);this.fontStyle!==Bt.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},su=new(function(){function t(){this.elements=[]}var r=t.prototype;return r.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements.length=0},r.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return N(t),t}if(Ba(za))return e.window._createOffscreenCanvas(10,10);var r=e.document.createElement("canvas");return r.getContext("2d",{willReadFrequently:!0}),r},r.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?y(this.elements,t):t.remove()},t}()),au=["serif","sans-serif","monospace","courier"],ou=0;exports.TextComponent=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.maxLineWidth=0,i.SCALE_FACTOR=.1,i.ALPHA_FIX_VALUE=1/255,i.name="MText"+ou++,i.geometry=i.createGeometry(rr.TRIANGLES),r&&i.fromData(r),i.canvas=su.getCanvas(),su.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),i.setItem(),!r)return ru(i);var n=r.options;return i.updateWithOptions(n),i.updateTexture(),i}_t(e,t);var r=e.prototype;return r.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},r.fromData=function(e){t.prototype.fromData.call(this,e);var r,i,n,s,a,o,u=e.interaction,h=e.options,c=e.listIndex,l=void 0===c?0:c,f=e.renderer;f||(f={}),this.interaction=u,this.renderer={renderMode:null!=(r=f.renderMode)?r:yt.MESH,blending:null!=(i=f.blending)?i:ht.ALPHA,texture:null!=(n=f.texture)?n:this.engine.emptyTexture,occlusion:!!f.occlusion,transparentOcclusion:!!f.transparentOcclusion||f.maskMode===lt.MASK,side:null!=(s=f.side)?s:ct.DOUBLE,mask:null!=(a=f.mask)?a:0,maskMode:null!=(o=f.maskMode)?o:lt.NONE,order:l},this.interaction=u,this.cachePrefix="-",this.renderInfo=Kn(this);var p=this.createMaterial(this.renderInfo,2);this.worldMatrix=Pe.fromIdentity(),this.material=p,this.material.setVector4("_TexOffset",(new Ce).setFromArray([0,0,1,1])),this.updateWithOptions(h),this.renderText(h),this.setItem(),this.material.setColor("_Color",new Zr(1,1,1,1))},r.updateWithOptions=function(t){},r.updateTexture=function(t){},e}(qn),exports.TextComponent=u([he(Kt.TextComponent)],exports.TextComponent);var uu=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new nu(t),this.textLayout=new iu(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var r=this.context,i=this.textLayout,n=i.letterSpace,s=i.overflow,a=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,o=this.textLayout.width+this.textStyle.fontOffset,u=1,h=0,c=0;c<t.length;c++){var l,f,p=t[c],d=(null!=(f=null==r||null==(l=r.measureText(p))?void 0:l.width)?f:0)*a;h+=n,s===Nt.display?"\n"===p?(u++,h=0):(h+=d,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+d>o&&c>0||"\n"===p)&&(u++,this.maxLineWidth=Math.max(this.maxLineWidth,h),h=0),"\n"!==p&&(h+=d))}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||k(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,r=this.textStyle,i=this.textLayout,n=r.fontScale,s=(i.width+r.fontOffset)*n,a=i.lineHeight*this.lineCount,o=r.fontSize*n,u=i.lineHeight*n;r.fontDesc=this.getFontDesc(o),this.char=(this.text||"").split(""),this.canvas.width=s,i.autoWidth?(this.canvas.height=a*n,this.item.transform.size.set(1,a/i.height)):this.canvas.height=i.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>s&&i.overflow===Nt.display?e.font=this.getFontDesc(o*s/this.maxLineWidth):e.font=r.fontDesc,e.clearRect(0,0,s,h),r.hasShadow&&this.setupShadow(),r.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+r.textColor[0]+", "+r.textColor[1]+", "+r.textColor[2]+", "+r.textColor[3]+")";for(var c=[],l=0,f=i.getOffsetY(r,this.lineCount,u,o),p=[],d=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((l+=i.letterSpace*n)+y.width>s&&m>0||"\n"===v)&&(c.push({y:f,width:l,chars:p,charOffsetX:d}),l=0,f+=u,p=[],d=[]),"\n"!==v&&(p.push(v),d.push(l),l+=y.width)}c.push({y:f,width:l,chars:p,charOffsetX:d}),c.forEach((function(t){var n=i.getOffsetX(r,t.width);t.chars.forEach((function(i,s){r.isOutlined&&e.strokeText(i,n+t.charOffsetX[s],t.y),e.fillText(i,n+t.charOffsetX[s],t.y)}))})),r.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=ur.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:rr.LINEAR,minFilter:rr.LINEAR,wrapS:rr.CLAMP_TO_EDGE,wrapT:rr.CLAMP_TO_EDGE});this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.getFontDesc=function(t){var e=this.textStyle,r=e.fontSize,i=e.fontScale,n=e.fontFamily,s=e.textWeight,a=e.fontStyle,o=(t||r*i).toString()+"px ";return au.includes(n)?o+=n:o+='"'+n+'"',s!==Ut.normal&&(o=s+" "+o),a!==Bt.normal&&(o=a+" "+o),o},e.setupOutline=function(){var t=this.context,e=this.textStyle,r=e.outlineColor,i=e.outlineWidth,n=r[0],s=r[1],a=r[2],o=r[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*s+", "+255*a+", "+o+")",t.lineWidth=2*i)},e.setupShadow=function(){var t=this.context,e=this.textStyle,r=e.outlineColor,i=e.shadowBlur,n=e.shadowOffsetX,s=e.shadowOffsetY,a=r[0],o=r[1],u=r[2],h=r[3];t&&(t.shadowColor="rgba("+255*a+", "+255*o+", "+255*u+", "+h+")",t.shadowBlur=i,t.shadowOffsetX=n,t.shadowOffsetY=-s)},t}();tt(exports.TextComponent,[uu]);var hu=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(Tt),cu=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(fe);exports.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.fromData=function(t){},e}(fe),u([ce()],exports.BinaryAsset.prototype,"buffer",void 0),exports.BinaryAsset=u([he(Kt.BinaryAsset)],exports.BinaryAsset);var lu=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){if(this.engine.objectInstance[e])return this.engine.objectInstance[e];var r,i=this.findData(e);if(i){switch(i.dataType){case Kt.Material:r=Nr.create(this.engine);break;case Kt.Geometry:r=jr.create(this.engine);break;case Kt.Texture:r=ur.create(this.engine);break;default:var n=t.getClass(i.dataType);n&&(r=new n(this.engine))}if(r)return r.setInstanceId(i.id),this.engine.addInstance(r),ko.deserialize(i,r),r;console.error("Constructor for DataType: "+i.dataType+" not found.")}else console.error("Object data with uuid: "+e+" not found.")},e.loadGUIDAsync=function(e){var r=this;return i((function(){var i,n,s;return h(this,(function(a){switch(a.label){case 0:return r.engine.objectInstance[e]?[2,r.engine.objectInstance[e]]:(i=r.findData(e))?[3,2]:r.engine.database?[4,r.engine.database.loadGUID(e)]:(console.error("Object data with uuid: "+e+" not found."),[2,void 0]);case 1:return(n=a.sent())?(r.engine.addInstance(n),[2,n]):(console.error("Disk data with uuid: "+e+" not found."),[2,void 0]);case 2:switch(i.dataType){case Kt.Material:n=Nr.create(r.engine);break;case Kt.Geometry:n=jr.create(r.engine);break;case Kt.Texture:n=ur.create(r.engine);break;default:(s=t.getClass(i.dataType))&&(n=new s(r.engine))}return n?(n.setInstanceId(i.id),r.engine.addInstance(n),[4,ko.deserializeAsync(i,n)]):(console.error("Constructor for DataType: "+i.dataType+" not found."),[2,void 0]);case 3:return a.sent(),[2,n]}}))}))()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return ue[t]},t}(),fu=function(){function t(){}return t.prototype.loadGUID=function(t){return i((function(){return h(this,(function(t){return[2,void 0]}))}))()},t}();function pu(t,e){if(!t.includes(e))return t.push(e),!0}function du(t){if(Number.isFinite(t))return[Ct.CONSTANT,t];if(t){var e=t[0],r=t[1];if(Array.isArray(e))return;if("static"===e||e===Ct.CONSTANT)return[Ct.CONSTANT,t[1]];if("lines"===e)return[Ct.LINE,t[1]];if(e===Ct.LINE){var i=r.map((function(t){return[St.LINE,t]}));return[Ct.BEZIER_CURVE,i]}return"curve"===e||e===Ct.CURVE?[Ct.BEZIER_CURVE,Fu(r)]:t}}function mu(t,e){return Array.isArray(t)&&"random"===t[0]?[Ct.CONSTANT,t[1][e]]:du(t)}function vu(t){return t&&"color"===t[0]?bu(t[1],!0):[1,1,1,1]}function yu(t,e){if(t)return"colors"===t[0]?[Ct.COLORS,t[1].map((function(t){return bu(t,e)}))]:"gradient"===t[0]?xu(t[1],e):"color"===t[0]?[Ct.RGBA_COLOR,bu(t[1],e)]:t}function gu(t){return t&&"random"===t[0]?[Ct.RANDOM,t[1]]:du(t)}function xu(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach((function(i){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(i),s=bu(t[i],e);r.push([n,s[0],s[1],s[2],s[3]])})),r=r.sort((function(t,e){return t[0]-e[0]})),[Ct.GRADIENT_COLOR,r]}}function bu(t,e){var r;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else a(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=Tu(r)),r}function Tu(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Eu(t,e){return Array.isArray(t)?t[0]===Ct.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&xu(t[1],e):xu(t,e)}function _u(t){if(t){if(3===t.length)return[Ct.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===Ct.BEZIER_PATH||e===Ct.LINEAR_PATH){var r=t[1],i=r[0],n=r[1],s=r[2],a=Fu(i);if(!s){s=[];for(var o=0;o<n.length;o++){var u=n[o].slice();0===o?s.push(u):o<n.length-1?(s.push(u),s.push(u)):s.push(u)}}return[Ct.BEZIER_CURVE_PATH,[a,n,s]]}return t}}function Au(t){for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value;t[i]=Number(t[i])}return t}function Cu(t){for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value;void 0===t[i]&&delete t[i]}return t}var Su,wu=Math.cos,Ru=Math.sin,Ou=Math.PI/180,Mu=180/Math.PI;function Pu(t,e){return t?[t[0]-.5,.5-t[1]]:e?Iu[e]:[0,0]}var Iu=((Su={})[gt.PARTICLE_ORIGIN_CENTER]=[0,0],Su[gt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Su[gt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Su[gt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Su[gt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Su[gt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Su[gt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Su[gt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Su[gt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Su);function Lu(t,e,r,i){var n=r[0],s=r[1],a=i[0],o=a-n;return[[n+(a-n)/3,s+(t*=o)/3],[a-(a-n)/3,i[1]-(e*=o)/3]]}function Fu(t){for(var e=-1e6,r=1e6,i=0;i<t.length;i++)e=Math.max(e,t[i][1]),r=Math.min(r,t[i][1]);for(var n=[[t[0][0],t[0][1]]],s=0;s<t.length-1;s++){var a=t[s][3]*(e-r),o=t[s+1][2]*(e-r),u=[t[s][0],t[s][1]],h=[t[s+1][0],t[s+1][1]];if(u[0]!=h[0]){var c=Lu(a,o,u,h),l=c[0],f=c[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[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?[St.EASE_OUT,t]:e===n.length-1?[St.EASE_IN,t]:[St.EASE,t]}))}function Vu(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===vt.null&&t.endBehavior===wt.destroy&&(t.endBehavior=wt.freeze)}))})),t.version=ot["2_1"],t}function Du(t){var e;null==(e=t.plugins)||e.forEach((function(e,r){"richtext"===e&&(t.plugins[r]="rich-text")}));for(var r,i=s(t.components);!(r=i()).done;){var n=r.value;if(n.dataType===Kt.ShapeComponent){var a=n;if(a.type===Ht.Custom){var o,u=a;(null==(o=u.shapes)?void 0:o.length)>0&&u.shapes[0].fill&&(u.fill=u.shapes[0].fill);for(var h,c=new Array(u.easingIns.length),l=new Array(u.easingOuts.length).fill(!1),f=s(u.shapes);!(h=f()).done;)for(var p,d=s(h.value.indexes);!(p=d()).done;){var m=p.value,v=u.points[m.point],y=u.easingIns[m.easingIn],g=u.easingOuts[m.easingOut];c[m.easingIn]||(y.x-=v.x,y.y-=v.y,c[m.easingIn]=!0),l[m.easingOut]||(g.x-=v.x,g.y-=v.y,l[m.easingOut]=!0)}}}}for(var x,b=t.compositionId,T={},E=s(t.compositions);!(x=E()).done;){var _=x.value,A=J();T[_.id]=A,_.id===b&&(t.compositionId=A),_.id=A}for(var C,S=s(t.items);!(C=S()).done;){var w=C.value;if(w.content){var R=w.content.options;R&&void 0!==R.refId&&(R.refId=T[R.refId])}}return t}function Nu(t){for(var e,r,i,n=function(){var t=h.value;t.endBehavior!==jt&&t.endBehavior!==Gt||(t.endBehavior=wt.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===vt.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,r=s(t.items);!(e=r()).done;){var i=e.value;c[i.id]=J(),i.oldId=i.id,i.id=c[i.id],l[i.id]=i}t.items.forEach((function(e,r){if(e.parentId)if(e.parentId.includes("^")){var i=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=c[i]+"^"+n}else e.parentId=c[e.parentId];a.items.push(e),t.items[r]={id:e.id}}));var n=Ie({},t,{timelineAsset:{id:""},sceneBindings:[]});a.compositions.push(n),function(t,e,r){for(var i,n=[],a=[],o=[],u={tracks:[],id:J(),dataType:"TimelineAsset"},h=s(t.items);!(i=h()).done;){var c=e[i.value.id],l=[],f={id:J(),dataType:"ActivationPlayableAsset"};o.push(f);var p={id:J(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:f.id}}]};if(l.push({id:p.id}),a.push(p),c.type!==vt.particle){var d={id:J(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};o.push(d);var m={id:J(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:d.id}}]};l.push({id:m.id}),a.push(m)}if(c.type===vt.sprite||c.type===vt.text){var v={id:J(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime};o.push(v);var y={id:J(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:v.id}}]};l.push({id:y.id}),a.push(y)}if(c.type===vt.composition){var g={id:J(),dataType:"SubCompositionPlayableAsset"};o.push(g);var x={id:J(),dataType:"SubCompositionTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:g.id}}]};l.push({id:x.id}),a.push(x)}var b={id:J(),dataType:"ObjectBindingTrack",children:l,clips:[]};a.push(b),u.tracks.push({id:b.id}),n.push({key:{id:b.id},value:{id:c.id}})}for(var T,E=[],_=s(a);!(T=_()).done;){var A=T.value;E.push({id:A.id})}t.timelineAsset={id:u.id},t.sceneBindings=n,r.miscs.push(u);for(var C,S=s(a);!(C=S()).done;){var w=C.value;r.miscs.push(w)}for(var R,O=s(o);!(R=O()).done;){var M=R.value;r.miscs.push(M)}}(n,l,a)},a=Ie({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),o=s(a.images);!(r=o()).done;){r.value.id=J()}if(null!=(e=a).textures||(e.textures=[]),a.textures.forEach((function(t){var e;t.id=J(),t.dataType=Kt.Texture,t.source={id:null==(e=a.images[t.source])?void 0:e.id}})),a.textures.length<a.images.length)for(var u=a.textures.length;u<a.images.length;u++)a.textures.push({id:J(),dataType:Kt.Texture,source:{id:a.images[u].id},flipY:!0});t.bins&&(i=t.bins,a.bins=i.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:J()}})));for(var h,c={},l={},f=s(t.compositions);!(h=f()).done;)n();for(var p,d=s(a.items);!(p=d()).done;){var m=p.value;if(m.content){if(m.content.renderer&&void 0!==m.content.renderer.texture){var v=m.content.renderer.texture;m.content.renderer.texture={id:a.textures[v].id}}if(m.content.trails&&void 0!==m.content.trails.texture){var y=m.content.trails.texture;m.content.trails.texture={id:a.textures[y].id}}}if(m.transform){var g,x,b,T=[].concat(null!=(g=m.transform.position)?g:[0,0,0]),E=[].concat(null!=(x=m.transform.rotation)?x:[0,0,0]),_=[].concat(null!=(b=m.transform.scale)?b:[1,1,1]);if(Object.assign(m,{transform:{position:{x:T[0],y:T[1],z:T[2]},eulerHint:{x:E[0],y:E[1],z:E[2]},scale:{x:_[0],y:_[1],z:_[0]}}}),m.type===vt.sprite&&(m.transform.size={x:_[0],y:_[1]},m.transform.scale={x:1,y:1,z:1}),m.type===vt.sprite){var A=m.content;A.renderer||(A.renderer={});var C,S,w,R,O=A.renderer,M=Pu(O.anchor,O.particleOrigin),P=m.transform.size;if(!O.anchor&&void 0!==O.particleOrigin)m.transform.position.x+=-M[0]*(null!=(C=null==P?void 0:P.x)?C:1),m.transform.position.y+=-M[1]*(null!=(S=null==P?void 0:P.y)?S:1);m.transform.anchor={x:M[0]*(null!=(w=null==P?void 0:P.x)?w:1),y:M[1]*(null!=(R=null==P?void 0:P.y)?R:1)}}}if(m.type===vt.particle){var I=m.content;I.renderer||(I.renderer={});var L=I.renderer;I.renderer.anchor=Pu(L.anchor,L.particleOrigin)}if(m.type===vt.camera&&m.content.positionOverLifetime&&0!==Object.keys(m.content.positionOverLifetime).length&&(m.content.positionOverLifetime.asMovement=!0),void 0!==m.pn){var F=m.pn,V=t.plugins,D=void 0===V?[]:V;void 0!==F&&Number.isInteger(F)&&(m.pluginName=D[F])}switch("editor-gizmo"===m.pluginName&&(m.type="editor-gizmo"),"orientation-transformer"===m.pluginName&&(m.type="orientation-transformer"),m.content.options.target&&"editor-gizmo"===m.pluginName&&(m.content.options.target=c[m.content.options.target]),m.type===vt.spine&&t.spines&&0!==t.spines.length&&zu(t.spines[m.content.options.spine],m.content,a),m.type!==vt.sprite&&m.type!==vt.particle&&m.type!==vt.mesh&&m.type!==vt.skybox&&m.type!==vt.light&&"camera"!==m.type&&m.type!==vt.tree&&m.type!==vt.interact&&m.type!==vt.camera&&m.type!==vt.text&&m.type!==vt.spine&&"editor-gizmo"!==m.type&&"orientation-transformer"!==m.type||(m.components=[],a.components.push(m.content),m.content.id=J(),m.content.item={id:m.id},m.dataType=Kt.VFXItemData,m.components.push({id:m.content.id})),m.type!==vt.null&&m.type!==vt.composition||(m.components=[],m.dataType=Kt.VFXItemData),m.type){case vt.sprite:m.content.dataType=Kt.SpriteComponent;break;case vt.particle:m.content.dataType=Kt.ParticleSystem;break;case vt.mesh:m.content.dataType=Kt.MeshComponent;break;case vt.skybox:m.content.dataType=Kt.SkyboxComponent;break;case vt.light:m.content.dataType=Kt.LightComponent;break;case"camera":m.content.dataType=Kt.CameraComponent;break;case"editor-gizmo":m.content.dataType="GizmoComponent";break;case"orientation-transformer":m.content.dataType="OrientationComponent";break;case vt.tree:m.content.dataType=Kt.TreeComponent;break;case vt.interact:m.content.dataType=Kt.InteractComponent;break;case vt.camera:m.content.dataType=Kt.CameraController;break;case vt.text:m.content.dataType=Kt.TextComponent;break;case vt.spine:m.content.dataType=Kt.SpineComponent}}return a.version=ot["3_0"],a}function ku(t){if(t)for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value,n=t[i],a=Array.isArray(n);a&&2===n.length&&Array.isArray(n[1])?t[i]="path"===i?_u(n):du(n):a||"object"!=typeof n||ku(n)}}function zu(t,e,r){e.resource={atlas:{bins:{id:r.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:r.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map((function(t){return{id:r.textures[t].id}}))}}function Uu(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},s={path:_u(null==(r=t.transform)?void 0:r.path),gravity:i.gravity,gravityOverLifetime:du(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:du(n.linearX),linearY:du(n.linearY),linearZ:du(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:du(n.orbitalX),orbitalY:du(n.orbitalY),orbitalZ:du(n.orbitalZ),speedOverLifetime:du(n.speedOverLifetime)};Cu(s);var a={options:{startColor:vu(i.startColor)},positionOverLifetime:s};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var o=t.rotationOverLifetime;if(o){var u=a.rotationOverLifetime={separateAxes:o.separateAxes,asRotation:o.asRotation};u.separateAxes?(u.x=du(o.x),u.y=du(o.y),u.z=du(o.z)):u.z=du(o.angularVelocity)}var h=t.colorOverLifetime;if(h){var c=a.colorOverLifetime={opacity:du(h.opacity)};h.color&&(c.color=Eu(h.color))}var l=t.sizeOverLifetime;return l&&(a.sizeOverLifetime={separateAxes:l.separateAxes,size:du(l.size),x:du(l.x),y:du(l.y),z:du(l.z)}),a}var Bu=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,Gu=/^(\d+)\.(\d+)$/,ju=!1;function Xu(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e;if(function(t){var e,r=null==(e=t.version)?void 0:e.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==vt.mesh&&t.type!==vt.light||(t.endBehavior=1===t.endBehavior?wt.destroy:t.endBehavior)}))}))}(t),Bu.test(t.version))return ju="0"===(null==(e=/^(\d+)/.exec(t.version))?void 0:e[0]),Du(Nu(Vu(function(t){var e;Hu=ot["1_0"];var r=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(Hu=ot["1_3"]);var i,n=(t.requires||[]).slice(),s=t.images.map((function(e,r){return Wu(e,r,t.imageTags||[])})),a=t.textures||s.map((function(t,e){return{source:e,flipY:!0}})),o={plugins:r,shapes:t.shapes||[],type:"ge",version:Hu,playerVersion:null!=(i=t.playerVersion)?i:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return Yu(t,{plugins:r,requires:n})})),images:s,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:a,bins:(t.bins||[]).slice()};t._textures&&(o._textures=t._textures);return o}(t))));ju=!1;var r=Gu.exec(t.version)||[],i=Number(r[1]),n=Number(r[2]);if(i)return(i<2||2===i&&n<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,r=s(t.items);!(e=r()).done;)ku(e.value.content)})),t}(t)),i<3&&(t=Nu(Vu(t))),i<4&&3===i&&n<2&&(t=Du(t)),t;throw new Error("Invalid JSON version: "+t.version+".")}var Hu=ot["1_0"];function Wu(t,e,r){var i=r[e];if("string"==typeof t)return{id:J(),renderLevel:i,url:t};if(t.template)return{id:J(),url:t.url,template:t.template,webp:t.webp,renderLevel:i};if(t.compressed)return{id:J(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{id:J(),url:t.url,webp:t.webp,renderLevel:i};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}function Yu(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Ie({clipMode:Xt},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Qu(t,e)})),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var s=null==(r=t.meta)?void 0:r.previewSize;return s&&s[0]===s[1]&&0===s[0]&&(s=void 0),s&&(i.previewSize=s),i}var Zu,qu=[0,0,0,1],Ku=.5;function Qu(t,e){var r;void 0===e&&(e={});var i,n,s,a,o,u,h=vt.base,c=t.endBehavior,l=NaN;if(t.content?(h=t.type||vt.plugin,u=t.pn,o=t.pluginName,s=t.content,n=t.content,isNaN(u)&&!o&&(o=s.options.type),t.duration&&(l=t.duration),i=t.transform||y(n.transform)):t.particle?(h=vt.particle,i=y((n=t.particle).transform,ju,!0),s=function(t){var e=t.options,r=t.transform,i={type:ft.NONE};if(t.shape){var n,s=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(i=Ie({},t.shape,{type:ft[s]}),t.shape.upDirection){var a=t.shape.upDirection,o=a[0],u=a[1],h=a[2];0===o&&0===u&&0===h&&delete i.upDirection}}e.startTurbulence&&(i.turbulenceX=gu(e.turbulenceX),i.turbulenceY=gu(e.turbulenceY),i.turbulenceZ=gu(e.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map((function(t){return Au(t)}))),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map((function(t){return Au(t)}))),c.rateOverTime&&(c.rateOverTime=gu(c.rateOverTime));var l={renderer:t.renderer,shape:i,splits:t.splits,emission:c,options:{startLifetime:gu(e.startLifetime),start3DSize:!!e.start3DSize,startSize:gu(e.startSize),startSizeX:gu(e.startSizeX),startSizeY:gu(e.startSizeY),sizeAspect:gu(e.sizeAspect),maxCount:e.maxCount,startDelay:gu(e.startDelay),startColor:yu(e.startColor,!0),startRotationZ:gu(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=gu(e.startRotationX),l.options.startRotationY=gu(e.startRotationY)),r&&r.path&&(l.emitterTransform={path:_u(r.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:gu(f.x),y:gu(f.y)}:l.sizeOverLifetime={size:gu(f.size)});var p=t.velocityOverLifetime||{},d=p.speedOverLifetime;d=d?du(d):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:du(e.gravityModifier),startSpeed:gu(e.startSpeed),speedOverLifetime:d,asMovement:p.asMovement,linearX:gu(p.linearX),linearY:gu(p.linearY),linearZ:gu(p.linearZ),asRotation:p.asRotation,orbCenter:p.orbCenter,orbitalX:gu(p.orbitalX),orbitalY:gu(p.orbitalY),orbitalZ:gu(p.orbitalZ),forceTarget:p.forceTarget,target:p.target,forceCurve:du(p.forceCurve)},Cu(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:gu(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=du(m.y),l.rotationOverLifetime.x=du(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:du(v.opacity)};v.color&&(y.color=Eu(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:du(g.cycles),animationDelay:mu(g.animationDelay,0),animationDuration:mu(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:gu(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:du(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Eu(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Eu(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:gu(x.opacityOverLifetime)}),l.trails&&Cu(l.trails);var b=t.interaction;return b&&(l.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),l}(n)):t.sprite?(h=vt.sprite,s=function(t,e){var r=Uu(t,e),i=t.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=t.renderer,t.splits&&(r.splits=t.splits),t.interaction&&(r.interaction=t.interaction),r}(n=t.sprite,i=y(n.transform,!1,!0))):t.cal?(h=vt.null,s=Uu(n=t.cal,i=y(n.transform,!1,!0))):t.ui?(h=vt.interact,i=y((n=t.ui).transform),s=function(t){var e,r=t.options;switch(r.type){case"click":e={type:dt.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&vu(r.previewColor),behavior:r.behavior||mt.NOTIFY};break;case"drag":e={type:dt.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:dt.MESSAGE}}return{options:e}}(n),i.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(h=vt.camera,i=y(n.transform),s=function(t){var e,r=t.options,i={options:{fov:r.fov,far:r.far,near:r.near,clipMode:r.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var s,a={path:_u(null==(s=t.transform)?void 0:s.path),linearX:du(null==n?void 0:n.translateX),linearY:du(null==n?void 0:n.translateY),linearZ:du(null==n?void 0:n.translateZ)};Cu(a),i.positionOverLifetime=a}var o=t.rotationOverLifetime;if(o){var u={separateAxes:o.separateAxes,x:du(null==o?void 0:o.rotateX),y:du(null==o?void 0:o.rotateY),z:o.separateAxes?du(null==o?void 0:o.rotateZ):du(o.rotation)};Cu(u),i.rotationOverLifetime=u}return i}(n))),null==(r=s.renderer)?void 0:r.anchor){var f=new Float32Array(s.renderer.anchor);f[0]==Ku&&f[1]==Ku?delete s.renderer.anchor:e.requires&&pu(e.requires,"anchor")}if(n){var p,d,m=null==(p=n.options)?void 0:p.looping;if(m)c=Array.isArray(m)?m[1]?wt.restart:wt.destroy:wt.restart;else c=c||(null==n||null==(d=n.options)?void 0:d.endBehavior)||wt.destroy;n.options.renderLevel&&(a=n.options.renderLevel),isNaN(l)&&(l=n.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:l,id:t.id+"",transform:i,endBehavior:c,renderLevel:a,content:s};return o?e.plugins?(pu(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,r){if(t){var i={},n=t.rotation;if(n&&(i.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var s=(a=qu,o=i.rotation[0],u=i.rotation[1],h=i.rotation[2],c=wu(o*Ou/2),l=wu(u*Ou/2),f=wu(h*Ou/2),p=Ru(o*Ou/2),d=Ru(u*Ou/2),m=Ru(h*Ou/2),a[0]=p*l*f+c*d*m,a[1]=c*d*f-p*l*m,a[2]=c*l*m+p*d*f,a[3]=c*l*f-p*d*m,a);i.rotation=function(t,e){var r,i,n,s=e[0],a=e[1],o=e[2],u=e[3],h=s+s,c=a+a,l=o+o,f=s*h,p=a*h,d=a*c,m=o*l,v=u*l,y=1-d-m,g=p-v,x=p+v,b=1-f-m,T=o*h-u*c,E=o*c+u*h,_=1-f-d;return t[1]=Math.asin((i=-1,(r=-T)>(n=1)?n:r<i?i:r))*Mu,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,_)*Mu,t[2]=Math.atan2(x,y)*Mu):(t[0]=0,t[2]=Math.atan2(-g,b)*Mu),t}([],s)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}var a,o,u,h,c,l,f,p,d,m;return{}}}var Ju,$u=((Zu={})[ut.S]=[ut.S,ut.BPlus,ut.APlus],Zu[ut.A]=[ut.A,ut.BPlus,ut.APlus],Zu[ut.B]=[ut.B,ut.BPlus],Zu);function th(t,e){if(!t||!e)return!0;var r=$u[e];return!!r&&r.includes(t)}function eh(t,e){var r,i,n=null!=(i=null==t?void 0:t.background)?i:{},s=n.name,a=n.url;return s&&(e&&e[s]?r=e[s]:a&&(r=a)),r}function rh(t,e,r){return ih.apply(this,arguments)}function ih(){return(ih=i((function(t,r,i){var n,s;return h(this,(function(o){switch(o.label){case 0:return"string"!=typeof t?[3,2]:[4,Ue(t)];case 1:return n=o.sent(),[3,3];case 2:n=t,o.label=3;case 3:if(!n)throw new Error("Image not provided.");if(!r)return[2,n];if(s=eh(r,i)){if(H(s)&&s!==n.src)return[2,Ue(s)];if(a(s,e.HTMLImageElement))return[2,s]}return[2,n]}}))}))).apply(this,arguments)}exports.Scene=void 0,(Ju=exports.Scene||(exports.Scene={})).isJSONObject=function(t){return Z(t)&&"jsonScene"in t},Ju.isURL=function(t){return Z(t)&&"url"in t},Ju.isWithOptions=function(t){return Z(t)&&"options"in t};var nh=1,sh=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new Le),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=nh++,this.timers=[],this.updateOptions(t)}var r=t.prototype;return r.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,r=void 0===e?10:e;this.timeout=r},r.loadScene=function(t,r,n){var s=this;return i((function(){var a,o,u,c,l,f,p,d,m,v,y,g,x;return h(this,(function(b){return o=H(t)?t:s.id,u=e.performance.now(),c=[],l=null==r?void 0:r.engine.gpuCapability,p=null!=(f=null==l?void 0:l.detail.compressedTexture)?f:exports.COMPRESSED_TEXTURE.NONE,d={},v=!1,y=new Promise((function(t,r){m=e.window.setTimeout((function(){v=!0,s.removeTimer(m);var t=e.performance.now()-u;r(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+c.join(" ")+", url: "+o+"."))}),1e3*s.timeout),s.timers.push(m)})),g=i((function(t,r){var i,n,s,a;return h(this,(function(o){switch(o.label){case 0:if(v)return[3,4];i=e.performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r()];case 2:return n=o.sent(),s=e.performance.now()-i,c.push("["+t+": "+s.toFixed(2)+"]"),d[t]=s,[2,n];case 3:throw a=o.sent(),new Error("Load error in "+t+", "+a+".");case 4:throw new Error("Load canceled.")}}))})),x=i((function(){var r,i,l,f,v,y,x,b,T,E,_,A,C,S,w,R,O,M;return h(this,(function(h){switch(h.label){case 0:return H(t)?(i=new e.URL(t,e.location.href).href,s.baseUrl=i,[4,g("loadJSON",(function(){return s.loadJSON(i)}))]):[3,2];case 1:return a=h.sent(),[3,3];case 2:a=t,s.baseUrl=e.location.href,h.label=3;case 3:return exports.Scene.isJSONObject(a)?(r=Ie({},a),l=r.jsonScene,f=r.pluginSystem,v=r.images,y=l.images,s.assignImagesToAssets(y,v),[4,Promise.all([g("plugin:processAssets",(function(){return s.processPluginAssets(l,f,n)}))])]):[3,5];case 4:return h.sent(),[3,10];case 5:return[4,g("processJSON",(function(){return s.processJSON(a)}))];case 6:return x=h.sent(),b=x.jsonScene,T=x.pluginSystem,E=b.bins,_=void 0===E?[]:E,A=b.images,C=b.fonts,[4,Promise.all([g("processBins",(function(){return s.processBins(_)})),g("processImages",(function(){return s.processImages(A,p)})),g("plugin:processAssets",(function(){return s.processPluginAssets(b,T,n)})),g("processFontURL",(function(){return s.processFontURL(C)}))])];case 7:return S=h.sent(),w=S[0],R=S[1],[4,g("processTextures",(function(){return s.processTextures(R,w,b)}))];case 8:return O=h.sent(),r={timeInfos:d,url:t,renderLevel:s.options.renderLevel,storage:{},pluginSystem:T,jsonScene:b,bins:w,images:R,textureOptions:O},[4,g("plugin:prepareResource",(function(){return T.loadResources(r,s.options)}))];case 9:h.sent(),h.label=10;case 10:return M=e.performance.now()-u,j.info("Load asset: totalTime: "+M.toFixed(4)+"ms "+c.join(" ")+", url: "+o+"."),e.window.clearTimeout(m),s.removeTimer(m),r.totalTime=M,r.startTime=u,r.timeInfos=d,[2,r]}}))})),[2,Promise.race([y,x()])]}))}))()},r.getAssets=function(){return this.assets},r.processJSON=function(t){var e=this;return i((function(){var r,i;return h(this,(function(n){switch(n.label){case 0:return r=Xu(t),[4,(i=new st).processRawJSON(r,e.options)];case 1:return n.sent(),[2,{jsonScene:r,pluginSystem:i}]}}))}))()},r.processBins=function(t){var r=this;return i((function(){var i,n,s;return h(this,(function(o){return i=r.options.renderLevel,n=r.baseUrl,s=t.map((function(s){if(a(s,ArrayBuffer))return s;if(th(s.renderLevel,i))return r.loadBins(new e.URL(s.url,n).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(s)]}))}))()},r.processFontURL=function(r){var n=this;return i((function(){var s;return h(this,(function(a){return r?(s=r.map(i((function(r){var i,s,a;return h(this,(function(o){switch(o.label){case 0:if(!r.fontURL||t.fontCache.has(r.fontFamily))return[3,4];k(r.fontFamily)||console.warn("Risky font family: "+r.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),i=new e.URL(r.fontURL,n.baseUrl).href,[4,(a=new FontFace(null!=(s=r.fontFamily)?s:"","url("+i+")")).load()];case 2:return o.sent(),e.document.fonts.add(a),t.fontCache.add(r.fontFamily),[3,4];case 3:return o.sent(),j.warn("Invalid font family or font source: "+JSON.stringify(r.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(s)]):[2]}))}))()},r.processImages=function(t,r){void 0===r&&(r=0);var n=this;return i((function(){var s,o,u,c,l,f,p,d;return h(this,(function(m){switch(m.label){case 0:return s=n.options,o=s.useCompressedTexture,u=s.variables,c=s.disableWebP,l=s.disableAVIF,f=n.baseUrl,p=t.map(i((function(t,i){var s,p,d,m,v,y,g,x,b,T,E,_,A,C,S,w,R,O,M,P,I;return h(this,(function(i){switch(i.label){case 0:if(s=t.url,p=t.webp,d=t.avif,m=new e.URL(s,f).href,v=!c&&p?new e.URL(p,f).href:void 0,y=!l&&d?new e.URL(d,f).href:void 0,g=t.id,!("template"in t))return[3,8];if(x=t.template,!(b=x.background))return[3,7];T=eh(x,u),E=b.type===Zt.video,_=b&&E?He:Ue,i.label=1;case 1:return i.trys.push([1,6,,7]),[4,Ye(T,_)];case 2:return a(A=i.sent(),e.HTMLVideoElement)?(n.sourceFrom[g]={url:A.src,type:exports.TextureSourceType.video},[2,A]):[3,3];case 3:return b&&Array.isArray(T)&&u&&(u[b.name]=A.src),n.sourceFrom[g]={url:A.src,type:exports.TextureSourceType.image},[4,rh(A,x,u)];case 4:return[2,i.sent()];case 5:return[3,7];case 6:throw C=i.sent(),new Error("Failed to load. Check the template or if the URL is "+(E?"video":"image")+" type, URL: "+T+", Error: "+(C.message||C)+".");case 7:return[3,9];case 8:if("compressed"in t&&o&&r){if(S=t.compressed,r===exports.COMPRESSED_TEXTURE.ASTC?w=S.astc:r===exports.COMPRESSED_TEXTURE.PVRTC&&(w=S.pvrtc),w)return R=new e.URL(w,f).href,n.sourceFrom[g]={url:R,type:exports.TextureSourceType.compressed},[2,n.loadBins(R)]}else if(a(t,e.HTMLImageElement)||a(t,e.HTMLCanvasElement)||a(t,e.HTMLVideoElement)||a(t,ur))return[2,t];i.label=9;case 9:return y?[4,ke(m,y)]:[3,11];case 10:return I=i.sent(),[3,13];case 11:return[4,De(m,v)];case 12:I=i.sent(),i.label=13;case 13:return M=(O=I).url,P=O.image,n.sourceFrom[g]={url:M,type:exports.TextureSourceType.image},[2,P]}}))}))),[4,Promise.all(p)];case 1:return d=m.sent(),n.assignImagesToAssets(t,d),[2,d]}}))}))()},r.processPluginAssets=function(t,e,r){var n=this;return i((function(){var i,s,a,o,u;return h(this,(function(h){switch(h.label){case 0:return[4,e.processAssets(t,r)];case 1:for(i=h.sent(),s=i.reduce((function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t}),{assets:[],loadedAssets:[]}),a=s.assets,o=s.loadedAssets,u=0;u<a.length;u++)n.assets[a[u].id]=o[u];return[2]}}))}))()},r.processTextures=function(t,r,n){var s=this;return i((function(){var o,u,c;return h(this,(function(l){return u=null!=(o=n.textures)?o:t.map((function(t,e){return{source:e}})),c=u.map(i((function(t,i){var o,u,c,l,f,p;return h(this,(function(h){switch(h.label){case 0:if(a(t,ur))return[2,t];if(!("mipmaps"in t))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,qe(t,r,s.assets,n.bins)];case 2:return[2,h.sent()];case 3:throw o=h.sent(),new Error("Load texture "+i+" fails, error message: "+o+".");case 4:return u=t.source,c=t.id,f="",Z(u)?(l=s.assets[u.id],f=u.id,[3,7]):[3,5];case 5:return"string"!=typeof u?[3,7]:[4,Ue($(u))];case 6:l=h.sent(),h.label=7;case 7:if(l)return p=function(t,r,i){var n={id:i,dataType:Kt.Texture};if(a(t,ur))return Ie({},t.source,n);if(a(t,e.HTMLImageElement)||q(t))return Ie({image:t,sourceType:exports.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:rr.LINEAR,magFilter:rr.LINEAR},n);if(a(t,e.HTMLVideoElement))return Ie({sourceType:exports.TextureSourceType.video,video:t,minFilter:rr.LINEAR,magFilter:rr.LINEAR},n);if(a(t,ArrayBuffer))return Ie({},dr(t),{sourceFrom:r},n);if("width"in t&&"height"in t&&"data"in t)return Ie({sourceType:exports.TextureSourceType.data,data:t,wrapS:rr.CLAMP_TO_EDGE,wrapT:rr.CLAMP_TO_EDGE,minFilter:rr.NEAREST,magFilter:rr.NEAREST},n);throw new Error("Invalid texture options.")}(l,s.sourceFrom[f],c),[2,p.sourceType===exports.TextureSourceType.compressed?p:Ie({},p,t)];throw new Error("Invalid texture source: "+u+".")}}))}))),[2,Promise.all(c)]}))}))()},r.loadJSON=function(t){var e=this;return i((function(){return h(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadJSON(t,r,(function(e,r){i("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+r)}))}))]}))}))()},r.loadBins=function(t){var e=this;return i((function(){return h(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadBinary(t,r,(function(e,r){i("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+r)}))}))]}))}))()},r.assignImagesToAssets=function(t,e){for(var r=0;r<t.length;r++)this.assets[t[r].id]=e[r]},r.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},r.dispose=function(){this.timers.length&&this.timers.map((function(t){return e.window.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t}();sh.fontCache=new Set;var ah,oh=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(lr(t))}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var r=t;return exports.Scene.isURL(t)&&(exports.Scene.isJSONObject(t)||(r=t.url),exports.Scene.isWithOptions(t)&&(e=Ie({},e,t.options))),{source:r,options:e}},e.updateTextVariables=function(t,e){var r=this;void 0===e&&(e={}),t.jsonScene.items.forEach((function(t){if(t.type===vt.text||t.type===vt.richtext){var i=e[t.name];if(!i)return;t.components.forEach((function(t){var e=t.id,n=r.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==Kt.TextComponent&&(null==n?void 0:n.dataType)!==Kt.RichTextComponent||(n.options.text=i)}))}}))},e.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++){var r=t.textureOptions[e];a(r,ur)?this.engine.addInstance(r):(r=this.engine.assetLoader.loadGUID(t.textureOptions[e].id),t.textureOptions[e]=r),r.initialize()}},e.prepareAssets=function(t,e){this.engine.clearResources();for(var r,i=s(Object.keys(e));!(r=i()).done;){var n=r.value,a=e[n],o=new cu(this.engine);o.data=a,o.setInstanceId(n)}this.engine.addPackageDatas(t);for(var u,h=s(this.builtinObjects);!(u=h()).done;){var c=u.value;this.engine.addInstance(c)}},e.createShaderVariant=function(){for(var t,e=s(Object.keys(this.engine.objectInstance));!(t=e()).done;){var r=t.value,i=this.engine.objectInstance[r];a(i,Nr)&&i.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=s(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),uh=new Ae(1,1,1),hh=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new Bs,this.viewportMatrix=Pe.fromIdentity(),this.viewMatrix=Pe.fromIdentity(),this.projectionMatrix=Pe.fromIdentity(),this.viewProjectionMatrix=Pe.fromIdentity(),this.inverseViewMatrix=Pe.fromIdentity(),this.dirty=!0;var r=e.near,i=void 0===r?.1:r,n=e.far,s=void 0===n?20:n,a=e.fov,o=void 0===a?60:a,u=e.aspect,h=void 0===u?1:u,c=e.clipMode,l=void 0===c?At.portrait:c,f=e.position,p=void 0===f?[0,0,8]:f,d=e.rotation,m=void 0===d?[0,0,0]:d,v=new Hr(m[0],m[1],m[2]),y=(new Re).setFromEuler(v);this.options={near:i,far:s,fov:o,aspect:h,clipMode:l},this.transform.setPosition(p[0],p[1],p[2]),this.transform.setQuaternion(y.x,y.y,y.z,y.w),this.dirty=!0,this.updateMatrix()}var 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 Ae(this.position.x,this.position.y,t),r=this.getViewProjectionMatrix(),i=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();i.premultiply(n),r.multiply(n.invert())}var s=r.projectPoint(e).z,a=i.projectPoint(new Ae(1,1,s)),o=a.x,u=a.y,h=i.projectPoint(new Ae(-1,-1,s)),c=h.x,l=h.y;return new Ae((o-c)/2,(u-l)/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 Ie({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,r=t.far,i=t.fov,n=t.clipMode,s=t.aspect,a=t.position,o=t.rotation;this.near=e,this.far=r,this.fov=i,this.clipMode=n,this.aspect=s,this.position=a,this.rotation=o,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,r=e.fov,i=e.aspect,n=e.near,s=e.far,a=e.clipMode;this.projectionMatrix.perspective(r*ye,i,n,s,a===At.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),uh),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:Pe.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},se(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}(),ch=function(){function t(t,e){this.engine=e,this.imgUsage={},this.mask=0;var r=t.jsonScene,i=t.renderLevel,n=t.textureOptions,a=r.compositions,o=r.compositionId;if(!n)throw new Error("scene.textures expected.");var u=n;this.jsonScene=r,this.renderLevel=i,this.textures=u;for(var h,c=s(a);!(h=c()).done;){var l=h.value,f=this.getContent(l);this.engine.addEffectsObjectData(f),l.id===o&&(this.sourceContent=f)}if(!this.sourceContent)throw new Error("Invalid composition id: "+o+".")}var e=t.prototype;return e.getContent=function(t){var e=Ie({},t);return this.assembleItems(e),isNaN(e.endBehavior)&&(e.endBehavior=wt.freeze),e.startTime||(e.startTime=0),e},e.assembleItems=function(t){this.mask++;var e={},r=[];if(this.jsonScene){for(var i,n=s(this.jsonScene.components);!(i=n()).done;){var a=i.value;e[a.id]=a}for(var o,u=s(t.items);!(o=u()).done;){var h=o.value,c=this.engine.jsonSceneData[h.id],l=c;if(th(c.renderLevel,this.renderLevel)){if(l.type===vt.sprite||l.type===vt.particle||l.type===vt.spine||l.type===vt.text||l.type===vt.video||l.type===vt.shape)for(var f,p=s(l.components);!(f=p()).done;){var d=e[f.value.id];this.preProcessItemContent(d)}r.push(h)}else l.type!==vt.composition&&(l.components=[],r.push(h))}t.items=r}},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),"mask"in t.renderer||this.processMask(t.renderer);var e,r,i=t.splits&&!t.textureSheetAnimation?t.splits[0]:void 0,n=t.renderer.shape;if(Number.isInteger(n))e=null==(r=this.jsonScene)?void 0:r.shapes[n];else n&&(e=n);void 0===e||"aPoint"in e&&"index"in e||(t.renderer.shape=Ia(e,i))}"trails"in t&&void 0!==t.trails&&(t.trails=this.changeTex(t.trails))},e.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},e.addTextureUsage=function(t){var e,r=null!=(e=this.imgUsage)?e:{};t&&r&&(Object.prototype.hasOwnProperty.call(r,t)||(r[t]=0),r[t]++)},e.processMask=function(t){var e=t.maskMode;e!==lt.NONE&&(t.mask||(e===lt.MASK?t.mask=++this.mask:e!==lt.OBSCURED&&e!==lt.REVERSE_OBSCURED||(t.mask=this.mask)))},e.dispose=function(){this.textures=[],this.jsonScene=void 0,this.sourceContent=void 0},t}(),lh=function(){function t(){this.update=new ph,this.lateUpdate=new dh}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==pe.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==pe.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==pe.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==pe.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),fh=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 r=t.bind(e);this.ticks.includes(r)||this.ticks.push(r)},e.clear=function(){this.components=[]},t}(),ph=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.tickComponents=function(t,e){for(var r,i=s(t);!(r=i()).done;){r.value.onUpdate(e)}},e}(fh),dh=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.tickComponents=function(t,e){for(var r,i=s(t);!(r=i()).done;){r.value.onLateUpdate(e)}},e}(fh),mh=function(t){function r(e,r){var i,n;(i=t.call(this)||this).sceneTicking=new lh,i.speed=1,i.isEnded=!1,i.loaderData={},i.refContent=[],i.postProcessingEnabled=!1,i.assigned=!1,i.destroyed=!1,i.postLoaders=[],i.paused=!1,i.lastVideoUpdateTime=0,i.isEndCalled=!1;var s=e.reusable,a=void 0!==s&&s,o=e.speed,u=void 0===o?1:o,h=e.baseRenderOrder,c=void 0===h?0:h,l=e.renderer,f=e.event,p=e.width,d=e.height,m=e.handleItemMessage;i.compositionSourceManager=new ch(r,l.engine),a&&(i.keepResource=!0,r.textures=void 0,r.consumed=!0);var v,y,g,x=i.compositionSourceManager,b=x.sourceContent,T=x.imgUsage;return i.postProcessingEnabled=null!=(v=null==(n=r.jsonScene.renderSettings)?void 0:n.postProcessingEnabled)&&v,N(b),i.renderer=l,i.rootItem=new exports.VFXItem(i.getEngine()),i.rootItem.name="rootItem",i.rootItem.duration=b.duration,i.rootItem.endBehavior=b.endBehavior,i.rootItem.composition=we(i),i.rootComposition=i.rootItem.addComponent(No),ko.deserialize(b,i.rootComposition),i.width=p,i.height=d,i.renderOrder=c,i.id=b.id,i.renderer=l,i.texInfo=a?{}:T,i.event=f,i.statistic={loadStart:null!=(y=r.startTime)?y:0,loadTime:null!=(g=r.totalTime)?g:0,compileTime:0,firstFrameTime:0},i.reusable=a,i.speed=u,i.autoRefTex=!i.keepResource&&i.texInfo&&i.rootItem.endBehavior!==wt.restart,i.name=b.name,i.pluginSystem=r.pluginSystem,i.pluginSystem.initializeComposition(we(i),r),i.camera=new hh(i.name,Ie({},null==b?void 0:b.camera,{aspect:p/d})),i.url=r.url,i.assigned=!0,i.interactive=!0,i.handleItemMessage=m,i.createRenderFrame(),i.rendererOptions=null,i.buildItemTree(i.rootItem),i.rootComposition.setChildrenRenderOrder(0),i.pluginSystem.resetComposition(we(i),i.renderFrame),i}_t(r,t);var n=r.prototype;return n.getDuration=function(){return this.rootItem.duration},n.restart=function(){this.reset(),this.forwardTime(this.startTime)},n.setIndex=function(t){this.renderOrder=t},n.getIndex=function(){return this.renderOrder},n.setSpeed=function(t){this.speed=t},n.setVisible=function(t){this.rootItem.setVisible(t)},n.getSpeed=function(){return this.speed},n.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},n.pause=function(){this.paused=!0},n.getPaused=function(){return this.paused},n.resume=function(){this.paused=!1},n.gotoAndPlay=function(t){this.setTime(t),this.resume()},n.gotoAndStop=function(t){this.setTime(t),this.pause()},n.createRenderFrame=function(){this.renderFrame=new wi({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},n.setTime=function(t){var e=this.speed,r=this.getPaused();r&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),r&&this.pause(),this.emit("goto",{time:t})},n.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},n.forwardTime=function(t){for(var e=1e3*t-1e3*this.rootComposition.time,r=e<0,i=Math.abs(e),n=r?-15:15;i>15;i-=15)this.update(n);this.update(r?-i:i)},n.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},n.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(r){r.prepareRenderFrame(t,e)&&t.postLoaders.push(r)})),this.postLoaders.forEach((function(r){return r.postProcessFrame(t,e)}))},n.update=function(t){if(this.assigned&&!this.getPaused()){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=parseFloat(this.getUpdateTime(t*this.speed).toFixed(0));this.updateRootComposition(e/1e3),this.updateVideo(),this.updatePluginLoaders(t),this.sceneTicking.update.tick(e),this.sceneTicking.lateUpdate.tick(e),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},n.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===wt.destroy&&!this.reusable},n.getUpdateTime=function(t){var e=1e3*this.startTime,r=1e3*this.rootComposition.time;return t<0&&r+t<e?e-r:t},n.callAwake=function(t){for(var e,r=s(t.components);!(e=r()).done;){var i=e.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var n,a=s(t.children);!(n=a()).done;){var o=n.value;this.callAwake(o)}},n.buildItemTree=function(t){if(t.composition){for(var e,r=new Map,i=t.getComponent(No).items,n=s(i);!(e=n()).done;){var a=e.value;r.set(a.id,a)}for(var o,u=s(i);!(o=u()).done;){var h=o.value;if(void 0===h.parentId)h.setParent(t);else{var c=r.get(h.parentId);if(!c)throw new Error("The element references a non-existent element, please check the data.");h.setParent(c)}}for(var l,f=s(i);!(l=f()).done;){var p=l.value;exports.VFXItem.isComposition(p)&&this.buildItemTree(p)}}},n.updateVideo=function(){var t,r=e.performance.now();r-this.lastVideoUpdateTime>33&&((null!=(t=this.textures)?t:[]).forEach((function(t){return null==t?void 0:t.uploadCurrentVideoFrame()})),this.lastVideoUpdateTime=r)},n.updateCamera=function(){this.camera.updateMatrix()},n.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(e,t)}))},n.updateRootComposition=function(t){if(this.rootComposition.state!==Ps.Paused&&this.rootComposition.isActiveAndEnabled){var e=parseFloat((this.time+t-this.rootItem.start).toFixed(3)),r=!1,i=this.rootItem.duration,n=this.rootItem.endBehavior;if(e-i>.001)switch(r=!0,n){case wt.restart:e%=i,this.restart();break;case wt.freeze:e=Math.min(i,e);case wt.forward:case wt.destroy:}this.rootComposition.time=e,this.isEnded!==r&&(r?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},n.getItemByName=function(t){return this.rootItem.find(t)},n.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return tn((t-r.z)/i,(e-r.w)/n,this.camera)},n.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},n.hitTest=function(t,e,r,i){if(this.isDestroyed||!this.interactive)return[];var n=[],s=this.getHitTestRay(t,e);return this.refContent.forEach((function(a){var o;null==(o=a.getComponent(No))||o.hitTest(s,t,e,n,r,i)})),n},n.addInteractiveItem=function(t,e){if(e===dt.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},n.removeInteractiveItem=function(t,e){e===dt.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},n.destroyTextures=function(t){for(var e=0;e<t.length;e++){var r,i=t[e];if(i)if(i.sourceType!==exports.TextureSourceType.data||this.texInfo[i.getInstanceId()]){if(this.autoRefTex)--this.texInfo[i.getInstanceId()]||i.dispose()}else i!==(null==(r=this.rendererOptions)?void 0:r.emptyTexture)&&i!==this.renderFrame.transparentTexture&&i!==this.getEngine().emptyTexture&&i.dispose()}},n.destroyItem=function(t){var e=this;t.type==vt.composition?t.endBehavior!==wt.freeze&&t.getComponent(No).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(g(this.items,t),this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)})))},n.lost=function(t){this.videoState=this.textures.map((function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime})),this.textures.map((function(t){return t.dispose()})),this.dispose()},n.dispose=function(){var t,e,r=this;if(!this.destroyed){this.destroyed=!0;var i={},n=this.textures;n&&this.keepResource&&n.forEach((function(t){(null==t?void 0:t.dispose)&&(i[t.id]=t.dispose,t.dispose=X)})),this.rootItem.dispose(),this.renderFrame.dispose(),null==(t=this.rendererOptions)||t.emptyTexture.dispose(),null==(e=this.pluginSystem)||e.destroyComposition(this),this.update=function(){j.error("Update disposed composition: "+r.name+".")},this.dispose=X,n&&this.keepResource&&n.forEach((function(t){return t.dispose=i[t.id]})),this.compositionSourceManager.dispose(),this.renderer.env!==Xn&&this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},n.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},n.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},n.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},n.translate=function(t,e,r){this.rootItem.translate(t,e,r)},n.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},n.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},n.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},n.scale=function(t,e,r){this.rootItem.scale(t,e,r)},n.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},n.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},n.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},n.reloadTexture=function(){var t=this;return i((function(){return h(this,(function(e){switch(e.label){case 0:return t.textureOffloaded?[4,Promise.all(t.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}}))}))()},se(r,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this.compositionSourceManager.textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){return this.rootComposition.startTime}},{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)}}]),r}(ks),vh=new Int32Array(2),yh=new Float32Array(vh.buffer),gh=new Float64Array(vh.buffer),xh=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"}(ah||(ah={}));var bh=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new e.TextDecoder}var r=t.prototype;return r.clear=function(){this.position_=0},r.bytes=function(){return this.bytes_},r.position=function(){return this.position_},r.setPosition=function(t){this.position_=t},r.capacity=function(){return this.bytes_.length},r.readInt8=function(t){return this.readUint8(t)<<24>>24},r.readUint8=function(t){return this.bytes_[t]},r.readInt16=function(t){return this.readUint16(t)<<16>>16},r.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},r.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},r.readUint32=function(t){return this.readInt32(t)>>>0},r.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},r.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},r.readFloat32=function(t){return vh[0]=this.readInt32(t),yh[0]},r.readFloat64=function(t){return vh[xh?0:1]=this.readInt32(t),vh[xh?1:0]=this.readInt32(t+4),gh[0]},r.writeInt8=function(t,e){this.bytes_[t]=e},r.writeUint8=function(t,e){this.bytes_[t]=e},r.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.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},r.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},r.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},r.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},r.writeFloat32=function(t,e){yh[0]=e,this.writeInt32(t,vh[0])},r.writeFloat64=function(t,e){gh[0]=e,this.writeInt32(t,vh[xh?0:1]),this.writeInt32(t+4,vh[xh?1:0])},r.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},r.__offset=function(t,e){var r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0},r.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},r.__string=function(t,e){t+=this.readInt32(t);var r=this.readInt32(t);t+=4;var i=this.bytes_.subarray(t,t+r);return e===ah.UTF8_BYTES?i:this.text_decoder_.decode(i)},r.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},r.__indirect=function(t){return t+this.readInt32(t)},r.__vector=function(t){return t+this.readInt32(t)+4},r.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},r.__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},r.createScalarList=function(t,e){for(var r=[],i=0;i<e;++i){var n=t(i);null!==n&&r.push(n)}return r},r.createObjList=function(t,e){for(var r=[],i=0;i<e;++i){var n=t(i);null!==n&&r.push(n.unpack())}return r},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),Th=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=bh.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,r){e>this.minalign&&(this.minalign=e);for(var i=1+~(this.bb.capacity()-this.space+r)&e-1;this.space<i+e+r;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(i)},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,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,r){(this.force_defaults||e!==r)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,r){e!=r&&(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 r=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var i=2*(r+2);this.addInt16(i);var n=0,s=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(a)){for(var o=2;o<i;o+=2)if(this.bb.readInt16(s+o)!=this.bb.readInt16(a+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,r){var i=r?4:0;if(e){var n=e;if(this.prep(this.minalign,8+i),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var s=3;s>=0;s--)this.writeInt8(n.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&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 r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(e<this.bb.readInt16(i)&&0!=this.bb.readInt16(i+e)))throw new TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(r,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=a(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=[],r=0;r<t.length;++r){var i=t[r];if(null===i)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(i))}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 r=e<<1,i=bh.allocate(r);return i.setPosition(r-e),i.bytes().set(t.bytes(),r-e),i},t}(),Eh=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 _h(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,r,i){return t.startFBEffectsObjectData(e),t.addDataType(e,r),t.addData(e,i),t.endFBEffectsObjectData(e)},t}(),_h=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,r=Eh.createDataVector(t,this.data);return Eh.createFBEffectsObjectData(t,e,r)},t}(),Ah=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 r=this.bb.__offset(this.bb_pos,4);return r?(e||new Eh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 Ch(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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,r){return t.startFBEffectsPackageData(e),t.addExportObjects(e,r),t.endFBEffectsPackageData(e)},t}(),Ch=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=Ah.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return Ah.createFBEffectsPackageData(t,e)},t}(),Sh=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 wh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,r){return e.setPosition(e.position()+4),(r||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,r,i,n){return t.startFBSubMesh(e),t.addOffset(e,r),t.addIndexCount(e,i),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),wh=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.offset=t,this.indexCount=e,this.vertexCount=r}return t.prototype.pack=function(t){return Sh.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),Rh=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 Oh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,r){return e.setPosition(e.position()+4),(r||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,r,i,n,s,a){return t.startFBVertexChannel(e),t.addSemantic(e,r),t.addOffset(e,i),t.addFormat(e,n),t.addDimension(e,s),t.addNormalize(e,a),t.endFBVertexChannel(e)},t}(),Oh=function(){function t(t,e,r,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=r,this.dimension=i,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return Rh.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),Mh=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 r=this.bb.__offset(this.bb_pos,6);return r?(e||new Rh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 Ph(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,r,i){return t.startFBVertexData(e),t.addVertexCount(e,r),t.addChannels(e,i),t.endFBVertexData(e)},t}(),Ph=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=Mh.createChannelsVector(t,t.createObjectOffsetList(this.channels));return Mh.createFBVertexData(t,this.vertexCount,e)},t}(),Ih=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 Mh).__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 r=this.bb.__offset(this.bb_pos,14);return r?(e||new Sh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 r=this.bb.__offset(this.bb_pos,22);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+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 Lh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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 r=e.length-1;r>=0;r--)t.addInt8(e[r]);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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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 r=e.length-1;r>=0;r--)t.addFloat32(e[r]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),Lh=function(){function t(t,e,r,i,n,s,a,o,u,h,c,l){void 0===t&&(t=null),void 0===e&&(e=null),void 0===r&&(r=null),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=[]),void 0===a&&(a=0),void 0===o&&(o=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===c&&(c=null),void 0===l&&(l=[]),this.id=t,this.name=e,this.vertexData=r,this.indexFormat=i,this.indexOffset=n,this.subMeshes=s,this.mode=a,this.buffer=o,this.binaryData=u,this.boneNames=h,this.rootBoneName=c,this.inverseBindMatrices=l}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,r=null!==this.name?t.createString(this.name):0,i=null!==this.vertexData?this.vertexData.pack(t):0,n=Ih.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),s=null!==this.buffer?t.createString(this.buffer):0,a=Ih.createBinaryDataVector(t,this.binaryData),o=Ih.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=Ih.createInverseBindMatricesVector(t,this.inverseBindMatrices);return Ih.startFBGeometryData(t),Ih.addId(t,e),Ih.addName(t,r),Ih.addVertexData(t,i),Ih.addIndexFormat(t,this.indexFormat),Ih.addIndexOffset(t,this.indexOffset),Ih.addSubMeshes(t,n),Ih.addMode(t,this.mode),Ih.addBuffer(t,s),Ih.addBinaryData(t,a),Ih.addBoneNames(t,o),Ih.addRootBoneName(t,u),Ih.addInverseBindMatrices(t,h),Ih.endFBGeometryData(t)},t}(),Fh=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 Th(1),r=new Ch,i=[],n=s(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===Kt.Geometry&&(o=new _h("Geometry",this.geometryDataToBinary(a))),o&&i.push(o)}return r.exportObjects=i,Ah.finishFBEffectsPackageDataBuffer(e,r.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new bh(t),r=Ah.getRootAsFBEffectsPackageData(e),i=0;i<r.exportObjectsLength();i++){var n=r.exportObjects(i);if(n){var s=n.dataArray(),a=n.dataType();if(s){var o=void 0;a===Kt.Geometry&&(o=this.binaryToGeometryData(s)),o&&this.exportObjectDatas.push(o)}}}},e.geometryDataToBinary=function(t){var e=new Th(1),r=new Lh,i=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,u=t.vertexData,h=t.boneNames,c=void 0===h?[]:h,l=t.rootBoneName,f=void 0===l?"":l,p=t.inverseBindMatrices,d=void 0===p?[]:p,m=t.binaryData,v=void 0===m?[]:m;r.indexFormat=i,r.indexOffset=n,r.mode=a,r.id=o,r.boneNames=c,r.rootBoneName=f,r.inverseBindMatrices=d,r.binaryData=v;var y=new Ph;y.vertexCount=u.vertexCount,y.channels=[];for(var g,x=s(u.channels);!(g=x()).done;){var b=g.value,T=b.semantic,E=b.offset,_=b.format,A=b.dimension,C=b.normalize,S=new Oh(T,E,_,A,C);y.channels.push(S)}r.vertexData=y;for(var w,R=[],O=s(t.subMeshes);!(w=O()).done;){var M=w.value,P=M.offset,I=M.indexCount,L=M.vertexCount,F=new wh(P,I,L);R.push(F)}return r.subMeshes=R,Ah.finishFBEffectsPackageDataBuffer(e,r.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new bh(t),r=Ih.getRootAsFBGeometryData(e),i={vertexCount:0,channels:[]},n=r.vertexData();if(n){i.vertexCount=n.vertexCount();for(var s=0;s<n.channelsLength();s++){var a=n.channels(s);if(a){var o,u={semantic:null!=(o=a.semantic())?o:"",offset:a.offset(),format:a.format(),dimension:a.dimension(),normalize:a.normalize()};i.channels.push(u)}}}for(var h=[],c=0;c<r.subMeshesLength();c++){var l=r.subMeshes(c);if(l){var f={offset:l.offset(),vertexCount:l.vertexCount(),indexCount:l.indexCount()};h.push(f)}}for(var p=[],d=0;d<r.boneNamesLength();d++){var m=r.boneNames(d);p.push(m)}var v,y,g,x,b=r.inverseBindMatricesArray();return{vertexData:i,indexFormat:r.indexFormat(),indexOffset:r.indexOffset(),subMeshes:h,mode:r.mode(),buffer:null!=(v=r.buffer())?v:"",boneNames:p,rootBoneName:null!=(y=r.rootBoneName())?y:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(g=r.binaryDataArray())?g:void 0,id:null!=(x=r.id())?x:"",dataType:Kt.Geometry}},t}(),Vh=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 lu(this),this.emptyTexture=lr(this),this.transparentTexture=fr(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.getInstance=function(t){return this.objectInstance[t]},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,r=t.jsonScene,i=t.textureOptions,n=void 0===i?[]:i,a=r.items,o=void 0===a?[]:a,u=r.materials,h=void 0===u?[]:u,c=r.shaders,l=void 0===c?[]:c,f=r.geometries,p=void 0===f?[]:f,d=r.components,m=void 0===d?[]:d,v=r.animations,y=void 0===v?[]:v,g=r.bins,x=void 0===g?[]:g,b=r.miscs,T=void 0===b?[]:b,E=s(o);!(e=E()).done;){var _=e.value;this.addEffectsObjectData(_)}for(var A,C=s(h);!(A=C()).done;){var S=A.value;this.addEffectsObjectData(S)}for(var w,R=s(l);!(w=R()).done;){var O=w.value;this.addEffectsObjectData(O)}for(var M,P=s(p);!(M=P()).done;){var I=M.value;this.addEffectsObjectData(I)}for(var L,F=s(m);!(L=F()).done;){var V=L.value;this.addEffectsObjectData(V)}for(var D,N=s(y);!(D=N()).done;){var k=D.value;this.addEffectsObjectData(k)}for(var z,U=s(T);!(z=U()).done;){var B=z.value;this.addEffectsObjectData(B)}for(var G=0;G<x.length;G++){var j=x[G],X=t.bins[G];if(j.dataType===Kt.BinaryAsset)j.buffer=X,j.id&&this.addEffectsObjectData(j);else{var H=new Fh;H.deserializeFromBinary(new Uint8Array(X));for(var W,Y=s(H.exportObjectDatas);!(W=Y()).done;){var Z=W.value;this.addEffectsObjectData(Z)}}}for(var q,K=s(n);!(q=K()).done;){var Q=q.value;this.addEffectsObjectData(Q)}},e.createVFXItems=function(t){var e=this;return i((function(){var r,i,n,a,o;return h(this,(function(u){switch(u.label){case 0:r=t.jsonScene,i=s(r.items),u.label=1;case 1:return(n=i()).done?[3,4]:(a=n.value,"ECS"!==(o=a.type)&&"camera"!==o&&o!==vt.sprite&&o!==vt.particle&&o!==vt.mesh&&o!==vt.skybox&&o!==vt.light&&o!==vt.tree&&o!==vt.interact&&o!==vt.camera?[3,3]:e.database?[4,e.assetLoader.loadGUIDAsync(a.id)]:[3,3]);case 2:u.sent(),u.label=3;case 3:return[3,1];case 4:return[2]}}))}))()},e.addTexture=function(t){this.destroyed||y(this.textures,t)},e.removeTexture=function(t){this.destroyed||g(this.textures,t)},e.addMaterial=function(t){this.destroyed||y(this.materials,t)},e.removeMaterial=function(t){this.destroyed||g(this.materials,t)},e.addGeometry=function(t){this.destroyed||y(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||g(this.geometries,t)},e.addMesh=function(t){this.destroyed||y(this.meshes,t)},e.removeMesh=function(t){this.destroyed||g(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||y(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||g(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&&j.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}},se(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Dh=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var r=t.prototype;return r.getFPS=function(){return this.targetFPS},r.setFPS=function(t){this.targetFPS=Ee(t,1,120),this.interval=Math.floor(1e3/t)-2},r.getPaused=function(){return this.paused},r.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=e.performance.now();var r=e.requestAnimationFrame||function(t){return e.window.setTimeout(t,16.7)},i=function(){t.intervalId=r(i),t.paused||t.tick()};i()}},r.stop=function(){(e.cancelAnimationFrame||e.window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},r.pause=function(){this.paused=!0,this.dt=0},r.resume=function(){this.paused=!1,this.dt=0},r.tick=function(){if(!this.paused){var t=e.performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter((function(t){return t})),this.resetTickers=!1);for(var r=0,i=this.tickers.length;r<i;r++){var n=this.tickers[r];n(this.dt)}}}},r.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},se(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();nt("camera",bs,exports.VFXItem),nt("text",hu,exports.VFXItem),nt("sprite",Ls,exports.VFXItem),nt("particle",Wo,exports.VFXItem),nt("cal",Yo,exports.VFXItem),nt("interact",ws,exports.VFXItem);var Nh;j.info("Core version: 2.3.7.");var kh,zh=((Nh={})[rr.RGBA]=34842,Nh[rr.RGB]=34843,Nh[rr.ALPHA]=33325,Nh[rr.RED]=33325,Nh[rr.LUMINANCE_ALPHA]=33327,Nh[rr.LUMINANCE]=33325,Nh),Uh=((kh={})[rr.RGBA]=34836,kh[rr.RGB]=34837,kh[rr.ALPHA]=33326,kh[rr.RED]=33326,kh[rr.LUMINANCE_ALPHA]=33328,kh[rr.LUMINANCE]=33326,kh),Bh=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).initialized=!1,r&&i.fromData(r),i}_t(e,t);var r=e.prototype;return r.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},r.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,r=this.source,i=r.target,n=void 0===i?e.TEXTURE_2D:i,s=r.name;this.textureBuffer=e.createTexture(),Wh(this.textureBuffer,s),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},r.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},r.release=function(){switch(this.source.sourceType){case exports.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case exports.TextureSourceType.data:delete this.source.data;break;case exports.TextureSourceType.compressed:case exports.TextureSourceType.mipmaps:delete this.source.mipmaps}},r.update=function(t){var e=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var r,i,n=this.target,s=this.source,a=this.pipelineContext.gl,o=this.engine.gpuCapability.detail,u=s.sourceType,h=s.data,c=s.cube,l=s.image,f=s.video,p=s.mipmaps,d=s.mipmaps,m=t.data,v=t.cube,y=t.generateMipmap,g=t.mipmaps,x=s.format,b=s.type,T=s.internalFormat,E=0,_=0;if(this.bind(u===exports.TextureSourceType.video),b===rr.HALF_FLOAT?((b=o.halfFloatTexture)||j.error("Half float texture is not support."),nr(a)&&T===x&&(x===rr.LUMINANCE&&(x=rr.RED),T=zh[x]),o.halfFloatLinear||(s.minFilter=s.magFilter=a.NEAREST,j.warn("Half float linear not support, change to NEAREST."))):b===a.FLOAT&&((b=o.floatTexture)||j.error("Float texture is not support."),nr(a)&&T===x&&(x===rr.LUMINANCE&&(x=rr.RED),T=Uh[x]),o.floatLinear||(s.minFilter=a.NEAREST,s.magFilter=a.NEAREST,j.warn("Float linear not support, change to NEAREST."))),void 0===s.premultiplyAlpha&&(s.premultiplyAlpha=!1),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),void 0===s.flipY&&(s.flipY=!1),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,s.flipY),u===exports.TextureSourceType.framebuffer)m&&(E=null!=(r=m.width)?r:0,_=null!=(i=m.height)?i:0,E&&_&&(this.width!==E||this.height!==_)&&a.texImage2D(n,0,T,E,_,0,x,b,null));else if(u===exports.TextureSourceType.data){var A;if(n===a.TEXTURE_CUBE_MAP)v.forEach((function(t,r){var i=e.texImage2DData(a,a.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,T,x,b,t),n=i[0],s=i[1];E=Math.max(n,E),_=Math.max(s,_)}));else A=this.texImage2DData(a,n,0,T,x,b,h),E=A[0],_=A[1]}else if(u===exports.TextureSourceType.image||u===exports.TextureSourceType.video){if(n===a.TEXTURE_CUBE_MAP)c.forEach((function(t,r){var i=e.texImage2D(a,a.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,T,x,b,t),n=i[0],s=i[1];E=Math.max(n,E),_=Math.max(s,_)}));else if(n===a.TEXTURE_2D){var C,S=null!=l?l:f;C=this.texImage2D(a,n,0,T,x,b,S),E=C[0],_=C[1]}y&&(Gh(E)&&Gh(_)||nr(a))&&a.generateMipmap(n)}else if(u===exports.TextureSourceType.mipmaps){var w;n===a.TEXTURE_2D?p.forEach((function(t,r){var i;(w="data"in t?e.texImage2DData(a,n,r,T,x,b,t):e.texImage2D(a,n,r,T,x,b,t),0===r)&&(E=(i=w)[0],_=i[1])})):n===a.TEXTURE_CUBE_MAP&&d.forEach((function(t,r){t.forEach((function(t,i){var n;(w="data"in t?e.texImage2DData(a,a.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,T,x,b,t):e.texImage2D(a,a.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,T,x,b,t),0===r)&&(E=(n=w)[0],_=n[1])}))}))}else u===exports.TextureSourceType.compressed&&g&&0!==g.length&&(E=g[0].width,_=g[0].height,g.forEach((function(t,e){a.compressedTexImage2D(n,e,T,t.width,t.height,0,t.data)})));this.width=E,this.height=_,this.setTextureFilters(a,n,s)},r.setTextureFilters=function(t,e,r){var i=r.anisotropic,n=void 0===i?4:i,s=r.wrapS,a=void 0===s?t.CLAMP_TO_EDGE:s,o=r.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 c=nr(t)||Gh(this.width)&&Gh(this.height),l=r.magFilter?r.magFilter:t.NEAREST,f=r.minFilter?r.minFilter:t.NEAREST;c||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,l),t.texParameteri(e,t.TEXTURE_WRAP_S,c?a:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,c?u:t.CLAMP_TO_EDGE)},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e,i=this.assembleOptions(r),n=i.sourceType,s=i.sourceFrom,a=i.name,o=void 0===a?"":a;this.source=i,this.sourceType=n,this.sourceFrom=s,this.name=o,this.guid=e.id},r.texImage2D=function(t,e,r,i,n,s,a){var o,u=this,h=this.source,c=h.sourceType,l=h.minFilter,f=h.magFilter,p=h.wrapS,d=h.wrapT,m=null!=(o=this.engine.gpuCapability.detail.maxTextureSize)?o:2048,v=a;if(c!==exports.TextureSourceType.video){var y=l!==t.NEAREST||f!==t.NEAREST||p!==t.CLAMP_TO_EDGE||d!==t.CLAMP_TO_EDGE;(y=y||a.width>m||a.height>m)&&setTimeout((function(){v=u.resizeImage(a)}))}t.texImage2D(e,r,i,n,s,v);var g=[v.width,v.height];return c===exports.TextureSourceType.video?[a.videoWidth,a.videoHeight]:g},r.texImage2DData=function(t,e,r,i,n,s,a){var o=a.data,u=a.width,h=a.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/o.BYTES_PER_ELEMENT):o;return t.texImage2D(e,r,i,u,h,0,n,s,c),[u,h]},r.resizeImage=function(t,e,r){var i,n=null!=(i=this.engine.gpuCapability.detail.maxTextureSize)?i:2048;if(nr(this.pipelineContext.gl)&&t.width<n&&t.height<n)return t;var s=function(t,e,r,i){var n=t.width,s=t.height,a=Math.min(e,r||$i(n)),o=Math.min(e,i||$i(s));if(o!==s||a!==n){var u=su.getCanvas(),h=u.getContext("2d");return u.width=a,u.height=o,null==h||h.drawImage(t,0,0,n,s,0,0,a,o),j.warn("Image resize from "+n+"x"+s+" to "+a+"x"+o+"."),u}}(t,n,e,r);return s||t},r.reloadData=function(){var t=this;return i((function(){return h(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,xr().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},r.offloadData=function(){if(this.initialized&&xr().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var r=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);else if(t===e.TEXTURE_CUBE_MAP)for(var i=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<i.length;n++)e.texImage2D(i[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},r.uploadCurrentVideoFrame=function(){var t=this;return i((function(){return h(this,(function(e){return t.source.sourceType===exports.TextureSourceType.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]}))}))()},r.updateSource=function(t){this.source=this.assembleOptions(Ie({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},r.restore=function(){},r.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(){j.error("This texture has been destroyed.")},this.initialize=Q,void 0!==this.engine&&this.engine.removeTexture(this)},e}(ur);function Gh(t){return 0==(t&t-1)&&0!==t}var jh=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 nr(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),Wh(e,t),e},e.bindVertexArray=function(t){var e;nr(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;nr(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),Xh=1,Hh=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])},r=t.getGLPipelineContext(),i=r.gl;this.gl=i,this.pipelineContext=r,this.emptyTexture2D=new Bh(t,{data:e,sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new Bh(t,{target:i.TEXTURE_CUBE_MAP,cube:[e,e,e,e,e,e],sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+Xh,Xh++}var e=t.prototype;return e.copy2=function(t,e){var r=this.gl;if(r){this.sourceFbo||(this.sourceFbo=r.createFramebuffer()),this.targetFbo||(this.targetFbo=r.createFramebuffer());var i=this.pipelineContext;i.bindFramebuffer(r.FRAMEBUFFER,this.sourceFbo),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t.textureBuffer,0),i.bindFramebuffer(r.FRAMEBUFFER,this.targetFbo),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e.textureBuffer,0),i.bindFramebuffer(r.READ_FRAMEBUFFER,this.sourceFbo),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?r.NEAREST:r.LINEAR;r.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),r.COLOR_BUFFER_BIT,n),i.bindFramebuffer(r.FRAMEBUFFER,null),i.bindFramebuffer(r.READ_FRAMEBUFFER,null),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}},e.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&y(this.renderbuffers,t),e},e.resize=function(t,e){var r=this.gl;(r&&r.drawingBufferWidth!==t||r.drawingBufferHeight!==e)&&(r.canvas.width=t,r.canvas.height=e,r.viewport(0,0,t,e),this.framebuffers.forEach((function(r){var i=r.viewport;r.isCustomViewport||r.resize(i[0],i[1],t*r.viewportScale,e*r.viewportScale)})))},e.drawGeometry=function(t,e,r){if(this.gl){var i=t,n=e.shaderVariant.program;if(n){var s=n.setupAttributes(i),a=this.gl,o=i.indicesBuffer,u=i.drawStart,h=i.drawCount,c=i.mode,l=i.subMeshes;if(l&&l.length){var f,p=l[r];if(h<0)return;if(u=p.offset,o)h=null!=(f=p.indexCount)?f:0;else h=p.vertexCount}o?a.drawElements(c,h,o.type,null!=u?u:0):a.drawArrays(c,u,h),null==s||s.unbind()}}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")},e.createGLFramebuffer=function(t,e){var r=this.gl.createFramebuffer();if(!r)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return y(this.framebuffers,t),Wh(r,e,e),r},e.createVAO=function(t){return new jh(this.engine,t)},e.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),g(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),g(this.framebuffers,t),delete t.fbo)},e.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),g(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){j.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},se(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 Wh(t,e,r){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,r&&(t.__SPECTOR_Object_TAG.id=r)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var Yh,Zh,qh=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var r=e.name,i=e.data,n=e.elementCount,s=e.target,a=void 0===s?rr.ARRAY_BUFFER:s,o=e.type,u=void 0===o?rr.FLOAT:o,h=e.usage,c=void 0===h?rr.STATIC_DRAW:h,l=function(t){var e,r;return null!=(r=null==(e=Kh[t])?void 0:e.BYTES_PER_ELEMENT)?r:0}(u);this.target=a,this.type=u,this.usage=c,this.glBuffer=this.createGLBuffer(r),this.bytesPerElement=l,i?this.bufferData(i):n&&this.bufferData(l*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return Wh(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 r=this.pipelineContext.gl,i=this.target;r.bindBuffer(i,this.glBuffer),0===e?r.bufferData(i,1,this.usage):(r.bufferData(i,e,this.usage),"number"!=typeof t&&r.bufferSubData(i,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var r=this.pipelineContext.gl,i=this.target,n=t*this.bytesPerElement,s=n+e.byteLength;r.bindBuffer(i,this.glBuffer),s>this.byteLength&&(this.byteLength=s,r.bufferData(i,s,this.usage)),r.bufferSubData(i,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!!nr(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},se(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Kh=((Yh={})[rr.INT]=Int32Array,Yh[rr.FLOAT]=Float32Array,Yh[rr.SHORT]=Int16Array,Yh[rr.BYTE]=Int8Array,Yh[rr.UNSIGNED_BYTE]=Uint8Array,Yh[rr.UNSIGNED_INT]=Uint32Array,Yh[rr.UNSIGNED_SHORT]=Uint16Array,Yh);var Qh=((Zh={})[Uint8Array.BYTES_PER_ELEMENT]=rr.UNSIGNED_BYTE,Zh[Uint16Array.BYTES_PER_ELEMENT]=rr.UNSIGNED_SHORT,Zh[Uint32Array.BYTES_PER_ELEMENT]=rr.UNSIGNED_INT,Zh),Jh=1,$h=function(t){function r(e,r){var i;return(i=t.call(this,e)||this).drawCount=0,i.buffers={},i.vaos={},i.skin={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,r&&i.processProps(r),i}_t(r,t);var i=r.prototype;return i.getOptions=function(){return Ie({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;N(e),e.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new qh(r,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(r,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 r=this.getAttributeBufferOption(t),i=this.attributes[t].dataSource;if(r){var n=r.usage,s=r.target;this.bufferProps[i]={data:e,usage:n,target:s,elementCount:e.length},this.dirtyFlags[i].discard=!0,this.dirtyFlags[i].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,r){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t);if(i&&null!=i.data){var n=e,s=e+r.length;if(i.data.length<s){var a=new r.constructor(s);a.set(i.data),i.data=a,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,s-1))}i.data.set(r,n),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(a(t,Uint8Array)||a(t,Uint16Array)||a(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var r,i=t,n=t+e.length;if(this.indices.length<n){var s=new e.constructor(n);s.set(this.indices),this.indices=s,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var a=this.dirtyFlags.index;void 0!==a.start&&(a.start=Math.min(a.start,i)),void 0!==a.end&&(a.end=Math.max(a.end,n-1))}null==(r=this.indices)||r.set(e,i),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],r=e.stride,i=e.size,n=e.type;return r||i*Gr[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 r=Qh[e.BYTES_PER_ELEMENT],i={data:e,target:rr.ELEMENT_ARRAY_BUFFER,type:r,name:this.name+"##index"};return new qh(t,i)},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,r=this.bufferProps,i=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var s,a,o=t.dirtyFlags[n];if("index"==n)s=t.indicesBuffer,a=i;else{var u=e[n].dataSource;s=t.buffers[u],a=r[u].data}if((o.dirty||o.discard)&&s&&a){if(o.discard)s.bufferData(a);else if(void 0!==o.start&&void 0!==o.end){var h=o.start*a.BYTES_PER_ELEMENT+a.byteOffset,c=o.end-o.start+1,l=new a.constructor(a.buffer,h,c);s.bufferSubData(o.start,l)}o.start=Number.POSITIVE_INFINITY,o.end=0,o.dirty=o.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(i){var n=t.attributesReleasable[i],s=e[i].dataSource;r[s]&&n&&(r[s].data=void 0)})),this.indicesReleasable}},i.processProps=function(t){var e=t,r=e.drawStart,i=void 0===r?0:r,n=e.drawCount,s=e.mode,o=e.indices,u=e.name,h=void 0===u?"effectsGeometry:"+Jh++:u,c=e.bufferUsage,l=void 0===c?rr.STATIC_DRAW:c;this.name=h;var f={},p=[],d={},m={},v={},y=l;this.drawStart=i,void 0!==n&&(this.drawCount=n),this.mode=isNaN(s)?rr.TRIANGLES:s,Object.keys(e.attributes).forEach((function(t){var r=e.attributes[t],i=r.size,n=r.stride,s=r.offset,o=r.normalize,u=r.type,h=void 0===u?rr.FLOAT:u,c=r.releasable,l=r.data;if(!h||"dataSource"in r||l||(l=Xr(h)),l){var g=a(l,Float32Array)?rr.FLOAT:rr.INT;f[t]={data:l,usage:y,target:rr.ARRAY_BUFFER,name:t},d[t]={size:i,stride:n,offset:s,type:null!=h?h:g,normalize:!!o,dataSource:t},v[t]=null!=c&&c,m[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=r.dataSource;x&&(d[t]={size:i,stride:n,offset:s,type:h,dataSource:x,normalize:!!o})}p.push(t)})),m.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==o?void 0:o.data,this.indicesReleasable=!0===(null==o?void 0:o.releasable),this.bufferProps=f,this.attributes=d,this.attributesName=p,this.attributesReleasable=v,this.dirtyFlags=m,this.options=e,this.initialized=!1},i.fromData=function(r){var i,n=this;if(t.prototype.fromData.call(this,r),this.subMeshes=r.subMeshes,r.buffer?i=new Uint8Array(function(t){for(var r=e.atob(t),i=new Uint8Array(r.length),n=0;n<r.length;n++)i[n]=r.charCodeAt(n);var s=i.buffer;return s}(r.buffer)):r.binaryData&&(i=r.binaryData),i){var s=r.vertexData.vertexCount;if(this.hasSemantic(r)){var a={mode:rr.TRIANGLES,attributes:{}};if(r.vertexData.channels.forEach((function(t){var e,r=null!=(e=tc[t.semantic])?e:t.semantic,o=n.createVertexTypedArray(t,i,s);a.attributes[r]={type:ar(t.format),size:t.dimension,data:o,normalize:t.normalize}})),r.indexFormat!==$t.None){var o=this.createIndexTypedArray(r.indexFormat,i,r.indexOffset);a.indices={data:o},a.drawCount=o.length}else a.drawCount=s;this.processProps(a)}else{var u=r.vertexData.channels[0],h=r.vertexData.channels[1],c=r.vertexData.channels[2],l=this.createVertexTypedArray(u,i,s),f=this.createVertexTypedArray(h,i,s),p=this.createVertexTypedArray(c,i,s),d=this.createIndexTypedArray(r.indexFormat,i,r.indexOffset),m={mode:rr.TRIANGLES,attributes:{aPos:{type:ar(u.format),size:3,data:l,normalize:u.normalize},aUV:{type:ar(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:ar(c.format),size:3,data:p,normalize:c.normalize}}};m.indices={data:d},m.drawCount=d.length,this.processProps(m)}this.skin={boneNames:r.boneNames,rootBoneName:r.rootBoneName,inverseBindMatrices:r.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 r;null==(r=e.vaos[t])||r.dispose(),e.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0));this.destroyed=!0},i.createVertexTypedArray=function(t,e,r){var i=e.buffer;switch(t.format){case Jt.Float32:return new Float32Array(i,e.byteOffset+t.offset,t.dimension*r);case Jt.Int16:return new Int16Array(i,e.byteOffset+t.offset,t.dimension*r);case Jt.Int8:return new Int8Array(i,e.byteOffset+t.offset,t.dimension*r);case Jt.UInt16:return new Uint16Array(i,e.byteOffset+t.offset,t.dimension*r);case Jt.UInt8:return new Uint8Array(i,e.byteOffset+t.offset,t.dimension*r);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(i,e.byteOffset+t.offset,t.dimension*r)}},i.createIndexTypedArray=function(t,e,r){var i=e.buffer;switch(t){case $t.UInt16:return new Uint16Array(i,e.byteOffset+r);case $t.UInt32:return new Uint32Array(i,e.byteOffset+r);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(i,e.byteOffset+r)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},se(r,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),r}(jr),tc={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 ec,rc,ic=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.blendColor[0]===e&&this.blendColor[1]===r&&this.blendColor[2]===i&&this.blendColor[3]===n||(this.blendColor[0]=e,this.blendColor[1]=r,this.blendColor[2]=i,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.blendFunctionParameters[0]===e&&this.blendFunctionParameters[1]===r&&this.blendFunctionParameters[2]===i&&this.blendFunctionParameters[3]===n||(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=r,this.blendFunctionParameters[2]=i,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],r=t[1];this.blendEquationParameters[0]===e&&this.blendEquationParameters[1]===r||(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=r)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.colorMask[0]===e&&this.colorMask[1]===r&&this.colorMask[2]===i&&this.colorMask[3]===n||(this.colorMask[0]=e,this.colorMask[1]=r,this.colorMask[2]=i,this.colorMask[3]=n)},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[rr.ONE,rr.ONE_MINUS_SRC_ALPHA,rr.ONE,rr.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[rr.FUNC_ADD,rr.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=rr.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[rr.ALWAYS,rr.ALWAYS],this.stencilOpFail=[rr.KEEP,rr.KEEP],this.stencilOpZFail=[rr.KEEP,rr.KEEP],this.stencilOpZPass=[rr.KEEP,rr.KEEP],this.culling=!1,this.frontFace=rr.CCW,this.cullFace=rr.FRONT},e.apply=function(t){if(t.toggle(rr.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(rr.BLEND,this.blending),t.toggle(rr.DEPTH_TEST,this.depthTest),t.toggle(rr.STENCIL_TEST,this.stencilTest),t.toggle(rr.CULL_FACE,this.culling),t.toggle(rr.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(rr.BACK,this.stencilMask[1]),t.stencilMaskSeparate(rr.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(rr.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(rr.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(rr.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(rr.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,r=e.blendColor,i=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(r[0],r[1],r[2],r[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(n[0],n[1],n[2],n[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),nc=Ce,sc=Pe,ac=function(t){function e(e,r){var i;return(i=t.call(this,e,r)||this).floats={},i.ints={},i.vector2s={},i.vector3s={},i.vector4s={},i.colors={},i.quaternions={},i.matrices={},i.matrice3s={},i.textures={},i.floatArrays={},i.vector4Arrays={},i.matrixArrays={},i.samplers=[],i.uniforms=[],i.uniformDirty=!0,i.macrosDirty=!0,i.glMaterialState=new ic,r&&(i.shader=new exports.Shader(e),i.shader.shaderData=Ie({},r.shader,{id:J(),dataType:Kt.Shader})),i}_t(e,t);var r=e.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.createMaterialStates=function(t){this.sampleAlphaToCoverage=!!t.sampleAlphaToCoverage,this.depthTest=t.depthTest,this.depthMask=t.depthMask,this.depthRange=t.depthRange,this.depthFunc=t.depthFunc,this.colorMask=t.colorMask,this.polygonOffset=t.polygonOffset,this.polygonOffsetFill=t.polygonOffsetFill,this.blending=t.blending,this.blendFunction=t.blendFunction,this.stencilTest=t.stencilTest},r.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach((function(e){var r=t.textures[e];Y(r.initialize)?r.initialize():j.error("Failed to initialize texture: "+JSON.stringify(r)+". Ensure the texture conforms to the expected format.")})),this.initialized=!0)},r.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},r.setupStates=function(t){this.glMaterialState.apply(t)},r.use=function(t,e){var r=t.engine.getGLPipelineContext(),i=this.shaderVariant;if(i.program){var n;if(i.program.bind(),this.setupStates(r),e){for(var a,o=s(e.uniforms);!(a=o()).done;)n=a.value,this.checkUniform(n);for(var u,h=s(e.samplers);!(u=h()).done;)n=u.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(i.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)i.setFloat(n,e.floats[n]);for(n in e.ints)i.setInt(n,e.ints[n]);for(n in e.vector4s)i.setVector4(n,e.vector4s[n]);for(n in e.vector3s)i.setVector3(n,e.vector3s[n]);for(n in e.matrices)i.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].textureBuffer||this.textures[n].initialize();for(n in this.floats)i.setFloat(n,this.floats[n]);for(n in this.ints)i.setInt(n,this.ints[n]);for(n in this.floatArrays)i.setFloats(n,this.floatArrays[n]);for(n in this.textures)i.setTexture(n,this.textures[n]);for(n in this.vector2s)i.setVector2(n,this.vector2s[n]);for(n in this.vector3s)i.setVector3(n,this.vector3s[n]);for(n in this.vector4s)i.setVector4(n,this.vector4s[n]);for(n in this.colors)i.setColor(n,this.colors[n]);for(n in this.quaternions)i.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)i.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)i.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)i.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)i.setMatrixArray(n,this.matrixArrays[n])}else{var c;null==(c=this.engine)||c.renderErrors.add(new Error("Shader program is not initialized."))}},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var r,i=s(e);!(r=i()).done;){var n=r.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var r,i=s(e);!(r=i()).done;)for(var n=r.value,a=0;a<16;a++)this.matrixArrays[t].push(n.elements[a])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var r=t||this.props,i=this.engine;N(i);var n=new e(i,r);return n.glMaterialState=Object.assign(new ic,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},r.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var r=Ie({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===xt.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var i,n,s=e.stringTags.RenderFace;for(i in s===bt.Front?(this.culling=!0,this.cullFace=rr.BACK):s===bt.Back?(this.culling=!0,this.cullFace=rr.FRONT):this.culling=!1,r.floats)this.setFloat(i,r.floats[i]);for(i in r.ints)this.setInt(i,r.ints[i]);for(i in r.vector4s){var a=r.vector4s[i];this.setVector4(i,new Ce(a.x,a.y,a.z,a.w))}for(i in r.colors){var o=r.colors[i];this.setColor(i,new Zr(o.r,o.g,o.b,o.a))}for(i in r.textures){var u=r.textures[i];this.setTexture(i,u.texture);var h=u.offset,c=u.scale;h&&c&&this.setVector4(i+"_ST",new nc(c.x,c.y,h.x,h.y))}e.shader&&(this.shader=e.shader,this.shaderSource=this.shader.shaderData),this.stringTags=null!=(n=e.stringTags)?n:{},this.initialized=!1},r.toData=function(){var t=this.taggedProperties;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=Kt.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var r in this.ints)t.ints[r]=this.ints[r];for(var i in this.vector4s)t.vector4s[i]=this.vector4s[i];for(var n in this.colors)t.colors[n]=this.colors[n];for(var s in this.textures){t.textures[s]||(t.textures[s]={texture:this.textures[s]});var a=t.textures[s],o=this.getVector4(s+"_ST");o&&(a.scale={x:o.x,y:o.y},a.offset={x:o.z,y:o.w},delete t.vector4s[s+"_ST"])}return t},r.cloneUniforms=function(t){var e,r=t;for(e in r.floats)this.setFloat(e,r.floats[e]);for(e in r.ints)this.setInt(e,r.ints[e]);for(e in r.floatArrays)this.setFloats(e,r.floatArrays[e]);for(e in r.textures)this.setTexture(e,r.textures[e]);for(e in r.vector2s)this.setVector2(e,r.vector2s[e]);for(e in r.vector3s)this.setVector3(e,r.vector3s[e]);for(e in r.vector4s)this.setVector4(e,r.vector4s[e]);for(e in r.colors)this.setColor(e,r.colors[e]);for(e in r.quaternions)this.setQuaternion(e,r.quaternions[e]);for(e in r.matrices)this.setMatrix(e,r.matrices[e]);for(e in r.vector4Arrays){for(var i=[],n=0;n<r.vector4Arrays[e].length;n+=4)i.push(new nc(r.vector4Arrays[e][n],r.vector4Arrays[e][n+1],r.vector4Arrays[e][n+2],r.vector4Arrays[e][n+3]));this.setVector4Array(e,i)}for(e in r.matrixArrays){for(var s=[],a=0;a<r.matrixArrays[e].length;a+=16){for(var o=sc.fromIdentity(),u=0;u<16;u++)o.elements[u]=r.matrixArrays[e][a+u];s.push(o)}this.setMatrixArray(e,s)}},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},r.dispose=function(t){var e,r=this;this.destroyed||(null==(e=this.shaderVariant)||e.dispose(),(null==t?void 0:t.textures)!==exports.DestroyOptions.keep&&Object.keys(this.textures).forEach((function(t){var e=r.textures[t];e!==r.engine.emptyTexture&&e.dispose()})),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=Q,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},se(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},set:function(t){t&&this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Nr),oc=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:exports.TextureSourceType.framebuffer,data:{width:e.getWidth()||t.getWidth(),height:e.getHeight()||t.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(t,e):this.copy1(t,e))},e.copy2=function(t,e){var r=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(r)},e.copy1=function(t,e){var r=this.copyRenderPass;if(r){var i=this.renderer;if(i){var n=r.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),i.glRenderer.resetColorAttachments(n,[e]),r.meshes[0].material.setTexture("uTex",t),i.renderRenderPass(r)}}},e.createCopyRenderPass=function(){var t="mri-copy-mesh",e={texture:{format:rr.RGBA}},r=this.renderer.engine,i=new $h(r,{name:t,mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=r.gpuCapability.level,s=new ac(r,{name:t,shader:{cacheId:"$mri-internal-copy",name:t,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===n?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1}});s.blending=!1,s.depthTest=!1,s.culling=!1;var a=new ei(r,{name:t,geometry:i,material:s,priority:0});return new uc(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:exports.TextureLoadAction.whatever},attachments:[e],meshes:[a]})},e.dispose=function(){var t;this.renderer&&(null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0)},t}(),uc=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},r.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(ai),hc=function(){function t(t,e,r){var i=this;void 0===e&&(e="webgl"),void 0===r&&(r={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],N(t),this.gl=$e(t,e,r),this.contextLostListener=function(t){for(var e,r,n=s(i.lostHandlers);!(r=n()).done;){r.value.lost(t)}null==(e=i.canvas)||e.removeEventListener("webglcontextlost",i.contextLostListener)},this.contextRestoredListener=function(t){for(var e,r,n=s(i.restoreHandlers);!(r=n()).done;){r.value.restore()}null==(e=i.canvas)||e.addEventListener("webglcontextlost",i.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}(),cc=function(t){function e(e){var r;return(r=t.call(this)||this).gpuCapability=new Di(e),r}_t(e,t);var r=e.prototype;return r.dispose=function(){this.isDestroyed||t.prototype.dispose.call(this)},r.getGLRenderer=function(){return this.renderer},r.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},r.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(Vh),lc=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).initialized=!1,void 0!==r&&i.initialize(r),i}_t(e,t);var r=e.prototype;return r.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},r.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var r=this.renderer,i=r.gl;r.pipelineContext.bindRenderbuffer(i.RENDERBUFFER,this.buffer),t&&e?i.renderbufferStorage(i.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):j.error("Invalid render buffer size: "+t+"x"+e+".")}}else j.error("Can't set size for uninitialized render buffer.")},r.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=Q},e}(Fi),fc=1,pc=function(t){function e(e,r){var i;(i=t.call(this)||this).attachmentTextures=[];var n,s=e.depthStencilAttachment,a=e.viewport,o=e.isCustomViewport,u=e.storeAction,h=e.viewportScale,c=void 0===h?1:h,l=e.name,f=void 0===l?"GLFramebuffer"+fc++:l;return i.renderer=r,i.engine=r.engine,i.depthStencilStorageType=null!=(n=null==s?void 0:s.storageType)?n:exports.RenderPassAttachmentStorageType.none,i.viewport=a,i.isCustomViewport=!!o,i.viewportScale=c,i.name=f,i.storeAction=u,i.updateProps(e),i}_t(e,t);var r=e.prototype;return r.getDepthTexture=function(){return this.depthTexture},r.getStencilTexture=function(){return this.stencilTexture},r.getColorTextures=function(){return this.colorTextures},r.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(e){e.initialize(),y(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&y(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&y(this.attachmentTextures,this.depthTexture.textureBuffer)},r.updateProps=function(t){var e,r,i=this.renderer,n=this.engine.gpuCapability,s=null!=(r=t.depthStencilAttachment)?r:{storageType:exports.RenderPassAttachmentStorageType.none},o=t.attachments.length>0,u=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var h=null==(e=t.depthStencilAttachment)?void 0:e.texture,c=n.detail.readableDepthStencilTextures,l=s.storageType,f=s.storage;if(this.colorTextures=t.attachments.slice(),!o&&l!==exports.RenderPassAttachmentStorageType.none)throw new Error("Use depth stencil attachment without color attachments.");switch(o&&(this.fbo=i.glRenderer.createGLFramebuffer(this,this.name)),l){case exports.RenderPassAttachmentStorageType.depth_stencil_opaque:if(f){if(!a(f,lc))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new lc({format:rr.DEPTH_STENCIL,attachment:rr.DEPTH_STENCIL_ATTACHMENT,storageType:l},i.glRenderer);u=!1;break;case exports.RenderPassAttachmentStorageType.depth_16_opaque:if(f){if(!a(f,lc))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new lc({attachment:rr.DEPTH_ATTACHMENT,format:rr.DEPTH_COMPONENT16,storageType:l},i.glRenderer);break;case exports.RenderPassAttachmentStorageType.stencil_8_opaque:if(f){if(!a(f,lc))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new lc({attachment:rr.STENCIL_ATTACHMENT,format:rr.STENCIL_INDEX8,storageType:l},i.glRenderer);break;case exports.RenderPassAttachmentStorageType.depth_16_texture:if(!c)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=h?h:new Bh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:rr.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:rr.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!c)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=h?h:new Bh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:rr.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},r.getStoreAttachments=function(t,e){var r=this.renderer.glRenderer.gl,i=this.colorTextures.length;if(t&&nr(r)&&i>0){var n=[];if(t.depthAction===exports.TextureStoreAction.clear&&this.depthStorage&&y(n,e?r.DEPTH_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===exports.TextureStoreAction.clear&&this.stencilStorage&&y(n,e?r.STENCIL_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),t.colorAction===exports.TextureStoreAction.clear)for(var s=0;s<i;s++)y(n,r["COLOR_ATTACHMENT"+s]);return n}},r.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;nr(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},r.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,r=this.renderer.pipelineContext,i=this.viewport,n=i[0],s=i[1],a=i[2],o=i[3];r.bindFramebuffer(e.FRAMEBUFFER,this.fbo),r.viewport(n,s,a,o);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(r.textureUnitDict).forEach((function(e){var i=r.textureUnitDict[e];i&&i!==u&&t.attachmentTextures.includes(i)&&(r.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)r.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var c=this,l=c.depthStencilRenderbuffer,f=c.depthTexture,p=c.stencilTexture;if(r.activeTexture(e.TEXTURE0),l)l.setSize(a,o),e.framebufferRenderbuffer(e.FRAMEBUFFER,l.attachment,e.RENDERBUFFER,l.buffer);else if(f){f.source.data={width:a,height:o},f.update({data:{width:a,height:o,data:new Uint16Array(0)}});var d=f&&p?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,d,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}}},r.resetColorTextures=function(t){var e=t,r=this.renderer.glRenderer.gl,i=this.engine.gpuCapability,n=this.viewport,a=[];if(e){for(var o,u=s(e);!(o=u()).done;){o.value.initialize()}this.colorTextures=e.slice()}this.renderer.pipelineContext.activeTexture(r.TEXTURE0),this.colorTextures.forEach((function(t,e){var s={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:s}),i.framebufferTexture2D(r,r.FRAMEBUFFER,e,r.TEXTURE_2D,t.textureBuffer),a.push(!0)})),i.drawBuffers(r,a),this.updateAttachmentTextures()},r.resize=function(t,e,r,i){var n=this.viewport,s=n[0],a=n[1],o=n[2],u=n[3];s===t&&a===e&&o===r&&u===i||(this.viewport=[t,e,r,i],this.ready=!1,this.bind())},r.dispose=function(t){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var e,r,i=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:exports.RenderPassDestroyAttachmentType.force;if(i===exports.RenderPassDestroyAttachmentType.force||i===exports.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)null==(e=this.depthStencilRenderbuffer)||e.dispose(),null==(r=this.depthTexture)||r.dispose();this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},se(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(Bi),dc=((ec={})[rr.FLOAT]=1,ec[rr.INT]=1,ec[rr.UNSIGNED_INT]=1,ec[rr.SHORT]=1,ec[rr.BOOL]=1,ec[rr.UNSIGNED_SHORT]=1,ec[rr.FLOAT_VEC2]=2,ec[rr.FLOAT_VEC3]=3,ec[rr.FLOAT_VEC4]=4,ec[rr.FLOAT_MAT2]=4,ec[rr.FLOAT_MAT3]=9,ec[rr.FLOAT_MAT4]=16,ec[rr.FLOAT_MAT2x3]=6,ec[rr.FLOAT_MAT2x4]=8,ec[rr.FLOAT_MAT4x3]=12,ec[rr.FLOAT_MAT4x2]=8,ec[rr.FLOAT_MAT3x4]=12,ec[rr.FLOAT_MAT3x2]=6,ec[rr.INT_VEC2]=2,ec[rr.INT_VEC3]=3,ec[rr.INT_VEC4]=4,ec[rr.UNSIGNED_INT_VEC2]=2,ec[rr.UNSIGNED_INT_VEC3]=3,ec[rr.UNSIGNED_INT_VEC4]=4,ec[rr.BOOL_VEC2]=2,ec[rr.BOOL_VEC3]=3,ec[rr.BOOL_VEC4]=4,ec),mc=xc(Float32Array),vc=xc(Int32Array),yc=xc(Uint8Array);function gc(t){return function(e,r,i,n){var s={start:r[1],dirty:!0};if(r[2]>1){var a=e;if(a.length){for(var o=n[1]||a.length,u=r[4]/t.BYTES_PER_ELEMENT,h=s.buffer=new t(o*u),c=n[0]||0,l=0;l<o;l++)h[l*u]=a[l+c];s.start+=c*u}}else s.buffer=new t([e]);return s}}function xc(t){return function(e,r,i,n){for(var s=r[8],a=r[2],o=r[5],u=1===a?s:r[4],h=o?u/o:1,c=u/t.BYTES_PER_ELEMENT/h,l=s/t.BYTES_PER_ELEMENT/c,f=dc[r[0]],p=f/h,d=(n[0]||0)*f,m=n[1]?h*n[1]:l,v=new t(c*m),y={start:r[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,b=d;g<m;g++){for(var T=0;T<p;T++)v[x+T]=e[b+T];x+=c,b+=p}return y}}function bc(t,e){for(var r=function(r){var s=t.getActiveUniformBlockName(e,r);N(s);var a={index:t.getUniformBlockIndex(e,s),usedByVertexShader:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:s,id:""};a.used=a.usedByVertexShader||a.usedByFragmentShader,i[r]=a;for(var o=a.uniformIndices,u=[],h=0;h<o.length;h++){var c=t.getActiveUniform(e,o[h]).name.replace("[0]","");a.uniforms[c]=[0,0,0,0,0,0,0,h,0],u[h]=c,n.push(c)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach((function(r,i){t.getActiveUniforms(e,o,r).forEach((function(t,e){var r=u[e];a.uniforms[r][i]=+t}))}));for(var l=0;l<u.length;l++){var f=a.uniforms[u[l]],p=a.uniforms[u[l+1]],d=p?p[1]:a.size;f[8]=d-f[1]}a.id=function(t){var e=t.name,r=t.size,i=t.uniforms,n=t.uniformIndices,s=Object.keys(i).map((function(t){return t+"["+i[t].join(":")+"]"})).join("+");return Tc(e+"+",r+"+",n.length+"+",s)}(a)+""},i=[],n=[],s=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),a=0;a<s;++a)r(a);return{blockSpecs:i,blockUniformNames:n}}function Tc(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(var i=0,n=0;n<arguments.length;n++)for(var s=e[n],a=0;a<s.length;a++)i=Math.imul(31,i)+s.charCodeAt(a)|0;return i}(rc={})[rr.FLOAT]=gc(Float32Array),rc[rr.INT]=gc(Int32Array),rc[rr.UNSIGNED_INT]=gc(Uint32Array),rc[rr.SHORT]=gc(Int16Array),rc[rr.BOOL]=gc(Uint8Array),rc[rr.UNSIGNED_SHORT]=gc(Uint16Array),rc[rr.FLOAT_VEC2]=mc,rc[rr.FLOAT_VEC3]=mc,rc[rr.FLOAT_VEC4]=mc,rc[rr.FLOAT_MAT2]=mc,rc[rr.FLOAT_MAT3]=mc,rc[rr.FLOAT_MAT4]=mc,rc[rr.FLOAT_MAT2x3]=mc,rc[rr.FLOAT_MAT2x4]=mc,rc[rr.FLOAT_MAT4x3]=mc,rc[rr.FLOAT_MAT4x2]=mc,rc[rr.FLOAT_MAT3x4]=mc,rc[rr.FLOAT_MAT3x2]=mc,rc[rr.INT_VEC2]=vc,rc[rr.INT_VEC3]=vc,rc[rr.INT_VEC4]=vc,rc[rr.UNSIGNED_INT_VEC2]=vc,rc[rr.UNSIGNED_INT_VEC3]=vc,rc[rr.UNSIGNED_INT_VEC4]=vc,rc[rr.BOOL_VEC2]=yc,rc[rr.BOOL_VEC3]=yc,rc[rr.BOOL_VEC4]=yc;var Ec=function(){function t(t,e,r){var i=this;this.engine=t,this.program=e,this.id=r,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var n=this.pipelineContext.gl;(this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),nr(n))&&bc(n,e).blockSpecs.forEach((function(t){return i.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,r,i=this,n=this.id,s=this.pipelineContext.gl;return t.vaos[n]?r=t.vaos[n]:((r=new jh(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),t.vaos[n]=r),r&&r.vao&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var r=i.attribInfoMap[e],n=t.attributes[e];if(n){var a=t.buffers[n.dataSource];if(!a)throw new Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");a.bind(),s.enableVertexAttribArray(r.loc),s.vertexAttribPointer(r.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null==(e=t.indicesBuffer)||e.bind(),r&&(r.ready=!0)),r},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var s=t.getActiveAttrib(e,n);if(s){var a=s.name,o=s.type,u=s.size,h=t.getAttribLocation(e,a);r[a]={type:o,name:a,size:u,loc:h}}}return r},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),_c=function(t){function e(e,r){var i;return(i=t.call(this,e,r)||this).initialized=!1,i.uniformLocations={},i.samplerChannels={},i}_t(e,t);var r=e.prototype;return r.initialize=function(){this.initialized||this.engine.getGLPipelineContext().shaderLibrary.compileShader(this)},r.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},r.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},r.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},r.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},r.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},r.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},r.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},r.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},r.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},r.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},r.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},r.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},r.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},r.fillShaderInformation=function(t,e){var r=e.slice();t=t.concat(r);for(var i,n=this.pipelineContext.getUniforms(this.program.program,t),s=0;s<t.length;s++)this.uniformLocations[t[s]]=n[s];for(i=0;i<r.length;i++){null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--)}for(i=0;i<r.length;i++){var a=r[i];this.samplerChannels[a]=i}},r.toData=function(){var t=this.taggedProperties;t.dataType=Kt.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},r.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(br),Ac=0,Cc=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 r=t.prototype;return r.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var r,i=[],n=s(Object.keys(this.cachedShaders));!(r=n()).done;){var a=r.value;this.cachedShaders[a].initialized||i.push(a)}t?i.length?Promise.all(i.map((function(t){return new Promise((function(r){return e.compileShader(e.cachedShaders[t],r)}))}))).then(t).catch((function(){return 0})):t([]):i.map((function(t){return e.compileShader(e.cachedShaders[t])})),this.shaderAllDone=!0}},r.addShader=function(t,e){var r,i,n=[];t.macros&&(r=n).push.apply(r,[].concat(t.macros));e&&(i=n).push.apply(i,[].concat(e));var s=Ie({},t,{vertex:bi.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.vertex,shader:t.vertex,macros:n}),fragment:bi.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.fragment,shader:t.fragment,macros:n})}),a=this.computeShaderCacheId(s);if(this.cachedShaders[a])return a;this.shaderAllDone=!1;var o=!1;return(s.shared||s.cacheId)&&(o=!0),this.cachedShaders[a]=new _c(this.engine,Ie({},s,{vertex:s.vertex,fragment:s.fragment,name:s.name||a,shared:o})),this.cachedShaders[a].id=a,a},r.createShader=function(t,e){var r=this.addShader(t,e);return this.cachedShaders[r]},r.compileShader=function(t,r){var i=this,n=t.source,s=n.shared,a=n.vertex,o=n.fragment,u=n.name,h=t.source.cacheId,c=!1;(s||h)&&(c=!0);var l=this.pipelineContext.gl,f={shared:c,status:exports.ShaderCompileResultStatus.compiling},p=this.createProgram(l,a,o,f),d=this.glAsyncCompileExt,m=e.performance.now(),v=function(r){f.status=exports.ShaderCompileResultStatus.success,f.compileTime=e.performance.now()-m,t.program=r,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]=r},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==r?void 0:r(f);if(t.initialized)return null==r?void 0:r(f);var n=(!r||!d||d&&1==l.getProgramParameter(f.program,d.COMPLETION_STATUS_KHR))&&p();if(n){if(f.status!==exports.ShaderCompileResultStatus.fail){Wh(n,u);var s=new Ec(i.engine,n,t.id);if(l.validateProgram(n),l.getProgramParameter(n,l.VALIDATE_STATUS))v(s);else{var h=l.getProgramInfoLog(n);(null==h?void 0:h.includes("the same texture"))?v(s):(f.status=exports.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",a,"\nfragment:\n",o),l.deleteProgram(n))}}null==r||r(f)}else r&&e.requestAnimationFrame(y)};t.compileResult=f,y()},r.computeShaderCacheId=function(t){var e=t.vertex,r=void 0===e?"":e,i=t.fragment,n=void 0===i?"":i,s=t.shared,a=t.cacheId;return s||a?a||"shared_"+Tc(r,n):"instanced_"+Ac++},r.createProgram=function(t,e,r,i){var n=t.createProgram(),s=this.createGLShader(t,t.VERTEX_SHADER,e),a=this.createGLShader(t,t.FRAGMENT_SHADER,r);return n&&s&&a?(t.attachShader(n,s),t.attachShader(n,a),t.linkProgram(n),i.program=n,i.status=exports.ShaderCompileResultStatus.compiling,function(){if(i.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var o=t.getProgramInfoLog(n);console.error("Failed to link program: "+o+".");var u=Sc(t,s,"vertex",e),h=Sc(t,a,"fragment",r);return i.status=exports.ShaderCompileResultStatus.fail,u&&(i.error=u.error,i.status=u.status),h&&(i.error=h.error,i.status=h.status),n}return n}):(i.status=exports.ShaderCompileResultStatus.fail,function(){return null})},r.createGLShader=function(t,e,r){var i=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Tc(null!=r?r:""),s=i.get(n);if(s)return s;var a=t.createShader(e);return a&&(t.shaderSource(a,r),t.compileShader(a),i.set(n,a)),a},r.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]},r.restore=function(){},r.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 Sc(t,e,r,i){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+r+" error: "+n,(null!=i?i:"").split("\n").map((function(t,e){return e+1+" "+t})).join("\n")),{error:n,status:exports.ShaderCompileResultStatus.fail}}}var wc=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new Cc(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=rr.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,r){this.stencilFuncSeparate(this.gl.FRONT,t,e,r),this.stencilFuncSeparate(this.gl.BACK,t,e,r)},e.stencilFuncSeparate=function(t,e,r,i){this.set4("stencilFuncSeparate",t,e,r,i)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,r){this.stencilOpSeparate(this.gl.FRONT,t,e,r),this.stencilOpSeparate(this.gl.BACK,t,e,r)},e.stencilOpSeparate=function(t,e,r,i){this.set4("stencilOpSeparate",t,e,r,i)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,r,i){this.set4("clearColor",t,e,r,i)},e.colorMask=function(t,e,r,i){this.set4("colorMask",t,e,r,i)},e.blendColor=function(t,e,r,i){this.set4("blendColor",t,e,r,i)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,r,i){this.set4("blendFuncSeparate",t,e,r,i)},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,r,i){this.set4("viewport",t,e,r,i)},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,r){(this.currentTextureBinding!==e||r)&&(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,r){var i=this.glCapabilityCache[t];i||(i=this.glCapabilityCache[t]={x:NaN,y:NaN}),i.x===e&&i.y===r||this.gl[t](i.x=e,i.y=r)},e.set3=function(t,e,r,i){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===r&&n.z===i||this.gl[t](n.x=e,n.y=r,n.z=i)},e.set4=function(t,e,r,i,n){var s=this.glCapabilityCache[t];s||(s=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),s.x===e&&s.y===r&&s.z===i&&s.w===n||this.gl[t](s.x=e,s.y=r,s.z=i,s.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,r){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var i=r.target;this.gl.bindTexture(i,r.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var r=[],i=0;i<e.length;i++)r.push(this.gl.getUniformLocation(t,e[i]));return r},e.setFloat4=function(t,e,r,i,n){t&&this.gl.uniform4f(t,e,r,i,n)},e.setFloat3=function(t,e,r,i){t&&this.gl.uniform3f(t,e,r,i)},e.setFloat2=function(t,e,r){t&&this.gl.uniform2f(t,e,r)},t}(),Rc=function(t){function e(e,r,i){var n;(n=t.call(this)||this).canvas=e,n.temporaryRTs={};var s=Ie({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},i);n.context=new hc(e,r,s);var a=n.context.gl;return N(a),n.engine=new cc(a),n.engine.renderer=we(n),n.pipelineContext=new wc(n.engine,a),n.glRenderer=new Hh(n.engine),n.extension=new oc(we(n)),n.renderingData={currentFrame:{}},n.framebuffer=new pc({storeAction:{},viewport:[0,0,n.width,n.height],attachments:[new Bh(n.engine,{sourceType:exports.TextureSourceType.framebuffer,data:{width:n.width,height:n.height}})],depthStencilAttachment:{storageType:exports.RenderPassAttachmentStorageType.none}},we(n)),n}_t(e,t);var r=e.prototype;return r.renderRenderFrame=function(t){var e,r=t;r.resource&&r.resource.color_b.initialize(),r.emptyTexture.initialize(),r.transparentTexture.initialize();var i=r._renderPasses;if(this.isDestroyed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=r.renderer.getShaderLibrary())||e.compileAllShaders(),this.setFramebuffer(null),this.clear(r.clearAction);var n=r.camera;this.renderingData.currentFrame=r,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),L(i);for(var a,o=s(i);!(a=o()).done;){var u=a.value,h=u.delegate;null==h.willBeginRenderPass||h.willBeginRenderPass.call(h,u,this.renderingData),this.renderRenderPass(u),null==h.didEndRenderPass||h.didEndRenderPass.call(h,u,this.renderingData)}for(var c,l=s(i);!(c=l()).done;){c.value.frameCleanup(this)}}},r.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},r.renderMeshes=function(t){for(var e,r=this.renderingData.currentPass.delegate,i=s(t);!(e=i()).done;){var n=e.value;null==r.willRenderMesh||r.willRenderMesh.call(r,n,this.renderingData),n.render(this),null==r.didRenderMesh||r.didRenderMesh.call(r,n,this.renderingData)}},r.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},r.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},r.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},r.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},r.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},r.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},r.drawGeometry=function(t,e,r){if(void 0===r&&(r=0),t&&e){e.initialize(),t.initialize(),t.flush();var i=this.renderingData;i.currentFrame.editorTransform&&e.setVector4("uEditorTransform",i.currentFrame.editorTransform);try{e.use(this,i.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,e,r)}},r.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.getFramebuffer=function(){return this.framebuffer},r.getTemporaryRT=function(t,e,r,i,n,s){if(this.temporaryRTs[t])return this.temporaryRTs[t];var a,o,u=exports.RenderPassAttachmentStorageType.none;n===exports.FilterMode.Linear?a=rr.LINEAR:n===exports.FilterMode.Nearest&&(a=rr.NEAREST),s===exports.RenderTextureFormat.RGBA32?o=rr.UNSIGNED_BYTE:s===exports.RenderTextureFormat.RGBAHalf&&(o=rr.HALF_FLOAT),0===i?u=exports.RenderPassAttachmentStorageType.none:16===i?u=exports.RenderPassAttachmentStorageType.depth_16_opaque:24===i&&(u=exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var h=new Bh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,minFilter:a,magFilter:a,internalFormat:rr.RGBA,format:rr.RGBA,type:o}),c=new pc({name:t,storeAction:{},viewport:[0,0,e,r],viewportScale:1,isCustomViewport:!0,attachments:[h],depthStencilAttachment:{storageType:u}},this);return this.temporaryRTs[t]=c,c},r.setViewport=function(t,e,r,i){this.pipelineContext.viewport(t,e,r,i)},r.clear=function(t){var e=this.pipelineContext,r=0;if(t.colorAction===exports.TextureLoadAction.clear){var i=t.clearColor;i&&e.clearColor(i[0],i[1],i[2],i[3]),e.colorMask(!0,!0,!0,!0),r=rr.COLOR_BUFFER_BIT}if(t.stencilAction===exports.TextureLoadAction.clear&&(e.stencilMask(255),e.clearStencil(t.clearStencil||0),r|=rr.STENCIL_BUFFER_BIT),t.depthAction===exports.TextureLoadAction.clear){var n=t.clearDepth;e.depthMask(!0),e.clearDepth(Number.isFinite(n)?n:1),r|=rr.DEPTH_BUFFER_BIT}r&&e.clear(r)},r.addLostHandler=function(t){this.context.addLostHandler(t)},r.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},r.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.getWidth=function(){return this.width},r.getHeight=function(){return this.height},r.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},r.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},r.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context.");this.engine.gpuCapability=new Di(t),this.engine.renderer=this,this.pipelineContext=new wc(this.engine,t),this.glRenderer=new Hh(this.engine),this.extension=new oc(this)},r.resize=function(t,e){var r=this.glRenderer;r&&(this.width===t&&this.height===e||r.resize(t,e))},r.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},se(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}(Gi),Oc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY",Mc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT",Pc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW",Ic="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Lc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Fc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",Vc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var Dc=new Map;var Nc=!1,kc=1,zc=function(t){function r(r){var n;(n=t.call(this)||this).compositions=[],n.displayScale=1,n.resumePending=!1,n.disposed=!1,n.assetManagers=[],n.speed=1,n.baseCompositionIndex=0,n.lost=function(t){var e;null==(e=n.ticker)||e.pause(),n.compositions.forEach((function(e){return e.lost(t)})),n.renderer.lost(t),n.handleEmitEvent("webglcontextlost",t),Uc(we(n),!1)};var a=we(n);n.restore=i((function(){var t;return h(this,(function(r){switch(r.label){case 0:return a.renderer.restore(),[4,Promise.all(a.compositions.map(i((function(t){var e,r,i,n,s,o,u,c,l,f,p,d;return h(this,(function(h){switch(h.label){case 0:return e=t.time,r=t.url,i=t.speed,n=t.keepResource,s=t.reusable,o=t.renderOrder,u=t.transform,c=t.videoState,[4,a.loadScene(r)];case 1:(l=h.sent()).speed=i,l.reusable=s,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),f=0,h.label=2;case 2:return f<c.length?c[f]?((p=l.textures[f].source.video).currentTime=null!=(d=c[f])?d:0,[4,p.play()]):[3,4]:[3,5];case 3:h.sent(),h.label=4;case 4:return f++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}}))}))))];case 1:return a.compositions=r.sent(),a.emit("webglcontextrestored"),null==(t=a.ticker)||t.resume(),S()&&a.canvas&&(a.canvas.style.display="none",e.window.setTimeout((function(){a.canvas.style.display=""}),0)),[2]}}))})),n.handleResume=function(){n.emit("update",{player:we(n),playing:!0})},n.handleClick=function(t){var e=t.x,r=t.y,i=[];n.compositions.forEach((function(t){for(var a,o=s(t.hitTest(e,r));!(a=o()).done;){var u=a.value;i.push(Ie({},u,{player:we(n),composition:t}))}}));for(var a=0;a<i.length;a++){var o=i[a],u=o.behavior||mt.NOTIFY;u===mt.NOTIFY?(n.emit("click",Ie({},o,{compositionId:o.composition.id,compositionName:o.composition.name})),o.composition.emit("click",Ie({},o,{compositionId:o.composition.id,compositionName:o.composition.name}))):u===mt.RESUME_PLAYER&&n.resume()}};var o=r.container,u=r.canvas,c=r.fps,l=r.name,f=r.pixelRatio,p=r.manualRender,d=r.reportGPUTime,m=r.renderFramework,v=r.notifyTouch,y=r.onError,g=r.interactive,x=void 0!==g&&g,b=r.renderOptions,T=void 0===b?{}:b,E=r.env,_=void 0===E?"":E,A=T.willCaptureImage,w=T.premultipliedAlpha;if(n.onError=y,Nc||"debug-disable"===m)return ru(n);var R,O=(R=/iPhone OS (\d+)_(\d+)/.exec(e.navigator.userAgent))&&("13"===R[1]||"16"===R[1]&&"5"===R[2])?"webgl":"webgl2";m&&(O="webgl"===m?"webgl":"webgl2"),n.reportGPUTime=d,n.pixelRatio=Number.isFinite(f)?f:C(),n.offscreenMode=!0,n.env=_,n.name=l||""+kc++;try{if(er.length)throw new Error("Errors before player create: "+er.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});u?n.canvas=u:(Bc(o),n.canvas=e.document.createElement("canvas"),o.appendChild(n.canvas)),n.container=n.canvas.parentElement,n.renderer=Gi.create(n.canvas,O,{preserveDrawingBuffer:A,premultipliedAlpha:w}),n.renderer.env=_,n.renderer.addLostHandler({lost:n.lost}),n.renderer.addRestoreHandler({restore:n.restore}),n.gpuCapability=n.renderer.engine.gpuCapability,n.assetService=new oh(n.renderer.engine),p||(n.ticker=new Dh(c),n.ticker.add(n.tick.bind(we(n)))),n.event=new Cs(n.canvas,!!v),n.event.bindListeners(),n.event.addEventListener(Ts,n.handleClick),n.interactive=x,n.resize(),jo(n.gpuCapability.detail)}catch(t){n.handleThrowError(t)}return Dc.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&&j.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+n.gpuCapability.type+".\nsee "+Vc+".")})),Dc.set(n.canvas,we(n)),function(){for(var t,e=[],r=s(Dc.values());!(t=r()).done;){var i=t.value;i.paused||e.push(i)}e.length>1&&j.error("Current running player count: "+e.length+", see "+Fc+".",e)}(),Uc(we(n),!0),n}_t(r,t);var n=r.prototype;return n.setSpeed=function(t){isNaN(t)||(this.speed=t)},n.getSpeed=function(){return this.speed},n.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},n.getCompositions=function(){return this.compositions.sort((function(t,e){return t.getIndex()-e.getIndex()}))},n.getAssetManager=function(){return this.assetManagers},n.loadScene=function(t,r){var n=this;return i((function(){var a,o,u,c,l,f,p,d,m,v,y,g,x,b,T,E,_,A,C,S;return h(this,(function(w){switch(w.label){case 0:return N(n.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),c=e.performance.now(),l=[],f=[],d=null==(p=null==r?void 0:r.autoplay)||p,m=null==(o=n.renderer.engine.gpuCapability)||null==(a=o.detail)?void 0:a.asyncShaderCompile,v=n.baseCompositionIndex,W(t)?(y=l).push.apply(y,[].concat(t)):l.push(t),d&&(n.autoPlaying=!0),g=[],[4,Promise.all(l.map(i((function(t,e){var i,s,a,o,u,c,l,p;return h(this,(function(h){switch(h.label){case 0:return i=n.assetService.assembleSceneLoadOptions(t,Ie({autoplay:d},r)),s=i.source,a=i.options,u=null!=(o=null==a?void 0:a.autoplay)?o:d,c=new sh(a),n.assetManagers.push(c),[4,c.loadScene(s,n.renderer,{env:n.env})];case 1:return l=h.sent(),n.assetService.prepareAssets(l,c.getAssets()),n.assetService.updateTextVariables(l,c.options.variables),n.assetService.initializeTexture(l),l.pluginSystem.precompile(l.jsonScene.compositions,n.renderer),p=n.createComposition(l,a),n.baseCompositionIndex+=1,p.setIndex(v+e),f[e]=p,g[e]=u,[2]}}))}))))];case 1:return w.sent(),x=e.performance.now(),[4,new Promise((function(t){var e;null==(e=n.renderer.getShaderLibrary())||e.compileAllShaders((function(){return t(null)}))}))];case 2:for(w.sent(),b=e.performance.now()-x,T=0;T<f.length;T++)g[T]?f[T].play():f[T].pause();for(null==(u=n.ticker)||u.start(),E=f.map((function(t){return t.name})),_=e.performance.now()-c,A=s(f);!(C=A()).done;)(S=C.value).statistic.compileTime=b,S.statistic.firstFrameTime=_;return j.info("First frame ["+E+"]: "+_.toFixed(4)+"ms."),j.info("Shader "+(m?"async":"sync")+" compile ["+E+"]: "+b.toFixed(4)+"ms."),[2,W(t)?f:f[0]]}}))}))()},n.createComposition=function(t,e){var r=this;void 0===e&&(e={});var i=this.renderer;if(this.disposed)throw new Error("Disposed player can not used to create Composition.");var n=new mh(Ie({},e,{renderer:i,width:i.getWidth(),height:i.getHeight(),event:this.event,handleItemMessage:function(t){r.emit("message",t)}}),t);return this.ticker&&e.renderLevel===ut.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),this.env!==Xn&&this.assetService.createShaderVariant(),this.compositions.push(n),n},n.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.play()})),null==(t=this.ticker)||t.start()},n.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.gotoAndPlay(t)})),this.ticker?this.ticker.start():this.doTick(0,!0)},n.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(e){e.gotoAndStop(t)})),this.ticker&&!(null==(e=this.ticker)?void 0:e.getPaused())||this.doTick(0,!0),this.emit("update",{player:this,playing:!1})},n.playSequence=function(t){for(var e,r=function(e){t[e].on("end",(function(){t[e+1].play()}))},i=0;i<t.length-1;i++)r(i);t[0].play(),null==(e=this.ticker)||e.start()},n.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},n.resume=function(){var t=this;return i((function(){var e;return h(this,(function(r){switch(r.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:r.sent(),t.resumePending=!1,t.handleResume(),r.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}}))}))()},n.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},n.doTick=function(t,e){var r,i=this,n=this.renderer.engine.renderErrors;n.size>0&&(this.handleEmitEvent("rendererror",n.values().next().value),null==(r=this.ticker)||r.pause());t=Math.min(t,33)*this.speed;var s=this.compositions,a=!1;s.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var o,u=[],h=0;h<s.length;h++){var c=s[h];c.textureOffloaded?(a=!0,j.error("Composition "+c.name+" texture offloaded, skip render."),u.push(c)):(!c.isDestroyed&&c.renderer&&c.update(t),c.isDestroyed||u.push(c))}if(this.compositions=u,this.baseCompositionIndex=this.compositions.length,a)return this.handleEmitEvent("rendererror",new Error("Play when texture offloaded.")),null==(o=this.ticker)?void 0:o.pause();if(!this.paused||e){var l=this.gpuCapability.level,f=this.renderer.context.gl,p=2===l&&this.reportGPUTime?tr(f):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<s.length||e){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var d=0;d<s.length;d++)!s[d].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(s[d].renderFrame)}null==p||p.end(),null==p||p.getTime().then((function(t){return null==i.reportGPUTime?void 0:i.reportGPUTime.call(i,null!=t?t:0)})).catch,this.autoPlaying&&this.emit("update",{player:this,playing:!0})}},n.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},n.resize=function(){var t,r,i,n,s=this.canvas.parentElement;if(s){var a=this.getTargetSize(s);t=a[0],r=a[1],i=a[2],n=a[3]}else t=i=this.canvas.width,r=n=this.canvas.height;var o=t/r;if(t&&r){var u,h=e.document.documentElement.clientWidth;i>2*h&&j.error("DPI overflowed, width "+i+" is more than 2x document width "+h+", see "+Mc+".");var c=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>c||n>c)&&(j.error("Container size overflowed "+i+"x"+n+", see "+Oc+"."),o>1?(i=Math.round(c),n=Math.round(c/o)):(n=Math.round(c),i=Math.round(c*o))),this.renderer.resize(i,n),this.canvas.style.width=t+"px",this.canvas.style.height=r+"px",j.info("Resize player "+this.name+" ["+i+","+n+","+t+","+r+"]."),null==(u=this.compositions)||u.forEach((function(t){t.camera.aspect=o}))}},n.clearCanvas=function(t){t?this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},n.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},n.dispose=function(t){var r;if(j.info("Call player destroyed: "+this.name+"."),!this.disposed){Dc.delete(this.canvas),this.pause(),null==(r=this.ticker)||r.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(),Uc(this,!1),a(this.canvas,e.HTMLCanvasElement)&&!t&&this.renderer.context&&(su.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var i="Never use destroyed player: "+this.name+" again, see "+Lc+".",n=function(){return function(t){throw new Error(t)}(i)},s=function(){return t=i,Promise.reject(t);var t};this.tick=n,this.resize=n,this.loadScene=s,this.play=s,this.gotoAndPlay=s,this.gotoAndStop=s,this.playSequence=n,this.destroyCurrentCompositions=n,this.resume=s,this.disposed=!0}},n.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},n.getTargetSize=function(t){Bc(t);var r,i,n=this.displayAspect,s=null==e.window.getComputedStyle?void 0:e.window.getComputedStyle.call(e.window,t),a=0,o=0;(s?(a=parseInt(s.width,10),o=parseInt(s.height,10)):(a=t.clientWidth,o=t.clientHeight),n)?a/o>n?r=(i=o*this.displayScale)*n:i=(r=a*this.displayScale)/n:(r=a,i=o);var u=this.pixelRatio,h=r,c=i;if(r=Math.round(r*u),(i=Math.round(i*u))<1||i<1){if(!this.offscreenMode)throw new Error("Invalid container size "+r+"x"+i+", see "+Pc+".");r=i=h=c=1}return[h,c,r,i]},n.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},n.handleEmitEvent=function(t,r){this.onError?a(r,e.Event)?this.onError(new Error(r.type,{cause:t}),r):a(r,Error)?this.onError(new Error(r.message,{cause:t}),r):this.onError(new Error("Unknown error.",{cause:t}),r):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,r))},se(r,[{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}}]),r}(ks);function Uc(t,e){Object.keys(et).forEach((function(r){var i=et[r],n=e?i.onPlayerCreated:i.onPlayerDestroy;null==n||n(t)}))}function Bc(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Ic+".")}u([function(t,e,r){var n=r.value;return r.value=i((function(){var e,r,i,s,a=arguments;return h(this,(function(o){switch(o.label){case 0:for(e=a.length,r=new Array(e),i=0;i<e;i++)r[i]=a[i];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.apply(this,r)];case 2:return[2,o.sent()];case 3:return s=o.sent(),t.handleThrowError.call(this,s),[3,4];case 4:return[2]}}))})),r}],zc.prototype,"loadScene",null),ur.create=function(t,e){return new Bh(t,e)},ur.createWithData=function(t,e,r){void 0===e&&(e=P("#fff")),void 0===r&&(r={});var i=r.type,n=void 0===i?rr.UNSIGNED_BYTE:i,s=r.format,a=void 0===s?rr.RGBA:s,o=r.internalFormat,u=r.wrapS,h=void 0===u?rr.MIRRORED_REPEAT:u,c=r.wrapT,l=void 0===c?rr.MIRRORED_REPEAT:c,f=r.minFilter,p=void 0===f?rr.NEAREST:f,d=r.magFilter,m=void 0===d?rr.NEAREST:d,v=r.flipY,y=void 0!==v&&v;return new Bh(t,{data:e,type:n,sourceType:exports.TextureSourceType.data,format:a,internalFormat:o||a,wrapS:h,wrapT:l,minFilter:p,magFilter:m,flipY:y})},Nr.create=function(t,e){return new ac(t,e)},jr.create=function(t,e){return new $h(t,e)},ei.create=function(t,e){return new ei(t,e)},Fi.create=function(t){return new lc(t)},Bi.create=function(t,e){return new pc(t,e)},Gi.create=function(t,e,r){return new Rc(t,e,r)},Vh.create=function(t){return new cc(t)};var Gc="2.3.7";j.info("Player version: 2.3.7."),exports.AbstractPlugin=Tt,exports.ActivationPlayable=tu,exports.AnimationClipPlayable=eu,exports.Asset=cu,exports.AssetLoader=lu,exports.AssetManager=sh,exports.AssetService=oh,exports.BYTES_TYPE_MAP=Gr,exports.BaseRenderComponent=qn,exports.Behaviour=de,exports.BezierCurve=On,exports.BezierCurvePath=Pn,exports.BezierCurveQuat=In,exports.COPY_FRAGMENT_SHADER=Cr,exports.COPY_MESH_SHADER_ID=_r,exports.COPY_VERTEX_SHADER=Ar,exports.CalculateLoader=Yo,exports.Camera=hh,exports.CameraVFXItemLoader=bs,exports.ColorCurve=Zn,exports.Component=pe,exports.Composition=mh,exports.CompositionComponent=No,exports.CompositionSourceManager=ch,exports.DEFAULT_FONTS=au,exports.DEFAULT_FPS=60,exports.Database=fu,exports.Downloader=Le,exports.EFFECTS_COPY_MESH_NAME=Er,exports.EVENT_TYPE_CLICK=Ts,exports.EVENT_TYPE_TOUCH_END=As,exports.EVENT_TYPE_TOUCH_MOVE=_s,exports.EVENT_TYPE_TOUCH_START=Es,exports.EffectsObject=fe,exports.EffectsPackage=Fh,exports.Engine=Vh,exports.EventEmitter=ks,exports.EventSystem=Cs,exports.Float16ArrayWrapper=Xi,exports.Framebuffer=Bi,exports.GLEngine=cc,exports.GLGeometry=$h,exports.GLRenderer=Rc,exports.GPUCapability=Di,exports.Geometry=jr,exports.GlobalUniforms=Li,exports.GradientValue=wn,exports.HELP_LINK=Hn,exports.InteractLoader=ws,exports.InteractMesh=Os,exports.KTXTexture=pr,exports.LineSegments=Rn,exports.LinearValue=Sn,exports.Material=Nr,exports.MaterialDataBlock=Ir,exports.Mesh=ei,exports.MeshCollider=Is,exports.PLAYER_OPTIONS_ENV_EDITOR=Xn,exports.POST_PROCESS_SETTINGS="post_process_settings",exports.ParticleBehaviourPlayable=qa,exports.ParticleBehaviourPlayableAsset=Ka,exports.ParticleLoader=Wo,exports.ParticleMesh=Ja,exports.ParticleSystemRenderer=eo,exports.ParticleTrack=Po,exports.PassTextureCache=Ur,exports.PathSegments=Mn,exports.Player=zc,exports.PluginSystem=st,exports.PropertyTrack=Mo,exports.RENDER_PASS_NAME_PREFIX=Ci,exports.RENDER_PREFER_LOOKUP_TEXTURE=ka,exports.RUNTIME_ENV="runtime_env",exports.RandomSetValue=_n,exports.RandomValue=An,exports.RandomVectorValue=Cn,exports.RenderFrame=wi,exports.RenderPass=ai,exports.RenderPassPriorityNormal=ri,exports.RenderPassPriorityPostprocess=3e3,exports.RenderPassPriorityPrepare=0,exports.RenderTargetHandle=ni,exports.Renderbuffer=Fi,exports.Renderer=Gi,exports.RendererComponent=me,exports.RuntimeClip=Oo,exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",exports.SPRITE_VERTEX_STRIDE=jn,exports.SemanticMap=Br,exports.SerializationHelper=ko,exports.ShaderFactory=bi,exports.ShaderVariant=br,exports.SpriteLoader=Ls,exports.StaticValue=En,exports.TEMPLATE_USE_OFFSCREEN_CANVAS=za,exports.TextComponentBase=uu,exports.TextLayout=iu,exports.TextLoader=hu,exports.TextStyle=nu,exports.Texture=ur,exports.TextureFactory=gr,exports.Ticker=Dh,exports.TimelineClip=Ro,exports.TimelinePlayable=Lo,exports.TrackSortWrapper=Fo,exports.Transform=Bs,exports.TransformAnimationPlayable=$o,exports.ValueGetter=Tn,exports.Vector2Curve=Gn,exports.Vector4Curve=Bn,exports.addByOrder=F,exports.addItem=y,exports.addItemWithOrder=function(t,e,r,i){if(void 0===i&&(i=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var s=t[n];if(i)for(;t[n-1][r]<s[r]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][r]>s[r]&&(t[n]=t[n-1],0!=--n););t[n]=s}}},exports.applyMixins=tt,exports.assertExist=N,exports.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},exports.base64ToFile=$,exports.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",exports.calculateTranslation=Zi,exports.canvasPool=su,exports.colorGradingFrag=di,exports.colorStopsFromGradient=E,exports.colorToArr=b,exports.combineImageTemplate=rh,exports.createCopyShader=Sr,exports.createGLContext=$e,exports.createKeyFrameMeta=Nn,exports.createShape=ia,exports.createValueGetter=Yn,exports.decimalEqual=rn,exports.defaultPlugins=rt,exports.deserializeMipmapTexture=qe,exports.disableAllPlayer=function(t){Nc=!!t},exports.earcut=Sa,exports.effectsClass=he,exports.effectsClassStore=ue,exports.enlargeBuffer=x,exports.ensureFixedNumber=du,exports.ensureVec3=qi,exports.findPreviousRenderPass=function(t,e){var r=t.indexOf(e);return t[r-1]},exports.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",exports.gaussianDownHFrag=mi,exports.gaussianDownVFrag=vi,exports.gaussianUpFrag=yi,exports.generateEmptyTypedArray=Xr,exports.generateGUID=J,exports.generateHalfFloatTexture=hr,exports.generateTransparentTexture=fr,exports.generateWhiteTexture=lr,exports.getActivePlayers=function(){return Array.from(Dc.values())},exports.getBackgroundImage=eh,exports.getColorFromGradientStops=T,exports.getConfig=Ba,exports.getDefaultTextureFactory=xr,exports.getGeometryByShape=Ia,exports.getGeometryTriangles=Pa,exports.getImageItemRenderInfo=Kn,exports.getKTXTextureOptions=dr,exports.getKeyFrameMetaByRawValue=Dn,exports.getMergedStore=le,exports.getParticleMeshShader=function(t,e,r){var i;void 0===r&&(r="");var n,s=t.content,a=+((null==(i=s.renderer)?void 0:i.renderMode)||0),o=[["RENDER_MODE",a],["ENV_EDITOR",r===Xn]],u=e.level,h=e.detail,c={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=h.maxVertexUniforms>0,p=(null!=(n=s.positionOverLifetime)?n:{}).speedOverLifetime,d=0,m=0;f&&o.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(o.push(["SPEED_OVER_LIFETIME",!0]),m|=2,Dn(c,p));var v=s.textureSheetAnimation;v&&v.animate&&(o.push(["USE_SPRITE",!0]),m|=4);var y=s.colorOverLifetime;y&&y.color&&(o.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=y&&y.opacity;g&&Dn(c,g);var x,b=s.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[i])&&(Dn(c,b[i]),r=1,m|=1<<7+e),o.push(["LINEAR_VEL_"+t.toUpperCase(),r]);var s=0;(null==b?void 0:b[n])&&(Dn(c,b[n]),s=1,m|=1<<10+e,x=!0),o.push(["ORB_VEL_"+t.toUpperCase(),s])})),(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),s.sizeOverLifetime){var T=s.sizeOverLifetime;T.separateAxes?(Dn(c,T.x),o.push(["SIZE_Y_BY_LIFE",1]),m|=16384,Dn(c,T.y)):Dn(c,T.size)}if(s.rotationOverLifetime){var E=s.rotationOverLifetime;E.z&&(Dn(c,null==E?void 0:E.z),m|=32768,o.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(Dn(c,E.x),m|=65536,o.push(["ROT_X_LIFETIME",1])),E.y&&(Dn(c,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)}Dn(c,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(o.push(["FINAL_TARGET",!0]),m|=1<<19,Dn(c,b.forceCurve));var _=h.halfFloatTexture;_&&l.max&&(m|=1<<20);var A=h.maxVertexUniforms,C=c.max+c.curves.length-32>A;Ba(ka)&&(C=!0),2===u&&(c.max=-1,l.index>0&&(l.max=-1)),C&&_&&f&&(d=1);var S=["-p:",a,m,c.index,c.max,l.index,l.max].join("+"),w={fragment:ci,vertex:"#define LOOKUP_TEXTURE_CURVE "+d+"\n"+li,shared:!0,cacheId:S,macros:o,name:"particle#"+t.name};return o.push(["VERT_CURVE_VALUE_COUNT",c.index],["FRAG_CURVE_VALUE_COUNT",l.index],["VERT_MAX_KEY_FRAME_COUNT",c.max],["FRAG_MAX_KEY_FRAME_COUNT",l.max]),{shader:w,vertex:c.index,fragment:l.index}},exports.getPixelRatio=C,exports.getPlayerByCanvas=function(t){return Dc.get(t)},exports.getPreMultiAlpha=wr,exports.getStandardComposition=Yu,exports.getStandardImage=Wu,exports.getStandardItem=Qu,exports.getStandardJSON=Xu,exports.getTextureSize=Ri,exports.glContext=rr,exports.glType2VertexFormatType=function(t){switch(t){case e.WebGLRenderingContext.FLOAT:return Jt.Float32;case e.WebGLRenderingContext.SHORT:return Jt.Int16;case e.WebGLRenderingContext.BYTE:return Jt.Int8;case e.WebGLRenderingContext.UNSIGNED_SHORT:return Jt.UInt16;case e.WebGLRenderingContext.UNSIGNED_BYTE:return Jt.UInt8;default:return Jt.Float32}},exports.gpuTimer=tr,exports.imageDataFromColor=P,exports.imageDataFromGradient=I,exports.initErrors=er,exports.initGLContext=ir,exports.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",exports.interpolateColor=_,exports.isAlipayMiniApp=O,exports.isAndroid=w,exports.isArray=W,exports.isCanvas=q,exports.isCanvasUsedByPlayer=function(t){return Dc.has(t)},exports.isFunction=Y,exports.isIOS=S,exports.isIOSByUA=function(){var t=e.navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},exports.isMiniProgram=function(){return O()||M()},exports.isObject=Z,exports.isSimulatorCellPhone=R,exports.isString=H,exports.isUniformStruct=Lr,exports.isUniformStructArray=function(t){return t&&void 0!==t.length&&Lr(t[0])},exports.isValidFontFamily=k,exports.isWebGL2=nr,exports.isWechatMiniApp=M,exports.itemFrag=hi,exports.itemFrameFrag=oi,exports.itemVert=ui,exports.loadAVIFOptional=ke,exports.loadBinary=Ge,exports.loadBlob=function(t){return Xe.apply(this,arguments)},exports.loadImage=Ue,exports.loadMedia=Ye,exports.loadVideo=He,exports.loadWebPOptional=De,exports.logger=j,exports.math=$r,exports.modifyMaxKeyframeShader=function(t,e,r){var i,n=null==(i=t.cacheId)?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.macros)for(var s=0;s<t.macros.length;s++){var a=t.macros[s];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}},exports.nearestPowerOfTwo=$i,exports.noop=X,exports.normalizeColor=Tu,exports.numberToFix=nn,exports.parsePercent=A,exports.particleFrag=ci,exports.particleOriginTranslateMap=Ji,exports.particleUniformTypeMap=Qa,exports.particleVert=li,exports.passRenderLevel=th,exports.pluginLoaderMap=et,exports.randomInRange=K,exports.registerPlugin=nt,exports.removeItem=g,exports.rotateVec2=La,exports.screenMeshVert=pi,exports.serialize=ce,exports.setBlendMode=Rr,exports.setConfig=function(t,e){return Ua[t]=e},exports.setDefaultTextureFactory=function(t){mr=t},exports.setMaskMode=Mr,exports.setMaxSpriteMeshItemCount=function(t){exports.maxSpriteMeshItemCount=t},exports.setRayFromCamera=tn,exports.setSideMode=Or,exports.setSpriteMeshMaxItemCountByGPU=jo,exports.sortByOrder=L,exports.spec=ie,exports.spriteMeshShaderFromFilter=Xo,exports.spriteMeshShaderFromRenderInfo=Ho,exports.spriteMeshShaderIdFromRenderInfo=function(t,e){return t.cachePrefix+"_effects_sprite_"+e},exports.thresholdFrag=gi,exports.throwDestroyedError=Q,exports.trailVert=fi,exports.translatePoint=function(t,e){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=t,r[i+1]+=e;return r},exports.trianglesFromRect=en,exports.unregisterPlugin=function(t){delete it[t],delete et[t],g(rt,t)},exports.valIfUndefined=function(t,e){return null==t?e:t},exports.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",exports.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",exports.vecFill=Ki,exports.vecMulCombine=Qi,exports.version=Gc,exports.vertexFormatType2GLType=ar;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e=require("@galacean/appx-adapter/weapp");function r(t,e,r,i,n,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(i,n)}function i(t){return function(){var e=this,i=arguments;return new Promise((function(n,s){var a=t.apply(e,i);function o(t){r(a,n,s,o,u,"next",t)}function u(t){r(a,n,s,o,u,"throw",t)}o(void 0)}))}}function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(r):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}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 a(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):a(t,e)}function o(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function u(t,e,r,i){var n,s=arguments.length,a=s<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,i);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(s<3?n(a):s>3?n(e,r,a):n(e,r))||a);return s>3&&a&&Object.defineProperty(e,r,a),a}function h(t,e){var r,i,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(o){return function(u){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,o[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,u])}}}"function"==typeof SuppressedError&&SuppressedError;var c=new Uint8Array(16);function l(){if(!t&&!(t=void 0!==e.crypto&&e.crypto.getRandomValues&&e.crypto.getRandomValues.bind(e.crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(c)}for(var f=[],p=0;p<256;++p)f.push((p+256).toString(16).slice(1));var d,m={randomUUID:void 0!==e.crypto&&e.crypto.randomUUID&&e.crypto.randomUUID.bind(e.crypto)};function v(t,e,r){if(m.randomUUID&&!e&&!t)return m.randomUUID();var i=(t=t||{}).random||(t.rng||l)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){r=r||0;for(var n=0;n<16;++n)e[r+n]=i[n];return e}return function(t,e){return void 0===e&&(e=0),f[t[e+0]]+f[t[e+1]]+f[t[e+2]]+f[t[e+3]]+"-"+f[t[e+4]]+f[t[e+5]]+"-"+f[t[e+6]]+f[t[e+7]]+"-"+f[t[e+8]]+f[t[e+9]]+"-"+f[t[e+10]]+f[t[e+11]]+f[t[e+12]]+f[t[e+13]]+f[t[e+14]]+f[t[e+15]]}(i)}function y(t,e){return t.includes(e)||t.push(e),t}function g(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function x(t,e,r,i){if(void 0===i&&(i=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*i);Number.isNaN(r)||(n=Math.min(n,r));var s=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(s);return a.set(t),a}return t}function b(t,e){var r=[0,0,0,0];if(H(t)){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:255*n]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else a(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var s=0;s<4;s++)r[s]/=255;return r}function T(t,e,r){if(t.length){for(var i,n=1;n<=t.length-1;n++){var s=t[n-1],a=t[n];if(s.stop<=e&&e<=a.stop){i=_(s.color,a.color,(e-s.stop)/(a.stop-s.stop));break}}return i||(i=t[t.length-1].color),r?i.map((function(t){return t/255})):i}return[0,0,0,0]}function E(t){var e=[];if(a(t,Array)?t.forEach((function(t){var r=t[0],i=t[1],n=t[2],s=t[3],a=t[4];e.push({stop:A(r),color:[i,n,s,a]})})):Object.keys(t).forEach((function(r){var i=b(t[r]);e.push({stop:A(r),color:i})})),(e=e.sort((function(t,e){return t.stop-e.stop}))).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var r=e[e.length-1];1!==r.stop&&e.push({stop:1,color:r.color.slice()})}return e}function _(t,e,r,i){var n=[],s=1-r;if(i)for(var a=0;a<4;a++)n[a]=t[a]*s+e[a]*r;else{for(var o=0;o<3;o++)n[o]=Math.round(Math.sqrt(t[o]*t[o]*s+e[o]*e[o]*r));n[3]=Math.round(t[3]*s+e[3]*r)}return n}function A(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function C(){if("object"==typeof e.screen&&"object"==typeof e.document){var t=Math.max(e.document.documentElement.clientWidth,e.window.innerWidth||0),r=e.screen.width/t;return Math.min(2*r,2)}return 1}function S(){return!!e.navigator.platform&&/iPad|iPhone|iPod/.test(e.navigator.platform)}function w(){return/\b[Aa]ndroid\b/.test(e.navigator.userAgent)}function R(){return w()||/\b(iPad|iPhone|iPod)\b/.test(e.navigator.userAgent)}function O(){var t;return"undefined"!=typeof my&&"web"===(null==(t=my)?void 0:t.renderTarget)}function M(){return"miniprogram"===e.window.__wxjs_environment}function P(t){H(t)&&(t=b(t));for(var e=t,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=e[n];return r}function I(t){var e=128,r={width:e,height:1,data:new Uint8Array(512)},i=r.data,n=E(t);if(n.length){i.set(n[0].color,0);for(var s=1;s<127;s++){for(var a=s/e,o=void 0,u=void 0,h=0;h<n.length&&(o=n[h],u=n[h+1],!(o.stop<=a&&u.stop>a));h++);var c=_(o.color,u.color,(a-o.stop)/(u.stop-o.stop));i.set(c,4*s)}i.set(n[n.length-1].color,508)}return r}function L(t,e){void 0===e&&(e=2);var r=t.length;if(r<=1||1===e)return t;if(r<=30){for(var i=1;i<r;i++)V(t,i,e);return t}return D(t,e)}function F(t,e,r){return void 0===r&&(r=2),t.includes(e)?t:(t.push(e),1===t.length||1!==r&&V(t,t.length-1,r),t)}function V(t,e,r){var i=t[e];if(2!==r)for(;e>=1&&t[e-1].priority<i.priority&&(t[e]=t[e-1],0!=--e););else for(;e>=1&&t[e-1].priority>i.priority&&(t[e]=t[e-1],0!=--e););t[e]=i}function D(t,e,r,i){if(void 0===r&&(r=0),void 0===i&&(i=t.length-1),r>=i)return t;for(var n,s=t[r],a=r,o=i;a<o;){if(2===e){for(;t[o].priority>s.priority&&o>=a;)o--;for(;t[a].priority<=s.priority&&a<o;)a++}else{for(;t[o].priority<s.priority&&o>=a;)o--;for(;t[a].priority>=s.priority&&a<o;)a++}var u;u=[t[o],t[a]],t[a]=u[0],t[o]=u[1]}return n=[t[a],t[r]],t[r]=n[0],t[a]=n[1],D(t,e,r,a-1),D(t,e,o+1,i),t}function N(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function k(t){return/^[^\d.][\w-]*$/.test(t)}exports.OrderType=void 0,(d=exports.OrderType||(exports.OrderType={}))[d.none=1]="none",d[d.ascending=2]="ascending",d[d.descending=3]="descending";var z,U="[Galacean Effects]";function B(t){return["%c"+U,"color: #AA0100",""+t]}var G,j={error:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).error.apply(n,[].concat(B(t),[r])),null==z||z("error",t,r)},info:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).debug.apply(n,[].concat(B(t))),null==z||z("info",t,r)},warn:function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=console).warn.apply(n,[].concat(B(t))),null==z||z("warn",t,r)},register:function(t){t&&Y(t)&&(z=t)}};function X(){}function H(t){return"string"==typeof t}exports.DestroyOptions=void 0,(G=exports.DestroyOptions||(exports.DestroyOptions={}))[G.destroy=0]="destroy",G[G.keep=1]="keep",G[G.force=0]="force";var W=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function Y(t){return"[object Function]"===Object.prototype.toString.call(t)}function Z(t){return"[object Object]"===Object.prototype.toString.call(t)}function q(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null==(e=t.tagName)?void 0:e.toUpperCase())}function K(t,e){return t+Math.random()*(e-t)}function Q(){throw new Error("Destroyed item cannot be used again.")}function J(){return v().replace(/-/g,"")}function $(t,r,i){void 0===r&&(r="base64File"),void 0===i&&(i="");for(var n=t.split(",")[1]||t,s=e.atob(n),a=[],o=0;o<s.length;o+=512){for(var u=s.slice(o,o+512),h=new Array(u.length),c=0;c<u.length;c++)h[c]=u.charCodeAt(c);var l=new Uint8Array(h);a.push(l)}var f=new e.Blob(a,{type:i});return new File([f],r,{type:i})}function tt(t,e){e.forEach((function(e){Object.getOwnPropertyNames(e.prototype).forEach((function(r){var i=Object.getOwnPropertyDescriptor(e.prototype,r);if(!i)throw new Error("Cannot find property descriptor of class "+e);Object.defineProperty(t.prototype,r,i)}))}))}var et={},rt=[],it={};function nt(t,e,r){it[t]&&j.error("Duplicate registration for plugin "+t+"."),it[t]=r,et[t]=e,y(rt,t)}var st=function(){function t(){var t={},e=[];rt.forEach((function(r){var i=et[r];e.includes(i)||(e.push(i),t[r]=i)})),this.plugins=Object.keys(t).map((function(t){var e=et[t];if(!e)throw new Error("The plugin '"+t+"' not found."+function(t){var e=at[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+"'":""}(t));var r=new e;return r.name=t,r})).sort((function(t,e){return t.order-e.order}))}var e=t.prototype;return e.initializeComposition=function(t,e){this.plugins.forEach((function(r){return r.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(r){return r.onCompositionReset(t,e)}))},e.processRawJSON=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("processRawJSON",t,e)]}))}))()},e.processAssets=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("processAssets",t,e)]}))}))()},e.precompile=function(t,e){for(var r,i=s(this.plugins);!(r=i()).done;){r.value.precompile(t,e)}},e.loadResources=function(t,e){var r=this;return i((function(){return h(this,(function(i){return[2,r.callStatic("prepareResource",t,e)]}))}))()},e.callStatic=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];var s=this;return i((function(){var e,i,n,a,o,u,c;return h(this,(function(h){for(e=[],i=s.plugins,n=0;n<i.length;n++)a=i[n],o=et[a.name],t in o&&e.push(Promise.resolve(null==(c=o[t])?void 0:(u=c).call.apply(u,[].concat([o],r))));return[2,Promise.all(e)]}))}))()},t}(),at={"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"};var ot,ut,ht,ct,lt,ft,pt,dt,mt,vt,yt,gt,xt,bt,Tt=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 Et(t,e){return Et=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},Et(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&&Et(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.LATEST="3.2"}(ot||(ot={})),function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(ut||(ut={})),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"}(ht||(ht={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(ct||(ct={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(lt||(lt={})),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"}(ft||(ft={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(pt||(pt={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(dt||(dt={})),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"}(mt||(mt={})),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"}(vt||(vt={})),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"}(gt||(gt={})),function(t){t.Opaque="Opaque",t.Transparent="Transparent"}(xt||(xt={})),function(t){t.Both="Both",t.Back="Back",t.Front="Front"}(bt||(bt={}));var At,Ct,St,wt,Rt,Ot,Mt,Pt,It,Lt,Ft,Vt,Dt,Nt,kt,zt,Ut,Bt,Gt=1,jt=3,Xt=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(At||(At={})),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"}(Ct||(Ct={})),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"}(St||(St={})),function(t){t[t.destroy=0]="destroy",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.freeze=4]="freeze"}(wt||(wt={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(Rt||(Rt={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Ot||(Ot={})),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"}(Mt||(Mt={})),function(t){t.point="point",t.spot="spot",t.directional="directional",t.ambient="ambient"}(Pt||(Pt={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(It||(It={})),function(t){t.orthographic="orthographic",t.perspective="perspective"}(Lt||(Lt={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Ft||(Ft={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(Vt||(Vt={})),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"}(Dt||(Dt={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(Nt||(Nt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(kt||(kt={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(zt||(zt={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Ut||(Ut={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Bt||(Bt={}));var Ht,Wt,Yt,Zt,qt,Kt,Qt,Jt,$t,te,ee={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"}(Ht||(Ht={})),function(t){t[t.Butt=0]="Butt",t[t.Round=1]="Round",t[t.Square=2]="Square"}(Wt||(Wt={})),function(t){t[t.Round=0]="Round",t[t.Bevel=1]="Bevel",t[t.Miter=2]="Miter"}(Yt||(Yt={})),function(t){t.video="video",t.image="image"}(Zt||(Zt={})),function(t){t.video="video",t.audio="audio"}(qt||(qt={})),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.TimelineClip="TimelineClip"}(Kt||(Kt={})),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"}(Qt||(Qt={})),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"}(Jt||(Jt={})),function(t){t[t.None=-1]="None",t[t.UInt8=0]="UInt8",t[t.UInt16=1]="UInt16",t[t.UInt32=2]="UInt32"}($t||($t={})),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"}(te||(te={}));var re=ot.LATEST,ie=Object.freeze({__proto__:null,LATEST_VERSION:re,get RenderLevel(){return ut},get BlendingMode(){return ht},get SideMode(){return ct},get MaskMode(){return lt},get ParticleEmitterShapeType(){return ft},get PluginType(){return pt},get InteractType(){return dt},get InteractBehavior(){return mt},get ItemType(){return vt},get RenderMode(){return yt},get ParticleOrigin(){return gt},get RenderType(){return xt},get RenderFace(){return bt},get CameraClipMode(){return At},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_PAUSE:Gt,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_PAUSE_AND_DESTROY:jt,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_RESTART:5,END_BEHAVIOR_DESTROY_CHILDREN:6,CAMERA_CLIP_MODE_VERTICAL:1,CAMERA_CLIP_MODE_NORMAL:Xt,MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get ValueType(){return Ct},get BezierKeyframeType(){return St},get JSONSceneVersion(){return ot},get EndBehavior(){return wt},get ParentItemEndBehavior(){return Rt},get ParticleInteractionBehavior(){return Ot},get ShapeArcMode(){return Mt},get LightType(){return Pt},get ModelBoundingType(){return It},get CameraType(){return Lt},get MaterialType(){return Ft},get MaterialBlending(){return Vt},get RenderMode3D(){return Dt},get TextOverflow(){return Nt},get TextBaseline(){return kt},get TextAlignment(){return zt},get TextWeight(){return Ut},get FontStyle(){return Bt},BuiltinObjectGUID:ee,get ShapePrimitiveType(){return Ht},get LineCap(){return Wt},get LineJoin(){return Yt},get BackgroundType(){return Zt},get MultimediaType(){return qt},get DataType(){return Kt},get GeometryType(){return Qt},get VertexFormatType(){return Jt},get IndexFormatType(){return $t},get VertexBufferSemantic(){return te}});function ne(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function se(t,e,r){return e&&ne(t.prototype,e),r&&ne(t,r),t}var ae=new Map,oe=new Map,ue={};function he(t){return function(e,r){ue[t]&&console.warn("Class "+t+" is already registered."),ue[t]=e}}function ce(t,e){return function(t,e){return function(r,i){var n=function(t){var e=t.constructor;ae.get(e)||ae.set(e,{});return ae.get(e)}(r);n&&(n[i]||(n[i]={type:t,sourceName:e}))}}(t,e)}function le(t){var e=t.constructor;if(oe.get(e))return oe.get(e);var r={};oe.set(e,r);for(var i=t,n=e;n;){var s=ae.get(n);for(var a in s)r[a]=s[a];var o=Object.getPrototypeOf(i);if((n=Object.getPrototypeOf(o).constructor)===Object)break;i=o}return r}var fe=function(){function t(t){this.engine=t,this.guid=J(),this.taggedProperties={},this.engine.addInstance(this)}var e=t.prototype;return e.getInstanceId=function(){return this.guid},e.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},e.toData=function(){},e.fromData=function(t){t.id&&this.setInstanceId(t.id)},e.dispose=function(){},t.is=function(e){return a(e,t)&&"guid"in e},t}(),pe=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 r=e.prototype;return r.onAwake=function(){},r.onEnable=function(){},r.onDisable=function(){},r.onStart=function(){},r.onUpdate=function(t){},r.onLateUpdate=function(t){},r.onDestroy=function(){},r.enable=function(){this.item.composition&&(this.item.composition.sceneTicking.addComponent(this),this.isEnableCalled=!0),this.onEnable()},r.disable=function(){this.onDisable(),this.item.composition&&(this.isEnableCalled=!1,this.item.composition.sceneTicking.removeComponent(this))},r.setVFXItem=function(t){this.item=t,t.isDuringPlay&&(this.isAwakeCalled||(this.onAwake(),this.isAwakeCalled=!0),t.isActive&&this.enabled&&(this.start(),this.enable()))},r.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},r.dispose=function(){this.isEnableCalled&&this.disable(),this.isAwakeCalled&&(this.isAwakeCalled=!1,this.onDestroy()),this.item&&g(this.item.components,this)},r.start=function(){this.isStartCalled||(this.isStartCalled=!0,this.onStart())},se(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}(fe);u([ce()],pe.prototype,"_enabled",void 0);var de=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e)},r.dispose=function(){t.prototype.dispose.call(this)},e}(pe),me=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).materials=[],e._priority=0,e}_t(e,t);var r=e.prototype;return r.render=function(t){},r.setVFXItem=function(e){t.prototype.setVFXItem.call(this,e),this.item.rendererComponents.push(this)},r.onEnable=function(){var t;null==(t=this.item.composition)||t.renderFrame.addMeshToDefaultRenderPass(this)},r.onDisable=function(){var t;null==(t=this.item.composition)||t.renderFrame.removeMeshFromDefaultRenderPass(this)},r.fromData=function(e){t.prototype.fromData.call(this,e)},r.toData=function(){t.prototype.toData.call(this)},r.dispose=function(){this.item&&g(this.item.rendererComponents,this),t.prototype.dispose.call(this)},se(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}(pe);u([ce()],me.prototype,"materials",void 0),u([ce()],me.prototype,"_priority",void 0);var ve=2*Math.PI,ye=Math.PI/180,ge=180/Math.PI,xe=1e-6;function be(t,e){return Math.abs(t-e)<xe||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var Te=function(t,e,r){return(1-r)*t+r*e};function Ee(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r,s=Math.min(i,n),a=Math.max(i,n);return Math.min(Math.max(t,s),a)}var _e=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 r,i;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):a(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):a(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):a(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):a(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,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,r=this.y-t.y;return Math.sqrt(e*e+r*r)},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},e.equals=function(t){return this.x===t.x&&this.y===t.y},e.isZero=function(){var t=xe,e=this.x,r=this.y;return Math.abs(e)<=t&&Math.abs(r)<=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,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();_e.ONE=new _e(1,1),_e.ZERO=new _e(0,0);var Ae=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}var e=t.prototype;return e.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,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 r,i,n;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i: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):a(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):a(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):a(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):a(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this},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 r=t.x,i=t.y,n=t.z,s=e.x,a=e.y,o=e.z;return this.x=i*o-n*a,this.y=n*s-r*o,this.z=r*a-i*s,this},e.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},e.distance=function(t){return Math.sqrt(this.distanceSquared(t))},e.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.isZero=function(){var t=xe,e=this,r=e.x,i=e.y,n=e.z;return Math.abs(r)<=t&&Math.abs(i)<=t&&Math.abs(n)<=t},e.toArray=function(){return[this.x,this.y,this.z]},e.toVector2=function(){return new _e(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,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();Ae.X=new Ae(1,0,0),Ae.Y=new Ae(0,1,0),Ae.Z=new Ae(0,0,1),Ae.ONE=new Ae(1,1,1),Ae.ZERO=new Ae(0,0,0);var Ce=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,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 r,i,n,s;return void 0===e&&(e=0),this.x=null!=(r=t[e])?r:0,this.y=null!=(i=t[e+1])?i:0,this.z=null!=(n=t[e+2])?n:0,this.w=null!=(s=t[e+3])?s:0,this},e.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},e.clone=function(){return new t(this.x,this.y,this.z,this.w)},e.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},e.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},e.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):a(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):a(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):a(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):a(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,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,this},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=xe,e=this,r=e.x,i=e.y,n=e.z,s=e.w;return Math.abs(r)<=t&&Math.abs(i)<=t&&Math.abs(n)<=t&&Math.abs(s)<=t},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector3=function(){return new Ae(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,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t}();Ce.ONE=new Ce(1,1,1,1),Ce.ZERO=new Ce(0,0,0,0);var Se=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).meshCollider=new Is,e.getHitTestParams=function(t){var r=e.transform.getWorldMatrix();e.meshCollider.setGeometry(e.geometry,r);var i=e.meshCollider.getBoundingBoxData();if(i)return{type:i.type,triangles:i.area}},e}_t(e,t);var r=e.prototype;return r.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)},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix();return this.meshCollider.setGeometry(this.geometry,t),this.meshCollider.getBoundingBox()},e}(me);function we(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}u([ce()],Se.prototype,"geometry",void 0),exports.EffectComponent=function(t){function e(e){var r;return(r=t.call(this,e)||this).name="EffectComponent",r}_t(e,t);var r=e.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onUpdate=function(t){var e,r=this.item.time,i=null!=(e=this.material.getVector4("_Time"))?e:new Ce;this.material.setVector4("_Time",i.set(r/20,r,2*r,3*r))},r.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e}(Se),exports.EffectComponent=u([he(Kt.EffectComponent)],exports.EffectComponent),exports.PostProcessVolume=function(t){function e(e){var r;return(r=t.call(this,e)||this).bloom={threshold:0,intensity:0,active:!1},r.vignette={intensity:0,smoothness:0,roundness:0,active:!1},r.tonemapping={active:!1},r.colorAdjustments={brightness:0,saturation:0,contrast:0,active:!1},r}return _t(e,t),e.prototype.onStart=function(){var t=this.item.composition;t&&(t.renderFrame.globalVolume=this)},e}(de),u([ce()],exports.PostProcessVolume.prototype,"bloom",void 0),u([ce()],exports.PostProcessVolume.prototype,"vignette",void 0),u([ce()],exports.PostProcessVolume.prototype,"tonemapping",void 0),u([ce()],exports.PostProcessVolume.prototype,"colorAdjustments",void 0),exports.PostProcessVolume=u([he(Kt.PostProcessVolume)],exports.PostProcessVolume);var Re=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=t,this.y=e,this.z=r,this.w=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},e.setFromEuler=function(t){return t.toQuaternion(this),this},e.setFromAxisAngle=function(e,r){var i=r/2,n=Math.sin(i),s=t.tempVec0;return s.copyFrom(e).normalize(),this.x=s.x*n,this.y=s.y*n,this.z=s.z*n,this.w=Math.cos(i),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,r=e[0],i=e[4],n=e[8],s=e[1],a=e[5],o=e[9],u=e[2],h=e[6],c=e[10],l=r+a+c;if(l>0){var f=.5/Math.sqrt(l+1);this.w=.25/f,this.x=(h-o)*f,this.y=(n-u)*f,this.z=(s-i)*f}else if(r>a&&r>c){var p=2*Math.sqrt(1+r-a-c);this.w=(h-o)/p,this.x=.25*p,this.y=(i+s)/p,this.z=(n+u)/p,this.negate()}else if(a>c){var d=2*Math.sqrt(1+a-r-c);this.w=(n-u)/d,this.x=(i+s)/d,this.y=.25*d,this.z=(o+h)/d,this.negate()}else{var m=2*Math.sqrt(1+c-r-a);this.w=(s-i)/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 r=t.dot(e)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=r):(this.x=0,this.y=-t.z,this.z=t.y,this.w=r)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=r),this.normalize()},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(Ee(this.dot(t),-1,1)))},e.rotateTowards=function(t,e){var r=this.angleTo(t);if(0===r)return this;var i=Math.min(1,e/r);return this.slerp(t,i),this},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 r=t.x,i=t.y,n=t.z,s=t.w,a=e.x,o=e.y,u=e.z,h=e.w;return this.x=r*h+s*a+i*u-n*o,this.y=i*h+s*o+n*a-r*u,this.z=n*h+s*u+r*o-i*a,this.w=s*h-r*a-i*o-n*u,this},e.slerp=function(t,e){if(0===e)return this;if(1===e)return this.copyFrom(t);var r=this,i=r.x,n=r.y,s=r.z,a=r.w,o=a*t.w+i*t.x+n*t.y+s*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=a,this.x=i,this.y=n,this.z=s,this;var u=1-o*o;if(u<=Number.EPSILON){var h=1-e;return this.w=h*a+e*this.w,this.x=h*i+e*this.x,this.y=h*n+e*this.y,this.z=h*s+e*this.z,this.normalize(),this}var c=Math.sqrt(u),l=Math.atan2(c,o),f=Math.sin((1-e)*l)/c,p=Math.sin(e*l)/c;return this.w=a*f+this.w*p,this.x=i*f+this.x*p,this.y=n*f+this.y*p,this.z=s*f+this.z*p,this},e.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},e.rotateVector3=function(t,e){var r=this,i=r.x,n=r.y,s=r.z,a=r.w,o=t.x,u=t.y,h=t.z,c=a*o+n*h-s*u,l=a*u+s*o-i*h,f=a*h+i*u-n*o,p=-i*o-n*u-s*h,d=null!=e?e:t;return d.x=c*a+p*-i+l*-s-f*-n,d.y=l*a+p*-n+f*-i-c*-s,d.z=f*a+p*-s+c*-n-l*-i,d},e.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},e.toArray=function(){return[this.x,this.y,this.z,this.w]},e.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},e.toEuler=function(t){return t.setFromQuaternion(this)},e.toMatrix4=function(t){return t.compose(Ae.ZERO,this,Ae.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,r){return(new t).setFromAxisAngle(e,r)},t.fromVector4=function(e){return(new t).setFromVector4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromRotationMatrix=function(e){return(new t).setFromRotationMatrix(e)},t.fromUnitVectors=function(e,r){return(new t).setFromUnitVectors(e,r)},t}();Re.tempVec0=new Ae;var Oe,Me,Pe=function(){function t(t,e,r,i,n,s,a,o,u,h,c,l,f,p,d,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=1),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=0),void 0===h&&(h=0),void 0===c&&(c=1),void 0===l&&(l=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===d&&(d=0),void 0===m&&(m=1),this.elements=[t,e,r,i,n,s,a,o,u,h,c,l,f,p,d,m]}var e=t.prototype;return e.set=function(t,e,r,i,n,s,a,o,u,h,c,l,f,p,d,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=n,v[5]=s,v[6]=a,v[7]=o,v[8]=u,v[9]=h,v[10]=c,v[11]=l,v[12]=f,v[13]=p,v[14]=d,v[15]=m,this},e.setFromRowMajorData=function(t,e,r,i,n,s,a,o,u,h,c,l,f,p,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=i,v[1]=n,v[5]=s,v[9]=a,v[13]=o,v[2]=u,v[6]=h,v[10]=c,v[14]=l,v[3]=f,v[7]=p,v[11]=d,v[15]=m,this},e.setFromColumnVectors=function(t,e,r,i){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,r.x,r.y,r.z,r.w,i.x,i.y,i.z,i.w)},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 r=0;r<16;r++)this.elements[r]=t[e+r];return this},e.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},e.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},e.setFromRotationX=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1)},e.setFromRotationY=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1)},e.setFromRotationZ=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1)},e.setFromRotationAxis=function(e,r){var i=t.tempVec0;i.copyFrom(e).normalize();var n=Math.cos(r),s=Math.sin(r),a=1-n,o=i.x,u=i.y,h=i.z,c=a*o,l=a*u;return this.set(c*o+n,c*u+s*h,c*h-s*u,0,c*u-s*h,l*u+n,l*h+s*o,0,c*h+s*u,l*h-s*o,a*h*h+n,0,0,0,0,1)},e.setFromEuler=function(t){return t.toMatrix4(this),this},e.setFromQuaternion=function(t){return this.compose(Ae.ZERO,t,Ae.ONE)},e.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},e.setFromBasis=function(t,e,r){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.z,0,0,0,0,1)},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,r,i){var n=t.tempVec0,s=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,r),a.normalize(),n.crossVectors(i,a),n.normalize(),s.crossVectors(a,n);var o=this.elements;return o[0]=n.x,o[1]=s.x,o[2]=a.x,o[3]=0,o[4]=n.y,o[5]=s.y,o[6]=a.y,o[7]=0,o[8]=n.z,o[9]=s.z,o[10]=a.z,o[11]=0,o[12]=-n.dot(e),o[13]=-s.dot(e),o[14]=-a.dot(e),o[15]=1,this},e.addScaledMatrix=function(t,e){for(var r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[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 r=t.elements,i=e.elements,n=this.elements,s=r[0],a=r[4],o=r[8],u=r[12],h=r[1],c=r[5],l=r[9],f=r[13],p=r[2],d=r[6],m=r[10],v=r[14],y=r[3],g=r[7],x=r[11],b=r[15],T=i[0],E=i[4],_=i[8],A=i[12],C=i[1],S=i[5],w=i[9],R=i[13],O=i[2],M=i[6],P=i[10],I=i[14],L=i[3],F=i[7],V=i[11],D=i[15];return n[0]=s*T+a*C+o*O+u*L,n[4]=s*E+a*S+o*M+u*F,n[8]=s*_+a*w+o*P+u*V,n[12]=s*A+a*R+o*I+u*D,n[1]=h*T+c*C+l*O+f*L,n[5]=h*E+c*S+l*M+f*F,n[9]=h*_+c*w+l*P+f*V,n[13]=h*A+c*R+l*I+f*D,n[2]=p*T+d*C+m*O+v*L,n[6]=p*E+d*S+m*M+v*F,n[10]=p*_+d*w+m*P+v*V,n[14]=p*A+d*R+m*I+v*D,n[3]=y*T+g*C+x*O+b*L,n[7]=y*E+g*S+x*M+b*F,n[11]=y*_+g*w+x*P+b*V,n[15]=y*A+g*R+x*I+b*D,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],r=t[4],i=t[8],n=t[12],s=t[1],a=t[5],o=t[9],u=t[13],h=t[2],c=t[6],l=t[10],f=t[14];return t[3]*(+n*o*c-i*u*c-n*a*l+r*u*l+i*a*f-r*o*f)+t[7]*(+e*o*f-e*u*l+n*s*l-i*s*f+i*u*h-n*o*h)+t[11]*(+e*u*c-e*a*f-n*s*c+r*s*f+n*a*h-r*u*h)+t[15]*(-i*a*h-e*o*c+e*a*l+i*s*c-r*s*l+r*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],r=t[1],i=t[2],n=t[3],s=t[4],a=t[5],o=t[6],u=t[7],h=t[8],c=t[9],l=t[10],f=t[11],p=t[12],d=t[13],m=t[14],v=t[15],y=c*m*u-d*l*u+d*o*f-a*m*f-c*o*v+a*l*v,g=p*l*u-h*m*u-p*o*f+s*m*f+h*o*v-s*l*v,x=h*d*u-p*c*u+p*a*f-s*d*f-h*a*v+s*c*v,b=p*c*o-h*d*o-p*a*l+s*d*l+h*a*m-s*c*m,T=e*y+r*g+i*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]=(d*l*n-c*m*n-d*i*f+r*m*f+c*i*v-r*l*v)*E,t[2]=(a*m*n-d*o*n+d*i*u-r*m*u-a*i*v+r*o*v)*E,t[3]=(c*o*n-a*l*n-c*i*u+r*l*u+a*i*f-r*o*f)*E,t[4]=g*E,t[5]=(h*m*n-p*l*n+p*i*f-e*m*f-h*i*v+e*l*v)*E,t[6]=(p*o*n-s*m*n-p*i*u+e*m*u+s*i*v-e*o*v)*E,t[7]=(s*l*n-h*o*n+h*i*u-e*l*u-s*i*f+e*o*f)*E,t[8]=x*E,t[9]=(p*c*n-h*d*n-p*r*f+e*d*f+h*r*v-e*c*v)*E,t[10]=(s*d*n-p*a*n+p*r*u-e*d*u-s*r*v+e*a*v)*E,t[11]=(h*a*n-s*c*n-h*r*u+e*c*u+s*r*f-e*a*f)*E,t[12]=b*E,t[13]=(h*d*i-p*c*i+p*r*l-e*d*l-h*r*m+e*c*m)*E,t[14]=(p*a*i-s*d*i-p*r*o+e*d*o+s*r*m-e*a*m)*E,t[15]=(s*c*i-h*a*i+h*r*o-e*c*o-s*r*l+e*a*l)*E,this},e.extractBasis=function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},e.compose=function(t,e,r,i){void 0===i&&(i=Ae.ZERO);var n=this.elements,s=e.x,a=e.y,o=e.z,u=e.w,h=-i.x,c=-i.y,l=-i.z,f=s+s,p=a+a,d=o+o,m=s*f,v=s*p,y=s*d,g=a*p,x=a*d,b=o*d,T=u*f,E=u*p,_=u*d,A=r.x,C=r.y,S=r.z;return n[0]=(1-(g+b))*A,n[1]=(v+_)*A,n[2]=(y-E)*A,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)*S,n[9]=(x-T)*S,n[10]=(1-(m+g))*S,n[11]=0,n[12]=h*n[0]+c*n[4]+l*n[8]-h+t.x,n[13]=h*n[1]+c*n[5]+l*n[9]-c+t.y,n[14]=h*n[2]+c*n[6]+l*n[10]-l+t.z,this},e.decompose=function(e,r,i){var n=t.tempVec0,s=this.elements,a=n.set(s[0],s[1],s[2]).length(),o=n.set(s[4],s[5],s[6]).length(),u=n.set(s[8],s[9],s[10]).length();this.determinant()<0&&(a=-a),e.x=s[12],e.y=s[13],e.z=s[14];var h=t.tempMat0;h.copyFrom(this);var c=1/a,l=1/o,f=1/u;return h.elements[0]*=c,h.elements[1]*=c,h.elements[2]*=c,h.elements[4]*=l,h.elements[5]*=l,h.elements[6]*=l,h.elements[8]*=f,h.elements[9]*=f,h.elements[10]*=f,r.setFromRotationMatrix(h),i.x=a,i.y=o,i.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 Ae,e=new Re,r=new Ae;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},e.orthographic=function(t,e,r,i,n,s){var a=1/(e-t),o=1/(r-i),u=1/(s-n),h=-(e+t)*a,c=-(r+i)*o,l=-(s+n)*u;a*=2,o*=2,u*=-2;var f=this.elements;return f[0]=a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=o,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=h,f[13]=c,f[14]=l,f[15]=1,this},e.perspective=function(t,e,r,i,n){var s=1/Math.tan(.5*t),a=1/(r-i),o=this.elements;return o[0]=n?s:s/e,o[1]=0,o[2]=0,o[3]=0,o[4]=0,o[5]=n?s*e:s,o[6]=0,o[7]=0,o[8]=0,o[9]=0,o[10]=(i+r)*a,o[11]=-1,o[12]=0,o[13]=0,o[14]=2*i*r*a,o[15]=0,null!==i&&i!==1/0||(o[10]=-1,o[14]=-2*r),this},e.projectPoint=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,a=null!=e?e:t;a.x=s[0]*r+s[4]*i+s[8]*n+s[12],a.y=s[1]*r+s[5]*i+s[9]*n+s[13],a.z=s[2]*r+s[6]*i+s[10]*n+s[14];var o=s[3]*r+s[7]*i+s[11]*n+s[15];return a.multiply(1/o)},e.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*r+s[4]*i+s[8]*n+s[12],a.y=s[1]*r+s[5]*i+s[9]*n+s[13],a.z=s[2]*r+s[6]*i+s[10]*n+s[14],a},e.transformNormal=function(t,e){var r=t.x,i=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*r+s[4]*i+s[8]*n,a.y=s[1]*r+s[5]*i+s[9]*n,a.z=s[2]*r+s[6]*i+s[10]*n,a.normalize()},e.transformVector4=function(t,e){var r=t.x,i=t.y,n=t.z,s=t.w,a=this.elements,o=null!=e?e:t;return o.x=a[0]*r+a[4]*i+a[8]*n+a[12]*s,o.y=a[1]*r+a[5]*i+a[9]*n+a[13]*s,o.z=a[2]*r+a[6]*i+a[10]*n+a[14]*s,o.w=a[3]*r+a[7]*i+a[11]*n+a[15]*s,o},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!be(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,r,i){return(new t).lookAt(e,r,i)},t.fromPerspective=function(e,r,i,n,s){return(new t).perspective(e,r,i,n,s)},t.fromColumnVectors=function(e,r,i,n){return(new t).setFromColumnVectors(e,r,i,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromScale=function(e,r,i){return(new t).setFromScale(e,r,i)},t.fromTranslation=function(e,r,i){return(new t).setFromTranslation(e,r,i)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,r){return(new t).setFromRotationAxis(e,r)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,r,i){return(new t).setFromShear(e,r,i)},t.fromBasis=function(e,r,i){return(new t).setFromBasis(e,r,i)},t.fromRowMajorData=function(e,r,i,n,s,a,o,u,h,c,l,f,p,d,m,v){return new t(e,s,h,p,r,a,c,d,i,o,l,m,n,u,f,v)},t}();function Ie(){return Ie=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},Ie.apply(this,arguments)}Pe.IDENTITY=new Pe(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),Pe.ZERO=new Pe(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),Pe.tempVec0=new Ae,Pe.tempVec1=new Ae,Pe.tempVec2=new Ae,Pe.tempMat0=new Pe,exports.TextureLoadAction=void 0,(Oe=exports.TextureLoadAction||(exports.TextureLoadAction={}))[Oe.whatever=0]="whatever",Oe[Oe.clear=2]="clear",exports.TextureSourceType=void 0,(Me=exports.TextureSourceType||(exports.TextureSourceType={}))[Me.none=0]="none",Me[Me.data=1]="data",Me[Me.image=2]="image",Me[Me.compressed=3]="compressed",Me[Me.video=4]="video",Me[Me.canvas=5]="canvas",Me[Me.framebuffer=6]="framebuffer",Me[Me.mipmaps=7]="mipmaps";var Le=function(){function t(){this.callbacks={}}var r=t.prototype;return r.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},r.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},r.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},r.download=function(t,r,i,n){var s=this;if(void 0===r&&(r="json"),!this.start(t,i,n)){var a=new e.XMLHttpRequest,o=function(){s.finish(t,a.status,a.response)};a.responseType=r,a.addEventListener("load",(function(){200==a.status?s.finish(t,200,a.response):o()})),a.addEventListener("error",o),a.open("GET",t,!0),a.send()}},r.start=function(t,e,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},r.finish=function(t,e,r){var i=this.callbacks[t];delete this.callbacks[t];for(var n=200==e?[r]:[e,r],s=n.length-1,a=i.length;s<a;s+=2)i[s].apply(null,n)},t}(),Fe=!1,Ve=!1;function De(t,e){return Ne.apply(this,arguments)}function Ne(){return(Ne=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:return!Fe&&e?[3,2]:[4,Ue(t)];case 1:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,Ue(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),Fe=!0,[4,Ue(t)];case 5:return[2,{image:r.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function ke(t,e){return ze.apply(this,arguments)}function ze(){return(ze=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:return!Ve&&e?[3,2]:[4,Ue(t)];case 1:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,Ue(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),Ve=!0,[4,Ue(t)];case 5:return[2,{image:r.sent(),url:t}];case 6:return[2]}}))}))).apply(this,arguments)}function Ue(t){return Be.apply(this,arguments)}function Be(){return(Be=i((function(t){var r,i;return h(this,(function(n){if(r="",a(t,e.HTMLImageElement)){if(t.complete)return[2,t];r=t.src}else a(t,e.Blob)?(r=e.URL.createObjectURL(t),i=!0):"string"==typeof t&&(r=t);if(!r)throw new Error("Invalid url type: "+JSON.stringify(t)+".");return[2,new Promise((function(t,n){var s=new e.Image;/^data:/.test(r)||(s.crossOrigin="*"),s.onload=function(){return s.onload=null,i&&e.URL.revokeObjectURL(r),t(s)},s.onerror=function(t){return s.onerror=null,i&&e.URL.revokeObjectURL(r),n("Load image fail: "+r+", reason: "+JSON.stringify(t))},s.src=r}))]}))}))).apply(this,arguments)}function Ge(t){return je.apply(this,arguments)}function je(){return(je=i((function(t){return h(this,(function(e){return[2,new Promise((function(e,r){(new Le).downloadBinary(t,e,(function(e,i){r("Couldn't load bins "+t+": status "+e+", "+i)}))}))]}))}))).apply(this,arguments)}function Xe(){return(Xe=i((function(t){return h(this,(function(e){return[2,new Promise((function(e,r){(new Le).downloadBlob(t,e,(function(e,i){r("Couldn't load blob "+t+": status "+e+", "+i)}))}))]}))}))).apply(this,arguments)}function He(t){return We.apply(this,arguments)}function We(){return(We=i((function(t){var r;return h(this,(function(i){return r=e.document.createElement("video"),"string"==typeof t?r.src=t:r.srcObject=t,r.crossOrigin="anonymous",r.muted=!0,w()&&r.setAttribute("renderer","standard"),r.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var i=r.play();i?i.then((function(){return t(r)})):r.addEventListener("loadeddata",(function e(){t(r),r.removeEventListener("loadeddata",e)}),!0),r.addEventListener("error",(function(t){e("Load video fail.")}))}))]}))}))).apply(this,arguments)}function Ye(t,e){return Ze.apply(this,arguments)}function Ze(){return(Ze=i((function(t,e){return h(this,(function(r){switch(r.label){case 0:if(!Array.isArray(t))return[3,5];r.label=1;case 1:return r.trys.push([1,3,,5]),[4,e(t[0])];case 2:return[2,r.sent()];case 3:return r.sent(),[4,e(t[1])];case 4:return[2,r.sent()];case 5:return[2,e(t)]}}))}))).apply(this,arguments)}function qe(t,e,r){return Ke.apply(this,arguments)}function Ke(){return(Ke=i((function(t,e,r,i){var n,s,a,o,u,c,l,f,p;return h(this,(function(h){switch(h.label){case 0:return void 0===i&&(i=[]),34067!==t.target?[3,2]:(n=t.mipmaps,s=t.target,a=n.map((function(t){return Promise.all(t.map((function(t){return t.id?r[t.id]:Qe(t,e)})))})),[4,Promise.all(a)]);case 1:return o=h.sent(),[2,Ie({keepImageSource:!1},t,{mipmaps:o,sourceFrom:{target:s,type:exports.TextureSourceType.mipmaps}})];case 2:return u=t.mipmaps,c=t.target,l=u.map((function(t){return Qe(t,e)})),[4,Promise.all(l)];case 3:return f=h.sent(),p=i[u[0][1][0]].url,[2,Ie({keepImageSource:!1},t,{mipmaps:f,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{target:c,bin:p,type:exports.TextureSourceType.mipmaps,mipmaps:u.map((function(t){return[t[1][1],t[1][2]]}))}})];case 4:return[2]}}))}))).apply(this,arguments)}function Qe(t,e){return Je.apply(this,arguments)}function Je(){return Je=i((function(t,r){var i,n,s,a,o;return h(this,(function(u){if(i=t[1],n=i[0],s=i[1],a=i[2],!(o=r[n]))throw new Error("Invalid bin pointer: "+JSON.stringify(t)+".");return[2,Ue(new e.Blob([new Uint8Array(o,s,a)]))]}))})),Je.apply(this,arguments)}function $e(t,e,r){var i;if(void 0===e&&(e="webgl"),"webgl2"===e&&((i=t.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),i&&"webgl"!==e||(i=t.getContext("webgl",r)),!i)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i}function tr(t){var r=t.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var n=t.createQuery(),s=i((function(){return h(this,(function(i){return[2,new Promise((function(i,a){if(n){var o=t.getQueryParameter(n,t.QUERY_RESULT_AVAILABLE),u=t.getParameter(r.GPU_DISJOINT_EXT);if(o&&!u){var h=t.getQueryParameter(n,t.QUERY_RESULT);i(h/1e3/1e3)}(o||u)&&(t.deleteQuery(n),n=null),null!==o&&n&&e.window.setTimeout((function(){s().then(i).catch}),1)}}))]}))}));if(!n)return;return{begin:function(){n&&t.beginQuery(r.TIME_ELAPSED_EXT,n)},end:function(){t.endQuery(r.TIME_ELAPSED_EXT)},getTime:s}}}var er=[],rr={};function ir(){"function"==typeof e.WebGL2RenderingContext?sr(e.WebGL2RenderingContext):void 0!==e.WebGLRenderingContext?(sr(e.WebGLRenderingContext),sr(e.WebGLRenderingContext.prototype)):er.push("iOS16 lockdown mode, WebGL Constants not in global"),er.length||"HALF_FLOAT"in rr||(rr.HALF_FLOAT=5131)}function nr(t){return void 0!==e.WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function sr(t){for(var e in t)/^[A-Z_]/.test(e)&&(rr[e]=t[e])}function ar(t){switch(t){case Jt.Float32:return e.WebGLRenderingContext.FLOAT;case Jt.Int16:return e.WebGLRenderingContext.SHORT;case Jt.Int8:return e.WebGLRenderingContext.BYTE;case Jt.UInt16:return e.WebGLRenderingContext.UNSIGNED_SHORT;case Jt.UInt8:return e.WebGLRenderingContext.UNSIGNED_BYTE;default:return e.WebGLRenderingContext.FLOAT}}er.length||ir();var or=1,ur=function(t){function e(e){var r;return(r=t.call(this,e)||this).destroyed=!1,r.id="Tex"+or++,r}_t(e,t);var r=e.prototype;return r.getWidth=function(){return this.width||0},r.getHeight=function(){return this.height||0},r.uploadCurrentVideoFrame=function(){},r.offloadData=function(){},r.reloadData=function(){},r.initialize=function(){},r.assembleOptions=function(t){var e=t.target,r=void 0===e?rr.TEXTURE_2D:e,i=t.format,n=void 0===i?rr.RGBA:i;return t.sourceType||(t.sourceType="image"in t?exports.TextureSourceType.image:"data"in t?exports.TextureSourceType.data:"video"in t?exports.TextureSourceType.video:0),Ie({minFilter:rr.NEAREST,magFilter:rr.NEAREST,wrapS:rr.CLAMP_TO_EDGE,wrapT:rr.CLAMP_TO_EDGE,target:r,format:rr.RGBA,internalFormat:n,type:rr.UNSIGNED_BYTE},t)},e.fromImage=function(t,r,n){return i((function(){var i,s;return h(this,(function(a){switch(a.label){case 0:return[4,Ue(t)];case 1:return i=a.sent(),(s=e.create(r,Ie({sourceType:exports.TextureSourceType.image,image:i,target:rr.TEXTURE_2D,id:J(),flipY:!0},n))).initialize(),[2,s]}}))}))()},e.fromVideo=function(t,r,n){return i((function(){var i,s;return h(this,(function(a){switch(a.label){case 0:return[4,He(t)];case 1:return i=a.sent(),(s=e.create(r,Ie({sourceType:exports.TextureSourceType.video,video:i,id:J(),flipY:!0},n))).initialize(),[2,s]}}))}))()},se(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(fe);function hr(t,e,r,i){var n,s,a=e.length/r/i;return s=n=4===a||0===a?rr.RGBA:3===a?rr.RGB:2===a?rr.LUMINANCE_ALPHA:rr.LUMINANCE,ur.createWithData(t,{data:e,width:r,height:i},{type:rr.HALF_FLOAT,format:n,internalFormat:s,wrapS:rr.CLAMP_TO_EDGE,wrapT:rr.CLAMP_TO_EDGE})}var cr={type:rr.UNSIGNED_BYTE,format:rr.RGBA,internalFormat:rr.RGBA,wrapS:rr.MIRRORED_REPEAT,wrapT:rr.MIRRORED_REPEAT,minFilter:rr.NEAREST,magFilter:rr.NEAREST};function lr(t){return ur.create(t,Ie({id:ee.WhiteTexture,data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:exports.TextureSourceType.data},cr))}function fr(t){return ur.create(t,Ie({id:ee.TransparentTexture,data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:exports.TextureSourceType.data},cr))}var pr=function(){function t(t,e,r){void 0===r&&(r=0),this.arrayBuffer=t,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[11])throw new Error("Texture missing KTX identifier.");var n=Uint32Array.BYTES_PER_ELEMENT,s=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===s.getUint32(0,!0);this.glType=s.getUint32(1*n,a),this.glTypeSize=s.getUint32(2*n,a),this.glFormat=s.getUint32(3*n,a),this.glInternalFormat=s.getUint32(4*n,a),this.glBaseInternalFormat=s.getUint32(5*n,a),this.pixelWidth=s.getUint32(6*n,a),this.pixelHeight=s.getUint32(7*n,a),this.pixelDepth=s.getUint32(8*n,a),this.numberOfArrayElements=s.getUint32(9*n,a),this.numberOfFaces=s.getUint32(10*n,a),this.numberOfMipmapLevels=s.getUint32(11*n,a),this.bytesOfKeyValueData=s.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=0:this.loadType=2:j.warn("Number of faces expected "+e+", but found "+this.numberOfFaces+"."):j.warn("Texture arrays not currently supported."):j.warn("Only 2D textures currently supported.")}return t.prototype.mipmaps=function(t){for(var e=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,s=t?this.numberOfMipmapLevels:1,a=0;a<s;a++){for(var o=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var h=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,o);e.push({data:h,width:i,height:n}),r+=o+4,r+=3-(o+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function dr(t){var e=new pr(t,1),r=e.numberOfMipmapLevels,i=e.pixelWidth,n=e.pixelHeight,s=e.glType,a=e.numberOfFaces,o=e.glInternalFormat,u=e.glFormat,h=r>=Math.floor(Math.log2(Math.max(i,n))+1);return{sourceType:exports.TextureSourceType.compressed,type:s,target:6===a?rr.TEXTURE_CUBE_MAP:rr.TEXTURE_2D,internalFormat:o,format:u,mipmaps:e.mipmaps(h)}}var mr,vr,yr,gr=function(){function t(){this.reloadPending={}}var r=t.prototype;return r.reload=function(t){var e=this;return i((function(){var r,i;return h(this,(function(n){switch(n.label){case 0:return r=t.id,e.reloadPending[r]?[2]:t.sourceFrom?(e.reloadPending[r]=!0,[4,e.loadSource(t.sourceFrom)]):[3,2];case 1:return i=n.sent(),t.updateSource(i),e.reloadPending[r]=!1,[3,3];case 2:throw new Error("No source from.");case 3:return[2]}}))}))()},r.canOffloadTexture=function(t){if(t){var e=t.type;if(e===exports.TextureSourceType.compressed||e===exports.TextureSourceType.image){var r=t.target,i=t.map,n=t.url;return r===rr.TEXTURE_CUBE_MAP?"object"==typeof i&&!!i:H(n)&&n.length>0}if(e===exports.TextureSourceType.mipmaps){var s=t.bin,a=t.mipmaps,o=t.target,u=t.maps,h=t.urls;return s?a.length>0:o===rr.TEXTURE_CUBE_MAP?u.every((function(t){return"object"==typeof t&&t})):h.every((function(t){return H(t)&&t.length>0}))}}return!1},r.loadSource=function(t,e){var r=this;return i((function(){var i,n,s,a,o,u,c,l,f,p,d,m,v,y,g,x,b;return h(this,(function(h){switch(h.label){case 0:return i=t.type,n=t.target,s=t.map,a=t.url,o=t.bin,u=t.mipmaps,c=t.urls,l=t.maps,n!==rr.TEXTURE_CUBE_MAP||i===exports.TextureSourceType.mipmaps?[3,2]:[4,r.loadCubeMap(s)];case 1:return f=h.sent(),[2,Ie({},e,{cube:f,target:rr.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.image,sourceFrom:{type:exports.TextureSourceType.image,map:Ie({},s),target:rr.TEXTURE_CUBE_MAP}})];case 2:return i!==exports.TextureSourceType.image?[3,4]:[4,Ue(a)];case 3:return p=h.sent(),[2,Ie({},e,{image:p,sourceType:exports.TextureSourceType.image,sourceFrom:{type:i,url:a,target:rr.TEXTURE_2D}})];case 4:return i!==exports.TextureSourceType.video?[3,6]:[4,He(a)];case 5:return d=h.sent(),[2,Ie({},e,{video:d,sourceType:exports.TextureSourceType.video})];case 6:return i!==exports.TextureSourceType.compressed?[3,8]:[4,Ge(a)];case 7:return[2,Ie({},dr(h.sent()),e,{sourceFrom:{url:a,type:exports.TextureSourceType.compressed}})];case 8:return i!==exports.TextureSourceType.mipmaps?[3,17]:o?[4,Ge(o)]:[3,13];case 9:return m=h.sent(),v=null!=n?n:rr.TEXTURE_2D,y=v===rr.TEXTURE_2D?u.slice():u.map((function(t){return t.slice()})),n!==rr.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(u.map((function(t){return r.loadMipmapImages(t,m)})))];case 10:return g=h.sent(),[3,12];case 11:g=r.loadMipmapImages(u,m),h.label=12;case 12:return[2,Ie({},e,{mipmaps:g,target:v,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{bin:o,mipmaps:y,target:v,type:exports.TextureSourceType.mipmaps}})];case 13:return n!==rr.TEXTURE_2D&&n?[3,15]:[4,Promise.all(c.map((function(t){return Ue(t)})))];case 14:return x=h.sent(),[2,Ie({},e,{mipmaps:x,target:rr.TEXTURE_2D,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:c.slice(),target:rr.TEXTURE_2D}})];case 15:return n!==rr.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(l.map((function(t){return r.loadCubeMap(t)})))];case 16:return b=h.sent(),[2,Ie({},e,{mipmaps:b,target:rr.TEXTURE_CUBE_MAP,sourceType:exports.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:l.map((function(t){return Ie({},t)})),target:rr.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: "+i+".")}}))}))()},r.loadMipmapImages=function(t,r){return i((function(){return h(this,(function(i){return[2,Promise.all(t.map((function(t){return Ue(new e.Blob([new Uint8Array(r,t[0],t[1])]))})))]}))}))()},r.loadCubeMap=function(t){return i((function(){return h(this,(function(e){return[2,Promise.all(t.map((function(t){return Ue(t)})))]}))}))()},t}();function xr(){return mr||(mr=new gr),mr}exports.ShaderCompileResultStatus=void 0,(vr=exports.ShaderCompileResultStatus||(exports.ShaderCompileResultStatus={}))[vr.noShader=0]="noShader",vr[vr.success=1]="success",vr[vr.fail=2]="fail",vr[vr.compiling=3]="compiling",exports.GLSLVersion=void 0,(yr=exports.GLSLVersion||(exports.GLSLVersion={})).GLSL1="100",yr.GLSL3="300 es";var br=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).source=r,i}return _t(e,t),e}(fe);exports.Shader=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.createVariant=function(t){var e=[];if(t)for(var r,i=s(Object.keys(t));!(r=i()).done;){var n=r.value;e.push([n,t[n]])}var a=this.engine.getShaderLibrary().createShader(this.shaderData,e);return a.shader=this,a},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shaderData=e},e}(fe),exports.Shader=u([he(Kt.Shader)],exports.Shader);var Tr,Er="effects-internal-copy",_r="effects-internal-copy-mesh",Ar="\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}",Cr="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 Sr(t,e){return{name:Er,vertex:Ar,fragment:Cr,glslVersion:2===t?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1,macros:[["DEPTH_TEXTURE",!!e]],cacheId:_r+ +e}}function wr(t){switch(t){case ht.ALPHA:case ht.ADD:case ht.SUBTRACTION:case ht.STRONG_LIGHT:case ht.WEAK_LIGHT:return 1;case ht.SUPERPOSITION:return 2;case ht.BRIGHTNESS:return 3;case ht.MULTIPLY:return 0;default:return 1}}function Rr(t,e){switch(e){case void 0:case ht.ALPHA:t.blendFunction=[rr.ONE,rr.ONE_MINUS_SRC_ALPHA,rr.ONE,rr.ONE_MINUS_SRC_ALPHA];break;case ht.ADD:t.blendFunction=[rr.ONE,rr.ONE,rr.ONE,rr.ONE];break;case ht.SUBTRACTION:t.blendFunction=[rr.ONE,rr.ONE,rr.ZERO,rr.ONE],t.blendEquation=[rr.FUNC_REVERSE_SUBTRACT,rr.FUNC_REVERSE_SUBTRACT];break;case ht.SUPERPOSITION:t.blendFunction=[rr.ONE,rr.ONE,rr.ONE,rr.ONE];break;case ht.MULTIPLY:t.blendFunction=[rr.DST_COLOR,rr.ONE_MINUS_SRC_ALPHA,rr.DST_COLOR,rr.ONE_MINUS_SRC_ALPHA];break;case ht.BRIGHTNESS:t.blendFunction=[rr.ONE,rr.ONE_MINUS_SRC_ALPHA,rr.ONE,rr.ONE_MINUS_SRC_ALPHA];break;case ht.STRONG_LIGHT:t.blendFunction=[rr.DST_COLOR,rr.DST_ALPHA,rr.ZERO,rr.ONE];break;case ht.WEAK_LIGHT:t.blendFunction=[rr.DST_COLOR,rr.ZERO,rr.ZERO,rr.ONE];break;default:console.warn("BlendMode "+e+" not in specification, please set blend params separately.")}}function Or(t,e){e===ct.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=rr.CW,t.cullFace=e===ct.BACK?rr.BACK:rr.FRONT)}function Mr(t,e){switch(e){case void 0:t.stencilTest=!1;break;case lt.MASK:t.stencilTest=!0,t.stencilFunc=[rr.ALWAYS,rr.ALWAYS],t.stencilOpZPass=[rr.REPLACE,rr.REPLACE];break;case lt.OBSCURED:t.stencilTest=!0,t.stencilFunc=[rr.EQUAL,rr.EQUAL];break;case lt.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[rr.NOTEQUAL,rr.NOTEQUAL];break;case lt.NONE:t.stencilTest=!1;break;default:console.warn("MaskMode "+e+" not in specification, please set stencil params seperately.")}}exports.ShaderType=void 0,(Tr=exports.ShaderType||(exports.ShaderType={}))[Tr.vertex=0]="vertex",Tr[Tr.fragment=1]="fragment";var Pr,Ir=function(){function t(t){this.destroyed=!1;var e=t.name,r=void 0===e?"defaultDataBlock":e;this.name=r}var e=t.prototype;return e.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(r){e.setUniformValue(r,t[r])}))},e.invalidAllFlags=function(){},e.updateUniformSubData=function(t,e,r){},t}();function Lr(t){return"object"==typeof t&&t&&void 0===t.length&&a(t,ur)}exports.MaterialRenderType=void 0,(Pr=exports.MaterialRenderType||(exports.MaterialRenderType={}))[Pr.normal=0]="normal",Pr[Pr.transformFeedback=1]="transformFeedback";var Fr,Vr,Dr=1,Nr=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).stringTags={},i.enabledMacros={},i.destroyed=!1,i.initialized=!1,i.shaderDirty=!0,r){var n=r.name,s=void 0===n?"Material"+Dr++:n,a=r.renderType,o=void 0===a?0:a,u=r.shader,h=r.uniformSemantics;i.name=s,i.renderType=o,i.shaderSource=u,i.props=r,i.uniformSemantics=Ie({},h)}else i.name="Material"+Dr++,i.renderType=0;return i}_t(e,t);var r=e.prototype;return r.initialize=function(){},r.createShaderVariant=function(){},r.use=function(t,e){},se(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:"colorMask",set:function(t){}},{key:"stencilMask",set:function(t){}},{key:"stencilOpFail",set:function(t){}},{key:"stencilOpZFail",set:function(t){}}]),e}(fe),kr={format:rr.RGBA,type:rr.UNSIGNED_BYTE,minFilter:rr.LINEAR,magFilter:rr.LINEAR,wrapS:rr.CLAMP_TO_EDGE,wrapT:rr.CLAMP_TO_EDGE},zr=Symbol("dispose"),Ur=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}var e=t.prototype;return e.requestColorAttachmentTexture=function(t){var e=this,r=t.width,i=t.height,n=t.name,s={sourceType:exports.TextureSourceType.framebuffer,data:{width:r,height:i},name:n},a=[n];Object.getOwnPropertyNames(kr).forEach((function(e){var r,i=null!=(r=t[e])?r:kr[e];s[e]=i,a.push(e,i)}));var o=a.join(":"),u=this.textureCache[o];if(u)this.textureRef[o]++;else{var h=this.engine;N(h),u=ur.create(h,s),this.textureCache[o]=u,this.textureRef[o]=1,u[zr]=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 r=this.textureCache[t];r&&(r[zr](),r.dispose=r[zr]),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 r=t.textureCache[e];r[zr](),r.dispose=r[zr]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),Br=function(){function t(t){void 0===t&&(t={}),this.semantics=Ie({},t)}var e=t.prototype;return e.toObject=function(){return Ie({},this.semantics)},e.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},e.getSemanticValue=function(t,e){var r=this.semantics[t];return Y(r)?r(e):r},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}(),Gr=((Fr={})[rr.FLOAT]=Float32Array.BYTES_PER_ELEMENT,Fr[rr.INT]=Int32Array.BYTES_PER_ELEMENT,Fr[rr.SHORT]=Int16Array.BYTES_PER_ELEMENT,Fr[rr.BYTE]=Int8Array.BYTES_PER_ELEMENT,Fr),jr=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="",e.subMeshes=[],e}_t(e,t);var r=e.prototype;return r.initialize=function(){},r.flush=function(){},e}(fe);function Xr(t){return t===rr.INT?new Int32Array(0):t===rr.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"}(Vr||(Vr={}));var Hr=function(){function t(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=r,this.z=i,this.order=n}var e=t.prototype;return e.set=function(t,e,r,i){return void 0===i&&(i=this.order),this.x=t,this.y=e,this.z=r,this.order=i,this},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 r=t.elements,i=r[0],n=r[4],s=r[8],a=r[1],o=r[5],u=r[9],h=r[2],c=r[6],l=r[10];switch(e){case Vr.XYZ:this.y=Math.asin(Ee(s,-1,1)),Math.abs(s)<.9999999?(this.x=Math.atan2(-u,l),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(c,o),this.z=0);break;case Vr.YXZ:this.x=Math.asin(-Ee(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(s,l),this.z=Math.atan2(a,o)):(this.y=Math.atan2(-h,i),this.z=0);break;case Vr.ZXY:this.x=Math.asin(Ee(c,-1,1)),Math.abs(c)<.9999999?(this.y=Math.atan2(-h,l),this.z=Math.atan2(-n,o)):(this.y=0,this.z=Math.atan2(a,i));break;case Vr.ZYX:this.y=Math.asin(-Ee(h,-1,1)),Math.abs(h)<.9999999?(this.x=Math.atan2(c,l),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,o));break;case Vr.YZX:this.z=Math.asin(Ee(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,o),this.y=Math.atan2(-h,i)):(this.x=0,this.y=Math.atan2(s,l));break;case Vr.XZY:this.z=Math.asin(-Ee(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(c,o),this.y=Math.atan2(s,i)):(this.x=Math.atan2(-u,l),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=ge,this.y*=ge,this.z*=ge,this.order=e,this},e.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},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,r){var i,n,s,a;return void 0===e&&(e=0),void 0===r&&(r=this.order),this.x=null!=(i=t[e])?i:0,this.y=null!=(n=t[e+1])?n:0,this.z=null!=(s=t[e+2])?s:0,this.order=null!=(a=t[e+3])?a:r,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 Re;return e.setFromEuler(this),this.setFromQuaternion(e,t)},e.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},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,r=e.x,i=e.y,n=e.z,s=e.order,a=Math.cos(r*ye*.5),o=Math.cos(i*ye*.5),u=Math.cos(n*ye*.5),h=Math.sin(r*ye*.5),c=Math.sin(i*ye*.5),l=Math.sin(n*ye*.5);switch(s){case Vr.XYZ:t.set(h*o*u+a*c*l,a*c*u-h*o*l,a*o*l+h*c*u,a*o*u-h*c*l);break;case Vr.YXZ:t.set(h*o*u+a*c*l,a*c*u-h*o*l,a*o*l-h*c*u,a*o*u+h*c*l);break;case Vr.ZXY:t.set(h*o*u-a*c*l,a*c*u+h*o*l,a*o*l+h*c*u,a*o*u-h*c*l);break;case Vr.ZYX:t.set(h*o*u-a*c*l,a*c*u+h*o*l,a*o*l-h*c*u,a*o*u+h*c*l);break;case Vr.YZX:t.set(h*o*u+a*c*l,a*c*u+h*o*l,a*o*l-h*c*u,a*o*u-h*c*l);break;case Vr.XZY:t.set(h*o*u-a*c*l,a*c*u-h*o*l,a*o*l+h*c*u,a*o*u+h*c*l);break;default:console.error("unknown euler order: "+s)}return t},e.toMatrix4=function(t){var e=t.elements,r=this,i=r.x,n=r.y,s=r.z,a=r.order,o=Math.cos(i*ye),u=Math.sin(i*ye),h=Math.cos(n*ye),c=Math.sin(n*ye),l=Math.cos(s*ye),f=Math.sin(s*ye);if(a===Vr.XYZ){var p=o*l,d=o*f,m=u*l,v=u*f;e[0]=h*l,e[4]=-h*f,e[8]=c,e[1]=d+m*c,e[5]=p-v*c,e[9]=-u*h,e[2]=v-p*c,e[6]=m+d*c,e[10]=o*h}else if(a===Vr.YXZ){var y=h*l,g=h*f,x=c*l,b=c*f;e[0]=y+b*u,e[4]=x*u-g,e[8]=o*c,e[1]=o*f,e[5]=o*l,e[9]=-u,e[2]=g*u-x,e[6]=b+y*u,e[10]=o*h}else if(a===Vr.ZXY){var T=h*l,E=h*f,_=c*l,A=c*f;e[0]=T-A*u,e[4]=-o*f,e[8]=_+E*u,e[1]=E+_*u,e[5]=o*l,e[9]=A-T*u,e[2]=-o*c,e[6]=u,e[10]=o*h}else if(a===Vr.ZYX){var C=o*l,S=o*f,w=u*l,R=u*f;e[0]=h*l,e[4]=w*c-S,e[8]=C*c+R,e[1]=h*f,e[5]=R*c+C,e[9]=S*c-w,e[2]=-c,e[6]=u*h,e[10]=o*h}else if(a===Vr.YZX){var O=o*h,M=o*c,P=u*h,I=u*c;e[0]=h*l,e[4]=I-O*f,e[8]=P*f+M,e[1]=f,e[5]=o*l,e[9]=-u*l,e[2]=-c*l,e[6]=M*f+P,e[10]=O-I*f}else if(a===Vr.XZY){var L=o*h,F=o*c,V=u*h,D=u*c;e[0]=h*l,e[4]=-f,e[8]=c*l,e[1]=L*f+D,e[5]=o*l,e[9]=F*f-V,e[2]=V*f-F,e[6]=u*l,e[10]=D*f+L}else console.error("toMatrix4: Invalid order "+a);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,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,r)},t.fromQuaternion=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,r)},t.fromVector3=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromVector3(e,r)},t.fromArray=function(e,r,i){return void 0===r&&(r=0),void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromArray(e,r,i)},t}();Hr.DEFAULT_ORDER=Vr.ZYX,Hr.tempQuat0=new Re,Hr.tempMat0=new Pe;var Wr=function(){function t(t,e,r,i,n,s,a,o,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=0),void 0===a&&(a=0),void 0===o&&(o=0),void 0===u&&(u=1),this.elements=[t,e,r,i,n,s,a,o,u]}var e=t.prototype;return e.set=function(t,e,r,i,n,s,a,o,u){var h=this.elements;return h[0]=t,h[3]=i,h[6]=a,h[1]=e,h[4]=n,h[7]=o,h[2]=r,h[5]=s,h[8]=u,this},e.setFromRowMajorData=function(t,e,r,i,n,s,a,o,u){var h=this.elements;return h[0]=t,h[3]=e,h[6]=r,h[1]=i,h[4]=n,h[7]=s,h[2]=a,h[5]=o,h[8]=u,this},e.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.z)},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 r=0;r<9;r++)this.elements[r]=t[e+r];return this},e.setFromQuaternion=function(t){var e=t.x,r=t.y,i=t.z,n=t.w,s=e+e,a=r+r,o=i+i,u=e*s,h=e*a,c=e*o,l=r*a,f=r*o,p=i*o,d=n*s,m=n*a,v=n*o,y=this.elements;return y[0]=1-(l+p),y[1]=h+v,y[2]=c-m,y[3]=h-v,y[4]=1-(u+p),y[5]=f+d,y[6]=c+m,y[7]=f-d,y[8]=1-(u+l),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 r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},e.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.elements,n=i[0],s=i[3],a=i[6],o=i[1],u=i[4],h=i[7];return i[0]=e*n+r*o,i[3]=e*s+r*u,i[6]=e*a+r*h,i[1]=-r*n+e*o,i[4]=-r*s+e*u,i[7]=-r*a+e*h,this},e.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[8],this},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 r=t.elements,i=e.elements,n=this.elements,s=r[0],a=r[3],o=r[6],u=r[1],h=r[4],c=r[7],l=r[2],f=r[5],p=r[8],d=i[0],m=i[3],v=i[6],y=i[1],g=i[4],x=i[7],b=i[2],T=i[5],E=i[8];return n[0]=s*d+a*y+o*b,n[3]=s*m+a*g+o*T,n[6]=s*v+a*x+o*E,n[1]=u*d+h*y+c*b,n[4]=u*m+h*g+c*T,n[7]=u*v+h*x+c*E,n[2]=l*d+f*y+p*b,n[5]=l*m+f*g+p*T,n[8]=l*v+f*x+p*E,this},e.determinant=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],s=t[4],a=t[7],o=t[2],u=t[5],h=t[8];return e*(s*h-u*a)+n*(u*i-r*h)+o*(r*a-s*i)},e.invert=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],s=t[4],a=t[7],o=t[2],u=t[5],h=t[8],c=h*s-u*a,l=u*i-h*r,f=a*r-s*i,p=e*c+n*l+o*f;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var d=1/p;return t[0]=c*d,t[1]=(o*a-h*n)*d,t[2]=(u*n-o*s)*d,t[3]=l*d,t[4]=(h*e-o*i)*d,t[5]=(o*r-u*e)*d,t[6]=f*d,t[7]=(n*i-a*e)*d,t[8]=(s*e-n*r)*d,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 r=t.x,i=t.y,n=t.z,s=this.elements,a=null!=e?e:t;return a.x=s[0]*r+s[3]*i+s[6]*n,a.y=s[1]*r+s[4]*i+s[7]*n,a.z=s[2]*r+s[5]*i+s[8]*n,a},e.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},e.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!be(e[i],r[i]))return!1;return!0},e.toArray=function(){return[].concat(this.elements)},e.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,r,i){return(new t).setFromColumnVectors(e,r,i)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,r,i,n,s,a,o,u,h){return new t(e,n,o,r,s,u,i,a,h)},t}(),Yr=function(){function t(t,e){void 0===t&&(t=Ae.ZERO),void 0===e&&(e=Ae.X),this.origin=new Ae,this.direction=new Ae,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 r=e||new Ae;return r.copyFrom(this.origin),r.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 r,i,n,s,a,o,u=this.origin,h=u.x,c=u.y,l=u.z,f=this.direction,p=f.x,d=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,A=1/p,C=1/d,S=1/m;if(A>=0?(r=(y-h)*A,i=(T-h)*A):(r=(T-h)*A,i=(y-h)*A),C>=0?(n=(g-c)*C,s=(E-c)*C):(n=(E-c)*C,s=(g-c)*C),!(r>s||n>i||((n>r||r!=r)&&(r=n),(s<i||i!=i)&&(i=s),(n>r||r!=r)&&(r=n),(s<i||i!=i)&&(i=s),S>=0?(a=(x-l)*S,o=(_-l)*S):(a=(_-l)*S,o=(x-l)*S),r>o||a>i||((a>r||r!=r)&&(r=a),(o<i||i!=i)&&(i=o),i<0))))return r>=0?this.at(r,e):this.at(i,e)},e.intersectPlane=function(t,e){var r=t.normal,i=t.distance,n=r.dot(this.direction);if(0===n)return 0===r.dot(this.origin)+i?(e||new Ae).copyFrom(this.origin):void 0;var s=-(this.origin.dot(r)+i)/n;return s>=0?this.at(s,e):void 0},e.intersectSphere=function(e,r){var i=e.center,n=t.tempVec0.subtractVectors(i,this.origin),s=n.dot(this.direction),a=n.dot(n)-s*s,o=e.radius*e.radius;if(!(a>o)){var u=Math.sqrt(o-a),h=s-u,c=s+u;if(!(c<0))return h>=0?this.at(h,r):this.at(c,r)}},e.intersectTriangle=function(e,r,i){var n,s=e.p0,a=e.p1,o=e.p2,u=t.tempVec0.subtractVectors(a,s),h=t.tempVec1.subtractVectors(o,s),c=t.tempVec2.subtractVectors(this.origin,s),l=t.tempVec3.crossVectors(u,h),f=this.direction.dot(l);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}h.crossVectors(c,h);var p=n*this.direction.dot(h);if(!(p<0)){u.cross(c);var d=n*this.direction.dot(u);if(!(d<0||p+d>f)){var m=-n*c.dot(l);if(!(m<0))return this.at(m/f,r)}}},t}();Yr.tempVec0=new Ae,Yr.tempVec1=new Ae,Yr.tempVec2=new Ae,Yr.tempVec3=new Ae;var Zr=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}var e=t.prototype;return e.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,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 r,i,n,s;return void 0===e&&(e=0),this.r=null!=(r=t[e])?r:0,this.g=null!=(i=t[e+1])?i:0,this.b=null!=(n=t[e+2])?n:0,this.a=null!=(s=t[e+3])?s:0,this},e.setFromHSV=function(t,e,r,i){void 0===i&&(i=1);var n=r*e,s=t/60,a=n*(1-Math.abs(s%2-1)),o=0,u=0,h=0;s>=0&&s<=1?(o=n,u=a):s>=1&&s<=2?(o=a,u=n):s>=2&&s<=3?(u=n,h=a):s>=3&&s<=4?(u=a,h=n):s>=4&&s<=5?(o=a,h=n):s>=5&&s<=6&&(o=n,h=a);var c=r-n;return this.set(o+c,u+c,h+c,i)},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,r=parseInt(t.substring(3,5),16)/255,i=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,i,n)},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):a(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):a(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):a(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):a(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 Ce(this.r,this.g,this.b,this.a)},e.toHSV=function(){var e=this,r=e.r,i=e.g,n=e.b,s=e.a,a=Math.max(r,i,n),o=Math.min(r,i,n),u=a-o,h=0,c=0;return 0!==a&&(c=u/a),a!=o&&(a==r?(h=(i-n)/u,i<n&&(h+=6)):a==i?h=(n-r)/u+2:a==n&&(h=(r-i)/u+4),h*=60),new t(h,c,a,s)},e.toHexString=function(e){void 0===e&&(e=!0);var r=t.ToHex(Math.round(255*this.r)),i=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),s=t.ToHex(Math.round(255*this.a));return e?"#"+r+i+n+s:"#"+r+i+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,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,r,i,n){return void 0===n&&(n=1),(new t).setFromHSV(e,r,i,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t}();Zr.BLACK=new Zr(0,0,0,1),Zr.BLUE=new Zr(0,0,1,1),Zr.CLEAR=new Zr(0,0,0,0),Zr.CYAN=new Zr(0,1,1,1),Zr.GRAY=new Zr(.5,.5,.5,1),Zr.GREEN=new Zr(0,1,0,1),Zr.MAGENTA=new Zr(1,0,1,1),Zr.RED=new Zr(1,0,0,1),Zr.WHITE=new Zr(1,1,1,1),Zr.YELLOW=new Zr(1,.92,.016,1);var qr,Kr,Qr=function(){function t(t,e){void 0===t&&(t=new Ae(1/0,1/0,1/0)),void 0===e&&(e=new Ae(-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),r=Number(1/0),i=Number(1/0),n=-1/0,s=-1/0,a=-1/0,o=0,u=t.length;o<u;o+=3){var h=t[o],c=t[o+1],l=t[o+2];h<e&&(e=h),c<r&&(r=c),l<i&&(i=l),h>n&&(n=h),c>s&&(s=c),l>a&&(a=l)}return this.min.set(e,r,i),this.max.set(n,s,a),this},e.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},e.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),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 Ae),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 Ae),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 r=e.geometry;if(void 0!==r){null===r.boundingBox&&r.computeBoundingBox();var i=new t;i.copyFrom(r.boundingBox),i.applyMatrix4(e.matrixWorld),this.union(i)}for(var n=e.children,s=0,a=n.length;s<a;s++)this.expandByObject(n[s]);return this},e.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},e.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},e.getParameter=function(t,e){return void 0===e&&(e=new Ae),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 Ae;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 Ae),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 Ae),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},e.getOBBPoints=function(t,e){if(void 0===e&&(e=new Ae),this.isEmpty())return[];var r=[];return r[0]=new Ae(this.min.x,this.min.y,this.min.z),r[1]=new Ae(this.min.x,this.min.y,this.max.z),r[2]=new Ae(this.min.x,this.max.y,this.min.z),r[3]=new Ae(this.min.x,this.max.y,this.max.z),r[4]=new Ae(this.max.x,this.min.y,this.min.z),r[5]=new Ae(this.max.x,this.min.y,this.max.z),r[6]=new Ae(this.max.x,this.max.y,this.min.z),r[7]=new Ae(this.max.x,this.max.y,this.max.z),r.forEach((function(r){r.subtract(e),r.applyMatrix(t),r.add(e)})),r},e.getBoundingSphere=function(t){this.getCenter(t.center);var e=new Ae;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}(),Jr=function(){function t(t,e){void 0===t&&(t=Ae.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 r=this.center;if(void 0!==e){r.copyFrom(e);for(var i=0,n=0;n<t.length;n++)i=Math.max(i,r.distanceSquared(t[n]));this.radius=Math.sqrt(i)}else{var s=(new Qr).setFromPoints(t);s.getCenter(r),this.radius=s.getSize().length()/2}return this},e.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},e.isEmpty=function(){return this.radius<0},e.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},e.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},e.distanceToPoint=function(t){return t.distance(this.center)-this.radius},e.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},e.intersectsBox=function(t){return t.intersectsSphere(this)},e.clampPoint=function(t,e){var r=this.center.distanceSquared(t);return void 0===e&&(e=new Ae),e.copyFrom(t),r>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 Qr),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},e.applyMatrix4=function(t){var e=t.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10],s=Math.sqrt(Math.max(r,i,n));return this.center.applyMatrix(t),this.radius=this.radius*s,this},e.translate=function(t){return this.center.add(t),this},e.expandByPoint=function(t){var e=(new Ae).subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=.5*(i-this.radius);this.center.add(e.multiply(n/i)),this.radius+=n}return this},e.union=function(t){var e=new Ae,r=new Ae;return r.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(r)),this.expandByPoint(e.copyFrom(t.center).subtract(r)),this},e.intersect=function(t){var e=(new Ae).subtractVectors(this.center,t.center),r=e.length();return r>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(r/2)),this.radius=this.radius+t.radius-r,this)},e.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},e.clone=function(){return(new t).copyFrom(this)},t}(),$r=Object.freeze({__proto__:null,get EulerOrder(){return Vr},Euler:Hr,Quaternion:Re,Vector2:_e,Vector3:Ae,Vector4:Ce,Matrix3:Wr,Matrix4:Pe,Ray:Yr,PI2:ve,DEG2RAD:ye,RAD2DEG:ge,NumberEpsilon:xe,isZero:function(t){return isNaN(t)||Math.abs(t)<xe},isEqual:be,damp:function(t,e,r,i){return Te(t,e,1-Math.exp(-r*i))},lerp:Te,degToRad:function(t){return t*ye},radToDeg:function(t){return t*ge},clamp:Ee,Color:Zr,Box3:Qr,Sphere:Jr}),ti=1,ei=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).destroyed=!1,i.visible=!0,r){var n=r.material,s=r.geometry,a=r.name,o=void 0===a?"<unnamed>":a,u=r.priority,h=void 0===u?0:u,c=r.worldMatrix,l=void 0===c?Pe.fromIdentity():c;i.id="Mesh"+ti++,i.name=o,i.geometry=s,i.material=n,i.priority=h,i.worldMatrix=l}else i.id="Mesh"+ti++,i.name="<unnamed>",i.worldMatrix=Pe.fromIdentity(),i._priority=0;return i}_t(e,t);var r=e.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.render=function(t){this.isDestroyed||this.getVisible()&&(t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),t.drawGeometry(this.geometry,this.material))},r.firstGeometry=function(){return this.geometry},r.setMaterial=function(t,e){e!==exports.DestroyOptions.keep&&this.material.dispose(e),this.material=t},r.restore=function(){},r.dispose=function(t){if(!this.destroyed){(null==t?void 0:t.geometries)!==exports.DestroyOptions.keep&&this.geometry.dispose();var e=null==t?void 0:t.material;e!==exports.DestroyOptions.keep&&this.material.dispose(e),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},se(e,[{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(me),ri=1e3;exports.RenderPassAttachmentStorageType=void 0,(qr=exports.RenderPassAttachmentStorageType||(exports.RenderPassAttachmentStorageType={}))[qr.none=0]="none",qr[qr.color=1]="color",qr[qr.stencil_8_opaque=2]="stencil_8_opaque",qr[qr.depth_16_opaque=3]="depth_16_opaque",qr[qr.depth_stencil_opaque=4]="depth_stencil_opaque",qr[qr.depth_16_texture=5]="depth_16_texture",qr[qr.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",exports.TextureStoreAction=void 0,(Kr=exports.TextureStoreAction||(exports.TextureStoreAction={}))[Kr.store=0]="store",Kr[Kr.clear=2]="clear";var ii,ni=function(){function t(t,e){if(this.destroyed=!1,e){var r=e.texture,i=e.size;if(a(r,ur))this.texture=r,this.externalTexture=!0;else if(r){var n=r.wrapT,s=r.wrapS,o=r.minFilter,u=r.magFilter,h=r.internalFormat,c=r.format,l=void 0===c?rr.RGBA:c,f=r.type,p=void 0===f?rr.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:i,format:l,type:p,internalFormat:h||l,wrapT:n,wrapS:s,minFilter:o,magFilter:u,name:e.name},this.texture=ur.create(t,Ie({},this.textureOptions,{sourceType:exports.TextureSourceType.framebuffer,data:{width:i[0],height:i[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},se(t,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"storageType",get:function(){return 1}},{key:"size",get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]}},{key:"width",get:function(){return this.texture.getWidth()||0}},{key:"height",get:function(){return this.texture.getHeight()||0}}]),t}();exports.RenderPassDestroyAttachmentType=void 0,(ii=exports.RenderPassDestroyAttachmentType||(exports.RenderPassDestroyAttachmentType={}))[ii.force=0]="force",ii[ii.keep=1]="keep",ii[ii.keepExternal=2]="keepExternal",ii[ii.destroy=0]="destroy";var si=1,ai=function(){function t(t,e){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=e.name,i=void 0===r?"RenderPass_"+si++:r,n=e.clearAction,s=e.semantics,a=e.depthStencilAttachment,o=e.storeAction,u=e.priority,h=void 0===u?0:u,c=e.meshOrder,l=void 0===c?exports.OrderType.ascending:c,f=e.meshes,p=void 0===f?[]:f,d=e.delegate,m=void 0===d?{}:d;this.name=i,this.renderer=t,this.priority=h,this.meshOrder=l,this.meshes=L(p.slice(),this.meshOrder),this.depthStencilType=(null==a?void 0:a.storageType)||0,this.clearAction=Ie({},n),this.storeAction=Ie({colorAction:0,depthAction:0,stencilAction:0},o),this.semantics=new Br(s),this.options=e,this.delegate=m,this.setViewportOptions(e)}var e=t.prototype;return e.addMesh=function(t){F(this.meshes,t,this.meshOrder)},e.removeMesh=function(t){g(this.meshes,t)},e.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,[].concat([0,0],t)),L(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(),r=e[0],i=e[1],n=e[2],s=e[3];t.setViewport(r,i,n,s)}},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 r=t.map((function(t){return t.updateSource({sourceType:exports.TextureSourceType.framebuffer}),new ni(e.renderer.engine,{texture:t})}));this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments=r,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,r=this,i=this.renderer,n=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null==(e=this.framebuffer)||e.dispose({depthStencilAttachment:2}),this.framebuffer=null);var s=this.viewportScale,a=this.isCustomViewport?this.customViewport:[0,0,i.getWidth()*s,i.getHeight()*s],o=[a[2],a[3]],u=this.name;if(null==(t=n.attachments)?void 0:t.length){var h=n.attachments.map((function(t,e){var i;return new ni(r.renderer.engine,Ie({size:o,name:(null==(i=t.texture)?void 0:i.name)||u+"##color_"+e},t))}));this.attachments=h;var c=Bi.create({storeAction:this.storeAction,name:u,viewport:a,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:h.map((function(t){return t.texture})),depthStencilAttachment:n.depthStencilAttachment||{storageType:0}},i);c.bind(),c.unbind(),this.framebuffer=c}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 r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},e.getDepthAttachment=function(){var t=this.framebuffer;if(t){var e=t.getDepthTexture(),r=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:r}}},e.getStencilAttachment=function(){var t=this.framebuffer;if(t){var e=t.getStencilTexture(),r=e?this.getDepthTexture(e,t.externalStorage):void 0;return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:r}}},e.getDepthTexture=function(t,e){if(!this.depthTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},e.getStencilTexture=function(t,e){if(!this.stencilTexture){var r,i=null==(r=this.options.depthStencilAttachment)?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},e.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.dispose=function(t){if(!this.destroyed){var e=(null==t?void 0:t.meshes)||void 0;e!==exports.DestroyOptions.keep&&this.meshes.forEach((function(t){t.dispose(e)})),this.meshes.length=0;var r=(null==t?void 0:t.colorAttachment)?t.colorAttachment:0;this.attachments.forEach((function(t){t.externalTexture&&2===r||1===r||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var i,n,s=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:0,a=this.framebuffer;if(a)if(a.dispose({depthStencilAttachment:s}),!(a.externalStorage&&2===s||1===s))null==(i=this.stencilTexture)||i.dispose(),null==(n=this.depthTexture)||n.dispose();this.options=this.renderer=null,this.initialize=Q}},se(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}(),oi="#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);}",ui="precision highp float;attribute vec2 atlasOffset;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(atlasOffset.xy*_TexOffset.zw+_TexOffset.xy);vColor=_Color;vParams=vec3(0.0,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}",hi="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(vParams.z==0.&&color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",ci="#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",li="#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}}",fi="#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}",pi="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",di="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);}",mi="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);}",vi="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);}",yi="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);}",gi="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);}",xi={},bi=function(){function t(){}return t.registerInclude=function(t,e){xi[t]&&j.warn('The "'+t+'" shader include already exist.'),xi[t]=e},t.unRegisterInclude=function(t){delete xi[t]},t.unRegisterAllIncludes=function(){Object.keys(xi).forEach((function(e){t.unRegisterInclude(e)}))},t.genFinalShaderCode=function(e){var r=e.level,i=e.shaderType,n=e.shader,s=e.macros,a=e.removeVersion,o=t.genMacroString(r,s),u=t.genShaderVersion(r),h=t.parseIncludes(n),c=t.isVersion300(h);return h=t.removeWebGLVersion(h),2!==r||c||(h=t.convertTo300(h,i===exports.ShaderType.fragment)),a?o+h:u+o+h},t.convertTo300=function(e,r){if(e=(e=(e=e.replace(/\bvarying\b/g,r?"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,""),r){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 i=(e=e.replace(/\bgl_FragColor\b/g,"gl_FragData[0]")).match(/\bgl_FragData\[.+?\]/g);i&&(e=t.replaceMRTShader(e,i))}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 r;for(void 0===e&&(e=/#include <(.+)>/gm);null!==(r=e.exec(t));){var i=r[1],n=xi[i];if(void 0===n)throw new Error("Can't find include shader name "+i);t=t.replace(r[0],n)}return t},t.genMacroString=function(t,e,r){void 0===r&&(r=!0);var i=[],n="WEBGL"+t;return i.push("#ifndef "+n),i.push("#define "+n),i.push("#endif"),r&&i.push("#define GE_RUNTIME"),e&&e.length&&e.forEach((function(t){var e=t[0],r=t[1];!0===r?i.push("#define "+e):Number.isFinite(r)&&i.push("#define "+e+" "+r)})),i.length?i.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 r=new Set,i="",n=0;n<e.length;n++){var s=e[n].match(/\bgl_FragData\[(.+?)\]/);s&&r.add(s[1])}return r.forEach((function(t){i+="layout(location="+t+") out vec4 fragOutColor"+t+";\n"})),i+="void main(",t=(t=t.replace(/\bgl_FragData\[(.+?)\]/g,"fragOutColor$1")).replace(/void\s+?main\s*\(/g,i)},t}(),Ti=function(t){function e(e,r){var i,n=(i=t.call(this,e,r)||this).renderer.engine,s=jr.create(n,{mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=Nr.create(n,{shader:{vertex:pi,fragment:gi,glslVersion:exports.GLSLVersion.GLSL1}});return a.blending=!1,a.depthTest=!1,a.culling=!1,i.screenMesh=ei.create(n,{geometry:s,material:a,priority:0}),i.priority=5e3,i}_t(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFramebuffer(this.framebuffer)},r.execute=function(t){var e,r,i;t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var n=null!=(i=null==(r=t.renderingData.currentFrame.globalVolume)||null==(e=r.bloom)?void 0:e.threshold)?i:1;this.screenMesh.material.setFloat("_Threshold",n),t.renderMeshes([this.screenMesh])},e}(ai),Ei=function(t){function e(e,r,i){var n;(n=t.call(this,e,i)||this).type=r;var s=n.renderer.engine,a="PostProcess",o=jr.create(s,{name:a,mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u={vertex:pi,fragment:"H"==r?mi:vi,glslVersion:exports.GLSLVersion.GLSL1},h=Nr.create(s,{name:a,shader:u});return h.blending=!1,h.depthTest=!1,h.culling=!1,n.screenMesh=ei.create(s,{name:a,geometry:o,material:h,priority:0}),n.priority=5e3,n}_t(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",Ri(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFramebuffer().getColorTextures()[0])},e}(ai),_i=function(t){function e(e,r){var i,n="PostProcess",s=(i=t.call(this,e,r)||this).renderer.engine,a=jr.create(s,{name:n,mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o={vertex:pi,fragment:yi},u=Nr.create(s,{name:n,shader:o});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=ei.create(s,{name:n,geometry:a,material:u,priority:0}),i.priority=5e3,i}_t(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],t.setFramebuffer(this.framebuffer)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",Ri(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},e}(ai),Ai=function(t){function e(e,r){var i,n="PostProcess",s=(i=t.call(this,e,{})||this).renderer.engine;i.sceneTextureHandle=r||new ni(s);var a=jr.create(s,{name:n,mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=Nr.create(s,{name:n,shader:{vertex:pi,fragment:di,glslVersion:exports.GLSLVersion.GLSL1}});return o.blending=!1,o.depthTest=!1,o.culling=!1,i.screenMesh=ei.create(s,{name:n,geometry:a,material:o,priority:0}),i.priority=5e3,i}_t(e,t);var r=e.prototype;return r.configure=function(t){this.mainTexture=t.getFramebuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFramebuffer(null)},r.execute=function(t){t.clear({colorAction:exports.TextureStoreAction.clear,depthAction:exports.TextureStoreAction.clear,stencilAction:exports.TextureStoreAction.clear});var e=t.renderingData.currentFrame.globalVolume,r=Ie({threshold:0,intensity:0,active:!1},null==e?void 0:e.bloom),i=Ie({intensity:0,smoothness:0,roundness:0,active:!1},null==e?void 0:e.vignette),n=Ie({brightness:0,saturation:0,contrast:0,active:!1},null==e?void 0:e.colorAdjustments),s=Ie({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(r.active)),r.active&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r.intensity)),i.intensity>0&&(this.screenMesh.material.setFloat("_VignetteIntensity",i.intensity),this.screenMesh.material.setFloat("_VignetteSmoothness",i.smoothness),this.screenMesh.material.setFloat("_VignetteRoundness",i.roundness),this.screenMesh.material.setVector2("_VignetteCenter",new _e(.5,.5)),this.screenMesh.material.setVector3("_VignetteColor",new Ae(0,0,0))),this.screenMesh.material.setInt("_UseToneMapping",Number(s.active)),t.renderMeshes([this.screenMesh])},e}(ai),Ci="_effects_default_",Si=1,wi=function(){function t(t){var e;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var r=t.camera,i=t.keepColorBuffer,n=t.renderer,s=t.editorTransform,a=void 0===s?[1,1,0,0]:s,o=t.globalVolume,u=t.postProcessingEnabled,h=void 0!==u&&u,c=t.clearAction,l=void 0===c?{colorAction:exports.TextureLoadAction.whatever,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.whatever}:c,f=n.engine;o&&(this.globalVolume=o),this.globalUniforms=new Li;var p,d=[],m={};if(this.renderer=n,h){if(!this.renderer.engine.gpuCapability.detail.halfFloatTexture)throw new Error("Half float texture is not supported.");var v=rr.HALF_FLOAT;d=[{texture:{format:rr.RGBA,type:v,magFilter:rr.LINEAR,minFilter:rr.LINEAR}}],p={storageType:exports.RenderPassAttachmentStorageType.depth_stencil_opaque},m={colorAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,depthAction:exports.TextureLoadAction.clear}}this.drawObjectPass=new ai(n,{name:Ci,priority:ri,meshOrder:exports.OrderType.ascending,depthStencilAttachment:p,attachments:d,clearAction:m});var y=[this.drawObjectPass];if(this.setRenderPasses(y),h){var g=new ni(f),x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],b=new Array(7),T=rr.HALF_FLOAT,E=new Ti(n,{name:"BloomThresholdPass",attachments:[{texture:{format:rr.RGBA,type:T,minFilter:rr.LINEAR,magFilter:rr.LINEAR}}]});E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){b[_]=new ni(f);var A=new Ei(n,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:rr.RGBA,type:T,minFilter:rr.LINEAR,magFilter:rr.LINEAR}}]}),C=new Ei(n,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:rr.RGBA,type:T,minFilter:rr.LINEAR,magFilter:rr.LINEAR}}]});C.gaussianResult=b[_],this.addRenderPass(A),this.addRenderPass(C),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(var S=0;S<6;S++){var w=new _i(n,{name:"GaussianUpPass"+S,viewport:x,attachments:[{texture:{format:rr.RGBA,type:T,minFilter:rr.LINEAR,magFilter:rr.LINEAR}}]});w.gaussianDownSampleResult=b[5-S],this.addRenderPass(w),x[2]*=2,x[3]*=2}var R=new Ai(n,g);this.addRenderPass(R)}this.semantics=new Br(t.semantics),this.clearAction=l,this.name="RenderFrame"+Si++;var O=y[0];this.emptyTexture=lr(f),this.transparentTexture=fr(f),this.camera=r,this.keepColorBuffer=i,this.renderPassInfoMap.set(O,{listStart:0,listEnd:0,renderPass:O,intermedia:!1}),this.editorTransform=Ce.fromArray(a),t.clearAction||this.resetClearActions(),this.passTextureCache=new Ur(f);var M=f.gpuCapability,P=M.detail,I=Sr(M.level,P.readableDepthStencilTextures&&P.writableFragDepth);null==(e=this.renderer.getShaderLibrary())||e.addShader(I)}var e=t.prototype;return e.addMeshToDefaultRenderPass=function(t){this.drawObjectPass.addMesh(t)},e.removeMeshFromDefaultRenderPass=function(t){this.drawObjectPass.removeMesh(t)},e.dispose=function(t){(null==t?void 0:t.semantics)!==exports.DestroyOptions.keep&&this.semantics.dispose();var e,r,i=(null==t?void 0:t.passes)?t.passes:void 0;(i!==exports.DestroyOptions.keep&&this._renderPasses.forEach((function(t){t.dispose(i)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource)&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null==(r=this.resource.depthStencil)||null==(e=r.texture)||e.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null);this.destroyed=!0},e.resetRenderPassDefaultAttachment=function(t,e){for(var r,i=this.resource,n=i.color_a,s=i.color_b,a=e;a<t.length;a++){var o,u,h=t[a],c=null==(o=h.attachments[0])?void 0:o.texture;if(c&&r===c){var l=c===n?s:n;h.resetColorAttachments([l])}(c=null==(u=h.attachments[0])?void 0:u.texture)&&(r=c)}},e.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(Ci)||!r.meshes.includes(t)||(e=i,!1)})),e},e.addToRenderPass=function(t,e){var r=this.renderPassInfoMap.get(t),i=e.priority;r&&(0===t.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),t.addMesh(e))},e.getRPAttachments=function(t,e){if(1===(null==t?void 0:t.length)){var r,i=t[0],n=i.texture,s=i.persistent,a=n.format,o=null!=(r=null==e?void 0:e.getInitAttachments())?r:[];if(a===rr.RGBA&&!s){var u=this.resource.color_a;return 0===o.length?[{texture:u}]:[{texture:o[0].texture===u?this.resource.color_b:u}]}}return t},e.resetClearActions=function(){var t=this.renderPasses.length>1?exports.TextureLoadAction.clear:exports.TextureLoadAction.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=exports.TextureLoadAction.whatever)},e.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.createResource=function(){var t=this.renderer.engine;if(!this.resource){var e,r=t.gpuCapability,i=r.detail,n=r.level,s=this.renderer.getWidth(),a=this.renderer.getHeight(),o=2===n?rr.LINEAR:rr.NEAREST,u=ur.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:rr.RGBA,name:"frame_a",minFilter:o,magFilter:o}),h=ur.create(t,{sourceType:exports.TextureSourceType.framebuffer,format:rr.RGBA,data:{width:s,height:a},minFilter:o,magFilter:o,name:"frame_b"}),c=i.readableDepthStencilTextures&&i.writableFragDepth?exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:exports.RenderPassAttachmentStorageType.depth_stencil_opaque,l=new ai(this.renderer,{depthStencilAttachment:{storageType:c},attachments:[{texture:u}]}).initialize(this.renderer),f=new Ii(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:exports.TextureLoadAction.clear,stencilAction:exports.TextureLoadAction.clear,colorAction:exports.TextureLoadAction.clear},meshOrder:exports.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null==(e=l.getDepthAttachment())?void 0:e.texture})]});this.resource={color_a:l.attachments[0].texture,color_b:h,finalCopyRP:f,depthStencil:l.depthAttachment,resRP:l}}},e.createCopyMesh=function(t){var e,r=Er,i=this.renderer.engine,n=jr.create(i,{name:r,mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=Sr(i.gpuCapability.level,!!(null==t?void 0:t.depthTexture));null==(e=this.renderer.getShaderLibrary())||e.addShader(s);var a=Nr.create(i,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:r,shader:s});return a.blending=!1,a.depthTest=!1,a.culling=!1,(null==t?void 0:t.blend)&&(a.blending=!0,a.blendFunction=[rr.SRC_ALPHA,rr.ONE_MINUS_SRC_ALPHA,rr.SRC_ALPHA,rr.ONE_MINUS_SRC_ALPHA]),ei.create(i,{name:r,geometry:n,material:a,priority:0})},e.removeRenderPass=function(t){g(this._renderPasses,t)},se(t,[{key:"renderPasses",get:function(){return this._renderPasses.slice()}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}();function Ri(t){return t?new _e(t.getWidth(),t.getHeight()):new _e}var Oi,Mi,Pi,Ii=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.configure=function(t){var e=t.getFramebuffer();e&&(this.prePassTexture=e.getColorTextures()[0]),t.setFramebuffer(null)},r.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Ri(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(ai),Li=function(){this.floats={},this.ints={},this.vector3s={},this.vector4s={},this.matrices={},this.samplers=[],this.uniforms=[]},Fi=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,r=t.format,i=t.attachment;this.storageType=e,this.format=r,this.attachment=i}return se(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Vi="function"==typeof e.WebGL2RenderingContext,Di=function(){function t(t){this.setupCapability(t)}var r=t.prototype;return r.setupCapability=function(t){var r,i=Vi&&a(t,e.WebGL2RenderingContext)?2:1,n=2===i,s=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),u=!!t.getExtension("OES_texture_half_float_linear"),h=!!t.getExtension("OES_texture_float_linear");this.level=i,this.type=n?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),n&&!u&&(u=Ni(t,t.HALF_FLOAT)),n&&!h&&(h=Ni(t,t.FLOAT)),this.internalFormatDepth16=n?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=n?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var c=n||t.getExtension("OES_texture_float")?t.FLOAT:0,l=n?e.WebGL2RenderingContext.HALF_FLOAT:(null==(r=t.getExtension("OES_texture_half_float"))?void 0:r.HALF_FLOAT_OES)||0,f={floatTexture:c,halfFloatTexture:l,maxSample:n?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:n?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:n?!!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:ki(t),halfFloatLinear:u,floatLinear:h,maxTextureAnisotropy:s?t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:n||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:n||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:n||!!this.drawBufferExtension,asyncShaderCompile:!!this.glAsyncCompileExt,intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:n||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:n||!!o,writableFragDepth:n||!!t.getExtension("EXT_frag_depth")};this.detail=f,s&&(this.textureMaxAnisotropyExt=s.TEXTURE_MAX_ANISOTROPY_EXT)},r.framebufferTexture2D=function(t,e,r,i,n){var s=this.drawBufferExtension;if(1===this.level&&!s&&r>0)throw new Error("Draw multiple color buffers not available.");var a=s?s["COLOR_ATTACHMENT"+r+"_WEBGL"]:t["COLOR_ATTACHMENT"+r];a?t.framebufferTexture2D(e,a,i,n,0):console.error("Invalid color attachment index: "+r+".")},r.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1!==this.level||r){var i=e.map((function(e,i){return e?r?r["COLOR_ATTACHMENT"+i+"_WEBGL"]:t["COLOR_ATTACHMENT"+i]:t.NONE}));r?r.drawBuffersWEBGL(i):t.drawBuffers(i)}else if(e.length>1)throw new Error("Draw buffers not available.")},r.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function Ni(t,e){var r=t.createTexture(),i=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(i=!0),t.deleteTexture(r),i}function ki(t){return t.getExtension("WEBGL_compressed_texture_astc")?2:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?1:0}exports.COMPRESSED_TEXTURE=void 0,(Oi=exports.COMPRESSED_TEXTURE||(exports.COMPRESSED_TEXTURE={}))[Oi.NONE=0]="NONE",Oi[Oi.PVRTC=1]="PVRTC",Oi[Oi.ASTC=2]="ASTC",exports.FilterMode=void 0,(Mi=exports.FilterMode||(exports.FilterMode={}))[Mi.Nearest=0]="Nearest",Mi[Mi.Linear=1]="Linear",exports.RenderTextureFormat=void 0,(Pi=exports.RenderTextureFormat||(exports.RenderTextureFormat={}))[Pi.RGBA32=0]="RGBA32",Pi[Pi.RGBAHalf=1]="RGBAHalf";var zi,Ui,Bi=function(){function t(){}var e=t.prototype;return e.resize=function(t,e,r,i){},e.resetColorTextures=function(t){},e.unbind=function(){},e.bind=function(){},e.getDepthTexture=function(){},e.getStencilTexture=function(){},e.getColorTextures=function(){return[]},e.dispose=function(t){},se(t,[{key:"stencilStorage",get:function(){}},{key:"depthStorage",get:function(){}}]),t}(),Gi=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,r,i){},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,r){},e.getTemporaryRT=function(t,e,r,i,n,s){return null},e.dispose=function(t){},t}(),ji=(zi=new Float32Array(1),Ui=new Int32Array(zi.buffer),function(t){zi[0]=t;var e=Ui[0],r=e>>16&32768,i=e>>12&2047,n=e>>23&255;return n<103?r:n>142?(r|=31744,r|=(255==n?0:1)&&8388607&e):n<113?r|=((i|=2048)>>114-n)+(i>>113-n&1):(r|=n-112<<10|i>>1,r+=1&i)}),Xi=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),r=0;r<e.length;r++)e[r]=ji(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=ji(t[r])},t}();var Hi,Wi=new Hr,Yi=new Pe;function Zi(t,e,r,i,n,s,a){var o=t,u=i/n,h=i,c=e.speedOverLifetime;c&&(h=c.getIntegrateValue(0,i,n));var l=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;o.copyFrom(s),o.addScaledVector(a,h),o.addScaledVector(r,l);var f=e.linearVelOverLifetime||{},p=e.orbitalVelOverLifetime||{};if(p.enabled){var d=new Ae;p.center&&d.setFromArray(p.center);var m=o.clone().subtract(d),v=p.asRotation,y=["x","y","z"].map((function(t){var e=p[t];return e?v?e.getValue(u):e.getIntegrateValue(0,i,n):0}));Wi.setFromArray(y).negate(),Yi.setFromEuler(Wi);var g=Yi.transformPoint(m);o.addVectors(d,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,i,n);o.x=o.x+_}if(T){var A=x?T.getValue(u):T.getIntegrateValue(0,i,n);o.y=o.y+A}if(E){var C=x?E.getValue(u):E.getIntegrateValue(0,i,n);o.z=o.z+C}}return o}function qi(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function Ki(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function Qi(t,e,r){if(e&&r)for(var i=0,n=e.length;i<n;i++)t[i]=e[i]*r[i];else if(e){if(t!==e)for(var s=0;s<e.length;s++)t[s]=e[s]}else if(r&&t!==r)for(var a=0;a<r.length;a++)t[a]=r[a];return t}var Ji=((Hi={})[gt.PARTICLE_ORIGIN_CENTER]=[0,0],Hi[gt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Hi[gt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Hi[gt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Hi[gt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Hi[gt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Hi[gt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Hi[gt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Hi[gt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Hi);function $i(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function tn(t,e,r){var i=r.position,n=new Ae(t,e,0),s=new Ae;return r.getInverseViewProjectionMatrix().projectPoint(n,s),s.subtract(i),new Yr(i,s)}function en(t,e,r){var i=t.x,n=t.y,s=t.z,a=new Ae(i-e,n+r,s),o=new Ae(i-e,n-r,s),u=new Ae(i+e,n-r,s),h=new Ae(i+e,n+r,s);return[{p0:a,p1:o,p2:u},{p0:a.clone(),p1:u.clone(),p2:h}]}function rn(t,e,r){return void 0===r&&(r=1e-6),Math.abs(t-e)<r}function nn(t,e){void 0===e&&(e=2);var r=Math.pow(10,e);return Math.floor(t*r)/r}var sn={pointIndexCache:{xIndex:0,yIndex:0},getPointInCurve:function(t){t[0];var e=t[1],r=this.getPointIndexInCurve(t,this.pointIndexCache),i=r.xIndex,n=r.yIndex,s=e[i],a=e[n];return new _e(s,a)},getPointIndexInCurve:function(t,e){var r=t[0],i=t[2],n=r===St.LINE||r===St.EASE_OUT?0:r===St.EASE_IN||r===St.EASE||r===St.HOLD&&i===St.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 r=t[2];return!(e!==St.HOLD||!this.isKeyframeTypeLeftSideEase(r))||this.isKeyframeTypeLeftSideEase(e)},isRightSideEase:function(t){var e=t[0];t[1];var r=t[2];return!(e!==St.HOLD||!this.isKeyframeTypeRightSideEase(r))||this.isKeyframeTypeRightSideEase(e)},isKeyframeTypeLeftSideEase:function(t){return[St.EASE,St.EASE_IN,St.AUTO].includes(t)},isKeyframeTypeRightSideEase:function(t){return[St.EASE,St.EASE_OUT,St.AUTO].includes(t)},isHoldInKeyframe:function(t){var e=t[0];t[1];var r=t[2];return e===St.HOLD&&[St.HOLD,St.LINE_OUT,St.EASE_OUT].includes(r)},isHoldOutKeyframe:function(t){var e=t[0];t[1];var r=t[2];return e===St.HOLD&&[St.HOLD,St.LINE,St.EASE_IN].includes(r)}},an=function(t,e){this.points=t,this.totalLength=e},on={},un={},hn=.1;function cn(t,e){return 1-3*e+3*t}function ln(t,e){return 3*e-6*t}function fn(t){return 3*t}function pn(t,e,r){return((cn(e,r)*t+ln(e,r))*t+fn(e))*t}function dn(t,e,r){return 3*cn(e,r)*t*t+2*ln(e,r)*t+fn(e)}var mn=function(){function t(t,e,r,i){this.p1=t,this.p2=e,this.p3=r,this.p4=i,this.catching={lastPoint:0,lastAddedLength:0};var n=function(t,e,r,i){var n=nn(e.x-t.x,3)+"_"+nn(e.y-t.y,3)+"_"+nn(e.z-t.z,3)+"&"+nn(r.x-t.x,3)+"_"+nn(r.y-t.y,3)+"_"+nn(r.z-t.z,3)+"&"+nn(i.x-t.x,3)+"_"+nn(i.y-t.y,3)+"_"+nn(i.z-t.z,3);if(un[n])return{data:un[n],interval:t};for(var s=[],a=null,o=0,u=0,h=0;h<300;h+=1){var c=new Ae,l=h/299;u=0,c.x=3*Math.pow(1-l,2)*l*(r.x-t.x)+3*(1-l)*Math.pow(l,2)*(i.x-t.x)+Math.pow(l,3)*(e.x-t.x),c.y=3*Math.pow(1-l,2)*l*(r.y-t.y)+3*(1-l)*Math.pow(l,2)*(i.y-t.y)+Math.pow(l,3)*(e.y-t.y),c.z=3*Math.pow(1-l,2)*l*(r.z-t.z)+3*(1-l)*Math.pow(l,2)*(i.z-t.z)+Math.pow(l,3)*(e.z-t.z),null!==a&&(u+=Math.pow(c.x-a.x,2),u+=Math.pow(c.y-a.y,2),u+=Math.pow(c.z-a.z,2)),a=c,o+=u=Math.sqrt(u),s[h]={partialLength:u,point:c}}var f=new an(s,o);return un[n]=f,{data:f,interval:new Ae(t.x,t.y,t.z)}}(t,e,r,i),s=n.data,a=n.interval;this.lengthData=s,this.interval=a,this.totalLength=s.totalLength}return t.prototype.getPointInPercent=function(t){var e=this.lengthData;if(0===t)return e.points[0].point.clone().add(this.interval);if(rn(1-t,0))return e.points[299].point.clone().add(this.interval);if(rn(e.totalLength,0))return this.p1.clone();var r=new Ae,i=nn(e.totalLength*t,4),n=this.catching.lastAddedLength,s=this.catching.lastPoint;if(rn(n,i))return e.points[s].point.clone().add(this.interval);var a=!0,o=1;for(i<n&&(o=-1);a;){if(i>=n){if(299===s){r.x=e.points[s].point.x,r.y=e.points[s].point.y,r.z=e.points[s].point.z;break}if(i<n+e.points[s+1].partialLength){var u=(i-n)/e.points[s+1].partialLength;r.x=e.points[s].point.x+(e.points[s+1].point.x-e.points[s].point.x)*u,r.y=e.points[s].point.y+(e.points[s+1].point.y-e.points[s].point.y)*u,r.z=e.points[s].point.z+(e.points[s+1].point.z-e.points[s].point.z)*u;break}}o>0&&s<299?(s+=o,n+=nn(e.points[s].partialLength,5)):o<0&&s>0?(n-=nn(e.points[s].partialLength,5),s+=o):a=!1}return this.catching.lastPoint=s,this.catching.lastAddedLength=n,r.add(this.interval),r},t}(),vn=function(){function t(t,e,r,i){this.p1=t,this.p2=e,this.p3=r,this.p4=i,this.temp=new Re,this.totalLength=0}return t.prototype.getPointInPercent=function(t){return 0===t?this.temp.copyFrom(this.p1):rn(1-t,0)?this.temp.copyFrom(this.p2):(xn.slerpFlat(this.temp,this.p1,this.p2,t),this.temp)},t}(),yn=function(){function t(t,e,r,i){this.mX1=t,this.mY1=e,this.mX2=r,this.mY2=i,this.precomputed=!1,this.mSampleValues=new Array(11)}var e=t.prototype;return e.precompute=function(){this.precomputed=!0,this.mX1===this.mY1&&this.mX2===this.mY2||this.calcSampleValues()},e.getValue=function(t){return this.mX1===this.mY1&&this.mX2===this.mY2?t:isNaN(this.mY1)||isNaN(this.mY2)?0:0===t||1===t?t:(this.precomputed||this.precompute(),pn(this.getTForX(t),this.mY1,this.mY2))},e.calcSampleValues=function(){for(var t=0;t<11;++t)this.mSampleValues[t]=pn(t*hn,this.mX1,this.mX2)},e.getTForX=function(t){for(var e=this.mSampleValues,r=0,i=1;10!==i&&e[i]<=t;++i)r+=hn;var n=r+(t-e[--i])/(e[i+1]-e[i])*hn,s=dn(n,this.mX1,this.mX2);return s>=.001?function(t,e,r,i){for(var n=0;n<4;++n){var s=dn(e,r,i);if(0===s)return e;e-=(pn(e,r,i)-t)/s}return e}(t,n,this.mX1,this.mX2):0===s?n:function(t,e,r,i,n){var s,a,o=0;do{(s=pn(a=e+(r-e)/2,i,n)-t)>0?r=a:e=a}while(Math.abs(s)>1e-7&&++o<10);return a}(t,r,r+hn,this.mX1,this.mX2)},t}();function gn(t,e){var r=function(t,e,r){var i=t[1],n=sn.isHoldOutKeyframe(t),s=sn.isHoldInKeyframe(e),a=!s&&sn.isRightSideEase(t),o=!n&&sn.isLeftSideEase(e);if(a&&!o&&!s){var u=new _e(i[i.length-4],i[i.length-3]),h=new _e(i[i.length-2],i[i.length-1]),c=sn.getPointInCurve(e),l=new _e(c.x,c.y);return{type:"ease",p0:u,p1:h,p2:new _e(l.x-(l.x-u.x)/10,l.y),p3:l}}if(!a&&o&&!n){var f=e[1],p=sn.getPointInCurve(t),d=new _e(p.x,p.y),m=new _e(f[0],f[1]),v=new _e(f[2],f[3]);return{type:"ease",p0:d,p1:new _e(d.x+(v.x-d.x)/10,d.y),p2:m,p3:v}}if(a&&o){var y=e[1];return{type:"ease",p0:new _e(i[i.length-4],i[i.length-3]),p1:new _e(i[i.length-2],i[i.length-1]),p2:new _e(y[0],y[1]),p3:new _e(y[2],y[3])}}var g=sn.getPointInCurve(t),x=sn.getPointInCurve(e);n?x.y=g.y:s&&(g.y=x.y);return r?{type:"ease",p0:g,p1:new _e((x.x-g.x)/3+g.x,(x.y-g.y)/3+g.y),p2:new _e((x.x-g.x)/3*2+g.x,(x.y-g.y)/3*2+g.y),p3:x,isHold:n||s,leftHoldLine:n,rightHoldLine:s}:{type:"line",p0:g,p1:x,isHold:n||s,leftHoldLine:n,rightHoldLine:s}}(t,e,!0),i=r.p0,n=r.p1,s=r.p2,a=r.p3;N(s),N(a);var o,u,h=a.x-i.x,c=a.y-i.y,l=nn((n.x-i.x)/h,5),f=nn((s.x-i.x)/h,5);rn(c,0)?o=u=NaN:(o=nn((n.y-i.y)/c,5),u=nn((s.y-i.y)/c,5)),l<0&&(console.error("Invalid bezier points, x1 < 0",i,n,s,a),l=0),f<0&&(console.error("Invalid bezier points, x2 < 0",i,n,s,a),f=0),l>1&&(console.error("Invalid bezier points, x1 >= 1",i,n,s,a),l=1),f>1&&(console.error("Invalid bezier points, x2 >= 1",i,n,s,a),f=1);var p,d=("bez_"+l+"_"+o+"_"+f+"_"+u).replace(/\./g,"p");return on[d]?p=on[d]:(p=new yn(l,o,f,u),on[d]=p),{points:[i,n,s,a],timeInterval:h,valueInterval:c,curve:p}}var xn=function(){function t(){}return t.slerpFlat=function(t,e,r,i){var n=e.x,s=e.y,a=e.z,o=e.w,u=r.x,h=r.y,c=r.z,l=r.w;if(0===i)return t.x=n,t.y=s,t.z=a,void(t.w=o);if(1===i)return t.x=u,t.y=h,t.z=c,void(t.w=l);if(o!==l||n!==u||s!==h||a!==c){var f=1-i,p=n*u+s*h+a*c+o*l,d=p>=0?1:-1,m=1-p*p;if(m>Number.EPSILON){var v=Math.sqrt(m),y=Math.atan2(v,p*d);f=Math.sin(f*y)/v,i=Math.sin(i*y)/v}var g=i*d;if(n=n*f+u*g,s=s*f+h*g,a=a*f+c*g,o=o*f+l*g,f===1-i){var x=1/Math.sqrt(n*n+s*s+a*a+o*o);n*=x,s*=x,a*=x,o*=x}}t.x=n,t.y=s,t.z=a,t.w=o},t}(),bn="not_implement",Tn=function(){function t(t){this.onCreate(t)}var e=t.prototype;return e.onCreate=function(t){throw new Error(bn)},e.getIntegrateValue=function(t,e,r){throw new Error(bn)},e.getIntegrateByTime=function(t,e){throw new Error(bn)},e.getValue=function(t){throw new Error(bn)},e.getMaxTime=function(){throw new Error(bn)},e.toUniform=function(t){throw new Error(bn)},e.map=function(t){throw new Error(bn)},e.scaleXCoord=function(t){return this},e.toData=function(){throw new Error(bn)},t.getAllData=function(t,e){for(var r=new(e?Xi:Float32Array)(4*t.index),i=0,n=0,s=t.curves;i<s.length;i++){var a=s[i].toData();r.set(a,n),n+=a.length}return e?r.data:r},t}(),En=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.value=t},r.getIntegrateValue=function(t,e,r){return this.value*(e-t)},r.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},r.getValue=function(t){return this.value},r.toUniform=function(){return new Float32Array([0,this.value,0,0])},r.map=function(t){var e=this.value;return this.value=t(e),this},r.getMaxTime=function(){return 0},e}(Tn),_n=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.items=t},r.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},r.map=function(t){return this.items=this.items.map(t),this},e}(Tn),An=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t,e){var r=null!=e?e:Math.random();return this.min+r*(this.max-this.min)},r.getIntegrateValue=function(t,e,r){var i=null!=r?r:1;return(this.min+i*(this.max-this.min))*(e-t)},r.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(Tn),Cn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1]},r.getValue=function(t){for(var e=this.min,r=this.max,i=[],n=0;n<e.length;n++){var s=Math.random();i[n]=e[n]*(1-s)+r[n]*s}return i},r.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(Tn),Sn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},r.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},r.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=this.min,n=this.max,s=this.xCoord*r;return((i+e/s*(n-i)+i)*e-(i+t/s*(n-i)+i)*t)/2},r.getIntegrateByTime=function(t,e){return Fn(e,0,this.xCoord,this.min,this.max)-Fn(t,0,this.xCoord,this.min,this.max)},r.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},r.scaleXCoord=function(t){return this.xCoord=t,this},e}(Tn),wn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.stops=E(t)},r.getStops=function(){return this.stops},r.getValue=function(t){for(var e=this.stops,r=e.length-1,i=0;i<r;i++){var n=e[i],s=e[i+1];if(n.stop<=t&&s.stop>t){var a=(t-n.stop)/(s.stop-n.stop);return _(n.color,s.color,a,!0)}}return e[r].color.slice()},e}(Tn),Rn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},r.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var r=e.length-1,i=0;i<r;i++){var n=e[i],s=e[i+1],a=n[0],o=s[0];if(t>=a&&t<=o){var u=(t-a)/(o-a),h=n[1];return h+u*(s[1]-h)}}return e[r][1]},r.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},r.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},r.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,s=e?Fn:Ln,a=0;a<n;a++){var o=r[a],u=r[a+1],h=o[0],c=u[0];if(t>h&&t<=c)return i+s(t,h,c,o[1],u[1]);i+=s(c,h,c,o[1],u[1])}return i},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),r=0,i=0;r<t.length;r++,i+=2)e.set(t[r],i);return e.set(t[t.length-1],e.length-2),e},r.toUniform=function(t){var e=t.index,r=this.keys,i=Math.ceil(r.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},r.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},r.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(Tn),On=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t;this.curveMap={},this.keys=[];for(var r=0;r<e.length-1;r++){var i=gn(e[r],e[r+1]),n=i.points,s=i.curve,a=i.timeInterval,o=i.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())),this.curveMap[u.x+"&"+h.x]={points:n,timeInterval:a,valueInterval:o,curve:s,timeStart:Number(u.x),timeEnd:Number(h.x)}}this.startKeyframe=e[0],this.endKeyframe=e[e.length-1],this.keyTimeData=Object.keys(this.curveMap)},r.getValue=function(t){var e=0,r=this.keyTimeData,i=this.curveMap[r[0]].timeStart,n=this.curveMap[r[r.length-1]].timeEnd;if(t<=i)return sn.getPointIndexInCurve(this.startKeyframe,sn.pointIndexCache),this.startKeyframe[1][sn.pointIndexCache.yIndex];if(t>=n)return sn.getPointIndexInCurve(this.endKeyframe,sn.pointIndexCache),this.endKeyframe[1][sn.pointIndexCache.yIndex];for(var s=0;s<r.length;s++){var a=this.curveMap[r[s]].timeStart,o=this.curveMap[r[s]].timeEnd;if(t>=Number(a)&&t<Number(o)){e=this.getCurveValue(r[s],t);break}}return e},r.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=(e-t)/r,n=0,s=Object.keys(this.curveMap);if(i<=this.curveMap[s[0]].timeStart)return 0;for(var a=0;a<s.length;a++){var o=this.curveMap[s[a]].timeStart,u=this.curveMap[s[a]].timeEnd;if(i>=Number(u)&&(n+=r*this.getCurveIntegrateValue(s[a],Number(u))),i>=Number(o)&&i<Number(u)){n+=r*this.getCurveIntegrateValue(s[a],i);break}}return n},r.getIntegrateByTime=function(t,e){return this.getIntegrateValue(0,e)-this.getIntegrateValue(0,t)},r.getCurveIntegrateValue=function(t,e){for(var r=this.curveMap[t],i=r.points[0],n=r.timeInterval,s=r.valueInterval,a=0,o=(e-i.x)/20,u=0;u<=20;u++){var h=u*o/n,c=i.y+s*r.curve.getValue(h);a+=0===u||20===u?c:u%2==1?4*c:2*c}return a*=o/3},r.getCurveValue=function(t,e){var r=this.curveMap[t],i=r.points[0],n=r.timeInterval,s=r.valueInterval,a=(e-i.x)/n,o=r.curve.getValue(a);return i.y+s*o},r.toUniform=function(t){var e=t.index,r=this.keys.length;return t.curves.push(this),t.index=e+r,t.max=Math.max(t.max,r),t.curveCount+=r,new Float32Array([5,e+1/r,e,r])},r.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4)e.set(t[r],i);return e},r.getMaxTime=function(){var t=this.keyTimeData;return this.curveMap[t[t.length-1]].timeEnd},e}(Tn),Mn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.keys=t[0],this.values=t[1]},r.getValue=function(t){for(var e=this.keys,r=this.values,i=0;i<e.length-1;i++){var n=e[i],s=e[i+1];if(n[0]<=t&&s[0]>=t){var a=s[1]-n[1],o=void 0;if(0===a)o=(t-n[0])/(s[0]-n[0]);else o=(Vn(t,n,s)-n[1])/a;return this.calculateVec(i,o)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},r.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=[0,0,0],s=0;s<r.length;s++)n[s]=r[s]*(1-e)+i[s]*e;return n},e}(Tn),Pn=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t[0],r=t[1],i=t[2];if(this.curveSegments={},i.length){for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1],o=new Ae(r[n][0],r[n][1],r[n][2]),u=new Ae(r[n+1][0],r[n+1][1],r[n+1][2]),h=new Ae(i[2*n][0],i[2*n][1],i[2*n][2]),c=new Ae(i[2*n+1][0],i[2*n+1][1],i[2*n+1][2]),l=gn(s,a),f=l.points,p=l.curve,d=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new mn(o,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:d,valueInterval:m,easingCurve:p,pathCurve:g,timeStart:Number(v.x),timeEnd:Number(y.x)}}this.keyTimeData=Object.keys(this.curveSegments)}},r.getValue=function(t){var e=nn(t,5),r=0,i=new Ae,n=this.keyTimeData;if(!n.length)return i;var s=this.curveSegments[n[0]].timeStart,a=this.curveSegments[n[n.length-1]].timeEnd;if(e<=s)return i=this.curveSegments[n[0]].pathCurve.getPointInPercent(0);if(e>=a)return i=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 c=this.curveSegments[n[o]].pathCurve;r=this.getPercValue(n[o],e),i=c.getPointInPercent(r)}}return i},r.getPercValue=function(t,e){var r=this.curveSegments[t],i=r.points[0],n=r.timeInterval,s=nn((e-i.x)/n,4);return Ee(r.easingCurve.getValue(s),0,1)},r.getMaxTime=function(){var t=this.keyTimeData;return this.curveSegments[t[t.length-1]].timeEnd},e}(Tn),In=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.onCreate=function(t){var e=t[0],r=t[1],i=t[2];if(this.curveSegments={},i.length)for(var n=0;n<e.length-1;n++){var s=e[n],a=e[n+1],o=Re.fromArray(r[n]),u=Re.fromArray(r[n+1]),h=Re.fromArray(i[2*n]),c=Re.fromArray(i[2*n+1]),l=gn(s,a),f=l.points,p=l.curve,d=l.timeInterval,m=l.valueInterval,v=f[0],y=f[f.length-1],g=new vn(o,u,h,c);this.curveSegments[v.x+"&"+y.x]={points:f,timeInterval:d,valueInterval:m,easingCurve:p,pathCurve:g}}},r.getValue=function(t){var e=0,r=nn(t,5),i=Object.keys(this.curveSegments),n=Number(i[0].split("&")[0]),s=Number(i[i.length-1].split("&")[1]);if(r<=n)return this.curveSegments[i[0]].pathCurve.getPointInPercent(0);if(r>=s)return this.curveSegments[i[i.length-1]].pathCurve.getPointInPercent(1);for(var a=0;a<i.length;a++){var o=i[a].split("&"),u=o[0],h=o[1];if(r>=Number(u)&&r<Number(h)){var c=this.curveSegments[i[a]].pathCurve;return e=this.getPercValue(i[a],r),c.getPointInPercent(e)}}return this.curveSegments[i[0]].pathCurve.getPointInPercent(0)},r.getPercValue=function(t,e){var r=this.curveSegments[t],i=r.points[0],n=r.timeInterval,s=nn((e-i.x)/n,4);return Ee(r.easingCurve.getValue(s),0,1)},r.getMaxTime=function(){var t=Object.keys(this.curveSegments);return Number(t[t.length-1].split("&")[1])},e}(Tn);function Ln(t,e,r,i,n){var s=t-e;return(i+i+(n-i)*s/(r-e))*s/2}function Fn(t,e,r,i,n){var s=t*t,a=e*e;return(2*(s*t)*(i-n)+3*s*(e*n-r*i)-a*e*(2*i+n)+3*a*r*i)/(6*(e-r))}function Vn(t,e,r){var i=r[0]-e[0],n=e[3]*i,s=r[2]*i,a=(t-e[0])/i,o=a*a,u=o*a,h=u-2*o+a,c=u-o,l=-2*u+3*o;return(2*u-3*o+1)*e[1]+h*n+c*s+l*r[1]}function Dn(t,e){if(e){var r=e[0],i=e[1];if(r===Ct.CURVE){t.curves.push(i);var n=i.length;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(r===Ct.LINE){var s=i.length;if(2===s&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&s++,i[i.length-1][0]<1&&s++;var a=Math.ceil(s/2);t.lineSegCount+=a,t.curves.push(i),t.index+=a,t.max=Math.max(t.max,a)}else if(r===Ct.BEZIER_CURVE){var o=i.length-1;t.index+=2*o,t.curves.push(i),t.max=Math.max(t.max,2*o),t.curveCount+=2*o}}}function Nn(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}function kn(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(kn=function(){return!!t})()}function zn(t,e,r){return zn=kn()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&Et(n,r.prototype),n},zn.apply(null,arguments)}var Un,Bn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Ce,e}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.xCurve=Yn(t[0]),this.yCurve=Yn(t[1]),this.zCurve=Yn(t[2]),this.wCurve=Yn(t[3])},r.getValue=function(t){var e=this.xCurve.getValue(t),r=this.yCurve.getValue(t),i=this.zCurve.getValue(t),n=this.wCurve.getValue(t);return this.value.set(e,r,i,n),this.value},e}(Tn),Gn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new _e,e}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.xCurve=Yn(t[0]),this.yCurve=Yn(t[1])},r.getValue=function(t){var e=this.xCurve.getValue(t),r=this.yCurve.getValue(t);return this.value.set(e,r),this.value},e}(Tn),jn=6,Xn="editor",Hn={"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"},Wn=((Un={})[Ct.RANDOM]=function(t){return a(t[0],Array)?new Cn(t):new An(t)},Un[Ct.CONSTANT]=function(t){return new En(t)},Un[Ct.CONSTANT_VEC2]=function(t){return new En(t)},Un[Ct.CONSTANT_VEC3]=function(t){return new En(t)},Un[Ct.CONSTANT_VEC4]=function(t){return new En(t)},Un[Ct.RGBA_COLOR]=function(t){return new En(t)},Un[Ct.COLORS]=function(t){return new _n(t.map((function(t){return b(t,!1)})))},Un[Ct.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Sn([t[0][1],t[1][1]]):new Rn(t)},Un[Ct.GRADIENT_COLOR]=function(t){return new wn(t)},Un[Ct.LINEAR_PATH]=function(t){return new Mn(t)},Un[Ct.BEZIER_CURVE]=function(t){return 1===t.length?new En(t[0][1][1]):new On(t)},Un[Ct.BEZIER_CURVE_PATH]=function(t){return 1===t[0].length?new En(zn(Ae,[].concat(t[1][0]))):new Pn(t)},Un[Ct.BEZIER_CURVE_QUAT]=function(t){return 1===t[0].length?new En(zn(Re,[].concat(t[1][0]))):new In(t)},Un[Ct.COLOR_CURVE]=function(t){return new Zn(t)},Un[Ct.VECTOR4_CURVE]=function(t){return new Bn(t)},Un[Ct.VECTOR2_CURVE]=function(t){return new Gn(t)},Un);function Yn(t){if(!t||!isNaN(+t))return new En(t||0);if(a(t,Tn))return t;if(Y(Wn[t[0]]))return Wn[t[0]](t[1]);throw new Error("ValueType: "+t[0]+" is not supported, see "+Hn["ValueType: 21/22 is not supported"]+".")}var Zn=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).value=new Zr,e}_t(e,t);var r=e.prototype;return r.onCreate=function(t){this.rCurve=Yn(t[0]),this.gCurve=Yn(t[1]),this.bCurve=Yn(t[2]),this.aCurve=Yn(t[3])},r.getValue=function(t){var e=this.rCurve.getValue(t),r=this.gCurve.getValue(t),i=this.bCurve.getValue(t),n=this.aCurve.getValue(t);return this.value.set(e,r,i,n),this.value},e}(Tn),qn=function(t){function e(e){var r;(r=t.call(this,e)||this).cachePrefix="-",r.color=[1,1,1,1],r.visible=!0,r.isManualTimeSet=!1,r.frameAnimationTime=0,r.getHitTestParams=function(t){var e=r.interaction;if(t||e){var i,n=r.getBoundingBox();if(n)return{behavior:(null==(i=r.interaction)?void 0:i.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:r.renderer.side===ct.FRONT}}},r.renderer={renderMode:yt.MESH,blending:ht.ALPHA,texture:r.engine.emptyTexture,occlusion:!1,transparentOcclusion:!1,side:ct.DOUBLE,mask:0,maskMode:lt.NONE,order:0},r.emptyTexture=r.engine.emptyTexture,r.renderInfo=Kn(we(r));var i=r.createMaterial(r.renderInfo,2);return r.worldMatrix=Pe.fromIdentity(),r.material=i,r.material.setColor("_Color",(new Zr).setFromArray([1,1,1,1])),r.material.setVector4("_TexOffset",(new Ce).setFromArray([0,0,1,1])),r}_t(e,t);var r=e.prototype;return r.setVisible=function(t){this.visible=t},r.getVisible=function(){return this.visible},r.setColor=function(t){this.color=t,this.material.setColor("_Color",(new Zr).setFromArray(t))},r.setTexture=function(t){var e=this;return i((function(){var r;return h(this,(function(i){switch(i.label){case 0:return"string"!=typeof t?[3,2]:[4,ur.fromImage(t,e.item.engine)];case 1:return r=i.sent(),[3,3];case 2:r=t,i.label=3;case 3:return e.renderer.texture=r,e.material.setTexture("_MainTex",r),[2]}}))}))()},r.setAnimationTime=function(t){this.frameAnimationTime=t,this.isManualTimeSet=!0},r.render=function(t){if(this.getVisible()){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),this.material.setVector2("_Size",this.transform.size),this.renderer.renderMode!==yt.BILLBOARD&&this.renderer.renderMode!==yt.VERTICAL_BILLBOARD&&this.renderer.renderMode!==yt.HORIZONTAL_BILLBOARD||this.material.setVector3("_Scale",this.transform.scale),t.drawGeometry(r,e)}},r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},r.getItemInitData=function(){this.geoData=this.getItemGeometryData();var t=this.geoData,e=t.index,r=t.atlasOffset,i=e.length,n=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new e.constructor(i);if(!this.wireframe)for(var s=0;s<i;s++)n[s]=0+e[s];return{atlasOffset:r,index:n}},r.setItem=function(){var t=this.renderer.texture;t&&y([],t),t=this.renderer.texture;var e=this.getItemInitData(),r=this.renderer,i=this.material.getVector4("_TexParams");i&&(i.x=r.occlusion?+r.transparentOcclusion:1,i.y=+this.preMultiAlpha,i.z=r.renderMode,0===i.x?this.material.enableMacro("ALPHA_CLIP"):this.material.disableMacro("ALPHA_CLIP"));var n={atlasOffset:new Float32Array(e.atlasOffset.length),index:new Uint16Array(e.index.length)};n.atlasOffset.set(e.atlasOffset),n.index.set(e.index);var s=this.material,a=this.geometry,o=n.index;a.setIndexData(o),a.setAttributeData("atlasOffset",n.atlasOffset),a.setDrawCount(e.index.length),s.setTexture("_MainTex",t)},r.getItemGeometryData=function(){var t=this.renderer;if(t.shape){for(var e=t.shape,r=e.index,i=void 0===r?[]:r,n=e.aPoint,s=void 0===n?[]:n,a=new Float32Array(s),o=[],u=[],h=0;h<a.length;h+=6)u.push(s[h+2],s[h+3]),o.push(a[h],a[h+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(o)),{index:i,atlasOffset:u}}return this.geometry.setAttributeData("aPos",new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])),{index:[0,1,2,2,1,3],atlasOffset:[0,1,0,0,1,1,1,0]}},r.createGeometry=function(t){return jr.create(this.engine,{attributes:{aPos:{type:rr.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},atlasOffset:{size:2,offset:0,releasable:!0,type:rr.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:4})},r.getMaterialProps=function(t,e){return{shader:Ho(t,e,1)}},r.createMaterial=function(t,e){var r=t.side,i=t.occlusion,n=t.blending,s=t.maskMode,a=t.mask,o=this.getMaterialProps(t,e);this.preMultiAlpha=wr(n);var u=Nr.create(this.engine,o),h={side:r,blending:!0,blendMode:n,mask:a,maskMode:s,depthTest:!0,depthMask:i};return u.blending=h.blending,u.stencilRef=void 0!==h.mask?[h.mask,h.mask]:void 0,u.depthTest=h.depthTest,u.depthMask=h.depthMask,Rr(u,h.blendMode),Mr(u,h.maskMode),Or(u,h.side),u.shader.shaderData.properties='_MainTex("_MainTex",2D) = "white" {}',u.hasUniform("_Color")||u.setColor("_Color",new Zr(0,0,0,1)),u.hasUniform("_TexOffset")||u.setVector4("_TexOffset",new Ce),u.hasUniform("_TexParams")||u.setVector4("_TexParams",new Ce),u},r.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},r.getBoundingBox=function(){if(this.item){var t=this.transform.getWorldMatrix(),e=en(Ae.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:exports.HitTestType.triangle,area:e}}},e}(me);function Kn(t){var e=t.renderer,r=e.blending,i=e.side,n=e.occlusion,s=e.mask,a=e.maskMode,o=e.order,u=+r,h=t.cachePrefix||"-";return{side:i,occlusion:n,blending:r,mask:s,maskMode:a,cachePrefix:h,cacheId:h+"."+ +i+"+"+ +n+"+"+u+"+"+o+"+"+a+"."+s}}var Qn=function(){},Jn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},$n={exports:{}};!function(t){var e;function r(t,e){return t.b===e.b&&t.a===e.a}function i(t,e){return t.b<e.b||t.b===e.b&&t.a<=e.a}function n(t,e,r){var i=e.b-t.b,n=r.b-e.b;return 0<i+n?i<n?e.a-t.a+i/(i+n)*(t.a-r.a):e.a-r.a+n/(i+n)*(r.a-t.a):0}function s(t,e,r){var i=e.b-t.b,n=r.b-e.b;return 0<i+n?(e.a-r.a)*i+(e.a-t.a)*n:0}function a(t,e){return t.a<e.a||t.a===e.a&&t.b<=e.b}function o(t,e,r){var i=e.a-t.a,n=r.a-e.a;return 0<i+n?i<n?e.b-t.b+i/(i+n)*(t.b-r.b):e.b-r.b+n/(i+n)*(r.b-t.b):0}function u(t,e,r){var i=e.a-t.a,n=r.a-e.a;return 0<i+n?(e.b-r.b)*i+(e.b-t.b)*n:0}function h(t){return i(t.b.a,t.a)}function c(t){return i(t.a,t.b.a)}function l(t,e,r,i){return(t=0>t?0:t)<=(r=0>r?0:r)?0===r?(e+i)/2:e+t/(t+r)*(i-e):i+r/(t+r)*(e-i)}function f(t){var e=y(t.b);return x(e,t.c),x(e.b,t.c),b(e,t.a),e}function p(t,e){var r=!1,i=!1;t!==e&&(e.a!==t.a&&(i=!0,E(e.a,t.a)),e.d!==t.d&&(r=!0,_(e.d,t.d)),g(e,t),i||(x(e,t.a),t.a.c=t),r||(b(e,t.d),t.d.a=t))}function d(t){var e=t.b,r=!1;t.d!==t.b.d&&(r=!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)),r||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),r=e.b;return g(e,t.e),e.a=t.b.a,x(r,e.a),e.d=r.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 r=!1,i=y(t),n=i.b;return e.d!==t.d&&(r=!0,_(e.d,t.d)),g(i,t.e),g(n,e),i.a=t.b.a,n.a=e.a,i.d=n.d=t.d,t.d.a=n,r||b(i,t.d),i}function y(t){var e=new J,r=new J,i=t.b.h;return r.h=i,i.b.h=e,e.h=t,t.b.h=r,e.b=r,e.c=e,e.e=r,r.b=e,r.c=r,r.e=e}function g(t,e){var r=t.c,i=e.c;r.b.e=e,i.b.e=t,t.c=i,e.c=r}function x(t,e){var r=e.f,i=new et(e,r);r.e=i,e.f=i,r=i.c=t;do{r.a=i,r=r.c}while(r!==t)}function b(t,e){var r=e.d,i=new Q(e,r);r.b=i,e.d=i,i.a=t,i.c=e.c,r=t;do{r.d=i,r=r.e}while(r!==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 r=t.c,i=r;do{i.a=e,i=i.c}while(i!==r);r=t.f,(i=t.e).f=r,r.e=i}function _(t,e){var r=t.a,i=r;do{i.d=e,i=i.e}while(i!==r);r=t.d,(i=t.b).d=r,r.b=i}function A(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 S(t,e){t.f+=e.f,t.b.f+=e.b.f}function w(t,e,r){return t=t.a,e=e.a,r=r.a,e.b.a===t?r.b.a===t?i(e.a,r.a)?0>=s(r.b.a,e.a,r.a):0<=s(e.b.a,r.a,e.a):0>=s(r.b.a,t,r.a):r.b.a===t?0<=s(e.b.a,t,e.a):(e=n(e.b.a,t,e.a))>=(t=n(r.b.a,t,r.a))}function R(t){t.a.i=null;var e=t.e;e.a.c=e.c,e.c.a=e.a,t.e=null}function O(t,e){d(t.a),t.c=!1,t.a=e,e.i=t}function M(t){var e=t.a.a;do{t=pt(t)}while(t.a.a===e);return t.c&&(O(t,e=v(ft(t).a.b,t.a.e)),t=pt(t)),t}function P(t,e,r){var i=new lt;return i.a=r,i.e=H(t.f,e.e,i),r.i=i}function I(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 L(t){var e=t.a,r=e.d;r.c=t.d,r.a=e,R(t)}function F(t,e,r){for(t=e,e=e.a;t!==r;){t.c=!1;var i=ft(t),n=i.a;if(n.a!==e.a){if(!i.c){L(t);break}O(i,n=v(e.c.b,n.b))}e.c!==n&&(p($(n),n),p(e,n)),L(t),e=i.a,t=i}return e}function V(t,e,r,i,n,s){var a=!0;do{P(t,e,r.b),r=r.c}while(r!==i);for(null===n&&(n=ft(e).a.b.c);(r=(i=ft(e)).a.b).a===n.a;)r.c!==n&&(p($(r),r),p($(n),r)),i.f=e.f-r.f,i.d=I(t,i.f),e.b=!0,!a&&z(t,e)&&(S(r,n),R(e),d(n)),a=!1,e=i,n=r;e.b=!0,s&&B(t,e)}function D(t,e,r,i,n){var s=[e.g[0],e.g[1],e.g[2]];e.d=null,e.d=t.o&&t.o(s,r,i,t.c)||null,null===e.d&&(n?t.n||(K(t,100156),t.n=!0):e.d=r[0])}function N(t,e,r){var i=[null,null,null,null];i[0]=e.a.d,i[1]=r.a.d,D(t,e.a,i,[.5,.5,0,0],!1),p(e,r)}function k(t,e,r,i,n){var s=Math.abs(e.b-t.b)+Math.abs(e.a-t.a),a=Math.abs(r.b-t.b)+Math.abs(r.a-t.a),o=n+1;i[n]=.5*a/(s+a),i[o]=.5*s/(s+a),t.g[0]+=i[n]*e.g[0]+i[o]*r.g[0],t.g[1]+=i[n]*e.g[1]+i[o]*r.g[1],t.g[2]+=i[n]*e.g[2]+i[o]*r.g[2]}function z(t,e){var n=ft(e),a=e.a,o=n.a;if(i(a.a,o.a)){if(0<s(o.b.a,a.a,o.a))return!1;if(r(a.a,o.a)){if(a.a!==o.a){n=t.e;var u=a.a.h;if(0<=u){var h=(n=n.b).d,c=n.e,l=n.c,f=l[u];h[f]=h[n.a],l[h[f]]=f,f<=--n.a&&(1>=f||i(c[h[f>>1]],c[h[f]])?ht(n,f):ct(n,f)),c[u]=null,l[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;N(t,$(o),a)}}else m(o.b),p(a,$(o)),e.b=n.b=!0}else{if(0>s(a.b.a,o.a,a.a))return!1;pt(e).b=e.b=!0,m(a.b),p($(o),a)}return!0}function U(t,e){var h=ft(e),c=e.a,f=h.a,d=c.a,v=f.a,y=c.b.a,g=f.b.a,x=new et;if(s(y,t.a,d),s(g,t.a,v),d===v||Math.min(d.a,y.a)>Math.max(v.a,g.a))return!1;if(i(d,v)){if(0<s(g,d,v))return!1}else if(0>s(y,v,d))return!1;var b,T,E=y,_=d,A=g,C=v;if(i(E,_)||(b=E,E=_,_=b),i(A,C)||(b=A,A=C,C=b),i(E,A)||(b=E,E=A,A=b,b=_,_=C,C=b),i(A,_)?i(_,C)?(0>(b=n(E,A,_))+(T=n(A,_,C))&&(b=-b,T=-T),x.b=l(b,A.b,T,_.b)):(0>(b=s(E,A,_))+(T=-s(E,C,_))&&(b=-b,T=-T),x.b=l(b,A.b,T,C.b)):x.b=(A.b+_.b)/2,a(E,_)||(b=E,E=_,_=b),a(A,C)||(b=A,A=C,C=b),a(E,A)||(b=E,E=A,A=b,b=_,_=C,C=b),a(A,_)?a(_,C)?(0>(b=o(E,A,_))+(T=o(A,_,C))&&(b=-b,T=-T),x.a=l(b,A.a,T,_.a)):(0>(b=u(E,A,_))+(T=-u(E,C,_))&&(b=-b,T=-T),x.a=l(b,A.a,T,C.a)):x.a=(A.a+_.a)/2,i(x,t.a)&&(x.b=t.a.b,x.a=t.a.a),E=i(d,v)?d:v,i(E,x)&&(x.b=E.b,x.a=E.a),r(x,d)||r(x,v))return z(t,e),!1;if(!r(y,t.a)&&0<=s(y,t.a,x)||!r(g,t.a)&&0>=s(g,t.a,x)){if(g===t.a)return m(c.b),p(f.b,c),c=ft(e=M(e)).a,F(t,ft(e),h),V(t,e,$(c),c,c,!0),!0;if(y===t.a){m(f.b),p(c.e,$(f)),v=(d=h=e).a.b.a;do{d=pt(d)}while(d.a.b.a===v);return d=ft(e=d).a.b.c,h.a=$(f),V(t,e,(f=F(t,h,null)).c,c.b.c,d,!0),!0}return 0<=s(y,t.a,x)&&(pt(e).b=e.b=!0,m(c.b),c.a.b=t.a.b,c.a.a=t.a.a),0>=s(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(c.b),m(f.b),p($(f),c),c.a.b=x.b,c.a.a=x.a,c.a.h=it(t.e,c.a),c=c.a,f=[0,0,0,0],x=[d.d,y.d,v.d,g.d],c.g[0]=c.g[1]=c.g[2]=0,k(c,d,y,f,0),k(c,v,g,f,2),D(t,c,x,f,!0),pt(e).b=e.b=h.b=!0,!1}function B(t,e){for(var r=ft(e);;){for(;r.b;)e=r,r=ft(r);if(!e.b&&(r=e,null===(e=pt(e))||!e.b))break;e.b=!1;var n,a=e.a,o=r.a;if(n=a.b.a!==o.b.a)t:{var u=ft(n=e),h=n.a,c=u.a,l=void 0;if(i(h.b.a,c.b.a)){if(0>s(h.b.a,c.b.a,h.a)){n=!1;break t}pt(n).b=n.b=!0,l=m(h),p(c.b,l),l.d.c=n.d}else{if(0<s(c.b.a,h.b.a,c.a)){n=!1;break t}n.b=u.b=!0,l=m(c),p(h.e,c.b),l.b.d.c=n.d}n=!0}if(n&&(r.c?(R(r),d(o),o=(r=ft(e)).a):e.c&&(R(e),d(a),a=(e=pt(r)).a)),a.a!==o.a)if(a.b.a===o.b.a||e.c||r.c||a.b.a!==t.a&&o.b.a!==t.a)z(t,e);else if(U(t,e))break;a.a===o.a&&a.b.a===o.b.a&&(S(o,a),R(e),d(a),e=pt(r))}}function G(t,e){t.a=e;for(var n=e.c;null===n.i;)if((n=n.c)===e.c){n=t;var a=e;(h=new lt).a=a.c.b;var o=(l=n.f).a;do{o=o.a}while(null!==o.b&&!l.c(l.b,h,o.b));var u=ft(l=o.b),h=l.a;o=u.a;if(0===s(h.b.a,a,h.a))r((h=l.a).a,a)||r(h.b.a,a)||(m(h.b),l.c&&(d(h.c),l.c=!1),p(a.c,h),G(n,a));else{var c=i(o.b.a,h.b.a)?l:u;u=void 0;l.d||c.c?(u=c===l?v(a.c.b,h.e):v(o.b.c.b,a.c).b,c.c?O(c,u):(h=n,(l=P(n,l,u)).f=pt(l).f+l.a.f,l.d=I(h,l.f)),G(n,a)):V(n,l,a.c,a.c,null,!0)}return}if(l=(h=ft(n=M(n.i))).a,(h=F(t,h,null)).c===l){h=(l=h).c,o=ft(n),u=n.a,c=o.a;var l,f=!1;u.b.a!==c.b.a&&U(t,n),r(u.a,t.a)&&(p($(h),u),h=ft(n=M(n)).a,F(t,ft(n),o),f=!0),r(c.a,t.a)&&(p(l,$(c)),l=F(t,o,null),f=!0),f?V(t,n,l.c,h,h,!0):(a=i(c.a,u.a)?$(c):u,V(t,n,a=v(l.c.b,a),a.c,a.c,!1),a.b.i.c=!0,B(t,n))}else V(t,n,h.c,l,l,!0)}function j(t,e){var r=new lt,i=f(t.b);i.a.b=C,i.a.a=e,i.b.a.b=-C,i.b.a.a=e,t.a=i.b.a,r.a=i,r.f=0,r.d=!1,r.c=!1,r.h=!0,r.b=!1,i=H(i=t.f,i.a,r),r.e=i}function X(t){this.a=new W,this.b=t,this.c=w}function H(t,e,r){do{e=e.c}while(null!==e.b&&!t.c(t.b,e.b,r));return t=new W(r,e.a,e),e.a.c=t,e.a=t}function W(t,e,r){this.b=t||null,this.a=e||this,this.c=r||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 rt(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new st}function it(t,e){if(t.e){var r,i=t.b,n=++i.a;return 2*n>i.f&&(i.f*=2,i.c=at(i.c,i.f+1)),0===i.b?r=n:(r=i.b,i.b=i.c[i.b]),i.e[r]=e,i.c[r]=n,i.d[n]=r,i.h&&ct(i,n),r}return i=t.a++,t.c[i]=e,-(i+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&&i(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 st(){this.d=at([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 at(t,e){for(var r=Array(e),i=0;i<t.length;i++)r[i]=t[i];for(;i<e;i++)r[i]=0;return r}function ot(t){return t.e[t.d[1]]}function ut(t){var e=t.d,r=t.e,i=t.c,n=e[1],s=r[n];return 0<t.a&&(e[1]=e[t.a],i[e[1]]=1,r[n]=null,i[n]=t.b,t.b=n,0<--t.a&&ht(t,1)),s}function ht(t,e){for(var r=t.d,n=t.e,s=t.c,a=e,o=r[a];;){var u=a<<1;u<t.a&&i(n[r[u+1]],n[r[u]])&&(u+=1);var h=r[u];if(u>t.a||i(n[o],n[h])){r[a]=o,s[o]=a;break}r[a]=h,s[h]=a,a=u}}function ct(t,e){for(var r=t.d,n=t.e,s=t.c,a=e,o=r[a];;){var u=a>>1,h=r[u];if(0===u||i(n[h],n[o])){r[a]=o,s[o]=a;break}r[a]=h,s[h]=a,a=u}}function lt(){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 pt(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,r){this.j[0]=t,this.j[1]=e,this.j[2]=r},e.z=function(t,e){var r=e||null;switch(t){case 100100:case 100106:this.h=r;break;case 100104:case 100110:this.l=r;break;case 100101:case 100107:this.k=r;break;case 100102:case 100108:this.i=r;break;case 100103:case 100109:this.p=r;break;case 100105:case 100111:this.o=r;break;case 100112:this.r=r;break;default:K(this,100900)}},e.C=function(t,e){var r=!1,i=[0,0,0];q(this,2);for(var n=0;3>n;++n){var s=t[n];-1e150>s&&(s=-1e150,r=!0),1e150<s&&(s=1e150,r=!0),i[n]=s}r&&K(this,100155),null===(r=this.q)?p(r=f(this.b),r.b):(m(r),r=r.e),r.a.d=e,r.a.g[0]=i[0],r.a.g[1]=i[1],r.a.g[2]=i[2],r.f=1,r.b.f=-1,this.q=r},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=[l=this.j[0],n=this.j[1],o=this.j[2]];if(0===l&&0===n&&0===o){for(var n=[-2e150,-2e150,-2e150],a=[2e150,2e150,2e150],o=[],u=[],l=(t=this.b.c).e;l!==t;l=l.e)for(var f=0;3>f;++f){var p=l.g[f];p<a[f]&&(a[f]=p,u[f]=l),p>n[f]&&(n[f]=p,o[f]=l)}if(l=0,n[1]-a[1]>n[0]-a[0]&&(l=1),n[2]-a[2]>n[l]-a[l]&&(l=2),a[l]>=n[l])e[0]=0,e[1]=0,e[2]=1;else{for(n=0,a=u[l],o=o[l],u=[0,0,0],a=[a.g[0]-o.g[0],a.g[1]-o.g[1],a.g[2]-o.g[2]],f=[0,0,0],l=t.e;l!==t;l=l.e)f[0]=l.g[0]-o.g[0],f[1]=l.g[1]-o.g[1],f[2]=l.g[2]-o.g[2],u[0]=a[1]*f[2]-a[2]*f[1],u[1]=a[2]*f[0]-a[0]*f[2],u[2]=a[0]*f[1]-a[1]*f[0],(p=u[0]*u[0]+u[1]*u[1]+u[2]*u[2])>n&&(n=p,e[0]=u[0],e[1]=u[1],e[2]=u[2]);0>=n&&(e[0]=e[1]=e[2]=0,e[A(a)]=1)}t=!0}for(u=A(e),l=this.b.c,n=(u+1)%3,o=(u+2)%3,u=0<e[u]?1:-1,e=l.e;e!==l;e=e.e)e.b=e.g[n],e.a=u*e.g[o];if(t){for(e=0,l=(t=this.b.a).b;l!==t;l=l.b)if(!(0>=(n=l.a).f))do{e+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==l.a);if(0>e)for(t=(e=this.b.c).e;t!==e;t=t.e)t.a=-t.a}for(this.n=!1,l=(e=this.b.b).h;l!==e;l=t)t=l.h,n=l.e,r(l.a,l.b.a)&&l.e.e!==l&&(N(this,n,l),d(l),n=(l=n).e),n.e===l&&(n!==l&&(n!==t&&n!==t.b||(t=t.h),d(n)),l!==t&&l!==t.b||(t=t.h),d(l));for(this.e=e=new rt,l=(t=this.b.c).e;l!==t;l=l.e)l.h=it(e,l);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,r){return i(t[e],t[r])?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(l=this.e,0===l.a)t=ot(l.b);else if(t=l.c[l.d[l.a-1]],0!==l.b.a&&(l=ot(l.b),i(l,t))){t=l;break t}if(null===t||!r(t,e))break;t=nt(this.e),N(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,R(t);for(this.f=null,(e=this.e).b=null,e.d=null,this.e=e.c=null,l=(e=this.b).a.b;l!==e.a;l=t)t=l.b,(l=l.a).e.e===l&&(S(l.c,l),d(l));if(!this.n){if(e=this.b,this.m)for(l=e.b.h;l!==e.b;l=t)t=l.h,l.b.d.c!==l.d.c?l.f=l.d.c?1:-1:d(l);else for(l=e.a.b;l!==e.a;l=t)if(t=l.b,l.c){for(l=l.a;i(l.b.a,l.a);l=l.c.b);for(;i(l.a,l.b.a);l=l.e);for(n=l.c.b,o=void 0;l.e!==n;)if(i(l.b.a,n.a)){for(;n.e!==l&&(h(n.e)||0>=s(n.a,n.b.a,n.e.b.a));)n=(o=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==l&&(c(l.c.b)||0<=s(l.b.a,l.a,l.c.b.a));)l=(o=v(l,l.c.b)).b;l=l.e}for(;n.e.e!==l;)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),l=t.a;do{this.k&&this.k(l.a.d,this.c),l=l.e}while(l!==t.a);this.i&&this.i(this.c)}}else{for(e=this.b,t=!!this.l,l=!1,n=-1,o=e.a.d;o!==e.a;o=o.d)if(o.c){l||(this.h&&this.h(4,this.c),l=!0),u=o.a;do{t&&(n!==(a=u.b.d.c?0:1)&&(n=a,this.l&&this.l(!!n,this.c))),this.k&&this.k(u.a.d,this.c),u=u.e}while(u!==o.a)}l&&this.i&&this.i(this.c)}if(this.r){for(l=(e=this.b).a.b;l!==e.a;l=t)if(t=l.b,!l.c){o=(n=l.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))),(a=u.b).c===a?E(a.a,null):(a.a.c=a.c,g(a,$(a))),T(u))}while(u!==n);n=l.d,(l=l.b).d=n,n.b=l}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},Jn.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=Jn.libtess}($n);var ts=function(){var t=new $n.exports.GluTesselator;return t.gluTessCallback($n.exports.gluEnum.GLU_TESS_VERTEX_DATA,(function(t,e){e[e.length]=t[0],e[e.length]=t[1]})),t.gluTessCallback($n.exports.gluEnum.GLU_TESS_BEGIN,(function(t){t!==$n.exports.primitiveType.GL_TRIANGLES&&console.info("expected TRIANGLES but got type: "+t)})),t.gluTessCallback($n.exports.gluEnum.GLU_TESS_ERROR,(function(t){console.error("error callback, error number: "+t)})),t.gluTessCallback($n.exports.gluEnum.GLU_TESS_COMBINE,(function(t,e,r){return[t[0],t[1],t[2]]})),t.gluTessCallback($n.exports.gluEnum.GLU_TESS_EDGE_FLAG,(function(t){})),t}();function es(t){ts.gluTessNormal(0,0,1);var e=[];ts.gluTessBeginPolygon(e);for(var r=0;r<t.length;r++){ts.gluTessBeginContour();for(var i=t[r],n=0;n<i.length;n+=2){var s=[i[n],i[n+1],0];ts.gluTessVertex(s,s)}ts.gluTessEndContour()}return ts.gluTessEndPolygon(),e}var rs=function(t){function e(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];var n;(n=t.call(this)||this).points=[],n.closePath=!1;var s=Array.isArray(r[0])?r[0]:r;if("number"!=typeof s[0]){for(var a=[],o=0,u=s.length;o<u;o++)a.push(s[o].x,s[o].y);s=a}return n.points=s,n.closePath=!0,n}_t(e,t);var r=e.prototype;return r.clone=function(){var t=new e(this.points.slice());return t.closePath=this.closePath,t},r.contains=function(t,e){for(var r=!1,i=this.points.length/2,n=0,s=i-1;n<i;s=n++){var a=this.points[2*n],o=this.points[2*n+1],u=this.points[2*s],h=this.points[2*s+1];o>e!=h>e&&t<(e-o)/(h-o)*(u-a)+a&&(r=!r)}return r},r.copyFrom=function(t){return this.points=t.points.slice(),this.closePath=t.closePath,this},r.copyTo=function(t){return t.copyFrom(this),t},r.getX=function(){return this.points[this.points.length-2]},r.getY=function(){return this.points[this.points.length-1]},r.build=function(t){for(var e=0;e<this.points.length;e++)t[e]=this.points[e]},r.triangulate=function(t,e,r,i,n){var s=es([t]),a=e.length/2;0===s.length&&this.getLineEndPointsTriangle(t,s);for(var o=0;o<s.length;o++)e[2*r+o]=s[o];for(var u=s.length/2,h=0;h<u;h++)i[n+h]=a+h},r.getLineEndPointsTriangle=function(t,e){if(!t||t.length<2||t.length%2!=0)throw new Error("Invalid points array");if(2!==t.length){var r=t[2]-t[0],i=t[3]-t[1],n=t[0],s=t[1],a=t[0],o=t[1];if(Math.abs(r)>=Math.abs(i))for(var u=0;u<t.length;u+=2){var h=t[u],c=t[u+1];h<n&&(n=h,s=c),h>a&&(a=h,o=c)}else for(var l=0;l<t.length;l+=2){var f=t[l],p=t[l+1];p<s&&(n=f,s=p),p>o&&(a=f,o=p)}e.push(n,s,a,o,a,o)}else e.push(t[0],t[1],t[0],t[1],t[0],t[1])},se(e,[{key:"lastX",get:function(){return this.points[this.points.length-2]}},{key:"lastY",get:function(){return this.points[this.points.length-1]}}]),e}(Qn),is=8,ns=1.1920929e-7;function ss(t,e,r,i,n,s,a,o,u,h){var c=(1-Math.min(.99,Math.max(0,null!=h?h:.5)))/5;return function(t,e,r,i,n,s,a,o,u,h){as(t,e,r,i,n,s,a,o,u,h,0),u.push(a,o)}(e,r,i,n,s,a,o,u,t,c*=c),t}function as(t,e,r,i,n,s,a,o,u,h,c){if(!(c>is)){var l=(t+r)/2,f=(e+i)/2,p=(r+n)/2,d=(i+s)/2,m=(n+a)/2,v=(s+o)/2,y=(l+p)/2,g=(f+d)/2,x=(p+m)/2,b=(d+v)/2,T=(y+x)/2,E=(g+b)/2;if(c>0){var _=a-t,A=o-e,C=Math.abs((r-a)*A-(i-o)*_),S=Math.abs((n-a)*A-(s-o)*_);if(C>ns&&S>ns){if((C+S)*(C+S)<=h*(_*_+A*A))return void u.push(T,E)}else if(C>ns){if(C*C<=h*(_*_+A*A))return void u.push(T,E)}else if(S>ns){if(S*S<=h*(_*_+A*A))return void u.push(T,E)}else if((_=T-(t+a)/2)*_+(A=E-(e+o)/2)*A<=h)return void u.push(T,E)}as(t,e,l,f,y,g,T,E,u,h,c+1),as(T,E,x,b,m,v,a,o,u,h,c+1)}}var os,us=function(t){function e(e,r,i,n){var s;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),(s=t.call(this)||this).type="ellipse",s.x=e,s.y=r,s.halfWidth=i,s.halfHeight=n,s}_t(e,t);var r=e.prototype;return r.clone=function(){return new e(this.x,this.y,this.halfWidth,this.halfHeight)},r.contains=function(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;var r=(t-this.x)/this.halfWidth,i=(e-this.y)/this.halfHeight;return(r*=r)+(i*=i)<=1},r.strokeContains=function(t,e,r){var i=this.halfWidth,n=this.halfHeight;if(i<=0||n<=0)return!1;var s=r/2,a=i-s,o=n-s,u=i+s,h=n+s,c=t-this.x,l=e-this.y;return c*c/(a*a)+l*l/(o*o)>1&&c*c/(u*u)+l*l/(h*h)<=1},r.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this},r.copyTo=function(t){return t.copyFrom(this),t},r.getX=function(){return this.x},r.getY=function(){return this.y},r.build=function(t){var e=this.x,r=this.y,i=this.halfWidth,n=this.halfHeight;if(!(i>=0&&n>=0))return t;var s=Math.ceil(5*Math.sqrt(i+n)),a=8*s+0+0;if(0===a)return t;if(0===s)return t[0]=t[6]=e+0,t[1]=t[3]=r+0,t[2]=t[4]=e-0,t[5]=t[7]=r-0,t;var o=0,u=4*s+0+2,h=u,c=a,l=0+i,f=0,p=e+l,d=e-l,m=r+f;t[o++]=p,t[o++]=m,t[--u]=m,t[--u]=d;for(var v=1;v<s;v++){var y=Math.PI/2*(v/s),g=0+Math.cos(y)*i,x=0+Math.sin(y)*n,b=e+g,T=e-g,E=r+x,_=r-x;t[o++]=b,t[o++]=E,t[--u]=E,t[--u]=T,t[h++]=T,t[h++]=_,t[--c]=_,t[--c]=b}p=e+(l=0),d=e-l,m=r+(f=0+n);var A=r-f;return t[o++]=p,t[o++]=m,t[--c]=A,t[--c]=p,t},r.triangulate=function(t,e,r,i,n){if(0!==t.length){for(var s=0,a=0,o=0;o<t.length;o+=2)s+=t[o],a+=t[o+1];s/=t.length/2,a/=t.length/2;var u=r;e[2*u]=s,e[2*u+1]=a;for(var h=u++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(i[n++]=u,i[n++]=h,i[n++]=u-1),u++;i[n++]=h+1,i[n++]=h,i[n++]=u-1}},e}(Qn);!function(t){t[t.Star=0]="Star",t[t.Polygon=1]="Polygon"}(os||(os={}));var hs,cs=function(t){function e(e,r,i,n,s,a){var o;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=0),(o=t.call(this)||this).pointCount=e,o.outerRadius=r,o.innerRadius=i,o.outerRoundness=n,o.innerRoundness=s,o.starType=a,o.v=[],o.in=[],o.out=[],o}_t(e,t);var r=e.prototype;return r.clone=function(){return new e(this.pointCount,this.outerRadius,this.innerRadius,this.outerRoundness,this.innerRoundness,this.starType)},r.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},r.copyTo=function(t){t.copyFrom(this)},r.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)ss(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 r=this.v.length-1;ss(t,this.v[r-1],this.v[r],this.out[r-1],this.out[r],this.in[0],this.in[1],this.v[0],this.v[1],1)},r.triangulate=function(t,e,r,i,n){for(var s=es([t]),a=e.length/2,o=0;o<s.length;o++)e[2*r+o]=s[o];for(var u=s.length/2,h=0;h<u;h++)i[n+h]=a+h},r.buildStarPath=function(){this.v=[],this.in=[],this.out=[];var t,e,r,i,n=2*Math.floor(this.pointCount),s=2*Math.PI/n,a=!0,o=this.outerRadius,u=this.innerRadius,h=this.outerRoundness/100,c=this.innerRoundness/100,l=2*Math.PI*o/(2*n),f=2*Math.PI*u/(2*n),p=-Math.PI/2;for(t=0;t<n;t++){r=a?h:c,i=a?l:f;var d=(e=a?o:u)*Math.cos(p),m=e*Math.sin(p),v=0===d&&0===m?0:m/Math.sqrt(d*d+m*m),y=0===d&&0===m?0:-d/Math.sqrt(d*d+m*m),g=2*t;this.v[g]=d,this.v[g+1]=m,this.in[g]=d+v*i*r*1,this.in[g+1]=m+y*i*r*1,this.out[g]=d-v*i*r*1,this.out[g+1]=m-y*i*r*1,a=!a,p+=1*s}},r.buildPolygonPath=function(){this.v=[],this.in=[],this.out=[];var t,e=Math.floor(this.pointCount),r=2*Math.PI/e,i=this.outerRadius,n=this.outerRoundness/100,s=2*Math.PI*i/(4*e),a=.5*-Math.PI;for(t=0;t<e;t++){var o=i*Math.cos(a),u=i*Math.sin(a),h=0===o&&0===u?0:u/Math.sqrt(o*o+u*u),c=0===o&&0===u?0:-o/Math.sqrt(o*o+u*u),l=2*t;this.v[l]=o,this.v[l+1]=u,this.in[l]=o+h*s*n*1,this.in[l+1]=u+c*s*n*1,this.out[l]=o-h*s*n*1,this.out[l+1]=u-c*s*n*1,a+=1*r}},e}(Qn),ls=function(t){function e(e,r,i,n,s){var a;return void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=20),(a=t.call(this)||this).x=e,a.y=r,a.width=i,a.height=n,a.roundness=s,a}_t(e,t);var r=e.prototype;return r.getBounds=function(t){return(t=t||new e).x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t},r.clone=function(){return new e(this.x,this.y,this.width,this.height,this.roundness)},r.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},r.copyTo=function(t){return t.copyFrom(this),t},r.build=function(t){var e,r=this.width/2,i=this.height/2,n=this.x+r,s=this.y+i,a=e=Math.max(0,Math.min(this.roundness/100,1)*Math.min(r,i)),o=r-a,u=i-e;if(a>=0&&e>=0&&o>=0&&u>=0){var h=5*Math.ceil(2.3*Math.sqrt(a+e)),c=8*h+(o?4:0)+(u?4:0);if(0!==c){if(0===h)return t[0]=t[6]=n+o,t[1]=t[3]=s+u,t[2]=t[4]=n-o,void(t[5]=t[7]=s-u);var l=0,f=4*h+(o?2:0)+2,p=f,d=c,m=o+a,v=u,y=n+m,g=n-m,x=s+v;if(t[l++]=y,t[l++]=x,t[--f]=x,t[--f]=g,u){var b=s-v;t[p++]=g,t[p++]=b,t[--d]=b,t[--d]=y}for(var T=1;T<h;T++){var E=Math.PI/2*(T/h),_=o+Math.cos(E)*a,A=u+Math.sin(E)*e,C=n+_,S=n-_,w=s+A,R=s-A;t[l++]=C,t[l++]=w,t[--f]=w,t[--f]=S,t[p++]=S,t[p++]=R,t[--d]=R,t[--d]=C}y=n+(m=o),g=n-m,x=s+(v=u+e);var O=s-v;t[l++]=y,t[l++]=x,t[--d]=O,t[--d]=y,o&&(t[l++]=g,t[l++]=x,t[--d]=O,t[--d]=g)}}},r.triangulate=function(t,e,r,i,n){if(0!==t.length){for(var s=0,a=0,o=0;o<t.length;o+=2)s+=t[o],a+=t[o+1];s/=t.length/2,a/=t.length/2;var u=r;e[2*u]=s,e[2*u+1]=a;for(var h=u++,c=0;c<t.length;c+=2)e[2*u]=t[c],e[2*u+1]=t[c+1],c>0&&(i[n++]=u,i[n++]=h,i[n++]=u-1),u++;i[n++]=h+1,i[n++]=h,i[n++]=u-1}},e}(Qn),fs=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=s(this.graphicsPath.instructions);!(t=e()).done;){var r=t.value,i=r.action,n=r.data;switch(i){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,r,i,n,s,a){this.ensurePoly();var o=this.currentPoly;return ss(o.points,o.lastX,o.lastY,t,e,r,i,n,s,a),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,r,i,n){return this.drawShape(new us(t,e,r,i),n),this},e.polyStar=function(t,e,r,i,n,s,a){return this.drawShape(new cs(t,e,r,i,n,s),a),this},e.rect=function(t,e,r,i,n,s){return this.drawShape(new ls(t,e,r,i,n),s),this},e.drawShape=function(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this},e.startPoly=function(t,e){var r=this.currentPoly;return r&&this.endPoly(),(r=new rs).points.push(t,e),this.currentPoly=r,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 rs,this.currentPoly.points.push(0,0))},t}(),ps=function(){function t(){this.instructions=[],this.dirty=!1}var e=t.prototype;return e.bezierCurveTo=function(t,e,r,i,n,s,a){return this.instructions.push({action:"bezierCurveTo",data:[t,e,r,i,n,s,a]}),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,r,i,n){return this.instructions.push({action:"ellipse",data:[t,e,r,i,n]}),this.dirty=!0,this},e.rect=function(t,e,r,i,n,s){return this.instructions.push({action:"rect",data:[t,e,r,i,n,s]}),this.dirty=!0,this},e.polyStar=function(t,e,r,i,n,s,a){return this.instructions.push({action:"polyStar",data:[t,e,r,i,n,s,a]}),this.dirty=!0,this},e.clear=function(){return this.instructions.length=0,this.dirty=!0,this},se(t,[{key:"shapePath",get:function(){return this._shapePath||(this._shapePath=new fs(this)),this.dirty&&(this.dirty=!1,this._shapePath.buildPath()),this._shapePath}}]),t}(),ds=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},se(t,null,[{key:"shared",get:function(){return ms.x=0,ms.y=0,ms}}]),t}(),ms=new ds;function vs(t,e,r,i,n,s,a,o){var u,h;a?(u=i,h=-r):(u=-i,h=r);var c=t-r*n+u,l=e-i*n+h,f=t+r*s+u,p=e+i*s+h;return o.push(c,l),o.push(f,p),2}function ys(t,e,r,i,n,s,a,o){var u=r-t,h=i-e,c=Math.atan2(u,h),l=Math.atan2(n-t,s-e);o&&c<l?c+=2*Math.PI:!o&&c>l&&(l+=2*Math.PI);var f=c,p=l-c,d=Math.abs(p),m=Math.sqrt(u*u+h*h),v=1+(15*d*Math.sqrt(m)/Math.PI>>0),y=p/v;if(f+=y,o){a.push(t,e),a.push(r,i);for(var g=1,x=f;g<v;g++,x+=y)a.push(t,e),a.push(t+Math.sin(x)*m,e+Math.cos(x)*m);a.push(t,e),a.push(n,s)}else{a.push(r,i),a.push(t,e);for(var b=1,T=f;b<v;b++,T+=y)a.push(t+Math.sin(T)*m,e+Math.cos(T)*m),a.push(t,e);a.push(n,s),a.push(t,e)}return 2*v}function gs(t,e,r,i,n,s,a,o,u){var h=1e-4;if(0!==t.length){var c=e,l=c.alignment;if(.5!==e.alignment){var f=function(t){var e=t.length;if(e<6)return 1;for(var r=0,i=0,n=t[e-2],s=t[e-1];i<e;i+=2){var a=t[i],o=t[i+1];r+=(a-n)*(o+s),n=a,s=o}return r<0?-1:1}(t);r&&(f*=-1),l=(l-.5)*f+.5}var p=new ds(t[0],t[1]),d=new ds(t[t.length-2],t[t.length-1]),m=i,v=Math.abs(p.x-d.x)<h&&Math.abs(p.y-d.y)<h;if(m){t=t.slice(),v&&(t.pop(),t.pop(),d.set(t[t.length-2],t[t.length-1]));var y=.5*(p.x+d.x),g=.5*(d.y+p.y);t.unshift(y,g),t.push(y,g)}var x=n,b=t.length/2,T=t.length,E=x.length/2,_=c.width/2,A=_*_,C=c.miterLimit*c.miterLimit,S=t[0],w=t[1],R=t[2],O=t[3],M=0,P=0,I=-(w-O),L=S-R,F=0,V=0,D=Math.sqrt(I*I+L*L)+xe;I/=D,L/=D,I*=_,L*=_;var N=2*(1-l),k=2*l;m||(c.cap===Wt.Round?T+=ys(S-I*(N-k)*.5,w-L*(N-k)*.5,S-I*N,w-L*N,S+I*k,w+L*k,x,!0)+2:c.cap===Wt.Square&&(T+=vs(S,w,I,L,N,k,!0,x))),x.push(S-I*N,w-L*N),x.push(S+I*k,w+L*k);for(var z=1;z<b-1;++z){S=t[2*(z-1)],w=t[2*(z-1)+1],R=t[2*z],O=t[2*z+1],M=t[2*(z+1)],P=t[2*(z+1)+1],I=-(w-O),L=S-R,I/=D=Math.sqrt(I*I+L*L)+xe,L/=D,I*=_,L*=_,F=-(O-P),V=R-M,F/=D=Math.sqrt(F*F+V*V)+xe,V/=D,F*=_,V*=_;var U=R-S,B=w-O,G=R-M,j=P-O,X=U*G+B*j,H=B*G-j*U,W=H<0;if(Math.abs(H)<.001*Math.abs(X))x.push(R-I*N,O-L*N),x.push(R+I*k,O+L*k),X>=0&&(c.join===Yt.Round?T+=ys(R,O,R-I*N,O-L*N,R-F*N,O-V*N,x,!1)+4:T+=2,x.push(R-F*k,O-V*k),x.push(R+F*N,O+V*N));else{var Y=(-I+S)*(-L+O)-(-I+R)*(-L+w),Z=(-F+M)*(-V+O)-(-F+R)*(-V+P),q=(U*Z-G*Y)/H,K=(j*Y-B*Z)/H,Q=(q-R)*(q-R)+(K-O)*(K-O),J=R+(q-R)*N,$=O+(K-O)*N,tt=R-(q-R)*k,et=O-(K-O)*k,rt=W?N:k;Q<=Math.min(U*U+B*B,G*G+j*j)+rt*rt*A?c.join===Yt.Bevel||Q/A>C?(W?(x.push(J,$),x.push(R+I*k,O+L*k),x.push(J,$),x.push(R+F*k,O+V*k)):(x.push(R-I*N,O-L*N),x.push(tt,et),x.push(R-F*N,O-V*N),x.push(tt,et)),T+=2):c.join===Yt.Round?W?(x.push(J,$),x.push(R+I*k,O+L*k),T+=ys(R,O,R+I*k,O+L*k,R+F*k,O+V*k,x,!0)+4,x.push(J,$),x.push(R+F*k,O+V*k)):(x.push(R-I*N,O-L*N),x.push(tt,et),T+=ys(R,O,R-I*N,O-L*N,R-F*N,O-V*N,x,!1)+4,x.push(R-F*N,O-V*N),x.push(tt,et)):(x.push(J,$),x.push(tt,et)):(x.push(R-I*N,O-L*N),x.push(R+I*k,O+L*k),c.join===Yt.Round?T+=W?ys(R,O,R+I*k,O+L*k,R+F*k,O+V*k,x,!0)+2:ys(R,O,R-I*N,O-L*N,R-F*N,O-V*N,x,!1)+2:c.join===Yt.Miter&&Q/A<=C&&(W?(x.push(tt,et),x.push(tt,et)):(x.push(J,$),x.push(J,$)),T+=2),x.push(R-F*N,O-V*N),x.push(R+F*k,O+V*k),T+=2)}}S=t[2*(b-2)],w=t[2*(b-2)+1],R=t[2*(b-1)],I=-(w-(O=t[2*(b-1)+1])),L=S-R,I/=D=Math.sqrt(I*I+L*L)+xe,L/=D,I*=_,L*=_,x.push(R-I*N,O-L*N),x.push(R+I*k,O+L*k),m||(c.cap===Wt.Round?T+=ys(R-I*(N-k)*.5,O-L*(N-k)*.5,R-I*N,O-L*N,R+I*k,O+L*k,x,!1)+2:c.cap===Wt.Square&&(T+=vs(R,O,I,L,N,k,!1,x)));for(var it=E;it<T+E-2;++it)S=x[2*it],w=x[2*it+1],R=x[2*(it+1)],O=x[2*(it+1)+1],M=x[2*(it+2)],P=x[2*(it+2)+1],Math.abs(S*(O-P)+R*(P-w)+M*(w-O))<1e-8||o.push(it,it+1,it+2)}}exports.ShapeComponent=function(t){function e(e){var r;if((r=t.call(this,e)||this).hasStroke=!1,r.hasFill=!1,r.shapeDirty=!0,r.graphicsPath=new ps,r.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",r.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",r.geometry||(r.geometry=jr.create(e,{attributes:{aPos:{type:rr.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},aUV:{type:rr.FLOAT,size:2,data:new Float32Array}},mode:rr.TRIANGLES,drawCount:4}),r.geometry.subMeshes.push({offset:0,indexCount:0,vertexCount:0},{offset:0,indexCount:0,vertexCount:0})),!r.material){var i={shader:{vertex:r.vert,fragment:r.frag,glslVersion:exports.GLSLVersion.GLSL1}},n=Nr.create(e,i);n.setColor("_Color",new Zr(1,1,1,1)),n.depthMask=!1,n.depthTest=!0,n.blending=!0,r.material=n;var s=Nr.create(e,i);s.setColor("_Color",new Zr(.25,.25,.25,1)),s.depthMask=!1,s.depthTest=!0,s.blending=!0,r.materials[1]=s}return r.strokeAttributes={width:1,alignment:.5,cap:Wt.Butt,join:Yt.Miter,miterLimit:10,color:new Zr(1,1,1,1)},r.fillAttribute={color:new Zr(1,1,1,1)},r.shapeAttribute={type:Ht.Custom,points:[],easingIns:[],easingOuts:[],shapes:[]},r}_t(e,t);var r=e.prototype;return r.onStart=function(){this.item.getHitTestParams=this.getHitTestParams},r.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)},r.buildGeometryFromPath=function(t){var e=t.shapePrimitives,r=[],i=[];if(this.hasFill)for(var n,a=s(e);!(n=a()).done;){var o=n.value.shape,u=[],h=i.length,c=r.length/2;o.build(u),o.triangulate(u,r,c,i,h)}var l=i.length;if(this.hasStroke)for(var f,p=s(e);!(f=p()).done;){var d=f.value.shape,m=[],v=this.strokeAttributes,y=!0;this.shapeAttribute.type===Ht.Custom&&(y=d.closePath),d.build(m),gs(m,v,!1,y,r,0,0,i)}var g=i.length-l,x=r.length/2,b=this.geometry.getAttributeData("aPos"),T=this.geometry.getAttributeData("aUV"),E=this.geometry.getIndexData();(!b||b.length<3*x)&&(b=new Float32Array(3*x)),(!T||T.length<2*x)&&(T=new Float32Array(2*x)),(!E||E.length<i.length)&&(E=new Uint16Array(i.length));for(var _=0;_<x;_++){var A=3*_,C=2*_,S=2*_;b[A]=r[C],b[A+1]=r[C+1],b[A+2]=0,T[S]=b[A],T[S+1]=b[A+1]}E.set(i),this.geometry.setAttributeData("aPos",b),this.geometry.setAttributeData("aUV",T),this.geometry.setIndexData(E),this.geometry.setDrawCount(i.length);var w=this.geometry.subMeshes[0],R=this.geometry.subMeshes[1];w.indexCount=l,R.offset=2*l,R.indexCount=g},r.buildPath=function(t){switch(this.graphicsPath.clear(),t.type){case Ht.Custom:for(var e,r=this.shapeAttribute,i=r.points,n=r.easingIns,a=r.easingOuts,o=s(r.shapes);!(e=o()).done;){var u=e.value,h=u.indexes,c=i[h[0].point];this.graphicsPath.moveTo(c.x,c.y);for(var l=1;l<h.length;l++){var f=h[l],p=h[l-1],d=i[f.point],m=i[p.point],v=a[p.easingOut],y=n[f.easingIn];this.graphicsPath.bezierCurveTo(v.x+m.x,v.y+m.y,y.x+d.x,y.y+d.y,d.x,d.y,1)}if(u.close){var g=h[0],x=h[h.length-1],b=i[g.point],T=i[x.point],E=a[x.easingOut],_=n[g.easingIn];this.graphicsPath.bezierCurveTo(E.x+T.x,E.y+T.y,_.x+b.x,_.y+b.y,b.x,b.y,1),this.graphicsPath.closePath()}}break;case Ht.Ellipse:var A=t;this.graphicsPath.ellipse(0,0,A.xRadius,A.yRadius);break;case Ht.Rectangle:var C=t;this.graphicsPath.rect(-C.width/2,-C.height/2,C.width,C.height,C.roundness);break;case Ht.Star:var S=t;this.graphicsPath.polyStar(S.pointCount,S.outerRadius,S.innerRadius,S.outerRoundness,S.innerRoundness,os.Star);break;case Ht.Polygon:var w=t;this.graphicsPath.polyStar(w.pointCount,w.radius,w.radius,w.roundness,w.roundness,os.Polygon)}},r.fromData=function(e){t.prototype.fromData.call(this,e),this.shapeDirty=!0;var r=e.stroke;r&&(this.hasStroke=!0,this.strokeAttributes.width=r.width,this.strokeAttributes.color.copyFrom(r.color),this.strokeAttributes.cap=r.cap,this.strokeAttributes.join=r.join);var i=e.fill;switch(i&&(this.hasFill=!0,this.fillAttribute.color.copyFrom(i.color)),e.type){case Ht.Custom:for(var n,a=e,o={type:Ht.Custom,points:[],easingIns:[],easingOuts:[],shapes:[],fill:a.fill},u=s(a.points);!(n=u()).done;){var h=n.value;o.points.push(new _e(h.x,h.y))}for(var c,l=s(a.easingIns);!(c=l()).done;){var f=c.value;o.easingIns.push(new _e(f.x,f.y))}for(var p,d=s(a.easingOuts);!(p=d()).done;){var m=p.value;o.easingOuts.push(new _e(m.x,m.y))}o.shapes=a.shapes,this.shapeAttribute=o;break;case Ht.Ellipse:var v=e,y={type:Ht.Ellipse,xRadius:v.xRadius,yRadius:v.yRadius,fill:v.fill};this.shapeAttribute=y;break;case Ht.Rectangle:var g=e,x={type:Ht.Rectangle,width:g.width,height:g.height,roundness:g.roundness,fill:g.fill};this.shapeAttribute=x;break;case Ht.Star:var b=e,T={type:Ht.Star,pointCount:b.pointCount,innerRadius:b.innerRadius,outerRadius:b.outerRadius,innerRoundness:b.innerRoundness,outerRoundness:b.outerRoundness,fill:b.fill};this.shapeAttribute=T;break;case Ht.Polygon:var E=e,_={type:Ht.Polygon,pointCount:E.pointCount,radius:E.radius,roundness:E.roundness,fill:E.fill};this.shapeAttribute=_}var A=this.material;A.stencilRef=void 0!==e.renderer.mask?[e.renderer.mask,e.renderer.mask]:void 0,Mr(A,e.renderer.maskMode)},se(e,[{key:"shape",get:function(){return this.shapeDirty=!0,this.shapeAttribute}}]),e}(Se),exports.ShapeComponent=u([he("ShapeComponent")],exports.ShapeComponent),exports.Fake3DComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).loop=!1,e.amountOfMotion=1,e.animationLength=2,e.mode=1,e.startPositionX=0,e.startPositionY=0,e.startPositionZ=0,e.endPositionX=0,e.endPositionY=0,e.endPositionZ=0,e.amplitudeX=0,e.amplitudeY=0,e.amplitudeZ=0,e.phaseX=0,e.phaseY=0,e.phaseZ=0,e}_t(e,t);var r=e.prototype;return r.onStart=function(){this.effectComponent=this.item.getComponent(exports.EffectComponent)},r.onUpdate=function(t){this.updateFake3D()},r.updateFake3D=function(){if(this.effectComponent){var t=this.item.time%this.animationLength/this.animationLength,e=0,r=0,i=0;switch(this.mode){case 0:var n=Math.PI;e=Math.sin(2*n*(t+this.phaseX))*this.amplitudeX,r=Math.sin(2*n*(t+this.phaseY))*this.amplitudeY,i=Math.sin(2*n*(t+this.phaseZ))*this.amplitudeZ;break;case 1:var s=t;this.loop&&(s>.5&&(s=1-s),s*=2),e=this.startPositionX*(1-s)+s*this.endPositionX,r=this.startPositionY*(1-s)+s*this.endPositionY,i=this.startPositionZ*(1-s)+s*this.endPositionZ}var a=this.effectComponent.material;a.setFloat("_PosX",e*this.amountOfMotion),a.setFloat("_PosY",r*this.amountOfMotion),a.setFloat("_PosZ",i*this.amountOfMotion)}},e}(pe),u([ce()],exports.Fake3DComponent.prototype,"loop",void 0),u([ce()],exports.Fake3DComponent.prototype,"amountOfMotion",void 0),u([ce()],exports.Fake3DComponent.prototype,"animationLength",void 0),u([ce()],exports.Fake3DComponent.prototype,"mode",void 0),u([ce()],exports.Fake3DComponent.prototype,"startPositionX",void 0),u([ce()],exports.Fake3DComponent.prototype,"startPositionY",void 0),u([ce()],exports.Fake3DComponent.prototype,"startPositionZ",void 0),u([ce()],exports.Fake3DComponent.prototype,"endPositionX",void 0),u([ce()],exports.Fake3DComponent.prototype,"endPositionY",void 0),u([ce()],exports.Fake3DComponent.prototype,"endPositionZ",void 0),u([ce()],exports.Fake3DComponent.prototype,"amplitudeX",void 0),u([ce()],exports.Fake3DComponent.prototype,"amplitudeY",void 0),u([ce()],exports.Fake3DComponent.prototype,"amplitudeZ",void 0),u([ce()],exports.Fake3DComponent.prototype,"phaseX",void 0),u([ce()],exports.Fake3DComponent.prototype,"phaseY",void 0),u([ce()],exports.Fake3DComponent.prototype,"phaseZ",void 0),exports.Fake3DComponent=u([he("Fake3DComponent")],exports.Fake3DComponent),exports.Fake3DAnimationMode=void 0,(hs=exports.Fake3DAnimationMode||(exports.Fake3DAnimationMode={}))[hs.Circular=0]="Circular",hs[hs.Linear=1]="Linear",exports.CameraController=function(t){function e(e,r){var i;return i=t.call(this,e)||this,r&&i.fromData(r),i}_t(e,t);var r=e.prototype;return r.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())}},r.fromData=function(e){t.prototype.fromData.call(this,e),this.options=e.options},e}(de),exports.CameraController=u([he(Kt.CameraController)],exports.CameraController);var xs,bs=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(Tt);exports.HitTestType=void 0,(xs=exports.HitTestType||(exports.HitTestType={}))[xs.triangle=1]="triangle",xs[xs.box=2]="box",xs[xs.sphere=3]="sphere",xs[xs.custom=4]="custom";var Ts="click",Es="touchstart",_s="touchmove",As="touchend",Cs=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}var r=t.prototype;return r.bindListeners=function(){var t,r,i,n,s,a=this;s=function(t){return t};var o,u="mousedown",h="mousemove",c="mouseup",l=function(t,r,i,s,o){void 0===s&&(s=0),void 0===o&&(o=0);var u=0,h=0,c=e.performance.now();if(!a.target)return j.warn("Trigger TouchEvent after EventSystem is disposed."),{x:r,y:i,vx:0,vy:h,dx:s,dy:o,ts:c,width:0,height:0,origin:t};var l=a.target,f=l.width,p=l.height;if(n){var d=c-n.ts;u=(s-n.dx)/d||0,h=(o-n.dy)/d||0,n={dx:s,dy:o,ts:c}}return{x:r,y:i,vx:u,vy:h,dx:s,dy:o,ts:c,width:f,height:p,origin:t}};R()&&(s=function(t){var e=t.touches,r=t.changedTouches;return e[0]||r[0]},u="touchstart",h="touchmove",c="touchend"),this.nativeHandlers=((o={})[u]=function(o){if(a.enabled){var u=s(o),h=Ss(u);t=h.x,r=h.y,n=i={clientX:u.clientX,clientY:u.clientY,ts:e.performance.now(),x:t,y:r},a.dispatchEvent(Es,l(o,t,r))}},o[h]=function(e){if(i&&a.enabled){var n=Ss(s(e));t=n.x,r=n.y,a.dispatchEvent(_s,l(e,t,r,t-i.x,r-i.y))}},o[c]=function(e){if(i&&a.enabled){!a.allowPropagation&&e.cancelable&&(e.preventDefault(),e.stopPropagation());var n=s(e),o=Ss(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);t=o.x,r=o.y,u<4&&a.dispatchEvent(Ts,l(e,t,r)),a.dispatchEvent(As,l(e,t,r,t-i.x,r-i.y))}i=0},o),Object.keys(this.nativeHandlers).forEach((function(t){var e;null==(e=a.target)||e.addEventListener(String(t),a.nativeHandlers[t])}))},r.dispatchEvent=function(t,e){var r=this.handlers[t];null==r||r.forEach((function(t){return t(e)}))},r.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),y(r,e),function(){g(r,e)}},r.removeEventListener=function(t,e){var r=this.handlers[t];r&&g(r,e)},r.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var r;null==(r=t.target)||r.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={},this.target=null)},t}();function Ss(t){var e=t.target,r=t.clientX,i=t.clientY,n=e.getBoundingClientRect(),s=n.left,a=n.top;return{x:(r-s)/n.width*2-1,y:1-(i-a)/n.height*2}}var ws=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(Tt),Rs=1,Os=function(){function t(t,e,r,i){this.transform=r,this.engine=i,this.color=t.options.previewColor;var n=this.createMaterial(e),s=this.createGeometry();this.mesh=this.createMesh(s,n),this.updateMesh()}var e=t.prototype;return e.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new Ae,n=new Re,s=this.transform.scale.clone();this.transform.assignWorldTRS(i,n,s),e.x=s.x,e.y=s.y,r.x=i.x,r.y=i.y,r.z=i.z,t.setVector2("uSize",e),t.setVector4("uPos",r),t.setQuaternion("uQuat",n)},e.createMaterial=function(t){var e,r=[["ENV_EDITOR",(null==(e=this.engine.renderer)?void 0:e.env)===Xn]],i=Yn(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:exports.GLSLVersion.GLSL1,cacheId:t.cachePrefix+"_effects_interact",macros:r},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},s=Nr.create(this.engine,n);return s.blending=!0,s.depthTest=!1,s.setVector4("uPos",new Ce(0,0,0,0)),s.setVector2("uSize",new _e(1,1)),s.setVector4("uColor",new Ce(i[0]/255,i[1]/255,i[2]/255,i[3])),s.setQuaternion("uQuat",new Re(0,0,0,0)),s},e.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return jr.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:t.length,indices:{data:t},mode:rr.LINES,maxVertex:4})},e.createMesh=function(t,e){return ei.create(this.engine,{name:"Interact_preview"+Rs++,priority:0,worldMatrix:Pe.fromIdentity(),geometry:t,material:e})},t}();function Ms(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}exports.InteractComponent=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).downgrade=.95,e.dragRatio=[1,1],e.dragRange={dxRange:[0,0],dyRange:[0,0]},e.duringPlay=!1,e._interactive=!0,e.getHitTestParams=function(t){if(e.clickable){var r=e.item.props.content.options.behavior,i=e.getBoundingBox();return i?{type:i.type,triangles:i.area,behavior:r}:void 0}},e}_t(e,t);var r=e.prototype;return r.getDragRangeX=function(){return this.dragRange.dxRange},r.setDragRangeX=function(t,e){this.dragRange.dxRange=[t,e]},r.getDragRangeY=function(){return this.dragRange.dyRange},r.setDragRangeY=function(t,e){this.dragRange.dyRange=[t,e]},r.onStart=function(){var t=this.item.props.content.options,e=this.item.engine.renderer.env,r=this.item.composition,i=this.interactData.options,n=i.type,s=i.showPreview;if(n===dt.CLICK&&(this.clickable=!0,s&&e===Xn)){var a=null==r?void 0:r.getRendererOptions();void 0!==a&&(this.previewContent=new Os(this.item.props.content,a,this.transform,this.engine))}t.type===dt.DRAG&&(e!==Xn||t.enableInEditor)&&(null==r?void 0:r.event)&&this.beginDragTarget(t,r.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},r.onDisable=function(){t.prototype.onDisable.call(this),this.item&&this.item.composition&&(this.duringPlay&&!this.item.transform.getValid()&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.duringPlay=!1),this.clickable=!1,this.endDragTarget())},r.onEnable=function(){t.prototype.onEnable.call(this);var e=this.interactData.options.type,r=this.item.engine.renderer.env;if(e===dt.CLICK)this.clickable=!0;else if(e===dt.DRAG){var i,n=this.interactData.options,s=n.enableInEditor;if(r!==Xn||s)(null==(i=this.item.composition)?void 0:i.event)&&this.beginDragTarget(n,this.item.composition.event)}},r.onUpdate=function(t){var e;if(this.duringPlay=!0,this.item.time>0&&this.item.time-t/1e3<=0){var r,i=this.item.props.content.options;null==(r=this.item.composition)||r.addInteractiveItem(this.item,i.type)}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,Ms(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg))},r.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},r.onDestroy=function(){var t;null==(t=this.previewContent)||t.mesh.dispose()},r.endDragTarget=function(){},r.handleDragMove=function(t,e){if((null==t?void 0:t.cameraParam)&&this.canInteract()&&this.item.composition){var r,i,n=t.cameraParam,s=n.position,a=n.fov,o=e.dy,u=e.dx*e.width/e.height,h=s[2],c=Math.tan(a*Math.PI/180/2)*Math.abs(h),l=o*c,f=u*c,p=this.dragRange,d=p.dxRange,m=p.dyRange,v=s[0]-this.dragRatio[0]*f,y=s[1]-this.dragRatio[1]*l,g=d[0],x=d[1],b=m[0],T=m[1];if(v=Ee(v,g,x),y=Ee(y,b,T),v!==g&&v!==x&&g!==x)null==(r=e.origin)||r.preventDefault();if(y!==b&&y!==T&&b!==T)null==(i=e.origin)||i.preventDefault();this.item.composition.camera.position=new Ae(v,y,h)}},r.beginDragTarget=function(t,r){var i=this;if("camera"===t.target){var n,s={touchstart:function(t){var e;if(i.canInteract()){i.dragEvent=null,i.bouncingArg=null;var r=null==(e=i.item.composition)?void 0:e.camera;n={x:t.x,y:t.y,cameraParam:{position:(null==r?void 0:r.position.toArray())||[0,0,8],fov:(null==r?void 0:r.fov)||60}}}},touchmove:function(t){i.handleDragMove(n,t),i.bouncingArg=t},touchend:function(t){if(i.canInteract()){var e=i.bouncingArg;if(!Ms(e,3)&&e){e.vx*=5,e.vy*=5,i.dragEvent=Ie({},n)}n=null}}};Object.keys(s).forEach((function(t){r.addEventListener(t,s[t])})),s.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(e).endDragTarget=function(){Object.keys(s).forEach((function(t){r.removeEventListener(t,s[t])}))}}},r.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=en(Ae.ZERO,.5*this.transform.size.x,.5*this.transform.size.y);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:exports.HitTestType.triangle,area:e}},r.fromData=function(e){if(t.prototype.fromData.call(this,e),this.interactData=e,e.options.type===dt.DRAG){var r=e.options;r.dxRange&&(this.dragRange.dxRange=r.dxRange),r.dyRange&&(this.dragRange.dyRange=r.dyRange)}},r.canInteract=function(){var t;return Boolean(null==(t=this.item.composition)?void 0:t.interactive)&&this._interactive},se(e,[{key:"interactive",get:function(){return this._interactive},set:function(t){this._interactive=t,t||(this.bouncingArg=null)}}]),e}(me),exports.InteractComponent=u([he(Kt.InteractComponent)],exports.InteractComponent);var Ps,Is=function(){function t(){this.triangles=[],this.worldMatrix=new Pe}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,r=-Number.MAX_VALUE,i=Number.MAX_VALUE,n=Number.MAX_VALUE,a=s(this.boundingBoxData.area);!(t=a()).done;){var o=t.value;e=Math.max(o.p0.x,o.p1.x,o.p2.x,e),r=Math.max(o.p0.y,o.p1.y,o.p2.y,r),i=Math.min(o.p0.x,o.p1.x,o.p2.x,i),n=Math.min(o.p0.y,o.p1.y,o.p2.y,n)}var u=[],h=new Ae(i,r,0),c=new Ae(e,r,0),l=new Ae(e,n,0),f=new Ae(i,n,0);return u.push({p0:h,p1:c,p2:l}),u.push({p0:h,p1:l,p2:f}),this.applyWorldMatrix(u),{type:exports.HitTestType.triangle,area:u}},e.setGeometry=function(t,e){this.triangles=this.geometryToTriangles(t),this.geometry=t;for(var r,i=[],n=s(this.triangles);!(r=n()).done;){var a=r.value;i.push({p0:a.p0,p1:a.p1,p2:a.p2})}e&&this.worldMatrix.copyFrom(e),this.boundingBoxData={type:exports.HitTestType.triangle,area:i}},e.geometryToTriangles=function(t){var e=t.getIndexData(),r=t.getAttributeData("aPos"),i=[];if(!e||!r)return i;for(var n,a=s(t.subMeshes);!(n=a()).done;){var o=n.value;if(void 0!==o.indexCount)for(var u=e.BYTES_PER_ELEMENT,h=o.offset/u,c=h+o.indexCount,l=h;l<c;l+=3){var f=3*e[l],p=3*e[l+1],d=3*e[l+2],m={x:r[f],y:r[f+1],z:r[f+2]},v={x:r[p],y:r[p+1],z:r[p+2]},y={x:r[d],y:r[d+1],z:r[d+2]};i.push({p0:m,p1:v,p2:y})}}return i},e.applyWorldMatrix=function(t){var e=this;return t.forEach((function(t){t.p0=e.worldMatrix.transformPoint(t.p0,new Ae),t.p1=e.worldMatrix.transformPoint(t.p1,new Ae),t.p2=e.worldMatrix.transformPoint(t.p2,new Ae)})),t},t}(),Ls=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).name="sprite",e}return _t(e,t),e}(Tt),Fs=function(){function t(){this.playableOutputs=[],this.playables=[]}var e=t.prototype;return e.evaluate=function(t){for(var e,r=s(this.playableOutputs);!(e=r()).done;){e.value.context.deltaTime=t}for(var i,n=s(this.playableOutputs);!(i=n()).done;){var a=i.value;this.prepareFrameWithRoot(a)}for(var o,u=s(this.playableOutputs);!(o=u()).done;){var h=o.value;this.processFrameWithRoot(h)}},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}(),Vs=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}(),Ds=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}(),Ns=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(fe);!function(t){t[t.Playing=0]="Playing",t[t.Paused=1]="Paused"}(Ps||(Ps={}));var ks=function(){var t=this,e=this;this.listeners={},this.off=function(e,r){t.listeners[e]&&(t.listeners[e]=t.listeners[e].filter((function(t){return t.listener!==r})))},this.on=function(e,r,i){return t.listeners[e]=t.listeners[e]||[],t.listeners[e].push({listener:r,options:i}),function(){return t.off(e,r)}},this.once=function(e,r){t.on(e,r,{once:!0})},this.emit=function(t){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];var s;null==(s=e.listeners[t])||s.forEach((function(r){var n=r.listener,s=r.options;n.apply(void 0,[].concat(i)),(null==s?void 0:s.once)&&e.off(t,n)}))},this.getListeners=function(e){var r;return(null==(r=t.listeners[e])?void 0:r.map((function(t){return t.listener})))||[]}},zs=new Re,Us=1,Bs=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new Ae(0,0,0),this.quat=new Re(0,0,0,1),this.rotation=new Hr(0,0,0),this.scale=new Ae(1,1,1),this.anchor=new Ae(0,0,0),this.size=new _e(1,1),this.children=[],this.worldMatrix=Pe.fromIdentity(),this.localMatrix=Pe.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new Ae(0,0,0),quat:new Re(0,0,0,1),scale:new Ae(1,1,1)},this.name="transform_"+Us++,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,r){this.position.x===t&&this.position.y===e&&this.position.z===r||(this.position.x=t,this.position.y=e,this.position.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.translate=function(t,e,r){0===t&&0===e&&0===r||(this.position.x+=t,this.position.y+=e,this.position.z+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setRotation=function(t,e,r){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===r||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=r,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setQuaternion=function(t,e,r,i){this.quat.x===t&&this.quat.y===e&&this.quat.z===r&&this.quat.w===i||(this.quat.x=t,this.quat.y=e,this.quat.z=r,this.quat.w=i,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.setScale=function(t,e,r){this.scale.x===t&&this.scale.y===e&&this.scale.z===r||(this.scale.x=t,this.scale.y=e,this.scale.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},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,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,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 r=t.position,i=t.rotation,n=t.scale,s=t.size,o=t.quat,u=t.name,h=t.anchor;if(u&&(this.name=u),r&&(a(r,Ae)?this.setPosition(r.x,r.y,r.z):this.setPosition(r[0],r[1],r[2])),o)a(o,Re)?this.setQuaternion(o.x,o.y,o.z,o.w):this.setQuaternion(o[0],o[1],o[2],o[3]);else if(i){var c=e?-1:1;a(i,Hr)?this.setRotation(i.x*c,i.y*c,i.z*c):this.setRotation(i[0]*c,i[1]*c,i[2]*c)}n&&(a(n,Ae)?this.setScale(n.x,n.y,n.z):this.setScale(n[0],n[1],n[2])),s&&this.setSize(s.x,s.y),h&&(a(h,_e)?this.setAnchor(h.x,h.y):this.setAnchor(h[0],h[1]))},e.addChild=function(t){y(this.children,t)},e.removeChild=function(t){g(this.children,t)},e.getRotation=function(){return t.getRotation(this.quat,new Hr)},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 Hr)},e.assignWorldTRS=function(t,e,r){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),r&&r.copyFrom(this.worldTRSCache.scale)},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={position:(new Ae).copyFrom(t.position),rotation:new Hr(t.eulerHint.x,t.eulerHint.y,t.eulerHint.z),scale:(new Ae).copyFrom(t.scale)};this.setTransform(e)},e.dispose=function(){},e.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},e.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t.getRotation=function(t,e){var r=zs.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},se(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}(),Gs=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=js(this.arc,this.arcMode,t)*ye,r=Math.cos(e)*this.radius,i=Math.sin(e)*this.radius,n=new Ae(r,i,0),s=Math.tan(this.angle*ye),a=n.clone().multiply(s);return a.z+=1,{position:n.multiply(K(0,1)),direction:a.normalize()}},t}();function js(t,e,r){if(e===Mt.RANDOM)t=K(0,t);else if(e===Mt.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===Mt.BIDIRECTIONAL_CYCLE){var n=r.index/(r.total+1),s=n-Math.floor(n);t*=Math.floor(n)%2?1-s:s}else e===Mt.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var Xs,Hs=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=js(this.arc,this.arcMode,t)*ye,r=new Ae(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),Ws=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=K(-this._d,this._d),r=K(-this._h,this._h);return{direction:new Ae(0,0,1),position:new Ae(e,r,0)}},t}(),Ys=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=js(this.arc,this.arcMode,t)*ye,r=new Ae(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,s=Math.atan2(n,i),a=Math.tan(e),o=new Ae;return e<s?o.set(i,i*a,0):e>=s&&e<Math.PI-s?o.set(n/a,n,0):e<Math.PI+s?o.set(-i,-i*a,0):e<2*Math.PI-s?o.set(-n/a,-n,0):o.set(i,i*a,0),{direction:r,position:o}},t}(),Zs=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Mt.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):K(0,1);return{direction:new Ae(0,1,0),position:new Ae(this._d*(e-.5),0,0)}},t}(),qs=new Pe,Ks=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=this.donutRadius,r=this.radius-e,i=K(0,2*Math.PI),n=js(this.arc,this.arcMode,t)*ye,s=qs.setFromRotationZ(n),a=new Ae(Math.cos(i),Math.sin(i),0),o=new Ae(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:s.transformNormal(a),position:s.transformPoint(o)}},t}(),Qs=new Pe,Js=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}var e=t.prototype;return e.getHorizontalAngle=function(){return K(-90,90)},e.generate=function(t){var e=js(this.arc,this.arcMode,t)*ye,r=this.getHorizontalAngle()*ye,i=this.radius,n=new Ae(Math.cos(r),0,Math.sin(r)),s=Qs.setFromRotationZ(e).transformNormal(n);return{position:s.clone().multiply(i),direction:s}},t}(),$s=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.getHorizontalAngle=function(){return K(0,90)},e}(Js),ta=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=Ee(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,r=e.length/2-1,i=Math.floor(js(r,this.arcMode,t)),n=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,s=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new Ae(n,s,0);return{position:new Ae(n*this.width,s*this.height,0),direction:a.normalize()}},t}(),ea=function(){function t(){}return t.prototype.generate=function(){return{position:new Ae,direction:new Ae}},t}(),ra=((Xs={})[ft.NONE]=ea,Xs[ft.CONE]=Gs,Xs[ft.SPHERE]=Js,Xs[ft.HEMISPHERE]=$s,Xs[ft.CIRCLE]=Hs,Xs[ft.DONUT]=Ks,Xs[ft.RECTANGLE]=Ws,Xs[ft.EDGE]=Zs,Xs[ft.RECTANGLE_EDGE]=Ys,Xs[ft.TEXTURE]=ta,Xs);function ia(t){if(!t)return new ea;var e=Ie({radius:1,arc:360,angle:0,arcMode:Mt.RANDOM},t),r=t.type,i=ra[r];if(!i)throw new Error("Invalid shape: "+r+".");var n=new i(e);if(r!==ft.NONE){var s=t.alignSpeedDirection,a=t.upDirection,o=void 0===a?[0,0,1]:a;n.alignSpeedDirection=s,n.upDirection=Ae.fromArray(o).normalize()}return n}function na(t,e,r,i,n){var s,a;if(n===function(t,e,r,i){for(var n=0,s=e,a=r-i;s<r;s+=i)n+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return n}(t,e,r,i)>0)for(s=e;s<r;s+=i)a=Ea(s,t[s],t[s+1],a);else for(s=r-i;s>=e;s-=i)a=Ea(s,t[s],t[s+1],a);return a&&va(a,a.next)&&(_a(a),a=a.next),a}function sa(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!va(i,i.next)&&0!==ma(i.prev,i,i.next))i=i.next;else{if(_a(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function aa(t){var e=t.prev,r=t,i=t.next;if(ma(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(pa(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&ma(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function oa(t,e,r,i){var n=t.prev,s=t,a=t.next;if(ma(n,s,a)>=0)return!1;for(var o=n.x<s.x?n.x<a.x?n.x:a.x:s.x<a.x?s.x:a.x,u=n.y<s.y?n.y<a.y?n.y:a.y:s.y<a.y?s.y:a.y,h=n.x>s.x?n.x>a.x?n.x:a.x:s.x>a.x?s.x:a.x,c=n.y>s.y?n.y>a.y?n.y:a.y:s.y>a.y?s.y:a.y,l=la(o,u,e,r,i),f=la(h,c,e,r,i),p=t.prevZ,d=t.nextZ;p&&p.z>=l&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&pa(n.x,n.y,s.x,s.y,a.x,a.y,p.x,p.y)&&ma(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&pa(n.x,n.y,s.x,s.y,a.x,a.y,d.x,d.y)&&ma(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=l;){if(p!==t.prev&&p!==t.next&&pa(n.x,n.y,s.x,s.y,a.x,a.y,p.x,p.y)&&ma(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&pa(n.x,n.y,s.x,s.y,a.x,a.y,d.x,d.y)&&ma(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function ua(t,e){return t.x-e.x}function ha(t,e){if(e=function(t,e){var r,i=e,n=t.x,s=t.y,a=-1/0;do{if(s<=i.y&&s>=i.next.y&&i.next.y!==i.y){var o=i.x+(s-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(o<=n&&o>a){if(a=o,o===n){if(s===i.y)return i;if(s===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!r)return null;if(n===a)return r;var u,h=r,c=r.x,l=r.y,f=1/0;i=r;do{n>=i.x&&i.x>=c&&n!==i.x&&pa(s<l?n:a,s,c,l,s<l?a:n,s,i.x,i.y)&&(u=Math.abs(s-i.y)/(n-i.x),ba(i,t)&&(u<f||u===f&&(i.x>r.x||i.x===r.x&&ca(r,i)))&&(r=i,f=u)),i=i.next}while(i!==h);return r}(t,e),e){var r=Ta(e,t);sa(e,e.next),sa(r,r.next)}}function ca(t,e){return ma(t.prev,t,e.prev)<0&&ma(e.next,t,t.next)<0}function la(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function fa(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function pa(t,e,r,i,n,s,a,o){return(n-a)*(e-o)-(t-a)*(s-o)>=0&&(t-a)*(i-o)-(r-a)*(e-o)>=0&&(r-a)*(s-o)-(n-a)*(i-o)>=0}function da(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&ya(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(ba(t,e)&&ba(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,s=(t.y+e.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&n<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(ma(t.prev,t,e.prev)||ma(t,e.prev,e))||va(t,e)&&ma(t.prev,t,t.next)>0&&ma(e.prev,e,e.next)>0)}function ma(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function va(t,e){return t.x===e.x&&t.y===e.y}function ya(t,e,r,i){var n=xa(ma(t,e,r)),s=xa(ma(t,e,i)),a=xa(ma(r,i,t)),o=xa(ma(r,i,e));return n!==s&&a!==o||(!(0!==n||!ga(t,r,e))||(!(0!==s||!ga(t,i,e))||(!(0!==a||!ga(r,t,i))||!(0!==o||!ga(r,e,i)))))}function ga(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function xa(t){return t>0?1:t<0?-1:0}function ba(t,e){return ma(t.prev,t,t.next)<0?ma(t,e,t.next)>=0&&ma(t,t.prev,e)>=0:ma(t,e,t.prev)<0||ma(t,t.next,e)<0}function Ta(t,e){var r=new Aa(t.i,t.x,t.y),i=new Aa(e.i,e.x,e.y),n=t.next,s=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,s.next=i,i.prev=s,i}function Ea(t,e,r,i){var n=new Aa(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function _a(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 Aa(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Ca=0;function Sa(t,e,r,i){r=r||2,Ca=i||0;var n,s,a,o,u,h,c,l=e&&e.length,f=l?e[0]*r:t.length,p=na(t,0,f,r,!0),d=[];if(!p||p.next===p.prev)return d;if(l&&(p=function(t,e,r,i){var n,s,a,o=[];for(n=0,s=e.length;n<s;n++)(a=na(t,e[n]*i,n<s-1?e[n+1]*i:t.length,i,!1))===a.next&&(a.steiner=!0),o.push(fa(a));for(o.sort(ua),n=0;n<o.length;n++)ha(o[n],r),r=sa(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=a=t[0],s=o=t[1];for(var m=r;m<f;m+=r)(u=t[m])<n&&(n=u),(h=t[m+1])<s&&(s=h),u>a&&(a=u),h>o&&(o=h);c=0!==(c=Math.max(a-n,o-s))?1/c:0}return wa(p,d,r,n,s,c),d}function wa(t,e,r,i,n,s,a){if(t){!a&&s&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=la(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,s,a,o,u,h=1;do{for(r=t,t=null,s=null,a=0;r;){for(a++,i=r,o=0,e=0;e<h&&(o++,i=i.nextZ);e++);for(u=h;o>0||u>0&&i;)0!==o&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,o--):(n=i,i=i.nextZ,u--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=i}s.nextZ=null,h*=2}while(a>1)}(n)}(t,i,n,s);for(var o,u,h=t;t.prev!==t.next;)if(o=t.prev,u=t.next,s?oa(t,i,n,s):aa(t))e.push(o.i/r+Ca),e.push(t.i/r+Ca),e.push(u.i/r+Ca),_a(t),t=u.next,h=u.next;else if((t=u)===h){a?1===a?wa(t=Ra(sa(t),e,r),e,r,i,n,s,2):2===a&&Oa(t,e,r,i,n,s):wa(sa(t),e,r,i,n,s,1);break}}}function Ra(t,e,r){var i=t;do{var n=i.prev,s=i.next.next;!va(n,s)&&ya(n,i,i.next,s)&&ba(n,s)&&ba(s,n)&&(e.push(n.i/r+Ca),e.push(i.i/r+Ca),e.push(s.i/r+Ca),_a(i),_a(i.next),i=t=s),i=i.next}while(i!==t);return sa(i)}function Oa(t,e,r,i,n,s){var a=t;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&da(a,o)){var u=Ta(a,o);return a=sa(a,a.next),u=sa(u,u.next),wa(a,e,r,i,n,s),void wa(u,e,r,i,n,s)}o=o.next}a=a.next}while(a!==t)}var Ma=2;function Pa(t,e){for(var r=t.s,i=t.p,n=r[1],s=i[1],a=0,o=0;o<n.length;o++){a+=n[o].length-1}var u,h=new Float32Array(a*jn),c=e.indexBase,l=void 0===c?0:c,f=e.uvTransform,p=0,d=0,m=0,v=1,y=1;f&&(d=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=s[b],_=s[b+1]||s[0],A=T,C=[0,0],S=0;S<A.length-1;S++){Fa(C,A[S],E,_,E[4],E[5],_[2],_[3]),R(C[0],C[1])}var w=Sa(Array.from(h),null,jn,l);return{aPoint:h,index:new Uint16Array(w)};function R(t,e){h[p++]=t/2,h[p++]=e/2,f?(g[0]=t,g[1]=e,La(g,g,x),h[p++]=d+(g[0]+1)/2*v,h[p++]=m+(g[1]+1)/2*y):(h[p++]=(t+1)/2,h[p++]=(e+1)/2),p+=Ma}}function Ia(t,e){for(var r=[],i=function(t){var e=[];return"gs"in t?t.gs.forEach((function(t){e.push({p:[Ct.SHAPE_POINTS,t.p],s:[Ct.SHAPE_SPLITS,t.s]})})):"g"in t?e.push({p:[Ct.SHAPE_POINTS,t.g.p],s:[Ct.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,s=0,a=0,o=0;o<i.length;o++){var u=Pa(i[o],{indexBase:n,uvTransform:e});n+=u.aPoint.length/5,r.push(u),s+=u.aPoint.length,a+=u.index.length}if(1===r.length)return r[0];for(var h=new Float32Array(s),c=new Uint16Array(a),l=0,f=0,p=0;l<r[l];l++){var d=r[l];h.set(d.aPoint,f),f+=d.aPoint.length,c.set(d.index,p),p+=d.index.length}return{aPoint:h,index:c}}function La(t,e,r){var i=Math.cos(r),n=Math.sin(r),s=e[0],a=e[1];return t[0]=i*s+n*a,t[1]=-n*s+i*a,t}function Fa(t,e,r,i,n,s,a,o){var u=1-e,h=u*u*u,c=3*e*u*u,l=3*e*e*u,f=e*e*e;return t[0]=h*r[0]+c*n+l*a+f*i[0],t[1]=h*r[1]+c*s+l*o+f*i[1],t}var Va=function(){function t(t){var e=t.time,r=t.interval,i=t.count,n=t.cycles,s=t.probability;this.time=+e||0,this.interval=+r||1,this.count=a(i,Tn)?i:Yn(i),this.cycles=+n||1/0,this.probability=isNaN(s)?1:+s,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}(),Da=function(t){this.content=t},Na=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 r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},e.shiftNode=function(t){var e=new Da(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(this.sort(r.content,e.content)<=0))return r.pre?this.insertNode(r.pre,e):(this.first=e,e.next=r,r.pre=e),e;if(!r.next)return this.insertNode(r,e),this.last=e;r=r.next}},e.pushNode=function(t){var e=new Da(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(this.sort(e.content,r.content)<=0))return this.insertNode(r,e),r===this.last&&(this.last=e),e;if(this.first===r)return r.pre=e,e.next=r,this.first=e;r=r.pre}},e.removeNode=function(t){var e=this.first;if(this.length--,e===t){var r=this.first=e.next;r&&(r.pre=null)}else if((e=this.last)===t){var i=this.last=e.pre;i&&(i.next=null)}else if(t){var n=t.pre,s=t.next;n.next=s,s&&(s.pre=n)}t.pre=null,t.next=null},e.forEach=function(t,e){var r=this.first,i=0;if(r)do{t.call(e||this,r.content,i++)}while(r=r.next)},e.forEachReverse=function(t,e){var r=this.last,i=this.length-1;if(r)do{t.call(e||this,r.content,i--)}while(r=r.pre)},e.getNodeByIndex=function(t){var e=0,r=this.first;if(!r||t>=this.length||t<0)return null;for(;e<t;)r=r.next,e++;return r},t}(),ka="lookup_texture",za="offscreen_canvas",Ua={};function Ba(t){return Ua[t]}var Ga=new Ae,ja=new Ae,Xa=function(){function t(t,e){this.pointStart=[];var r,i=e.colorOverLifetime,n=e.colorOverTrail,s=e.maxTrailCount,o=e.opacityOverLifetime,u=void 0===o?Yn(1):o,h=e.widthOverTrail,c=e.name,l=e.occlusion,f=e.blending,p=e.maskMode,d=e.textureMap,m=void 0===d?[0,0,1,1]:d,v=e.texture,y=e.transparentOcclusion,g=e.minimumVertexDistance,x=e.lifetime,b=e.matrix,T=t.gpuCapability,E=T.detail,_=T.level,A=Math.max(e.pointCountPerTrail,2),C={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},S=E.maxVertexTextures>0,w=(null!=(r=t.renderer)?r:{}).env,R={},O=[["ENABLE_VERTEX_TEXTURE",S],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",w===Xn]],M=s>64,P=0;i&&(O.push(["COLOR_OVER_LIFETIME",!0]),P|=1,R.uColorOverLifetime=ur.createWithData(t,I(i))),n&&(O.push(["COLOR_OVER_TRAIL",!0]),P|=4,R.uColorOverTrail=ur.createWithData(t,I(n))),M?(O.push(["ATTR_TRAIL_START",1]),P|=8):R.uTrailStart=new Float32Array(s),R.uOpacityOverLifetimeValue=u.toUniform(C);var L=h.toUniform(C);O.push(["VERT_CURVE_VALUE_COUNT",C.index],["VERT_MAX_KEY_FRAME_COUNT",C.max]),R.uVCurveValues=Tn.getAllData(C);var F={shader:{vertex:fi,fragment:ci,macros:O,glslVersion:1===_?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,name:"trail#"+c,cacheId:"-t:+"+P+"+"+C.index+"+"+C.max},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},V=A*s*2,D=(A-1)*s,N=Float32Array.BYTES_PER_ELEMENT,k=12*N,z={attributes:{aColor:{size:4,stride:k,data:new Float32Array(12*V)},aSeed:{size:1,stride:k,offset:4*N,dataSource:"aColor"},aInfo:{size:3,stride:k,offset:5*N,dataSource:"aColor"},aPos:{size:4,stride:k,offset:8*N,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(V)},aDir:{size:3,data:new Float32Array(3*V)}},indices:{data:new Uint16Array(6*V)},drawCount:6*D,name:"trail#"+c,bufferUsage:rr.DYNAMIC_DRAW};if(M)z.attributes.aTrailStart={size:1,data:new Float32Array(V)};else{var U=new Float32Array(V);z.attributes.aTrailStartIndex={size:1,data:U};for(var B=0;B<s;B++)for(var G=2*A,j=B*G,X=0;X<G;X++)U[j+X]=B}var H=wr(f),W=Nr.create(t,F);W.blending=!0,W.depthMask=l,W.depthTest=!0,Mr(W,p),Rr(W,f);var Y=this.mesh=ei.create(t,{name:"MTrail_"+c,material:W,geometry:jr.create(t,z)}),Z=null!=v?v:ur.createWithData(t);Object.keys(R).map((function(t){var e=R[t];if(a(e,ur))W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){for(var r=[],i=0;i<e.length;i+=4){var n=new Ce(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}W.setVector4Array(t,r)}else W.setVector4(t,Ce.fromArray(e))})),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",Ce.fromArray(L)),W.setVector2("uTexOffset",new _e(0,0)),W.setVector4("uTextureMap",Ce.fromArray(m)),W.setVector4("uParams",new Ce(0,A-1,0,0)),W.setTexture("uMaskTex",Z),W.setVector4("uColorParams",new Ce(v?1:0,+H,0,+(l&&!y))),this.maxTrailCount=s,this.pointCountPerTrail=A,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(s)}var e=t.prototype;return e.addPoint=function(t,e,r){r=r||{};var i=this.trailCursors[t],n=this.pointCountPerTrail,s=this.geometry,a=n-1,o=i%n,u=(i-1)%n,h=(i-2)%n,c=this.getTrailPosition(t,u,Ga);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var l=t*n+o,f=Za(c,e),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,v=6*l,y=new Float32Array(6);y.set(f,0),y.set(f,3),s.setAttributeSubData("aDir",v,y),s.setAttributeSubData("aTime",2*l,new Float32Array([p,p]));var g=r.color||[1,1,1,1],x=new Float32Array(24),b=e.toArray();if(x.set(g,0),x.set(d,4),x[7]=0,x.set(b,8),x[11]=.5*m,x.set(g,12),x.set(d,16),x[19]=1,x.set(b,20),x[23]=-.5*m,s.setAttributeSubData("aColor",24*l,x),u>=0){var T=this.getTrailPosition(t,h,ja),E=new Float32Array(Za(T,c,e)),_=6*(t*n+u);s.setAttributeSubData("aDir",_,E),s.setAttributeSubData("aDir",_+3,E);var A=t*n*2,C=new Uint16Array([2*u+A,2*u+1+A,2*o+A,2*o+A,2*u+1+A,2*o+1+A]),S=6*(t*a+(i-1)%a);s.setIndexSubData(S,C)}i=++this.trailCursors[t];var w=this.mesh.material,R=w.getVector4("uParams"),O=d[2];if(this.useAttributeTrailStart){for(var M=2*n,P=new Float32Array(M),I=0;I<M;I++)P[I]=O;s.setAttributeSubData("aTrailStart",t*P.length,P)}else{var L=w.getFloats("uTrailStart");null!=L&&(L[t]=O,w.setFloats("uTrailStart",L))}R&&(R.y=Math.max(R.y,i-1)-Math.max(0,i-n),w.setVector4("uParams",R))}},e.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=24*(t*i+e)+8,s=this.geometry.getAttributeData("aColor");return N(s),r.x=s[n],r.y=s[1+n],r.z=s[2+n],r}},e.clearAllTrails=function(){var t=this.geometry.getIndexData();N(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");N(e);for(var r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();N(r),r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),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){},se(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}(),Ha=new Ae,Wa=new Ae,Ya=new Ae;function Za(t,e,r){var i=Ha;return t||r?(t?r?(Wa.subtractVectors(e,t).normalize(),Wa.subtractVectors(r,e),Ya.copyFrom(Wa).normalize(),i.addVectors(Wa,Ya)):i.subtractVectors(e,t):i.subtractVectors(r,e),i.normalize().toArray()):[0,0,0]}var qa=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).lastTime=0,e}_t(e,t);var r=e.prototype;return r.start=function(t){var e=t.output.getUserData();!this.particleSystem&&a(e,exports.VFXItem)&&(this.particleSystem=e.getComponent(exports.ParticleSystem),this.particleSystem&&(this.particleSystem.name=e.name,this.particleSystem.startEmit(),this.particleSystem.initEmitterTransform()))},r.processFrame=function(t){this.time>=0&&this.start(t);var e=this.particleSystem;if(e){var r=t.deltaTime;this.time>=0&&this.time<e.item.duration&&e.isEnded()&&e.reset(),Math.abs(this.time-this.lastTime)<.001&&(r=0),e.update(r)}this.lastTime=this.time},e}(Vs),Ka=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){return new qa(t)},e}(Ns),Qa={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"},Ja=function(){function t(t,e){var r;this.particleCount=0,this.cachedRotationVector3=new Ae,this.cachedRotationMatrix=new Wr,this.cachedLinearMove=new Ae,this.tempMatrix3=new Wr,this.VERT_MAX_KEY_FRAME_COUNT=0;var i,n,s=(null!=(r=t.renderer)?r:{}).env,o=e.speedOverLifetime,u=e.colorOverLifetime,h=e.linearVelOverLifetime,c=e.orbitalVelOverLifetime,l=e.sizeOverLifetime,f=e.rotationOverLifetime,p=e.sprite,d=e.gravityModifier,m=e.maxCount,v=e.textureFlip,y=e.useSprite,g=e.name,x=e.gravity,b=e.forceTarget,T=e.side,E=e.occlusion,_=e.anchor,A=e.blending,C=e.maskMode,S=e.mask,w=e.transparentOcclusion,R=e.meshSlots,O=e.renderMode,M=void 0===O?0:O,P=e.diffuse,L=void 0===P?ur.createWithData(t):P,F=t.gpuCapability.detail,V=F.halfFloatTexture,D=F.maxVertexUniforms,N=[["RENDER_MODE",+M],["ENV_EDITOR",s===Xn]],k=t.gpuCapability.level,z={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},U={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},B=D>0,G={},j=0,X=0;(this.useSprite=y,B&&N.push(["ENABLE_VERTEX_TEXTURE",!0]),o&&(N.push(["SPEED_OVER_LIFETIME",!0]),X|=2,G.uSpeedLifetimeValue=o.toUniform(z)),(null==p?void 0:p.animate)&&(N.push(["USE_SPRITE",!0]),X|=4,G.uFSprite=G.uSprite=new Float32Array([p.col,p.row,p.total,p.blend?1:0]),this.useSprite=!0),(null==u?void 0:u.color)&&(N.push(["COLOR_OVER_LIFETIME",!0]),X|=16,G.uColorOverLifetime=a(u.color,ur)?u.color:ur.createWithData(t,I(u.color))),(null==u?void 0:u.opacity)?G.uOpacityOverLifetimeValue=u.opacity.toUniform(z):G.uOpacityOverLifetimeValue=Yn(1).toUniform(z),["x","y","z"].forEach((function(t,e){var r=0,n=0;(null==h?void 0:h[t])&&(G["uLinear"+t.toUpperCase()+"ByLifetimeValue"]=h[t].toUniform(z),r=1,X|=1<<7+e,h.enabled=!0),N.push(["LINEAR_VEL_"+t.toUpperCase(),r]),(null==c?void 0:c[t])&&(G["uOrb"+t.toUpperCase()+"ByLifetimeValue"]=c[t].toUniform(z),n=1,X|=1<<10+e,i=!0,c.enabled=!0),N.push(["ORB_VEL_"+t.toUpperCase(),n])})),(null==h?void 0:h.asMovement)&&(N.push(["AS_LINEAR_MOVEMENT",!0]),X|=32),i&&((null==c?void 0:c.asRotation)&&(N.push(["AS_ORBITAL_MOVEMENT",!0]),X|=64),G.uOrbCenter=new Float32Array((null==c?void 0:c.center)||[0,0,0])),G.uSizeByLifetimeValue=null==l?void 0:l.x.toUniform(z),null==l?void 0:l.separateAxes)&&(N.push(["SIZE_Y_BY_LIFE",1]),X|=16384,G.uSizeYByLifetimeValue=null==l||null==(n=l.y)?void 0:n.toUniform(z));(null==f?void 0:f.z)&&(G.uRZByLifeTimeValue=f.z.toUniform(z),X|=32768,N.push(["ROT_Z_LIFETIME",1])),(null==f?void 0:f.x)&&(G.uRXByLifeTimeValue=f.x.toUniform(z),X|=65536,N.push(["ROT_X_LIFETIME",1])),(null==f?void 0:f.y)&&(G.uRYByLifeTimeValue=f.y.toUniform(z),X|=1<<17,N.push(["ROT_Y_LIFETIME",1])),(null==f?void 0:f.asRotation)&&(N.push(["ROT_LIFETIME_AS_MOVEMENT",1]),X|=1<<18),G.uGravityModifierValue=d.toUniform(z),b&&(N.push(["FINAL_TARGET",!0]),X|=1<<19,G.uFinalTarget=new Float32Array(b.target||[0,0,0]),G.uForceCurve=b.curve.toUniform(z)),V&&U.max?(X|=1<<20,G.uFCurveValueTexture=hr(t,Tn.getAllData(U,!0),U.index,1)):G.uFCurveValues=Tn.getAllData(U);var H=z.max+z.curves.length-32>D;if(2===k&&(z.max=-1,z.index=R?R[0]:to(z.index),U.index>0&&(U.max=-1,U.index=R?R[1]:to(U.index))),H&&V&&B){var W=hr(t,Tn.getAllData(z,!0),z.index,1);G.uVCurveValueTexture=W,j=1}else G.uVCurveValues=Tn.getAllData(z);var Y=["-p:",M,X,z.index,z.max,U.index,U.max].join("+");N.push(["VERT_CURVE_VALUE_COUNT",z.index],["FRAG_CURVE_VALUE_COUNT",U.index],["VERT_MAX_KEY_FRAME_COUNT",z.max],["FRAG_MAX_KEY_FRAME_COUNT",U.max]),this.VERT_MAX_KEY_FRAME_COUNT=z.max;var Z={shader:{fragment:ci,vertex:"#define LOOKUP_TEXTURE_CURVE "+j+"\n"+li,glslVersion:1===k?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,shared:!0,cacheId:Y,macros:N,name:"particle#"+g},uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},q=wr(A);G.uTexOffset=new Float32Array(L?[1/L.getWidth(),1/L.getHeight()]:[0,0]),G.uMaskTex=L,G.uColorParams=new Float32Array([L?1:0,+q,0,+(!!E&&!w)]),G.uParams=[0,0,0,0],G.uAcceleration=[(null==x?void 0:x[0])||0,(null==x?void 0:x[1])||0,(null==x?void 0:x[2])||0,0];var K=Nr.create(t,Z);K.blending=!0,K.depthTest=!0,K.depthMask=!!E,K.stencilRef=S?[S,S]:void 0,Mr(K,C),Rr(K,A),Or(K,T),Object.keys(G).map((function(t){var e=G[t];if(a(e,ur))K.setTexture(t,e);else{var r=[];switch(Qa[t]){case"vec4":K.setVector4(t,Ce.fromArray(e));break;case"vec3":K.setVector3(t,Ae.fromArray(e));break;case"vec2":K.setVector2(t,_e.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new Ce(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}K.setVector4Array(t,r),r.length=0;break;default:console.warn("Uniform "+t+"'s type not in typeMap.")}}})),K.setVector3("emissionColor",new Ae(0,0,0)),K.setFloat("emissionIntensity",0);var Q=jr.create(t,function(t,e,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,s={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*i,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*i,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*i,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*i,data:new Float32Array(0)},aSeed:{size:1,offset:3*i,stride:8*i,dataSource:"aRot"},aColor:{size:4,offset:4*i,stride:8*i,dataSource:"aRot"},aOffset:{size:4,stride:4*i,data:new Float32Array(0)},aTranslation:{size:3,data:new Float32Array(0)},aLinearMove:{size:3,data:new Float32Array(0)},aRotation0:{size:3,offset:0,stride:9*i,data:new Float32Array(0)},aRotation1:{size:3,offset:3*i,stride:9*i,dataSource:"aRotation0"},aRotation2:{size:3,offset:6*i,stride:9*i,dataSource:"aRotation0"}};e&&(s.aSprite={size:3,stride:3*i,data:new Float32Array(0)});return{attributes:s,indices:{data:new Uint16Array(0)},name:r,maxVertex:t}}(4*m,this.useSprite,"particle#"+g)),J=ei.create(t,{name:"MParticle_"+g,material:K,geometry:Q});this.anchor=_,this.mesh=J,this.geometry=J.firstGeometry(),this.forceTarget=b,this.sizeOverLifetime=l,this.speedOverLifetime=o,this.linearVelOverLifetime=h,this.orbitalVelOverLifetime=c,this.orbitalVelOverLifetime=c,this.gravityModifier=d,this.rotationOverLifetime=f,this.maxCount=m,this.textureOffsets=v?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}var e=t.prototype;return e.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),r=32*t+4;return N(e),[e[r],e[r+1],e[r+2],e[r+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(),r=t.getIndexData(),i=0;i<e.length;i++){var n=e[i],s=t.getAttributeData(n);s&&t.setAttributeData(n,new s.constructor(0))}t.setIndexData(new r.constructor(0))},e.onUpdate=function(t){var e=this.geometry.getAttributeData("aPos"),r=Math.ceil(e.length/12);this.applyTranslation(r,t),this.applyRotation(r,t),this.applyLinearMove(r,t)},e.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),r=0;r<e.length;r+=4)e[r+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.setPoint=function(t,e){var r=this.maxCount;if(t<r){var i=t+1,n=4*i,s=this.geometry,a=i>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 c=new Ae,l=new Re,f=new Ae(1,1,1);e.transform.assignWorldTRS(c,l,f);var p,d=Bs.getRotation(l,new Hr),m=c.toArray(),v=d.toArray(),y=this.textureOffsets,g=[0,0,e.delay,e.lifetime],b=[0,0,1,1],T=e.vel,E=e.color,_=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],A=Math.random();h&&(p=e.sprite);for(var C=0;C<4;C++){var S=2*C,w=3*C,R=4*C,O=12*C,M=8*C;u.aPos.set(m,O),T.fill(u.aPos,O+3),u.aRot.set(v,M),u.aRot[M+3]=A,u.aRot.set(E,M+4),h&&u.aSprite.set(p,w);var P=e.uv||b;if(P){var I=h?1-y[S+1]:y[S+1];g[0]=P[0]+y[S]*P[2],g[1]=P[1]+I*P[3]}u.aOffset.set(g,R);for(var L=C+C,F=(_[L]-this.anchor.x)*f.x,V=(_[L+1]-this.anchor.y)*f.y,D=0;D<3;D++)u.aPos[O+6+D]=e.dirX.getElement(D)*F,u.aPos[O+9+D]=e.dirY.getElement(D)*V}var k=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(a){var z=x(s.getIndexData(),6*i,6*r,o);z.set(k,6*t),s.setIndexData(z),this.maxParticleBufferCount=z.length/6}else s.setIndexSubData(6*t,k);Object.keys(u).forEach((function(e){var i=u[e],h=s.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(a){var c=s.getAttributeData(e);N(c);var l=x(c,n*h,4*r*h,o);l.set(i,i.length*t),s.setAttributeData(e,l)}else s.setAttributeSubData(e,i.length*t,i)})),this.particleCount=Math.max(i,this.particleCount),s.setDrawCount(6*this.particleCount)}},e.applyTranslation=function(t,e){var r=this.time,i=this.geometry.getAttributeData("aTranslation"),n=this.geometry.getAttributeData("aVel"),s=this.geometry.getAttributeData("aOffset");i.length<3*t&&(i=this.expandArray(i,3*t));for(var a=0,o=0,u=0,h=this.mesh.material.getVector4("uAcceleration"),c=this.mesh.material.getVector4("uGravityModifierValue"),l=0;l<t;l+=4){var f=12*l+3;a=n[f],o=n[f+1],u=n[f+2];var p=r-s[4*l+2],d=s[4*l+3];if(h&&c){var m=this.gravityModifier.getIntegrateValue(0,p,d),v=h.x*m,y=h.y*m,g=h.z*m;if(this.speedOverLifetime){var x=this.speedOverLifetime.getValue(p/d);a=a*x+v,o=o*x+y,u=u*x+g}else a+=v,o+=y,u+=g}var b=3*l;if(s[4*l+2]<r){var T=a*(e/1e3),E=o*(e/1e3),_=u*(e/1e3);i[b]+=T,i[b+1]+=E,i[b+2]+=_,i[b+3]+=T,i[b+4]+=E,i[b+5]+=_,i[b+6]+=T,i[b+7]+=E,i[b+8]+=_,i[b+9]+=T,i[b+10]+=E,i[b+11]+=_}}this.geometry.setAttributeData("aTranslation",i)},e.applyRotation=function(t,e){var r=this.geometry.getAttributeData("aRotation0"),i=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aRot"),s=this.geometry.getAttributeData("aSeed"),o=this.time,u=this.cachedRotationMatrix;r.length<9*t&&(r=this.expandArray(r,9*t));for(var h=0;h<t;h+=4){var c=Ee((o-i[4*h+2])/i[4*h+3],0,1),l=8*h,f=this.cachedRotationVector3.set(n[l],n[l+1],n[l+2]),p=s[8*h+3],d=f;this.rotationOverLifetime?(this.rotationOverLifetime.x&&(a(this.rotationOverLifetime.x,An)?d.x+=this.rotationOverLifetime.x.getValue(c,p):d.x+=this.rotationOverLifetime.x.getValue(c)),this.rotationOverLifetime.y&&(a(this.rotationOverLifetime.y,An)?d.y+=this.rotationOverLifetime.y.getValue(c,p):d.y+=this.rotationOverLifetime.y.getValue(c)),this.rotationOverLifetime.z&&(a(this.rotationOverLifetime.z,An)?d.z+=this.rotationOverLifetime.z.getValue(c,p):d.z+=this.rotationOverLifetime.z.getValue(c))):u.setZero(),0===d.dot(d)&&u.identity();var m=Math.PI/180,v=d.x*m,y=d.y*m,g=d.z*m,x=Math.sin(v),b=Math.sin(y),T=Math.sin(g),E=Math.cos(v),_=Math.cos(y),A=Math.cos(g);u.set(A,-T,0,T,A,0,0,0,1),u.multiply(this.tempMatrix3.set(_,0,b,0,1,0,-b,0,_)),u.multiply(this.tempMatrix3.set(1,0,0,0,E,-x,0,x,E));var C=9*h,S=u.elements;r.set(S,C),h+4<=t&&(r.set(S,C+9),r.set(S,C+18),r.set(S,C+27))}this.geometry.setAttributeData("aRotation0",r)},e.applyLinearMove=function(t,e){var r=this.geometry.getAttributeData("aLinearMove"),i=this.geometry.getAttributeData("aOffset"),n=this.geometry.getAttributeData("aSeed"),s=this.time;r.length<3*t&&(r=this.expandArray(r,3*t));var o=this.cachedLinearMove;if(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled)for(var u=0;u<t;u+=4){var h=s-i[4*u+2],c=i[4*u+3],l=h/c,f=n[8*u+3];o.setZero(),this.linearVelOverLifetime.asMovement?(this.linearVelOverLifetime.x&&(a(this.linearVelOverLifetime.x,An)?o.x=this.linearVelOverLifetime.x.getValue(l,f):o.x=this.linearVelOverLifetime.x.getValue(l)),this.linearVelOverLifetime.y&&(a(this.linearVelOverLifetime.y,An)?o.y=this.linearVelOverLifetime.y.getValue(l,f):o.y=this.linearVelOverLifetime.y.getValue(l)),this.linearVelOverLifetime.z&&(a(this.linearVelOverLifetime.z,An)?o.z=this.linearVelOverLifetime.z.getValue(l,f):o.z=this.linearVelOverLifetime.z.getValue(l))):(this.linearVelOverLifetime.x&&(a(this.linearVelOverLifetime.x,An)?o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,f):o.x=this.linearVelOverLifetime.x.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.y&&(a(this.linearVelOverLifetime.y,An)?o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,f):o.y=this.linearVelOverLifetime.y.getIntegrateValue(0,h,c)),this.linearVelOverLifetime.z&&(a(this.linearVelOverLifetime.z,An)?o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,f):o.z=this.linearVelOverLifetime.z.getIntegrateValue(0,h,c)));var p=3*u;r[p]=o.x,r[p+1]=o.y,r[p+2]=o.z,r[p+3]=o.x,r[p+4]=o.y,r[p+5]=o.z,r[p+6]=o.x,r[p+7]=o.y,r[p+8]=o.z,r[p+9]=o.x,r[p+10]=o.y,r[p+11]=o.z}this.geometry.setAttributeData("aLinearMove",r)},e.expandArray=function(t,e){var r=new Float32Array(e);return r.set(t),r},t}(),$a=[10,32,64,160];function to(t){for(var e=0;e<$a.length;e++){var r=$a[e];if(r>t)return r}return t||$a[0]}var eo=function(t){function e(e,r,i){var n;(n=t.call(this,e)||this).name="ParticleSystemRenderer",r&&(n.particleMesh=new Ja(e,r)),i&&(n.trailMesh=new Xa(e,i));var s=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(s.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=s,n}_t(e,t);var r=e.prototype;return r.onStart=function(){this._priority=this.item.renderOrder,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);for(var t,e=s(this.meshes);!(t=e()).done;){t.value.onStart()}},r.onUpdate=function(t){var e,r=this.particleMesh.time,i=null!=(e=this.particleMesh.mesh.material.getVector4("uParams"))?e:new Ce;this.particleMesh.mesh.material.setVector4("uParams",i.set(r,this.item.duration,0,0))},r.render=function(t){for(var e,r=s(this.meshes);!(e=r()).done;){e.value.render(t)}},r.reset=function(){var t;this.particleMesh.clearPoints(),null==(t=this.trailMesh)||t.clearAllTrails()},r.updateTime=function(t,e){this.particleMesh.time=t,this.particleMesh.onUpdate(e),this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},r.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null==(e=this.trailMesh)||e.minusTime(t)},r.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},r.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null==(e=this.trailMesh)||e.mesh.setVisible(t)},r.getTextures=function(){var t=[],e=this.particleMesh.mesh.material.textures;if(Object.keys(e).forEach((function(r){t.push(e[r])})),this.trailMesh){var r=this.trailMesh.mesh.material.textures;Object.keys(r).forEach((function(e){t.push(r[e])}))}return t},r.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},r.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},r.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},r.hasTrail=function(){return void 0!==this.trailMesh},r.clearTrail=function(t){var e;null==(e=this.trailMesh)||e.clearTrail(t)},r.addTrailPoint=function(t,e,r){var i;null==(i=this.trailMesh)||i.addPoint(t,e,r)},r.setTrailStartPosition=function(t,e){var r;null==(r=this.trailMesh)||r.setPointStartPos(t,e)},r.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(me);exports.ParticleSystem=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).destroyed=!1,i.getHitTestParams=function(t){var e=i.interaction;if(t||e)return{type:exports.HitTestType.custom,collect:function(t){return i.raycast({radius:(null==e?void 0:e.radius)||.4,multiple:!!(null==e?void 0:e.multiple),removeParticle:(null==e?void 0:e.behavior)===Ot.removeParticle,ray:t})}}},r&&i.fromData(r),i}_t(e,t);var r=e.prototype;return r.isFrozen=function(){return this.frozen},r.isEnded=function(){return this.ended},r.initEmitterTransform=function(){var t,e=this.item.transform.position.clone(),r=this.item.transform.rotation.clone(),i=this.props.emitterTransform&&this.props.emitterTransform.path;i&&(i[0]===Ct.CONSTANT_VEC3?e.add(i[1]):t=Yn(i)),this.basicTransform={position:e,rotation:r,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 s=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(s)}},r.updateEmitterTransform=function(t){var e=this.basicTransform,r=e.path,i=e.position.clone();if(r){var n=this.item.duration;i.add(r.getValue(t/n))}if(this.transform.setPosition(i.x,i.y,i.z),this.options.particleFollowParent){var s=this.transform.getWorldMatrix();this.renderer.updateWorldMatrix(s)}},r.addParticle=function(t,e){var r,i=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(i.length<e)r=n[1]=i.length;else{var s=i.first;i.removeNode(s),r=n[1]=s.content[1]}i.pushNode(n),this.renderer.setParticlePoint(r,t),this.clearPointTrail(r),this.transform.parentTransform&&this.renderer.setTrailStartPosition(r,this.transform.parentTransform.position.clone())},r.setVisible=function(t){this.renderer.setVisible(t)},r.setOpacity=function(t){var e,r=this.renderer.particleMesh.mesh.material,i=this.renderer.particleMesh.mesh.geometry,n=(null==(e=r.getVector4("uOpacityOverLifetimeValue"))?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new Ce(n[0],n[1],n[2],t));for(var s=i.getAttributeData("aColor")||[],a=0;a<s.length;a+=32)s[8*a+7]=t},r.setColor=function(t,e,r,i){var n,s=this.renderer.particleMesh.mesh.material,a=this.renderer.particleMesh.mesh.geometry,o=(null==(n=s.getVector4("uOpacityOverLifetimeValue"))?void 0:n.toArray())||[1,1,1,1];s.setVector4("uOpacityOverLifetimeValue",new Ce(o[0],o[1],o[2],i));for(var u=a.getAttributeData("aColor")||[],h=0;h<u.length;h+=32)u[8*h+4]=t,u[8*h+5]=e,u[8*h+6]=r,u[8*h+7]=i},r.setParentTransform=function(t){},r.getTextures=function(){return this.renderer.getTextures()},r.startEmit=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},r.stop=function(){this.ended=!0,this.started=!1},r.reset=function(){this.renderer.reset(),this.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new Na((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},r.update=function(t){var e=this;if(this.started&&!this.frozen){var r=this.lastUpdate+t/1e3,i=this.options,n=this.loopStartTime,s=this.emission;this.lastUpdate=r,this.upDirectionWorld=null,this.renderer.updateTime(r,t);var a=this.particleLink,o=(r-n)/this.item.duration,u=this.timePassed,h=!1,c=function(){e.trails&&!h&&(h=!0,a.forEach((function(t){var r=t[0],i=t[1],n=t[2],s=t[3];r<u?e.clearPointTrail(i):u>n&&e.updatePointTrail(i,o,s,n)})))};if(this.ended){if(this.item.endBehavior!==wt.restart&&wt.destroy===this.item.endBehavior){var l=a.last;l&&l.content[0]<this.lastUpdate&&(this.destroyed=!0)}}else{var f=this.item.duration,p=this.lifetime;if(u<f){var d=1/s.rateOverTime.getValue(p),m=Math.floor((u-this.lastEmitTime)/d),v=m,y=d/m,g=r,x=i.maxCount;this.updateEmitterTransform(u);for(var b=function(){var t=a.first;return e.emissionStopped||a.length===x&&t&&t.content[0]-n>u},T=0;T<v&&T<x&&!b();T++){var E=this.createPoint(p);E.delay+=g+T*y,this.addParticle(E,x),this.lastEmitTime=u}for(var _=s.bursts,A=(null==_?void 0:_.length)-1,C=0;A>=0&&C<x&&!b();A--){var S=_[A],w=!S.disabled&&S.getGeneratorOptions(u,p);if(w){var R=s.burstOffsets[A],O=R&&R[w.cycleIndex]||[0,0,0];S.once&&this.removeBurst(A);for(var M=0;M<w.count&&C<x;M++){var P;if(b())break;var I=this.initPoint(this.shape.generate({total:w.total,index:w.index,burstIndex:M,burstCount:w.count}));I.delay+=g,C++,(P=I.transform).translate.apply(P,[].concat(O)),this.addParticle(I,x)}}}}else if(this.item.endBehavior===wt.restart)c(),this.loopStartTime=r-f,this.lastEmitTime-=f,this.lastUpdate-=f,s.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=f,t[2]-=f,t[3].delay-=f})),this.renderer.minusTimeForLoop(f);else{this.ended=!0,this.item.endBehavior===wt.freeze&&(this.frozen=!0)}}c()}},r.onDestroy=function(){this.item&&this.item.composition&&(this.item.composition.destroyTextures(this.getTextures()),this.meshes.forEach((function(t){return t.dispose({material:{textures:exports.DestroyOptions.keep}})})))},r.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,r=[],i=this.particleCount,n=0;if(!t||!e)return r;for(var s=t.last,a=!1;!a;){var o=s.content[0],u=s.content[3];if(o>this.timePassed){var h=this.getPointPosition(u);r.push({center:h,size:u.transform.scale}),s.pre?s=s.pre:a=!0}++n>i&&(a=!0)}return r},r.raycast=function(t){var e=this.particleLink,r=this.renderer;if(e&&r){var i=e.last,n=[],s=new Ae,a=!1;if(i&&i.content)do{var o=i.content,u=o[0],h=o[1];o[2];var c=o[3];if(!(u>this.timePassed))break;var l=this.getPointPosition(c),f=t.ray,p=!1;f&&(p=!!f.intersectSphere({center:l,radius:t.radius},s)),p&&(t.removeParticle&&(r.removeParticlePoint(h),this.clearPointTrail(h),i.content=[0]),n.push(l),t.multiple||(a=!0))}while((i=i.pre)&&!a);return n}},r.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},r.updatePointTrail=function(t,e,r,i){var n=this.renderer;if(n.hasTrail()){var s=this.trails,a=this.getPointPosition(r),o=s.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],u=r.transform.getWorldScale().toArray(),h=1,c=s.lifetime.getValue(e);if(s.sizeAffectsWidth&&(h*=u[0]),s.sizeAffectsLifetime&&(c*=u[0]),s.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var l=n.getTrailStartPosition(t);l&&a.subtract(l)}n.addTrailPoint(t,a,{color:o,lifetime:c,size:h,time:i})}},r.getPointPositionByIndex=function(t){var e=this.particleLink.getNodeByIndex(t);return e?this.getPointPosition(e.content[3]):(console.error("Get point error."),null)},r.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,s=t.gravity,a=void 0===s?[]:s,o=this.options.forceTarget,u=this.lastUpdate-n,h=new Ae,c=Ae.fromArray(a);e.assignWorldTRS(h);var l=Zi(new Ae,this.options,c,u,i,h,r);if(o){var f=o.target||[0,0,0],p=o.curve.getValue(u/i),d=1-p;l.x=l.x*d+f[0]*p,l.y=l.y*d+f[1]*p,l.z=l.z*d+f[2]*p}return l},r.initPoint=function(t){var e=this.options,r=this.lifetime,i=this.shape,n=e.startSpeed.getValue(r),s=e.particleFollowParent?Pe.IDENTITY:this.transform.getWorldMatrix(),a=t.position,o=s.transformPoint(a,new Ae),u=new Bs({position:o,valid:!0}),h=t.direction;if(h=s.transformNormal(h,ro).normalize(),e.startTurbulence&&e.turbulence){for(var c=0;c<3;c++)oo.setElement(c,e.turbulence[c].getValue(r));uo.setFromVector3(oo.negate()),co.setFromEuler(uo).transformNormal(h).normalize()}var l,f=so,p=ao;i.alignSpeedDirection?(p.copyFrom(h),this.upDirectionWorld||(i.upDirection?this.upDirectionWorld=i.upDirection.clone():this.upDirectionWorld=Ae.Z.clone(),s.transformNormal(this.upDirectionWorld)),f.crossVectors(p,this.upDirectionWorld).normalize(),f.isZero()&&f.set(1,0,0)):(f.set(1,0,0),p.set(0,1,0));var d=this.textureSheetAnimation;d&&d.animate&&((l=ho)[0]=d.animationDelay.getValue(r),l[1]=d.animationDuration.getValue(r),l[2]=d.cycles.getValue(r));var m=no;e.start3DRotation?m.set(e.startRotationX.getValue(r),e.startRotationY.getValue(r),e.startRotationZ.getValue(r)):e.startRotation?m.set(0,0,e.startRotation.getValue(r)):m.set(0,0,0),u.setRotation(m.x,m.y,m.z);var v=e.startColor.getValue(r);3===v.length&&(v[3]=1);var y=io;if(e.start3DSize)y.x=e.startSizeX.getValue(r),y.y=e.startSizeY.getValue(r);else{var g=e.startSize.getValue(r),x=e.sizeAspect.getValue(r);y.x=g,y.y=0===x?0:g/x}var b=h.clone();if(b.multiply(n),!e.particleFollowParent){var T=new Ae;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(r),lifetime:e.startLifetime.getValue(r),uv:fo(this.uvs,!0),gravity:e.gravity,sprite:l,dirY:p,dirX:f,transform:u}},r.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&a(e,Array)){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return-1},r.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},r.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))},r.stopParticleEmission=function(){this.emissionStopped=!0},r.resumeParticleEmission=function(){this.emissionStopped=!1},r.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:exports.HitTestType.sphere,area:t}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e;this.props=r,this.destroyed=!1;var i,n,s,o,u,h=r.options,c=r.positionOverLifetime,l=void 0===c?{}:c,f=r.shape,p=null==l?void 0:l.gravityOverLifetime,d=qi(null==l?void 0:l.gravity),m=r.textureSheetAnimation,v=m?{animationDelay:Yn(m.animationDelay||0),animationDuration:Yn(m.animationDuration||1),cycles:Yn(m.cycles||1),animate:m.animate,col:m.col,row:m.row,total:m.total||m.col*m.row}:void 0,y=!!(f&&f.turbulenceX||(null==f?void 0:f.turbulenceY)||(null==f?void 0:f.turbulenceZ));y&&(i=[Yn(null!=(n=f.turbulenceX)?n:0),Yn(null!=(s=f.turbulenceY)?s:0),Yn(null!=(o=f.turbulenceZ)?o:0)]);this.name="ParticleSystem",this.shape=ia(f),this.emission={rateOverTime:Yn(r.emission.rateOverTime),burstOffsets:lo(null!=(u=r.emission.burstOffsets)?u:[]),bursts:(r.emission.bursts||[]).map((function(t){return new Va(t)}))},this.textureSheetAnimation=v;var g,x,b=r.renderer||{},T=r.rotationOverLifetime;T&&((g={}).asRotation=!!T.asRotation,g.z=T.z?Yn(T.z):Yn(0),T.separateAxes&&(g.x=T.x&&Yn(T.x),g.y=T.y&&Yn(T.y))),(null==l?void 0:l.forceTarget)&&(x={target:l.target||[0,0,0],curve:Yn(l.forceCurve||[Ct.LINE,[[0,0],[1,1]]])});var E={x:l.linearX&&Yn(l.linearX||0),y:l.linearY&&Yn(l.linearY||0),z:l.linearZ&&Yn(l.linearZ||0),asMovement:l.asMovement},_={x:l.orbitalX&&Yn(l.orbitalX),y:l.orbitalY&&Yn(l.orbitalY),z:l.orbitalZ&&Yn(l.orbitalZ),center:l.orbCenter,asRotation:l.asRotation},A=r.sizeOverLifetime||{},C=r.colorOverLifetime,S=(null==A?void 0:A.separateAxes)?{separateAxes:!0,x:Yn(A.x),y:Yn(A.y)}:{separateAxes:!1,x:Yn(("size"in A?A.size:A.x)||1)};b.anchor=b.anchor||[0,0];var w,R,O=_e.fromArray(b.anchor);this.options={particleFollowParent:!!h.particleFollowParent,startLifetime:Yn(h.startLifetime),startDelay:Yn(h.startDelay||0),startSpeed:Yn(l.startSpeed||0),startColor:Yn(h.startColor),looping:!1,maxCount:null!=(w=h.maxCount)?w:0,gravityModifier:Yn(p||0),gravity:d,start3DSize:!!h.start3DSize,startTurbulence:y,turbulence:i,speedOverLifetime:l.speedOverLifetime&&Yn(l.speedOverLifetime),linearVelOverLifetime:E,orbitalVelOverLifetime:_,forceTarget:x},h.startRotationZ&&(this.options.startRotation=Yn(h.startRotationZ||0)),(h.startRotationX||h.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=Yn(h.startRotationX||0),this.options.startRotationY=Yn(h.startRotationY||0),this.options.startRotationZ=Yn(h.startRotationZ||0)),h.start3DSize?(this.options.startSizeX=Yn(h.startSizeX),this.options.startSizeY=Yn(h.startSizeY)):(this.options.startSize=Yn(h.startSize),this.options.sizeAspect=Yn(h.sizeAspect||1));var M={meshSlots:h.meshSlots,name:this.name,matrix:Pe.IDENTITY,shaderCachePrefix:"",renderMode:b.renderMode||yt.BILLBOARD,side:b.side||ct.DOUBLE,gravity:d,blending:b.blending||ht.ALPHA,rotationOverLifetime:g,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:v,occlusion:!!b.occlusion,transparentOcclusion:!!b.transparentOcclusion,maxCount:h.maxCount,mask:b.mask,maskMode:null!=(R=b.maskMode)?R:lt.NONE,forceTarget:x,diffuse:b.texture,sizeOverLifetime:S,anchor:O};if(C){var P=C.color,I=C.opacity;M.colorOverLifetime={},I&&(M.colorOverLifetime.opacity=Yn(C.opacity)),P&&(P[0]===Ct.GRADIENT_COLOR?M.colorOverLifetime.color=C.color[1]:P[0]===Ct.RGBA_COLOR?M.colorOverLifetime.color=ur.createWithData(this.engine,{data:new Uint8Array(P[1]),width:1,height:1}):a(P,ur)&&(M.colorOverLifetime.color=P))}var L,F=[],V=[0,0,1,1];if(r.splits){var D=r.splits[0];V=(L=D[4])?[D[0],D[1],D[3],D[2]]:[D[0],D[1],D[2],D[3]]}if(v&&!v.animate)for(var N=L?v.row:v.col,k=L?v.col:v.row,z=v.total||N*k,U=0,B=0;B<N;B++)for(var G=0;G<k&&U<z;G++,U++)F.push([B*V[2]/N+V[0],G*V[3]/k+V[1],V[2]/N,V[3]/k]);else F.push(V);this.uvs=F,M.textureFlip=L;var j,X=r.trails;X&&(this.trails={lifetime:Yn(X.lifetime),dieWithParticles:!1!==X.dieWithParticles,sizeAffectsWidth:!!X.sizeAffectsWidth,sizeAffectsLifetime:!!X.sizeAffectsLifetime,inheritParticleColor:!!X.inheritParticleColor,parentAffectsPosition:!!X.parentAffectsPosition},j={name:"Trail",matrix:Pe.IDENTITY,minimumVertexDistance:X.minimumVertexDistance||.02,maxTrailCount:h.maxCount,pointCountPerTrail:Math.round(X.maxPointPerTrail)||32,blending:X.blending,texture:X.texture,opacityOverLifetime:Yn(X.opacityOverLifetime||1),widthOverTrail:Yn(X.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!X.occlusion,transparentOcclusion:!!X.transparentOcclusion,textureMap:X.textureMap,mask:b.mask,maskMode:b.maskMode},X.colorOverLifetime&&X.colorOverLifetime[0]===Ct.GRADIENT_COLOR&&(j.colorOverLifetime=X.colorOverLifetime[1]),X.colorOverTrail&&X.colorOverTrail[0]===Ct.GRADIENT_COLOR&&(j.colorOverTrail=X.colorOverTrail[1])),this.renderer=new eo(this.engine,M,j),this.renderer.item=this.item,this.meshes=this.renderer.meshes;var H,W=r.interaction;W&&(this.interaction={multiple:W.multiple,radius:null!=(H=W.radius)?H:.4,behavior:W.behavior});this.item.getHitTestParams=this.getHitTestParams,this.item._content=this},se(e,[{key:"timePassed",get:function(){return this.lastUpdate-this.loopStartTime}},{key:"lifetime",get:function(){return this.timePassed/this.item.duration}},{key:"particleCount",get:function(){return this.particleLink.length}},{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}(pe),exports.ParticleSystem=u([he(Kt.ParticleSystem)],exports.ParticleSystem);var ro=new Ae,io=new _e,no=new Hr,so=new Ae,ao=new Ae,oo=new Ae,uo=new Hr,ho=[0,0,0],co=new Pe;function lo(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var r=a(t,Array),i=r?t[0]:t.index,n=e[i];n||(n=e[i]=[]),r?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function fo(t,e){var r=Math.floor(Math.random()*t.length),i=t[r];return e||t.splice(r,1),i}var po,mo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clipPlayables=[],e.clipWeights=[],e}_t(e,t);var r=e.prototype;return r.processFrame=function(t){for(var e,r=s(this.clipPlayables);!(e=r()).done;){e.value.processFrame(t)}this.evaluate(t)},r.setClipWeight=function(t,e){if(a(t,Vs)){for(var r=0;r<this.clipPlayables.length;r++)if(this.clipPlayables[r]===t)return void(this.clipWeights[r]=e)}else this.clipWeights.length<t+1&&(this.clipWeights.length=t+1),this.clipWeights[t]=e},r.getClipWeight=function(t){return this.clipWeights[t]},r.getClipPlayable=function(t){return this.clipPlayables[t]},r.evaluate=function(t){},e}(Vs),vo=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(a(e,exports.VFXItem)){for(var r=e,i=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){i=!0;break}i?(r.transform.setValid(!0),r.setActive(!0)):(r.transform.setValid(!1),r.setActive(!1))}},e}(mo),yo=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}(Vs),go=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 r=!1;if(this.propertyValue=e[this.propertyName],void 0!==this.propertyValue&&null!==this.propertyValue){this.resetPropertyValue();for(var i=0;i<this.clipPlayables.length;i++){var n=this.getClipWeight(i);if(n>0){var s=this.getClipPlayable(i);if(!a(s,yo)){console.error("PropertyTrack added non-PropertyPlayableAsset");continue}var o=s.value;this.addWeightedValue(o,n),r=!0}}r&&(e[this.propertyName]=this.propertyValue)}}},e}(mo),xo=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.setZero()},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.r+=t.r*e,r.g+=t.g*e,r.b+=t.b*e,r.a+=t.a*e},e}(go),bo=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue=0},r.addWeightedValue=function(t,e){this.propertyValue+=t*e},e}(go),To=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.evaluate=function(t){},e}(mo),Eo=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.evaluate=function(t){},e}(mo),_o=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();a(e,No)&&(e.time=this.getTime())},e}(Vs),Ao=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.evaluate=function(t){var e=t.output.getUserData();if(a(e,No)){for(var r=e,i=!1,n=0;n<this.clipPlayables.length;n++)if(this.getClipWeight(n)>0){i=!0;break}i?r.item.setActive(!0):r.item.setActive(!1)}},e}(mo),Co=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.evaluate=function(t){},e}(mo),So=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0,this.propertyValue.z=0,this.propertyValue.w=0},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.x+=t.x*e,r.y+=t.y*e,r.z+=t.z*e,r.w+=t.w*e},e}(go),wo=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.resetPropertyValue=function(){this.propertyValue.x=0,this.propertyValue.y=0},r.addWeightedValue=function(t,e){var r=this.propertyValue;r.x+=t.x*e,r.y+=t.y*e},e}(go),Ro=function(){function t(){this.start=0,this.duration=0}return t.prototype.toLocalTime=function(t){var e=t-this.start,r=this.duration;return e-r>0&&(this.endBehavior===wt.restart?e%=r:this.endBehavior===wt.freeze&&(e=Math.min(r,e))),e},t}();exports.TrackAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).trackType=0,e.clipSeed=0,e.clips=[],e.children=[],e}_t(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){this.parent&&(this.boundObject=this.parent.boundObject)},r.createTrackMixer=function(t){return new mo(t)},r.createOutput=function(){return new Ds},r.createPlayableGraph=function(t,e){return this.createMixerPlayableGraph(t,e)},r.createMixerPlayableGraph=function(t,e){for(var r,i=[],n=s(this.clips);!(r=n()).done;){var a=r.value;i.push(a)}return this.compileClips(t,i,e)},r.compileClips=function(t,e,r){for(var i,n=this.createTrackMixer(t),a=s(e);!(i=a()).done;){var o=i.value,u=this.createClipPlayable(t,o);u.setDuration(o.duration);var h=new Oo(o,u,n,this);r.push(h),n.clipPlayables.push(u),n.setClipWeight(u,0)}return n},r.createPlayable=function(t){return new Vs(t)},r.getChildTracks=function(){return this.children},r.addChild=function(t){this.children.push(t),t.parent=this},r.createClip=function(t,e){var r=new Ro;return r.asset=new t(this.engine),r.name=e||"TimelineClip"+r.id,this.addClip(r),r},r.getClips=function(){return this.clips},r.findClip=function(t){for(var e,r=s(this.clips);!(e=r()).done;){var i=e.value;if(i.name===t)return i}},r.addClip=function(t){t.id=(this.clipSeed++).toString(),this.clips.push(t)},r.createClipPlayable=function(t,e){return e.asset.createPlayable(t)},r.fromData=function(e){t.prototype.fromData.call(this,e);for(var r,i=s(this.children);!(r=i()).done;){r.value.parent=this}},e}(Ns),u([ce(Ro)],exports.TrackAsset.prototype,"clips",void 0),u([ce()],exports.TrackAsset.prototype,"children",void 0),exports.TrackAsset=u([he(Kt.TrackAsset)],exports.TrackAsset),exports.TrackType=void 0,(po=exports.TrackType||(exports.TrackType={}))[po.MasterTrack=0]="MasterTrack",po[po.ObjectTrack=1]="ObjectTrack";var Oo=function(){function t(t,e,r,i){this.clip=t,this.playable=e,this.parentMixer=r,this.track=i,a(this.track.boundObject,exports.VFXItem)&&(this.particleSystem=this.track.boundObject.getComponent(exports.ParticleSystem))}return t.prototype.evaluateAt=function(t){var e=this.clip,r=1,i=!1,n=!1,s=this.track.boundObject;t>=e.start+e.duration&&e.endBehavior===wt.destroy?a(s,exports.VFXItem)&&exports.VFXItem.isParticle(s)&&this.particleSystem&&!this.particleSystem.destroyed?r=1:(r=0,i=!0):t-this.clip.start>=0?(r=1,n=!0):t<e.start&&(r=0),n&&this.playable.getPlayState()!==Ps.Playing&&this.playable.play(),this.parentMixer.setClipWeight(this.playable,r);var o=parseFloat(e.toLocalTime(t).toFixed(3));this.playable.setTime(o),i&&this.playable.getPlayState()===Ps.Playing&&this.playable.pause()},se(t,[{key:"enable",set:function(t){t?this.playable.play():(this.parentMixer.setClipWeight(this.playable,0),this.playable.pause())}}]),t}();exports.ActivationTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){return new vo(t)},e}(exports.TrackAsset),exports.ActivationTrack=u([he(Kt.ActivationTrack)],exports.ActivationTrack);var Mo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).propertyNames=[],e.path="",e}_t(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,r=0;r<t.length-1;r++){var i=e[t[r]];void 0===i&&console.error("The "+t[r]+" property of "+e+" was not found"),e=i}this.boundObject=e},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=this.path.split(".");this.propertyNames=r},e}(exports.TrackAsset);u([ce()],Mo.prototype,"path",void 0),exports.FloatPropertyTrack=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.createTrackMixer=function(t){var e=new bo(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},r.updateAnimatedObject=function(){for(var t=this.propertyNames,e=this.parent.boundObject,r=0;r<t.length-1;r++){var i=e[t[r]];void 0===i&&console.error("The "+t[r]+" property of "+e+" was not found"),e=i}this.boundObject=e},e}(Mo),exports.FloatPropertyTrack=u([he(Kt.FloatPropertyTrack)],exports.FloatPropertyTrack),exports.SpriteColorTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){return new Eo(t)},e}(exports.TrackAsset),exports.SpriteColorTrack=u([he(Kt.SpriteColorTrack)],exports.SpriteColorTrack),exports.SubCompositionTrack=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){if(!this.parent||!a(this.parent.boundObject,exports.VFXItem))throw new Error("SubCompositionTrack needs to be set under the VFXItem track.");this.boundObject=this.parent.boundObject.getComponent(No)},r.createTrackMixer=function(t){return new Ao(t)},e}(exports.TrackAsset),exports.SubCompositionTrack=u([he(Kt.SubCompositionTrack)],exports.SubCompositionTrack),exports.TransformTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){return new Co(t)},e}(exports.TrackAsset),exports.TransformTrack=u([he(Kt.TransformTrack)],exports.TransformTrack),exports.MaterialTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.updateAnimatedObject=function(){a(this.parent.boundObject,me)&&(this.parent.boundObject,this.boundObject=this.parent.boundObject.materials[this.index])},e}(exports.TrackAsset),u([ce()],exports.MaterialTrack.prototype,"index",void 0),exports.MaterialTrack=u([he("MaterialTrack")],exports.MaterialTrack);var Po=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){return new To(t)},e}(exports.TrackAsset);exports.Vector4PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){var e=new So(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(Mo),exports.Vector4PropertyTrack=u([he(Kt.Vector4PropertyTrack)],exports.Vector4PropertyTrack),exports.Vector2PropertyTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){var e=new wo(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(Mo),exports.Vector2PropertyTrack=u([he("Vector2PropertyTrack")],exports.Vector2PropertyTrack),exports.ColorPropertyTrack=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createTrackMixer=function(t){var e=new xo(t),r=this.propertyNames;if(r.length>0){var i=r[r.length-1];e.propertyName=i}return e},e}(Mo),exports.ColorPropertyTrack=u([he(Kt.ColorPropertyTrack)],exports.ColorPropertyTrack),exports.ColorPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){var e=new yo(t);return e.curve=Yn(this.curveData),e.value=e.curve.getValue(0),e},e}(Ns),u([ce()],exports.ColorPropertyPlayableAsset.prototype,"curveData",void 0),exports.ColorPropertyPlayableAsset=u([he(Kt.ColorPropertyPlayableAsset)],exports.ColorPropertyPlayableAsset),exports.FloatPropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){var e=new yo(t);return e.curve=Yn(this.curveData),e.value=e.curve.getValue(0),e},e}(Ns),u([ce()],exports.FloatPropertyPlayableAsset.prototype,"curveData",void 0),exports.FloatPropertyPlayableAsset=u([he(Kt.FloatPropertyPlayableAsset)],exports.FloatPropertyPlayableAsset),exports.SubCompositionPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){return new _o(t)},e}(Ns),exports.SubCompositionPlayableAsset=u([he(Kt.SubCompositionPlayableAsset)],exports.SubCompositionPlayableAsset),exports.ObjectBindingTrack=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.updateAnimatedObject=function(){},r.create=function(t){if(a(this.boundObject,exports.VFXItem)){var e=this.boundObject;if(e.getComponent(exports.ParticleSystem)){var r=t.createTrack(Po,this,"ParticleTrack");r.boundObject=this.boundObject;var i=r.createClip(Ka);i.start=e.start,i.duration=e.duration,i.endBehavior=e.endBehavior}}},e}(exports.TrackAsset),exports.ObjectBindingTrack=u([he(Kt.ObjectBindingTrack)],exports.ObjectBindingTrack);var Io=function(){function t(t,e,r){this.children=[],this.trackAsset=t,this.mixer=e,this.output=r}return t.prototype.addChild=function(t){this.children.push(t)},t}();exports.TimelineAsset=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).tracks=[],e.cacheFlattenedTracks=null,e}_t(e,t);var r=e.prototype;return r.createPlayable=function(t){for(var e,r=new Lo(t),i=s(this.tracks);!(e=i()).done;){var n=e.value;a(n,exports.ObjectBindingTrack)&&n.create(this)}return this.sortTracks(this.tracks),r.compileTracks(t,this.flattenedTracks),r},r.createTrack=function(t,e,r){var i=new t(this.engine);return i.name=r||t.name,e.addChild(i),this.invalidate(),i},r.invalidate=function(){this.cacheFlattenedTracks=null},r.addSubTracksRecursive=function(t,e){for(var r,i=s(t.getChildTracks());!(r=i()).done;){var n=r.value;e.push(n)}for(var a,o=s(t.getChildTracks());!(a=o()).done;){var u=a.value;this.addSubTracksRecursive(u,e)}},r.sortTracks=function(t){for(var e=[],r=0;r<t.length;r++)e.push(new Fo(t[r],r));e.sort(Vo),t.length=0;for(var i,n=s(e);!(i=n()).done;){var a=i.value;t.push(a.track)}},r.fromData=function(t){},se(e,[{key:"flattenedTracks",get:function(){if(!this.cacheFlattenedTracks){this.cacheFlattenedTracks=[];for(var t,e=s(this.tracks);!(t=e()).done;){var r=t.value;this.cacheFlattenedTracks.push(r),this.addSubTracksRecursive(r,this.cacheFlattenedTracks)}}return this.cacheFlattenedTracks}}]),e}(Ns),u([ce()],exports.TimelineAsset.prototype,"tracks",void 0),exports.TimelineAsset=u([he(Kt.TimelineAsset)],exports.TimelineAsset);var Lo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).clips=[],e.masterTrackInstances=[],e}_t(e,t);var r=e.prototype;return r.prepareFrame=function(t){},r.evaluate=function(){for(var t,e=this.getTime(),r=s(this.clips);!(t=r()).done;){t.value.evaluateAt(e)}},r.compileTracks=function(t,e){for(var r,i=e,n={},a=s(i);!(r=a()).done;){var o=r.value,u=o.createPlayableGraph(t,this.clips),h=o.createOutput();h.setUserData(o.boundObject),t.addOutput(h),h.setSourcePlayable(u);var c=new Io(o,u,h);n[o.getInstanceId()]=c,o.parent||this.masterTrackInstances.push(c)}for(var l,f=s(i);!(l=f()).done;)for(var p,d=l.value,m=n[d.getInstanceId()],v=s(d.getChildTracks());!(p=v()).done;){var y=n[p.value.getInstanceId()];m.addChild(y)}},e}(Vs),Fo=function(t,e){this.track=t,this.originalIndex=e};function Vo(t,e){var r=t.track.boundObject,i=e.track.boundObject;return a(r,exports.VFXItem)&&a(i,exports.VFXItem)?exports.VFXItem.isAncestor(r,i)?-1:exports.VFXItem.isAncestor(i,r)?1:t.originalIndex-e.originalIndex:t.originalIndex-e.originalIndex}exports.Vector4PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){var e=new yo(t);return e.curve=Yn(this.curveData),e.value=e.curve.getValue(0),e},e}(Ns),u([ce()],exports.Vector4PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector4PropertyPlayableAsset=u([he(Kt.Vector4PropertyPlayableAsset)],exports.Vector4PropertyPlayableAsset),exports.Vector2PropertyPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){var e=new yo(t);return e.curve=Yn(this.curveData),e.value=e.curve.getValue(0),e},e}(Ns),u([ce()],exports.Vector2PropertyPlayableAsset.prototype,"curveData",void 0),exports.Vector2PropertyPlayableAsset=u([he(Kt.Vector2PropertyPlayableAsset)],exports.Vector2PropertyPlayableAsset);var Do,No=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).time=0,e.startTime=0,e.items=[],e.state=Ps.Playing,e.reusable=!1,e.sceneBindings=[],e.graph=new Fs,e}_t(e,t);var r=e.prototype;return r.onStart=function(){var t;this.timelineAsset||(this.timelineAsset=new exports.TimelineAsset(this.engine)),this.resolveBindings(),this.timelinePlayable=this.timelineAsset.createPlayable(this.graph),this.item.endBehavior!==wt.destroy&&this.setReusable(!0),null==(t=this.item.composition)||t.refContent.push(this.item)},r.setReusable=function(t){for(var r,i=s(this.timelineAsset.tracks);!(r=i()).done;){var n=r.value.boundObject;if(a(n,exports.VFXItem)){var o=n.getComponent(e);o&&o.setReusable(t)}}},r.getReusable=function(){return this.reusable},r.pause=function(){this.state=Ps.Paused},r.resume=function(){this.state=Ps.Playing},r.onUpdate=function(t){if(this.state!==Ps.Paused){var e=this.time;this.timelinePlayable.setTime(e),this.resolveBindings(),this.timelinePlayable.evaluate(),this.graph.evaluate(t)}},r.onEnable=function(){for(var t,e=s(this.items);!(t=e()).done;){t.value.setActive(!0)}},r.onDisable=function(){for(var t,e=s(this.items);!(t=e()).done;){t.value.setActive(!1)}},r.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},r.hitTest=function(t,e,r,i,n,s){for(var a,u=function(s){var o=a.items[s];if(o.isActive&&o.transform.getValid()&&!exports.VFXItem.isComposition(o)&&!l(o)){var u=o.getHitTestParams(n);if(u){var f=!1,p=new Ae;if(u.type===exports.HitTestType.triangle)for(var d=u.triangles,m=u.backfaceCulling,v=0;v<d.length;v++){var y=d[v];if(t.intersectTriangle(y,p,m)){f=!0,h.push(p);break}}else if(u.type===exports.HitTestType.box){var g=u.center,x=u.size,b=g.clone().addScaledVector(x,.5),T=g.clone().addScaledVector(x,-.5);t.intersectBox({min:b,max:T},p)&&(f=!0,h.push(p))}else if(u.type===exports.HitTestType.sphere){var E=u.center,_=u.radius;t.intersectSphere({center:E,radius:_},p)&&(f=!0,h.push(p))}else if(u.type===exports.HitTestType.custom){var A=u.collect(t,new _e(e,r));A&&A.length>0&&(A.forEach((function(t){h.push(t)})),f=!0)}if(f){var C={compContent:a.item,id:o.id,name:o.name,position:h[h.length-1],parentId:o.parentId,hitPositions:h,behavior:u.behavior};if(o.emit("click",C),i.push(C),c(C))return{v:i}}}}},h=[],c=(null==s?void 0:s.stop)||X,l=(null==s?void 0:s.skip)||X,f=(null==s?void 0:s.maxCount)||this.items.length,p=0;p<this.items.length&&i.length<f;p++){var d=(a=this,u(p));if("object"===o(d))return d.v}return i},r.setChildrenRenderOrder=function(t){for(var r,i=s(this.items);!(r=i()).done;){var n=r.value;n.renderOrder=t++;var a=n.getComponent(e);a&&(t=a.setChildrenRenderOrder(t))}return t},r.fromData=function(e){var r;t.prototype.fromData.call(this,e),this.items=e.items,this.startTime=null!=(r=e.startTime)?r:0,this.sceneBindings=e.sceneBindings,this.timelineAsset=e.timelineAsset},r.resolveBindings=function(){for(var t,e=s(this.sceneBindings);!(t=e()).done;){var r=t.value;r.key.boundObject=r.value}for(var i,n=s(this.timelineAsset.tracks);!(i=n()).done;){var a=i.value;this.updateTrackAnimatedObject(a)}},r.updateTrackAnimatedObject=function(t){for(var e,r=s(t.getChildTracks());!(e=r()).done;){var i=e.value;i.updateAnimatedObject(),this.updateTrackAnimatedObject(i)}},e}(de),ko=function(){function t(){}return t.collectSerializableObject=function(e,r){if(!r[e.getInstanceId()]){e.toData(),r[e.getInstanceId()]=e;var i=le(e);if(i)for(var n,a=s(Object.keys(i));!(n=a()).done;){var o=n.value,u=e.taggedProperties[o];if(void 0===u&&(u=e[o]),fe.is(u))t.collectSerializableObject(u,r);else if(W(u))for(var h,c=s(u);!(h=c()).done;){var l=h.value;fe.is(l)&&t.collectSerializableObject(l,r)}else if(Z(u))for(var f,p=s(Object.keys(u));!(f=p()).done;){var d=u[f.value];fe.is(d)&&t.collectSerializableObject(d,r)}}}},t.serializeEffectObject=function(e){var r={},i=Ie({},e.engine.jsonSceneData);t.collectSerializableObject(e,r);for(var n,a=s(Object.keys(r));!(n=a()).done;){var o=r[n.value];i[o.getInstanceId()]||(i[o.getInstanceId()]={}),t.serialize(o,i[o.getInstanceId()])}return i},t.serialize=function(e,r){e.toData(),r||(r={});var i=le(e);if(i)for(var n,a=s(Object.keys(i));!(n=a()).done;){var o=n.value,u=e[o];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(u)?r[o]=u:W(u)?(r[o]||(r[o]=[]),t.serializeArrayProperty(u,r[o],0)):fe.is(u)?r[o]={id:u.getInstanceId()}:Z(u)&&(r[o]||(r[o]={}),t.serializeObjectProperty(u,r[o],0))}for(var h,c=s(Object.keys(e.taggedProperties));!(h=c()).done;){var l=h.value,f=e.taggedProperties[l];"number"==typeof f||"string"==typeof f||"boolean"==typeof f||t.checkTypedArray(f)?r[l]=f:W(f)?(r[l]||(r[l]=[]),t.serializeArrayProperty(f,r[l],0)):fe.is(f)?r[l]={id:f.getInstanceId()}:Z(f)&&(r[l]||(r[l]={}),t.serializeObjectProperty(f,r[l],0))}return r},t.deserialize=function(e,r){for(var i,n=r.taggedProperties,a=le(r),o=r.engine,u=s(Object.keys(e));!(i=u()).done;){var h=i.value;if(!a||!a[h]){var c=e[h];n[h]=t.deserializeProperty(c,o,0)}}if(a)for(var l,f=s(Object.keys(a));!(l=f()).done;){var p=l.value,d=e[p];if(void 0!==d){var m=a[p].type;r[p]=t.deserializeProperty(d,o,0,m)}}r.fromData(n)},t.deserializeAsync=function(e,r){return i((function(){var i,n,a,o,u,c,l,f,p,d,m,v;return h(this,(function(h){switch(h.label){case 0:i=r.taggedProperties,n=le(r),a=r.engine,o=s(Object.keys(e)),h.label=1;case 1:return(u=o()).done?[3,4]:(c=u.value,n&&n[c]?[3,3]:(l=e[c],[4,t.deserializePropertyAsync(l,a,0)]));case 2:i[c]=h.sent(),h.label=3;case 3:return[3,1];case 4:if(!n)return[3,8];f=s(Object.keys(n)),h.label=5;case 5:return(p=f()).done?[3,8]:(d=p.value,void 0===(m=e[d])?[3,7]:(v=n[d].type,[4,t.deserializePropertyAsync(m,a,0,v)]));case 6:r[d]=h.sent(),h.label=7;case 7:return[3,5];case 8:return r.fromData(i),[2]}}))}))()},t.checkTypedArray=function(t){return a(t,Int8Array)||a(t,Uint8Array)||a(t,Uint8ClampedArray)||a(t,Int16Array)||a(t,Uint16Array)||a(t,Int32Array)||a(t,Uint32Array)||a(t,Float32Array)||a(t,Float64Array)||a(t,ArrayBuffer)},t.checkDataPath=function(t){return!!(Z(t)&&1===Object.keys(t).length&&"id"in t&&H(t.id)&&32===t.id.length)},t.checkGLTFNode=function(t){return Z(t)&&void 0!==t.nodeIndex&&void 0!==t.isJoint},t.checkImageSource=function(t){return q(t)||a(t,e.HTMLImageElement)},t.deserializeProperty=function(e,r,i,n){if(!(i>14)){if(W(e)){for(var a,o=[],u=s(e);!(a=u()).done;){var h=a.value;o.push(t.deserializeProperty(h,r,i+1,n))}return o}if(t.checkDataPath(e))return r.assetLoader.loadGUID(e.id);if(Z(e)&&e.constructor===Object){var c;c=n?new n:{};for(var l,f=s(Object.keys(e));!(l=f()).done;){var p=l.value;c[p]=t.deserializeProperty(e[p],r,i+1)}return c}return e}console.error("The nested object layers of the serialized data exceed the maximum limit.")},t.deserializePropertyAsync=function(e,r,n,a){return i((function(){var i,o,u,c,l,f,p,d,m;return h(this,(function(h){switch(h.label){case 0:if(n>14)return console.error("The nested object layers of the serialized data exceed the maximum limit."),[2];if(!W(e))return[3,5];i=[],o=s(e),h.label=1;case 1:return(u=o()).done?[3,4]:(c=u.value,l=i.push,[4,t.deserializePropertyAsync(c,r,n+1,a)]);case 2:l.apply(i,[h.sent()]),h.label=3;case 3:return[3,1];case 4:return[2,i];case 5:return t.checkDataPath(e)?[4,r.assetLoader.loadGUIDAsync(e.id)]:[3,7];case 6:return[2,h.sent()];case 7:if(!Z(e)||e.constructor!==Object)return[3,12];f=a?new a:{},p=s(Object.keys(e)),h.label=8;case 8:return(d=p()).done?[3,11]:(m=d.value,[4,t.deserializePropertyAsync(e[m],r,n+1)]);case 9:f[m]=h.sent(),h.label=10;case 10:return[3,8];case 11:return[2,f];case 12:return[2,e];case 13:return[2]}}))}))()},t.serializeObjectProperty=function(e,r,i){if(i>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{r||(r={});for(var n,a=s(Object.keys(e));!(n=a()).done;){var o=n.value,u=e[o];"number"==typeof u||"string"==typeof u||"boolean"==typeof u||t.checkTypedArray(e)?r[o]=u:W(u)?(r[o]||(r[o]=[]),t.serializeArrayProperty(u,r[o],i+1)):fe.is(u)?r[o]={id:u.getInstanceId()}:Z(u)&&(r[o]||(r[o]={}),t.serializeObjectProperty(u,r[o],i+1))}}},t.serializeArrayProperty=function(e,r,i){if(i>14)console.error("The nested object layers of the serialized data exceed the maximum limit.");else{r||(r=[]);for(var n=0;n<e.length;n++){var s=e[n];"number"==typeof s||"string"==typeof s||"boolean"==typeof s||t.checkTypedArray(e)?r[n]=s:W(s)?(r[n]||(r[n]=[]),t.serializeArrayProperty(s,r[n],i+1)):fe.is(s)?r[n]={id:s.getInstanceId()}:Z(s)&&(r[n]||(r[n]={}),t.serializeObjectProperty(s,r[n],i+1))}}},t}();exports.VFXItem=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).children=[],i.transform=new Bs,i.time=0,i.duration=0,i.start=0,i.endBehavior=wt.forward,i.type=vt.base,i.isDuringPlay=!1,i.components=[],i.rendererComponents=[],i.active=!0,i.visible=!0,i.speed=1,i.listIndex=0,i.isEnabled=!1,i.eventProcessor=new ks,i.name="VFXItem",i.transform.name=i.name,i.transform.engine=e,r&&i.fromData(r),i}_t(e,t);var r=e.prototype;return r.on=function(t,e,r){this.eventProcessor.on(t,e,r)},r.off=function(t,e){this.eventProcessor.off(t,e)},r.once=function(t,e){this.eventProcessor.once(t,e)},r.emit=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];var n;(n=this.eventProcessor).emit.apply(n,[].concat([t],r))},r.getListeners=function(t){return this.eventProcessor.getListeners(t)},r.setSpeed=function(t){this.speed=t},r.getSpeed=function(){return this.speed},r.addComponent=function(t){var e=new t(this.engine);return this.components.push(e),e.setVFXItem(this),e},r.getComponent=function(t){for(var e,r,i=s(this.components);!(r=i()).done;){var n=r.value;if(a(n,t)){e=n;break}}return e},r.getComponents=function(t){for(var e,r=[],i=s(this.components);!(e=i()).done;){var n=e.value;a(n,t)&&r.push(n)}return r},r.setParent=function(t){(t!==this||t)&&(this.parent&&g(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())},r.setColor=function(t,e,r,i){},r.setOpacity=function(t){},r.setActive=function(t){this.active!==t&&(this.active=!!t,this.onActiveChanged())},r.setVisible=function(t){for(var e,r=s(this.components);!(e=r()).done;){e.value.enabled=t}this.visible=t},r.getVisible=function(){return this.visible},r.getWorldTransform=function(t){var e=null!=t?t:new Bs({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},r.translate=function(t,e,r){this.transform.translate(t,e,r)},r.rotate=function(t,e,r){var i=new Hr(t,e,r),n=Re.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},r.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},r.setPositionByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,s=i.y,a=this.composition.renderer.getWidth()/2,o=this.composition.renderer.getHeight()/2;this.transform.setPosition((2*t/a-1)*n,(1-2*e/o)*s,r)}},r.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},r.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},r.setScale=function(t,e,r){this.transform.setScale(t,e,r)},r.getBoundingBox=function(){},r.getHitTestParams=function(t){},r.getCurrentPosition=function(){var t=new Ae;return this.transform.assignWorldTRS(t),t},r.find=function(t){var e;if(this.name===t)return this;var r=[];(e=r).push.apply(e,[].concat(this.children));for(var i=0;i<r.length;){var n,s=r[i];if(i++,s.name===t)return s;(n=r).push.apply(n,[].concat(s.children))}},r.beginPlay=function(){this.isDuringPlay=!0,this.composition&&this.active&&!this.isEnabled&&this.onEnable();for(var t,e=s(this.children);!(t=e()).done;){var r=t.value;r.isDuringPlay||r.beginPlay()}},r.onActiveChanged=function(){this.isEnabled?this.onDisable():this.onEnable()},r.onEnable=function(){this.isEnabled=!0;for(var t,e=s(this.components);!(t=e()).done;){var r=t.value;r.enabled&&!r.isStartCalled&&(r.onStart(),r.isStartCalled=!0)}for(var i,n=s(this.components);!(i=n()).done;){var a=i.value;a.enabled&&!a.isEnableCalled&&a.enable()}},r.onDisable=function(){this.isEnabled=!1;for(var t,e=s(this.components);!(t=e()).done;){var r=t.value;r.enabled&&r.isEnableCalled&&r.disable()}},r.fromData=function(r){t.prototype.fromData.call(this,r);var i=r.id,n=r.name,o=r.delay,u=r.parentId,h=r.endBehavior,c=r.transform,l=r.duration,f=void 0===l?0:l;this.props=r,this.type=r.type,this.id=i.toString(),this.name=n,this.start=o||this.start;var p={};if(c){var d;if(p.position=(new Ae).copyFrom(c.position),c.quat)p.quat=new Re(c.quat.x,c.quat.y,c.quat.z,c.quat.w);else p.rotation=(new Hr).copyFrom(null!=(d=c.eulerHint)?d:c.rotation);p.scale=(new Ae).copyFrom(c.scale),c.size&&(p.size=(new _e).copyFrom(c.size)),c.anchor&&(p.anchor=(new _e).copyFrom(c.anchor)),this.transform.setTransform(p)}if(this.transform.name=this.name,this.transform.engine=this.engine,this.parentId=u,this.duration=f,this.endBehavior=h,r.content||(r.content={options:{}}),f<0)throw new Error("Item duration can't be less than 0, see "+Hn["Item duration can't be less than 0"]+".");this.rendererComponents.length=0;for(var m,v=s(this.components);!(m=v()).done;){var y=m.value;y.item=this,a(y,me)&&this.rendererComponents.push(y),a(y,exports.ParticleSystem)&&(this.components.includes(y.renderer)||this.components.push(y.renderer),this.rendererComponents.push(y.renderer))}e.isComposition(this)&&this.instantiatePreComposition()},r.toData=function(){var t,e;(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=Kt.VFXItemData,"rootItem"!==(null==(t=this.parent)?void 0:t.name))&&(this.taggedProperties.parentId=null==(e=this.parent)?void 0:e.guid);if(!this.taggedProperties.components){this.taggedProperties.components=[];for(var r,i=s(this.components);!(r=i()).done;){var n=r.value;a(n,exports.EffectComponent)&&this.taggedProperties.components.push(n)}}this.taggedProperties.content={}},r.translateByPixel=function(t,e){if(this.composition){var r=this.composition.renderer.canvas.getBoundingClientRect(),i=r.width,n=r.height,s=this.transform.getWorldPosition().z,a=this.composition.camera.getInverseVPRatio(s),o=a.x,u=a.y;this.transform.translate(2*t*o/i,-2*e*u/n,0)}},r.dispose=function(){if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);for(var t,e=s(this.components.slice());!(t=e()).done;){t.value.dispose()}this.components=[],this._content=void 0,this._composition=null,this.transform.setValid(!1)}},r.resetChildrenParent=function(){for(var t,e=s(this.children);!(t=e()).done;){var r=t.value;this.parent&&r.setParent(this.parent)}var i;this.parent&&g(null==(i=this.parent)?void 0:i.children,this)},r.instantiatePreComposition=function(){var t=this.props.content.options.refId,e=this.engine.findEffectsObjectData(t);if(!e)throw new Error("Referenced precomposition with Id: "+t+" does not exist.");var r=this.addComponent(No);ko.deserialize(e,r);for(var i,n=s(r.items);!(i=n()).done;){var a=i.value;a.setInstanceId(J());for(var o,u=s(a.components);!(o=u()).done;){o.value.setInstanceId(J())}}},e.isComposition=function(t){return t.type===vt.composition},e.isSprite=function(t){return t.type===vt.sprite},e.isParticle=function(t){return t.type===vt.particle},e.isNull=function(t){return t.type===vt.null},e.isTree=function(t){return t.type===vt.tree},e.isCamera=function(t){return t.type===vt.camera},e.isAncestor=function(t,e){for(var r=e.parent;r;){if(r===t)return!0;r=r.parent}return!1},se(e,[{key:"content",get:function(){return this._content}},{key:"composition",get:function(){return this._composition},set:function(t){this._composition=t;for(var e,r=s(this.children);!(e=r()).done;){var i=e.value;i.composition||(i.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,r=s(this.rendererComponents);!(e=r()).done;){e.value.priority=t}}}},{key:"isActive",get:function(){return this.active}},{key:"isVisible",get:function(){return this.visible}}]),e}(fe),u([ce()],exports.VFXItem.prototype,"components",void 0),exports.VFXItem=u([he(Kt.VFXItemData)],exports.VFXItem),exports.Item=void 0,(Do=exports.Item||(exports.Item={})).is=function(t,e){return t.type===e},Do.isComposition=function(t){return t.type===vt.composition},Do.isParticle=function(t){return t.type===vt.particle},Do.isNull=function(t){return t.type===vt.null};var zo=[1,1,1,1],Uo=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).renderColor=[1,1,1,1],e}_t(e,t);var r=e.prototype;return r.processFrame=function(t){var e,r=t.output.getUserData();if(a(r,exports.VFXItem)){if(this.activeComponent||(this.activeComponent=this.getActiveComponent(r)),!this.activeMaterial){var i,n;this.activeMaterial=null==(i=this.activeComponent)?void 0:i.material;var s=null==(n=this.activeMaterial)?void 0:n.getColor("_Color");s&&(this.startColor=s.toArray())}null==(e=this.activeComponent)||e.setAnimationTime(this.time);var o,u,h,c=Ki(zo,1),l=this.time/r.duration,f=this.opacityOverLifetime,p=this.colorOverLifetime;if(p&&(c=T(p,l,!0),o=!0),f&&(c[3]*=f.getValue(l),o=!0),o)Qi(this.renderColor,c,this.startColor),null==(h=this.activeMaterial)||null==(u=h.getColor("_Color"))||u.setFromArray(this.renderColor)}},r.create=function(t){this.clipData=t;var e,r=t.colorOverLifetime;r&&(this.opacityOverLifetime=Yn(null!=(e=r.opacity)?e:1),r.color&&r.color[0]===Ct.GRADIENT_COLOR&&(this.colorOverLifetime=E(r.color[1])));return this},r.getActiveComponent=function(t){return t.getComponent(qn)},e}(Vs),Bo=[[0,0,1,1,void 0]],Go=0;function jo(t){return t.maxVertexUniforms>=256?exports.maxSpriteMeshItemCount=32:t.maxVertexUniforms>=128?exports.maxSpriteMeshItemCount=16:void 0}function Xo(t,e){var r=null!=e?e:{},i=r.env,n=void 0===i?"":i,s=r.wireframe,a=[["ENV_EDITOR",n===Xn]];return{fragment:s?oi:hi,vertex:ui,glslVersion:1===t?exports.GLSLVersion.GLSL1:exports.GLSLVersion.GLSL3,macros:a,shared:!0}}function Ho(t,e,r,i){var n=Xo(r,{wireframe:t.wireframe,env:i});return n.shared=!0,n}exports.SpriteColorPlayableAsset=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.createPlayable=function(t){var e=new Uo(t);return e.create(this.data),e},r.fromData=function(t){this.data=t},e}(Ns),exports.SpriteColorPlayableAsset=u([he(Kt.SpriteColorPlayableAsset)],exports.SpriteColorPlayableAsset),exports.SpriteComponent=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).splits=Bo,i.frameAnimationLoop=!1,i.name="MSprite"+Go++,i.geometry=i.createGeometry(rr.TRIANGLES),i.setItem(),r&&i.fromData(r),i}_t(e,t);var r=e.prototype;return r.onUpdate=function(t){var e=this;this.isManualTimeSet||(this.frameAnimationTime+=t/1e3,this.isManualTimeSet=!1);var r=this.frameAnimationTime,i=this.item.duration;r>i&&this.frameAnimationLoop&&(r%=i);var n=Math.min(Math.max(r/i,0),1),s=this.textureSheetAnimation,a=this.renderer.texture.source.video;if(a&&(0===r?a.pause():a.play().catch((function(t){e.engine.renderErrors.add(t)}))),s){var o,u,h,c,l,f=s.total||s.row*s.col,p=0,d=0,m=1,v=1;if(this.splits){var y=this.splits[0];u=y[4],p=y[0],d=y[1],u?(m=y[3],v=y[2]):(m=y[2],v=y[3])}if(u?(h=1/s.row*m,c=1/s.col*v):(h=1/s.col*m,c=1/s.row*v),s.animate){var g=Math.round(n*(f-1)),x=Math.floor(g/s.col),b=g-x*s.col;l=u?[h*x,c*(s.col-b)]:[h*b,c*(1+x)]}else l=[0,c];null==(o=this.material.getVector4("_TexOffset"))||o.setFromArray([p+l[0],v+d-l[1],h,c])}},r.onDestroy=function(){var t=this.getTextures();this.item&&this.item.composition&&this.item.composition.destroyTextures(t),t.forEach((function(t){var e=t.source;e.sourceType===exports.TextureSourceType.video&&(null==e?void 0:e.video)&&(e.video.pause(),e.video.src="",e.video.load())}))},r.createGeometry=function(t){var e=12*this.splits.length;return jr.create(this.engine,{attributes:{aPos:{type:rr.FLOAT,size:3,data:new Float32Array([-.5,.5,0,-.5,-.5,0,.5,.5,0,.5,-.5,0])},atlasOffset:{size:2,offset:0,releasable:!0,type:rr.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},r.getItemGeometryData=function(){var t=this.splits,e=this.textureSheetAnimation,r=this.renderer;if(r.shape){for(var i=r.shape,n=i.index,s=void 0===n?[]:n,a=i.aPoint,o=void 0===a?[]:a,u=new Float32Array(o),h=[],c=[],l=0;l<u.length;l+=6)u[l]*=1,u[l+1]*=1,c.push(o[l+2],o[l+3]),h.push(u[l],u[l+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(h)),{index:s,atlasOffset:c}}var f=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],p=[],d=[],m=2,v=2;1===t.length&&(m=1,v=1);for(var y=[],g=0;g<m;g++)for(var x=0;x<v;x++){var b=4*(2*x+g),T=e?[0,0,1,1,t[0][4]]:t[2*x+g],E=T[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],_=((g+g+1)/m-1)/2,A=((x+x+1)/v-1)/2,C=T[0],S=T[1],w=T[4]?T[3]:T[2],R=T[4]?T[2]:T[3],O=[f[0]/m+_,f[1]/v+A,f[2]/m+_,f[3]/v+A,f[4]/m+_,f[5]/v+A,f[6]/m+_,f[7]/v+A];p.push(E[0]*w+C,E[1]*R+S,E[2]*w+C,E[3]*R+S,E[4]*w+C,E[5]*R+S,E[6]*w+C,E[7]*R+S),y.push(1*O[0],1*O[1],0,1*O[2],1*O[3],0,1*O[4],1*O[5],0,1*O[6],1*O[7],0),d.push(b,1+b,2+b,2+b,1+b,3+b)}return this.geometry.setAttributeData("aPos",new Float32Array(y)),{index:d,atlasOffset:p}},r.fromData=function(e){t.prototype.fromData.call(this,e);var r,i,n,s,a,o,u=e.interaction,h=e.options,c=e.listIndex,l=void 0===c?0:c,f=e.renderer;f||(f={}),this.interaction=u,this.renderer={renderMode:null!=(r=f.renderMode)?r:yt.MESH,blending:null!=(i=f.blending)?i:ht.ALPHA,texture:null!=(n=f.texture)?n:this.engine.emptyTexture,occlusion:!!f.occlusion,transparentOcclusion:!!f.transparentOcclusion||f.maskMode===lt.MASK,side:null!=(s=f.side)?s:ct.DOUBLE,shape:f.shape,mask:null!=(a=f.mask)?a:0,maskMode:null!=(o=f.maskMode)?o:lt.NONE,order:l},this.emptyTexture=this.engine.emptyTexture,this.splits=e.splits||Bo,this.textureSheetAnimation=e.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=Kn(this);var p=this.createGeometry(rr.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=Pe.fromIdentity(),this.material=d,this.geometry=p;var m=h.startColor||[1,1,1,1];this.material.setColor("_Color",(new Zr).setFromArray(m)),this.material.setVector4("_TexOffset",(new Ce).setFromArray([0,0,1,1])),this.setItem()},e}(qn),exports.SpriteComponent=u([he(Kt.SpriteComponent)],exports.SpriteComponent),exports.maxSpriteMeshItemCount=8;var Wo=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(Tt),Yo=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(Tt),Zo=function(){function t(t){this.curveValues={},this.playable=t}var e=t.prototype;return e.setCurveValue=function(t,e,r){return this.findCurveValue(t,e)?this.curveValues[t+e].value=r:this.curveValues[t+e]={componentType:t,propertyName:e,value:r},this.curveValues[t+e]},e.findCurveValue=function(t,e){return this.curveValues[t+e]},t}(),qo=function(t){function e(e){var r;return(r=t.call(this,e)||this).animationStream=new Zo(we(r)),r}return _t(e,t),e}(Vs),Ko=new Hr,Qo=new Ae(1,1,1),Jo=new Ae,$o=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.start=function(){var t=this.boundObject,e=t.transform.scale;this.originalTransform={position:t.transform.position.clone(),rotation:t.transform.getRotation().clone(),scale:new Ae(e.x,e.y,e.x)};var r,i=this.data.positionOverLifetime,n=this.data.rotationOverLifetime,s=this.data.sizeOverLifetime;if(i&&0!==Object.keys(i).length){this.positionOverLifetime=i,i.path&&(this.originalTransform.path=Yn(i.path));var a=i.linearX||i.linearY||i.linearZ;a&&(this.linearVelOverLifetime={x:i.linearX&&Yn(i.linearX),y:i.linearY&&Yn(i.linearY),z:i.linearZ&&Yn(i.linearZ),asMovement:i.asMovement,enabled:!!a});var o=i.orbitalX||i.orbitalY||i.orbitalZ;o&&(this.orbitalVelOverLifetime={x:i.orbitalX&&Yn(i.orbitalX),y:i.orbitalY&&Yn(i.orbitalY),z:i.orbitalZ&&Yn(i.orbitalZ),center:qi(i.orbCenter),asRotation:i.asRotation,enabled:!!o}),this.speedOverLifetime=i.speedOverLifetime&&Yn(i.speedOverLifetime)}if(s&&(s.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Yn(s.x||1),this.sizeYOverLifetime=Yn(s.y||1),this.sizeZOverLifetime=Yn(s.z||1)):this.sizeXOverLifetime=Yn(s.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:Yn(n.z||0)},n.separateAxes)){var u=this.rotationOverLifetime;u.x=Yn(n.x||0),u.y=Yn(n.y||0)}this.gravity=Ae.fromArray((null==i?void 0:i.gravity)||[]),this.gravityModifier=Yn(null!=(r=null==i?void 0:i.gravityOverLifetime)?r:0),this.direction=(null==i?void 0:i.direction)?Ae.fromArray(i.direction).normalize():new Ae,this.startSpeed=(null==i?void 0:i.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},r.processFrame=function(t){if(!this.boundObject){var e=t.output.getUserData();a(e,exports.VFXItem)&&(this.boundObject=e,this.start())}this.boundObject&&this.boundObject.composition&&this.sampleAnimation()},r.sampleAnimation=function(){var t=this,e=this.boundObject,r=e.duration,i=this.time/r;if(i=i<0?0:i>1?1:i,this.sizeXOverLifetime){Qo.x=this.sizeXOverLifetime.getValue(i),this.sizeSeparateAxes?(Qo.y=this.sizeYOverLifetime.getValue(i),Qo.z=this.sizeZOverLifetime.getValue(i)):Qo.z=Qo.y=Qo.x;var n=this.originalTransform.scale;e.transform.setScale(Qo.x*n.x,Qo.y*n.y,Qo.z*n.z)}if(this.rotationOverLifetime){var s=function(e){return t.rotationOverLifetime.asRotation?e.getValue(i):e.getIntegrateValue(0,i,r)},a=s(this.rotationOverLifetime.z),o=this.rotationOverLifetime.separateAxes;Ko.x=o?s(this.rotationOverLifetime.x):0,Ko.y=o?s(this.rotationOverLifetime.y):0,Ko.z=a;var u=Ko.addEulers(this.originalTransform.rotation,Ko);e.transform.setRotation(u.x,u.y,u.z)}if(this.positionOverLifetime){var h=Jo;Zi(h,this,this.gravity,this.time,r,this.originalTransform.position,this.velocity),this.originalTransform.path&&h.add(this.originalTransform.path.getValue(i)),e.transform.setPosition(h.x,h.y,h.z)}},e}(qo);exports.TransformPlayableAsset=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.createPlayable=function(t){var e=new $o(t);return e.data=this.transformAnimationData,e},r.fromData=function(t){this.transformAnimationData=t},e}(Ns),exports.TransformPlayableAsset=u([he(Kt.TransformPlayableAsset)],exports.TransformPlayableAsset);var tu=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();a(e,exports.VFXItem)&&(e.time=this.time)},e}(Vs);exports.ActivationPlayableAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.createPlayable=function(t){return new tu(t)},e}(Ns),exports.ActivationPlayableAsset=u([he(Kt.ActivationPlayableAsset)],exports.ActivationPlayableAsset),exports.AnimationClip=function(t){function e(){var e;return(e=t.apply(this,arguments)||this).duration=0,e.positionCurves=[],e.rotationCurves=[],e.scaleCurves=[],e.floatCurves=[],e}_t(e,t);var r=e.prototype;return r.sampleAnimation=function(t,e){var r=e/t.duration;r=r<0?0:r>1?1:r;for(var i,n=s(this.positionCurves);!(i=n()).done;){var a=i.value,o=a.keyFrames.getValue(r),u=this.findTarget(t,a.path);null==u||u.transform.setPosition(o.x,o.y,o.z)}for(var h,c=s(this.rotationCurves);!(h=c()).done;){var l=h.value,f=l.keyFrames.getValue(r),p=this.findTarget(t,l.path);null==p||p.transform.setQuaternion(f.x,f.y,f.z,f.w)}for(var d,m=s(this.scaleCurves);!(d=m()).done;){var v=d.value,y=v.keyFrames.getValue(r),g=this.findTarget(t,v.path);null==g||g.transform.setScale(y.x,y.y,y.z)}},r.fromData=function(t){this.positionCurves.length=0,this.scaleCurves.length=0,this.floatCurves.length=0;for(var e,r=s(t.positionCurves);!(e=r()).done;){var i=e.value,n={path:i.path,keyFrames:Yn(i.keyFrames)};this.duration=Math.max(this.duration,n.keyFrames.getMaxTime()),this.positionCurves.push(n)}for(var a,o=s(t.rotationCurves);!(a=o()).done;){var u=a.value,h={path:u.path,keyFrames:Yn(u.keyFrames)};this.duration=Math.max(this.duration,h.keyFrames.getMaxTime()),this.rotationCurves.push(h)}for(var c,l=s(t.scaleCurves);!(c=l()).done;){var f=c.value,p={path:f.path,keyFrames:Yn(f.keyFrames)};this.duration=Math.max(this.duration,p.keyFrames.getMaxTime()),this.scaleCurves.push(p)}for(var d,m=s(t.floatCurves);!(d=m()).done;){var v=d.value,y={path:v.path,keyFrames:Yn(v.keyFrames),property:v.property,className:v.className};this.duration=Math.max(this.duration,y.keyFrames.getMaxTime()),this.floatCurves.push(y)}},r.findTarget=function(t,e){for(var r,i=t,n=s(e);!(r=n()).done;){for(var a,o=r.value,u=!1,h=s(i.children);!(a=h()).done;){var c=a.value;if(c.name===o){i=c,u=!0;break}}if(!u)return}return i},e}(fe),exports.AnimationClip=u([he(Kt.AnimationClip)],exports.AnimationClip);var eu=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.processFrame=function(t){var e=t.output.getUserData();a(e,exports.VFXItem)&&e.composition&&this.clip.sampleAnimation(e,this.time)},e}(Vs);function ru(t,e){return!e||"object"!==o(e)&&"function"!=typeof e?we(t):e}var iu=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=void 0===e?100:e,i=t.textWidth,n=void 0===i?100:i,s=t.textOverflow,a=void 0===s?Nt.clip:s,o=t.textBaseline,u=void 0===o?kt.top:o,h=t.textAlign,c=void 0===h?zt.left:h,l=t.text,f=void 0===l?" ":l,p=t.letterSpace,d=void 0===p?0:p,m=t.autoWidth,v=void 0!==m&&m,y=t.fontSize,g=t.lineHeight,x=void 0===g?y:g,b=y+d;this.autoWidth=v,this.maxTextWidth=f.length*b,this.width=n,this.height=r,this.letterSpace=d,this.overflow=a,this.textBaseline=u,this.textAlign=c,this.lineHeight=x}var e=t.prototype;return e.getOffsetY=function(t,e,r,i){var n=t.outlineWidth,s=t.fontScale,a=(r-i)/3,o=i+n*s,u=r*(e-1),h=0;switch(this.textBaseline){case kt.top:h=o+a;break;case kt.middle:h=(this.height*s-u+o)/2;break;case kt.bottom:h=this.height*s-u-a}return h},e.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case zt.left:r=t.outlineWidth*t.fontScale;break;case zt.middle:r=(this.width*t.fontScale-e)/2;break;case zt.right:r=this.width*t.fontScale-e}return r},e.setSize=function(t,e){this.width=t,this.height=e},t}(),nu=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,r,i,n,s,a,o=t.textColor,u=void 0===o?[1,1,1,1]:o,h=t.fontSize,c=void 0===h?40:h,l=t.outline,f=t.shadow,p=t.fontWeight,d=void 0===p?"normal":p,m=t.fontStyle,v=void 0===m?"normal":m,y=t.fontFamily,g=void 0===y?"sans-serif":y;(this.textColor=u,this.textWeight=d,this.fontStyle=v,this.fontFamily=g,this.fontSize=c,l)&&(this.isOutlined=!0,this.outlineColor=null!=(e=l.outlineColor)?e:[1,1,1,1],this.outlineWidth=null!=(r=l.outlineWidth)?r:1,this.fontOffset+=this.outlineWidth);f&&(this.hasShadow=!0,this.shadowBlur=null!=(i=f.shadowBlur)?i:2,this.shadowColor=null!=(n=f.shadowColor)?n:[0,0,0,1],this.shadowOffsetX=null!=(s=f.shadowOffsetX)?s:0,this.shadowOffsetY=null!=(a=f.shadowOffsetY)?a:0);this.fontStyle!==Bt.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},su=new(function(){function t(){this.elements=[]}var r=t.prototype;return r.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements.length=0},r.getCanvas=function(){if(0!==this.elements.length){var t=this.elements.shift();return N(t),t}if(Ba(za))return e.window._createOffscreenCanvas(10,10);var r=e.document.createElement("canvas");return r.getContext("2d",{willReadFrequently:!0}),r},r.saveCanvas=function(t){t.width=1,t.height=1,this.elements.length<3?y(this.elements,t):t.remove()},t}()),au=["serif","sans-serif","monospace","courier"],ou=0;exports.TextComponent=function(t){function e(e,r){var i;if((i=t.call(this,e)||this).isDirty=!0,i.lineCount=0,i.maxLineWidth=0,i.SCALE_FACTOR=.1,i.ALPHA_FIX_VALUE=1/255,i.name="MText"+ou++,i.geometry=i.createGeometry(rr.TRIANGLES),r&&i.fromData(r),i.canvas=su.getCanvas(),su.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),i.setItem(),!r)return ru(i);var n=r.options;return i.updateWithOptions(n),i.updateTexture(),i}_t(e,t);var r=e.prototype;return r.onUpdate=function(e){t.prototype.onUpdate.call(this,e),this.updateTexture()},r.fromData=function(e){t.prototype.fromData.call(this,e);var r,i,n,s,a,o,u=e.interaction,h=e.options,c=e.listIndex,l=void 0===c?0:c,f=e.renderer;f||(f={}),this.interaction=u,this.renderer={renderMode:null!=(r=f.renderMode)?r:yt.MESH,blending:null!=(i=f.blending)?i:ht.ALPHA,texture:null!=(n=f.texture)?n:this.engine.emptyTexture,occlusion:!!f.occlusion,transparentOcclusion:!!f.transparentOcclusion||f.maskMode===lt.MASK,side:null!=(s=f.side)?s:ct.DOUBLE,mask:null!=(a=f.mask)?a:0,maskMode:null!=(o=f.maskMode)?o:lt.NONE,order:l},this.interaction=u,this.cachePrefix="-",this.renderInfo=Kn(this);var p=this.createMaterial(this.renderInfo,2);this.worldMatrix=Pe.fromIdentity(),this.material=p,this.material.setVector4("_TexOffset",(new Ce).setFromArray([0,0,1,1])),this.updateWithOptions(h),this.renderText(h),this.setItem(),this.material.setColor("_Color",new Zr(1,1,1,1))},r.updateWithOptions=function(t){},r.updateTexture=function(t){},e}(qn),exports.TextComponent=u([he(Kt.TextComponent)],exports.TextComponent);var uu=function(){function t(){}var e=t.prototype;return e.renderText=function(t){this.updateTexture()},e.updateWithOptions=function(t){this.textStyle=new nu(t),this.textLayout=new iu(t),this.text=t.text.toString(),this.lineCount=this.getLineCount(t.text,!0)},e.getLineCount=function(t,e){for(var r=this.context,i=this.textLayout,n=i.letterSpace,s=i.overflow,a=e?this.textStyle.fontSize/10:1/this.textStyle.fontScale,o=this.textLayout.width+this.textStyle.fontOffset,u=1,h=0,c=0;c<t.length;c++){var l,f,p=t[c],d=(null!=(f=null==r||null==(l=r.measureText(p))?void 0:l.width)?f:0)*a;h+=n,s===Nt.display?"\n"===p?(u++,h=0):(h+=d,this.maxLineWidth=Math.max(this.maxLineWidth,h)):((h+d>o&&c>0||"\n"===p)&&(u++,this.maxLineWidth=Math.max(this.maxLineWidth,h),h=0),"\n"!==p&&(h+=d))}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||k(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,r=this.textStyle,i=this.textLayout,n=r.fontScale,s=(i.width+r.fontOffset)*n,a=i.lineHeight*this.lineCount,o=r.fontSize*n,u=i.lineHeight*n;r.fontDesc=this.getFontDesc(o),this.char=(this.text||"").split(""),this.canvas.width=s,i.autoWidth?(this.canvas.height=a*n,this.item.transform.size.set(1,a/i.height)):this.canvas.height=i.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>s&&i.overflow===Nt.display?e.font=this.getFontDesc(o*s/this.maxLineWidth):e.font=r.fontDesc,e.clearRect(0,0,s,h),r.hasShadow&&this.setupShadow(),r.isOutlined&&this.setupOutline(),e.fillStyle="rgba("+r.textColor[0]+", "+r.textColor[1]+", "+r.textColor[2]+", "+r.textColor[3]+")";for(var c=[],l=0,f=i.getOffsetY(r,this.lineCount,u,o),p=[],d=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((l+=i.letterSpace*n)+y.width>s&&m>0||"\n"===v)&&(c.push({y:f,width:l,chars:p,charOffsetX:d}),l=0,f+=u,p=[],d=[]),"\n"!==v&&(p.push(v),d.push(l),l+=y.width)}c.push({y:f,width:l,chars:p,charOffsetX:d}),c.forEach((function(t){var n=i.getOffsetX(r,t.width);t.chars.forEach((function(i,s){r.isOutlined&&e.strokeText(i,n+t.charOffsetX[s],t.y),e.fillText(i,n+t.charOffsetX[s],t.y)}))})),r.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height),x=ur.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:t,magFilter:rr.LINEAR,minFilter:rr.LINEAR,wrapS:rr.CLAMP_TO_EDGE,wrapT:rr.CLAMP_TO_EDGE});this.renderer.texture=x,this.material.setTexture("_MainTex",x),this.isDirty=!1}},e.getFontDesc=function(t){var e=this.textStyle,r=e.fontSize,i=e.fontScale,n=e.fontFamily,s=e.textWeight,a=e.fontStyle,o=(t||r*i).toString()+"px ";return au.includes(n)?o+=n:o+='"'+n+'"',s!==Ut.normal&&(o=s+" "+o),a!==Bt.normal&&(o=a+" "+o),o},e.setupOutline=function(){var t=this.context,e=this.textStyle,r=e.outlineColor,i=e.outlineWidth,n=r[0],s=r[1],a=r[2],o=r[3];t&&(t.strokeStyle="rgba("+255*n+", "+255*s+", "+255*a+", "+o+")",t.lineWidth=2*i)},e.setupShadow=function(){var t=this.context,e=this.textStyle,r=e.outlineColor,i=e.shadowBlur,n=e.shadowOffsetX,s=e.shadowOffsetY,a=r[0],o=r[1],u=r[2],h=r[3];t&&(t.shadowColor="rgba("+255*a+", "+255*o+", "+255*u+", "+h+")",t.shadowBlur=i,t.shadowOffsetX=n,t.shadowOffsetY=-s)},t}();tt(exports.TextComponent,[uu]);var hu=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(Tt),cu=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e}(fe);exports.BinaryAsset=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.fromData=function(t){},e}(fe),u([ce()],exports.BinaryAsset.prototype,"buffer",void 0),exports.BinaryAsset=u([he(Kt.BinaryAsset)],exports.BinaryAsset);var lu=function(){function t(t){this.engine=t}var e=t.prototype;return e.loadGUID=function(e){if(this.engine.objectInstance[e])return this.engine.objectInstance[e];var r,i=this.findData(e);if(i){switch(i.dataType){case Kt.Material:r=Nr.create(this.engine);break;case Kt.Geometry:r=jr.create(this.engine);break;case Kt.Texture:r=ur.create(this.engine);break;default:var n=t.getClass(i.dataType);n&&(r=new n(this.engine))}if(r)return r.setInstanceId(i.id),this.engine.addInstance(r),ko.deserialize(i,r),r;console.error("Constructor for DataType: "+i.dataType+" not found.")}else console.error("Object data with uuid: "+e+" not found.")},e.loadGUIDAsync=function(e){var r=this;return i((function(){var i,n,s;return h(this,(function(a){switch(a.label){case 0:return r.engine.objectInstance[e]?[2,r.engine.objectInstance[e]]:(i=r.findData(e))?[3,2]:r.engine.database?[4,r.engine.database.loadGUID(e)]:(console.error("Object data with uuid: "+e+" not found."),[2,void 0]);case 1:return(n=a.sent())?(r.engine.addInstance(n),[2,n]):(console.error("Disk data with uuid: "+e+" not found."),[2,void 0]);case 2:switch(i.dataType){case Kt.Material:n=Nr.create(r.engine);break;case Kt.Geometry:n=jr.create(r.engine);break;case Kt.Texture:n=ur.create(r.engine);break;default:(s=t.getClass(i.dataType))&&(n=new s(r.engine))}return n?(n.setInstanceId(i.id),r.engine.addInstance(n),[4,ko.deserializeAsync(i,n)]):(console.error("Constructor for DataType: "+i.dataType+" not found."),[2,void 0]);case 3:return a.sent(),[2,n]}}))}))()},e.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return ue[t]},t}(),fu=function(){function t(){}return t.prototype.loadGUID=function(t){return i((function(){return h(this,(function(t){return[2,void 0]}))}))()},t}();function pu(t,e){if(!t.includes(e))return t.push(e),!0}function du(t){if(Number.isFinite(t))return[Ct.CONSTANT,t];if(t){var e=t[0],r=t[1];if(Array.isArray(e))return;if("static"===e||e===Ct.CONSTANT)return[Ct.CONSTANT,t[1]];if("lines"===e)return[Ct.LINE,t[1]];if(e===Ct.LINE){var i=r.map((function(t){return[St.LINE,t]}));return[Ct.BEZIER_CURVE,i]}return"curve"===e||e===Ct.CURVE?[Ct.BEZIER_CURVE,Fu(r)]:t}}function mu(t,e){return Array.isArray(t)&&"random"===t[0]?[Ct.CONSTANT,t[1][e]]:du(t)}function vu(t){return t&&"color"===t[0]?bu(t[1],!0):[1,1,1,1]}function yu(t,e){if(t)return"colors"===t[0]?[Ct.COLORS,t[1].map((function(t){return bu(t,e)}))]:"gradient"===t[0]?xu(t[1],e):"color"===t[0]?[Ct.RGBA_COLOR,bu(t[1],e)]:t}function gu(t){return t&&"random"===t[0]?[Ct.RANDOM,t[1]]:du(t)}function xu(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach((function(i){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(i),s=bu(t[i],e);r.push([n,s[0],s[1],s[2],s[3]])})),r=r.sort((function(t,e){return t[0]-e[0]})),[Ct.GRADIENT_COLOR,r]}}function bu(t,e){var r;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else a(t,Array)&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=Tu(r)),r}function Tu(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}function Eu(t,e){return Array.isArray(t)?t[0]===Ct.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&xu(t[1],e):xu(t,e)}function _u(t){if(t){if(3===t.length)return[Ct.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===Ct.BEZIER_PATH||e===Ct.LINEAR_PATH){var r=t[1],i=r[0],n=r[1],s=r[2],a=Fu(i);if(!s){s=[];for(var o=0;o<n.length;o++){var u=n[o].slice();0===o?s.push(u):o<n.length-1?(s.push(u),s.push(u)):s.push(u)}}return[Ct.BEZIER_CURVE_PATH,[a,n,s]]}return t}}function Au(t){for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value;t[i]=Number(t[i])}return t}function Cu(t){for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value;void 0===t[i]&&delete t[i]}return t}var Su,wu=Math.cos,Ru=Math.sin,Ou=Math.PI/180,Mu=180/Math.PI;function Pu(t,e){return t?[t[0]-.5,.5-t[1]]:e?Iu[e]:[0,0]}var Iu=((Su={})[gt.PARTICLE_ORIGIN_CENTER]=[0,0],Su[gt.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],Su[gt.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],Su[gt.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],Su[gt.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],Su[gt.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],Su[gt.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],Su[gt.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],Su[gt.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],Su);function Lu(t,e,r,i){var n=r[0],s=r[1],a=i[0],o=a-n;return[[n+(a-n)/3,s+(t*=o)/3],[a-(a-n)/3,i[1]-(e*=o)/3]]}function Fu(t){for(var e=-1e6,r=1e6,i=0;i<t.length;i++)e=Math.max(e,t[i][1]),r=Math.min(r,t[i][1]);for(var n=[[t[0][0],t[0][1]]],s=0;s<t.length-1;s++){var a=t[s][3]*(e-r),o=t[s+1][2]*(e-r),u=[t[s][0],t[s][1]],h=[t[s+1][0],t[s+1][1]];if(u[0]!=h[0]){var c=Lu(a,o,u,h),l=c[0],f=c[1];n[n.length-1].push(l[0]),n[n.length-1].push(l[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?[St.EASE_OUT,t]:e===n.length-1?[St.EASE_IN,t]:[St.EASE,t]}))}function Vu(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===vt.null&&t.endBehavior===wt.destroy&&(t.endBehavior=wt.freeze)}))})),t.version=ot["2_1"],t}function Du(t){var e;null==(e=t.plugins)||e.forEach((function(e,r){"richtext"===e&&(t.plugins[r]="rich-text")}));for(var r,i=s(t.components);!(r=i()).done;){var n=r.value;if(n.dataType===Kt.ShapeComponent){var a=n;if(a.type===Ht.Custom){var o,u=a;(null==(o=u.shapes)?void 0:o.length)>0&&u.shapes[0].fill&&(u.fill=u.shapes[0].fill);for(var h,c=new Array(u.easingIns.length),l=new Array(u.easingOuts.length).fill(!1),f=s(u.shapes);!(h=f()).done;)for(var p,d=s(h.value.indexes);!(p=d()).done;){var m=p.value,v=u.points[m.point],y=u.easingIns[m.easingIn],g=u.easingOuts[m.easingOut];c[m.easingIn]||(y.x-=v.x,y.y-=v.y,c[m.easingIn]=!0),l[m.easingOut]||(g.x-=v.x,g.y-=v.y,l[m.easingOut]=!0)}}}}for(var x,b=t.compositionId,T={},E=s(t.compositions);!(x=E()).done;){var _=x.value,A=J();T[_.id]=A,_.id===b&&(t.compositionId=A),_.id=A}for(var C,S=s(t.items);!(C=S()).done;){var w=C.value;if(w.content){var R=w.content.options;R&&void 0!==R.refId&&(R.refId=T[R.refId])}}return t}function Nu(t){for(var e,r,i,n=function(){var t=h.value;t.endBehavior!==jt&&t.endBehavior!==Gt||(t.endBehavior=wt.freeze),t.items=t.items.filter((function(t){return"8"!==t.type})),t.items.forEach((function(t){t.type===vt.particle&&(t.content.filter&&delete t.content.filter)}));for(var e,r=s(t.items);!(e=r()).done;){var i=e.value;c[i.id]=J(),i.oldId=i.id,i.id=c[i.id],l[i.id]=i}t.items.forEach((function(e,r){if(e.parentId)if(e.parentId.includes("^")){var i=e.parentId.split("^")[0],n=e.parentId.split("^")[1];e.parentId=c[i]+"^"+n}else e.parentId=c[e.parentId];a.items.push(e),t.items[r]={id:e.id}}));var n=Ie({},t,{timelineAsset:{id:""},sceneBindings:[]});a.compositions.push(n),function(t,e,r){for(var i,n=[],a=[],o=[],u={tracks:[],id:J(),dataType:"TimelineAsset"},h=s(t.items);!(i=h()).done;){var c=e[i.value.id],l=[],f={id:J(),dataType:"ActivationPlayableAsset"};o.push(f);var p={id:J(),dataType:"ActivationTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:f.id}}]};if(l.push({id:p.id}),a.push(p),c.type!==vt.particle){var d={id:J(),dataType:"TransformPlayableAsset",sizeOverLifetime:c.content.sizeOverLifetime,rotationOverLifetime:c.content.rotationOverLifetime,positionOverLifetime:c.content.positionOverLifetime};o.push(d);var m={id:J(),dataType:"TransformTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:d.id}}]};l.push({id:m.id}),a.push(m)}if(c.type===vt.sprite||c.type===vt.text){var v={id:J(),dataType:"SpriteColorPlayableAsset",colorOverLifetime:c.content.colorOverLifetime};o.push(v);var y={id:J(),dataType:"SpriteColorTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:v.id}}]};l.push({id:y.id}),a.push(y)}if(c.type===vt.composition){var g={id:J(),dataType:"SubCompositionPlayableAsset"};o.push(g);var x={id:J(),dataType:"SubCompositionTrack",children:[],clips:[{start:c.delay,duration:c.duration,endBehavior:c.endBehavior,asset:{id:g.id}}]};l.push({id:x.id}),a.push(x)}var b={id:J(),dataType:"ObjectBindingTrack",children:l,clips:[]};a.push(b),u.tracks.push({id:b.id}),n.push({key:{id:b.id},value:{id:c.id}})}for(var T,E=[],_=s(a);!(T=_()).done;){var A=T.value;E.push({id:A.id})}t.timelineAsset={id:u.id},t.sceneBindings=n,r.miscs.push(u);for(var C,S=s(a);!(C=S()).done;){var w=C.value;r.miscs.push(w)}for(var R,O=s(o);!(R=O()).done;){var M=R.value;r.miscs.push(M)}}(n,l,a)},a=Ie({},t,{items:[],compositions:[],components:[],materials:[],shaders:[],geometries:[],animations:[],miscs:[]}),o=s(a.images);!(r=o()).done;){r.value.id=J()}if(null!=(e=a).textures||(e.textures=[]),a.textures.forEach((function(t){var e;t.id=J(),t.dataType=Kt.Texture,t.source={id:null==(e=a.images[t.source])?void 0:e.id}})),a.textures.length<a.images.length)for(var u=a.textures.length;u<a.images.length;u++)a.textures.push({id:J(),dataType:Kt.Texture,source:{id:a.images[u].id},flipY:!0});t.bins&&(i=t.bins,a.bins=i.map((function(t){return{url:t.url,dataType:"BinaryAsset",id:J()}})));for(var h,c={},l={},f=s(t.compositions);!(h=f()).done;)n();for(var p,d=s(a.items);!(p=d()).done;){var m=p.value;if(m.content){if(m.content.renderer&&void 0!==m.content.renderer.texture){var v=m.content.renderer.texture;m.content.renderer.texture={id:a.textures[v].id}}if(m.content.trails&&void 0!==m.content.trails.texture){var y=m.content.trails.texture;m.content.trails.texture={id:a.textures[y].id}}}if(m.transform){var g,x,b,T=[].concat(null!=(g=m.transform.position)?g:[0,0,0]),E=[].concat(null!=(x=m.transform.rotation)?x:[0,0,0]),_=[].concat(null!=(b=m.transform.scale)?b:[1,1,1]);if(Object.assign(m,{transform:{position:{x:T[0],y:T[1],z:T[2]},eulerHint:{x:E[0],y:E[1],z:E[2]},scale:{x:_[0],y:_[1],z:_[0]}}}),m.type===vt.sprite&&(m.transform.size={x:_[0],y:_[1]},m.transform.scale={x:1,y:1,z:1}),m.type===vt.sprite){var A=m.content;A.renderer||(A.renderer={});var C,S,w,R,O=A.renderer,M=Pu(O.anchor,O.particleOrigin),P=m.transform.size;if(!O.anchor&&void 0!==O.particleOrigin)m.transform.position.x+=-M[0]*(null!=(C=null==P?void 0:P.x)?C:1),m.transform.position.y+=-M[1]*(null!=(S=null==P?void 0:P.y)?S:1);m.transform.anchor={x:M[0]*(null!=(w=null==P?void 0:P.x)?w:1),y:M[1]*(null!=(R=null==P?void 0:P.y)?R:1)}}}if(m.type===vt.particle){var I=m.content;I.renderer||(I.renderer={});var L=I.renderer;I.renderer.anchor=Pu(L.anchor,L.particleOrigin)}if(m.type===vt.camera&&m.content.positionOverLifetime&&0!==Object.keys(m.content.positionOverLifetime).length&&(m.content.positionOverLifetime.asMovement=!0),void 0!==m.pn){var F=m.pn,V=t.plugins,D=void 0===V?[]:V;void 0!==F&&Number.isInteger(F)&&(m.pluginName=D[F])}switch("editor-gizmo"===m.pluginName&&(m.type="editor-gizmo"),"orientation-transformer"===m.pluginName&&(m.type="orientation-transformer"),m.content.options.target&&"editor-gizmo"===m.pluginName&&(m.content.options.target=c[m.content.options.target]),m.type===vt.spine&&t.spines&&0!==t.spines.length&&zu(t.spines[m.content.options.spine],m.content,a),m.type!==vt.sprite&&m.type!==vt.particle&&m.type!==vt.mesh&&m.type!==vt.skybox&&m.type!==vt.light&&"camera"!==m.type&&m.type!==vt.tree&&m.type!==vt.interact&&m.type!==vt.camera&&m.type!==vt.text&&m.type!==vt.spine&&"editor-gizmo"!==m.type&&"orientation-transformer"!==m.type||(m.components=[],a.components.push(m.content),m.content.id=J(),m.content.item={id:m.id},m.dataType=Kt.VFXItemData,m.components.push({id:m.content.id})),m.type!==vt.null&&m.type!==vt.composition||(m.components=[],m.dataType=Kt.VFXItemData),m.type){case vt.sprite:m.content.dataType=Kt.SpriteComponent;break;case vt.particle:m.content.dataType=Kt.ParticleSystem;break;case vt.mesh:m.content.dataType=Kt.MeshComponent;break;case vt.skybox:m.content.dataType=Kt.SkyboxComponent;break;case vt.light:m.content.dataType=Kt.LightComponent;break;case"camera":m.content.dataType=Kt.CameraComponent;break;case"editor-gizmo":m.content.dataType="GizmoComponent";break;case"orientation-transformer":m.content.dataType="OrientationComponent";break;case vt.tree:m.content.dataType=Kt.TreeComponent;break;case vt.interact:m.content.dataType=Kt.InteractComponent;break;case vt.camera:m.content.dataType=Kt.CameraController;break;case vt.text:m.content.dataType=Kt.TextComponent;break;case vt.spine:m.content.dataType=Kt.SpineComponent}}return a.version=ot["3_0"],a}function ku(t){if(t)for(var e,r=s(Object.keys(t));!(e=r()).done;){var i=e.value,n=t[i],a=Array.isArray(n);a&&2===n.length&&Array.isArray(n[1])?t[i]="path"===i?_u(n):du(n):a||"object"!=typeof n||ku(n)}}function zu(t,e,r){e.resource={atlas:{bins:{id:r.bins[t.atlas[1][0]].id},source:t.atlas[1].slice(1)},skeleton:{bins:{id:r.bins[t.skeleton[1][0]].id},source:t.skeleton[1].slice(1)},skeletonType:t.skeletonType,images:t.images.map((function(t){return{id:r.textures[t].id}}))}}function Uu(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},s={path:_u(null==(r=t.transform)?void 0:r.path),gravity:i.gravity,gravityOverLifetime:du(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:du(n.linearX),linearY:du(n.linearY),linearZ:du(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:du(n.orbitalX),orbitalY:du(n.orbitalY),orbitalZ:du(n.orbitalZ),speedOverLifetime:du(n.speedOverLifetime)};Cu(s);var a={options:{startColor:vu(i.startColor)},positionOverLifetime:s};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var o=t.rotationOverLifetime;if(o){var u=a.rotationOverLifetime={separateAxes:o.separateAxes,asRotation:o.asRotation};u.separateAxes?(u.x=du(o.x),u.y=du(o.y),u.z=du(o.z)):u.z=du(o.angularVelocity)}var h=t.colorOverLifetime;if(h){var c=a.colorOverLifetime={opacity:du(h.opacity)};h.color&&(c.color=Eu(h.color))}var l=t.sizeOverLifetime;return l&&(a.sizeOverLifetime={separateAxes:l.separateAxes,size:du(l.size),x:du(l.x),y:du(l.y),z:du(l.z)}),a}var Bu=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,Gu=/^(\d+)\.(\d+)$/,ju=!1;function Xu(t){if(!t||"object"!=typeof t)throw new Error("Invalid input: Expected a JSON object.");var e;if(function(t){var e,r=null==(e=t.version)?void 0:e.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==vt.mesh&&t.type!==vt.light||(t.endBehavior=1===t.endBehavior?wt.destroy:t.endBehavior)}))}))}(t),Bu.test(t.version))return ju="0"===(null==(e=/^(\d+)/.exec(t.version))?void 0:e[0]),Du(Nu(Vu(function(t){var e;Hu=ot["1_0"];var r=t.plugins||[];(null==(e=t.bins)?void 0:e.length)&&(Hu=ot["1_3"]);var i,n=(t.requires||[]).slice(),s=t.images.map((function(e,r){return Wu(e,r,t.imageTags||[])})),a=t.textures||s.map((function(t,e){return{source:e,flipY:!0}})),o={plugins:r,shapes:t.shapes||[],type:"ge",version:Hu,playerVersion:null!=(i=t.playerVersion)?i:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return Yu(t,{plugins:r,requires:n})})),images:s,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:a,bins:(t.bins||[]).slice()};t._textures&&(o._textures=t._textures);return o}(t))));ju=!1;var r=Gu.exec(t.version)||[],i=Number(r[1]),n=Number(r[2]);if(i)return(i<2||2===i&&n<4)&&(t=function(t){return t.compositions.map((function(t){for(var e,r=s(t.items);!(e=r()).done;)ku(e.value.content)})),t}(t)),i<3&&(t=Nu(Vu(t))),i<4&&3===i&&n<2&&(t=Du(t)),t;throw new Error("Invalid JSON version: "+t.version+".")}var Hu=ot["1_0"];function Wu(t,e,r){var i=r[e];if("string"==typeof t)return{id:J(),renderLevel:i,url:t};if(t.template)return{id:J(),url:t.url,template:t.template,webp:t.webp,renderLevel:i};if(t.compressed)return{id:J(),url:t.url,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{id:J(),url:t.url,webp:t.webp,renderLevel:i};if(t&&t.sourceType)return t;throw new Error("Invalid image type.")}function Yu(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Ie({clipMode:Xt},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Qu(t,e)})),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var s=null==(r=t.meta)?void 0:r.previewSize;return s&&s[0]===s[1]&&0===s[0]&&(s=void 0),s&&(i.previewSize=s),i}var Zu,qu=[0,0,0,1],Ku=.5;function Qu(t,e){var r;void 0===e&&(e={});var i,n,s,a,o,u,h=vt.base,c=t.endBehavior,l=NaN;if(t.content?(h=t.type||vt.plugin,u=t.pn,o=t.pluginName,s=t.content,n=t.content,isNaN(u)&&!o&&(o=s.options.type),t.duration&&(l=t.duration),i=t.transform||y(n.transform)):t.particle?(h=vt.particle,i=y((n=t.particle).transform,ju,!0),s=function(t){var e=t.options,r=t.transform,i={type:ft.NONE};if(t.shape){var n,s=null==(n=t.shape.shape)?void 0:n.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(i=Ie({},t.shape,{type:ft[s]}),t.shape.upDirection){var a=t.shape.upDirection,o=a[0],u=a[1],h=a[2];0===o&&0===u&&0===h&&delete i.upDirection}}e.startTurbulence&&(i.turbulenceX=gu(e.turbulenceX),i.turbulenceY=gu(e.turbulenceY),i.turbulenceZ=gu(e.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map((function(t){return Au(t)}))),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map((function(t){return Au(t)}))),c.rateOverTime&&(c.rateOverTime=gu(c.rateOverTime));var l={renderer:t.renderer,shape:i,splits:t.splits,emission:c,options:{startLifetime:gu(e.startLifetime),start3DSize:!!e.start3DSize,startSize:gu(e.startSize),startSizeX:gu(e.startSizeX),startSizeY:gu(e.startSizeY),sizeAspect:gu(e.sizeAspect),maxCount:e.maxCount,startDelay:gu(e.startDelay),startColor:yu(e.startColor,!0),startRotationZ:gu(e.startRotation||e.startRotationZ),particleFollowParent:e.particleFollowParent}};e.start3DRotation&&(l.options.startRotationX=gu(e.startRotationX),l.options.startRotationY=gu(e.startRotationY)),r&&r.path&&(l.emitterTransform={path:_u(r.path)});var f=t.sizeOverLifetime;f&&(f.separateAxes?l.sizeOverLifetime={separateAxes:!0,x:gu(f.x),y:gu(f.y)}:l.sizeOverLifetime={size:gu(f.size)});var p=t.velocityOverLifetime||{},d=p.speedOverLifetime;d=d?du(d):void 0,l.positionOverLifetime={gravity:e.gravity,gravityOverLifetime:du(e.gravityModifier),startSpeed:gu(e.startSpeed),speedOverLifetime:d,asMovement:p.asMovement,linearX:gu(p.linearX),linearY:gu(p.linearY),linearZ:gu(p.linearZ),asRotation:p.asRotation,orbCenter:p.orbCenter,orbitalX:gu(p.orbitalX),orbitalY:gu(p.orbitalY),orbitalZ:gu(p.orbitalZ),forceTarget:p.forceTarget,target:p.target,forceCurve:du(p.forceCurve)},Cu(l.positionOverLifetime);var m=t.rotationOverLifetime;m&&(l.rotationOverLifetime={separateAxes:m.separateAxes,asRotation:m.asRotation,z:gu(m.separateAxes?m.z:m.angularVelocity)},m.separateAxes&&(l.rotationOverLifetime.y=du(m.y),l.rotationOverLifetime.x=du(m.x)));var v=t.colorOverLifetime;if(v){var y=l.colorOverLifetime={opacity:du(v.opacity)};v.color&&(y.color=Eu(v.color))}var g=t.textureSheetAnimation;g&&(l.textureSheetAnimation={row:g.row,col:g.col,total:g.total,animate:g.animate,cycles:du(g.cycles),animationDelay:mu(g.animationDelay,0),animationDuration:mu(g.animationDuration,0)});var x=t.trails;x&&(l.trails={lifetime:gu(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:du(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&Eu(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&Eu(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:gu(x.opacityOverLifetime)}),l.trails&&Cu(l.trails);var b=t.interaction;return b&&(l.interaction={behavior:b.behavior,radius:b.radius,multiple:b.multiple}),l}(n)):t.sprite?(h=vt.sprite,s=function(t,e){var r=Uu(t,e),i=t.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=t.renderer,t.splits&&(r.splits=t.splits),t.interaction&&(r.interaction=t.interaction),r}(n=t.sprite,i=y(n.transform,!1,!0))):t.cal?(h=vt.null,s=Uu(n=t.cal,i=y(n.transform,!1,!0))):t.ui?(h=vt.interact,i=y((n=t.ui).transform),s=function(t){var e,r=t.options;switch(r.type){case"click":e={type:dt.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&vu(r.previewColor),behavior:r.behavior||mt.NOTIFY};break;case"drag":e={type:dt.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:dt.MESSAGE}}return{options:e}}(n),i.scale=[n.options.width||1,n.options.height||1,1]):t.model&&(n=t.model,1===t.model.options.type&&(h=vt.camera,i=y(n.transform),s=function(t){var e,r=t.options,i={options:{fov:r.fov,far:r.far,near:r.near,clipMode:r.clipMode}},n=t.velocityOverLifetime;if(n||(null==(e=t.transform)?void 0:e.path)){var s,a={path:_u(null==(s=t.transform)?void 0:s.path),linearX:du(null==n?void 0:n.translateX),linearY:du(null==n?void 0:n.translateY),linearZ:du(null==n?void 0:n.translateZ)};Cu(a),i.positionOverLifetime=a}var o=t.rotationOverLifetime;if(o){var u={separateAxes:o.separateAxes,x:du(null==o?void 0:o.rotateX),y:du(null==o?void 0:o.rotateY),z:o.separateAxes?du(null==o?void 0:o.rotateZ):du(o.rotation)};Cu(u),i.rotationOverLifetime=u}return i}(n))),null==(r=s.renderer)?void 0:r.anchor){var f=new Float32Array(s.renderer.anchor);f[0]==Ku&&f[1]==Ku?delete s.renderer.anchor:e.requires&&pu(e.requires,"anchor")}if(n){var p,d,m=null==(p=n.options)?void 0:p.looping;if(m)c=Array.isArray(m)?m[1]?wt.restart:wt.destroy:wt.restart;else c=c||(null==n||null==(d=n.options)?void 0:d.endBehavior)||wt.destroy;n.options.renderLevel&&(a=n.options.renderLevel),isNaN(l)&&(l=n.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:l,id:t.id+"",transform:i,endBehavior:c,renderLevel:a,content:s};return o?e.plugins?(pu(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,r){if(t){var i={},n=t.rotation;if(n&&(i.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var s=(a=qu,o=i.rotation[0],u=i.rotation[1],h=i.rotation[2],c=wu(o*Ou/2),l=wu(u*Ou/2),f=wu(h*Ou/2),p=Ru(o*Ou/2),d=Ru(u*Ou/2),m=Ru(h*Ou/2),a[0]=p*l*f+c*d*m,a[1]=c*d*f-p*l*m,a[2]=c*l*m+p*d*f,a[3]=c*l*f-p*d*m,a);i.rotation=function(t,e){var r,i,n,s=e[0],a=e[1],o=e[2],u=e[3],h=s+s,c=a+a,l=o+o,f=s*h,p=a*h,d=a*c,m=o*l,v=u*l,y=1-d-m,g=p-v,x=p+v,b=1-f-m,T=o*h-u*c,E=o*c+u*h,_=1-f-d;return t[1]=Math.asin((i=-1,(r=-T)>(n=1)?n:r<i?i:r))*Mu,Math.abs(T)<.9999999?(t[0]=Math.atan2(E,_)*Mu,t[2]=Math.atan2(x,y)*Mu):(t[0]=0,t[2]=Math.atan2(-g,b)*Mu),t}([],s)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}var a,o,u,h,c,l,f,p,d,m;return{}}}var Ju,$u=((Zu={})[ut.S]=[ut.S,ut.BPlus,ut.APlus],Zu[ut.A]=[ut.A,ut.BPlus,ut.APlus],Zu[ut.B]=[ut.B,ut.BPlus],Zu);function th(t,e){if(!t||!e)return!0;var r=$u[e];return!!r&&r.includes(t)}function eh(t,e){var r,i,n=null!=(i=null==t?void 0:t.background)?i:{},s=n.name,a=n.url;return s&&(e&&e[s]?r=e[s]:a&&(r=a)),r}function rh(t,e,r){return ih.apply(this,arguments)}function ih(){return(ih=i((function(t,r,i){var n,s;return h(this,(function(o){switch(o.label){case 0:return"string"!=typeof t?[3,2]:[4,Ue(t)];case 1:return n=o.sent(),[3,3];case 2:n=t,o.label=3;case 3:if(!n)throw new Error("Image not provided.");if(!r)return[2,n];if(s=eh(r,i)){if(H(s)&&s!==n.src)return[2,Ue(s)];if(a(s,e.HTMLImageElement))return[2,s]}return[2,n]}}))}))).apply(this,arguments)}exports.Scene=void 0,(Ju=exports.Scene||(exports.Scene={})).isJSONObject=function(t){return Z(t)&&"jsonScene"in t},Ju.isURL=function(t){return Z(t)&&"url"in t},Ju.isWithOptions=function(t){return Z(t)&&"options"in t};var nh=1,sh=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e=new Le),this.options=t,this.downloader=e,this.assets={},this.sourceFrom={},this.id=nh++,this.timers=[],this.updateOptions(t)}var r=t.prototype;return r.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,r=void 0===e?10:e;this.timeout=r},r.loadScene=function(t,r,n){var s=this;return i((function(){var a,o,u,c,l,f,p,d,m,v,y,g,x;return h(this,(function(b){return o=H(t)?t:s.id,u=e.performance.now(),c=[],l=null==r?void 0:r.engine.gpuCapability,p=null!=(f=null==l?void 0:l.detail.compressedTexture)?f:exports.COMPRESSED_TEXTURE.NONE,d={},v=!1,y=new Promise((function(t,r){m=e.window.setTimeout((function(){v=!0,s.removeTimer(m);var t=e.performance.now()-u;r(new Error("Load time out: totalTime: "+t.toFixed(4)+"ms "+c.join(" ")+", url: "+o+"."))}),1e3*s.timeout),s.timers.push(m)})),g=i((function(t,r){var i,n,s,a;return h(this,(function(o){switch(o.label){case 0:if(v)return[3,4];i=e.performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,r()];case 2:return n=o.sent(),s=e.performance.now()-i,c.push("["+t+": "+s.toFixed(2)+"]"),d[t]=s,[2,n];case 3:throw a=o.sent(),new Error("Load error in "+t+", "+a+".");case 4:throw new Error("Load canceled.")}}))})),x=i((function(){var r,i,l,f,v,y,x,b,T,E,_,A,C,S,w,R,O,M;return h(this,(function(h){switch(h.label){case 0:return H(t)?(i=new e.URL(t,e.location.href).href,s.baseUrl=i,[4,g("loadJSON",(function(){return s.loadJSON(i)}))]):[3,2];case 1:return a=h.sent(),[3,3];case 2:a=t,s.baseUrl=e.location.href,h.label=3;case 3:return exports.Scene.isJSONObject(a)?(r=Ie({},a),l=r.jsonScene,f=r.pluginSystem,v=r.images,y=l.images,s.assignImagesToAssets(y,v),[4,Promise.all([g("plugin:processAssets",(function(){return s.processPluginAssets(l,f,n)}))])]):[3,5];case 4:return h.sent(),[3,10];case 5:return[4,g("processJSON",(function(){return s.processJSON(a)}))];case 6:return x=h.sent(),b=x.jsonScene,T=x.pluginSystem,E=b.bins,_=void 0===E?[]:E,A=b.images,C=b.fonts,[4,Promise.all([g("processBins",(function(){return s.processBins(_)})),g("processImages",(function(){return s.processImages(A,p)})),g("plugin:processAssets",(function(){return s.processPluginAssets(b,T,n)})),g("processFontURL",(function(){return s.processFontURL(C)}))])];case 7:return S=h.sent(),w=S[0],R=S[1],[4,g("processTextures",(function(){return s.processTextures(R,w,b)}))];case 8:return O=h.sent(),r={timeInfos:d,url:t,renderLevel:s.options.renderLevel,storage:{},pluginSystem:T,jsonScene:b,bins:w,images:R,textureOptions:O},[4,g("plugin:prepareResource",(function(){return T.loadResources(r,s.options)}))];case 9:h.sent(),h.label=10;case 10:return M=e.performance.now()-u,j.info("Load asset: totalTime: "+M.toFixed(4)+"ms "+c.join(" ")+", url: "+o+"."),e.window.clearTimeout(m),s.removeTimer(m),r.totalTime=M,r.startTime=u,r.timeInfos=d,[2,r]}}))})),[2,Promise.race([y,x()])]}))}))()},r.getAssets=function(){return this.assets},r.processJSON=function(t){var e=this;return i((function(){var r,i;return h(this,(function(n){switch(n.label){case 0:return r=Xu(t),[4,(i=new st).processRawJSON(r,e.options)];case 1:return n.sent(),[2,{jsonScene:r,pluginSystem:i}]}}))}))()},r.processBins=function(t){var r=this;return i((function(){var i,n,s;return h(this,(function(o){return i=r.options.renderLevel,n=r.baseUrl,s=t.map((function(s){if(a(s,ArrayBuffer))return s;if(th(s.renderLevel,i))return r.loadBins(new e.URL(s.url,n).href);throw new Error("Invalid bins source: "+JSON.stringify(t)+".")})),[2,Promise.all(s)]}))}))()},r.processFontURL=function(r){var n=this;return i((function(){var s;return h(this,(function(a){return r?(s=r.map(i((function(r){var i,s,a;return h(this,(function(o){switch(o.label){case 0:if(!r.fontURL||t.fontCache.has(r.fontFamily))return[3,4];k(r.fontFamily)||console.warn("Risky font family: "+r.fontFamily+"."),o.label=1;case 1:return o.trys.push([1,3,,4]),i=new e.URL(r.fontURL,n.baseUrl).href,[4,(a=new FontFace(null!=(s=r.fontFamily)?s:"","url("+i+")")).load()];case 2:return o.sent(),e.document.fonts.add(a),t.fontCache.add(r.fontFamily),[3,4];case 3:return o.sent(),j.warn("Invalid font family or font source: "+JSON.stringify(r.fontURL)+"."),[3,4];case 4:return[2]}}))}))),[2,Promise.all(s)]):[2]}))}))()},r.processImages=function(t,r){void 0===r&&(r=0);var n=this;return i((function(){var s,o,u,c,l,f,p,d;return h(this,(function(m){switch(m.label){case 0:return s=n.options,o=s.useCompressedTexture,u=s.variables,c=s.disableWebP,l=s.disableAVIF,f=n.baseUrl,p=t.map(i((function(t,i){var s,p,d,m,v,y,g,x,b,T,E,_,A,C,S,w,R,O,M,P,I;return h(this,(function(i){switch(i.label){case 0:if(s=t.url,p=t.webp,d=t.avif,m=new e.URL(s,f).href,v=!c&&p?new e.URL(p,f).href:void 0,y=!l&&d?new e.URL(d,f).href:void 0,g=t.id,!("template"in t))return[3,8];if(x=t.template,!(b=x.background))return[3,7];T=eh(x,u),E=b.type===Zt.video,_=b&&E?He:Ue,i.label=1;case 1:return i.trys.push([1,6,,7]),[4,Ye(T,_)];case 2:return a(A=i.sent(),e.HTMLVideoElement)?(n.sourceFrom[g]={url:A.src,type:exports.TextureSourceType.video},[2,A]):[3,3];case 3:return b&&Array.isArray(T)&&u&&(u[b.name]=A.src),n.sourceFrom[g]={url:A.src,type:exports.TextureSourceType.image},[4,rh(A,x,u)];case 4:return[2,i.sent()];case 5:return[3,7];case 6:throw C=i.sent(),new Error("Failed to load. Check the template or if the URL is "+(E?"video":"image")+" type, URL: "+T+", Error: "+(C.message||C)+".");case 7:return[3,9];case 8:if("compressed"in t&&o&&r){if(S=t.compressed,r===exports.COMPRESSED_TEXTURE.ASTC?w=S.astc:r===exports.COMPRESSED_TEXTURE.PVRTC&&(w=S.pvrtc),w)return R=new e.URL(w,f).href,n.sourceFrom[g]={url:R,type:exports.TextureSourceType.compressed},[2,n.loadBins(R)]}else if(a(t,e.HTMLImageElement)||a(t,e.HTMLCanvasElement)||a(t,e.HTMLVideoElement)||a(t,ur))return[2,t];i.label=9;case 9:return y?[4,ke(m,y)]:[3,11];case 10:return I=i.sent(),[3,13];case 11:return[4,De(m,v)];case 12:I=i.sent(),i.label=13;case 13:return M=(O=I).url,P=O.image,n.sourceFrom[g]={url:M,type:exports.TextureSourceType.image},[2,P]}}))}))),[4,Promise.all(p)];case 1:return d=m.sent(),n.assignImagesToAssets(t,d),[2,d]}}))}))()},r.processPluginAssets=function(t,e,r){var n=this;return i((function(){var i,s,a,o,u;return h(this,(function(h){switch(h.label){case 0:return[4,e.processAssets(t,r)];case 1:for(i=h.sent(),s=i.reduce((function(t,e){return t.assets=t.assets.concat(e.assets),t.loadedAssets=t.loadedAssets.concat(e.loadedAssets),t}),{assets:[],loadedAssets:[]}),a=s.assets,o=s.loadedAssets,u=0;u<a.length;u++)n.assets[a[u].id]=o[u];return[2]}}))}))()},r.processTextures=function(t,r,n){var s=this;return i((function(){var o,u,c;return h(this,(function(l){return u=null!=(o=n.textures)?o:t.map((function(t,e){return{source:e}})),c=u.map(i((function(t,i){var o,u,c,l,f,p;return h(this,(function(h){switch(h.label){case 0:if(a(t,ur))return[2,t];if(!("mipmaps"in t))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,qe(t,r,s.assets,n.bins)];case 2:return[2,h.sent()];case 3:throw o=h.sent(),new Error("Load texture "+i+" fails, error message: "+o+".");case 4:return u=t.source,c=t.id,f="",Z(u)?(l=s.assets[u.id],f=u.id,[3,7]):[3,5];case 5:return"string"!=typeof u?[3,7]:[4,Ue($(u))];case 6:l=h.sent(),h.label=7;case 7:if(l)return p=function(t,r,i){var n={id:i,dataType:Kt.Texture};if(a(t,ur))return Ie({},t.source,n);if(a(t,e.HTMLImageElement)||q(t))return Ie({image:t,sourceType:exports.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:rr.LINEAR,magFilter:rr.LINEAR},n);if(a(t,e.HTMLVideoElement))return Ie({sourceType:exports.TextureSourceType.video,video:t,minFilter:rr.LINEAR,magFilter:rr.LINEAR},n);if(a(t,ArrayBuffer))return Ie({},dr(t),{sourceFrom:r},n);if("width"in t&&"height"in t&&"data"in t)return Ie({sourceType:exports.TextureSourceType.data,data:t,wrapS:rr.CLAMP_TO_EDGE,wrapT:rr.CLAMP_TO_EDGE,minFilter:rr.NEAREST,magFilter:rr.NEAREST},n);throw new Error("Invalid texture options.")}(l,s.sourceFrom[f],c),[2,p.sourceType===exports.TextureSourceType.compressed?p:Ie({},p,t)];throw new Error("Invalid texture source: "+u+".")}}))}))),[2,Promise.all(c)]}))}))()},r.loadJSON=function(t){var e=this;return i((function(){return h(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadJSON(t,r,(function(e,r){i("Couldn't load JSON "+JSON.stringify(t)+": status "+e+", "+r)}))}))]}))}))()},r.loadBins=function(t){var e=this;return i((function(){return h(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadBinary(t,r,(function(e,r){i("Couldn't load bins "+JSON.stringify(t)+": status "+e+", "+r)}))}))]}))}))()},r.assignImagesToAssets=function(t,e){for(var r=0;r<t.length;r++)this.assets[t[r].id]=e[r]},r.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},r.dispose=function(){this.timers.length&&this.timers.map((function(t){return e.window.clearTimeout(t)})),this.assets={},this.sourceFrom={},this.timers=[]},t}();sh.fontCache=new Set;var ah,oh=function(){function t(t){this.engine=t,this.builtinObjects=[],this.builtinObjects.push(lr(t))}var e=t.prototype;return e.assembleSceneLoadOptions=function(t,e){void 0===e&&(e={});var r=t;return exports.Scene.isURL(t)&&(exports.Scene.isJSONObject(t)||(r=t.url),exports.Scene.isWithOptions(t)&&(e=Ie({},e,t.options))),{source:r,options:e}},e.updateTextVariables=function(t,e){var r=this;void 0===e&&(e={}),t.jsonScene.items.forEach((function(t){if(t.type===vt.text||t.type===vt.richtext){var i=e[t.name];if(!i)return;t.components.forEach((function(t){var e=t.id,n=r.engine.findEffectsObjectData(e);(null==n?void 0:n.dataType)!==Kt.TextComponent&&(null==n?void 0:n.dataType)!==Kt.RichTextComponent||(n.options.text=i)}))}}))},e.initializeTexture=function(t){for(var e=0;e<t.textureOptions.length;e++){var r=t.textureOptions[e];a(r,ur)?this.engine.addInstance(r):(r=this.engine.assetLoader.loadGUID(t.textureOptions[e].id),t.textureOptions[e]=r),r.initialize()}},e.prepareAssets=function(t,e){this.engine.clearResources();for(var r,i=s(Object.keys(e));!(r=i()).done;){var n=r.value,a=e[n],o=new cu(this.engine);o.data=a,o.setInstanceId(n)}this.engine.addPackageDatas(t);for(var u,h=s(this.builtinObjects);!(u=h()).done;){var c=u.value;this.engine.addInstance(c)}},e.createShaderVariant=function(){for(var t,e=s(Object.keys(this.engine.objectInstance));!(t=e()).done;){var r=t.value,i=this.engine.objectInstance[r];a(i,Nr)&&i.createShaderVariant()}},e.destroyBuiltinObjects=function(){for(var t,e=s(this.builtinObjects);!(t=e()).done;){t.value.dispose()}this.builtinObjects.length=0},e.dispose=function(){this.destroyBuiltinObjects()},t}(),uh=new Ae(1,1,1),hh=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.transform=new Bs,this.viewportMatrix=Pe.fromIdentity(),this.viewMatrix=Pe.fromIdentity(),this.projectionMatrix=Pe.fromIdentity(),this.viewProjectionMatrix=Pe.fromIdentity(),this.inverseViewMatrix=Pe.fromIdentity(),this.dirty=!0;var r=e.near,i=void 0===r?.1:r,n=e.far,s=void 0===n?20:n,a=e.fov,o=void 0===a?60:a,u=e.aspect,h=void 0===u?1:u,c=e.clipMode,l=void 0===c?At.portrait:c,f=e.position,p=void 0===f?[0,0,8]:f,d=e.rotation,m=void 0===d?[0,0,0]:d,v=new Hr(m[0],m[1],m[2]),y=(new Re).setFromEuler(v);this.options={near:i,far:s,fov:o,aspect:h,clipMode:l},this.transform.setPosition(p[0],p[1],p[2]),this.transform.setQuaternion(y.x,y.y,y.z,y.w),this.dirty=!0,this.updateMatrix()}var 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 Ae(this.position.x,this.position.y,t),r=this.getViewProjectionMatrix(),i=this.getInverseViewProjectionMatrix();if(!this.viewportMatrix.isIdentity()){var n=this.viewportMatrix.clone();i.premultiply(n),r.multiply(n.invert())}var s=r.projectPoint(e).z,a=i.projectPoint(new Ae(1,1,s)),o=a.x,u=a.y,h=i.projectPoint(new Ae(-1,-1,s)),c=h.x,l=h.y;return new Ae((o-c)/2,(u-l)/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 Ie({},this.options,{position:this.position.clone(),rotation:this.rotation.clone()})},e.copy=function(t){var e=t.near,r=t.far,i=t.fov,n=t.clipMode,s=t.aspect,a=t.position,o=t.rotation;this.near=e,this.far=r,this.fov=i,this.clipMode=n,this.aspect=s,this.position=a,this.rotation=o,this.updateMatrix()},e.updateMatrix=function(){if(this.dirty){var t,e=this.options,r=e.fov,i=e.aspect,n=e.near,s=e.far,a=e.clipMode;this.projectionMatrix.perspective(r*ye,i,n,s,a===At.portrait),this.projectionMatrix.premultiply(this.viewportMatrix),this.inverseViewMatrix.compose(this.position,this.getQuat(),uh),this.inverseViewMatrix.premultiply(null!=(t=this.transform.getParentMatrix())?t:Pe.IDENTITY),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},se(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}(),ch=function(){function t(t,e){this.engine=e,this.imgUsage={},this.mask=0;var r=t.jsonScene,i=t.renderLevel,n=t.textureOptions,a=r.compositions,o=r.compositionId;if(!n)throw new Error("scene.textures expected.");var u=n;this.jsonScene=r,this.renderLevel=i,this.textures=u;for(var h,c=s(a);!(h=c()).done;){var l=h.value,f=this.getContent(l);this.engine.addEffectsObjectData(f),l.id===o&&(this.sourceContent=f)}if(!this.sourceContent)throw new Error("Invalid composition id: "+o+".")}var e=t.prototype;return e.getContent=function(t){var e=Ie({},t);return this.assembleItems(e),isNaN(e.endBehavior)&&(e.endBehavior=wt.freeze),e.startTime||(e.startTime=0),e},e.assembleItems=function(t){this.mask++;var e={},r=[];if(this.jsonScene){for(var i,n=s(this.jsonScene.components);!(i=n()).done;){var a=i.value;e[a.id]=a}for(var o,u=s(t.items);!(o=u()).done;){var h=o.value,c=this.engine.jsonSceneData[h.id],l=c;if(th(c.renderLevel,this.renderLevel)){if(l.type===vt.sprite||l.type===vt.particle||l.type===vt.spine||l.type===vt.text||l.type===vt.video||l.type===vt.shape)for(var f,p=s(l.components);!(f=p()).done;){var d=e[f.value.id];this.preProcessItemContent(d)}r.push(h)}else l.type!==vt.composition&&(l.components=[],r.push(h))}t.items=r}},e.preProcessItemContent=function(t){if(t.renderer){t.renderer=this.changeTex(t.renderer),"mask"in t.renderer||this.processMask(t.renderer);var e,r,i=t.splits&&!t.textureSheetAnimation?t.splits[0]:void 0,n=t.renderer.shape;if(Number.isInteger(n))e=null==(r=this.jsonScene)?void 0:r.shapes[n];else n&&(e=n);void 0===e||"aPoint"in e&&"index"in e||(t.renderer.shape=Ia(e,i))}"trails"in t&&void 0!==t.trails&&(t.trails=this.changeTex(t.trails))},e.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},e.addTextureUsage=function(t){var e,r=null!=(e=this.imgUsage)?e:{};t&&r&&(Object.prototype.hasOwnProperty.call(r,t)||(r[t]=0),r[t]++)},e.processMask=function(t){var e=t.maskMode;e!==lt.NONE&&(t.mask||(e===lt.MASK?t.mask=++this.mask:e!==lt.OBSCURED&&e!==lt.REVERSE_OBSCURED||(t.mask=this.mask)))},e.dispose=function(){this.textures=[],this.jsonScene=void 0,this.sourceContent=void 0},t}(),lh=function(){function t(){this.update=new ph,this.lateUpdate=new dh}var e=t.prototype;return e.addComponent=function(t){t.onUpdate!==pe.prototype.onUpdate&&this.update.addComponent(t),t.onLateUpdate!==pe.prototype.onLateUpdate&&this.lateUpdate.addComponent(t)},e.removeComponent=function(t){t.onUpdate!==pe.prototype.onUpdate&&this.update.removeComponent(t),t.onLateUpdate!==pe.prototype.onLateUpdate&&this.lateUpdate.removeComponent(t)},e.clear=function(){this.update.clear(),this.lateUpdate.clear()},t}(),fh=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 r=t.bind(e);this.ticks.includes(r)||this.ticks.push(r)},e.clear=function(){this.components=[]},t}(),ph=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.tickComponents=function(t,e){for(var r,i=s(t);!(r=i()).done;){r.value.onUpdate(e)}},e}(fh),dh=function(t){function e(){return t.apply(this,arguments)}return _t(e,t),e.prototype.tickComponents=function(t,e){for(var r,i=s(t);!(r=i()).done;){r.value.onLateUpdate(e)}},e}(fh),mh=function(t){function r(e,r){var i,n;(i=t.call(this)||this).sceneTicking=new lh,i.speed=1,i.isEnded=!1,i.loaderData={},i.refContent=[],i.postProcessingEnabled=!1,i.assigned=!1,i.destroyed=!1,i.postLoaders=[],i.paused=!1,i.lastVideoUpdateTime=0,i.isEndCalled=!1;var s=e.reusable,a=void 0!==s&&s,o=e.speed,u=void 0===o?1:o,h=e.baseRenderOrder,c=void 0===h?0:h,l=e.renderer,f=e.event,p=e.width,d=e.height,m=e.handleItemMessage;i.compositionSourceManager=new ch(r,l.engine),a&&(i.keepResource=!0,r.textures=void 0,r.consumed=!0);var v,y,g,x=i.compositionSourceManager,b=x.sourceContent,T=x.imgUsage;return i.postProcessingEnabled=null!=(v=null==(n=r.jsonScene.renderSettings)?void 0:n.postProcessingEnabled)&&v,N(b),i.renderer=l,i.rootItem=new exports.VFXItem(i.getEngine()),i.rootItem.name="rootItem",i.rootItem.duration=b.duration,i.rootItem.endBehavior=b.endBehavior,i.rootItem.composition=we(i),i.rootComposition=i.rootItem.addComponent(No),ko.deserialize(b,i.rootComposition),i.width=p,i.height=d,i.renderOrder=c,i.id=b.id,i.renderer=l,i.texInfo=a?{}:T,i.event=f,i.statistic={loadStart:null!=(y=r.startTime)?y:0,loadTime:null!=(g=r.totalTime)?g:0,compileTime:0,firstFrameTime:0},i.reusable=a,i.speed=u,i.autoRefTex=!i.keepResource&&i.texInfo&&i.rootItem.endBehavior!==wt.restart,i.name=b.name,i.pluginSystem=r.pluginSystem,i.pluginSystem.initializeComposition(we(i),r),i.camera=new hh(i.name,Ie({},null==b?void 0:b.camera,{aspect:p/d})),i.url=r.url,i.assigned=!0,i.interactive=!0,i.handleItemMessage=m,i.createRenderFrame(),i.rendererOptions=null,i.buildItemTree(i.rootItem),i.rootComposition.setChildrenRenderOrder(0),i.pluginSystem.resetComposition(we(i),i.renderFrame),i}_t(r,t);var n=r.prototype;return n.getDuration=function(){return this.rootItem.duration},n.restart=function(){this.reset(),this.forwardTime(this.startTime)},n.setIndex=function(t){this.renderOrder=t},n.getIndex=function(){return this.renderOrder},n.setSpeed=function(t){this.speed=t},n.setVisible=function(t){this.rootItem.setVisible(t)},n.getSpeed=function(){return this.speed},n.play=function(){this.isEnded&&this.reusable&&this.restart(),this.rootComposition.isStartCalled?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},n.pause=function(){this.paused=!0},n.getPaused=function(){return this.paused},n.resume=function(){this.paused=!1},n.gotoAndPlay=function(t){this.setTime(t),this.resume()},n.gotoAndStop=function(t){this.setTime(t),this.pause()},n.createRenderFrame=function(){this.renderFrame=new wi({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume,postProcessingEnabled:this.postProcessingEnabled}),this.renderFrame.cachedTextures=this.textures},n.setTime=function(t){var e=this.speed,r=this.getPaused();r&&this.resume(),this.setSpeed(1),this.forwardTime(t+this.startTime),this.setSpeed(e),r&&this.pause(),this.emit("goto",{time:t})},n.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},n.forwardTime=function(t){for(var e=1e3*t-1e3*this.rootComposition.time,r=e<0,i=Math.abs(e),n=r?-15:15;i>15;i-=15)this.update(n);this.update(r?-i:i)},n.reset=function(){this.rendererOptions=null,this.isEnded=!1,this.isEndCalled=!1,this.rootComposition.time=0,this.pluginSystem.resetComposition(this,this.renderFrame)},n.prepareRender=function(){var t=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(r){r.prepareRenderFrame(t,e)&&t.postLoaders.push(r)})),this.postLoaders.forEach((function(r){return r.postProcessFrame(t,e)}))},n.update=function(t){if(this.assigned&&!this.getPaused()){this.rootItem.isDuringPlay||(this.callAwake(this.rootItem),this.rootItem.beginPlay());var e=parseFloat(this.getUpdateTime(t*this.speed).toFixed(0));this.updateRootComposition(e/1e3),this.updateVideo(),this.updatePluginLoaders(t),this.sceneTicking.update.tick(e),this.sceneTicking.lateUpdate.tick(e),this.updateCamera(),this.prepareRender(),this.isEnded&&!this.isEndCalled&&(this.isEndCalled=!0,this.emit("end",{composition:this})),this.shouldDispose()&&this.dispose()}},n.shouldDispose=function(){return this.isEnded&&this.rootItem.endBehavior===wt.destroy&&!this.reusable},n.getUpdateTime=function(t){var e=1e3*this.startTime,r=1e3*this.rootComposition.time;return t<0&&r+t<e?e-r:t},n.callAwake=function(t){for(var e,r=s(t.components);!(e=r()).done;){var i=e.value;i.isAwakeCalled||(i.onAwake(),i.isAwakeCalled=!0)}for(var n,a=s(t.children);!(n=a()).done;){var o=n.value;this.callAwake(o)}},n.buildItemTree=function(t){if(t.composition){for(var e,r=new Map,i=t.getComponent(No).items,n=s(i);!(e=n()).done;){var a=e.value;r.set(a.id,a)}for(var o,u=s(i);!(o=u()).done;){var h=o.value;if(void 0===h.parentId)h.setParent(t);else{var c=r.get(h.parentId);if(!c)throw new Error("The element references a non-existent element, please check the data.");h.setParent(c)}}for(var l,f=s(i);!(l=f()).done;){var p=l.value;exports.VFXItem.isComposition(p)&&this.buildItemTree(p)}}},n.updateVideo=function(){var t,r=e.performance.now();r-this.lastVideoUpdateTime>33&&((null!=(t=this.textures)?t:[]).forEach((function(t){return null==t?void 0:t.uploadCurrentVideoFrame()})),this.lastVideoUpdateTime=r)},n.updateCamera=function(){this.camera.updateMatrix()},n.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(e,t)}))},n.updateRootComposition=function(t){if(this.rootComposition.state!==Ps.Paused&&this.rootComposition.isActiveAndEnabled){var e=parseFloat((this.time+t-this.rootItem.start).toFixed(3)),r=!1,i=this.rootItem.duration,n=this.rootItem.endBehavior;if(e-i>.001)switch(r=!0,n){case wt.restart:e%=i,this.restart();break;case wt.freeze:e=Math.min(i,e);case wt.forward:case wt.destroy:}this.rootComposition.time=e,this.isEnded!==r&&(r?this.isEnded=!0:(this.isEnded=!1,this.isEndCalled=!1))}},n.getItemByName=function(t){return this.rootItem.find(t)},n.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return tn((t-r.z)/i,(e-r.w)/n,this.camera)},n.getEngine=function(){var t;return null==(t=this.renderer)?void 0:t.engine},n.hitTest=function(t,e,r,i){if(this.isDestroyed||!this.interactive)return[];var n=[],s=this.getHitTestRay(t,e);return this.refContent.forEach((function(a){var o;null==(o=a.getComponent(No))||o.hitTest(s,t,e,n,r,i)})),n},n.addInteractiveItem=function(t,e){if(e===dt.MESSAGE)return this.handleItemMessage({name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:2,id:t.id}),t.id},n.removeInteractiveItem=function(t,e){e===dt.MESSAGE&&(this.handleItemMessage({name:t.name,phrase:1,id:t.id,compositionId:this.id}),t.emit("message",{name:t.name,phrase:1,id:t.id}))},n.destroyTextures=function(t){for(var e=0;e<t.length;e++){var r,i=t[e];if(i)if(i.sourceType!==exports.TextureSourceType.data||this.texInfo[i.getInstanceId()]){if(this.autoRefTex)--this.texInfo[i.getInstanceId()]||i.dispose()}else i!==(null==(r=this.rendererOptions)?void 0:r.emptyTexture)&&i!==this.renderFrame.transparentTexture&&i!==this.getEngine().emptyTexture&&i.dispose()}},n.destroyItem=function(t){var e=this;t.type==vt.composition?t.endBehavior!==wt.freeze&&t.getComponent(No).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(g(this.items,t),this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)})))},n.lost=function(t){this.videoState=this.textures.map((function(t){if("video"in t.source)return t.source.video.pause(),t.source.video.currentTime})),this.textures.map((function(t){return t.dispose()})),this.dispose()},n.dispose=function(){var t,e,r=this;if(!this.destroyed){this.destroyed=!0;var i={},n=this.textures;n&&this.keepResource&&n.forEach((function(t){(null==t?void 0:t.dispose)&&(i[t.id]=t.dispose,t.dispose=X)})),this.rootItem.dispose(),this.renderFrame.dispose(),null==(t=this.rendererOptions)||t.emptyTexture.dispose(),null==(e=this.pluginSystem)||e.destroyComposition(this),this.update=function(){j.error("Update disposed composition: "+r.name+".")},this.dispose=X,n&&this.keepResource&&n.forEach((function(t){return t.dispose=i[t.id]})),this.compositionSourceManager.dispose(),this.renderer.env!==Xn&&this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},n.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},n.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},n.setPositionByPixel=function(t,e){this.renderer?this.rootItem.setPositionByPixel(t,e):console.warn("Renderer not assigned. Operation aborted.")},n.translate=function(t,e,r){this.rootItem.translate(t,e,r)},n.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},n.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},n.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},n.scale=function(t,e,r){this.rootItem.scale(t,e,r)},n.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},n.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},n.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},n.reloadTexture=function(){var t=this;return i((function(){return h(this,(function(e){switch(e.label){case 0:return t.textureOffloaded?[4,Promise.all(t.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:e.sent(),t.textureOffloaded=!1,e.label=2;case 2:return[2]}}))}))()},se(r,[{key:"transform",get:function(){return this.rootItem.transform}},{key:"textures",get:function(){return this.compositionSourceManager.textures}},{key:"items",get:function(){return this.rootComposition.items}},{key:"startTime",get:function(){return this.rootComposition.startTime}},{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)}}]),r}(ks),vh=new Int32Array(2),yh=new Float32Array(vh.buffer),gh=new Float64Array(vh.buffer),xh=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"}(ah||(ah={}));var bh=function(){function t(t){this.bytes_=t,this.position_=0,this.text_decoder_=new e.TextDecoder}var r=t.prototype;return r.clear=function(){this.position_=0},r.bytes=function(){return this.bytes_},r.position=function(){return this.position_},r.setPosition=function(t){this.position_=t},r.capacity=function(){return this.bytes_.length},r.readInt8=function(t){return this.readUint8(t)<<24>>24},r.readUint8=function(t){return this.bytes_[t]},r.readInt16=function(t){return this.readUint16(t)<<16>>16},r.readUint16=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8},r.readInt32=function(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24},r.readUint32=function(t){return this.readInt32(t)>>>0},r.readInt64=function(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},r.readUint64=function(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))},r.readFloat32=function(t){return vh[0]=this.readInt32(t),yh[0]},r.readFloat64=function(t){return vh[xh?0:1]=this.readInt32(t),vh[xh?1:0]=this.readInt32(t+4),gh[0]},r.writeInt8=function(t,e){this.bytes_[t]=e},r.writeUint8=function(t,e){this.bytes_[t]=e},r.writeInt16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.writeUint16=function(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8},r.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},r.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},r.writeInt64=function(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))},r.writeUint64=function(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))},r.writeFloat32=function(t,e){yh[0]=e,this.writeInt32(t,vh[0])},r.writeFloat64=function(t,e){gh[0]=e,this.writeInt32(t,vh[xh?0:1]),this.writeInt32(t+4,vh[xh?1:0])},r.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},r.__offset=function(t,e){var r=t-this.readInt32(t);return e<this.readInt16(r)?this.readInt16(r+e):0},r.__union=function(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t},r.__string=function(t,e){t+=this.readInt32(t);var r=this.readInt32(t);t+=4;var i=this.bytes_.subarray(t,t+r);return e===ah.UTF8_BYTES?i:this.text_decoder_.decode(i)},r.__union_with_string=function(t,e){return"string"==typeof t?this.__string(e):this.__union(t,e)},r.__indirect=function(t){return t+this.readInt32(t)},r.__vector=function(t){return t+this.readInt32(t)+4},r.__vector_len=function(t){return this.readInt32(t+this.readInt32(t))},r.__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},r.createScalarList=function(t,e){for(var r=[],i=0;i<e;++i){var n=t(i);null!==n&&r.push(n)}return r},r.createObjList=function(t,e){for(var r=[],i=0;i<e;++i){var n=t(i);null!==n&&r.push(n.unpack())}return r},t.allocate=function(e){return new t(new Uint8Array(e))},t}(),Th=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=bh.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,r){e>this.minalign&&(this.minalign=e);for(var i=1+~(this.bb.capacity()-this.space+r)&e-1;this.space<i+e+r;){var n=this.bb.capacity();this.bb=t.growByteBuffer(this.bb),this.space+=this.bb.capacity()-n}this.pad(i)},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,r){(this.force_defaults||e!=r)&&(this.addInt8(e),this.slot(t))},e.addFieldInt16=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt16(e),this.slot(t))},e.addFieldInt32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addInt32(e),this.slot(t))},e.addFieldInt64=function(t,e,r){(this.force_defaults||e!==r)&&(this.addInt64(e),this.slot(t))},e.addFieldFloat32=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat32(e),this.slot(t))},e.addFieldFloat64=function(t,e,r){(this.force_defaults||e!=r)&&(this.addFloat64(e),this.slot(t))},e.addFieldOffset=function(t,e,r){(this.force_defaults||e!=r)&&(this.addOffset(e),this.slot(t))},e.addFieldStruct=function(t,e,r){e!=r&&(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 r=e+1;e>=0;e--)this.addInt16(0!=this.vtable[e]?t-this.vtable[e]:0);this.addInt16(t-this.object_start);var i=2*(r+2);this.addInt16(i);var n=0,s=this.space;t:for(e=0;e<this.vtables.length;e++){var a=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(a)){for(var o=2;o<i;o+=2)if(this.bb.readInt16(s+o)!=this.bb.readInt16(a+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,r){var i=r?4:0;if(e){var n=e;if(this.prep(this.minalign,8+i),4!=n.length)throw new TypeError("FlatBuffers: file identifier must be length 4");for(var s=3;s>=0;s--)this.writeInt8(n.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&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 r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(e<this.bb.readInt16(i)&&0!=this.bb.readInt16(i+e)))throw new TypeError("FlatBuffers: field "+e+" must be set")},e.startVector=function(t,e,r){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(r,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=a(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=[],r=0;r<t.length;++r){var i=t[r];if(null===i)throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.");e.push(this.createObjectOffset(i))}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 r=e<<1,i=bh.allocate(r);return i.setPosition(r-e),i.bytes().set(t.bytes(),r-e),i},t}(),Eh=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 _h(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsObjectData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addInt8(e[r]);return t.endVector()},t.startDataVector=function(t,e){t.startVector(1,e,1)},t.endFBEffectsObjectData=function(t){return t.endObject()},t.createFBEffectsObjectData=function(e,r,i){return t.startFBEffectsObjectData(e),t.addDataType(e,r),t.addData(e,i),t.endFBEffectsObjectData(e)},t}(),_h=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,r=Eh.createDataVector(t,this.data);return Eh.createFBEffectsObjectData(t,e,r)},t}(),Ah=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 r=this.bb.__offset(this.bb_pos,4);return r?(e||new Eh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 Ch(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBEffectsPackageData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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,r){return t.startFBEffectsPackageData(e),t.addExportObjects(e,r),t.endFBEffectsPackageData(e)},t}(),Ch=function(){function t(t){void 0===t&&(t=[]),this.exportObjects=t}return t.prototype.pack=function(t){var e=Ah.createExportObjectsVector(t,t.createObjectOffsetList(this.exportObjects));return Ah.createFBEffectsPackageData(t,e)},t}(),Sh=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 wh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBSubMesh=function(e,r){return e.setPosition(e.position()+4),(r||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,r,i,n){return t.startFBSubMesh(e),t.addOffset(e,r),t.addIndexCount(e,i),t.addVertexCount(e,n),t.endFBSubMesh(e)},t}(),wh=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.offset=t,this.indexCount=e,this.vertexCount=r}return t.prototype.pack=function(t){return Sh.createFBSubMesh(t,this.offset,this.indexCount,this.vertexCount)},t}(),Rh=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 Oh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexChannel=function(e,r){return e.setPosition(e.position()+4),(r||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,r,i,n,s,a){return t.startFBVertexChannel(e),t.addSemantic(e,r),t.addOffset(e,i),t.addFormat(e,n),t.addDimension(e,s),t.addNormalize(e,a),t.endFBVertexChannel(e)},t}(),Oh=function(){function t(t,e,r,i,n){void 0===t&&(t=null),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=!1),this.semantic=t,this.offset=e,this.format=r,this.dimension=i,this.normalize=n}return t.prototype.pack=function(t){var e=null!==this.semantic?t.createString(this.semantic):0;return Rh.createFBVertexChannel(t,e,this.offset,this.format,this.dimension,this.normalize)},t}(),Mh=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 r=this.bb.__offset(this.bb_pos,6);return r?(e||new Rh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 Ph(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBVertexData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);return t.endVector()},t.startChannelsVector=function(t,e){t.startVector(4,e,4)},t.endFBVertexData=function(t){return t.endObject()},t.createFBVertexData=function(e,r,i){return t.startFBVertexData(e),t.addVertexCount(e,r),t.addChannels(e,i),t.endFBVertexData(e)},t}(),Ph=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=Mh.createChannelsVector(t,t.createObjectOffsetList(this.channels));return Mh.createFBVertexData(t,this.vertexCount,e)},t}(),Ih=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 Mh).__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 r=this.bb.__offset(this.bb_pos,14);return r?(e||new Sh).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+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 r=this.bb.__offset(this.bb_pos,22);return r?this.bb.__string(this.bb.__vector(this.bb_pos+r)+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 Lh(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,r){return(r||new t).__init(e.readInt32(e.position())+e.position(),e)},t.getSizePrefixedRootAsFBGeometryData=function(e,r){return e.setPosition(e.position()+4),(r||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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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 r=e.length-1;r>=0;r--)t.addInt8(e[r]);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 r=e.length-1;r>=0;r--)t.addOffset(e[r]);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 r=e.length-1;r>=0;r--)t.addFloat32(e[r]);return t.endVector()},t.startInverseBindMatricesVector=function(t,e){t.startVector(4,e,4)},t.endFBGeometryData=function(t){return t.endObject()},t}(),Lh=function(){function t(t,e,r,i,n,s,a,o,u,h,c,l){void 0===t&&(t=null),void 0===e&&(e=null),void 0===r&&(r=null),void 0===i&&(i=0),void 0===n&&(n=0),void 0===s&&(s=[]),void 0===a&&(a=0),void 0===o&&(o=null),void 0===u&&(u=[]),void 0===h&&(h=[]),void 0===c&&(c=null),void 0===l&&(l=[]),this.id=t,this.name=e,this.vertexData=r,this.indexFormat=i,this.indexOffset=n,this.subMeshes=s,this.mode=a,this.buffer=o,this.binaryData=u,this.boneNames=h,this.rootBoneName=c,this.inverseBindMatrices=l}return t.prototype.pack=function(t){var e=null!==this.id?t.createString(this.id):0,r=null!==this.name?t.createString(this.name):0,i=null!==this.vertexData?this.vertexData.pack(t):0,n=Ih.createSubMeshesVector(t,t.createObjectOffsetList(this.subMeshes)),s=null!==this.buffer?t.createString(this.buffer):0,a=Ih.createBinaryDataVector(t,this.binaryData),o=Ih.createBoneNamesVector(t,t.createObjectOffsetList(this.boneNames)),u=null!==this.rootBoneName?t.createString(this.rootBoneName):0,h=Ih.createInverseBindMatricesVector(t,this.inverseBindMatrices);return Ih.startFBGeometryData(t),Ih.addId(t,e),Ih.addName(t,r),Ih.addVertexData(t,i),Ih.addIndexFormat(t,this.indexFormat),Ih.addIndexOffset(t,this.indexOffset),Ih.addSubMeshes(t,n),Ih.addMode(t,this.mode),Ih.addBuffer(t,s),Ih.addBinaryData(t,a),Ih.addBoneNames(t,o),Ih.addRootBoneName(t,u),Ih.addInverseBindMatrices(t,h),Ih.endFBGeometryData(t)},t}(),Fh=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 Th(1),r=new Ch,i=[],n=s(this.exportObjectDatas);!(t=n()).done;){var a=t.value,o=void 0;a.dataType===Kt.Geometry&&(o=new _h("Geometry",this.geometryDataToBinary(a))),o&&i.push(o)}return r.exportObjects=i,Ah.finishFBEffectsPackageDataBuffer(e,r.pack(e)),e.asUint8Array()},e.deserializeFromBinary=function(t){for(var e=new bh(t),r=Ah.getRootAsFBEffectsPackageData(e),i=0;i<r.exportObjectsLength();i++){var n=r.exportObjects(i);if(n){var s=n.dataArray(),a=n.dataType();if(s){var o=void 0;a===Kt.Geometry&&(o=this.binaryToGeometryData(s)),o&&this.exportObjectDatas.push(o)}}}},e.geometryDataToBinary=function(t){var e=new Th(1),r=new Lh,i=t.indexFormat,n=t.indexOffset,a=t.mode,o=t.id,u=t.vertexData,h=t.boneNames,c=void 0===h?[]:h,l=t.rootBoneName,f=void 0===l?"":l,p=t.inverseBindMatrices,d=void 0===p?[]:p,m=t.binaryData,v=void 0===m?[]:m;r.indexFormat=i,r.indexOffset=n,r.mode=a,r.id=o,r.boneNames=c,r.rootBoneName=f,r.inverseBindMatrices=d,r.binaryData=v;var y=new Ph;y.vertexCount=u.vertexCount,y.channels=[];for(var g,x=s(u.channels);!(g=x()).done;){var b=g.value,T=b.semantic,E=b.offset,_=b.format,A=b.dimension,C=b.normalize,S=new Oh(T,E,_,A,C);y.channels.push(S)}r.vertexData=y;for(var w,R=[],O=s(t.subMeshes);!(w=O()).done;){var M=w.value,P=M.offset,I=M.indexCount,L=M.vertexCount,F=new wh(P,I,L);R.push(F)}return r.subMeshes=R,Ah.finishFBEffectsPackageDataBuffer(e,r.pack(e)),e.asUint8Array()},e.binaryToGeometryData=function(t){var e=new bh(t),r=Ih.getRootAsFBGeometryData(e),i={vertexCount:0,channels:[]},n=r.vertexData();if(n){i.vertexCount=n.vertexCount();for(var s=0;s<n.channelsLength();s++){var a=n.channels(s);if(a){var o,u={semantic:null!=(o=a.semantic())?o:"",offset:a.offset(),format:a.format(),dimension:a.dimension(),normalize:a.normalize()};i.channels.push(u)}}}for(var h=[],c=0;c<r.subMeshesLength();c++){var l=r.subMeshes(c);if(l){var f={offset:l.offset(),vertexCount:l.vertexCount(),indexCount:l.indexCount()};h.push(f)}}for(var p=[],d=0;d<r.boneNamesLength();d++){var m=r.boneNames(d);p.push(m)}var v,y,g,x,b=r.inverseBindMatricesArray();return{vertexData:i,indexFormat:r.indexFormat(),indexOffset:r.indexOffset(),subMeshes:h,mode:r.mode(),buffer:null!=(v=r.buffer())?v:"",boneNames:p,rootBoneName:null!=(y=r.rootBoneName())?y:"",inverseBindMatrices:b?Array.from(b):void 0,binaryData:null!=(g=r.binaryDataArray())?g:void 0,id:null!=(x=r.id())?x:"",dataType:Kt.Geometry}},t}(),Vh=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 lu(this),this.emptyTexture=lr(this),this.transparentTexture=fr(this)}var e=t.prototype;return e.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.getInstance=function(t){return this.objectInstance[t]},e.removeInstance=function(t){delete this.objectInstance[t]},e.addPackageDatas=function(t){for(var e,r=t.jsonScene,i=t.textureOptions,n=void 0===i?[]:i,a=r.items,o=void 0===a?[]:a,u=r.materials,h=void 0===u?[]:u,c=r.shaders,l=void 0===c?[]:c,f=r.geometries,p=void 0===f?[]:f,d=r.components,m=void 0===d?[]:d,v=r.animations,y=void 0===v?[]:v,g=r.bins,x=void 0===g?[]:g,b=r.miscs,T=void 0===b?[]:b,E=s(o);!(e=E()).done;){var _=e.value;this.addEffectsObjectData(_)}for(var A,C=s(h);!(A=C()).done;){var S=A.value;this.addEffectsObjectData(S)}for(var w,R=s(l);!(w=R()).done;){var O=w.value;this.addEffectsObjectData(O)}for(var M,P=s(p);!(M=P()).done;){var I=M.value;this.addEffectsObjectData(I)}for(var L,F=s(m);!(L=F()).done;){var V=L.value;this.addEffectsObjectData(V)}for(var D,N=s(y);!(D=N()).done;){var k=D.value;this.addEffectsObjectData(k)}for(var z,U=s(T);!(z=U()).done;){var B=z.value;this.addEffectsObjectData(B)}for(var G=0;G<x.length;G++){var j=x[G],X=t.bins[G];if(j.dataType===Kt.BinaryAsset)j.buffer=X,j.id&&this.addEffectsObjectData(j);else{var H=new Fh;H.deserializeFromBinary(new Uint8Array(X));for(var W,Y=s(H.exportObjectDatas);!(W=Y()).done;){var Z=W.value;this.addEffectsObjectData(Z)}}}for(var q,K=s(n);!(q=K()).done;){var Q=q.value;this.addEffectsObjectData(Q)}},e.createVFXItems=function(t){var e=this;return i((function(){var r,i,n,a,o;return h(this,(function(u){switch(u.label){case 0:r=t.jsonScene,i=s(r.items),u.label=1;case 1:return(n=i()).done?[3,4]:(a=n.value,"ECS"!==(o=a.type)&&"camera"!==o&&o!==vt.sprite&&o!==vt.particle&&o!==vt.mesh&&o!==vt.skybox&&o!==vt.light&&o!==vt.tree&&o!==vt.interact&&o!==vt.camera?[3,3]:e.database?[4,e.assetLoader.loadGUIDAsync(a.id)]:[3,3]);case 2:u.sent(),u.label=3;case 3:return[3,1];case 4:return[2]}}))}))()},e.addTexture=function(t){this.destroyed||y(this.textures,t)},e.removeTexture=function(t){this.destroyed||g(this.textures,t)},e.addMaterial=function(t){this.destroyed||y(this.materials,t)},e.removeMaterial=function(t){this.destroyed||g(this.materials,t)},e.addGeometry=function(t){this.destroyed||y(this.geometries,t)},e.removeGeometry=function(t){this.destroyed||g(this.geometries,t)},e.addMesh=function(t){this.destroyed||y(this.meshes,t)},e.removeMesh=function(t){this.destroyed||g(this.meshes,t)},e.addRenderPass=function(t){this.destroyed||y(this.renderPasses,t)},e.removeRenderPass=function(t){this.destroyed||g(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&&j.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}},se(t,[{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Dh=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.dt=0,this.setFPS(t),this.tickers=[]}var r=t.prototype;return r.getFPS=function(){return this.targetFPS},r.setFPS=function(t){this.targetFPS=Ee(t,1,120),this.interval=Math.floor(1e3/t)-2},r.getPaused=function(){return this.paused},r.start=function(){var t=this;if(this.paused=!1,this.dt=0,!this.intervalId){this.lastTime=e.performance.now();var r=e.requestAnimationFrame||function(t){return e.window.setTimeout(t,16.7)},i=function(){t.intervalId=r(i),t.paused||t.tick()};i()}},r.stop=function(){(e.cancelAnimationFrame||e.window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.dt=0,this.tickers=[]},r.pause=function(){this.paused=!0,this.dt=0},r.resume=function(){this.paused=!1,this.dt=0},r.tick=function(){if(!this.paused){var t=e.performance.now();if(this.dt=t-this.lastTime,this.dt>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter((function(t){return t})),this.resetTickers=!1);for(var r=0,i=this.tickers.length;r<i;r++){var n=this.tickers[r];n(this.dt)}}}},r.add=function(t){if("function"!=typeof t)throw new Error("The tick object must implement the tick method.");this.tickers.push(t)},se(t,[{key:"deltaTime",get:function(){return this.dt}}]),t}();nt("camera",bs,exports.VFXItem),nt("text",hu,exports.VFXItem),nt("sprite",Ls,exports.VFXItem),nt("particle",Wo,exports.VFXItem),nt("cal",Yo,exports.VFXItem),nt("interact",ws,exports.VFXItem);var Nh;j.info("Core version: 2.3.8.");var kh,zh=((Nh={})[rr.RGBA]=34842,Nh[rr.RGB]=34843,Nh[rr.ALPHA]=33325,Nh[rr.RED]=33325,Nh[rr.LUMINANCE_ALPHA]=33327,Nh[rr.LUMINANCE]=33325,Nh),Uh=((kh={})[rr.RGBA]=34836,kh[rr.RGB]=34837,kh[rr.ALPHA]=33326,kh[rr.RED]=33326,kh[rr.LUMINANCE_ALPHA]=33328,kh[rr.LUMINANCE]=33326,kh),Bh=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).initialized=!1,r&&i.fromData(r),i}_t(e,t);var r=e.prototype;return r.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},r.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this),this.pipelineContext=t.getGLPipelineContext();var e=this.pipelineContext.gl,r=this.source,i=r.target,n=void 0===i?e.TEXTURE_2D:i,s=r.name;this.textureBuffer=e.createTexture(),Wh(this.textureBuffer,s),this.target=n,this.update(this.source),this.release(),this.initialized=!0}},r.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},r.release=function(){switch(this.source.sourceType){case exports.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case exports.TextureSourceType.data:delete this.source.data;break;case exports.TextureSourceType.compressed:case exports.TextureSourceType.mipmaps:delete this.source.mipmaps}},r.update=function(t){var e=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var r,i,n=this.target,s=this.source,a=this.pipelineContext.gl,o=this.engine.gpuCapability.detail,u=s.sourceType,h=s.data,c=s.cube,l=s.image,f=s.video,p=s.mipmaps,d=s.mipmaps,m=t.data,v=t.cube,y=t.generateMipmap,g=t.mipmaps,x=s.format,b=s.type,T=s.internalFormat,E=0,_=0;if(this.bind(u===exports.TextureSourceType.video),b===rr.HALF_FLOAT?((b=o.halfFloatTexture)||j.error("Half float texture is not support."),nr(a)&&T===x&&(x===rr.LUMINANCE&&(x=rr.RED),T=zh[x]),o.halfFloatLinear||(s.minFilter=s.magFilter=a.NEAREST,j.warn("Half float linear not support, change to NEAREST."))):b===a.FLOAT&&((b=o.floatTexture)||j.error("Float texture is not support."),nr(a)&&T===x&&(x===rr.LUMINANCE&&(x=rr.RED),T=Uh[x]),o.floatLinear||(s.minFilter=a.NEAREST,s.magFilter=a.NEAREST,j.warn("Float linear not support, change to NEAREST."))),void 0===s.premultiplyAlpha&&(s.premultiplyAlpha=!1),a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),void 0===s.flipY&&(s.flipY=!1),a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,s.flipY),u===exports.TextureSourceType.framebuffer)m&&(E=null!=(r=m.width)?r:0,_=null!=(i=m.height)?i:0,E&&_&&(this.width!==E||this.height!==_)&&a.texImage2D(n,0,T,E,_,0,x,b,null));else if(u===exports.TextureSourceType.data){var A;if(n===a.TEXTURE_CUBE_MAP)v.forEach((function(t,r){var i=e.texImage2DData(a,a.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,T,x,b,t),n=i[0],s=i[1];E=Math.max(n,E),_=Math.max(s,_)}));else A=this.texImage2DData(a,n,0,T,x,b,h),E=A[0],_=A[1]}else if(u===exports.TextureSourceType.image||u===exports.TextureSourceType.video){if(n===a.TEXTURE_CUBE_MAP)c.forEach((function(t,r){var i=e.texImage2D(a,a.TEXTURE_CUBE_MAP_POSITIVE_X+r,0,T,x,b,t),n=i[0],s=i[1];E=Math.max(n,E),_=Math.max(s,_)}));else if(n===a.TEXTURE_2D){var C,S=null!=l?l:f;C=this.texImage2D(a,n,0,T,x,b,S),E=C[0],_=C[1]}y&&(Gh(E)&&Gh(_)||nr(a))&&a.generateMipmap(n)}else if(u===exports.TextureSourceType.mipmaps){var w;n===a.TEXTURE_2D?p.forEach((function(t,r){var i;(w="data"in t?e.texImage2DData(a,n,r,T,x,b,t):e.texImage2D(a,n,r,T,x,b,t),0===r)&&(E=(i=w)[0],_=i[1])})):n===a.TEXTURE_CUBE_MAP&&d.forEach((function(t,r){t.forEach((function(t,i){var n;(w="data"in t?e.texImage2DData(a,a.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,T,x,b,t):e.texImage2D(a,a.TEXTURE_CUBE_MAP_POSITIVE_X+i,r,T,x,b,t),0===r)&&(E=(n=w)[0],_=n[1])}))}))}else u===exports.TextureSourceType.compressed&&g&&0!==g.length&&(E=g[0].width,_=g[0].height,g.forEach((function(t,e){a.compressedTexImage2D(n,e,T,t.width,t.height,0,t.data)})));this.width=E,this.height=_,this.setTextureFilters(a,n,s)},r.setTextureFilters=function(t,e,r){var i=r.anisotropic,n=void 0===i?4:i,s=r.wrapS,a=void 0===s?t.CLAMP_TO_EDGE:s,o=r.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 c=nr(t)||Gh(this.width)&&Gh(this.height),l=r.magFilter?r.magFilter:t.NEAREST,f=r.minFilter?r.minFilter:t.NEAREST;c||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,l),t.texParameteri(e,t.TEXTURE_WRAP_S,c?a:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,c?u:t.CLAMP_TO_EDGE)},r.fromData=function(e){t.prototype.fromData.call(this,e);var r=e,i=this.assembleOptions(r),n=i.sourceType,s=i.sourceFrom,a=i.name,o=void 0===a?"":a;this.source=i,this.sourceType=n,this.sourceFrom=s,this.name=o,this.guid=e.id},r.texImage2D=function(t,e,r,i,n,s,a){var o,u=this,h=this.source,c=h.sourceType,l=h.minFilter,f=h.magFilter,p=h.wrapS,d=h.wrapT,m=null!=(o=this.engine.gpuCapability.detail.maxTextureSize)?o:2048,v=a;if(c!==exports.TextureSourceType.video){var y=l!==t.NEAREST||f!==t.NEAREST||p!==t.CLAMP_TO_EDGE||d!==t.CLAMP_TO_EDGE;(y=y||a.width>m||a.height>m)&&setTimeout((function(){v=u.resizeImage(a)}))}t.texImage2D(e,r,i,n,s,v);var g=[v.width,v.height];return c===exports.TextureSourceType.video?[a.videoWidth,a.videoHeight]:g},r.texImage2DData=function(t,e,r,i,n,s,a){var o=a.data,u=a.width,h=a.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(o.buffer,o.byteOffset,o.byteLength/o.BYTES_PER_ELEMENT):o;return t.texImage2D(e,r,i,u,h,0,n,s,c),[u,h]},r.resizeImage=function(t,e,r){var i,n=null!=(i=this.engine.gpuCapability.detail.maxTextureSize)?i:2048;if(nr(this.pipelineContext.gl)&&t.width<n&&t.height<n)return t;var s=function(t,e,r,i){var n=t.width,s=t.height,a=Math.min(e,r||$i(n)),o=Math.min(e,i||$i(s));if(o!==s||a!==n){var u=su.getCanvas(),h=u.getContext("2d");return u.width=a,u.height=o,null==h||h.drawImage(t,0,0,n,s,0,0,a,o),j.warn("Image resize from "+n+"x"+s+" to "+a+"x"+o+"."),u}}(t,n,e,r);return s||t},r.reloadData=function(){var t=this;return i((function(){return h(this,(function(e){switch(e.label){case 0:return t.offloaded?[4,xr().reload(t)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))()},r.offloadData=function(){if(this.initialized&&xr().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var r=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);else if(t===e.TEXTURE_CUBE_MAP)for(var i=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<i.length;n++)e.texImage2D(i[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},r.uploadCurrentVideoFrame=function(){var t=this;return i((function(){return h(this,(function(e){return t.source.sourceType===exports.TextureSourceType.video&&t.source.video&&t.initialized?(t.update({video:t.source.video}),[2,!0]):[2,!1]}))}))()},r.updateSource=function(t){this.source=this.assembleOptions(Ie({},this.source,t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},r.restore=function(){},r.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(){j.error("This texture has been destroyed.")},this.initialize=Q,void 0!==this.engine&&this.engine.removeTexture(this)},e}(ur);function Gh(t){return 0==(t&t-1)&&0!==t}var jh=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 nr(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),Wh(e,t),e},e.bindVertexArray=function(t){var e;nr(this.gl)?this.gl.bindVertexArray(t):null==(e=this.vaoExt)||e.bindVertexArrayOES(t)},e.dispose=function(){var t;nr(this.gl)?this.gl.deleteVertexArray(this.vao):null==(t=this.vaoExt)||t.deleteVertexArrayOES(this.vao)},t}(),Xh=1,Hh=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])},r=t.getGLPipelineContext(),i=r.gl;this.gl=i,this.pipelineContext=r,this.emptyTexture2D=new Bh(t,{data:e,sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new Bh(t,{target:i.TEXTURE_CUBE_MAP,cube:[e,e,e,e,e,e],sourceType:exports.TextureSourceType.data,format:i.LUMINANCE,internalFormat:i.LUMINANCE,type:i.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+Xh,Xh++}var e=t.prototype;return e.copy2=function(t,e){var r=this.gl;if(r){this.sourceFbo||(this.sourceFbo=r.createFramebuffer()),this.targetFbo||(this.targetFbo=r.createFramebuffer());var i=this.pipelineContext;i.bindFramebuffer(r.FRAMEBUFFER,this.sourceFbo),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t.textureBuffer,0),i.bindFramebuffer(r.FRAMEBUFFER,this.targetFbo),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e.textureBuffer,0),i.bindFramebuffer(r.READ_FRAMEBUFFER,this.sourceFbo),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.targetFbo);var n=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?r.NEAREST:r.LINEAR;r.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),r.COLOR_BUFFER_BIT,n),i.bindFramebuffer(r.FRAMEBUFFER,null),i.bindFramebuffer(r.READ_FRAMEBUFFER,null),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}},e.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.createGLRenderbuffer=function(t){var e=this.gl.createRenderbuffer();return e&&y(this.renderbuffers,t),e},e.resize=function(t,e){var r=this.gl;(r&&r.drawingBufferWidth!==t||r.drawingBufferHeight!==e)&&(r.canvas.width=t,r.canvas.height=e,r.viewport(0,0,t,e),this.framebuffers.forEach((function(r){var i=r.viewport;r.isCustomViewport||r.resize(i[0],i[1],t*r.viewportScale,e*r.viewportScale)})))},e.drawGeometry=function(t,e,r){if(this.gl){var i=t,n=e.shaderVariant.program;if(n){var s=n.setupAttributes(i),a=this.gl,o=i.indicesBuffer,u=i.drawStart,h=i.drawCount,c=i.mode,l=i.subMeshes;if(l&&l.length){var f,p=l[r];if(h<0)return;if(u=p.offset,o)h=null!=(f=p.indexCount)?f:0;else h=p.vertexCount}o?a.drawElements(c,h,o.type,null!=u?u:0):a.drawArrays(c,u,h),null==s||s.unbind()}}else console.warn("GLGPURenderer has not bound a gl object, unable to render geometry.")},e.createGLFramebuffer=function(t,e){var r=this.gl.createFramebuffer();if(!r)throw new Error("Failed to create WebGL framebuffer. gl isContextLost="+this.gl.isContextLost());return y(this.framebuffers,t),Wh(r,e,e),r},e.createVAO=function(t){return new jh(this.engine,t)},e.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),g(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),g(this.framebuffers,t),delete t.fbo)},e.deleteGLRenderbuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),g(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){j.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},se(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 Wh(t,e,r){void 0!==e&&null!==t&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,r&&(t.__SPECTOR_Object_TAG.id=r)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var Yh,Zh,qh=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var r=e.name,i=e.data,n=e.elementCount,s=e.target,a=void 0===s?rr.ARRAY_BUFFER:s,o=e.type,u=void 0===o?rr.FLOAT:o,h=e.usage,c=void 0===h?rr.STATIC_DRAW:h,l=function(t){var e,r;return null!=(r=null==(e=Kh[t])?void 0:e.BYTES_PER_ELEMENT)?r:0}(u);this.target=a,this.type=u,this.usage=c,this.glBuffer=this.createGLBuffer(r),this.bytesPerElement=l,i?this.bufferData(i):n&&this.bufferData(l*n)}var e=t.prototype;return e.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return Wh(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 r=this.pipelineContext.gl,i=this.target;r.bindBuffer(i,this.glBuffer),0===e?r.bufferData(i,1,this.usage):(r.bufferData(i,e,this.usage),"number"!=typeof t&&r.bufferSubData(i,0,t))}else this.byteLength=0},e.bufferSubData=function(t,e){if(this.pipelineContext){var r=this.pipelineContext.gl,i=this.target,n=t*this.bytesPerElement,s=n+e.byteLength;r.bindBuffer(i,this.glBuffer),s>this.byteLength&&(this.byteLength=s,r.bufferData(i,s,this.usage)),r.bufferSubData(i,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!!nr(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},se(t,[{key:"elementCount",get:function(){return this.byteLength/this.bytesPerElement}},{key:"isDestroyed",get:function(){return this.destroyed}}]),t}(),Kh=((Yh={})[rr.INT]=Int32Array,Yh[rr.FLOAT]=Float32Array,Yh[rr.SHORT]=Int16Array,Yh[rr.BYTE]=Int8Array,Yh[rr.UNSIGNED_BYTE]=Uint8Array,Yh[rr.UNSIGNED_INT]=Uint32Array,Yh[rr.UNSIGNED_SHORT]=Uint16Array,Yh);var Qh=((Zh={})[Uint8Array.BYTES_PER_ELEMENT]=rr.UNSIGNED_BYTE,Zh[Uint16Array.BYTES_PER_ELEMENT]=rr.UNSIGNED_SHORT,Zh[Uint32Array.BYTES_PER_ELEMENT]=rr.UNSIGNED_INT,Zh),Jh=1,$h=function(t){function r(e,r){var i;return(i=t.call(this,e)||this).drawCount=0,i.buffers={},i.vaos={},i.skin={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,r&&i.processProps(r),i}_t(r,t);var i=r.prototype;return i.getOptions=function(){return Ie({},this.options)},i.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;N(e),e.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new qh(r,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(r,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 r=this.getAttributeBufferOption(t),i=this.attributes[t].dataSource;if(r){var n=r.usage,s=r.target;this.bufferProps[i]={data:e,usage:n,target:s,elementCount:e.length},this.dirtyFlags[i].discard=!0,this.dirtyFlags[i].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,r){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t);if(i&&null!=i.data){var n=e,s=e+r.length;if(i.data.length<s){var a=new r.constructor(s);a.set(i.data),i.data=a,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,s-1))}i.data.set(r,n),this.dirtyFlags[t].dirty=!0}}},i.getIndexData=function(){return this.indices},i.setIndexData=function(t){(a(t,Uint8Array)||a(t,Uint16Array)||a(t,Uint32Array))&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},i.setIndexSubData=function(t,e){if(this.indices){var r,i=t,n=t+e.length;if(this.indices.length<n){var s=new e.constructor(n);s.set(this.indices),this.indices=s,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var a=this.dirtyFlags.index;void 0!==a.start&&(a.start=Math.min(a.start,i)),void 0!==a.end&&(a.end=Math.max(a.end,n-1))}null==(r=this.indices)||r.set(e,i),this.dirtyFlags.index.dirty=!0}},i.getAttributeStride=function(t){var e=this.attributes[t],r=e.stride,i=e.size,n=e.type;return r||i*Gr[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 r=Qh[e.BYTES_PER_ELEMENT],i={data:e,target:rr.ELEMENT_ARRAY_BUFFER,type:r,name:this.name+"##index"};return new qh(t,i)},i.flush=function(){var t=this;if(this.initialized){var e=this.attributes,r=this.bufferProps,i=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var s,a,o=t.dirtyFlags[n];if("index"==n)s=t.indicesBuffer,a=i;else{var u=e[n].dataSource;s=t.buffers[u],a=r[u].data}if((o.dirty||o.discard)&&s&&a){if(o.discard)s.bufferData(a);else if(void 0!==o.start&&void 0!==o.end){var h=o.start*a.BYTES_PER_ELEMENT+a.byteOffset,c=o.end-o.start+1,l=new a.constructor(a.buffer,h,c);s.bufferSubData(o.start,l)}o.start=Number.POSITIVE_INFINITY,o.end=0,o.dirty=o.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(i){var n=t.attributesReleasable[i],s=e[i].dataSource;r[s]&&n&&(r[s].data=void 0)})),this.indicesReleasable}},i.processProps=function(t){var e=t,r=e.drawStart,i=void 0===r?0:r,n=e.drawCount,s=e.mode,o=e.indices,u=e.name,h=void 0===u?"effectsGeometry:"+Jh++:u,c=e.bufferUsage,l=void 0===c?rr.STATIC_DRAW:c;this.name=h;var f={},p=[],d={},m={},v={},y=l;this.drawStart=i,void 0!==n&&(this.drawCount=n),this.mode=isNaN(s)?rr.TRIANGLES:s,Object.keys(e.attributes).forEach((function(t){var r=e.attributes[t],i=r.size,n=r.stride,s=r.offset,o=r.normalize,u=r.type,h=void 0===u?rr.FLOAT:u,c=r.releasable,l=r.data;if(!h||"dataSource"in r||l||(l=Xr(h)),l){var g=a(l,Float32Array)?rr.FLOAT:rr.INT;f[t]={data:l,usage:y,target:rr.ARRAY_BUFFER,name:t},d[t]={size:i,stride:n,offset:s,type:null!=h?h:g,normalize:!!o,dataSource:t},v[t]=null!=c&&c,m[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=r.dataSource;x&&(d[t]={size:i,stride:n,offset:s,type:h,dataSource:x,normalize:!!o})}p.push(t)})),m.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==o?void 0:o.data,this.indicesReleasable=!0===(null==o?void 0:o.releasable),this.bufferProps=f,this.attributes=d,this.attributesName=p,this.attributesReleasable=v,this.dirtyFlags=m,this.options=e,this.initialized=!1},i.fromData=function(r){var i,n=this;if(t.prototype.fromData.call(this,r),this.subMeshes=r.subMeshes,r.buffer?i=new Uint8Array(function(t){for(var r=e.atob(t),i=new Uint8Array(r.length),n=0;n<r.length;n++)i[n]=r.charCodeAt(n);var s=i.buffer;return s}(r.buffer)):r.binaryData&&(i=r.binaryData),i){var s=r.vertexData.vertexCount;if(this.hasSemantic(r)){var a={mode:rr.TRIANGLES,attributes:{}};if(r.vertexData.channels.forEach((function(t){var e,r=null!=(e=tc[t.semantic])?e:t.semantic,o=n.createVertexTypedArray(t,i,s);a.attributes[r]={type:ar(t.format),size:t.dimension,data:o,normalize:t.normalize}})),r.indexFormat!==$t.None){var o=this.createIndexTypedArray(r.indexFormat,i,r.indexOffset);a.indices={data:o},a.drawCount=o.length}else a.drawCount=s;this.processProps(a)}else{var u=r.vertexData.channels[0],h=r.vertexData.channels[1],c=r.vertexData.channels[2],l=this.createVertexTypedArray(u,i,s),f=this.createVertexTypedArray(h,i,s),p=this.createVertexTypedArray(c,i,s),d=this.createIndexTypedArray(r.indexFormat,i,r.indexOffset),m={mode:rr.TRIANGLES,attributes:{aPos:{type:ar(u.format),size:3,data:l,normalize:u.normalize},aUV:{type:ar(h.format),size:2,data:f,normalize:h.normalize},aNormal:{type:ar(c.format),size:3,data:p,normalize:c.normalize}}};m.indices={data:d},m.drawCount=d.length,this.processProps(m)}this.skin={boneNames:r.boneNames,rootBoneName:r.rootBoneName,inverseBindMatrices:r.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 r;null==(r=e.vaos[t])||r.dispose(),e.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0));this.destroyed=!0},i.createVertexTypedArray=function(t,e,r){var i=e.buffer;switch(t.format){case Jt.Float32:return new Float32Array(i,e.byteOffset+t.offset,t.dimension*r);case Jt.Int16:return new Int16Array(i,e.byteOffset+t.offset,t.dimension*r);case Jt.Int8:return new Int8Array(i,e.byteOffset+t.offset,t.dimension*r);case Jt.UInt16:return new Uint16Array(i,e.byteOffset+t.offset,t.dimension*r);case Jt.UInt8:return new Uint8Array(i,e.byteOffset+t.offset,t.dimension*r);default:return console.error("Invalid vertex format type: "+t.format+"."),new Float32Array(i,e.byteOffset+t.offset,t.dimension*r)}},i.createIndexTypedArray=function(t,e,r){var i=e.buffer;switch(t){case $t.UInt16:return new Uint16Array(i,e.byteOffset+r);case $t.UInt32:return new Uint32Array(i,e.byteOffset+r);default:return console.error("Invalid index format type: "+t+"."),new Uint32Array(i,e.byteOffset+r)}},i.hasSemantic=function(t){var e=!1;return t.vertexData.channels.forEach((function(t){t.semantic&&t.semantic.length>0&&(e=!0)})),e},se(r,[{key:"isDestroyed",get:function(){return this.destroyed}},{key:"isInitialized",get:function(){return this.initialized}}]),r}(jr),tc={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 ec,rc,ic=function(){function t(){this.reset()}var e=t.prototype;return e.setBlendColor=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.blendColor[0]===e&&this.blendColor[1]===r&&this.blendColor[2]===i&&this.blendColor[3]===n||(this.blendColor[0]=e,this.blendColor[1]=r,this.blendColor[2]=i,this.blendColor[3]=n)},e.setBlending=function(t){this.blending!==t&&(this.blending=t)},e.setBlendFunctionParameters=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.blendFunctionParameters[0]===e&&this.blendFunctionParameters[1]===r&&this.blendFunctionParameters[2]===i&&this.blendFunctionParameters[3]===n||(this.blendFunctionParameters[0]=e,this.blendFunctionParameters[1]=r,this.blendFunctionParameters[2]=i,this.blendFunctionParameters[3]=n)},e.setBlendEquationParameters=function(t){var e=t[0],r=t[1];this.blendEquationParameters[0]===e&&this.blendEquationParameters[1]===r||(this.blendEquationParameters[0]=e,this.blendEquationParameters[1]=r)},e.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},e.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},e.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},e.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},e.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},e.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},e.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},e.setColorMask=function(t){var e=t[0],r=t[1],i=t[2],n=t[3];this.colorMask[0]===e&&this.colorMask[1]===r&&this.colorMask[2]===i&&this.colorMask[3]===n||(this.colorMask[0]=e,this.colorMask[1]=r,this.colorMask[2]=i,this.colorMask[3]=n)},e.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},e.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},e.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},e.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},e.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},e.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},e.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},e.setCulling=function(t){this.culling!==t&&(this.culling=t)},e.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},e.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},e.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[rr.ONE,rr.ONE_MINUS_SRC_ALPHA,rr.ONE,rr.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[rr.FUNC_ADD,rr.FUNC_ADD],this.depthTest=!0,this.depthMask=!0,this.depthRange=[0,1],this.depthFunc=rr.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[rr.ALWAYS,rr.ALWAYS],this.stencilOpFail=[rr.KEEP,rr.KEEP],this.stencilOpZFail=[rr.KEEP,rr.KEEP],this.stencilOpZPass=[rr.KEEP,rr.KEEP],this.culling=!1,this.frontFace=rr.CCW,this.cullFace=rr.FRONT},e.apply=function(t){if(t.toggle(rr.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(rr.BLEND,this.blending),t.toggle(rr.DEPTH_TEST,this.depthTest),t.toggle(rr.STENCIL_TEST,this.stencilTest),t.toggle(rr.CULL_FACE,this.culling),t.toggle(rr.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(rr.BACK,this.stencilMask[1]),t.stencilMaskSeparate(rr.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(rr.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(rr.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(rr.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(rr.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,r=e.blendColor,i=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(r[0],r[1],r[2],r[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(n[0],n[1],n[2],n[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),nc=Ce,sc=Pe,ac=function(t){function e(e,r){var i;return(i=t.call(this,e,r)||this).floats={},i.ints={},i.vector2s={},i.vector3s={},i.vector4s={},i.colors={},i.quaternions={},i.matrices={},i.matrice3s={},i.textures={},i.floatArrays={},i.vector4Arrays={},i.matrixArrays={},i.samplers=[],i.uniforms=[],i.uniformDirty=!0,i.macrosDirty=!0,i.glMaterialState=new ic,r&&(i.shader=new exports.Shader(e),i.shader.shaderData=Ie({},r.shader,{id:J(),dataType:Kt.Shader})),i}_t(e,t);var r=e.prototype;return r.enableMacro=function(t,e){this.isMacroEnabled(t)&&this.enabledMacros[t]===e||(this.enabledMacros[t]=null==e||e,this.macrosDirty=!0)},r.disableMacro=function(t){this.isMacroEnabled(t)&&(delete this.enabledMacros[t],this.macrosDirty=!0)},r.isMacroEnabled=function(t){return void 0!==this.enabledMacros[t]},r.createMaterialStates=function(t){this.sampleAlphaToCoverage=!!t.sampleAlphaToCoverage,this.depthTest=t.depthTest,this.depthMask=t.depthMask,this.depthRange=t.depthRange,this.depthFunc=t.depthFunc,this.colorMask=t.colorMask,this.polygonOffset=t.polygonOffset,this.polygonOffsetFill=t.polygonOffsetFill,this.blending=t.blending,this.blendFunction=t.blendFunction,this.stencilTest=t.stencilTest},r.initialize=function(){var t=this,e=this.engine;this.createShaderVariant(),this.shaderVariant.initialize(),this.initialized||(e.addMaterial(this),Object.keys(this.textures).forEach((function(e){var r=t.textures[e];Y(r.initialize)?r.initialize():j.error("Failed to initialize texture: "+JSON.stringify(r)+". Ensure the texture conforms to the expected format.")})),this.initialized=!0)},r.createShaderVariant=function(){(this.shaderDirty||this.macrosDirty)&&(this.shaderVariant=this.shader.createVariant(this.enabledMacros),this.macrosDirty=!1,this.shaderDirty=!1,this.uniformDirty=!0)},r.setupStates=function(t){this.glMaterialState.apply(t)},r.use=function(t,e){var r=t.engine.getGLPipelineContext(),i=this.shaderVariant;if(i.program){var n;if(i.program.bind(),this.setupStates(r),e){for(var a,o=s(e.uniforms);!(a=o()).done;)n=a.value,this.checkUniform(n);for(var u,h=s(e.samplers);!(u=h()).done;)n=u.value,this.samplers.includes(n)||(this.samplers.push(n),this.uniformDirty=!0)}if(this.uniformDirty&&(i.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirty=!1),e){for(n in e.floats)i.setFloat(n,e.floats[n]);for(n in e.ints)i.setInt(n,e.ints[n]);for(n in e.vector4s)i.setVector4(n,e.vector4s[n]);for(n in e.vector3s)i.setVector3(n,e.vector3s[n]);for(n in e.matrices)i.setMatrix(n,e.matrices[n])}for(n in this.textures)this.textures[n].textureBuffer||this.textures[n].initialize();for(n in this.floats)i.setFloat(n,this.floats[n]);for(n in this.ints)i.setInt(n,this.ints[n]);for(n in this.floatArrays)i.setFloats(n,this.floatArrays[n]);for(n in this.textures)i.setTexture(n,this.textures[n]);for(n in this.vector2s)i.setVector2(n,this.vector2s[n]);for(n in this.vector3s)i.setVector3(n,this.vector3s[n]);for(n in this.vector4s)i.setVector4(n,this.vector4s[n]);for(n in this.colors)i.setColor(n,this.colors[n]);for(n in this.quaternions)i.setQuaternion(n,this.quaternions[n]);for(n in this.matrices)i.setMatrix(n,this.matrices[n]);for(n in this.matrice3s)i.setMatrix3(n,this.matrice3s[n]);for(n in this.vector4Arrays)i.setVector4Array(n,this.vector4Arrays[n]);for(n in this.matrixArrays)i.setMatrixArray(n,this.matrixArrays[n])}else{var c;null==(c=this.engine)||c.renderErrors.add(new Error("Shader program is not initialized."))}},r.getFloat=function(t){return this.floats[t]},r.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},r.getInt=function(t){return this.ints[t]},r.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},r.getFloats=function(t){return this.floatArrays[t]},r.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},r.getVector2=function(t){return this.vector2s[t]},r.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},r.getVector3=function(t){return this.vector3s[t]},r.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},r.getVector4=function(t){return this.vector4s[t]},r.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},r.getColor=function(t){return this.colors[t]},r.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},r.getQuaternion=function(t){return this.quaternions[t]},r.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},r.getMatrix=function(t){return this.matrices[t]},r.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},r.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},r.getVector4Array=function(t){return this.vector4Arrays[t]},r.setVector4Array=function(t,e){this.checkUniform(t),this.vector4Arrays[t]=[];for(var r,i=s(e);!(r=i()).done;){var n=r.value;this.vector4Arrays[t].push(n.x,n.y,n.z,n.w)}},r.getMatrixArray=function(t){return this.matrixArrays[t]},r.setMatrixArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=[];for(var r,i=s(e);!(r=i()).done;)for(var n=r.value,a=0;a<16;a++)this.matrixArrays[t].push(n.elements[a])},r.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},r.getTexture=function(t){return this.textures[t]},r.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirty=!0),this.textures[t]=e},r.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},r.clone=function(t){var r=t||this.props,i=this.engine;N(i);var n=new e(i,r);return n.glMaterialState=Object.assign(new ic,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},r.fromData=function(e){t.prototype.fromData.call(this,e),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var r=Ie({},e);void 0!==e.stringTags.RenderType&&(this.blending=e.stringTags.RenderType===xt.Transparent),void 0!==e.floats.ZTest&&(this.depthTest=0!==e.floats.ZTest),void 0!==e.floats.ZWrite&&(this.depthMask=0!==e.floats.ZWrite);var i,n,s=e.stringTags.RenderFace;for(i in s===bt.Front?(this.culling=!0,this.cullFace=rr.BACK):s===bt.Back?(this.culling=!0,this.cullFace=rr.FRONT):this.culling=!1,r.floats)this.setFloat(i,r.floats[i]);for(i in r.ints)this.setInt(i,r.ints[i]);for(i in r.vector4s){var a=r.vector4s[i];this.setVector4(i,new Ce(a.x,a.y,a.z,a.w))}for(i in r.colors){var o=r.colors[i];this.setColor(i,new Zr(o.r,o.g,o.b,o.a))}for(i in r.textures){var u=r.textures[i];this.setTexture(i,u.texture);var h=u.offset,c=u.scale;h&&c&&this.setVector4(i+"_ST",new nc(c.x,c.y,h.x,h.y))}e.shader&&(this.shader=e.shader,this.shaderSource=this.shader.shaderData),this.stringTags=null!=(n=e.stringTags)?n:{},this.initialized=!1},r.toData=function(){var t=this.taggedProperties;for(var e in this.shader&&(t.shader=this.shader),t.floats={},t.ints={},t.vector4s={},t.colors={},t.textures={},t.dataType=Kt.Material,t.stringTags=this.stringTags,this.floats)t.floats[e]=this.floats[e];for(var r in this.ints)t.ints[r]=this.ints[r];for(var i in this.vector4s)t.vector4s[i]=this.vector4s[i];for(var n in this.colors)t.colors[n]=this.colors[n];for(var s in this.textures){t.textures[s]||(t.textures[s]={texture:this.textures[s]});var a=t.textures[s],o=this.getVector4(s+"_ST");o&&(a.scale={x:o.x,y:o.y},a.offset={x:o.z,y:o.w},delete t.vector4s[s+"_ST"])}return t},r.cloneUniforms=function(t){var e,r=t;for(e in r.floats)this.setFloat(e,r.floats[e]);for(e in r.ints)this.setInt(e,r.ints[e]);for(e in r.floatArrays)this.setFloats(e,r.floatArrays[e]);for(e in r.textures)this.setTexture(e,r.textures[e]);for(e in r.vector2s)this.setVector2(e,r.vector2s[e]);for(e in r.vector3s)this.setVector3(e,r.vector3s[e]);for(e in r.vector4s)this.setVector4(e,r.vector4s[e]);for(e in r.colors)this.setColor(e,r.colors[e]);for(e in r.quaternions)this.setQuaternion(e,r.quaternions[e]);for(e in r.matrices)this.setMatrix(e,r.matrices[e]);for(e in r.vector4Arrays){for(var i=[],n=0;n<r.vector4Arrays[e].length;n+=4)i.push(new nc(r.vector4Arrays[e][n],r.vector4Arrays[e][n+1],r.vector4Arrays[e][n+2],r.vector4Arrays[e][n+3]));this.setVector4Array(e,i)}for(e in r.matrixArrays){for(var s=[],a=0;a<r.matrixArrays[e].length;a+=16){for(var o=sc.fromIdentity(),u=0;u<16;u++)o.elements[u]=r.matrixArrays[e][a+u];s.push(o)}this.setMatrixArray(e,s)}},r.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirty=!0)},r.dispose=function(t){var e,r=this;this.destroyed||(null==(e=this.shaderVariant)||e.dispose(),(null==t?void 0:t.textures)!==exports.DestroyOptions.keep&&Object.keys(this.textures).forEach((function(t){var e=r.textures[t];e!==r.engine.emptyTexture&&e.dispose()})),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=Q,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},se(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},set:function(t){t&&this.glMaterialState.setColorMask(t)}},{key:"stencilTest",get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)}},{key:"stencilMask",get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)}},{key:"stencilRef",get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)}},{key:"stencilFunc",get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)}},{key:"stencilOpFail",get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)}},{key:"stencilOpZFail",get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)}},{key:"stencilOpZPass",get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)}},{key:"culling",get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)}},{key:"frontFace",get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)}},{key:"cullFace",get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)}},{key:"isDestroyed",get:function(){return this.destroyed}}]),e}(Nr),oc=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:exports.TextureSourceType.framebuffer,data:{width:e.getWidth()||t.getWidth(),height:e.getHeight()||t.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(t,e):this.copy1(t,e))},e.copy2=function(t,e){var r=this.renderer.getFramebuffer();this.renderer.glRenderer.copy2(t,e),this.renderer.setFramebuffer(r)},e.copy1=function(t,e){var r=this.copyRenderPass;if(r){var i=this.renderer;if(i){var n=r.framebuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),i.glRenderer.resetColorAttachments(n,[e]),r.meshes[0].material.setTexture("uTex",t),i.renderRenderPass(r)}}},e.createCopyRenderPass=function(){var t="mri-copy-mesh",e={texture:{format:rr.RGBA}},r=this.renderer.engine,i=new $h(r,{name:t,mode:rr.TRIANGLE_STRIP,attributes:{aPos:{type:rr.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=r.gpuCapability.level,s=new ac(r,{name:t,shader:{cacheId:"$mri-internal-copy",name:t,vertex:"\nprecision highp float;\nattribute vec2 aPos;\nvarying vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n}",fragment:"\nprecision highp float;\nvarying vec2 vTex;\nuniform sampler2D uTex;\nvoid main(){\n gl_FragColor = texture2D(uTex,vTex);\n}",glslVersion:2===n?exports.GLSLVersion.GLSL3:exports.GLSLVersion.GLSL1}});s.blending=!1,s.depthTest=!1,s.culling=!1;var a=new ei(r,{name:t,geometry:i,material:s,priority:0});return new uc(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:exports.TextureLoadAction.whatever},attachments:[e],meshes:[a]})},e.dispose=function(){var t;this.renderer&&(null==(t=this.copyRenderPass)||t.dispose(),this.renderer=void 0)},t}(),uc=function(t){function e(){return t.apply(this,arguments)}_t(e,t);var r=e.prototype;return r.configure=function(t){this.currentFramebuffer=t.getFramebuffer(),t.setFramebuffer(this.framebuffer)},r.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFramebuffer(this.currentFramebuffer)},e}(ai),hc=function(){function t(t,e,r){var i=this;void 0===e&&(e="webgl"),void 0===r&&(r={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],N(t),this.gl=$e(t,e,r),this.contextLostListener=function(t){for(var e,r,n=s(i.lostHandlers);!(r=n()).done;){r.value.lost(t)}null==(e=i.canvas)||e.removeEventListener("webglcontextlost",i.contextLostListener)},this.contextRestoredListener=function(t){for(var e,r,n=s(i.restoreHandlers);!(r=n()).done;){r.value.restore()}null==(e=i.canvas)||e.addEventListener("webglcontextlost",i.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}(),cc=function(t){function e(e){var r;return(r=t.call(this)||this).gpuCapability=new Di(e),r}_t(e,t);var r=e.prototype;return r.dispose=function(){this.isDestroyed||t.prototype.dispose.call(this)},r.getGLRenderer=function(){return this.renderer},r.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},r.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(Vh),lc=function(t){function e(e,r){var i;return(i=t.call(this,e)||this).initialized=!1,void 0!==r&&i.initialize(r),i}_t(e,t);var r=e.prototype;return r.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderbuffer(this))},r.setSize=function(t,e){if(this.initialized){if(this.renderer&&(t!==this.size[0]||e!==this.size[1])){var r=this.renderer,i=r.gl;r.pipelineContext.bindRenderbuffer(i.RENDERBUFFER,this.buffer),t&&e?i.renderbufferStorage(i.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):j.error("Invalid render buffer size: "+t+"x"+e+".")}}else j.error("Can't set size for uninitialized render buffer.")},r.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderbuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=Q},e}(Fi),fc=1,pc=function(t){function e(e,r){var i;(i=t.call(this)||this).attachmentTextures=[];var n,s=e.depthStencilAttachment,a=e.viewport,o=e.isCustomViewport,u=e.storeAction,h=e.viewportScale,c=void 0===h?1:h,l=e.name,f=void 0===l?"GLFramebuffer"+fc++:l;return i.renderer=r,i.engine=r.engine,i.depthStencilStorageType=null!=(n=null==s?void 0:s.storageType)?n:exports.RenderPassAttachmentStorageType.none,i.viewport=a,i.isCustomViewport=!!o,i.viewportScale=c,i.name=f,i.storeAction=u,i.updateProps(e),i}_t(e,t);var r=e.prototype;return r.getDepthTexture=function(){return this.depthTexture},r.getStencilTexture=function(){return this.stencilTexture},r.getColorTextures=function(){return this.colorTextures},r.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(e){e.initialize(),y(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&y(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&y(this.attachmentTextures,this.depthTexture.textureBuffer)},r.updateProps=function(t){var e,r,i=this.renderer,n=this.engine.gpuCapability,s=null!=(r=t.depthStencilAttachment)?r:{storageType:exports.RenderPassAttachmentStorageType.none},o=t.attachments.length>0,u=!0;if(this.externalStorage=!1,t.attachments.length>1&&!n.detail.drawBuffers)throw new Error("Multiple color attachments not support.");var h=null==(e=t.depthStencilAttachment)?void 0:e.texture,c=n.detail.readableDepthStencilTextures,l=s.storageType,f=s.storage;if(this.colorTextures=t.attachments.slice(),!o&&l!==exports.RenderPassAttachmentStorageType.none)throw new Error("Use depth stencil attachment without color attachments.");switch(o&&(this.fbo=i.glRenderer.createGLFramebuffer(this,this.name)),l){case exports.RenderPassAttachmentStorageType.depth_stencil_opaque:if(f){if(!a(f,lc))throw new Error("Invalid depth stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new lc({format:rr.DEPTH_STENCIL,attachment:rr.DEPTH_STENCIL_ATTACHMENT,storageType:l},i.glRenderer);u=!1;break;case exports.RenderPassAttachmentStorageType.depth_16_opaque:if(f){if(!a(f,lc))throw new Error("Invalid depth attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new lc({attachment:rr.DEPTH_ATTACHMENT,format:rr.DEPTH_COMPONENT16,storageType:l},i.glRenderer);break;case exports.RenderPassAttachmentStorageType.stencil_8_opaque:if(f){if(!a(f,lc))throw new Error("Invalid stencil attachment storage.");this.depthStencilRenderbuffer=f,this.externalStorage=!0}else this.depthStencilRenderbuffer=new lc({attachment:rr.STENCIL_ATTACHMENT,format:rr.STENCIL_INDEX8,storageType:l},i.glRenderer);break;case exports.RenderPassAttachmentStorageType.depth_16_texture:if(!c)throw new Error("Depth texture is not support in framebuffer.");this.depthTexture=null!=h?h:new Bh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:rr.DEPTH_COMPONENT,internalFormat:n.internalFormatDepth16,type:rr.UNSIGNED_SHORT,name:this.name+"##depthTex"}),this.depthTexture.initialize();break;case exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:if(!c)throw new Error("Depth stencil texture is not support in framebuffer.");this.depthTexture=this.stencilTexture=null!=h?h:new Bh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,format:rr.DEPTH_STENCIL,internalFormat:n.internalFormatDepth24_stencil8,type:n.UNSIGNED_INT_24_8,name:this.name+"##dpthStclTex"}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},r.getStoreAttachments=function(t,e){var r=this.renderer.glRenderer.gl,i=this.colorTextures.length;if(t&&nr(r)&&i>0){var n=[];if(t.depthAction===exports.TextureStoreAction.clear&&this.depthStorage&&y(n,e?r.DEPTH_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===exports.TextureStoreAction.clear&&this.stencilStorage&&y(n,e?r.STENCIL_ATTACHMENT:r.DEPTH_STENCIL_ATTACHMENT),t.colorAction===exports.TextureStoreAction.clear)for(var s=0;s<i;s++)y(n,r["COLOR_ATTACHMENT"+s]);return n}},r.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;nr(e)&&e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},r.bind=function(){var t=this;if(this.fbo){var e=this.renderer.glRenderer.gl,r=this.renderer.pipelineContext,i=this.viewport,n=i[0],s=i[1],a=i[2],o=i[3];r.bindFramebuffer(e.FRAMEBUFFER,this.fbo),r.viewport(n,s,a,o);var u=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(r.textureUnitDict).forEach((function(e){var i=r.textureUnitDict[e];i&&i!==u&&t.attachmentTextures.includes(i)&&(r.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)r.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var c=this,l=c.depthStencilRenderbuffer,f=c.depthTexture,p=c.stencilTexture;if(r.activeTexture(e.TEXTURE0),l)l.setSize(a,o),e.framebufferRenderbuffer(e.FRAMEBUFFER,l.attachment,e.RENDERBUFFER,l.buffer);else if(f){f.source.data={width:a,height:o},f.update({data:{width:a,height:o,data:new Uint16Array(0)}});var d=f&&p?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(e.FRAMEBUFFER,d,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}}},r.resetColorTextures=function(t){var e=t,r=this.renderer.glRenderer.gl,i=this.engine.gpuCapability,n=this.viewport,a=[];if(e){for(var o,u=s(e);!(o=u()).done;){o.value.initialize()}this.colorTextures=e.slice()}this.renderer.pipelineContext.activeTexture(r.TEXTURE0),this.colorTextures.forEach((function(t,e){var s={width:n[2],height:n[3],data:new Uint8Array(0)};t.update({data:s}),i.framebufferTexture2D(r,r.FRAMEBUFFER,e,r.TEXTURE_2D,t.textureBuffer),a.push(!0)})),i.drawBuffers(r,a),this.updateAttachmentTextures()},r.resize=function(t,e,r,i){var n=this.viewport,s=n[0],a=n[1],o=n[2],u=n[3];s===t&&a===e&&o===r&&u===i||(this.viewport=[t,e,r,i],this.ready=!1,this.bind())},r.dispose=function(t){if(this.renderer){this.renderer.glRenderer.deleteGLFramebuffer(this),delete this.fbo;var e,r,i=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:exports.RenderPassDestroyAttachmentType.force;if(i===exports.RenderPassDestroyAttachmentType.force||i===exports.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)null==(e=this.depthStencilRenderbuffer)||e.dispose(),null==(r=this.depthTexture)||r.dispose();this.renderer=this.stencilRenderbuffer=this.depthStencilRenderbuffer=null}},se(e,[{key:"stencilStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderbuffer}},{key:"depthStorage",get:function(){if(this.depthStencilStorageType!==exports.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderbuffer}}]),e}(Bi),dc=((ec={})[rr.FLOAT]=1,ec[rr.INT]=1,ec[rr.UNSIGNED_INT]=1,ec[rr.SHORT]=1,ec[rr.BOOL]=1,ec[rr.UNSIGNED_SHORT]=1,ec[rr.FLOAT_VEC2]=2,ec[rr.FLOAT_VEC3]=3,ec[rr.FLOAT_VEC4]=4,ec[rr.FLOAT_MAT2]=4,ec[rr.FLOAT_MAT3]=9,ec[rr.FLOAT_MAT4]=16,ec[rr.FLOAT_MAT2x3]=6,ec[rr.FLOAT_MAT2x4]=8,ec[rr.FLOAT_MAT4x3]=12,ec[rr.FLOAT_MAT4x2]=8,ec[rr.FLOAT_MAT3x4]=12,ec[rr.FLOAT_MAT3x2]=6,ec[rr.INT_VEC2]=2,ec[rr.INT_VEC3]=3,ec[rr.INT_VEC4]=4,ec[rr.UNSIGNED_INT_VEC2]=2,ec[rr.UNSIGNED_INT_VEC3]=3,ec[rr.UNSIGNED_INT_VEC4]=4,ec[rr.BOOL_VEC2]=2,ec[rr.BOOL_VEC3]=3,ec[rr.BOOL_VEC4]=4,ec),mc=xc(Float32Array),vc=xc(Int32Array),yc=xc(Uint8Array);function gc(t){return function(e,r,i,n){var s={start:r[1],dirty:!0};if(r[2]>1){var a=e;if(a.length){for(var o=n[1]||a.length,u=r[4]/t.BYTES_PER_ELEMENT,h=s.buffer=new t(o*u),c=n[0]||0,l=0;l<o;l++)h[l*u]=a[l+c];s.start+=c*u}}else s.buffer=new t([e]);return s}}function xc(t){return function(e,r,i,n){for(var s=r[8],a=r[2],o=r[5],u=1===a?s:r[4],h=o?u/o:1,c=u/t.BYTES_PER_ELEMENT/h,l=s/t.BYTES_PER_ELEMENT/c,f=dc[r[0]],p=f/h,d=(n[0]||0)*f,m=n[1]?h*n[1]:l,v=new t(c*m),y={start:r[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,b=d;g<m;g++){for(var T=0;T<p;T++)v[x+T]=e[b+T];x+=c,b+=p}return y}}function bc(t,e){for(var r=function(r){var s=t.getActiveUniformBlockName(e,r);N(s);var a={index:t.getUniformBlockIndex(e,s),usedByVertexShader:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,r,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:s,id:""};a.used=a.usedByVertexShader||a.usedByFragmentShader,i[r]=a;for(var o=a.uniformIndices,u=[],h=0;h<o.length;h++){var c=t.getActiveUniform(e,o[h]).name.replace("[0]","");a.uniforms[c]=[0,0,0,0,0,0,0,h,0],u[h]=c,n.push(c)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach((function(r,i){t.getActiveUniforms(e,o,r).forEach((function(t,e){var r=u[e];a.uniforms[r][i]=+t}))}));for(var l=0;l<u.length;l++){var f=a.uniforms[u[l]],p=a.uniforms[u[l+1]],d=p?p[1]:a.size;f[8]=d-f[1]}a.id=function(t){var e=t.name,r=t.size,i=t.uniforms,n=t.uniformIndices,s=Object.keys(i).map((function(t){return t+"["+i[t].join(":")+"]"})).join("+");return Tc(e+"+",r+"+",n.length+"+",s)}(a)+""},i=[],n=[],s=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),a=0;a<s;++a)r(a);return{blockSpecs:i,blockUniformNames:n}}function Tc(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];for(var i=0,n=0;n<arguments.length;n++)for(var s=e[n],a=0;a<s.length;a++)i=Math.imul(31,i)+s.charCodeAt(a)|0;return i}(rc={})[rr.FLOAT]=gc(Float32Array),rc[rr.INT]=gc(Int32Array),rc[rr.UNSIGNED_INT]=gc(Uint32Array),rc[rr.SHORT]=gc(Int16Array),rc[rr.BOOL]=gc(Uint8Array),rc[rr.UNSIGNED_SHORT]=gc(Uint16Array),rc[rr.FLOAT_VEC2]=mc,rc[rr.FLOAT_VEC3]=mc,rc[rr.FLOAT_VEC4]=mc,rc[rr.FLOAT_MAT2]=mc,rc[rr.FLOAT_MAT3]=mc,rc[rr.FLOAT_MAT4]=mc,rc[rr.FLOAT_MAT2x3]=mc,rc[rr.FLOAT_MAT2x4]=mc,rc[rr.FLOAT_MAT4x3]=mc,rc[rr.FLOAT_MAT4x2]=mc,rc[rr.FLOAT_MAT3x4]=mc,rc[rr.FLOAT_MAT3x2]=mc,rc[rr.INT_VEC2]=vc,rc[rr.INT_VEC3]=vc,rc[rr.INT_VEC4]=vc,rc[rr.UNSIGNED_INT_VEC2]=vc,rc[rr.UNSIGNED_INT_VEC3]=vc,rc[rr.UNSIGNED_INT_VEC4]=vc,rc[rr.BOOL_VEC2]=yc,rc[rr.BOOL_VEC3]=yc,rc[rr.BOOL_VEC4]=yc;var Ec=function(){function t(t,e,r){var i=this;this.engine=t,this.program=e,this.id=r,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var n=this.pipelineContext.gl;(this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),nr(n))&&bc(n,e).blockSpecs.forEach((function(t){return i.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,r,i=this,n=this.id,s=this.pipelineContext.gl;return t.vaos[n]?r=t.vaos[n]:((r=new jh(this.engine,t.name+"-"+n))||console.error("Failed to create VAO object."),t.vaos[n]=r),r&&r.vao&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var r=i.attribInfoMap[e],n=t.attributes[e];if(n){var a=t.buffers[n.dataSource];if(!a)throw new Error("Failed to find a buffer named '"+(n.dataSource||e)+"'. Please ensure the buffer is correctly initialized and bound.");a.bind(),s.enableVertexAttribArray(r.loc),s.vertexAttribPointer(r.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null==(e=t.indicesBuffer)||e.bind(),r&&(r.ready=!0)),r},e.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var s=t.getActiveAttrib(e,n);if(s){var a=s.name,o=s.type,u=s.size,h=t.getAttribLocation(e,a);r[a]={type:o,name:a,size:u,loc:h}}}return r},e.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),_c=function(t){function e(e,r){var i;return(i=t.call(this,e,r)||this).initialized=!1,i.uniformLocations={},i.samplerChannels={},i}_t(e,t);var r=e.prototype;return r.initialize=function(){this.initialized||this.engine.getGLPipelineContext().shaderLibrary.compileShader(this)},r.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},r.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},r.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},r.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},r.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},r.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},r.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},r.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},r.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},r.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},r.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},r.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},r.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},r.fillShaderInformation=function(t,e){var r=e.slice();t=t.concat(r);for(var i,n=this.pipelineContext.getUniforms(this.program.program,t),s=0;s<t.length;s++)this.uniformLocations[t[s]]=n[s];for(i=0;i<r.length;i++){null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--)}for(i=0;i<r.length;i++){var a=r[i];this.samplerChannels[a]=i}},r.toData=function(){var t=this.taggedProperties;t.dataType=Kt.Shader,t.id=this.guid,t.vertex=this.source.vertex,t.fragment=this.source.fragment},r.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null==(t=this.program)||t.dispose()},e}(br),Ac=0,Cc=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 r=t.prototype;return r.compileAllShaders=function(t){var e=this;if(this.shaderAllDone)t&&t([]);else{for(var r,i=[],n=s(Object.keys(this.cachedShaders));!(r=n()).done;){var a=r.value;this.cachedShaders[a].initialized||i.push(a)}t?i.length?Promise.all(i.map((function(t){return new Promise((function(r){return e.compileShader(e.cachedShaders[t],r)}))}))).then(t).catch((function(){return 0})):t([]):i.map((function(t){return e.compileShader(e.cachedShaders[t])})),this.shaderAllDone=!0}},r.addShader=function(t,e){var r,i,n=[];t.macros&&(r=n).push.apply(r,[].concat(t.macros));e&&(i=n).push.apply(i,[].concat(e));var s=Ie({},t,{vertex:bi.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.vertex,shader:t.vertex,macros:n}),fragment:bi.genFinalShaderCode({level:this.engine.gpuCapability.level,shaderType:exports.ShaderType.fragment,shader:t.fragment,macros:n})}),a=this.computeShaderCacheId(s);if(this.cachedShaders[a])return a;this.shaderAllDone=!1;var o=!1;return(s.shared||s.cacheId)&&(o=!0),this.cachedShaders[a]=new _c(this.engine,Ie({},s,{vertex:s.vertex,fragment:s.fragment,name:s.name||a,shared:o})),this.cachedShaders[a].id=a,a},r.createShader=function(t,e){var r=this.addShader(t,e);return this.cachedShaders[r]},r.compileShader=function(t,r){var i=this,n=t.source,s=n.shared,a=n.vertex,o=n.fragment,u=n.name,h=t.source.cacheId,c=!1;(s||h)&&(c=!0);var l=this.pipelineContext.gl,f={shared:c,status:exports.ShaderCompileResultStatus.compiling},p=this.createProgram(l,a,o,f),d=this.glAsyncCompileExt,m=e.performance.now(),v=function(r){f.status=exports.ShaderCompileResultStatus.success,f.compileTime=e.performance.now()-m,t.program=r,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]=r},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==r?void 0:r(f);if(t.initialized)return null==r?void 0:r(f);var n=(!r||!d||d&&1==l.getProgramParameter(f.program,d.COMPLETION_STATUS_KHR))&&p();if(n){if(f.status!==exports.ShaderCompileResultStatus.fail){Wh(n,u);var s=new Ec(i.engine,n,t.id);if(l.validateProgram(n),l.getProgramParameter(n,l.VALIDATE_STATUS))v(s);else{var h=l.getProgramInfoLog(n);(null==h?void 0:h.includes("the same texture"))?v(s):(f.status=exports.ShaderCompileResultStatus.fail,f.error=h,console.error("compileProgramError: "+h,"\nvertex:\n",a,"\nfragment:\n",o),l.deleteProgram(n))}}null==r||r(f)}else r&&e.requestAnimationFrame(y)};t.compileResult=f,y()},r.computeShaderCacheId=function(t){var e=t.vertex,r=void 0===e?"":e,i=t.fragment,n=void 0===i?"":i,s=t.shared,a=t.cacheId;return s||a?a||"shared_"+Tc(r,n):"instanced_"+Ac++},r.createProgram=function(t,e,r,i){var n=t.createProgram(),s=this.createGLShader(t,t.VERTEX_SHADER,e),a=this.createGLShader(t,t.FRAGMENT_SHADER,r);return n&&s&&a?(t.attachShader(n,s),t.attachShader(n,a),t.linkProgram(n),i.program=n,i.status=exports.ShaderCompileResultStatus.compiling,function(){if(i.program=void 0,!t.getProgramParameter(n,t.LINK_STATUS)){var o=t.getProgramInfoLog(n);console.error("Failed to link program: "+o+".");var u=Sc(t,s,"vertex",e),h=Sc(t,a,"fragment",r);return i.status=exports.ShaderCompileResultStatus.fail,u&&(i.error=u.error,i.status=u.status),h&&(i.error=h.error,i.status=h.status),n}return n}):(i.status=exports.ShaderCompileResultStatus.fail,function(){return null})},r.createGLShader=function(t,e,r){var i=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Tc(null!=r?r:""),s=i.get(n);if(s)return s;var a=t.createShader(e);return a&&(t.shaderSource(a,r),t.compileShader(a),i.set(n,a)),a},r.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]},r.restore=function(){},r.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 Sc(t,e,r,i){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(e);return console.error("compile "+r+" error: "+n,(null!=i?i:"").split("\n").map((function(t,e){return e+1+" "+t})).join("\n")),{error:n,status:exports.ShaderCompileResultStatus.fail}}}var wc=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new Cc(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=rr.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,r){this.stencilFuncSeparate(this.gl.FRONT,t,e,r),this.stencilFuncSeparate(this.gl.BACK,t,e,r)},e.stencilFuncSeparate=function(t,e,r,i){this.set4("stencilFuncSeparate",t,e,r,i)},e.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},e.stencilOp=function(t,e,r){this.stencilOpSeparate(this.gl.FRONT,t,e,r),this.stencilOpSeparate(this.gl.BACK,t,e,r)},e.stencilOpSeparate=function(t,e,r,i){this.set4("stencilOpSeparate",t,e,r,i)},e.cullFace=function(t){this.set1("cullFace",t)},e.frontFace=function(t){this.set1("frontFace",t)},e.clearColor=function(t,e,r,i){this.set4("clearColor",t,e,r,i)},e.colorMask=function(t,e,r,i){this.set4("colorMask",t,e,r,i)},e.blendColor=function(t,e,r,i){this.set4("blendColor",t,e,r,i)},e.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},e.blendFuncSeparate=function(t,e,r,i){this.set4("blendFuncSeparate",t,e,r,i)},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,r,i){this.set4("viewport",t,e,r,i)},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,r){(this.currentTextureBinding!==e||r)&&(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,r){var i=this.glCapabilityCache[t];i||(i=this.glCapabilityCache[t]={x:NaN,y:NaN}),i.x===e&&i.y===r||this.gl[t](i.x=e,i.y=r)},e.set3=function(t,e,r,i){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===r&&n.z===i||this.gl[t](n.x=e,n.y=r,n.z=i)},e.set4=function(t,e,r,i,n){var s=this.glCapabilityCache[t];s||(s=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),s.x===e&&s.y===r&&s.z===i&&s.w===n||this.gl[t](s.x=e,s.y=r,s.z=i,s.w=n)},e.get=function(t){return this.glCapabilityCache[t]},e.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},e.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},e.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},e.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},e.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},e.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},e.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},e.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},e.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},e.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},e.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},e.setTexture=function(t,e,r){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var i=r.target;this.gl.bindTexture(i,r.textureBuffer),this.gl.uniform1i(t,e)}},e.getUniforms=function(t,e){for(var r=[],i=0;i<e.length;i++)r.push(this.gl.getUniformLocation(t,e[i]));return r},e.setFloat4=function(t,e,r,i,n){t&&this.gl.uniform4f(t,e,r,i,n)},e.setFloat3=function(t,e,r,i){t&&this.gl.uniform3f(t,e,r,i)},e.setFloat2=function(t,e,r){t&&this.gl.uniform2f(t,e,r)},t}(),Rc=function(t){function e(e,r,i){var n;(n=t.call(this)||this).canvas=e,n.temporaryRTs={};var s=Ie({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},i);n.context=new hc(e,r,s);var a=n.context.gl;return N(a),n.engine=new cc(a),n.engine.renderer=we(n),n.pipelineContext=new wc(n.engine,a),n.glRenderer=new Hh(n.engine),n.extension=new oc(we(n)),n.renderingData={currentFrame:{}},n.framebuffer=new pc({storeAction:{},viewport:[0,0,n.width,n.height],attachments:[new Bh(n.engine,{sourceType:exports.TextureSourceType.framebuffer,data:{width:n.width,height:n.height}})],depthStencilAttachment:{storageType:exports.RenderPassAttachmentStorageType.none}},we(n)),n}_t(e,t);var r=e.prototype;return r.renderRenderFrame=function(t){var e,r=t;r.resource&&r.resource.color_b.initialize(),r.emptyTexture.initialize(),r.transparentTexture.initialize();var i=r._renderPasses;if(this.isDestroyed)console.error("Renderer is destroyed, target: GLRenderer.");else{null==(e=r.renderer.getShaderLibrary())||e.compileAllShaders(),this.setFramebuffer(null),this.clear(r.clearAction);var n=r.camera;this.renderingData.currentFrame=r,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),L(i);for(var a,o=s(i);!(a=o()).done;){var u=a.value,h=u.delegate;null==h.willBeginRenderPass||h.willBeginRenderPass.call(h,u,this.renderingData),this.renderRenderPass(u),null==h.didEndRenderPass||h.didEndRenderPass.call(h,u,this.renderingData)}for(var c,l=s(i);!(c=l()).done;){c.value.frameCleanup(this)}}},r.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},r.renderMeshes=function(t){for(var e,r=this.renderingData.currentPass.delegate,i=s(t);!(e=i()).done;){var n=e.value;null==r.willRenderMesh||r.willRenderMesh.call(r,n,this.renderingData),n.render(this),null==r.didRenderMesh||r.didRenderMesh.call(r,n,this.renderingData)}},r.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},r.setGlobalVector4=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector4s[t]=e},r.getGlobalVector4=function(t){return this.renderingData.currentFrame.globalUniforms.vector4s[t]},r.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},r.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},r.setGlobalVector3=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.vector3s[t]=e},r.drawGeometry=function(t,e,r){if(void 0===r&&(r=0),t&&e){e.initialize(),t.initialize(),t.flush();var i=this.renderingData;i.currentFrame.editorTransform&&e.setVector4("uEditorTransform",i.currentFrame.editorTransform);try{e.use(this,i.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,e,r)}},r.setFramebuffer=function(t){t?(this.framebuffer=t,this.framebuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.getFramebuffer=function(){return this.framebuffer},r.getTemporaryRT=function(t,e,r,i,n,s){if(this.temporaryRTs[t])return this.temporaryRTs[t];var a,o,u=exports.RenderPassAttachmentStorageType.none;n===exports.FilterMode.Linear?a=rr.LINEAR:n===exports.FilterMode.Nearest&&(a=rr.NEAREST),s===exports.RenderTextureFormat.RGBA32?o=rr.UNSIGNED_BYTE:s===exports.RenderTextureFormat.RGBAHalf&&(o=rr.HALF_FLOAT),0===i?u=exports.RenderPassAttachmentStorageType.none:16===i?u=exports.RenderPassAttachmentStorageType.depth_16_opaque:24===i&&(u=exports.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var h=new Bh(this.engine,{sourceType:exports.TextureSourceType.framebuffer,minFilter:a,magFilter:a,internalFormat:rr.RGBA,format:rr.RGBA,type:o}),c=new pc({name:t,storeAction:{},viewport:[0,0,e,r],viewportScale:1,isCustomViewport:!0,attachments:[h],depthStencilAttachment:{storageType:u}},this);return this.temporaryRTs[t]=c,c},r.setViewport=function(t,e,r,i){this.pipelineContext.viewport(t,e,r,i)},r.clear=function(t){var e=this.pipelineContext,r=0;if(t.colorAction===exports.TextureLoadAction.clear){var i=t.clearColor;i&&e.clearColor(i[0],i[1],i[2],i[3]),e.colorMask(!0,!0,!0,!0),r=rr.COLOR_BUFFER_BIT}if(t.stencilAction===exports.TextureLoadAction.clear&&(e.stencilMask(255),e.clearStencil(t.clearStencil||0),r|=rr.STENCIL_BUFFER_BIT),t.depthAction===exports.TextureLoadAction.clear){var n=t.clearDepth;e.depthMask(!0),e.clearDepth(Number.isFinite(n)?n:1),r|=rr.DEPTH_BUFFER_BIT}r&&e.clear(r)},r.addLostHandler=function(t){this.context.addLostHandler(t)},r.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},r.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.getWidth=function(){return this.width},r.getHeight=function(){return this.height},r.dispose=function(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null==(t=this.glRenderer)||t.dispose(),this.canvas=null,this.engine.dispose()},r.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},r.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context.");this.engine.gpuCapability=new Di(t),this.engine.renderer=this,this.pipelineContext=new wc(this.engine,t),this.glRenderer=new Hh(this.engine),this.extension=new oc(this)},r.resize=function(t,e){var r=this.glRenderer;r&&(this.width===t&&this.height===e||r.resize(t,e))},r.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},se(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}(Gi),Oc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#MvjnY",Mc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#ulfNT",Pc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#lLlSW",Ic="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#WZaWg",Lc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#YSWQr",Fc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#IzodZ",Vc="https://www.galacean.com/effects/user/gasrv4ka5sacrwpg#X0ulg";var Dc=new Map;var Nc=!1,kc=1,zc=function(t){function r(r){var n;(n=t.call(this)||this).compositions=[],n.displayScale=1,n.resumePending=!1,n.disposed=!1,n.assetManagers=[],n.speed=1,n.baseCompositionIndex=0,n.lost=function(t){var e;null==(e=n.ticker)||e.pause(),n.compositions.forEach((function(e){return e.lost(t)})),n.renderer.lost(t),n.handleEmitEvent("webglcontextlost",t),Uc(we(n),!1)};var a=we(n);n.restore=i((function(){var t;return h(this,(function(r){switch(r.label){case 0:return a.renderer.restore(),[4,Promise.all(a.compositions.map(i((function(t){var e,r,i,n,s,o,u,c,l,f,p,d;return h(this,(function(h){switch(h.label){case 0:return e=t.time,r=t.url,i=t.speed,n=t.keepResource,s=t.reusable,o=t.renderOrder,u=t.transform,c=t.videoState,[4,a.loadScene(r)];case 1:(l=h.sent()).speed=i,l.reusable=s,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),f=0,h.label=2;case 2:return f<c.length?c[f]?((p=l.textures[f].source.video).currentTime=null!=(d=c[f])?d:0,[4,p.play()]):[3,4]:[3,5];case 3:h.sent(),h.label=4;case 4:return f++,[3,2];case 5:return l.isEnded=!1,l.gotoAndPlay(e),[2,l]}}))}))))];case 1:return a.compositions=r.sent(),a.emit("webglcontextrestored"),null==(t=a.ticker)||t.resume(),S()&&a.canvas&&(a.canvas.style.display="none",e.window.setTimeout((function(){a.canvas.style.display=""}),0)),[2]}}))})),n.handleResume=function(){n.emit("update",{player:we(n),playing:!0})},n.handleClick=function(t){var e=t.x,r=t.y,i=[];n.compositions.forEach((function(t){for(var a,o=s(t.hitTest(e,r));!(a=o()).done;){var u=a.value;i.push(Ie({},u,{player:we(n),composition:t}))}}));for(var a=0;a<i.length;a++){var o=i[a],u=o.behavior||mt.NOTIFY;u===mt.NOTIFY?(n.emit("click",Ie({},o,{compositionId:o.composition.id,compositionName:o.composition.name})),o.composition.emit("click",Ie({},o,{compositionId:o.composition.id,compositionName:o.composition.name}))):u===mt.RESUME_PLAYER&&n.resume()}};var o=r.container,u=r.canvas,c=r.fps,l=r.name,f=r.pixelRatio,p=r.manualRender,d=r.reportGPUTime,m=r.renderFramework,v=r.notifyTouch,y=r.onError,g=r.interactive,x=void 0!==g&&g,b=r.renderOptions,T=void 0===b?{}:b,E=r.env,_=void 0===E?"":E,A=T.willCaptureImage,w=T.premultipliedAlpha;if(n.onError=y,Nc||"debug-disable"===m)return ru(n);var R,O=(R=/iPhone OS (\d+)_(\d+)/.exec(e.navigator.userAgent))&&("13"===R[1]||"16"===R[1]&&"5"===R[2])?"webgl":"webgl2";m&&(O="webgl"===m?"webgl":"webgl2"),n.reportGPUTime=d,n.pixelRatio=Number.isFinite(f)?f:C(),n.offscreenMode=!0,n.env=_,n.name=l||""+kc++;try{if(er.length)throw new Error("Errors before player create: "+er.map((function(t,e){return"\n "+(e+1)+": "+t}))+".",{cause:"webgliniterror"});u?n.canvas=u:(Bc(o),n.canvas=e.document.createElement("canvas"),o.appendChild(n.canvas)),n.container=n.canvas.parentElement,n.renderer=Gi.create(n.canvas,O,{preserveDrawingBuffer:A,premultipliedAlpha:w}),n.renderer.env=_,n.renderer.addLostHandler({lost:n.lost}),n.renderer.addRestoreHandler({restore:n.restore}),n.gpuCapability=n.renderer.engine.gpuCapability,n.assetService=new oh(n.renderer.engine),p||(n.ticker=new Dh(c),n.ticker.add(n.tick.bind(we(n)))),n.event=new Cs(n.canvas,!!v),n.event.bindListeners(),n.event.addEventListener(Ts,n.handleClick),n.interactive=x,n.resize(),jo(n.gpuCapability.detail)}catch(t){n.handleThrowError(t)}return Dc.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&&j.warn("Create player with different WebGL version: old="+t.gpuCapability.type+", new="+n.gpuCapability.type+".\nsee "+Vc+".")})),Dc.set(n.canvas,we(n)),function(){for(var t,e=[],r=s(Dc.values());!(t=r()).done;){var i=t.value;i.paused||e.push(i)}e.length>1&&j.error("Current running player count: "+e.length+", see "+Fc+".",e)}(),Uc(we(n),!0),n}_t(r,t);var n=r.prototype;return n.setSpeed=function(t){isNaN(t)||(this.speed=t)},n.getSpeed=function(){return this.speed},n.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},n.getCompositions=function(){return this.compositions.sort((function(t,e){return t.getIndex()-e.getIndex()}))},n.getAssetManager=function(){return this.assetManagers},n.loadScene=function(t,r){var n=this;return i((function(){var a,o,u,c,l,f,p,d,m,v,y,g,x,b,T,E,_,A,C,S;return h(this,(function(w){switch(w.label){case 0:return N(n.renderer,"Renderer is not exist, maybe the Player has been disabled or in gl 'debug-disable' mode."),c=e.performance.now(),l=[],f=[],d=null==(p=null==r?void 0:r.autoplay)||p,m=null==(o=n.renderer.engine.gpuCapability)||null==(a=o.detail)?void 0:a.asyncShaderCompile,v=n.baseCompositionIndex,W(t)?(y=l).push.apply(y,[].concat(t)):l.push(t),d&&(n.autoPlaying=!0),g=[],[4,Promise.all(l.map(i((function(t,e){var i,s,a,o,u,c,l,p;return h(this,(function(h){switch(h.label){case 0:return i=n.assetService.assembleSceneLoadOptions(t,Ie({autoplay:d},r)),s=i.source,a=i.options,u=null!=(o=null==a?void 0:a.autoplay)?o:d,c=new sh(a),n.assetManagers.push(c),[4,c.loadScene(s,n.renderer,{env:n.env})];case 1:return l=h.sent(),n.assetService.prepareAssets(l,c.getAssets()),n.assetService.updateTextVariables(l,c.options.variables),n.assetService.initializeTexture(l),l.pluginSystem.precompile(l.jsonScene.compositions,n.renderer),p=n.createComposition(l,a),n.baseCompositionIndex+=1,p.setIndex(v+e),f[e]=p,g[e]=u,[2]}}))}))))];case 1:return w.sent(),x=e.performance.now(),[4,new Promise((function(t){var e;null==(e=n.renderer.getShaderLibrary())||e.compileAllShaders((function(){return t(null)}))}))];case 2:for(w.sent(),b=e.performance.now()-x,T=0;T<f.length;T++)g[T]?f[T].play():f[T].pause();for(null==(u=n.ticker)||u.start(),E=f.map((function(t){return t.name})),_=e.performance.now()-c,A=s(f);!(C=A()).done;)(S=C.value).statistic.compileTime=b,S.statistic.firstFrameTime=_;return j.info("First frame ["+E+"]: "+_.toFixed(4)+"ms."),j.info("Shader "+(m?"async":"sync")+" compile ["+E+"]: "+b.toFixed(4)+"ms."),[2,W(t)?f:f[0]]}}))}))()},n.createComposition=function(t,e){var r=this;void 0===e&&(e={});var i=this.renderer;if(this.disposed)throw new Error("Disposed player can not used to create Composition.");var n=new mh(Ie({},e,{renderer:i,width:i.getWidth(),height:i.getHeight(),event:this.event,handleItemMessage:function(t){r.emit("message",t)}}),t);return this.ticker&&e.renderLevel===ut.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),this.env!==Xn&&this.assetService.createShaderVariant(),this.compositions.push(n),n},n.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.play()})),null==(t=this.ticker)||t.start()},n.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.gotoAndPlay(t)})),this.ticker?this.ticker.start():this.doTick(0,!0)},n.gotoAndStop=function(t){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(e){e.gotoAndStop(t)})),this.ticker&&!(null==(e=this.ticker)?void 0:e.getPaused())||this.doTick(0,!0),this.emit("update",{player:this,playing:!1})},n.playSequence=function(t){for(var e,r=function(e){t[e].on("end",(function(){t[e+1].play()}))},i=0;i<t.length-1;i++)r(i);t[0].play(),null==(e=this.ticker)||e.start()},n.pause=function(t){var e;this.paused||(null==(e=this.ticker)||e.pause(),this.emit("pause"),this.emit("update",{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},n.resume=function(){var t=this;return i((function(){var e;return h(this,(function(r){switch(r.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:r.sent(),t.resumePending=!1,t.handleResume(),r.label=2;case 2:return null==(e=t.ticker)||e.resume(),[2]}}))}))()},n.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},n.doTick=function(t,e){var r,i=this,n=this.renderer.engine.renderErrors;n.size>0&&(this.handleEmitEvent("rendererror",n.values().next().value),null==(r=this.ticker)||r.pause());t=Math.min(t,33)*this.speed;var s=this.compositions,a=!1;s.sort((function(t,e){return t.getIndex()-e.getIndex()}));for(var o,u=[],h=0;h<s.length;h++){var c=s[h];c.textureOffloaded?(a=!0,j.error("Composition "+c.name+" texture offloaded, skip render."),u.push(c)):(!c.isDestroyed&&c.renderer&&c.update(t),c.isDestroyed||u.push(c))}if(this.compositions=u,this.baseCompositionIndex=this.compositions.length,a)return this.handleEmitEvent("rendererror",new Error("Play when texture offloaded.")),null==(o=this.ticker)?void 0:o.pause();if(!this.paused||e){var l=this.gpuCapability.level,f=this.renderer.context.gl,p=2===l&&this.reportGPUTime?tr(f):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<s.length||e){this.renderer.setFramebuffer(null),this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var d=0;d<s.length;d++)!s[d].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(s[d].renderFrame)}null==p||p.end(),null==p||p.getTime().then((function(t){return null==i.reportGPUTime?void 0:i.reportGPUTime.call(i,null!=t?t:0)})).catch,this.autoPlaying&&this.emit("update",{player:this,playing:!0})}},n.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},n.resize=function(){var t,r,i,n,s=this.canvas.parentElement;if(s){var a=this.getTargetSize(s);t=a[0],r=a[1],i=a[2],n=a[3]}else t=i=this.canvas.width,r=n=this.canvas.height;var o=t/r;if(t&&r){var u,h=e.document.documentElement.clientWidth;i>2*h&&j.error("DPI overflowed, width "+i+" is more than 2x document width "+h+", see "+Mc+".");var c=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>c||n>c)&&(j.error("Container size overflowed "+i+"x"+n+", see "+Oc+"."),o>1?(i=Math.round(c),n=Math.round(c/o)):(n=Math.round(c),i=Math.round(c*o))),this.renderer.resize(i,n),this.canvas.style.width=t+"px",this.canvas.style.height=r+"px",j.info("Resize player "+this.name+" ["+i+","+n+","+t+","+r+"]."),null==(u=this.compositions)||u.forEach((function(t){t.camera.aspect=o}))}},n.clearCanvas=function(t){t?this.renderer.clear({stencilAction:exports.TextureLoadAction.clear,clearStencil:0,depthAction:exports.TextureLoadAction.clear,clearDepth:1,colorAction:exports.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},n.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},n.dispose=function(t){var r;if(j.info("Call player destroyed: "+this.name+"."),!this.disposed){Dc.delete(this.canvas),this.pause(),null==(r=this.ticker)||r.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(),Uc(this,!1),a(this.canvas,e.HTMLCanvasElement)&&!t&&this.renderer.context&&(su.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var i="Never use destroyed player: "+this.name+" again, see "+Lc+".",n=function(){return function(t){throw new Error(t)}(i)},s=function(){return t=i,Promise.reject(t);var t};this.tick=n,this.resize=n,this.loadScene=s,this.play=s,this.gotoAndPlay=s,this.gotoAndStop=s,this.playSequence=n,this.destroyCurrentCompositions=n,this.resume=s,this.disposed=!0}},n.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},n.getTargetSize=function(t){Bc(t);var r,i,n=this.displayAspect,s=null==e.window.getComputedStyle?void 0:e.window.getComputedStyle.call(e.window,t),a=0,o=0;(s?(a=parseInt(s.width,10),o=parseInt(s.height,10)):(a=t.clientWidth,o=t.clientHeight),n)?a/o>n?r=(i=o*this.displayScale)*n:i=(r=a*this.displayScale)/n:(r=a,i=o);var u=this.pixelRatio,h=r,c=i;if(r=Math.round(r*u),(i=Math.round(i*u))<1||i<1){if(!this.offscreenMode)throw new Error("Invalid container size "+r+"x"+i+", see "+Pc+".");r=i=h=c=1}return[h,c,r,i]},n.handleThrowError=function(t){if(!this.onError)throw t;this.onError(t)},n.handleEmitEvent=function(t,r){this.onError?a(r,e.Event)?this.onError(new Error(r.type,{cause:t}),r):a(r,Error)?this.onError(new Error(r.message,{cause:t}),r):this.onError(new Error("Unknown error.",{cause:t}),r):(console.warn("["+t+"] event is deprecated, please use 'onError' instead."),this.emit(t,r))},se(r,[{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}}]),r}(ks);function Uc(t,e){Object.keys(et).forEach((function(r){var i=et[r],n=e?i.onPlayerCreated:i.onPlayerDestroy;null==n||n(t)}))}function Bc(t){if(null==t)throw new Error("Container is not an HTMLElement, see "+Ic+".")}u([function(t,e,r){var n=r.value;return r.value=i((function(){var e,r,i,s,a=arguments;return h(this,(function(o){switch(o.label){case 0:for(e=a.length,r=new Array(e),i=0;i<e;i++)r[i]=a[i];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.apply(this,r)];case 2:return[2,o.sent()];case 3:return s=o.sent(),t.handleThrowError.call(this,s),[3,4];case 4:return[2]}}))})),r}],zc.prototype,"loadScene",null),ur.create=function(t,e){return new Bh(t,e)},ur.createWithData=function(t,e,r){void 0===e&&(e=P("#fff")),void 0===r&&(r={});var i=r.type,n=void 0===i?rr.UNSIGNED_BYTE:i,s=r.format,a=void 0===s?rr.RGBA:s,o=r.internalFormat,u=r.wrapS,h=void 0===u?rr.MIRRORED_REPEAT:u,c=r.wrapT,l=void 0===c?rr.MIRRORED_REPEAT:c,f=r.minFilter,p=void 0===f?rr.NEAREST:f,d=r.magFilter,m=void 0===d?rr.NEAREST:d,v=r.flipY,y=void 0!==v&&v;return new Bh(t,{data:e,type:n,sourceType:exports.TextureSourceType.data,format:a,internalFormat:o||a,wrapS:h,wrapT:l,minFilter:p,magFilter:m,flipY:y})},Nr.create=function(t,e){return new ac(t,e)},jr.create=function(t,e){return new $h(t,e)},ei.create=function(t,e){return new ei(t,e)},Fi.create=function(t){return new lc(t)},Bi.create=function(t,e){return new pc(t,e)},Gi.create=function(t,e,r){return new Rc(t,e,r)},Vh.create=function(t){return new cc(t)};var Gc="2.3.8";j.info("Player version: 2.3.8."),exports.AbstractPlugin=Tt,exports.ActivationPlayable=tu,exports.AnimationClipPlayable=eu,exports.Asset=cu,exports.AssetLoader=lu,exports.AssetManager=sh,exports.AssetService=oh,exports.BYTES_TYPE_MAP=Gr,exports.BaseRenderComponent=qn,exports.Behaviour=de,exports.BezierCurve=On,exports.BezierCurvePath=Pn,exports.BezierCurveQuat=In,exports.COPY_FRAGMENT_SHADER=Cr,exports.COPY_MESH_SHADER_ID=_r,exports.COPY_VERTEX_SHADER=Ar,exports.CalculateLoader=Yo,exports.Camera=hh,exports.CameraVFXItemLoader=bs,exports.ColorCurve=Zn,exports.Component=pe,exports.Composition=mh,exports.CompositionComponent=No,exports.CompositionSourceManager=ch,exports.DEFAULT_FONTS=au,exports.DEFAULT_FPS=60,exports.Database=fu,exports.Downloader=Le,exports.EFFECTS_COPY_MESH_NAME=Er,exports.EVENT_TYPE_CLICK=Ts,exports.EVENT_TYPE_TOUCH_END=As,exports.EVENT_TYPE_TOUCH_MOVE=_s,exports.EVENT_TYPE_TOUCH_START=Es,exports.EffectsObject=fe,exports.EffectsPackage=Fh,exports.Engine=Vh,exports.EventEmitter=ks,exports.EventSystem=Cs,exports.Float16ArrayWrapper=Xi,exports.Framebuffer=Bi,exports.GLEngine=cc,exports.GLGeometry=$h,exports.GLRenderer=Rc,exports.GPUCapability=Di,exports.Geometry=jr,exports.GlobalUniforms=Li,exports.GradientValue=wn,exports.HELP_LINK=Hn,exports.InteractLoader=ws,exports.InteractMesh=Os,exports.KTXTexture=pr,exports.LineSegments=Rn,exports.LinearValue=Sn,exports.Material=Nr,exports.MaterialDataBlock=Ir,exports.Mesh=ei,exports.MeshCollider=Is,exports.PLAYER_OPTIONS_ENV_EDITOR=Xn,exports.POST_PROCESS_SETTINGS="post_process_settings",exports.ParticleBehaviourPlayable=qa,exports.ParticleBehaviourPlayableAsset=Ka,exports.ParticleLoader=Wo,exports.ParticleMesh=Ja,exports.ParticleSystemRenderer=eo,exports.ParticleTrack=Po,exports.PassTextureCache=Ur,exports.PathSegments=Mn,exports.Player=zc,exports.PluginSystem=st,exports.PropertyTrack=Mo,exports.RENDER_PASS_NAME_PREFIX=Ci,exports.RENDER_PREFER_LOOKUP_TEXTURE=ka,exports.RUNTIME_ENV="runtime_env",exports.RandomSetValue=_n,exports.RandomValue=An,exports.RandomVectorValue=Cn,exports.RenderFrame=wi,exports.RenderPass=ai,exports.RenderPassPriorityNormal=ri,exports.RenderPassPriorityPostprocess=3e3,exports.RenderPassPriorityPrepare=0,exports.RenderTargetHandle=ni,exports.Renderbuffer=Fi,exports.Renderer=Gi,exports.RendererComponent=me,exports.RuntimeClip=Oo,exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",exports.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",exports.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",exports.SPRITE_VERTEX_STRIDE=jn,exports.SemanticMap=Br,exports.SerializationHelper=ko,exports.ShaderFactory=bi,exports.ShaderVariant=br,exports.SpriteLoader=Ls,exports.StaticValue=En,exports.TEMPLATE_USE_OFFSCREEN_CANVAS=za,exports.TextComponentBase=uu,exports.TextLayout=iu,exports.TextLoader=hu,exports.TextStyle=nu,exports.Texture=ur,exports.TextureFactory=gr,exports.Ticker=Dh,exports.TimelineClip=Ro,exports.TimelinePlayable=Lo,exports.TrackSortWrapper=Fo,exports.Transform=Bs,exports.TransformAnimationPlayable=$o,exports.ValueGetter=Tn,exports.Vector2Curve=Gn,exports.Vector4Curve=Bn,exports.addByOrder=F,exports.addItem=y,exports.addItemWithOrder=function(t,e,r,i){if(void 0===i&&(i=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var s=t[n];if(i)for(;t[n-1][r]<s[r]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][r]>s[r]&&(t[n]=t[n-1],0!=--n););t[n]=s}}},exports.applyMixins=tt,exports.assertExist=N,exports.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},exports.base64ToFile=$,exports.blend="vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;float alpha=ret.a;if(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}",exports.calculateTranslation=Zi,exports.canvasPool=su,exports.colorGradingFrag=di,exports.colorStopsFromGradient=E,exports.colorToArr=b,exports.combineImageTemplate=rh,exports.createCopyShader=Sr,exports.createGLContext=$e,exports.createKeyFrameMeta=Nn,exports.createShape=ia,exports.createValueGetter=Yn,exports.decimalEqual=rn,exports.defaultPlugins=rt,exports.deserializeMipmapTexture=qe,exports.disableAllPlayer=function(t){Nc=!!t},exports.earcut=Sa,exports.effectsClass=he,exports.effectsClassStore=ue,exports.enlargeBuffer=x,exports.ensureFixedNumber=du,exports.ensureVec3=qi,exports.findPreviousRenderPass=function(t,e){var r=t.indexOf(e);return t[r-1]},exports.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",exports.gaussianDownHFrag=mi,exports.gaussianDownVFrag=vi,exports.gaussianUpFrag=yi,exports.generateEmptyTypedArray=Xr,exports.generateGUID=J,exports.generateHalfFloatTexture=hr,exports.generateTransparentTexture=fr,exports.generateWhiteTexture=lr,exports.getActivePlayers=function(){return Array.from(Dc.values())},exports.getBackgroundImage=eh,exports.getColorFromGradientStops=T,exports.getConfig=Ba,exports.getDefaultTextureFactory=xr,exports.getGeometryByShape=Ia,exports.getGeometryTriangles=Pa,exports.getImageItemRenderInfo=Kn,exports.getKTXTextureOptions=dr,exports.getKeyFrameMetaByRawValue=Dn,exports.getMergedStore=le,exports.getParticleMeshShader=function(t,e,r){var i;void 0===r&&(r="");var n,s=t.content,a=+((null==(i=s.renderer)?void 0:i.renderMode)||0),o=[["RENDER_MODE",a],["ENV_EDITOR",r===Xn]],u=e.level,h=e.detail,c={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=h.maxVertexUniforms>0,p=(null!=(n=s.positionOverLifetime)?n:{}).speedOverLifetime,d=0,m=0;f&&o.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(o.push(["SPEED_OVER_LIFETIME",!0]),m|=2,Dn(c,p));var v=s.textureSheetAnimation;v&&v.animate&&(o.push(["USE_SPRITE",!0]),m|=4);var y=s.colorOverLifetime;y&&y.color&&(o.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=y&&y.opacity;g&&Dn(c,g);var x,b=s.positionOverLifetime;if(["x","y","z"].forEach((function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==b?void 0:b[i])&&(Dn(c,b[i]),r=1,m|=1<<7+e),o.push(["LINEAR_VEL_"+t.toUpperCase(),r]);var s=0;(null==b?void 0:b[n])&&(Dn(c,b[n]),s=1,m|=1<<10+e,x=!0),o.push(["ORB_VEL_"+t.toUpperCase(),s])})),(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),s.sizeOverLifetime){var T=s.sizeOverLifetime;T.separateAxes?(Dn(c,T.x),o.push(["SIZE_Y_BY_LIFE",1]),m|=16384,Dn(c,T.y)):Dn(c,T.size)}if(s.rotationOverLifetime){var E=s.rotationOverLifetime;E.z&&(Dn(c,null==E?void 0:E.z),m|=32768,o.push(["ROT_Z_LIFETIME",1])),E.separateAxes&&(E.x&&(Dn(c,E.x),m|=65536,o.push(["ROT_X_LIFETIME",1])),E.y&&(Dn(c,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)}Dn(c,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(o.push(["FINAL_TARGET",!0]),m|=1<<19,Dn(c,b.forceCurve));var _=h.halfFloatTexture;_&&l.max&&(m|=1<<20);var A=h.maxVertexUniforms,C=c.max+c.curves.length-32>A;Ba(ka)&&(C=!0),2===u&&(c.max=-1,l.index>0&&(l.max=-1)),C&&_&&f&&(d=1);var S=["-p:",a,m,c.index,c.max,l.index,l.max].join("+"),w={fragment:ci,vertex:"#define LOOKUP_TEXTURE_CURVE "+d+"\n"+li,shared:!0,cacheId:S,macros:o,name:"particle#"+t.name};return o.push(["VERT_CURVE_VALUE_COUNT",c.index],["FRAG_CURVE_VALUE_COUNT",l.index],["VERT_MAX_KEY_FRAME_COUNT",c.max],["FRAG_MAX_KEY_FRAME_COUNT",l.max]),{shader:w,vertex:c.index,fragment:l.index}},exports.getPixelRatio=C,exports.getPlayerByCanvas=function(t){return Dc.get(t)},exports.getPreMultiAlpha=wr,exports.getStandardComposition=Yu,exports.getStandardImage=Wu,exports.getStandardItem=Qu,exports.getStandardJSON=Xu,exports.getTextureSize=Ri,exports.glContext=rr,exports.glType2VertexFormatType=function(t){switch(t){case e.WebGLRenderingContext.FLOAT:return Jt.Float32;case e.WebGLRenderingContext.SHORT:return Jt.Int16;case e.WebGLRenderingContext.BYTE:return Jt.Int8;case e.WebGLRenderingContext.UNSIGNED_SHORT:return Jt.UInt16;case e.WebGLRenderingContext.UNSIGNED_BYTE:return Jt.UInt8;default:return Jt.Float32}},exports.gpuTimer=tr,exports.imageDataFromColor=P,exports.imageDataFromGradient=I,exports.initErrors=er,exports.initGLContext=ir,exports.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",exports.interpolateColor=_,exports.isAlipayMiniApp=O,exports.isAndroid=w,exports.isArray=W,exports.isCanvas=q,exports.isCanvasUsedByPlayer=function(t){return Dc.has(t)},exports.isFunction=Y,exports.isIOS=S,exports.isIOSByUA=function(){var t=e.navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/);return t?parseInt(t[2],10):0},exports.isMiniProgram=function(){return O()||M()},exports.isObject=Z,exports.isSimulatorCellPhone=R,exports.isString=H,exports.isUniformStruct=Lr,exports.isUniformStructArray=function(t){return t&&void 0!==t.length&&Lr(t[0])},exports.isValidFontFamily=k,exports.isWebGL2=nr,exports.isWechatMiniApp=M,exports.itemFrag=hi,exports.itemFrameFrag=oi,exports.itemVert=ui,exports.loadAVIFOptional=ke,exports.loadBinary=Ge,exports.loadBlob=function(t){return Xe.apply(this,arguments)},exports.loadImage=Ue,exports.loadMedia=Ye,exports.loadVideo=He,exports.loadWebPOptional=De,exports.logger=j,exports.math=$r,exports.modifyMaxKeyframeShader=function(t,e,r){var i,n=null==(i=t.cacheId)?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.macros)for(var s=0;s<t.macros.length;s++){var a=t.macros[s];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}},exports.nearestPowerOfTwo=$i,exports.noop=X,exports.normalizeColor=Tu,exports.numberToFix=nn,exports.parsePercent=A,exports.particleFrag=ci,exports.particleOriginTranslateMap=Ji,exports.particleUniformTypeMap=Qa,exports.particleVert=li,exports.passRenderLevel=th,exports.pluginLoaderMap=et,exports.randomInRange=K,exports.registerPlugin=nt,exports.removeItem=g,exports.rotateVec2=La,exports.screenMeshVert=pi,exports.serialize=ce,exports.setBlendMode=Rr,exports.setConfig=function(t,e){return Ua[t]=e},exports.setDefaultTextureFactory=function(t){mr=t},exports.setMaskMode=Mr,exports.setMaxSpriteMeshItemCount=function(t){exports.maxSpriteMeshItemCount=t},exports.setRayFromCamera=tn,exports.setSideMode=Or,exports.setSpriteMeshMaxItemCountByGPU=jo,exports.sortByOrder=L,exports.spec=ie,exports.spriteMeshShaderFromFilter=Xo,exports.spriteMeshShaderFromRenderInfo=Ho,exports.spriteMeshShaderIdFromRenderInfo=function(t,e){return t.cachePrefix+"_effects_sprite_"+e},exports.thresholdFrag=gi,exports.throwDestroyedError=Q,exports.trailVert=fi,exports.translatePoint=function(t,e){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=t,r[i+1]+=e;return r},exports.trianglesFromRect=en,exports.unregisterPlugin=function(t){delete it[t],delete et[t],g(rt,t)},exports.valIfUndefined=function(t,e){return null==t?e:t},exports.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nattribute float aSeed;varying float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",exports.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",exports.vecFill=Ki,exports.vecMulCombine=Qi,exports.version=Gc,exports.vertexFormatType2GLType=ar;
2
2
  //# sourceMappingURL=weapp.js.map