@galacean/effects-plugin-orientation-transformer 1.2.1 → 2.0.0-alpha.0
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/index.js +18622 -40
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +14 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +18630 -48
- package/dist/index.mjs.map +1 -1
- package/dist/orientation-component.d.ts +8 -0
- package/dist/transform-vfx-item.d.ts +4 -8
- package/package.json +2 -2
- package/dist/transform-item.d.ts +0 -2
package/dist/index.min.js
CHANGED
|
@@ -3,7 +3,19 @@
|
|
|
3
3
|
* Description: Galacean Effects player orientation transformer plugin
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,意绮
|
|
6
|
-
* Version:
|
|
6
|
+
* Version: v2.0.0-alpha.0
|
|
7
7
|
*/
|
|
8
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.orientationTransformerPlugin={}),t.ge)}(this,(function(t,e){"use strict";var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var r=function(){return r=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},r.apply(this,arguments)};function i(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,r,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=i.next()).done;)a.push(o.value)}catch(t){r={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return a}function a(t,e,n){if(n||2===arguments.length)for(var o,r=0,i=e.length;r<i;r++)!o&&r in e||(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var s=function(){function t(t){this.composition=t,this.targets={},this.records={},this.current={},this.gammaRange=[-89,89],this.betaRange=[-80,80]}return t.prototype.update=function(t){var e=t.x,n=t.y;this.currentEvent={x:e,y:n}},t.prototype.updateOrientation=function(){var t=this,e=this.currentEvent;e&&Object.getOwnPropertyNames(this.targets).forEach((function(n){t.moveLayer(n,e)}))},t.prototype.initComposition=function(){for(var t=this.composition.items,e=0;e<t.length;e++){var n=t[e];if(this.targets[n.name]){var o=n.transform.position.toArray(),r=this.current[n.name];if(this.records[n.name]={item:n,position:o},r){var a=i(r,3),s=a[0],c=a[1],l=a[2];n.transform.setPosition(s,c,l)}}}},t.prototype.addTarget=function(t){this.targets[t.name]=t},t.prototype.removeTarget=function(t){delete this.targets[t],delete this.records[t]},t.prototype.moveLayer=function(t,e){var n,o,r=e.x,s=e.y,u=null===(o=this.records[t])||void 0===o?void 0:o.item;if(u){var p=this.records[t].position,h=this.targets[t],f=c(r,this.betaRange),d=c(s,this.gammaRange);if(h){var v=[p[0]+1.2*l((f-this.gammaRange[0])/(this.gammaRange[1]-this.gammaRange[0]),h.xMin,h.xMax),p[1]+1.2*l((d-this.betaRange[0])/(this.betaRange[1]-this.betaRange[0]),h.yMin,h.yMax),p[2]];(n=u.transform).setPosition.apply(n,a([],i(v),!1)),this.current[t]=v.slice()}}},t}();function c(t,e){return t<e[0]?e[0]:t>e[1]?e[1]:t}function l(t,e,n){return e+(n-e)*t}function u(t){return Object.prototype.toString.call(t)}function p(t,e){var n=!0,o=!0,r=!0;if("[object Array]"===u(e.alpha)&&e.alpha.length>=2){var i=t.alpha+e.alpha[0],a=t.alpha+e.alpha[1];n=(i=i<0?i+360:i)<(a=a>360?a-360:a)?t.alpha>i&&t.alpha<a:t.alpha>i||t.alpha<a}return"[object Array]"===u(e.beta)&&e.beta.length>=2&&(o=t.beta>=e.beta[0]&&t.beta<=e.beta[1]),"[object Array]"===u(e.gamma)&&e.gamma.length>=2&&(r=t.gamma>=e.gamma[0]&&t.gamma<=e.gamma[1]),n&&o&&r}function h(t,n){if(!e.isObject(t)&&!e.isArray(t))return t;for(var o=e.isArray(t)?a([],i(t),!1):r({},t),s=arguments.length,c=1;c<s;c++){var l=arguments[c]||{};if(e.isObject(l)){var u=void 0;for(u in l)l.hasOwnProperty(u)&&(e.isObject(o[u])&&e.isObject(l[u])?o[u]=h(o[u],l[u]):e.isObject(l[u])||e.isArray(l[u])?o[u]=h(l[u]):o[u]=l[u]);for(u in o)e.isObject(o[u])&&o.hasOwnProperty(u)&&!l.hasOwnProperty(u)&&(o[u]=h(o[u]))}}if(1===s)for(var u in o)e.isObject(o[u])&&o.hasOwnProperty(u)&&(o[u]=h(o[u]));return o}var f=function(){function t(t){void 0===t&&(t={}),this.options=t,this.lastValue=0,this.valuePool=[]}return t.prototype.stableFix=function(t){var e=this.options.stableRange||3;return Math.abs(t)<e?0:t>e?t-e:t+e},t.prototype.changeLimit=function(t){var e=this.lastValue,n=t;return Math.abs(t-e)>5&&(n=e<t?e+5:e-5),Math.abs(t-e)<1&&(n=e),this.lastValue=n,n},t.prototype.linearRegressionMedian=function(t){var e,n,o;return this.valuePool.push(t),this.valuePool.length>=5?(n=this.valuePool,o=function(t){var e=[],n=[];t.forEach((function(t,o){e.push(o),n.push(t)}));var o=function(t,e){for(var n={},o=e.length,r=0,i=0,a=0,s=0,c=0,l=0;l<e.length;l++)r+=t[l],i+=e[l],a+=t[l]*e[l],s+=t[l]*t[l],c+=e[l]*e[l];var u=r/o,p=i/o;return n.a=(a-o*u*p)/(s-o*u*u),n.b=p-n.a*u,n.miss=Math.pow((o*a-r*i)/Math.sqrt((o*s-r*r)*(o*c-i*i)),2),n}(e,n);return function(t){return o.a*t+o.b}}(n),n=n.map((function(t,e){return o(e)})),e=o(n.length/2),this.valuePool.shift()):e=this.lastValue,e},t}();var d,v=((d=navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/))?parseInt(d[2],10):0)&&void 0!==window.AlipayJSBridge,m=void 0!==window.WindVane,g={X:!0,Y:!0,interval:Math.floor(1e3/30),useRequestAnimationFrame:!0,relativeBeta:!1,relativeGamma:!1,validRange:{alpha:[-60,60],beta:[-60,180],gamma:[-89,89]},stableRange:3},y=function(){function t(t){void 0===t&&(t={}),this.lastX=0,this.lastY=0,this.prevAcceler={x:0,y:0,z:0},this.stoped=!1,this.options=h(g,t);var e=this.options.stableRange;this.filterX=new f({stableRange:e}),this.filterY=new f({stableRange:e})}return t.prototype.watch=function(t){var e=this;if("function"==typeof t&&!this.watchListener){var n,o,r,i,a,s,c,l=0,u=0,h=0,f=0,d=function(l){e.stoped||(n=l.alpha,o=l.beta,r=l.gamma,f||(f=o||0),h||(h=r||0),p.call(e,{alpha:n,beta:o,gamma:r},e.options.validRange)&&(e.options.X?(i=r-h,s=e.options.relativeGamma?i:r,s=e.filterX.stableFix(s),s=e.filterX.changeLimit(s),s=e.filterX.linearRegressionMedian(+s)):s=0,e.options.Y?(a=o-f,c=e.options.relativeBeta?a:o,c=e.filterY.stableFix(c),c=e.filterY.changeLimit(c),c=e.filterY.linearRegressionMedian(+c)):c=0,e.isValid(s,c)&&(e.options.useRequestAnimationFrame?window.requestAnimationFrame((function(){t(s,c,{alpha:n,beta:o,gamma:r})})):t(s,c,{alpha:n,beta:o,gamma:r}),e.lastX=s,e.lastY=c)))};this.stoped=!1,m?(w(!0,this.options.interval),this.watchListener=function(t){if("param"in t){var n=t.param,o=n.x,r=n.y,i=n.z;if(o===e.prevAcceler.x&&r===e.prevAcceler.y&&i===e.prevAcceler.z)return;e.prevAcceler={x:o,y:r,z:i},d({alpha:180*+i,beta:-90*+r,gamma:90*+o})}},document.addEventListener("motion.gyro",this.watchListener,!1)):v?(b(!0,this.options.interval/1e3),this.watchListener=function(t){if(t&&"data"in t){var e=t.data,n=e.x,o=e.y,r=e.z;d({alpha:180*r,beta:-90*o,gamma:90*n})}},document.addEventListener("accelerometerChange",this.watchListener,!1)):(this.watchListener=function(t){(u=(new Date).getTime())-l>=e.options.interval&&(l=u,d(t))},window.addEventListener("deviceorientation",this.watchListener,!1))}},t.prototype.unWatch=function(){e.assertExist(this.watchListener),m?(w(!1),document.removeEventListener("motion.gyro",this.watchListener)):v?(b(!1),document.removeEventListener("accelerometerChange",this.watchListener)):window.removeEventListener("deviceorientation",this.watchListener),this.stoped=!0,this.watchListener=void 0},t.prototype.pause=function(){this.stoped=!0,v&&b(!1)},t.prototype.continue=function(){this.stoped=!1,v&&b(!0,this.options.interval/1e3)},t.prototype.isValid=function(t,e){return this.lastX!==t||this.lastY!==e},t}();function b(t,e){window.AlipayJSBridge.call("watchShake",{monitorGyroscope:!1,monitorAccelerometer:!!t,interval:t?parseFloat(e.toFixed(3)):10},(function(){}))}function w(t,e){var n={on:t,frequency:e};window.WindVane.call("WVMotion","listenGyro",n,(function(t){console.info("call WVMotion success")}),(function(t){console.error("call WVMotion failed:"+JSON.stringify(t))}))}var M,x=function(){function t(){this.transformers=[],this.connected=!1,this.accelerMotion=null,this.validRange={alpha:[-60,60],beta:[-80,80],gamma:[-89,89]}}return t.prototype.connect=function(){var t=this;this.connected||(this.accelerMotion=new y({X:!0,Y:!0,interval:Math.floor(1e3/60),useRequestAnimationFrame:!0,relativeBeta:!1,relativeGamma:!1,validRange:this.validRange,stableRange:3}),this.accelerMotion.watch((function(e,n){var o={x:e,y:n};t.dispatchMotion(o)}))),this.connected=!0},t.prototype.disconnect=function(){this.accelerMotion&&this.accelerMotion.unWatch(),this.connected=!1},t.prototype.dispatchMotion=function(t){this.transformers.forEach((function(e){return e.update(t)}))},t.prototype.addTransformer=function(t){this.transformers.includes(t)||this.transformers.push(t)},t.prototype.removeTransformer=function(t){var e=this.transformers.indexOf(t);return e>-1&&this.transformers.splice(e,1),0===this.transformers.length},t}();var A=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.order=90,e.adapter=null,e.handleConnect=function(){var t;L||null===(t=e.adapter)||void 0===t||t.connect()},e.handleDisconnect=function(){var t;null===(t=e.adapter)||void 0===t||t.disconnect()},e}return o(e,t),e.prototype.onCompositionConstructed=function(){var t;this.adapter=O(),null===(t=this.adapter)||void 0===t||t.connect(),this.bindAccelerDocumentEvent()},e.prototype.onCompositionReset=function(t){var e,n=t.loaderData.deviceTransformer=new s(t);null===(e=this.adapter)||void 0===e||e.addTransformer(n)},e.prototype.onCompositionUpdate=function(t){var e=t.loaderData.deviceTransformer;e&&e.updateOrientation()},e.prototype.onCompositionDestroyed=function(t){var e,n;(null===(e=this.adapter)||void 0===e?void 0:e.removeTransformer(t.loaderData.deviceTransformer))&&(null===(n=this.adapter)||void 0===n||n.disconnect())},e.prototype.bindAccelerDocumentEvent=function(){this.unbindAccelerDocumentEvent(),document.addEventListener("resume",this.handleConnect,!1),document.addEventListener("pause",this.handleDisconnect,!1),document.addEventListener("back",this.handleDisconnect,!1)},e.prototype.unbindAccelerDocumentEvent=function(){document.removeEventListener("resume",this.handleConnect),document.removeEventListener("pause",this.handleDisconnect),document.removeEventListener("back",this.handleDisconnect)},e.prototype.dispose=function(){O().disconnect(),this.unbindAccelerDocumentEvent()},e}(e.AbstractPlugin),L=!1;function O(){return M||(M=new x),M}var R=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),Object.defineProperty(e.prototype,"type",{get:function(){return"orientation-transformer"},enumerable:!1,configurable:!0}),e.prototype.onConstructed=function(t){var e=t.content.options.targets;e&&(this.targets=e.map((function(t){return{name:t.name,xMin:+t.xMin||0,yMin:+t.yMin||0,xMax:+t.xMax||0,yMax:+t.yMax||0}})))},e.prototype.onItemRemoved=function(t){var e;null===(e=this.targets)||void 0===e||e.forEach((function(e){var n;return null===(n=t.loaderData.deviceTransformer)||void 0===n?void 0:n.removeTarget(e.name)}))},e.prototype.doCreateContent=function(t){var e,n=t.loaderData.deviceTransformer;return n&&(null===(e=this.targets)||void 0===e||e.forEach((function(t){return n.addTarget(t)})),n.initComposition()),{}},e}(e.VFXItem);e.registerPlugin("orientation-transformer",A,R);var E="1.2.1";e.logger.info("plugin orientation transformer version: "+E),t.OrientationAdapterAcceler=x,t.closeDeviceMotion=function(){L=!0,O().disconnect()},t.getAdapter=O,t.openDeviceMotion=function(){L=!1,O().connect()},t.version=E,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
8
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@galacean/effects")):"function"==typeof define&&define.amd?define(["exports","@galacean/effects"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.orientationTransformerPlugin={}),t.ge)}(this,(function(t,e){"use strict";var r=function(t,e){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},r(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var n=function(){return n=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},n.apply(this,arguments)};function o(t,e,r,i){var n,o=arguments.length,a=o<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 s=t.length-1;s>=0;s--)(n=t[s])&&(a=(o<3?n(a):o>3?n(e,r,a):n(e,r))||a);return o>3&&a&&Object.defineProperty(e,r,a),a}function a(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{l(i.next(t))}catch(t){o(t)}}function s(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(a,s)}l((i=i.apply(t,e||[])).next())}))}function s(t,e){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(l){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}}function l(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function c(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var h=function(){function t(t){this.composition=t,this.targets={},this.records={},this.current={},this.gammaRange=[-89,89],this.betaRange=[-80,80]}return t.prototype.update=function(t){var e=t.x,r=t.y;this.currentEvent={x:e,y:r}},t.prototype.updateOrientation=function(){var t=this,e=this.currentEvent;e&&Object.getOwnPropertyNames(this.targets).forEach((function(r){t.moveLayer(r,e)}))},t.prototype.initComposition=function(){for(var t=this.composition.items,e=0;e<t.length;e++){var r=t[e];if(this.targets[r.name]){var i=r.transform.position.toArray(),n=this.current[r.name];if(this.records[r.name]={item:r,position:i},n){var o=u(n,3),a=o[0],s=o[1],l=o[2];r.transform.setPosition(a,s,l)}}}},t.prototype.addTarget=function(t){this.targets[t.name]=t},t.prototype.removeTarget=function(t){delete this.targets[t],delete this.records[t]},t.prototype.moveLayer=function(t,e){var r,i,n=e.x,o=e.y,a=null===(i=this.records[t])||void 0===i?void 0:i.item;if(a){var s=this.records[t].position,l=this.targets[t],h=f(n,this.betaRange),d=f(o,this.gammaRange);if(l){var m=[s[0]+1.2*p((h-this.gammaRange[0])/(this.gammaRange[1]-this.gammaRange[0]),l.xMin,l.xMax),s[1]+1.2*p((d-this.betaRange[0])/(this.betaRange[1]-this.betaRange[0]),l.yMin,l.yMax),s[2]];(r=a.transform).setPosition.apply(r,c([],u(m),!1)),this.current[t]=m.slice()}}},t}();function f(t,e){return t<e[0]?e[0]:t>e[1]?e[1]:t}function p(t,e,r){return e+(r-e)*t}function d(t){return Object.prototype.toString.call(t)}function m(t,e){var r=!0,i=!0,n=!0;if("[object Array]"===d(e.alpha)&&e.alpha.length>=2){var o=t.alpha+e.alpha[0],a=t.alpha+e.alpha[1];r=(o=o<0?o+360:o)<(a=a>360?a-360:a)?t.alpha>o&&t.alpha<a:t.alpha>o||t.alpha<a}return"[object Array]"===d(e.beta)&&e.beta.length>=2&&(i=t.beta>=e.beta[0]&&t.beta<=e.beta[1]),"[object Array]"===d(e.gamma)&&e.gamma.length>=2&&(n=t.gamma>=e.gamma[0]&&t.gamma<=e.gamma[1]),r&&i&&n}function y(t,r){if(!e.isObject(t)&&!e.isArray(t))return t;for(var i=e.isArray(t)?c([],u(t),!1):n({},t),o=arguments.length,a=1;a<o;a++){var s=arguments[a]||{};if(e.isObject(s)){var l=void 0;for(l in s)s.hasOwnProperty(l)&&(e.isObject(i[l])&&e.isObject(s[l])?i[l]=y(i[l],s[l]):e.isObject(s[l])||e.isArray(s[l])?i[l]=y(s[l]):i[l]=s[l]);for(l in i)e.isObject(i[l])&&i.hasOwnProperty(l)&&!s.hasOwnProperty(l)&&(i[l]=y(i[l]))}}if(1===o)for(var l in i)e.isObject(i[l])&&i.hasOwnProperty(l)&&(i[l]=y(i[l]));return i}var v=function(){function t(t){void 0===t&&(t={}),this.options=t,this.lastValue=0,this.valuePool=[]}return t.prototype.stableFix=function(t){var e=this.options.stableRange||3;return Math.abs(t)<e?0:t>e?t-e:t+e},t.prototype.changeLimit=function(t){var e=this.lastValue,r=t;return Math.abs(t-e)>5&&(r=e<t?e+5:e-5),Math.abs(t-e)<1&&(r=e),this.lastValue=r,r},t.prototype.linearRegressionMedian=function(t){var e,r,i;return this.valuePool.push(t),this.valuePool.length>=5?(r=this.valuePool,i=function(t){var e=[],r=[];t.forEach((function(t,i){e.push(i),r.push(t)}));var i=function(t,e){for(var r={},i=e.length,n=0,o=0,a=0,s=0,l=0,u=0;u<e.length;u++)n+=t[u],o+=e[u],a+=t[u]*e[u],s+=t[u]*t[u],l+=e[u]*e[u];var c=n/i,h=o/i;return r.a=(a-i*c*h)/(s-i*c*c),r.b=h-r.a*c,r.miss=Math.pow((i*a-n*o)/Math.sqrt((i*s-n*n)*(i*l-o*o)),2),r}(e,r);return function(t){return i.a*t+i.b}}(r),r=r.map((function(t,e){return i(e)})),e=i(r.length/2),this.valuePool.shift()):e=this.lastValue,e},t}();var g,x=((g=navigator.userAgent.toLowerCase().match(/cpu (iphone )?os (.*?) like mac os/))?parseInt(g[2],10):0)&&void 0!==window.AlipayJSBridge,E=void 0!==window.WindVane,T={X:!0,Y:!0,interval:Math.floor(1e3/30),useRequestAnimationFrame:!0,relativeBeta:!1,relativeGamma:!1,validRange:{alpha:[-60,60],beta:[-60,180],gamma:[-89,89]},stableRange:3},_=function(){function t(t){void 0===t&&(t={}),this.lastX=0,this.lastY=0,this.prevAcceler={x:0,y:0,z:0},this.stoped=!1,this.options=y(T,t);var e=this.options.stableRange;this.filterX=new v({stableRange:e}),this.filterY=new v({stableRange:e})}return t.prototype.watch=function(t){var e=this;if("function"==typeof t&&!this.watchListener){var r,i,n,o,a,s,l,u=0,c=0,h=0,f=0,p=function(u){e.stoped||(r=u.alpha,i=u.beta,n=u.gamma,f||(f=i||0),h||(h=n||0),m.call(e,{alpha:r,beta:i,gamma:n},e.options.validRange)&&(e.options.X?(o=n-h,s=e.options.relativeGamma?o:n,s=e.filterX.stableFix(s),s=e.filterX.changeLimit(s),s=e.filterX.linearRegressionMedian(+s)):s=0,e.options.Y?(a=i-f,l=e.options.relativeBeta?a:i,l=e.filterY.stableFix(l),l=e.filterY.changeLimit(l),l=e.filterY.linearRegressionMedian(+l)):l=0,e.isValid(s,l)&&(e.options.useRequestAnimationFrame?window.requestAnimationFrame((function(){t(s,l,{alpha:r,beta:i,gamma:n})})):t(s,l,{alpha:r,beta:i,gamma:n}),e.lastX=s,e.lastY=l)))};this.stoped=!1,E?(b(!0,this.options.interval),this.watchListener=function(t){if("param"in t){var r=t.param,i=r.x,n=r.y,o=r.z;if(i===e.prevAcceler.x&&n===e.prevAcceler.y&&o===e.prevAcceler.z)return;e.prevAcceler={x:i,y:n,z:o},p({alpha:180*+o,beta:-90*+n,gamma:90*+i})}},document.addEventListener("motion.gyro",this.watchListener,!1)):x?(C(!0,this.options.interval/1e3),this.watchListener=function(t){if(t&&"data"in t){var e=t.data,r=e.x,i=e.y,n=e.z;p({alpha:180*n,beta:-90*i,gamma:90*r})}},document.addEventListener("accelerometerChange",this.watchListener,!1)):(this.watchListener=function(t){(c=(new Date).getTime())-u>=e.options.interval&&(u=c,p(t))},window.addEventListener("deviceorientation",this.watchListener,!1))}},t.prototype.unWatch=function(){e.assertExist(this.watchListener),E?(b(!1),document.removeEventListener("motion.gyro",this.watchListener)):x?(C(!1),document.removeEventListener("accelerometerChange",this.watchListener)):window.removeEventListener("deviceorientation",this.watchListener),this.stoped=!0,this.watchListener=void 0},t.prototype.pause=function(){this.stoped=!0,x&&C(!1)},t.prototype.continue=function(){this.stoped=!1,x&&C(!0,this.options.interval/1e3)},t.prototype.isValid=function(t,e){return this.lastX!==t||this.lastY!==e},t}();function C(t,e){window.AlipayJSBridge.call("watchShake",{monitorGyroscope:!1,monitorAccelerometer:!!t,interval:t?parseFloat(e.toFixed(3)):10},(function(){}))}function b(t,e){var r={on:t,frequency:e};window.WindVane.call("WVMotion","listenGyro",r,(function(t){console.info("call WVMotion success")}),(function(t){console.error("call WVMotion failed:"+JSON.stringify(t))}))}var O,R=function(){function t(){this.transformers=[],this.connected=!1,this.accelerMotion=null,this.validRange={alpha:[-60,60],beta:[-80,80],gamma:[-89,89]}}return t.prototype.connect=function(){var t=this;this.connected||(this.accelerMotion=new _({X:!0,Y:!0,interval:Math.floor(1e3/60),useRequestAnimationFrame:!0,relativeBeta:!1,relativeGamma:!1,validRange:this.validRange,stableRange:3}),this.accelerMotion.watch((function(e,r){var i={x:e,y:r};t.dispatchMotion(i)}))),this.connected=!0},t.prototype.disconnect=function(){this.accelerMotion&&this.accelerMotion.unWatch(),this.connected=!1},t.prototype.dispatchMotion=function(t){this.transformers.forEach((function(e){return e.update(t)}))},t.prototype.addTransformer=function(t){this.transformers.includes(t)||this.transformers.push(t)},t.prototype.removeTransformer=function(t){var e=this.transformers.indexOf(t);return e>-1&&this.transformers.splice(e,1),0===this.transformers.length},t}();var A=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.order=90,e.adapter=null,e.handleConnect=function(){var t;w||null===(t=e.adapter)||void 0===t||t.connect()},e.handleDisconnect=function(){var t;null===(t=e.adapter)||void 0===t||t.disconnect()},e}return i(e,t),e.prototype.onCompositionConstructed=function(){var t;this.adapter=S(),null===(t=this.adapter)||void 0===t||t.connect(),this.bindAccelerDocumentEvent()},e.prototype.onCompositionReset=function(t){var e,r=t.loaderData.deviceTransformer=new h(t);null===(e=this.adapter)||void 0===e||e.addTransformer(r)},e.prototype.onCompositionUpdate=function(t){var e=t.loaderData.deviceTransformer;e&&e.updateOrientation()},e.prototype.onCompositionDestroyed=function(t){var e,r;(null===(e=this.adapter)||void 0===e?void 0:e.removeTransformer(t.loaderData.deviceTransformer))&&(null===(r=this.adapter)||void 0===r||r.disconnect())},e.prototype.bindAccelerDocumentEvent=function(){this.unbindAccelerDocumentEvent(),document.addEventListener("resume",this.handleConnect,!1),document.addEventListener("pause",this.handleDisconnect,!1),document.addEventListener("back",this.handleDisconnect,!1)},e.prototype.unbindAccelerDocumentEvent=function(){document.removeEventListener("resume",this.handleConnect),document.removeEventListener("pause",this.handleDisconnect),document.removeEventListener("back",this.handleDisconnect)},e.prototype.dispose=function(){S().disconnect(),this.unbindAccelerDocumentEvent()},e}(e.AbstractPlugin),w=!1;function S(){return O||(O=new R),O}let I;const M=new Uint8Array(16);function L(){if(!I&&(I="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!I))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return I(M)}const P=[];for(let t=0;t<256;++t)P.push((t+256).toString(16).slice(1));var V,N={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function z(t,e,r){if(N.randomUUID&&!e&&!t)return N.randomUUID();const 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(let t=0;t<16;++t)e[r+t]=i[t];return e}return function(t,e=0){return P[t[e+0]]+P[t[e+1]]+P[t[e+2]]+P[t[e+3]]+"-"+P[t[e+4]]+P[t[e+5]]+"-"+P[t[e+6]]+P[t[e+7]]+"-"+P[t[e+8]]+P[t[e+9]]+"-"+P[t[e+10]]+P[t[e+11]]+P[t[e+12]]+P[t[e+13]]+P[t[e+14]]+P[t[e+15]]}(i)}function D(t,e){return t.includes(e)||t.push(e),t}function F(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function U(t,e,r,i){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);isNaN(i)||(n=Math.min(n,i));var o=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(o);return a.set(t),a}return t}function k(t,e){var r=[0,0,0,0];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: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 t instanceof Array&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:t[3]]);if(e)for(var o=0;o<4;o++)r[o]/=255;return r}function B(t){var e=[];if(t instanceof Array?t.forEach((function(t){var r=u(t,5),i=r[0],n=r[1],o=r[2],a=r[3],s=r[4];e.push({stop:j(i),color:[n,o,a,s]})})):Object.keys(t).forEach((function(r){var i=k(t[r]);e.push({stop:j(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 G(t,e,r,i){var n=[],o=1-r;if(i)for(var a=0;a<4;a++)n[a]=t[a]*o+e[a]*r;else{for(a=0;a<3;a++)n[a]=Math.round(Math.sqrt(t[a]*t[a]*o+e[a]*e[a]*r));n[3]=Math.round(t[3]*o+e[3]*r)}return n}function j(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function X(t){var e=128,r={width:e,height:1,data:new Uint8Array(512)},i=r.data,n=B(t);if(n.length){i.set(n[0].color,0);for(var o=1;o<127;o++){for(var a=o/e,s=void 0,l=void 0,u=0;u<n.length&&(s=n[u],l=n[u+1],!(s.stop<=a&&l.stop>a));u++);var c=G(s.color,l.color,(a-s.stop)/(l.stop-s.stop));i.set(c,4*o)}i.set(n[n.length-1].color,508)}return r}function Y(t,e){void 0===e&&(e=V.ascending);var r=t.length;if(r<=1||e===V.none)return t;if(r<=30){for(var i=1;i<r;i++)H(t,i,e);return t}return W(t,e)}function H(t,e,r){var i=t[e];if(r!==V.ascending)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 W(t,e,r,i){var n,o;if(void 0===r&&(r=0),void 0===i&&(i=t.length-1),r>=i)return t;for(var a=t[r],s=r,l=i;s<l;){if(e===V.ascending){for(;t[l].priority>a.priority&&l>=s;)l--;for(;t[s].priority<=a.priority&&s<l;)s++}else{for(;t[l].priority<a.priority&&l>=s;)l--;for(;t[s].priority>=a.priority&&s<l;)s++}n=u([t[l],t[s]],2),t[s]=n[0],t[l]=n[1]}return o=u([t[s],t[r]],2),t[r]=o[0],t[s]=o[1],W(t,e,r,s-1),W(t,e,l+1,i),t}function Z(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}!function(t){t[t.none=1]="none",t[t.ascending=2]="ascending",t[t.descending=3]="descending"}(V||(V={}));var q=Math.PI/180,Q=180/Math.PI,K=1e-6;function J(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r,o=Math.min(i,n),a=Math.max(i,n);return Math.min(Math.max(t,o),a)}var $,tt=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this},t.prototype.setFromArray=function(t,e){var r,i;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):t instanceof Array?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):t instanceof Array?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):t instanceof Array?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):t instanceof Array?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this},t.prototype.sum=function(){return this.x+this.y},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},t.prototype.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},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.cross=function(t){return this.x*t.y-this.y*t.x},t.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},t.prototype.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},t.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},t.prototype.isZero=function(){var t=K,e=(this,this.x),r=this.y;return Math.abs(e)<=t&&Math.abs(r)<=t},t.prototype.toArray=function(){return[this.x,this.y]},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},t.prototype.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.ONE=new t(1,1),t.ZERO=new t(0,0),t}(),et=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}return t.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},t.prototype.setFromArray=function(t,e){var r,i,n;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this.z=null!==(n=t[e+2])&&void 0!==n?n:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):t instanceof 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},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},t.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):t instanceof 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},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):t instanceof 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},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):t instanceof 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},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.sum=function(){return this.x+this.y+this.z},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.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},t.prototype.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},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},t.prototype.cross=function(t){return this.crossVectors(this,t)},t.prototype.crossVectors=function(t,e){var r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},t.prototype.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},t.prototype.distance=function(t){return Math.sqrt(this.distanceSquared(t))},t.prototype.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},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},t.prototype.isZero=function(){var t,e=K,r=(t=this).x,i=t.y,n=t.z;return Math.abs(r)<=e&&Math.abs(i)<=e&&Math.abs(n)<=e},t.prototype.toArray=function(){return[this.x,this.y,this.z]},t.prototype.toVector2=function(){return new tt(this.x,this.y)},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t.prototype.applyEuler=function(t,e){return t.rotateVector3(this,e)},t.prototype.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},t.prototype.applyMatrix=function(t,e){return t.transformPoint(this,e)},t.prototype.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},t.prototype.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.X=new t(1,0,0),t.Y=new t(0,1,0),t.Z=new t(0,0,1),t.ONE=new t(1,1,1),t.ZERO=new t(0,0,0),t}(),rt=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}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.setFromEuler=function(t){return t.toQuaternion(this),this},t.prototype.setFromAxisAngle=function(e,r){var i=r/2,n=Math.sin(i),o=t.tempVec0;return o.copyFrom(e).normalize(),this.x=o.x*n,this.y=o.y*n,this.z=o.z*n,this.w=Math.cos(i),this},t.prototype.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},t.prototype.setFromRotationMatrix=function(t){var e=t.elements,r=e[0],i=e[4],n=e[8],o=e[1],a=e[5],s=e[9],l=e[2],u=e[6],c=e[10],h=r+a+c;if(h>0){var f=.5/Math.sqrt(h+1);this.w=.25/f,this.x=(u-s)*f,this.y=(n-l)*f,this.z=(o-i)*f}else if(r>a&&r>c){f=2*Math.sqrt(1+r-a-c);this.w=(u-s)/f,this.x=.25*f,this.y=(i+o)/f,this.z=(n+l)/f,this.negate()}else if(a>c){f=2*Math.sqrt(1+a-r-c);this.w=(n-l)/f,this.x=(i+o)/f,this.y=.25*f,this.z=(s+u)/f,this.negate()}else{f=2*Math.sqrt(1+c-r-a);this.w=(o-i)/f,this.x=(n+l)/f,this.y=(s+u)/f,this.z=.25*f,this.negate()}return this},t.prototype.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()},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(J(this.dot(t),-1,1)))},t.prototype.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},t.prototype.identity=function(){return this.set(0,0,0,1)},t.prototype.invert=function(){return this.conjugate()},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},t.prototype.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.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},t.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},t.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},t.prototype.multiplyQuaternions=function(t,e){var r=t.x,i=t.y,n=t.z,o=t.w,a=e.x,s=e.y,l=e.z,u=e.w;return this.x=r*u+o*a+i*l-n*s,this.y=i*u+o*s+n*a-r*l,this.z=n*u+o*l+r*s-i*a,this.w=o*u-r*a-i*s-n*l,this},t.prototype.slerp=function(t,e){var r;if(0===e)return this;if(1===e)return this.copyFrom(t);var i=(r=this).x,n=r.y,o=r.z,a=r.w,s=a*t.w+i*t.x+n*t.y+o*t.z;if(s<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,s=-s):this.copyFrom(t),s>=1)return this.w=a,this.x=i,this.y=n,this.z=o,this;var l=1-s*s;if(l<=Number.EPSILON){var u=1-e;return this.w=u*a+e*this.w,this.x=u*i+e*this.x,this.y=u*n+e*this.y,this.z=u*o+e*this.z,this.normalize(),this}var c=Math.sqrt(l),h=Math.atan2(c,s),f=Math.sin((1-e)*h)/c,p=Math.sin(e*h)/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=o*f+this.z*p,this},t.prototype.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},t.prototype.rotateVector3=function(t,e){var r,i=(r=this).x,n=r.y,o=r.z,a=r.w,s=t.x,l=t.y,u=t.z,c=a*s+n*u-o*l,h=a*l+o*s-i*u,f=a*u+i*l-n*s,p=-i*s-n*l-o*u,d=null!=e?e:t;return d.x=c*a+p*-i+h*-o-f*-n,d.y=h*a+p*-n+f*-i-c*-o,d.z=f*a+p*-o+c*-n-h*-i,d},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},t.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]},t.prototype.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},t.prototype.toEuler=function(t){return t.setFromQuaternion(this)},t.prototype.toMatrix4=function(t){return t.compose(et.ZERO,this,et.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,r){return(new t).setFromAxisAngle(e,r)},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.tempVec0=new et,t}(),it=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a},nt=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},ot=function(){function t(t,e,r,i,n,o,a,s,l,u,c,h,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===o&&(o=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===l&&(l=0),void 0===u&&(u=0),void 0===c&&(c=1),void 0===h&&(h=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,o,a,s,l,u,c,h,f,p,d,m]}return t.prototype.set=function(t,e,r,i,n,o,a,s,l,u,c,h,f,p,d,m){var y=this.elements;return y[0]=t,y[1]=e,y[2]=r,y[3]=i,y[4]=n,y[5]=o,y[6]=a,y[7]=s,y[8]=l,y[9]=u,y[10]=c,y[11]=h,y[12]=f,y[13]=p,y[14]=d,y[15]=m,this},t.prototype.setFromRowMajorData=function(t,e,r,i,n,o,a,s,l,u,c,h,f,p,d,m){var y=this.elements;return y[0]=t,y[4]=e,y[8]=r,y[12]=i,y[1]=n,y[5]=o,y[9]=a,y[13]=s,y[2]=l,y[6]=u,y[10]=c,y[14]=h,y[3]=f,y[7]=p,y[11]=d,y[15]=m,this},t.prototype.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)},t.prototype.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},t.prototype.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[e+r];return this},t.prototype.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},t.prototype.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},t.prototype.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)},t.prototype.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)},t.prototype.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)},t.prototype.setFromRotationAxis=function(e,r){var i=t.tempVec0;i.copyFrom(e).normalize();var n=Math.cos(r),o=Math.sin(r),a=1-n,s=i.x,l=i.y,u=i.z,c=a*s,h=a*l;return this.set(c*s+n,c*l+o*u,c*u-o*l,0,c*l-o*u,h*l+n,h*u+o*s,0,c*u+o*l,h*u-o*s,a*u*u+n,0,0,0,0,1)},t.prototype.setFromEuler=function(t){return t.toMatrix4(this),this},t.prototype.setFromQuaternion=function(t){return this.compose(et.ZERO,t,et.ONE)},t.prototype.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},t.prototype.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)},t.prototype.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},t.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.prototype.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]},t.prototype.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])},t.prototype.copyFrom=function(t){return this.elements=nt([],it(t.elements),!1),this},t.prototype.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])},t.prototype.lookAt=function(e,r,i){var n=t.tempVec0,o=t.tempVec1,a=t.tempVec2;a.subtractVectors(e,r),a.normalize(),n.crossVectors(i,a),n.normalize(),o.crossVectors(a,n);var s=this.elements;return s[0]=n.x,s[1]=o.x,s[2]=a.x,s[3]=0,s[4]=n.y,s[5]=o.y,s[6]=a.y,s[7]=0,s[8]=n.z,s[9]=o.z,s[10]=a.z,s[11]=0,s[12]=-n.dot(e),s[13]=-o.dot(e),s[14]=-a.dot(e),s[15]=1,this},t.prototype.addScaledMatrix=function(t,e){for(var r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[n]*e;return this},t.prototype.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)},t.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},t.prototype.multiplyMatrices=function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],l=r[12],u=r[1],c=r[5],h=r[9],f=r[13],p=r[2],d=r[6],m=r[10],y=r[14],v=r[3],g=r[7],x=r[11],E=r[15],T=i[0],_=i[4],C=i[8],b=i[12],O=i[1],R=i[5],A=i[9],w=i[13],S=i[2],I=i[6],M=i[10],L=i[14],P=i[3],V=i[7],N=i[11],z=i[15];return n[0]=o*T+a*O+s*S+l*P,n[4]=o*_+a*R+s*I+l*V,n[8]=o*C+a*A+s*M+l*N,n[12]=o*b+a*w+s*L+l*z,n[1]=u*T+c*O+h*S+f*P,n[5]=u*_+c*R+h*I+f*V,n[9]=u*C+c*A+h*M+f*N,n[13]=u*b+c*w+h*L+f*z,n[2]=p*T+d*O+m*S+y*P,n[6]=p*_+d*R+m*I+y*V,n[10]=p*C+d*A+m*M+y*N,n[14]=p*b+d*w+m*L+y*z,n[3]=v*T+g*O+x*S+E*P,n[7]=v*_+g*R+x*I+E*V,n[11]=v*C+g*A+x*M+E*N,n[15]=v*b+g*w+x*L+E*z,this},t.prototype.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},t.prototype.determinant=function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],l=t[13],u=t[2],c=t[6],h=t[10],f=t[14];return t[3]*(+n*s*c-i*l*c-n*a*h+r*l*h+i*a*f-r*s*f)+t[7]*(+e*s*f-e*l*h+n*o*h-i*o*f+i*l*u-n*s*u)+t[11]*(+e*l*c-e*a*f-n*o*c+r*o*f+n*a*u-r*l*u)+t[15]*(-i*a*u-e*s*c+e*a*h+i*o*c-r*o*h+r*s*u)},t.prototype.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},t.prototype.invert=function(){var t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],h=t[10],f=t[11],p=t[12],d=t[13],m=t[14],y=t[15],v=c*m*l-d*h*l+d*s*f-a*m*f-c*s*y+a*h*y,g=p*h*l-u*m*l-p*s*f+o*m*f+u*s*y-o*h*y,x=u*d*l-p*c*l+p*a*f-o*d*f-u*a*y+o*c*y,E=p*c*s-u*d*s-p*a*h+o*d*h+u*a*m-o*c*m,T=e*v+r*g+i*x+n*E;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var _=1/T;return t[0]=v*_,t[1]=(d*h*n-c*m*n-d*i*f+r*m*f+c*i*y-r*h*y)*_,t[2]=(a*m*n-d*s*n+d*i*l-r*m*l-a*i*y+r*s*y)*_,t[3]=(c*s*n-a*h*n-c*i*l+r*h*l+a*i*f-r*s*f)*_,t[4]=g*_,t[5]=(u*m*n-p*h*n+p*i*f-e*m*f-u*i*y+e*h*y)*_,t[6]=(p*s*n-o*m*n-p*i*l+e*m*l+o*i*y-e*s*y)*_,t[7]=(o*h*n-u*s*n+u*i*l-e*h*l-o*i*f+e*s*f)*_,t[8]=x*_,t[9]=(p*c*n-u*d*n-p*r*f+e*d*f+u*r*y-e*c*y)*_,t[10]=(o*d*n-p*a*n+p*r*l-e*d*l-o*r*y+e*a*y)*_,t[11]=(u*a*n-o*c*n-u*r*l+e*c*l+o*r*f-e*a*f)*_,t[12]=E*_,t[13]=(u*d*i-p*c*i+p*r*h-e*d*h-u*r*m+e*c*m)*_,t[14]=(p*a*i-o*d*i-p*r*s+e*d*s+o*r*m-e*a*m)*_,t[15]=(o*c*i-u*a*i+u*r*s-e*c*s-o*r*h+e*a*h)*_,this},t.prototype.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},t.prototype.compose=function(t,e,r,i){void 0===i&&(i=et.ZERO);var n=this.elements,o=e.x,a=e.y,s=e.z,l=e.w,u=-i.x,c=-i.y,h=-i.z,f=o+o,p=a+a,d=s+s,m=o*f,y=o*p,v=o*d,g=a*p,x=a*d,E=s*d,T=l*f,_=l*p,C=l*d,b=r.x,O=r.y,R=r.z;return n[0]=(1-(g+E))*b,n[1]=(y+C)*b,n[2]=(v-_)*b,n[3]=0,n[4]=(y-C)*O,n[5]=(1-(m+E))*O,n[6]=(x+T)*O,n[7]=0,n[8]=(v+_)*R,n[9]=(x-T)*R,n[10]=(1-(m+g))*R,n[11]=0,n[12]=u*n[0]+c*n[4]+h*n[8]-u+t.x,n[13]=u*n[1]+c*n[5]+h*n[9]-c+t.y,n[14]=u*n[2]+c*n[6]+h*n[10]-h+t.z,this},t.prototype.decompose=function(e,r,i){var n=t.tempVec0,o=this.elements,a=n.set(o[0],o[1],o[2]).length(),s=n.set(o[4],o[5],o[6]).length(),l=n.set(o[8],o[9],o[10]).length();this.determinant()<0&&(a=-a),e.x=o[12],e.y=o[13],e.z=o[14];var u=t.tempMat0;u.copyFrom(this);var c=1/a,h=1/s,f=1/l;return u.elements[0]*=c,u.elements[1]*=c,u.elements[2]*=c,u.elements[4]*=h,u.elements[5]*=h,u.elements[6]*=h,u.elements[8]*=f,u.elements[9]*=f,u.elements[10]*=f,r.setFromRotationMatrix(u),i.x=a,i.y=s,i.z=l,this},t.prototype.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},t.prototype.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]))},t.prototype.getTransform=function(){var t=new et,e=new rt,r=new et;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},t.prototype.orthographic=function(t,e,r,i,n,o){var a=1/(e-t),s=1/(r-i),l=1/(o-n),u=-(e+t)*a,c=-(r+i)*s,h=-(o+n)*l;a*=2,s*=2,l*=-2;var f=this.elements;return f[0]=a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=l,f[11]=0,f[12]=u,f[13]=c,f[14]=h,f[15]=1,this},t.prototype.perspective=function(t,e,r,i,n){var o=1/Math.tan(.5*t),a=1/(r-i),s=this.elements;return s[0]=n?o:o/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?o*e:o,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(i+r)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*i*r*a,s[15]=0,null!==i&&i!==1/0||(s[10]=-1,s[14]=-2*r),this},t.prototype.projectPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14];var s=o[3]*r+o[7]*i+o[11]*n+o[15];return a.multiply(1/s)},t.prototype.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14],a},t.prototype.transformNormal=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n,a.y=o[1]*r+o[5]*i+o[9]*n,a.z=o[2]*r+o[6]*i+o[10]*n,a.normalize()},t.prototype.transformVector4=function(t,e){var r=t.x,i=t.y,n=t.z,o=t.w,a=this.elements,s=null!=e?e:t;return s.x=a[0]*r+a[4]*i+a[8]*n+a[12]*o,s.y=a[1]*r+a[5]*i+a[9]*n+a[13]*o,s.z=a[2]*r+a[6]*i+a[10]*n+a[14]*o,s.w=a[3]*r+a[7]*i+a[11]*n+a[15]*o,s},t.prototype.equals=function(t){for(var e,r,i=this.elements,n=t.elements,o=0;o<16;o++)if(e=i[o],r=n[o],!(Math.abs(e-r)<K||e===1/0&&r===1/0||e===-1/0&&r===-1/0))return!1;return!0},t.prototype.toArray=function(){return nt([],it(this.elements),!1)},t.prototype.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,o){return(new t).perspective(e,r,i,n,o)},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,o,a,s,l,u,c,h,f,p,d,m,y){return new t(e,o,u,p,r,a,c,d,i,s,h,m,n,l,f,y)},t.IDENTITY=new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),t.ZERO=new t(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),t.tempVec0=new et,t.tempVec1=new et,t.tempVec2=new et,t.tempMat0=new t,t}();!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"}($||($={}));var at=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}return t.prototype.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},t.prototype.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},t.prototype.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var r=t.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],l=r[9],u=r[2],c=r[6],h=r[10];switch(e){case $.XYZ:this.y=Math.asin(J(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-l,h),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(c,s),this.z=0);break;case $.YXZ:this.x=Math.asin(-J(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(o,h),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-u,i),this.z=0);break;case $.ZXY:this.x=Math.asin(J(c,-1,1)),Math.abs(c)<.9999999?(this.y=Math.atan2(-u,h),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,i));break;case $.ZYX:this.y=Math.asin(-J(u,-1,1)),Math.abs(u)<.9999999?(this.x=Math.atan2(c,h),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,s));break;case $.YZX:this.z=Math.asin(J(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-l,s),this.y=Math.atan2(-u,i)):(this.x=0,this.y=Math.atan2(o,h));break;case $.XZY:this.z=Math.asin(-J(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(c,s),this.y=Math.atan2(o,i)):(this.x=Math.atan2(-l,h),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=Q,this.y*=Q,this.z*=Q,this.order=e,this},t.prototype.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},t.prototype.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},t.prototype.setFromArray=function(t,e,r){var i,n,o,a;return void 0===e&&(e=0),void 0===r&&(r=this.order),this.x=null!==(i=t[e])&&void 0!==i?i:0,this.y=null!==(n=t[e+1])&&void 0!==n?n:0,this.z=null!==(o=t[e+2])&&void 0!==o?o:0,this.order=null!==(a=t[e+3])&&void 0!==a?a:r,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.order)},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},t.prototype.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)},t.prototype.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)},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.reorder=function(t){var e=new rt;return e.setFromEuler(this),this.setFromQuaternion(e,t)},t.prototype.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},t.prototype.toVector3=function(t){return t.set(this.x,this.y,this.z)},t.prototype.toArray=function(){return[this.x,this.y,this.z]},t.prototype.toQuaternion=function(t){var e,r=(e=this).x,i=e.y,n=e.z,o=e.order,a=Math.cos(r*q*.5),s=Math.cos(i*q*.5),l=Math.cos(n*q*.5),u=Math.sin(r*q*.5),c=Math.sin(i*q*.5),h=Math.sin(n*q*.5);switch(o){case $.XYZ:t.set(u*s*l+a*c*h,a*c*l-u*s*h,a*s*h+u*c*l,a*s*l-u*c*h);break;case $.YXZ:t.set(u*s*l+a*c*h,a*c*l-u*s*h,a*s*h-u*c*l,a*s*l+u*c*h);break;case $.ZXY:t.set(u*s*l-a*c*h,a*c*l+u*s*h,a*s*h+u*c*l,a*s*l-u*c*h);break;case $.ZYX:t.set(u*s*l-a*c*h,a*c*l+u*s*h,a*s*h-u*c*l,a*s*l+u*c*h);break;case $.YZX:t.set(u*s*l+a*c*h,a*c*l+u*s*h,a*s*h-u*c*l,a*s*l-u*c*h);break;case $.XZY:t.set(u*s*l-a*c*h,a*c*l-u*s*h,a*s*h+u*c*l,a*s*l+u*c*h);break;default:console.error("unknown euler order: "+o)}return t},t.prototype.toMatrix4=function(t){var e,r=t.elements,i=(e=this).x,n=e.y,o=e.z,a=e.order,s=Math.cos(i*q),l=Math.sin(i*q),u=Math.cos(n*q),c=Math.sin(n*q),h=Math.cos(o*q),f=Math.sin(o*q);if(a===$.XYZ){var p=s*h,d=s*f,m=l*h,y=l*f;r[0]=u*h,r[4]=-u*f,r[8]=c,r[1]=d+m*c,r[5]=p-y*c,r[9]=-l*u,r[2]=y-p*c,r[6]=m+d*c,r[10]=s*u}else if(a===$.YXZ){var v=u*h,g=u*f,x=c*h,E=c*f;r[0]=v+E*l,r[4]=x*l-g,r[8]=s*c,r[1]=s*f,r[5]=s*h,r[9]=-l,r[2]=g*l-x,r[6]=E+v*l,r[10]=s*u}else if(a===$.ZXY){v=u*h,g=u*f,x=c*h,E=c*f;r[0]=v-E*l,r[4]=-s*f,r[8]=x+g*l,r[1]=g+x*l,r[5]=s*h,r[9]=E-v*l,r[2]=-s*c,r[6]=l,r[10]=s*u}else if(a===$.ZYX){p=s*h,d=s*f,m=l*h,y=l*f;r[0]=u*h,r[4]=m*c-d,r[8]=p*c+y,r[1]=u*f,r[5]=y*c+p,r[9]=d*c-m,r[2]=-c,r[6]=l*u,r[10]=s*u}else if(a===$.YZX){var T=s*u,_=s*c,C=l*u,b=l*c;r[0]=u*h,r[4]=b-T*f,r[8]=C*f+_,r[1]=f,r[5]=s*h,r[9]=-l*h,r[2]=-c*h,r[6]=_*f+C,r[10]=T-b*f}else if(a===$.XZY){T=s*u,_=s*c,C=l*u,b=l*c;r[0]=u*h,r[4]=-f,r[8]=c*h,r[1]=T*f+b,r[5]=s*h,r[9]=_*f-C,r[2]=C*f-_,r[6]=l*h,r[10]=b*f+T}else console.error("toMatrix4: Invalid order "+a);return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[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.DEFAULT_ORDER=$.ZYX,t.tempQuat0=new rt,t.tempMat0=new ot,t}(),st=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}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},t.prototype.setFromArray=function(t,e){var r,i,n,o;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this.z=null!==(n=t[e+2])&&void 0!==n?n:0,this.w=null!==(o=t[e+3])&&void 0!==o?o:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.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},t.prototype.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},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):t instanceof 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},t.prototype.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},t.prototype.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},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):t instanceof 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},t.prototype.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},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):t instanceof 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},t.prototype.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},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):t instanceof 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},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},t.prototype.sum=function(){return this.x+this.y+this.z+this.w},t.prototype.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},t.prototype.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},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.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},t.prototype.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},t.prototype.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},t.prototype.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},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.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},t.prototype.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},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},t.prototype.isZero=function(){var t,e=K,r=(t=this).x,i=t.y,n=t.z,o=t.w;return Math.abs(r)<=e&&Math.abs(i)<=e&&Math.abs(n)<=e&&Math.abs(o)<=e},t.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]},t.prototype.toVector3=function(){return new et(this.x,this.y,this.z)},t.prototype.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},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},t.prototype.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.ONE=new t(1,1,1,1),t.ZERO=new t(0,0,0,0),t}(),lt=function(){function t(t,e){void 0===t&&(t=et.ZERO),void 0===e&&(e=et.X),this.origin=new et,this.direction=new et,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}return t.prototype.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},t.prototype.clone=function(){return new t(this.origin,this.direction)},t.prototype.copyFrom=function(t){return this.set(t.origin,t.direction)},t.prototype.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},t.prototype.at=function(t,e){var r=e||new et;return r.copyFrom(this.origin),r.addScaledVector(this.direction,t)},t.prototype.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},t.prototype.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},t.prototype.intersectBox=function(t,e){var r,i,n,o,a,s,l,u,c,h,f=(r=this.origin).x,p=r.y,d=r.z,m=(i=this.direction).x,y=i.y,v=i.z,g=(n=t.min).x,x=n.y,E=n.z,T=(o=t.max).x,_=o.y,C=o.z,b=1/m,O=1/y,R=1/v;if(b>=0?(a=(g-f)*b,s=(T-f)*b):(a=(T-f)*b,s=(g-f)*b),O>=0?(l=(x-p)*O,u=(_-p)*O):(l=(_-p)*O,u=(x-p)*O),!(a>u||l>s||((l>a||a!=a)&&(a=l),(u<s||s!=s)&&(s=u),(l>a||a!=a)&&(a=l),(u<s||s!=s)&&(s=u),R>=0?(c=(E-d)*R,h=(C-d)*R):(c=(C-d)*R,h=(E-d)*R),a>h||c>s||((c>a||a!=a)&&(a=c),(h<s||s!=s)&&(s=h),s<0))))return a>=0?this.at(a,e):this.at(s,e)},t.prototype.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 et).copyFrom(this.origin):void 0;var o=-(this.origin.dot(r)+i)/n;return o>=0?this.at(o,e):void 0},t.prototype.intersectSphere=function(e,r){var i=e.center,n=t.tempVec0.subtractVectors(i,this.origin),o=n.dot(this.direction),a=n.dot(n)-o*o,s=e.radius*e.radius;if(!(a>s)){var l=Math.sqrt(s-a),u=o-l,c=o+l;if(!(c<0))return u>=0?this.at(u,r):this.at(c,r)}},t.prototype.intersectTriangle=function(e,r,i){var n,o=e.p0,a=e.p1,s=e.p2,l=t.tempVec0.subtractVectors(a,o),u=t.tempVec1.subtractVectors(s,o),c=t.tempVec2.subtractVectors(this.origin,o),h=t.tempVec3.crossVectors(l,u),f=this.direction.dot(h);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}u.crossVectors(c,u);var p=n*this.direction.dot(u);if(!(p<0)){l.cross(c);var d=n*this.direction.dot(l);if(!(d<0||p+d>f)){var m=-n*c.dot(h);if(!(m<0))return this.at(m/f,r)}}},t.tempVec0=new et,t.tempVec1=new et,t.tempVec2=new et,t.tempVec3=new et,t}();new at,new et(1,1,1),new et(0,0,0);var ut,ct="[Galacean Effects]";function ht(t){return["%c".concat(ct),"background: #AA0100; color: white","".concat(t)]}var ft,pt={error:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.error.apply(console,c(c([],u(ht(t)),!1),[e],!1)),null==ut||ut("error",t,e)},info:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.debug.apply(console,c([],u(ht(t)),!1)),null==ut||ut("info",t,e)},warn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.warn.apply(console,c([],u(ht(t)),!1)),null==ut||ut("warn",t,e)},register:function(t){t&&At(t)&&(ut=t)}};function dt(){}!function(t){t[t.destroy=0]="destroy",t[t.keep=1]="keep",t[t.force=0]="force"}(ft||(ft={}));var mt,yt,vt,gt,xt,Et,Tt,_t,Ct,bt,Ot,Rt=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function At(t){return"[object Function]"===Object.prototype.toString.call(t)}function wt(t,e){return t+Math.random()*(e-t)}function St(){throw Error("destroyed item cannot be used again")}function It(){return z().replace(/-/g,"")}
|
|
9
|
+
/*!
|
|
10
|
+
* Name: @galacean/effects-specification
|
|
11
|
+
* Description: Galacean Effects JSON Specification
|
|
12
|
+
* Author: Ant Group CO., Ltd.
|
|
13
|
+
* Version: v1.0.1
|
|
14
|
+
*/!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(mt||(mt={})),function(t){t[t.ALPHA=0]="ALPHA",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.BRIGHTNESS=3]="BRIGHTNESS",t[t.SUBTRACTION=4]="SUBTRACTION",t[t.STRONG_LIGHT=5]="STRONG_LIGHT",t[t.WEAK_LIGHT=6]="WEAK_LIGHT",t[t.SUPERPOSITION=7]="SUPERPOSITION"}(yt||(yt={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(vt||(vt={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(gt||(gt={})),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"}(xt||(xt={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(Et||(Et={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Tt||(Tt={})),function(t){t[t.NONE=0]="NONE",t[t.NOTIFY=1]="NOTIFY",t[t.RESUME_PLAYER=2]="RESUME_PLAYER",t[t.REMOVE=3]="REMOVE",t[t.PAUSE=4]="PAUSE"}(_t||(_t={})),function(t){t.base="0",t.sprite="1",t.particle="2",t.null="3",t.interact="4",t.plugin="5",t.camera="6",t.composition="7",t.filter="8",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox"}(Ct||(Ct={})),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"}(bt||(bt={})),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"}(Ot||(Ot={}));var Mt,Lt,Pt,Vt,Nt,zt,Dt,Ft,Ut,kt,Bt,Gt,jt,Xt,Yt,Ht,Wt;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(Mt||(Mt={})),function(t){t[t.destroy=0]="destroy",t[t.pause=1]="pause",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.pause_destroy=3]="pause_destroy"}(Lt||(Lt={})),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"}(Pt||(Pt={})),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"}(Vt||(Vt={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(Nt||(Nt={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(zt||(zt={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Dt||(Dt={})),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"}(Ft||(Ft={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Ut||(Ut={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(kt||(kt={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(Bt||(Bt={})),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"}(Gt||(Gt={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(jt||(jt={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Xt||(Xt={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(Yt||(Yt={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Ht||(Ht={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Wt||(Wt={}));var Zt={},qt={},Qt={};function Kt(t){var e=t.constructor.name;if(Qt[e])return Qt[e];Qt[e]={};for(var r=Qt[e],i=t,n=e;n;){var o=qt[n];for(var a in o)r[a]=o[a];var s=Object.getPrototypeOf(i);if("Object"===(n=Object.getPrototypeOf(s).constructor.name))break;i=s}return r}function Jt(t){return function(t,e){return function(r,i){var n=function(t){var e=t.constructor.name;return qt[e]||(qt[e]={}),qt[e]}(r);n[i]||(n[i]={type:t,sourceName:e})}}(0,t)}function $t(t){return function(e,r){Zt[t]&&console.warn("Class "+t+" 重复注册"),Zt[t]=e}}var te,ee=function(){function t(t){this.engine=t,this.guid=It(),this.taggedProperties={},this.engine.addInstance(this)}return t.prototype.getInstanceId=function(){return this.guid},t.prototype.setInstanceId=function(t){this.engine.removeInstance(this.guid),this.guid=t,this.engine.addInstance(this)},t.prototype.toData=function(){},t.prototype.fromData=function(t){t.id&&this.setInstanceId(t.id)},t.prototype.dispose=function(){},o([Jt()],t.prototype,"guid",void 0),t}(),re=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),Object.defineProperty(e.prototype,"transform",{get:function(){return this.item.transform},enumerable:!1,configurable:!0}),e.prototype.onAttached=function(){},e.prototype.onDestroy=function(){},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e),e.item&&(this.item=e.item)},e.prototype.dispose=function(){this.onDestroy(),this.item&&F(this.item.components,this)},e}(ee),ie=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._enabled=!0,e}return i(e,t),Object.defineProperty(e.prototype,"isActiveAndEnabled",{get:function(){return this.item.getVisible()&&this.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onBehaviourEnable()},enumerable:!1,configurable:!0}),e.prototype.onBehaviourEnable=function(){},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e)},e.prototype.toData=function(){t.prototype.toData.call(this)},o([Jt()],e.prototype,"_enabled",void 0),e}(re),ne=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.started=!1,e}return i(e,t),e.prototype.onEnable=function(){},e.prototype.start=function(){},e.prototype.update=function(t){},e.prototype.lateUpdate=function(t){},e.prototype.onAttached=function(){this.item.itemBehaviours.push(this)},e.prototype.dispose=function(){this.item&&F(this.item.itemBehaviours,this),t.prototype.dispose.call(this)},e.prototype.onBehaviourEnable=function(){this.onEnable(),this.started||(this.start(),this.started=!0)},e}(ie),oe=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.started=!1,e.materials=[],e._enabled=!0,e}return i(e,t),Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},set:function(t){this._priority=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this._enabled=t,t&&this.onEnable()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isActiveAndEnabled",{get:function(){return this.item.getVisible()&&this.enabled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this.materials[0]},set:function(t){0===this.materials.length?this.materials.push(t):this.materials[0]=t},enumerable:!1,configurable:!0}),e.prototype.onEnable=function(){},e.prototype.start=function(){},e.prototype.update=function(t){},e.prototype.lateUpdate=function(t){},e.prototype.render=function(t){},e.prototype.onAttached=function(){this.item.rendererComponents.push(this)},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e)},e.prototype.toData=function(){t.prototype.toData.call(this)},e.prototype.dispose=function(){this.item&&F(this.item.rendererComponents,this),t.prototype.dispose.call(this)},o([Jt()],e.prototype,"materials",void 0),o([Jt()],e.prototype,"_priority",void 0),o([Jt()],e.prototype,"_enabled",void 0),e}(re);!function(t){t[t.vertex=0]="vertex",t[t.fragment=1]="fragment"}(te||(te={}));var ae,se=[],le={};function ue(t){for(var e in t)/^[A-Z_]/.test(e)&&(le[e]=t[e])}function ce(t){switch(t){case yt.ALPHA:case yt.ADD:case yt.SUBTRACTION:case yt.STRONG_LIGHT:case yt.WEAK_LIGHT:return 1;case yt.SUPERPOSITION:return 2;case yt.BRIGHTNESS:return 3;case yt.MULTIPLY:return 0;default:return 1}}se.length||function(){"function"==typeof WebGL2RenderingContext?ue(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(ue(WebGLRenderingContext),ue(WebGLRenderingContext.prototype)):se.push("iOS16 lockdown mode, WebGL Constants not in global");se.length||"HALF_FLOAT"in le||(le.HALF_FLOAT=5131)}();var he,fe,pe=((ae={})[te.vertex]={in:"attribute",out:"varying"},ae[te.fragment]={in:"varying"},ae);function de(t,e,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),t&&(t.forEach((function(t){var e=u(t,2),r=e[0],i=e[1];!0===i?n.push("#define ".concat(r)):Number.isFinite(i)&&n.push("#define ".concat(r," ").concat(i))})),o=n.length?n.join("\n")+"\n":"");var a="WEBGL".concat(i),s=(o+="\n#ifndef ".concat(a,"\n#define ").concat(a,"\n#endif"))+"\n"+e,l=s.match(/#version\s+\b\d{3}\b\s*(es)?/),c=l?l[0]:"";if(c&&c.includes("300")){var h=new RegExp("".concat(c),"g");1===i&&(s=s.replace(/\b(in|out)\b/g,(function(t){var e;return null!==(e=pe[r][t])&&void 0!==e?e:t}))),s=s.replace(h,"\n")}return s}function me(t,e){switch(e){case void 0:case yt.ALPHA:t.blendFunction=[le.ONE,le.ONE_MINUS_SRC_ALPHA,le.ONE,le.ONE_MINUS_SRC_ALPHA];break;case yt.ADD:t.blendFunction=[le.ONE,le.ONE,le.ONE,le.ONE];break;case yt.SUBTRACTION:t.blendFunction=[le.ONE,le.ONE,le.ZERO,le.ONE],t.blendEquation=[le.FUNC_REVERSE_SUBTRACT,le.FUNC_REVERSE_SUBTRACT];break;case yt.SUPERPOSITION:t.blendFunction=[le.ONE,le.ONE,le.ONE,le.ONE];break;case yt.MULTIPLY:t.blendFunction=[le.DST_COLOR,le.ONE_MINUS_SRC_ALPHA,le.DST_COLOR,le.ONE_MINUS_SRC_ALPHA];break;case yt.BRIGHTNESS:t.blendFunction=[le.ONE,le.ONE_MINUS_SRC_ALPHA,le.ONE,le.ONE_MINUS_SRC_ALPHA];break;case yt.STRONG_LIGHT:t.blendFunction=[le.DST_COLOR,le.DST_ALPHA,le.ZERO,le.ONE];break;case yt.WEAK_LIGHT:t.blendFunction=[le.DST_COLOR,le.ZERO,le.ZERO,le.ONE];break;default:console.warn("blendMode ".concat(e," not in specification, please set blend params separately"))}}function ye(t,e){e===vt.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=le.CW,t.cullFace=e===vt.BACK?le.BACK:le.FRONT)}function ve(t,e){switch(e){case void 0:t.stencilTest=!1;break;case gt.MASK:t.stencilTest=!0,t.stencilFunc=[le.ALWAYS,le.ALWAYS],t.stencilOpZPass=[le.REPLACE,le.REPLACE];break;case gt.OBSCURED:t.stencilTest=!0,t.stencilFunc=[le.EQUAL,le.EQUAL];break;case gt.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[le.NOTEQUAL,le.NOTEQUAL];break;case gt.NONE:t.stencilTest=!1;break;default:console.warn("maskMode ".concat(e," not in specification, please set stencil params seperately"))}}!function(t){t[t.whatever=0]="whatever",t[t.clear=2]="clear"}(he||(he={})),function(t){t[t.none=0]="none",t[t.data=1]="data",t[t.image=2]="image",t[t.compressed=3]="compressed",t[t.video=4]="video",t[t.canvas=5]="canvas",t[t.framebuffer=6]="framebuffer",t[t.mipmaps=7]="mipmaps"}(fe||(fe={}));var ge,xe=1,Ee=function(t){function e(e){var r=t.call(this,e)||this;return r.destroyed=!1,r.id="Tex"+xe++,r}return i(e,t),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getWidth=function(){return this.width||0},e.prototype.getHeight=function(){return this.height||0},e.prototype.uploadCurrentVideoFrame=function(){},e.prototype.offloadData=function(){},e.prototype.reloadData=function(){},e.prototype.initialize=function(){},e.prototype.assembleOptions=function(t){var e=t.target,r=void 0===e?le.TEXTURE_2D:e,i=t.format,o=void 0===i?le.RGBA:i;return t.sourceType||(t.sourceType="image"in t?fe.image:"data"in t?fe.data:"video"in t?fe.video:0),n({minFilter:le.NEAREST,magFilter:le.NEAREST,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE,target:r,format:le.RGBA,internalFormat:o,type:le.UNSIGNED_BYTE},t)},e}(ee);function Te(t,e,r,i){var n,o,a=e.length/r/i;return o=n=4===a||0===a?le.RGBA:3===a?le.RGB:2===a?le.LUMINANCE_ALPHA:le.LUMINANCE,Ee.createWithData(t,{data:e,width:r,height:i},{type:le.HALF_FLOAT,format:n,internalFormat:o,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE})}!function(t){t[t.normal=0]="normal",t[t.transformFeedback=1]="transformFeedback"}(ge||(ge={}));var _e,Ce,be=1,Oe=function(t){function e(e,r){var i=t.call(this,e)||this;if(i.destroyed=!1,i.initialized=!1,r){var o=r.name,a=void 0===o?"Material"+be++:o,s=r.renderType,l=void 0===s?ge.normal:s,u=r.shader,c=r.uniformSemantics;i.name=a,i.renderType=l,i.shaderSource=u,i.props=r,i.uniformSemantics=n({},c)}else i.name="Material"+be++,i.renderType=ge.normal;return i}return i(e,t),Object.defineProperty(e.prototype,"blending",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendFunction",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendEquation",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthTest",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilTest",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilRef",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFunc",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpZPass",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"culling",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontFace",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cullFace",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendColor",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthRange",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthFunc",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polygonOffsetFill",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polygonOffset",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sampleAlphaToCoverage",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpFail",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpZFail",{set:function(t){},enumerable:!1,configurable:!0}),e.prototype.initialize=function(){},e.prototype.use=function(t,e){},e}(ee);!function(t){t[t.noShader=0]="noShader",t[t.success=1]="success",t[t.fail=2]="fail",t[t.compiling=3]="compiling"}(_e||(_e={})),function(t){t.GLSL1="100",t.GLSL3="300 es"}(Ce||(Ce={})),function(t){function e(e,r){var i=t.call(this,e)||this;return i.source=r,i}i(e,t)}(ee);var Re="effects-internal-copy",Ae="precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\n".concat("uniform vec2 uFilterSourceSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));return mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}","\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n fragColor = filterMain(vTex,uFilterSource);\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n");function we(t,e){var r=2===t,i=r?"#version 300 es":"";return{name:Re,vertex:de([],i+"\n\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",te.vertex,t),fragment:de([],i+"\n"+Ae,te.fragment,t),glslVersion:r?Ce.GLSL3:Ce.GLSL1,marcos:[["WEBGL2",!!r],["DEPTH_TEXTURE",!!e]],cacheId:"effects-internal-copy-mesh"+ +e}}var Se,Ie={format:le.RGBA,type:le.UNSIGNED_BYTE,minFilter:le.LINEAR,magFilter:le.LINEAR,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE},Me=Symbol("dispose"),Le=function(){function t(t){this.textureCache={},this.textureRef={},this.engine=t}return t.prototype.requestColorAttachmentTexture=function(t){var e=this,r=t.width,i=t.height,n=t.name,o={sourceType:fe.framebuffer,data:{width:r,height:i},name:n},a=[n];Object.getOwnPropertyNames(Ie).forEach((function(e){var r,i=null!==(r=t[e])&&void 0!==r?r:Ie[e];o[e]=i,a.push(e,i)}));var s=a.join(":"),l=this.textureCache[s];if(l)this.textureRef[s]++;else{var u=this.engine;Z(u),l=Ee.create(u,o),this.textureCache[s]=l,this.textureRef[s]=1,l[Me]=l.dispose,l.dispose=function(){return e.removeTexture(s)}}return l},t.prototype.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[Me](),r.dispose=r[Me]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},t.prototype.dispose=function(){var t=this;Object.keys(this.textureCache).forEach((function(e){var r=t.textureCache[e];r[Me](),r.dispose=r[Me]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),Pe=function(){function t(t){void 0===t&&(t={}),this.semantics=n({},t)}return t.prototype.toObject=function(){return n({},this.semantics)},t.prototype.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},t.prototype.getSemanticValue=function(t,e){var r=this.semantics[t];return At(r)?r(e):r},t.prototype.hasSemanticValue=function(t){return t in this.semantics},t.prototype.dispose=function(){var t=this;Object.keys(this.semantics).forEach((function(e){delete t.semantics[e]}))},t}();(Se={})[le.FLOAT]=Float32Array.BYTES_PER_ELEMENT,Se[le.INT]=Int32Array.BYTES_PER_ELEMENT,Se[le.SHORT]=Int16Array.BYTES_PER_ELEMENT,Se[le.BYTE]=Int8Array.BYTES_PER_ELEMENT;var Ve,Ne,ze=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.initialize=function(){},e.prototype.flush=function(){},e}(ee),De=1,Fe=function(t){function e(e,r){var i=t.call(this,e)||this;if(i.destroyed=!1,i.visible=!0,r){var n=r.material,o=r.geometry,a=r.name,s=void 0===a?"<unnamed>":a,l=r.priority,u=void 0===l?0:l,c=r.worldMatrix,h=void 0===c?ot.fromIdentity():c;i.id="Mesh"+De++,i.name=s,i.geometry=o,i.material=n,i.priority=u,i.worldMatrix=h}else i.id="Mesh"+De++,i.name="<unnamed>",i.worldMatrix=ot.fromIdentity(),i._priority=0;return i}return i(e,t),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.setVisible=function(t){this.visible=t},e.prototype.getVisible=function(){return this.visible},e.prototype.render=function(t){if(!this.isDestroyed&&this.getVisible()){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix),r.flush(),t.drawGeometry(r,e)}},e.prototype.firstGeometry=function(){return this.geometry},e.prototype.setMaterial=function(t,e){e!==ft.keep&&this.material.dispose(e),this.material=t},e.prototype.restore=function(){},e.prototype.dispose=function(t){if(!this.destroyed){(null==t?void 0:t.geometries)!==ft.keep&&this.geometry.dispose();var e=null==t?void 0:t.material;e!==ft.keep&&this.material.dispose(e),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},e}(oe);!function(t){t[t.none=0]="none",t[t.color=1]="color",t[t.stencil_8_opaque=2]="stencil_8_opaque",t[t.depth_16_opaque=3]="depth_16_opaque",t[t.depth_stencil_opaque=4]="depth_stencil_opaque",t[t.depth_16_texture=5]="depth_16_texture",t[t.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture"}(Ve||(Ve={})),function(t){t[t.store=0]="store",t[t.clear=2]="clear"}(Ne||(Ne={}));var Ue,ke=function(){function t(t,e){if(this.destroyed=!1,e){var r=e.texture,i=e.size;if(r instanceof Ee)this.texture=r,this.externalTexture=!0;else if(r){var o=r.wrapT,a=r.wrapS,s=r.minFilter,l=r.magFilter,u=r.internalFormat,c=r.format,h=void 0===c?le.RGBA:c,f=r.type,p=void 0===f?le.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:i,format:h,type:p,internalFormat:u||h,wrapT:o,wrapS:a,minFilter:s,magFilter:l,name:e.name},this.texture=Ee.create(t,n(n({},this.textureOptions),{sourceType:fe.framebuffer,data:{width:i[0],height:i[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"storageType",{get:function(){return Ve.color},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.texture.getWidth()||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.texture.getHeight()||0},enumerable:!1,configurable:!0}),t}();!function(t){t[t.force=0]="force",t[t.keep=1]="keep",t[t.keepExternal=2]="keepExternal",t[t.destroy=0]="destroy"}(Ue||(Ue={}));var Be=1,Ge=function(){function t(t,e){this.attachments=[],this.destroyed=!1,this.initialized=!1;var r=e.name,i=void 0===r?"RenderPass_"+Be++:r,o=e.clearAction,a=e.semantics,s=e.depthStencilAttachment,l=e.storeAction,u=e.priority,c=void 0===u?0:u,h=e.meshOrder,f=void 0===h?V.ascending:h,p=e.meshes,d=void 0===p?[]:p,m=e.delegate,y=void 0===m?{}:m;this.name=i,this.renderer=t,this.priority=c,this.meshOrder=f,this.meshes=Y(d.slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||Ve.none,this.clearAction=n({},o),this.storeAction=n({colorAction:Ne.store,depthAction:Ne.store,stencilAction:Ne.store},l),this.semantics=new Pe(a),this.options=e,this.delegate=y,this.setViewportOptions(e)}return Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewport",{get:function(){return this.getViewport()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilAttachment",{get:function(){return this.getStencilAttachment()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthAttachment",{get:function(){return this.getDepthAttachment()},enumerable:!1,configurable:!0}),t.prototype.addMesh=function(t){var e,r,i;e=this.meshes,r=t,void 0===(i=this.meshOrder)&&(i=V.ascending),e.includes(r)||(e.push(r),1===e.length||i!==V.none&&H(e,e.length-1,i))},t.prototype.removeMesh=function(t){F(this.meshes,t)},t.prototype.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,c([0,0],u(t),!1)),Y(this.meshes,this.meshOrder),this.meshes},t.prototype.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},t.prototype.configure=function(t){if(this.frameBuffer)t.setFrameBuffer(this.frameBuffer);else{var e=u(this.getViewport(),4),r=e[0],i=e[1],n=e[2],o=e[3];t.setViewport(r,i,n,o)}},t.prototype.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},t.prototype.frameCleanup=function(t){},t.prototype.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:fe.framebuffer}),new ke(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}}))})},t.prototype.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},t.prototype.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)},t.prototype._resetAttachments=function(){var t,e,r=this,i=this.renderer,o=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null===(t=this.frameBuffer)||void 0===t||t.dispose({depthStencilAttachment:Ue.keepExternal}),this.frameBuffer=null);var a=this.viewportScale,s=this.isCustomViewport?this.customViewport:[0,0,i.getWidth()*a,i.getHeight()*a],l=[s[2],s[3]],u=this.name;if(null===(e=o.attachments)||void 0===e?void 0:e.length){var c=o.attachments.map((function(t,e){var i;return new ke(r.renderer.engine,n({size:l,name:(null===(i=t.texture)||void 0===i?void 0:i.name)||"".concat(u,"##color_").concat(e)},t))}));this.attachments=c;var h=cr.create({storeAction:this.storeAction,name:u,viewport:s,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:c.map((function(t){return t.texture})),depthStencilAttachment:o.depthStencilAttachment||{storageType:Ve.none}},i);h.bind(),h.unbind(),this.frameBuffer=h}else this.attachments.length=0},t.prototype.getViewport=function(){var t,e=(null===(t=this.frameBuffer)||void 0===t?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]},t.prototype.getDepthAttachment=function(){var t=this.frameBuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:t.getDepthTexture()?this.getDepthTexture(t.getDepthTexture(),t.externalStorage):void 0}},t.prototype.getStencilAttachment=function(){var t=this.frameBuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:t.getStencilTexture()?this.getStencilTexture(t.getStencilTexture(),t.externalStorage):void 0}},t.prototype.getDepthTexture=function(t,e){var r;if(!this.depthTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},t.prototype.getStencilTexture=function(t,e){var r;if(!this.stencilTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},t.prototype.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},t.prototype.dispose=function(t){var e,r;if(!this.destroyed){var i=(null==t?void 0:t.meshes)||void 0;i!==ft.keep&&this.meshes.forEach((function(t){t.dispose(i)})),this.meshes.length=0;var n=(null==t?void 0:t.colorAttachment)?t.colorAttachment:Ue.force;this.attachments.forEach((function(t){t.externalTexture&&n===Ue.keepExternal||n===Ue.keep||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==ft.keep&&this.semantics.dispose(),this.destroyed=!0;var o=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:Ue.force,a=this.frameBuffer;if(a)a.dispose({depthStencilAttachment:o}),a.externalStorage&&o===Ue.keepExternal||o===Ue.keep||(null===(e=this.stencilTexture)||void 0===e||e.dispose(),null===(r=this.depthTexture)||void 0===r||r.dispose());this.options=this.renderer=null,this.initialize=St}},t}(),je="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}",Xe="precision highp float;attribute vec2 atlasOffset;attribute vec3 aPos;varying vec2 vTexCoord;varying vec3 vParams;varying vec4 vColor;uniform vec4 _Color;uniform vec4 _TexParams;uniform vec4 _TexOffset;uniform mat4 effects_MatrixVP;uniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;\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);vec4 pos=vec4(aPos.xyz,1.0);gl_Position=effects_MatrixVP*effects_ObjectToWorld*pos;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",Ye="precision highp float;varying vec4 vColor;varying vec2 vTexCoord;varying vec3 vParams;uniform sampler2D uSampler0;vec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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.);vec4 texColor=texture2D(uSampler0,vTexCoord.xy);color=blendColor(texColor,vColor,floor(0.5+vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}color.a=clamp(color.a,0.0,1.0);gl_FragColor=color;}",He="#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(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\nin float vLife;in vec2 vTexCoord;in 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\nin vec4 vTexCoordBlend;\n#ifdef USE_FILTER\nuniform vec4 uFSprite;\n#endif\n#endif\nin 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(){fragColor=uPreviewColor;}\n#else\n#pragma FILTER_FRAG\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}\n#ifdef USE_FILTER\n#ifdef USE_SPRITE\ntexOffset=uTexOffset/uFSprite.xy;\n#endif\ncolor=filterMain(vTexCoord,uMaskTex);\n#else\nif(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#endif\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);fragColor=color;}\n#endif\n",We="#version 300 es\nprecision highp float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(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 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}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;}else 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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}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==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}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.;}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#pragma EDITOR_VERT_DEFINE\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 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out vec2 vTexCoord;\n#ifdef USE_FILTER\n#pragma FILTER_VERT\n#endif\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;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}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\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void 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\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\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 USE_FILTER\nfilterMain(life);\n#endif\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n#pragma EDITOR_VERT_TRANSFORM\n}}",Ze="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\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#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\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\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(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++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).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++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(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;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}in vec4 aPos;in vec3 aDir;in vec3 aInfo;in vec4 aColor;in float aTime;\n#ifdef ATTR_TRAIL_START\nin float aTrailStart;\n#else\nuniform float uTrailStart[64];in 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\nout float vLife;out vec2 vTexCoord;out 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}",qe="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",Qe=function(t){function e(e,r){var i=t.call(this,e,r)||this,n=i.renderer.engine,o=ze.create(n,{mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),a=Oe.create(n,{shader:{vertex:qe,fragment:"precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainColor=texture2D(_MainTex,uv);mainColor.rgb=pow(mainColor.rgb,vec3(2.2));float brightness=max(mainColor.r,max(mainColor.g,mainColor.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainColor.rgb*=w;gl_FragColor=vec4(mainColor.rgb,1.0);}",glslVersion:Ce.GLSL1}});return a.blending=!1,a.depthTest=!1,a.culling=!1,i.screenMesh=Fe.create(n,{geometry:o,material:a,priority:0}),i.priority=5e3,i}return i(e,t),e.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear({colorAction:Ne.clear,depthAction:Ne.clear,stencilAction:Ne.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var e=t.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",e),t.renderMeshes([this.screenMesh])},e}(Ge),Ke=function(t){function e(e,r,i){var n=t.call(this,e,i)||this;n.type=r;var o=n.renderer.engine,a="PostProcess",s=ze.create(o,{name:a,mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),l={vertex:qe,fragment:"H"==r?"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);}":"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);}",glslVersion:Ce.GLSL1},u=Oe.create(o,{name:a,shader:l});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=Fe.create(o,{name:a,geometry:s,material:u,priority:0}),n.priority=5e3,n}return i(e,t),e.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear({colorAction:Ne.clear,depthAction:Ne.clear,stencilAction:Ne.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",nr(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFrameBuffer().getColorTextures()[0])},e}(Ge),Je=function(t){function e(e,r){var i=t.call(this,e,r)||this,n="PostProcess",o=i.renderer.engine,a=ze.create(o,{name:n,mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s={vertex:qe,fragment:"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);}"},l=Oe.create(o,{name:n,shader:s});return l.blending=!1,l.depthTest=!1,l.culling=!1,i.screenMesh=Fe.create(o,{name:n,geometry:a,material:l,priority:0}),i.priority=5e3,i}return i(e,t),e.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear({colorAction:Ne.clear,depthAction:Ne.clear,stencilAction:Ne.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",nr(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},e}(Ge),$e=function(t){function e(e,r){var i=t.call(this,e,{})||this,n="PostProcess",o=i.renderer.engine;i.sceneTextureHandle=r||new ke(o);var a=ze.create(o,{name:n,mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=Oe.create(o,{name:n,shader:{vertex:qe,fragment:"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;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));}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;}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));}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",glslVersion:Ce.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,i.screenMesh=Fe.create(o,{name:n,geometry:a,material:s,priority:0}),i.priority=5e3,i}return i(e,t),e.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFrameBuffer(null)},e.prototype.execute=function(t){t.clear({colorAction:Ne.clear,depthAction:Ne.clear,stencilAction:Ne.clear});var e=t.renderingData.currentFrame.globalVolume,r=e.bloomIntensity,i=e.brightness,n=e.saturation,o=e.contrast,a=e.useBloom,s=e.useToneMapping;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",i),this.screenMesh.material.setFloat("_Saturation",n),this.screenMesh.material.setFloat("_Contrast",o),this.screenMesh.material.setInt("_UseBloom",a),a&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",r)),this.screenMesh.material.setInt("_UseToneMapping",s),t.renderMeshes([this.screenMesh])},e}(Ge),tr={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,useToneMapping:1},er="_effects_default_",rr=1,ir=function(){function t(t){var e;this.renderQueue=[],this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var r=t.camera,i=t.keepColorBuffer,o=t.renderer,a=t.editorTransform,s=void 0===a?[1,1,0,0]:a,l=t.globalVolume,u=t.clearAction,c=void 0===u?{colorAction:he.whatever,stencilAction:he.clear,depthAction:he.whatever}:u,h=o.engine;l&&(this.globalVolume=n(n({},tr),l)),this.globalUniforms=new lr;var f,p=[],d={};if(this.renderer=o,this.globalVolume){var m=this.globalVolume.useHDR?le.HALF_FLOAT:le.UNSIGNED_BYTE;p=[{texture:{format:le.RGBA,type:m,magFilter:le.LINEAR,minFilter:le.LINEAR}}],f={storageType:Ve.depth_stencil_opaque},d={colorAction:he.clear,stencilAction:he.clear,depthAction:he.clear}}var y=[new Ge(o,{name:er,priority:1e3,meshOrder:V.ascending,depthStencilAttachment:f,attachments:p,clearAction:d})];if(this.setRenderPasses(y),this.globalVolume){var v=this.globalVolume.useBloom,g=new ke(h);if(v){var x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],E=new Array(7),T=(m=this.globalVolume.useHDR?le.HALF_FLOAT:le.UNSIGNED_BYTE,new Qe(o,{name:"BloomThresholdPass",attachments:[{texture:{format:le.RGBA,type:m,minFilter:le.LINEAR,magFilter:le.LINEAR}}]}));T.sceneTextureHandle=g,this.addRenderPass(T);for(var _=0;_<7;_++){E[_]=new ke(h);var C=new Ke(o,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:le.RGBA,type:m,minFilter:le.LINEAR,magFilter:le.LINEAR}}]}),b=new Ke(o,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:le.RGBA,type:m,minFilter:le.LINEAR,magFilter:le.LINEAR}}]});b.gaussianResult=E[_],this.addRenderPass(C),this.addRenderPass(b),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(_=0;_<6;_++){var O=new Je(o,{name:"GaussianUpPass"+_,viewport:x,attachments:[{texture:{format:le.RGBA,type:m,minFilter:le.LINEAR,magFilter:le.LINEAR}}]});O.gaussianDownSampleResult=E[5-_],this.addRenderPass(O),x[2]*=2,x[3]*=2}}var R=void 0;R=v?new $e(o,g):new $e(o),this.addRenderPass(R)}this.semantics=new Pe(t.semantics),this.clearAction=c,this.name="RenderFrame".concat(rr++);var A=y[0],w={type:le.UNSIGNED_BYTE,format:le.RGBA,internalFormat:le.RGBA,wrapS:le.MIRRORED_REPEAT,wrapT:le.MIRRORED_REPEAT,minFilter:le.NEAREST,magFilter:le.NEAREST};this.emptyTexture=Ee.create(h,n({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:fe.data},w)),this.transparentTexture=Ee.create(h,n({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:fe.data},w)),this.camera=r,this.keepColorBuffer=i,this.renderPassInfoMap.set(A,{listStart:0,listEnd:0,renderPass:A,intermedia:!1}),this.editorTransform=st.fromArray(s),t.clearAction||this.resetClearActions(),this.passTextureCache=new Le(h);var S=h.gpuCapability,I=S.detail,M=we(S.level,I.readableDepthStencilTextures&&I.writableFragDepth);null===(e=this.renderer.getShaderLibrary())||void 0===e||e.addShader(M)}return Object.defineProperty(t.prototype,"renderPasses",{get:function(){return this._renderPasses.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.addMeshToDefaultRenderPass=function(t){t&&this.renderPasses[0].addMesh(t)},t.prototype.removeMeshFromDefaultRenderPass=function(t){},t.prototype.dispose=function(t){var e,r;(null==t?void 0:t.semantics)!==ft.keep&&this.semantics.dispose();var i=(null==t?void 0:t.passes)?t.passes:void 0;i!==ft.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=null===(e=this.resource.depthStencil)||void 0===e?void 0:e.texture)||void 0===r||r.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},t.prototype.resetRenderPassDefaultAttachment=function(t,e){for(var r,i,n,o=this.resource,a=o.color_a,s=o.color_b,l=e;l<t.length;l++){var u=t[l],c=null===(r=u.attachments[0])||void 0===r?void 0:r.texture;if(c&&n===c){var h=c===a?s:a;u.resetColorAttachments([h])}(c=null===(i=u.attachments[0])||void 0===i?void 0:i.texture)&&(n=c)}},t.prototype.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(er)||!r.meshes.includes(t)||(e=i,!1)})),e},t.prototype.addToRenderPass=function(t,e){var r=this.renderPassInfoMap.get(t),i=e.priority;0===t.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),t.addMesh(e)},t.prototype.getRPAttachments=function(t,e){var r;if(1===(null==t?void 0:t.length)){var i=t[0],n=i.texture,o=i.persistent,a=n.format,s=null!==(r=null==e?void 0:e.getInitAttachments())&&void 0!==r?r:[];if(a===le.RGBA&&!o){var l=this.resource.color_a;return 0===s.length?[{texture:l}]:[{texture:s[0].texture===l?this.resource.color_b:l}]}}return t},t.prototype.resetClearActions=function(){var t=this.renderPasses.length>1?he.clear:he.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=he.whatever)},t.prototype.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},t.prototype.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},t.prototype.createResource=function(){var t,e=this.renderer.engine;if(!this.resource){var r=e.gpuCapability,i=r.detail,n=r.level,o=this.renderer.getWidth(),a=this.renderer.getHeight(),s=2===n?le.LINEAR:le.NEAREST,l=Ee.create(e,{sourceType:fe.framebuffer,format:le.RGBA,name:"frame_a",minFilter:s,magFilter:s}),u=Ee.create(e,{sourceType:fe.framebuffer,format:le.RGBA,data:{width:o,height:a},minFilter:s,magFilter:s,name:"frame_b"}),c=i.readableDepthStencilTextures&&i.writableFragDepth?Ve.depth_24_stencil_8_texture:Ve.depth_stencil_opaque,h=new Ge(this.renderer,{depthStencilAttachment:{storageType:c},attachments:[{texture:l}]}).initialize(this.renderer),f=new sr(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:he.clear,stencilAction:he.clear,colorAction:he.clear},meshOrder:V.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null===(t=h.getDepthAttachment())||void 0===t?void 0:t.texture})]});this.resource={color_a:h.attachments[0].texture,color_b:u,finalCopyRP:f,depthStencil:h.depthAttachment,resRP:h}}},t.prototype.createCopyMesh=function(t){var e=Re,r=this.renderer.engine,i=ze.create(r,{name:e,mode:le.TRIANGLE_STRIP,attributes:{aPos:{type:le.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=we(r.gpuCapability.level,!!(null==t?void 0:t.depthTexture));this.renderer.getShaderLibrary().addShader(n);var o=Oe.create(r,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:e,shader:n});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==t?void 0:t.blend)&&(o.blending=!0,o.blendFunction=[le.SRC_ALPHA,le.ONE_MINUS_SRC_ALPHA,le.SRC_ALPHA,le.ONE_MINUS_SRC_ALPHA]),Fe.create(r,{name:e,geometry:i,material:o,priority:0})},t.prototype.removeRenderPass=function(t){F(this._renderPasses,t)},t}();function nr(t){return t?new tt(t.getWidth(),t.getHeight()):new tt}var or,ar,sr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(null)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",nr(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(Ge),lr=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]};!function(t){t[t.Nearest=0]="Nearest",t[t.Linear=1]="Linear"}(or||(or={})),function(t){t[t.RGBA32=0]="RGBA32",t[t.RGBAHalf=1]="RGBAHalf"}(ar||(ar={}));var ur,cr=function(){function t(){}return t.prototype.resize=function(t,e,r,i){},t.prototype.resetColorTextures=function(t){},t.prototype.unbind=function(){},t.prototype.bind=function(){},Object.defineProperty(t.prototype,"stencilStorage",{get:function(){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthStorage",{get:function(){},enumerable:!1,configurable:!0}),t.prototype.getDepthTexture=function(){},t.prototype.getStencilTexture=function(){},t.prototype.getColorTextures=function(){return[]},t.prototype.dispose=function(t){},t}(),hr=function(){function t(){}return t.collectSerializableObject=function(t,e){var r,i,n,o,a,s;if(!e[t.getInstanceId()]){t.toData(),e[t.getInstanceId()]=t;var u=Kt(t);try{for(var c=l(Object.keys(u)),h=c.next();!h.done;h=c.next()){var f=h.value,p=t.taggedProperties[f];if(void 0===p&&(p=t[f]),p instanceof ee)this.collectSerializableObject(p,e);else if(p instanceof Array)try{for(var d=(n=void 0,l(p)),m=d.next();!m.done;m=d.next()){var y=m.value;y instanceof ee&&this.collectSerializableObject(y,e)}}catch(t){n={error:t}}finally{try{m&&!m.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}else if(p instanceof Object)try{for(var v=(a=void 0,l(Object.keys(p))),g=v.next();!g.done;g=v.next()){var x=p[g.value];x instanceof ee&&this.collectSerializableObject(x,e)}}catch(t){a={error:t}}finally{try{g&&!g.done&&(s=v.return)&&s.call(v)}finally{if(a)throw a.error}}}}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}},t.serializeEffectObject=function(e){var r,i,o={},a=e.engine,s=n({},a.jsonSceneData);t.collectSerializableObject(e,o);try{for(var u=l(Object.keys(o)),c=u.next();!c.done;c=u.next()){var h=o[c.value];s[h.getInstanceId()]||(s[h.getInstanceId()]={}),t.serializeTaggedProperties(h,s[h.getInstanceId()])}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return s},t.serializeTaggedProperties=function(e,r){var i,n,o,a;e.toData(),r||(r={});var s=Kt(e);try{for(var u=l(Object.keys(s)),c=u.next();!c.done;c=u.next()){"number"==typeof(p=e[d=c.value])||"string"==typeof p||"boolean"==typeof p||t.checkTypedArray(p)?r[d]=p:p instanceof Array?(r[d]||(r[d]=[]),t.serializeArrayProperty(p,r[d],0)):p instanceof ee?r[d]={id:p.getInstanceId()}:p instanceof Object&&(r[d]||(r[d]={}),t.serializeObjectProperty(p,r[d],0))}}catch(t){i={error:t}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(i)throw i.error}}try{for(var h=l(Object.keys(e.taggedProperties)),f=h.next();!f.done;f=h.next()){var p,d=f.value;"number"==typeof(p=e.taggedProperties[d])||"string"==typeof p||"boolean"==typeof p||t.checkTypedArray(p)?r[d]=p:p instanceof Array?(r[d]||(r[d]=[]),t.serializeArrayProperty(p,r[d],0)):p instanceof ee?r[d]={id:p.getInstanceId()}:p instanceof Object&&(r[d]||(r[d]={}),t.serializeObjectProperty(p,r[d],0))}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=h.return)&&a.call(h)}finally{if(o)throw o.error}}return r},t.deserializeTaggedProperties=function(e,r){var i,n,o,a,s=r.taggedProperties,u=Kt(r),c=r.engine;try{for(var h=l(Object.keys(e)),f=h.next();!f.done;f=h.next()){if(!u[y=f.value]){var p=e[y];s[y]=t.deserializeProperty(p,c,0)}}}catch(t){i={error:t}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}try{for(var d=l(Object.keys(u)),m=d.next();!m.done;m=d.next()){var y;void 0!==(p=e[y=m.value])&&(r[y]=t.deserializeProperty(p,c,0))}}catch(t){o={error:t}}finally{try{m&&!m.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}r.fromData(s)},t.deserializeTaggedPropertiesAsync=function(e,r){return a(this,void 0,void 0,(function(){var i,n,o,a,u,c,h,f,p,d,m,y,v,g,x,E,T,_,C;return s(this,(function(s){switch(s.label){case 0:i=r.taggedProperties,n=Kt(r),o=r.engine,s.label=1;case 1:s.trys.push([1,6,7,8]),a=l(Object.keys(e)),u=a.next(),s.label=2;case 2:return u.done?[3,5]:(m=u.value,n[m]?[3,4]:(y=e[m],c=i,h=m,[4,t.deserializePropertyAsync(y,o,0)]));case 3:c[h]=s.sent(),s.label=4;case 4:return u=a.next(),[3,2];case 5:return[3,8];case 6:return f=s.sent(),E={error:f},[3,8];case 7:try{u&&!u.done&&(T=a.return)&&T.call(a)}finally{if(E)throw E.error}return[7];case 8:s.trys.push([8,13,14,15]),p=l(Object.keys(n)),d=p.next(),s.label=9;case 9:return d.done?[3,12]:(m=d.value,void 0===(y=e[m])?[3,11]:(v=r,g=m,[4,t.deserializePropertyAsync(y,o,0)]));case 10:v[g]=s.sent(),s.label=11;case 11:return d=p.next(),[3,9];case 12:return[3,15];case 13:return x=s.sent(),_={error:x},[3,15];case 14:try{d&&!d.done&&(C=p.return)&&C.call(p)}finally{if(_)throw _.error}return[7];case 15:return r.fromData(i),[2]}}))}))},t.checkTypedArray=function(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array},t.checkDataPath=function(t){return t instanceof Object&&1===Object.keys(t).length&&t.id&&32===t.id.length},t.deserializeProperty=function(e,r,i){var n,o,a,s;if(i>10)console.error("序列化数据的内嵌对象层数大于上限");else{if("number"==typeof e||"string"==typeof e||"boolean"==typeof e)return e;if(e instanceof Array){var u=[];try{for(var c=l(e),h=c.next();!h.done;h=c.next()){var f=h.value;u.push(t.deserializeProperty(f,r,i+1))}}catch(t){n={error:t}}finally{try{h&&!h.done&&(o=c.return)&&o.call(c)}finally{if(n)throw n.error}}return u}if(t.checkDataPath(e))return r.assetLoader.loadGUID(e.id);if(e instanceof ee||t.checkTypedArray(e))return e;if(e instanceof Object){u={};try{for(var p=l(Object.keys(e)),d=p.next();!d.done;d=p.next()){var m=d.value;u[m]=t.deserializeProperty(e[m],r,i+1)}}catch(t){a={error:t}}finally{try{d&&!d.done&&(s=p.return)&&s.call(p)}finally{if(a)throw a.error}}return u}}},t.deserializePropertyAsync=function(e,r,i){return a(this,void 0,void 0,(function(){var n,o,a,u,c,h,f,p,d,m,y,v,g,x,E,T,_;return s(this,(function(s){switch(s.label){case 0:return i>10?(console.error("序列化数据的内嵌对象层数大于上限"),[2]):"number"!=typeof e&&"string"!=typeof e&&"boolean"!=typeof e?[3,1]:[2,e];case 1:if(!(e instanceof Array))return[3,10];f=[],s.label=2;case 2:s.trys.push([2,7,8,9]),n=l(e),o=n.next(),s.label=3;case 3:return o.done?[3,6]:(a=o.value,c=(u=f).push,[4,t.deserializePropertyAsync(a,r,i+1)]);case 4:c.apply(u,[s.sent()]),s.label=5;case 5:return o=n.next(),[3,3];case 6:return[3,9];case 7:return h=s.sent(),x={error:h},[3,9];case 8:try{o&&!o.done&&(E=n.return)&&E.call(n)}finally{if(x)throw x.error}return[7];case 9:return[2,f];case 10:return t.checkDataPath(e)?[4,r.assetLoader.loadGUIDAsync(e.id)]:[3,12];case 11:return[2,f=s.sent()];case 12:return e instanceof ee||t.checkTypedArray(e)?[2,e]:[3,13];case 13:if(!(e instanceof Object))return[3,22];f={},s.label=14;case 14:s.trys.push([14,19,20,21]),p=l(Object.keys(e)),d=p.next(),s.label=15;case 15:return d.done?[3,18]:(m=d.value,y=f,v=m,[4,t.deserializePropertyAsync(e[m],r,i+1)]);case 16:y[v]=s.sent(),s.label=17;case 17:return d=p.next(),[3,15];case 18:return[3,21];case 19:return g=s.sent(),T={error:g},[3,21];case 20:try{d&&!d.done&&(_=p.return)&&_.call(p)}finally{if(T)throw T.error}return[7];case 21:return[2,f];case 22:return[2]}}))}))},t.serializeObjectProperty=function(e,r,i){var n,o;if(i>10)console.error("序列化数据的内嵌对象层数大于上限");else{r||(r={});try{for(var a=l(Object.keys(e)),s=a.next();!s.done;s=a.next()){var u=s.value,c=e[u];"number"==typeof c||"string"==typeof c||"boolean"==typeof c||t.checkTypedArray(e)?r[u]=c:c instanceof Array?(r[u]||(r[u]=[]),t.serializeArrayProperty(c,r[u],i+1)):c instanceof ee?r[u]={id:c.getInstanceId()}:c instanceof Object&&(r[u]||(r[u]={}),t.serializeObjectProperty(c,r[u],i+1))}}catch(t){n={error:t}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}}},t.serializeArrayProperty=function(e,r,i){if(i>10)console.error("序列化数据的内嵌对象层数大于上限");else{r||(r=[]);for(var n=0;n<e.length;n++){var o=e[n];"number"==typeof o||"string"==typeof o||"boolean"==typeof o||t.checkTypedArray(e)?r[n]=o:o instanceof Array?(r[n]||(r[n]=[]),this.serializeArrayProperty(o,r[n],i+1)):o instanceof ee?r[n]={id:o.getInstanceId()}:o instanceof Object&&(r[n]||(r[n]={}),t.serializeObjectProperty(o[n],r[n],i+1))}}},t}(),fr=function(){function t(t){this.engine=t}return t.prototype.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 ur.Material:r=Oe.create(this.engine);break;case ur.Geometry:r=ze.create(this.engine);break;case ur.Texture:return r=Ee.create(this.engine,i);case ur.Shader:r=this.engine.getShaderLibrary().createShader(i);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),hr.deserializeTaggedProperties(i,r),r;console.error("未找到 DataType: "+i.dataType+"的构造函数")}else console.error("未找到 uuid: "+e+"的对象数据")},t.prototype.loadGUIDAsync=function(e){return a(this,void 0,void 0,(function(){var r,i,n;return s(this,(function(o){switch(o.label){case 0:return this.engine.objectInstance[e]?[2,this.engine.objectInstance[e]]:(i=this.findData(e))?[3,2]:this.engine.database?[4,this.engine.database.loadGUID(e)]:(console.error("未找到 uuid: "+e+"的对象数据"),[2,void 0]);case 1:return(r=o.sent())?(this.engine.addInstance(r),[2,r]):(console.error("未找到 uuid: "+e+"的磁盘数据"),[2,void 0]);case 2:switch(i.dataType){case ur.Material:r=Oe.create(this.engine);break;case ur.Geometry:r=ze.create(this.engine);break;case ur.Texture:return[2,r=Ee.create(this.engine,i)];case ur.Shader:r=this.engine.getShaderLibrary().createShader(i);break;default:(n=t.getClass(i.dataType))&&(r=new n(this.engine))}return r?(r.setInstanceId(i.id),this.engine.addInstance(r),[4,hr.deserializeTaggedPropertiesAsync(i,r)]):(console.error("未找到 DataType: "+i.dataType+"的构造函数"),[2,void 0]);case 3:return o.sent(),[2,r]}}))}))},t.prototype.findData=function(t){return this.engine.jsonSceneData[t]},t.getClass=function(t){return Zt[t]},t}();!function(t){t[t.VFXItemData=0]="VFXItemData",t[t.EffectComponent=1]="EffectComponent",t[t.Material=2]="Material",t[t.Shader=3]="Shader",t[t.SpriteComponent=4]="SpriteComponent",t[t.ParticleSystem=5]="ParticleSystem",t[t.InteractComponent=6]="InteractComponent",t[t.CameraController=7]="CameraController",t[t.Geometry=8]="Geometry",t[t.Texture=9]="Texture",t[t.TextComponent=10]="TextComponent",t[t.MeshComponent=1e4]="MeshComponent",t[t.SkyboxComponent=10001]="SkyboxComponent",t[t.LightComponent=10002]="LightComponent",t[t.CameraComponent=10003]="CameraComponent",t[t.ModelPluginComponent=10004]="ModelPluginComponent",t[t.TreeComponent=10005]="TreeComponent"}(ur||(ur={}));var pr,dr,mr,yr=function(){function t(){this.order=100,this.name=""}return t.precompile=function(t,e){return Promise.resolve()},t.prototype.onCompositionConstructed=function(t,e){},t.prototype.onCompositionItemLifeBegin=function(t,e){},t.prototype.onCompositionItemLifeEnd=function(t,e){},t.prototype.onCompositionItemRemoved=function(t,e){},t.prototype.onCompositionReset=function(t,e){},t.prototype.onCompositionWillReset=function(t,e){},t.prototype.onCompositionDestroyed=function(t){},t.prototype.onCompositionUpdate=function(t,e){},t.prototype.prepareRenderFrame=function(t,e){return!1},t.prototype.postProcessFrame=function(t,e){},t}(),vr=(pr=new Float32Array(1),dr=new Int32Array(pr.buffer),function(t){pr[0]=t;var e=dr[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)}),gr=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]=vr(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=vr(t[r])},t}(),xr=new at,Er=new ot;function Tr(t,e,r,i,n,o,a){var s=t,l=i/n,u=i,c=e.speedOverLifetime;c&&(u=c.getIntegrateValue(0,i,n));var h=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;s.copyFrom(o),s.addScaledVector(a,u),s.addScaledVector(r,h);var f=e.linearVelOverLifetime||{},p=e.orbitalVelOverLifetime||{},d=["x","y","z"];if(p.enabled){var m=new et;p.center&&m.setFromArray(p.center);var y=s.clone().subtract(m),v=p.asRotation,g=d.map((function(t){var e=p[t];return e?v?e.getValue(l):e.getIntegrateValue(0,i,n):0}));xr.setFromArray(g).negate(),Er.setFromEuler(xr);var x=Er.transformPoint(y);s.addVectors(m,x)}if(f.enabled)for(var E=f.asMovement,T=0;T<3;T++){var _=f[d[T]];if(_){var C=E?_.getValue(l):_.getIntegrateValue(0,i,n);s.setElement(T,s.getElement(T)+C)}}return s}function _r(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}var Cr,br=((mr={})[Ot.PARTICLE_ORIGIN_CENTER]=[0,0],mr[Ot.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],mr[Ot.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],mr[Ot.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],mr[Ot.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],mr[Ot.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],mr[Ot.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],mr[Ot.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],mr[Ot.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],mr);function Or(t,e){return t?[t[0]-.5,.5-t[1]]:e?br[e]:[0,0]}function Rr(t,e,r){var i=t.x,n=t.y,o=t.z,a=new et(i-e,n+r,o),s=new et(i-e,n-r,o),l=new et(i+e,n-r,o),u=new et(i+e,n+r,o);return[{p0:a,p1:s,p2:l},{p0:a.clone(),p1:l.clone(),p2:u}]}var Ar="not_implement",wr=function(){function t(t){this.onCreate(t)}return t.prototype.onCreate=function(t){throw Error(Ar)},t.prototype.getIntegrateValue=function(t,e,r){throw Error(Ar)},t.prototype.getIntegrateByTime=function(t,e){throw Error(Ar)},t.prototype.getValue=function(t){throw Error(Ar)},t.prototype.toUniform=function(t){throw Error(Ar)},t.prototype.map=function(t){throw Error(Ar)},t.prototype.scaleXCoord=function(t){return this},t}(),Sr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.onCreate=function(t){this.value=t},e.prototype.getIntegrateValue=function(t,e,r){return this.value*(e-t)},e.prototype.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},e.prototype.getValue=function(t){return this.value},e.prototype.toUniform=function(){return new Float32Array([0,this.value,0,0])},e.prototype.map=function(t){var e=this.value;return this.value=t(e),this},e}(wr),Ir=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.onCreate=function(t){this.items=t},e.prototype.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},e.prototype.map=function(t){return this.items=this.items.map(t),this},e}(wr),Mr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1]},e.prototype.getValue=function(t){return wt(this.min,this.max)},e.prototype.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},e.prototype.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(wr),Lr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1]},e.prototype.getValue=function(t){for(var e=this.min,r=this.max,i=[],n=0;n<e.length;n++){var o=Math.random();i[n]=e[n]*(1-o)+r[n]*o}return i},e.prototype.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(wr),Pr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},e.prototype.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},e.prototype.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},e.prototype.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=this.min,n=this.max,o=this.xCoord*r;return((i+e/o*(n-i)+i)*e-(i+t/o*(n-i)+i)*t)/2},e.prototype.getIntegrateByTime=function(t,e){return Gr(e,0,this.xCoord,this.min,this.max)-Gr(t,0,this.xCoord,this.min,this.max)},e.prototype.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e.prototype.scaleXCoord=function(t){return this.xCoord=t,this},e}(wr),Vr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.onCreate=function(t){this.stops=B(t)},e.prototype.getStops=function(){return this.stops},e.prototype.getValue=function(t){for(var e=this.stops,r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1];if(n.stop<=t&&o.stop>t){var a=(t-n.stop)/(o.stop-n.stop);return G(n.color,o.color,a,!0)}}return e[r].color.slice()},e}(wr),Nr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.getAllData=function(t,e){for(var r=new(e?gr:Float32Array)(4*t.index),i=0,n=0,o=t.curves;i<o.length;i++){var a=o[i].toData();r.set(a,n),n+=a.length}return e?r.data:r},e.prototype.onCreate=function(t){var e=1/0,r=-1/0;if(Number.isFinite(t[0])&&Number.isFinite(t[1])){for(var i=[],n=2;n<t.length;n++)i.push(t[n].slice(0,4));this.keys=i,this.min=t[0],this.dist=t[1]-t[0]}else{i=t.map((function(t){if(Rt(t))return e=Math.min(e,t[1]),r=Math.max(r,t[1]),t.slice(0,4);if("object"==typeof t&&t){var i=t,n=i.time,o=i.value,a=i.inTangent,s=void 0===a?0:a,l=i.outTangent,u=void 0===l?0:l;return e=Math.min(e,o),r=Math.max(r,o),[n,o,s,u]}throw new Error("invalid keyframe")}));var o=r-e;if(this.keys=i,0!==o)for(n=0;n<i.length;n++){var a=i[n];a[1]=(a[1]-e)/o}var s=i[0];s[0]>0&&(s[2]=0,i.unshift([0,s[1],0,0]));var l=i[i.length-1];l[0]<1&&(l[3]=0,i.push([1,l[1],0,0])),this.min=e,this.dist=o}this.isCurveValue=!0},e.prototype.getValue=function(t){var e=this,r=e.keys,i=e.min,n=e.dist,o=r;if(t<=o[0][0])return o[0][1]*n+i;for(var a=o.length-1,s=0;s<a;s++){var l=o[s],u=o[s+1];if(t>l[0]&&t<=u[0])return jr(t,l,u)*n+i}return o[a][1]*n+i},e.prototype.getIntegrateByTime=function(t,e){var r=this.integrate(e,!0)-this.integrate(t,!0);return.5*this.min*(e-t)*(e-t)+r*this.dist},e.prototype.getIntegrateValue=function(t,e,r){r=r||1;var i=(this.integrate(e/r,!1)-this.integrate(t/r,!1))*r,n=(e-t)/r;return this.min*n+i*this.dist},e.prototype.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,o=e?Yr:Xr,a=0;a<n;a++){var s=r[a],l=r[a+1],u=s[0],c=l[0];if(t>u&&t<=c)return i+o(t,s,l);i+=o(c,s,l)}return i},e.prototype.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},e.prototype.toUniform=function(t){var e=t.index,r=this.keys;return t.curves.push(this),t.index+=r.length,t.max=Math.max(t.max,r.length),t.curveCount+=r.length,new Float32Array([2,e+1/r.length,this.min,this.dist])},e.prototype.map=function(t){return this.keys.forEach((function(e){e[1]=t(e[1])})),this},e.prototype.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(wr),zr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.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},e.prototype.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],o=e[i+1],a=n[0],s=o[0];if(t>=a&&t<=s){var l=(t-a)/(s-a),u=n[1];return u+l*(o[1]-u)}}return e[r][1]},e.prototype.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},e.prototype.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},e.prototype.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,o=e?Gr:Br,a=0;a<n;a++){var s=r[a],l=r[a+1],u=s[0],c=l[0];if(t>u&&t<=c)return i+o(t,u,c,s[1],l[1]);i+=o(c,u,c,s[1],l[1])}return i},e.prototype.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},e.prototype.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])},e.prototype.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},e.prototype.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(wr),Dr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.onCreate=function(t){this.keys=t[0],this.values=t[1]},e.prototype.getValue=function(t){for(var e=this.keys,r=this.values,i=0;i<e.length-1;i++){var n=e[i],o=e[i+1];if(n[0]<=t&&o[0]>=t){var a=o[1]-n[1],s=void 0;if(0===a)s=(t-n[0])/(o[0]-n[0]);else s=(jr(t,n,o)-n[1])/a;return this.calculateVec(i,s)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},e.prototype.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=[0,0,0],o=0;o<r.length;o++)n[o]=r[o]*(1-e)+i[o]*e;return n},e}(wr),Fr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.onCreate=function(e){t.prototype.onCreate.call(this,e),this.cps=e[2]},e.prototype.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=this.cps[t+t],o=this.cps[t+t+1],a=[0,0,0],s=1-e,l=s*s*s,u=3*e*s*s,c=3*e*e*s,h=e*e*e,f=0;f<r.length;f++)a[f]=l*r[f]+u*n[f]+c*o[f]+h*i[f];return a},e}(Dr),Ur=((Cr={})[Pt.RANDOM]=function(t){return t[0]instanceof Array?new Lr(t):new Mr(t)},Cr[Pt.CONSTANT]=function(t){return new Sr(t)},Cr[Pt.CONSTANT_VEC2]=function(t){return new Sr(t)},Cr[Pt.CONSTANT_VEC3]=function(t){return new Sr(t)},Cr[Pt.CONSTANT_VEC4]=function(t){return new Sr(t)},Cr[Pt.CURVE]=function(t){return new Nr(t)},Cr[Pt.RGBA_COLOR]=function(t){return new Sr(t)},Cr[Pt.COLORS]=function(t){return new Ir(t.map((function(t){return k(t,!1)})))},Cr[Pt.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new Pr([t[0][1],t[1][1]]):new zr(t)},Cr[Pt.GRADIENT_COLOR]=function(t){return new Vr(t)},Cr[Pt.LINEAR_PATH]=function(t){return new Dr(t)},Cr[Pt.BEZIER_PATH]=function(t){return new Fr(t)},Cr);function kr(t){if(!t||!isNaN(+t))return new Sr(t||0);if(t instanceof wr)return t;if(At(Ur[t[0]]))return Ur[t[0]](t[1]);throw new Error("ValueType: ".concat(t[0]," is not support"))}function Br(t,e,r,i,n){var o=t-e;return(i+i+(n-i)*o/(r-e))*o/2}function Gr(t,e,r,i,n){var o=t*t,a=e*e;return(2*(o*t)*(i-n)+3*o*(e*n-r*i)-a*e*(2*i+n)+3*a*r*i)/(6*(e-r))}function jr(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=(t-e[0])/i,s=a*a,l=s*a,u=l-2*s+a,c=l-s,h=-2*l+3*s;return(2*l-3*s+1)*e[1]+u*n+c*o+h*r[1]}function Xr(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=e[0],s=e[1],l=r[1],u=a-t,c=u*u,h=c*u;return(n+o+2*s-2*l)*h*u/(4*i*i*i)+(2*n+o+3*s-3*l)*h/(3*i*i)+n*c/2/i-s*u}function Yr(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=e[0],s=e[1],l=r[1],u=a-t,c=u*u,h=c*u,f=i*i,p=f*i;return(-30*p*s*(a+t)*u+10*f*n*(a+2*t)*c+5*i*(a+3*t)*(2*n+o+3*s-3*l)*h+3*(a+4*t)*(n+o+2*s-2*l)*h*u)/60/p}function Hr(t,e){if(e){var r=e[0],i=e[1];if(r===Pt.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===Pt.LINE){if(2===(n=i.length)&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++;var o=Math.ceil(n/2);t.lineSegCount+=o,t.curves.push(i),t.index+=o,t.max=Math.max(t.max,o)}}}var Wr=new rt,Zr=1,qr=function(){function t(t,e){void 0===t&&(t={}),this.taggedProperties={},this.position=new et(0,0,0),this.quat=new rt(0,0,0,1),this.rotation=new at(0,0,0),this.scale=new et(1,1,1),this.anchor=new et(0,0,0),this.size=new tt(1,1),this.children=[],this.worldMatrix=ot.fromIdentity(),this.localMatrix=ot.fromIdentity(),this.valid=!0,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new et(0,0,0),quat:new rt(0,0,0,1),scale:new et(1,1,1)},this.name="transform_".concat(Zr++),t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}return t.getRotation=function(t,e){var r=Wr.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},Object.defineProperty(t.prototype,"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)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentMatrixDirty",{get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())},enumerable:!1,configurable:!0}),t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.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())},t.prototype.rotateByQuat=function(t){this.quat.multiply(t),this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.scaleBy=function(t,e,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.setAnchor=function(t,e,r){this.anchor.x===t&&this.anchor.y===e&&this.anchor.z===r||(this.anchor.x=t,this.anchor.y=e,this.anchor.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.setTransform=function(t,e){var r,i=t.position,n=t.rotation,o=t.scale,a=t.quat,s=t.name,l=t.anchor;if(s&&(this.name=s),i&&(i instanceof et?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),a)a instanceof rt?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(n){var u=e?-1:1;n instanceof at?this.setRotation(n.x*u,n.y*u,n.z*u):this.setRotation(n[0]*u,n[1]*u,n[2]*u)}o&&(o instanceof et?this.setScale(o.x,o.y,o.z):this.setScale(o[0],o[1],o[2])),l&&(l instanceof et?this.setAnchor(l.x,l.y,l.z):this.setAnchor(l[0],l[1],null!==(r=l[2])&&void 0!==r?r:0))},t.prototype.addChild=function(t){D(this.children,t)},t.prototype.removeChild=function(t){F(this.children,t)},t.prototype.getRotation=function(){return t.getRotation(this.quat,new at)},t.prototype.getQuaternion=function(){return this.quat},t.prototype.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.localMatrix.multiply(new ot(this.size.x,0,0,0,0,this.size.y,0,0,0,0,1,0,0,0,0,1)),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},t.prototype.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},t.prototype.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},t.prototype.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},t.prototype.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()},t.prototype.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},t.prototype.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new at)},t.prototype.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)},t.prototype.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},t.prototype.getValid=function(){return this.valid},t.prototype.toData=function(){var t=this.taggedProperties;return t.position=this.position.clone(),t.rotation={x:this.rotation.x,y:this.rotation.y,z:this.rotation.z},t.scale=this.scale.clone(),t},t.prototype.fromData=function(t){var e={position:(new et).copyFrom(t.position),rotation:new at(t.rotation.x,t.rotation.y,t.rotation.z),scale:(new et).copyFrom(t.scale)};this.setTransform(e)},t.prototype.dispose=function(){},t.prototype.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}},t.prototype.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t}();!function(t){function e(e,r){var i=t.call(this,e)||this;return r&&i.fromData(r),i}i(e,t),e.prototype.start=function(){this.options.position=this.transform.position.clone(),this.options.rotation=this.transform.getRotation().clone()},e.prototype.update=function(){var t=this.item.lifetime;if(!(t<0)&&this.item.transform.getValid()){var e=new rt,r=new et,i=new at;r.copyFrom(this.options.position),i.copyFrom(this.options.rotation);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(t=J(t,0,1),n&&(r.x+=n.x.getValue(t),r.y+=n.y.getValue(t),r.z+=n.z.getValue(t),n.path)){var a=n.path.getValue(t);r.x+=a[0],r.y+=a[1],r.z+=a[2]}if(o){var s=o.z.getValue(t);i.z+=s,o.separateAxes?(i.x+=o.x.getValue(t),i.y+=o.y.getValue(t)):(i.x+=s,i.y+=s)}this.far=this.options.far.getValue(t),this.near=this.options.near.getValue(t),this.fov=this.options.fov.getValue(t),this.transform.setPosition(r.x,r.y,r.z),this.transform.setRotation(i.x,i.y,i.z),this.transform.assignWorldTRS(r,e),this.position=r,this.rotation=qr.getRotation(e,i),this.updateCamera()}},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.options,i=r.near,n=r.far,o=r.fov,a=r.clipMode;if(this.clipMode=a,this.options={position:new et,rotation:new at,near:kr(i),far:kr(n),fov:kr(o)},e.positionOverLifetime){var s=e.positionOverLifetime,l=s.path,u=s.linearX,c=void 0===u?0:u,h=s.linearY,f=void 0===h?0:h,p=s.linearZ,d=void 0===p?0:p;this.translateOverLifetime={path:l&&kr(l),x:kr(c),y:kr(f),z:kr(d)}}if(e.rotationOverLifetime){var m=e.rotationOverLifetime,y=m.separateAxes,v=m.x,g=void 0===v?0:v,x=m.y,E=void 0===x?0:x,T=m.z,_=void 0===T?0:T;this.rotationOverLifetime={separateAxes:y,x:kr(g),y:kr(E),z:kr(_)}}},e.prototype.updateCamera=function(){if(this.item.composition){var t=this.item.composition.camera;t.near=this.near,t.far=this.far,t.fov=this.fov,t.clipMode=this.clipMode,t.position=this.position,t.rotation=this.rotation}},e=o([$t(ur.CameraController)],e)}(ne);var Qr;!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}i(e,t)}(yr);!function(t){t[t.triangle=1]="triangle",t[t.box=2]="box",t[t.sphere=3]="sphere",t[t.custom=4]="custom"}(Qr||(Qr={}));!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}i(e,t)}(yr);var Kr="editor",Jr="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",$r=1,ti=function(){function t(t,e,r,i){this.transform=r,this.engine=i,this.color=t.options.previewColor;var n=this.createMaterial(e),o=this.createGeometry();this.mesh=this.createMesh(o,n),this.updateMesh()}return t.prototype.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new et,n=new rt,o=this.transform.scale.clone();this.transform.assignWorldTRS(i,n,o),e.x=o.x,e.y=o.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)},t.prototype.createMaterial=function(t){var e,r=[["ENV_EDITOR",(null===(e=this.engine.renderer)||void 0===e?void 0:e.env)===Kr]],i=kr(this.color).getValue(0),n=this.engine.gpuCapability.level,o={shader:{vertex:de(r,"\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",te.vertex,n),fragment:de(r,"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n",te.fragment,n),glslVersion:Ce.GLSL1,cacheId:"".concat(t.cachePrefix,"_effects_interact")},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},a=Oe.create(this.engine,o);return a.depthTest=!1,a.setVector4("uPos",new st(0,0,0,0)),a.setVector2("uSize",new tt(1,1)),a.setVector4("uColor",new st(i[0]/255,i[1]/255,i[2]/255,i[3])),a.setQuaternion("uQuat",new rt(0,0,0,0)),a},t.prototype.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return ze.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:le.LINES,maxVertex:4})},t.prototype.createMesh=function(t,e){return Fe.create(this.engine,{name:"Interact_preview"+$r++,priority:0,worldMatrix:ot.fromIdentity(),geometry:t,material:e})},t}();function ei(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}!function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return 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}var r;i(e,t),r=e,e.prototype.start=function(){var t,e,r,i=this.item.props.content.options,n=(null!==(e=null===(t=this.item.engine)||void 0===t?void 0:t.renderer)&&void 0!==e?e:{}).env,o=this.item.composition,a=this.interactData.options,s=a.type,l=a.showPreview;if(s===Tt.CLICK&&(this.clickable=!0,l&&n===Kr)){var u=this.item.composition.getRendererOptions();this.previewContent=new ti(this.item.props.content,u,this.transform,this.engine)}null===(r=this.item.composition)||void 0===r||r.addInteractiveItem(this.item,i.type),i.type===Tt.DRAG&&(n!==Kr||i.enableInEditor)&&o.event&&this.beginDragTarget(i,o.event),this.previewContent&&(this.previewContent.mesh.item=this.item,this.materials=this.previewContent.mesh.materials),this.item.getHitTestParams=this.getHitTestParams},e.prototype.update=function(t){var e;if(null===(e=this.previewContent)||void 0===e||e.updateMesh(),this.dragEvent&&this.bouncingArg){this.bouncingArg.vx*=.95,this.bouncingArg.vy*=.95,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,ei(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg)}},e.prototype.render=function(t){this.previewContent&&this.previewContent.mesh.render(t)},e.prototype.onDestroy=function(){var t;this.item&&this.item.composition&&(this.item.composition.removeInteractiveItem(this.item,this.item.props.content.options.type),this.clickable=!1,null===(t=this.previewContent)||void 0===t||t.mesh.dispose(),this.endDragTarget())},e.prototype.endDragTarget=function(){},e.prototype.handleDragMove=function(t,e){var r,i;if(t&&t.cameraParam&&this.item.composition){var n=this.item.props.content.options,o=t.cameraParam,a=o.position,s=o.fov,l=e.dy,c=e.dx*e.width/e.height,h=a[2],f=Math.tan(s*Math.PI/180/2)*Math.abs(h),p=l*f,d=c*f,m=a[0]-d,y=a[1]-p;if(n.dxRange){var v=u(n.dxRange,2);(m=J(m,g=v[0],x=v[1]))!==g&&m!==x&&g!==x&&(null===(r=e.origin)||void 0===r||r.preventDefault())}if(n.dyRange){var g,x,E=u(n.dyRange,2);(y=J(y,g=E[0],x=E[1]))!==g&&y!==x&&g!==x&&(null===(i=e.origin)||void 0===i||i.preventDefault())}this.item.composition.camera.position=new et(m,y,h)}},e.prototype.beginDragTarget=function(t,e){var i=this;if("camera"===t.target){var o,a={touchstart:function(t){var e;i.dragEvent=null,i.bouncingArg=null;var r=null===(e=i.item.composition)||void 0===e?void 0:e.camera;o={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(o,t),i.bouncingArg=t},touchend:function(t){var e=i.bouncingArg;if(!ei(e,3)&&e){e.vx*=5,e.vy*=5,i.dragEvent=n({},o)}o=null}};Object.keys(a).forEach((function(t){e.addEventListener(t,a[t])})),a.touchmove({dx:0,dy:0,width:1,height:1}),this.item.getComponent(r).endDragTarget=function(){Object.keys(a).forEach((function(t){e.removeEventListener(t,a[t])}))}}},e.prototype.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),e=Rr(et.ZERO,.5,.5);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:Qr.triangle,area:e}},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e),this.interactData=e},e=r=o([$t(ur.InteractComponent)],e)}(oe);function ri(t,e){return"".concat(t.cachePrefix,"_effects_sprite_").concat(e)}function ii(t,e,r,i){var n=t.wireframe,o=function(t,e){var r=null!=e?e:{},i=r.count,n=void 0===i?2:i,o=r.env,a=void 0===o?"":o,s=r.ignoreBlend,l=r.wireframe,u=[["MAX_ITEM_COUNT",n],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",a===Kr],["USE_BLEND",!s],["MAX_FRAG_TEX",8]],c=l?je:Ye.replace(/#pragma\s+FILTER_FRAG/,""),h=Xe.replace(/#pragma\s+FILTER_VERT/,"vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}");return{fragment:de(u,c,te.fragment,t),vertex:de(u,h,te.vertex,t),glslVersion:1===t?Ce.GLSL1:Ce.GLSL3,marcos:u,shared:!0}}(r,{count:e,wireframe:n,env:i});return o.shared=!0,n||(o.cacheId=ri(t,e)),o}var ni={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},oi=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="sprite",e}i(e,t),e.precompile=function(t,e,r){var i=e.getShaderLibrary(),n=e.engine.gpuCapability,o=n.level,a=n.detail,s=(null!=r?r:{}).env;return i.shaderResults[ri(ni,2)]||(i.addShader(ii(ni,2,1,s)),i.addShader(ii(ni,8,1,s)),a.writableFragDepth&&i.addShader(we(o,!0))),Promise.resolve()}}(yr),function(){function t(){this.playableOutputs=[]}return t.prototype.evaluate=function(t){var e,r;try{for(var i=l(this.playableOutputs),n=i.next();!n.done;n=i.next()){var o=n.value;this.callProcessFrame(o.sourcePlayable,t),o.processFrame(t)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.connect=function(t,e){e.connect(t)},t.prototype.addOutput=function(t){this.playableOutputs.push(t)},t.prototype.callProcessFrame=function(t,e){var r,i;try{for(var n=l(t.getInputs()),o=n.next();!o.done;o=n.next()){var a=o.value;this.callProcessFrame(a,e)}}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}t.processFrame(e)},t}()),ai=function(){function t(){this.inputs=[]}return t.prototype.connect=function(t){this.inputs.push(t)},t.prototype.getInputs=function(){return this.inputs},t.prototype.getInput=function(t){if(!(t>this.inputs.length-1))return this.inputs[t]},t.prototype.setTime=function(t){this.time=t},t.prototype.getTime=function(){return this.time},t.prototype.onGraphStart=function(){},t.prototype.onGraphStop=function(){},t.prototype.onPlayablePlay=function(){},t.prototype.processFrame=function(t){},t.prototype.onPlayableDestroy=function(){},t.prototype.fromData=function(t){},t}(),si=function(){function t(){}return t.prototype.setSourcePlayeble=function(t){this.sourcePlayable=t},t.prototype.onGraphStart=function(){},t.prototype.processFrame=function(t){},t}(),li=function(t){function e(e){var r=t.call(this,e)||this;return r.reusable=!1,r.timelineStarted=!1,r.playableGraph=new oi,r.time=0,r.tracks=[],r.trackSeed=0,r}return i(e,t),e.prototype.start=function(){var t,e,r,i;try{for(var n=l(this.tracks),o=n.next();!o.done;o=n.next()){var a=o.value;try{for(var s=(r=void 0,l(a.getClips())),u=s.next();!u.done;u=s.next()){var c=u.value;c.start=this.item.start,c.duration=this.item.duration}}catch(t){r={error:t}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.compileTracks(this.playableGraph)},e.prototype.update=function(t){var e,r,i,n,o,a,s,u,c,h,f,p,d,m,y,v;if(!this.item.stopped&&this.item.composition){if(!this.timelineStarted){try{for(var g=l(this.tracks),x=g.next();!x.done;x=g.next()){var E=x.value;try{for(var T=(i=void 0,l(E.getClips())),_=T.next();!_.done;_=T.next()){_.value.playable.onGraphStart()}}catch(t){i={error:t}}finally{try{_&&!_.done&&(n=T.return)&&n.call(T)}finally{if(i)throw i.error}}}}catch(t){e={error:t}}finally{try{x&&!x.done&&(r=g.return)&&r.call(g)}finally{if(e)throw e.error}}this.timelineStarted=!0}var C=this.time;if(this.item.delaying&&C>=0&&C<=this.item.duration){this.item.delaying=!1;try{for(var b=l(this.tracks),O=b.next();!O.done;O=b.next()){E=O.value;try{for(var R=(s=void 0,l(E.getClips())),A=R.next();!A.done;A=R.next()){A.value.playable.onPlayablePlay()}}catch(t){s={error:t}}finally{try{A&&!A.done&&(u=R.return)&&u.call(R)}finally{if(s)throw s.error}}}}catch(t){o={error:t}}finally{try{O&&!O.done&&(a=b.return)&&a.call(b)}finally{if(o)throw o.error}}}if(Rn.isParticle(this.item)?this.item.isEnded(C)&&this.item.content.destoryed:this.item.isEnded(C)){var w=this.item.endBehavior;if(!this.item.ended&&(this.item.ended=!0,this.item.onEnd(),0===w)){try{for(var S=l(this.tracks),I=S.next();!I.done;I=S.next()){E=I.value;try{for(var M=(f=void 0,l(E.getClips())),L=M.next();!L.done;L=M.next()){L.value.playable.onPlayableDestroy()}}catch(t){f={error:t}}finally{try{L&&!L.done&&(p=M.return)&&p.call(M)}finally{if(f)throw f.error}}}}catch(t){c={error:t}}finally{try{I&&!I.done&&(h=S.return)&&h.call(S)}finally{if(c)throw c.error}}if(this.item.delaying=!0,!this.item.reusable&&!this.reusable)return void this.item.dispose()}}if(!this.item.delaying){var P=this.time/this.item.duration;this.item.lifetime=P;try{for(var V=l(this.tracks),N=V.next();!N.done;N=V.next()){E=N.value;try{for(var z=(y=void 0,l(E.getClips())),D=z.next();!D.done;D=z.next()){D.value.playable.setTime(this.time)}}catch(t){y={error:t}}finally{try{D&&!D.done&&(v=z.return)&&v.call(z)}finally{if(y)throw y.error}}}}catch(t){d={error:t}}finally{try{N&&!N.done&&(m=V.return)&&m.call(V)}finally{if(d)throw d.error}}this.playableGraph.evaluate(t)}}},e.prototype.setTime=function(t){this.time=t},e.prototype.getTime=function(){return this.time},e.prototype.toLocalTime=function(t){var e=t-this.options.start,r=this.options.duration;return e-r>.001&&(5===this.options.endBehavior?e%=r:4===this.options.endBehavior&&(e=Math.min(r,e))),e},e.prototype.createTrack=function(t,e){var r=new t;return r.bindingItem=this.item,r.id=(this.trackSeed++).toString(),r.name=e||"Track"+r.id,this.tracks.push(r),r},e.prototype.getTracks=function(){return this.tracks},e.prototype.findTrack=function(t){var e,r;try{for(var i=l(this.tracks),n=i.next();!n.done;n=i.next()){var o=n.value;if(o.name===t)return o}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},e.prototype.rebuildGraph=function(){this.playableGraph=new oi,this.compileTracks(this.playableGraph)},e.prototype.compileTracks=function(t){var e,r;try{for(var i=l(this.tracks),n=i.next();!n.done;n=i.next()){var o=n.value,a=o.createPlayebleTree(),s=o.createOutput();t.addOutput(s),s.setSourcePlayeble(a)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e),this.options={start:this.item.start,duration:this.item.duration,looping:5===this.item.endBehavior,endBehavior:this.item.endBehavior||0},this.id=this.item.id,this.name=this.item.name},e.prototype.toData=function(){t.prototype.toData.call(this)},o([Jt()],e.prototype,"time",void 0),e}(ne),ui=function(){function t(){this.clips=[],this.clipSeed=0}return t.prototype.createOutput=function(){return new si},t.prototype.createMixerPlayable=function(){return new ai},t.prototype.createPlayebleTree=function(){var t,e,r=this.createMixerPlayable();try{for(var i=l(this.clips),n=i.next();!n.done;n=i.next()){var o=n.value;r.connect(o.playable)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}return r},t.prototype.createClip=function(t,e){var r=new ci;return r.playable=new t,r.name=e||"TimelineClip"+r.id,this.addClip(r),r},t.prototype.getClips=function(){return this.clips},t.prototype.findClip=function(t){var e,r;try{for(var i=l(this.clips),n=i.next();!n.done;n=i.next()){var o=n.value;if(o.name===t)return o}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},t.prototype.addClip=function(t){t.playable.bindingItem=this.bindingItem,t.id=(this.clipSeed++).toString(),this.clips.push(t)},t}(),ci=function(){this.start=0,this.duration=0},hi=[[0,0,1,1,void 0]],fi=[1,1,1,1],pi=0,di=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.renderColor=[1,1,1,1],e}return i(e,t),e.prototype.onPlayablePlay=function(){this.spriteMaterial=this.bindingItem.getComponent(mi).material},e.prototype.processFrame=function(t){var e,r=function(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}(fi,1),i=this.time/this.bindingItem.duration,n=this.opacityOverLifetime,o=this.colorOverLifetime;o&&(r=function(t,e,r){if(t.length){for(var i=void 0,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){i=G(o.color,a.color,(e-o.stop)/(a.stop-o.stop));break}}return i||(i=t[t.length-1].color),r?i.map((function(t){return t/255})):i}return[0,0,0,0]}(o,i,!0),e=!0),n&&(r[3]*=n.getValue(i),e=!0),e&&(!function(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(i=0;i<e.length;i++)t[i]=e[i]}else if(r&&t!==r)for(i=0;i<r.length;i++)t[i]=r[i]}(this.renderColor,r,this.startColor),this.spriteMaterial.getVector4("_Color").setFromArray(this.renderColor))},e.prototype.fromData=function(t){var e;this.clipData=t;var r=t.colorOverLifetime;return r&&(this.opacityOverLifetime=kr(null!==(e=r.opacity)&&void 0!==e?e:1),r.color&&r.color[0]===Pt.GRADIENT_COLOR&&(this.colorOverLifetime=B(r.color[1]))),this.startColor=t.startColor||[1,1,1,1],this},e}(ai),mi=function(t){function e(e,r){var i=t.call(this,e)||this;return i.color=[1,1,1,1],i.visible=!0,i.getHitTestParams=function(t){var e,r=i.interaction;if(t||r){var n=i.getBoundingBox();if(n)return{behavior:(null===(e=i.interaction)||void 0===e?void 0:e.behavior)||0,type:n.type,triangles:n.area,backfaceCulling:i.renderer.side===vt.FRONT}}},r&&i.fromData(r),i}return i(e,t),e.prototype.setVisible=function(t){this.visible=t},e.prototype.getVisible=function(){return this.visible},e.prototype.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),r.flush(),t.drawGeometry(r,e)}},e.prototype.start=function(){this.priority=this.item.listIndex,this.timelineComponent=this.item.getComponent(li),this.item.getHitTestParams=this.getHitTestParams},e.prototype.update=function(t){var e=this.timelineComponent.getTime(),r=this.item.duration,i=Math.min(Math.max(e/r,0),1),n=this.textureSheetAnimation;if(n){var o=n.total||n.row*n.col,a=0,s=0,l=1,u=1,c=void 0;if(this.splits){var h=this.splits[0];c=h[4],a=h[0],s=h[1],c?(l=h[3],u=h[2]):(l=h[2],u=h[3])}var f=void 0,p=void 0;c?(f=1/n.row*l,p=1/n.col*u):(f=1/n.col*l,p=1/n.row*u);var d=void 0;if(n.animate){var m=Math.round(i*(o-1)),y=Math.floor(m/n.col),v=m-y*n.col;d=c?[f*y,p*(n.col-v)]:[f*v,p*(1+y)]}else d=[0,p];this.material.getVector4("_TexOffset").setFromArray([a+d[0],u+s-d[1],f,p])}},e.prototype.onDestroy=function(){this.item&&this.item.composition&&this.item.composition.destroyTextures(this.getTextures())},e.prototype.getItemInitData=function(t,e,r,i){var n=t.geoData;n||(n=t.geoData=this.getItemGeometryData(t,e));var o=n.index,a=o.length,s=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new o.constructor(a);if(!this.wireframe)for(var l=0;l<a;l++)s[l]=r+o[l];return{atlasOffset:n.atlasOffset,index:s}},e.prototype.setItem=function(){var t=[],e=this.renderer.texture;e&&D(t,e);var r=(e=this.renderer.texture)?t.indexOf(e):-1,i=this.getItemInitData(this,0,0,r),n=this.renderer,o=this.material.getVector4("_TexParams");o.x=n.occlusion?+n.transparentOcclusion:1,o.y=+this.preMultiAlpha,o.z=n.renderMode;var a={atlasOffset:new Float32Array(i.atlasOffset.length),index:new Uint16Array(i.index.length)};a.atlasOffset.set(i.atlasOffset),a.index.set(i.index);var s=this.material,l=this.geometry,u=a.index;l.setIndexData(u),l.setAttributeData("atlasOffset",a.atlasOffset),l.setDrawCount(i.index.length);for(var c=0;c<t.length;c++){var h=t[c];s.setTexture("uSampler"+c,h)}for(var f=this.emptyTexture,p=t.length;p<8;p++)s.setTexture("uSampler"+p,f)},e.prototype.createGeometry=function(t){var e=12*this.splits.length;return ze.create(this.engine,{attributes:{aPos:{type:le.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:le.FLOAT,data:new Float32Array(0)}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:e})},e.prototype.createMaterial=function(t,e){var r=t.side,i=t.occlusion,n=t.blending,o=t.maskMode,a=t.mask,s={shader:ii(t,e,1)};this.preMultiAlpha=ce(n);var l=Oe.create(this.engine,s),u={side:r,blending:!0,blendMode:n,mask:a,maskMode:o,depthTest:!0,depthMask:i};return l.blending=u.blending,l.stencilRef=void 0!==u.mask?[u.mask,u.mask]:void 0,l.depthTest=u.depthTest,l.depthMask=u.depthMask,me(l,u.blendMode),ve(l,u.maskMode),ye(l,u.side),l.hasUniform("_Color")||l.setVector4("_Color",new st(0,0,0,1)),l.hasUniform("_TexOffset")||l.setVector4("_TexOffset",new st),l.hasUniform("_TexParams")||l.setVector4("_TexParams",new st),l},e.prototype.getItemGeometryData=function(t,e){var r=t.splits,i=t.renderer,n=t.textureSheetAnimation;if(i.shape){for(var o=i.shape,a=o.index,s=o.aPoint,l=new Float32Array(s),u=[],c=[],h=0;h<l.length;h+=6)l[h]*=1,l[h+1]*=1,c.push(s[h+2],s[h+3]),u.push(l[h],l[h+1],0);return this.geometry.setAttributeData("aPos",new Float32Array(u)),{index:a,atlasOffset:c}}var f=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],p=[],d=[],m=2,y=2;1===r.length&&(m=1,y=1);for(var v=[],g=0;g<m;g++)for(var x=0;x<y;x++){var E=4*(2*x+g),T=n?[0,0,1,1,r[0][4]]:r[2*x+g],_=T[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],C=((g+g+1)/m-1)/2,b=((x+x+1)/y-1)/2,O=T[0],R=T[1],A=T[4]?T[3]:T[2],w=T[4]?T[2]:T[3],S=[f[0]/m+C,f[1]/y+b,f[2]/m+C,f[3]/y+b,f[4]/m+C,f[5]/y+b,f[6]/m+C,f[7]/y+b];p.push(_[0]*A+O,_[1]*w+R,_[2]*A+O,_[3]*w+R,_[4]*A+O,_[5]*w+R,_[6]*A+O,_[7]*w+R),v.push(1*S[0],1*S[1],0,1*S[2],1*S[3],0,1*S[4],1*S[5],0,1*S[6],1*S[7],0),d.push(E,1+E,2+E,2+E,1+E,3+E)}return this.geometry.setAttributeData("aPos",new Float32Array(v)),{index:d,atlasOffset:p}},e.prototype.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},e.prototype.getBoundingBox=function(){if(this.item){var t=this.transform.getWorldMatrix(),e=Rr(et.ZERO,.5,.5);return e.forEach((function(e){t.transformPoint(e.p0),t.transformPoint(e.p1),t.transformPoint(e.p2)})),{type:Qr.triangle,area:e}}},e.prototype.fromData=function(e){var r,i,n,o,a,s;t.prototype.fromData.call(this,e);var l=e.interaction,u=e.options,c=e.listIndex,h=void 0===c?0:c,f=e.renderer;f||(f={}),this.interaction=l,this.renderer={renderMode:null!==(r=f.renderMode)&&void 0!==r?r:bt.BILLBOARD,blending:null!==(i=f.blending)&&void 0!==i?i:yt.ALPHA,texture:null!==(n=f.texture)&&void 0!==n?n:this.engine.emptyTexture,occlusion:!!f.occlusion,transparentOcclusion:!!f.transparentOcclusion||f.maskMode===gt.MASK,side:null!==(o=f.side)&&void 0!==o?o:vt.DOUBLE,shape:f.shape,mask:null!==(a=f.mask)&&void 0!==a?a:0,maskMode:null!==(s=f.maskMode)&&void 0!==s?s:gt.NONE,order:h},this.emptyTexture=this.engine.emptyTexture,this.splits=e.splits||hi,this.textureSheetAnimation=e.textureSheetAnimation,this.cachePrefix="-",this.renderInfo=function(t){var e=t.renderer,r=e.blending,i=e.side,n=e.occlusion,o=e.mask,a=e.maskMode,s=e.order,l=+r,u=t.cachePrefix||"-";return{side:i,occlusion:n,blending:r,mask:o,maskMode:a,cachePrefix:u,cacheId:"".concat(u,".").concat(+i,"+").concat(+n,"+").concat(l,"+").concat(s,"+").concat(a,".").concat(o)}}(this);var p=this.createGeometry(le.TRIANGLES),d=this.createMaterial(this.renderInfo,2);this.worldMatrix=ot.fromIdentity(),this.material=d,this.geometry=p,this.name="MSprite"+pi++;var m=u.startColor||[1,1,1,1];this.material.setVector4("_Color",(new st).setFromArray(m)),this.material.setVector4("_TexOffset",(new st).setFromArray([0,0,1,1])),this.setItem(),this.item.getComponent(li).createTrack(ui,"SpriteColorTrack").createClip(di,"SpriteColorClip").playable.fromData({colorOverLifetime:e.colorOverLifetime,startColor:e.options.startColor})},e.prototype.toData=function(){t.prototype.toData.call(this)},e=o([$t(ur.SpriteComponent)],e)}(oe),yi="lookup_texture",vi="offscreen_canvas",gi={};function xi(t){return gi[t]}var Ei=function(){function t(t,e){var r,i;this.particleCount=0;var n=(null!==(r=t.renderer)&&void 0!==r?r:{}).env,o=e.speedOverLifetime,a=e.colorOverLifetime,s=e.linearVelOverLifetime,l=e.orbitalVelOverLifetime,u=e.sizeOverLifetime,c=e.rotationOverLifetime,h=e.sprite,f=e.gravityModifier,p=e.maxCount,d=e.textureFlip,m=e.useSprite,y=e.name;e.filter;var v,g=e.gravity,x=e.forceTarget,E=e.side,T=e.occlusion,_=e.anchor,C=e.blending,b=e.maskMode,O=e.mask,R=e.transparentOcclusion,A=e.meshSlots,w=e.renderMode,S=void 0===w?0:w,I=e.diffuse,M=void 0===I?Ee.createWithData(t):I,L=t.gpuCapability.detail,P=L.halfFloatTexture,V=L.maxVertexUniforms,N=[["RENDER_MODE",+S],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",n===Kr]],z=t.gpuCapability.level,D={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},F={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},U=V>0,k={},B=0,G=0;this.useSprite=m,U&&N.push(["ENABLE_VERTEX_TEXTURE",!0]),o&&(N.push(["SPEED_OVER_LIFETIME",!0]),G|=2,k.uSpeedLifetimeValue=o.toUniform(D)),(null==h?void 0:h.animate)&&(N.push(["USE_SPRITE",!0]),G|=4,k.uFSprite=k.uSprite=new Float32Array([h.col,h.row,h.total,h.blend?1:0]),this.useSprite=!0),(null==a?void 0:a.color)&&(N.push(["COLOR_OVER_LIFETIME",!0]),G|=16,k.uColorOverLifetime=a.color instanceof Ee?a.color:Ee.createWithData(t,X(a.color))),(null==a?void 0:a.opacity)?k.uOpacityOverLifetimeValue=a.opacity.toUniform(D):k.uOpacityOverLifetimeValue=kr(1).toUniform(D),["x","y","z"].forEach((function(t,e){var r=0,i=0;(null==s?void 0:s[t])&&(k["uLinear".concat(t.toUpperCase(),"ByLifetimeValue")]=s[t].toUniform(D),r=1,G|=1<<7+e,s.enabled=!0),N.push(["LINEAR_VEL_".concat(t.toUpperCase()),r]),(null==l?void 0:l[t])&&(k["uOrb".concat(t.toUpperCase(),"ByLifetimeValue")]=l[t].toUniform(D),i=1,G|=1<<10+e,v=!0,l.enabled=!0),N.push(["ORB_VEL_".concat(t.toUpperCase()),i])})),(null==s?void 0:s.asMovement)&&(N.push(["AS_LINEAR_MOVEMENT",!0]),G|=32),v&&((null==l?void 0:l.asRotation)&&(N.push(["AS_ORBITAL_MOVEMENT",!0]),G|=64),k.uOrbCenter=new Float32Array((null==l?void 0:l.center)||[0,0,0])),k.uSizeByLifetimeValue=null==u?void 0:u.x.toUniform(D),(null==u?void 0:u.separateAxes)&&(N.push(["SIZE_Y_BY_LIFE",1]),G|=16384,k.uSizeYByLifetimeValue=null===(i=null==u?void 0:u.y)||void 0===i?void 0:i.toUniform(D)),(null==c?void 0:c.z)&&(k.uRZByLifeTimeValue=c.z.toUniform(D),G|=32768,N.push(["ROT_Z_LIFETIME",1])),(null==c?void 0:c.x)&&(k.uRXByLifeTimeValue=c.x.toUniform(D),G|=65536,N.push(["ROT_X_LIFETIME",1])),(null==c?void 0:c.y)&&(k.uRYByLifeTimeValue=c.y.toUniform(D),G|=1<<17,N.push(["ROT_Y_LIFETIME",1])),(null==c?void 0:c.asRotation)&&(N.push(["ROT_LIFETIME_AS_MOVEMENT",1]),G|=1<<18),k.uGravityModifierValue=f.toUniform(D),x&&(N.push(["FINAL_TARGET",!0]),G|=1<<19,k.uFinalTarget=new Float32Array(x.target||[0,0,0]),k.uForceCurve=x.curve.toUniform(D)),P&&F.max?(G|=1<<20,k.uFCurveValueTexture=Te(t,Nr.getAllData(F,!0),F.index,1)):k.uFCurveValues=Nr.getAllData(F);var j=D.max+D.curves.length-32>V;if(2===z&&(D.max=-1,D.index=A?A[0]:_i(D.index),F.index>0&&(F.max=-1,F.index=A?A[1]:_i(F.index))),j&&P&&U){var Y=Te(t,Nr.getAllData(D,!0),D.index,1);k.uVCurveValueTexture=Y,B=1}else k.uVCurveValues=Nr.getAllData(D);var H=["-p:",S,G,D.index,D.max,F.index,F.max].join("+");N.push(["VERT_CURVE_VALUE_COUNT",D.index],["FRAG_CURVE_VALUE_COUNT",F.index],["VERT_MAX_KEY_FRAME_COUNT",D.max],["FRAG_MAX_KEY_FRAME_COUNT",F.max]);var W=He,Z="#define LOOKUP_TEXTURE_CURVE ".concat(B,"\n").concat(We),q={shader:{fragment:de(N,W,te.fragment,z),vertex:de(N,Z,te.vertex,z),glslVersion:1===z?Ce.GLSL1:Ce.GLSL3,shared:!0,cacheId:H,marcos:N,name:"particle#".concat(y)},uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},Q=ce(C);k.uTexOffset=new Float32Array(M?[1/M.getWidth(),1/M.getHeight()]:[0,0]),k.uMaskTex=M,k.uColorParams=new Float32Array([M?1:0,+Q,0,+(!!T&&!R)]),k.uParams=[0,0,0,0],k.uAcceleration=[(null==g?void 0:g[0])||0,(null==g?void 0:g[1])||0,(null==g?void 0:g[2])||0,0];var K=Oe.create(t,q);K.blending=!0,K.depthTest=!0,K.depthMask=!!T,K.stencilRef=O?[O,O]:void 0,ve(K,b),me(K,C),ye(K,E);var J={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"};Object.keys(k).map((function(t){var e=k[t];if(e instanceof Ee)K.setTexture(t,e);else{var r=[];switch(J[t]){case"vec4":K.setVector4(t,st.fromArray(e));break;case"vec3":K.setVector3(t,et.fromArray(e));break;case"vec2":K.setVector2(t,tt.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new st(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 ".concat(t,"'s type not in typeMap"))}}})),K.setVector3("emissionColor",new et(0,0,0)),K.setFloat("emissionIntensity",0);var $=ze.create(t,function(t,e,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,o={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)}};e&&(o.aSprite={size:3,stride:3*i,data:new Float32Array(0)});return{attributes:o,indices:{data:new Uint16Array(0)},name:r,maxVertex:t}}(4*p,this.useSprite,"particle#".concat(y))),rt=Fe.create(t,{name:"MParticle_".concat(y),material:K,geometry:$});this.anchor=_,this.mesh=rt,this.geometry=rt.firstGeometry(),this.forceTarget=x,this.sizeOverLifetime=u,this.speedOverLifetime=o,this.linearVelOverLifetime=s,this.orbitalVelOverLifetime=l,this.orbitalVelOverLifetime=l,this.gravityModifier=f,this.maxCount=p,this.textureOffsets=d?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],this.time=0}return t.prototype.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),r=32*t+4;return[e[r],e[r+1],e[r+2],e[r+3]]},t.prototype.getPointPosition=function(t){var e=this.geometry,r=48*t,i=e.getAttributeData("aPos"),n=e.getAttributeData("aOffset"),o=this.time-n[16*t+2],a=n[16*t+3],s=this.mesh.material,l=s.getVector4("uAcceleration").toVector3(),u=et.fromArray(i,r),c=et.fromArray(i,r+3),h=Tr(new et,this,l,o,a,u,c);if(this.forceTarget){var f=s.getVector3("uFinalTarget"),p=this.forceTarget.curve.getValue(o/a),d=1-p;h.x=h.x*d+f.x*p,h.y=h.y*d+f.y*p,h.z=h.z*d+f.z*p}return h},t.prototype.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},t.prototype.resetGeometryData=function(t){for(var e=t.getAttributeNames(),r=t.getIndexData(),i=0;i<e.length;i++){var n=e[i],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new r.constructor(0))},t.prototype.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},t.prototype.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},t.prototype.setPoint=function(t,e){var r=this.maxCount;if(t<r){var i=t+1,n=4*i,o=this.geometry,a=i>this.maxParticleBufferCount,s=1;this.particleCount>300?s=(this.particleCount+100)/this.particleCount:this.particleCount>100?s=1.4:this.particleCount>0&&(s=2);var l={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},u=this.useSprite;u&&(l.aSprite=new Float32Array(12));var c=new et,h=new rt,f=new et(1,1,1);e.transform.assignWorldTRS(c,h,f);var p=qr.getRotation(h,new at),d=c.toArray(),m=p.toArray(),y=this.textureOffsets,v=[0,0,e.delay,e.lifetime],g=[0,0,1,1],x=e.vel,E=e.color,T=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],_=Math.random(),C=void 0;u&&(C=e.sprite);for(var b=0;b<4;b++){var O=2*b,R=3*b,A=4*b,w=12*b,S=8*b;l.aPos.set(d,w),x.fill(l.aPos,w+3),l.aRot.set(m,S),l.aRot[S+3]=_,l.aRot.set(E,S+4),u&&l.aSprite.set(C,R);var I=e.uv||g;if(I){var M=u?1-y[O+1]:y[O+1];v[0]=I[0]+y[O]*I[2],v[1]=I[1]+M*I[3]}l.aOffset.set(v,A);for(var L=b+b,P=(T[L]-this.anchor.x)*f.x,V=(T[L+1]-this.anchor.y)*f.y,N=0;N<3;N++)l.aPos[w+6+N]=e.dirX.getElement(N)*P,l.aPos[w+9+N]=e.dirY.getElement(N)*V}var z=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(a){var D=U(o.getIndexData(),6*i,s,6*r);D.set(z,6*t),o.setIndexData(D),this.maxParticleBufferCount=D.length/6}else o.setIndexSubData(6*t,z);Object.keys(l).forEach((function(e){var i=l[e],u=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(a){var c=U(o.getAttributeData(e),n*u,s,4*r*u);c.set(i,i.length*t),o.setAttributeData(e,c)}else o.setAttributeSubData(e,i.length*t,i)})),this.particleCount=Math.max(i,this.particleCount),o.setDrawCount(6*this.particleCount)}},t}(),Ti=[10,32,64,160];function _i(t){for(var e=0;e<Ti.length;e++){var r=Ti[e];if(r>t)return r}return t||Ti[0]}var Ci=new et,bi=new et,Oi=function(){function t(t,e){var r;this.pointStart=[];var i=e.colorOverLifetime,n=e.colorOverTrail,o=e.maxTrailCount,a=e.opacityOverLifetime,s=void 0===a?kr(1):a,l=e.widthOverTrail,u=e.name,c=e.occlusion,h=e.blending,f=e.maskMode,p=e.textureMap,d=void 0===p?[0,0,1,1]:p,m=e.texture,y=e.transparentOcclusion,v=e.minimumVertexDistance,g=e.lifetime,x=e.matrix,E=t.gpuCapability,T=E.detail,_=E.level,C=Math.max(e.pointCountPerTrail,2),b={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},O=T.maxVertexTextures>0,R=(null!==(r=t.renderer)&&void 0!==r?r:{}).env,A={},w=[["ENABLE_VERTEX_TEXTURE",O],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",R===Kr]],S=o>64,I=0;i&&(w.push(["COLOR_OVER_LIFETIME",!0]),I|=1,A.uColorOverLifetime=Ee.createWithData(t,X(i))),n&&(w.push(["COLOR_OVER_TRAIL",!0]),I|=4,A.uColorOverTrail=Ee.createWithData(t,X(n))),S?(w.push(["ATTR_TRAIL_START",1]),I|=8):A.uTrailStart=new Float32Array(o),A.uOpacityOverLifetimeValue=s.toUniform(b);var M=l.toUniform(b);w.push(["VERT_CURVE_VALUE_COUNT",b.index],["VERT_MAX_KEY_FRAME_COUNT",b.max]),A.uVCurveValues=Nr.getAllData(b);var L={shader:{vertex:de(w,Ze,te.vertex,_),fragment:de(w,He,te.fragment,_),marcos:w,glslVersion:1===_?Ce.GLSL1:Ce.GLSL3,shared:!0,name:"trail#".concat(u),cacheId:"-t:+".concat(I,"+").concat(b.index,"+").concat(b.max)},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},P=C*o*2,V=(C-1)*o,N=Float32Array.BYTES_PER_ELEMENT,z=12*N,D={attributes:{aColor:{size:4,stride:z,data:new Float32Array(12*P)},aSeed:{size:1,stride:z,offset:4*N,dataSource:"aColor"},aInfo:{size:3,stride:z,offset:5*N,dataSource:"aColor"},aPos:{size:4,stride:z,offset:8*N,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(P)},aDir:{size:3,data:new Float32Array(3*P)}},indices:{data:new Uint16Array(6*P)},drawCount:6*V,name:"trail#".concat(u),bufferUsage:le.DYNAMIC_DRAW};if(S)D.attributes.aTrailStart={size:1,data:new Float32Array(P)};else{var F=new Float32Array(P);D.attributes.aTrailStartIndex={size:1,data:F};for(var U=0;U<o;U++)for(var k=2*C,B=U*k,G=0;G<k;G++)F[B+G]=U}var j=ce(h),Y=Oe.create(t,L);Y.blending=!0,Y.depthMask=c,Y.depthTest=!0,ve(Y,f),me(Y,h);var H=this.mesh=Fe.create(t,{name:"MTrail_".concat(u),material:Y,geometry:ze.create(t,D)}),W=null!=m?m:Ee.createWithData(t);Object.keys(A).map((function(t){var e=A[t];if(e instanceof Ee)Y.setTexture(t,e);else if("uTrailStart"===t)Y.setFloats("uTrailStart",e);else if("uVCurveValues"===t){var r=[];r.push(new st(e[0],e[1],e[2],e[3])),r.push(new st(e[4],e[5],e[6],e[7])),Y.setVector4Array(t,r)}else Y.setVector4(t,st.fromArray(e))})),Y.setFloat("uTime",0),Y.setVector4("uWidthOverTrail",st.fromArray(M)),Y.setVector2("uTexOffset",new tt(0,0)),Y.setVector4("uTextureMap",st.fromArray(d)),Y.setVector4("uParams",new st(0,C-1,0,0)),Y.setTexture("uMaskTex",W),Y.setVector4("uColorParams",new st(m?1:0,+j,0,+(c&&!y))),this.maxTrailCount=o,this.pointCountPerTrail=C,this.checkVertexDistance=v>0,this.minimumVertexDistance=Math.pow(v||.001,2),this.useAttributeTrailStart=S,this.lifetime=g,x&&(this.mesh.worldMatrix=x),this.geometry=H.firstGeometry(),this.trailCursors=new Uint16Array(o)}return Object.defineProperty(t.prototype,"time",{get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)},enumerable:!1,configurable:!0}),t.prototype.addPoint=function(t,e,r){r=r||{};var i=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=i%n,l=(i-1)%n,u=(i-2)%n,c=this.getTrailPosition(t,l,Ci);if(!(c&&this.checkVertexDistance&&(null==c?void 0:c.distanceSquared(e))<this.minimumVertexDistance)){var h=t*n+s,f=Si(c,e),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,y=6*h,v=new Float32Array(6);v.set(f,0),v.set(f,3),o.setAttributeSubData("aDir",y,v),o.setAttributeSubData("aTime",2*h,new Float32Array([p,p]));var g=r.color||[1,1,1,1],x=new Float32Array(24),E=e.toArray();if(x.set(g,0),x.set(d,4),x[7]=0,x.set(E,8),x[11]=.5*m,x.set(g,12),x.set(d,16),x[19]=1,x.set(E,20),x[23]=-.5*m,o.setAttributeSubData("aColor",24*h,x),l>=0){var T=this.getTrailPosition(t,u,bi),_=new Float32Array(Si(T,c,e)),C=6*(t*n+l);o.setAttributeSubData("aDir",C,_),o.setAttributeSubData("aDir",C+3,_);var b=t*n*2,O=new Uint16Array([2*l+b,2*l+1+b,2*s+b,2*s+b,2*l+1+b,2*s+1+b]),R=6*(t*a+(i-1)%a);o.setIndexSubData(R,O)}i=++this.trailCursors[t];var A=this.mesh.material,w=A.getVector4("uParams"),S=d[2];if(this.useAttributeTrailStart){for(var I=2*n,M=new Float32Array(I),L=0;L<I;L++)M[L]=S;o.setAttributeSubData("aTrailStart",t*M.length,M)}else{var P=A.getFloats("uTrailStart");null!=P&&(P[t]=S,A.setFloats("uTrailStart",P))}w&&(w.y=Math.max(w.y,i-1)-Math.max(0,i-n),A.setVector4("uParams",w))}},t.prototype.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=24*(t*i+e)+8,o=this.geometry.getAttributeData("aColor");return r.x=o[n],r.y=o[1+n],r.z=o[2+n],r}},t.prototype.clearAllTrails=function(){var t=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),t.setIndexData(new Uint16Array(t.getIndexData().length))},t.prototype.minusTime=function(t){for(var e=this.geometry.getAttributeData("aTime"),r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},t.prototype.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),this.trailCursors[t]=0}},t.prototype.getPointStartPos=function(t){return this.pointStart[t]},t.prototype.setPointStartPos=function(t,e){this.pointStart[t]=e},t.prototype.onUpdate=function(t){},t}(),Ri=new et,Ai=new et,wi=new et;function Si(t,e,r){var i=Ri;return t||r?(t?r?(Ai.subtractVectors(e,t).normalize(),Ai.subtractVectors(r,e),wi.copyFrom(Ai).normalize(),i.addVectors(Ai,wi)):i.subtractVectors(e,t):i.subtractVectors(r,e),i.normalize().toArray()):[0,0,0]}!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}i(e,t),e.precompile=function(t,e,r){var i=t[0],n={rotationOverLifetime:{x:!1,y:!1,z:!1},positionOverLifetime:{speedOverLifetime:!1,linearX:!1,linearY:!1,linearZ:!1,orbitalX:!1,orbitalY:!1,orbitalZ:!1,forceCurve:!1},colorOverLifetime:{opacity:!1,color:!1},sizeOverLifetime:{x:!1,y:!1}},o={colorOverLifetime:{opacity:1,color:[Pt.RGBA_COLOR,[255,255,255,255]]},positionOverLifetime:{speedOverLifetime:1},sizeOverLifetime:{x:1,y:1}},a=e.engine.gpuCapability,s=a.level,l=(null!=r?r:{}).env,u=e.getShaderLibrary(),c=[],h=[],f=[],p=0,d=0;return i.items.forEach((function(t){On.isParticle(t)&&(h.push(t),function(t){if(On.isParticle(t)){var e=t.content;e.rotationOverLifetime||(e.rotationOverLifetime={});var r=e.rotationOverLifetime;r.z||(r.z=[Pt.CONSTANT,0]),r.separateAxes||(delete r.y,delete r.x),e.sizeOverLifetime||(e.sizeOverLifetime={});var i=e.sizeOverLifetime;i.separateAxes||delete i.y,i.size&&(i.x=i.size,delete i.size),i.x||(i.x=[Pt.CONSTANT,1])}}(t),2===s&&Object.keys(n).forEach((function(e){var r=n[e],i=t.content[e];i&&Object.keys(r).forEach((function(t){i[t]&&(r[t]=!0,D(c,e))}))})))})),h.forEach((function(t){var e,r,i=t.content;2===s&&(c.forEach((function(t){var e=n[t],r=i[t]||(i[t]={});Object.keys(e).forEach((function(i){if(e[i]&&!r[i]){var n=o[t]&&o[t][i]||0;r[i]=isNaN(n)?n:[Pt.CONSTANT,n]}}))})),n.positionOverLifetime.forceCurve&&(i.positionOverLifetime.forceTarget=!0),(n.rotationOverLifetime.x||n.rotationOverLifetime.y)&&(i.rotationOverLifetime.separateAxes=!0),n.sizeOverLifetime.y&&(i.sizeOverLifetime.separateAxes=!0));var h=function(t,e,r){var i,n;void 0===e&&(e="");var o=t.content,a=+((null===(i=o.renderer)||void 0===i?void 0:i.renderMode)||0),s=[["RENDER_MODE",a],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",e===Kr]],l=r.level,u=r.detail,c={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},h={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},f=u.maxVertexUniforms>0,p=(null!==(n=o.positionOverLifetime)&&void 0!==n?n:{}).speedOverLifetime,d=0,m=0;f&&s.push(["ENABLE_VERTEX_TEXTURE",!0]),p&&(s.push(["SPEED_OVER_LIFETIME",!0]),m|=2,Hr(c,p));var y=o.textureSheetAnimation;y&&y.animate&&(s.push(["USE_SPRITE",!0]),m|=4);var v=o.colorOverLifetime;v&&v.color&&(s.push(["COLOR_OVER_LIFETIME",!0]),m|=16);var g=v&&v.opacity;g&&Hr(c,g);var x,E=o.positionOverLifetime;["x","y","z"].forEach((function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==E?void 0:E[i])&&(Hr(c,E[i]),r=1,m|=1<<7+e),s.push(["LINEAR_VEL_".concat(t.toUpperCase()),r]);var o=0;(null==E?void 0:E[n])&&(Hr(c,E[n]),o=1,m|=1<<10+e,x=!0),s.push(["ORB_VEL_".concat(t.toUpperCase()),o])})),(null==E?void 0:E.asMovement)&&(s.push(["AS_LINEAR_MOVEMENT",!0]),m|=32),x&&(null==E?void 0:E.asRotation)&&(s.push(["AS_ORBITAL_MOVEMENT",!0]),m|=64);var T=o.sizeOverLifetime;Hr(c,null==T?void 0:T.x),(null==T?void 0:T.separateAxes)&&(s.push(["SIZE_Y_BY_LIFE",1]),m|=16384,Hr(c,null==T?void 0:T.y));var _=o.rotationOverLifetime;(null==_?void 0:_.z)&&(Hr(c,null==_?void 0:_.z),m|=32768,s.push(["ROT_Z_LIFETIME",1])),(null==_?void 0:_.separateAxes)&&(_.x&&(Hr(c,_.x),m|=65536,s.push(["ROT_X_LIFETIME",1])),_.y&&(Hr(c,_.y),m|=1<<17,s.push(["ROT_Y_LIFETIME",1]))),(null==_?void 0:_.asRotation)&&(s.push(["ROT_LIFETIME_AS_MOVEMENT",1]),m|=1<<18),Hr(c,null==E?void 0:E.gravityOverLifetime),(null==E?void 0:E.forceTarget)&&(s.push(["FINAL_TARGET",!0]),m|=1<<19,Hr(c,E.forceCurve));var C=u.halfFloatTexture;C&&h.max&&(m|=1<<20);var b=u.maxVertexUniforms,O=c.max+c.curves.length-32>b;xi(yi)&&(O=!0),2===l&&(c.max=-1,h.index>0&&(h.max=-1)),O&&C&&f&&(d=1);var R=["-p:",a,m,c.index,c.max,h.index,h.max].join("+"),A={fragment:He,vertex:"#define LOOKUP_TEXTURE_CURVE ".concat(d,"\n").concat(We),shared:!0,cacheId:R,marcos:s,name:"particle#".concat(t.name)};return s.push(["VERT_CURVE_VALUE_COUNT",c.index],["FRAG_CURVE_VALUE_COUNT",h.index],["VERT_MAX_KEY_FRAME_COUNT",c.max],["FRAG_MAX_KEY_FRAME_COUNT",h.max]),{shader:A,vertex:c.index,fragment:h.index}}(t,l,a),m=h.shader,y=h.fragment,v=h.vertex;if(f.push(m),p=Math.max(p,y),d=Math.max(d,v),t.content.trails){var g=function(t,e,r,i,n){void 0===i&&(i="");var o=0,a=xi(yi)?1:0,s=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",a],["ENV_EDITOR",i===Kr]],l={curves:[],index:0,max:0,lineSegCount:0,curveCount:0};return t.colorOverLifetime&&(s.push(["COLOR_OVER_LIFETIME",!0]),o|=1),t.colorOverTrail&&(s.push(["COLOR_OVER_TRAIL",!0]),o|=4),e>64&&(s.push(["ATTR_TRAIL_START",1]),o|=8),Hr(l,t.opacityOverLifetime),Hr(l,t.widthOverTrail),s.push(["VERT_CURVE_VALUE_COUNT",l.index],["VERT_MAX_KEY_FRAME_COUNT",l.max]),{vertex:Ze,fragment:He,marcos:s,shared:!0,name:"trail#"+r,cacheId:"-t:+".concat(o,"+").concat(l.index,"+").concat(l.max)}}(t.content.trails,t.content.options.maxCount,t.name,l,a);g.vertex=de(null!==(e=g.marcos)&&void 0!==e?e:[],g.vertex,te.vertex,s),g.fragment=de(null!==(r=g.marcos)&&void 0!==r?r:[],g.fragment,te.fragment,s),g.glslVersion=2===s?Ce.GLSL3:Ce.GLSL1,u.addShader(g)}})),f.forEach((function(t){var e,r;2===s?(!function(t,e,r){var i,n=null===(i=t.cacheId)||void 0===i?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.marcos)for(var o=0;o<t.marcos.length;o++){var a=t.marcos[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}}(t,d,p),t.glslVersion=Ce.GLSL3):t.glslVersion=Ce.GLSL1,t.vertex=de(null!==(e=t.marcos)&&void 0!==e?e:[],t.vertex,te.vertex,s),t.fragment=de(null!==(r=t.marcos)&&void 0!==r?r:[],t.fragment,te.fragment,s),u.addShader(t)})),2===s&&h.forEach((function(t){t.content.options.meshSlots=[d,p]})),Promise.resolve()}}(yr);var Ii=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=Mi(this.arc,this.arcMode,t)*q,r=Math.cos(e)*this.radius,i=Math.sin(e)*this.radius,n=new et(r,i,0),o=Math.tan(this.angle*q),a=n.clone().multiply(o);return a.z+=1,{position:n.multiply(wt(0,1)),direction:a.normalize()}},t}();function Mi(t,e,r){if(e===Ft.RANDOM)t=wt(0,t);else if(e===Ft.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===Ft.BIDIRECTIONAL_CYCLE){var n=(i=r.index/(r.total+1))-Math.floor(i);t*=Math.floor(i)%2?1-n:n}else e===Ft.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var Li,Pi=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=Mi(this.arc,this.arcMode,t)*q,r=new et(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),Vi=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=wt(-this._d,this._d),r=wt(-this._h,this._h);return{direction:new et(0,0,1),position:new et(e,r,0)}},t}(),Ni=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=Mi(this.arc,this.arcMode,t)*q,r=new et(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,o=Math.atan2(n,i),a=Math.tan(e),s=new et;return e<o?s.set(i,i*a,0):e>=o&&e<Math.PI-o?s.set(n/a,n,0):e<Math.PI+o?s.set(-i,-i*a,0):e<2*Math.PI-o?s.set(-n/a,-n,0):s.set(i,i*a,0),{direction:r,position:s}},t}(),zi=function(){function t(t){this._d=(t.width||1)/2,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===Ft.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):wt(0,1);return{direction:new et(0,1,0),position:new et(this._d*(e-.5),0,0)}},t}(),Di=new ot,Fi=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=wt(0,2*Math.PI),n=Mi(this.arc,this.arcMode,t)*q,o=Di.setFromRotationZ(n),a=new et(Math.cos(i),Math.sin(i),0),s=new et(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),Ui=new ot,ki=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.getHorizontalAngle=function(){return wt(-90,90)},t.prototype.generate=function(t){var e=Mi(this.arc,this.arcMode,t)*q,r=this.getHorizontalAngle()*q,i=this.radius,n=new et(Math.cos(r),0,Math.sin(r)),o=Ui.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(i),direction:o}},t}(),Bi=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.getHorizontalAngle=function(){return wt(0,90)},e}(ki),Gi=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=J(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,r=e.length/2-1,i=Math.floor(Mi(r,this.arcMode,t)),n=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,o=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new et(n,o,0);return{position:new et(n*this.width,o*this.height,0),direction:a.normalize()}},t}(),ji=function(){function t(){}return t.prototype.generate=function(){return{position:new et,direction:new et}},t}(),Xi=((Li={})[xt.NONE]=ji,Li[xt.CONE]=Ii,Li[xt.SPHERE]=ki,Li[xt.HEMISPHERE]=Bi,Li[xt.CIRCLE]=Pi,Li[xt.DONUT]=Fi,Li[xt.RECTANGLE]=Vi,Li[xt.EDGE]=zi,Li[xt.RECTANGLE_EDGE]=Ni,Li[xt.TEXTURE]=Gi,Li);var Yi=function(){function t(t){var e=t.time,r=t.interval,i=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+r||1,this.count=i instanceof wr?i:kr(i),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}return t.prototype.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},t.prototype.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},t.prototype.clone=function(){return new t(this)},t}(),Hi=function(t){this.content=t},Wi=function(){function t(t){this.sort=t,this.length=0}return t.prototype.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},t.prototype.insertNode=function(t,e){var r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},t.prototype.shiftNode=function(t){var e=new Hi(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}},t.prototype.pushNode=function(t){var e=new Hi(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}},t.prototype.removeNode=function(t){var e=this.first;if(this.length--,e===t)(r=this.first=e.next)&&(r.pre=null);else if((e=this.last)===t){var r;(r=this.last=e.pre)&&(r.next=null)}else if(t){var i=t.pre,n=t.next;i.next=n,n&&(n.pre=i)}t.pre=null,t.next=null},t.prototype.forEach=function(t,e){var r=this.first,i=0;if(r)do{t.call(e||this,r.content,i++)}while(r=r.next)},t.prototype.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)},t}(),Zi=function(t){function e(e,r,i){var n=t.call(this,e)||this;n.name="ParticleSystemRenderer",n.particleMesh=new Ei(e,r),void 0!==i&&(n.trailMesh=new Oi(e,i));var o=[n.particleMesh.mesh];return n.materials.push(n.particleMesh.mesh.material),n.trailMesh&&(o.push(n.trailMesh.mesh),n.materials.push(n.trailMesh.mesh.material)),n.meshes=o,n}return i(e,t),e.prototype.start=function(){var t,e;this._priority=this.item.listIndex,this.particleMesh.gravityModifier.scaleXCoord(this.item.duration);try{for(var r=l(this.meshes),i=r.next();!i.done;i=r.next()){i.value.start()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e.prototype.update=function(t){var e=this.particleMesh.time;this.particleMesh.mesh.material.setVector4("uParams",new st(e,this.item.duration,0,0))},e.prototype.render=function(t){var e,r;try{for(var i=l(this.meshes),n=i.next();!n.done;n=i.next()){n.value.render(t)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}},e.prototype.reset=function(){var t;this.particleMesh.clearPoints(),null===(t=this.trailMesh)||void 0===t||t.clearAllTrails()},e.prototype.updateTime=function(t,e){this.particleMesh.time=t,this.trailMesh&&(this.trailMesh.time=t,this.trailMesh.onUpdate(e))},e.prototype.minusTimeForLoop=function(t){var e;this.particleMesh.minusTime(t),null===(e=this.trailMesh)||void 0===e||e.minusTime(t)},e.prototype.updateWorldMatrix=function(t){this.particleMesh.mesh.worldMatrix=t,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=t)},e.prototype.setVisible=function(t){var e;this.particleMesh.mesh.setVisible(t),null===(e=this.trailMesh)||void 0===e||e.mesh.setVisible(t)},e.prototype.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},e.prototype.setParticlePoint=function(t,e){this.particleMesh.setPoint(t,e)},e.prototype.removeParticlePoint=function(t){this.particleMesh.removePoint(t)},e.prototype.getParticlePointColor=function(t){return this.particleMesh.getPointColor(t)},e.prototype.hasTrail=function(){return void 0!==this.trailMesh},e.prototype.clearTrail=function(t){var e;null===(e=this.trailMesh)||void 0===e||e.clearTrail(t)},e.prototype.addTrailPoint=function(t,e,r){var i;null===(i=this.trailMesh)||void 0===i||i.addPoint(t,e,r)},e.prototype.setTrailStartPosition=function(t,e){var r;null===(r=this.trailMesh)||void 0===r||r.setPointStartPos(t,e)},e.prototype.getTrailStartPosition=function(t){return this.trailMesh.getPointStartPos(t)},e}(oe),qi=function(t){function e(e,r){var i=t.call(this,e)||this;return i.destoryed=!1,i.getHitTestParams=function(t){var e=i.interaction;if(t||e)return{type:Qr.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)===Dt.removeParticle,ray:t})}}},r&&i.fromData(r),i}return i(e,t),Object.defineProperty(e.prototype,"timePassed",{get:function(){return this.lastUpdate-this.loopStartTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lifetime",{get:function(){return this.timePassed/this.item.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"particleCount",{get:function(){return this.particleLink.length},enumerable:!1,configurable:!0}),e.prototype.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]===Pt.CONSTANT_VEC3?e.add(i[1]):t=kr(i)),this.basicTransform={position:e,rotation:r,path:t};var n=this.transform.parentTransform,o=e.clone();if(t&&o.add(t.getValue(0)),this.transform.setPosition(o.x,o.y,o.z),this.options.particleFollowParent&&n){var a=n.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},e.prototype.updateEmitterTransform=function(t){var e=this.transform.parentTransform,r=this.basicTransform,i=r.path,n=r.position.clone();if(i){var o=this.item.duration;n.add(i.getValue(t/o))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var a=e.getWorldMatrix();this.renderer.updateWorldMatrix(a)}},e.prototype.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 o=i.first;i.removeNode(o),r=n[1]=o.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())},e.prototype.setVisible=function(t){this.renderer.setVisible(t)},e.prototype.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?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new st(n[0],n[1],n[2],t));for(var o=i.getAttributeData("aColor")||[],a=0;a<o.length;a+=32)o[8*a+7]=t},e.prototype.setColor=function(t,e,r,i){var n,o=this.renderer.particleMesh.mesh.material,a=this.renderer.particleMesh.mesh.geometry,s=(null===(n=o.getVector4("uOpacityOverLifetimeValue"))||void 0===n?void 0:n.toArray())||[1,1,1,1];o.setVector4("uOpacityOverLifetimeValue",new st(s[0],s[1],s[2],i));for(var l=a.getAttributeData("aColor")||[],u=0;u<l.length;u+=32)l[8*u+4]=t,l[8*u+5]=e,l[8*u+6]=r,l[8*u+7]=i},e.prototype.setParentTransform=function(t){},e.prototype.getTextures=function(){return this.renderer.getTextures()},e.prototype.start=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},e.prototype.stop=function(){this.ended=!0,this.started=!1},e.prototype.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 Wi((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1},e.prototype.onUpdate=function(t){var e,r=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,n=this.options,o=this.loopStartTime,a=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,this.renderer.updateTime(i,t);var s=this.particleLink,l=(i-o)/this.item.duration,h=this.timePassed,f=!1,p=function(){r.trails&&!f&&(f=!0,s.forEach((function(t){var e=u(t,4),i=e[0],n=e[1],o=e[2],a=e[3];i<h?r.clearPointTrail(n):h>o&&r.updatePointTrail(n,l,a,o)})))};if(this.ended){if(this.item.endBehavior!==Nt.loop&&0===this.item.endBehavior){var d=s.last;d&&d.content[0]<this.lastUpdate&&(this.destoryed=!0)}}else{var m=this.item.duration,y=this.lifetime;if(h<m){var v=1/a.rateOverTime.getValue(y),g=Math.floor((h-this.lastEmitTime)/v),x=g,E=v/g,T=i,_=n.maxCount;this.updateEmitterTransform(h);for(var C=function(){var t=s.first;return r.emissionStopped||s.length===_&&t&&t.content[0]-o>h},b=0;b<x&&b<_&&!C();b++){(L=this.createPoint(y)).delay+=T+b*E,this.addParticle(L,_),this.lastEmitTime=h}for(var O=a.bursts,R=(null==O?void 0:O.length)-1,A=0;R>=0&&A<_&&!C();R--){var w=O[R],S=!w.disabled&&w.getGeneratorOptions(h,y);if(S){var I=a.burstOffsets[R],M=I&&I[S.cycleIndex]||[0,0,0];w.once&&this.removeBurst(R);for(b=0;b<S.count&&A<_&&!C();b++){var L;(L=this.initPoint(this.shape.generate({total:S.total,index:S.index,burstIndex:b,burstCount:S.count}))).delay+=T,A++,(e=L.transform).translate.apply(e,c([],u(M),!1)),this.addParticle(L,_)}}}}else if(this.item.endBehavior===Nt.loop)p(),this.loopStartTime=i-m,this.lastEmitTime-=m,this.lastUpdate-=m,a.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=m,t[2]-=m,t[3].delay-=m})),this.renderer.minusTimeForLoop(m),this.onIterate(this);else{this.ended=!0,this.onEnd(this),4===this.item.endBehavior&&(this.frozen=!0)}}p()}},e.prototype.onDestroy=function(){this.item&&this.item.composition&&(this.item.composition.destroyTextures(this.getTextures()),this.meshes.forEach((function(t){return t.dispose({material:{textures:ft.keep}})})))},e.prototype.getParticleBoxes=function(){var t=this.particleLink,e=this.renderer,r=[],i=this.particleCount,n=0;if(!t||!e)return r;for(var o=t.last,a=!1;!a;){var s=o.content[0],l=o.content[3];if(s>this.timePassed){var u=this.getPointPosition(l);r.push({center:u,size:l.transform.scale}),o.pre?o=o.pre:a=!0}++n>i&&(a=!0)}return r},e.prototype.raycast=function(t){var e=this.particleLink,r=this.renderer;if(e&&r){var i=e.last,n=[],o=new et,a=!1;if(i&&i.content)do{var s=u(i.content,4),l=s[0],c=s[1];s[2];var h=s[3];if(!(l>this.timePassed))break;var f=this.getPointPosition(h),p=t.ray,d=!1;p&&(d=!!p.intersectSphere({center:f,radius:t.radius},o)),d&&(t.removeParticle&&(r.removeParticlePoint(c),this.clearPointTrail(c),e.removeNode(i),i.content=[0]),n.push(f),t.multiple||(a=!0))}while((i=i.pre)&&!a);return n}},e.prototype.clearPointTrail=function(t){this.trails&&this.trails.dieWithParticles&&this.renderer.clearTrail(t)},e.prototype.updatePointTrail=function(t,e,r,i){var n=this.renderer;if(n.hasTrail()){var o=this.trails,a=this.getPointPosition(r),s=o.inheritParticleColor?n.getParticlePointColor(t):[1,1,1,1],l=r.transform.getWorldScale().toArray(),u=1,c=o.lifetime.getValue(e);if(o.sizeAffectsWidth&&(u*=l[0]),o.sizeAffectsLifetime&&(c*=l[0]),o.parentAffectsPosition&&this.transform.parentTransform){a.add(this.transform.parentTransform.position);var h=n.getTrailStartPosition(t);h&&a.subtract(h)}n.addTrailPoint(t,a,{color:s,lifetime:c,size:u,time:i})}},e.prototype.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,o=t.gravity,a=void 0===o?[]:o,s=this.options.forceTarget,l=this.lastUpdate-n,u=new et,c=et.fromArray(a);e.assignWorldTRS(u);var h=Tr(new et,this.options,c,l,i,u,r);if(s){var f=s.target||[0,0,0],p=s.curve.getValue(l/i),d=1-p;h.x=h.x*d+f[0]*p,h.y=h.y*d+f[1]*p,h.z=h.z*d+f[2]*p}return h},e.prototype.onEnd=function(t){},e.prototype.onIterate=function(t){},e.prototype.initPoint=function(t){var e=this.options,r=this.lifetime,i=this.shape,n=e.startSpeed.getValue(r),o=e.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),a=o.transformPoint(t.position,new et),s=new qr({position:a,valid:!0}),l=t.direction;if(l=o.transformNormal(l,Qi).normalize(),e.startTurbulence&&e.turbulence){for(var u=0;u<3;u++)en.setElement(u,e.turbulence[u].getValue(r));rn.setFromVector3(en.negate()),on.setFromEuler(rn).transformNormal(l).normalize()}var c,h=$i,f=tn;i.alignSpeedDirection?(f.copyFrom(l),this.upDirectionWorld||(i.upDirection?this.upDirectionWorld=i.upDirection.clone():this.upDirectionWorld=et.Z.clone(),o.transformNormal(this.upDirectionWorld)),h.crossVectors(f,this.upDirectionWorld).normalize(),h.isZero()&&h.set(1,0,0)):(h.set(1,0,0),f.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((c=nn)[0]=p.animationDelay.getValue(r),c[1]=p.animationDuration.getValue(r),c[2]=p.cycles.getValue(r));var d=Ji;e.start3DRotation?d.set(e.startRotationX.getValue(r),e.startRotationY.getValue(r),e.startRotationZ.getValue(r)):e.startRotation?d.set(0,0,e.startRotation.getValue(r)):d.set(0,0,0),s.setRotation(d.x,d.y,d.z);var m=e.startColor.getValue(r);3===m.length&&(m[3]=1);var y=Ki;if(e.start3DSize)y.x=e.startSizeX.getValue(r),y.y=e.startSizeY.getValue(r);else{var v=e.startSize.getValue(r),g=e.sizeAspect.getValue(r);y.x=v,y.y=0===g?0:v/g}var x=l.clone();if(x.multiply(n),!e.particleFollowParent){var E=new et;this.transform.assignWorldTRS(void 0,void 0,E),y.x*=E.x,y.y*=E.y}return s.setScale(y.x,y.y,1),{size:y,vel:x,color:m,delay:e.startDelay.getValue(r),lifetime:e.startLifetime.getValue(r),uv:sn(this.uvs,!0),gravity:e.gravity,sprite:c,dirY:f,dirX:h,transform:s}},e.prototype.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&e instanceof Array){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return-1},e.prototype.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},e.prototype.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))},e.prototype.stopParticleEmission=function(){this.emissionStopped=!0},e.prototype.resumeParticleEmission=function(){this.emissionStopped=!1},e.prototype.getBoundingBox=function(){var t=this.getParticleBoxes();return{type:Qr.sphere,area:t}},e.prototype.fromData=function(e){var r,i,o,a,s,l;t.prototype.fromData.call(this,e);var u=e;this.props=u,this.destoryed=!1;var c,h=u.options,f=u.positionOverLifetime,p=u.shape,d=f.gravityOverLifetime,m=_r(f.gravity),y=u.textureSheetAnimation,v=y?{animationDelay:kr(y.animationDelay||0),animationDuration:kr(y.animationDuration||1),cycles:kr(y.cycles||1),animate:y.animate,col:y.col,row:y.row,total:y.total||y.col*y.row}:void 0,g=!!(p&&p.turbulenceX||p.turbulenceY||p.turbulenceZ);g&&(c=[kr(null!==(r=p.turbulenceX)&&void 0!==r?r:0),kr(null!==(i=p.turbulenceY)&&void 0!==i?i:0),kr(null!==(o=p.turbulenceZ)&&void 0!==o?o:0)]),this.name="ParticleSystem",this.shape=function(t){if(!t)return new ji;var e=n({radius:1,arc:360,angle:0,arcMode:Ft.RANDOM},t),r=t.type,i=Xi[r];if(!i)throw Error("invalid shape:"+r);var o=new i(e);if(r!==xt.NONE){var a=t,s=a.alignSpeedDirection,l=a.upDirection,u=void 0===l?[0,0,1]:l;o.alignSpeedDirection=s,o.upDirection=et.fromArray(u).normalize()}return o}(p),this.emission={rateOverTime:kr(u.emission.rateOverTime),burstOffsets:an(null!==(a=u.emission.burstOffsets)&&void 0!==a?a:[]),bursts:(u.emission.bursts||[]).map((function(t){return new Yi(t)}))},this.textureSheetAnimation=v;var x,E=u.renderer||{},T={},_=u.rotationOverLifetime;_&&(T.asRotation=!!_.asRotation,T.z=_.z?kr(_.z):kr(0),_.separateAxes&&(T.x=_.x&&kr(_.x),T.y=_.y&&kr(_.y))),f.forceTarget&&(x={target:f.target||[0,0,0],curve:kr(f.forceCurve||[Pt.LINE,[[0,0],[1,1]]])});var C={x:f.linearX&&kr(f.linearX||0),y:f.linearY&&kr(f.linearY||0),z:f.linearZ&&kr(f.linearZ||0),asMovement:f.asMovement},b={x:f.orbitalX&&kr(f.orbitalX),y:f.orbitalY&&kr(f.orbitalY),z:f.orbitalZ&&kr(f.orbitalZ),center:f.orbCenter,asRotation:f.asRotation},O=u.sizeOverLifetime||{},R=u.colorOverLifetime,A=(null==O?void 0:O.separateAxes)?{separateAxes:!0,x:kr(O.x),y:kr(O.y)}:{separateAxes:!1,x:kr(("size"in O?O.size:O.x)||1)},w=tt.fromArray(Or(E.anchor,E.particleOrigin));this.options={particleFollowParent:!!h.particleFollowParent,startLifetime:kr(h.startLifetime),startDelay:kr(h.startDelay||0),startSpeed:kr(f.startSpeed||0),startColor:kr(h.startColor),looping:!1,maxCount:null!==(s=h.maxCount)&&void 0!==s?s:0,gravityModifier:kr(d||0),gravity:m,start3DSize:!!h.start3DSize,startTurbulence:g,turbulence:c,speedOverLifetime:f.speedOverLifetime&&kr(f.speedOverLifetime),linearVelOverLifetime:C,orbitalVelOverLifetime:b,forceTarget:x},h.startRotationZ&&(this.options.startRotation=kr(h.startRotationZ||0)),(h.startRotationX||h.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=kr(h.startRotationX||0),this.options.startRotationY=kr(h.startRotationY||0),this.options.startRotationZ=kr(h.startRotationZ||0)),h.start3DSize?(this.options.startSizeX=kr(h.startSizeX),this.options.startSizeY=kr(h.startSizeY)):(this.options.startSize=kr(h.startSize),this.options.sizeAspect=kr(h.sizeAspect||1));var S={meshSlots:h.meshSlots,name:this.name,matrix:ot.IDENTITY,filter:u.filter,shaderCachePrefix:"",renderMode:E.renderMode||bt.BILLBOARD,side:E.side||vt.DOUBLE,gravity:m,blending:E.blending||yt.ALPHA,rotationOverLifetime:T,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:v,occlusion:!!E.occlusion,transparentOcclusion:!!E.transparentOcclusion,maxCount:h.maxCount,mask:E.mask,maskMode:null!==(l=E.maskMode)&&void 0!==l?l:gt.NONE,forceTarget:x,diffuse:E.texture,sizeOverLifetime:A,anchor:w};if(R){var I=R.color,M=R.opacity;S.colorOverLifetime={},M&&(S.colorOverLifetime.opacity=kr(R.opacity)),I&&(I[0]===Pt.GRADIENT_COLOR?S.colorOverLifetime.color=R.color[1]:I[0]===Pt.RGBA_COLOR?S.colorOverLifetime.color=Ee.createWithData(this.engine,{data:new Uint8Array(I[1]),width:1,height:1}):I instanceof Ee&&(S.colorOverLifetime.color=I))}var L,P=[],V=[0,0,1,1];if(u.splits){var N=u.splits[0];V=(L=N[4])?[N[0],N[1],N[3],N[2]]:[N[0],N[1],N[2],N[3]]}if(v&&!v.animate)for(var z=L?v.row:v.col,D=L?v.col:v.row,F=v.total||z*D,U=0,k=0;k<z;k++)for(var B=0;B<D&&U<F;B++,U++)P.push([k*V[2]/z+V[0],B*V[3]/D+V[1],V[2]/z,V[3]/D]);else P.push(V);this.uvs=P,S.textureFlip=L;var G,j=u.trails;j&&(this.trails={lifetime:kr(j.lifetime),dieWithParticles:!1!==j.dieWithParticles,sizeAffectsWidth:!!j.sizeAffectsWidth,sizeAffectsLifetime:!!j.sizeAffectsLifetime,inheritParticleColor:!!j.inheritParticleColor,parentAffectsPosition:!!j.parentAffectsPosition},G={name:"Trail",matrix:ot.IDENTITY,minimumVertexDistance:j.minimumVertexDistance||.02,maxTrailCount:h.maxCount,pointCountPerTrail:Math.round(j.maxPointPerTrail)||32,blending:j.blending,texture:j.texture,opacityOverLifetime:kr(j.opacityOverLifetime||1),widthOverTrail:kr(j.widthOverTrail||1),shaderCachePrefix:"",lifetime:this.trails.lifetime,occlusion:!!j.occlusion,transparentOcclusion:!!j.transparentOcclusion,textureMap:j.textureMap,mask:E.mask,maskMode:E.maskMode},j.colorOverLifetime&&j.colorOverLifetime[0]===Pt.GRADIENT_COLOR&&(G.colorOverLifetime=j.colorOverLifetime[1]),j.colorOverTrail&&j.colorOverTrail[0]===Pt.GRADIENT_COLOR&&(G.colorOverTrail=j.colorOverTrail[1])),this.renderer=new Zi(this.engine,S,G),this.meshes=this.renderer.meshes;var X=u.interaction;X&&(this.interaction={multiple:X.multiple,radius:X.radius,behavior:X.behavior}),this.item.getHitTestParams=this.getHitTestParams,this.item._content=this,this.renderer.item=this.item,this.item.components.push(this.renderer),this.item.rendererComponents.push(this.renderer),this.item.getComponent(li).createTrack(ui).createClip(un)},e=o([$t(ur.ParticleSystem)],e)}(re),Qi=new et,Ki=new tt,Ji=new at,$i=new et,tn=new et,en=new et,rn=new at,nn=[0,0,0],on=new ot;function an(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var r=t instanceof 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 sn(t,e){var r=Math.floor(Math.random()*t.length),i=t[r];return e||t.splice(r,1),i}var ln,un=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.onPlayablePlay=function(){this.particleSystem=this.bindingItem.getComponent(qi),this.particleSystem&&(this.particleSystem.name=this.bindingItem.name,this.particleSystem.start(),this.particleSystem.initEmitterTransform())},e.prototype.processFrame=function(t){var e=this.particleSystem;e&&(this.bindingItem.parent,e.setVisible(!0),e.onUpdate(t))},e}(ai),cn=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}i(e,t)}(yr),function(){function t(t){this.curveValues={},this.playable=t}return t.prototype.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]},t.prototype.findCurveValue=function(t,e){return this.curveValues[t+e]},t.prototype.getInputStream=function(t){var e=this.playable.getInput(t);if(e instanceof hn)return e.animationStream},t}()),hn=function(t){function e(){var e=t.call(this)||this;return e.animationStream=new cn(e),e}return i(e,t),e}(ai),fn=new at,pn=new et(1,1,1),dn=new et,mn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.processFrame=function(t){this.bindingItem.composition&&this.sampleAnimation()},e.prototype.sampleAnimation=function(){var t=this,e=this.bindingItem.duration,r=this.time/e;if(r=r<0?0:r>1?1:r,this.sizeXOverLifetime){pn.x=this.sizeXOverLifetime.getValue(r),this.sizeSeparateAxes?(pn.y=this.sizeYOverLifetime.getValue(r),pn.z=this.sizeZOverLifetime.getValue(r)):pn.z=pn.y=pn.x;var i=this.originalTransform.scale;this.bindingItem.transform.setScale(pn.x*i.x,pn.y*i.y,pn.z*i.z)}if(this.rotationOverLifetime){var n=function(i){return t.rotationOverLifetime.asRotation?i.getValue(r):i.getIntegrateValue(0,r,e)},o=n(this.rotationOverLifetime.z),a=this.rotationOverLifetime.separateAxes;fn.x=a?n(this.rotationOverLifetime.x):0,fn.y=a?n(this.rotationOverLifetime.y):0,fn.z=o;var s=fn.addEulers(this.originalTransform.rotation,fn);this.bindingItem.transform.setRotation(s.x,s.y,s.z)}if(this.positionOverLifetime){var l=dn;Tr(l,this,this.gravity,this.time,e,this.originalTransform.position,this.velocity),this.originalTransform.path&&l.add(this.originalTransform.path.getValue(r)),this.bindingItem.transform.setPosition(l.x,l.y,l.z)}},e.prototype.fromData=function(t){var e,r=this.bindingItem.transform.scale;this.originalTransform={position:this.bindingItem.transform.position.clone(),rotation:this.bindingItem.transform.getRotation().clone(),scale:new et(r.x,r.y,r.x)};var i=t.positionOverLifetime,n=t.rotationOverLifetime,o=t.sizeOverLifetime;if(i&&0!==Object.keys(i).length){this.positionOverLifetime=i,i.path&&(this.originalTransform.path=kr(i.path));var a=i.linearX||i.linearY||i.linearZ;a&&(this.linearVelOverLifetime={x:i.linearX&&kr(i.linearX),y:i.linearY&&kr(i.linearY),z:i.linearZ&&kr(i.linearZ),asMovement:i.asMovement,enabled:!!a});var s=i.orbitalX||i.orbitalY||i.orbitalZ;s&&(this.orbitalVelOverLifetime={x:i.orbitalX&&kr(i.orbitalX),y:i.orbitalY&&kr(i.orbitalY),z:i.orbitalZ&&kr(i.orbitalZ),center:_r(i.orbCenter),asRotation:i.asRotation,enabled:!!s}),this.speedOverLifetime=i.speedOverLifetime&&kr(i.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=kr(o.x||1),this.sizeYOverLifetime=kr(o.y||1),this.sizeZOverLifetime=kr(o.z||1)):this.sizeXOverLifetime=kr(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:kr(n.z||0)},n.separateAxes)){var l=this.rotationOverLifetime;l.x=kr(n.x||0),l.y=kr(n.y||0)}this.gravity=et.fromArray((null==i?void 0:i.gravity)||[]),this.gravityModifier=kr(null!==(e=null==i?void 0:i.gravityOverLifetime)&&void 0!==e?e:0),this.direction=(null==i?void 0:i.direction)?et.fromArray(i.direction).normalize():new et,this.startSpeed=(null==i?void 0:i.startSpeed)||0,this.velocity=this.direction.clone(),this.velocity.multiply(this.startSpeed)},e}(hn),yn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.onGraphStart=function(){this.bindingItem.transform.setValid(!1),this.hideRendererComponents()},e.prototype.onPlayablePlay=function(){this.bindingItem.transform.setValid(!0),this.showRendererComponents()},e.prototype.onPlayableDestroy=function(){this.bindingItem.transform.setValid(!1),this.hideRendererComponents()},e.prototype.hideRendererComponents=function(){var t,e;try{for(var r=l(this.bindingItem.rendererComponents),i=r.next();!i.done;i=r.next()){var n=i.value;n.enabled&&(n.enabled=!1)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e.prototype.showRendererComponents=function(){var t,e;try{for(var r=l(this.bindingItem.rendererComponents),i=r.next();!i.done;i=r.next()){var n=i.value;n.enabled||(n.enabled=!0)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}},e}(ai),vn=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,o=t.textOverflow,a=void 0===o?jt.display:o,s=t.textBaseline,l=void 0===s?Xt.top:s,u=t.textAlign,c=void 0===u?Yt.left:u,h=t.text,f=t.letterSpace,p=void 0===f?0:f,d=t.autoWidth,m=void 0!==d&&d,y=t.fontSize,v=t.lineHeight,g=void 0===v?y:v,x=y+p;this.autoWidth=m,this.maxTextWidth=h.length*x,this.width=n,this.height=r,this.letterSpace=p,this.overFlow=a,this.textBaseline=l,this.textAlign=c,this.lineHeight=g}return t.prototype.getOffsetY=function(t){var e=0,r=(t.fontSize+t.outlineWidth)*t.fontScale;switch(this.textBaseline){case 0:e=r;break;case 1:e=(this.height+r)/2;break;case 2:e=this.height-r/2}return e},t.prototype.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case 0:r=t.outlineWidth*t.fontScale;break;case 1:r=(this.width*t.fontScale-e)/2;break;case 2:r=this.width*t.fontScale-e}return r},t.prototype.setSize=function(t,e){this.width=t,this.height=e},t}(),gn=function(t){var e,r,i,n,o,a;this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var s=t.textColor,l=void 0===s?[1,1,1,1]:s,u=t.fontSize,c=void 0===u?40:u,h=t.outline,f=t.shadow,p=t.fontWeight,d=void 0===p?"normal":p,m=t.fontStyle,y=void 0===m?"normal":m,v=t.fontFamily,g=void 0===v?"sans-serif":v;this.textColor=l,this.textWeight=d,this.fontStyle=y,this.fontFamily=g,this.fontSize=c,h&&(this.isOutlined=!0,this.outlineColor=null!==(e=h.outlineColor)&&void 0!==e?e:[1,1,1,1],this.outlineWidth=null!==(r=h.outlineWidth)&&void 0!==r?r:1,this.fontOffset+=this.outlineWidth),f&&(this.hasShadow=!0,this.shadowBlur=null!==(i=f.shadowBlur)&&void 0!==i?i:2,this.shadowColor=null!==(n=f.shadowColor)&&void 0!==n?n:[0,0,0,1],this.shadowOffsetX=null!==(o=f.shadowOffsetX)&&void 0!==o?o:0,this.shadowOffsetY=null!==(a=f.shadowOffsetY)&&void 0!==a?a:0),this.fontStyle!==Wt.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))};!function(){function t(){}t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var r={ascent:0,descent:0,fontSize:0},i=t._canvas,n=i.getContext("2d",{willReadFrequently:!0});n.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,a=Math.ceil(n.measureText(o).width),s=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),l=Math.ceil(t.HEIGHT_MULTIPLIER*s);s=s*t.BASELINE_MULTIPLIER|0,i.width=a,i.height=l,n.fillStyle="#f00",n.fillRect(0,0,a,l),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,s);var u=n.getImageData(0,0,a,l).data,c=u.length,h=4*a,f=0,p=0,d=!1;for(f=0;f<s;++f){for(var m=0;m<h;m+=4)if(255!==u[p+m]){d=!0;break}if(d)break;p+=h}for(r.ascent=s-f,p=c-h,d=!1,f=l;f>s;--f){for(m=0;m<h;m+=4)if(255!==u[p+m]){d=!0;break}if(d)break;p-=h}return r.descent=f-s,r.fontSize=r.ascent+r.descent,t._fonts[e]=r,r},Object.defineProperty(t,"_canvas",{get:function(){var e;return xi(vi)?(e=window._createOffscreenCanvas(10,10),t.__canvas=e):t.__canvas||((e=document.createElement("canvas")).width=e.height=10,t.__canvas=e),t.__canvas},enumerable:!1,configurable:!0}),t._fonts={},t.METRICS_STRING="|ÉqÅ",t.BASELINE_SYMBOL="M",t.BASELINE_MULTIPLIER=1.4,t.HEIGHT_MULTIPLIER=2}(),function(t){t[t.Default=0]="Default",t[t.Clip=1]="Clip",t[t.Ellipsis=2]="Ellipsis"}(ln||(ln={}));var xn=["serif","sans-serif","monospace","courier"],En=new(function(){function t(){this.elements=[]}return t.prototype.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements=[]},t.prototype.getCanvas=function(){if(this.elements.length)return this.elements.shift();if(xi(vi))return window._createOffscreenCanvas(10,10);var t=document.createElement("canvas");return t.getContext("2d",{willReadFrequently:!0}),t},t.prototype.saveCanvas=function(t){t.width=t.height=1,this.elements.length<3?D(this.elements,t):t.remove()},t}()),Tn=function(t){function e(e,r){var i=t.call(this,e,r)||this;if(i.isDirty=!0,i.canvas=En.getCanvas(),En.saveCanvas(i.canvas),i.context=i.canvas.getContext("2d",{willReadFrequently:!0}),!r)return i;var n=r.options;return i.textStyle=new gn(n),i.textLayout=new vn(n),i.text=n.text,i.updateTexture(),i}return i(e,t),e.prototype.setFontSize=function(t){this.textStyle.fontSize!==t&&(this.textStyle.fontSize=t,this.textLayout.lineHeight=1.5175*this.textStyle.fontSize,this.isDirty=!0)},e.prototype.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.prototype.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.prototype.setText=function(t){this.text!==t&&(this.text=t,this.isDirty=!0)},e.prototype.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.prototype.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.prototype.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.prototype.setFontFamily=function(t){this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0)},e.prototype.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.prototype.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.prototype.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.prototype.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.prototype.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.prototype.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.prototype.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.prototype.update=function(e){t.prototype.update.call(this,e),this.updateTexture()},e.prototype.updateTexture=function(){if(this.isDirty&&this.context&&this.canvas){var t=this.context,e=this.textStyle,r=this.textLayout,i=e.fontScale,n=(r.width+e.fontOffset)*i,o=r.height*i,a=e.fontSize*i,s=r.lineHeight*i;this.char=(this.text||"").split(""),this.canvas.width=n,this.canvas.height=o,t.clearRect(0,0,n,this.canvas.height),t.fillStyle="rgba(255, 255, 255, 0.0039)",t.fillRect(0,0,n,this.canvas.height),e.fontDesc=this.getFontDesc(),t.font=e.fontDesc,e.hasShadow&&this.setupShadow(),e.isOutlined&&this.setupOutline(),t.fillStyle="rgba(".concat(e.textColor[0],", ").concat(e.textColor[1],", ").concat(e.textColor[2],", ").concat(e.textColor[3],")");for(var l=[],u=(s-a)/3,c=0,h=r.getOffsetY(e)+u,f=[],p=[],d=0;d<this.char.length;d++){var m=this.char[d],y=t.measureText(m);((c+=r.letterSpace*i)+y.width>n&&d>0||"\n"===m)&&(l.push({y:h,width:c,chars:f,charOffsetX:p}),c=0,h+=s,f=[],p=[]),"\n"!==m&&(f.push(m),p.push(c),c+=y.width)}l.push({y:h,width:c,chars:f,charOffsetX:p}),l.forEach((function(i){var n=r.getOffsetX(e,i.width);i.chars.forEach((function(r,o){e.isOutlined&&t.strokeText(r,n+i.charOffsetX[o],i.y),t.fillText(r,n+i.charOffsetX[o],i.y)}))})),e.hasShadow&&(t.shadowColor="transparent");var v=t.getImageData(0,0,this.canvas.width,this.canvas.height);this.material.setTexture("uSampler0",Ee.createWithData(this.engine,{data:new Uint8Array(v.data),width:v.width,height:v.height},{flipY:!0,magFilter:le.LINEAR,minFilter:le.LINEAR,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE})),this.isDirty=!1}},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.options;this.textStyle=new gn(r),this.textLayout=new vn(r),this.text=r.text,this.updateTexture()},e.prototype.getFontDesc=function(){var t=this.textStyle,e="".concat((t.fontSize*t.fontScale).toString(),"px ");return xn.includes(t.fontFamily)?e+=t.fontFamily:e+='"'.concat(t.fontFamily,'"'),t.textWeight!==Ht.normal&&(e="".concat(t.textWeight," ").concat(e)),t.fontStyle!==Wt.normal&&(e="".concat(t.fontStyle," ").concat(e)),e},e.prototype.setupOutline=function(){var t=this.context,e=this.textStyle;t.strokeStyle="rgba(".concat(255*e.outlineColor[0],", ").concat(255*e.outlineColor[1],", ").concat(255*e.outlineColor[2],", ").concat(e.outlineColor[3],")"),t.lineWidth=2*e.outlineWidth},e.prototype.setupShadow=function(){var t=this.context,e=this.textStyle;t.shadowColor="rgba(".concat(255*e.shadowColor[0],", ").concat(255*e.shadowColor[1],", ").concat(255*e.shadowColor[2],", ").concat(e.shadowColor[3],")"),t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=-e.shadowOffsetY},e=o([$t(ur.TextComponent)],e)}(mi),_n=(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}i(e,t)}(yr),1),Cn=function(t){function e(e){var r=t.call(this,e)||this;r.worldMatrix=ot.fromIdentity(),r.triangles=[],r.destroyed=!1,r.visible=!1,r.getHitTestParams=function(t){var e=r.getBoundingBox();if(e)return{type:e.type,triangles:e.area}},r.id="Mesh"+_n++,r.name="<unnamed>",r._priority=0,r.geometry=ze.create(r.engine);var i={vertices:[-1,1,0,-1,-1,0,1,1,0,1,-1,0],uvs:[0,1,0,0,1,1,1,0],indices:[0,1,2,2,1,3],dataType:ur.Geometry,id:It()};return r.geometry.fromData(i),r.triangles=bn(r.geometry),r}return i(e,t),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.setVisible=function(t){this.visible=t},e.prototype.start=function(){this.item.getHitTestParams=this.getHitTestParams},e.prototype.render=function(t){var e=this.material,r=this.geometry;t.renderingData.currentFrame.globalUniforms&&t.setGlobalMatrix("effects_ObjectToWorld",this.transform.getWorldMatrix()),r.flush(),t.drawGeometry(r,e)},e.prototype.getVisible=function(){return this.visible},e.prototype.firstGeometry=function(){return this.geometry},e.prototype.setMaterial=function(t,e){e!==ft.keep&&this.material.dispose(e),this.material=t},e.prototype.getBoundingBox=function(){var t,e,r=this.transform.getWorldMatrix();this.hitTestGeometry!==this.geometry&&(this.triangles=bn(this.geometry),this.hitTestGeometry=this.geometry);var i=[];try{for(var n=l(this.triangles),o=n.next();!o.done;o=n.next()){var a=o.value;i.push({p0:a.p0,p1:a.p1,p2:a.p2})}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}return i.forEach((function(t){t.p0=r.transformPoint(t.p0,new et),t.p1=r.transformPoint(t.p1,new et),t.p2=r.transformPoint(t.p2,new et)})),{type:Qr.triangle,area:i}},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e),this.material=this.materials[0]},e.prototype.toData=function(){this.taggedProperties.id=this.guid},e.prototype.dispose=function(e){this.destroyed||(this.destroyed=!0,t.prototype.dispose.call(this))},o([Jt()],e.prototype,"geometry",void 0),e=o([$t(ur.EffectComponent)],e)}(oe);function bn(t){for(var e=t.getIndexData(),r=t.getAttributeData("aPos"),i=[],n=0;n<e.length;n+=3){var o=3*e[n],a=3*e[n+1],s=3*e[n+2],l={x:r[o],y:r[o+1],z:r[o+2]},u={x:r[a],y:r[a+1],z:r[a+2]},c={x:r[s],y:r[s+1],z:r[s+2]};i.push({p0:l,p1:u,p2:c})}return i}var On,Rn=function(t){function e(e,r){var i=t.call(this,e)||this;return i.children=[],i.transform=new qr,i.duration=0,i.start=0,i.ended=!1,i.delaying=!0,i.type=Ct.base,i.stopped=!1,i.components=[],i.itemBehaviours=[],i.rendererComponents=[],i.visible=!0,i._contentVisible=!1,i.speed=1,i.name="VFXItem",i.transform.name=i.name,i.transform.engine=e,i.addComponent(li),r&&i.fromData(r),i}var r;return i(e,t),r=e,e.isComposition=function(t){return t.type===Ct.composition},e.isSprite=function(t){return t.type===Ct.sprite},e.isParticle=function(t){return t.type===Ct.particle},e.isNull=function(t){return t.type===Ct.null},e.isTree=function(t){return t.type===Ct.tree},e.isCamera=function(t){return t.type===Ct.camera},e.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},Object.defineProperty(e.prototype,"content",{get:function(){return this._content},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"reusable",{get:function(){var t,e;return null!==(e=null===(t=this.composition)||void 0===t?void 0:t.reusable)&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lifetimeStarted",{get:function(){return!this.delaying},enumerable:!1,configurable:!0}),e.prototype.setSpeed=function(t){this.speed=t},e.prototype.getSpeed=function(){return this.speed},e.prototype.addComponent=function(t){var e=new t(this.engine);return e.item=this,this.components.push(e),e.onAttached(),e},e.prototype.getComponent=function(t){var e,r,i;try{for(var n=l(this.components),o=n.next();!o.done;o=n.next()){var a=o.value;if(a instanceof t){i=a;break}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return i},e.prototype.getComponents=function(t){var e,r,i=[];try{for(var n=l(this.components),o=n.next();!o.done;o=n.next()){var a=o.value;a instanceof t&&i.push(a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return i},e.prototype.setParent=function(t){t!==this&&(this.parent&&F(this.parent.children,this),this.parent=t,t&&(r.isCamera(this)||(this.transform.parentTransform=t.transform),t.children.push(this),this.composition||(this.composition=t.composition)))},e.prototype.stop=function(){this.stopped=!0},e.prototype.onEnd=function(){},e.prototype.setColor=function(t,e,r,i){},e.prototype.setOpacity=function(t){},e.prototype.getVisible=function(){return this.visible},e.prototype.setVisible=function(t){this.visible!==t&&(this.visible=!!t)},e.prototype.getWorldTransform=function(t){var e=null!=t?t:new qr({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},e.prototype.getNodeTransform=function(t){for(var e=0;e<this.components.length;e++){var r=this.components[1];if(r.getNodeTransform)return r.getNodeTransform(t)}return this.transform},e.prototype.translate=function(t,e,r){this.transform.translate(t,e,r)},e.prototype.rotate=function(t,e,r){var i=new at(t,e,r),n=rt.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},e.prototype.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},e.prototype.setPositionByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,o=i.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition(2*t*n/a,-2*e*o/s,r)}},e.prototype.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},e.prototype.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},e.prototype.setScale=function(t,e,r){this.transform.setScale(t,e,r)},e.prototype.getBoundingBox=function(){},e.prototype.getHitTestParams=function(t){},e.prototype.getCurrentPosition=function(){var t=new et;return this.transform.assignWorldTRS(t),t},e.prototype.isEnded=function(t){return t-this.duration>.001},e.prototype.find=function(t){var e,r,i,n;if(this.name===t)return this;try{for(var o=l(this.children),a=o.next();!a.done;a=o.next()){if((c=a.value).name===t)return c}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}try{for(var s=l(this.children),u=s.next();!u.done;u=s.next()){var c;return(c=u.value).find(t)}}catch(t){i={error:t}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}},e.prototype.fromData=function(e){var r,i;t.prototype.fromData.call(this,e);var n=e.id,o=e.name,a=e.delay,s=e.parentId,u=e.endBehavior,c=e.transform,h=e.listIndex,f=void 0===h?0:h,p=e.duration,d=void 0===p?0:p;this.props=e,this.type=e.type,this.id=n.toString(),this.name=o,this.start=a||this.start,c&&c.scale&&"ECS"!==e.type&&(c.scale.z=c.scale.x),c&&(c.position=(new et).copyFrom(c.position),c.rotation=(new at).copyFrom(c.rotation),c.scale=(new et).copyFrom(c.scale),this.transform.setTransform(c)),this.transform.name=this.name,this.transform.engine=this.engine,e.type===Ct.sprite&&c&&(this.transform.setSize(this.transform.scale.x,this.transform.scale.y),this.transform.setScale(1,1,1)),this.parentId=s,this.duration=d,this.endBehavior=u,3!==this.endBehavior&&1!==this.endBehavior||(this.endBehavior=4),this.lifetime=-this.start/this.duration,this.listIndex=f,e.content||(e.content={options:{}});var m=this.getComponent(li);if(m.fromData(e.content),e.type===Ct.sprite){var y=e.content;y.renderer||(y.renderer={});var v=Or(y.renderer.anchor,y.renderer.particleOrigin),g=this.transform.size;y.renderer.anchor||void 0===y.renderer.particleOrigin||this.transform.position.add([-v[0]*g.x,-v[1]*g.y,0]),this.transform.setAnchor(v[0]*g.x,v[1]*g.y,0)}this.type!==Ct.particle&&m.createTrack(ui,"AnimationTrack").createClip(mn,"AnimationTimelineClip").playable.fromData(e.content);if(m.createTrack(ui,"ActivationTrack").createClip(yn,"ActivationTimelineClip"),d<=0)throw Error("Item duration can't be less than 0, see ".concat(Jr));if(e.components)try{for(var x=l(e.components),E=x.next();!E.done;E=x.next()){var T=E.value;this.components.push(T),T instanceof oe?this.rendererComponents.push(T):T instanceof ne&&this.itemBehaviours.push(T)}}catch(t){r={error:t}}finally{try{E&&!E.done&&(i=x.return)&&i.call(x)}finally{if(r)throw r.error}}},e.prototype.toData=function(){var t,e,r,i;if(this.taggedProperties.id=this.guid,this.taggedProperties.transform=this.transform.toData(),this.taggedProperties.dataType=ur.VFXItemData,"rootItem"!==(null===(r=this.parent)||void 0===r?void 0:r.name)&&(this.taggedProperties.parentId=null===(i=this.parent)||void 0===i?void 0:i.guid),!this.taggedProperties.components){this.taggedProperties.components=[];try{for(var n=l(this.components),o=n.next();!o.done;o=n.next()){var a=o.value;a instanceof Cn&&this.taggedProperties.components.push(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}}this.taggedProperties.content={}},e.prototype.translateByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,o=i.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.translate(2*t*n/a,-2*e*o/s,0)}},e.prototype.dispose=function(){var t,e;if(this.resetChildrenParent(),this.composition){this.composition.destroyItem(this);try{for(var r=l(this.components.slice()),i=r.next();!i.done;i=r.next()){i.value.dispose()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=r.return)&&e.call(r)}finally{if(t)throw t.error}}this.components=[],this._content=void 0,this.composition=null,this._contentVisible=!1,this.transform.setValid(!1)}},e.prototype.resetChildrenParent=function(){var t,e,r;try{for(var i=l(this.children),n=i.next();!n.done;n=i.next()){var o=n.value;this.parent&&o.setParent(this.parent)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}this.parent&&F(null===(r=this.parent)||void 0===r?void 0:r.children,this)},e=r=o([$t(ur.VFXItemData)],e)}(ee);function An(t,e){var r=t.type,i=t.pluginName;if(!i)switch(r){case Ct.null:case Ct.base:i="cal";break;case Ct.sprite:i="sprite";break;case Ct.particle:i="particle";break;case Ct.interact:i="interact";break;case Ct.camera:i="camera";break;case Ct.filter:i="filter";break;case Ct.text:i="text";break;case Ct.tree:i="tree";break;default:throw new Error("invalid vfx item type")}return e.pluginSystem.createPluginItem(i,t,e)}!function(t){t.is=function(t,e){return t.type===e},t.isFilter=function(t){return t.type===Ct.filter},t.isComposition=function(t){return t.type===Ct.composition},t.isParticle=function(t){return t.type===Ct.particle},t.isNull=function(t){return t.type===Ct.null}}(On||(On={}));var wn,Sn,In,Mn,Ln,Pn,Vn,Nn,zn,Dn,Fn,Un=[];function kn(t,e,r,i){i&&D(Un,t)}
|
|
15
|
+
/*!
|
|
16
|
+
* Name: @galacean/effects-specification
|
|
17
|
+
* Description: Galacean Effects JSON Specification
|
|
18
|
+
* Author: Ant Group CO., Ltd.
|
|
19
|
+
* Version: v1.0.1
|
|
20
|
+
*/!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(wn||(wn={})),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"}(Sn||(Sn={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(In||(In={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Mn||(Mn={})),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"}(Ln||(Ln={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(Pn||(Pn={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Vn||(Vn={})),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"}(Nn||(Nn={})),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.filter="8",t.spine="spine",t.mesh="mesh",t.tree="tree",t.text="text",t.light="light",t.skybox="skybox"}(zn||(zn={})),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"}(Dn||(Dn={})),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"}(Fn||(Fn={}));var Bn,Gn,jn,Xn,Yn,Hn,Wn,Zn,qn,Qn,Kn,Jn,$n,to,eo,ro,io,no;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(Bn||(Bn={})),function(t){t[t.destroy=0]="destroy",t[t.pause=1]="pause",t[t.restart=5]="restart",t[t.forward=2]="forward",t[t.pause_destroy=3]="pause_destroy"}(Gn||(Gn={})),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"}(jn||(jn={})),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"}(Xn||(Xn={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(Yn||(Yn={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(Hn||(Hn={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(Wn||(Wn={})),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"}(Zn||(Zn={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(qn||(qn={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Qn||(Qn={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(Kn||(Kn={})),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"}(Jn||(Jn={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}($n||($n={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(to||(to={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(eo||(eo={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(ro||(ro={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(io||(io={})),"function"==typeof SuppressedError&&SuppressedError,(no={})[mt.S]=[mt.S,mt.BPlus,mt.APlus],no[mt.A]=[mt.A,mt.BPlus,mt.APlus],no[mt.B]=[mt.B,mt.BPlus];var oo=new et(1,1,1),ao=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewMatrix=ot.fromIdentity(),this.projectionMatrix=ot.fromIdentity(),this.viewProjectionMatrix=ot.fromIdentity(),this.inverseViewMatrix=ot.fromIdentity(),this.dirty=!0;var r=e.near,i=void 0===r?.1:r,n=e.far,o=void 0===n?20:n,a=e.fov,s=void 0===a?60:a,l=e.aspect,u=void 0===l?1:l,c=e.clipMode,h=void 0===c?Mt.portrait:c,f=e.position,p=void 0===f?[0,0,8]:f,d=e.rotation,m=void 0===d?[0,0,0]:d;this.options={near:i,far:o,fov:s,aspect:u,clipMode:h,position:et.fromArray(p),rotation:at.fromArray(m)},this.dirty=!0,this.updateMatrix()}return Object.defineProperty(t.prototype,"near",{get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"far",{get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fov",{get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aspect",{get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipMode",{get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this.options.position.clone()},set:function(t){this.options.position.equals(t)||(this.options.position.copyFrom(t),this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.options.rotation.clone()},set:function(t){this.options.rotation.equals(t)||(this.options.rotation.copyFrom(t),this.dirty=!0,this.options.quat=void 0)},enumerable:!1,configurable:!0}),t.prototype.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},t.prototype.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},t.prototype.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},t.prototype.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null===(t=this.inverseProjectionMatrix)||void 0===t?void 0:t.clone()},t.prototype.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},t.prototype.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},t.prototype.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},t.prototype.getInverseVPRatio=function(t){var e=new et(0,0,t),r=this.getViewProjectionMatrix(),i=e.applyMatrix(r).z;return new et(1,1,i).applyMatrix(r)},t.prototype.setQuat=function(t){void 0===this.options.quat?(this.options.quat=t.clone(),this.dirty=!0):(this.options.quat,this.options.quat.equals(t)||(this.options.quat.copyFrom(t),this.dirty=!0)),this.dirty&&this.setRotationByQuat(t)},t.prototype.getQuat=function(){var t=this.options.quat;if(void 0===t){t=new rt;var e=this.options.rotation;e&&t.setFromEuler(e),this.options.quat=t}return t},t.prototype.getOptions=function(){return this.options},t.prototype.copy=function(t){var e=t.near,r=t.far,i=t.fov,n=t.clipMode,o=t.aspect,a=t.position,s=t.rotation;this.near=e,this.far=r,this.fov=i,this.clipMode=n,this.aspect=o,this.position=a,this.rotation=s,this.updateMatrix()},t.prototype.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,r=t.aspect,i=t.near,n=t.far,o=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*q,r,i,n,o===Mt.portrait),this.inverseViewMatrix.compose(a,this.getQuat(),oo),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},t.prototype.setRotationByQuat=function(t){qr.getRotation(t,this.options.rotation)},t}(),so=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.items=[],e}return i(e,t),e.prototype.start=function(){var t,e,r=this.item.props.startTime,i=void 0===r?0:r;this.startTime=i,this.timelineComponents=[],this.timelineComponent=this.item.getComponent(li);try{for(var n=l(this.items),o=n.next();!o.done;o=n.next()){var a=o.value.getComponent(li);a&&(this.timelineComponents.push(a),(0!==this.item.endBehavior||this.timelineComponent.reusable)&&(a.reusable=!0))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}},e.prototype.update=function(t){var e,r,i=this.timelineComponent.getTime();try{for(var n=l(this.timelineComponents),o=n.next();!o.done;o=n.next()){var a=o.value,s=a.toLocalTime(i);a.setTime(s)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},e.prototype.resetStatus=function(){this.item.ended=!1,this.item.delaying=!0},e.prototype.createContent=function(){var t=this.items;if(this.items.length=0,this.item.composition){var r=this.item.engine.assetLoader;this.item.composition.compositionSourceManager.jsonScene;for(var i=this.item.props.items?this.item.props.items:[],o=0;o<i.length;o++){var a=void 0,s=i[o];if(On.isComposition(s)){var l=s.content.options.refId,u=this.item.composition.refCompositionProps.get(l);if(!u)throw new Error("引用的Id: ".concat(l," 的预合成不存在"));u.content=s.content,(a=new Rn(this.engine,n(n({},u),{id:s.id,name:s.name,delay:s.delay,duration:s.duration,endBehavior:s.endBehavior,parentId:s.parentId,transform:s.transform}))).type=Ct.composition,a.composition=this.item.composition,a.addComponent(e).refId=l,a.transform.parentTransform=this.transform,this.item.composition.refContent.push(a),5===a.endBehavior&&(this.item.composition.autoRefTex=!1),a.getComponent(e).createContent()}else if("ECS"===s.type||s.type===Ct.sprite||s.type===Ct.text||s.type===Ct.particle||s.type===Ct.mesh||s.type===Ct.skybox||s.type===Ct.light||"camera"===s.type||s.type===Ct.tree||s.type===Ct.interact||s.type===Ct.camera)(a=r.loadGUID(s.id)).composition=this.item.composition;else if((a=new Rn(this.engine,s)).composition=this.item.composition,s.type===Ct.text){var c=new Tn(this.engine,s.content);c.item=a,a.components.push(c),a.rendererComponents.push(c),a._content=c}else a=An(s,this.item.composition);a.parent=this.item,a.transform.parentTransform=s.type===Ct.camera?new qr:this.transform,Rn.isExtraCamera(a)&&(this.item.composition.extraCamera=a),t.push(a)}}},e.prototype.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},e.prototype.hitTest=function(t,e,r,i,n,o){for(var a=[],s=(null==o?void 0:o.stop)||dt,l=(null==o?void 0:o.skip)||dt,u=(null==o?void 0:o.maxCount)||this.items.length,c=0;c<this.items.length&&i.length<u;c++){var h=this.items[c];if(h.lifetime>=0&&!h.ended&&!Rn.isComposition(h)&&!l(h)){var f=h.getHitTestParams(n);if(f){var p=!1,d=new et;if(f.type===Qr.triangle)for(var m=f.triangles,y=f.backfaceCulling,v=0;v<m.length;v++){var g=m[v];if(t.intersectTriangle(g,d,y)){p=!0,a.push(d);break}}else if(f.type===Qr.box){var x=f.center,E=f.size,T=x.clone().addScaledVector(E,.5),_=x.clone().addScaledVector(E,-.5);t.intersectBox({min:T,max:_},d)&&(p=!0,a.push(d))}else if(f.type===Qr.sphere){x=f.center;var C=f.radius;t.intersectSphere({center:x,radius:C},d)&&(p=!0,a.push(d))}else if(f.type===Qr.custom){var b=f.collect(t,new tt(e,r));b&&b.length>0&&(b.forEach((function(t){a.push(t)})),p=!0)}if(p){var O={compContent:this.item,id:h.id,name:h.name,position:a[a.length-1],parentId:h.parentId,hitPositions:a,behavior:f.behavior};if(i.push(O),s(O))return i}}}}return i},e}(ne),lo=1;!function(){function t(t,e,r){var i,o=this;this.compositionSourceManager=r,this.speed=1,this.loaderData={},this.refContent=[],this.refCompositionProps=new Map,this.assigned=!1,this.destroyed=!1,this.paused=!1,this.lastVideoUpdateTime=0,this.postLoaders=[];var a=t.reusable,s=void 0!==a&&a,l=t.speed,u=void 0===l?1:l,c=t.baseRenderOrder,h=void 0===c?0:c,f=t.renderer,p=t.onPlayerPause,d=t.onMessageItem,m=t.onEnd,y=t.event,v=t.width,g=t.height;e.jsonScene.imgUsage=void 0,s&&(this.keepResource=!0,e.textures=void 0,e.consumed=!0);var x=this.compositionSourceManager,E=x.sourceContent,T=x.pluginSystem,_=x.imgUsage,C=x.totalTime,b=x.renderLevel,O=x.refCompositionProps;Z(E),this.renderer=f,this.refCompositionProps=O;var R=new Rn(this.getEngine(),E);R.name="rootItem",R.type=Ct.composition,R.composition=this,this.rootComposition=R.addComponent(so),this.rootTimeline=R.getComponent(li);var A=!s&&_;this.transform=new qr({name:this.name}),this.transform.engine=this.getEngine(),R.transform=this.transform,this.globalVolume=E.globalVolume,this.width=v,this.height=g,this.renderOrder=h,this.id=lo++,this.renderer=f,this.texInfo=null!=A?A:{},this.event=y,this.statistic={loadTime:null!=C?C:0,loadStart:null!==(i=e.startTime)&&void 0!==i?i:0,firstFrameTime:0},this.reusable=s,this.speed=u,this.renderLevel=b,this.autoRefTex=!this.keepResource&&A&&5!==R.endBehavior,this.rootItem=R,this.name=E.name,this.pluginSystem=T,this.pluginSystem.initializeComposition(this,e),this.camera=new ao(this.name,n(n({},null==E?void 0:E.camera),{aspect:v/g})),this.url=e.url,this.assigned=!0,this.globalTime=0,this.onPlayerPause=p,this.onMessageItem=d,this.onEnd=m,this.createRenderFrame(),this.rendererOptions=null,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout((function(){var t;null===(t=o.handleEnd)||void 0===t||t.call(o,o)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)}Object.defineProperty(t.prototype,"handleEnd",{set:function(t){console.warn("The handleEnd property is deprecated. Use onEnd instead."),this.onEnd=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"textures",{get:function(){return this.compositionSourceManager.textures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return this.rootComposition.items},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startTime",{get:function(){var t;return null!==(t=this.rootComposition.startTime)&&void 0!==t?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return this.rootTimeline.getTime()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.getDuration=function(){return this.rootItem.duration},t.prototype.restart=function(){var t=this.rootComposition.items;t.forEach((function(t){return t.dispose()})),t.length=0,this.prepareRender(),this.reset(),this.transform.setValid(!0),this.rootComposition.resetStatus(),this.forwardTime(this.startTime)},t.prototype.setIndex=function(t){this.renderOrder=t},t.prototype.getIndex=function(){return this.renderOrder},t.prototype.setSpeed=function(t){this.speed=t},t.prototype.getSpeed=function(){return this.speed},t.prototype.play=function(){this.rootItem.ended&&this.reusable&&this.restart(),this.rootTimeline.timelineStarted?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},t.prototype.pause=function(){this.paused=!0},t.prototype.getPaused=function(){return this.paused},t.prototype.resume=function(){this.paused=!1},t.prototype.gotoAndPlay=function(t){this.resume(),this.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime)},t.prototype.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},t.prototype.createRenderFrame=function(){this.renderFrame=new ir({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},t.prototype.setTime=function(t){var e=this.paused;e&&this.resume(),this.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime,!0),e&&this.pause()},t.prototype.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},t.prototype.forwardTime=function(t,e){void 0===e&&(e=!1);for(var r=1e3*t-1e3*this.rootTimeline.getTime(),i=r<0,n=Math.abs(r),o=i?-15:15;n>15;n-=15)this.update(o,e);this.update(i?-n:n,e)},t.prototype.reset=function(){var t=this,e=new Rn(this.getEngine(),this.compositionSourceManager.sourceContent);e.type=Ct.composition,e.composition=this,this.rootComposition=e.addComponent(so),this.rootTimeline=e.getComponent(li),this.transform=new qr({name:this.name}),this.transform.engine=this.getEngine(),e.transform=this.transform,this.rootItem=e,this.rendererOptions=null,this.globalTime=0,this.rootComposition.createContent(),this.buildItemTree(this.rootItem),this.rootItem.onEnd=function(){window.setTimeout((function(){var e;null===(e=t.onEnd)||void 0===e||e.call(t,t)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)},t.prototype.prepareRender=function(){var t,e,r,i,n,o,a,s,u,c,h=this,f=this.renderFrame;f._renderPasses[0].meshes.length=0,this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(t){t.prepareRenderFrame(h,f)&&h.postLoaders.push(t)}));try{for(var p=l(this.rootComposition.items),d=p.next();!d.done;d=p.next()){var m=d.value.getComponents(oe);try{for(var y=(r=void 0,l(m)),v=y.next();!v.done;v=y.next()){(O=v.value).isActiveAndEnabled&&f.addMeshToDefaultRenderPass(O)}}catch(t){r={error:t}}finally{try{v&&!v.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(e=p.return)&&e.call(p)}finally{if(t)throw t.error}}try{for(var g=l(this.refContent),x=g.next();!x.done;x=g.next()){var E=x.value;try{for(var T=(a=void 0,l(E.getComponent(so).items)),_=T.next();!_.done;_=T.next()){m=_.value.getComponents(oe);try{for(var C=(u=void 0,l(m)),b=C.next();!b.done;b=C.next()){var O;(O=b.value).isActiveAndEnabled&&f.addMeshToDefaultRenderPass(O)}}catch(t){u={error:t}}finally{try{b&&!b.done&&(c=C.return)&&c.call(C)}finally{if(u)throw u.error}}}}catch(t){a={error:t}}finally{try{_&&!_.done&&(s=T.return)&&s.call(T)}finally{if(a)throw a.error}}}}catch(t){n={error:t}}finally{try{x&&!x.done&&(o=g.return)&&o.call(g)}finally{if(n)throw n.error}}this.postLoaders.forEach((function(t){return t.postProcessFrame(h,f)}))},t.prototype.shouldRestart=function(){var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&5===r},t.prototype.shouldDispose=function(){if(this.reusable)return!1;var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},t.prototype.update=function(t,e){var r,i;if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var n=this.getUpdateTime(t*this.speed);this.globalTime+=n,this.rootTimeline.isActiveAndEnabled&&this.rootTimeline.setTime(this.globalTime/1e3),this.updateVideo(),this.updatePluginLoaders(t),this.callStart(this.rootItem),this.callUpdate(this.rootItem,n),this.callLateUpdate(this.rootItem,n),null===(i=null===(r=this.extraCamera)||void 0===r?void 0:r.getComponent(li))||void 0===i||i.update(t),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},t.prototype.getUpdateTime=function(t){var e=1e3*this.startTime;this.rootItem;var r=1e3*this.rootTimeline.getTime();return t<0&&r+t<e?e-r:t},t.prototype.callStart=function(t){var e,r,i,n,o,a;try{for(var s=l(t.itemBehaviours),u=s.next();!u.done;u=s.next()){var c=u.value;c.isActiveAndEnabled&&!c.started&&(c.start(),c.started=!0)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}try{for(var h=l(t.rendererComponents),f=h.next();!f.done;f=h.next()){var p=f.value;p.isActiveAndEnabled&&!p.started&&(p.start(),p.started=!0)}}catch(t){i={error:t}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}try{for(var d=l(t.children),m=d.next();!m.done;m=d.next()){var y=m.value;this.callStart(y)}}catch(t){o={error:t}}finally{try{m&&!m.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}},t.prototype.callUpdate=function(t,e){var r,i,n,o,a,s;try{for(var u=l(t.itemBehaviours),c=u.next();!c.done;c=u.next()){var h=c.value;h.isActiveAndEnabled&&h.started&&h.update(e)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}try{for(var f=l(t.rendererComponents),p=f.next();!p.done;p=f.next()){var d=p.value;d.isActiveAndEnabled&&d.started&&d.update(e)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}try{for(var m=l(t.children),y=m.next();!y.done;y=m.next()){var v=y.value;Rn.isComposition(v)&&v.ended&&5===v.endBehavior?(v.getComponent(so).resetStatus(),this.callUpdate(v,0)):this.callUpdate(v,e)}}catch(t){a={error:t}}finally{try{y&&!y.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}},t.prototype.callLateUpdate=function(t,e){var r,i,n,o,a,s;try{for(var u=l(t.itemBehaviours),c=u.next();!c.done;c=u.next()){var h=c.value;h.isActiveAndEnabled&&h.started&&h.lateUpdate(e)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}try{for(var f=l(t.rendererComponents),p=f.next();!p.done;p=f.next()){var d=p.value;d.isActiveAndEnabled&&d.started&&d.lateUpdate(e)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}try{for(var m=l(t.children),y=m.next();!y.done;y=m.next()){var v=y.value;this.callLateUpdate(v,e)}}catch(t){a={error:t}}finally{try{y&&!y.done&&(s=m.return)&&s.call(m)}finally{if(a)throw a.error}}},t.prototype.buildItemTree=function(t){var e,r,i,n,o,a;if(t.composition){var s=new Map,u=t.getComponent(so).items;try{for(var c=l(u),h=c.next();!h.done;h=c.next()){var f=h.value;s.set(f.id,f)}}catch(t){e={error:t}}finally{try{h&&!h.done&&(r=c.return)&&r.call(c)}finally{if(e)throw e.error}}try{for(var p=l(u),d=p.next();!d.done;d=p.next()){if(void 0===(f=d.value).parentId)f.setParent(t);else{var m=this.getParentIdWithoutSuffix(f.parentId),y=s.get(m);if(!y)throw Error("元素引用了不存在的元素,请检查数据");Rn.isTree(y)&&f.parentId.includes("^")?(f.parent=y,f.transform.parentTransform=y.getNodeTransform(f.parentId)):(f.parent=y,f.transform.parentTransform=y.transform),y.children.push(f)}}}catch(t){i={error:t}}finally{try{d&&!d.done&&(n=p.return)&&n.call(p)}finally{if(i)throw i.error}}try{for(var v=l(u),g=v.next();!g.done;g=v.next()){f=g.value;Rn.isComposition(f)&&this.buildItemTree(f)}}catch(t){o={error:t}}finally{try{g&&!g.done&&(a=v.return)&&a.call(v)}finally{if(o)throw o.error}}}},t.prototype.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},t.prototype.updateVideo=function(){var t,e=performance.now();e-this.lastVideoUpdateTime>33&&((null!==(t=this.textures)&&void 0!==t?t:[]).forEach((function(t){return null==t?void 0:t.uploadCurrentVideoFrame()})),this.lastVideoUpdateTime=e)},t.prototype.updateCamera=function(){this.camera.updateMatrix()},t.prototype.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(e,t)}))},t.prototype.getItemByName=function(t){return this.rootItem.find(t)},t.prototype.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return function(t,e,r){var i=r.position,n=new et(t,e,0),o=new et;return r.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(i),new lt(i,o)}((t-r.z)/i,(e-r.w)/n,this.camera)},t.prototype.getEngine=function(){var t;return null===(t=this.renderer)||void 0===t?void 0:t.engine},t.prototype.hitTest=function(t,e,r,i){var n;if(this.isDestroyed)return[];var o=[],a=this.getHitTestRay(t,e);return null===(n=this.rootItem.getComponent(so))||void 0===n||n.hitTest(a,t,e,o,r,i),this.refContent.forEach((function(n){var s;null===(s=n.getComponent(so))||void 0===s||s.hitTest(a,t,e,o,r,i)})),o},t.prototype.addInteractiveItem=function(t,e){var r;if(e===Tt.MESSAGE)return null===(r=this.onMessageItem)||void 0===r||r.call(this,{name:t.name,phrase:2,id:t.id,compositionId:this.id}),t.id},t.prototype.removeInteractiveItem=function(t,e){var r;e===Tt.MESSAGE&&(null===(r=this.onMessageItem)||void 0===r||r.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}))},t.prototype.destroyTextures=function(t){for(var e,r=0;r<t.length;r++){var i=t[r];if(i)if(i.sourceType!==fe.data||this.texInfo[i.getInstanceId()]){if(this.autoRefTex)--this.texInfo[i.getInstanceId()]||i.dispose()}else i!==(null===(e=this.rendererOptions)||void 0===e?void 0:e.emptyTexture)&&i!==this.renderFrame.transparentTexture&&i!==this.getEngine().emptyTexture&&i.dispose()}},t.prototype.destroyItem=function(t){var e=this;t.type==Ct.composition?4!==t.endBehavior&&t.getComponent(so).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(F(this.items,t),this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)})))},t.prototype.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()},t.prototype.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=dt)})),this.rootItem.dispose(),this.renderFrame.dispose(),null===(t=this.rendererOptions)||void 0===t||t.emptyTexture.dispose(),null===(e=this.pluginSystem)||void 0===e||e.destroyComposition(this),this.update=function(){pt.error("Update disposed composition: ".concat(r.name,"."))},this.onPlayerPause=dt,this.dispose=dt,n&&this.keepResource&&n.forEach((function(t){return t.dispose=i[t.id]})),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.clear({stencilAction:he.clear,clearStencil:0,depthAction:he.clear,clearDepth:1,colorAction:he.clear,clearColor:[0,0,0,0]})}},t.prototype.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},t.prototype.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Can not translate position when container not assigned")},t.prototype.translate=function(t,e,r){this.rootItem.translate(t,e,r)},t.prototype.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},t.prototype.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},t.prototype.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},t.prototype.scale=function(t,e,r){this.rootItem.scale(t,e,r)},t.prototype.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},t.prototype.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},t.prototype.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},t.prototype.reloadTexture=function(){return a(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.textureOffloaded?[4,Promise.all(this.textures.map((function(t){return null==t?void 0:t.reloadData()})))]:[3,2];case 1:t.sent(),this.textureOffloaded=!1,t.label=2;case 2:return[2]}}))}))}}(),function(){function t(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new fr(this),this.createDefaultTexture()}t.prototype.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},t.prototype.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},t.prototype.findEffectsObjectData=function(t){return this.jsonSceneData[t]},t.prototype.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},t.prototype.getInstance=function(t){return this.objectInstance[t]},t.prototype.removeInstance=function(t){delete this.objectInstance[t]},t.prototype.addPackageDatas=function(t){var e,r,i,n,o,a,s,u,c,h,f,p,d=t.jsonScene;if(d.items)try{for(var m=l(d.items),y=m.next();!y.done;y=m.next()){var v=y.value;this.addEffectsObjectData(v)}}catch(t){e={error:t}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(e)throw e.error}}if(d.materials)try{for(var g=l(d.materials),x=g.next();!x.done;x=g.next()){var E=x.value;this.addEffectsObjectData(E)}}catch(t){i={error:t}}finally{try{x&&!x.done&&(n=g.return)&&n.call(g)}finally{if(i)throw i.error}}if(d.shaders)try{for(var T=l(d.shaders),_=T.next();!_.done;_=T.next()){var C=_.value;this.addEffectsObjectData(C)}}catch(t){o={error:t}}finally{try{_&&!_.done&&(a=T.return)&&a.call(T)}finally{if(o)throw o.error}}if(d.geometries)try{for(var b=l(d.geometries),O=b.next();!O.done;O=b.next()){var R=O.value;this.addEffectsObjectData(R)}}catch(t){s={error:t}}finally{try{O&&!O.done&&(u=b.return)&&u.call(b)}finally{if(s)throw s.error}}if(d.components)try{for(var A=l(d.components),w=A.next();!w.done;w=A.next()){var S=w.value;this.addEffectsObjectData(S)}}catch(t){c={error:t}}finally{try{w&&!w.done&&(h=A.return)&&h.call(A)}finally{if(c)throw c.error}}if(t.textureOptions)try{for(var I=l(t.textureOptions),M=I.next();!M.done;M=I.next()){var L=M.value;this.addEffectsObjectData(L)}}catch(t){f={error:t}}finally{try{M&&!M.done&&(p=I.return)&&p.call(I)}finally{if(f)throw f.error}}},t.prototype.createVFXItemsAsync=function(t){return a(this,void 0,void 0,(function(){var e,r,i,n,o,a,u;return s(this,(function(s){switch(s.label){case 0:e=t.jsonScene,s.label=1;case 1:s.trys.push([1,6,7,8]),r=l(e.items),i=r.next(),s.label=2;case 2:return i.done?[3,5]:"ECS"!==(n=i.value).type&&n.type!==Ct.sprite&&n.type!==Ct.particle&&n.type!==Ct.mesh&&n.type!==Ct.skybox&&n.type!==Ct.light&&"camera"!==n.type&&n.type!==Ct.tree&&n.type!==Ct.interact&&n.type!==Ct.camera?[3,4]:this.database?[4,this.assetLoader.loadGUIDAsync(n.id)]:[3,4];case 3:s.sent(),s.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=s.sent(),a={error:o},[3,8];case 7:try{i&&!i.done&&(u=r.return)&&u.call(r)}finally{if(a)throw a.error}return[7];case 8:return[2]}}))}))},t.prototype.addTexture=function(t){this.destroyed||D(this.textures,t)},t.prototype.removeTexture=function(t){this.destroyed||F(this.textures,t)},t.prototype.addMaterial=function(t){this.destroyed||D(this.materials,t)},t.prototype.removeMaterial=function(t){this.destroyed||F(this.materials,t)},t.prototype.addGeometry=function(t){this.destroyed||D(this.geometries,t)},t.prototype.removeGeometry=function(t){this.destroyed||F(this.geometries,t)},t.prototype.addMesh=function(t){this.destroyed||D(this.meshes,t)},t.prototype.removeMesh=function(t){this.destroyed||F(this.meshes,t)},t.prototype.addRenderPass=function(t){this.destroyed||D(this.renderPasses,t)},t.prototype.removeRenderPass=function(t){this.destroyed||F(this.renderPasses,t)},Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},t.prototype.createDefaultTexture=function(){var t={type:le.UNSIGNED_BYTE,format:le.RGBA,internalFormat:le.RGBA,wrapS:le.MIRRORED_REPEAT,wrapT:le.MIRRORED_REPEAT,minFilter:le.NEAREST,magFilter:le.NEAREST};this.emptyTexture=Ee.create(this,n({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:fe.data},t)),this.transparentTexture=Ee.create(this,n({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:fe.data},t))},t.prototype.dispose=function(){if(!this.destroyed){this.destroyed=!0;var t=[];this.renderPasses.length>0&&t.push("Pass ".concat(this.renderPasses.length)),this.meshes.length>0&&t.push("Mesh ".concat(this.meshes.length)),this.geometries.length>0&&t.push("Geom ".concat(this.geometries.length)),this.textures.length>0&&t.push("Tex ".concat(this.textures.length)),t.length>0&&pt.warn("Release GPU memory: ".concat(t.join(", "))),this.renderPasses.forEach((function(t){t.dispose()})),this.meshes.forEach((function(t){t.dispose()})),this.geometries.forEach((function(t){t.dispose()})),this.materials.forEach((function(t){t.dispose()})),this.textures.forEach((function(t){t.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}}}(),kn("camera",0,0,!0),kn("text",0,0,!0),kn("sprite",0,0,!0),kn("particle",0,0,!0),kn("cal",0,0,!0),kn("interact",0,0,!0);var uo=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return i(e,t),e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var r=e.content.options.targets;r&&(this.targets=r.map((function(t){return{name:t.name,xMin:+t.xMin||0,yMin:+t.yMin||0,xMax:+t.xMax||0,yMax:+t.yMax||0}})))},e.prototype.start=function(){var t,e,r=null===(t=this.item.composition)||void 0===t?void 0:t.loaderData.deviceTransformer;r&&(null===(e=this.targets)||void 0===e||e.forEach((function(t){return r.addTarget(t)})),r.initComposition())},e.prototype.update=function(t){var e,r=null===(e=this.item.composition)||void 0===e?void 0:e.loaderData.deviceTransformer;r&&r.updateOrientation()},e.prototype.onDestroy=function(){var t,e=this;null===(t=this.targets)||void 0===t||t.forEach((function(t){var r,i;return null===(i=null===(r=e.item.composition)||void 0===r?void 0:r.loaderData.deviceTransformer)||void 0===i?void 0:i.removeTarget(t.name)}))},e}(ne),co=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.addComponent(uo).fromData(r),i}return i(e,t),e}(e.VFXItem);e.registerPlugin("orientation-transformer",A,co);var ho="2.0.0-alpha.0";e.logger.info("plugin orientation transformer version: "+ho),t.OrientationAdapterAcceler=R,t.closeDeviceMotion=function(){w=!0,S().disconnect()},t.getAdapter=S,t.openDeviceMotion=function(){w=!1,S().connect()},t.version=ho,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
9
21
|
//# sourceMappingURL=index.min.js.map
|