@galacean/effects 2.0.0-alpha.1 → 2.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/index.min.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/weapp.js +1 -1
- package/dist/weapp.mjs +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime player for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -31118,7 +31118,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31118
31118
|
Engine.create = function (gl) {
|
|
31119
31119
|
return new GLEngine(gl);
|
|
31120
31120
|
};
|
|
31121
|
-
var version = "2.0.0-alpha.
|
|
31121
|
+
var version = "2.0.0-alpha.2";
|
|
31122
31122
|
logger.info('player version: ' + version);
|
|
31123
31123
|
|
|
31124
31124
|
exports.AbstractPlugin = AbstractPlugin;
|
package/dist/index.min.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime player for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ge={})}(this,(function(t){"use strict";var e=function(t,r){return e=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])},e(t,r)};function r(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}var i=function(){return i=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},i.apply(this,arguments)};function n(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 o(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?n(t.value):function(t){return t instanceof r?t:new r((function(e){e(t)}))}(t.value).then(a,s)}u((i=i.apply(t,e||[])).next())}))}function a(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(u){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,u])}}}function s(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 l(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))}let c;"function"==typeof SuppressedError&&SuppressedError;const h=new Uint8Array(16);function f(){if(!c&&(c="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!c))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return c(h)}const p=[];for(let t=0;t<256;++t)p.push((t+256).toString(16).slice(1));var d,m={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function y(t,e,r){if(m.randomUUID&&!e&&!t)return m.randomUUID();const i=(t=t||{}).random||(t.rng||f)();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 v(t,e){return t.includes(e)||t.push(e),t}function g(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function x(t,e,r,i){if(void 0===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 T(t,e){var r=[0,0,0,0];if(ht(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 E(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=C(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]}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:_(i),color:[n,o,a,s]})})):Object.keys(t).forEach((function(r){var i=T(t[r]);e.push({stop:_(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 C(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 _(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function A(){if("object"==typeof screen&&"object"==typeof document){var t=Math.max(document.documentElement.clientWidth,window.innerWidth||0),e=screen.width/t;return Math.min(2*e,2)}return 1}function S(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function R(){return S()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function O(t){ht(t)&&(t=T(t));for(var e=t,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=e[n];return r}function w(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,u=void 0,l=0;l<n.length&&(s=n[l],u=n[l+1],!(s.stop<=a&&u.stop>a));l++);var c=C(s.color,u.color,(a-s.stop)/(u.stop-s.stop));i.set(c,4*o)}i.set(n[n.length-1].color,508)}return r}function M(e,r){void 0===r&&(r=t.OrderType.ascending);var i=e.length;if(i<=1||r===t.OrderType.none)return e;if(i<=30){for(var n=1;n<i;n++)I(e,n,r);return e}return P(e,r)}function L(e,r,i){return void 0===i&&(i=t.OrderType.ascending),e.includes(r)?e:(e.push(r),1===e.length||i!==t.OrderType.none&&I(e,e.length-1,i),e)}function I(e,r,i){var n=e[r];if(i!==t.OrderType.ascending)for(;r>=1&&e[r-1].priority<n.priority&&(e[r]=e[r-1],0!=--r););else for(;r>=1&&e[r-1].priority>n.priority&&(e[r]=e[r-1],0!=--r););e[r]=n}function P(e,r,i,n){var o,a;if(void 0===i&&(i=0),void 0===n&&(n=e.length-1),i>=n)return e;for(var s=e[i],l=i,c=n;l<c;){if(r===t.OrderType.ascending){for(;e[c].priority>s.priority&&c>=l;)c--;for(;e[l].priority<=s.priority&&l<c;)l++}else{for(;e[c].priority<s.priority&&c>=l;)c--;for(;e[l].priority>=s.priority&&l<c;)l++}o=u([e[c],e[l]],2),e[l]=o[0],e[c]=o[1]}return a=u([e[l],e[i]],2),e[i]=a[0],e[l]=a[1],P(e,r,i,l-1),P(e,r,c+1,n),e}function F(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}t.OrderType=void 0,(d=t.OrderType||(t.OrderType={}))[d.none=1]="none",d[d.ascending=2]="ascending",d[d.descending=3]="descending";var N=2*Math.PI,D=Math.PI/180,V=180/Math.PI,z=1e-6;function U(t,e){return Math.abs(t-e)<z||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var B=function(t,e,r){return(1-r)*t+r*e};function k(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 G,X=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=z,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}(),H=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=z,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 X(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}(),j=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],u=e[2],l=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=(l-s)*f,this.y=(n-u)*f,this.z=(o-i)*f}else if(r>a&&r>c){f=2*Math.sqrt(1+r-a-c);this.w=(l-s)/f,this.x=.25*f,this.y=(i+o)/f,this.z=(n+u)/f,this.negate()}else if(a>c){f=2*Math.sqrt(1+a-r-c);this.w=(n-u)/f,this.x=(i+o)/f,this.y=.25*f,this.z=(s+l)/f,this.negate()}else{f=2*Math.sqrt(1+c-r-a);this.w=(o-i)/f,this.x=(n+u)/f,this.y=(s+l)/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(k(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,u=e.z,l=e.w;return this.x=r*l+o*a+i*u-n*s,this.y=i*l+o*s+n*a-r*u,this.z=n*l+o*u+r*s-i*a,this.w=o*l-r*a-i*s-n*u,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 u=1-s*s;if(u<=Number.EPSILON){var l=1-e;return this.w=l*a+e*this.w,this.x=l*i+e*this.x,this.y=l*n+e*this.y,this.z=l*o+e*this.z,this.normalize(),this}var c=Math.sqrt(u),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,u=t.y,l=t.z,c=a*s+n*l-o*u,h=a*u+o*s-i*l,f=a*l+i*u-n*s,p=-i*s-n*u-o*l,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(H.ZERO,this,H.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 H,t}(),Y=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},W=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))},Z=function(){function t(t,e,r,i,n,o,a,s,u,l,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===u&&(u=0),void 0===l&&(l=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,u,l,c,h,f,p,d,m]}return t.prototype.set=function(t,e,r,i,n,o,a,s,u,l,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]=u,y[9]=l,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,u,l,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]=u,y[6]=l,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,u=i.y,l=i.z,c=a*s,h=a*u;return this.set(c*s+n,c*u+o*l,c*l-o*u,0,c*u-o*l,h*u+n,h*l+o*s,0,c*l+o*u,h*l-o*s,a*l*l+n,0,0,0,0,1)},t.prototype.setFromEuler=function(t){return t.toMatrix4(this),this},t.prototype.setFromQuaternion=function(t){return this.compose(H.ZERO,t,H.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=W([],Y(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],u=r[12],l=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],T=r[15],E=i[0],b=i[4],C=i[8],_=i[12],A=i[1],S=i[5],R=i[9],O=i[13],w=i[2],M=i[6],L=i[10],I=i[14],P=i[3],F=i[7],N=i[11],D=i[15];return n[0]=o*E+a*A+s*w+u*P,n[4]=o*b+a*S+s*M+u*F,n[8]=o*C+a*R+s*L+u*N,n[12]=o*_+a*O+s*I+u*D,n[1]=l*E+c*A+h*w+f*P,n[5]=l*b+c*S+h*M+f*F,n[9]=l*C+c*R+h*L+f*N,n[13]=l*_+c*O+h*I+f*D,n[2]=p*E+d*A+m*w+y*P,n[6]=p*b+d*S+m*M+y*F,n[10]=p*C+d*R+m*L+y*N,n[14]=p*_+d*O+m*I+y*D,n[3]=v*E+g*A+x*w+T*P,n[7]=v*b+g*S+x*M+T*F,n[11]=v*C+g*R+x*L+T*N,n[15]=v*_+g*O+x*I+T*D,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],u=t[13],l=t[2],c=t[6],h=t[10],f=t[14];return t[3]*(+n*s*c-i*u*c-n*a*h+r*u*h+i*a*f-r*s*f)+t[7]*(+e*s*f-e*u*h+n*o*h-i*o*f+i*u*l-n*s*l)+t[11]*(+e*u*c-e*a*f-n*o*c+r*o*f+n*a*l-r*u*l)+t[15]*(-i*a*l-e*s*c+e*a*h+i*o*c-r*o*h+r*s*l)},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],u=t[7],l=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*u-d*h*u+d*s*f-a*m*f-c*s*y+a*h*y,g=p*h*u-l*m*u-p*s*f+o*m*f+l*s*y-o*h*y,x=l*d*u-p*c*u+p*a*f-o*d*f-l*a*y+o*c*y,T=p*c*s-l*d*s-p*a*h+o*d*h+l*a*m-o*c*m,E=e*v+r*g+i*x+n*T;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var b=1/E;return t[0]=v*b,t[1]=(d*h*n-c*m*n-d*i*f+r*m*f+c*i*y-r*h*y)*b,t[2]=(a*m*n-d*s*n+d*i*u-r*m*u-a*i*y+r*s*y)*b,t[3]=(c*s*n-a*h*n-c*i*u+r*h*u+a*i*f-r*s*f)*b,t[4]=g*b,t[5]=(l*m*n-p*h*n+p*i*f-e*m*f-l*i*y+e*h*y)*b,t[6]=(p*s*n-o*m*n-p*i*u+e*m*u+o*i*y-e*s*y)*b,t[7]=(o*h*n-l*s*n+l*i*u-e*h*u-o*i*f+e*s*f)*b,t[8]=x*b,t[9]=(p*c*n-l*d*n-p*r*f+e*d*f+l*r*y-e*c*y)*b,t[10]=(o*d*n-p*a*n+p*r*u-e*d*u-o*r*y+e*a*y)*b,t[11]=(l*a*n-o*c*n-l*r*u+e*c*u+o*r*f-e*a*f)*b,t[12]=T*b,t[13]=(l*d*i-p*c*i+p*r*h-e*d*h-l*r*m+e*c*m)*b,t[14]=(p*a*i-o*d*i-p*r*s+e*d*s+o*r*m-e*a*m)*b,t[15]=(o*c*i-l*a*i+l*r*s-e*c*s-o*r*h+e*a*h)*b,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=H.ZERO);var n=this.elements,o=e.x,a=e.y,s=e.z,u=e.w,l=-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,T=s*d,E=u*f,b=u*p,C=u*d,_=r.x,A=r.y,S=r.z;return n[0]=(1-(g+T))*_,n[1]=(y+C)*_,n[2]=(v-b)*_,n[3]=0,n[4]=(y-C)*A,n[5]=(1-(m+T))*A,n[6]=(x+E)*A,n[7]=0,n[8]=(v+b)*S,n[9]=(x-E)*S,n[10]=(1-(m+g))*S,n[11]=0,n[12]=l*n[0]+c*n[4]+h*n[8]-l+t.x,n[13]=l*n[1]+c*n[5]+h*n[9]-c+t.y,n[14]=l*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(),u=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 l=t.tempMat0;l.copyFrom(this);var c=1/a,h=1/s,f=1/u;return l.elements[0]*=c,l.elements[1]*=c,l.elements[2]*=c,l.elements[4]*=h,l.elements[5]*=h,l.elements[6]*=h,l.elements[8]*=f,l.elements[9]*=f,l.elements[10]*=f,r.setFromRotationMatrix(l),i.x=a,i.y=s,i.z=u,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 H,e=new j,r=new H;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),u=1/(o-n),l=-(e+t)*a,c=-(r+i)*s,h=-(o+n)*u;a*=2,s*=2,u*=-2;var f=this.elements;return f[0]=a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=l,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=this.elements,r=t.elements,i=0;i<16;i++)if(!U(e[i],r[i]))return!1;return!0},t.prototype.toArray=function(){return W([],Y(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,u,l,c,h,f,p,d,m,y){return new t(e,o,l,p,r,a,c,d,i,s,h,m,n,u,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 H,t.tempVec1=new H,t.tempVec2=new H,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"}(G||(G={}));var q=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],u=r[9],l=r[2],c=r[6],h=r[10];switch(e){case G.XYZ:this.y=Math.asin(k(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,h),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(c,s),this.z=0);break;case G.YXZ:this.x=Math.asin(-k(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(o,h),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-l,i),this.z=0);break;case G.ZXY:this.x=Math.asin(k(c,-1,1)),Math.abs(c)<.9999999?(this.y=Math.atan2(-l,h),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,i));break;case G.ZYX:this.y=Math.asin(-k(l,-1,1)),Math.abs(l)<.9999999?(this.x=Math.atan2(c,h),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,s));break;case G.YZX:this.z=Math.asin(k(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-l,i)):(this.x=0,this.y=Math.atan2(o,h));break;case G.XZY:this.z=Math.asin(-k(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(c,s),this.y=Math.atan2(o,i)):(this.x=Math.atan2(-u,h),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=V,this.y*=V,this.z*=V,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 j;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*D*.5),s=Math.cos(i*D*.5),u=Math.cos(n*D*.5),l=Math.sin(r*D*.5),c=Math.sin(i*D*.5),h=Math.sin(n*D*.5);switch(o){case G.XYZ:t.set(l*s*u+a*c*h,a*c*u-l*s*h,a*s*h+l*c*u,a*s*u-l*c*h);break;case G.YXZ:t.set(l*s*u+a*c*h,a*c*u-l*s*h,a*s*h-l*c*u,a*s*u+l*c*h);break;case G.ZXY:t.set(l*s*u-a*c*h,a*c*u+l*s*h,a*s*h+l*c*u,a*s*u-l*c*h);break;case G.ZYX:t.set(l*s*u-a*c*h,a*c*u+l*s*h,a*s*h-l*c*u,a*s*u+l*c*h);break;case G.YZX:t.set(l*s*u+a*c*h,a*c*u+l*s*h,a*s*h-l*c*u,a*s*u-l*c*h);break;case G.XZY:t.set(l*s*u-a*c*h,a*c*u-l*s*h,a*s*h+l*c*u,a*s*u+l*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*D),u=Math.sin(i*D),l=Math.cos(n*D),c=Math.sin(n*D),h=Math.cos(o*D),f=Math.sin(o*D);if(a===G.XYZ){var p=s*h,d=s*f,m=u*h,y=u*f;r[0]=l*h,r[4]=-l*f,r[8]=c,r[1]=d+m*c,r[5]=p-y*c,r[9]=-u*l,r[2]=y-p*c,r[6]=m+d*c,r[10]=s*l}else if(a===G.YXZ){var v=l*h,g=l*f,x=c*h,T=c*f;r[0]=v+T*u,r[4]=x*u-g,r[8]=s*c,r[1]=s*f,r[5]=s*h,r[9]=-u,r[2]=g*u-x,r[6]=T+v*u,r[10]=s*l}else if(a===G.ZXY){v=l*h,g=l*f,x=c*h,T=c*f;r[0]=v-T*u,r[4]=-s*f,r[8]=x+g*u,r[1]=g+x*u,r[5]=s*h,r[9]=T-v*u,r[2]=-s*c,r[6]=u,r[10]=s*l}else if(a===G.ZYX){p=s*h,d=s*f,m=u*h,y=u*f;r[0]=l*h,r[4]=m*c-d,r[8]=p*c+y,r[1]=l*f,r[5]=y*c+p,r[9]=d*c-m,r[2]=-c,r[6]=u*l,r[10]=s*l}else if(a===G.YZX){var E=s*l,b=s*c,C=u*l,_=u*c;r[0]=l*h,r[4]=_-E*f,r[8]=C*f+b,r[1]=f,r[5]=s*h,r[9]=-u*h,r[2]=-c*h,r[6]=b*f+C,r[10]=E-_*f}else if(a===G.XZY){E=s*l,b=s*c,C=u*l,_=u*c;r[0]=l*h,r[4]=-f,r[8]=c*h,r[1]=E*f+_,r[5]=s*h,r[9]=b*f-C,r[2]=C*f-b,r[6]=u*h,r[10]=_*f+E}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=G.ZYX,t.tempQuat0=new j,t.tempMat0=new Z,t}(),K=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=z,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 H(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}(),Q=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},J=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))},$=function(){function t(t,e,r,i,n,o,a,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,r,i,n,o,a,s,u]}return t.prototype.set=function(t,e,r,i,n,o,a,s,u){var l=this.elements;return l[0]=t,l[3]=i,l[6]=a,l[1]=e,l[4]=n,l[7]=s,l[2]=r,l[5]=o,l[8]=u,this},t.prototype.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u){var l=this.elements;return l[0]=t,l[3]=e,l[6]=r,l[1]=i,l[4]=n,l[7]=o,l[2]=a,l[5]=s,l[8]=u,this},t.prototype.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.z)},t.prototype.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},t.prototype.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<9;r++)this.elements[r]=t[e+r];return this},t.prototype.setFromQuaternion=function(t){var e=t.x,r=t.y,i=t.z,n=t.w,o=e+e,a=r+r,s=i+i,u=e*o,l=e*a,c=e*s,h=r*a,f=r*s,p=i*s,d=n*o,m=n*a,y=n*s,v=this.elements;return v[0]=1-(h+p),v[1]=l+y,v[2]=c-m,v[3]=l-y,v[4]=1-(u+p),v[5]=f+d,v[6]=c+m,v[7]=f-d,v[8]=1-(u+h),this},t.prototype.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},t.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},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])},t.prototype.copyFrom=function(t){return this.elements=J([],Q(t.elements),!1),this},t.prototype.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},t.prototype.scale=function(t,e){var r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.elements,n=i[0],o=i[3],a=i[6],s=i[1],u=i[4],l=i[7];return i[0]=e*n+r*s,i[3]=e*o+r*u,i[6]=e*a+r*l,i[1]=-r*n+e*s,i[4]=-r*o+e*u,i[7]=-r*a+e*l,this},t.prototype.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[8],this},t.prototype.multiply=function(t){if("number"==typeof t){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},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[3],s=r[6],u=r[1],l=r[4],c=r[7],h=r[2],f=r[5],p=r[8],d=i[0],m=i[3],y=i[6],v=i[1],g=i[4],x=i[7],T=i[2],E=i[5],b=i[8];return n[0]=o*d+a*v+s*T,n[3]=o*m+a*g+s*E,n[6]=o*y+a*x+s*b,n[1]=u*d+l*v+c*T,n[4]=u*m+l*g+c*E,n[7]=u*y+l*x+c*b,n[2]=h*d+f*v+p*T,n[5]=h*m+f*g+p*E,n[8]=h*y+f*x+p*b,this},t.prototype.determinant=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],l=t[8];return e*(o*l-u*a)+n*(u*i-r*l)+s*(r*a-o*i)},t.prototype.invert=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],l=t[8],c=l*o-u*a,h=u*i-l*r,f=a*r-o*i,p=e*c+n*h+s*f;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var d=1/p;return t[0]=c*d,t[1]=(s*a-l*n)*d,t[2]=(u*n-s*o)*d,t[3]=h*d,t[4]=(l*e-s*i)*d,t[5]=(s*r-u*e)*d,t[6]=f*d,t[7]=(n*i-a*e)*d,t[8]=(o*e-n*r)*d,this},t.prototype.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},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[3]*i+o[6]*n,a.y=o[1]*r+o[4]*i+o[7]*n,a.z=o[2]*r+o[5]*i+o[8]*n,a},t.prototype.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},t.prototype.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!U(e[i],r[i]))return!1;return!0},t.prototype.toArray=function(){return J([],Q(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.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,r,i){return(new t).setFromColumnVectors(e,r,i)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,l){return new t(e,n,s,r,o,u,i,a,l)},t}(),tt=function(){function t(t,e){void 0===t&&(t=H.ZERO),void 0===e&&(e=H.X),this.origin=new H,this.direction=new H,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 H;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,u,l,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,T=n.z,E=(o=t.max).x,b=o.y,C=o.z,_=1/m,A=1/y,S=1/v;if(_>=0?(a=(g-f)*_,s=(E-f)*_):(a=(E-f)*_,s=(g-f)*_),A>=0?(u=(x-p)*A,l=(b-p)*A):(u=(b-p)*A,l=(x-p)*A),!(a>l||u>s||((u>a||a!=a)&&(a=u),(l<s||s!=s)&&(s=l),(u>a||a!=a)&&(a=u),(l<s||s!=s)&&(s=l),S>=0?(c=(T-d)*S,h=(C-d)*S):(c=(C-d)*S,h=(T-d)*S),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 H).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 u=Math.sqrt(s-a),l=o-u,c=o+u;if(!(c<0))return l>=0?this.at(l,r):this.at(c,r)}},t.prototype.intersectTriangle=function(e,r,i){var n,o=e.p0,a=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(a,o),l=t.tempVec1.subtractVectors(s,o),c=t.tempVec2.subtractVectors(this.origin,o),h=t.tempVec3.crossVectors(u,l),f=this.direction.dot(h);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}l.crossVectors(c,l);var p=n*this.direction.dot(l);if(!(p<0)){u.cross(c);var d=n*this.direction.dot(u);if(!(d<0||p+d>f)){var m=-n*c.dot(h);if(!(m<0))return this.at(m/f,r)}}},t.tempVec0=new H,t.tempVec1=new H,t.tempVec2=new H,t.tempVec3=new H,t}(),et=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}return t.prototype.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,this},t.prototype.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},t.prototype.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},t.prototype.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},t.prototype.setFromArray=function(t,e){var r,i,n,o;return void 0===e&&(e=0),this.r=null!==(r=t[e])&&void 0!==r?r:0,this.g=null!==(i=t[e+1])&&void 0!==i?i:0,this.b=null!==(n=t[e+2])&&void 0!==n?n:0,this.a=null!==(o=t[e+3])&&void 0!==o?o:0,this},t.prototype.setFromHSV=function(t,e,r,i){void 0===i&&(i=1);var n=r*e,o=t/60,a=n*(1-Math.abs(o%2-1)),s=0,u=0,l=0;o>=0&&o<=1?(s=n,u=a):o>=1&&o<=2?(s=a,u=n):o>=2&&o<=3?(u=n,l=a):o>=3&&o<=4?(u=a,l=n):o>=4&&o<=5?(s=a,l=n):o>=5&&o<=6&&(s=n,l=a);var c=r-n;return this.set(s+c,u+c,l+c,i)},t.prototype.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,r=parseInt(t.substring(3,5),16)/255,i=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,i,n)},t.prototype.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.clone=function(){return new t(this.r,this.g,this.b,this.a)},t.prototype.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},t.prototype.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},t.prototype.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):t instanceof Array?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},t.prototype.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):t instanceof Array?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},t.prototype.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):t instanceof Array?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},t.prototype.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):t instanceof Array?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},t.prototype.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},t.prototype.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},t.prototype.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},t.prototype.luminance=function(){return.3*this.r+.59*this.g+.11*this.b},t.prototype.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},t.prototype.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},t.prototype.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},t.prototype.toArray=function(){return[this.r,this.g,this.b,this.a]},t.prototype.toVector4=function(){return new K(this.r,this.g,this.b,this.a)},t.prototype.toHSV=function(){var e,r=(e=this).r,i=e.g,n=e.b,o=e.a,a=Math.max(r,i,n),s=Math.min(r,i,n),u=a-s,l=0,c=0;return 0!==a&&(c=u/a),a!=s&&(a==r?(l=(i-n)/u,i<n&&(l+=6)):a==i?l=(n-r)/u+2:a==n&&(l=(r-i)/u+4),l*=60),new t(l,c,a,o)},t.prototype.toHexString=function(e){void 0===e&&(e=!0);var r=t.ToHex(Math.round(255*this.r)),i=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),o=t.ToHex(Math.round(255*this.a));return e?"#"+r+i+n+o:"#"+r+i+n},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,r,i,n){return void 0===n&&(n=1),(new t).setFromHSV(e,r,i,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t.BLACK=new t(0,0,0,1),t.BLUE=new t(0,0,1,1),t.CLEAR=new t(0,0,0,0),t.CYAN=new t(0,1,1,1),t.GRAY=new t(.5,.5,.5,1),t.GREEN=new t(0,1,0,1),t.MAGENTA=new t(1,0,1,1),t.RED=new t(1,0,0,1),t.WHITE=new t(1,1,1,1),t.YELLOW=new t(1,.92,.016,1),t}(),rt=function(){function t(t,e){void 0===t&&(t=new H(1/0,1/0,1/0)),void 0===e&&(e=new H(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}return t.prototype.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},t.prototype.setFromArray=function(t){for(var e=Number(1/0),r=Number(1/0),i=Number(1/0),n=-1/0,o=-1/0,a=-1/0,s=0,u=t.length;s<u;s+=3){var l=t[s],c=t[s+1],h=t[s+2];l<e&&(e=l),c<r&&(r=c),h<i&&(i=h),l>n&&(n=l),c>o&&(o=c),h>a&&(a=h)}return this.min.set(e,r,i),this.max.set(n,o,a),this},t.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},t.prototype.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),this},t.prototype.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},t.prototype.clone=function(){return(new t).copyFrom(this)},t.prototype.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},t.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},t.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},t.prototype.getCenter=function(t){return void 0===t&&(t=new H),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},t.prototype.getSize=function(t){return void 0===t&&(t=new H),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},t.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},t.prototype.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},t.prototype.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},t.prototype.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var r=e.geometry;if(void 0!==r){null===r.boundingBox&&r.computeBoundingBox();var i=new t;i.copyFrom(r.boundingBox),i.applyMatrix4(e.matrixWorld),this.union(i)}for(var n=e.children,o=0,a=n.length;o<a;o++)this.expandByObject(n[o]);return this},t.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},t.prototype.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},t.prototype.getParameter=function(t,e){return void 0===e&&(e=new H),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},t.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},t.prototype.intersectsSphere=function(t){var e=new H;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},t.prototype.clampPoint=function(t,e){return void 0===e&&(e=new H),e.copyFrom(t).clamp(this.min,this.max)},t.prototype.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},t.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},t.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.applyMatrix4=function(t,e){if(void 0===e&&(e=new H),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},t.prototype.getOBBPoints=function(t,e){if(void 0===e&&(e=new H),this.isEmpty())return[];var r=[];return r[0]=new H(this.min.x,this.min.y,this.min.z),r[1]=new H(this.min.x,this.min.y,this.max.z),r[2]=new H(this.min.x,this.max.y,this.min.z),r[3]=new H(this.min.x,this.max.y,this.max.z),r[4]=new H(this.max.x,this.min.y,this.min.z),r[5]=new H(this.max.x,this.min.y,this.max.z),r[6]=new H(this.max.x,this.max.y,this.min.z),r[7]=new H(this.max.x,this.max.y,this.max.z),r.forEach((function(r){r.subtract(e),r.applyMatrix(t),r.add(e)})),r},t.prototype.getBoundingSphere=function(t){this.getCenter(t.center);var e=new H;return t.radius=.5*this.getSize(e).length(),t},t.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},t.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),it=function(){function t(t,e){void 0===t&&(t=H.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}return t.prototype.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},t.prototype.setFromPoints=function(t,e){var r=this.center;if(void 0!==e){r.copyFrom(e);for(var i=0,n=0;n<t.length;n++)i=Math.max(i,r.distanceSquared(t[n]));this.radius=Math.sqrt(i)}else{var o=(new rt).setFromPoints(t);o.getCenter(r),this.radius=o.getSize().length()/2}return this},t.prototype.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},t.prototype.isEmpty=function(){return this.radius<0},t.prototype.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},t.prototype.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},t.prototype.distanceToPoint=function(t){return t.distance(this.center)-this.radius},t.prototype.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},t.prototype.intersectsBox=function(t){return t.intersectsSphere(this)},t.prototype.clampPoint=function(t,e){var r=this.center.distanceSquared(t);return void 0===e&&(e=new H),e.copyFrom(t),r>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},t.prototype.getBoundingBox=function(t){return void 0===t&&(t=new rt),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},t.prototype.applyMatrix4=function(t){var e=t.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10],o=Math.sqrt(Math.max(r,i,n));return this.center.applyMatrix(t),this.radius=this.radius*o,this},t.prototype.translate=function(t){return this.center.add(t),this},t.prototype.expandByPoint=function(t){var e=(new H).subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=.5*(i-this.radius);this.center.add(e.multiply(n/i)),this.radius+=n}return this},t.prototype.union=function(t){var e=new H,r=new H;return r.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(r)),this.expandByPoint(e.copyFrom(t.center).subtract(r)),this},t.prototype.intersect=function(t){var e=(new H).subtractVectors(this.center,t.center),r=e.length();return r>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(r/2)),this.radius=this.radius+t.radius-r,this)},t.prototype.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},t.prototype.clone=function(){return(new t).copyFrom(this)},t}(),nt=Object.freeze({__proto__:null,get EulerOrder(){return G},Euler:q,Quaternion:j,Vector2:X,Vector3:H,Vector4:K,Matrix3:$,Matrix4:Z,Ray:tt,PI2:N,DEG2RAD:D,RAD2DEG:V,NumberEpsilon:z,isZero:function(t){return isNaN(t)||Math.abs(t)<z},isEqual:U,damp:function(t,e,r,i){return B(t,e,1-Math.exp(-r*i))},lerp:B,degToRad:function(t){return t*D},radToDeg:function(t){return t*V},clamp:k,Color:et,Box3:rt,Sphere:it});new q,new H(1,1,1),new H(0,0,0);var ot,at="[Galacean Effects]";function st(t){return["%c".concat(at),"background: #AA0100; color: white","".concat(t)]}var ut,lt={error:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.error.apply(console,l(l([],u(st(t)),!1),[e],!1)),null==ot||ot("error",t,e)},info:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.debug.apply(console,l([],u(st(t)),!1)),null==ot||ot("info",t,e)},warn:function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];console.warn.apply(console,l([],u(st(t)),!1)),null==ot||ot("warn",t,e)},register:function(t){t&&_t(t)&&(ot=t)}};function ct(){}function ht(t){return"string"==typeof t}t.DestroyOptions=void 0,(ut=t.DestroyOptions||(t.DestroyOptions={}))[ut.destroy=0]="destroy",ut[ut.keep=1]="keep",ut[ut.force=0]="force";var ft,pt,dt,mt,yt,vt,gt,xt,Tt,Et,bt,Ct=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function _t(t){return"[object Function]"===Object.prototype.toString.call(t)}function At(t){return"[object Object]"===Object.prototype.toString.call(t)}function St(t,e){return t+Math.random()*(e-t)}function Rt(){throw Error("destroyed item cannot be used again")}function Ot(){return y().replace(/-/g,"")}
|
|
9
9
|
/*!
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
* Description: Galacean Effects JSON Specification
|
|
18
18
|
* Author: Ant Group CO., Ltd.
|
|
19
19
|
* Version: v1.0.1
|
|
20
|
-
*/(t));var r=new e;return r.name=t,r})).sort((function(t,e){return t.order-e.order}))}return t.prototype.initializeComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionConstructed(t,e)}))},t.prototype.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},t.prototype.resetComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionReset(t,e)}))},t.prototype.createPluginItem=function(t,e,r){var i=Fa[t];if(!i)throw new Error("plugin ".concat(t," no registered constructor"));var n=new i(r.getEngine(),e,r);if(n.composition=r,!(n instanceof Ma))throw new Error("plugin ".concat(t," invalid constructor type"));return n},t.prototype.processRawJSON=function(t,e){return o(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.callStatic("processRawJSON",t,e)]}))}))},t.prototype.callStatic=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return o(this,void 0,void 0,(function(){var r,i,n,o,s;return a(this,(function(a){for(r=[],i=this.plugins,n=0;n<i.length;n++)o=i[n],s=Ia[o.name],t in s&&r.push(Promise.resolve(s[t].apply(s,l([],u(e),!1))));return[2,Promise.all(r)]}))}))},t.prototype.precompile=function(t,e,r){return o(this,void 0,void 0,(function(){return a(this,(function(i){return[2,this.callStatic("precompile",t,e,r)]}))}))},t.prototype.loadResources=function(t,e){return o(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.callStatic("prepareResource",t,e)]}))}))},t}(),Za={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",tree:"@galacean/effects-plugin-model",model:"@galacean/effects-plugin-model","orientation-transformer":"@galacean/effects-plugin-orientation-transformer",spine:"@galacean/effects-plugin-spine"};!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(Da||(Da={})),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"}(Va||(Va={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(za||(za={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Ua||(Ua={})),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"}(Ba||(Ba={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(ka||(ka={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Ga||(Ga={})),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"}(Xa||(Xa={})),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"}(Ha||(Ha={})),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"}(ja||(ja={})),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"}(Ya||(Ya={}));var qa,Ka,Qa,Ja,$a,ts,es,rs,is,ns,os,as,ss,us,ls,cs,hs,fs=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=fs]="landscape"}(qa||(qa={})),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"}(Ka||(Ka={})),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"}(Qa||(Qa={})),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"}(Ja||(Ja={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}($a||($a={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(ts||(ts={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(es||(es={})),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"}(rs||(rs={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(is||(is={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(ns||(ns={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(os||(os={})),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"}(as||(as={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(ss||(ss={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(us||(us={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(ls||(ls={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(cs||(cs={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(hs||(hs={}));var ps=function(){return ps=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},ps.apply(this,arguments)};function ds(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 ms(t,e){if(!t.includes(e))return t.push(e),!0}function ys(t,e,r){if(t)for(var i in t)Object.hasOwnProperty.call(t,i)&&e.call(r,t[i],i);return t}function vs(t){if(Number.isFinite(t))return[Qa.CONSTANT,t];if(t){if("lines"===t[0])return[Qa.LINE,t[1]];if("curve"===t[0])return[Qa.CURVE,t[1]];if("static"===t[0])return[Qa.CONSTANT,t[1]]}}function gs(t,e){return Array.isArray(t)&&"random"===t[0]?[Qa.CONSTANT,t[1][e]]:vs(t)}function xs(t){return t&&"color"===t[0]?Cs(t[1],!0):[1,1,1,1]}function Ts(t,e){if(t){if("colors"===t[0])return[Qa.COLORS,t[1].map((function(t){return Cs(t,e)}))];if("gradient"===t[0])return bs(t[1],e);if("color"===t[0])return[Qa.RGBA_COLOR,Cs(t[1],e)]}}function Es(t){return t&&"random"===t[0]?[Qa.RANDOM,t[1]]:vs(t)}function bs(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach((function(i){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(i),o=Cs(t[i],e);r.push([n,o[0],o[1],o[2],o[3]])})),r=r.sort((function(t,e){return t[0]-e[0]})),[Qa.GRADIENT_COLOR,r]}}function Cs(t,e){var r;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else t instanceof Array&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=function(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}(r)),r}function _s(t,e){return Array.isArray(t)?("gradient"===t[0]||"color"===t[0])&&bs(t[1],e):bs(t,e)}function As(t){if(t){if(3===t.length)return[Qa.CONSTANT_VEC3,t];if("path"===t[0])return[Qa.LINEAR_PATH,t[1]];if("bezier"===t[0])return[Qa.BEZIER_PATH,t[1]]}}function Ss(t){var e,r;try{for(var i=ds(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;t[o]=Number(t[o])}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}function Rs(t){var e,r;try{for(var i=ds(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;void 0===t[o]&&delete t[o]}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}"function"==typeof SuppressedError&&SuppressedError;var Os=Math.cos,ws=Math.sin,Ms=Math.PI/180,Ls=180/Math.PI;function Is(t){var e,r=t.options,i=t.transform,n={type:Ba.NONE};if(t.shape){var o=null===(e=t.shape.shape)||void 0===e?void 0:e.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(n=ps(ps({},t.shape),{type:Ba[o]}),t.shape.upDirection){var a=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}(t.shape.upDirection,3),s=a[0],u=a[1],l=a[2];0===s&&0===u&&0===l&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=Es(r.turbulenceX),n.turbulenceY=Es(r.turbulenceY),n.turbulenceZ=Es(r.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map((function(t){return Ss(t)}))),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map((function(t){return Ss(t)}))),c.rateOverTime&&(c.rateOverTime=Es(c.rateOverTime));var h={renderer:t.renderer,shape:n,splits:t.splits,emission:c,options:{startLifetime:Es(r.startLifetime),start3DSize:!!r.start3DSize,startSize:Es(r.startSize),startSizeX:Es(r.startSizeX),startSizeY:Es(r.startSizeY),sizeAspect:Es(r.sizeAspect),maxCount:r.maxCount,startDelay:Es(r.startDelay),startColor:Ts(r.startColor,!0),startRotationZ:Es(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(h.options.startRotationX=Es(r.startRotationX),h.options.startRotationY=Es(r.startRotationY)),t.filter){var f={};ys(t.filter,(function(t,e){var r;f[e]=(r=t,Array.isArray(r)&&"string"==typeof r[0]&&(Es(r)||As(r)||Ts(r))||r)})),h.filter=f}i&&i.path&&(h.emitterTransform={path:As(i.path)});var p=t.sizeOverLifetime;p&&(p.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:Es(p.x),y:Es(p.y)}:h.sizeOverLifetime={size:Es(p.size)});var d=t.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?vs(m):void 0,h.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:vs(r.gravityModifier),startSpeed:Es(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:Es(d.linearX),linearY:Es(d.linearY),linearZ:Es(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Es(d.orbitalX),orbitalY:Es(d.orbitalY),orbitalZ:Es(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:vs(d.forceCurve)},Rs(h.positionOverLifetime);var y=t.rotationOverLifetime;y&&(h.rotationOverLifetime={separateAxes:y.separateAxes,asRotation:y.asRotation,z:Es(y.separateAxes?y.z:y.angularVelocity)},y.separateAxes&&(h.rotationOverLifetime.y=vs(y.y),h.rotationOverLifetime.x=vs(y.x)));var v=t.colorOverLifetime;if(v){var g=h.colorOverLifetime={opacity:vs(v.opacity)};v.color&&(g.color=_s(v.color))}var x=t.textureSheetAnimation;x&&(h.textureSheetAnimation={row:x.row,col:x.col,total:x.total,animate:x.animate,cycles:vs(x.cycles),animationDelay:gs(x.animationDelay,0),animationDuration:gs(x.animationDuration,0)});var T=t.trails;T&&(h.trails={lifetime:Es(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:vs(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&_s(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&_s(T.colorOverLifetime,!1),inheritParticleColor:T.inheritParticleColor,occlusion:T.occlusion,transparentOcclusion:T.transparentOcclusion,orderOffset:T.orderOffset,sizeAffectsLifetime:T.sizeAffectsLifetime,sizeAffectsWidth:T.sizeAffectsWidth,texture:T.texture,parentAffectsPosition:T.parentAffectsPosition,opacityOverLifetime:Es(T.opacityOverLifetime)}),h.trails&&Rs(h.trails);var E=t.interaction;return E&&(h.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),h}function Ps(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:As(null===(r=t.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:vs(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:vs(n.linearX),linearY:vs(n.linearY),linearZ:vs(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:vs(n.orbitalX),orbitalY:vs(n.orbitalY),orbitalZ:vs(n.orbitalZ),speedOverLifetime:vs(n.speedOverLifetime)};Rs(o);var a={options:{startColor:xs(i.startColor)},positionOverLifetime:o};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var s=t.rotationOverLifetime;if(s){var u=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=vs(s.x),u.y=vs(s.y),u.z=vs(s.z)):u.z=vs(s.angularVelocity)}var l=t.colorOverLifetime;if(l){var c=a.colorOverLifetime={opacity:vs(l.opacity)};l.color&&(c.color=_s(l.color))}var h=t.sizeOverLifetime;return h&&(a.sizeOverLifetime={separateAxes:h.separateAxes,size:vs(h.size),x:vs(h.x),y:vs(h.y),z:vs(h.z)}),a}function Fs(t,e){var r=Ps(t,e),i=t.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=t.renderer,t.splits&&(r.splits=t.splits),t.interaction&&(r.interaction=t.interaction),r}var Ns=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],Ds=["path","position"];function Vs(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===Ha.null&&t.endBehavior===$a.destroy&&(t.endBehavior=$a.freeze)}))})),t.version="2.1",t}var zs=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,Us=/^(\d+)\.(\d+)$/,Bs=!1;function ks(t){var e,r;if(!t||"object"!=typeof t)throw Error("expect a json object");if(function(t){var e,r=null===(e=t.version)||void 0===e?void 0:e.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==Ha.mesh&&t.type!==Ha.light||(t.endBehavior=1===t.endBehavior?$a.destroy:t.endBehavior)}))}))}(t),zs.test(t.version))return Bs="0"===(null===(e=/^(\d+)/.exec(t.version))||void 0===e?void 0:e[0]),Vs(function(t){var e,r;Gs="1.0";var i=t.plugins||[];(null===(e=t.bins)||void 0===e?void 0:e.length)&&(Gs="1.3");var n=(t.requires||[]).slice(),o=t.images.map((function(e,r){return Xs(e,r,t.imageTags||[])})),a=t.textures||o.map((function(t,e){return{source:e,flipY:!0}})),s={plugins:i,shapes:t.shapes||[],type:"ge",version:Gs,playerVersion:null!==(r=t.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return Hs(t,{plugins:i,requires:n})})),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:a,bins:(t.bins||[]).slice()};t._textures&&(s._textures=t._textures);return s}(t));var i=null===(r=Us.exec(t.version))||void 0===r?void 0:r[1];if(i)return Number(i)<2?Vs(t):t;throw Error("invalid json version "+t.version)}var Gs="1.0";function Xs(t,e,r){var i=r[e],n=t.oriY;if("string"==typeof t)return{renderLevel:i,url:t,oriY:n};if(t.template)return{url:t.url,template:t.template,webp:t.webp,renderLevel:i,oriY:n};if(t.compressed)return{url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{url:t.url,type:t.type,webp:t.webp,renderLevel:i,oriY:n,loop:t.loop};if(t&&t.sourceType)return t;throw Error("invalid image type")}function Hs(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Object.assign({clipMode:fs},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Zs(t,e)})),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var o=null===(r=t.meta)||void 0===r?void 0:r.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(i.previewSize=o),i}var js,Ys=[0,0,0,1],Ws=.5;function Zs(t,e){var r,i,n;void 0===e&&(e={});var o,a,s,u,l,c,h=Ha.base,f=t.endBehavior,p=NaN;if(t.content?(h=t.type||Ha.plugin,c=t.pn,l=t.pluginName,s=t.content,a=t.content,isNaN(c)&&!l&&(l=s.options.type),t.duration&&(p=t.duration),o=t.transform||v(a.transform),h===Ha.filter&&(Gs<"1.1"&&(Gs="1.1"),(s=Fs(a,o)).filter=function(t){var e={};return ys(t,(function(t,r){Ns.includes(r)?e[r]=vs(t):Ds.includes(r)?e[r]=As(t):e[r]=t})),e}(a.filter))):t.particle?(h=Ha.particle,o=v((a=t.particle).transform,Bs,!0),s=Is(a)):t.sprite?(h=Ha.sprite,s=Fs(a=t.sprite,o=v(a.transform,!1,!0))):t.cal?(h=Ha.null,s=Ps(a=t.cal,o=v(a.transform,!1,!0))):t.ui?(h=Ha.interact,o=v((a=t.ui).transform),s=function(t){var e,r=t.options;switch(r.type){case"click":e={type:Ga.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&xs(r.previewColor),behavior:r.behavior||Xa.NOTIFY};break;case"drag":e={type:Ga.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:Ga.MESSAGE}}return{options:e}}(a),o.scale=[a.options.width||1,a.options.height||1,1]):t.model&&(a=t.model,1===t.model.options.type&&(h=Ha.camera,o=v(a.transform),s=function(t){var e,r,i=t.options,n={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},o=t.velocityOverLifetime;if(o||(null===(e=t.transform)||void 0===e?void 0:e.path)){var a={path:As(null===(r=t.transform)||void 0===r?void 0:r.path),linearX:vs(null==o?void 0:o.translateX),linearY:vs(null==o?void 0:o.translateY),linearZ:vs(null==o?void 0:o.translateZ)};Rs(a),n.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:vs(null==s?void 0:s.rotateX),y:vs(null==s?void 0:s.rotateY),z:s.separateAxes?vs(null==s?void 0:s.rotateZ):vs(s.rotation)};Rs(u),n.rotationOverLifetime=u}return n}(a))),null===(r=s.renderer)||void 0===r?void 0:r.anchor){var d=new Float32Array(s.renderer.anchor);d[0]==Ws&&d[1]==Ws?delete s.renderer.anchor:e.requires&&ms(e.requires,"anchor")}if(a){var m=null===(i=a.options)||void 0===i?void 0:i.looping;f=m?Array.isArray(m)?m[1]?$a.loop:$a.destroy:$a.loop:f||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||$a.destroy,a.options.renderLevel&&(u=a.options.renderLevel),isNaN(p)&&(p=a.options.duration)}var y={type:h,name:t.name,delay:t.delay,duration:p,id:t.id+"",transform:o,endBehavior:f,renderLevel:u,content:s};return l?e.plugins?(ms(e.plugins,l),y.pn=e.plugins.indexOf(l)):y.pluginName=l:Number.isInteger(c)&&(y.pn=c),t.parentId&&(y.parentId=t.parentId+""),y;function v(t,e,r){if(t){var i={},n=t.rotation;if(n&&(i.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var o=(a=Ys,s=i.rotation[0],u=i.rotation[1],l=i.rotation[2],c=Os(s*Ms/2),h=Os(u*Ms/2),f=Os(l*Ms/2),p=ws(s*Ms/2),d=ws(u*Ms/2),m=ws(l*Ms/2),a[0]=p*h*f+c*d*m,a[1]=c*d*f-p*h*m,a[2]=c*h*m+p*d*f,a[3]=c*h*f-p*d*m,a);i.rotation=function(t,e){var r,i,n,o=e[0],a=e[1],s=e[2],u=e[3],l=o+o,c=a+a,h=s+s,f=o*l,p=a*l,d=a*c,m=s*h,y=u*h,v=1-d-m,g=p-y,x=p+y,T=1-f-m,E=s*l-u*c,b=s*c+u*l,C=1-f-d;return t[1]=Math.asin((i=-1,(r=-E)>(n=1)?n:r<i?i:r))*Ls,Math.abs(E)<.9999999?(t[0]=Math.atan2(b,C)*Ls,t[2]=Math.atan2(x,v)*Ls):(t[0]=0,t[2]=Math.atan2(-g,T)*Ls),t}([],o)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}var a,s,u,l,c,h,f,p,d,m;return{}}}var qs=((js={})[ft.S]=[ft.S,ft.BPlus,ft.APlus],js[ft.A]=[ft.A,ft.BPlus,ft.APlus],js[ft.B]=[ft.B,ft.BPlus],js);function Ks(t,e){if(!t||!e)return!0;var r=qs[e];return!!r&&r.includes(t)}function Qs(t){return At(t)&&"jsonScene"in t}function Js(t,e){return t?[t[0]-.5,.5-t[1]]:e?hi[e]:[0,0]}var $s=1,tu=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new Ee),this.options=t,this.downloader=e,this.assets={},this.id=$s++,this.timers=[],this.updateOptions(t)}return e.prototype.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,r=void 0===e?10:e;this.timeout=r},e.prototype.updateSceneData=function(t){var e=this.options.variables;return!e||Object.keys(e).length<=0||t.forEach((function(t){t.items.forEach((function(t){if(t.type===Tt.text){var r=e[t.name];r&&(t.content.options.text=r)}}))})),t},e.prototype.loadScene=function(e,r,n){var l,c,h;return o(this,void 0,void 0,(function(){var f,p,d,m,v,g,x,T,E,b,C,_,A=this;return a(this,(function(S){return p=ht(e)?e:this.id,d=performance.now(),m=[],v=null==r?void 0:r.engine.gpuCapability,g=null!==(c=null===(l=null==v?void 0:v.detail)||void 0===l?void 0:l.asyncShaderCompile)&&void 0!==c&&c,x=null!==(h=null==v?void 0:v.detail.compressedTexture)&&void 0!==h?h:0,E=!1,b=new Promise((function(t,e){T=window.setTimeout((function(){E=!0,A.removeTimer(T);var t=performance.now()-d;e("Load time out: totalTime: ".concat(t.toFixed(4),"ms ").concat(m.join(" "),", url: ").concat(p))}),1e3*A.timeout),A.timers.push(T)})),C=function(t,e){return o(A,void 0,void 0,(function(){var r,i,n;return a(this,(function(o){switch(o.label){case 0:if(E)return[3,4];r=performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e()];case 2:return i=o.sent(),m.push("[".concat(t,": ").concat((performance.now()-r).toFixed(2),"]")),[2,i];case 3:throw n=o.sent(),new Error("load error in ".concat(t,", ").concat(n));case 4:throw new Error("load canceled.")}}))}))},_=function(){return o(A,void 0,void 0,(function(){var o,l,c,h,v,E,b,_,A,S,R,O,w,M,L,I,P,F,N,D=this;return a(this,(function(a){switch(a.label){case 0:return At(e)?(f=e,this.baseUrl=location.href,[3,3]):[3,1];case 1:return e=new URL(e,location.href).href,this.baseUrl=e,[4,C("loadJSON",(function(){return D.loadJSON(e)}))];case 2:f=a.sent(),a.label=3;case 3:if(!Qs(f))return[3,6];if(o=i({},f),!this.options||!this.options.variables||0===Object.keys(this.options.variables).length)return[3,5];for(l=f.jsonScene.images,c=o.images,v=0;v<l.length;v++)c[v]instanceof HTMLCanvasElement&&(c[v]=l[v]);return h=o,[4,C("processImages",(function(){return D.processImages(c,o.usedImages,x)}))];case 4:for(h.images=a.sent(),v=0;v<o.images.length;v++)o.textureOptions[v].image=o.images[v];o.jsonScene.compositions=this.updateSceneData(o.jsonScene.compositions),a.label=5;case 5:return[3,12];case 6:return[4,C("processJSON",(function(){return D.processJSON(f)}))];case 7:return E=a.sent(),b=E.usedImages,_=E.jsonScene,A=E.pluginSystem,S=_.bins,R=void 0===S?[]:S,O=_.images,w=_.compositions,M=_.fonts,[4,Promise.all([C("processBins",(function(){return D.processBins(R)})),C("processImages",(function(){return D.processImages(O,b,x)})),C("".concat(g?"async":"sync"," compile"),(function(){return D.precompile(w,A,r,n)}))])];case 8:return L=u.apply(void 0,[a.sent(),2]),I=L[0],P=L[1],[4,C("processFontURL",(function(){return D.processFontURL(M)}))];case 9:return a.sent(),[4,C("processTextures",(function(){return D.processTextures(P,I,_)}))];case 10:return F=a.sent(),_.compositions=this.updateSceneData(_.compositions),o={url:e,renderLevel:this.options.renderLevel,storage:{},pluginSystem:A,jsonScene:_,usedImages:b,images:P,textureOptions:F,bins:I},[4,C("processPlugins",(function(){return A.loadResources(o,D.options)}))];case 11:a.sent(),a.label=12;case 12:return N=performance.now()-d,lt.info("Load asset: totalTime: ".concat(N.toFixed(4),"ms ").concat(m.join(" "),", url: ").concat(p)),window.clearTimeout(T),this.removeTimer(T),o.totalTime=N,o.startTime=d,Number(o.jsonScene.version)<3&&(console.warn("The current json version "+o.jsonScene.version+" is less than 3.0, try to convert to the new version."),o=function(e){var r,i,n,o,a,u,l,c,h,f,p,d;e.jsonScene.version="3.0";var m=e.jsonScene;m.items||(m.items=[]);try{for(var v=s(e.jsonScene.compositions),g=v.next();!g.done;g=v.next()){for(var x=g.value,T=0;T<x.items.length;T++)m.items.push(x.items[T]);3!==x.endBehavior&&1!==x.endBehavior||(x.endBehavior=4)}}catch(t){r={error:t}}finally{try{g&&!g.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}var E={};try{for(var b=s(m.items),C=b.next();!C.done;C=b.next())E[(D=C.value).id]=Ot(),D.oldId=D.id,D.id=E[D.id]}catch(t){n={error:t}}finally{try{C&&!C.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}try{for(var _=s(m.items),A=_.next();!A.done;A=_.next())if((D=A.value).parentId)if(D.parentId.includes("^")){var S=D.parentId.split("^")[0],R=D.parentId.split("^")[1];D.parentId=E[S]+"^"+R}else D.parentId=E[D.parentId]}catch(t){a={error:t}}finally{try{A&&!A.done&&(u=_.return)&&u.call(_)}finally{if(a)throw a.error}}try{for(var O=s(e.jsonScene.compositions),w=O.next();!w.done;w=O.next())for(x=w.value,T=0;T<x.items.length;T++)x.items[T]={id:x.items[T].id}}catch(t){l={error:t}}finally{try{w&&!w.done&&(c=O.return)&&c.call(O)}finally{if(l)throw l.error}}try{for(var M=s(e.textureOptions),L=M.next();!L.done;L=M.next()){var I=L.value;I.id=Ot(),I.dataType=t.DataType.Texture}}catch(t){h={error:t}}finally{try{L&&!L.done&&(f=M.return)&&f.call(M)}finally{if(h)throw h.error}}m.components||(m.components=[]);var P=m.components;try{for(var F=s(m.items),N=F.next();!N.done;N=F.next()){var D;if((D=N.value).content){if(D.content.renderer&&void 0!==D.content.renderer.texture){var V=D.content.renderer.texture;D.content.renderer.texture={id:e.textureOptions[V].id}}D.content.trails&&void 0!==D.content.trails.texture&&(V=D.content.trails.texture,D.content.trails.texture={id:e.textureOptions[V].id})}if(D.transform){var z=D.transform.position,U=D.transform.rotation,B=D.transform.scale;if(z||(z=[0,0,0]),U||(U=[0,0,0]),B||(B=[1,1,1]),D.transform={position:{x:z[0],y:z[1],z:z[2]},rotation:{x:U[0],y:U[1],z:U[2]},scale:{x:B[0],y:B[1],z:B[0]}},D.type===Tt.sprite&&(D.transform.size={x:B[0],y:B[1]},D.transform.scale={x:1,y:1,z:1}),D.type===Tt.sprite){(X=D.content).renderer||(X.renderer={});var k=Js((H=X.renderer).anchor,H.particleOrigin),G=D.transform.size;H.anchor||void 0===H.particleOrigin||(D.transform.position.x+=-k[0]*G.x,D.transform.position.y+=-k[1]*G.y),D.transform.anchor={x:k[0]*G.x,y:k[1]*G.y}}}if(D.type===Tt.particle){var X;(X=D.content).renderer||(X.renderer={});var H=X.renderer;X.renderer.anchor=Js(H.anchor,H.particleOrigin)}3!==D.endBehavior&&1!==D.endBehavior||(D.endBehavior=4);var j=y().replace(/-/g,"");D.type===Tt.sprite?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.SpriteComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.particle?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.ParticleSystem,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.mesh?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.MeshComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.skybox?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.SkyboxComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.light?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.LightComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):"camera"===D.type?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.CameraComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.tree?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.TreeComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.interact?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.InteractComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.camera?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.CameraController,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.text&&(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.TextComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id}))}}catch(t){p={error:t}}finally{try{N&&!N.done&&(d=F.return)&&d.call(F)}finally{if(p)throw p.error}}return e}(o)),[2,o]}}))}))},[2,Promise.race([b,_()])]}))}))},e.prototype.precompile=function(t,e,r,i){return o(this,void 0,void 0,(function(){var n;return a(this,(function(o){switch(o.label){case 0:return r&&r.getShaderLibrary()?(n=null==r?void 0:r.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,r,i)]):[2];case 1:return o.sent(),[4,new Promise((function(t){n.compileAllShaders((function(){t(null)}))}))];case 2:return o.sent(),[2]}}))}))},e.prototype.processJSON=function(t){return o(this,void 0,void 0,(function(){var e,r,i,n,o,s,u,l,c;return a(this,(function(a){switch(a.label){case 0:return e=ks(t),t.compositions.forEach((function(t,r){t.globalVolume&&(e.compositions[r].globalVolume=t.globalVolume)})),r=e.plugins,i=void 0===r?[]:r,n=e.compositions,o=e.imgUsage,s=e.images,[4,(u=new Wa(i)).processRawJSON(e,this.options)];case 1:return a.sent(),l=this.options.renderLevel,c={},o?function(t,e,r,i,n){for(var o=0;o<e.length;o++){var a=r[e[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];Ks(i[u].renderLevel,n)&&(t[u]=!0)}}}(c,n,o,s,l):null==s||s.forEach((function(t,e){c[e]=!0})),[2,{usedImages:c,jsonScene:e,pluginSystem:u}]}}))}))},e.prototype.processBins=function(t){return o(this,void 0,void 0,(function(){var e,r,i=this;return a(this,(function(n){return e=this.options.renderLevel,r=t.map((function(r){if(r instanceof ArrayBuffer)return r;if(Ks(r.renderLevel,e))return i.loadBins(r.url);throw new Error("Invalid bins source: ".concat(JSON.stringify(t)))})),[2,Promise.all(r)]}))}))},e.prototype.processFontURL=function(t){return o(this,void 0,void 0,(function(){var r,i=this;return a(this,(function(n){return t?(r=t.map((function(t){return o(i,void 0,void 0,(function(){var r,i;return a(this,(function(n){switch(n.label){case 0:if(!t.fontURL||e.fonts.has(t.fontFamily))return[3,4];r=new FontFace(null!==(i=t.fontFamily)&&void 0!==i?i:"","url("+t.fontURL+")"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r.load()];case 2:return n.sent(),document.fonts.add(r),e.fonts.add(t.fontFamily),[3,4];case 3:return n.sent(),lt.warn("Invalid fonts source: ".concat(JSON.stringify(t.fontURL))),[3,4];case 4:return[2]}}))}))})),[2,Promise.all(r)]):[2]}))}))},e.prototype.processImages=function(e,r,i){return o(this,void 0,void 0,(function(){var n,s,u,l,c,h=this;return a(this,(function(f){return n=this.options,s=n.useCompressedTexture,u=n.variables,l=this.baseUrl,c=e.map((function(e,n){return o(h,void 0,void 0,(function(){var o,c,h,f,p,d,m,y,v,g,x,T,E,b,C,_,A,S,R;return a(this,(function(a){switch(a.label){case 0:if(!r[n])return[3,19];if(o=e.url,c=e.webp,h=new URL(o,l).href,f=c&&new URL(c,l).href,!("template"in e))return[3,16];if(p=e.template,d=void 0,!("v"in p)||2!==p.v||!p.background)return[3,9];if(!((m=Ta(p,u))instanceof Array))return[3,6];y=p.background.name,a.label=1;case 1:return a.trys.push([1,3,,5]),A={},[4,_e(m[0])];case 2:return A.image=a.sent(),A.url=m[0],d=A,[3,5];case 3:return a.sent(),S={},[4,_e(m[1])];case 4:return S.image=a.sent(),S.url=m[1],d=S,[3,5];case 5:return u&&(u[y]=d.url),[3,8];case 6:return"string"!=typeof m?[3,8]:(R={},[4,_e(m)]);case 7:R.image=a.sent(),R.url=m,d=R,a.label=8;case 8:return[3,11];case 9:return[4,Ce(h,f)];case 10:d=a.sent(),a.label=11;case 11:v=void 0,a.label=12;case 12:return a.trys.push([12,14,,15]),[4,_a(d.image,p,u,this.options,-1===e.oriY)];case 13:return v=a.sent(),[3,15];case 14:throw a.sent(),new Error("image template fail: ".concat(h));case 15:return[2,v];case 16:if("type"in e&&"video"===e.type)return g=e.loop,[2,Se(e.url,{loop:g})];if("compressed"in e&&s&&i){if(x=e.compressed,T=void 0,i===Xr.ASTC?T=x.astc:i===Xr.PVRTC&&(T=x.pvrtc),T)return E=new URL(T,l).href,this.assets[n]={url:E,type:t.TextureSourceType.compressed},[2,this.loadBins(E)]}else{if("sourceType"in e)return[2,e];if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof Me)return[2,e]}a.label=17;case 17:return[4,Ce(h,f)];case 18:return b=a.sent(),C=b.url,_=b.image,this.assets[n]={url:C,type:t.TextureSourceType.image},[2,_];case 19:return[2,void 0]}}))}))})),[2,Promise.all(c)]}))}))},e.prototype.processTextures=function(e,r,n){var s;return o(this,void 0,void 0,(function(){var u,l,c=this;return a(this,(function(h){return u=null!==(s=n.textures)&&void 0!==s?s:e.map((function(t,e){return{source:e}})),l=u.map((function(s,u){return o(c,void 0,void 0,(function(){var o,l,c,h;return a(this,(function(a){switch(a.label){case 0:if(s instanceof Me)return[2,s];if(!("mipmaps"in s))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,Re(s,r,n.bins)];case 2:return[2,a.sent()];case 3:throw o=a.sent(),new Error("load texture ".concat(u," fails, error message: ").concat(o));case 4:return"number"!=typeof(l=s.source)?[3,5]:(c=e[l],[3,7]);case 5:return"string"!=typeof l?[3,7]:[4,_e(eu(l))];case 6:c=a.sent(),a.label=7;case 7:if(c)return h=function(e,r){if(e instanceof Me)return e.source;if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement)return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:le.LINEAR,magFilter:le.LINEAR};if(e instanceof HTMLVideoElement)return{sourceType:t.TextureSourceType.video,video:e,minFilter:le.LINEAR,magFilter:le.LINEAR};if(e instanceof ArrayBuffer)return i(i({},Pe(e)),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE,minFilter:le.NEAREST,magFilter:le.NEAREST};throw new Error("Invalid texture options")}(c,this.assets[u]),[2,h.sourceType===t.TextureSourceType.compressed?h:i(i({},h),s)];throw new Error("Invalid texture source: ".concat(l))}}))}))})),[2,Promise.all(l)]}))}))},e.prototype.loadJSON=function(t){return o(this,void 0,void 0,(function(){var e=this;return a(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadJSON(t,r,(function(e,r){i("Couldn't load JSON ".concat(JSON.stringify(t),": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.loadBins=function(t){return o(this,void 0,void 0,(function(){var e=this;return a(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadBinary(t,r,(function(e,r){i("Couldn't load bins ".concat(JSON.stringify(t),": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},e.prototype.dispose=function(){var t;for(var e in this.timers.length&&this.timers.map((function(t){return window.clearTimeout(t)})),this.assets){var r=this.assets[e];null===(t=null==r?void 0:r.dispose)||void 0===t||t.call(r)}this.assets={},this.timers=[]},e.fonts=new Set,e}();function eu(t,e,r){void 0===e&&(e="base64File"),void 0===r&&(r="");for(var i=t.split(",")[1]||t,n=atob(i),o=[],a=0;a<n.length;a+=512){for(var s=n.slice(a,a+512),u=new Array(s.length),l=0;l<s.length;l++)u[l]=s.charCodeAt(l);var c=new Uint8Array(u);o.push(c)}var h=new Blob(o,{type:r});return new File([h],e,{type:r})}var ru,iu,nu=new H(1,1,1),ou=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewMatrix=Z.fromIdentity(),this.projectionMatrix=Z.fromIdentity(),this.viewProjectionMatrix=Z.fromIdentity(),this.inverseViewMatrix=Z.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,u=e.aspect,l=void 0===u?1:u,c=e.clipMode,h=void 0===c?wt.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:l,clipMode:h,position:H.fromArray(p),rotation:q.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 H(0,0,t),r=this.getViewProjectionMatrix(),i=e.applyMatrix(r).z;return new H(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 j;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*D,r,i,n,o===wt.portrait),this.inverseViewMatrix.compose(a,this.getQuat(),nu),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},t.prototype.setRotationByQuat=function(t){Ui.getRotation(t,this.options.rotation)},t}(),au=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.items=[],t}return r(n,e),n.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(Cn);try{for(var n=s(this.items),o=n.next();!o.done;o=n.next()){var a=o.value.getComponent(Cn);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}}},n.prototype.update=function(t){var e,r,i=this.timelineComponent.getTime();try{for(var n=s(this.timelineComponents),o=n.next();!o.done;o=n.next()){var a=o.value,u=a.toLocalTime(i);a.setTime(u)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},n.prototype.resetStatus=function(){this.item.ended=!1,this.item.delaying=!0},n.prototype.createContent=function(){var e=this.items;if(this.items.length=0,this.item.composition){var r=this.item.engine.assetLoader;this.item.composition.compositionSourceManager.jsonScene;for(var o=this.item.props.items?this.item.props.items:[],a=0;a<o.length;a++){var s=void 0,u=o[a];if(t.Item.isComposition(u)){var l=u.content.options.refId,c=this.item.composition.refCompositionProps.get(l);if(!c)throw new Error("引用的Id: ".concat(l," 的预合成不存在"));c.content=u.content,(s=new Ma(this.engine,i(i({},c),{id:u.id,name:u.name,delay:u.delay,duration:u.duration,endBehavior:u.endBehavior,parentId:u.parentId,transform:u.transform,oldId:u.oldId}))).type=Tt.composition,s.composition=this.item.composition,s.addComponent(n).refId=l,s.transform.parentTransform=this.transform,this.item.composition.refContent.push(s),5===s.endBehavior&&(this.item.composition.autoRefTex=!1),s.getComponent(n).createContent()}else if("ECS"===u.type||u.type===Tt.sprite||u.type===Tt.text||u.type===Tt.particle||u.type===Tt.mesh||u.type===Tt.skybox||u.type===Tt.light||"camera"===u.type||u.type===Tt.tree||u.type===Tt.interact||u.type===Tt.camera)(s=r.loadGUID(u.id)).composition=this.item.composition;else if((s=new Ma(this.engine,u)).composition=this.item.composition,u.type===Tt.text){var h=new Aa(this.engine,u.content);h.item=s,s.components.push(h),s.rendererComponents.push(h),s._content=h}else s=La(u,this.item.composition);s.parent=this.item,s.transform.parentTransform=u.type===Tt.camera?new Ui:this.transform,Ma.isExtraCamera(s)&&(this.item.composition.extraCamera=s),e.push(s)}}},n.prototype.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},n.prototype.hitTest=function(e,r,i,n,o,a){for(var s=[],u=(null==a?void 0:a.stop)||ct,l=(null==a?void 0:a.skip)||ct,c=(null==a?void 0:a.maxCount)||this.items.length,h=0;h<this.items.length&&n.length<c;h++){var f=this.items[h];if(f.lifetime>=0&&!f.ended&&!Ma.isComposition(f)&&!l(f)){var p=f.getHitTestParams(o);if(p){var d=!1,m=new H;if(p.type===t.HitTestType.triangle)for(var y=p.triangles,v=p.backfaceCulling,g=0;g<y.length;g++){var x=y[g];if(e.intersectTriangle(x,m,v)){d=!0,s.push(m);break}}else if(p.type===t.HitTestType.box){var T=p.center,E=p.size,b=T.clone().addScaledVector(E,.5),C=T.clone().addScaledVector(E,-.5);e.intersectBox({min:b,max:C},m)&&(d=!0,s.push(m))}else if(p.type===t.HitTestType.sphere){T=p.center;var _=p.radius;e.intersectSphere({center:T,radius:_},m)&&(d=!0,s.push(m))}else if(p.type===t.HitTestType.custom){var A=p.collect(e,new X(r,i));A&&A.length>0&&(A.forEach((function(t){s.push(t)})),d=!0)}if(d){var S={compContent:this.item,id:f.id,name:f.name,position:s[s.length-1],parentId:f.parentId,hitPositions:s,behavior:p.behavior};if(n.push(S),u(S))return n}}}}return n},n}(ie),su=function(){function e(t,e,r){var n,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,u=t.speed,l=void 0===u?1:u,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,T=x.sourceContent,E=x.pluginSystem,b=x.imgUsage,C=x.totalTime,_=x.renderLevel,A=x.refCompositionProps;F(T),this.renderer=f,this.refCompositionProps=A;var S=new Ma(this.getEngine(),T);S.name="rootItem",S.type=Tt.composition,S.composition=this,this.rootComposition=S.addComponent(au),this.rootTimeline=S.getComponent(Cn);var R=!s&&b;this.transform=new Ui({name:this.name}),this.transform.engine=this.getEngine(),S.transform=this.transform,this.globalVolume=T.globalVolume,this.width=v,this.height=g,this.renderOrder=h,this.id=T.id,this.renderer=f,this.texInfo=null!=R?R:{},this.event=y,this.statistic={loadTime:null!=C?C:0,loadStart:null!==(n=e.startTime)&&void 0!==n?n:0,firstFrameTime:0},this.reusable=s,this.speed=l,this.renderLevel=_,this.autoRefTex=!this.keepResource&&R&&5!==S.endBehavior,this.rootItem=S,this.name=T.name,this.pluginSystem=E,this.pluginSystem.initializeComposition(this,e),this.camera=new ou(this.name,i(i({},null==T?void 0:T.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.onEnd)||void 0===t||t.call(o,o)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)}return Object.defineProperty(e.prototype,"handleEnd",{set:function(t){console.warn("The handleEnd property is deprecated. Use onEnd instead."),this.onEnd=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this.compositionSourceManager.textures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this.rootComposition.items},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){var t;return null!==(t=this.rootComposition.startTime)&&void 0!==t?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return this.rootTimeline.getTime()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getDuration=function(){return this.rootItem.duration},e.prototype.restart=function(){this.rootComposition.items,this.prepareRender(),this.reset(),this.transform.setValid(!0),this.rootComposition.resetStatus(),this.forwardTime(this.startTime)},e.prototype.setIndex=function(t){this.renderOrder=t},e.prototype.getIndex=function(){return this.renderOrder},e.prototype.setSpeed=function(t){this.speed=t},e.prototype.getSpeed=function(){return this.speed},e.prototype.play=function(){this.rootItem.ended&&this.reusable&&this.restart(),this.rootTimeline.timelineStarted?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},e.prototype.pause=function(){this.paused=!0},e.prototype.getPaused=function(){return this.paused},e.prototype.resume=function(){this.paused=!1},e.prototype.gotoAndPlay=function(t){this.resume(),this.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime)},e.prototype.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},e.prototype.createRenderFrame=function(){this.renderFrame=new Pr({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},e.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()},e.prototype.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},e.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)},e.prototype.reset=function(){var t=this,e=new Ma(this.getEngine(),this.compositionSourceManager.sourceContent);e.type=Tt.composition,e.composition=this,this.rootComposition=e.addComponent(au),this.rootTimeline=e.getComponent(Cn),this.transform=new Ui({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)},e.prototype.prepareRender=function(){var t,e,r,i,n,o,a,u,l,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=s(this.rootComposition.items),d=p.next();!d.done;d=p.next()){var m=d.value.getComponents(ne);try{for(var y=(r=void 0,s(m)),v=y.next();!v.done;v=y.next()){(A=v.value).isActiveAndEnabled&&f.addMeshToDefaultRenderPass(A)}}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=s(this.refContent),x=g.next();!x.done;x=g.next()){var T=x.value;try{for(var E=(a=void 0,s(T.getComponent(au).items)),b=E.next();!b.done;b=E.next()){m=b.value.getComponents(ne);try{for(var C=(l=void 0,s(m)),_=C.next();!_.done;_=C.next()){var A;(A=_.value).isActiveAndEnabled&&f.addMeshToDefaultRenderPass(A)}}catch(t){l={error:t}}finally{try{_&&!_.done&&(c=C.return)&&c.call(C)}finally{if(l)throw l.error}}}}catch(t){a={error:t}}finally{try{b&&!b.done&&(u=E.return)&&u.call(E)}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)}))},e.prototype.shouldRestart=function(){var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&5===r},e.prototype.shouldDispose=function(){if(this.reusable)return!1;var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},e.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);if(this.globalTime+=n,this.rootTimeline.isActiveAndEnabled){var o=this.rootTimeline.toLocalTime(this.globalTime/1e3);this.rootTimeline.setTime(o)}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(Cn))||void 0===i||i.update(t),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},e.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},e.prototype.callStart=function(t){var e,r,i,n,o,a;try{for(var u=s(t.itemBehaviours),l=u.next();!l.done;l=u.next()){var c=l.value;c.isActiveAndEnabled&&!c.started&&(c.start(),c.started=!0)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}try{for(var h=s(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=s(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}}},e.prototype.callUpdate=function(t,e){var r,i,n,o,a,u;try{for(var l=s(t.itemBehaviours),c=l.next();!c.done;c=l.next()){var h=c.value;h.isActiveAndEnabled&&h.started&&h.update(e)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}try{for(var f=s(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=s(t.children),y=m.next();!y.done;y=m.next()){var v=y.value;Ma.isComposition(v)&&v.ended&&5===v.endBehavior?(v.getComponent(au).resetStatus(),this.callUpdate(v,0)):this.callUpdate(v,e)}}catch(t){a={error:t}}finally{try{y&&!y.done&&(u=m.return)&&u.call(m)}finally{if(a)throw a.error}}},e.prototype.callLateUpdate=function(t,e){var r,i,n,o,a,u;try{for(var l=s(t.itemBehaviours),c=l.next();!c.done;c=l.next()){var h=c.value;h.isActiveAndEnabled&&h.started&&h.lateUpdate(e)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}try{for(var f=s(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=s(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&&(u=m.return)&&u.call(m)}finally{if(a)throw a.error}}},e.prototype.buildItemTree=function(t){var e,r,i,n,o,a;if(t.composition){var u=new Map,l=t.getComponent(au).items;try{for(var c=s(l),h=c.next();!h.done;h=c.next()){var f=h.value;u.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=s(l),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=u.get(m);if(!y)throw Error("元素引用了不存在的元素,请检查数据");Ma.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=s(l),g=v.next();!g.done;g=v.next()){f=g.value;Ma.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}}}},e.prototype.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},e.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)},e.prototype.updateCamera=function(){this.camera.updateMatrix()},e.prototype.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(e,t)}))},e.prototype.getItemByName=function(t){return this.rootItem.find(t)},e.prototype.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return pi((t-r.z)/i,(e-r.w)/n,this.camera)},e.prototype.getEngine=function(){var t;return null===(t=this.renderer)||void 0===t?void 0:t.engine},e.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(au))||void 0===n||n.hitTest(a,t,e,o,r,i),this.refContent.forEach((function(n){var s;null===(s=n.getComponent(au))||void 0===s||s.hitTest(a,t,e,o,r,i)})),o},e.prototype.addInteractiveItem=function(t,e){var r;if(e===gt.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},e.prototype.removeInteractiveItem=function(t,e){var r;e===gt.MESSAGE&&(null===(r=this.onMessageItem)||void 0===r||r.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}))},e.prototype.destroyTextures=function(e){for(var r,i=0;i<e.length;i++){var n=e[i];if(n)if(n.sourceType!==t.TextureSourceType.data||this.texInfo[n.getInstanceId()]){if(this.autoRefTex)--this.texInfo[n.getInstanceId()]||n.dispose()}else n!==(null===(r=this.rendererOptions)||void 0===r?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n!==this.getEngine().emptyTexture&&n.dispose()}},e.prototype.destroyItem=function(t){var e=this;t.type==Tt.composition?4!==t.endBehavior&&t.getComponent(au).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(g(this.items,t),this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)})))},e.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()},e.prototype.dispose=function(){var e,r,i=this;if(!this.destroyed){this.destroyed=!0;var n={},o=this.textures;o&&this.keepResource&&o.forEach((function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=ct)})),this.rootItem.dispose(),this.renderFrame.dispose(),null===(e=this.rendererOptions)||void 0===e||e.emptyTexture.dispose(),null===(r=this.pluginSystem)||void 0===r||r.destroyComposition(this),this.update=function(){lt.error("Update disposed composition: ".concat(i.name,"."))},this.onPlayerPause=ct,this.dispose=ct,o&&this.keepResource&&o.forEach((function(t){return t.dispose=n[t.id]})),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==Qi&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},e.prototype.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},e.prototype.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Can not translate position when container not assigned")},e.prototype.translate=function(t,e,r){this.rootItem.translate(t,e,r)},e.prototype.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},e.prototype.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},e.prototype.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},e.prototype.scale=function(t,e,r){this.rootItem.scale(t,e,r)},e.prototype.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},e.prototype.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},e.prototype.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},e.prototype.reloadTexture=function(){return o(this,void 0,void 0,(function(){return a(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]}}))}))},e}(),uu=0,lu=function(){function t(t,e){var r,i;this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var n=t.jsonScene,o=t.renderLevel,a=t.textureOptions,u=t.pluginSystem,l=t.totalTime,c=n.compositions,h=n.imgUsage,f=n.compositionId;if(!a)throw new Error("scene.textures expected");var p=a;try{for(var d=s(c),m=d.next();!m.done;m=d.next()){var y=m.value;y.id===f?this.composition=y:this.refCompositions.set(y.id,y)}}catch(t){r={error:t}}finally{try{m&&!m.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}if(!this.composition)throw new Error("Invalid composition id: "+f);this.jsonScene=n,this.renderLevel=o,this.pluginSystem=u,this.totalTime=null!=l?l:0,this.imgUsage=null!=h?h:{},this.textures=p,uu=0,this.sourceContent=this.getContent(this.composition)}return t.prototype.getContent=function(t){var e=t.id,r=t.duration,i=t.name,n=t.endBehavior,o=t.camera,a=t.globalVolume,s=t.startTime,u=void 0===s?0:s,l=this.assembleItems(t);return{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:l,camera:o,startTime:u,globalVolume:a}},t.prototype.assembleItems=function(t){var e,r,i,n,o,a,u=this,l=[];this.mask++;var c={};try{for(var h=s(this.jsonScene.components),f=h.next();!f.done;f=h.next()){var p=f.value;c[p.id]=p}}catch(t){e={error:t}}finally{try{f&&!f.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}try{for(var d=s(t.items),m=d.next();!m.done;m=d.next()){var y=m.value,v=this.engine.jsonSceneData[y.id],g=v;if(Ks(v.renderLevel,this.renderLevel)){if(g.type===Tt.sprite||g.type===Tt.particle)try{for(var x=(o=void 0,s(g.components)),T=x.next();!T.done;T=x.next()){var E=c[T.value.id];this.preProcessItemContent(E)}}catch(t){o={error:t}}finally{try{T&&!T.done&&(a=x.return)&&a.call(x)}finally{if(o)throw o.error}}else{var b=g.content;b&&this.preProcessItemContent(b)}var C=v.pn,_=this.jsonScene.plugins,A=void 0===_?[]:_;if(g.listIndex=uu++,void 0!==C&&Number.isInteger(C)&&(g.pluginName=A[C]),g.type===Tt.composition){var S=v.content.options.refId;if(!this.refCompositions.get(S))throw new Error("Invalid Ref Composition id: "+S);var R=this.getContent(this.refCompositions.get(S));this.refCompositionProps.has(S)||this.refCompositionProps.set(S,R),R.items.forEach((function(t){u.processMask(t.content)})),g.items=R.items}l.push(g)}}}catch(t){i={error:t}}finally{try{m&&!m.done&&(n=d.return)&&n.call(d)}finally{if(i)throw i.error}}return l},t.prototype.preProcessItemContent=function(t){var e;if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var r=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=Vo(null===(e=this.jsonScene)||void 0===e?void 0:e.shapes[t.renderer.shape],r):t.renderer.shape&&At(t.renderer.shape)&&(t.renderer.shape=Vo(t.renderer.shape,r))}t.trails&&(t.trails=this.changeTex(t.trails))},t.prototype.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},t.prototype.addTextureUsage=function(t){var e,r=t,i=null!==(e=this.imgUsage)&&void 0!==e?e:{};r&&i&&(i.hasOwnProperty(r)||(i[r]=0),i[r]++)},t.prototype.processMask=function(t){if(t.maskMode!==mt.NONE&&!t.mask){var e=t.maskMode;e===mt.MASK?t.mask=++this.mask:e!==mt.OBSCURED&&e!==mt.REVERSE_OBSCURED||(t.mask=this.mask)}},t.prototype.dispose=function(){this.textures=[],this.composition=void 0,this.jsonScene=void 0,this.totalTime=0,this.pluginSystem=void 0,this.sourceContent=void 0,this.refCompositions.clear(),this.refCompositionProps.clear()},t}(),cu=function(){function e(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new qr(this),this.createDefaultTexture()}return e.prototype.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.prototype.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.prototype.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.prototype.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.prototype.getInstance=function(t){return this.objectInstance[t]},e.prototype.removeInstance=function(t){delete this.objectInstance[t]},e.prototype.addPackageDatas=function(t){var e,r,i,n,o,a,u,l,c,h,f,p,d=t.jsonScene;if(d.items)try{for(var m=s(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=s(d.materials),x=g.next();!x.done;x=g.next()){var T=x.value;this.addEffectsObjectData(T)}}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 E=s(d.shaders),b=E.next();!b.done;b=E.next()){var C=b.value;this.addEffectsObjectData(C)}}catch(t){o={error:t}}finally{try{b&&!b.done&&(a=E.return)&&a.call(E)}finally{if(o)throw o.error}}if(d.geometries)try{for(var _=s(d.geometries),A=_.next();!A.done;A=_.next()){var S=A.value;this.addEffectsObjectData(S)}}catch(t){u={error:t}}finally{try{A&&!A.done&&(l=_.return)&&l.call(_)}finally{if(u)throw u.error}}if(d.components)try{for(var R=s(d.components),O=R.next();!O.done;O=R.next()){var w=O.value;this.addEffectsObjectData(w)}}catch(t){c={error:t}}finally{try{O&&!O.done&&(h=R.return)&&h.call(R)}finally{if(c)throw c.error}}if(t.textureOptions)try{for(var M=s(t.textureOptions),L=M.next();!L.done;L=M.next()){var I=L.value;this.addEffectsObjectData(I)}}catch(t){f={error:t}}finally{try{L&&!L.done&&(p=M.return)&&p.call(M)}finally{if(f)throw f.error}}},e.prototype.createVFXItemsAsync=function(t){return o(this,void 0,void 0,(function(){var e,r,i,n,o,u,l;return a(this,(function(a){switch(a.label){case 0:e=t.jsonScene,a.label=1;case 1:a.trys.push([1,6,7,8]),r=s(e.items),i=r.next(),a.label=2;case 2:return i.done?[3,5]:"ECS"!==(n=i.value).type&&n.type!==Tt.sprite&&n.type!==Tt.particle&&n.type!==Tt.mesh&&n.type!==Tt.skybox&&n.type!==Tt.light&&"camera"!==n.type&&n.type!==Tt.tree&&n.type!==Tt.interact&&n.type!==Tt.camera?[3,4]:this.database?[4,this.assetLoader.loadGUIDAsync(n.id)]:[3,4];case 3:a.sent(),a.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=a.sent(),u={error:o},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(u)throw u.error}return[7];case 8:return[2]}}))}))},e.prototype.addTexture=function(t){this.destroyed||v(this.textures,t)},e.prototype.removeTexture=function(t){this.destroyed||g(this.textures,t)},e.prototype.addMaterial=function(t){this.destroyed||v(this.materials,t)},e.prototype.removeMaterial=function(t){this.destroyed||g(this.materials,t)},e.prototype.addGeometry=function(t){this.destroyed||v(this.geometries,t)},e.prototype.removeGeometry=function(t){this.destroyed||g(this.geometries,t)},e.prototype.addMesh=function(t){this.destroyed||v(this.meshes,t)},e.prototype.removeMesh=function(t){this.destroyed||g(this.meshes,t)},e.prototype.addRenderPass=function(t){this.destroyed||v(this.renderPasses,t)},e.prototype.removeRenderPass=function(t){this.destroyed||g(this.renderPasses,t)},Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.prototype.createDefaultTexture=function(){var e={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=Me.create(this,i({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},e)),this.transparentTexture=Me.create(this,i({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},e))},e.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&<.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}},e}(),hu=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this._deltaTime=0,this.setFPS(t),this.tickers=[]}return Object.defineProperty(t.prototype,"deltaTime",{get:function(){return this._deltaTime},enumerable:!1,configurable:!0}),t.prototype.getFPS=function(){return this.targetFPS},t.prototype.setFPS=function(t){this.targetFPS=k(t,1,120),this.interval=Math.floor(1e3/t)-2},t.prototype.getPaused=function(){return this.paused},t.prototype.start=function(){var t=this;if(this.paused=!1,this._deltaTime=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},r=function(){t.intervalId=e(r),t.paused||t.tick()};r()}},t.prototype.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this._deltaTime=0,this.tickers=[]},t.prototype.pause=function(){this.paused=!0,this._deltaTime=0},t.prototype.resume=function(){this.paused=!1,this._deltaTime=0},t.prototype.tick=function(){if(!this.paused){var t=performance.now();if(this._deltaTime=t-this.lastTime,this._deltaTime>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter((function(t){return t})),this.resetTickers=!1);for(var e=0,r=this.tickers.length;e<r;e++){(0,this.tickers[e])(this._deltaTime)}}}},t.prototype.add=function(t){if("function"!=typeof t)throw new Error("Ticker: The tick object must implement the tick method.");this.tickers.push(t)},t}();Na("camera",ki,Ma,!0),Na("text",Sa,Ma,!0),Na("sprite",cn,Ma,!0),Na("particle",jn,Ma,!0),Na("cal",na,Ma,!0),Na("interact",qi,Ma,!0);var fu=((ru={})[le.RGBA]=34842,ru[le.RGB]=34843,ru[le.ALPHA]=33325,ru[le.RED]=33325,ru[le.LUMINANCE_ALPHA]=33327,ru[le.LUMINANCE]=33325,ru),pu=((iu={})[le.RGBA]=34836,iu[le.RGB]=34837,iu[le.ALPHA]=33326,iu[le.RED]=33326,iu[le.LUMINANCE_ALPHA]=33328,iu[le.LUMINANCE]=33326,iu),du=function(e){function n(t,r){var i=e.call(this,t)||this;return i.initialized=!1,r&&i.fromData(r),i}return r(n,e),n.prototype.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},n.prototype.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this);var e=t.getGLPipelineContext();this.pipelineContext=e;var r=e.gl,i=this.source,n=i.target,o=void 0===n?r.TEXTURE_2D:n,a=i.name;this.textureBuffer=r.createTexture(),this.textureBuffer&&Tu(this.textureBuffer,a),this.target=o,this.update(this.source),this.release(),this.initialized=!0}},n.prototype.clone=function(){var t=new n(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},n.prototype.release=function(){switch(this.source.sourceType){case t.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case t.TextureSourceType.data:delete this.source.data;break;case t.TextureSourceType.compressed:case t.TextureSourceType.mipmaps:delete this.source.mipmaps}},n.prototype.update=function(e){var r,i,n,o,a=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var s=this.target,l=this.source,c=this.pipelineContext.gl,h=this.engine.gpuCapability.detail,f=l.sourceType,p=l.data,d=l.cube,m=l.image,y=l.video,v=l.mipmaps,g=l.mipmaps,x=e.data,T=e.cube,E=e.generateMipmap,b=e.mipmaps,C=l,_=C.format,A=C.type,S=C.internalFormat,R=0,O=0;if(this.bind(f===t.TextureSourceType.video),A===le.HALF_FLOAT?((A=h.halfFloatTexture)||lt.error("Half float texture is not support."),he(c)&&S===_&&(_===le.LUMINANCE&&(_=le.RED),S=fu[_]),h.halfFloatLinear||(l.minFilter=l.magFilter=c.NEAREST,lt.warn("Half float linear not support, change to NEAREST."))):A===c.FLOAT&&((A=h.floatTexture)||lt.error("Float texture is not support."),he(c)&&S===_&&(_===le.LUMINANCE&&(_=le.RED),S=pu[_]),h.floatLinear||(l.minFilter=c.NEAREST,l.magFilter=c.NEAREST,lt.warn("Float linear not support, change to NEAREST."))),void 0===l.premultiplyAlpha&&(l.premultiplyAlpha=!1),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l.premultiplyAlpha),void 0===l.flipY&&(l.flipY=!1),c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,l.flipY),f===t.TextureSourceType.framebuffer)x&&(R=null!==(n=x.width)&&void 0!==n?n:0,O=null!==(o=x.height)&&void 0!==o?o:0,R&&O&&(this.width!==R||this.height!==O)&&c.texImage2D(s,0,S,R,O,0,_,A,null));else if(f===t.TextureSourceType.data)s===c.TEXTURE_CUBE_MAP?T.forEach((function(t,e){var r=u(a.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,A,t),2),i=r[0],n=r[1];R=Math.max(i,R),O=Math.max(n,O)})):(r=u(this.texImage2DData(c,s,0,S,_,A,p),2),R=r[0],O=r[1]);else if(f===t.TextureSourceType.image||f===t.TextureSourceType.video){if(s===c.TEXTURE_CUBE_MAP)d.forEach((function(t,e){var r=u(a.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,A,t),2),i=r[0],n=r[1];R=Math.max(i,R),O=Math.max(n,O)}));else if(s===c.TEXTURE_2D){var w=null!=m?m:y;i=u(this.texImage2D(c,s,0,S,_,A,w),2),R=i[0],O=i[1]}E&&(mu(R)&&mu(O)||he(c))&&c.generateMipmap(s)}else if(f===t.TextureSourceType.mipmaps){var M;s===c.TEXTURE_2D?v.forEach((function(t,e){var r;M="data"in t?a.texImage2DData(c,s,e,S,_,A,t):a.texImage2D(c,s,e,S,_,A,t),0===e&&(r=u(M,2),R=r[0],O=r[1])})):s===c.TEXTURE_CUBE_MAP&&g.forEach((function(t,e){t.forEach((function(t,r){var i;M="data"in t?a.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,S,_,A,t):a.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,S,_,A,t),0===e&&(i=u(M,2),R=i[0],O=i[1])}))}))}else f===t.TextureSourceType.compressed&&b&&(R=b[0].width,O=b[0].height,b.forEach((function(t,e){c.compressedTexImage2D(s,e,S,t.width,t.height,0,t.data)})));this.width=R,this.height=O,this.setTextureFilters(c,s,l)},n.prototype.setTextureFilters=function(t,e,r){var i=r.anisotropic,n=void 0===i?4:i,o=r.wrapS,a=void 0===o?t.CLAMP_TO_EDGE:o,s=r.wrapT,u=void 0===s?t.CLAMP_TO_EDGE:s,l=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&l.setTextureAnisotropic(t,this.target,n);var c=he(t)||mu(this.width)&&mu(this.height),h=r.minFilter?r.minFilter:t.NEAREST,f=r.magFilter?r.magFilter:t.NEAREST;t.texParameteri(e,t.TEXTURE_MIN_FILTER,h),t.texParameteri(e,t.TEXTURE_MAG_FILTER,f),t.texParameteri(e,t.TEXTURE_WRAP_S,c?a:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,c?u:t.CLAMP_TO_EDGE)},n.prototype.fromData=function(t){e.prototype.fromData.call(this,t);var r=t,i=this.assembleOptions(r),n=i.sourceType,o=i.sourceFrom,a=i.name,s=void 0===a?"":a;this.source=i,this.sourceType=n,this.sourceFrom=o,this.name=s,this.guid=t.id},n.prototype.texImage2D=function(e,r,i,n,o,a,s){var u,l=this,c=this.source,h=c.sourceType,f=c.minFilter,p=c.magFilter;c.flipY;var d=c.wrapS,m=c.wrapT,y=null!==(u=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==u?u:2048,v=s;if(h!==t.TextureSourceType.video){var g=f!==e.NEAREST||p!==e.NEAREST||d!==e.CLAMP_TO_EDGE||m!==e.CLAMP_TO_EDGE;(g=g||s.width>y||s.height>y)&&setTimeout((function(){v=l.resizeImage(s)}))}e.texImage2D(r,i,n,o,a,v);var x=[v.width,v.height];if(h===t.TextureSourceType.video){var T=s;return[T.videoWidth,T.videoHeight]}return x},n.prototype.texImage2DData=function(t,e,r,i,n,o,a){var s=a.data,u=a.width,l=a.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(s.buffer,s.byteOffset,s.byteLength/s.BYTES_PER_ELEMENT):s;return t.texImage2D(e,r,i,u,l,0,n,o,c),[u,l]},n.prototype.resizeImage=function(t,e,r){var i,n=null!==(i=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==i?i:2048;if(he(this.pipelineContext.gl)&&t.width<n&&t.height<n)return t;var o=function(t,e,r,i){var n=t.width,o=t.height,a=Math.min(e,r||fi(n)),s=Math.min(e,i||fi(o));if(s!==o||a!==n){var u=xa.getCanvas(),l=u.getContext("2d");return u.width=a,u.height=s,null==l||l.drawImage(t,0,0,n,o,0,0,a,s),lt.warn("Image resize from ".concat(n,"x").concat(o," to ").concat(a,"x").concat(s)),u}}(t,n,e,r);return o||t},n.prototype.reloadData=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return this.offloaded?[4,De().reload(this)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},n.prototype.offloadData=function(){if(this.initialized&&De().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var r=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);else if(t===e.TEXTURE_CUBE_MAP)for(var i=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<i.length;n++)e.texImage2D(i[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},n.prototype.uploadCurrentVideoFrame=function(){return o(this,void 0,void 0,(function(){var e;return a(this,(function(r){switch(r.label){case 0:return this.source.sourceType===t.TextureSourceType.video&&this.source.video&&this.initialized?(e=this.source.video).paused?[4,e.play()]:[3,2]:[3,3];case 1:r.sent(),r.label=2;case 2:return this.update({video:this.source.video}),[2,!0];case 3:return[2,!1]}}))}))},n.prototype.updateSource=function(t){this.source=this.assembleOptions(i(i({},this.source),t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},n.prototype.restore=function(){},n.prototype.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.source.sourceType===t.TextureSourceType.video&&this.source.video&&this.initialized&&(this.source.video.pause(),this.source.video.src="",this.source.video.load()),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){lt.error("This texture has been destroyed.")},this.initialize=Rt,void 0!==this.engine&&this.engine.removeTexture(this)},n}(Me);function mu(t){return 0==(t&t-1)&&0!==t}var yu,vu=function(){function t(t,e){this.engine=t,this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}return t.prototype.bind=function(){this.bindVertexArray(this.vao)},t.prototype.unbind=function(){this.bindVertexArray(null)},t.prototype.createVertexArray=function(t){var e=null;return he(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),e&&Tu(e,t),e},t.prototype.bindVertexArray=function(t){var e;he(this.gl)?this.gl.bindVertexArray(t):null===(e=this.vaoExt)||void 0===e||e.bindVertexArrayOES(t)},t.prototype.dispose=function(){var t;he(this.gl)?this.gl.deleteVertexArray(this.vao):null===(t=this.vaoExt)||void 0===t||t.deleteVertexArrayOES(this.vao)},t}(),gu=1,xu=function(){function e(e){this.engine=e,this.textures=[],this.renderBuffers=[],this.frameBuffers=[],this.destroyed=!1;var r={width:1,height:1,data:new Uint8Array([255])},i=e.getGLPipelineContext(),n=i.gl;this.gl=n,this.pipelineContext=i,this.emptyTexture2D=new du(e,{data:r,sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new du(e,{target:n.TEXTURE_CUBE_MAP,cube:[r,r,r,r,r,r],sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+gu,gu++}return Object.defineProperty(e.prototype,"height",{get:function(){var t;return null===(t=this.gl)||void 0===t?void 0:t.drawingBufferHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){var t;return null===(t=this.gl)||void 0===t?void 0:t.drawingBufferWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canvas",{get:function(){return this.gl.canvas},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.copy2=function(t,e){var r=this.gl;if(r){this.sourceFbo||(this.sourceFbo=r.createFramebuffer()),this.targetFbo||(this.targetFbo=r.createFramebuffer());var i=this.pipelineContext,n=r.COLOR_ATTACHMENT0;i.bindFramebuffer(r.FRAMEBUFFER,this.sourceFbo),r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,t.textureBuffer,0),i.bindFramebuffer(r.FRAMEBUFFER,this.targetFbo),r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,e.textureBuffer,0),i.bindFramebuffer(r.READ_FRAMEBUFFER,this.sourceFbo),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.targetFbo);var o=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?r.NEAREST:r.LINEAR;r.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),r.COLOR_BUFFER_BIT,o),i.bindFramebuffer(r.FRAMEBUFFER,null),i.bindFramebuffer(r.READ_FRAMEBUFFER,null),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}},e.prototype.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.prototype.createGLRenderBuffer=function(t){var e=this.gl.createRenderbuffer();return e&&v(this.renderBuffers,t),e},e.prototype.resize=function(t,e){var r=this.gl;(r&&r.drawingBufferWidth!==t||r.drawingBufferHeight!==e)&&(r.canvas.width=t,r.canvas.height=e,r.viewport(0,0,t,e),this.frameBuffers.forEach((function(r){var i=r.viewport;r.isCustomViewport||r.resize(i[0],i[1],t*r.viewportScale,e*r.viewportScale)})))},e.prototype.drawGeometry=function(t,e){if(this.gl){var r=t,i=e,n=i.shader.program;if(n){var o=n.setupAttributes(r),a=this.gl,s=r.indicesBuffer,u=r.drawStart,l=r.mode,c=r.drawCount;if(s){var h=s.type,f=s.elementCount;(c=isNaN(c)?f:c)>0&&a.drawElements(l,c,h,null!=u?u:0)}else c>0&&a.drawArrays(l,u,c);null==o||o.unbind()}else console.warn("Material "+i.name+" 的shader着色器程序未初始化。")}else console.warn("GLGPURenderer没有绑定gl对象, 无法绘制geometry")},e.prototype.createGLFrameBuffer=function(t,e){var r=this.gl.createFramebuffer();return r&&(v(this.frameBuffers,t),Tu(r,e,e)),r},e.prototype.createVAO=function(t){return new vu(this.engine,t)},e.prototype.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),g(this.textures,t),delete t.textureBuffer)},e.prototype.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},e.prototype.deleteGLFrameBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),g(this.frameBuffers,t),delete t.fbo)},e.prototype.deleteGLRenderBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),g(this.renderBuffers,t),delete t.buffer)},e.prototype.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.frameBuffers.forEach((function(e){return t.deleteGLFrameBuffer(e)})),this.frameBuffers.length=0,this.renderBuffers.forEach((function(e){return t.deleteGLRenderBuffer(e)})),this.renderBuffers.length=0,this.textures.forEach((function(e){return t.deleteGLTexture(e)})),this.textures.length=0)},e.prototype.lost=function(t){lt.error("gl lost, destroy glRenderer by default",t.target),this.deleteResource()},e.prototype.dispose=function(t){this.deleteResource();var e=this.gl;if(e&&t){var r=e.getExtension("WEBGL_lose_context");null==r||r.loseContext()}this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},e}();function Tu(t,e,r){void 0!==e&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,r&&(t.__SPECTOR_Object_TAG.id=r)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var Eu,bu=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var r=e.target,i=void 0===r?le.ARRAY_BUFFER:r,n=e.type,o=void 0===n?le.FLOAT:n,a=e.name,s=e.usage,u=void 0===s?le.STATIC_DRAW:s,l=e.data,c=e.elementCount,h=function(t){var e,r;return null!==(r=null===(e=Cu[t])||void 0===e?void 0:e.BYTES_PER_ELEMENT)&&void 0!==r?r:0}(o);this.target=i,this.type=o,this.usage=u,this.glBuffer=this.createGLBuffer(a),this.bytesPerElement=h,l?this.bufferData(l):c&&this.bufferData(h*c)}return Object.defineProperty(t.prototype,"elementCount",{get:function(){return this.byteLength/this.bytesPerElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return e&&Tu(e,t),e},t.prototype.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},t.prototype.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var r=this.pipelineContext.gl,i=this.target;r.bindBuffer(i,this.glBuffer),0===e?r.bufferData(i,1,this.usage):(r.bufferData(i,e,this.usage),"number"!=typeof t&&r.bufferSubData(i,0,t))}else this.byteLength=0},t.prototype.bufferSubData=function(t,e){if(this.pipelineContext){var r=this.pipelineContext.gl,i=this.target,n=t*this.bytesPerElement,o=n+e.byteLength;r.bindBuffer(i,this.glBuffer),o>this.byteLength&&(this.byteLength=o,r.bufferData(i,o,this.usage)),r.bufferSubData(i,n,e)}else this.byteLength=0},t.prototype.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},t.prototype.readSubData=function(t,e){return!!he(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},t}(),Cu=((yu={})[le.INT]=Int32Array,yu[le.FLOAT]=Float32Array,yu[le.SHORT]=Int16Array,yu[le.BYTE]=Int8Array,yu[le.UNSIGNED_BYTE]=Uint8Array,yu[le.UNSIGNED_INT]=Uint32Array,yu[le.UNSIGNED_SHORT]=Uint16Array,yu);var _u=((Eu={})[Uint8Array.BYTES_PER_ELEMENT]=le.UNSIGNED_BYTE,Eu[Uint16Array.BYTES_PER_ELEMENT]=le.UNSIGNED_SHORT,Eu[Uint32Array.BYTES_PER_ELEMENT]=le.UNSIGNED_INT,Eu),Au=1,Su=function(t){function e(e,r){var i=t.call(this,e)||this;return i.drawCount=0,i.buffers={},i.vaos={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,r&&i.processProps(r),i}return r(e,t),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInitialized",{get:function(){return this.initialized},enumerable:!1,configurable:!0}),e.prototype.getOptions=function(){return i({},this.options)},e.prototype.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;F(e),e.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new bu(r,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(r,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},e.prototype.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},e.prototype.setAttributeData=function(t,e){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t),i=this.attributes[t].dataSource;if(r){var n=r.usage,o=r.target;this.bufferProps[i]={data:e,usage:n,target:o,elementCount:e.length},this.dirtyFlags[i].discard=!0,this.dirtyFlags[i].dirty=!0}}},e.prototype.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},e.prototype.setAttributeSubData=function(t,e,r){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t);if(i&&null!=i.data){var n=e,o=e+r.length;if(i.data.length<o){var a=new r.constructor(o);a.set(i.data),i.data=a,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var s=this.dirtyFlags[t];s.start=Math.min(s.start,n),s.end=Math.max(s.end,o-1)}i.data.set(r,n),this.dirtyFlags[t].dirty=!0}}},e.prototype.getIndexData=function(){return this.indices},e.prototype.setIndexData=function(t){(t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array)&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},e.prototype.setIndexSubData=function(t,e){var r;if(this.indices){var i=t,n=t+e.length;if(this.indices.length<n){var o=new e.constructor(n);o.set(this.indices),this.indices=o,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var a=this.dirtyFlags.index;a.start=Math.min(a.start,i),a.end=Math.max(a.end,n-1)}null===(r=this.indices)||void 0===r||r.set(e,i),this.dirtyFlags.index.dirty=!0}},e.prototype.getAttributeStride=function(t){var e=this.attributes[t],r=e.stride,i=e.size,n=e.type;return r||i*rr[n]},e.prototype.getAttributeNames=function(){return this.attributesName},e.prototype.setDrawStart=function(t){this.drawStart=t},e.prototype.getDrawStart=function(){return this.drawStart},e.prototype.setDrawCount=function(t){this.drawCount=t},e.prototype.getDrawCount=function(){return this.drawCount},e.prototype.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},e.prototype.createIndicesBuffer=function(t,e){var r=_u[e.BYTES_PER_ELEMENT],i={data:e,target:le.ELEMENT_ARRAY_BUFFER,type:r,name:"".concat(this.name,"##index")};return new bu(t,i)},e.prototype.flush=function(){var t=this;if(this.initialized){var e=this.attributes,r=this.bufferProps,i=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var o,a,s=t.dirtyFlags[n];if("index"==n)o=t.indicesBuffer,a=i;else{var u=e[n].dataSource;o=t.buffers[u],a=r[u].data}if((s.dirty||s.discard)&&o&&a){if(s.discard)o.bufferData(a);else{var l=s.start*a.BYTES_PER_ELEMENT+a.byteOffset,c=s.end-s.start+1,h=new a.constructor(a.buffer,l,c);o.bufferSubData(s.start,h)}s.start=Number.POSITIVE_INFINITY,s.end=0,s.dirty=s.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(i){var n=t.attributesReleasable[i],o=e[i].dataSource;r[o]&&n&&(r[o].data=void 0)})),this.indicesReleasable}},e.prototype.processProps=function(t){var e=t,r=e.drawStart,i=void 0===r?0:r,n=e.drawCount,o=e.mode,a=e.indices,s=e.name,u=void 0===s?"effectsGeometry:".concat(Au++):s,l=e.bufferUsage,c=void 0===l?le.STATIC_DRAW:l;this.name=u;var h={},f=[],p={},d={},m={},y=c;this.drawStart=i,void 0!==n&&(this.drawCount=n),this.mode=isNaN(o)?le.TRIANGLES:o,Object.keys(e.attributes).forEach((function(t){var r=e.attributes[t],i=r.size,n=r.stride,o=r.offset,a=r.normalize,s=r,u=s.type,l=void 0===u?le.FLOAT:u,c=s.releasable,v=r.data;if(!l||"dataSource"in r||v||(v=nr(l)),v){var g=v instanceof Float32Array?le.FLOAT:le.INT;h[t]={data:v,usage:y,target:le.ARRAY_BUFFER,name:t},p[t]={size:i,stride:n,offset:o,type:null!=l?l:g,normalize:!!a,dataSource:t},m[t]=null!=c&&c,d[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=r.dataSource;x&&(p[t]={size:i,stride:n,offset:o,type:l,dataSource:x,normalize:!!a})}f.push(t)})),d.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==a?void 0:a.data,this.indicesReleasable=!0===(null==a?void 0:a.releasable),this.bufferProps=h,this.attributes=p,this.attributesName=f,this.attributesReleasable=m,this.dirtyFlags=d,this.options=e,this.initialized=!1},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var r=function(t){for(var e=atob(t),r=new Uint8Array(e.length),i=0;i<e.length;i++)r[i]=e.charCodeAt(i);var n=r.buffer;return n}(e.buffer),i=e.vertexData.vertexCount,n=e.vertexData.channels[0],o=e.vertexData.channels[1],a=e.vertexData.channels[2],s=new Float32Array(r,n.offset,n.dimension*i),u=new Float32Array(r,o.offset,o.dimension*i),l=new Float32Array(r,a.offset,a.dimension*i),c=new Uint16Array(r,e.indexOffset),h={mode:le.TRIANGLES,attributes:{aPos:{type:le.FLOAT,size:3,data:s},aUV:{type:le.FLOAT,size:2,data:u},aNormal:{type:le.FLOAT,size:3,data:l}}};h.indices={data:c},h.drawCount=c.length,this.processProps(h)},e.prototype.dispose=function(){var t,e=this;this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized&&(Object.keys(this.buffers).forEach((function(t){e.buffers[t].dispose()})),this.buffers={},null===(t=this.indicesBuffer)||void 0===t||t.dispose(),Object.keys(this.vaos).forEach((function(t){var r;null===(r=e.vaos[t])||void 0===r||r.dispose(),e.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0)),this.destroyed=!0},e}(ir);var Ru=function(){function t(){this.reset()}return t.prototype.setBlendColor=function(t){var e=u(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.blendColor[0]===r&&this.blendColor[1]===i&&this.blendColor[2]===n&&this.blendColor[3]===o||(this.blendColor[0]=r,this.blendColor[1]=i,this.blendColor[2]=n,this.blendColor[3]=o)},t.prototype.setBlending=function(t){this.blending!==t&&(this.blending=t)},t.prototype.setBlendFunctionParameters=function(t){var e=u(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.blendFunctionParameters[0]===r&&this.blendFunctionParameters[1]===i&&this.blendFunctionParameters[2]===n&&this.blendFunctionParameters[3]===o||(this.blendFunctionParameters[0]=r,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=n,this.blendFunctionParameters[3]=o)},t.prototype.setBlendEquationParameters=function(t){var e=u(t,2),r=e[0],i=e[1];this.blendEquationParameters[0]===r&&this.blendEquationParameters[1]===i||(this.blendEquationParameters[0]=r,this.blendEquationParameters[1]=i)},t.prototype.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},t.prototype.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},t.prototype.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},t.prototype.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},t.prototype.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},t.prototype.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},t.prototype.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},t.prototype.setColorMask=function(t){var e=u(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.colorMask[0]===r&&this.colorMask[1]===i&&this.colorMask[2]===n&&this.colorMask[3]===o||(this.colorMask[0]=r,this.colorMask[1]=i,this.colorMask[2]=n,this.colorMask[3]=o)},t.prototype.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},t.prototype.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},t.prototype.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},t.prototype.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},t.prototype.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},t.prototype.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},t.prototype.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},t.prototype.setCulling=function(t){this.culling!==t&&(this.culling=t)},t.prototype.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},t.prototype.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},t.prototype.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[le.ONE,le.ONE_MINUS_SRC_ALPHA,le.ONE,le.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[le.FUNC_ADD,le.FUNC_ADD],this.depthTest=!1,this.depthMask=!1,this.depthRange=[0,1],this.depthFunc=le.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[le.ALWAYS,le.ALWAYS],this.stencilOpFail=[le.KEEP,le.KEEP],this.stencilOpZFail=[le.KEEP,le.KEEP],this.stencilOpZPass=[le.KEEP,le.KEEP],this.culling=!1,this.frontFace=le.CW,this.cullFace=le.FRONT},t.prototype.apply=function(t){if(t.toggle(le.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(le.BLEND,this.blending),t.toggle(le.DEPTH_TEST,this.depthTest),t.toggle(le.STENCIL_TEST,this.stencilTest),t.toggle(le.CULL_FACE,this.culling),t.toggle(le.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(le.BACK,this.stencilMask[1]),t.stencilMaskSeparate(le.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(le.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(le.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(le.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(le.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,r=e.blendColor,i=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(r[0],r[1],r[2],r[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(n[0],n[1],n[2],n[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),Ou=K,wu=Z,Mu=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.floats={},t.ints={},t.vector2s={},t.vector3s={},t.vector4s={},t.colors={},t.quaternions={},t.matrices={},t.matrice3s={},t.textures={},t.floatArrays={},t.vector4Arrays={},t.matrixArrays={},t.samplers=[],t.uniforms=[],t.uniformDirtyFlag=!0,t.glMaterialState=new Ru,t}return r(n,e),Object.defineProperty(n.prototype,"blending",{get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendColor",{get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendFunction",{get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendEquation",{get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthTest",{get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthMask",{get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthRange",{get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthFunc",{get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"polygonOffsetFill",{get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"polygonOffset",{get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sampleAlphaToCoverage",{get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"colorMask",{get:function(){return this.glMaterialState.colorMask},set:function(t){t&&this.glMaterialState.setColorMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilTest",{get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilMask",{get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilRef",{get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilFunc",{get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpFail",{get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpZFail",{get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpZPass",{get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"culling",{get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"frontFace",{get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cullFace",{get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)},enumerable:!1,configurable:!0}),n.prototype.enableKeyword=function(t){throw new Error("Method not implemented.")},n.prototype.disableKeyword=function(t){throw new Error("Method not implemented.")},n.prototype.isKeywordEnabled=function(t){throw new Error("Method not implemented.")},n.prototype.createMaterialStates=function(t){this.sampleAlphaToCoverage=!!t.sampleAlphaToCoverage,this.depthTest=t.depthTest,this.depthMask=t.depthMask,this.depthRange=t.depthRange,this.depthFunc=t.depthFunc,this.colorMask=t.colorMask,this.polygonOffset=t.polygonOffset,this.polygonOffsetFill=t.polygonOffsetFill,this.blending=t.blending,this.blendFunction=t.blendFunction,this.stencilTest=t.stencilTest},Object.defineProperty(n.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),n.prototype.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;if(e.addMaterial(this),!this.shader){var r=e.getGLPipelineContext();this.shader=r.shaderLibrary.createShader(this.shaderSource)}this.shader.initialize(e),Object.keys(this.textures).forEach((function(e){var r=t.textures[e];_t(r.initialize)?r.initialize():lt.error("".concat(JSON.stringify(r)," is not valid Texture to initialize"))})),this.initialized=!0}},n.prototype.setupStates=function(t){this.glMaterialState.apply(t)},n.prototype.use=function(t,e){var r,i,n,o,a,u=t.engine.getGLPipelineContext();if(this.shader.program.bind(),this.setupStates(u),e){try{for(var l=s(e.uniforms),c=l.next();!c.done;c=l.next())a=c.value,this.checkUniform(a)}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}try{for(var h=s(e.samplers),f=h.next();!f.done;f=h.next())a=f.value,this.samplers.includes(a)||(this.samplers.push(a),this.uniformDirtyFlag=!0)}catch(t){n={error:t}}finally{try{f&&!f.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}}if(this.uniformDirtyFlag&&(this.shader.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirtyFlag=!1),e){for(a in e.floats)this.shader.setFloat(a,e.floats[a]);for(a in e.ints)this.shader.setInt(a,e.ints[a]);for(a in e.matrices)this.shader.setMatrix(a,e.matrices[a])}for(a in this.textures)this.textures[a].textureBuffer||this.textures[a].initialize();for(a in this.floats)this.shader.setFloat(a,this.floats[a]);for(a in this.ints)this.shader.setInt(a,this.ints[a]);for(a in this.floatArrays)this.shader.setFloats(a,this.floatArrays[a]);for(a in this.textures)this.shader.setTexture(a,this.textures[a]);for(a in this.vector2s)this.shader.setVector2(a,this.vector2s[a]);for(a in this.vector3s)this.shader.setVector3(a,this.vector3s[a]);for(a in this.vector4s)this.shader.setVector4(a,this.vector4s[a]);for(a in this.colors)this.shader.setColor(a,this.colors[a]);for(a in this.quaternions)this.shader.setQuaternion(a,this.quaternions[a]);for(a in this.matrices)this.shader.setMatrix(a,this.matrices[a]);for(a in this.matrice3s)this.shader.setMatrix3(a,this.matrice3s[a]);for(a in this.vector4Arrays)this.shader.setVector4Array(a,this.vector4Arrays[a]);for(a in this.matrixArrays)this.shader.setMatrixArray(a,this.matrixArrays[a])},n.prototype.getFloat=function(t){return this.floats[t]},n.prototype.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},n.prototype.getInt=function(t){return this.ints[t]},n.prototype.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},n.prototype.getFloats=function(t){return this.floatArrays[t]},n.prototype.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},n.prototype.getVector2=function(t){return this.vector2s[t]},n.prototype.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},n.prototype.getVector3=function(t){return this.vector3s[t]},n.prototype.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},n.prototype.getVector4=function(t){return this.vector4s[t]},n.prototype.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},n.prototype.getColor=function(t){return this.colors[t]},n.prototype.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},n.prototype.getQuaternion=function(t){return this.quaternions[t]},n.prototype.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},n.prototype.getMatrix=function(t){return this.matrices[t]},n.prototype.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},n.prototype.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},n.prototype.getVector4Array=function(t){return this.vector4Arrays[t]},n.prototype.setVector4Array=function(t,e){var r,i;this.checkUniform(t),this.vector4Arrays[t]=[];try{for(var n=s(e),o=n.next();!o.done;o=n.next()){var a=o.value;this.vector4Arrays[t].push(a.x,a.y,a.z,a.w)}}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},n.prototype.getMatrixArray=function(t){return this.matrixArrays[t]},n.prototype.setMatrixArray=function(t,e){var r,i;this.checkUniform(t),this.matrixArrays[t]=[];try{for(var n=s(e),o=n.next();!o.done;o=n.next())for(var a=o.value,u=0;u<16;u++)this.matrixArrays[t].push(a.elements[u])}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},n.prototype.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},n.prototype.getTexture=function(t){return this.textures[t]},n.prototype.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirtyFlag=!0),this.textures[t]=e},n.prototype.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},n.prototype.clone=function(t){var e=t||this.props,r=this.engine;F(r);var i=new n(r,e);return i.glMaterialState=Object.assign(new Ru,i.glMaterialState),i.floats=this.floats,i.ints=this.ints,i.vector2s=this.vector2s,i.vector3s=this.vector3s,i.vector4s=this.vector4s,i.colors=this.colors,i.quaternions=this.quaternions,i.matrices=this.matrices,i.textures=this.textures,i.floatArrays=this.floatArrays,i.vector4Arrays=this.vector4Arrays,i.matrixArrays=this.matrixArrays,i.samplers=this.samplers,i.uniforms=this.uniforms,i.uniformDirtyFlag=!0,i},n.prototype.fromData=function(t){e.prototype.fromData.call(this,t),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var r,n=i({vector2s:{},matrices:{},textures:{},floatArrays:{},blending:!1,zTest:!1,zWrite:!1},t);for(r in this.blending=n.blending,this.depthTest=n.zTest,this.depthMask=n.zWrite,n.floats)this.setFloat(r,n.floats[r]);for(r in n.ints)this.setInt(r,n.ints[r]);for(r in n.vector4s){var o=n.vector4s[r];this.setVector4(r,new K(o.x,o.y,o.z,o.w))}for(r in n.colors){var a=n.colors[r];this.setColor(r,new et(a.r,a.g,a.b,a.a))}for(r in n.textures){var s=n.textures[r];this.setTexture(r,s)}t.shader&&(this.shader=t.shader,this.shaderSource=this.shader.source),this.initialized=!1},n.prototype.toData=function(){var e=this.taggedProperties;for(var r in this.shader&&(e.shader=this.shader),e.floats={},e.ints={},e.vector4s={},e.dataType=t.DataType.Material,this.blending&&(e.blending=this.blending),this.depthTest&&(e.zTest=this.depthTest),this.depthMask&&(e.zWrite=this.depthMask),this.floats)e.floats[r]=this.floats[r];for(var i in this.ints)e.ints[i]=this.ints[i];for(var n in this.vector4s)e.vector4s[n]=this.vector4s[n];for(var o in this.colors)e.colors[o]=this.colors[o];return e},n.prototype.cloneUniforms=function(t){var e,r=t;for(e in r.floats)this.setFloat(e,r.floats[e]);for(e in r.ints)this.setInt(e,r.ints[e]);for(e in r.floatArrays)this.setFloats(e,r.floatArrays[e]);for(e in r.textures)this.setTexture(e,r.textures[e]);for(e in r.vector2s)this.setVector2(e,r.vector2s[e]);for(e in r.vector3s)this.setVector3(e,r.vector3s[e]);for(e in r.vector4s)this.setVector4(e,r.vector4s[e]);for(e in r.colors)this.setColor(e,r.colors[e]);for(e in r.quaternions)this.setQuaternion(e,r.quaternions[e]);for(e in r.matrices)this.setMatrix(e,r.matrices[e]);for(e in r.vector4Arrays){for(var i=[],n=0;n<r.vector4Arrays[e].length;n+=4)i.push(new Ou(r.vector4Arrays[e][n],r.vector4Arrays[e][n+1],r.vector4Arrays[e][n+2],r.vector4Arrays[e][n+3]));this.setVector4Array(e,i)}for(e in r.matrixArrays){var o=[];for(n=0;n<r.matrixArrays[e].length;n+=16){for(var a=wu.fromIdentity(),s=0;s<16;s++)a.elements[s]=r.matrixArrays[e][n+s];o.push(a)}this.setMatrixArray(e,o)}},n.prototype.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirtyFlag=!0)},n.prototype.dispose=function(e){var r,i=this;this.destroyed||(null===(r=this.shader)||void 0===r||r.dispose(),(null==e?void 0:e.textures)!==t.DestroyOptions.keep&&Object.keys(this.textures).forEach((function(t){var e=i.textures[t];e!==i.engine.emptyTexture&&e.dispose()})),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=Rt,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},n}(Xe),Lu=function(){function e(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}return e.prototype.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},e.prototype.copyTexture=function(e,r){this.renderer&&(e.initialize(),r.initialize(),r.updateSource({sourceType:t.TextureSourceType.framebuffer,data:{width:r.getWidth()||e.getWidth(),height:r.getHeight()||e.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(e,r):this.copy1(e,r))},e.prototype.copy2=function(t,e){var r,i=this.renderer.getFrameBuffer();null===(r=this.renderer)||void 0===r||r.glRenderer.copy2(t,e),this.renderer.setFrameBuffer(i)},e.prototype.copy1=function(t,e){var r=this.copyRenderPass;if(r){var i=this.renderer;if(i){var n=r.frameBuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),i.glRenderer.resetColorAttachments(n,[e]),r.meshes[0].material.setTexture("uTex",t),i.renderRenderPass(r)}}},e.prototype.createCopyRenderPass=function(){var e="mri-copy-mesh",r={texture:{format:le.RGBA}},i=this.renderer.engine,n=new Su(i,{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}),o=i.gpuCapability.level,a=new Mu(i,{name:e,shader:{cacheId:"$mri-internal-copy",name:e,vertex:ve([],"\n precision highp float;\n attribute vec2 aPos;\n varying vec2 vTex;\n void main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n }\n ",t.ShaderType.vertex,o),fragment:ve([],"\n precision highp float;\n varying vec2 vTex;\n uniform sampler2D uTex;\n void main(){gl_FragColor = texture2D(uTex,vTex);}\n ",t.ShaderType.fragment,o),glslVersion:2===o?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1}});a.blending=!1,a.depthTest=!1,a.culling=!1;var s=new ur(i,{name:e,geometry:n,material:a,priority:0});return new Iu(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:t.TextureLoadAction.whatever},attachments:[r],meshes:[s]})},e.prototype.dispose=function(){var t;this.renderer&&(null===(t=this.copyRenderPass)||void 0===t||t.dispose(),this.renderer=void 0)},e}(),Iu=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.configure=function(t){this.currentFrameBuffer=t.getFrameBuffer(),t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFrameBuffer(this.currentFrameBuffer)},e}(pr),Pu=function(){function t(t,e,r){var i=this;void 0===e&&(e="webgl"),void 0===r&&(r={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],F(t),this.gl=oe(t,e,r),this.contextLostListener=function(t){var e,r,n;try{for(var o=s(i.lostHandlers),a=o.next();!a.done;a=o.next()){a.value.lost(t)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}null===(n=i.canvas)||void 0===n||n.removeEventListener("webglcontextlost",i.contextLostListener)},this.contextRestoredListener=function(t){var e,r,n;try{for(var o=s(i.restoreHandlers),a=o.next();!a.done;a=o.next()){a.value.restore()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}null===(n=i.canvas)||void 0===n||n.addEventListener("webglcontextlost",i.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}return t.prototype.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},t.prototype.addLostHandler=function(t){this.lostHandlers.push(t)},t.prototype.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},t.prototype.addRestoreHandler=function(t){this.restoreHandlers.push(t)},t.prototype.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),Fu=function(t){function e(e){var r=t.call(this)||this;return r.gpuCapability=new Ur(e),r}return r(e,t),e.prototype.dispose=function(){this.isDestroyed||t.prototype.dispose.call(this)},e.prototype.getGLRenderer=function(){return this.renderer},e.prototype.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},e.prototype.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(cu),Nu=function(t){function e(e,r){var i=t.call(this,e)||this;return i.initialized=!1,void 0!==r&&i.initialize(r),i}return r(e,t),e.prototype.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderBuffer(this))},e.prototype.setSize=function(t,e){if(this.initialized){if(t!==this.size[0]||e!==this.size[1]){var r=this.renderer,i=r.gl;r.pipelineContext.bindRenderBuffer(i.RENDERBUFFER,this.buffer),t&&e?i.renderbufferStorage(i.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):lt.error("Invalid render buffer size: ".concat(t,"x").concat(e))}}else lt.error("Can't set size for uninitialized render buffer")},e.prototype.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderBuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=Rt},e}(Vr),Du=1,Vu=function(e){function i(r,i){var n,o=e.call(this)||this;o.attachmentTextures=[],o.renderer=i,o.engine=i.engine;var a=r.depthStencilAttachment,s=r.viewport,u=r.isCustomViewport,l=r.storeAction,c=r.viewportScale,h=void 0===c?1:c,f=r.name,p=void 0===f?"GLFrameBuffer".concat(Du++):f;return o.depthStencilStorageType=null!==(n=null==a?void 0:a.storageType)&&void 0!==n?n:t.RenderPassAttachmentStorageType.none,o.viewport=s,o.isCustomViewport=!!u,o.viewportScale=h,o.name=p,o.storeAction=l,o.updateProps(r),o}return r(i,e),Object.defineProperty(i.prototype,"stencilStorage",{get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthStorage",{get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderBuffer},enumerable:!1,configurable:!0}),i.prototype.getDepthTexture=function(){return this.depthTexture},i.prototype.getStencilTexture=function(){return this.stencilTexture},i.prototype.getColorTextures=function(){return this.colorTextures},i.prototype.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(e){e.initialize(),v(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&v(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&v(this.attachmentTextures,this.depthTexture.textureBuffer)},i.prototype.updateProps=function(e){var r,i,n=this.renderer,o=this.engine.gpuCapability,a=null!==(r=e.depthStencilAttachment)&&void 0!==r?r:{storageType:t.RenderPassAttachmentStorageType.none},s=e.attachments.length>0;this.externalStorage=!1;var u=!0;if(e.attachments.length>1&&!o.detail.drawBuffers)throw Error("multiple color attachments not support");var l=null===(i=e.depthStencilAttachment)||void 0===i?void 0:i.texture,c=o.detail.readableDepthStencilTextures;if(this.colorTextures=e.attachments.slice(),!s&&a.storageType!==t.RenderPassAttachmentStorageType.none)throw Error("use depth stencil attachment without color attachments");s&&(this.fbo=n.glRenderer.createGLFrameBuffer(this,this.name));var h=a.storageType;if(h===t.RenderPassAttachmentStorageType.depth_stencil_opaque){if(a.storage){if(!(a.storage instanceof Nu))throw Error("invalid depth stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new Nu({format:le.DEPTH_STENCIL,attachment:le.DEPTH_STENCIL_ATTACHMENT,storageType:h},n.glRenderer);u=!1}else if(h===t.RenderPassAttachmentStorageType.depth_16_opaque)if(a.storage){if(!(a.storage instanceof Nu))throw Error("invalid depth attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new Nu({attachment:le.DEPTH_ATTACHMENT,format:le.DEPTH_COMPONENT16,storageType:h},n.glRenderer);else if(h===t.RenderPassAttachmentStorageType.stencil_8_opaque)if(a.storage){if(!(a.storage instanceof Nu))throw Error("invalid stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new Nu({attachment:le.STENCIL_ATTACHMENT,format:le.STENCIL_INDEX8,storageType:h},n.glRenderer);else if(h===t.RenderPassAttachmentStorageType.depth_16_texture){if(!c)throw Error("depth texture is not support in framebuffer");this.depthTexture=null!=l?l:new du(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:le.DEPTH_COMPONENT,internalFormat:o.internalFormatDepth16,type:le.UNSIGNED_SHORT,name:"".concat(this.name,"##depthTex")}),this.depthTexture.initialize()}else if(h===t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture){if(!c)throw Error("depth stencil texture is not support in framebuffer");this.depthTexture=this.stencilTexture=null!=l?l:new du(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:le.DEPTH_STENCIL,internalFormat:o.internalFormatDepth24_stencil8,type:o.UNSIGNED_INT_24_8,name:"".concat(this.name,"##dpthStclTex")}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},i.prototype.getStoreAttachments=function(e,r){var i=this.renderer.glRenderer.gl,n=this.colorTextures.length;if(e&&he(i)&&n>0){var o=[];if(e.depthAction===t.TextureStoreAction.clear&&this.depthStorage&&v(o,r?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===t.TextureStoreAction.clear&&this.stencilStorage&&v(o,r?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),e.colorAction===t.TextureStoreAction.clear)for(var a=0;a<n;a++)v(o,i["COLOR_ATTACHMENT".concat(a)]);return o}},i.prototype.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},i.prototype.bind=function(){var t=this,e=this.renderer.glRenderer.gl,r=this.renderer.pipelineContext;if(this.fbo){var i=e.FRAMEBUFFER,n=u(this.viewport,4),o=n[0],a=n[1],s=n[2],l=n[3];r.bindFramebuffer(i,this.fbo),r.viewport(o,a,s,l);var c=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(r.textureUnitDict).forEach((function(e){var i=r.textureUnitDict[e];i!==c&&i&&t.attachmentTextures.includes(i)&&(r.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)r.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var f=this,p=f.depthStencilRenderBuffer,d=f.depthTexture,m=f.stencilTexture;if(r.activeTexture(e.TEXTURE0),p)p.setSize(s,l),e.framebufferRenderbuffer(i,p.attachment,e.RENDERBUFFER,p.buffer);else if(d){d.source.data={width:s,height:l},d.update({data:{width:s,height:l,data:new Uint16Array(0)}});var y=d&&m?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(i,y,e.TEXTURE_2D,d.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var v=e.checkFramebufferStatus(i);if(v!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed, status: ".concat(v,", error: ").concat(e.getError()));this.ready=!0}}},i.prototype.resetColorTextures=function(t){var e,r,i=t,n=this.renderer.glRenderer.gl,o=this.engine.gpuCapability,a=this.viewport,u=[];if(i){try{for(var l=s(i),c=l.next();!c.done;c=l.next()){c.value.initialize()}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(e)throw e.error}}this.colorTextures=i.slice()}this.renderer.pipelineContext.activeTexture(n.TEXTURE0),this.colorTextures.forEach((function(t,e){var r={width:a[2],height:a[3],data:new Uint8Array(0)};t.update({data:r}),o.framebufferTexture2D(n,n.FRAMEBUFFER,e,n.TEXTURE_2D,t.textureBuffer),u.push(!0)})),o.drawBuffers(n,u),this.updateAttachmentTextures()},i.prototype.resize=function(t,e,r,i){var n=u(this.viewport,4),o=n[0],a=n[1],s=n[2],l=n[3];o===t&&a===e&&s===r&&l===i||(this.viewport=[t,e,r,i],this.ready=!1,this.bind())},i.prototype.dispose=function(e){var r,i,n=this.renderer;if(n){n.glRenderer.deleteGLFrameBuffer(this),delete this.fbo;var o=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:t.RenderPassDestroyAttachmentType.force;(o===t.RenderPassDestroyAttachmentType.force||o===t.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)&&(null===(r=this.depthStencilRenderBuffer)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose()),this.renderer=this.stencilRenderBuffer=this.depthStencilRenderBuffer=null}},i}(Yr);var zu,Uu,Bu=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return e>>>0},ku=((zu={})[le.FLOAT]=1,zu[le.INT]=1,zu[le.UNSIGNED_INT]=1,zu[le.SHORT]=1,zu[le.BOOL]=1,zu[le.UNSIGNED_SHORT]=1,zu[le.FLOAT_VEC2]=2,zu[le.FLOAT_VEC3]=3,zu[le.FLOAT_VEC4]=4,zu[le.FLOAT_MAT2]=4,zu[le.FLOAT_MAT3]=9,zu[le.FLOAT_MAT4]=16,zu[le.FLOAT_MAT2x3]=6,zu[le.FLOAT_MAT2x4]=8,zu[le.FLOAT_MAT4x3]=12,zu[le.FLOAT_MAT4x2]=8,zu[le.FLOAT_MAT3x4]=12,zu[le.FLOAT_MAT3x2]=6,zu[le.INT_VEC2]=2,zu[le.INT_VEC3]=3,zu[le.INT_VEC4]=4,zu[le.UNSIGNED_INT_VEC2]=2,zu[le.UNSIGNED_INT_VEC3]=3,zu[le.UNSIGNED_INT_VEC4]=4,zu[le.BOOL_VEC2]=2,zu[le.BOOL_VEC3]=3,zu[le.BOOL_VEC4]=4,zu),Gu=Yu(Float32Array),Xu=Yu(Int32Array),Hu=Yu(Uint8Array);function ju(t){return function(e,r,i,n){var o={start:r[1],dirty:!0};if(r[2]>1){var a=e;if(a.length){for(var s=n[1]||a.length,u=r[4]/t.BYTES_PER_ELEMENT,l=o.buffer=new t(s*u),c=n[0]||0,h=0;h<s;h++)l[h*u]=a[h+c];o.start+=c*u}}else o.buffer=new t([e]);return o}}function Yu(t){return function(e,r,i,n){for(var o=r[8],a=r[2],s=r[5],u=1===a?o:r[4],l=s?u/s:1,c=u/t.BYTES_PER_ELEMENT/l,h=o/t.BYTES_PER_ELEMENT/c,f=ku[r[0]],p=f/l,d=(n[0]||0)*f,m=n[1]?l*n[1]:h,y=new t(c*m),v={start:r[1]+u*(n[0]||0),dirty:!0,buffer:y},g=0,x=0,T=d;g<m;g++){for(var E=0;E<p;E++)y[x+E]=e[T+E];x+=c,T+=p}return v}}function Wu(t,e){for(var r=[],i=[],n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),o=function(n){var o=t.getActiveUniformBlockName(e,n),a={index:t.getUniformBlockIndex(e,o),usedByVertexShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:o,id:""};a.used=a.usedByVertexShader||a.usedByFragmentShader,r[n]=a;for(var s=a.uniformIndices,u=[],l=0;l<s.length;l++){var c=t.getActiveUniform(e,s[l]).name.replace("[0]","");a.uniforms[c]=[0,0,0,0,0,0,0,l,0],u[l]=c,i.push(c)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach((function(r,i){t.getActiveUniforms(e,s,r).forEach((function(t,e){var r=u[e];a.uniforms[r][i]=+t}))}));for(l=0;l<u.length;l++){var h=a.uniforms[u[l]],f=a.uniforms[u[l+1]],p=f?f[1]:a.size;h[8]=p-h[1]}a.id=function(t){var e=t.name,r=t.size,i=t.uniforms,n=t.uniformIndices;return Object.keys(i).map((function(t){return"".concat(t,"[").concat(i[t].join(":"),"]")})).join("+"),Bu("".concat(e,"+"),"".concat(r,"+"),"".concat(n.length,"+"))}(a)+""},a=0;a<n;++a)o(a);return{blockSpecs:r,blockUniformNames:i}}(Uu={})[le.FLOAT]=ju(Float32Array),Uu[le.INT]=ju(Int32Array),Uu[le.UNSIGNED_INT]=ju(Uint32Array),Uu[le.SHORT]=ju(Int16Array),Uu[le.BOOL]=ju(Uint8Array),Uu[le.UNSIGNED_SHORT]=ju(Uint16Array),Uu[le.FLOAT_VEC2]=Gu,Uu[le.FLOAT_VEC3]=Gu,Uu[le.FLOAT_VEC4]=Gu,Uu[le.FLOAT_MAT2]=Gu,Uu[le.FLOAT_MAT3]=Gu,Uu[le.FLOAT_MAT4]=Gu,Uu[le.FLOAT_MAT2x3]=Gu,Uu[le.FLOAT_MAT2x4]=Gu,Uu[le.FLOAT_MAT4x3]=Gu,Uu[le.FLOAT_MAT4x2]=Gu,Uu[le.FLOAT_MAT3x4]=Gu,Uu[le.FLOAT_MAT3x2]=Gu,Uu[le.INT_VEC2]=Xu,Uu[le.INT_VEC3]=Xu,Uu[le.INT_VEC4]=Xu,Uu[le.UNSIGNED_INT_VEC2]=Xu,Uu[le.UNSIGNED_INT_VEC3]=Xu,Uu[le.UNSIGNED_INT_VEC4]=Xu,Uu[le.BOOL_VEC2]=Hu,Uu[le.BOOL_VEC3]=Hu,Uu[le.BOOL_VEC4]=Hu;var Zu=function(){function t(t,e,r,i){var n=this;this.engine=t,this.program=e,this.shared=r,this.id=i,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var o=this.pipelineContext.gl;if(this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),he(o)){var a=Wu(o,e),s=a.blockSpecs;a.blockUniformNames,s.forEach((function(t){return n.uniformBlockMap[t.name]=t}))}this.pipelineContext.useProgram(null)}return t.prototype.bind=function(){this.pipelineContext.useProgram(this.program)},t.prototype.setupAttributes=function(t){var e,r,i=this,n=this.id,o=this.pipelineContext.gl;return t.vaos[n]?r=t.vaos[n]:((r=new vu(this.engine,"".concat(t.name,"-").concat(n)))||console.error("创建vao对象失败"),t.vaos[n]=r),r&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var r=i.attribInfoMap[e],n=t.attributes[e];if(n){var a=t.buffers[n.dataSource];if(!a)throw Error("no buffer named ".concat(n.dataSource||e));a.bind(),o.enableVertexAttribArray(r.loc),o.vertexAttribPointer(r.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null===(e=t.indicesBuffer)||void 0===e||e.bind(),r&&(r.ready=!0)),r},t.prototype.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var o=t.getActiveAttrib(e,n),a=o.name,s=o.type,u=o.size,l=t.getAttribLocation(e,a);r[a]={type:s,name:a,size:u,loc:l}}return r},t.prototype.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),qu=function(e){function i(t,r){var i=e.call(this,t,r)||this;return i.initialized=!1,i.uniformLocations={},i.samplerChannels={},i}return r(i,e),i.prototype.initialize=function(t){this.initialized||t.getGLPipelineContext().shaderLibrary.compileShader(this)},i.prototype.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},i.prototype.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},i.prototype.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},i.prototype.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.prototype.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},i.prototype.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},i.prototype.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},i.prototype.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},i.prototype.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},i.prototype.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},i.prototype.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},i.prototype.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},i.prototype.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},i.prototype.fillShaderInformation=function(t,e){var r=e.slice();t=t.concat(r);for(var i,n=this.pipelineContext.getUniforms(this.program.program,t),o=0;o<t.length;o++)this.uniformLocations[t[o]]=n[o];for(i=0;i<r.length;i++){null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--)}for(i=0;i<r.length;i++){var a=r[i];this.samplerChannels[a]=i}},i.prototype.toData=function(){var e=this.taggedProperties;e.dataType=t.DataType.Shader,e.id=this.guid,e.vertex=this.source.vertex,e.fragment=this.source.fragment},i.prototype.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null===(t=this.program)||void 0===t||t.dispose()},i}(je),Ku=0,Qu=function(){function e(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}return e.prototype.compileAllShaders=function(t){var e,r,i=this;if(this.shaderAllDone)t&&t([]);else{var n=[];try{for(var o=s(Object.keys(this.cachedShaders)),a=o.next();!a.done;a=o.next()){var u=a.value;this.cachedShaders[u].initialized||n.push(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}t?n.length?Promise.all(n.map((function(t){return new Promise((function(e){return i.compileShader(i.cachedShaders[t],e)}))}))).then(t).catch((function(){return 0})):t([]):n.map((function(t){return i.compileShader(i.cachedShaders[t])})),this.shaderAllDone=!0}},e.prototype.addShader=function(e){var r=this.computeShaderCacheId(e);if(this.cachedShaders[r])return r;this.shaderAllDone=!1;var n=e.glslVersion===t.GLSLVersion.GLSL3?"#version 300 es\n":"",o=e.vertex?n+e.vertex:"",a=e.fragment?n+e.fragment:"",s=!1;return(e.shared||e.cacheId)&&(s=!0),this.cachedShaders[r]=new qu(this.engine,i(i({},e),{vertex:o,fragment:a,name:e.name||r,shared:s})),this.cachedShaders[r].id=r,r},e.prototype.createShader=function(t){var e=this.addShader(t);return this.cachedShaders[e]},e.prototype.compileShader=function(e,r){var i=this,n=e.source,o=!1;(n.shared||n.cacheId)&&(o=!0);var a={vertex:n.vertex,fragment:n.fragment,name:n.name,shared:o},s=this.pipelineContext.gl,u={shared:a.shared,status:t.ShaderCompileResultStatus.compiling},l=this.createProgram(s,a.vertex,a.fragment,u),c=this.glAsyncCompileExt,h=performance.now(),f=function(r){u.status=t.ShaderCompileResultStatus.success,u.compileTime=performance.now()-h,e.program=r,e.initialized=!0,e.pipelineContext=i.pipelineContext,void 0!==i.programMap[e.id]&&console.warn("find duplicated shader id",e.id),i.programMap[e.id]=r},p=function(){var n=(!r||!c||c&&1==s.getProgramParameter(u.program,c.COMPLETION_STATUS_KHR))&&l();if(n){if(u.status!==t.ShaderCompileResultStatus.fail){Tu(n,a.name);var h=new Zu(i.engine,n,o,e.id);if(s.validateProgram(n),s.getProgramParameter(n,s.VALIDATE_STATUS))f(h);else{var d=s.getProgramInfoLog(n);(null==d?void 0:d.includes("the same texture"))?f(h):(u.status=t.ShaderCompileResultStatus.fail,u.error=d,console.error("compileProgramError: "+d,"\nvertex:\n",a.vertex,"\nfragment:\n",a.fragment),s.deleteProgram(n))}}r&&r(u)}else r&&requestAnimationFrame(p)};e.compileResult=u,p()},e.prototype.computeShaderCacheId=function(t){var e,r=t.vertex?t.vertex:"",i=t.fragment?t.fragment:"";return e=t.shared||t.cacheId?t.cacheId||"shared_".concat(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=0,i=0;i<arguments.length;i++)for(var n=t[i],o=0;o<n.length;o++)r=Math.imul(31,r)+n.charCodeAt(o)|0;return r}(r,i)):"instanced_"+Ku++,e},e.prototype.createProgram=function(e,r,i,n){var o=e.createProgram(),a=this.createGLShader(e,e.VERTEX_SHADER,r),s=this.createGLShader(e,e.FRAGMENT_SHADER,i);return o&&a&&s?(e.attachShader(o,a),e.attachShader(o,s),e.linkProgram(o),n.program=o,n.status=t.ShaderCompileResultStatus.compiling,function(){if(delete n.program,!e.getProgramParameter(o,e.LINK_STATUS)){var u=Ju(e,a,"vertex",r),l=Ju(e,s,"fragment",i);return n.status=t.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),l&&(n.error=l.error,n.status=l.status),o}return o}):(n.status=t.ShaderCompileResultStatus.fail,function(){return null})},e.prototype.createGLShader=function(t,e,r){var i=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Bu(null!=r?r:""),o=i.get(n);if(o)return o;var a=t.createShader(e);return a&&(t.shaderSource(a,r),t.compileShader(a),i.set(n,a)),a},e.prototype.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},e.prototype.restore=function(){},e.prototype.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach((function(e){t.programMap[e].dispose()})),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},e}();function Ju(e,r,i,n){if(!e.getShaderParameter(r,e.COMPILE_STATUS)){var o=e.getShaderInfoLog(r);return console.error("compile "+i+" error: "+o,(null!=n?n:"").split("\n").map((function(t,e){return"".concat(e+1," ").concat(t)})).join("\n")),{error:o,status:t.ShaderCompileResultStatus.fail}}}var $u=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new Qu(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}return t.prototype.dispose=function(){this.shaderLibrary.dispose(),this.reset()},t.prototype.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=le.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderBuffer={}},t.prototype.toggle=function(t,e){e?this.enable(t):this.disable(t)},t.prototype.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},t.prototype.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},t.prototype.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},t.prototype.bindRenderBuffer=function(t,e){this.currentRenderBuffer[t]!==e&&(this.currentRenderBuffer[t]=e,this.gl.bindRenderbuffer(t,e))},t.prototype.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},t.prototype.useProgram=function(t){this.set1("useProgram",t)},t.prototype.clear=function(t){this.gl.clear(t)},t.prototype.clearDepth=function(t){this.set1("clearDepth",t)},t.prototype.depthFunc=function(t){this.set1("depthFunc",t)},t.prototype.depthMask=function(t){this.set1("depthMask",t)},t.prototype.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},t.prototype.depthRange=function(t,e){this.set2("depthRange",t,e)},t.prototype.clearStencil=function(t){this.set1("clearStencil",t)},t.prototype.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},t.prototype.stencilFunc=function(t,e,r){this.stencilFuncSeparate(this.gl.FRONT,t,e,r),this.stencilFuncSeparate(this.gl.BACK,t,e,r)},t.prototype.stencilFuncSeparate=function(t,e,r,i){this.set4("stencilFuncSeparate",t,e,r,i)},t.prototype.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},t.prototype.stencilOp=function(t,e,r){this.stencilOpSeparate(this.gl.FRONT,t,e,r),this.stencilOpSeparate(this.gl.BACK,t,e,r)},t.prototype.stencilOpSeparate=function(t,e,r,i){this.set4("stencilOpSeparate",t,e,r,i)},t.prototype.cullFace=function(t){this.set1("cullFace",t)},t.prototype.frontFace=function(t){this.set1("frontFace",t)},t.prototype.clearColor=function(t,e,r,i){this.set4("clearColor",t,e,r,i)},t.prototype.colorMask=function(t,e,r,i){this.set4("colorMask",t,e,r,i)},t.prototype.blendColor=function(t,e,r,i){this.set4("blendColor",t,e,r,i)},t.prototype.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},t.prototype.blendFuncSeparate=function(t,e,r,i){this.set4("blendFuncSeparate",t,e,r,i)},t.prototype.blendEquation=function(t){this.set1("blendEquation",t)},t.prototype.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},t.prototype.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},t.prototype.viewport=function(t,e,r,i){this.set4("viewport",t,e,r,i)},t.prototype.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},t.prototype.bindTexture=function(t,e,r){(this.currentTextureBinding!==e||r)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},t.prototype.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},t.prototype.set2=function(t,e,r){var i=this.glCapabilityCache[t];i||(i=this.glCapabilityCache[t]={x:NaN,y:NaN}),i.x===e&&i.y===r||this.gl[t](i.x=e,i.y=r)},t.prototype.set3=function(t,e,r,i){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===r&&n.z===i||this.gl[t](n.x=e,n.y=r,n.z=i)},t.prototype.set4=function(t,e,r,i,n){var o=this.glCapabilityCache[t];o||(o=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),o.x===e&&o.y===r&&o.z===i&&o.w===n||this.gl[t](o.x=e,o.y=r,o.z=i,o.w=n)},t.prototype.get=function(t){return this.glCapabilityCache[t]},t.prototype.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},t.prototype.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},t.prototype.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},t.prototype.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},t.prototype.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},t.prototype.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},t.prototype.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},t.prototype.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},t.prototype.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},t.prototype.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},t.prototype.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},t.prototype.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},t.prototype.setTexture=function(t,e,r){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var i=r.target;this.gl.bindTexture(i,r.textureBuffer),this.gl.uniform1i(t,e)}},t.prototype.getUniforms=function(t,e){for(var r=[],i=0;i<e.length;i++)r.push(this.gl.getUniformLocation(t,e[i]));return r},t.prototype.setFloat4=function(t,e,r,i,n){t&&this.gl.uniform4f(t,e,r,i,n)},t.prototype.setFloat3=function(t,e,r,i){t&&this.gl.uniform3f(t,e,r,i)},t.prototype.setFloat2=function(t,e,r){t&&this.gl.uniform2f(t,e,r)},t}(),tl=function(e){function n(r,n,o){var a=e.call(this)||this;a.canvas=r,a.temporaryRTs={};var s=i({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},o);a.context=new Pu(r,n,s);var u=a.context.gl;return F(u),a.engine=new Fu(u),a.engine.renderer=a,a.pipelineContext=new $u(a.engine,u),a.glRenderer=new xu(a.engine),a.extension=new Lu(a),a.renderingData={currentFrame:{}},a.frameBuffer=new Vu({storeAction:{},viewport:[0,0,a.width,a.height],attachments:[new du(a.engine,{sourceType:t.TextureSourceType.framebuffer,data:{width:a.width,height:a.height}})],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},a),a}return r(n,e),Object.defineProperty(n.prototype,"isDestroyed",{get:function(){var t=this.glRenderer;return!t||t.isDestroyed},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){var t,e;return null!==(e=null===(t=this.glRenderer)||void 0===t?void 0:t.height)&&void 0!==e?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){var t,e;return null!==(e=null===(t=this.glRenderer)||void 0===t?void 0:t.width)&&void 0!==e?e:0},enumerable:!1,configurable:!0}),n.prototype.renderRenderFrame=function(t){var e,r,i,n,o,a,u=t;u.resource&&u.resource.color_b.initialize(),u.emptyTexture.initialize(),u.transparentTexture.initialize();var l=u._renderPasses;if(this.isDestroyed)return console.error("renderer is destroyed",this);u.renderer.getShaderLibrary().compileAllShaders(),this.setFrameBuffer(null),this.clear(u.clearAction),this.renderingData.currentFrame=u,this.renderingData.currentCamera=u.camera,M(l);try{for(var c=s(l),h=c.next();!h.done;h=c.next()){var f=(m=h.value).delegate;null===(o=f.willBeginRenderPass)||void 0===o||o.call(f,m,this.renderingData),this.renderRenderPass(m),null===(a=f.didEndRenderPass)||void 0===a||a.call(f,m,this.renderingData)}}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=s(l),d=p.next();!d.done;d=p.next()){var m;(m=d.value).frameCleanup(this)}}catch(t){i={error:t}}finally{try{d&&!d.done&&(n=p.return)&&n.call(p)}finally{if(i)throw i.error}}},n.prototype.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},n.prototype.renderMeshes=function(t){var e,r,i,n,o=this.renderingData.currentPass.delegate;try{for(var a=s(t),u=a.next();!u.done;u=a.next()){var l=u.value;null===(i=o.willRenderMesh)||void 0===i||i.call(o,l,this.renderingData),l.render(this),null===(n=o.didRenderMesh)||void 0===n||n.call(o,l,this.renderingData)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}},n.prototype.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},n.prototype.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},n.prototype.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},n.prototype.drawGeometry=function(t,e){if(t&&e){e.initialize(),t.initialize();var r=this.renderingData;r.currentFrame.globalUniforms&&r.currentCamera&&(this.setGlobalMatrix("effects_MatrixInvV",r.currentCamera.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",r.currentCamera.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",r.currentCamera.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",r.currentCamera.getProjectionMatrix()));var i=Date.now()%1e8*.001*1;this.setGlobalFloat("_GlobalTime",i),r.currentFrame.editorTransform&&e.setVector4("uEditorTransform",r.currentFrame.editorTransform);try{e.use(this,r.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,e)}},n.prototype.setFrameBuffer=function(t){t?(this.frameBuffer=t,this.frameBuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},n.prototype.getFrameBuffer=function(){return this.frameBuffer},n.prototype.getTemporaryRT=function(e,r,i,n,o,a){if(this.temporaryRTs[e])return this.temporaryRTs[e];var s,u,l=t.RenderPassAttachmentStorageType.none;o===t.FilterMode.Linear?s=le.LINEAR:o===t.FilterMode.Nearest&&(s=le.NEAREST),a===t.RenderTextureFormat.RGBA32?u=le.UNSIGNED_BYTE:a===t.RenderTextureFormat.RGBAHalf&&(u=le.HALF_FLOAT),0===n?l=t.RenderPassAttachmentStorageType.none:16===n?l=t.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(l=t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var c=new du(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:le.RGBA,format:le.RGBA,type:u}),h=new Vu({name:e,storeAction:{},viewport:[0,0,r,i],viewportScale:1,isCustomViewport:!0,attachments:[c],depthStencilAttachment:{storageType:l}},this);return this.temporaryRTs[e]=h,h},n.prototype.setViewport=function(t,e,r,i){this.pipelineContext.viewport(t,e,r,i)},n.prototype.clear=function(e){var r=this.pipelineContext,i=0;if(e.colorAction===t.TextureLoadAction.clear){var n=e.clearColor;n&&r.clearColor(n[0],n[1],n[2],n[3]),r.colorMask(!0,!0,!0,!0),i=le.COLOR_BUFFER_BIT}if(e.stencilAction===t.TextureLoadAction.clear&&(r.stencilMask(255),r.clearStencil(e.clearStencil||0),i|=le.STENCIL_BUFFER_BIT),e.depthAction===t.TextureLoadAction.clear){var o=e.clearDepth;r.depthMask(!0),r.clearDepth(Number.isFinite(o)?o:1),i|=le.DEPTH_BUFFER_BIT}i&&r.clear(i)},n.prototype.addLostHandler=function(t){this.context.addLostHandler(t)},n.prototype.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},n.prototype.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},n.prototype.getWidth=function(){return this.width},n.prototype.getHeight=function(){return this.height},n.prototype.dispose=function(t){var e;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null===(e=this.glRenderer)||void 0===e||e.dispose(t),this.canvas=null,this.engine.dispose()},n.prototype.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},n.prototype.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context");this.engine=new Fu(t),this.engine.renderer=this,this.pipelineContext=new $u(this.engine,t),this.glRenderer=new xu(this.engine),this.extension=new Lu(this)},n.prototype.resize=function(t,e){var r=this.glRenderer;r&&(this.width===t&&this.height===e||r.resize(t,e))},n.prototype.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},n}(Wr),el="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",rl="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",il="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",nl="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",ol="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",al="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg";var sl=new Map,ul=!1,ll=1,cl=function(){function e(t){var e,r,n=this;this.compositions=[],this.displayScale=1,this.resumePending=!1,this.disposed=!1,this.speed=1,this.baseCompositionIndex=0,this.lost=function(t){var e,r;null===(e=n.ticker)||void 0===e||e.pause(),n.compositions.forEach((function(e){return e.lost(t)})),n.renderer.lost(t),null===(r=n.handleWebGLContextLost)||void 0===r||r.call(n,t),fl(n,!1)},this.restore=function(){return o(n,void 0,void 0,(function(){var t,e,r,i=this;return a(this,(function(n){switch(n.label){case 0:return this.renderer.restore(),t=this,[4,Promise.all(this.compositions.map((function(t){return o(i,void 0,void 0,(function(){var e,r,i,n,o,s,u,l,c,h,f,p;return a(this,(function(a){switch(a.label){case 0:return e=t.time,r=t.url,i=t.speed,n=t.keepResource,o=t.reusable,s=t.renderOrder,u=t.transform,l=t.videoState,[4,this.loadScene(r)];case 1:(c=a.sent()).speed=i,c.reusable=o,c.keepResource=n,c.renderOrder=s,c.transform=u,h=0,a.label=2;case 2:return h<l.length?l[h]?((f=c.textures[h].source.video).currentTime=null!==(p=l[h])&&void 0!==p?p:0,[4,f.play()]):[3,4]:[3,5];case 3:a.sent(),a.label=4;case 4:return h++,[3,2];case 5:return c.rootItem.getComponent(au).resetStatus(),c.gotoAndPlay(e),[2,c]}}))}))})))];case 1:return t.compositions=n.sent(),null===(e=this.handleWebGLContextRestored)||void 0===e||e.call(this),null===(r=this.ticker)||void 0===r||r.resume(),[2]}}))}))},this.handleResume=function(){var t;null===(t=n.handlePlayableUpdate)||void 0===t||t.call(n,{player:n,playing:!0})},this.handleClick=function(t){var e=t.x,r=t.y;n.compositions.forEach((function(t){var o,a=t.hitTest(e,r);if(a.length)for(var s=0;s<a.length;s++){var u=a[s].behavior||xt.NOTIFY;u===xt.NOTIFY?null===(o=n.handleItemClicked)||void 0===o||o.call(n,i(i({},a[s]),{composition:t.name,player:n})):u===xt.RESUME_PLAYER&&n.resume()}}))};var u=t.container,l=t.canvas,c=t.gl,h=t.fps,f=t.name,p=t.pixelRatio,d=t.manualRender,m=t.interactive,y=t.reportGPUTime,v=t.onMessageItem,g=t.onPausedByItem,x=t.onItemClicked,T=t.onPlayableUpdate,E=t.onRenderError,b=t.onWebGLContextLost,C=t.onWebGLContextRestored,_=t.renderFramework,R=t.env,O=void 0===R?"":R,w=t.notifyTouch;if(ue.length)throw new Error("Errors before player create: ".concat(ue.map((function(t,e){return"\n ".concat(e+1,": ").concat(t)}))));var M=null!==(r=null!==(e=t.renderOptions)&&void 0!==e?e:t)&&void 0!==r?r:{},L=M.willCaptureImage,I=M.premultiplyAlpha;if(!ul&&"debug-disable"!==_){var P,F=S()||(P=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===P[1]||"16"===P[1]&&"5"===P[2])?"webgl":"webgl2";if(_&&(F="webgl"===_?"webgl":"webgl2"),this.handleWebGLContextLost=b,this.handleWebGLContextRestored=C,this.reportGPUTime=y,this.handleItemClicked=x,this.handleMessageItem=v,this.handlePlayableUpdate=T,this.handleRenderError=E,this.handlePlayerPause=function(t){n.pause(),null==g||g({name:t.name,player:n})},this.pixelRatio=Number.isFinite(p)?p:A(),this.offscreenMode=!0,this.env=O,l)this.canvas=l;else if(c){this.canvas=c.canvas;var N=c instanceof WebGLRenderingContext?"webgl":"webgl2";F!==N&&(lt.error("The gl context(".concat(N,") is inconsistent with renderFramework or default version(").concat(F,")")),F=N)}else pl(u),this.canvas=document.createElement("canvas"),u.appendChild(this.canvas);this.renderer=Wr.create(this.canvas,F,{preserveDrawingBuffer:L,premultipliedAlpha:I}),this.renderer.env=O,this.renderer.addLostHandler({lost:this.lost}),this.renderer.addRestoreHandler({restore:this.restore}),this.gpuCapability=this.renderer.engine.gpuCapability,sl.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&<.warn("Create player with different webgl version: old=".concat(t.gpuCapability.type,", new=").concat(n.gpuCapability.type))})),d||(this.ticker=new hu(h),this.ticker.add(this.tick.bind(this))),this.event=new Wi(this.canvas,!!w),this.event.bindListeners(),this.event.addEventListener(Gi,this.handleClick),this.interactive=null!=m&&m,this.name=f||"".concat(ll++),c||this.resize(),nn(this.gpuCapability.detail),this.container=this.canvas.parentElement,sl.set(this.canvas,this),function(){var t,e,r=[];try{for(var i=s(sl.values()),n=i.next();!n.done;n=i.next()){var o=n.value;o.paused||r.push(o)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}r.length>1&<.error("Current running player count: ".concat(r.length,", see ").concat(al),r)}(),fl(this,!0)}}return e.prototype.setSpeed=function(t){isNaN(t)||(this.speed=t)},e.prototype.getSpeed=function(){return this.speed},e.prototype.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},e.prototype.getCompositions=function(){return this.compositions},Object.defineProperty(e.prototype,"hasPlayable",{get:function(){return this.compositions.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){var t;return null===(t=this.ticker)||void 0===t?void 0:t.getPaused()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"interactive",{get:function(){return this.event.enabled},set:function(t){this.event.enabled=t},enumerable:!1,configurable:!0}),e.prototype.loadScene=function(t,e){var r;return o(this,void 0,void 0,(function(){var i,n,s=this;return a(this,(function(u){switch(u.label){case 0:return n=this.baseCompositionIndex,Ct(t)?(this.baseCompositionIndex+=t.length,[4,Promise.all(t.map((function(t,r){return o(s,void 0,void 0,(function(){var i;return a(this,(function(o){switch(o.label){case 0:return[4,this.createComposition(t,e)];case 1:return(i=o.sent()).setIndex(n+r),[2,i]}}))}))})))]):[3,2];case 1:return i=u.sent(),[3,4];case 2:return this.baseCompositionIndex+=1,[4,this.createComposition(t,e)];case 3:(i=u.sent()).setIndex(n),u.label=4;case 4:return null===(r=this.ticker)||void 0===r||r.start(),[2,i]}}))}))},e.prototype.createComposition=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var r,n,o,s,u,l,c,h,f,p,d=this;return a(this,(function(a){switch(a.label){case 0:return r=this.renderer,n=this.renderer.engine,o=performance.now(),s=i({autoplay:!0},e),hl(t)?(u=t.scene,s=i(i({},s),t.options||{})):u=t,this.assetManager?this.assetManager.updateOptions(s):this.assetManager=new tu(s),n.clearResources(),[4,this.assetManager.loadScene(u,this.renderer,{env:this.env})];case 1:for(l=a.sent(),n.addPackageDatas(l),c=0;c<l.textureOptions.length;c++)l.textureOptions[c]=n.assetLoader.loadGUID(l.textureOptions[c].id),l.textureOptions[c].initialize();return h=new lu(l,n),n.database?[4,n.createVFXItemsAsync(l)]:[3,3];case 2:a.sent(),a.label=3;case 3:if(this.disposed)throw new Error("Disposed player can not used to create Composition");return f=new su(i(i({},s),{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,onPlayerPause:this.handlePlayerPause,onMessageItem:this.handleMessageItem}),l,h),this.ticker&&f.renderLevel===ft.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),[4,new Promise((function(t){d.renderer.getShaderLibrary().compileAllShaders((function(){t(null)}))}))];case 4:return a.sent(),s.autoplay?(this.autoPlaying=!0,f.play()):f.pause(),p=performance.now()-o+f.statistic.loadTime,f.statistic.firstFrameTime=p,lt.info("first frame: [".concat(f.name,"]").concat(p.toFixed(4),"ms")),this.compositions.push(f),[2,f]}}))}))},e.prototype.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.play()})),null===(t=this.ticker)||void 0===t||t.start()},e.prototype.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.gotoAndPlay(t)})),this.ticker?this.ticker.start():this.doTick(0,!0)},e.prototype.gotoAndStop=function(t){var e,r;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(e){e.gotoAndStop(t)})),this.ticker&&!(null===(e=this.ticker)||void 0===e?void 0:e.getPaused())||this.doTick(0,!0),null===(r=this.handlePlayableUpdate)||void 0===r||r.call(this,{player:this,playing:!1})},e.prototype.playSequence=function(t){for(var e,r=function(e){var r=t[e],i=r.onEnd;r.onEnd=function(){null==i||i.call(r,r),t[e+1].play()}},i=0;i<t.length-1;i++)r(i);t[0].play(),null===(e=this.ticker)||void 0===e||e.start()},e.prototype.pause=function(t){var e,r;this.paused||(null===(e=this.ticker)||void 0===e||e.pause(),null===(r=this.handlePlayableUpdate)||void 0===r||r.call(this,{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},e.prototype.resume=function(){var t;return o(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return this.resumePending?[2]:this.paused?(this.resumePending=!0,[4,Promise.all(this.compositions.map((function(t){return t.reloadTexture()})))]):[3,2];case 1:e.sent(),this.resumePending=!1,this.handleResume(),e.label=2;case 2:return null===(t=this.ticker)||void 0===t||t.resume(),[2]}}))}))},e.prototype.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},e.prototype.doTick=function(e,r){var i,n,o,a=this;e=Math.min(e,33)*this.speed;var s=this.compositions,u=!1;s.sort((function(t,e){return t.getIndex()-e.getIndex()})),this.compositions=[];for(var l=0;l<s.length;l++){var c=s[l];c.textureOffloaded?(u=!0,lt.error("Composition ".concat(c.name," texture offloaded, skip render.")),this.compositions.push(c)):(!c.isDestroyed&&c.renderer&&c.update(e,!1),c.isDestroyed||this.compositions.push(c))}if(this.baseCompositionIndex=this.compositions.length,u)return null===(i=this.handleRenderError)||void 0===i||i.call(this,new Error("play when texture offloaded")),null===(n=this.ticker)||void 0===n?void 0:n.pause();if(!this.paused||r){var h=this.gpuCapability.level,f=this.renderer.context.gl,p=2===h&&this.reportGPUTime?ae(f):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<s.length||r){this.renderer.setFrameBuffer(null),this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(l=0;l<s.length;l++)!s[l].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(s[l].renderFrame)}null==p||p.end(),null==p||p.getTime().then((function(t){var e;return null===(e=a.reportGPUTime)||void 0===e?void 0:e.call(a,null!=t?t:0)})).catch,this.autoPlaying&&(null===(o=this.handlePlayableUpdate)||void 0===o||o.call(this,{player:this,playing:!0}))}},e.prototype.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},e.prototype.resize=function(){var t,e,r,i,n,o=this.canvas.parentElement;if(o){var a=this.getTargetSize(o);e=a[0],r=a[1],i=a[2],n=a[3]}else e=i=this.canvas.width,r=n=this.canvas.height;var s=e/r;if(e&&r){var u=document.documentElement.clientWidth;i>2*u&<.error("DPI overflowed, width ".concat(i," is more than 2x document width ").concat(u,", see ").concat(rl));var l=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>l||n>l)&&(lt.error("Container size overflowed ".concat(i,"x").concat(n,", see ").concat(el)),s>1?(i=Math.round(l),n=Math.round(l/s)):(n=Math.round(l),i=Math.round(l*s))),this.renderer.resize(i,n),this.canvas.style.width=e+"px",this.canvas.style.height=r+"px",lt.info("Resize player ".concat(this.name," [").concat(i,",").concat(n,",").concat(e,",").concat(r,"].")),null===(t=this.compositions)||void 0===t||t.forEach((function(t){t.camera.aspect=s}))}},e.prototype.clearCanvas=function(e){e?this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},e.prototype.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},e.prototype.dispose=function(t){var e,r;if(lt.info("call player destroy: ".concat(this.name)),!this.disposed){sl.delete(this.canvas),this.pause(),null===(e=this.ticker)||void 0===e||e.stop(),null===(r=this.assetManager)||void 0===r||r.dispose(),this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.event.dispose(),this.renderer.dispose(!t),fl(this,!1),this.canvas instanceof HTMLCanvasElement&&!t&&this.renderer.context&&(xa.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var i,n=(i=this.name,"Never use destroyed player: ".concat(i," again, see ").concat(ol)),o=function(){return function(t){throw new Error(t)}(n)},a=function(){return t=n,Promise.reject(t);var t};this.tick=o,this.resize=o,this.loadScene=a,this.play=a,this.gotoAndPlay=a,this.gotoAndStop=a,this.playSequence=o,this.destroyCurrentCompositions=o,this.resume=a,this.disposed=!0}},e.prototype.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},e.prototype.getTargetSize=function(t){pl(t);var e,r,i=this.displayAspect;i?t.clientWidth/t.clientHeight>i?e=(r=t.clientHeight*this.displayScale)*i:r=(e=t.clientWidth*this.displayScale)/i:(e=t.clientWidth,r=t.clientHeight);var n=this.pixelRatio,o=e,a=r;if(e=Math.round(e*n),(r=Math.round(r*n))<1||r<1){if(!this.offscreenMode)throw Error("Invalid container size ".concat(e,"x").concat(r,", see ").concat(il));e=r=o=a=1}return[o,a,e,r]},e}();function hl(t){return At(t)&&"scene"in t&&"options"in t}function fl(t,e){Object.keys(Ia).forEach((function(r){var i=Ia[r],n=e?i.onPlayerCreated:i.onPlayerDestroy;null==n||n(t)}))}function pl(t){if(null==t)throw new Error("Container is not an HTMLElement, see ".concat(nl))}Me.create=function(t,e){return new du(t,e)},Me.createWithData=function(e,r,i){void 0===r&&(r=O("#fff")),void 0===i&&(i={});var n=i,o=n.type,a=void 0===o?le.UNSIGNED_BYTE:o,s=n.format,u=void 0===s?le.RGBA:s,l=n.internalFormat,c=n.wrapS,h=void 0===c?le.MIRRORED_REPEAT:c,f=n.wrapT,p=void 0===f?le.MIRRORED_REPEAT:f,d=n.minFilter,m=void 0===d?le.NEAREST:d,y=n.magFilter,v=void 0===y?le.NEAREST:y,g=n.flipY,x=void 0!==g&&g;return new du(e,{data:r,type:a,sourceType:t.TextureSourceType.data,format:u,internalFormat:l||u,wrapS:h,wrapT:p,minFilter:m,magFilter:v,flipY:x})},Xe.create=function(t,e){return new Mu(t,e)},ir.create=function(t,e){return new Su(t,e)},ur.create=function(t,e){return new ur(t,e)},Vr.create=function(t){return new Nu(t)},Yr.create=function(t,e){return new Vu(t,e)},Wr.create=function(t,e,r){return new tl(t,e,r)},cu.create=function(t){return new Fu(t)};var dl="2.0.0-alpha.1";lt.info("player version: "+dl),t.AbstractPlugin=$r,t.ActivationClipPlayable=bn,t.AnimationClipPlayable=En,t.AssetLoader=qr,t.AssetManager=tu,t.BYTES_TYPE_MAP=rr,t.Behaviour=re,t.BezierSegments=Si,t.COMPRESSED_TEXTURE=Xr,t.COPY_FRAGMENT_SHADER=qe,t.COPY_MESH_SHADER_ID=We,t.COPY_VERTEX_SHADER=Ze,t.CalculateLoader=na,t.Camera=ou,t.CameraController=Bi,t.CameraVFXItemLoader=ki,t.Component=ee,t.Composition=su,t.CompositionComponent=au,t.CompositionSourceManager=lu,t.CurveValue=Ci,t.DEFAULT_FONTS=ma,t.Database=Kr,t.Downloader=Ee,t.EFFECTS_COPY_MESH_NAME=Ye,t.EVENT_TYPE_CLICK=Gi,t.EVENT_TYPE_TOUCH_END=ji,t.EVENT_TYPE_TOUCH_MOVE=Hi,t.EVENT_TYPE_TOUCH_START=Xi,t.EffectComponent=Oa,t.EffectsObject=te,t.Engine=cu,t.EventSystem=Wi,t.FILTER_NAME_NONE="none",t.Float16ArrayWrapper=ei,t.FrameBuffer=Yr,t.GLEngine=Fu,t.GLGeometry=Su,t.GLRenderer=tl,t.GPUCapability=Ur,t.Geometry=ir,t.GlobalUniforms=Dr,t.GradientValue=bi,t.HELP_LINK=Ji,t.InteractBehavior=Yi,t.InteractComponent=en,t.InteractLoader=qi,t.InteractMesh=tn,t.ItemBehaviour=ie,t.KTXTexture=Ie,t.LineSegments=_i,t.LinearValue=Ei,t.Material=Xe,t.MaterialDataBlock=ze,t.Mesh=ur,t.PLAYER_OPTIONS_ENV_EDITOR=Qi,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=ia,t.ParticleLoader=jn,t.ParticleMesh=Pn,t.ParticleSystem=Ho,t.ParticleSystemRenderer=Xo,t.PassTextureCache=tr,t.PathSegments=Ai,t.Player=cl,t.PluginSystem=Wa,t.QCanvasViewer=ca,t.QText=la,t.RENDER_PASS_NAME_PREFIX=Lr,t.RENDER_PREFER_LOOKUP_TEXTURE=wn,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=gi,t.RandomValue=xi,t.RandomVectorValue=Ti,t.RenderBuffer=Vr,t.RenderFrame=Pr,t.RenderPass=pr,t.RenderPassPriorityNormal=lr,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=hr,t.Renderer=Wr,t.RendererComponent=ne,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",t.SPRITE_VERTEX_STRIDE=Ki,t.SemanticMap=er,t.SerializationHelper=Zr,t.Shader=je,t.SpriteColorPlayable=Rn,t.SpriteComponent=On,t.SpriteLoader=cn,t.StaticValue=vi,t.TEMPLATE_USE_OFFSCREEN_CANVAS=Mn,t.TextComponent=Aa,t.TextLoader=Sa,t.Texture=Me,t.TextureFactory=Ne,t.Ticker=hu,t.TimelineClip=mn,t.TimelineComponent=Cn,t.Track=dn,t.Transform=Ui,t.VFXItem=Ma,t.ValueGetter=yi,t.addByOrder=L,t.addItem=v,t.addItemWithOrder=function(t,e,r,i){if(void 0===i&&(i=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var o=t[n];if(i)for(;t[n-1][r]<o[r]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][r]>o[r]&&(t[n]=t[n-1],0!=--n););t[n]=o}}},t.alphaFrameFrag="uniform vec4 uTexRange;uniform vec2 uFilterSourceSize;\n#define INTERPOLATION 0\nvec4 filterMain(vec2 texCoord,sampler2D source){float x=uTexRange.x+texCoord.x*uTexRange.y;\n#if 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));vec4 color=mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nvec4 color=texture2D(source,vec2(x,texCoord.y));\n#endif\nx=uTexRange.z+texCoord.x*uTexRange.w;vec4 opacity=texture2D(source,vec2(x,texCoord.y));return vec4(color.rgb,opacity.r);}",t.alphaMaskFrag="uniform sampler2D uAlphaXSample;uniform sampler2D uAlphaYSample;vec4 filterMain(vec2 texCoord,sampler2D source){vec4 color=texture2D(source,texCoord);float x=texture2D(uAlphaXSample,vec2(vFeatherCoord.x,0.)).r;float y=texture2D(uAlphaYSample,vec2(vFeatherCoord.y,0.)).r;return vec4(color.rgb,color.a*min(x,y));}",t.assertExist=F,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},t.blend="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;}",t.bloomMixVert="uniform sampler2D uBloomBlur;uniform vec4 uBloomParams;vec4 filterMain(vec2 coord,sampler2D tex){const vec3 gamma=vec3(1./2.2);vec4 c1=texture2D(tex,coord);vec4 bloomColor=texture2D(uBloomBlur,coord);float alpha=max(c1.a,bloomColor.a);vec3 color=max(c1.rgb*c1.a,bloomColor.rgb*bloomColor.a)/alpha*uBloomParams.y+bloomColor.rgb*uBloomParams.x;return vec4(color,alpha);}",t.bloomThresholdVert="uniform vec4 uColorThreshold;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);vec3 color=c1.rgb*c1.a;vec3 s=step(uColorThreshold.xyz,color);float m=min(s.r+s.g+s.b,1.);return c1*m;}",t.calculateTranslation=oi,t.cameraMoveFrag="uniform vec2 uMoveTexSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uMoveTexSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uMoveTexSize,(coordMin+vec2(1.))/uMoveTexSize);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));vec4 cB=mix(cLB,cRB,pp.x);vec4 cT=mix(cLT,cRT,pp.x);return mix(cB,cT,pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}",t.cameraMoveVert="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",t.canvasPool=xa,t.colorGradingFrag=Er,t.colorStopsFromGradient=b,t.colorToArr=T,t.combineImageTemplate=_a,t.combineImageTemplate1=fa,t.combineImageTemplate1Async=function(t,e,r,i,n){return o(this,void 0,void 0,(function(){return a(this,(function(o){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,fa(t,e,r,i,n)]}))}))},t.combineImageTemplate2=Ca,t.combineImageTemplate2Async=function(t,e,r,i,n){return o(this,void 0,void 0,(function(){return a(this,(function(o){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,Ca(t,e,r,i,n)]}))}))},t.combineImageTemplateAsync=function(t,e,r,i,n){return o(this,void 0,void 0,(function(){return a(this,(function(o){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,_a(t,e,r,i,n)]}))}))},t.compatibleFrag="#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\n",t.compatibleVert="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n",t.copyFrag=He,t.createCopyShader=Ke,t.createGLContext=oe,t.createKeyFrameMeta=Ni,t.createShaderWithMarcos=ve,t.createShape=so,t.createVFXItem=La,t.createValueGetter=Oi,t.deepClone=function t(e){if(Ct(e))return e.map(t);if(e&&"object"==typeof e){if(ArrayBuffer.isView(e))return e.slice();for(var r={},i=Object.keys(e),n=0;n<i.length;n++){var o=i[n];r[o]=t(e[o])}return r}return e},t.defaultGlobalVolume=Mr,t.defaultPlugins=Pa,t.delayFrag="uniform sampler2D uLastSource;uniform vec4 uParams;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);if(uParams.x<1.){return c1;}vec4 c2=texture2D(uLastSource,coord);return mix(c1,c2,uParams.y);}",t.deserializeMipmapTexture=Re,t.disableAllPlayer=function(t){ul=!!t},t.distortionFrag="uniform vec4 uWaveParams;\n#ifdef PATICLE_SHADER\nin vec4 vWaveParams;\n#else\nuniform vec4 vWaveParams;\n#endif\nvec4 filterMain(vec2 texCoord,sampler2D tex){vec2 vp=texCoord-uWaveParams.xy;float xx=dot(vp,uWaveParams.zw);float d=sin(vWaveParams.x*xx+vWaveParams.y)*vWaveParams.z;vec2 up=vec2(-uWaveParams.w,uWaveParams.z)*d;return texture2D(tex,clamp(texCoord+up,0.,1.));}",t.distortionVert="uniform vec4 uMovementValue;uniform vec4 uStrengthValue;uniform vec4 uPeriodValue;out vec4 vWaveParams;void filterMain(float lifetime){const float pi2=3.14159265;vWaveParams=vec4(getValueFromTime(lifetime,uPeriodValue)*pi2,getValueFromTime(lifetime,uMovementValue)*pi2,getValueFromTime(lifetime,uStrengthValue),0.);}",t.earcut=Lo,t.effectsClass=Jt,t.effectsClassStore=Wt,t.enlargeBuffer=x,t.ensureVec3=ai,t.findPreviousRenderPass=function(t,e){var r=t.indexOf(e);return t[r-1]},t.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",t.gaussianDownHFrag=br,t.gaussianDownVFrag=Cr,t.gaussianUpFrag=_r,t.generateEmptyTypedArray=nr,t.generateGUID=Ot,t.generateHalfFloatTexture=Le,t.getActivePlayers=function(){return Array.from(sl.values())},t.getBackgroundImage=Ta,t.getColorFromGradientStops=E,t.getConfig=In,t.getDefaultTemplateCanvasPool=function(){return xa},t.getDefaultTextureFactory=De,t.getGeometryByShape=Vo,t.getGeometryTriangles=Do,t.getImageItemRenderInfo=on,t.getKTXTextureOptions=Pe,t.getKeyFrameMetaByRawValue=Fi,t.getMergedStore=Kt,t.getParticleMeshShader=Dn,t.getPixelRatio=A,t.getPlayerByCanvas=function(t){return sl.get(t)},t.getPreMultiAlpha=pe,t.getStandardComposition=Hs,t.getStandardImage=Xs,t.getStandardItem=Zs,t.getStandardJSON=ks,t.getTextureSize=Fr,t.glContext=le,t.gpuTimer=ae,t.imageDataFromColor=O,t.imageDataFromGradient=w,t.initErrors=ue,t.initGLContext=ce,t.integrate="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.;}",t.interpolateColor=C,t.isAndroid=S,t.isArray=Ct,t.isCanvasUsedByPlayer=function(t){return sl.has(t)},t.isFunction=_t,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=At,t.isScene=Qs,t.isSceneWithOptions=hl,t.isSimulatorCellPhone=R,t.isString=ht,t.isUniformStruct=Ue,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&Ue(t[0])},t.isWebGL2=he,t.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",t.itemFrag=yr,t.itemFrameFrag=dr,t.itemVert=mr,t.loadBinary=Ae,t.loadBlob=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){return[2,new Promise((function(e,r){(new Ee).downloadBlob(t,e,(function(e,i){r("Couldn't load blob ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))},t.loadImage=_e,t.loadVideo=Se,t.loadWebPOptional=Ce,t.logger=lt,t.math=nt,t.modifyMaxKeyframeShader=Vn,t.nearestPowerOfTwo=fi,t.noop=ct,t.parsePercent=_,t.particleFrag=vr,t.particleOriginTranslateMap=hi,t.particleVert=gr,t.pluginLoaderMap=Ia,t.random=St,t.registerPlugin=Na,t.removeItem=g,t.requestAsync=ha,t.rotateVec2=zo,t.screenMeshVert=Tr,t.serialize=Qt,t.setBlendMode=ge,t.setConfig=function(t,e){return Ln[t]=e},t.setDefaultTextureFactory=function(t){Fe=t},t.setMaskMode=Te,t.setMaxSpriteMeshItemCount=function(e){t.maxSpriteMeshItemCount=e},t.setRayFromCamera=pi,t.setSideMode=xe,t.setSpriteMeshMaxFragmentTextures=function(e){t.maxSpriteTextureCount=e},t.setSpriteMeshMaxItemCountByGPU=nn,t.sortByOrder=M,t.spec=Yt,t.spriteMeshShaderFromFilter=an,t.spriteMeshShaderFromRenderInfo=un,t.spriteMeshShaderIdFromRenderInfo=sn,t.thresholdFrag=Ar,t.throwDestroyedError=Rt,t.trailVert=xr,t.translatePoint=function(t,e){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=t,r[i+1]+=e;return r},t.trianglesFromRect=di,t.unregisterPlugin=function(t){delete Fa[t],delete Ia[t],g(Pa,t)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#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.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecAssign=ui,t.vecFill=si,t.vecMulCombine=li,t.vecNormalize=function(t,e){1===arguments.length&&(e=t,t=[]);var r=e,i=Math.hypot.apply(Math,l([],u(r),!1));if(0===i)return ui(t,r,r.length);for(var n=0;n<r.length;n++)t[n]=r[n]/i;return t},t.version=dl,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
20
|
+
*/(t));var r=new e;return r.name=t,r})).sort((function(t,e){return t.order-e.order}))}return t.prototype.initializeComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionConstructed(t,e)}))},t.prototype.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},t.prototype.resetComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionReset(t,e)}))},t.prototype.createPluginItem=function(t,e,r){var i=Fa[t];if(!i)throw new Error("plugin ".concat(t," no registered constructor"));var n=new i(r.getEngine(),e,r);if(n.composition=r,!(n instanceof Ma))throw new Error("plugin ".concat(t," invalid constructor type"));return n},t.prototype.processRawJSON=function(t,e){return o(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.callStatic("processRawJSON",t,e)]}))}))},t.prototype.callStatic=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return o(this,void 0,void 0,(function(){var r,i,n,o,s;return a(this,(function(a){for(r=[],i=this.plugins,n=0;n<i.length;n++)o=i[n],s=Ia[o.name],t in s&&r.push(Promise.resolve(s[t].apply(s,l([],u(e),!1))));return[2,Promise.all(r)]}))}))},t.prototype.precompile=function(t,e,r){return o(this,void 0,void 0,(function(){return a(this,(function(i){return[2,this.callStatic("precompile",t,e,r)]}))}))},t.prototype.loadResources=function(t,e){return o(this,void 0,void 0,(function(){return a(this,(function(r){return[2,this.callStatic("prepareResource",t,e)]}))}))},t}(),Za={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",tree:"@galacean/effects-plugin-model",model:"@galacean/effects-plugin-model","orientation-transformer":"@galacean/effects-plugin-orientation-transformer",spine:"@galacean/effects-plugin-spine"};!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(Da||(Da={})),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"}(Va||(Va={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(za||(za={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Ua||(Ua={})),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"}(Ba||(Ba={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(ka||(ka={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Ga||(Ga={})),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"}(Xa||(Xa={})),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"}(Ha||(Ha={})),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"}(ja||(ja={})),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"}(Ya||(Ya={}));var qa,Ka,Qa,Ja,$a,ts,es,rs,is,ns,os,as,ss,us,ls,cs,hs,fs=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=fs]="landscape"}(qa||(qa={})),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"}(Ka||(Ka={})),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"}(Qa||(Qa={})),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"}(Ja||(Ja={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}($a||($a={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(ts||(ts={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(es||(es={})),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"}(rs||(rs={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(is||(is={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(ns||(ns={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(os||(os={})),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"}(as||(as={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(ss||(ss={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(us||(us={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(ls||(ls={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(cs||(cs={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(hs||(hs={}));var ps=function(){return ps=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},ps.apply(this,arguments)};function ds(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 ms(t,e){if(!t.includes(e))return t.push(e),!0}function ys(t,e,r){if(t)for(var i in t)Object.hasOwnProperty.call(t,i)&&e.call(r,t[i],i);return t}function vs(t){if(Number.isFinite(t))return[Qa.CONSTANT,t];if(t){if("lines"===t[0])return[Qa.LINE,t[1]];if("curve"===t[0])return[Qa.CURVE,t[1]];if("static"===t[0])return[Qa.CONSTANT,t[1]]}}function gs(t,e){return Array.isArray(t)&&"random"===t[0]?[Qa.CONSTANT,t[1][e]]:vs(t)}function xs(t){return t&&"color"===t[0]?Cs(t[1],!0):[1,1,1,1]}function Ts(t,e){if(t){if("colors"===t[0])return[Qa.COLORS,t[1].map((function(t){return Cs(t,e)}))];if("gradient"===t[0])return bs(t[1],e);if("color"===t[0])return[Qa.RGBA_COLOR,Cs(t[1],e)]}}function Es(t){return t&&"random"===t[0]?[Qa.RANDOM,t[1]]:vs(t)}function bs(t,e){if(t){var r=[];return Object.getOwnPropertyNames(t).forEach((function(i){var n=function(t){var e=/^(-)?([\d+.]+)%$/.exec(t);if(e)return+e[2]/100*(e[1]?-1:1);return+t}(i),o=Cs(t[i],e);r.push([n,o[0],o[1],o[2],o[3]])})),r=r.sort((function(t,e){return t[0]-e[0]})),[Qa.GRADIENT_COLOR,r]}}function Cs(t,e){var r;if("string"==typeof t){t=t.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(t);if(i){var n=+i[4];r=[+i[1],+i[2],+i[3],isNaN(n)?255:Math.round(255*n)]}else/^#[a-f\d]{3}$/i.test(t)?r=[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else t instanceof Array&&(r=[t[0],t[1],t[2],isNaN(t[3])?255:Math.round(255*t[3])]);return e&&(r=function(t){if(Array.isArray(t))return t.map((function(t){return Number.isFinite(t/255)?Number((t/255).toFixed(6)):0}))}(r)),r}function _s(t,e){return Array.isArray(t)?("gradient"===t[0]||"color"===t[0])&&bs(t[1],e):bs(t,e)}function As(t){if(t){if(3===t.length)return[Qa.CONSTANT_VEC3,t];if("path"===t[0])return[Qa.LINEAR_PATH,t[1]];if("bezier"===t[0])return[Qa.BEZIER_PATH,t[1]]}}function Ss(t){var e,r;try{for(var i=ds(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;t[o]=Number(t[o])}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}function Rs(t){var e,r;try{for(var i=ds(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value;void 0===t[o]&&delete t[o]}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}return t}"function"==typeof SuppressedError&&SuppressedError;var Os=Math.cos,ws=Math.sin,Ms=Math.PI/180,Ls=180/Math.PI;function Is(t){var e,r=t.options,i=t.transform,n={type:Ba.NONE};if(t.shape){var o=null===(e=t.shape.shape)||void 0===e?void 0:e.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(n=ps(ps({},t.shape),{type:Ba[o]}),t.shape.upDirection){var a=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}(t.shape.upDirection,3),s=a[0],u=a[1],l=a[2];0===s&&0===u&&0===l&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=Es(r.turbulenceX),n.turbulenceY=Es(r.turbulenceY),n.turbulenceZ=Es(r.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map((function(t){return Ss(t)}))),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map((function(t){return Ss(t)}))),c.rateOverTime&&(c.rateOverTime=Es(c.rateOverTime));var h={renderer:t.renderer,shape:n,splits:t.splits,emission:c,options:{startLifetime:Es(r.startLifetime),start3DSize:!!r.start3DSize,startSize:Es(r.startSize),startSizeX:Es(r.startSizeX),startSizeY:Es(r.startSizeY),sizeAspect:Es(r.sizeAspect),maxCount:r.maxCount,startDelay:Es(r.startDelay),startColor:Ts(r.startColor,!0),startRotationZ:Es(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(h.options.startRotationX=Es(r.startRotationX),h.options.startRotationY=Es(r.startRotationY)),t.filter){var f={};ys(t.filter,(function(t,e){var r;f[e]=(r=t,Array.isArray(r)&&"string"==typeof r[0]&&(Es(r)||As(r)||Ts(r))||r)})),h.filter=f}i&&i.path&&(h.emitterTransform={path:As(i.path)});var p=t.sizeOverLifetime;p&&(p.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:Es(p.x),y:Es(p.y)}:h.sizeOverLifetime={size:Es(p.size)});var d=t.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?vs(m):void 0,h.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:vs(r.gravityModifier),startSpeed:Es(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:Es(d.linearX),linearY:Es(d.linearY),linearZ:Es(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Es(d.orbitalX),orbitalY:Es(d.orbitalY),orbitalZ:Es(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:vs(d.forceCurve)},Rs(h.positionOverLifetime);var y=t.rotationOverLifetime;y&&(h.rotationOverLifetime={separateAxes:y.separateAxes,asRotation:y.asRotation,z:Es(y.separateAxes?y.z:y.angularVelocity)},y.separateAxes&&(h.rotationOverLifetime.y=vs(y.y),h.rotationOverLifetime.x=vs(y.x)));var v=t.colorOverLifetime;if(v){var g=h.colorOverLifetime={opacity:vs(v.opacity)};v.color&&(g.color=_s(v.color))}var x=t.textureSheetAnimation;x&&(h.textureSheetAnimation={row:x.row,col:x.col,total:x.total,animate:x.animate,cycles:vs(x.cycles),animationDelay:gs(x.animationDelay,0),animationDuration:gs(x.animationDuration,0)});var T=t.trails;T&&(h.trails={lifetime:Es(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:vs(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&_s(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&_s(T.colorOverLifetime,!1),inheritParticleColor:T.inheritParticleColor,occlusion:T.occlusion,transparentOcclusion:T.transparentOcclusion,orderOffset:T.orderOffset,sizeAffectsLifetime:T.sizeAffectsLifetime,sizeAffectsWidth:T.sizeAffectsWidth,texture:T.texture,parentAffectsPosition:T.parentAffectsPosition,opacityOverLifetime:Es(T.opacityOverLifetime)}),h.trails&&Rs(h.trails);var E=t.interaction;return E&&(h.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),h}function Ps(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:As(null===(r=t.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:vs(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:vs(n.linearX),linearY:vs(n.linearY),linearZ:vs(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:vs(n.orbitalX),orbitalY:vs(n.orbitalY),orbitalZ:vs(n.orbitalZ),speedOverLifetime:vs(n.speedOverLifetime)};Rs(o);var a={options:{startColor:xs(i.startColor)},positionOverLifetime:o};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var s=t.rotationOverLifetime;if(s){var u=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=vs(s.x),u.y=vs(s.y),u.z=vs(s.z)):u.z=vs(s.angularVelocity)}var l=t.colorOverLifetime;if(l){var c=a.colorOverLifetime={opacity:vs(l.opacity)};l.color&&(c.color=_s(l.color))}var h=t.sizeOverLifetime;return h&&(a.sizeOverLifetime={separateAxes:h.separateAxes,size:vs(h.size),x:vs(h.x),y:vs(h.y),z:vs(h.z)}),a}function Fs(t,e){var r=Ps(t,e),i=t.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=t.renderer,t.splits&&(r.splits=t.splits),t.interaction&&(r.interaction=t.interaction),r}var Ns=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],Ds=["path","position"];function Vs(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===Ha.null&&t.endBehavior===$a.destroy&&(t.endBehavior=$a.freeze)}))})),t.version="2.1",t}var zs=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,Us=/^(\d+)\.(\d+)$/,Bs=!1;function ks(t){var e,r;if(!t||"object"!=typeof t)throw Error("expect a json object");if(function(t){var e,r=null===(e=t.version)||void 0===e?void 0:e.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==Ha.mesh&&t.type!==Ha.light||(t.endBehavior=1===t.endBehavior?$a.destroy:t.endBehavior)}))}))}(t),zs.test(t.version))return Bs="0"===(null===(e=/^(\d+)/.exec(t.version))||void 0===e?void 0:e[0]),Vs(function(t){var e,r;Gs="1.0";var i=t.plugins||[];(null===(e=t.bins)||void 0===e?void 0:e.length)&&(Gs="1.3");var n=(t.requires||[]).slice(),o=t.images.map((function(e,r){return Xs(e,r,t.imageTags||[])})),a=t.textures||o.map((function(t,e){return{source:e,flipY:!0}})),s={plugins:i,shapes:t.shapes||[],type:"ge",version:Gs,playerVersion:null!==(r=t.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return Hs(t,{plugins:i,requires:n})})),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:a,bins:(t.bins||[]).slice()};t._textures&&(s._textures=t._textures);return s}(t));var i=null===(r=Us.exec(t.version))||void 0===r?void 0:r[1];if(i)return Number(i)<2?Vs(t):t;throw Error("invalid json version "+t.version)}var Gs="1.0";function Xs(t,e,r){var i=r[e],n=t.oriY;if("string"==typeof t)return{renderLevel:i,url:t,oriY:n};if(t.template)return{url:t.url,template:t.template,webp:t.webp,renderLevel:i,oriY:n};if(t.compressed)return{url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{url:t.url,type:t.type,webp:t.webp,renderLevel:i,oriY:n,loop:t.loop};if(t&&t.sourceType)return t;throw Error("invalid image type")}function Hs(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Object.assign({clipMode:fs},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Zs(t,e)})),name:t.name},n=t.startTime||t.st;n&&(i.startTime=n);var o=null===(r=t.meta)||void 0===r?void 0:r.previewSize;return o&&o[0]===o[1]&&0===o[0]&&(o=void 0),o&&(i.previewSize=o),i}var js,Ys=[0,0,0,1],Ws=.5;function Zs(t,e){var r,i,n;void 0===e&&(e={});var o,a,s,u,l,c,h=Ha.base,f=t.endBehavior,p=NaN;if(t.content?(h=t.type||Ha.plugin,c=t.pn,l=t.pluginName,s=t.content,a=t.content,isNaN(c)&&!l&&(l=s.options.type),t.duration&&(p=t.duration),o=t.transform||v(a.transform),h===Ha.filter&&(Gs<"1.1"&&(Gs="1.1"),(s=Fs(a,o)).filter=function(t){var e={};return ys(t,(function(t,r){Ns.includes(r)?e[r]=vs(t):Ds.includes(r)?e[r]=As(t):e[r]=t})),e}(a.filter))):t.particle?(h=Ha.particle,o=v((a=t.particle).transform,Bs,!0),s=Is(a)):t.sprite?(h=Ha.sprite,s=Fs(a=t.sprite,o=v(a.transform,!1,!0))):t.cal?(h=Ha.null,s=Ps(a=t.cal,o=v(a.transform,!1,!0))):t.ui?(h=Ha.interact,o=v((a=t.ui).transform),s=function(t){var e,r=t.options;switch(r.type){case"click":e={type:Ga.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&xs(r.previewColor),behavior:r.behavior||Xa.NOTIFY};break;case"drag":e={type:Ga.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:Ga.MESSAGE}}return{options:e}}(a),o.scale=[a.options.width||1,a.options.height||1,1]):t.model&&(a=t.model,1===t.model.options.type&&(h=Ha.camera,o=v(a.transform),s=function(t){var e,r,i=t.options,n={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},o=t.velocityOverLifetime;if(o||(null===(e=t.transform)||void 0===e?void 0:e.path)){var a={path:As(null===(r=t.transform)||void 0===r?void 0:r.path),linearX:vs(null==o?void 0:o.translateX),linearY:vs(null==o?void 0:o.translateY),linearZ:vs(null==o?void 0:o.translateZ)};Rs(a),n.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:vs(null==s?void 0:s.rotateX),y:vs(null==s?void 0:s.rotateY),z:s.separateAxes?vs(null==s?void 0:s.rotateZ):vs(s.rotation)};Rs(u),n.rotationOverLifetime=u}return n}(a))),null===(r=s.renderer)||void 0===r?void 0:r.anchor){var d=new Float32Array(s.renderer.anchor);d[0]==Ws&&d[1]==Ws?delete s.renderer.anchor:e.requires&&ms(e.requires,"anchor")}if(a){var m=null===(i=a.options)||void 0===i?void 0:i.looping;f=m?Array.isArray(m)?m[1]?$a.loop:$a.destroy:$a.loop:f||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||$a.destroy,a.options.renderLevel&&(u=a.options.renderLevel),isNaN(p)&&(p=a.options.duration)}var y={type:h,name:t.name,delay:t.delay,duration:p,id:t.id+"",transform:o,endBehavior:f,renderLevel:u,content:s};return l?e.plugins?(ms(e.plugins,l),y.pn=e.plugins.indexOf(l)):y.pluginName=l:Number.isInteger(c)&&(y.pn=c),t.parentId&&(y.parentId=t.parentId+""),y;function v(t,e,r){if(t){var i={},n=t.rotation;if(n&&(i.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var o=(a=Ys,s=i.rotation[0],u=i.rotation[1],l=i.rotation[2],c=Os(s*Ms/2),h=Os(u*Ms/2),f=Os(l*Ms/2),p=ws(s*Ms/2),d=ws(u*Ms/2),m=ws(l*Ms/2),a[0]=p*h*f+c*d*m,a[1]=c*d*f-p*h*m,a[2]=c*h*m+p*d*f,a[3]=c*h*f-p*d*m,a);i.rotation=function(t,e){var r,i,n,o=e[0],a=e[1],s=e[2],u=e[3],l=o+o,c=a+a,h=s+s,f=o*l,p=a*l,d=a*c,m=s*h,y=u*h,v=1-d-m,g=p-y,x=p+y,T=1-f-m,E=s*l-u*c,b=s*c+u*l,C=1-f-d;return t[1]=Math.asin((i=-1,(r=-E)>(n=1)?n:r<i?i:r))*Ls,Math.abs(E)<.9999999?(t[0]=Math.atan2(b,C)*Ls,t[2]=Math.atan2(x,v)*Ls):(t[0]=0,t[2]=Math.atan2(-g,T)*Ls),t}([],o)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}var a,s,u,l,c,h,f,p,d,m;return{}}}var qs=((js={})[ft.S]=[ft.S,ft.BPlus,ft.APlus],js[ft.A]=[ft.A,ft.BPlus,ft.APlus],js[ft.B]=[ft.B,ft.BPlus],js);function Ks(t,e){if(!t||!e)return!0;var r=qs[e];return!!r&&r.includes(t)}function Qs(t){return At(t)&&"jsonScene"in t}function Js(t,e){return t?[t[0]-.5,.5-t[1]]:e?hi[e]:[0,0]}var $s=1,tu=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new Ee),this.options=t,this.downloader=e,this.assets={},this.id=$s++,this.timers=[],this.updateOptions(t)}return e.prototype.updateOptions=function(t){void 0===t&&(t={}),this.options=t,t.pluginData||(t.pluginData={});var e=t.timeout,r=void 0===e?10:e;this.timeout=r},e.prototype.updateSceneData=function(t){var e=this.options.variables;return!e||Object.keys(e).length<=0||t.forEach((function(t){t.items.forEach((function(t){if(t.type===Tt.text){var r=e[t.name];r&&(t.content.options.text=r)}}))})),t},e.prototype.loadScene=function(e,r,n){var l,c,h;return o(this,void 0,void 0,(function(){var f,p,d,m,v,g,x,T,E,b,C,_,A=this;return a(this,(function(S){return p=ht(e)?e:this.id,d=performance.now(),m=[],v=null==r?void 0:r.engine.gpuCapability,g=null!==(c=null===(l=null==v?void 0:v.detail)||void 0===l?void 0:l.asyncShaderCompile)&&void 0!==c&&c,x=null!==(h=null==v?void 0:v.detail.compressedTexture)&&void 0!==h?h:0,E=!1,b=new Promise((function(t,e){T=window.setTimeout((function(){E=!0,A.removeTimer(T);var t=performance.now()-d;e("Load time out: totalTime: ".concat(t.toFixed(4),"ms ").concat(m.join(" "),", url: ").concat(p))}),1e3*A.timeout),A.timers.push(T)})),C=function(t,e){return o(A,void 0,void 0,(function(){var r,i,n;return a(this,(function(o){switch(o.label){case 0:if(E)return[3,4];r=performance.now(),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,e()];case 2:return i=o.sent(),m.push("[".concat(t,": ").concat((performance.now()-r).toFixed(2),"]")),[2,i];case 3:throw n=o.sent(),new Error("load error in ".concat(t,", ").concat(n));case 4:throw new Error("load canceled.")}}))}))},_=function(){return o(A,void 0,void 0,(function(){var o,l,c,h,v,E,b,_,A,S,R,O,w,M,L,I,P,F,N,D=this;return a(this,(function(a){switch(a.label){case 0:return At(e)?(f=e,this.baseUrl=location.href,[3,3]):[3,1];case 1:return e=new URL(e,location.href).href,this.baseUrl=e,[4,C("loadJSON",(function(){return D.loadJSON(e)}))];case 2:f=a.sent(),a.label=3;case 3:if(!Qs(f))return[3,6];if(o=i({},f),!this.options||!this.options.variables||0===Object.keys(this.options.variables).length)return[3,5];for(l=f.jsonScene.images,c=o.images,v=0;v<l.length;v++)c[v]instanceof HTMLCanvasElement&&(c[v]=l[v]);return h=o,[4,C("processImages",(function(){return D.processImages(c,o.usedImages,x)}))];case 4:for(h.images=a.sent(),v=0;v<o.images.length;v++)o.textureOptions[v].image=o.images[v];o.jsonScene.compositions=this.updateSceneData(o.jsonScene.compositions),a.label=5;case 5:return[3,12];case 6:return[4,C("processJSON",(function(){return D.processJSON(f)}))];case 7:return E=a.sent(),b=E.usedImages,_=E.jsonScene,A=E.pluginSystem,S=_.bins,R=void 0===S?[]:S,O=_.images,w=_.compositions,M=_.fonts,[4,Promise.all([C("processBins",(function(){return D.processBins(R)})),C("processImages",(function(){return D.processImages(O,b,x)})),C("".concat(g?"async":"sync"," compile"),(function(){return D.precompile(w,A,r,n)}))])];case 8:return L=u.apply(void 0,[a.sent(),2]),I=L[0],P=L[1],[4,C("processFontURL",(function(){return D.processFontURL(M)}))];case 9:return a.sent(),[4,C("processTextures",(function(){return D.processTextures(P,I,_)}))];case 10:return F=a.sent(),_.compositions=this.updateSceneData(_.compositions),o={url:e,renderLevel:this.options.renderLevel,storage:{},pluginSystem:A,jsonScene:_,usedImages:b,images:P,textureOptions:F,bins:I},[4,C("processPlugins",(function(){return A.loadResources(o,D.options)}))];case 11:a.sent(),a.label=12;case 12:return N=performance.now()-d,lt.info("Load asset: totalTime: ".concat(N.toFixed(4),"ms ").concat(m.join(" "),", url: ").concat(p)),window.clearTimeout(T),this.removeTimer(T),o.totalTime=N,o.startTime=d,Number(o.jsonScene.version)<3&&(console.warn("The current json version "+o.jsonScene.version+" is less than 3.0, try to convert to the new version."),o=function(e){var r,i,n,o,a,u,l,c,h,f,p,d;e.jsonScene.version="3.0";var m=e.jsonScene;m.items||(m.items=[]);try{for(var v=s(e.jsonScene.compositions),g=v.next();!g.done;g=v.next()){for(var x=g.value,T=0;T<x.items.length;T++)m.items.push(x.items[T]);3!==x.endBehavior&&1!==x.endBehavior||(x.endBehavior=4)}}catch(t){r={error:t}}finally{try{g&&!g.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}var E={};try{for(var b=s(m.items),C=b.next();!C.done;C=b.next())E[(D=C.value).id]=Ot(),D.oldId=D.id,D.id=E[D.id]}catch(t){n={error:t}}finally{try{C&&!C.done&&(o=b.return)&&o.call(b)}finally{if(n)throw n.error}}try{for(var _=s(m.items),A=_.next();!A.done;A=_.next())if((D=A.value).parentId)if(D.parentId.includes("^")){var S=D.parentId.split("^")[0],R=D.parentId.split("^")[1];D.parentId=E[S]+"^"+R}else D.parentId=E[D.parentId]}catch(t){a={error:t}}finally{try{A&&!A.done&&(u=_.return)&&u.call(_)}finally{if(a)throw a.error}}try{for(var O=s(e.jsonScene.compositions),w=O.next();!w.done;w=O.next())for(x=w.value,T=0;T<x.items.length;T++)x.items[T]={id:x.items[T].id}}catch(t){l={error:t}}finally{try{w&&!w.done&&(c=O.return)&&c.call(O)}finally{if(l)throw l.error}}try{for(var M=s(e.textureOptions),L=M.next();!L.done;L=M.next()){var I=L.value;I.id=Ot(),I.dataType=t.DataType.Texture}}catch(t){h={error:t}}finally{try{L&&!L.done&&(f=M.return)&&f.call(M)}finally{if(h)throw h.error}}m.components||(m.components=[]);var P=m.components;try{for(var F=s(m.items),N=F.next();!N.done;N=F.next()){var D;if((D=N.value).content){if(D.content.renderer&&void 0!==D.content.renderer.texture){var V=D.content.renderer.texture;D.content.renderer.texture={id:e.textureOptions[V].id}}D.content.trails&&void 0!==D.content.trails.texture&&(V=D.content.trails.texture,D.content.trails.texture={id:e.textureOptions[V].id})}if(D.transform){var z=D.transform.position,U=D.transform.rotation,B=D.transform.scale;if(z||(z=[0,0,0]),U||(U=[0,0,0]),B||(B=[1,1,1]),D.transform={position:{x:z[0],y:z[1],z:z[2]},rotation:{x:U[0],y:U[1],z:U[2]},scale:{x:B[0],y:B[1],z:B[0]}},D.type===Tt.sprite&&(D.transform.size={x:B[0],y:B[1]},D.transform.scale={x:1,y:1,z:1}),D.type===Tt.sprite){(X=D.content).renderer||(X.renderer={});var k=Js((H=X.renderer).anchor,H.particleOrigin),G=D.transform.size;H.anchor||void 0===H.particleOrigin||(D.transform.position.x+=-k[0]*G.x,D.transform.position.y+=-k[1]*G.y),D.transform.anchor={x:k[0]*G.x,y:k[1]*G.y}}}if(D.type===Tt.particle){var X;(X=D.content).renderer||(X.renderer={});var H=X.renderer;X.renderer.anchor=Js(H.anchor,H.particleOrigin)}3!==D.endBehavior&&1!==D.endBehavior||(D.endBehavior=4);var j=y().replace(/-/g,"");D.type===Tt.sprite?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.SpriteComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.particle?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.ParticleSystem,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.mesh?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.MeshComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.skybox?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.SkyboxComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.light?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.LightComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):"camera"===D.type?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.CameraComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.tree?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.TreeComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.interact?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.InteractComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.camera?(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.CameraController,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id})):D.type===Tt.text&&(D.components=[],P.push(D.content),D.content.id=j,D.content.dataType=t.DataType.TextComponent,D.content.item={id:D.id},D.dataType=t.DataType.VFXItemData,D.components.push({id:D.content.id}))}}catch(t){p={error:t}}finally{try{N&&!N.done&&(d=F.return)&&d.call(F)}finally{if(p)throw p.error}}return e}(o)),[2,o]}}))}))},[2,Promise.race([b,_()])]}))}))},e.prototype.precompile=function(t,e,r,i){return o(this,void 0,void 0,(function(){var n;return a(this,(function(o){switch(o.label){case 0:return r&&r.getShaderLibrary()?(n=null==r?void 0:r.getShaderLibrary(),[4,null==e?void 0:e.precompile(t,r,i)]):[2];case 1:return o.sent(),[4,new Promise((function(t){n.compileAllShaders((function(){t(null)}))}))];case 2:return o.sent(),[2]}}))}))},e.prototype.processJSON=function(t){return o(this,void 0,void 0,(function(){var e,r,i,n,o,s,u,l,c;return a(this,(function(a){switch(a.label){case 0:return e=ks(t),t.compositions.forEach((function(t,r){t.globalVolume&&(e.compositions[r].globalVolume=t.globalVolume)})),r=e.plugins,i=void 0===r?[]:r,n=e.compositions,o=e.imgUsage,s=e.images,[4,(u=new Wa(i)).processRawJSON(e,this.options)];case 1:return a.sent(),l=this.options.renderLevel,c={},o?function(t,e,r,i,n){for(var o=0;o<e.length;o++){var a=r[e[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];Ks(i[u].renderLevel,n)&&(t[u]=!0)}}}(c,n,o,s,l):null==s||s.forEach((function(t,e){c[e]=!0})),[2,{usedImages:c,jsonScene:e,pluginSystem:u}]}}))}))},e.prototype.processBins=function(t){return o(this,void 0,void 0,(function(){var e,r,i=this;return a(this,(function(n){return e=this.options.renderLevel,r=t.map((function(r){if(r instanceof ArrayBuffer)return r;if(Ks(r.renderLevel,e))return i.loadBins(r.url);throw new Error("Invalid bins source: ".concat(JSON.stringify(t)))})),[2,Promise.all(r)]}))}))},e.prototype.processFontURL=function(t){return o(this,void 0,void 0,(function(){var r,i=this;return a(this,(function(n){return t?(r=t.map((function(t){return o(i,void 0,void 0,(function(){var r,i;return a(this,(function(n){switch(n.label){case 0:if(!t.fontURL||e.fonts.has(t.fontFamily))return[3,4];r=new FontFace(null!==(i=t.fontFamily)&&void 0!==i?i:"","url("+t.fontURL+")"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r.load()];case 2:return n.sent(),document.fonts.add(r),e.fonts.add(t.fontFamily),[3,4];case 3:return n.sent(),lt.warn("Invalid fonts source: ".concat(JSON.stringify(t.fontURL))),[3,4];case 4:return[2]}}))}))})),[2,Promise.all(r)]):[2]}))}))},e.prototype.processImages=function(e,r,i){return o(this,void 0,void 0,(function(){var n,s,u,l,c,h=this;return a(this,(function(f){return n=this.options,s=n.useCompressedTexture,u=n.variables,l=this.baseUrl,c=e.map((function(e,n){return o(h,void 0,void 0,(function(){var o,c,h,f,p,d,m,y,v,g,x,T,E,b,C,_,A,S,R;return a(this,(function(a){switch(a.label){case 0:if(!r[n])return[3,19];if(o=e.url,c=e.webp,h=new URL(o,l).href,f=c&&new URL(c,l).href,!("template"in e))return[3,16];if(p=e.template,d=void 0,!("v"in p)||2!==p.v||!p.background)return[3,9];if(!((m=Ta(p,u))instanceof Array))return[3,6];y=p.background.name,a.label=1;case 1:return a.trys.push([1,3,,5]),A={},[4,_e(m[0])];case 2:return A.image=a.sent(),A.url=m[0],d=A,[3,5];case 3:return a.sent(),S={},[4,_e(m[1])];case 4:return S.image=a.sent(),S.url=m[1],d=S,[3,5];case 5:return u&&(u[y]=d.url),[3,8];case 6:return"string"!=typeof m?[3,8]:(R={},[4,_e(m)]);case 7:R.image=a.sent(),R.url=m,d=R,a.label=8;case 8:return[3,11];case 9:return[4,Ce(h,f)];case 10:d=a.sent(),a.label=11;case 11:v=void 0,a.label=12;case 12:return a.trys.push([12,14,,15]),[4,_a(d.image,p,u,this.options,-1===e.oriY)];case 13:return v=a.sent(),[3,15];case 14:throw a.sent(),new Error("image template fail: ".concat(h));case 15:return[2,v];case 16:if("type"in e&&"video"===e.type)return g=e.loop,[2,Se(e.url,{loop:g})];if("compressed"in e&&s&&i){if(x=e.compressed,T=void 0,i===Xr.ASTC?T=x.astc:i===Xr.PVRTC&&(T=x.pvrtc),T)return E=new URL(T,l).href,this.assets[n]={url:E,type:t.TextureSourceType.compressed},[2,this.loadBins(E)]}else{if("sourceType"in e)return[2,e];if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof Me)return[2,e]}a.label=17;case 17:return[4,Ce(h,f)];case 18:return b=a.sent(),C=b.url,_=b.image,this.assets[n]={url:C,type:t.TextureSourceType.image},[2,_];case 19:return[2,void 0]}}))}))})),[2,Promise.all(c)]}))}))},e.prototype.processTextures=function(e,r,n){var s;return o(this,void 0,void 0,(function(){var u,l,c=this;return a(this,(function(h){return u=null!==(s=n.textures)&&void 0!==s?s:e.map((function(t,e){return{source:e}})),l=u.map((function(s,u){return o(c,void 0,void 0,(function(){var o,l,c,h;return a(this,(function(a){switch(a.label){case 0:if(s instanceof Me)return[2,s];if(!("mipmaps"in s))return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),[4,Re(s,r,n.bins)];case 2:return[2,a.sent()];case 3:throw o=a.sent(),new Error("load texture ".concat(u," fails, error message: ").concat(o));case 4:return"number"!=typeof(l=s.source)?[3,5]:(c=e[l],[3,7]);case 5:return"string"!=typeof l?[3,7]:[4,_e(eu(l))];case 6:c=a.sent(),a.label=7;case 7:if(c)return h=function(e,r){if(e instanceof Me)return e.source;if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement)return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:le.LINEAR,magFilter:le.LINEAR};if(e instanceof HTMLVideoElement)return{sourceType:t.TextureSourceType.video,video:e,minFilter:le.LINEAR,magFilter:le.LINEAR};if(e instanceof ArrayBuffer)return i(i({},Pe(e)),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:le.CLAMP_TO_EDGE,wrapT:le.CLAMP_TO_EDGE,minFilter:le.NEAREST,magFilter:le.NEAREST};throw new Error("Invalid texture options")}(c,this.assets[u]),[2,h.sourceType===t.TextureSourceType.compressed?h:i(i({},h),s)];throw new Error("Invalid texture source: ".concat(l))}}))}))})),[2,Promise.all(l)]}))}))},e.prototype.loadJSON=function(t){return o(this,void 0,void 0,(function(){var e=this;return a(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadJSON(t,r,(function(e,r){i("Couldn't load JSON ".concat(JSON.stringify(t),": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.loadBins=function(t){return o(this,void 0,void 0,(function(){var e=this;return a(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadBinary(t,r,(function(e,r){i("Couldn't load bins ".concat(JSON.stringify(t),": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.removeTimer=function(t){var e=this.timers.indexOf(t);-1!==e&&this.timers.splice(e,1)},e.prototype.dispose=function(){var t;for(var e in this.timers.length&&this.timers.map((function(t){return window.clearTimeout(t)})),this.assets){var r=this.assets[e];null===(t=null==r?void 0:r.dispose)||void 0===t||t.call(r)}this.assets={},this.timers=[]},e.fonts=new Set,e}();function eu(t,e,r){void 0===e&&(e="base64File"),void 0===r&&(r="");for(var i=t.split(",")[1]||t,n=atob(i),o=[],a=0;a<n.length;a+=512){for(var s=n.slice(a,a+512),u=new Array(s.length),l=0;l<s.length;l++)u[l]=s.charCodeAt(l);var c=new Uint8Array(u);o.push(c)}var h=new Blob(o,{type:r});return new File([h],e,{type:r})}var ru,iu,nu=new H(1,1,1),ou=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewMatrix=Z.fromIdentity(),this.projectionMatrix=Z.fromIdentity(),this.viewProjectionMatrix=Z.fromIdentity(),this.inverseViewMatrix=Z.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,u=e.aspect,l=void 0===u?1:u,c=e.clipMode,h=void 0===c?wt.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:l,clipMode:h,position:H.fromArray(p),rotation:q.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 H(0,0,t),r=this.getViewProjectionMatrix(),i=e.applyMatrix(r).z;return new H(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 j;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*D,r,i,n,o===wt.portrait),this.inverseViewMatrix.compose(a,this.getQuat(),nu),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},t.prototype.setRotationByQuat=function(t){Ui.getRotation(t,this.options.rotation)},t}(),au=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.items=[],t}return r(n,e),n.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(Cn);try{for(var n=s(this.items),o=n.next();!o.done;o=n.next()){var a=o.value.getComponent(Cn);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}}},n.prototype.update=function(t){var e,r,i=this.timelineComponent.getTime();try{for(var n=s(this.timelineComponents),o=n.next();!o.done;o=n.next()){var a=o.value,u=a.toLocalTime(i);a.setTime(u)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}},n.prototype.resetStatus=function(){this.item.ended=!1,this.item.delaying=!0},n.prototype.createContent=function(){var e=this.items;if(this.items.length=0,this.item.composition){var r=this.item.engine.assetLoader;this.item.composition.compositionSourceManager.jsonScene;for(var o=this.item.props.items?this.item.props.items:[],a=0;a<o.length;a++){var s=void 0,u=o[a];if(t.Item.isComposition(u)){var l=u.content.options.refId,c=this.item.composition.refCompositionProps.get(l);if(!c)throw new Error("引用的Id: ".concat(l," 的预合成不存在"));c.content=u.content,(s=new Ma(this.engine,i(i({},c),{id:u.id,name:u.name,delay:u.delay,duration:u.duration,endBehavior:u.endBehavior,parentId:u.parentId,transform:u.transform,oldId:u.oldId}))).type=Tt.composition,s.composition=this.item.composition,s.addComponent(n).refId=l,s.transform.parentTransform=this.transform,this.item.composition.refContent.push(s),5===s.endBehavior&&(this.item.composition.autoRefTex=!1),s.getComponent(n).createContent()}else if("ECS"===u.type||u.type===Tt.sprite||u.type===Tt.text||u.type===Tt.particle||u.type===Tt.mesh||u.type===Tt.skybox||u.type===Tt.light||"camera"===u.type||u.type===Tt.tree||u.type===Tt.interact||u.type===Tt.camera)(s=r.loadGUID(u.id)).composition=this.item.composition;else if((s=new Ma(this.engine,u)).composition=this.item.composition,u.type===Tt.text){var h=new Aa(this.engine,u.content);h.item=s,s.components.push(h),s.rendererComponents.push(h),s._content=h}else s=La(u,this.item.composition);s.parent=this.item,s.transform.parentTransform=u.type===Tt.camera?new Ui:this.transform,Ma.isExtraCamera(s)&&(this.item.composition.extraCamera=s),e.push(s)}}},n.prototype.onDestroy=function(){this.item.composition&&this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0)},n.prototype.hitTest=function(e,r,i,n,o,a){for(var s=[],u=(null==a?void 0:a.stop)||ct,l=(null==a?void 0:a.skip)||ct,c=(null==a?void 0:a.maxCount)||this.items.length,h=0;h<this.items.length&&n.length<c;h++){var f=this.items[h];if(f.lifetime>=0&&!f.ended&&!Ma.isComposition(f)&&!l(f)){var p=f.getHitTestParams(o);if(p){var d=!1,m=new H;if(p.type===t.HitTestType.triangle)for(var y=p.triangles,v=p.backfaceCulling,g=0;g<y.length;g++){var x=y[g];if(e.intersectTriangle(x,m,v)){d=!0,s.push(m);break}}else if(p.type===t.HitTestType.box){var T=p.center,E=p.size,b=T.clone().addScaledVector(E,.5),C=T.clone().addScaledVector(E,-.5);e.intersectBox({min:b,max:C},m)&&(d=!0,s.push(m))}else if(p.type===t.HitTestType.sphere){T=p.center;var _=p.radius;e.intersectSphere({center:T,radius:_},m)&&(d=!0,s.push(m))}else if(p.type===t.HitTestType.custom){var A=p.collect(e,new X(r,i));A&&A.length>0&&(A.forEach((function(t){s.push(t)})),d=!0)}if(d){var S={compContent:this.item,id:f.id,name:f.name,position:s[s.length-1],parentId:f.parentId,hitPositions:s,behavior:p.behavior};if(n.push(S),u(S))return n}}}}return n},n}(ie),su=function(){function e(t,e,r){var n,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,u=t.speed,l=void 0===u?1:u,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,T=x.sourceContent,E=x.pluginSystem,b=x.imgUsage,C=x.totalTime,_=x.renderLevel,A=x.refCompositionProps;F(T),this.renderer=f,this.refCompositionProps=A;var S=new Ma(this.getEngine(),T);S.name="rootItem",S.type=Tt.composition,S.composition=this,this.rootComposition=S.addComponent(au),this.rootTimeline=S.getComponent(Cn);var R=!s&&b;this.transform=new Ui({name:this.name}),this.transform.engine=this.getEngine(),S.transform=this.transform,this.globalVolume=T.globalVolume,this.width=v,this.height=g,this.renderOrder=h,this.id=T.id,this.renderer=f,this.texInfo=null!=R?R:{},this.event=y,this.statistic={loadTime:null!=C?C:0,loadStart:null!==(n=e.startTime)&&void 0!==n?n:0,firstFrameTime:0},this.reusable=s,this.speed=l,this.renderLevel=_,this.autoRefTex=!this.keepResource&&R&&5!==S.endBehavior,this.rootItem=S,this.name=T.name,this.pluginSystem=E,this.pluginSystem.initializeComposition(this,e),this.camera=new ou(this.name,i(i({},null==T?void 0:T.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.onEnd)||void 0===t||t.call(o,o)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)}return Object.defineProperty(e.prototype,"handleEnd",{set:function(t){console.warn("The handleEnd property is deprecated. Use onEnd instead."),this.onEnd=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this.compositionSourceManager.textures},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"items",{get:function(){return this.rootComposition.items},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){var t;return null!==(t=this.rootComposition.startTime)&&void 0!==t?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return this.rootTimeline.getTime()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getDuration=function(){return this.rootItem.duration},e.prototype.restart=function(){this.rootComposition.items,this.prepareRender(),this.reset(),this.transform.setValid(!0),this.rootComposition.resetStatus(),this.forwardTime(this.startTime)},e.prototype.setIndex=function(t){this.renderOrder=t},e.prototype.getIndex=function(){return this.renderOrder},e.prototype.setSpeed=function(t){this.speed=t},e.prototype.getSpeed=function(){return this.speed},e.prototype.play=function(){this.rootItem.ended&&this.reusable&&this.restart(),this.rootTimeline.timelineStarted?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},e.prototype.pause=function(){this.paused=!0},e.prototype.getPaused=function(){return this.paused},e.prototype.resume=function(){this.paused=!1},e.prototype.gotoAndPlay=function(t){this.resume(),this.rootTimeline.timelineStarted||this.rootComposition.start(),this.forwardTime(t+this.startTime)},e.prototype.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},e.prototype.createRenderFrame=function(){this.renderFrame=new Pr({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},e.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()},e.prototype.addItem=function(t){this.items.push(t),t.setParent(this.rootItem)},e.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)},e.prototype.reset=function(){var t=this,e=new Ma(this.getEngine(),this.compositionSourceManager.sourceContent);e.type=Tt.composition,e.composition=this,this.rootComposition=e.addComponent(au),this.rootTimeline=e.getComponent(Cn),this.transform=new Ui({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)},e.prototype.prepareRender=function(){var t,e,r,i,n,o,a,u,l,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=s(this.rootComposition.items),d=p.next();!d.done;d=p.next()){var m=d.value.getComponents(ne);try{for(var y=(r=void 0,s(m)),v=y.next();!v.done;v=y.next()){(A=v.value).isActiveAndEnabled&&f.addMeshToDefaultRenderPass(A)}}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=s(this.refContent),x=g.next();!x.done;x=g.next()){var T=x.value;try{for(var E=(a=void 0,s(T.getComponent(au).items)),b=E.next();!b.done;b=E.next()){m=b.value.getComponents(ne);try{for(var C=(l=void 0,s(m)),_=C.next();!_.done;_=C.next()){var A;(A=_.value).isActiveAndEnabled&&f.addMeshToDefaultRenderPass(A)}}catch(t){l={error:t}}finally{try{_&&!_.done&&(c=C.return)&&c.call(C)}finally{if(l)throw l.error}}}}catch(t){a={error:t}}finally{try{b&&!b.done&&(u=E.return)&&u.call(E)}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)}))},e.prototype.shouldRestart=function(){var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&5===r},e.prototype.shouldDispose=function(){if(this.reusable)return!1;var t=this.rootItem,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},e.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);if(this.globalTime+=n,this.rootTimeline.isActiveAndEnabled){var o=this.rootTimeline.toLocalTime(this.globalTime/1e3);this.rootTimeline.setTime(o)}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(Cn))||void 0===i||i.update(t),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},e.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},e.prototype.callStart=function(t){var e,r,i,n,o,a;try{for(var u=s(t.itemBehaviours),l=u.next();!l.done;l=u.next()){var c=l.value;c.isActiveAndEnabled&&!c.started&&(c.start(),c.started=!0)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}try{for(var h=s(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=s(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}}},e.prototype.callUpdate=function(t,e){var r,i,n,o,a,u;try{for(var l=s(t.itemBehaviours),c=l.next();!c.done;c=l.next()){var h=c.value;h.isActiveAndEnabled&&h.started&&h.update(e)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}try{for(var f=s(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=s(t.children),y=m.next();!y.done;y=m.next()){var v=y.value;Ma.isComposition(v)&&v.ended&&5===v.endBehavior?(v.getComponent(au).resetStatus(),this.callUpdate(v,0)):this.callUpdate(v,e)}}catch(t){a={error:t}}finally{try{y&&!y.done&&(u=m.return)&&u.call(m)}finally{if(a)throw a.error}}},e.prototype.callLateUpdate=function(t,e){var r,i,n,o,a,u;try{for(var l=s(t.itemBehaviours),c=l.next();!c.done;c=l.next()){var h=c.value;h.isActiveAndEnabled&&h.started&&h.lateUpdate(e)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}try{for(var f=s(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=s(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&&(u=m.return)&&u.call(m)}finally{if(a)throw a.error}}},e.prototype.buildItemTree=function(t){var e,r,i,n,o,a;if(t.composition){var u=new Map,l=t.getComponent(au).items;try{for(var c=s(l),h=c.next();!h.done;h=c.next()){var f=h.value;u.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=s(l),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=u.get(m);if(!y)throw Error("元素引用了不存在的元素,请检查数据");Ma.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=s(l),g=v.next();!g.done;g=v.next()){f=g.value;Ma.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}}}},e.prototype.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},e.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)},e.prototype.updateCamera=function(){this.camera.updateMatrix()},e.prototype.updatePluginLoaders=function(t){var e=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(e,t)}))},e.prototype.getItemByName=function(t){return this.rootItem.find(t)},e.prototype.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return pi((t-r.z)/i,(e-r.w)/n,this.camera)},e.prototype.getEngine=function(){var t;return null===(t=this.renderer)||void 0===t?void 0:t.engine},e.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(au))||void 0===n||n.hitTest(a,t,e,o,r,i),this.refContent.forEach((function(n){var s;null===(s=n.getComponent(au))||void 0===s||s.hitTest(a,t,e,o,r,i)})),o},e.prototype.addInteractiveItem=function(t,e){var r;if(e===gt.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},e.prototype.removeInteractiveItem=function(t,e){var r;e===gt.MESSAGE&&(null===(r=this.onMessageItem)||void 0===r||r.call(this,{name:t.name,phrase:1,id:t.id,compositionId:this.id}))},e.prototype.destroyTextures=function(e){for(var r,i=0;i<e.length;i++){var n=e[i];if(n)if(n.sourceType!==t.TextureSourceType.data||this.texInfo[n.getInstanceId()]){if(this.autoRefTex)--this.texInfo[n.getInstanceId()]||n.dispose()}else n!==(null===(r=this.rendererOptions)||void 0===r?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n!==this.getEngine().emptyTexture&&n.dispose()}},e.prototype.destroyItem=function(t){var e=this;t.type==Tt.composition?4!==t.endBehavior&&t.getComponent(au).items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(g(this.items,t),this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)})))},e.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()},e.prototype.dispose=function(){var e,r,i=this;if(!this.destroyed){this.destroyed=!0;var n={},o=this.textures;o&&this.keepResource&&o.forEach((function(t){(null==t?void 0:t.dispose)&&(n[t.id]=t.dispose,t.dispose=ct)})),this.rootItem.dispose(),this.renderFrame.dispose(),null===(e=this.rendererOptions)||void 0===e||e.emptyTexture.dispose(),null===(r=this.pluginSystem)||void 0===r||r.destroyComposition(this),this.update=function(){lt.error("Update disposed composition: ".concat(i.name,"."))},this.onPlayerPause=ct,this.dispose=ct,o&&this.keepResource&&o.forEach((function(t){return t.dispose=n[t.id]})),this.compositionSourceManager.dispose(),this.refCompositionProps.clear(),this.renderer.env!==Qi&&this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]})}},e.prototype.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},e.prototype.translateByPixel=function(t,e){this.renderer?this.rootItem.translateByPixel(t,e):console.warn("Can not translate position when container not assigned")},e.prototype.translate=function(t,e,r){this.rootItem.translate(t,e,r)},e.prototype.setPosition=function(t,e,r){this.rootItem.setPosition(t,e,r)},e.prototype.rotate=function(t,e,r){this.rootItem.rotate(t,e,r)},e.prototype.setRotation=function(t,e,r){this.rootItem.setRotation(t,e,r)},e.prototype.scale=function(t,e,r){this.rootItem.scale(t,e,r)},e.prototype.setScale=function(t,e,r){this.rootItem.setScale(t,e,r)},e.prototype.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(t){return t&&t.offloadData()})),this.textureOffloaded=!0)},e.prototype.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},e.prototype.reloadTexture=function(){return o(this,void 0,void 0,(function(){return a(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]}}))}))},e}(),uu=0,lu=function(){function t(t,e){var r,i;this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0,this.engine=e;var n=t.jsonScene,o=t.renderLevel,a=t.textureOptions,u=t.pluginSystem,l=t.totalTime,c=n.compositions,h=n.imgUsage,f=n.compositionId;if(!a)throw new Error("scene.textures expected");var p=a;try{for(var d=s(c),m=d.next();!m.done;m=d.next()){var y=m.value;y.id===f?this.composition=y:this.refCompositions.set(y.id,y)}}catch(t){r={error:t}}finally{try{m&&!m.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}if(!this.composition)throw new Error("Invalid composition id: "+f);this.jsonScene=n,this.renderLevel=o,this.pluginSystem=u,this.totalTime=null!=l?l:0,this.imgUsage=null!=h?h:{},this.textures=p,uu=0,this.sourceContent=this.getContent(this.composition)}return t.prototype.getContent=function(t){var e=t.id,r=t.duration,i=t.name,n=t.endBehavior,o=t.camera,a=t.globalVolume,s=t.startTime,u=void 0===s?0:s,l=this.assembleItems(t);return{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:l,camera:o,startTime:u,globalVolume:a}},t.prototype.assembleItems=function(t){var e,r,i,n,o,a,u=this,l=[];this.mask++;var c={};try{for(var h=s(this.jsonScene.components),f=h.next();!f.done;f=h.next()){var p=f.value;c[p.id]=p}}catch(t){e={error:t}}finally{try{f&&!f.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}try{for(var d=s(t.items),m=d.next();!m.done;m=d.next()){var y=m.value,v=this.engine.jsonSceneData[y.id],g=v;if(Ks(v.renderLevel,this.renderLevel)){if(g.type===Tt.sprite||g.type===Tt.particle)try{for(var x=(o=void 0,s(g.components)),T=x.next();!T.done;T=x.next()){var E=c[T.value.id];this.preProcessItemContent(E)}}catch(t){o={error:t}}finally{try{T&&!T.done&&(a=x.return)&&a.call(x)}finally{if(o)throw o.error}}else{var b=g.content;b&&this.preProcessItemContent(b)}var C=v.pn,_=this.jsonScene.plugins,A=void 0===_?[]:_;if(g.listIndex=uu++,void 0!==C&&Number.isInteger(C)&&(g.pluginName=A[C]),g.type===Tt.composition){var S=v.content.options.refId;if(!this.refCompositions.get(S))throw new Error("Invalid Ref Composition id: "+S);var R=this.getContent(this.refCompositions.get(S));this.refCompositionProps.has(S)||this.refCompositionProps.set(S,R),R.items.forEach((function(t){u.processMask(t.content)})),g.items=R.items}l.push(g)}}}catch(t){i={error:t}}finally{try{m&&!m.done&&(n=d.return)&&n.call(d)}finally{if(i)throw i.error}}return l},t.prototype.preProcessItemContent=function(t){var e;if(t.renderer){t.renderer=this.changeTex(t.renderer),t.renderer.mask||this.processMask(t.renderer);var r=t.splits&&!t.textureSheetAnimation&&t.splits[0];Number.isInteger(t.renderer.shape)?t.renderer.shape=Vo(null===(e=this.jsonScene)||void 0===e?void 0:e.shapes[t.renderer.shape],r):t.renderer.shape&&At(t.renderer.shape)&&(t.renderer.shape=Vo(t.renderer.shape,r))}t.trails&&(t.trails=this.changeTex(t.trails))},t.prototype.changeTex=function(t){if(!t.texture)return t;var e=t.texture.id;return void 0!==e&&this.addTextureUsage(e),t},t.prototype.addTextureUsage=function(t){var e,r=t,i=null!==(e=this.imgUsage)&&void 0!==e?e:{};r&&i&&(i.hasOwnProperty(r)||(i[r]=0),i[r]++)},t.prototype.processMask=function(t){if(t.maskMode!==mt.NONE&&!t.mask){var e=t.maskMode;e===mt.MASK?t.mask=++this.mask:e!==mt.OBSCURED&&e!==mt.REVERSE_OBSCURED||(t.mask=this.mask)}},t.prototype.dispose=function(){this.textures=[],this.composition=void 0,this.jsonScene=void 0,this.totalTime=0,this.pluginSystem=void 0,this.sourceContent=void 0,this.refCompositions.clear(),this.refCompositionProps.clear()},t}(),cu=function(){function e(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.jsonSceneData={},this.objectInstance={},this.assetLoader=new qr(this),this.createDefaultTexture()}return e.prototype.clearResources=function(){this.jsonSceneData={},this.objectInstance={}},e.prototype.addEffectsObjectData=function(t){this.jsonSceneData[t.id]=t},e.prototype.findEffectsObjectData=function(t){return this.jsonSceneData[t]},e.prototype.addInstance=function(t){this.objectInstance[t.getInstanceId()]=t},e.prototype.getInstance=function(t){return this.objectInstance[t]},e.prototype.removeInstance=function(t){delete this.objectInstance[t]},e.prototype.addPackageDatas=function(t){var e,r,i,n,o,a,u,l,c,h,f,p,d=t.jsonScene;if(d.items)try{for(var m=s(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=s(d.materials),x=g.next();!x.done;x=g.next()){var T=x.value;this.addEffectsObjectData(T)}}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 E=s(d.shaders),b=E.next();!b.done;b=E.next()){var C=b.value;this.addEffectsObjectData(C)}}catch(t){o={error:t}}finally{try{b&&!b.done&&(a=E.return)&&a.call(E)}finally{if(o)throw o.error}}if(d.geometries)try{for(var _=s(d.geometries),A=_.next();!A.done;A=_.next()){var S=A.value;this.addEffectsObjectData(S)}}catch(t){u={error:t}}finally{try{A&&!A.done&&(l=_.return)&&l.call(_)}finally{if(u)throw u.error}}if(d.components)try{for(var R=s(d.components),O=R.next();!O.done;O=R.next()){var w=O.value;this.addEffectsObjectData(w)}}catch(t){c={error:t}}finally{try{O&&!O.done&&(h=R.return)&&h.call(R)}finally{if(c)throw c.error}}if(t.textureOptions)try{for(var M=s(t.textureOptions),L=M.next();!L.done;L=M.next()){var I=L.value;this.addEffectsObjectData(I)}}catch(t){f={error:t}}finally{try{L&&!L.done&&(p=M.return)&&p.call(M)}finally{if(f)throw f.error}}},e.prototype.createVFXItemsAsync=function(t){return o(this,void 0,void 0,(function(){var e,r,i,n,o,u,l;return a(this,(function(a){switch(a.label){case 0:e=t.jsonScene,a.label=1;case 1:a.trys.push([1,6,7,8]),r=s(e.items),i=r.next(),a.label=2;case 2:return i.done?[3,5]:"ECS"!==(n=i.value).type&&n.type!==Tt.sprite&&n.type!==Tt.particle&&n.type!==Tt.mesh&&n.type!==Tt.skybox&&n.type!==Tt.light&&"camera"!==n.type&&n.type!==Tt.tree&&n.type!==Tt.interact&&n.type!==Tt.camera?[3,4]:this.database?[4,this.assetLoader.loadGUIDAsync(n.id)]:[3,4];case 3:a.sent(),a.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return o=a.sent(),u={error:o},[3,8];case 7:try{i&&!i.done&&(l=r.return)&&l.call(r)}finally{if(u)throw u.error}return[7];case 8:return[2]}}))}))},e.prototype.addTexture=function(t){this.destroyed||v(this.textures,t)},e.prototype.removeTexture=function(t){this.destroyed||g(this.textures,t)},e.prototype.addMaterial=function(t){this.destroyed||v(this.materials,t)},e.prototype.removeMaterial=function(t){this.destroyed||g(this.materials,t)},e.prototype.addGeometry=function(t){this.destroyed||v(this.geometries,t)},e.prototype.removeGeometry=function(t){this.destroyed||g(this.geometries,t)},e.prototype.addMesh=function(t){this.destroyed||v(this.meshes,t)},e.prototype.removeMesh=function(t){this.destroyed||g(this.meshes,t)},e.prototype.addRenderPass=function(t){this.destroyed||v(this.renderPasses,t)},e.prototype.removeRenderPass=function(t){this.destroyed||g(this.renderPasses,t)},Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.prototype.createDefaultTexture=function(){var e={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=Me.create(this,i({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},e)),this.transparentTexture=Me.create(this,i({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},e))},e.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&<.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}},e}(),hu=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this._deltaTime=0,this.setFPS(t),this.tickers=[]}return Object.defineProperty(t.prototype,"deltaTime",{get:function(){return this._deltaTime},enumerable:!1,configurable:!0}),t.prototype.getFPS=function(){return this.targetFPS},t.prototype.setFPS=function(t){this.targetFPS=k(t,1,120),this.interval=Math.floor(1e3/t)-2},t.prototype.getPaused=function(){return this.paused},t.prototype.start=function(){var t=this;if(this.paused=!1,this._deltaTime=0,!this.intervalId){this.lastTime=performance.now();var e=requestAnimationFrame||function(t){return window.setTimeout(t,16.7)},r=function(){t.intervalId=e(r),t.paused||t.tick()};r()}},t.prototype.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this._deltaTime=0,this.tickers=[]},t.prototype.pause=function(){this.paused=!0,this._deltaTime=0},t.prototype.resume=function(){this.paused=!1,this._deltaTime=0},t.prototype.tick=function(){if(!this.paused){var t=performance.now();if(this._deltaTime=t-this.lastTime,this._deltaTime>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter((function(t){return t})),this.resetTickers=!1);for(var e=0,r=this.tickers.length;e<r;e++){(0,this.tickers[e])(this._deltaTime)}}}},t.prototype.add=function(t){if("function"!=typeof t)throw new Error("Ticker: The tick object must implement the tick method.");this.tickers.push(t)},t}();Na("camera",ki,Ma,!0),Na("text",Sa,Ma,!0),Na("sprite",cn,Ma,!0),Na("particle",jn,Ma,!0),Na("cal",na,Ma,!0),Na("interact",qi,Ma,!0);var fu=((ru={})[le.RGBA]=34842,ru[le.RGB]=34843,ru[le.ALPHA]=33325,ru[le.RED]=33325,ru[le.LUMINANCE_ALPHA]=33327,ru[le.LUMINANCE]=33325,ru),pu=((iu={})[le.RGBA]=34836,iu[le.RGB]=34837,iu[le.ALPHA]=33326,iu[le.RED]=33326,iu[le.LUMINANCE_ALPHA]=33328,iu[le.LUMINANCE]=33326,iu),du=function(e){function n(t,r){var i=e.call(this,t)||this;return i.initialized=!1,r&&i.fromData(r),i}return r(n,e),n.prototype.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},n.prototype.initialize=function(){if(!this.initialized){var t=this.engine;t.addTexture(this);var e=t.getGLPipelineContext();this.pipelineContext=e;var r=e.gl,i=this.source,n=i.target,o=void 0===n?r.TEXTURE_2D:n,a=i.name;this.textureBuffer=r.createTexture(),this.textureBuffer&&Tu(this.textureBuffer,a),this.target=o,this.update(this.source),this.release(),this.initialized=!0}},n.prototype.clone=function(){var t=new n(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},n.prototype.release=function(){switch(this.source.sourceType){case t.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case t.TextureSourceType.data:delete this.source.data;break;case t.TextureSourceType.compressed:case t.TextureSourceType.mipmaps:delete this.source.mipmaps}},n.prototype.update=function(e){var r,i,n,o,a=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var s=this.target,l=this.source,c=this.pipelineContext.gl,h=this.engine.gpuCapability.detail,f=l.sourceType,p=l.data,d=l.cube,m=l.image,y=l.video,v=l.mipmaps,g=l.mipmaps,x=e.data,T=e.cube,E=e.generateMipmap,b=e.mipmaps,C=l,_=C.format,A=C.type,S=C.internalFormat,R=0,O=0;if(this.bind(f===t.TextureSourceType.video),A===le.HALF_FLOAT?((A=h.halfFloatTexture)||lt.error("Half float texture is not support."),he(c)&&S===_&&(_===le.LUMINANCE&&(_=le.RED),S=fu[_]),h.halfFloatLinear||(l.minFilter=l.magFilter=c.NEAREST,lt.warn("Half float linear not support, change to NEAREST."))):A===c.FLOAT&&((A=h.floatTexture)||lt.error("Float texture is not support."),he(c)&&S===_&&(_===le.LUMINANCE&&(_=le.RED),S=pu[_]),h.floatLinear||(l.minFilter=c.NEAREST,l.magFilter=c.NEAREST,lt.warn("Float linear not support, change to NEAREST."))),void 0===l.premultiplyAlpha&&(l.premultiplyAlpha=!1),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,l.premultiplyAlpha),void 0===l.flipY&&(l.flipY=!1),c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,l.flipY),f===t.TextureSourceType.framebuffer)x&&(R=null!==(n=x.width)&&void 0!==n?n:0,O=null!==(o=x.height)&&void 0!==o?o:0,R&&O&&(this.width!==R||this.height!==O)&&c.texImage2D(s,0,S,R,O,0,_,A,null));else if(f===t.TextureSourceType.data)s===c.TEXTURE_CUBE_MAP?T.forEach((function(t,e){var r=u(a.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,A,t),2),i=r[0],n=r[1];R=Math.max(i,R),O=Math.max(n,O)})):(r=u(this.texImage2DData(c,s,0,S,_,A,p),2),R=r[0],O=r[1]);else if(f===t.TextureSourceType.image||f===t.TextureSourceType.video){if(s===c.TEXTURE_CUBE_MAP)d.forEach((function(t,e){var r=u(a.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,S,_,A,t),2),i=r[0],n=r[1];R=Math.max(i,R),O=Math.max(n,O)}));else if(s===c.TEXTURE_2D){var w=null!=m?m:y;i=u(this.texImage2D(c,s,0,S,_,A,w),2),R=i[0],O=i[1]}E&&(mu(R)&&mu(O)||he(c))&&c.generateMipmap(s)}else if(f===t.TextureSourceType.mipmaps){var M;s===c.TEXTURE_2D?v.forEach((function(t,e){var r;M="data"in t?a.texImage2DData(c,s,e,S,_,A,t):a.texImage2D(c,s,e,S,_,A,t),0===e&&(r=u(M,2),R=r[0],O=r[1])})):s===c.TEXTURE_CUBE_MAP&&g.forEach((function(t,e){t.forEach((function(t,r){var i;M="data"in t?a.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,S,_,A,t):a.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,S,_,A,t),0===e&&(i=u(M,2),R=i[0],O=i[1])}))}))}else f===t.TextureSourceType.compressed&&b&&(R=b[0].width,O=b[0].height,b.forEach((function(t,e){c.compressedTexImage2D(s,e,S,t.width,t.height,0,t.data)})));this.width=R,this.height=O,this.setTextureFilters(c,s,l)},n.prototype.setTextureFilters=function(t,e,r){var i=r.anisotropic,n=void 0===i?4:i,o=r.wrapS,a=void 0===o?t.CLAMP_TO_EDGE:o,s=r.wrapT,u=void 0===s?t.CLAMP_TO_EDGE:s,l=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&l.setTextureAnisotropic(t,this.target,n);var c=he(t)||mu(this.width)&&mu(this.height),h=r.minFilter?r.minFilter:t.NEAREST,f=r.magFilter?r.magFilter:t.NEAREST;t.texParameteri(e,t.TEXTURE_MIN_FILTER,h),t.texParameteri(e,t.TEXTURE_MAG_FILTER,f),t.texParameteri(e,t.TEXTURE_WRAP_S,c?a:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,c?u:t.CLAMP_TO_EDGE)},n.prototype.fromData=function(t){e.prototype.fromData.call(this,t);var r=t,i=this.assembleOptions(r),n=i.sourceType,o=i.sourceFrom,a=i.name,s=void 0===a?"":a;this.source=i,this.sourceType=n,this.sourceFrom=o,this.name=s,this.guid=t.id},n.prototype.texImage2D=function(e,r,i,n,o,a,s){var u,l=this,c=this.source,h=c.sourceType,f=c.minFilter,p=c.magFilter;c.flipY;var d=c.wrapS,m=c.wrapT,y=null!==(u=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==u?u:2048,v=s;if(h!==t.TextureSourceType.video){var g=f!==e.NEAREST||p!==e.NEAREST||d!==e.CLAMP_TO_EDGE||m!==e.CLAMP_TO_EDGE;(g=g||s.width>y||s.height>y)&&setTimeout((function(){v=l.resizeImage(s)}))}e.texImage2D(r,i,n,o,a,v);var x=[v.width,v.height];if(h===t.TextureSourceType.video){var T=s;return[T.videoWidth,T.videoHeight]}return x},n.prototype.texImage2DData=function(t,e,r,i,n,o,a){var s=a.data,u=a.width,l=a.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(s.buffer,s.byteOffset,s.byteLength/s.BYTES_PER_ELEMENT):s;return t.texImage2D(e,r,i,u,l,0,n,o,c),[u,l]},n.prototype.resizeImage=function(t,e,r){var i,n=null!==(i=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==i?i:2048;if(he(this.pipelineContext.gl)&&t.width<n&&t.height<n)return t;var o=function(t,e,r,i){var n=t.width,o=t.height,a=Math.min(e,r||fi(n)),s=Math.min(e,i||fi(o));if(s!==o||a!==n){var u=xa.getCanvas(),l=u.getContext("2d");return u.width=a,u.height=s,null==l||l.drawImage(t,0,0,n,o,0,0,a,s),lt.warn("Image resize from ".concat(n,"x").concat(o," to ").concat(a,"x").concat(s)),u}}(t,n,e,r);return o||t},n.prototype.reloadData=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return this.offloaded?[4,De().reload(this)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},n.prototype.offloadData=function(){if(this.initialized&&De().canOffloadTexture(this.source.sourceFrom)){var t=this.target,e=this.pipelineContext.gl;if(e&&this.textureBuffer){var r=new Uint8Array([255]);if(this.bind(),t===e.TEXTURE_2D)e.texImage2D(t,0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);else if(t===e.TEXTURE_CUBE_MAP)for(var i=[e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Z,e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<i.length;n++)e.texImage2D(i[n],0,e.LUMINANCE,1,1,0,e.LUMINANCE,e.UNSIGNED_BYTE,r);e.generateMipmap(t),this.width=1,this.height=1}this.offloaded=!0}},n.prototype.uploadCurrentVideoFrame=function(){return o(this,void 0,void 0,(function(){var e;return a(this,(function(r){switch(r.label){case 0:return this.source.sourceType===t.TextureSourceType.video&&this.source.video&&this.initialized?(e=this.source.video).paused?[4,e.play()]:[3,2]:[3,3];case 1:r.sent(),r.label=2;case 2:return this.update({video:this.source.video}),[2,!0];case 3:return[2,!1]}}))}))},n.prototype.updateSource=function(t){this.source=this.assembleOptions(i(i({},this.source),t)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},n.prototype.restore=function(){},n.prototype.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.source.sourceType===t.TextureSourceType.video&&this.source.video&&this.initialized&&(this.source.video.pause(),this.source.video.src="",this.source.video.load()),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){lt.error("This texture has been destroyed.")},this.initialize=Rt,void 0!==this.engine&&this.engine.removeTexture(this)},n}(Me);function mu(t){return 0==(t&t-1)&&0!==t}var yu,vu=function(){function t(t,e){this.engine=t,this.ready=!1,this.disposed=!1,this.gl=t.getGLPipelineContext().gl,this.vaoExt=t.gpuCapability.vaoExt,this.vao=this.createVertexArray(e)}return t.prototype.bind=function(){this.bindVertexArray(this.vao)},t.prototype.unbind=function(){this.bindVertexArray(null)},t.prototype.createVertexArray=function(t){var e=null;return he(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),e&&Tu(e,t),e},t.prototype.bindVertexArray=function(t){var e;he(this.gl)?this.gl.bindVertexArray(t):null===(e=this.vaoExt)||void 0===e||e.bindVertexArrayOES(t)},t.prototype.dispose=function(){var t;he(this.gl)?this.gl.deleteVertexArray(this.vao):null===(t=this.vaoExt)||void 0===t||t.deleteVertexArrayOES(this.vao)},t}(),gu=1,xu=function(){function e(e){this.engine=e,this.textures=[],this.renderBuffers=[],this.frameBuffers=[],this.destroyed=!1;var r={width:1,height:1,data:new Uint8Array([255])},i=e.getGLPipelineContext(),n=i.gl;this.gl=n,this.pipelineContext=i,this.emptyTexture2D=new du(e,{data:r,sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new du(e,{target:n.TEXTURE_CUBE_MAP,cube:[r,r,r,r,r,r],sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+gu,gu++}return Object.defineProperty(e.prototype,"height",{get:function(){var t;return null===(t=this.gl)||void 0===t?void 0:t.drawingBufferHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){var t;return null===(t=this.gl)||void 0===t?void 0:t.drawingBufferWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canvas",{get:function(){return this.gl.canvas},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.copy2=function(t,e){var r=this.gl;if(r){this.sourceFbo||(this.sourceFbo=r.createFramebuffer()),this.targetFbo||(this.targetFbo=r.createFramebuffer());var i=this.pipelineContext,n=r.COLOR_ATTACHMENT0;i.bindFramebuffer(r.FRAMEBUFFER,this.sourceFbo),r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,t.textureBuffer,0),i.bindFramebuffer(r.FRAMEBUFFER,this.targetFbo),r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,e.textureBuffer,0),i.bindFramebuffer(r.READ_FRAMEBUFFER,this.sourceFbo),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.targetFbo);var o=t.getWidth()===t.getHeight()&&e.getWidth()==e.getHeight()?r.NEAREST:r.LINEAR;r.blitFramebuffer(0,0,t.getWidth(),t.getHeight(),0,0,e.getWidth(),e.getHeight(),r.COLOR_BUFFER_BIT,o),i.bindFramebuffer(r.FRAMEBUFFER,null),i.bindFramebuffer(r.READ_FRAMEBUFFER,null),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}},e.prototype.resetColorAttachments=function(t,e){t.bind(),t.resetColorTextures(e)},e.prototype.createGLRenderBuffer=function(t){var e=this.gl.createRenderbuffer();return e&&v(this.renderBuffers,t),e},e.prototype.resize=function(t,e){var r=this.gl;(r&&r.drawingBufferWidth!==t||r.drawingBufferHeight!==e)&&(r.canvas.width=t,r.canvas.height=e,r.viewport(0,0,t,e),this.frameBuffers.forEach((function(r){var i=r.viewport;r.isCustomViewport||r.resize(i[0],i[1],t*r.viewportScale,e*r.viewportScale)})))},e.prototype.drawGeometry=function(t,e){if(this.gl){var r=t,i=e,n=i.shader.program;if(n){var o=n.setupAttributes(r),a=this.gl,s=r.indicesBuffer,u=r.drawStart,l=r.mode,c=r.drawCount;if(s){var h=s.type,f=s.elementCount;(c=isNaN(c)?f:c)>0&&a.drawElements(l,c,h,null!=u?u:0)}else c>0&&a.drawArrays(l,u,c);null==o||o.unbind()}else console.warn("Material "+i.name+" 的shader着色器程序未初始化。")}else console.warn("GLGPURenderer没有绑定gl对象, 无法绘制geometry")},e.prototype.createGLFrameBuffer=function(t,e){var r=this.gl.createFramebuffer();return r&&(v(this.frameBuffers,t),Tu(r,e,e)),r},e.prototype.createVAO=function(t){return new vu(this.engine,t)},e.prototype.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),g(this.textures,t),delete t.textureBuffer)},e.prototype.deleteGPUBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteBuffer(t.glBuffer),delete t.glBuffer)},e.prototype.deleteGLFrameBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteFramebuffer(t.fbo),g(this.frameBuffers,t),delete t.fbo)},e.prototype.deleteGLRenderBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),g(this.renderBuffers,t),delete t.buffer)},e.prototype.deleteResource=function(){var t=this,e=this.gl;e&&(e.deleteFramebuffer(this.sourceFbo),e.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.frameBuffers.forEach((function(e){return t.deleteGLFrameBuffer(e)})),this.frameBuffers.length=0,this.renderBuffers.forEach((function(e){return t.deleteGLRenderBuffer(e)})),this.renderBuffers.length=0,this.textures.forEach((function(e){return t.deleteGLTexture(e)})),this.textures.length=0)},e.prototype.lost=function(t){lt.error("gl lost, destroy glRenderer by default",t.target),this.deleteResource()},e.prototype.dispose=function(t){this.deleteResource();var e=this.gl;if(e&&t){var r=e.getExtension("WEBGL_lose_context");null==r||r.loseContext()}this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},e}();function Tu(t,e,r){void 0!==e&&(t.__SPECTOR_Metadata={name:e},t.__SPECTOR_Object_TAG?(t.__SPECTOR_Object_TAG.displayText=e,r&&(t.__SPECTOR_Object_TAG.id=r)):t.__SPECTOR_Object_TAG={displayText:e,id:""})}var Eu,bu=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var r=e.target,i=void 0===r?le.ARRAY_BUFFER:r,n=e.type,o=void 0===n?le.FLOAT:n,a=e.name,s=e.usage,u=void 0===s?le.STATIC_DRAW:s,l=e.data,c=e.elementCount,h=function(t){var e,r;return null!==(r=null===(e=Cu[t])||void 0===e?void 0:e.BYTES_PER_ELEMENT)&&void 0!==r?r:0}(o);this.target=i,this.type=o,this.usage=u,this.glBuffer=this.createGLBuffer(a),this.bytesPerElement=h,l?this.bufferData(l):c&&this.bufferData(h*c)}return Object.defineProperty(t.prototype,"elementCount",{get:function(){return this.byteLength/this.bytesPerElement},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.createGLBuffer=function(t){var e=this.pipelineContext.gl.createBuffer();return e&&Tu(e,t),e},t.prototype.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},t.prototype.bufferData=function(t){var e="number"==typeof t?t:t.byteLength;if(this.pipelineContext){this.byteLength=e;var r=this.pipelineContext.gl,i=this.target;r.bindBuffer(i,this.glBuffer),0===e?r.bufferData(i,1,this.usage):(r.bufferData(i,e,this.usage),"number"!=typeof t&&r.bufferSubData(i,0,t))}else this.byteLength=0},t.prototype.bufferSubData=function(t,e){if(this.pipelineContext){var r=this.pipelineContext.gl,i=this.target,n=t*this.bytesPerElement,o=n+e.byteLength;r.bindBuffer(i,this.glBuffer),o>this.byteLength&&(this.byteLength=o,r.bufferData(i,o,this.usage)),r.bufferSubData(i,n,e)}else this.byteLength=0},t.prototype.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},t.prototype.readSubData=function(t,e){return!!he(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},t}(),Cu=((yu={})[le.INT]=Int32Array,yu[le.FLOAT]=Float32Array,yu[le.SHORT]=Int16Array,yu[le.BYTE]=Int8Array,yu[le.UNSIGNED_BYTE]=Uint8Array,yu[le.UNSIGNED_INT]=Uint32Array,yu[le.UNSIGNED_SHORT]=Uint16Array,yu);var _u=((Eu={})[Uint8Array.BYTES_PER_ELEMENT]=le.UNSIGNED_BYTE,Eu[Uint16Array.BYTES_PER_ELEMENT]=le.UNSIGNED_SHORT,Eu[Uint32Array.BYTES_PER_ELEMENT]=le.UNSIGNED_INT,Eu),Au=1,Su=function(t){function e(e,r){var i=t.call(this,e)||this;return i.drawCount=0,i.buffers={},i.vaos={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,r&&i.processProps(r),i}return r(e,t),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInitialized",{get:function(){return this.initialized},enumerable:!1,configurable:!0}),e.prototype.getOptions=function(){return i({},this.options)},e.prototype.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;F(e),e.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new bu(r,t.bufferProps[e])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(r,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},e.prototype.getAttributeBuffer=function(t){if(this.initialized){var e=this.attributes[t].dataSource;return this.buffers[e]}},e.prototype.setAttributeData=function(t,e){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(t),i=this.attributes[t].dataSource;if(r){var n=r.usage,o=r.target;this.bufferProps[i]={data:e,usage:n,target:o,elementCount:e.length},this.dirtyFlags[i].discard=!0,this.dirtyFlags[i].dirty=!0}}},e.prototype.getAttributeData=function(t){if(null!=this.bufferProps){var e=this.getAttributeBufferOption(t);return e?e.data:void 0}},e.prototype.setAttributeSubData=function(t,e,r){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(t);if(i&&null!=i.data){var n=e,o=e+r.length;if(i.data.length<o){var a=new r.constructor(o);a.set(i.data),i.data=a,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var s=this.dirtyFlags[t];s.start=Math.min(s.start,n),s.end=Math.max(s.end,o-1)}i.data.set(r,n),this.dirtyFlags[t].dirty=!0}}},e.prototype.getIndexData=function(){return this.indices},e.prototype.setIndexData=function(t){(t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Uint32Array)&&(this.indices=t,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},e.prototype.setIndexSubData=function(t,e){var r;if(this.indices){var i=t,n=t+e.length;if(this.indices.length<n){var o=new e.constructor(n);o.set(this.indices),this.indices=o,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var a=this.dirtyFlags.index;a.start=Math.min(a.start,i),a.end=Math.max(a.end,n-1)}null===(r=this.indices)||void 0===r||r.set(e,i),this.dirtyFlags.index.dirty=!0}},e.prototype.getAttributeStride=function(t){var e=this.attributes[t],r=e.stride,i=e.size,n=e.type;return r||i*rr[n]},e.prototype.getAttributeNames=function(){return this.attributesName},e.prototype.setDrawStart=function(t){this.drawStart=t},e.prototype.getDrawStart=function(){return this.drawStart},e.prototype.setDrawCount=function(t){this.drawCount=t},e.prototype.getDrawCount=function(){return this.drawCount},e.prototype.getAttributeBufferOption=function(t){var e=this.attributes[t];return e?this.bufferProps[e.dataSource]:void 0},e.prototype.createIndicesBuffer=function(t,e){var r=_u[e.BYTES_PER_ELEMENT],i={data:e,target:le.ELEMENT_ARRAY_BUFFER,type:r,name:"".concat(this.name,"##index")};return new bu(t,i)},e.prototype.flush=function(){var t=this;if(this.initialized){var e=this.attributes,r=this.bufferProps,i=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var o,a,s=t.dirtyFlags[n];if("index"==n)o=t.indicesBuffer,a=i;else{var u=e[n].dataSource;o=t.buffers[u],a=r[u].data}if((s.dirty||s.discard)&&o&&a){if(s.discard)o.bufferData(a);else{var l=s.start*a.BYTES_PER_ELEMENT+a.byteOffset,c=s.end-s.start+1,h=new a.constructor(a.buffer,l,c);o.bufferSubData(s.start,h)}s.start=Number.POSITIVE_INFINITY,s.end=0,s.dirty=s.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(i){var n=t.attributesReleasable[i],o=e[i].dataSource;r[o]&&n&&(r[o].data=void 0)})),this.indicesReleasable}},e.prototype.processProps=function(t){var e=t,r=e.drawStart,i=void 0===r?0:r,n=e.drawCount,o=e.mode,a=e.indices,s=e.name,u=void 0===s?"effectsGeometry:".concat(Au++):s,l=e.bufferUsage,c=void 0===l?le.STATIC_DRAW:l;this.name=u;var h={},f=[],p={},d={},m={},y=c;this.drawStart=i,void 0!==n&&(this.drawCount=n),this.mode=isNaN(o)?le.TRIANGLES:o,Object.keys(e.attributes).forEach((function(t){var r=e.attributes[t],i=r.size,n=r.stride,o=r.offset,a=r.normalize,s=r,u=s.type,l=void 0===u?le.FLOAT:u,c=s.releasable,v=r.data;if(!l||"dataSource"in r||v||(v=nr(l)),v){var g=v instanceof Float32Array?le.FLOAT:le.INT;h[t]={data:v,usage:y,target:le.ARRAY_BUFFER,name:t},p[t]={size:i,stride:n,offset:o,type:null!=l?l:g,normalize:!!a,dataSource:t},m[t]=null!=c&&c,d[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var x=r.dataSource;x&&(p[t]={size:i,stride:n,offset:o,type:l,dataSource:x,normalize:!!a})}f.push(t)})),d.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},this.indices=null==a?void 0:a.data,this.indicesReleasable=!0===(null==a?void 0:a.releasable),this.bufferProps=h,this.attributes=p,this.attributesName=f,this.attributesReleasable=m,this.dirtyFlags=d,this.options=e,this.initialized=!1},e.prototype.fromData=function(e){t.prototype.fromData.call(this,e);var r=function(t){for(var e=atob(t),r=new Uint8Array(e.length),i=0;i<e.length;i++)r[i]=e.charCodeAt(i);var n=r.buffer;return n}(e.buffer),i=e.vertexData.vertexCount,n=e.vertexData.channels[0],o=e.vertexData.channels[1],a=e.vertexData.channels[2],s=new Float32Array(r,n.offset,n.dimension*i),u=new Float32Array(r,o.offset,o.dimension*i),l=new Float32Array(r,a.offset,a.dimension*i),c=new Uint16Array(r,e.indexOffset),h={mode:le.TRIANGLES,attributes:{aPos:{type:le.FLOAT,size:3,data:s},aUV:{type:le.FLOAT,size:2,data:u},aNormal:{type:le.FLOAT,size:3,data:l}}};h.indices={data:c},h.drawCount=c.length,this.processProps(h)},e.prototype.dispose=function(){var t,e=this;this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized&&(Object.keys(this.buffers).forEach((function(t){e.buffers[t].dispose()})),this.buffers={},null===(t=this.indicesBuffer)||void 0===t||t.dispose(),Object.keys(this.vaos).forEach((function(t){var r;null===(r=e.vaos[t])||void 0===r||r.dispose(),e.vaos[t]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0)),this.destroyed=!0},e}(ir);var Ru=function(){function t(){this.reset()}return t.prototype.setBlendColor=function(t){var e=u(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.blendColor[0]===r&&this.blendColor[1]===i&&this.blendColor[2]===n&&this.blendColor[3]===o||(this.blendColor[0]=r,this.blendColor[1]=i,this.blendColor[2]=n,this.blendColor[3]=o)},t.prototype.setBlending=function(t){this.blending!==t&&(this.blending=t)},t.prototype.setBlendFunctionParameters=function(t){var e=u(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.blendFunctionParameters[0]===r&&this.blendFunctionParameters[1]===i&&this.blendFunctionParameters[2]===n&&this.blendFunctionParameters[3]===o||(this.blendFunctionParameters[0]=r,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=n,this.blendFunctionParameters[3]=o)},t.prototype.setBlendEquationParameters=function(t){var e=u(t,2),r=e[0],i=e[1];this.blendEquationParameters[0]===r&&this.blendEquationParameters[1]===i||(this.blendEquationParameters[0]=r,this.blendEquationParameters[1]=i)},t.prototype.setDepthTest=function(t){this.depthTest!==t&&(this.depthTest=t)},t.prototype.setDepthMask=function(t){this.depthMask!==t&&(this.depthMask=t)},t.prototype.setDepthRange=function(t){this.depthRange[0]===t[0]&&this.depthRange[1]===t[1]||(this.depthRange[0]=t[0],this.depthRange[1]=t[1])},t.prototype.setDepthFunc=function(t){this.depthFunc!==t&&(this.depthFunc=t)},t.prototype.setPolygonOffsetFill=function(t){this.polygonOffsetFill!==t&&(this.polygonOffsetFill=t)},t.prototype.setPolygonOffset=function(t){this.polygonOffset[0]===t[0]&&this.polygonOffset[1]===t[1]||(this.polygonOffset[0]=t[0],this.polygonOffset[1]=t[1])},t.prototype.setSampleAlphaToCoverage=function(t){this.sampleAlphaToCoverage!==t&&(this.sampleAlphaToCoverage=t)},t.prototype.setColorMask=function(t){var e=u(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.colorMask[0]===r&&this.colorMask[1]===i&&this.colorMask[2]===n&&this.colorMask[3]===o||(this.colorMask[0]=r,this.colorMask[1]=i,this.colorMask[2]=n,this.colorMask[3]=o)},t.prototype.setStencilTest=function(t){this.stencilTest!==t&&(this.stencilTest=t)},t.prototype.setStencilMask=function(t){this.stencilMask[0]===t[0]&&this.stencilMask[1]===t[1]||(this.stencilMask[0]=t[0],this.stencilMask[1]=t[1])},t.prototype.setStencilRef=function(t){this.stencilRef[0]===t[0]&&this.stencilRef[1]===t[1]||(this.stencilRef[0]=t[0],this.stencilRef[1]=t[1])},t.prototype.setStencilFunc=function(t){this.stencilFunc[0]===t[0]&&this.stencilFunc[1]===t[1]||(this.stencilFunc[0]=t[0],this.stencilFunc[1]=t[1])},t.prototype.setStencilOpFail=function(t){this.stencilOpFail[0]===t[0]&&this.stencilOpFail[1]===t[1]||(this.stencilOpFail[0]=t[0],this.stencilOpFail[1]=t[1])},t.prototype.setStencilOpZFail=function(t){this.stencilOpZFail[0]===t[0]&&this.stencilOpZFail[1]===t[1]||(this.stencilOpZFail[0]=t[0],this.stencilOpZFail[1]=t[1])},t.prototype.setStencilOpZPass=function(t){this.stencilOpZPass[0]===t[0]&&this.stencilOpZPass[1]===t[1]||(this.stencilOpZPass[0]=t[0],this.stencilOpZPass[1]=t[1])},t.prototype.setCulling=function(t){this.culling!==t&&(this.culling=t)},t.prototype.setFrontFace=function(t){this.frontFace!==t&&(this.frontFace=t)},t.prototype.setCullFace=function(t){this.cullFace!==t&&(this.cullFace=t)},t.prototype.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[le.ONE,le.ONE_MINUS_SRC_ALPHA,le.ONE,le.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[le.FUNC_ADD,le.FUNC_ADD],this.depthTest=!1,this.depthMask=!1,this.depthRange=[0,1],this.depthFunc=le.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[le.ALWAYS,le.ALWAYS],this.stencilOpFail=[le.KEEP,le.KEEP],this.stencilOpZFail=[le.KEEP,le.KEEP],this.stencilOpZPass=[le.KEEP,le.KEEP],this.culling=!1,this.frontFace=le.CW,this.cullFace=le.FRONT},t.prototype.apply=function(t){if(t.toggle(le.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(le.BLEND,this.blending),t.toggle(le.DEPTH_TEST,this.depthTest),t.toggle(le.STENCIL_TEST,this.stencilTest),t.toggle(le.CULL_FACE,this.culling),t.toggle(le.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(le.BACK,this.stencilMask[1]),t.stencilMaskSeparate(le.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(le.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(le.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(le.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(le.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var e=this,r=e.blendColor,i=e.blendEquationParameters,n=e.blendFunctionParameters;t.blendColor(r[0],r[1],r[2],r[3]),t.blendEquationSeparate(i[0],i[1]),t.blendFuncSeparate(n[0],n[1],n[2],n[3])}t.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(t.depthMask(this.depthMask),t.depthFunc(this.depthFunc),t.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(t.cullFace(this.cullFace),t.frontFace(this.frontFace)),this.polygonOffsetFill&&t.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},t}(),Ou=K,wu=Z,Mu=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.floats={},t.ints={},t.vector2s={},t.vector3s={},t.vector4s={},t.colors={},t.quaternions={},t.matrices={},t.matrice3s={},t.textures={},t.floatArrays={},t.vector4Arrays={},t.matrixArrays={},t.samplers=[],t.uniforms=[],t.uniformDirtyFlag=!0,t.glMaterialState=new Ru,t}return r(n,e),Object.defineProperty(n.prototype,"blending",{get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendColor",{get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendFunction",{get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"blendEquation",{get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthTest",{get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthMask",{get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthRange",{get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"depthFunc",{get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"polygonOffsetFill",{get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"polygonOffset",{get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sampleAlphaToCoverage",{get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"colorMask",{get:function(){return this.glMaterialState.colorMask},set:function(t){t&&this.glMaterialState.setColorMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilTest",{get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilMask",{get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilRef",{get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilFunc",{get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpFail",{get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpZFail",{get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"stencilOpZPass",{get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"culling",{get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"frontFace",{get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"cullFace",{get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)},enumerable:!1,configurable:!0}),n.prototype.enableKeyword=function(t){throw new Error("Method not implemented.")},n.prototype.disableKeyword=function(t){throw new Error("Method not implemented.")},n.prototype.isKeywordEnabled=function(t){throw new Error("Method not implemented.")},n.prototype.createMaterialStates=function(t){this.sampleAlphaToCoverage=!!t.sampleAlphaToCoverage,this.depthTest=t.depthTest,this.depthMask=t.depthMask,this.depthRange=t.depthRange,this.depthFunc=t.depthFunc,this.colorMask=t.colorMask,this.polygonOffset=t.polygonOffset,this.polygonOffsetFill=t.polygonOffsetFill,this.blending=t.blending,this.blendFunction=t.blendFunction,this.stencilTest=t.stencilTest},Object.defineProperty(n.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),n.prototype.initialize=function(){var t=this;if(!this.initialized){var e=this.engine;if(e.addMaterial(this),!this.shader){var r=e.getGLPipelineContext();this.shader=r.shaderLibrary.createShader(this.shaderSource)}this.shader.initialize(e),Object.keys(this.textures).forEach((function(e){var r=t.textures[e];_t(r.initialize)?r.initialize():lt.error("".concat(JSON.stringify(r)," is not valid Texture to initialize"))})),this.initialized=!0}},n.prototype.setupStates=function(t){this.glMaterialState.apply(t)},n.prototype.use=function(t,e){var r,i,n,o,a,u=t.engine.getGLPipelineContext();if(this.shader.program.bind(),this.setupStates(u),e){try{for(var l=s(e.uniforms),c=l.next();!c.done;c=l.next())a=c.value,this.checkUniform(a)}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}try{for(var h=s(e.samplers),f=h.next();!f.done;f=h.next())a=f.value,this.samplers.includes(a)||(this.samplers.push(a),this.uniformDirtyFlag=!0)}catch(t){n={error:t}}finally{try{f&&!f.done&&(o=h.return)&&o.call(h)}finally{if(n)throw n.error}}}if(this.uniformDirtyFlag&&(this.shader.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirtyFlag=!1),e){for(a in e.floats)this.shader.setFloat(a,e.floats[a]);for(a in e.ints)this.shader.setInt(a,e.ints[a]);for(a in e.matrices)this.shader.setMatrix(a,e.matrices[a])}for(a in this.textures)this.textures[a].textureBuffer||this.textures[a].initialize();for(a in this.floats)this.shader.setFloat(a,this.floats[a]);for(a in this.ints)this.shader.setInt(a,this.ints[a]);for(a in this.floatArrays)this.shader.setFloats(a,this.floatArrays[a]);for(a in this.textures)this.shader.setTexture(a,this.textures[a]);for(a in this.vector2s)this.shader.setVector2(a,this.vector2s[a]);for(a in this.vector3s)this.shader.setVector3(a,this.vector3s[a]);for(a in this.vector4s)this.shader.setVector4(a,this.vector4s[a]);for(a in this.colors)this.shader.setColor(a,this.colors[a]);for(a in this.quaternions)this.shader.setQuaternion(a,this.quaternions[a]);for(a in this.matrices)this.shader.setMatrix(a,this.matrices[a]);for(a in this.matrice3s)this.shader.setMatrix3(a,this.matrice3s[a]);for(a in this.vector4Arrays)this.shader.setVector4Array(a,this.vector4Arrays[a]);for(a in this.matrixArrays)this.shader.setMatrixArray(a,this.matrixArrays[a])},n.prototype.getFloat=function(t){return this.floats[t]},n.prototype.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},n.prototype.getInt=function(t){return this.ints[t]},n.prototype.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},n.prototype.getFloats=function(t){return this.floatArrays[t]},n.prototype.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},n.prototype.getVector2=function(t){return this.vector2s[t]},n.prototype.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},n.prototype.getVector3=function(t){return this.vector3s[t]},n.prototype.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},n.prototype.getVector4=function(t){return this.vector4s[t]},n.prototype.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},n.prototype.getColor=function(t){return this.colors[t]},n.prototype.setColor=function(t,e){this.checkUniform(t),this.colors[t]=e},n.prototype.getQuaternion=function(t){return this.quaternions[t]},n.prototype.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},n.prototype.getMatrix=function(t){return this.matrices[t]},n.prototype.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},n.prototype.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},n.prototype.getVector4Array=function(t){return this.vector4Arrays[t]},n.prototype.setVector4Array=function(t,e){var r,i;this.checkUniform(t),this.vector4Arrays[t]=[];try{for(var n=s(e),o=n.next();!o.done;o=n.next()){var a=o.value;this.vector4Arrays[t].push(a.x,a.y,a.z,a.w)}}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},n.prototype.getMatrixArray=function(t){return this.matrixArrays[t]},n.prototype.setMatrixArray=function(t,e){var r,i;this.checkUniform(t),this.matrixArrays[t]=[];try{for(var n=s(e),o=n.next();!o.done;o=n.next())for(var a=o.value,u=0;u<16;u++)this.matrixArrays[t].push(a.elements[u])}catch(t){r={error:t}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},n.prototype.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},n.prototype.getTexture=function(t){return this.textures[t]},n.prototype.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirtyFlag=!0),this.textures[t]=e},n.prototype.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},n.prototype.clone=function(t){var e=t||this.props,r=this.engine;F(r);var i=new n(r,e);return i.glMaterialState=Object.assign(new Ru,i.glMaterialState),i.floats=this.floats,i.ints=this.ints,i.vector2s=this.vector2s,i.vector3s=this.vector3s,i.vector4s=this.vector4s,i.colors=this.colors,i.quaternions=this.quaternions,i.matrices=this.matrices,i.textures=this.textures,i.floatArrays=this.floatArrays,i.vector4Arrays=this.vector4Arrays,i.matrixArrays=this.matrixArrays,i.samplers=this.samplers,i.uniforms=this.uniforms,i.uniformDirtyFlag=!0,i},n.prototype.fromData=function(t){e.prototype.fromData.call(this,t),this.uniforms=[],this.samplers=[],this.textures={},this.floats={},this.ints={},this.floatArrays={},this.vector4s={};var r,n=i({vector2s:{},matrices:{},textures:{},floatArrays:{},blending:!1,zTest:!1,zWrite:!1},t);for(r in this.blending=n.blending,this.depthTest=n.zTest,this.depthMask=n.zWrite,n.floats)this.setFloat(r,n.floats[r]);for(r in n.ints)this.setInt(r,n.ints[r]);for(r in n.vector4s){var o=n.vector4s[r];this.setVector4(r,new K(o.x,o.y,o.z,o.w))}for(r in n.colors){var a=n.colors[r];this.setColor(r,new et(a.r,a.g,a.b,a.a))}for(r in n.textures){var s=n.textures[r];this.setTexture(r,s)}t.shader&&(this.shader=t.shader,this.shaderSource=this.shader.source),this.initialized=!1},n.prototype.toData=function(){var e=this.taggedProperties;for(var r in this.shader&&(e.shader=this.shader),e.floats={},e.ints={},e.vector4s={},e.dataType=t.DataType.Material,this.blending&&(e.blending=this.blending),this.depthTest&&(e.zTest=this.depthTest),this.depthMask&&(e.zWrite=this.depthMask),this.floats)e.floats[r]=this.floats[r];for(var i in this.ints)e.ints[i]=this.ints[i];for(var n in this.vector4s)e.vector4s[n]=this.vector4s[n];for(var o in this.colors)e.colors[o]=this.colors[o];return e},n.prototype.cloneUniforms=function(t){var e,r=t;for(e in r.floats)this.setFloat(e,r.floats[e]);for(e in r.ints)this.setInt(e,r.ints[e]);for(e in r.floatArrays)this.setFloats(e,r.floatArrays[e]);for(e in r.textures)this.setTexture(e,r.textures[e]);for(e in r.vector2s)this.setVector2(e,r.vector2s[e]);for(e in r.vector3s)this.setVector3(e,r.vector3s[e]);for(e in r.vector4s)this.setVector4(e,r.vector4s[e]);for(e in r.colors)this.setColor(e,r.colors[e]);for(e in r.quaternions)this.setQuaternion(e,r.quaternions[e]);for(e in r.matrices)this.setMatrix(e,r.matrices[e]);for(e in r.vector4Arrays){for(var i=[],n=0;n<r.vector4Arrays[e].length;n+=4)i.push(new Ou(r.vector4Arrays[e][n],r.vector4Arrays[e][n+1],r.vector4Arrays[e][n+2],r.vector4Arrays[e][n+3]));this.setVector4Array(e,i)}for(e in r.matrixArrays){var o=[];for(n=0;n<r.matrixArrays[e].length;n+=16){for(var a=wu.fromIdentity(),s=0;s<16;s++)a.elements[s]=r.matrixArrays[e][n+s];o.push(a)}this.setMatrixArray(e,o)}},n.prototype.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirtyFlag=!0)},n.prototype.dispose=function(e){var r,i=this;this.destroyed||(null===(r=this.shader)||void 0===r||r.dispose(),(null==e?void 0:e.textures)!==t.DestroyOptions.keep&&Object.keys(this.textures).forEach((function(t){var e=i.textures[t];e!==i.engine.emptyTexture&&e.dispose()})),this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.quaternions={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=Rt,this.destroyed=!0,void 0!==this.engine&&this.engine.removeMaterial(this))},n}(Xe),Lu=function(){function e(t){if(this.renderer=t,1===t.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(t);var e=this.copyRenderPass.meshes[0].material.shaderSource;t.pipelineContext.shaderLibrary.addShader(e)}}return e.prototype.resetColorAttachments=function(t,e){this.renderer&&t.resetColorAttachments(e)},e.prototype.copyTexture=function(e,r){this.renderer&&(e.initialize(),r.initialize(),r.updateSource({sourceType:t.TextureSourceType.framebuffer,data:{width:r.getWidth()||e.getWidth(),height:r.getHeight()||e.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(e,r):this.copy1(e,r))},e.prototype.copy2=function(t,e){var r,i=this.renderer.getFrameBuffer();null===(r=this.renderer)||void 0===r||r.glRenderer.copy2(t,e),this.renderer.setFrameBuffer(i)},e.prototype.copy1=function(t,e){var r=this.copyRenderPass;if(r){var i=this.renderer;if(i){var n=r.frameBuffer;n.viewport[2]=e.getWidth()||t.getWidth(),n.viewport[3]=e.getHeight()||t.getHeight(),i.glRenderer.resetColorAttachments(n,[e]),r.meshes[0].material.setTexture("uTex",t),i.renderRenderPass(r)}}},e.prototype.createCopyRenderPass=function(){var e="mri-copy-mesh",r={texture:{format:le.RGBA}},i=this.renderer.engine,n=new Su(i,{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}),o=i.gpuCapability.level,a=new Mu(i,{name:e,shader:{cacheId:"$mri-internal-copy",name:e,vertex:ve([],"\n precision highp float;\n attribute vec2 aPos;\n varying vec2 vTex;\n void main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n }\n ",t.ShaderType.vertex,o),fragment:ve([],"\n precision highp float;\n varying vec2 vTex;\n uniform sampler2D uTex;\n void main(){gl_FragColor = texture2D(uTex,vTex);}\n ",t.ShaderType.fragment,o),glslVersion:2===o?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1}});a.blending=!1,a.depthTest=!1,a.culling=!1;var s=new ur(i,{name:e,geometry:n,material:a,priority:0});return new Iu(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:t.TextureLoadAction.whatever},attachments:[r],meshes:[s]})},e.prototype.dispose=function(){var t;this.renderer&&(null===(t=this.copyRenderPass)||void 0===t||t.dispose(),this.renderer=void 0)},e}(),Iu=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.configure=function(t){this.currentFrameBuffer=t.getFrameBuffer(),t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){this.clearAction&&t.clear(this.clearAction),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction),t.setFrameBuffer(this.currentFrameBuffer)},e}(pr),Pu=function(){function t(t,e,r){var i=this;void 0===e&&(e="webgl"),void 0===r&&(r={}),this.canvas=t,this.glType=e,this.restoreHandlers=[],this.lostHandlers=[],F(t),this.gl=oe(t,e,r),this.contextLostListener=function(t){var e,r,n;try{for(var o=s(i.lostHandlers),a=o.next();!a.done;a=o.next()){a.value.lost(t)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}null===(n=i.canvas)||void 0===n||n.removeEventListener("webglcontextlost",i.contextLostListener)},this.contextRestoredListener=function(t){var e,r,n;try{for(var o=s(i.restoreHandlers),a=o.next();!a.done;a=o.next()){a.value.restore()}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}null===(n=i.canvas)||void 0===n||n.addEventListener("webglcontextlost",i.contextLostListener)},t.addEventListener("webglcontextlost",this.contextLostListener),t.addEventListener("webglcontextrestored",this.contextRestoredListener)}return t.prototype.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},t.prototype.addLostHandler=function(t){this.lostHandlers.push(t)},t.prototype.removeLostHandler=function(t){var e=this.lostHandlers.indexOf(t);e>-1&&this.lostHandlers.splice(e,1)},t.prototype.addRestoreHandler=function(t){this.restoreHandlers.push(t)},t.prototype.removeRestoreHandler=function(t){var e=this.restoreHandlers.indexOf(t);e>-1&&this.restoreHandlers.splice(e,1)},t}(),Fu=function(t){function e(e){var r=t.call(this)||this;return r.gpuCapability=new Ur(e),r}return r(e,t),e.prototype.dispose=function(){this.isDestroyed||t.prototype.dispose.call(this)},e.prototype.getGLRenderer=function(){return this.renderer},e.prototype.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},e.prototype.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},e}(cu),Nu=function(t){function e(e,r){var i=t.call(this,e)||this;return i.initialized=!1,void 0!==r&&i.initialize(r),i}return r(e,t),e.prototype.initialize=function(t){this.initialized||(this.initialized=!0,this.renderer=t,this.buffer=t.createGLRenderBuffer(this))},e.prototype.setSize=function(t,e){if(this.initialized){if(t!==this.size[0]||e!==this.size[1]){var r=this.renderer,i=r.gl;r.pipelineContext.bindRenderBuffer(i.RENDERBUFFER,this.buffer),t&&e?i.renderbufferStorage(i.RENDERBUFFER,this.format,this.size[0]=t,this.size[1]=e):lt.error("Invalid render buffer size: ".concat(t,"x").concat(e))}}else lt.error("Can't set size for uninitialized render buffer")},e.prototype.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderBuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=Rt},e}(Vr),Du=1,Vu=function(e){function i(r,i){var n,o=e.call(this)||this;o.attachmentTextures=[],o.renderer=i,o.engine=i.engine;var a=r.depthStencilAttachment,s=r.viewport,u=r.isCustomViewport,l=r.storeAction,c=r.viewportScale,h=void 0===c?1:c,f=r.name,p=void 0===f?"GLFrameBuffer".concat(Du++):f;return o.depthStencilStorageType=null!==(n=null==a?void 0:a.storageType)&&void 0!==n?n:t.RenderPassAttachmentStorageType.none,o.viewport=s,o.isCustomViewport=!!u,o.viewportScale=h,o.name=p,o.storeAction=l,o.updateProps(r),o}return r(i,e),Object.defineProperty(i.prototype,"stencilStorage",{get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthStorage",{get:function(){if(this.depthStencilStorageType!==t.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderBuffer},enumerable:!1,configurable:!0}),i.prototype.getDepthTexture=function(){return this.depthTexture},i.prototype.getStencilTexture=function(){return this.stencilTexture},i.prototype.getColorTextures=function(){return this.colorTextures},i.prototype.updateAttachmentTextures=function(){var t=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(e){e.initialize(),v(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&v(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&v(this.attachmentTextures,this.depthTexture.textureBuffer)},i.prototype.updateProps=function(e){var r,i,n=this.renderer,o=this.engine.gpuCapability,a=null!==(r=e.depthStencilAttachment)&&void 0!==r?r:{storageType:t.RenderPassAttachmentStorageType.none},s=e.attachments.length>0;this.externalStorage=!1;var u=!0;if(e.attachments.length>1&&!o.detail.drawBuffers)throw Error("multiple color attachments not support");var l=null===(i=e.depthStencilAttachment)||void 0===i?void 0:i.texture,c=o.detail.readableDepthStencilTextures;if(this.colorTextures=e.attachments.slice(),!s&&a.storageType!==t.RenderPassAttachmentStorageType.none)throw Error("use depth stencil attachment without color attachments");s&&(this.fbo=n.glRenderer.createGLFrameBuffer(this,this.name));var h=a.storageType;if(h===t.RenderPassAttachmentStorageType.depth_stencil_opaque){if(a.storage){if(!(a.storage instanceof Nu))throw Error("invalid depth stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new Nu({format:le.DEPTH_STENCIL,attachment:le.DEPTH_STENCIL_ATTACHMENT,storageType:h},n.glRenderer);u=!1}else if(h===t.RenderPassAttachmentStorageType.depth_16_opaque)if(a.storage){if(!(a.storage instanceof Nu))throw Error("invalid depth attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new Nu({attachment:le.DEPTH_ATTACHMENT,format:le.DEPTH_COMPONENT16,storageType:h},n.glRenderer);else if(h===t.RenderPassAttachmentStorageType.stencil_8_opaque)if(a.storage){if(!(a.storage instanceof Nu))throw Error("invalid stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new Nu({attachment:le.STENCIL_ATTACHMENT,format:le.STENCIL_INDEX8,storageType:h},n.glRenderer);else if(h===t.RenderPassAttachmentStorageType.depth_16_texture){if(!c)throw Error("depth texture is not support in framebuffer");this.depthTexture=null!=l?l:new du(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:le.DEPTH_COMPONENT,internalFormat:o.internalFormatDepth16,type:le.UNSIGNED_SHORT,name:"".concat(this.name,"##depthTex")}),this.depthTexture.initialize()}else if(h===t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture){if(!c)throw Error("depth stencil texture is not support in framebuffer");this.depthTexture=this.stencilTexture=null!=l?l:new du(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:le.DEPTH_STENCIL,internalFormat:o.internalFormatDepth24_stencil8,type:o.UNSIGNED_INT_24_8,name:"".concat(this.name,"##dpthStclTex")}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},i.prototype.getStoreAttachments=function(e,r){var i=this.renderer.glRenderer.gl,n=this.colorTextures.length;if(e&&he(i)&&n>0){var o=[];if(e.depthAction===t.TextureStoreAction.clear&&this.depthStorage&&v(o,r?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===t.TextureStoreAction.clear&&this.stencilStorage&&v(o,r?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),e.colorAction===t.TextureStoreAction.clear)for(var a=0;a<n;a++)v(o,i["COLOR_ATTACHMENT".concat(a)]);return o}},i.prototype.unbind=function(){var t=this.storeInvalidAttachments;if(null==t?void 0:t.length){var e=this.renderer.glRenderer.gl;e.invalidateFramebuffer(e.FRAMEBUFFER,t)}this.renderer.pipelineContext.bindSystemFramebuffer()},i.prototype.bind=function(){var t=this,e=this.renderer.glRenderer.gl,r=this.renderer.pipelineContext;if(this.fbo){var i=e.FRAMEBUFFER,n=u(this.viewport,4),o=n[0],a=n[1],s=n[2],l=n[3];r.bindFramebuffer(i,this.fbo),r.viewport(o,a,s,l);var c=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(r.textureUnitDict).forEach((function(e){var i=r.textureUnitDict[e];i!==c&&i&&t.attachmentTextures.includes(i)&&(r.activeTexture(+e),t.renderer.glRenderer.emptyTexture2D.bind())}));for(var h=0;h<4;h++)r.activeTexture(e.TEXTURE0+h),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var f=this,p=f.depthStencilRenderBuffer,d=f.depthTexture,m=f.stencilTexture;if(r.activeTexture(e.TEXTURE0),p)p.setSize(s,l),e.framebufferRenderbuffer(i,p.attachment,e.RENDERBUFFER,p.buffer);else if(d){d.source.data={width:s,height:l},d.update({data:{width:s,height:l,data:new Uint16Array(0)}});var y=d&&m?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(i,y,e.TEXTURE_2D,d.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var v=e.checkFramebufferStatus(i);if(v!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed, status: ".concat(v,", error: ").concat(e.getError()));this.ready=!0}}},i.prototype.resetColorTextures=function(t){var e,r,i=t,n=this.renderer.glRenderer.gl,o=this.engine.gpuCapability,a=this.viewport,u=[];if(i){try{for(var l=s(i),c=l.next();!c.done;c=l.next()){c.value.initialize()}}catch(t){e={error:t}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(e)throw e.error}}this.colorTextures=i.slice()}this.renderer.pipelineContext.activeTexture(n.TEXTURE0),this.colorTextures.forEach((function(t,e){var r={width:a[2],height:a[3],data:new Uint8Array(0)};t.update({data:r}),o.framebufferTexture2D(n,n.FRAMEBUFFER,e,n.TEXTURE_2D,t.textureBuffer),u.push(!0)})),o.drawBuffers(n,u),this.updateAttachmentTextures()},i.prototype.resize=function(t,e,r,i){var n=u(this.viewport,4),o=n[0],a=n[1],s=n[2],l=n[3];o===t&&a===e&&s===r&&l===i||(this.viewport=[t,e,r,i],this.ready=!1,this.bind())},i.prototype.dispose=function(e){var r,i,n=this.renderer;if(n){n.glRenderer.deleteGLFrameBuffer(this),delete this.fbo;var o=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:t.RenderPassDestroyAttachmentType.force;(o===t.RenderPassDestroyAttachmentType.force||o===t.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)&&(null===(r=this.depthStencilRenderBuffer)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose()),this.renderer=this.stencilRenderBuffer=this.depthStencilRenderBuffer=null}},i}(Yr);var zu,Uu,Bu=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return e>>>0},ku=((zu={})[le.FLOAT]=1,zu[le.INT]=1,zu[le.UNSIGNED_INT]=1,zu[le.SHORT]=1,zu[le.BOOL]=1,zu[le.UNSIGNED_SHORT]=1,zu[le.FLOAT_VEC2]=2,zu[le.FLOAT_VEC3]=3,zu[le.FLOAT_VEC4]=4,zu[le.FLOAT_MAT2]=4,zu[le.FLOAT_MAT3]=9,zu[le.FLOAT_MAT4]=16,zu[le.FLOAT_MAT2x3]=6,zu[le.FLOAT_MAT2x4]=8,zu[le.FLOAT_MAT4x3]=12,zu[le.FLOAT_MAT4x2]=8,zu[le.FLOAT_MAT3x4]=12,zu[le.FLOAT_MAT3x2]=6,zu[le.INT_VEC2]=2,zu[le.INT_VEC3]=3,zu[le.INT_VEC4]=4,zu[le.UNSIGNED_INT_VEC2]=2,zu[le.UNSIGNED_INT_VEC3]=3,zu[le.UNSIGNED_INT_VEC4]=4,zu[le.BOOL_VEC2]=2,zu[le.BOOL_VEC3]=3,zu[le.BOOL_VEC4]=4,zu),Gu=Yu(Float32Array),Xu=Yu(Int32Array),Hu=Yu(Uint8Array);function ju(t){return function(e,r,i,n){var o={start:r[1],dirty:!0};if(r[2]>1){var a=e;if(a.length){for(var s=n[1]||a.length,u=r[4]/t.BYTES_PER_ELEMENT,l=o.buffer=new t(s*u),c=n[0]||0,h=0;h<s;h++)l[h*u]=a[h+c];o.start+=c*u}}else o.buffer=new t([e]);return o}}function Yu(t){return function(e,r,i,n){for(var o=r[8],a=r[2],s=r[5],u=1===a?o:r[4],l=s?u/s:1,c=u/t.BYTES_PER_ELEMENT/l,h=o/t.BYTES_PER_ELEMENT/c,f=ku[r[0]],p=f/l,d=(n[0]||0)*f,m=n[1]?l*n[1]:h,y=new t(c*m),v={start:r[1]+u*(n[0]||0),dirty:!0,buffer:y},g=0,x=0,T=d;g<m;g++){for(var E=0;E<p;E++)y[x+E]=e[T+E];x+=c,T+=p}return v}}function Wu(t,e){for(var r=[],i=[],n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),o=function(n){var o=t.getActiveUniformBlockName(e,n),a={index:t.getUniformBlockIndex(e,o),usedByVertexShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:t.getActiveUniformBlockParameter(e,n,t.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:o,id:""};a.used=a.usedByVertexShader||a.usedByFragmentShader,r[n]=a;for(var s=a.uniformIndices,u=[],l=0;l<s.length;l++){var c=t.getActiveUniform(e,s[l]).name.replace("[0]","");a.uniforms[c]=[0,0,0,0,0,0,0,l,0],u[l]=c,i.push(c)}[t.UNIFORM_TYPE,t.UNIFORM_OFFSET,t.UNIFORM_SIZE,t.UNIFORM_BLOCK_INDEX,t.UNIFORM_ARRAY_STRIDE,t.UNIFORM_MATRIX_STRIDE,t.UNIFORM_IS_ROW_MAJOR].forEach((function(r,i){t.getActiveUniforms(e,s,r).forEach((function(t,e){var r=u[e];a.uniforms[r][i]=+t}))}));for(l=0;l<u.length;l++){var h=a.uniforms[u[l]],f=a.uniforms[u[l+1]],p=f?f[1]:a.size;h[8]=p-h[1]}a.id=function(t){var e=t.name,r=t.size,i=t.uniforms,n=t.uniformIndices;return Object.keys(i).map((function(t){return"".concat(t,"[").concat(i[t].join(":"),"]")})).join("+"),Bu("".concat(e,"+"),"".concat(r,"+"),"".concat(n.length,"+"))}(a)+""},a=0;a<n;++a)o(a);return{blockSpecs:r,blockUniformNames:i}}(Uu={})[le.FLOAT]=ju(Float32Array),Uu[le.INT]=ju(Int32Array),Uu[le.UNSIGNED_INT]=ju(Uint32Array),Uu[le.SHORT]=ju(Int16Array),Uu[le.BOOL]=ju(Uint8Array),Uu[le.UNSIGNED_SHORT]=ju(Uint16Array),Uu[le.FLOAT_VEC2]=Gu,Uu[le.FLOAT_VEC3]=Gu,Uu[le.FLOAT_VEC4]=Gu,Uu[le.FLOAT_MAT2]=Gu,Uu[le.FLOAT_MAT3]=Gu,Uu[le.FLOAT_MAT4]=Gu,Uu[le.FLOAT_MAT2x3]=Gu,Uu[le.FLOAT_MAT2x4]=Gu,Uu[le.FLOAT_MAT4x3]=Gu,Uu[le.FLOAT_MAT4x2]=Gu,Uu[le.FLOAT_MAT3x4]=Gu,Uu[le.FLOAT_MAT3x2]=Gu,Uu[le.INT_VEC2]=Xu,Uu[le.INT_VEC3]=Xu,Uu[le.INT_VEC4]=Xu,Uu[le.UNSIGNED_INT_VEC2]=Xu,Uu[le.UNSIGNED_INT_VEC3]=Xu,Uu[le.UNSIGNED_INT_VEC4]=Xu,Uu[le.BOOL_VEC2]=Hu,Uu[le.BOOL_VEC3]=Hu,Uu[le.BOOL_VEC4]=Hu;var Zu=function(){function t(t,e,r,i){var n=this;this.engine=t,this.program=e,this.shared=r,this.id=i,this.uniformBlockMap={},this.pipelineContext=t.getGLPipelineContext();var o=this.pipelineContext.gl;if(this.pipelineContext.useProgram(e),this.attribInfoMap=this.createAttribMap(),he(o)){var a=Wu(o,e),s=a.blockSpecs;a.blockUniformNames,s.forEach((function(t){return n.uniformBlockMap[t.name]=t}))}this.pipelineContext.useProgram(null)}return t.prototype.bind=function(){this.pipelineContext.useProgram(this.program)},t.prototype.setupAttributes=function(t){var e,r,i=this,n=this.id,o=this.pipelineContext.gl;return t.vaos[n]?r=t.vaos[n]:((r=new vu(this.engine,"".concat(t.name,"-").concat(n)))||console.error("创建vao对象失败"),t.vaos[n]=r),r&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var r=i.attribInfoMap[e],n=t.attributes[e];if(n){var a=t.buffers[n.dataSource];if(!a)throw Error("no buffer named ".concat(n.dataSource||e));a.bind(),o.enableVertexAttribArray(r.loc),o.vertexAttribPointer(r.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null===(e=t.indicesBuffer)||void 0===e||e.bind(),r&&(r.ready=!0)),r},t.prototype.createAttribMap=function(){for(var t=this.pipelineContext.gl,e=this.program,r={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var o=t.getActiveAttrib(e,n),a=o.name,s=o.type,u=o.size,l=t.getAttribLocation(e,a);r[a]={type:s,name:a,size:u,loc:l}}return r},t.prototype.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),qu=function(e){function i(t,r){var i=e.call(this,t,r)||this;return i.initialized=!1,i.uniformLocations={},i.samplerChannels={},i}return r(i,e),i.prototype.initialize=function(t){this.initialized||t.getGLPipelineContext().shaderLibrary.compileShader(this)},i.prototype.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},i.prototype.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},i.prototype.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},i.prototype.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},i.prototype.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},i.prototype.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},i.prototype.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},i.prototype.setColor=function(t,e){this.pipelineContext.setColor(this.uniformLocations[t],e)},i.prototype.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},i.prototype.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},i.prototype.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},i.prototype.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},i.prototype.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},i.prototype.fillShaderInformation=function(t,e){var r=e.slice();t=t.concat(r);for(var i,n=this.pipelineContext.getUniforms(this.program.program,t),o=0;o<t.length;o++)this.uniformLocations[t[o]]=n[o];for(i=0;i<r.length;i++){null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--)}for(i=0;i<r.length;i++){var a=r[i];this.samplerChannels[a]=i}},i.prototype.toData=function(){var e=this.taggedProperties;e.dataType=t.DataType.Shader,e.id=this.guid,e.vertex=this.source.vertex,e.fragment=this.source.fragment},i.prototype.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null===(t=this.program)||void 0===t||t.dispose()},i}(je),Ku=0,Qu=function(){function e(t,e){this.engine=t,this.pipelineContext=e,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=t.gpuCapability.glAsyncCompileExt}return e.prototype.compileAllShaders=function(t){var e,r,i=this;if(this.shaderAllDone)t&&t([]);else{var n=[];try{for(var o=s(Object.keys(this.cachedShaders)),a=o.next();!a.done;a=o.next()){var u=a.value;this.cachedShaders[u].initialized||n.push(u)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(e)throw e.error}}t?n.length?Promise.all(n.map((function(t){return new Promise((function(e){return i.compileShader(i.cachedShaders[t],e)}))}))).then(t).catch((function(){return 0})):t([]):n.map((function(t){return i.compileShader(i.cachedShaders[t])})),this.shaderAllDone=!0}},e.prototype.addShader=function(e){var r=this.computeShaderCacheId(e);if(this.cachedShaders[r])return r;this.shaderAllDone=!1;var n=e.glslVersion===t.GLSLVersion.GLSL3?"#version 300 es\n":"",o=e.vertex?n+e.vertex:"",a=e.fragment?n+e.fragment:"",s=!1;return(e.shared||e.cacheId)&&(s=!0),this.cachedShaders[r]=new qu(this.engine,i(i({},e),{vertex:o,fragment:a,name:e.name||r,shared:s})),this.cachedShaders[r].id=r,r},e.prototype.createShader=function(t){var e=this.addShader(t);return this.cachedShaders[e]},e.prototype.compileShader=function(e,r){var i=this,n=e.source,o=!1;(n.shared||n.cacheId)&&(o=!0);var a={vertex:n.vertex,fragment:n.fragment,name:n.name,shared:o},s=this.pipelineContext.gl,u={shared:a.shared,status:t.ShaderCompileResultStatus.compiling},l=this.createProgram(s,a.vertex,a.fragment,u),c=this.glAsyncCompileExt,h=performance.now(),f=function(r){u.status=t.ShaderCompileResultStatus.success,u.compileTime=performance.now()-h,e.program=r,e.initialized=!0,e.pipelineContext=i.pipelineContext,void 0!==i.programMap[e.id]&&console.warn("find duplicated shader id",e.id),i.programMap[e.id]=r},p=function(){var n=(!r||!c||c&&1==s.getProgramParameter(u.program,c.COMPLETION_STATUS_KHR))&&l();if(n){if(u.status!==t.ShaderCompileResultStatus.fail){Tu(n,a.name);var h=new Zu(i.engine,n,o,e.id);if(s.validateProgram(n),s.getProgramParameter(n,s.VALIDATE_STATUS))f(h);else{var d=s.getProgramInfoLog(n);(null==d?void 0:d.includes("the same texture"))?f(h):(u.status=t.ShaderCompileResultStatus.fail,u.error=d,console.error("compileProgramError: "+d,"\nvertex:\n",a.vertex,"\nfragment:\n",a.fragment),s.deleteProgram(n))}}r&&r(u)}else r&&requestAnimationFrame(p)};e.compileResult=u,p()},e.prototype.computeShaderCacheId=function(t){var e,r=t.vertex?t.vertex:"",i=t.fragment?t.fragment:"";return e=t.shared||t.cacheId?t.cacheId||"shared_".concat(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var r=0,i=0;i<arguments.length;i++)for(var n=t[i],o=0;o<n.length;o++)r=Math.imul(31,r)+n.charCodeAt(o)|0;return r}(r,i)):"instanced_"+Ku++,e},e.prototype.createProgram=function(e,r,i,n){var o=e.createProgram(),a=this.createGLShader(e,e.VERTEX_SHADER,r),s=this.createGLShader(e,e.FRAGMENT_SHADER,i);return o&&a&&s?(e.attachShader(o,a),e.attachShader(o,s),e.linkProgram(o),n.program=o,n.status=t.ShaderCompileResultStatus.compiling,function(){if(delete n.program,!e.getProgramParameter(o,e.LINK_STATUS)){var u=Ju(e,a,"vertex",r),l=Ju(e,s,"fragment",i);return n.status=t.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),l&&(n.error=l.error,n.status=l.status),o}return o}):(n.status=t.ShaderCompileResultStatus.fail,function(){return null})},e.prototype.createGLShader=function(t,e,r){var i=e===t.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=Bu(null!=r?r:""),o=i.get(n);if(o)return o;var a=t.createShader(e);return a&&(t.shaderSource(a,r),t.compileShader(a),i.set(n,a)),a},e.prototype.deleteShader=function(t){var e=this.programMap[t];void 0!==e&&(e.dispose(),delete this.programMap[t]),void 0!==this.shaderResults[t]&&delete this.shaderResults[t]},e.prototype.restore=function(){},e.prototype.dispose=function(){var t=this;if(Object.keys(this.programMap).forEach((function(e){t.programMap[e].dispose()})),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},e}();function Ju(e,r,i,n){if(!e.getShaderParameter(r,e.COMPILE_STATUS)){var o=e.getShaderInfoLog(r);return console.error("compile "+i+" error: "+o,(null!=n?n:"").split("\n").map((function(t,e){return"".concat(e+1," ").concat(t)})).join("\n")),{error:o,status:t.ShaderCompileResultStatus.fail}}}var $u=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new Qu(t,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}return t.prototype.dispose=function(){this.shaderLibrary.dispose(),this.reset()},t.prototype.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=le.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderBuffer={}},t.prototype.toggle=function(t,e){e?this.enable(t):this.disable(t)},t.prototype.enable=function(t){!0!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!0,this.gl.enable(t))},t.prototype.disable=function(t){!1!==this.glCapabilityCache[t]&&(this.glCapabilityCache[t]=!1,this.gl.disable(t))},t.prototype.bindFramebuffer=function(t,e){this.currentFramebuffer[t]!==e&&(this.currentFramebuffer[t]=e,this.gl.bindFramebuffer(t,e))},t.prototype.bindRenderBuffer=function(t,e){this.currentRenderBuffer[t]!==e&&(this.currentRenderBuffer[t]=e,this.gl.bindRenderbuffer(t,e))},t.prototype.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},t.prototype.useProgram=function(t){this.set1("useProgram",t)},t.prototype.clear=function(t){this.gl.clear(t)},t.prototype.clearDepth=function(t){this.set1("clearDepth",t)},t.prototype.depthFunc=function(t){this.set1("depthFunc",t)},t.prototype.depthMask=function(t){this.set1("depthMask",t)},t.prototype.polygonOffset=function(t,e){this.set2("polygonOffset",t,e)},t.prototype.depthRange=function(t,e){this.set2("depthRange",t,e)},t.prototype.clearStencil=function(t){this.set1("clearStencil",t)},t.prototype.stencilMask=function(t){this.stencilMaskSeparate(this.gl.FRONT,t),this.stencilMaskSeparate(this.gl.BACK,t)},t.prototype.stencilFunc=function(t,e,r){this.stencilFuncSeparate(this.gl.FRONT,t,e,r),this.stencilFuncSeparate(this.gl.BACK,t,e,r)},t.prototype.stencilFuncSeparate=function(t,e,r,i){this.set4("stencilFuncSeparate",t,e,r,i)},t.prototype.stencilMaskSeparate=function(t,e){this.set2("stencilMaskSeparate",t,e)},t.prototype.stencilOp=function(t,e,r){this.stencilOpSeparate(this.gl.FRONT,t,e,r),this.stencilOpSeparate(this.gl.BACK,t,e,r)},t.prototype.stencilOpSeparate=function(t,e,r,i){this.set4("stencilOpSeparate",t,e,r,i)},t.prototype.cullFace=function(t){this.set1("cullFace",t)},t.prototype.frontFace=function(t){this.set1("frontFace",t)},t.prototype.clearColor=function(t,e,r,i){this.set4("clearColor",t,e,r,i)},t.prototype.colorMask=function(t,e,r,i){this.set4("colorMask",t,e,r,i)},t.prototype.blendColor=function(t,e,r,i){this.set4("blendColor",t,e,r,i)},t.prototype.blendFunc=function(t,e){this.blendFuncSeparate(t,e,t,e)},t.prototype.blendFuncSeparate=function(t,e,r,i){this.set4("blendFuncSeparate",t,e,r,i)},t.prototype.blendEquation=function(t){this.set1("blendEquation",t)},t.prototype.blendEquationSeparate=function(t,e){this.set2("blendEquationSeparate",t,e)},t.prototype.setPixelStorei=function(t,e){this.pixelStorei[t]!==e&&(this.pixelStorei[t]=e,this.gl.pixelStorei(t,e))},t.prototype.viewport=function(t,e,r,i){this.set4("viewport",t,e,r,i)},t.prototype.activeTexture=function(t){t=Math.min(t,this.maxTextureCount),this.activeTextureIndex!==t&&(this.activeTextureIndex=t,this.gl.activeTexture(t))},t.prototype.bindTexture=function(t,e,r){(this.currentTextureBinding!==e||r)&&(this.gl.bindTexture(t,e),this.currentTextureBinding=e),this.textureUnitDict[this.activeTextureIndex]=e},t.prototype.set1=function(t,e){this.glCapabilityCache[t]!==e&&(this.glCapabilityCache[t]=e,this.gl[t](e))},t.prototype.set2=function(t,e,r){var i=this.glCapabilityCache[t];i||(i=this.glCapabilityCache[t]={x:NaN,y:NaN}),i.x===e&&i.y===r||this.gl[t](i.x=e,i.y=r)},t.prototype.set3=function(t,e,r,i){var n=this.glCapabilityCache[t];n||(n=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN}),n.x===e&&n.y===r&&n.z===i||this.gl[t](n.x=e,n.y=r,n.z=i)},t.prototype.set4=function(t,e,r,i,n){var o=this.glCapabilityCache[t];o||(o=this.glCapabilityCache[t]={x:NaN,y:NaN,z:NaN,w:NaN}),o.x===e&&o.y===r&&o.z===i&&o.w===n||this.gl[t](o.x=e,o.y=r,o.z=i,o.w=n)},t.prototype.get=function(t){return this.glCapabilityCache[t]},t.prototype.setFloat=function(t,e){t&&this.gl.uniform1f(t,e)},t.prototype.setInt=function(t,e){t&&this.gl.uniform1i(t,e)},t.prototype.setFloats=function(t,e){t&&this.gl.uniform1fv(t,e)},t.prototype.setVector2=function(t,e){this.setFloat2(t,e.x,e.y)},t.prototype.setVector3=function(t,e){this.setFloat3(t,e.x,e.y,e.z)},t.prototype.setVector4=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},t.prototype.setColor=function(t,e){this.setFloat4(t,e.r,e.g,e.b,e.a)},t.prototype.setQuaternion=function(t,e){this.setFloat4(t,e.x,e.y,e.z,e.w)},t.prototype.setVector4Array=function(t,e){t&&e.length%4==0&&this.gl.uniform4fv(t,e)},t.prototype.setMatrix=function(t,e){t&&this.gl.uniformMatrix4fv(t,!1,e.elements)},t.prototype.setMatrix3=function(t,e){t&&this.gl.uniformMatrix3fv(t,!1,e.elements)},t.prototype.setMatrixArray=function(t,e){t&&e.length%16==0&&this.gl.uniformMatrix4fv(t,!1,e)},t.prototype.setTexture=function(t,e,r){if(t){this.gl.activeTexture(this.gl.TEXTURE0+e);var i=r.target;this.gl.bindTexture(i,r.textureBuffer),this.gl.uniform1i(t,e)}},t.prototype.getUniforms=function(t,e){for(var r=[],i=0;i<e.length;i++)r.push(this.gl.getUniformLocation(t,e[i]));return r},t.prototype.setFloat4=function(t,e,r,i,n){t&&this.gl.uniform4f(t,e,r,i,n)},t.prototype.setFloat3=function(t,e,r,i){t&&this.gl.uniform3f(t,e,r,i)},t.prototype.setFloat2=function(t,e,r){t&&this.gl.uniform2f(t,e,r)},t}(),tl=function(e){function n(r,n,o){var a=e.call(this)||this;a.canvas=r,a.temporaryRTs={};var s=i({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},o);a.context=new Pu(r,n,s);var u=a.context.gl;return F(u),a.engine=new Fu(u),a.engine.renderer=a,a.pipelineContext=new $u(a.engine,u),a.glRenderer=new xu(a.engine),a.extension=new Lu(a),a.renderingData={currentFrame:{}},a.frameBuffer=new Vu({storeAction:{},viewport:[0,0,a.width,a.height],attachments:[new du(a.engine,{sourceType:t.TextureSourceType.framebuffer,data:{width:a.width,height:a.height}})],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},a),a}return r(n,e),Object.defineProperty(n.prototype,"isDestroyed",{get:function(){var t=this.glRenderer;return!t||t.isDestroyed},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){var t,e;return null!==(e=null===(t=this.glRenderer)||void 0===t?void 0:t.height)&&void 0!==e?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){var t,e;return null!==(e=null===(t=this.glRenderer)||void 0===t?void 0:t.width)&&void 0!==e?e:0},enumerable:!1,configurable:!0}),n.prototype.renderRenderFrame=function(t){var e,r,i,n,o,a,u=t;u.resource&&u.resource.color_b.initialize(),u.emptyTexture.initialize(),u.transparentTexture.initialize();var l=u._renderPasses;if(this.isDestroyed)return console.error("renderer is destroyed",this);u.renderer.getShaderLibrary().compileAllShaders(),this.setFrameBuffer(null),this.clear(u.clearAction),this.renderingData.currentFrame=u,this.renderingData.currentCamera=u.camera,M(l);try{for(var c=s(l),h=c.next();!h.done;h=c.next()){var f=(m=h.value).delegate;null===(o=f.willBeginRenderPass)||void 0===o||o.call(f,m,this.renderingData),this.renderRenderPass(m),null===(a=f.didEndRenderPass)||void 0===a||a.call(f,m,this.renderingData)}}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=s(l),d=p.next();!d.done;d=p.next()){var m;(m=d.value).frameCleanup(this)}}catch(t){i={error:t}}finally{try{d&&!d.done&&(n=p.return)&&n.call(p)}finally{if(i)throw i.error}}},n.prototype.renderRenderPass=function(t){this.renderingData.currentPass=t,t.initialize(this),t.configure(this),t.execute(this)},n.prototype.renderMeshes=function(t){var e,r,i,n,o=this.renderingData.currentPass.delegate;try{for(var a=s(t),u=a.next();!u.done;u=a.next()){var l=u.value;null===(i=o.willRenderMesh)||void 0===i||i.call(o,l,this.renderingData),l.render(this),null===(n=o.didRenderMesh)||void 0===n||n.call(o,l,this.renderingData)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}},n.prototype.setGlobalFloat=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.floats[t]=e},n.prototype.setGlobalInt=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.ints[t]=e},n.prototype.setGlobalMatrix=function(t,e){this.checkGlobalUniform(t),this.renderingData.currentFrame.globalUniforms.matrices[t]=e},n.prototype.drawGeometry=function(t,e){if(t&&e){e.initialize(),t.initialize();var r=this.renderingData;r.currentFrame.globalUniforms&&r.currentCamera&&(this.setGlobalMatrix("effects_MatrixInvV",r.currentCamera.getInverseViewMatrix()),this.setGlobalMatrix("effects_MatrixV",r.currentCamera.getViewMatrix()),this.setGlobalMatrix("effects_MatrixVP",r.currentCamera.getViewProjectionMatrix()),this.setGlobalMatrix("_MatrixP",r.currentCamera.getProjectionMatrix()));var i=Date.now()%1e8*.001*1;this.setGlobalFloat("_GlobalTime",i),r.currentFrame.editorTransform&&e.setVector4("uEditorTransform",r.currentFrame.editorTransform);try{e.use(this,r.currentFrame.globalUniforms)}catch(t){return void console.error(t)}this.glRenderer.drawGeometry(t,e)}},n.prototype.setFrameBuffer=function(t){t?(this.frameBuffer=t,this.frameBuffer.bind(),this.setViewport(t.viewport[0],t.viewport[1],t.viewport[2],t.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},n.prototype.getFrameBuffer=function(){return this.frameBuffer},n.prototype.getTemporaryRT=function(e,r,i,n,o,a){if(this.temporaryRTs[e])return this.temporaryRTs[e];var s,u,l=t.RenderPassAttachmentStorageType.none;o===t.FilterMode.Linear?s=le.LINEAR:o===t.FilterMode.Nearest&&(s=le.NEAREST),a===t.RenderTextureFormat.RGBA32?u=le.UNSIGNED_BYTE:a===t.RenderTextureFormat.RGBAHalf&&(u=le.HALF_FLOAT),0===n?l=t.RenderPassAttachmentStorageType.none:16===n?l=t.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(l=t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var c=new du(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:le.RGBA,format:le.RGBA,type:u}),h=new Vu({name:e,storeAction:{},viewport:[0,0,r,i],viewportScale:1,isCustomViewport:!0,attachments:[c],depthStencilAttachment:{storageType:l}},this);return this.temporaryRTs[e]=h,h},n.prototype.setViewport=function(t,e,r,i){this.pipelineContext.viewport(t,e,r,i)},n.prototype.clear=function(e){var r=this.pipelineContext,i=0;if(e.colorAction===t.TextureLoadAction.clear){var n=e.clearColor;n&&r.clearColor(n[0],n[1],n[2],n[3]),r.colorMask(!0,!0,!0,!0),i=le.COLOR_BUFFER_BIT}if(e.stencilAction===t.TextureLoadAction.clear&&(r.stencilMask(255),r.clearStencil(e.clearStencil||0),i|=le.STENCIL_BUFFER_BIT),e.depthAction===t.TextureLoadAction.clear){var o=e.clearDepth;r.depthMask(!0),r.clearDepth(Number.isFinite(o)?o:1),i|=le.DEPTH_BUFFER_BIT}i&&r.clear(i)},n.prototype.addLostHandler=function(t){this.context.addLostHandler(t)},n.prototype.addRestoreHandler=function(t){this.context.addRestoreHandler(t)},n.prototype.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},n.prototype.getWidth=function(){return this.width},n.prototype.getHeight=function(){return this.height},n.prototype.dispose=function(t){var e;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null===(e=this.glRenderer)||void 0===e||e.dispose(t),this.canvas=null,this.engine.dispose()},n.prototype.lost=function(t){t.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(t)},n.prototype.restore=function(){var t=this.context.gl;if(!t)throw new Error("Can not restore automatically because losing gl context");this.engine=new Fu(t),this.engine.renderer=this,this.pipelineContext=new $u(this.engine,t),this.glRenderer=new xu(this.engine),this.extension=new Lu(this)},n.prototype.resize=function(t,e){var r=this.glRenderer;r&&(this.width===t&&this.height===e||r.resize(t,e))},n.prototype.checkGlobalUniform=function(t){var e=this.renderingData.currentFrame.globalUniforms;e.uniforms.includes(t)||e.uniforms.push(t)},n}(Wr),el="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",rl="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",il="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",nl="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",ol="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",al="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg";var sl=new Map,ul=!1,ll=1,cl=function(){function e(t){var e,r,n=this;this.compositions=[],this.displayScale=1,this.resumePending=!1,this.disposed=!1,this.speed=1,this.baseCompositionIndex=0,this.lost=function(t){var e,r;null===(e=n.ticker)||void 0===e||e.pause(),n.compositions.forEach((function(e){return e.lost(t)})),n.renderer.lost(t),null===(r=n.handleWebGLContextLost)||void 0===r||r.call(n,t),fl(n,!1)},this.restore=function(){return o(n,void 0,void 0,(function(){var t,e,r,i=this;return a(this,(function(n){switch(n.label){case 0:return this.renderer.restore(),t=this,[4,Promise.all(this.compositions.map((function(t){return o(i,void 0,void 0,(function(){var e,r,i,n,o,s,u,l,c,h,f,p;return a(this,(function(a){switch(a.label){case 0:return e=t.time,r=t.url,i=t.speed,n=t.keepResource,o=t.reusable,s=t.renderOrder,u=t.transform,l=t.videoState,[4,this.loadScene(r)];case 1:(c=a.sent()).speed=i,c.reusable=o,c.keepResource=n,c.renderOrder=s,c.transform=u,h=0,a.label=2;case 2:return h<l.length?l[h]?((f=c.textures[h].source.video).currentTime=null!==(p=l[h])&&void 0!==p?p:0,[4,f.play()]):[3,4]:[3,5];case 3:a.sent(),a.label=4;case 4:return h++,[3,2];case 5:return c.rootItem.getComponent(au).resetStatus(),c.gotoAndPlay(e),[2,c]}}))}))})))];case 1:return t.compositions=n.sent(),null===(e=this.handleWebGLContextRestored)||void 0===e||e.call(this),null===(r=this.ticker)||void 0===r||r.resume(),[2]}}))}))},this.handleResume=function(){var t;null===(t=n.handlePlayableUpdate)||void 0===t||t.call(n,{player:n,playing:!0})},this.handleClick=function(t){var e=t.x,r=t.y;n.compositions.forEach((function(t){var o,a=t.hitTest(e,r);if(a.length)for(var s=0;s<a.length;s++){var u=a[s].behavior||xt.NOTIFY;u===xt.NOTIFY?null===(o=n.handleItemClicked)||void 0===o||o.call(n,i(i({},a[s]),{composition:t.name,player:n})):u===xt.RESUME_PLAYER&&n.resume()}}))};var u=t.container,l=t.canvas,c=t.gl,h=t.fps,f=t.name,p=t.pixelRatio,d=t.manualRender,m=t.interactive,y=t.reportGPUTime,v=t.onMessageItem,g=t.onPausedByItem,x=t.onItemClicked,T=t.onPlayableUpdate,E=t.onRenderError,b=t.onWebGLContextLost,C=t.onWebGLContextRestored,_=t.renderFramework,R=t.env,O=void 0===R?"":R,w=t.notifyTouch;if(ue.length)throw new Error("Errors before player create: ".concat(ue.map((function(t,e){return"\n ".concat(e+1,": ").concat(t)}))));var M=null!==(r=null!==(e=t.renderOptions)&&void 0!==e?e:t)&&void 0!==r?r:{},L=M.willCaptureImage,I=M.premultiplyAlpha;if(!ul&&"debug-disable"!==_){var P,F=S()||(P=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===P[1]||"16"===P[1]&&"5"===P[2])?"webgl":"webgl2";if(_&&(F="webgl"===_?"webgl":"webgl2"),this.handleWebGLContextLost=b,this.handleWebGLContextRestored=C,this.reportGPUTime=y,this.handleItemClicked=x,this.handleMessageItem=v,this.handlePlayableUpdate=T,this.handleRenderError=E,this.handlePlayerPause=function(t){n.pause(),null==g||g({name:t.name,player:n})},this.pixelRatio=Number.isFinite(p)?p:A(),this.offscreenMode=!0,this.env=O,l)this.canvas=l;else if(c){this.canvas=c.canvas;var N=c instanceof WebGLRenderingContext?"webgl":"webgl2";F!==N&&(lt.error("The gl context(".concat(N,") is inconsistent with renderFramework or default version(").concat(F,")")),F=N)}else pl(u),this.canvas=document.createElement("canvas"),u.appendChild(this.canvas);this.renderer=Wr.create(this.canvas,F,{preserveDrawingBuffer:L,premultipliedAlpha:I}),this.renderer.env=O,this.renderer.addLostHandler({lost:this.lost}),this.renderer.addRestoreHandler({restore:this.restore}),this.gpuCapability=this.renderer.engine.gpuCapability,sl.forEach((function(t){t.gpuCapability.type!==n.gpuCapability.type&<.warn("Create player with different webgl version: old=".concat(t.gpuCapability.type,", new=").concat(n.gpuCapability.type))})),d||(this.ticker=new hu(h),this.ticker.add(this.tick.bind(this))),this.event=new Wi(this.canvas,!!w),this.event.bindListeners(),this.event.addEventListener(Gi,this.handleClick),this.interactive=null!=m&&m,this.name=f||"".concat(ll++),c||this.resize(),nn(this.gpuCapability.detail),this.container=this.canvas.parentElement,sl.set(this.canvas,this),function(){var t,e,r=[];try{for(var i=s(sl.values()),n=i.next();!n.done;n=i.next()){var o=n.value;o.paused||r.push(o)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}r.length>1&<.error("Current running player count: ".concat(r.length,", see ").concat(al),r)}(),fl(this,!0)}}return e.prototype.setSpeed=function(t){isNaN(t)||(this.speed=t)},e.prototype.getSpeed=function(){return this.speed},e.prototype.getCompositionByName=function(t){return this.compositions.find((function(e){return e.name===t}))},e.prototype.getCompositions=function(){return this.compositions},Object.defineProperty(e.prototype,"hasPlayable",{get:function(){return this.compositions.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"paused",{get:function(){var t;return null===(t=this.ticker)||void 0===t?void 0:t.getPaused()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"interactive",{get:function(){return this.event.enabled},set:function(t){this.event.enabled=t},enumerable:!1,configurable:!0}),e.prototype.loadScene=function(t,e){var r;return o(this,void 0,void 0,(function(){var i,n,s=this;return a(this,(function(u){switch(u.label){case 0:return n=this.baseCompositionIndex,Ct(t)?(this.baseCompositionIndex+=t.length,[4,Promise.all(t.map((function(t,r){return o(s,void 0,void 0,(function(){var i;return a(this,(function(o){switch(o.label){case 0:return[4,this.createComposition(t,e)];case 1:return(i=o.sent()).setIndex(n+r),[2,i]}}))}))})))]):[3,2];case 1:return i=u.sent(),[3,4];case 2:return this.baseCompositionIndex+=1,[4,this.createComposition(t,e)];case 3:(i=u.sent()).setIndex(n),u.label=4;case 4:return null===(r=this.ticker)||void 0===r||r.start(),[2,i]}}))}))},e.prototype.createComposition=function(t,e){return void 0===e&&(e={}),o(this,void 0,void 0,(function(){var r,n,o,s,u,l,c,h,f,p,d=this;return a(this,(function(a){switch(a.label){case 0:return r=this.renderer,n=this.renderer.engine,o=performance.now(),s=i({autoplay:!0},e),hl(t)?(u=t.scene,s=i(i({},s),t.options||{})):u=t,this.assetManager?this.assetManager.updateOptions(s):this.assetManager=new tu(s),n.clearResources(),[4,this.assetManager.loadScene(u,this.renderer,{env:this.env})];case 1:for(l=a.sent(),n.addPackageDatas(l),c=0;c<l.textureOptions.length;c++)l.textureOptions[c]=n.assetLoader.loadGUID(l.textureOptions[c].id),l.textureOptions[c].initialize();return h=new lu(l,n),n.database?[4,n.createVFXItemsAsync(l)]:[3,3];case 2:a.sent(),a.label=3;case 3:if(this.disposed)throw new Error("Disposed player can not used to create Composition");return f=new su(i(i({},s),{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,onPlayerPause:this.handlePlayerPause,onMessageItem:this.handleMessageItem}),l,h),this.ticker&&f.renderLevel===ft.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),[4,new Promise((function(t){d.renderer.getShaderLibrary().compileAllShaders((function(){t(null)}))}))];case 4:return a.sent(),s.autoplay?(this.autoPlaying=!0,f.play()):f.pause(),p=performance.now()-o+f.statistic.loadTime,f.statistic.firstFrameTime=p,lt.info("first frame: [".concat(f.name,"]").concat(p.toFixed(4),"ms")),this.compositions.push(f),[2,f]}}))}))},e.prototype.play=function(){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.play()})),null===(t=this.ticker)||void 0===t||t.start()},e.prototype.gotoAndPlay=function(t){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.gotoAndPlay(t)})),this.ticker?this.ticker.start():this.doTick(0,!0)},e.prototype.gotoAndStop=function(t){var e,r;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(e){e.gotoAndStop(t)})),this.ticker&&!(null===(e=this.ticker)||void 0===e?void 0:e.getPaused())||this.doTick(0,!0),null===(r=this.handlePlayableUpdate)||void 0===r||r.call(this,{player:this,playing:!1})},e.prototype.playSequence=function(t){for(var e,r=function(e){var r=t[e],i=r.onEnd;r.onEnd=function(){null==i||i.call(r,r),t[e+1].play()}},i=0;i<t.length-1;i++)r(i);t[0].play(),null===(e=this.ticker)||void 0===e||e.start()},e.prototype.pause=function(t){var e,r;this.paused||(null===(e=this.ticker)||void 0===e||e.pause(),null===(r=this.handlePlayableUpdate)||void 0===r||r.call(this,{player:this,playing:!1}),t&&t.offloadTexture&&this.offloadTexture())},e.prototype.resume=function(){var t;return o(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return this.resumePending?[2]:this.paused?(this.resumePending=!0,[4,Promise.all(this.compositions.map((function(t){return t.reloadTexture()})))]):[3,2];case 1:e.sent(),this.resumePending=!1,this.handleResume(),e.label=2;case 2:return null===(t=this.ticker)||void 0===t||t.resume(),[2]}}))}))},e.prototype.tick=function(t){this.doTick(t,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},e.prototype.doTick=function(e,r){var i,n,o,a=this;e=Math.min(e,33)*this.speed;var s=this.compositions,u=!1;s.sort((function(t,e){return t.getIndex()-e.getIndex()})),this.compositions=[];for(var l=0;l<s.length;l++){var c=s[l];c.textureOffloaded?(u=!0,lt.error("Composition ".concat(c.name," texture offloaded, skip render.")),this.compositions.push(c)):(!c.isDestroyed&&c.renderer&&c.update(e,!1),c.isDestroyed||this.compositions.push(c))}if(this.baseCompositionIndex=this.compositions.length,u)return null===(i=this.handleRenderError)||void 0===i||i.call(this,new Error("play when texture offloaded")),null===(n=this.ticker)||void 0===n?void 0:n.pause();if(!this.paused||r){var h=this.gpuCapability.level,f=this.renderer.context.gl,p=2===h&&this.reportGPUTime?ae(f):void 0;if(null==p||p.begin(),this.compositions.length||this.compositions.length<s.length||r){this.renderer.setFrameBuffer(null),this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(l=0;l<s.length;l++)!s[l].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(s[l].renderFrame)}null==p||p.end(),null==p||p.getTime().then((function(t){var e;return null===(e=a.reportGPUTime)||void 0===e?void 0:e.call(a,null!=t?t:0)})).catch,this.autoPlaying&&(null===(o=this.handlePlayableUpdate)||void 0===o||o.call(this,{player:this,playing:!0}))}},e.prototype.resizeToAspect=function(t,e){void 0===e&&(e=1),t!==this.displayAspect&&(this.displayAspect=t),e!==this.displayScale&&(this.displayScale=e),this.resize()},e.prototype.resize=function(){var t,e,r,i,n,o=this.canvas.parentElement;if(o){var a=this.getTargetSize(o);e=a[0],r=a[1],i=a[2],n=a[3]}else e=i=this.canvas.width,r=n=this.canvas.height;var s=e/r;if(e&&r){var u=document.documentElement.clientWidth;i>2*u&<.error("DPI overflowed, width ".concat(i," is more than 2x document width ").concat(u,", see ").concat(rl));var l=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>l||n>l)&&(lt.error("Container size overflowed ".concat(i,"x").concat(n,", see ").concat(el)),s>1?(i=Math.round(l),n=Math.round(l/s)):(n=Math.round(l),i=Math.round(l*s))),this.renderer.resize(i,n),this.canvas.style.width=e+"px",this.canvas.style.height=r+"px",lt.info("Resize player ".concat(this.name," [").concat(i,",").concat(n,",").concat(e,",").concat(r,"].")),null===(t=this.compositions)||void 0===t||t.forEach((function(t){t.camera.aspect=s}))}},e.prototype.clearCanvas=function(e){e?this.renderer.clear({stencilAction:t.TextureLoadAction.clear,clearStencil:0,depthAction:t.TextureLoadAction.clear,clearDepth:1,colorAction:t.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},e.prototype.destroyCurrentCompositions=function(){this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},e.prototype.dispose=function(t){var e,r;if(lt.info("call player destroy: ".concat(this.name)),!this.disposed){sl.delete(this.canvas),this.pause(),null===(e=this.ticker)||void 0===e||e.stop(),null===(r=this.assetManager)||void 0===r||r.dispose(),this.compositions.forEach((function(t){return t.dispose()})),this.compositions.length=0,this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.event.dispose(),this.renderer.dispose(!t),fl(this,!1),this.canvas instanceof HTMLCanvasElement&&!t&&this.renderer.context&&(xa.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var i,n=(i=this.name,"Never use destroyed player: ".concat(i," again, see ").concat(ol)),o=function(){return function(t){throw new Error(t)}(n)},a=function(){return t=n,Promise.reject(t);var t};this.tick=o,this.resize=o,this.loadScene=a,this.play=a,this.gotoAndPlay=a,this.gotoAndStop=a,this.playSequence=o,this.destroyCurrentCompositions=o,this.resume=a,this.disposed=!0}},e.prototype.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},e.prototype.getTargetSize=function(t){pl(t);var e,r,i=this.displayAspect;i?t.clientWidth/t.clientHeight>i?e=(r=t.clientHeight*this.displayScale)*i:r=(e=t.clientWidth*this.displayScale)/i:(e=t.clientWidth,r=t.clientHeight);var n=this.pixelRatio,o=e,a=r;if(e=Math.round(e*n),(r=Math.round(r*n))<1||r<1){if(!this.offscreenMode)throw Error("Invalid container size ".concat(e,"x").concat(r,", see ").concat(il));e=r=o=a=1}return[o,a,e,r]},e}();function hl(t){return At(t)&&"scene"in t&&"options"in t}function fl(t,e){Object.keys(Ia).forEach((function(r){var i=Ia[r],n=e?i.onPlayerCreated:i.onPlayerDestroy;null==n||n(t)}))}function pl(t){if(null==t)throw new Error("Container is not an HTMLElement, see ".concat(nl))}Me.create=function(t,e){return new du(t,e)},Me.createWithData=function(e,r,i){void 0===r&&(r=O("#fff")),void 0===i&&(i={});var n=i,o=n.type,a=void 0===o?le.UNSIGNED_BYTE:o,s=n.format,u=void 0===s?le.RGBA:s,l=n.internalFormat,c=n.wrapS,h=void 0===c?le.MIRRORED_REPEAT:c,f=n.wrapT,p=void 0===f?le.MIRRORED_REPEAT:f,d=n.minFilter,m=void 0===d?le.NEAREST:d,y=n.magFilter,v=void 0===y?le.NEAREST:y,g=n.flipY,x=void 0!==g&&g;return new du(e,{data:r,type:a,sourceType:t.TextureSourceType.data,format:u,internalFormat:l||u,wrapS:h,wrapT:p,minFilter:m,magFilter:v,flipY:x})},Xe.create=function(t,e){return new Mu(t,e)},ir.create=function(t,e){return new Su(t,e)},ur.create=function(t,e){return new ur(t,e)},Vr.create=function(t){return new Nu(t)},Yr.create=function(t,e){return new Vu(t,e)},Wr.create=function(t,e,r){return new tl(t,e,r)},cu.create=function(t){return new Fu(t)};var dl="2.0.0-alpha.2";lt.info("player version: "+dl),t.AbstractPlugin=$r,t.ActivationClipPlayable=bn,t.AnimationClipPlayable=En,t.AssetLoader=qr,t.AssetManager=tu,t.BYTES_TYPE_MAP=rr,t.Behaviour=re,t.BezierSegments=Si,t.COMPRESSED_TEXTURE=Xr,t.COPY_FRAGMENT_SHADER=qe,t.COPY_MESH_SHADER_ID=We,t.COPY_VERTEX_SHADER=Ze,t.CalculateLoader=na,t.Camera=ou,t.CameraController=Bi,t.CameraVFXItemLoader=ki,t.Component=ee,t.Composition=su,t.CompositionComponent=au,t.CompositionSourceManager=lu,t.CurveValue=Ci,t.DEFAULT_FONTS=ma,t.Database=Kr,t.Downloader=Ee,t.EFFECTS_COPY_MESH_NAME=Ye,t.EVENT_TYPE_CLICK=Gi,t.EVENT_TYPE_TOUCH_END=ji,t.EVENT_TYPE_TOUCH_MOVE=Hi,t.EVENT_TYPE_TOUCH_START=Xi,t.EffectComponent=Oa,t.EffectsObject=te,t.Engine=cu,t.EventSystem=Wi,t.FILTER_NAME_NONE="none",t.Float16ArrayWrapper=ei,t.FrameBuffer=Yr,t.GLEngine=Fu,t.GLGeometry=Su,t.GLRenderer=tl,t.GPUCapability=Ur,t.Geometry=ir,t.GlobalUniforms=Dr,t.GradientValue=bi,t.HELP_LINK=Ji,t.InteractBehavior=Yi,t.InteractComponent=en,t.InteractLoader=qi,t.InteractMesh=tn,t.ItemBehaviour=ie,t.KTXTexture=Ie,t.LineSegments=_i,t.LinearValue=Ei,t.Material=Xe,t.MaterialDataBlock=ze,t.Mesh=ur,t.PLAYER_OPTIONS_ENV_EDITOR=Qi,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleBehaviourPlayable=ia,t.ParticleLoader=jn,t.ParticleMesh=Pn,t.ParticleSystem=Ho,t.ParticleSystemRenderer=Xo,t.PassTextureCache=tr,t.PathSegments=Ai,t.Player=cl,t.PluginSystem=Wa,t.QCanvasViewer=ca,t.QText=la,t.RENDER_PASS_NAME_PREFIX=Lr,t.RENDER_PREFER_LOOKUP_TEXTURE=wn,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=gi,t.RandomValue=xi,t.RandomVectorValue=Ti,t.RenderBuffer=Vr,t.RenderFrame=Pr,t.RenderPass=pr,t.RenderPassPriorityNormal=lr,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=hr,t.Renderer=Wr,t.RendererComponent=ne,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",t.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",t.SPRITE_VERTEX_STRIDE=Ki,t.SemanticMap=er,t.SerializationHelper=Zr,t.Shader=je,t.SpriteColorPlayable=Rn,t.SpriteComponent=On,t.SpriteLoader=cn,t.StaticValue=vi,t.TEMPLATE_USE_OFFSCREEN_CANVAS=Mn,t.TextComponent=Aa,t.TextLoader=Sa,t.Texture=Me,t.TextureFactory=Ne,t.Ticker=hu,t.TimelineClip=mn,t.TimelineComponent=Cn,t.Track=dn,t.Transform=Ui,t.VFXItem=Ma,t.ValueGetter=yi,t.addByOrder=L,t.addItem=v,t.addItemWithOrder=function(t,e,r,i){if(void 0===i&&(i=!1),!t.includes(e)&&(t.push(e),1!==t.length)){var n=t.length-1;if(n){var o=t[n];if(i)for(;t[n-1][r]<o[r]&&(t[n]=t[n-1],0!=--n););else for(;t[n-1][r]>o[r]&&(t[n]=t[n-1],0!=--n););t[n]=o}}},t.alphaFrameFrag="uniform vec4 uTexRange;uniform vec2 uFilterSourceSize;\n#define INTERPOLATION 0\nvec4 filterMain(vec2 texCoord,sampler2D source){float x=uTexRange.x+texCoord.x*uTexRange.y;\n#if 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));vec4 color=mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nvec4 color=texture2D(source,vec2(x,texCoord.y));\n#endif\nx=uTexRange.z+texCoord.x*uTexRange.w;vec4 opacity=texture2D(source,vec2(x,texCoord.y));return vec4(color.rgb,opacity.r);}",t.alphaMaskFrag="uniform sampler2D uAlphaXSample;uniform sampler2D uAlphaYSample;vec4 filterMain(vec2 texCoord,sampler2D source){vec4 color=texture2D(source,texCoord);float x=texture2D(uAlphaXSample,vec2(vFeatherCoord.x,0.)).r;float y=texture2D(uAlphaYSample,vec2(vFeatherCoord.y,0.)).r;return vec4(color.rgb,color.a*min(x,y));}",t.assertExist=F,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)},t.blend="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;}",t.bloomMixVert="uniform sampler2D uBloomBlur;uniform vec4 uBloomParams;vec4 filterMain(vec2 coord,sampler2D tex){const vec3 gamma=vec3(1./2.2);vec4 c1=texture2D(tex,coord);vec4 bloomColor=texture2D(uBloomBlur,coord);float alpha=max(c1.a,bloomColor.a);vec3 color=max(c1.rgb*c1.a,bloomColor.rgb*bloomColor.a)/alpha*uBloomParams.y+bloomColor.rgb*uBloomParams.x;return vec4(color,alpha);}",t.bloomThresholdVert="uniform vec4 uColorThreshold;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);vec3 color=c1.rgb*c1.a;vec3 s=step(uColorThreshold.xyz,color);float m=min(s.r+s.g+s.b,1.);return c1*m;}",t.calculateTranslation=oi,t.cameraMoveFrag="uniform vec2 uMoveTexSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uMoveTexSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uMoveTexSize,(coordMin+vec2(1.))/uMoveTexSize);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));vec4 cB=mix(cLB,cRB,pp.x);vec4 cT=mix(cLT,cRT,pp.x);return mix(cB,cT,pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}",t.cameraMoveVert="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",t.canvasPool=xa,t.colorGradingFrag=Er,t.colorStopsFromGradient=b,t.colorToArr=T,t.combineImageTemplate=_a,t.combineImageTemplate1=fa,t.combineImageTemplate1Async=function(t,e,r,i,n){return o(this,void 0,void 0,(function(){return a(this,(function(o){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,fa(t,e,r,i,n)]}))}))},t.combineImageTemplate2=Ca,t.combineImageTemplate2Async=function(t,e,r,i,n){return o(this,void 0,void 0,(function(){return a(this,(function(o){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,Ca(t,e,r,i,n)]}))}))},t.combineImageTemplateAsync=function(t,e,r,i,n){return o(this,void 0,void 0,(function(){return a(this,(function(o){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,_a(t,e,r,i,n)]}))}))},t.compatibleFrag="#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\n",t.compatibleVert="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n",t.copyFrag=He,t.createCopyShader=Ke,t.createGLContext=oe,t.createKeyFrameMeta=Ni,t.createShaderWithMarcos=ve,t.createShape=so,t.createVFXItem=La,t.createValueGetter=Oi,t.deepClone=function t(e){if(Ct(e))return e.map(t);if(e&&"object"==typeof e){if(ArrayBuffer.isView(e))return e.slice();for(var r={},i=Object.keys(e),n=0;n<i.length;n++){var o=i[n];r[o]=t(e[o])}return r}return e},t.defaultGlobalVolume=Mr,t.defaultPlugins=Pa,t.delayFrag="uniform sampler2D uLastSource;uniform vec4 uParams;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);if(uParams.x<1.){return c1;}vec4 c2=texture2D(uLastSource,coord);return mix(c1,c2,uParams.y);}",t.deserializeMipmapTexture=Re,t.disableAllPlayer=function(t){ul=!!t},t.distortionFrag="uniform vec4 uWaveParams;\n#ifdef PATICLE_SHADER\nin vec4 vWaveParams;\n#else\nuniform vec4 vWaveParams;\n#endif\nvec4 filterMain(vec2 texCoord,sampler2D tex){vec2 vp=texCoord-uWaveParams.xy;float xx=dot(vp,uWaveParams.zw);float d=sin(vWaveParams.x*xx+vWaveParams.y)*vWaveParams.z;vec2 up=vec2(-uWaveParams.w,uWaveParams.z)*d;return texture2D(tex,clamp(texCoord+up,0.,1.));}",t.distortionVert="uniform vec4 uMovementValue;uniform vec4 uStrengthValue;uniform vec4 uPeriodValue;out vec4 vWaveParams;void filterMain(float lifetime){const float pi2=3.14159265;vWaveParams=vec4(getValueFromTime(lifetime,uPeriodValue)*pi2,getValueFromTime(lifetime,uMovementValue)*pi2,getValueFromTime(lifetime,uStrengthValue),0.);}",t.earcut=Lo,t.effectsClass=Jt,t.effectsClassStore=Wt,t.enlargeBuffer=x,t.ensureVec3=ai,t.findPreviousRenderPass=function(t,e){var r=t.indexOf(e);return t[r-1]},t.gaussianDownFrag="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=5/2;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec4 mainColor=texture2D(_MainTex,uv);vec3 color=mainColor.rgb;color=GaussNxN(_MainTex,uv,1.0/_TextureSize,1.0);gl_FragColor=vec4(color,1.0);}",t.gaussianDownHFrag=br,t.gaussianDownVFrag=Cr,t.gaussianUpFrag=_r,t.generateEmptyTypedArray=nr,t.generateGUID=Ot,t.generateHalfFloatTexture=Le,t.getActivePlayers=function(){return Array.from(sl.values())},t.getBackgroundImage=Ta,t.getColorFromGradientStops=E,t.getConfig=In,t.getDefaultTemplateCanvasPool=function(){return xa},t.getDefaultTextureFactory=De,t.getGeometryByShape=Vo,t.getGeometryTriangles=Do,t.getImageItemRenderInfo=on,t.getKTXTextureOptions=Pe,t.getKeyFrameMetaByRawValue=Fi,t.getMergedStore=Kt,t.getParticleMeshShader=Dn,t.getPixelRatio=A,t.getPlayerByCanvas=function(t){return sl.get(t)},t.getPreMultiAlpha=pe,t.getStandardComposition=Hs,t.getStandardImage=Xs,t.getStandardItem=Zs,t.getStandardJSON=ks,t.getTextureSize=Fr,t.glContext=le,t.gpuTimer=ae,t.imageDataFromColor=O,t.imageDataFromGradient=w,t.initErrors=ue,t.initGLContext=ce,t.integrate="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.;}",t.interpolateColor=C,t.isAndroid=S,t.isArray=Ct,t.isCanvasUsedByPlayer=function(t){return sl.has(t)},t.isFunction=_t,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=At,t.isScene=Qs,t.isSceneWithOptions=hl,t.isSimulatorCellPhone=R,t.isString=ht,t.isUniformStruct=Ue,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&Ue(t[0])},t.isWebGL2=he,t.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",t.itemFrag=yr,t.itemFrameFrag=dr,t.itemVert=mr,t.loadBinary=Ae,t.loadBlob=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){return[2,new Promise((function(e,r){(new Ee).downloadBlob(t,e,(function(e,i){r("Couldn't load blob ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))},t.loadImage=_e,t.loadVideo=Se,t.loadWebPOptional=Ce,t.logger=lt,t.math=nt,t.modifyMaxKeyframeShader=Vn,t.nearestPowerOfTwo=fi,t.noop=ct,t.parsePercent=_,t.particleFrag=vr,t.particleOriginTranslateMap=hi,t.particleVert=gr,t.pluginLoaderMap=Ia,t.random=St,t.registerPlugin=Na,t.removeItem=g,t.requestAsync=ha,t.rotateVec2=zo,t.screenMeshVert=Tr,t.serialize=Qt,t.setBlendMode=ge,t.setConfig=function(t,e){return Ln[t]=e},t.setDefaultTextureFactory=function(t){Fe=t},t.setMaskMode=Te,t.setMaxSpriteMeshItemCount=function(e){t.maxSpriteMeshItemCount=e},t.setRayFromCamera=pi,t.setSideMode=xe,t.setSpriteMeshMaxFragmentTextures=function(e){t.maxSpriteTextureCount=e},t.setSpriteMeshMaxItemCountByGPU=nn,t.sortByOrder=M,t.spec=Yt,t.spriteMeshShaderFromFilter=an,t.spriteMeshShaderFromRenderInfo=un,t.spriteMeshShaderIdFromRenderInfo=sn,t.thresholdFrag=Ar,t.throwDestroyedError=Rt,t.trailVert=xr,t.translatePoint=function(t,e){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=t,r[i+1]+=e;return r},t.trianglesFromRect=di,t.unregisterPlugin=function(t){delete Fa[t],delete Ia[t],g(Pa,t)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#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.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecAssign=ui,t.vecFill=si,t.vecMulCombine=li,t.vecNormalize=function(t,e){1===arguments.length&&(e=t,t=[]);var r=e,i=Math.hypot.apply(Math,l([],u(r),!1));if(0===i)return ui(t,r,r.length);for(var n=0;n<r.length;n++)t[n]=r[n]/i;return t},t.version=dl,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
21
21
|
//# sourceMappingURL=index.min.js.map
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime player for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version: v2.0.0-alpha.
|
|
6
|
+
* Version: v2.0.0-alpha.2
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
@@ -31114,7 +31114,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31114
31114
|
Engine.create = function (gl) {
|
|
31115
31115
|
return new GLEngine(gl);
|
|
31116
31116
|
};
|
|
31117
|
-
var version = "2.0.0-alpha.
|
|
31117
|
+
var version = "2.0.0-alpha.2";
|
|
31118
31118
|
logger.info('player version: ' + version);
|
|
31119
31119
|
|
|
31120
31120
|
export { AbstractPlugin, ActivationClipPlayable, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierSegments, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, CurveValue, DEFAULT_FONTS, DataType, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FILTER_NAME_NONE, FilterMode, Float16ArrayWrapper, FrameBuffer, GLEngine, GLGeometry, GLRenderer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK$1 as HELP_LINK, HitTestType, InteractBehavior$1 as InteractBehavior, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, Player, PluginSystem, QCanvasViewer, QText, QTextWrapMode, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderBuffer, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderer, RendererComponent, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, SpriteColorPlayable, SpriteComponent, SpriteLoader, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineClip, TimelineComponent, Track, Transform, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, alphaFrame_frag as alphaFrameFrag, alphaMask_frag as alphaMaskFrag, assertExist, asserts, blend, bloomMix_frag as bloomMixVert, bloomThreshold_frag as bloomThresholdVert, calculateTranslation, cameraMove_frag as cameraMoveFrag, cameraMove_vert as cameraMoveVert, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, combineImageTemplate1, combineImageTemplate1Async, combineImageTemplate2, combineImageTemplate2Async, combineImageTemplateAsync, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, copy as copyFrag, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, deepClone, defaultGlobalVolume, defaultPlugins, delay_frag as delayFrag, deserializeMipmapTexture, disableAllPlayer, distortion_frag as distortionFrag, distortion_vert as distortionVert, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, getActivePlayers, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPlayerByCanvas, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAndroid, isArray, isCanvasUsedByPlayer, isFunction, isIOS, isObject, isScene, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isWebGL2, item_define as itemDefine, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadVideo, loadWebPOptional, logger, index$1 as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap, particleVert, pluginLoaderMap, random, registerPlugin, removeItem, requestAsync, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, sortByOrder, index as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError$1 as throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version };
|
package/dist/weapp.js
CHANGED
|
@@ -31112,7 +31112,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31112
31112
|
Engine.create = function (gl) {
|
|
31113
31113
|
return new GLEngine(gl);
|
|
31114
31114
|
};
|
|
31115
|
-
var version = "2.0.0-alpha.
|
|
31115
|
+
var version = "2.0.0-alpha.2";
|
|
31116
31116
|
logger.info('player version: ' + version);
|
|
31117
31117
|
|
|
31118
31118
|
exports.AbstractPlugin = AbstractPlugin;
|
package/dist/weapp.mjs
CHANGED
|
@@ -31108,7 +31108,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31108
31108
|
Engine.create = function (gl) {
|
|
31109
31109
|
return new GLEngine(gl);
|
|
31110
31110
|
};
|
|
31111
|
-
var version = "2.0.0-alpha.
|
|
31111
|
+
var version = "2.0.0-alpha.2";
|
|
31112
31112
|
logger.info('player version: ' + version);
|
|
31113
31113
|
|
|
31114
31114
|
export { AbstractPlugin, ActivationClipPlayable, AnimationClipPlayable, AssetLoader, AssetManager, BYTES_TYPE_MAP, Behaviour, BezierSegments, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateLoader, Camera, CameraController, CameraVFXItemLoader, Component, Composition, CompositionComponent, CompositionSourceManager, CurveValue, DEFAULT_FONTS, DataType, Database, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, EffectComponent, EffectsObject, Engine, EventSystem, FILTER_NAME_NONE, FilterMode, Float16ArrayWrapper, FrameBuffer, GLEngine, GLGeometry, GLRenderer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK$1 as HELP_LINK, HitTestType, InteractBehavior$1 as InteractBehavior, InteractComponent, InteractLoader, InteractMesh, Item, ItemBehaviour, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleBehaviourPlayable, ParticleLoader, ParticleMesh, ParticleSystem, ParticleSystemRenderer, PassTextureCache, PathSegments, Player, PluginSystem, QCanvasViewer, QText, QTextWrapMode, RENDER_PASS_NAME_PREFIX, RENDER_PREFER_LOOKUP_TEXTURE, RUNTIME_ENV, RandomSetValue, RandomValue, RandomVectorValue, RenderBuffer, RenderFrame, RenderPass, RenderPassAttachmentStorageType, RenderPassDestroyAttachmentType, RenderPassPriorityNormal, RenderPassPriorityPostprocess, RenderPassPriorityPrepare, RenderTargetHandle, RenderTextureFormat, Renderer, RendererComponent, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0, SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0, SEMANTIC_PRE_COLOR_ATTACHMENT_0, SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0, SPRITE_VERTEX_STRIDE, SemanticMap, SerializationHelper, Shader, ShaderCompileResultStatus, ShaderType, SpriteColorPlayable, SpriteComponent, SpriteLoader, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TextComponent, TextLoader, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineClip, TimelineComponent, Track, Transform, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, alphaFrame_frag as alphaFrameFrag, alphaMask_frag as alphaMaskFrag, assertExist, asserts, blend, bloomMix_frag as bloomMixVert, bloomThreshold_frag as bloomThresholdVert, calculateTranslation, cameraMove_frag as cameraMoveFrag, cameraMove_vert as cameraMoveVert, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, combineImageTemplate1, combineImageTemplate1Async, combineImageTemplate2, combineImageTemplate2Async, combineImageTemplateAsync, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, copy as copyFrag, createCopyShader, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, deepClone, defaultGlobalVolume, defaultPlugins, delay_frag as delayFrag, deserializeMipmapTexture, disableAllPlayer, distortion_frag as distortionFrag, distortion_vert as distortionVert, earcut, effectsClass, effectsClassStore, enlargeBuffer, ensureVec3, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateGUID, generateHalfFloatTexture, getActivePlayers, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getMergedStore, getParticleMeshShader, getPixelRatio, getPlayerByCanvas, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAndroid, isArray, isCanvasUsedByPlayer, isFunction, isIOS, isObject, isScene, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isWebGL2, item_define as itemDefine, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadVideo, loadWebPOptional, logger, index$1 as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap, particleVert, pluginLoaderMap, random, registerPlugin, removeItem, requestAsync, rotateVec2, screenMeshVert, serialize, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, sortByOrder, index as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError$1 as throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/effects",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"description": "Galacean Effects runtime player for the web",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"registry": "https://registry.npmjs.org"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@galacean/effects-core": "2.0.0-alpha.
|
|
59
|
-
"@galacean/effects-webgl": "2.0.0-alpha.
|
|
58
|
+
"@galacean/effects-core": "2.0.0-alpha.2",
|
|
59
|
+
"@galacean/effects-webgl": "2.0.0-alpha.2"
|
|
60
60
|
},
|
|
61
61
|
"scripts": {
|
|
62
62
|
"prebuild": "pnpm clean",
|