@galacean/effects 1.6.9 → 1.6.10
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/alipay.js +1 -1
- package/dist/alipay.mjs +1 -1
- 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/alipay.js
CHANGED
|
@@ -31038,7 +31038,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31038
31038
|
Engine.create = function (gl) {
|
|
31039
31039
|
return new GLEngine(gl);
|
|
31040
31040
|
};
|
|
31041
|
-
var version = "1.6.
|
|
31041
|
+
var version = "1.6.10";
|
|
31042
31042
|
logger.info('player version: ' + version);
|
|
31043
31043
|
|
|
31044
31044
|
exports.AbstractPlugin = AbstractPlugin;
|
package/dist/alipay.mjs
CHANGED
|
@@ -31034,7 +31034,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31034
31034
|
Engine.create = function (gl) {
|
|
31035
31035
|
return new GLEngine(gl);
|
|
31036
31036
|
};
|
|
31037
|
-
var version = "1.6.
|
|
31037
|
+
var version = "1.6.10";
|
|
31038
31038
|
logger.info('player version: ' + version);
|
|
31039
31039
|
|
|
31040
31040
|
export { AbstractPlugin, AssetManager, BYTES_TYPE_MAP, BezierCurve, BezierCurvePath, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateItem, CalculateLoader, CalculateVFXItem, Camera, CameraController, CameraVFXItem, CameraVFXItemLoader, Composition, CompositionSourceManager, DEFAULT_FONTS, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, Engine, EventSystem, FILTER_NAME_NONE, FilterMode, FilterSpriteVFXItem, Float16ArrayWrapper, FrameBuffer, GLEngine, GLGeometry, GLRenderer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK$1 as HELP_LINK, HitTestType, InteractBehavior$1 as InteractBehavior, InteractItem, InteractLoader, InteractMesh, InteractVFXItem, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleLoader, ParticleMesh, ParticleSystem, ParticleVFXItem, PassTextureCache, 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, 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, Shader, ShaderCompileResultStatus, ShaderType, SpriteItem, SpriteLoader, SpriteMesh, SpriteVFXItem, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TextItem, TextLoader, TextMesh, TextVFXItem, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineComponent, Transform, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, alphaFrameFrag, alphaMaskFrag, assertExist, asserts, blend, bloomMixVert, bloomThresholdVert, calculateTranslation, cameraMove_frag as cameraMoveFrag, cameraMoveVert, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, combineImageTemplate1, combineImageTemplate1Async, combineImageTemplate2, combineImageTemplate2Async, combineImageTemplateAsync, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, convertAnchor, copyFrag, createCopyShader, createFilter, createFilterShaders, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual, deepClone, defaultGlobalVolume, defaultPlugins, delayFrag, deserializeMipmapTexture, disableAllPlayer, distortionFrag, distortionVert, earcut, enlargeBuffer, ensureVec3, filters, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateHalfFloatTexture, getActivePlayers, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getParticleMeshShader, getPixelRatio, getPlayerByCanvas, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvasUsedByPlayer, isFunction, isIOS, isObject, isScene, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, random, registerFilter, registerFilters, registerPlugin, removeItem, requestAsync, rotateVec2, screenMeshVert, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 as spec, spriteMeshShaderFromFilter, spriteMeshShaderFromRenderInfo, spriteMeshShaderIdFromRenderInfo, thresholdFrag, throwDestroyedError$1 as throwDestroyedError, trailVert, translatePoint, trianglesFromRect, unregisterPlugin, valIfUndefined, value, valueDefine, vecAssign, vecFill, vecMulCombine, vecNormalize, version };
|
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: v1.6.
|
|
6
|
+
* Version: v1.6.10
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
@@ -31044,7 +31044,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31044
31044
|
Engine.create = function (gl) {
|
|
31045
31045
|
return new GLEngine(gl);
|
|
31046
31046
|
};
|
|
31047
|
-
var version = "1.6.
|
|
31047
|
+
var version = "1.6.10";
|
|
31048
31048
|
logger.info('player version: ' + version);
|
|
31049
31049
|
|
|
31050
31050
|
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: v1.6.
|
|
6
|
+
* Version: v1.6.10
|
|
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){return new(r||(r=Promise))((function(n,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(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(s,a)}u((i=i.apply(t,e||[])).next())}))}function o(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(u){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(r=1,i&&(n=2&a[0]?i.return:a[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,a[1])).done)return n;switch(i=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){s.label=a[1];break}if(6===a[0]&&s.label<n[1]){s.label=n[1],n=a;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(a);break}n[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],i=0}finally{r=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,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 a(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)s.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 s}function u(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var l=6,c="editor",h="none",f={"Filter not imported":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg","Item duration can't be less than 0":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"};function p(t,e,r){var i;if(void 0===e&&(e="webgl"),"webgl2"===e&&((i=t.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),i&&"webgl"!==e||(i=t.getContext("webgl",r)),!i)throw new Error("This browser does not support WebGL or the WebGL version is incorrect. Please check your WebGL version.");return i}function d(t){var e=this,r=t.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var i=t.createQuery(),s=function(){return n(e,void 0,void 0,(function(){return o(this,(function(e){return[2,new Promise((function(e,n){if(i){var o=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),a=t.getParameter(r.GPU_DISJOINT_EXT);if(o&&!a){var u=t.getQueryParameter(i,t.QUERY_RESULT);e(u/1e3/1e3)}(o||a)&&(t.deleteQuery(i),i=null),null!==o&&i&&window.setTimeout((function(){s().then(e).catch}),1)}}))]}))}))};if(!i)return;return{begin:function(){i&&t.beginQuery(r.TIME_ELAPSED_EXT,i)},end:function(){t.endQuery(r.TIME_ELAPSED_EXT)},getTime:s}}}var m=[],v={};function y(){"function"==typeof WebGL2RenderingContext?x(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(x(WebGLRenderingContext),x(WebGLRenderingContext.prototype)):m.push("iOS16 lockdown mode, WebGL Constants not in global"),m.length||"HALF_FLOAT"in v||(v.HALF_FLOAT=5131)}function g(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name}function x(t){for(var e in t)/^[A-Z_]/.test(e)&&(v[e]=t[e])}m.length||y();var T,E,b,S,A,R,C,_,w,O,M,L,I={},P={};function F(t,e,r){t in I&&console.error("Filter ".concat(t," registered twice.")),I[t]=e,P[t]=r}function V(t){Object.keys(t).forEach((function(e){var r=a(t[e],2);F(e,r[0],r[1])}))}function N(t){var e=P[t.name];if(!e)throw Error("Filter ".concat(t.name," not imported, see ").concat(f["Filter not imported"]));return e(t)}function D(t,e){var r=I[t.name];if(!r)throw Error("Filter ".concat(t.name," not imported, see ").concat(f["Filter not imported"]));var i=r(t,e);return i.passSplitOptions||(i.passSplitOptions={attachments:[{texture:{format:v.RGBA}}]}),i}function z(t,e){return t.includes(e)||t.push(e),t}function B(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function U(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}}}function k(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),s=new t.constructor(o);return s.set(t),s}return t}function G(t,e){var r=[0,0,0,0];if(tr(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 X(t,e,r){if(t.length){for(var i=void 0,n=1;n<=t.length-1;n++){var o=t[n-1],s=t[n];if(o.stop<=e&&e<=s.stop){i=Y(o.color,s.color,(e-o.stop)/(s.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 H(t){var e=[];if(t instanceof Array?t.forEach((function(t){var r=a(t,5),i=r[0],n=r[1],o=r[2],s=r[3],u=r[4];e.push({stop:j(i),color:[n,o,s,u]})})):Object.keys(t).forEach((function(r){var i=G(t[r]);e.push({stop:j(r),color:i})})),(e=e.sort((function(t,e){return t.stop-e.stop}))).length){0!==e[0].stop&&e.unshift({stop:0,color:e[0].color.slice()});var r=e[e.length-1];1!==r.stop&&e.push({stop:1,color:r.color.slice()})}return e}function Y(t,e,r,i){var n=[],o=1-r;if(i)for(var s=0;s<4;s++)n[s]=t[s]*o+e[s]*r;else{for(s=0;s<3;s++)n[s]=Math.round(Math.sqrt(t[s]*t[s]*o+e[s]*e[s]*r));n[3]=Math.round(t[3]*o+e[3]*r)}return n}function j(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function W(){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 Z(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function q(){return Z()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function K(t){tr(t)&&(t=G(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 Q(t){var e=128,r={width:e,height:1,data:new Uint8Array(512)},i=r.data,n=H(t);if(n.length){i.set(n[0].color,0);for(var o=1;o<127;o++){for(var s=o/e,a=void 0,u=void 0,l=0;l<n.length&&(a=n[l],u=n[l+1],!(a.stop<=s&&u.stop>s));l++);var c=Y(a.color,u.color,(s-a.stop)/(u.stop-a.stop));i.set(c,4*o)}i.set(n[n.length-1].color,508)}return r}function J(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++)tt(e,n,r);return e}return et(e,r)}function $(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&&tt(e,e.length-1,i),e)}function tt(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 et(e,r,i,n){var o,s;if(void 0===i&&(i=0),void 0===n&&(n=e.length-1),i>=n)return e;for(var u=e[i],l=i,c=n;l<c;){if(r===t.OrderType.ascending){for(;e[c].priority>u.priority&&c>=l;)c--;for(;e[l].priority<=u.priority&&l<c;)l++}else{for(;e[c].priority<u.priority&&c>=l;)c--;for(;e[l].priority>=u.priority&&l<c;)l++}o=a([e[c],e[l]],2),e[l]=o[0],e[c]=o[1]}return s=a([e[l],e[i]],2),e[i]=s[0],e[l]=s[1],et(e,r,i,l-1),et(e,r,c+1,n),e}function rt(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}function it(t){return/^[^\d.][\w-]*$/.test(t)}
|
|
9
9
|
/*!
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
* Description: Galacean Effects JSON Specification
|
|
18
18
|
* Author: Ant Group CO., Ltd.
|
|
19
19
|
* Version: v1.3.0
|
|
20
|
-
*/!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(ua||(ua={})),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"}(la||(la={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(ca||(ca={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(ha||(ha={})),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"}(fa||(fa={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(pa||(pa={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(da||(da={})),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"}(ma||(ma={})),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"}(va||(va={})),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"}(ya||(ya={})),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"}(ga||(ga={}));var Ta,Ea,ba,Sa,Aa,Ra,Ca,_a,wa,Oa,Ma,La,Ia,Pa,Fa,Va,Na,Da,za=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=za]="landscape"}(Ta||(Ta={})),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"}(Ea||(Ea={})),function(t){t.video="video",t.image="image"}(ba||(ba={})),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"}(Sa||(Sa={})),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"}(Aa||(Aa={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(Ra||(Ra={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(Ca||(Ca={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(_a||(_a={})),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"}(wa||(wa={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Oa||(Oa={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Ma||(Ma={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(La||(La={})),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"}(Ia||(Ia={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(Pa||(Pa={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Fa||(Fa={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(Va||(Va={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Na||(Na={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Da||(Da={}));var Ba=function(){return Ba=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},Ba.apply(this,arguments)};function Ua(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 ka(t,e){if(!t.includes(e))return t.push(e),!0}function Ga(t,e,r){if(t)for(var i in t)Object.hasOwnProperty.call(t,i)&&e.call(r,t[i],i);return t}function Xa(t){if(Number.isFinite(t))return[Sa.CONSTANT,t];if(t){var e=t[0],r=t[1];if(Array.isArray(e))return;if("static"===e||e===Sa.CONSTANT)return[Sa.CONSTANT,t[1]];if("lines"===e)return[Sa.LINE,t[1]];if(e===Sa.LINE){var i=r.map((function(t){return[Aa.LINE,t]}));return[Sa.BEZIER_CURVE,i]}return"curve"===e||e===Sa.CURVE?[Sa.BEZIER_CURVE,ou(r)]:t}}function Ha(t,e){return Array.isArray(t)&&"random"===t[0]?[Sa.CONSTANT,t[1][e]]:Xa(t)}function Ya(t){return t&&"color"===t[0]?qa(t[1],!0):[1,1,1,1]}function ja(t,e){if(t)return"colors"===t[0]?[Sa.COLORS,t[1].map((function(t){return qa(t,e)}))]:"gradient"===t[0]?Za(t[1],e):"color"===t[0]?[Sa.RGBA_COLOR,qa(t[1],e)]:t}function Wa(t){return t&&"random"===t[0]?[Sa.RANDOM,t[1]]:Xa(t)}function Za(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=qa(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]})),[Sa.GRADIENT_COLOR,r]}}function qa(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 Ka(t,e){return Array.isArray(t)?t[0]===Sa.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Za(t[1],e):Za(t,e)}function Qa(t){if(t){if(3===t.length)return[Sa.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===Sa.BEZIER_PATH||e===Sa.LINEAR_PATH){var r=t[1],i=r[0],n=r[1],o=r[2],s=ou(i);if(!o){o=[];for(var a=0;a<n.length;a++){var u=n[a].slice();0===a?o.push(u):a<n.length-1?(o.push(u),o.push(u)):o.push(u)}}return[Sa.BEZIER_CURVE_PATH,[s,n,o]]}return t}}function Ja(t){var e,r;try{for(var i=Ua(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 $a(t){var e,r;try{for(var i=Ua(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 tu=Math.cos,eu=Math.sin,ru=Math.PI/180,iu=180/Math.PI;function nu(t,e,r,i){var n=r[0],o=r[1],s=i[0],a=s-n;return[[n+(s-n)/3,o+(t*=a)/3],[s-(s-n)/3,i[1]-(e*=a)/3]]}function ou(t){for(var e=-1e6,r=1e6,i=0;i<t.length;i++)e=Math.max(e,t[i][1]),r=Math.min(r,t[i][1]);var n=[[t[0][0],t[0][1]]];for(i=0;i<t.length-1;i++){var o=t[i][3]*(e-r),s=t[i+1][2]*(e-r),a=[t[i][0],t[i][1]],u=[t[i+1][0],t[i+1][1]];if(a[0]!=u[0]){var l=nu(o,s,a,u),c=l[0],h=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([h[0],h[1],u[0],u[1]])}else n[n.length-1].push(u[0]),n[n.length-1].push(u[1])}return n.map((function(t,e){return 0===e?[Aa.EASE_OUT,t]:e===n.length-1?[Aa.EASE_IN,t]:[Aa.EASE,t]}))}function su(t){var e,r=t.options,i=t.transform,n={type:fa.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=Ba(Ba({},t.shape),{type:fa[o]}),t.shape.upDirection){var s=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)s.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 s}(t.shape.upDirection,3),a=s[0],u=s[1],l=s[2];0===a&&0===u&&0===l&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=Wa(r.turbulenceX),n.turbulenceY=Wa(r.turbulenceY),n.turbulenceZ=Wa(r.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map((function(t){return Ja(t)}))),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map((function(t){return Ja(t)}))),c.rateOverTime&&(c.rateOverTime=Wa(c.rateOverTime));var h={renderer:t.renderer,shape:n,splits:t.splits,emission:c,options:{startLifetime:Wa(r.startLifetime),start3DSize:!!r.start3DSize,startSize:Wa(r.startSize),startSizeX:Wa(r.startSizeX),startSizeY:Wa(r.startSizeY),sizeAspect:Wa(r.sizeAspect),maxCount:r.maxCount,startDelay:Wa(r.startDelay),startColor:ja(r.startColor,!0),startRotationZ:Wa(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(h.options.startRotationX=Wa(r.startRotationX),h.options.startRotationY=Wa(r.startRotationY)),t.filter){var f={};Ga(t.filter,(function(t,e){var r;f[e]=(r=t,Array.isArray(r)&&"string"==typeof r[0]&&(Wa(r)||Qa(r)||ja(r))||r)})),h.filter=f}i&&i.path&&(h.emitterTransform={path:Qa(i.path)});var p=t.sizeOverLifetime;p&&(p.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:Wa(p.x),y:Wa(p.y)}:h.sizeOverLifetime={size:Wa(p.size)});var d=t.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?Xa(m):void 0,h.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:Xa(r.gravityModifier),startSpeed:Wa(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:Wa(d.linearX),linearY:Wa(d.linearY),linearZ:Wa(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Wa(d.orbitalX),orbitalY:Wa(d.orbitalY),orbitalZ:Wa(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Xa(d.forceCurve)},$a(h.positionOverLifetime);var v=t.rotationOverLifetime;v&&(h.rotationOverLifetime={separateAxes:v.separateAxes,asRotation:v.asRotation,z:Wa(v.separateAxes?v.z:v.angularVelocity)},v.separateAxes&&(h.rotationOverLifetime.y=Xa(v.y),h.rotationOverLifetime.x=Xa(v.x)));var y=t.colorOverLifetime;if(y){var g=h.colorOverLifetime={opacity:Xa(y.opacity)};y.color&&(g.color=Ka(y.color))}var x=t.textureSheetAnimation;x&&(h.textureSheetAnimation={row:x.row,col:x.col,total:x.total,animate:x.animate,cycles:Xa(x.cycles),animationDelay:Ha(x.animationDelay,0),animationDuration:Ha(x.animationDuration,0)});var T=t.trails;T&&(h.trails={lifetime:Wa(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:Xa(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&Ka(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&Ka(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:Wa(T.opacityOverLifetime)}),h.trails&&$a(h.trails);var E=t.interaction;return E&&(h.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),h}function au(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:Qa(null===(r=t.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:Xa(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:Xa(n.linearX),linearY:Xa(n.linearY),linearZ:Xa(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Xa(n.orbitalX),orbitalY:Xa(n.orbitalY),orbitalZ:Xa(n.orbitalZ),speedOverLifetime:Xa(n.speedOverLifetime)};$a(o);var s={options:{startColor:Ya(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 a=t.rotationOverLifetime;if(a){var u=s.rotationOverLifetime={separateAxes:a.separateAxes,asRotation:a.asRotation};u.separateAxes?(u.x=Xa(a.x),u.y=Xa(a.y),u.z=Xa(a.z)):u.z=Xa(a.angularVelocity)}var l=t.colorOverLifetime;if(l){var c=s.colorOverLifetime={opacity:Xa(l.opacity)};l.color&&(c.color=Ka(l.color))}var h=t.sizeOverLifetime;return h&&(s.sizeOverLifetime={separateAxes:h.separateAxes,size:Xa(h.size),x:Xa(h.x),y:Xa(h.y),z:Xa(h.z)}),s}function uu(t,e){var r=au(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 lu=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],cu=["path","position"];function hu(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===va.null&&t.endBehavior===Ra.destroy&&(t.endBehavior=Ra.freeze)}))})),t.version="2.1",t}function fu(t){var e,r;if(t)try{for(var i=Ua(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value,s=t[o],a=Array.isArray(s);a&&2===s.length&&Array.isArray(s[1])?t[o]="path"===o?Qa(s):Xa(s):a||"object"!=typeof s||fu(s)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}var pu=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,du=/^(\d+)\.(\d+)$/,mu=!1;function vu(t){var e;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!==va.mesh&&t.type!==va.light||(t.endBehavior=1===t.endBehavior?Ra.destroy:t.endBehavior)}))}))}(t),pu.test(t.version))return mu="0"===(null===(e=/^(\d+)/.exec(t.version))||void 0===e?void 0:e[0]),hu(function(t){var e,r;yu="1.0";var i=t.plugins||[];(null===(e=t.bins)||void 0===e?void 0:e.length)&&(yu="1.3");var n=(t.requires||[]).slice(),o=t.images.map((function(e,r){return gu(e,r,t.imageTags||[])})),s=t.textures||o.map((function(t,e){return{source:e,flipY:!0}})),a={plugins:i,shapes:t.shapes||[],type:"ge",version:yu,playerVersion:null!==(r=t.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return xu(t,{plugins:i,requires:n})})),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:s,bins:(t.bins||[]).slice()};t._textures&&(a._textures=t._textures);return a}(t));var r=du.exec(t.version)||[],i=Number(r[1]),n=Number(r[2]);if(i)return(i<2||2===i&&n<4)&&function(t){t.compositions.map((function(t){var e,r;try{for(var i=Ua(t.items),n=i.next();!n.done;n=i.next())fu(n.value.content)}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}))}(t),i<2?hu(t):t;throw Error("invalid json version "+t.version)}var yu="1.0";function gu(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,webp:t.webp,renderLevel:i,oriY:n};if(t&&t.sourceType)return t;throw Error("invalid image type")}function xu(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Object.assign({clipMode:za},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Su(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 Tu,Eu=[0,0,0,1],bu=.5;function Su(t,e){var r,i,n;void 0===e&&(e={});var o,s,a,u,l,c,h=va.base,f=t.endBehavior,p=NaN;if(t.content?(h=t.type||va.plugin,c=t.pn,l=t.pluginName,a=t.content,s=t.content,isNaN(c)&&!l&&(l=a.options.type),t.duration&&(p=t.duration),o=t.transform||y(s.transform),h===va.filter&&(yu<"1.1"&&(yu="1.1"),(a=uu(s,o)).filter=function(t){var e={};return Ga(t,(function(t,r){lu.includes(r)?e[r]=Xa(t):cu.includes(r)?e[r]=Qa(t):e[r]=t})),e}(s.filter))):t.particle?(h=va.particle,o=y((s=t.particle).transform,mu,!0),a=su(s)):t.sprite?(h=va.sprite,a=uu(s=t.sprite,o=y(s.transform,!1,!0))):t.cal?(h=va.null,a=au(s=t.cal,o=y(s.transform,!1,!0))):t.ui?(h=va.interact,o=y((s=t.ui).transform),a=function(t){var e,r=t.options;switch(r.type){case"click":e={type:da.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&Ya(r.previewColor),behavior:r.behavior||ma.NOTIFY};break;case"drag":e={type:da.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:da.MESSAGE}}return{options:e}}(s),o.scale=[s.options.width||1,s.options.height||1,1]):t.model&&(s=t.model,1===t.model.options.type&&(h=va.camera,o=y(s.transform),a=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 s={path:Qa(null===(r=t.transform)||void 0===r?void 0:r.path),linearX:Xa(null==o?void 0:o.translateX),linearY:Xa(null==o?void 0:o.translateY),linearZ:Xa(null==o?void 0:o.translateZ)};$a(s),n.positionOverLifetime=s}var a=t.rotationOverLifetime;if(a){var u={separateAxes:a.separateAxes,x:Xa(null==a?void 0:a.rotateX),y:Xa(null==a?void 0:a.rotateY),z:a.separateAxes?Xa(null==a?void 0:a.rotateZ):Xa(a.rotation)};$a(u),n.rotationOverLifetime=u}return n}(s))),null===(r=a.renderer)||void 0===r?void 0:r.anchor){var d=new Float32Array(a.renderer.anchor);d[0]==bu&&d[1]==bu?delete a.renderer.anchor:e.requires&&ka(e.requires,"anchor")}if(s){var m=null===(i=s.options)||void 0===i?void 0:i.looping;f=m?Array.isArray(m)?m[1]?Ra.loop:Ra.destroy:Ra.loop:f||(null===(n=null==s?void 0:s.options)||void 0===n?void 0:n.endBehavior)||Ra.destroy,s.options.renderLevel&&(u=s.options.renderLevel),isNaN(p)&&(p=s.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:p,id:t.id+"",transform:o,endBehavior:f,renderLevel:u,content:a};return l?e.plugins?(ka(e.plugins,l),v.pn=e.plugins.indexOf(l)):v.pluginName=l:Number.isInteger(c)&&(v.pn=c),t.parentId&&(v.parentId=t.parentId+""),v;function y(t,e,r){if(t){var i={},n=t.rotation;if(n&&(i.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var o=(s=Eu,a=i.rotation[0],u=i.rotation[1],l=i.rotation[2],c=tu(a*ru/2),h=tu(u*ru/2),f=tu(l*ru/2),p=eu(a*ru/2),d=eu(u*ru/2),m=eu(l*ru/2),s[0]=p*h*f+c*d*m,s[1]=c*d*f-p*h*m,s[2]=c*h*m+p*d*f,s[3]=c*h*f-p*d*m,s);i.rotation=function(t,e){var r,i,n,o=e[0],s=e[1],a=e[2],u=e[3],l=o+o,c=s+s,h=a+a,f=o*l,p=s*l,d=s*c,m=a*h,v=u*h,y=1-d-m,g=p-v,x=p+v,T=1-f-m,E=a*l-u*c,b=a*c+u*l,S=1-f-d;return t[1]=Math.asin((i=-1,(r=-E)>(n=1)?n:r<i?i:r))*iu,Math.abs(E)<.9999999?(t[0]=Math.atan2(b,S)*iu,t[2]=Math.atan2(x,y)*iu):(t[0]=0,t[2]=Math.atan2(-g,T)*iu),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 s,a,u,l,c,h,f,p,d,m;return{}}}var Au=((Tu={})[E.S]=[E.S,E.BPlus,E.APlus],Tu[E.A]=[E.A,E.BPlus,E.APlus],Tu[E.B]=[E.B,E.BPlus],Tu);function Ru(t,e){if(!t||!e)return!0;var r=Au[e];return!!r&&r.includes(t)}var Cu=0,_u=function(){function t(t,e){var r,i;this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0;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.map((function(t){return t&&(t instanceof qr?t:qr.create(e,t))}));t.textureOptions=p,null==p||p.forEach((function(t){return null==t?void 0:t.initialize()}));try{for(var d=s(c),m=d.next();!m.done;m=d.next()){var v=m.value;v.id===f?this.composition=v:this.refCompositions.set(v.id,v)}}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,Cu=0,this.textureOptions=a,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,s=t.globalVolume,a=t.startTime,u=void 0===a?0:a,l=this.assembleItems(t);return{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:l,camera:o,startTime:u,globalVolume:s}},t.prototype.assembleItems=function(t){var e=this,r=[];return t.items.forEach((function(t){var n,o={},s=t.visible,a=t.renderLevel,u=t.type;if(!1!==s){var l=i({},t.content);if(l&&(o.content=i({},l),Ru(a,e.renderLevel))){var c=o.content;if(o.type=u,c.renderer){c.renderer=e.changeTex(c.renderer),e.processMask(c.renderer);var h=c.splits&&!c.textureSheetAnimation&&c.splits[0];Number.isInteger(c.renderer.shape)?c.renderer.shape=Yo(null===(n=e.jsonScene)||void 0===n?void 0:n.shapes[c.renderer.shape],h):c.renderer.shape&&ir(c.renderer.shape)&&(c.renderer.shape=Yo(c.renderer.shape,h))}else o.content.renderer={order:0};c.trails&&(c.trails=e.changeTex(c.trails)),c.filter&&(c.filter=i({},c.filter));var f=t.name,p=t.delay,d=void 0===p?0:p,m=t.id,v=t.parentId,y=t.duration,g=t.endBehavior,x=t.pluginName,T=t.pn,E=t.transform,b=t.refCount,S=e.jsonScene.plugins,A=void 0===S?[]:S;if(o.name=f,o.delay=d,o.id=m,v&&(o.parentId=v),o.refCount=b,o.duration=y,o.listIndex=Cu++,o.endBehavior=g,x?o.pluginName=x:void 0!==T&&Number.isInteger(T)&&(o.pluginName=A[T]),E&&(o.transform=E),o.type===O.composition){e.mask++;var R=t.content.options.refId;if(!e.refCompositions.get(R))throw new Error("Invalid Ref Composition id: "+R);var C=e.getContent(e.refCompositions.get(R));e.refCompositionProps.has(R)||e.refCompositionProps.set(R,C),C.items.forEach((function(t){e.processMask(t.content)})),o.items=C.items}r.push(o)}}})),r},t.prototype.changeTex=function(t){var e=t.texture,r=i({},t);return void 0!==e&&(r.texture=this.addTextureUsage(e)||e),r},t.prototype.addTextureUsage=function(t){var e,r;if(Number.isInteger(t)){var i=null===(e=this.textures)||void 0===e?void 0:e[t],n=null==i?void 0:i.id,o=null!==(r=this.imgUsage)&&void 0!==r?r:{};if(n&&o)return o.hasOwnProperty(n)||(o[n]=0),o[n]++,i}},t.prototype.processMask=function(t){if(t.maskMode!==A.NONE&&!t.mask){var e=t.maskMode;e===A.MASK?t.mask=++this.mask:e!==A.OBSCURED&&e!==A.REVERSE_OBSCURED||(t.mask=this.mask)}},t.prototype.dispose=function(){this.textureOptions=[],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}();function wu(t){return ir(t)&&"jsonScene"in t}var Ou=1,Mu=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new Ur),this.options=t,this.downloader=e,this.assets={},this.id=Ou++,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===O.text){var r=e[t.name];r&&(t.content.options.text=r)}}))})),t},e.prototype.loadScene=function(t,e,r){var s,u,l;return n(this,void 0,void 0,(function(){var c,h,f,p,d,m,v,y,g,x,T,E,b,S=this;return o(this,(function(A){return h=tr(t)?t:this.id,f=performance.now(),p=[],d=null==e?void 0:e.engine.gpuCapability,m=null!==(u=null===(s=null==d?void 0:d.detail)||void 0===s?void 0:s.asyncShaderCompile)&&void 0!==u&&u,v=null!==(l=null==d?void 0:d.detail.compressedTexture)&&void 0!==l?l:0,y={},x=!1,T=new Promise((function(t,e){g=window.setTimeout((function(){x=!0,S.removeTimer(g);var t=performance.now()-f;e("Load time out: totalTime: ".concat(t.toFixed(4),"ms ").concat(p.join(" "),", url: ").concat(h))}),1e3*S.timeout),S.timers.push(g)})),E=function(t,e){return n(S,void 0,void 0,(function(){var r,i,n,s;return o(this,(function(o){switch(o.label){case 0:if(x)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(),n=performance.now()-r,p.push("[".concat(t,": ").concat(n.toFixed(2),"]")),y[t]=n,[2,i];case 3:throw s=o.sent(),new Error("load error in ".concat(t,", ").concat(s));case 4:throw new Error("load canceled.")}}))}))},b=function(){return n(S,void 0,void 0,(function(){var n,s,u,l,d,x,T,b,S,A,R,C,_,w,O,M,L,I,P,F=this;return o(this,(function(o){switch(o.label){case 0:return ir(t)?(c=t,this.baseUrl=location.href,[3,3]):[3,1];case 1:return t=new URL(t,location.href).href,this.baseUrl=t,[4,E("loadJSON",(function(){return F.loadJSON(t)}))];case 2:c=o.sent(),o.label=3;case 3:if(!wu(c))return[3,6];if(n=i({},c),!this.options||!this.options.variables||0===Object.keys(this.options.variables).length)return[3,5];for(s=c.jsonScene.images,u=n.images,d=0;d<s.length;d++)u[d]instanceof HTMLCanvasElement&&(u[d]=s[d]);return l=n,[4,E("processImages",(function(){return F.processImages(u,n.usedImages,v)}))];case 4:for(l.images=o.sent(),d=0;d<n.images.length;d++)n.textureOptions[d].image=n.images[d];n.jsonScene.compositions=this.updateSceneData(n.jsonScene.compositions),o.label=5;case 5:return[3,12];case 6:return[4,E("processJSON",(function(){return F.processJSON(c)}))];case 7:return x=o.sent(),T=x.usedImages,b=x.jsonScene,S=x.pluginSystem,A=b.bins,R=void 0===A?[]:A,C=b.images,_=b.compositions,w=b.fonts,[4,Promise.all([E("processBins",(function(){return F.processBins(R)})),E("processImages",(function(){return F.processImages(C,T,v)})),E("".concat(m?"async":"sync","Compile"),(function(){return F.precompile(_,S,e,r)}))])];case 8:return O=a.apply(void 0,[o.sent(),2]),M=O[0],L=O[1],[4,E("processFontURL",(function(){return F.processFontURL(w)}))];case 9:return o.sent(),[4,E("processTextures",(function(){return F.processTextures(L,M,b)}))];case 10:return I=o.sent(),b.compositions=this.updateSceneData(b.compositions),n={timeInfos:y,url:t,renderLevel:this.options.renderLevel,storage:{},pluginSystem:S,jsonScene:b,usedImages:T,images:L,textureOptions:I,bins:M},[4,E("processPlugins",(function(){return S.loadResources(n,F.options)}))];case 11:o.sent(),o.label=12;case 12:return P=performance.now()-f,Je.info("Load asset: totalTime: ".concat(P.toFixed(4),"ms ").concat(p.join(" "),", url: ").concat(h)),window.clearTimeout(g),this.removeTimer(g),n.totalTime=P,n.startTime=f,n.timeInfos=y,[2,n]}}))}))},[2,Promise.race([T,b()])]}))}))},e.prototype.precompile=function(t,e,r,i){return n(this,void 0,void 0,(function(){var n;return o(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 n(this,void 0,void 0,(function(){var e,r,i,n,s,a,u,l,c;return o(this,(function(o){switch(o.label){case 0:return e=vu(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,s=e.imgUsage,a=e.images,[4,(u=new vr(i)).processRawJSON(e,this.options)];case 1:return o.sent(),l=this.options.renderLevel,c={},s?function(t,e,r,i,n){for(var o=0;o<e.length;o++){var s=r[e[o].id];if(s)for(var a=0;a<s.length;a++){var u=s[a];Ru(i[u].renderLevel,n)&&(t[u]=!0)}}}(c,n,s,a,l):null==a||a.forEach((function(t,e){c[e]=!0})),[2,{usedImages:c,jsonScene:e,pluginSystem:u}]}}))}))},e.prototype.processBins=function(t){return n(this,void 0,void 0,(function(){var e,r,i,n=this;return o(this,(function(o){return e=this.options.renderLevel,r=this.baseUrl,i=t.map((function(i){if(i instanceof ArrayBuffer)return i;if(Ru(i.renderLevel,e))return n.loadBins(new URL(i.url,r).href);throw new Error("Invalid bins source: ".concat(JSON.stringify(t)))})),[2,Promise.all(i)]}))}))},e.prototype.processFontURL=function(t){return n(this,void 0,void 0,(function(){var r,i=this;return o(this,(function(s){return t?(r=t.map((function(t){return n(i,void 0,void 0,(function(){var r,i,n;return o(this,(function(o){switch(o.label){case 0:if(!t.fontURL||e.fonts.has(t.fontFamily))return[3,4];it(t.fontFamily)||console.warn("Risky font family: ".concat(t.fontFamily)),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(t.fontURL,this.baseUrl).href,[4,(i=new FontFace(null!==(n=t.fontFamily)&&void 0!==n?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(i),e.fonts.add(t.fontFamily),[3,4];case 3:return o.sent(),Je.warn("Invalid font family or font 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 n(this,void 0,void 0,(function(){var s,a,u,l,c,h=this;return o(this,(function(f){return s=this.options,a=s.useCompressedTexture,u=s.variables,l=this.baseUrl,c=e.map((function(e,s){return n(h,void 0,void 0,(function(){var n,c,h,f,p,d,m,v,y,g,x,T,E,b,S,A,R,C;return o(this,(function(o){switch(o.label){case 0:if(!r[s])return[2,void 0];if(n=e.url,c=e.webp,h=new URL(n,l).href,f=c&&new URL(c,l).href,!("template"in e))return[3,13];if(p=e.template,d="v"in p&&2===p.v&&p.background,m=d?p.background:void 0,!d||!m)return[3,8];v=Us(p,u),y=m.type===st.video,g=m&&y?Yr:Xr,o.label=1;case 1:return o.trys.push([1,6,,7]),[4,ks(v,g)];case 2:return(T=o.sent())instanceof HTMLVideoElement?[2,T]:[3,3];case 3:return m&&Array.isArray(v)&&u&&(u[m.name]=T.src),[4,Ys(T,p,u,this.options,-1===e.oriY)];case 4:return[2,o.sent()];case 5:return[3,7];case 6:throw x=o.sent(),new Error("Failed to load. Check the template or if the URL is ".concat(y?"video":"image"," type, URL: ").concat(v,", Error: ").concat(x.message));case 7:return[3,12];case 8:return o.trys.push([8,11,,12]),[4,Gr(h,f)];case 9:return[4,Ys((T=o.sent()).image,p,u,this.options,-1===e.oriY)];case 10:return[2,o.sent()];case 11:throw o.sent(),new Error("Failed to load. Check the template, URL: ".concat(h,"."));case 12:return[3,14];case 13:if("type"in e&&"video"===e.type)return console.warn("The video element is deprecated. Use template BackgroundType.video instead."),[2,Yr(e.url)];if("compressed"in e&&a&&i){if(E=e.compressed,b=void 0,i===En.ASTC?b=E.astc:i===En.PVRTC&&(b=E.pvrtc),b)return S=new URL(b,l).href,this.assets[s]={url:S,type:t.TextureSourceType.compressed},[2,this.loadBins(S)]}else{if("sourceType"in e)return[2,e];if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof qr)return[2,e]}o.label=14;case 14:return[4,Gr(h,f)];case 15:return A=o.sent(),R=A.url,C=A.image,this.assets[s]={url:R,type:t.TextureSourceType.image},[2,C]}}))}))})),[2,Promise.all(c)]}))}))},e.prototype.processTextures=function(e,r,s){var a;return n(this,void 0,void 0,(function(){var n,u,l=this;return o(this,(function(o){return n=null!==(a=s.textures)&&void 0!==a?a:e.map((function(t,e){return{source:e}})),u=n.map((function(n,o){if(n instanceof qr)return n;if("mipmaps"in n)try{return jr(n,r,s.bins)}catch(t){throw new Error("load texture ".concat(o," fails, error message: ").concat(t))}var a=n.source,u=e[a];if(u){var c=function(e,r){if(e instanceof qr)return e.source;if(e instanceof HTMLImageElement||function(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null===(e=t.tagName)||void 0===e?void 0:e.toUpperCase())}(e))return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:v.LINEAR,magFilter:v.LINEAR};if(e instanceof HTMLVideoElement)return{sourceType:t.TextureSourceType.video,video:e,minFilter:v.LINEAR,magFilter:v.LINEAR};if(e instanceof ArrayBuffer)return i(i({},Jr(e)),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:v.CLAMP_TO_EDGE,wrapT:v.CLAMP_TO_EDGE,minFilter:v.NEAREST,magFilter:v.NEAREST};throw new Error("Invalid texture options")}(u,l.assets[o]);return c.sourceType===t.TextureSourceType.compressed?c:i(i({},c),n)}throw new Error("Invalid texture source: ".concat(a))})),[2,Promise.all(u)]}))}))},e.prototype.loadJSON=function(t){return n(this,void 0,void 0,(function(){var e=this;return o(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 n(this,void 0,void 0,(function(){var e=this;return o(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}();var Lu,Iu,Pu=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.items=[],t.itemTree=[],t.itemCacheMap=new Map,t.itemsToRemove=[],t.tempQueue=[],t}return r(n,e),Object.defineProperty(n.prototype,"type",{get:function(){return O.composition},enumerable:!1,configurable:!0}),n.prototype.onConstructed=function(t){var e=t.items,r=void 0===e?[]:e,i=t.startTime,n=void 0===i?0:i,o=t.content,s=t.refId;this.refId=s,this.itemProps=r,this.contentProps=o;var a=this.endBehavior;5!==a&&1!==a&&3!==a||(this.freezeOnEnd=!0),this.startTime=n,this.startTimeInms=Math.round(1e3*this.startTime)},n.prototype.createContent=function(){if(!this.items.length&&this.composition)for(var e=0;e<this.itemProps.length;e++){var r=void 0,o=this.itemProps[e];if(t.Item.isComposition(o)){var s=o.content.options.refId;(r=new n(i({refId:s},o),this.composition)).contentProps=o.content,r.transform.parentTransform=this.transform,this.composition.refContent.push(r),5===r.endBehavior&&(this.composition.autoRefTex=!1),r.createContent()}else(r=hr(this.itemProps[e],this.composition)).transform.parentTransform=cr.isCamera(r)?new lr:this.transform;cr.isExtraCamera(r)&&(this.extraCamera=r),this.items.push(r),this.tempQueue.push(r)}!this.content&&this.contentProps&&(this._content=this.doCreateContent())},n.prototype.doCreateContent=function(){var t=new Yn(this.contentProps,this);return t.renderData=t.getRenderData(0,!0),t},n.prototype.onLifetimeBegin=function(){var t;null===(t=this.items)||void 0===t||t.forEach((function(t){t.start(),t.createContent()})),this.buildItemTree()},n.prototype.doStop=function(){this.items&&this.items.forEach((function(t){return t.stop()}))},n.prototype.onItemUpdate=function(t,e){var r,i,n=this;if(this.content&&(this.content.updateTime(this.time),this.content.getRenderData(this.content.time)),this.items){null===(r=this.composition)||void 0===r||r.updatePluginLoaders(t);var o=[];this.itemsToRemove.length&&(this.itemsToRemove.forEach((function(t){var e,r,i=n.itemCacheMap.get(t.id);if(i){var o=i.children;if(i.parentId){var s=n.itemCacheMap.get(i.parentId);s?(s.children.splice(s.children.indexOf(i),1),o.forEach((function(t){return n.setItemParent(t.item,s.item)}))):(o.forEach((function(t){return n.setItemParent(t.item,void 0)})),(e=n.itemTree).push.apply(e,u([],a(o),!1)))}else(r=n.itemTree).splice.apply(r,u([n.itemTree.indexOf(i),1],a(o),!1)),o.forEach((function(t){return n.setItemParent(t.item,void 0)}));n.itemCacheMap.delete(t.id),n.items.splice(n.items.indexOf(t),1)}})),this.itemsToRemove.length=0);for(var s=0;s<this.itemTree.length;s++){if((c=this.itemTree[s])&&c.item){var l=c.item;cr.isComposition(l)&&l.ended&&5===l.endBehavior?l.restart():l.onUpdate(t),o.push.apply(o,u([],a(c.children),!1))}}for(;o.length;){var c;if((c=o.shift())&&c.item)(l=c.item).onUpdate(t),o.push.apply(o,u([],a(c.children),!1)),l.composition||z(this.itemsToRemove,l)}null===(i=this.extraCamera)||void 0===i||i.onUpdate(t)}},n.prototype.onItemRemoved=function(t){this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0,this.itemTree.length=0,this.itemCacheMap.clear())},n.prototype.reset=function(){e.prototype.reset.call(this),this.itemTree=[],this.itemCacheMap.clear(),this.tempQueue.length=0,this.itemsToRemove.length=0},n.prototype.handleVisibleChanged=function(t){this.items.forEach((function(e){return e.setVisible(t)}))},n.prototype.setScale=function(t,e,r){this.content&&(this.content.startSize=new It(t,e,r))},n.prototype.scale=function(t,e,r){if(this.content){var i=this.content.startSize.clone();this.content.startSize=new It(t*i.x,e*i.y,r*i.z)}},n.prototype.getUpdateTime=function(t){var e=this.startTimeInms,r=this.timeInms;if(t<0&&r+t<e)return e-r;if(this.freezeOnEnd){var i=this.durInms-r;if(i<t)return i}return t},n.prototype.removeItem=function(t){var e,r=this;if(this.items.indexOf(t)>-1){if(z(this.itemsToRemove,t),cr.isTree(t)||cr.isNull(t)){var i=6===t.endBehavior,n=cr.isNull(t)&&!!this.itemCacheMap.get(t.id);((null===(e=this.itemCacheMap.get(t.id))||void 0===e?void 0:e.children)||[]).forEach((function(t){n||r.setItemParent(t.item,void 0),i&&r.removeItem(t.item)}))}return!0}return this.items.forEach((function(e){if(cr.isComposition(e)&&e.items.indexOf(t)>-1)return e.removeItem(t),!0})),!1},n.prototype.setItemParent=function(t,e){var r=this.itemCacheMap.get(t.id);if(r)if(e){var i=this.itemCacheMap.get(e.id);if(r.parentId){var n=this.itemCacheMap.get(r.parentId);n.children.splice(n.children.indexOf(r),1)}t.parent=e,r.parentId=e.id,i.children.push(r),t.transform.parentTransform=e.transform}else r.parentId=void 0,t.parent=void 0,t.transform.parentTransform=cr.isExtraCamera(t)?new lr:this.transform;else console.error("item has been remove, please set item's parent in valid lifetime")},n.prototype.getItemCurrentParent=function(t){var e=t.id,r=this.itemCacheMap.get(e);if(r){var i=r.parentId;if(i){var n=this.itemCacheMap.get(i);return i&&n?n.item:void 0}}},n.prototype.getItemByName=function(t){var e,r,i=[];try{for(var n=s(this.items),o=n.next();!o.done;o=n.next()){var l=o.value;l.name===t?i.push(l):cr.isComposition(l)&&i.push.apply(i,u([],a(l.getItemByName(t)),!1))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return i},n.prototype.hitTest=function(e,r,i,n,o,s){for(var a=[],u=(null==s?void 0:s.stop)||$e,l=(null==s?void 0:s.skip)||$e,c=(null==s?void 0:s.maxCount)||this.items.length,h=0;h<this.items.length&&n.length<c;h++){var f=this.items[h];if(f.lifetime>=0&&f.lifetime<=1&&!cr.isComposition(f)&&!l(f)){var p=f.getHitTestParams(o);if(p){var d=!1,m=new It;if(p.type===t.HitTestType.triangle)for(var v=p.triangles,y=p.backfaceCulling,g=0;g<v.length;g++){var x=v[g];if(e.intersectTriangle(x,m,y)){d=!0,a.push(m);break}}else if(p.type===t.HitTestType.box){var T=p.center,E=p.size,b=T.clone().addScaledVector(E,.5),S=T.clone().addScaledVector(E,-.5);e.intersectBox({min:b,max:S},m)&&(d=!0,a.push(m))}else if(p.type===t.HitTestType.sphere){T=p.center;var A=p.radius;e.intersectSphere({center:T,radius:A},m)&&(d=!0,a.push(m))}else if(p.type===t.HitTestType.custom){var R=p.collect(e,new Lt(r,i));R&&R.length>0&&(R.forEach((function(t){a.push(t)})),d=!0)}if(d){var C={compContent:this,id:f.id,name:f.name,position:a[a.length-1],parentId:f.parentId,hitPositions:a,behavior:p.behavior};if(n.push(C),u(C))return n}}}}return n},n.prototype.isEnded=function(t){return t>=this.durInms},n.prototype.buildItemTree=function(){if(!this.itemTree.length&&this.composition){this.itemTree=[];for(var t=this.itemCacheMap,e=this.tempQueue,r=function(){var r=e.shift();if(void 0===r.parentId){var n={id:r.id,item:r,children:[]};i.itemTree.push(n),t.set(r.id,n)}else{var o=i.getParentIdWithoutSuffix(r.parentId),s=t.get(o);if(s){n={id:r.id,parentId:o,item:r,children:[]};r.parent=s.item,r.transform.parentTransform=s.item.getNodeTransform(r.parentId),s.children.push(n),t.set(r.id,n)}else{if(-1===i.items.findIndex((function(t){return t.id===o})))throw Error("元素引用了不存在的元素,请检查数据");e.push(r)}}},i=this;e.length;)r()}},n.prototype.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},n.prototype.restart=function(){this.reset(),this.createContent(),this.start()},n}(cr),Fu=1,Vu=function(){function e(t,e){var r,n;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 o=t.reusable,s=void 0!==o&&o,a=t.speed,u=void 0===a?1:a,l=t.baseRenderOrder,c=void 0===l?0:l,h=t.renderer,f=t.onPlayerPause,p=t.onMessageItem,d=t.onEnd,m=t.event,v=t.width,y=t.height;this.compositionSourceManager=new _u(e,h.engine),e.jsonScene.imgUsage=void 0,s&&(this.keepResource=!0,e.textures=void 0,e.consumed=!0);var g=this.compositionSourceManager,x=g.sourceContent,T=g.pluginSystem,E=g.imgUsage,b=g.totalTime,S=g.renderLevel,A=g.refCompositionProps;rt(x),this.refCompositionProps=A;var R=new Pu(x,this),C=!s&&E;this.transform=new lr({name:this.name}),R.transform=this.transform,this.globalVolume=x.globalVolume,this.width=v,this.height=y,this.renderOrder=c,this.id=Fu++,this.renderer=h,this.texInfo=null!=C?C:{},this.event=m,this.statistic={loadTime:null!=b?b:0,loadStart:null!==(r=e.startTime)&&void 0!==r?r:0,firstFrameTime:0,precompileTime:null!==(n=e.timeInfos.asyncCompile)&&void 0!==n?n:e.timeInfos.syncCompile},this.reusable=s,this.speed=u,this.renderLevel=S,this.autoRefTex=!this.keepResource&&C&&5!==R.endBehavior,this.content=R,this.name=R.name,this.pluginSystem=T,this.pluginSystem.initializeComposition(this,e),this.camera=new aa(this.name,i(i({},null==x?void 0:x.camera),{aspect:v/y})),this.url=e.url,this.assigned=!0,this.interactive=!0,this.onPlayerPause=f,this.onMessageItem=p,this.onEnd=d,this.createRenderFrame(),this.reset()}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.content.items},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){var t;return null!==(t=this.content.startTime)&&void 0!==t?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return this.content.timeInms/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getDuration=function(){return this.content.duration},e.prototype.restart=function(){this.content.reset(),this.prepareRender(),this.reset(),this.transform.setValid(!0),this.content.start(),this.forwardTime(this.startTime),this.content.onUpdate(0),this.loaderData.spriteGroup.onUpdate(0)},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.content.ended&&this.reusable&&this.restart(),this.content.started?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},e.prototype.pause=function(){this.paused=!0},e.prototype.resume=function(){this.paused=!1},e.prototype.gotoAndPlay=function(t){this.resume(),this.content.started||this.content.start(),this.forwardTime(t+this.startTime)},e.prototype.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},e.prototype.createRenderFrame=function(){this.renderFrame=new hn({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.content.started||this.content.start(),this.forwardTime(t+this.startTime,!0),e&&this.pause()},e.prototype.forwardTime=function(t,e){void 0===e&&(e=!1);for(var r=1e3*t-this.content.timeInms,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;this.rendererOptions=null,this.pluginSystem.plugins.forEach((function(e){return e.onCompositionWillReset(t,t.renderFrame)})),this.content.createContent(),this.content.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=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(r){r.prepareRenderFrame(t,e)&&t.postLoaders.push(r)})),this.postLoaders.forEach((function(r){return r.postProcessFrame(t,e)}))},e.prototype.shouldRestart=function(){var t=this.content,e=t.ended,r=t.endBehavior;return e&&5===r},e.prototype.shouldDispose=function(){if(this.reusable)return!1;var t=this.content,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},e.prototype.update=function(t,e){if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var r=this.content.getUpdateTime(t*this.speed);this.updateVideo(),this.content.onUpdate(r),this.loaderData.spriteGroup.onUpdate(r),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},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,e){if(this.content&&this.content.items)return this.content.getItemByName(t)[0]},e.prototype.getItemByID=function(t){return this.content&&this.content.items&&this.content.itemCacheMap.has(t)?this.content.itemCacheMap.get(t).item:null},e.prototype.getItemCurrentParent=function(t){return this.content.getItemCurrentParent(t)},e.prototype.itemLifetimeEvent=function(t,e){var r=this,i=e?function(e){return e.onCompositionItemLifeBegin(r,t)}:function(e){return e.onCompositionItemLifeEnd(r,t)};this.pluginSystem.plugins.forEach(i)},e.prototype.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return le((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){if(this.isDestroyed||!this.interactive)return[];var n=[],o=this.getHitTestRay(t,e);return this.content.hitTest(o,t,e,n,r,i),this.refContent.forEach((function(s){s.hitTest(o,t,e,n,r,i)})),n},e.prototype.addInteractiveItem=function(t,e){var r;if(e===_.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===_.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.id]){if(this.autoRefTex)--this.texInfo[n.id]||n.dispose()}else n!==(null===(r=this.rendererOptions)||void 0===r?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n.dispose()}},e.prototype.destroyItem=function(t){var e=this;t.type==O.composition?4!==t.endBehavior&&t.items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(this.content.removeItem(t),this.refContent.forEach((function(e){return e.removeItem(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 t,e,r=this;if(!this.destroyed){this.destroyed=!0;var i={},n=this.textures;n&&(this.keepResource?n.forEach((function(t){(null==t?void 0:t.dispose)&&(i[t.id]=t.dispose,t.dispose=$e)})):n.forEach((function(t){return t&&t.dispose()}))),this.content.dispose(),this.renderFrame.dispose(),null===(t=this.rendererOptions)||void 0===t||t.emptyTexture.dispose(),null===(e=this.pluginSystem)||void 0===e||e.destroyComposition(this),this.update=function(){Je.error("Update disposed composition: ".concat(r.name,"."))},this.onPlayerPause=$e,this.dispose=$e,n&&this.keepResource&&n.forEach((function(t){return t.dispose=i[t.id]})),this.compositionSourceManager.dispose(),this.refCompositionProps.clear()}},e.prototype.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},e.prototype.translateByPixel=function(t,e){this.renderer?this.content.translateByPixel(t,e):console.warn("Can not translate position when container not assigned")},e.prototype.translate=function(t,e,r){this.content.translate(t,e,r)},e.prototype.setPosition=function(t,e,r){this.content.setPosition(t,e,r)},e.prototype.rotate=function(t,e,r){this.content.rotate(t,e,r)},e.prototype.setRotation=function(t,e,r){this.content.setRotation(t,e,r)},e.prototype.scale=function(t,e,r){this.content.scale(t,e,r)},e.prototype.setScale=function(t,e,r){this.content.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 n(this,void 0,void 0,(function(){return o(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}(),Nu=function(){function t(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderErrors=new Set}return t.prototype.addTexture=function(t){this.destroyed||z(this.textures,t)},t.prototype.removeTexture=function(t){this.destroyed||B(this.textures,t)},t.prototype.addMaterial=function(t){this.destroyed||z(this.materials,t)},t.prototype.removeMaterial=function(t){this.destroyed||B(this.materials,t)},t.prototype.addGeometry=function(t){this.destroyed||z(this.geometries,t)},t.prototype.removeGeometry=function(t){this.destroyed||B(this.geometries,t)},t.prototype.addMesh=function(t){this.destroyed||z(this.meshes,t)},t.prototype.removeMesh=function(t){this.destroyed||B(this.meshes,t)},t.prototype.addRenderPass=function(t){this.destroyed||z(this.renderPasses,t)},t.prototype.removeRenderPass=function(t){this.destroyed||B(this.renderPasses,t)},Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},t.prototype.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&&Je.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}},t}(),Du=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.setFPS(t),this.tickers=[]}return t.prototype.getFPS=function(){return this.targetFPS},t.prototype.setFPS=function(t){this.targetFPS=Ot(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.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.tickers=[]},t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.tick=function(){if(!this.paused){var t=performance.now(),e=t-this.lastTime;if(e>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter((function(t){return t})),this.resetTickers=!1);for(var r=0,i=this.tickers.length;r<i;r++){(0,this.tickers[r])(e)}}}},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}();mr("camera",Er,br,!0),mr("sprite",Gn,qn,!0),mr("particle",bs,ds,!0),mr("cal",Ss,As,!0),mr("interact",On,_n,!0),mr("filter",Gn,Qn,!0),mr("text",qs,Zs,!0),V(xa);var zu=((Lu={})[v.RGBA]=34842,Lu[v.RGB]=34843,Lu[v.ALPHA]=33325,Lu[v.RED]=33325,Lu[v.LUMINANCE_ALPHA]=33327,Lu[v.LUMINANCE]=33325,Lu),Bu=((Iu={})[v.RGBA]=34836,Iu[v.RGB]=34837,Iu[v.ALPHA]=33326,Iu[v.RED]=33326,Iu[v.LUMINANCE_ALPHA]=33328,Iu[v.LUMINANCE]=33326,Iu),Uu=function(e){function s(t,r){var i=e.call(this)||this;i.initialized=!1;var n=i.assembleOptions(r),o=n.sourceType,s=n.sourceFrom,a=n.name,u=void 0===a?"":a;return i.source=n,i.sourceType=o,i.sourceFrom=s,i.name=u,i.engine=t,i}return r(s,e),s.prototype.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},s.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,s=i.name;this.textureBuffer=r.createTexture(),this.textureBuffer&&ju(this.textureBuffer,s),this.target=o,this.update(this.source),this.release(),this.initialized=!0}},s.prototype.clone=function(){var t=new s(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},s.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}},s.prototype.update=function(e){var r,i,n,o,s=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var u=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,x=l.mipmaps,T=l.mipmaps,E=e.data,b=e.cube,S=e.generateMipmap,A=e.mipmaps,R=l,C=R.format,_=R.type,w=R.internalFormat,O=0,M=0;if(this.bind(f===t.TextureSourceType.video),_===v.HALF_FLOAT?((_=h.halfFloatTexture)||Je.error("Half float texture is not support."),g(c)&&w===C&&(C===v.LUMINANCE&&(C=v.RED),w=zu[C]),h.halfFloatLinear||(l.minFilter=l.magFilter=c.NEAREST,Je.warn("Half float linear not support, change to NEAREST."))):_===c.FLOAT&&((_=h.floatTexture)||Je.error("Float texture is not support."),g(c)&&w===C&&(C===v.LUMINANCE&&(C=v.RED),w=Bu[C]),h.floatLinear||(l.minFilter=c.NEAREST,l.magFilter=c.NEAREST,Je.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)E&&(O=null!==(n=E.width)&&void 0!==n?n:0,M=null!==(o=E.height)&&void 0!==o?o:0,O&&M&&(this.width!==O||this.height!==M)&&c.texImage2D(u,0,w,O,M,0,C,_,null));else if(f===t.TextureSourceType.data)u===c.TEXTURE_CUBE_MAP?b.forEach((function(t,e){var r=a(s.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,C,_,t),2),i=r[0],n=r[1];O=Math.max(i,O),M=Math.max(n,M)})):(r=a(this.texImage2DData(c,u,0,w,C,_,p),2),O=r[0],M=r[1]);else if(f===t.TextureSourceType.image||f===t.TextureSourceType.video){if(u===c.TEXTURE_CUBE_MAP)d.forEach((function(t,e){var r=a(s.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,C,_,t),2),i=r[0],n=r[1];O=Math.max(i,O),M=Math.max(n,M)}));else if(u===c.TEXTURE_2D){var L=null!=m?m:y;i=a(this.texImage2D(c,u,0,w,C,_,L),2),O=i[0],M=i[1]}S&&(ku(O)&&ku(M)||g(c))&&c.generateMipmap(u)}else if(f===t.TextureSourceType.mipmaps){var I;u===c.TEXTURE_2D?x.forEach((function(t,e){var r;I="data"in t?s.texImage2DData(c,u,e,w,C,_,t):s.texImage2D(c,u,e,w,C,_,t),0===e&&(r=a(I,2),O=r[0],M=r[1])})):u===c.TEXTURE_CUBE_MAP&&T.forEach((function(t,e){t.forEach((function(t,r){var i;I="data"in t?s.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,w,C,_,t):s.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,w,C,_,t),0===e&&(i=a(I,2),O=i[0],M=i[1])}))}))}else f===t.TextureSourceType.compressed&&A&&(O=A[0].width,M=A[0].height,A.forEach((function(t,e){c.compressedTexImage2D(u,e,w,t.width,t.height,0,t.data)})));this.width=O,this.height=M,this.setTextureFilters(c,u,l)},s.prototype.setTextureFilters=function(t,e,r){var i=r.anisotropic,n=void 0===i?4:i,o=r.wrapS,s=void 0===o?t.CLAMP_TO_EDGE:o,a=r.wrapT,u=void 0===a?t.CLAMP_TO_EDGE:a,l=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&l.setTextureAnisotropic(t,this.target,n);var c=g(t)||ku(this.width)&&ku(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?s:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,c?u:t.CLAMP_TO_EDGE)},s.prototype.texImage2D=function(e,r,i,n,o,s,a){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,v=null!==(u=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==u?u:2048,y=a;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||a.width>v||a.height>v)&&setTimeout((function(){y=l.resizeImage(a)}))}e.texImage2D(r,i,n,o,s,y);var x=[y.width,y.height];if(h===t.TextureSourceType.video){var T=a;return[T.videoWidth,T.videoHeight]}return x},s.prototype.texImage2DData=function(t,e,r,i,n,o,s){var a=s.data,u=s.width,l=s.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(a.buffer,a.byteOffset,a.byteLength/a.BYTES_PER_ELEMENT):a;return t.texImage2D(e,r,i,u,l,0,n,o,c),[u,l]},s.prototype.resizeImage=function(t,e,r){var i,n=null!==(i=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==i?i:2048;if(g(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,s=Math.min(e,r||ue(n)),a=Math.min(e,i||ue(o));if(a!==o||s!==n){var u=Bs.getCanvas(),l=u.getContext("2d");return u.width=s,u.height=a,null==l||l.drawImage(t,0,0,n,o,0,0,s,a),Je.warn("Image resize from ".concat(n,"x").concat(o," to ").concat(s,"x").concat(a)),u}}(t,n,e,r);return o||t},s.prototype.reloadData=function(){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this.offloaded?[4,ei().reload(this)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},s.prototype.offloadData=function(){if(this.initialized&&ei().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}},s.prototype.uploadCurrentVideoFrame=function(){return n(this,void 0,void 0,(function(){var e;return o(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]}}))}))},s.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)},s.prototype.restore=function(){},s.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(){Je.error("This texture has been destroyed.")},this.initialize=or,void 0!==this.engine&&this.engine.removeTexture(this)},s}(qr);function ku(t){return 0==(t&t-1)&&0!==t}var Gu,Xu=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 g(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),e&&ju(e,t),e},t.prototype.bindVertexArray=function(t){var e;g(this.gl)?this.gl.bindVertexArray(t):null===(e=this.vaoExt)||void 0===e||e.bindVertexArrayOES(t)},t.prototype.dispose=function(){var t;g(this.gl)?this.gl.deleteVertexArray(this.vao):null===(t=this.vaoExt)||void 0===t||t.deleteVertexArrayOES(this.vao)},t}(),Hu=1,Yu=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 Uu(e,{data:r,sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new Uu(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"+Hu,Hu++}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&&z(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.shader.program;if(i){var n=i.setupAttributes(r),o=this.gl,s=r.indicesBuffer,a=r.drawStart,u=r.mode,l=r.drawCount;if(s){var c=s.type,h=s.elementCount;(l=isNaN(l)?h:l)>0&&o.drawElements(u,l,c,null!=a?a:0)}else l>0&&o.drawArrays(u,a,l);null==n||n.unbind()}}else console.warn("GLGPURenderer没有绑定gl对象, 无法绘制geometry")},e.prototype.createGLFrameBuffer=function(t,e){var r=this.gl.createFramebuffer();return r&&(z(this.frameBuffers,t),ju(r,e,e)),r},e.prototype.createVAO=function(t){return new Xu(this.engine,t)},e.prototype.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),B(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),B(this.frameBuffers,t),delete t.fbo)},e.prototype.deleteGLRenderBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),B(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){Je.error("gl lost, destroy glRenderer by default",t.target),this.deleteResource()},e.prototype.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},e}();function ju(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 Wu,Zu=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var r=e.target,i=void 0===r?v.ARRAY_BUFFER:r,n=e.type,o=void 0===n?v.FLOAT:n,s=e.name,a=e.usage,u=void 0===a?v.STATIC_DRAW:a,l=e.data,c=e.elementCount,h=function(t){var e,r;return null!==(r=null===(e=qu[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(s),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&&ju(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!!g(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},t}(),qu=((Gu={})[v.INT]=Int32Array,Gu[v.FLOAT]=Float32Array,Gu[v.SHORT]=Int16Array,Gu[v.BYTE]=Int8Array,Gu[v.UNSIGNED_BYTE]=Uint8Array,Gu[v.UNSIGNED_INT]=Uint32Array,Gu[v.UNSIGNED_SHORT]=Uint16Array,Gu);var Ku=((Wu={})[Uint8Array.BYTES_PER_ELEMENT]=v.UNSIGNED_BYTE,Wu[Uint16Array.BYTES_PER_ELEMENT]=v.UNSIGNED_SHORT,Wu[Uint32Array.BYTES_PER_ELEMENT]=v.UNSIGNED_INT,Wu),Qu=1,Ju=function(t){function e(e,r){var i=this,n=r.drawStart,o=void 0===n?0:n,s=r.drawCount,a=r.mode,u=r.indices,l=r.name,c=void 0===l?"effectsGeometry:".concat(Qu++):l,h=r.bufferUsage,f=void 0===h?v.STATIC_DRAW:h;(i=t.call(this,c)||this).buffers={},i.vaos={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,i.engine=e;var p={},d=[],m={},y={},g={},x=f;return i.drawStart=o,i.drawCount=isNaN(+s)?NaN:s,i.mode=isNaN(a)?v.TRIANGLES:a,Object.keys(r.attributes).forEach((function(t){var e=r.attributes[t],i=e.size,n=e.stride,o=e.offset,s=e.normalize,a=e,u=a.type,l=void 0===u?v.FLOAT:u,c=a.releasable,h=e.data;if(!l||"dataSource"in e||h||(h=Si(l)),h){var f=h instanceof Float32Array?v.FLOAT:v.INT;p[t]={data:h,usage:x,target:v.ARRAY_BUFFER,name:t},m[t]={size:i,stride:n,offset:o,type:null!=l?l:f,normalize:!!s,dataSource:t},g[t]=null!=c&&c,y[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var T=e.dataSource;T&&(m[t]={size:i,stride:n,offset:o,type:l,dataSource:T,normalize:!!s})}d.push(t)})),y.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},i.indices=null==u?void 0:u.data,i.indicesReleasable=!0===(null==u?void 0:u.releasable),i.bufferProps=p,i.attributes=m,i.attributesName=d,i.attributesReleasable=g,i.dirtyFlags=y,i.options=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;rt(e),e.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new Zu(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 s=new r.constructor(o);s.set(i.data),i.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var a=this.dirtyFlags[t];a.start=Math.min(a.start,n),a.end=Math.max(a.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(end);o.set(this.indices),this.indices=o,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var s=this.dirtyFlags.index;s.start=Math.min(s.start,i),s.end=Math.max(s.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*Ei[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=Ku[e.BYTES_PER_ELEMENT],i={data:e,target:v.ELEMENT_ARRAY_BUFFER,type:r,name:"".concat(this.name,"##index")};return new Zu(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,s,a=t.dirtyFlags[n];if("index"==n)o=t.indicesBuffer,s=i;else{var u=e[n].dataSource;o=t.buffers[u],s=r[u].data}if((a.dirty||a.discard)&&o&&s){if(a.discard)o.bufferData(s);else{var l=a.start*s.BYTES_PER_ELEMENT+s.byteOffset,c=a.end-a.start+1,h=new s.constructor(s.buffer,l,c);o.bufferSubData(a.start,h)}a.start=Number.POSITIVE_INFINITY,a.end=0,a.dirty=a.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.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}(bi),$u=function(){function t(){this.reset()}return t.prototype.setBlendColor=function(t){var e=a(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=a(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=a(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=a(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=[v.ONE,v.ONE_MINUS_SRC_ALPHA,v.ONE,v.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[v.FUNC_ADD,v.FUNC_ADD],this.depthTest=!1,this.depthMask=!1,this.depthRange=[0,1],this.depthFunc=v.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=[v.ALWAYS,v.ALWAYS],this.stencilOpFail=[v.KEEP,v.KEEP],this.stencilOpZFail=[v.KEEP,v.KEEP],this.stencilOpZPass=[v.KEEP,v.KEEP],this.culling=!1,this.frontFace=v.CW,this.cullFace=v.FRONT},t.prototype.apply=function(t){if(t.toggle(v.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(v.BLEND,this.blending),t.toggle(v.DEPTH_TEST,this.depthTest),t.toggle(v.STENCIL_TEST,this.stencilTest),t.toggle(v.CULL_FACE,this.culling),t.toggle(v.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(v.BACK,this.stencilMask[1]),t.stencilMaskSeparate(v.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(v.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(v.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(v.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(v.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}(),tl=Ut,el=Nt,rl=function(e){function i(t,r){var i=e.call(this,r)||this;return i.floats={},i.ints={},i.vector2s={},i.vector3s={},i.vector4s={},i.quaternions={},i.matrices={},i.matrice3s={},i.textures={},i.floatArrays={},i.vector4Arrays={},i.matrixArrays={},i.samplers=[],i.uniforms=[],i.uniformDirtyFlag=!0,i.glMaterialState=new $u,i.engine=t,i}return r(i,e),Object.defineProperty(i.prototype,"blending",{get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blendColor",{get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blendFunction",{get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blendEquation",{get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthTest",{get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthMask",{get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthRange",{get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthFunc",{get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"polygonOffsetFill",{get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"polygonOffset",{get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"sampleAlphaToCoverage",{get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"colorMask",{get:function(){return this.glMaterialState.colorMask},set:function(t){t&&this.glMaterialState.setColorMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilTest",{get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilMask",{get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilRef",{get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilFunc",{get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilOpFail",{get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilOpZFail",{get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilOpZPass",{get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"culling",{get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"frontFace",{get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cullFace",{get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)},enumerable:!1,configurable:!0}),i.prototype.enableKeyword=function(t){throw new Error("Method not implemented.")},i.prototype.disableKeyword=function(t){throw new Error("Method not implemented.")},i.prototype.isKeywordEnabled=function(t){throw new Error("Method not implemented.")},i.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(i.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),i.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];rr(r.initialize)?r.initialize():Je.error("".concat(JSON.stringify(r)," is not valid Texture to initialize"))})),this.initialized=!0}},i.prototype.setupStates=function(t){this.glMaterialState.apply(t)},i.prototype.use=function(t,e){var r,i,n,o,a,u=t.engine.getGLPipelineContext();if(this.shader.program){var l;if(this.shader.program.bind(),this.setupStates(u),e){try{for(var c=s(e.uniforms),h=c.next();!h.done;h=c.next())l=h.value,this.checkUniform(l)}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}try{for(var f=s(e.samplers),p=f.next();!p.done;p=f.next())l=p.value,this.samplers.includes(l)||(this.samplers.push(l),this.uniformDirtyFlag=!0)}catch(t){n={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}if(this.uniformDirtyFlag&&(this.shader.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirtyFlag=!1),e){for(l in e.floats)this.shader.setFloat(l,e.floats[l]);for(l in e.ints)this.shader.setInt(l,e.ints[l]);for(l in e.matrices)this.shader.setMatrix(l,e.matrices[l])}for(l in this.textures)this.textures[l].textureBuffer||this.textures[l].initialize();for(l in this.floats)this.shader.setFloat(l,this.floats[l]);for(l in this.ints)this.shader.setInt(l,this.ints[l]);for(l in this.floatArrays)this.shader.setFloats(l,this.floatArrays[l]);for(l in this.textures)this.shader.setTexture(l,this.textures[l]);for(l in this.vector2s)this.shader.setVector2(l,this.vector2s[l]);for(l in this.vector3s)this.shader.setVector3(l,this.vector3s[l]);for(l in this.vector4s)this.shader.setVector4(l,this.vector4s[l]);for(l in this.quaternions)this.shader.setQuaternion(l,this.quaternions[l]);for(l in this.matrices)this.shader.setMatrix(l,this.matrices[l]);for(l in this.matrice3s)this.shader.setMatrix3(l,this.matrice3s[l]);for(l in this.vector4Arrays)this.shader.setVector4Array(l,this.vector4Arrays[l]);for(l in this.matrixArrays)this.shader.setMatrixArray(l,this.matrixArrays[l])}else null===(a=this.engine)||void 0===a||a.renderErrors.add(new Error("Shader program is not initialized"))},i.prototype.getFloat=function(t){return this.floats[t]},i.prototype.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},i.prototype.getInt=function(t){return this.ints[t]},i.prototype.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},i.prototype.getFloats=function(t){return this.floatArrays[t]},i.prototype.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},i.prototype.getVector2=function(t){return this.vector2s[t]},i.prototype.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},i.prototype.getVector3=function(t){return this.vector3s[t]},i.prototype.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},i.prototype.getVector4=function(t){return this.vector4s[t]},i.prototype.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},i.prototype.getQuaternion=function(t){return this.quaternions[t]},i.prototype.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},i.prototype.getMatrix=function(t){return this.matrices[t]},i.prototype.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},i.prototype.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},i.prototype.getVector4Array=function(t){return this.vector4Arrays[t]},i.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}}},i.prototype.getMatrixArray=function(t){return this.matrixArrays[t]},i.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}}},i.prototype.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},i.prototype.getTexture=function(t){return this.textures[t]},i.prototype.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirtyFlag=!0),this.textures[t]=e},i.prototype.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},i.prototype.clone=function(t){var e=t||this.props,r=this.engine;rt(r);var n=new i(r,e);return n.glMaterialState=Object.assign(new $u,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirtyFlag=!0,n},i.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.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 tl(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 s=el.fromIdentity(),a=0;a<16;a++)s.elements[a]=r.matrixArrays[e][n+a];o.push(s)}this.setMatrixArray(e,o)}},i.prototype.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirtyFlag=!0)},i.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){i.textures[t].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=or,this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMaterial(this),this.engine=void 0))},i}(ui),il=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:v.RGBA}},i=this.renderer.engine,n=new Ju(i,{name:e,mode:v.TRIANGLE_STRIP,attributes:{aPos:{type:v.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=i.gpuCapability.level,s=new rl(i,{name:e,shader:{cacheId:"$mri-internal-copy",name:e,vertex:Nr([],"\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:Nr([],"\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}});s.blending=!1,s.depthTest=!1,s.culling=!1;var a=new Li(i,{name:e,geometry:n,material:s,priority:0});return new nl(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:t.TextureLoadAction.whatever},attachments:[r],meshes:[a]})},e.prototype.dispose=function(){var t;this.renderer&&(null===(t=this.copyRenderPass)||void 0===t||t.dispose(),this.renderer=void 0)},e}(),nl=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}(Ni),ol=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=[],rt(t),this.gl=p(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}(),sl=function(t){function e(e){var r=t.call(this)||this;return r.gpuCapability=new yn(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}(Nu),al=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):Je.error("Invalid render buffer size: ".concat(t,"x").concat(e))}}else Je.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=or},e}(mn),ul=1,ll=function(e){function i(r,i){var n,o=e.call(this)||this;o.attachmentTextures=[],o.renderer=i,o.engine=i.engine;var s=r.depthStencilAttachment,a=r.viewport,u=r.isCustomViewport,l=r.viewportScale,c=void 0===l?1:l,h=r.storeAction,f=r.name,p=void 0===f?"GLFrameBuffer".concat(ul++):f;return o.depthStencilStorageType=null!==(n=null==s?void 0:s.storageType)&&void 0!==n?n:t.RenderPassAttachmentStorageType.none,o.viewport=a,o.isCustomViewport=!!u,o.viewportScale=c,o.name=p,o.storeAction=h,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(),z(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&z(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&z(this.attachmentTextures,this.depthTexture.textureBuffer)},i.prototype.updateProps=function(e){var r,i,n=this.renderer,o=this.engine.gpuCapability,s=null!==(r=e.depthStencilAttachment)&&void 0!==r?r:{storageType:t.RenderPassAttachmentStorageType.none},a=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(),!a&&s.storageType!==t.RenderPassAttachmentStorageType.none)throw Error("use depth stencil attachment without color attachments");a&&(this.fbo=n.glRenderer.createGLFrameBuffer(this,this.name));var h=s.storageType;if(h===t.RenderPassAttachmentStorageType.depth_stencil_opaque){if(s.storage){if(!(s.storage instanceof al))throw Error("invalid depth stencil attachment storage");this.depthStencilRenderBuffer=s.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new al({format:v.DEPTH_STENCIL,attachment:v.DEPTH_STENCIL_ATTACHMENT,storageType:h},n.glRenderer);u=!1}else if(h===t.RenderPassAttachmentStorageType.depth_16_opaque)if(s.storage){if(!(s.storage instanceof al))throw Error("invalid depth attachment storage");this.depthStencilRenderBuffer=s.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new al({attachment:v.DEPTH_ATTACHMENT,format:v.DEPTH_COMPONENT16,storageType:h},n.glRenderer);else if(h===t.RenderPassAttachmentStorageType.stencil_8_opaque)if(s.storage){if(!(s.storage instanceof al))throw Error("invalid stencil attachment storage");this.depthStencilRenderBuffer=s.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new al({attachment:v.STENCIL_ATTACHMENT,format:v.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 Uu(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:v.DEPTH_COMPONENT,internalFormat:o.internalFormatDepth16,type:v.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 Uu(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:v.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&&g(i)&&n>0){var o=[];if(e.depthAction===t.TextureStoreAction.clear&&this.depthStorage&&z(o,r?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===t.TextureStoreAction.clear&&this.stencilStorage&&z(o,r?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),e.colorAction===t.TextureStoreAction.clear)for(var s=0;s<n;s++)z(o,i["COLOR_ATTACHMENT".concat(s)]);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=a(this.viewport,4),o=n[0],s=n[1],u=n[2],l=n[3];r.bindFramebuffer(i,this.fbo),r.viewport(o,s,u,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(u,l),e.framebufferRenderbuffer(i,p.attachment,e.RENDERBUFFER,p.buffer);else if(d){d.source.data={width:u,height:l},d.update({data:{width:u,height:l,data:new Uint16Array(0)}});var v=d&&m?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(i,v,e.TEXTURE_2D,d.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var y=e.checkFramebufferStatus(i);if(y!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed, status: ".concat(y,", 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=a(this.viewport,4),o=n[0],s=n[1],u=n[2],l=n[3];o===t&&s===e&&u===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}(Sn);var cl,hl,fl=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return e>>>0},pl=((cl={})[v.FLOAT]=1,cl[v.INT]=1,cl[v.UNSIGNED_INT]=1,cl[v.SHORT]=1,cl[v.BOOL]=1,cl[v.UNSIGNED_SHORT]=1,cl[v.FLOAT_VEC2]=2,cl[v.FLOAT_VEC3]=3,cl[v.FLOAT_VEC4]=4,cl[v.FLOAT_MAT2]=4,cl[v.FLOAT_MAT3]=9,cl[v.FLOAT_MAT4]=16,cl[v.FLOAT_MAT2x3]=6,cl[v.FLOAT_MAT2x4]=8,cl[v.FLOAT_MAT4x3]=12,cl[v.FLOAT_MAT4x2]=8,cl[v.FLOAT_MAT3x4]=12,cl[v.FLOAT_MAT3x2]=6,cl[v.INT_VEC2]=2,cl[v.INT_VEC3]=3,cl[v.INT_VEC4]=4,cl[v.UNSIGNED_INT_VEC2]=2,cl[v.UNSIGNED_INT_VEC3]=3,cl[v.UNSIGNED_INT_VEC4]=4,cl[v.BOOL_VEC2]=2,cl[v.BOOL_VEC3]=3,cl[v.BOOL_VEC4]=4,cl),dl=gl(Float32Array),ml=gl(Int32Array),vl=gl(Uint8Array);function yl(t){return function(e,r,i,n){var o={start:r[1],dirty:!0};if(r[2]>1){var s=e;if(s.length){for(var a=n[1]||s.length,u=r[4]/t.BYTES_PER_ELEMENT,l=o.buffer=new t(a*u),c=n[0]||0,h=0;h<a;h++)l[h*u]=s[h+c];o.start+=c*u}}else o.buffer=new t([e]);return o}}function gl(t){return function(e,r,i,n){for(var o=r[8],s=r[2],a=r[5],u=1===s?o:r[4],l=a?u/a:1,c=u/t.BYTES_PER_ELEMENT/l,h=o/t.BYTES_PER_ELEMENT/c,f=pl[r[0]],p=f/l,d=(n[0]||0)*f,m=n[1]?l*n[1]:h,v=new t(c*m),y={start:r[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,T=d;g<m;g++){for(var E=0;E<p;E++)v[x+E]=e[T+E];x+=c,T+=p}return y}}function xl(t,e){for(var r=[],i=[],n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),o=function(n){var o=t.getActiveUniformBlockName(e,n),s={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:""};s.used=s.usedByVertexShader||s.usedByFragmentShader,r[n]=s;for(var a=s.uniformIndices,u=[],l=0;l<a.length;l++){var c=t.getActiveUniform(e,a[l]).name.replace("[0]","");s.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,a,r).forEach((function(t,e){var r=u[e];s.uniforms[r][i]=+t}))}));for(l=0;l<u.length;l++){var h=s.uniforms[u[l]],f=s.uniforms[u[l+1]],p=f?f[1]:s.size;h[8]=p-h[1]}s.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("+"),fl("".concat(e,"+"),"".concat(r,"+"),"".concat(n.length,"+"))}(s)+""},s=0;s<n;++s)o(s);return{blockSpecs:r,blockUniformNames:i}}(hl={})[v.FLOAT]=yl(Float32Array),hl[v.INT]=yl(Int32Array),hl[v.UNSIGNED_INT]=yl(Uint32Array),hl[v.SHORT]=yl(Int16Array),hl[v.BOOL]=yl(Uint8Array),hl[v.UNSIGNED_SHORT]=yl(Uint16Array),hl[v.FLOAT_VEC2]=dl,hl[v.FLOAT_VEC3]=dl,hl[v.FLOAT_VEC4]=dl,hl[v.FLOAT_MAT2]=dl,hl[v.FLOAT_MAT3]=dl,hl[v.FLOAT_MAT4]=dl,hl[v.FLOAT_MAT2x3]=dl,hl[v.FLOAT_MAT2x4]=dl,hl[v.FLOAT_MAT4x3]=dl,hl[v.FLOAT_MAT4x2]=dl,hl[v.FLOAT_MAT3x4]=dl,hl[v.FLOAT_MAT3x2]=dl,hl[v.INT_VEC2]=ml,hl[v.INT_VEC3]=ml,hl[v.INT_VEC4]=ml,hl[v.UNSIGNED_INT_VEC2]=ml,hl[v.UNSIGNED_INT_VEC3]=ml,hl[v.UNSIGNED_INT_VEC4]=ml,hl[v.BOOL_VEC2]=vl,hl[v.BOOL_VEC3]=vl,hl[v.BOOL_VEC4]=vl;var Tl=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(),g(o)){var s=xl(o,e),a=s.blockSpecs;s.blockUniformNames,a.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 Xu(this.engine,"".concat(t.name,"-").concat(n)))||console.error("创建vao对象失败"),t.vaos[n]=r),r&&r.vao&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var r=i.attribInfoMap[e],n=t.attributes[e];if(n){var s=t.buffers[n.dataSource];if(!s)throw Error("no buffer named ".concat(n.dataSource||e));s.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),s=o.name,a=o.type,u=o.size,l=t.getAttribLocation(e,s);r[s]={type:a,name:s,size:u,loc:l}}return r},t.prototype.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),El=function(t){function e(e){var r=t.call(this,e)||this;return r.initialized=!1,r.uniformLocations={},r.samplerChannels={},r}return r(e,t),e.prototype.initialize=function(t){this.initialized||t.getGLPipelineContext().shaderLibrary.compileShader(this)},e.prototype.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},e.prototype.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},e.prototype.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},e.prototype.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},e.prototype.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},e.prototype.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},e.prototype.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},e.prototype.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},e.prototype.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},e.prototype.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},e.prototype.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},e.prototype.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},e.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 s=r[i];this.samplerChannels[s]=i}},e.prototype.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null===(t=this.program)||void 0===t||t.dispose()},e}(ci),bl=0,Sl=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 i=e.glslVersion===t.GLSLVersion.GLSL3?"#version 300 es\n":"",n=e.vertex?i+e.vertex:"",o=e.fragment?i+e.fragment:"",s=!1;return(e.shared||e.cacheId)&&(s=!0),this.cachedShaders[r]=new El({vertex:n,fragment:o,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 s={vertex:n.vertex,fragment:n.fragment,name:n.name,shared:o},a=this.pipelineContext.gl,u={shared:s.shared,status:t.ShaderCompileResultStatus.compiling},l=this.createProgram(a,s.vertex,s.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==a.getProgramParameter(u.program,c.COMPLETION_STATUS_KHR))&&l();if(n){if(u.status!==t.ShaderCompileResultStatus.fail){ju(n,s.name);var h=new Tl(i.engine,n,o,e.id);if(a.validateProgram(n),a.getProgramParameter(n,a.VALIDATE_STATUS))f(h);else{var d=a.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",s.vertex,"\nfragment:\n",s.fragment),a.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_"+bl++,e},e.prototype.createProgram=function(e,r,i,n){var o=e.createProgram(),s=this.createGLShader(e,e.VERTEX_SHADER,r),a=this.createGLShader(e,e.FRAGMENT_SHADER,i);return o&&s&&a?(e.attachShader(o,s),e.attachShader(o,a),e.linkProgram(o),n.program=o,n.status=t.ShaderCompileResultStatus.compiling,function(){if(delete n.program,!e.getProgramParameter(o,e.LINK_STATUS)){var u=Al(e,s,"vertex",r),l=Al(e,a,"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=fl(null!=r?r:""),o=i.get(n);if(o)return o;var s=t.createShader(e);return s&&(t.shaderSource(s,r),t.compileShader(s),i.set(n,s)),s},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 Al(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 Rl=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new Sl(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=v.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.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}(),Cl=function(e){function n(r,n,o){var s=e.call(this)||this;s.canvas=r,s.temporaryRTs={};var a=i({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},o);s.context=new ol(r,n,a);var u=s.context.gl;return rt(u),s.engine=new sl(u),s.engine.renderer=s,s.pipelineContext=new Rl(s.engine,u),s.glRenderer=new Yu(s.engine),s.extension=new il(s),s.renderingData={currentFrame:{}},s.frameBuffer=new ll({storeAction:{},viewport:[0,0,s.width,s.height],attachments:[new Uu(s.engine,{sourceType:t.TextureSourceType.framebuffer,data:{width:s.width,height:s.height}})],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},s),s}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,J(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;l.isDestroyed||l.getVisible()&&(l.material?(l.material.initialize(),l.geometry.initialize(),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)):console.warn("Mesh "+l.name+" 没有绑定材质。"))}}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){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,s){if(this.temporaryRTs[e])return this.temporaryRTs[e];var a,u,l=t.RenderPassAttachmentStorageType.none;o===t.FilterMode.Linear?a=v.LINEAR:o===t.FilterMode.Nearest&&(a=v.NEAREST),s===t.RenderTextureFormat.RGBA32?u=v.UNSIGNED_BYTE:s===t.RenderTextureFormat.RGBAHalf&&(u=v.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 Uu(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:a,magFilter:a,internalFormat:v.RGBA,format:v.RGBA,type:u}),h=new ll({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=v.COLOR_BUFFER_BIT}if(e.stencilAction===t.TextureLoadAction.clear&&(r.stencilMask(255),r.clearStencil(e.clearStencil||0),i|=v.STENCIL_BUFFER_BIT),e.depthAction===t.TextureLoadAction.clear){var o=e.clearDepth;r.depthMask(!0),r.clearDepth(Number.isFinite(o)?o:1),i|=v.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(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null===(t=this.glRenderer)||void 0===t||t.dispose(),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 sl(t),this.engine.renderer=this,this.pipelineContext=new Rl(this.engine,t),this.glRenderer=new Yu(this.engine),this.extension=new il(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}(An),_l="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",wl="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Ol="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Ml="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Ll="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Il="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg";var Pl=new Map,Fl=!1,Vl=1,Nl=function(){function e(t){var e,r,a=this;this.compositions=[],this.displayScale=1,this.resumePending=!1,this.disposed=!1,this.assetManagers=[],this.speed=1,this.baseCompositionIndex=0,this.lost=function(t){var e,r;null===(e=a.ticker)||void 0===e||e.pause(),a.compositions.forEach((function(e){return e.lost(t)})),a.renderer.lost(t),null===(r=a.handleWebGLContextLost)||void 0===r||r.call(a,t),zl(a,!1)},this.restore=function(){return n(a,void 0,void 0,(function(){var t,e,r,i=this;return o(this,(function(s){switch(s.label){case 0:return this.renderer.restore(),t=this,[4,Promise.all(this.compositions.map((function(t){return n(i,void 0,void 0,(function(){var e,r,i,n,s,a,u,l,c,h,f,p;return o(this,(function(o){switch(o.label){case 0:return e=t.time,r=t.url,i=t.speed,n=t.keepResource,s=t.reusable,a=t.renderOrder,u=t.transform,l=t.videoState,[4,this.loadScene(r)];case 1:(c=o.sent()).speed=i,c.reusable=s,c.keepResource=n,c.renderOrder=a,c.transform=u,h=0,o.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:o.sent(),o.label=4;case 4:return h++,[3,2];case 5:return c.content.start(),c.gotoAndPlay(e),[2,c]}}))}))})))];case 1:return t.compositions=s.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=a.handlePlayableUpdate)||void 0===t||t.call(a,{player:a,playing:!0})},this.handleClick=function(t){var e=t.x,r=t.y;a.compositions.forEach((function(t){var n,o=t.hitTest(e,r);if(o.length)for(var s=0;s<o.length;s++){var u=o[s].behavior||w.NOTIFY;u===w.NOTIFY?t.onItemClicked?t.onItemClicked(i({},o[s])):null===(n=a.handleItemClicked)||void 0===n||n.call(a,i(i({},o[s]),{compositionId:t.id,compositionName:t.name,composition:t.name,player:a})):u===w.RESUME_PLAYER&&a.resume()}}))};var u=t.container,l=t.canvas,c=t.gl,h=t.fps,f=t.name,p=t.pixelRatio,d=t.manualRender,v=t.interactive,y=t.reportGPUTime,g=t.onMessageItem,x=t.onPausedByItem,T=t.onItemClicked,E=t.onPlayableUpdate,b=t.onRenderError,S=t.onWebGLContextLost,A=t.onWebGLContextRestored,R=t.renderFramework,C=t.env,_=void 0===C?"":C,O=t.notifyTouch;if(m.length)throw new Error("Errors before player create: ".concat(m.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(!Fl&&"debug-disable"!==R){var P,F=Z()||(P=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===P[1]||"16"===P[1]&&"5"===P[2])?"webgl":"webgl2";if(R&&(F="webgl"===R?"webgl":"webgl2"),this.handleWebGLContextLost=S,this.handleWebGLContextRestored=A,this.reportGPUTime=y,this.handleItemClicked=T,this.handleMessageItem=g,this.handlePlayableUpdate=E,this.handleRenderError=b,this.handlePlayerPause=function(t){a.pause(),null==x||x({name:t.name,player:a})},this.pixelRatio=Number.isFinite(p)?p:W(),this.offscreenMode=!0,this.env=_,l)this.canvas=l;else if(c){this.canvas=c.canvas;var V=c instanceof WebGLRenderingContext?"webgl":"webgl2";F!==V&&(Je.error("The gl context(".concat(V,") is inconsistent with renderFramework or default version(").concat(F,")")),F=V)}else Bl(u),this.canvas=document.createElement("canvas"),u.appendChild(this.canvas);this.renderer=An.create(this.canvas,F,{preserveDrawingBuffer:L,premultipliedAlpha:I}),this.renderer.env=_,this.renderer.addLostHandler({lost:this.lost}),this.renderer.addRestoreHandler({restore:this.restore}),this.gpuCapability=this.renderer.engine.gpuCapability,Pl.forEach((function(t){t.gpuCapability.type!==a.gpuCapability.type&&Je.warn("Create player with different webgl version: old=".concat(t.gpuCapability.type,", new=").concat(a.gpuCapability.type))})),d||(this.ticker=new Du(h),this.ticker.add(this.tick.bind(this))),this.event=new Mr(this.canvas,!!O),this.event.bindListeners(),this.event.addEventListener(Rr,this.handleClick),this.interactive=null!=v&&v,this.name=f||"".concat(Vl++),c||this.resize(),Pn(this.gpuCapability.detail),this.container=this.canvas.parentElement,Pl.set(this.canvas,this),function(){var t,e,r=[];try{for(var i=s(Pl.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&&Je.error("Current running player count: ".concat(r.length,", see ").concat(Il),r)}(),zl(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 n(this,void 0,void 0,(function(){var i,s,a=this;return o(this,(function(u){switch(u.label){case 0:return s=this.baseCompositionIndex,er(t)?(this.baseCompositionIndex+=t.length,[4,Promise.all(t.map((function(t,r){return n(a,void 0,void 0,(function(){var i;return o(this,(function(n){switch(n.label){case 0:return[4,this.createComposition(t,e)];case 1:return(i=n.sent()).setIndex(s+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(s),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={}),n(this,void 0,void 0,(function(){var r,n,s,a,u,l,c,h,f=this;return o(this,(function(o){switch(o.label){case 0:return r=this.renderer,n=performance.now(),s=i({autoplay:!0},e),Dl(t)?(a=t.scene,s=i(i({},s),t.options||{})):a=t,u=new Mu(s),this.assetManagers.push(u),[4,u.loadScene(a,this.renderer,{env:this.env})];case 1:if(l=o.sent(),this.disposed)throw new Error("Disposed player can not used to create Composition");return c=new Vu(i(i({},s),{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,onPlayerPause:this.handlePlayerPause,onMessageItem:this.handleMessageItem}),l),this.ticker&&c.renderLevel===E.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),[4,new Promise((function(t){f.renderer.getShaderLibrary().compileAllShaders((function(){t(null)}))}))];case 2:return o.sent(),s.autoplay?(this.autoPlaying=!0,c.play()):c.pause(),h=performance.now()-n+c.statistic.loadTime,c.statistic.firstFrameTime=h,Je.info("first frame: [".concat(c.name,"]").concat(h.toFixed(4),"ms")),this.compositions.push(c),[2,c]}}))}))},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 n(this,void 0,void 0,(function(){return o(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,s,a,u=this,l=this.renderer.engine.renderErrors;l.size>0&&(null===(i=this.handleRenderError)||void 0===i||i.call(this,l.values().next().value),null===(n=this.ticker)||void 0===n||n.pause()),e=Math.min(e,33)*this.speed;var c=this.compositions,h=!1;c.sort((function(t,e){return t.getIndex()-e.getIndex()})),this.compositions=[];for(var f=0;f<c.length;f++){var p=c[f];p.textureOffloaded?(h=!0,Je.error("Composition ".concat(p.name," texture offloaded, skip render.")),this.compositions.push(p)):(!p.isDestroyed&&p.renderer&&p.update(e),p.isDestroyed||this.compositions.push(p))}if(this.baseCompositionIndex=this.compositions.length,h)return null===(o=this.handleRenderError)||void 0===o||o.call(this,new Error("play when texture offloaded")),null===(s=this.ticker)||void 0===s?void 0:s.pause();if(!this.paused||r){var m=this.gpuCapability.level,v=this.renderer.context.gl,y=2===m&&this.reportGPUTime?d(v):void 0;if(null==y||y.begin(),this.compositions.length||this.compositions.length<c.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(f=0;f<c.length;f++)!c[f].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(c[f].renderFrame)}null==y||y.end(),null==y||y.getTime().then((function(t){var e;return null===(e=u.reportGPUTime)||void 0===e?void 0:e.call(u,null!=t?t:0)})).catch,this.autoPlaying&&(null===(a=this.handlePlayableUpdate)||void 0===a||a.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 s=this.getTargetSize(o);e=s[0],r=s[1],i=s[2],n=s[3]}else e=i=this.canvas.width,r=n=this.canvas.height;var a=e/r;if(e&&r){var u=document.documentElement.clientWidth;i>2*u&&Je.error("DPI overflowed, width ".concat(i," is more than 2x document width ").concat(u,", see ").concat(wl));var l=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>l||n>l)&&(Je.error("Container size overflowed ".concat(i,"x").concat(n,", see ").concat(_l)),a>1?(i=Math.round(l),n=Math.round(l/a)):(n=Math.round(l),i=Math.round(l*a))),this.renderer.resize(i,n),this.canvas.style.width=e+"px",this.canvas.style.height=r+"px",Je.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=a}))}},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.destroyItem=function(t,e){},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;if(Je.info("call player destroy: ".concat(this.name)),!this.disposed){Pl.delete(this.canvas),this.pause(),null===(e=this.ticker)||void 0===e||e.stop(),this.assetManagers.forEach((function(t){return t.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),zl(this,!1),this.canvas instanceof HTMLCanvasElement&&!t&&this.renderer.context&&(Bs.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var r,i=(r=this.name,"Never use destroyed player: ".concat(r," again, see ").concat(Ll)),n=function(){return function(t){throw new Error(t)}(i)},o=function(){return t=i,Promise.reject(t);var t};this.tick=n,this.resize=n,this.loadScene=o,this.play=o,this.gotoAndPlay=o,this.gotoAndStop=o,this.playSequence=n,this.destroyCurrentCompositions=n,this.resume=o,this.disposed=!0}},e.prototype.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},e.prototype.getTargetSize=function(t){Bl(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,s=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(Ol));e=r=o=s=1}return[o,s,e,r]},e}();function Dl(t){return ir(t)&&"scene"in t&&"options"in t}function zl(t,e){Object.keys(fr).forEach((function(r){var i=fr[r],n=e?i.onPlayerCreated:i.onPlayerDestroy;null==n||n(t)}))}function Bl(t){if(null==t)throw new Error("Container is not an HTMLElement, see ".concat(Ml))}qr.create=function(t,e){return new Uu(t,e)},qr.createWithData=function(e,r,i){void 0===r&&(r=K("#fff")),void 0===i&&(i={});var n=i,o=n.type,s=void 0===o?v.UNSIGNED_BYTE:o,a=n.format,u=void 0===a?v.RGBA:a,l=n.internalFormat,c=n.wrapS,h=void 0===c?v.MIRRORED_REPEAT:c,f=n.wrapT,p=void 0===f?v.MIRRORED_REPEAT:f,d=n.minFilter,m=void 0===d?v.NEAREST:d,y=n.magFilter,g=void 0===y?v.NEAREST:y,x=n.flipY,T=void 0!==x&&x;return new Uu(e,{data:r,type:s,sourceType:t.TextureSourceType.data,format:u,internalFormat:l||u,wrapS:h,wrapT:p,minFilter:m,magFilter:g,flipY:T})},ui.create=function(t,e){return new rl(t,e)},bi.create=function(t,e){return new Ju(t,e)},Li.create=function(t,e){return new Li(t,e)},mn.create=function(t){return new al(t)},Sn.create=function(t,e){return new ll(t,e)},An.create=function(t,e,r){return new Cl(t,e,r)},Nu.create=function(t){return new sl(t)};var Ul="1.6.9";Je.info("player version: "+Ul),t.AbstractPlugin=xr,t.AssetManager=Mu,t.BYTES_TYPE_MAP=Ei,t.BezierCurve=Ne,t.BezierCurvePath=De,t.COMPRESSED_TEXTURE=En,t.COPY_FRAGMENT_SHADER=di,t.COPY_MESH_SHADER_ID=fi,t.COPY_VERTEX_SHADER=pi,t.CalculateItem=Yn,t.CalculateLoader=Ss,t.CalculateVFXItem=As,t.Camera=aa,t.CameraController=Tr,t.CameraVFXItem=br,t.CameraVFXItemLoader=Er,t.Composition=Vu,t.CompositionSourceManager=_u,t.DEFAULT_FONTS=Vs,t.Downloader=Ur,t.EFFECTS_COPY_MESH_NAME=hi,t.EVENT_TYPE_CLICK=Rr,t.EVENT_TYPE_TOUCH_END=wr,t.EVENT_TYPE_TOUCH_MOVE=_r,t.EVENT_TYPE_TOUCH_START=Cr,t.Engine=Nu,t.EventSystem=Mr,t.FILTER_NAME_NONE=h,t.FilterSpriteVFXItem=Qn,t.Float16ArrayWrapper=Kt,t.FrameBuffer=Sn,t.GLEngine=sl,t.GLGeometry=Ju,t.GLRenderer=Cl,t.GPUCapability=yn,t.Geometry=bi,t.GlobalUniforms=dn,t.GradientValue=Fe,t.HELP_LINK=f,t.InteractBehavior=Or,t.InteractItem=Mn,t.InteractLoader=On,t.InteractMesh=Cn,t.InteractVFXItem=_n,t.KTXTexture=Qr,t.LineSegments=Ve,t.LinearValue=Pe,t.Material=ui,t.MaterialDataBlock=ii,t.Mesh=Li,t.PLAYER_OPTIONS_ENV_EDITOR=c,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleLoader=bs,t.ParticleMesh=vs,t.ParticleSystem=rs,t.ParticleVFXItem=ds,t.PassTextureCache=xi,t.Player=Nl,t.PluginSystem=vr,t.QCanvasViewer=Ms,t.QText=Os,t.RENDER_PASS_NAME_PREFIX=ln,t.RENDER_PREFER_LOOKUP_TEXTURE=Ai,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=Me,t.RandomValue=Le,t.RandomVectorValue=Ie,t.RenderBuffer=mn,t.RenderFrame=hn,t.RenderPass=Ni,t.RenderPassPriorityNormal=Ii,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=Fi,t.Renderer=An,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=l,t.SemanticMap=Ti,t.Shader=ci,t.SpriteItem=Zn,t.SpriteLoader=Gn,t.SpriteMesh=In,t.SpriteVFXItem=qn,t.StaticValue=Oe,t.TEMPLATE_USE_OFFSCREEN_CANVAS=Ri,t.TextItem=Ws,t.TextLoader=qs,t.TextMesh=Rs,t.TextVFXItem=Zs,t.Texture=qr,t.TextureFactory=ti,t.Ticker=Du,t.TimelineComponent=Ze,t.Transform=lr,t.VFXItem=cr,t.ValueGetter=we,t.addByOrder=$,t.addItem=z,t.addItemWithOrder=U,t.alphaFrameFrag=Xi,t.alphaMaskFrag=Hi,t.assertExist=rt,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=qi,t.bloomThresholdVert=Ki,t.calculateTranslation=te,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=Yi,t.canvasPool=Bs,t.colorGradingFrag=Ji,t.colorStopsFromGradient=H,t.colorToArr=G,t.combineImageTemplate=Ys,t.combineImageTemplate1=Is,t.combineImageTemplate1Async=function(t,e,r,i,s){return n(this,void 0,void 0,(function(){return o(this,(function(n){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,Is(t,e,r,i,s)]}))}))},t.combineImageTemplate2=Hs,t.combineImageTemplate2Async=function(t,e,r,i,s){return n(this,void 0,void 0,(function(){return o(this,(function(n){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,Hs(t,e,r,i,s)]}))}))},t.combineImageTemplateAsync=function(t,e,r,i,s){return n(this,void 0,void 0,(function(){return o(this,(function(n){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,Ys(t,e,r,i,s)]}))}))},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.convertAnchor=ae,t.copyFrag=li,t.createCopyShader=mi,t.createFilter=D,t.createFilterShaders=N,t.createGLContext=p,t.createKeyFrameMeta=Xe,t.createShaderWithMarcos=Nr,t.createShape=vo,t.createVFXItem=hr,t.createValueGetter=Be,t.decimalEqual=he,t.deepClone=function t(e){if(er(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=un,t.defaultPlugins=pr,t.delayFrag=ji,t.deserializeMipmapTexture=jr,t.disableAllPlayer=function(t){Fl=!!t},t.distortionFrag=Wi,t.distortionVert=Zi,t.earcut=Bo,t.enlargeBuffer=k,t.ensureVec3=ee,t.filters=xa,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=$i,t.gaussianDownVFrag=tn,t.gaussianUpFrag=en,t.generateEmptyTypedArray=Si,t.generateHalfFloatTexture=Kr,t.getActivePlayers=function(){return Array.from(Pl.values())},t.getBackgroundImage=Us,t.getColorFromGradientStops=X,t.getConfig=_i,t.getDefaultTemplateCanvasPool=function(){return Bs},t.getDefaultTextureFactory=ei,t.getGeometryByShape=Yo,t.getGeometryTriangles=Ho,t.getImageItemRenderInfo=Fn,t.getKTXTextureOptions=Jr,t.getKeyFrameMetaByRawValue=Ge,t.getParticleMeshShader=xs,t.getPixelRatio=W,t.getPlayerByCanvas=function(t){return Pl.get(t)},t.getPreMultiAlpha=Ir,t.getStandardComposition=xu,t.getStandardImage=gu,t.getStandardItem=Su,t.getStandardJSON=vu,t.getTextureSize=fn,t.glContext=v,t.gpuTimer=d,t.imageDataFromColor=K,t.imageDataFromGradient=Q,t.initErrors=m,t.initGLContext=y,t.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",t.interpolateColor=Y,t.isAlipayMiniApp=function(){return"undefined"!=typeof my&&"web"===(null===my||void 0===my?void 0:my.renderTarget)},t.isAndroid=Z,t.isArray=er,t.isCanvasUsedByPlayer=function(t){return Pl.has(t)},t.isFunction=rr,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=ir,t.isScene=wu,t.isSceneWithOptions=Dl,t.isSimulatorCellPhone=q,t.isString=tr,t.isUniformStruct=ni,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&ni(t[0])},t.isValidFontFamily=it,t.isWebGL2=g,t.itemFrag=Bi,t.itemFrameFrag=Di,t.itemVert=zi,t.loadBinary=Hr,t.loadBlob=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new Promise((function(e,r){(new Ur).downloadBlob(t,e,(function(e,i){r("Couldn't load blob ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))},t.loadImage=Xr,t.loadMedia=ks,t.loadVideo=Yr,t.loadWebPOptional=Gr,t.logger=Je,t.math=Zt,t.modifyMaxKeyframeShader=Ts,t.nearestPowerOfTwo=ue,t.noop=$e,t.numberToFix=fe,t.parsePercent=j,t.particleFrag=Ui,t.particleOriginTranslateMap=se,t.particleUniformTypeMap=ms,t.particleVert=ki,t.pluginLoaderMap=fr,t.pointOnLine=function(t,e,r,i,n,o){var s=t*i+e*n+r*o-n*i-o*t-r*e;return s>-.001&&s<.001},t.random=nr,t.registerFilter=F,t.registerFilters=V,t.registerPlugin=mr,t.removeItem=B,t.requestAsync=Ls,t.rotateVec2=jo,t.screenMeshVert=Qi,t.setBlendMode=Dr,t.setConfig=function(t,e){return Ci[t]=e},t.setDefaultTextureFactory=function(t){$r=t},t.setMaskMode=Br,t.setMaxSpriteMeshItemCount=function(e){t.maxSpriteMeshItemCount=e},t.setRayFromCamera=le,t.setSideMode=zr,t.setSpriteMeshMaxFragmentTextures=function(e){t.maxSpriteTextureCount=e},t.setSpriteMeshMaxItemCountByGPU=Pn,t.sortByOrder=J,t.spec=bt,t.spriteMeshShaderFromFilter=Vn,t.spriteMeshShaderFromRenderInfo=Dn,t.spriteMeshShaderIdFromRenderInfo=Nn,t.thresholdFrag=rn,t.throwDestroyedError=or,t.trailVert=Gi,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=ce,t.unregisterPlugin=function(t){delete dr[t],delete fr[t],B(pr,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#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",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=ie,t.vecFill=re,t.vecMulCombine=oe,t.vecNormalize=ne,t.version=Ul,Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
20
|
+
*/!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(ua||(ua={})),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"}(la||(la={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(ca||(ca={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(ha||(ha={})),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"}(fa||(fa={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(pa||(pa={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(da||(da={})),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"}(ma||(ma={})),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"}(va||(va={})),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"}(ya||(ya={})),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"}(ga||(ga={}));var Ta,Ea,ba,Sa,Aa,Ra,Ca,_a,wa,Oa,Ma,La,Ia,Pa,Fa,Va,Na,Da,za=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=za]="landscape"}(Ta||(Ta={})),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"}(Ea||(Ea={})),function(t){t.video="video",t.image="image"}(ba||(ba={})),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"}(Sa||(Sa={})),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"}(Aa||(Aa={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(Ra||(Ra={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(Ca||(Ca={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(_a||(_a={})),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"}(wa||(wa={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(Oa||(Oa={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(Ma||(Ma={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(La||(La={})),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"}(Ia||(Ia={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(Pa||(Pa={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(Fa||(Fa={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(Va||(Va={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(Na||(Na={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(Da||(Da={}));var Ba=function(){return Ba=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},Ba.apply(this,arguments)};function Ua(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 ka(t,e){if(!t.includes(e))return t.push(e),!0}function Ga(t,e,r){if(t)for(var i in t)Object.hasOwnProperty.call(t,i)&&e.call(r,t[i],i);return t}function Xa(t){if(Number.isFinite(t))return[Sa.CONSTANT,t];if(t){var e=t[0],r=t[1];if(Array.isArray(e))return;if("static"===e||e===Sa.CONSTANT)return[Sa.CONSTANT,t[1]];if("lines"===e)return[Sa.LINE,t[1]];if(e===Sa.LINE){var i=r.map((function(t){return[Aa.LINE,t]}));return[Sa.BEZIER_CURVE,i]}return"curve"===e||e===Sa.CURVE?[Sa.BEZIER_CURVE,ou(r)]:t}}function Ha(t,e){return Array.isArray(t)&&"random"===t[0]?[Sa.CONSTANT,t[1][e]]:Xa(t)}function Ya(t){return t&&"color"===t[0]?qa(t[1],!0):[1,1,1,1]}function ja(t,e){if(t)return"colors"===t[0]?[Sa.COLORS,t[1].map((function(t){return qa(t,e)}))]:"gradient"===t[0]?Za(t[1],e):"color"===t[0]?[Sa.RGBA_COLOR,qa(t[1],e)]:t}function Wa(t){return t&&"random"===t[0]?[Sa.RANDOM,t[1]]:Xa(t)}function Za(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=qa(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]})),[Sa.GRADIENT_COLOR,r]}}function qa(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 Ka(t,e){return Array.isArray(t)?t[0]===Sa.GRADIENT_COLOR?t:("gradient"===t[0]||"color"===t[0])&&Za(t[1],e):Za(t,e)}function Qa(t){if(t){if(3===t.length)return[Sa.CONSTANT_VEC3,t];var e=t[0];if("path"===e||"bezier"===e||e===Sa.BEZIER_PATH||e===Sa.LINEAR_PATH){var r=t[1],i=r[0],n=r[1],o=r[2],s=ou(i);if(!o){o=[];for(var a=0;a<n.length;a++){var u=n[a].slice();0===a?o.push(u):a<n.length-1?(o.push(u),o.push(u)):o.push(u)}}return[Sa.BEZIER_CURVE_PATH,[s,n,o]]}return t}}function Ja(t){var e,r;try{for(var i=Ua(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 $a(t){var e,r;try{for(var i=Ua(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 tu=Math.cos,eu=Math.sin,ru=Math.PI/180,iu=180/Math.PI;function nu(t,e,r,i){var n=r[0],o=r[1],s=i[0],a=s-n;return[[n+(s-n)/3,o+(t*=a)/3],[s-(s-n)/3,i[1]-(e*=a)/3]]}function ou(t){for(var e=-1e6,r=1e6,i=0;i<t.length;i++)e=Math.max(e,t[i][1]),r=Math.min(r,t[i][1]);var n=[[t[0][0],t[0][1]]];for(i=0;i<t.length-1;i++){var o=t[i][3]*(e-r),s=t[i+1][2]*(e-r),a=[t[i][0],t[i][1]],u=[t[i+1][0],t[i+1][1]];if(a[0]!=u[0]){var l=nu(o,s,a,u),c=l[0],h=l[1];n[n.length-1].push(c[0]),n[n.length-1].push(c[1]),n.push([h[0],h[1],u[0],u[1]])}else n[n.length-1].push(u[0]),n[n.length-1].push(u[1])}return n.map((function(t,e){return 0===e?[Aa.EASE_OUT,t]:e===n.length-1?[Aa.EASE_IN,t]:[Aa.EASE,t]}))}function su(t){var e,r=t.options,i=t.transform,n={type:fa.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=Ba(Ba({},t.shape),{type:fa[o]}),t.shape.upDirection){var s=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)s.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 s}(t.shape.upDirection,3),a=s[0],u=s[1],l=s[2];0===a&&0===u&&0===l&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=Wa(r.turbulenceX),n.turbulenceY=Wa(r.turbulenceY),n.turbulenceZ=Wa(r.turbulenceZ));var c=t.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map((function(t){return Ja(t)}))),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map((function(t){return Ja(t)}))),c.rateOverTime&&(c.rateOverTime=Wa(c.rateOverTime));var h={renderer:t.renderer,shape:n,splits:t.splits,emission:c,options:{startLifetime:Wa(r.startLifetime),start3DSize:!!r.start3DSize,startSize:Wa(r.startSize),startSizeX:Wa(r.startSizeX),startSizeY:Wa(r.startSizeY),sizeAspect:Wa(r.sizeAspect),maxCount:r.maxCount,startDelay:Wa(r.startDelay),startColor:ja(r.startColor,!0),startRotationZ:Wa(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(h.options.startRotationX=Wa(r.startRotationX),h.options.startRotationY=Wa(r.startRotationY)),t.filter){var f={};Ga(t.filter,(function(t,e){var r;f[e]=(r=t,Array.isArray(r)&&"string"==typeof r[0]&&(Wa(r)||Qa(r)||ja(r))||r)})),h.filter=f}i&&i.path&&(h.emitterTransform={path:Qa(i.path)});var p=t.sizeOverLifetime;p&&(p.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:Wa(p.x),y:Wa(p.y)}:h.sizeOverLifetime={size:Wa(p.size)});var d=t.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?Xa(m):void 0,h.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:Xa(r.gravityModifier),startSpeed:Wa(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:Wa(d.linearX),linearY:Wa(d.linearY),linearZ:Wa(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:Wa(d.orbitalX),orbitalY:Wa(d.orbitalY),orbitalZ:Wa(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:Xa(d.forceCurve)},$a(h.positionOverLifetime);var v=t.rotationOverLifetime;v&&(h.rotationOverLifetime={separateAxes:v.separateAxes,asRotation:v.asRotation,z:Wa(v.separateAxes?v.z:v.angularVelocity)},v.separateAxes&&(h.rotationOverLifetime.y=Xa(v.y),h.rotationOverLifetime.x=Xa(v.x)));var y=t.colorOverLifetime;if(y){var g=h.colorOverLifetime={opacity:Xa(y.opacity)};y.color&&(g.color=Ka(y.color))}var x=t.textureSheetAnimation;x&&(h.textureSheetAnimation={row:x.row,col:x.col,total:x.total,animate:x.animate,cycles:Xa(x.cycles),animationDelay:Ha(x.animationDelay,0),animationDuration:Ha(x.animationDuration,0)});var T=t.trails;T&&(h.trails={lifetime:Wa(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:Xa(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&Ka(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&Ka(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:Wa(T.opacityOverLifetime)}),h.trails&&$a(h.trails);var E=t.interaction;return E&&(h.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),h}function au(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:Qa(null===(r=t.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:Xa(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:Xa(n.linearX),linearY:Xa(n.linearY),linearZ:Xa(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:Xa(n.orbitalX),orbitalY:Xa(n.orbitalY),orbitalZ:Xa(n.orbitalZ),speedOverLifetime:Xa(n.speedOverLifetime)};$a(o);var s={options:{startColor:Ya(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 a=t.rotationOverLifetime;if(a){var u=s.rotationOverLifetime={separateAxes:a.separateAxes,asRotation:a.asRotation};u.separateAxes?(u.x=Xa(a.x),u.y=Xa(a.y),u.z=Xa(a.z)):u.z=Xa(a.angularVelocity)}var l=t.colorOverLifetime;if(l){var c=s.colorOverLifetime={opacity:Xa(l.opacity)};l.color&&(c.color=Ka(l.color))}var h=t.sizeOverLifetime;return h&&(s.sizeOverLifetime={separateAxes:h.separateAxes,size:Xa(h.size),x:Xa(h.x),y:Xa(h.y),z:Xa(h.z)}),s}function uu(t,e){var r=au(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 lu=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],cu=["path","position"];function hu(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===va.null&&t.endBehavior===Ra.destroy&&(t.endBehavior=Ra.freeze)}))})),t.version="2.1",t}function fu(t){var e,r;if(t)try{for(var i=Ua(Object.keys(t)),n=i.next();!n.done;n=i.next()){var o=n.value,s=t[o],a=Array.isArray(s);a&&2===s.length&&Array.isArray(s[1])?t[o]="path"===o?Qa(s):Xa(s):a||"object"!=typeof s||fu(s)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}var pu=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,du=/^(\d+)\.(\d+)$/,mu=!1;function vu(t){var e;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!==va.mesh&&t.type!==va.light||(t.endBehavior=1===t.endBehavior?Ra.destroy:t.endBehavior)}))}))}(t),pu.test(t.version))return mu="0"===(null===(e=/^(\d+)/.exec(t.version))||void 0===e?void 0:e[0]),hu(function(t){var e,r;yu="1.0";var i=t.plugins||[];(null===(e=t.bins)||void 0===e?void 0:e.length)&&(yu="1.3");var n=(t.requires||[]).slice(),o=t.images.map((function(e,r){return gu(e,r,t.imageTags||[])})),s=t.textures||o.map((function(t,e){return{source:e,flipY:!0}})),a={plugins:i,shapes:t.shapes||[],type:"ge",version:yu,playerVersion:null!==(r=t.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return xu(t,{plugins:i,requires:n})})),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:s,bins:(t.bins||[]).slice()};t._textures&&(a._textures=t._textures);return a}(t));var r=du.exec(t.version)||[],i=Number(r[1]),n=Number(r[2]);if(i)return(i<2||2===i&&n<4)&&function(t){t.compositions.map((function(t){var e,r;try{for(var i=Ua(t.items),n=i.next();!n.done;n=i.next())fu(n.value.content)}catch(t){e={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}}))}(t),i<2?hu(t):t;throw Error("invalid json version "+t.version)}var yu="1.0";function gu(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,webp:t.webp,renderLevel:i,oriY:n};if(t&&t.sourceType)return t;throw Error("invalid image type")}function xu(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Object.assign({clipMode:za},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return Su(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 Tu,Eu=[0,0,0,1],bu=.5;function Su(t,e){var r,i,n;void 0===e&&(e={});var o,s,a,u,l,c,h=va.base,f=t.endBehavior,p=NaN;if(t.content?(h=t.type||va.plugin,c=t.pn,l=t.pluginName,a=t.content,s=t.content,isNaN(c)&&!l&&(l=a.options.type),t.duration&&(p=t.duration),o=t.transform||y(s.transform),h===va.filter&&(yu<"1.1"&&(yu="1.1"),(a=uu(s,o)).filter=function(t){var e={};return Ga(t,(function(t,r){lu.includes(r)?e[r]=Xa(t):cu.includes(r)?e[r]=Qa(t):e[r]=t})),e}(s.filter))):t.particle?(h=va.particle,o=y((s=t.particle).transform,mu,!0),a=su(s)):t.sprite?(h=va.sprite,a=uu(s=t.sprite,o=y(s.transform,!1,!0))):t.cal?(h=va.null,a=au(s=t.cal,o=y(s.transform,!1,!0))):t.ui?(h=va.interact,o=y((s=t.ui).transform),a=function(t){var e,r=t.options;switch(r.type){case"click":e={type:da.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&Ya(r.previewColor),behavior:r.behavior||ma.NOTIFY};break;case"drag":e={type:da.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:da.MESSAGE}}return{options:e}}(s),o.scale=[s.options.width||1,s.options.height||1,1]):t.model&&(s=t.model,1===t.model.options.type&&(h=va.camera,o=y(s.transform),a=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 s={path:Qa(null===(r=t.transform)||void 0===r?void 0:r.path),linearX:Xa(null==o?void 0:o.translateX),linearY:Xa(null==o?void 0:o.translateY),linearZ:Xa(null==o?void 0:o.translateZ)};$a(s),n.positionOverLifetime=s}var a=t.rotationOverLifetime;if(a){var u={separateAxes:a.separateAxes,x:Xa(null==a?void 0:a.rotateX),y:Xa(null==a?void 0:a.rotateY),z:a.separateAxes?Xa(null==a?void 0:a.rotateZ):Xa(a.rotation)};$a(u),n.rotationOverLifetime=u}return n}(s))),null===(r=a.renderer)||void 0===r?void 0:r.anchor){var d=new Float32Array(a.renderer.anchor);d[0]==bu&&d[1]==bu?delete a.renderer.anchor:e.requires&&ka(e.requires,"anchor")}if(s){var m=null===(i=s.options)||void 0===i?void 0:i.looping;f=m?Array.isArray(m)?m[1]?Ra.loop:Ra.destroy:Ra.loop:f||(null===(n=null==s?void 0:s.options)||void 0===n?void 0:n.endBehavior)||Ra.destroy,s.options.renderLevel&&(u=s.options.renderLevel),isNaN(p)&&(p=s.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:p,id:t.id+"",transform:o,endBehavior:f,renderLevel:u,content:a};return l?e.plugins?(ka(e.plugins,l),v.pn=e.plugins.indexOf(l)):v.pluginName=l:Number.isInteger(c)&&(v.pn=c),t.parentId&&(v.parentId=t.parentId+""),v;function y(t,e,r){if(t){var i={},n=t.rotation;if(n&&(i.rotation=e?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var o=(s=Eu,a=i.rotation[0],u=i.rotation[1],l=i.rotation[2],c=tu(a*ru/2),h=tu(u*ru/2),f=tu(l*ru/2),p=eu(a*ru/2),d=eu(u*ru/2),m=eu(l*ru/2),s[0]=p*h*f+c*d*m,s[1]=c*d*f-p*h*m,s[2]=c*h*m+p*d*f,s[3]=c*h*f-p*d*m,s);i.rotation=function(t,e){var r,i,n,o=e[0],s=e[1],a=e[2],u=e[3],l=o+o,c=s+s,h=a+a,f=o*l,p=s*l,d=s*c,m=a*h,v=u*h,y=1-d-m,g=p-v,x=p+v,T=1-f-m,E=a*l-u*c,b=a*c+u*l,S=1-f-d;return t[1]=Math.asin((i=-1,(r=-E)>(n=1)?n:r<i?i:r))*iu,Math.abs(E)<.9999999?(t[0]=Math.atan2(b,S)*iu,t[2]=Math.atan2(x,y)*iu):(t[0]=0,t[2]=Math.atan2(-g,T)*iu),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 s,a,u,l,c,h,f,p,d,m;return{}}}var Au=((Tu={})[E.S]=[E.S,E.BPlus,E.APlus],Tu[E.A]=[E.A,E.BPlus,E.APlus],Tu[E.B]=[E.B,E.BPlus],Tu);function Ru(t,e){if(!t||!e)return!0;var r=Au[e];return!!r&&r.includes(t)}var Cu=0,_u=function(){function t(t,e){var r,i;this.refCompositions=new Map,this.refCompositionProps=new Map,this.mask=0;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.map((function(t){return t&&(t instanceof qr?t:qr.create(e,t))}));t.textureOptions=p,null==p||p.forEach((function(t){return null==t?void 0:t.initialize()}));try{for(var d=s(c),m=d.next();!m.done;m=d.next()){var v=m.value;v.id===f?this.composition=v:this.refCompositions.set(v.id,v)}}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,Cu=0,this.textureOptions=a,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,s=t.globalVolume,a=t.startTime,u=void 0===a?0:a,l=this.assembleItems(t);return{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:l,camera:o,startTime:u,globalVolume:s}},t.prototype.assembleItems=function(t){var e=this,r=[];return t.items.forEach((function(t){var n,o={},s=t.visible,a=t.renderLevel,u=t.type;if(!1!==s){var l=i({},t.content);if(l&&(o.content=i({},l),Ru(a,e.renderLevel))){var c=o.content;if(o.type=u,c.renderer){c.renderer=e.changeTex(c.renderer),e.processMask(c.renderer);var h=c.splits&&!c.textureSheetAnimation&&c.splits[0];Number.isInteger(c.renderer.shape)?c.renderer.shape=Yo(null===(n=e.jsonScene)||void 0===n?void 0:n.shapes[c.renderer.shape],h):c.renderer.shape&&ir(c.renderer.shape)&&(c.renderer.shape=Yo(c.renderer.shape,h))}else o.content.renderer={order:0};c.trails&&(c.trails=e.changeTex(c.trails)),c.filter&&(c.filter=i({},c.filter));var f=t.name,p=t.delay,d=void 0===p?0:p,m=t.id,v=t.parentId,y=t.duration,g=t.endBehavior,x=t.pluginName,T=t.pn,E=t.transform,b=t.refCount,S=e.jsonScene.plugins,A=void 0===S?[]:S;if(o.name=f,o.delay=d,o.id=m,v&&(o.parentId=v),o.refCount=b,o.duration=y,o.listIndex=Cu++,o.endBehavior=g,x?o.pluginName=x:void 0!==T&&Number.isInteger(T)&&(o.pluginName=A[T]),E&&(o.transform=E),o.type===O.composition){e.mask++;var R=t.content.options.refId;if(!e.refCompositions.get(R))throw new Error("Invalid Ref Composition id: "+R);var C=e.getContent(e.refCompositions.get(R));e.refCompositionProps.has(R)||e.refCompositionProps.set(R,C),C.items.forEach((function(t){e.processMask(t.content)})),o.items=C.items}r.push(o)}}})),r},t.prototype.changeTex=function(t){var e=t.texture,r=i({},t);return void 0!==e&&(r.texture=this.addTextureUsage(e)||e),r},t.prototype.addTextureUsage=function(t){var e,r;if(Number.isInteger(t)){var i=null===(e=this.textures)||void 0===e?void 0:e[t],n=null==i?void 0:i.id,o=null!==(r=this.imgUsage)&&void 0!==r?r:{};if(n&&o)return o.hasOwnProperty(n)||(o[n]=0),o[n]++,i}},t.prototype.processMask=function(t){if(t.maskMode!==A.NONE&&!t.mask){var e=t.maskMode;e===A.MASK?t.mask=++this.mask:e!==A.OBSCURED&&e!==A.REVERSE_OBSCURED||(t.mask=this.mask)}},t.prototype.dispose=function(){this.textureOptions=[],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}();function wu(t){return ir(t)&&"jsonScene"in t}var Ou=1,Mu=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new Ur),this.options=t,this.downloader=e,this.assets={},this.id=Ou++,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===O.text){var r=e[t.name];r&&(t.content.options.text=r)}}))})),t},e.prototype.loadScene=function(t,e,r){var s,u,l;return n(this,void 0,void 0,(function(){var c,h,f,p,d,m,v,y,g,x,T,E,b,S=this;return o(this,(function(A){return h=tr(t)?t:this.id,f=performance.now(),p=[],d=null==e?void 0:e.engine.gpuCapability,m=null!==(u=null===(s=null==d?void 0:d.detail)||void 0===s?void 0:s.asyncShaderCompile)&&void 0!==u&&u,v=null!==(l=null==d?void 0:d.detail.compressedTexture)&&void 0!==l?l:0,y={},x=!1,T=new Promise((function(t,e){g=window.setTimeout((function(){x=!0,S.removeTimer(g);var t=performance.now()-f;e("Load time out: totalTime: ".concat(t.toFixed(4),"ms ").concat(p.join(" "),", url: ").concat(h))}),1e3*S.timeout),S.timers.push(g)})),E=function(t,e){return n(S,void 0,void 0,(function(){var r,i,n,s;return o(this,(function(o){switch(o.label){case 0:if(x)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(),n=performance.now()-r,p.push("[".concat(t,": ").concat(n.toFixed(2),"]")),y[t]=n,[2,i];case 3:throw s=o.sent(),new Error("load error in ".concat(t,", ").concat(s));case 4:throw new Error("load canceled.")}}))}))},b=function(){return n(S,void 0,void 0,(function(){var n,s,u,l,d,x,T,b,S,A,R,C,_,w,O,M,L,I,P,F=this;return o(this,(function(o){switch(o.label){case 0:return ir(t)?(c=t,this.baseUrl=location.href,[3,3]):[3,1];case 1:return t=new URL(t,location.href).href,this.baseUrl=t,[4,E("loadJSON",(function(){return F.loadJSON(t)}))];case 2:c=o.sent(),o.label=3;case 3:if(!wu(c))return[3,6];if(n=i({},c),!this.options||!this.options.variables||0===Object.keys(this.options.variables).length)return[3,5];for(s=c.jsonScene.images,u=n.images,d=0;d<s.length;d++)u[d]instanceof HTMLCanvasElement&&(u[d]=s[d]);return l=n,[4,E("processImages",(function(){return F.processImages(u,n.usedImages,v)}))];case 4:for(l.images=o.sent(),d=0;d<n.images.length;d++)n.textureOptions[d].image=n.images[d];n.jsonScene.compositions=this.updateSceneData(n.jsonScene.compositions),o.label=5;case 5:return[3,12];case 6:return[4,E("processJSON",(function(){return F.processJSON(c)}))];case 7:return x=o.sent(),T=x.usedImages,b=x.jsonScene,S=x.pluginSystem,A=b.bins,R=void 0===A?[]:A,C=b.images,_=b.compositions,w=b.fonts,[4,Promise.all([E("processBins",(function(){return F.processBins(R)})),E("processImages",(function(){return F.processImages(C,T,v)})),E("".concat(m?"async":"sync","Compile"),(function(){return F.precompile(_,S,e,r)}))])];case 8:return O=a.apply(void 0,[o.sent(),2]),M=O[0],L=O[1],[4,E("processFontURL",(function(){return F.processFontURL(w)}))];case 9:return o.sent(),[4,E("processTextures",(function(){return F.processTextures(L,M,b)}))];case 10:return I=o.sent(),b.compositions=this.updateSceneData(b.compositions),n={timeInfos:y,url:t,renderLevel:this.options.renderLevel,storage:{},pluginSystem:S,jsonScene:b,usedImages:T,images:L,textureOptions:I,bins:M},[4,E("processPlugins",(function(){return S.loadResources(n,F.options)}))];case 11:o.sent(),o.label=12;case 12:return P=performance.now()-f,Je.info("Load asset: totalTime: ".concat(P.toFixed(4),"ms ").concat(p.join(" "),", url: ").concat(h)),window.clearTimeout(g),this.removeTimer(g),n.totalTime=P,n.startTime=f,n.timeInfos=y,[2,n]}}))}))},[2,Promise.race([T,b()])]}))}))},e.prototype.precompile=function(t,e,r,i){return n(this,void 0,void 0,(function(){var n;return o(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 n(this,void 0,void 0,(function(){var e,r,i,n,s,a,u,l,c;return o(this,(function(o){switch(o.label){case 0:return e=vu(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,s=e.imgUsage,a=e.images,[4,(u=new vr(i)).processRawJSON(e,this.options)];case 1:return o.sent(),l=this.options.renderLevel,c={},s?function(t,e,r,i,n){for(var o=0;o<e.length;o++){var s=r[e[o].id];if(s)for(var a=0;a<s.length;a++){var u=s[a];Ru(i[u].renderLevel,n)&&(t[u]=!0)}}}(c,n,s,a,l):null==a||a.forEach((function(t,e){c[e]=!0})),[2,{usedImages:c,jsonScene:e,pluginSystem:u}]}}))}))},e.prototype.processBins=function(t){return n(this,void 0,void 0,(function(){var e,r,i,n=this;return o(this,(function(o){return e=this.options.renderLevel,r=this.baseUrl,i=t.map((function(i){if(i instanceof ArrayBuffer)return i;if(Ru(i.renderLevel,e))return n.loadBins(new URL(i.url,r).href);throw new Error("Invalid bins source: ".concat(JSON.stringify(t)))})),[2,Promise.all(i)]}))}))},e.prototype.processFontURL=function(t){return n(this,void 0,void 0,(function(){var r,i=this;return o(this,(function(s){return t?(r=t.map((function(t){return n(i,void 0,void 0,(function(){var r,i,n;return o(this,(function(o){switch(o.label){case 0:if(!t.fontURL||e.fonts.has(t.fontFamily))return[3,4];it(t.fontFamily)||console.warn("Risky font family: ".concat(t.fontFamily)),o.label=1;case 1:return o.trys.push([1,3,,4]),r=new URL(t.fontURL,this.baseUrl).href,[4,(i=new FontFace(null!==(n=t.fontFamily)&&void 0!==n?n:"","url("+r+")")).load()];case 2:return o.sent(),document.fonts.add(i),e.fonts.add(t.fontFamily),[3,4];case 3:return o.sent(),Je.warn("Invalid font family or font 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 n(this,void 0,void 0,(function(){var s,a,u,l,c,h=this;return o(this,(function(f){return s=this.options,a=s.useCompressedTexture,u=s.variables,l=this.baseUrl,c=e.map((function(e,s){return n(h,void 0,void 0,(function(){var n,c,h,f,p,d,m,v,y,g,x,T,E,b,S,A,R,C;return o(this,(function(o){switch(o.label){case 0:if(!r[s])return[2,void 0];if(n=e.url,c=e.webp,h=new URL(n,l).href,f=c&&new URL(c,l).href,!("template"in e))return[3,13];if(p=e.template,d="v"in p&&2===p.v&&p.background,m=d?p.background:void 0,!d||!m)return[3,8];v=Us(p,u),y=m.type===st.video,g=m&&y?Yr:Xr,o.label=1;case 1:return o.trys.push([1,6,,7]),[4,ks(v,g)];case 2:return(T=o.sent())instanceof HTMLVideoElement?[2,T]:[3,3];case 3:return m&&Array.isArray(v)&&u&&(u[m.name]=T.src),[4,Ys(T,p,u,this.options,-1===e.oriY)];case 4:return[2,o.sent()];case 5:return[3,7];case 6:throw x=o.sent(),new Error("Failed to load. Check the template or if the URL is ".concat(y?"video":"image"," type, URL: ").concat(v,", Error: ").concat(x.message));case 7:return[3,12];case 8:return o.trys.push([8,11,,12]),[4,Gr(h,f)];case 9:return[4,Ys((T=o.sent()).image,p,u,this.options,-1===e.oriY)];case 10:return[2,o.sent()];case 11:throw o.sent(),new Error("Failed to load. Check the template, URL: ".concat(h,"."));case 12:return[3,14];case 13:if("type"in e&&"video"===e.type)return console.warn("The video element is deprecated. Use template BackgroundType.video instead."),[2,Yr(e.url)];if("compressed"in e&&a&&i){if(E=e.compressed,b=void 0,i===En.ASTC?b=E.astc:i===En.PVRTC&&(b=E.pvrtc),b)return S=new URL(b,l).href,this.assets[s]={url:S,type:t.TextureSourceType.compressed},[2,this.loadBins(S)]}else{if("sourceType"in e)return[2,e];if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof qr)return[2,e]}o.label=14;case 14:return[4,Gr(h,f)];case 15:return A=o.sent(),R=A.url,C=A.image,this.assets[s]={url:R,type:t.TextureSourceType.image},[2,C]}}))}))})),[2,Promise.all(c)]}))}))},e.prototype.processTextures=function(e,r,s){var a;return n(this,void 0,void 0,(function(){var n,u,l=this;return o(this,(function(o){return n=null!==(a=s.textures)&&void 0!==a?a:e.map((function(t,e){return{source:e}})),u=n.map((function(n,o){if(n instanceof qr)return n;if("mipmaps"in n)try{return jr(n,r,s.bins)}catch(t){throw new Error("load texture ".concat(o," fails, error message: ").concat(t))}var a=n.source,u=e[a];if(u){var c=function(e,r){if(e instanceof qr)return e.source;if(e instanceof HTMLImageElement||function(t){var e;return"object"==typeof t&&null!==t&&"CANVAS"===(null===(e=t.tagName)||void 0===e?void 0:e.toUpperCase())}(e))return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:v.LINEAR,magFilter:v.LINEAR};if(e instanceof HTMLVideoElement)return{sourceType:t.TextureSourceType.video,video:e,minFilter:v.LINEAR,magFilter:v.LINEAR};if(e instanceof ArrayBuffer)return i(i({},Jr(e)),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:v.CLAMP_TO_EDGE,wrapT:v.CLAMP_TO_EDGE,minFilter:v.NEAREST,magFilter:v.NEAREST};throw new Error("Invalid texture options")}(u,l.assets[o]);return c.sourceType===t.TextureSourceType.compressed?c:i(i({},c),n)}throw new Error("Invalid texture source: ".concat(a))})),[2,Promise.all(u)]}))}))},e.prototype.loadJSON=function(t){return n(this,void 0,void 0,(function(){var e=this;return o(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 n(this,void 0,void 0,(function(){var e=this;return o(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}();var Lu,Iu,Pu=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.items=[],t.itemTree=[],t.itemCacheMap=new Map,t.itemsToRemove=[],t.tempQueue=[],t}return r(n,e),Object.defineProperty(n.prototype,"type",{get:function(){return O.composition},enumerable:!1,configurable:!0}),n.prototype.onConstructed=function(t){var e=t.items,r=void 0===e?[]:e,i=t.startTime,n=void 0===i?0:i,o=t.content,s=t.refId;this.refId=s,this.itemProps=r,this.contentProps=o;var a=this.endBehavior;5!==a&&1!==a&&3!==a||(this.freezeOnEnd=!0),this.startTime=n,this.startTimeInms=Math.round(1e3*this.startTime)},n.prototype.createContent=function(){if(!this.items.length&&this.composition)for(var e=0;e<this.itemProps.length;e++){var r=void 0,o=this.itemProps[e];if(t.Item.isComposition(o)){var s=o.content.options.refId;(r=new n(i({refId:s},o),this.composition)).contentProps=o.content,r.transform.parentTransform=this.transform,this.composition.refContent.push(r),5===r.endBehavior&&(this.composition.autoRefTex=!1),r.createContent()}else(r=hr(this.itemProps[e],this.composition)).transform.parentTransform=cr.isCamera(r)?new lr:this.transform;cr.isExtraCamera(r)&&(this.extraCamera=r),this.items.push(r),this.tempQueue.push(r)}!this.content&&this.contentProps&&(this._content=this.doCreateContent())},n.prototype.doCreateContent=function(){var t=new Yn(this.contentProps,this);return t.renderData=t.getRenderData(0,!0),t},n.prototype.onLifetimeBegin=function(){var t;null===(t=this.items)||void 0===t||t.forEach((function(t){t.start(),t.createContent()})),this.buildItemTree()},n.prototype.doStop=function(){this.items&&this.items.forEach((function(t){return t.stop()}))},n.prototype.onItemUpdate=function(t,e){var r,i,n=this;if(this.content&&(this.content.updateTime(this.time),this.content.getRenderData(this.content.time)),this.items){null===(r=this.composition)||void 0===r||r.updatePluginLoaders(t);var o=[];this.itemsToRemove.length&&(this.itemsToRemove.forEach((function(t){var e,r,i=n.itemCacheMap.get(t.id);if(i){var o=i.children;if(i.parentId){var s=n.itemCacheMap.get(i.parentId);s?(s.children.splice(s.children.indexOf(i),1),o.forEach((function(t){return n.setItemParent(t.item,s.item)}))):(o.forEach((function(t){return n.setItemParent(t.item,void 0)})),(e=n.itemTree).push.apply(e,u([],a(o),!1)))}else(r=n.itemTree).splice.apply(r,u([n.itemTree.indexOf(i),1],a(o),!1)),o.forEach((function(t){return n.setItemParent(t.item,void 0)}));n.itemCacheMap.delete(t.id),n.items.splice(n.items.indexOf(t),1)}})),this.itemsToRemove.length=0);for(var s=0;s<this.itemTree.length;s++){if((c=this.itemTree[s])&&c.item){var l=c.item;cr.isComposition(l)&&l.ended&&5===l.endBehavior?l.restart():l.onUpdate(t),o.push.apply(o,u([],a(c.children),!1))}}for(;o.length;){var c;if((c=o.shift())&&c.item)(l=c.item).onUpdate(t),o.push.apply(o,u([],a(c.children),!1)),l.composition||z(this.itemsToRemove,l)}null===(i=this.extraCamera)||void 0===i||i.onUpdate(t)}},n.prototype.onItemRemoved=function(t){this.items&&(this.items.forEach((function(t){return t.dispose()})),this.items.length=0,this.itemTree.length=0,this.itemCacheMap.clear())},n.prototype.reset=function(){e.prototype.reset.call(this),this.itemTree=[],this.itemCacheMap.clear(),this.tempQueue.length=0,this.itemsToRemove.length=0},n.prototype.handleVisibleChanged=function(t){this.items.forEach((function(e){return e.setVisible(t)}))},n.prototype.setScale=function(t,e,r){this.content&&(this.content.startSize=new It(t,e,r))},n.prototype.scale=function(t,e,r){if(this.content){var i=this.content.startSize.clone();this.content.startSize=new It(t*i.x,e*i.y,r*i.z)}},n.prototype.getUpdateTime=function(t){var e=this.startTimeInms,r=this.timeInms;if(t<0&&r+t<e)return e-r;if(this.freezeOnEnd){var i=this.durInms-r;if(i<t)return i}return t},n.prototype.removeItem=function(t){var e,r=this;if(this.items.indexOf(t)>-1){if(z(this.itemsToRemove,t),cr.isTree(t)||cr.isNull(t)){var i=6===t.endBehavior,n=cr.isNull(t)&&!!this.itemCacheMap.get(t.id);((null===(e=this.itemCacheMap.get(t.id))||void 0===e?void 0:e.children)||[]).forEach((function(t){n||r.setItemParent(t.item,void 0),i&&r.removeItem(t.item)}))}return!0}return this.items.forEach((function(e){if(cr.isComposition(e)&&e.items.indexOf(t)>-1)return e.removeItem(t),!0})),!1},n.prototype.setItemParent=function(t,e){var r=this.itemCacheMap.get(t.id);if(r)if(e){var i=this.itemCacheMap.get(e.id);if(r.parentId){var n=this.itemCacheMap.get(r.parentId);n.children.splice(n.children.indexOf(r),1)}t.parent=e,r.parentId=e.id,i.children.push(r),t.transform.parentTransform=e.transform}else r.parentId=void 0,t.parent=void 0,t.transform.parentTransform=cr.isExtraCamera(t)?new lr:this.transform;else console.error("item has been remove, please set item's parent in valid lifetime")},n.prototype.getItemCurrentParent=function(t){var e=t.id,r=this.itemCacheMap.get(e);if(r){var i=r.parentId;if(i){var n=this.itemCacheMap.get(i);return i&&n?n.item:void 0}}},n.prototype.getItemByName=function(t){var e,r,i=[];try{for(var n=s(this.items),o=n.next();!o.done;o=n.next()){var l=o.value;l.name===t?i.push(l):cr.isComposition(l)&&i.push.apply(i,u([],a(l.getItemByName(t)),!1))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return i},n.prototype.hitTest=function(e,r,i,n,o,s){for(var a=[],u=(null==s?void 0:s.stop)||$e,l=(null==s?void 0:s.skip)||$e,c=(null==s?void 0:s.maxCount)||this.items.length,h=0;h<this.items.length&&n.length<c;h++){var f=this.items[h];if(f.lifetime>=0&&f.lifetime<=1&&!cr.isComposition(f)&&!l(f)){var p=f.getHitTestParams(o);if(p){var d=!1,m=new It;if(p.type===t.HitTestType.triangle)for(var v=p.triangles,y=p.backfaceCulling,g=0;g<v.length;g++){var x=v[g];if(e.intersectTriangle(x,m,y)){d=!0,a.push(m);break}}else if(p.type===t.HitTestType.box){var T=p.center,E=p.size,b=T.clone().addScaledVector(E,.5),S=T.clone().addScaledVector(E,-.5);e.intersectBox({min:b,max:S},m)&&(d=!0,a.push(m))}else if(p.type===t.HitTestType.sphere){T=p.center;var A=p.radius;e.intersectSphere({center:T,radius:A},m)&&(d=!0,a.push(m))}else if(p.type===t.HitTestType.custom){var R=p.collect(e,new Lt(r,i));R&&R.length>0&&(R.forEach((function(t){a.push(t)})),d=!0)}if(d){var C={compContent:this,id:f.id,name:f.name,position:a[a.length-1],parentId:f.parentId,hitPositions:a,behavior:p.behavior};if(n.push(C),u(C))return n}}}}return n},n.prototype.isEnded=function(t){return t>=this.durInms},n.prototype.buildItemTree=function(){if(!this.itemTree.length&&this.composition){this.itemTree=[];for(var t=this.itemCacheMap,e=this.tempQueue,r=function(){var r=e.shift();if(void 0===r.parentId){var n={id:r.id,item:r,children:[]};i.itemTree.push(n),t.set(r.id,n)}else{var o=i.getParentIdWithoutSuffix(r.parentId),s=t.get(o);if(s){n={id:r.id,parentId:o,item:r,children:[]};r.parent=s.item,r.transform.parentTransform=s.item.getNodeTransform(r.parentId),s.children.push(n),t.set(r.id,n)}else{if(-1===i.items.findIndex((function(t){return t.id===o})))throw Error("元素引用了不存在的元素,请检查数据");e.push(r)}}},i=this;e.length;)r()}},n.prototype.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},n.prototype.restart=function(){this.reset(),this.createContent(),this.start()},n}(cr),Fu=1,Vu=function(){function e(t,e){var r,n;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 o=t.reusable,s=void 0!==o&&o,a=t.speed,u=void 0===a?1:a,l=t.baseRenderOrder,c=void 0===l?0:l,h=t.renderer,f=t.onPlayerPause,p=t.onMessageItem,d=t.onEnd,m=t.event,v=t.width,y=t.height;this.compositionSourceManager=new _u(e,h.engine),e.jsonScene.imgUsage=void 0,s&&(this.keepResource=!0,e.textures=void 0,e.consumed=!0);var g=this.compositionSourceManager,x=g.sourceContent,T=g.pluginSystem,E=g.imgUsage,b=g.totalTime,S=g.renderLevel,A=g.refCompositionProps;rt(x),this.refCompositionProps=A;var R=new Pu(x,this),C=!s&&E;this.transform=new lr({name:this.name}),R.transform=this.transform,this.globalVolume=x.globalVolume,this.width=v,this.height=y,this.renderOrder=c,this.id=Fu++,this.renderer=h,this.texInfo=null!=C?C:{},this.event=m,this.statistic={loadTime:null!=b?b:0,loadStart:null!==(r=e.startTime)&&void 0!==r?r:0,firstFrameTime:0,precompileTime:null!==(n=e.timeInfos.asyncCompile)&&void 0!==n?n:e.timeInfos.syncCompile},this.reusable=s,this.speed=u,this.renderLevel=S,this.autoRefTex=!this.keepResource&&C&&5!==R.endBehavior,this.content=R,this.name=R.name,this.pluginSystem=T,this.pluginSystem.initializeComposition(this,e),this.camera=new aa(this.name,i(i({},null==x?void 0:x.camera),{aspect:v/y})),this.url=e.url,this.assigned=!0,this.interactive=!0,this.onPlayerPause=f,this.onMessageItem=p,this.onEnd=d,this.createRenderFrame(),this.reset()}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.content.items},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startTime",{get:function(){var t;return null!==(t=this.content.startTime)&&void 0!==t?t:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"time",{get:function(){return this.content.timeInms/1e3},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getDuration=function(){return this.content.duration},e.prototype.restart=function(){this.content.reset(),this.prepareRender(),this.reset(),this.transform.setValid(!0),this.content.start(),this.forwardTime(this.startTime),this.content.onUpdate(0),this.loaderData.spriteGroup.onUpdate(0)},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.content.ended&&this.reusable&&this.restart(),this.content.started?this.gotoAndPlay(this.time-this.startTime):this.gotoAndPlay(0)},e.prototype.pause=function(){this.paused=!0},e.prototype.resume=function(){this.paused=!1},e.prototype.gotoAndPlay=function(t){this.resume(),this.content.started||this.content.start(),this.forwardTime(t+this.startTime)},e.prototype.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},e.prototype.createRenderFrame=function(){this.renderFrame=new hn({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.content.started||this.content.start(),this.forwardTime(t+this.startTime,!0),e&&this.pause()},e.prototype.forwardTime=function(t,e){void 0===e&&(e=!1);for(var r=1e3*t-this.content.timeInms,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;this.rendererOptions=null,this.pluginSystem.plugins.forEach((function(e){return e.onCompositionWillReset(t,t.renderFrame)})),this.content.createContent(),this.content.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=this,e=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(r){r.prepareRenderFrame(t,e)&&t.postLoaders.push(r)})),this.postLoaders.forEach((function(r){return r.postProcessFrame(t,e)}))},e.prototype.shouldRestart=function(){var t=this.content,e=t.ended,r=t.endBehavior;return e&&5===r},e.prototype.shouldDispose=function(){if(this.reusable)return!1;var t=this.content,e=t.ended,r=t.endBehavior;return e&&(!r||3===r)},e.prototype.update=function(t,e){if(void 0===e&&(e=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var r=this.content.getUpdateTime(t*this.speed);this.updateVideo(),this.content.onUpdate(r),this.loaderData.spriteGroup.onUpdate(r),this.updateCamera(),this.shouldDispose()?this.dispose():e||this.prepareRender()}},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,e){if(this.content&&this.content.items)return this.content.getItemByName(t)[0]},e.prototype.getItemByID=function(t){return this.content&&this.content.items&&this.content.itemCacheMap.has(t)?this.content.itemCacheMap.get(t).item:null},e.prototype.getItemCurrentParent=function(t){return this.content.getItemCurrentParent(t)},e.prototype.itemLifetimeEvent=function(t,e){var r=this,i=e?function(e){return e.onCompositionItemLifeBegin(r,t)}:function(e){return e.onCompositionItemLifeEnd(r,t)};this.pluginSystem.plugins.forEach(i)},e.prototype.getHitTestRay=function(t,e){var r=this.renderFrame.editorTransform,i=r.x,n=r.y;return le((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){if(this.isDestroyed||!this.interactive)return[];var n=[],o=this.getHitTestRay(t,e);return this.content.hitTest(o,t,e,n,r,i),this.refContent.forEach((function(s){s.hitTest(o,t,e,n,r,i)})),n},e.prototype.addInteractiveItem=function(t,e){var r;if(e===_.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===_.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.id]){if(this.autoRefTex)--this.texInfo[n.id]||n.dispose()}else n!==(null===(r=this.rendererOptions)||void 0===r?void 0:r.emptyTexture)&&n!==this.renderFrame.transparentTexture&&n.dispose()}},e.prototype.destroyItem=function(t){var e=this;t.type==O.composition?4!==t.endBehavior&&t.items.forEach((function(t){return e.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(e,t)}))})):(this.content.removeItem(t),this.refContent.forEach((function(e){return e.removeItem(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 t,e,r=this;if(!this.destroyed){this.destroyed=!0;var i={},n=this.textures;n&&(this.keepResource?n.forEach((function(t){(null==t?void 0:t.dispose)&&(i[t.id]=t.dispose,t.dispose=$e)})):n.forEach((function(t){return t&&t.dispose()}))),this.content.dispose(),this.renderFrame.dispose(),null===(t=this.rendererOptions)||void 0===t||t.emptyTexture.dispose(),null===(e=this.pluginSystem)||void 0===e||e.destroyComposition(this),this.update=function(){Je.error("Update disposed composition: ".concat(r.name,"."))},this.onPlayerPause=$e,this.dispose=$e,n&&this.keepResource&&n.forEach((function(t){return t.dispose=i[t.id]})),this.compositionSourceManager.dispose(),this.refCompositionProps.clear()}},e.prototype.setEditorTransform=function(t,e,r){this.renderFrame.editorTransform.set(t,t,e,r)},e.prototype.translateByPixel=function(t,e){this.renderer?this.content.translateByPixel(t,e):console.warn("Can not translate position when container not assigned")},e.prototype.translate=function(t,e,r){this.content.translate(t,e,r)},e.prototype.setPosition=function(t,e,r){this.content.setPosition(t,e,r)},e.prototype.rotate=function(t,e,r){this.content.rotate(t,e,r)},e.prototype.setRotation=function(t,e,r){this.content.setRotation(t,e,r)},e.prototype.scale=function(t,e,r){this.content.scale(t,e,r)},e.prototype.setScale=function(t,e,r){this.content.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 n(this,void 0,void 0,(function(){return o(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}(),Nu=function(){function t(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderErrors=new Set}return t.prototype.addTexture=function(t){this.destroyed||z(this.textures,t)},t.prototype.removeTexture=function(t){this.destroyed||B(this.textures,t)},t.prototype.addMaterial=function(t){this.destroyed||z(this.materials,t)},t.prototype.removeMaterial=function(t){this.destroyed||B(this.materials,t)},t.prototype.addGeometry=function(t){this.destroyed||z(this.geometries,t)},t.prototype.removeGeometry=function(t){this.destroyed||B(this.geometries,t)},t.prototype.addMesh=function(t){this.destroyed||z(this.meshes,t)},t.prototype.removeMesh=function(t){this.destroyed||B(this.meshes,t)},t.prototype.addRenderPass=function(t){this.destroyed||z(this.renderPasses,t)},t.prototype.removeRenderPass=function(t){this.destroyed||B(this.renderPasses,t)},Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},t.prototype.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&&Je.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}},t}(),Du=function(){function t(t){void 0===t&&(t=60),this.paused=!0,this.lastTime=0,this.setFPS(t),this.tickers=[]}return t.prototype.getFPS=function(){return this.targetFPS},t.prototype.setFPS=function(t){this.targetFPS=Ot(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.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.tickers=[]},t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.tick=function(){if(!this.paused){var t=performance.now(),e=t-this.lastTime;if(e>=this.interval){this.lastTime=t,this.resetTickers&&(this.tickers=this.tickers.filter((function(t){return t})),this.resetTickers=!1);for(var r=0,i=this.tickers.length;r<i;r++){(0,this.tickers[r])(e)}}}},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}();mr("camera",Er,br,!0),mr("sprite",Gn,qn,!0),mr("particle",bs,ds,!0),mr("cal",Ss,As,!0),mr("interact",On,_n,!0),mr("filter",Gn,Qn,!0),mr("text",qs,Zs,!0),V(xa);var zu=((Lu={})[v.RGBA]=34842,Lu[v.RGB]=34843,Lu[v.ALPHA]=33325,Lu[v.RED]=33325,Lu[v.LUMINANCE_ALPHA]=33327,Lu[v.LUMINANCE]=33325,Lu),Bu=((Iu={})[v.RGBA]=34836,Iu[v.RGB]=34837,Iu[v.ALPHA]=33326,Iu[v.RED]=33326,Iu[v.LUMINANCE_ALPHA]=33328,Iu[v.LUMINANCE]=33326,Iu),Uu=function(e){function s(t,r){var i=e.call(this)||this;i.initialized=!1;var n=i.assembleOptions(r),o=n.sourceType,s=n.sourceFrom,a=n.name,u=void 0===a?"":a;return i.source=n,i.sourceType=o,i.sourceFrom=s,i.name=u,i.engine=t,i}return r(s,e),s.prototype.bind=function(t){this.pipelineContext.bindTexture(this.target,this.textureBuffer,t)},s.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,s=i.name;this.textureBuffer=r.createTexture(),this.textureBuffer&&ju(this.textureBuffer,s),this.target=o,this.update(this.source),this.release(),this.initialized=!0}},s.prototype.clone=function(){var t=new s(this.engine,this.source);return t.sourceFrom=this.sourceFrom,t.sourceType=this.sourceType,t.width=this.width,t.height=this.height,t},s.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}},s.prototype.update=function(e){var r,i,n,o,s=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var u=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,x=l.mipmaps,T=l.mipmaps,E=e.data,b=e.cube,S=e.generateMipmap,A=e.mipmaps,R=l,C=R.format,_=R.type,w=R.internalFormat,O=0,M=0;if(this.bind(f===t.TextureSourceType.video),_===v.HALF_FLOAT?((_=h.halfFloatTexture)||Je.error("Half float texture is not support."),g(c)&&w===C&&(C===v.LUMINANCE&&(C=v.RED),w=zu[C]),h.halfFloatLinear||(l.minFilter=l.magFilter=c.NEAREST,Je.warn("Half float linear not support, change to NEAREST."))):_===c.FLOAT&&((_=h.floatTexture)||Je.error("Float texture is not support."),g(c)&&w===C&&(C===v.LUMINANCE&&(C=v.RED),w=Bu[C]),h.floatLinear||(l.minFilter=c.NEAREST,l.magFilter=c.NEAREST,Je.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)E&&(O=null!==(n=E.width)&&void 0!==n?n:0,M=null!==(o=E.height)&&void 0!==o?o:0,O&&M&&(this.width!==O||this.height!==M)&&c.texImage2D(u,0,w,O,M,0,C,_,null));else if(f===t.TextureSourceType.data)u===c.TEXTURE_CUBE_MAP?b.forEach((function(t,e){var r=a(s.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,C,_,t),2),i=r[0],n=r[1];O=Math.max(i,O),M=Math.max(n,M)})):(r=a(this.texImage2DData(c,u,0,w,C,_,p),2),O=r[0],M=r[1]);else if(f===t.TextureSourceType.image||f===t.TextureSourceType.video){if(u===c.TEXTURE_CUBE_MAP)d.forEach((function(t,e){var r=a(s.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,w,C,_,t),2),i=r[0],n=r[1];O=Math.max(i,O),M=Math.max(n,M)}));else if(u===c.TEXTURE_2D){var L=null!=m?m:y;i=a(this.texImage2D(c,u,0,w,C,_,L),2),O=i[0],M=i[1]}S&&(ku(O)&&ku(M)||g(c))&&c.generateMipmap(u)}else if(f===t.TextureSourceType.mipmaps){var I;u===c.TEXTURE_2D?x.forEach((function(t,e){var r;I="data"in t?s.texImage2DData(c,u,e,w,C,_,t):s.texImage2D(c,u,e,w,C,_,t),0===e&&(r=a(I,2),O=r[0],M=r[1])})):u===c.TEXTURE_CUBE_MAP&&T.forEach((function(t,e){t.forEach((function(t,r){var i;I="data"in t?s.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,w,C,_,t):s.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,e,w,C,_,t),0===e&&(i=a(I,2),O=i[0],M=i[1])}))}))}else f===t.TextureSourceType.compressed&&A&&(O=A[0].width,M=A[0].height,A.forEach((function(t,e){c.compressedTexImage2D(u,e,w,t.width,t.height,0,t.data)})));this.width=O,this.height=M,this.setTextureFilters(c,u,l)},s.prototype.setTextureFilters=function(t,e,r){var i=r.anisotropic,n=void 0===i?4:i,o=r.wrapS,s=void 0===o?t.CLAMP_TO_EDGE:o,a=r.wrapT,u=void 0===a?t.CLAMP_TO_EDGE:a,l=this.engine.gpuCapability;this.target===t.TEXTURE_2D&&l.setTextureAnisotropic(t,this.target,n);var c=g(t)||ku(this.width)&&ku(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?s:t.CLAMP_TO_EDGE),t.texParameteri(e,t.TEXTURE_WRAP_T,c?u:t.CLAMP_TO_EDGE)},s.prototype.texImage2D=function(e,r,i,n,o,s,a){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,v=null!==(u=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==u?u:2048,y=a;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||a.width>v||a.height>v)&&setTimeout((function(){y=l.resizeImage(a)}))}e.texImage2D(r,i,n,o,s,y);var x=[y.width,y.height];if(h===t.TextureSourceType.video){var T=a;return[T.videoWidth,T.videoHeight]}return x},s.prototype.texImage2DData=function(t,e,r,i,n,o,s){var a=s.data,u=s.width,l=s.height,c=n===t.UNSIGNED_BYTE?new Uint8Array(a.buffer,a.byteOffset,a.byteLength/a.BYTES_PER_ELEMENT):a;return t.texImage2D(e,r,i,u,l,0,n,o,c),[u,l]},s.prototype.resizeImage=function(t,e,r){var i,n=null!==(i=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==i?i:2048;if(g(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,s=Math.min(e,r||ue(n)),a=Math.min(e,i||ue(o));if(a!==o||s!==n){var u=Bs.getCanvas(),l=u.getContext("2d");return u.width=s,u.height=a,null==l||l.drawImage(t,0,0,n,o,0,0,s,a),Je.warn("Image resize from ".concat(n,"x").concat(o," to ").concat(s,"x").concat(a)),u}}(t,n,e,r);return o||t},s.prototype.reloadData=function(){return n(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this.offloaded?[4,ei().reload(this)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))}))},s.prototype.offloadData=function(){if(this.initialized&&ei().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}},s.prototype.uploadCurrentVideoFrame=function(){return n(this,void 0,void 0,(function(){var e;return o(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]}}))}))},s.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)},s.prototype.restore=function(){},s.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(){Je.error("This texture has been destroyed.")},this.initialize=or,void 0!==this.engine&&this.engine.removeTexture(this)},s}(qr);function ku(t){return 0==(t&t-1)&&0!==t}var Gu,Xu=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 g(this.gl)&&(e=this.gl.createVertexArray()),!e&&this.vaoExt&&(e=this.vaoExt.createVertexArrayOES()),e&&ju(e,t),e},t.prototype.bindVertexArray=function(t){var e;g(this.gl)?this.gl.bindVertexArray(t):null===(e=this.vaoExt)||void 0===e||e.bindVertexArrayOES(t)},t.prototype.dispose=function(){var t;g(this.gl)?this.gl.deleteVertexArray(this.vao):null===(t=this.vaoExt)||void 0===t||t.deleteVertexArrayOES(this.vao)},t}(),Hu=1,Yu=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 Uu(e,{data:r,sourceType:t.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new Uu(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"+Hu,Hu++}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&&z(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.shader.program;if(i){var n=i.setupAttributes(r),o=this.gl,s=r.indicesBuffer,a=r.drawStart,u=r.mode,l=r.drawCount;if(s){var c=s.type,h=s.elementCount;(l=isNaN(l)?h:l)>0&&o.drawElements(u,l,c,null!=a?a:0)}else l>0&&o.drawArrays(u,a,l);null==n||n.unbind()}}else console.warn("GLGPURenderer没有绑定gl对象, 无法绘制geometry")},e.prototype.createGLFrameBuffer=function(t,e){var r=this.gl.createFramebuffer();return r&&(z(this.frameBuffers,t),ju(r,e,e)),r},e.prototype.createVAO=function(t){return new Xu(this.engine,t)},e.prototype.deleteGLTexture=function(t){t.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(t.textureBuffer),B(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),B(this.frameBuffers,t),delete t.fbo)},e.prototype.deleteGLRenderBuffer=function(t){t&&!this.destroyed&&(this.gl.deleteRenderbuffer(t.buffer),B(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){Je.error("gl lost, destroy glRenderer by default",t.target),this.deleteResource()},e.prototype.dispose=function(){this.deleteResource(),this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},e}();function ju(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 Wu,Zu=function(){function t(t,e){this.pipelineContext=t,this.byteLength=0,this.destroyed=!1;var r=e.target,i=void 0===r?v.ARRAY_BUFFER:r,n=e.type,o=void 0===n?v.FLOAT:n,s=e.name,a=e.usage,u=void 0===a?v.STATIC_DRAW:a,l=e.data,c=e.elementCount,h=function(t){var e,r;return null!==(r=null===(e=qu[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(s),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&&ju(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!!g(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,t*this.bytesPerElement,e),!0)},t}(),qu=((Gu={})[v.INT]=Int32Array,Gu[v.FLOAT]=Float32Array,Gu[v.SHORT]=Int16Array,Gu[v.BYTE]=Int8Array,Gu[v.UNSIGNED_BYTE]=Uint8Array,Gu[v.UNSIGNED_INT]=Uint32Array,Gu[v.UNSIGNED_SHORT]=Uint16Array,Gu);var Ku=((Wu={})[Uint8Array.BYTES_PER_ELEMENT]=v.UNSIGNED_BYTE,Wu[Uint16Array.BYTES_PER_ELEMENT]=v.UNSIGNED_SHORT,Wu[Uint32Array.BYTES_PER_ELEMENT]=v.UNSIGNED_INT,Wu),Qu=1,Ju=function(t){function e(e,r){var i=this,n=r.drawStart,o=void 0===n?0:n,s=r.drawCount,a=r.mode,u=r.indices,l=r.name,c=void 0===l?"effectsGeometry:".concat(Qu++):l,h=r.bufferUsage,f=void 0===h?v.STATIC_DRAW:h;(i=t.call(this,c)||this).buffers={},i.vaos={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,i.engine=e;var p={},d=[],m={},y={},g={},x=f;return i.drawStart=o,i.drawCount=isNaN(+s)?NaN:s,i.mode=isNaN(a)?v.TRIANGLES:a,Object.keys(r.attributes).forEach((function(t){var e=r.attributes[t],i=e.size,n=e.stride,o=e.offset,s=e.normalize,a=e,u=a.type,l=void 0===u?v.FLOAT:u,c=a.releasable,h=e.data;if(!l||"dataSource"in e||h||(h=Si(l)),h){var f=h instanceof Float32Array?v.FLOAT:v.INT;p[t]={data:h,usage:x,target:v.ARRAY_BUFFER,name:t},m[t]={size:i,stride:n,offset:o,type:null!=l?l:f,normalize:!!s,dataSource:t},g[t]=null!=c&&c,y[t]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var T=e.dataSource;T&&(m[t]={size:i,stride:n,offset:o,type:l,dataSource:T,normalize:!!s})}d.push(t)})),y.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},i.indices=null==u?void 0:u.data,i.indicesReleasable=!0===(null==u?void 0:u.releasable),i.bufferProps=p,i.attributes=m,i.attributesName=d,i.attributesReleasable=g,i.dirtyFlags=y,i.options=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;rt(e),e.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(e){t.buffers[e]=new Zu(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 s=new r.constructor(o);s.set(i.data),i.data=s,this.dirtyFlags[t].discard=!0}else if(!this.dirtyFlags[t].discard){var a=this.dirtyFlags[t];a.start=Math.min(a.start,n),a.end=Math.max(a.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(end);o.set(this.indices),this.indices=o,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var s=this.dirtyFlags.index;s.start=Math.min(s.start,i),s.end=Math.max(s.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*Ei[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=Ku[e.BYTES_PER_ELEMENT],i={data:e,target:v.ELEMENT_ARRAY_BUFFER,type:r,name:"".concat(this.name,"##index")};return new Zu(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,s,a=t.dirtyFlags[n];if("index"==n)o=t.indicesBuffer,s=i;else{var u=e[n].dataSource;o=t.buffers[u],s=r[u].data}if((a.dirty||a.discard)&&o&&s){if(a.discard)o.bufferData(s);else{var l=a.start*s.BYTES_PER_ELEMENT+s.byteOffset,c=a.end-a.start+1,h=new s.constructor(s.buffer,l,c);o.bufferSubData(a.start,h)}a.start=Number.POSITIVE_INFINITY,a.end=0,a.dirty=a.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.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}(bi),$u=function(){function t(){this.reset()}return t.prototype.setBlendColor=function(t){var e=a(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=a(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=a(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=a(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=[v.ONE,v.ONE_MINUS_SRC_ALPHA,v.ONE,v.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[v.FUNC_ADD,v.FUNC_ADD],this.depthTest=!1,this.depthMask=!1,this.depthRange=[0,1],this.depthFunc=v.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=[v.ALWAYS,v.ALWAYS],this.stencilOpFail=[v.KEEP,v.KEEP],this.stencilOpZFail=[v.KEEP,v.KEEP],this.stencilOpZPass=[v.KEEP,v.KEEP],this.culling=!1,this.frontFace=v.CW,this.cullFace=v.FRONT},t.prototype.apply=function(t){if(t.toggle(v.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),t.toggle(v.BLEND,this.blending),t.toggle(v.DEPTH_TEST,this.depthTest),t.toggle(v.STENCIL_TEST,this.stencilTest),t.toggle(v.CULL_FACE,this.culling),t.toggle(v.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(t.stencilMaskSeparate(v.BACK,this.stencilMask[1]),t.stencilMaskSeparate(v.FRONT,this.stencilMask[0]),t.stencilFuncSeparate(v.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),t.stencilFuncSeparate(v.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),t.stencilOpSeparate(v.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),t.stencilOpSeparate(v.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}(),tl=Ut,el=Nt,rl=function(e){function i(t,r){var i=e.call(this,r)||this;return i.floats={},i.ints={},i.vector2s={},i.vector3s={},i.vector4s={},i.quaternions={},i.matrices={},i.matrice3s={},i.textures={},i.floatArrays={},i.vector4Arrays={},i.matrixArrays={},i.samplers=[],i.uniforms=[],i.uniformDirtyFlag=!0,i.glMaterialState=new $u,i.engine=t,i}return r(i,e),Object.defineProperty(i.prototype,"blending",{get:function(){return this.glMaterialState.blending},set:function(t){void 0!==t&&this.glMaterialState.setBlending(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blendColor",{get:function(){return this.glMaterialState.blendColor},set:function(t){t&&this.glMaterialState.setBlendColor(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blendFunction",{get:function(){return this.glMaterialState.blendFunctionParameters},set:function(t){t&&this.glMaterialState.setBlendFunctionParameters(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"blendEquation",{get:function(){return this.glMaterialState.blendEquationParameters},set:function(t){t&&this.glMaterialState.setBlendEquationParameters(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthTest",{get:function(){return this.glMaterialState.depthTest},set:function(t){void 0!==t&&this.glMaterialState.setDepthTest(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthMask",{get:function(){return this.glMaterialState.depthMask},set:function(t){void 0!==t&&this.glMaterialState.setDepthMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthRange",{get:function(){return this.glMaterialState.depthRange},set:function(t){t&&this.glMaterialState.setDepthRange(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"depthFunc",{get:function(){return this.glMaterialState.depthFunc},set:function(t){void 0!==t&&this.glMaterialState.setDepthFunc(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"polygonOffsetFill",{get:function(){return this.glMaterialState.polygonOffsetFill},set:function(t){void 0!==t&&this.glMaterialState.setPolygonOffsetFill(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"polygonOffset",{get:function(){return this.glMaterialState.polygonOffset},set:function(t){t&&this.glMaterialState.setPolygonOffset(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"sampleAlphaToCoverage",{get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(t){void 0!==t&&this.glMaterialState.setSampleAlphaToCoverage(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"colorMask",{get:function(){return this.glMaterialState.colorMask},set:function(t){t&&this.glMaterialState.setColorMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilTest",{get:function(){return this.glMaterialState.stencilTest},set:function(t){void 0!==t&&this.glMaterialState.setStencilTest(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilMask",{get:function(){return this.glMaterialState.stencilMask},set:function(t){t&&this.glMaterialState.setStencilMask(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilRef",{get:function(){return this.glMaterialState.stencilRef},set:function(t){t&&this.glMaterialState.setStencilRef(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilFunc",{get:function(){return this.glMaterialState.stencilFunc},set:function(t){t&&this.glMaterialState.setStencilFunc(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilOpFail",{get:function(){return this.glMaterialState.stencilOpFail},set:function(t){t&&this.glMaterialState.setStencilOpFail(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilOpZFail",{get:function(){return this.glMaterialState.stencilOpZFail},set:function(t){t&&this.glMaterialState.setStencilOpZFail(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"stencilOpZPass",{get:function(){return this.glMaterialState.stencilOpZPass},set:function(t){t&&this.glMaterialState.setStencilOpZPass(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"culling",{get:function(){return this.glMaterialState.culling},set:function(t){void 0!==t&&this.glMaterialState.setCulling(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"frontFace",{get:function(){return this.glMaterialState.frontFace},set:function(t){void 0!==t&&this.glMaterialState.setFrontFace(t)},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"cullFace",{get:function(){return this.glMaterialState.cullFace},set:function(t){void 0!==t&&this.glMaterialState.setCullFace(t)},enumerable:!1,configurable:!0}),i.prototype.enableKeyword=function(t){throw new Error("Method not implemented.")},i.prototype.disableKeyword=function(t){throw new Error("Method not implemented.")},i.prototype.isKeywordEnabled=function(t){throw new Error("Method not implemented.")},i.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(i.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),i.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];rr(r.initialize)?r.initialize():Je.error("".concat(JSON.stringify(r)," is not valid Texture to initialize"))})),this.initialized=!0}},i.prototype.setupStates=function(t){this.glMaterialState.apply(t)},i.prototype.use=function(t,e){var r,i,n,o,a,u=t.engine.getGLPipelineContext();if(this.shader.program){var l;if(this.shader.program.bind(),this.setupStates(u),e){try{for(var c=s(e.uniforms),h=c.next();!h.done;h=c.next())l=h.value,this.checkUniform(l)}catch(t){r={error:t}}finally{try{h&&!h.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}try{for(var f=s(e.samplers),p=f.next();!p.done;p=f.next())l=p.value,this.samplers.includes(l)||(this.samplers.push(l),this.uniformDirtyFlag=!0)}catch(t){n={error:t}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}if(this.uniformDirtyFlag&&(this.shader.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirtyFlag=!1),e){for(l in e.floats)this.shader.setFloat(l,e.floats[l]);for(l in e.ints)this.shader.setInt(l,e.ints[l]);for(l in e.matrices)this.shader.setMatrix(l,e.matrices[l])}for(l in this.textures)this.textures[l].textureBuffer||this.textures[l].initialize();for(l in this.floats)this.shader.setFloat(l,this.floats[l]);for(l in this.ints)this.shader.setInt(l,this.ints[l]);for(l in this.floatArrays)this.shader.setFloats(l,this.floatArrays[l]);for(l in this.textures)this.shader.setTexture(l,this.textures[l]);for(l in this.vector2s)this.shader.setVector2(l,this.vector2s[l]);for(l in this.vector3s)this.shader.setVector3(l,this.vector3s[l]);for(l in this.vector4s)this.shader.setVector4(l,this.vector4s[l]);for(l in this.quaternions)this.shader.setQuaternion(l,this.quaternions[l]);for(l in this.matrices)this.shader.setMatrix(l,this.matrices[l]);for(l in this.matrice3s)this.shader.setMatrix3(l,this.matrice3s[l]);for(l in this.vector4Arrays)this.shader.setVector4Array(l,this.vector4Arrays[l]);for(l in this.matrixArrays)this.shader.setMatrixArray(l,this.matrixArrays[l])}else null===(a=this.engine)||void 0===a||a.renderErrors.add(new Error("Shader program is not initialized"))},i.prototype.getFloat=function(t){return this.floats[t]},i.prototype.setFloat=function(t,e){this.checkUniform(t),this.floats[t]=e},i.prototype.getInt=function(t){return this.ints[t]},i.prototype.setInt=function(t,e){this.checkUniform(t),this.ints[t]=e},i.prototype.getFloats=function(t){return this.floatArrays[t]},i.prototype.setFloats=function(t,e){this.checkUniform(t),this.floatArrays[t]=e},i.prototype.getVector2=function(t){return this.vector2s[t]},i.prototype.setVector2=function(t,e){this.checkUniform(t),this.vector2s[t]=e},i.prototype.getVector3=function(t){return this.vector3s[t]},i.prototype.setVector3=function(t,e){this.checkUniform(t),this.vector3s[t]=e},i.prototype.getVector4=function(t){return this.vector4s[t]},i.prototype.setVector4=function(t,e){this.checkUniform(t),this.vector4s[t]=e},i.prototype.getQuaternion=function(t){return this.quaternions[t]},i.prototype.setQuaternion=function(t,e){this.checkUniform(t),this.quaternions[t]=e},i.prototype.getMatrix=function(t){return this.matrices[t]},i.prototype.setMatrix=function(t,e){this.checkUniform(t),this.matrices[t]=e},i.prototype.setMatrix3=function(t,e){this.checkUniform(t),this.matrice3s[t]=e},i.prototype.getVector4Array=function(t){return this.vector4Arrays[t]},i.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}}},i.prototype.getMatrixArray=function(t){return this.matrixArrays[t]},i.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}}},i.prototype.setMatrixNumberArray=function(t,e){this.checkUniform(t),this.matrixArrays[t]=e},i.prototype.getTexture=function(t){return this.textures[t]},i.prototype.setTexture=function(t,e){this.samplers.includes(t)||(this.samplers.push(t),this.uniformDirtyFlag=!0),this.textures[t]=e},i.prototype.hasUniform=function(t){return this.uniforms.includes(t)||this.samplers.includes(t)},i.prototype.clone=function(t){var e=t||this.props,r=this.engine;rt(r);var n=new i(r,e);return n.glMaterialState=Object.assign(new $u,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.quaternions=this.quaternions,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirtyFlag=!0,n},i.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.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 tl(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 s=el.fromIdentity(),a=0;a<16;a++)s.elements[a]=r.matrixArrays[e][n+a];o.push(s)}this.setMatrixArray(e,o)}},i.prototype.checkUniform=function(t){this.uniforms.includes(t)||(this.uniforms.push(t),this.uniformDirtyFlag=!0)},i.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){i.textures[t].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=or,this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMaterial(this),this.engine=void 0))},i}(ui),il=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:v.RGBA}},i=this.renderer.engine,n=new Ju(i,{name:e,mode:v.TRIANGLE_STRIP,attributes:{aPos:{type:v.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=i.gpuCapability.level,s=new rl(i,{name:e,shader:{cacheId:"$mri-internal-copy",name:e,vertex:Nr([],"\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:Nr([],"\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}});s.blending=!1,s.depthTest=!1,s.culling=!1;var a=new Li(i,{name:e,geometry:n,material:s,priority:0});return new nl(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:t.TextureLoadAction.whatever},attachments:[r],meshes:[a]})},e.prototype.dispose=function(){var t;this.renderer&&(null===(t=this.copyRenderPass)||void 0===t||t.dispose(),this.renderer=void 0)},e}(),nl=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}(Ni),ol=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=[],rt(t),this.gl=p(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}(),sl=function(t){function e(e){var r=t.call(this)||this;return r.gpuCapability=new yn(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}(Nu),al=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):Je.error("Invalid render buffer size: ".concat(t,"x").concat(e))}}else Je.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=or},e}(mn),ul=1,ll=function(e){function i(r,i){var n,o=e.call(this)||this;o.attachmentTextures=[],o.renderer=i,o.engine=i.engine;var s=r.depthStencilAttachment,a=r.viewport,u=r.isCustomViewport,l=r.viewportScale,c=void 0===l?1:l,h=r.storeAction,f=r.name,p=void 0===f?"GLFrameBuffer".concat(ul++):f;return o.depthStencilStorageType=null!==(n=null==s?void 0:s.storageType)&&void 0!==n?n:t.RenderPassAttachmentStorageType.none,o.viewport=a,o.isCustomViewport=!!u,o.viewportScale=c,o.name=p,o.storeAction=h,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(),z(t.attachmentTextures,e.textureBuffer)})),this.stencilTexture&&z(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&z(this.attachmentTextures,this.depthTexture.textureBuffer)},i.prototype.updateProps=function(e){var r,i,n=this.renderer,o=this.engine.gpuCapability,s=null!==(r=e.depthStencilAttachment)&&void 0!==r?r:{storageType:t.RenderPassAttachmentStorageType.none},a=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(),!a&&s.storageType!==t.RenderPassAttachmentStorageType.none)throw Error("use depth stencil attachment without color attachments");a&&(this.fbo=n.glRenderer.createGLFrameBuffer(this,this.name));var h=s.storageType;if(h===t.RenderPassAttachmentStorageType.depth_stencil_opaque){if(s.storage){if(!(s.storage instanceof al))throw Error("invalid depth stencil attachment storage");this.depthStencilRenderBuffer=s.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new al({format:v.DEPTH_STENCIL,attachment:v.DEPTH_STENCIL_ATTACHMENT,storageType:h},n.glRenderer);u=!1}else if(h===t.RenderPassAttachmentStorageType.depth_16_opaque)if(s.storage){if(!(s.storage instanceof al))throw Error("invalid depth attachment storage");this.depthStencilRenderBuffer=s.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new al({attachment:v.DEPTH_ATTACHMENT,format:v.DEPTH_COMPONENT16,storageType:h},n.glRenderer);else if(h===t.RenderPassAttachmentStorageType.stencil_8_opaque)if(s.storage){if(!(s.storage instanceof al))throw Error("invalid stencil attachment storage");this.depthStencilRenderBuffer=s.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new al({attachment:v.STENCIL_ATTACHMENT,format:v.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 Uu(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:v.DEPTH_COMPONENT,internalFormat:o.internalFormatDepth16,type:v.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 Uu(this.engine,{sourceType:t.TextureSourceType.framebuffer,format:v.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&&g(i)&&n>0){var o=[];if(e.depthAction===t.TextureStoreAction.clear&&this.depthStorage&&z(o,r?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),e.stencilAction===t.TextureStoreAction.clear&&this.stencilStorage&&z(o,r?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),e.colorAction===t.TextureStoreAction.clear)for(var s=0;s<n;s++)z(o,i["COLOR_ATTACHMENT".concat(s)]);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=a(this.viewport,4),o=n[0],s=n[1],u=n[2],l=n[3];r.bindFramebuffer(i,this.fbo),r.viewport(o,s,u,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(u,l),e.framebufferRenderbuffer(i,p.attachment,e.RENDERBUFFER,p.buffer);else if(d){d.source.data={width:u,height:l},d.update({data:{width:u,height:l,data:new Uint16Array(0)}});var v=d&&m?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.framebufferTexture2D(i,v,e.TEXTURE_2D,d.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var y=e.checkFramebufferStatus(i);if(y!==e.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed, status: ".concat(y,", 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=a(this.viewport,4),o=n[0],s=n[1],u=n[2],l=n[3];o===t&&s===e&&u===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}(Sn);var cl,hl,fl=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return e>>>0},pl=((cl={})[v.FLOAT]=1,cl[v.INT]=1,cl[v.UNSIGNED_INT]=1,cl[v.SHORT]=1,cl[v.BOOL]=1,cl[v.UNSIGNED_SHORT]=1,cl[v.FLOAT_VEC2]=2,cl[v.FLOAT_VEC3]=3,cl[v.FLOAT_VEC4]=4,cl[v.FLOAT_MAT2]=4,cl[v.FLOAT_MAT3]=9,cl[v.FLOAT_MAT4]=16,cl[v.FLOAT_MAT2x3]=6,cl[v.FLOAT_MAT2x4]=8,cl[v.FLOAT_MAT4x3]=12,cl[v.FLOAT_MAT4x2]=8,cl[v.FLOAT_MAT3x4]=12,cl[v.FLOAT_MAT3x2]=6,cl[v.INT_VEC2]=2,cl[v.INT_VEC3]=3,cl[v.INT_VEC4]=4,cl[v.UNSIGNED_INT_VEC2]=2,cl[v.UNSIGNED_INT_VEC3]=3,cl[v.UNSIGNED_INT_VEC4]=4,cl[v.BOOL_VEC2]=2,cl[v.BOOL_VEC3]=3,cl[v.BOOL_VEC4]=4,cl),dl=gl(Float32Array),ml=gl(Int32Array),vl=gl(Uint8Array);function yl(t){return function(e,r,i,n){var o={start:r[1],dirty:!0};if(r[2]>1){var s=e;if(s.length){for(var a=n[1]||s.length,u=r[4]/t.BYTES_PER_ELEMENT,l=o.buffer=new t(a*u),c=n[0]||0,h=0;h<a;h++)l[h*u]=s[h+c];o.start+=c*u}}else o.buffer=new t([e]);return o}}function gl(t){return function(e,r,i,n){for(var o=r[8],s=r[2],a=r[5],u=1===s?o:r[4],l=a?u/a:1,c=u/t.BYTES_PER_ELEMENT/l,h=o/t.BYTES_PER_ELEMENT/c,f=pl[r[0]],p=f/l,d=(n[0]||0)*f,m=n[1]?l*n[1]:h,v=new t(c*m),y={start:r[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,x=0,T=d;g<m;g++){for(var E=0;E<p;E++)v[x+E]=e[T+E];x+=c,T+=p}return y}}function xl(t,e){for(var r=[],i=[],n=t.getProgramParameter(e,t.ACTIVE_UNIFORM_BLOCKS),o=function(n){var o=t.getActiveUniformBlockName(e,n),s={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:""};s.used=s.usedByVertexShader||s.usedByFragmentShader,r[n]=s;for(var a=s.uniformIndices,u=[],l=0;l<a.length;l++){var c=t.getActiveUniform(e,a[l]).name.replace("[0]","");s.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,a,r).forEach((function(t,e){var r=u[e];s.uniforms[r][i]=+t}))}));for(l=0;l<u.length;l++){var h=s.uniforms[u[l]],f=s.uniforms[u[l+1]],p=f?f[1]:s.size;h[8]=p-h[1]}s.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("+"),fl("".concat(e,"+"),"".concat(r,"+"),"".concat(n.length,"+"))}(s)+""},s=0;s<n;++s)o(s);return{blockSpecs:r,blockUniformNames:i}}(hl={})[v.FLOAT]=yl(Float32Array),hl[v.INT]=yl(Int32Array),hl[v.UNSIGNED_INT]=yl(Uint32Array),hl[v.SHORT]=yl(Int16Array),hl[v.BOOL]=yl(Uint8Array),hl[v.UNSIGNED_SHORT]=yl(Uint16Array),hl[v.FLOAT_VEC2]=dl,hl[v.FLOAT_VEC3]=dl,hl[v.FLOAT_VEC4]=dl,hl[v.FLOAT_MAT2]=dl,hl[v.FLOAT_MAT3]=dl,hl[v.FLOAT_MAT4]=dl,hl[v.FLOAT_MAT2x3]=dl,hl[v.FLOAT_MAT2x4]=dl,hl[v.FLOAT_MAT4x3]=dl,hl[v.FLOAT_MAT4x2]=dl,hl[v.FLOAT_MAT3x4]=dl,hl[v.FLOAT_MAT3x2]=dl,hl[v.INT_VEC2]=ml,hl[v.INT_VEC3]=ml,hl[v.INT_VEC4]=ml,hl[v.UNSIGNED_INT_VEC2]=ml,hl[v.UNSIGNED_INT_VEC3]=ml,hl[v.UNSIGNED_INT_VEC4]=ml,hl[v.BOOL_VEC2]=vl,hl[v.BOOL_VEC3]=vl,hl[v.BOOL_VEC4]=vl;var Tl=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(),g(o)){var s=xl(o,e),a=s.blockSpecs;s.blockUniformNames,a.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 Xu(this.engine,"".concat(t.name,"-").concat(n)))||console.error("创建vao对象失败"),t.vaos[n]=r),r&&r.vao&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(e){var r=i.attribInfoMap[e],n=t.attributes[e];if(n){var s=t.buffers[n.dataSource];if(!s)throw Error("no buffer named ".concat(n.dataSource||e));s.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),s=o.name,a=o.type,u=o.size,l=t.getAttribLocation(e,s);r[s]={type:a,name:s,size:u,loc:l}}return r},t.prototype.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},t}(),El=function(t){function e(e){var r=t.call(this,e)||this;return r.initialized=!1,r.uniformLocations={},r.samplerChannels={},r}return r(e,t),e.prototype.initialize=function(t){this.initialized||t.getGLPipelineContext().shaderLibrary.compileShader(this)},e.prototype.setFloat=function(t,e){this.pipelineContext.setFloat(this.uniformLocations[t],e)},e.prototype.setInt=function(t,e){this.pipelineContext.setInt(this.uniformLocations[t],e)},e.prototype.setFloats=function(t,e){this.pipelineContext.setFloats(this.uniformLocations[t],e)},e.prototype.setTexture=function(t,e){this.pipelineContext.setTexture(this.uniformLocations[t],this.samplerChannels[t],e)},e.prototype.setVector2=function(t,e){this.pipelineContext.setVector2(this.uniformLocations[t],e)},e.prototype.setVector3=function(t,e){this.pipelineContext.setVector3(this.uniformLocations[t],e)},e.prototype.setVector4=function(t,e){this.pipelineContext.setVector4(this.uniformLocations[t],e)},e.prototype.setQuaternion=function(t,e){this.pipelineContext.setQuaternion(this.uniformLocations[t],e)},e.prototype.setMatrix=function(t,e){this.pipelineContext.setMatrix(this.uniformLocations[t],e)},e.prototype.setMatrix3=function(t,e){this.pipelineContext.setMatrix3(this.uniformLocations[t],e)},e.prototype.setVector4Array=function(t,e){this.pipelineContext.setVector4Array(this.uniformLocations[t],e)},e.prototype.setMatrixArray=function(t,e){this.pipelineContext.setMatrixArray(this.uniformLocations[t],e)},e.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 s=r[i];this.samplerChannels[s]=i}},e.prototype.dispose=function(){var t;this.compileResult&&this.compileResult.shared||null===(t=this.program)||void 0===t||t.dispose()},e}(ci),bl=0,Sl=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 i=e.glslVersion===t.GLSLVersion.GLSL3?"#version 300 es\n":"",n=e.vertex?i+e.vertex:"",o=e.fragment?i+e.fragment:"",s=!1;return(e.shared||e.cacheId)&&(s=!0),this.cachedShaders[r]=new El({vertex:n,fragment:o,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 s={vertex:n.vertex,fragment:n.fragment,name:n.name,shared:o},a=this.pipelineContext.gl,u={shared:s.shared,status:t.ShaderCompileResultStatus.compiling},l=this.createProgram(a,s.vertex,s.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==a.getProgramParameter(u.program,c.COMPLETION_STATUS_KHR))&&l();if(n){if(u.status!==t.ShaderCompileResultStatus.fail){ju(n,s.name);var h=new Tl(i.engine,n,o,e.id);if(a.validateProgram(n),a.getProgramParameter(n,a.VALIDATE_STATUS))f(h);else{var d=a.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",s.vertex,"\nfragment:\n",s.fragment),a.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_"+bl++,e},e.prototype.createProgram=function(e,r,i,n){var o=e.createProgram(),s=this.createGLShader(e,e.VERTEX_SHADER,r),a=this.createGLShader(e,e.FRAGMENT_SHADER,i);return o&&s&&a?(e.attachShader(o,s),e.attachShader(o,a),e.linkProgram(o),n.program=o,n.status=t.ShaderCompileResultStatus.compiling,function(){if(delete n.program,!e.getProgramParameter(o,e.LINK_STATUS)){var u=Al(e,s,"vertex",r),l=Al(e,a,"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=fl(null!=r?r:""),o=i.get(n);if(o)return o;var s=t.createShader(e);return s&&(t.shaderSource(s,r),t.compileShader(s),i.set(n,s)),s},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 Al(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 Rl=function(){function t(t,e){this.engine=t,this.gl=e,this.gl=e,this.shaderLibrary=new Sl(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=v.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.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}(),Cl=function(e){function n(r,n,o){var s=e.call(this)||this;s.canvas=r,s.temporaryRTs={};var a=i({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},o);s.context=new ol(r,n,a);var u=s.context.gl;return rt(u),s.engine=new sl(u),s.engine.renderer=s,s.pipelineContext=new Rl(s.engine,u),s.glRenderer=new Yu(s.engine),s.extension=new il(s),s.renderingData={currentFrame:{}},s.frameBuffer=new ll({storeAction:{},viewport:[0,0,s.width,s.height],attachments:[new Uu(s.engine,{sourceType:t.TextureSourceType.framebuffer,data:{width:s.width,height:s.height}})],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},s),s}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,J(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;l.isDestroyed||l.getVisible()&&(l.material?(l.material.initialize(),l.geometry.initialize(),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)):console.warn("Mesh "+l.name+" 没有绑定材质。"))}}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){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,s){if(this.temporaryRTs[e])return this.temporaryRTs[e];var a,u,l=t.RenderPassAttachmentStorageType.none;o===t.FilterMode.Linear?a=v.LINEAR:o===t.FilterMode.Nearest&&(a=v.NEAREST),s===t.RenderTextureFormat.RGBA32?u=v.UNSIGNED_BYTE:s===t.RenderTextureFormat.RGBAHalf&&(u=v.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 Uu(this.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:a,magFilter:a,internalFormat:v.RGBA,format:v.RGBA,type:u}),h=new ll({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=v.COLOR_BUFFER_BIT}if(e.stencilAction===t.TextureLoadAction.clear&&(r.stencilMask(255),r.clearStencil(e.clearStencil||0),i|=v.STENCIL_BUFFER_BIT),e.depthAction===t.TextureLoadAction.clear){var o=e.clearDepth;r.depthMask(!0),r.clearDepth(Number.isFinite(o)?o:1),i|=v.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(){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null===(t=this.glRenderer)||void 0===t||t.dispose(),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 sl(t),this.engine.renderer=this,this.pipelineContext=new Rl(this.engine,t),this.glRenderer=new Yu(this.engine),this.extension=new il(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}(An),_l="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",wl="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Ol="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Ml="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Ll="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Il="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg";var Pl=new Map,Fl=!1,Vl=1,Nl=function(){function e(t){var e,r,a=this;this.compositions=[],this.displayScale=1,this.resumePending=!1,this.disposed=!1,this.assetManagers=[],this.speed=1,this.baseCompositionIndex=0,this.lost=function(t){var e,r;null===(e=a.ticker)||void 0===e||e.pause(),a.compositions.forEach((function(e){return e.lost(t)})),a.renderer.lost(t),null===(r=a.handleWebGLContextLost)||void 0===r||r.call(a,t),zl(a,!1)},this.restore=function(){return n(a,void 0,void 0,(function(){var t,e,r,i=this;return o(this,(function(s){switch(s.label){case 0:return this.renderer.restore(),t=this,[4,Promise.all(this.compositions.map((function(t){return n(i,void 0,void 0,(function(){var e,r,i,n,s,a,u,l,c,h,f,p;return o(this,(function(o){switch(o.label){case 0:return e=t.time,r=t.url,i=t.speed,n=t.keepResource,s=t.reusable,a=t.renderOrder,u=t.transform,l=t.videoState,[4,this.loadScene(r)];case 1:(c=o.sent()).speed=i,c.reusable=s,c.keepResource=n,c.renderOrder=a,c.transform=u,h=0,o.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:o.sent(),o.label=4;case 4:return h++,[3,2];case 5:return c.content.start(),c.gotoAndPlay(e),[2,c]}}))}))})))];case 1:return t.compositions=s.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=a.handlePlayableUpdate)||void 0===t||t.call(a,{player:a,playing:!0})},this.handleClick=function(t){var e=t.x,r=t.y;a.compositions.forEach((function(t){var n,o=t.hitTest(e,r);if(o.length)for(var s=0;s<o.length;s++){var u=o[s].behavior||w.NOTIFY;u===w.NOTIFY?t.onItemClicked?t.onItemClicked(i({},o[s])):null===(n=a.handleItemClicked)||void 0===n||n.call(a,i(i({},o[s]),{compositionId:t.id,compositionName:t.name,composition:t.name,player:a})):u===w.RESUME_PLAYER&&a.resume()}}))};var u=t.container,l=t.canvas,c=t.gl,h=t.fps,f=t.name,p=t.pixelRatio,d=t.manualRender,v=t.interactive,y=t.reportGPUTime,g=t.onMessageItem,x=t.onPausedByItem,T=t.onItemClicked,E=t.onPlayableUpdate,b=t.onRenderError,S=t.onWebGLContextLost,A=t.onWebGLContextRestored,R=t.renderFramework,C=t.env,_=void 0===C?"":C,O=t.notifyTouch;if(m.length)throw new Error("Errors before player create: ".concat(m.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(!Fl&&"debug-disable"!==R){var P,F=Z()||(P=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent))&&("13"===P[1]||"16"===P[1]&&"5"===P[2])?"webgl":"webgl2";if(R&&(F="webgl"===R?"webgl":"webgl2"),this.handleWebGLContextLost=S,this.handleWebGLContextRestored=A,this.reportGPUTime=y,this.handleItemClicked=T,this.handleMessageItem=g,this.handlePlayableUpdate=E,this.handleRenderError=b,this.handlePlayerPause=function(t){a.pause(),null==x||x({name:t.name,player:a})},this.pixelRatio=Number.isFinite(p)?p:W(),this.offscreenMode=!0,this.env=_,l)this.canvas=l;else if(c){this.canvas=c.canvas;var V=c instanceof WebGLRenderingContext?"webgl":"webgl2";F!==V&&(Je.error("The gl context(".concat(V,") is inconsistent with renderFramework or default version(").concat(F,")")),F=V)}else Bl(u),this.canvas=document.createElement("canvas"),u.appendChild(this.canvas);this.renderer=An.create(this.canvas,F,{preserveDrawingBuffer:L,premultipliedAlpha:I}),this.renderer.env=_,this.renderer.addLostHandler({lost:this.lost}),this.renderer.addRestoreHandler({restore:this.restore}),this.gpuCapability=this.renderer.engine.gpuCapability,Pl.forEach((function(t){t.gpuCapability.type!==a.gpuCapability.type&&Je.warn("Create player with different webgl version: old=".concat(t.gpuCapability.type,", new=").concat(a.gpuCapability.type))})),d||(this.ticker=new Du(h),this.ticker.add(this.tick.bind(this))),this.event=new Mr(this.canvas,!!O),this.event.bindListeners(),this.event.addEventListener(Rr,this.handleClick),this.interactive=null!=v&&v,this.name=f||"".concat(Vl++),c||this.resize(),Pn(this.gpuCapability.detail),this.container=this.canvas.parentElement,Pl.set(this.canvas,this),function(){var t,e,r=[];try{for(var i=s(Pl.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&&Je.error("Current running player count: ".concat(r.length,", see ").concat(Il),r)}(),zl(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 n(this,void 0,void 0,(function(){var i,s,a=this;return o(this,(function(u){switch(u.label){case 0:return s=this.baseCompositionIndex,er(t)?(this.baseCompositionIndex+=t.length,[4,Promise.all(t.map((function(t,r){return n(a,void 0,void 0,(function(){var i;return o(this,(function(n){switch(n.label){case 0:return[4,this.createComposition(t,e)];case 1:return(i=n.sent()).setIndex(s+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(s),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={}),n(this,void 0,void 0,(function(){var r,n,s,a,u,l,c,h,f=this;return o(this,(function(o){switch(o.label){case 0:return r=this.renderer,n=performance.now(),s=i({autoplay:!0},e),Dl(t)?(a=t.scene,s=i(i({},s),t.options||{})):a=t,u=new Mu(s),this.assetManagers.push(u),[4,u.loadScene(a,this.renderer,{env:this.env})];case 1:if(l=o.sent(),this.disposed)throw new Error("Disposed player can not used to create Composition");return c=new Vu(i(i({},s),{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,onPlayerPause:this.handlePlayerPause,onMessageItem:this.handleMessageItem}),l),this.ticker&&c.renderLevel===E.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),[4,new Promise((function(t){f.renderer.getShaderLibrary().compileAllShaders((function(){t(null)}))}))];case 2:return o.sent(),s.autoplay?(this.autoPlaying=!0,c.play()):c.pause(),h=performance.now()-n+c.statistic.loadTime,c.statistic.firstFrameTime=h,Je.info("first frame: [".concat(c.name,"]").concat(h.toFixed(4),"ms")),this.compositions.push(c),[2,c]}}))}))},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 n(this,void 0,void 0,(function(){return o(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,s,a,u=this,l=this.renderer.engine.renderErrors;l.size>0&&(null===(i=this.handleRenderError)||void 0===i||i.call(this,l.values().next().value),null===(n=this.ticker)||void 0===n||n.pause()),e=Math.min(e,33)*this.speed;var c=this.compositions,h=!1;c.sort((function(t,e){return t.getIndex()-e.getIndex()})),this.compositions=[];for(var f=0;f<c.length;f++){var p=c[f];p.textureOffloaded?(h=!0,Je.error("Composition ".concat(p.name," texture offloaded, skip render.")),this.compositions.push(p)):(!p.isDestroyed&&p.renderer&&p.update(e),p.isDestroyed||this.compositions.push(p))}if(this.baseCompositionIndex=this.compositions.length,h)return null===(o=this.handleRenderError)||void 0===o||o.call(this,new Error("play when texture offloaded")),null===(s=this.ticker)||void 0===s?void 0:s.pause();if(!this.paused||r){var m=this.gpuCapability.level,v=this.renderer.context.gl,y=2===m&&this.reportGPUTime?d(v):void 0;if(null==y||y.begin(),this.compositions.length||this.compositions.length<c.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(f=0;f<c.length;f++)!c[f].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(c[f].renderFrame)}null==y||y.end(),null==y||y.getTime().then((function(t){var e;return null===(e=u.reportGPUTime)||void 0===e?void 0:e.call(u,null!=t?t:0)})).catch,this.autoPlaying&&(null===(a=this.handlePlayableUpdate)||void 0===a||a.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 s=this.getTargetSize(o);e=s[0],r=s[1],i=s[2],n=s[3]}else e=i=this.canvas.width,r=n=this.canvas.height;var a=e/r;if(e&&r){var u=document.documentElement.clientWidth;i>2*u&&Je.error("DPI overflowed, width ".concat(i," is more than 2x document width ").concat(u,", see ").concat(wl));var l=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>l||n>l)&&(Je.error("Container size overflowed ".concat(i,"x").concat(n,", see ").concat(_l)),a>1?(i=Math.round(l),n=Math.round(l/a)):(n=Math.round(l),i=Math.round(l*a))),this.renderer.resize(i,n),this.canvas.style.width=e+"px",this.canvas.style.height=r+"px",Je.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=a}))}},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.destroyItem=function(t,e){},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;if(Je.info("call player destroy: ".concat(this.name)),!this.disposed){Pl.delete(this.canvas),this.pause(),null===(e=this.ticker)||void 0===e||e.stop(),this.assetManagers.forEach((function(t){return t.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),zl(this,!1),this.canvas instanceof HTMLCanvasElement&&!t&&this.renderer.context&&(Bs.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var r,i=(r=this.name,"Never use destroyed player: ".concat(r," again, see ").concat(Ll)),n=function(){return function(t){throw new Error(t)}(i)},o=function(){return t=i,Promise.reject(t);var t};this.tick=n,this.resize=n,this.loadScene=o,this.play=o,this.gotoAndPlay=o,this.gotoAndStop=o,this.playSequence=n,this.destroyCurrentCompositions=n,this.resume=o,this.disposed=!0}},e.prototype.offloadTexture=function(){this.compositions.forEach((function(t){return t.offloadTexture()}))},e.prototype.getTargetSize=function(t){Bl(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,s=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(Ol));e=r=o=s=1}return[o,s,e,r]},e}();function Dl(t){return ir(t)&&"scene"in t&&"options"in t}function zl(t,e){Object.keys(fr).forEach((function(r){var i=fr[r],n=e?i.onPlayerCreated:i.onPlayerDestroy;null==n||n(t)}))}function Bl(t){if(null==t)throw new Error("Container is not an HTMLElement, see ".concat(Ml))}qr.create=function(t,e){return new Uu(t,e)},qr.createWithData=function(e,r,i){void 0===r&&(r=K("#fff")),void 0===i&&(i={});var n=i,o=n.type,s=void 0===o?v.UNSIGNED_BYTE:o,a=n.format,u=void 0===a?v.RGBA:a,l=n.internalFormat,c=n.wrapS,h=void 0===c?v.MIRRORED_REPEAT:c,f=n.wrapT,p=void 0===f?v.MIRRORED_REPEAT:f,d=n.minFilter,m=void 0===d?v.NEAREST:d,y=n.magFilter,g=void 0===y?v.NEAREST:y,x=n.flipY,T=void 0!==x&&x;return new Uu(e,{data:r,type:s,sourceType:t.TextureSourceType.data,format:u,internalFormat:l||u,wrapS:h,wrapT:p,minFilter:m,magFilter:g,flipY:T})},ui.create=function(t,e){return new rl(t,e)},bi.create=function(t,e){return new Ju(t,e)},Li.create=function(t,e){return new Li(t,e)},mn.create=function(t){return new al(t)},Sn.create=function(t,e){return new ll(t,e)},An.create=function(t,e,r){return new Cl(t,e,r)},Nu.create=function(t){return new sl(t)};var Ul="1.6.10";Je.info("player version: "+Ul),t.AbstractPlugin=xr,t.AssetManager=Mu,t.BYTES_TYPE_MAP=Ei,t.BezierCurve=Ne,t.BezierCurvePath=De,t.COMPRESSED_TEXTURE=En,t.COPY_FRAGMENT_SHADER=di,t.COPY_MESH_SHADER_ID=fi,t.COPY_VERTEX_SHADER=pi,t.CalculateItem=Yn,t.CalculateLoader=Ss,t.CalculateVFXItem=As,t.Camera=aa,t.CameraController=Tr,t.CameraVFXItem=br,t.CameraVFXItemLoader=Er,t.Composition=Vu,t.CompositionSourceManager=_u,t.DEFAULT_FONTS=Vs,t.Downloader=Ur,t.EFFECTS_COPY_MESH_NAME=hi,t.EVENT_TYPE_CLICK=Rr,t.EVENT_TYPE_TOUCH_END=wr,t.EVENT_TYPE_TOUCH_MOVE=_r,t.EVENT_TYPE_TOUCH_START=Cr,t.Engine=Nu,t.EventSystem=Mr,t.FILTER_NAME_NONE=h,t.FilterSpriteVFXItem=Qn,t.Float16ArrayWrapper=Kt,t.FrameBuffer=Sn,t.GLEngine=sl,t.GLGeometry=Ju,t.GLRenderer=Cl,t.GPUCapability=yn,t.Geometry=bi,t.GlobalUniforms=dn,t.GradientValue=Fe,t.HELP_LINK=f,t.InteractBehavior=Or,t.InteractItem=Mn,t.InteractLoader=On,t.InteractMesh=Cn,t.InteractVFXItem=_n,t.KTXTexture=Qr,t.LineSegments=Ve,t.LinearValue=Pe,t.Material=ui,t.MaterialDataBlock=ii,t.Mesh=Li,t.PLAYER_OPTIONS_ENV_EDITOR=c,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleLoader=bs,t.ParticleMesh=vs,t.ParticleSystem=rs,t.ParticleVFXItem=ds,t.PassTextureCache=xi,t.Player=Nl,t.PluginSystem=vr,t.QCanvasViewer=Ms,t.QText=Os,t.RENDER_PASS_NAME_PREFIX=ln,t.RENDER_PREFER_LOOKUP_TEXTURE=Ai,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=Me,t.RandomValue=Le,t.RandomVectorValue=Ie,t.RenderBuffer=mn,t.RenderFrame=hn,t.RenderPass=Ni,t.RenderPassPriorityNormal=Ii,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=Fi,t.Renderer=An,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=l,t.SemanticMap=Ti,t.Shader=ci,t.SpriteItem=Zn,t.SpriteLoader=Gn,t.SpriteMesh=In,t.SpriteVFXItem=qn,t.StaticValue=Oe,t.TEMPLATE_USE_OFFSCREEN_CANVAS=Ri,t.TextItem=Ws,t.TextLoader=qs,t.TextMesh=Rs,t.TextVFXItem=Zs,t.Texture=qr,t.TextureFactory=ti,t.Ticker=Du,t.TimelineComponent=Ze,t.Transform=lr,t.VFXItem=cr,t.ValueGetter=we,t.addByOrder=$,t.addItem=z,t.addItemWithOrder=U,t.alphaFrameFrag=Xi,t.alphaMaskFrag=Hi,t.assertExist=rt,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=qi,t.bloomThresholdVert=Ki,t.calculateTranslation=te,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=Yi,t.canvasPool=Bs,t.colorGradingFrag=Ji,t.colorStopsFromGradient=H,t.colorToArr=G,t.combineImageTemplate=Ys,t.combineImageTemplate1=Is,t.combineImageTemplate1Async=function(t,e,r,i,s){return n(this,void 0,void 0,(function(){return o(this,(function(n){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,Is(t,e,r,i,s)]}))}))},t.combineImageTemplate2=Hs,t.combineImageTemplate2Async=function(t,e,r,i,s){return n(this,void 0,void 0,(function(){return o(this,(function(n){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,Hs(t,e,r,i,s)]}))}))},t.combineImageTemplateAsync=function(t,e,r,i,s){return n(this,void 0,void 0,(function(){return o(this,(function(n){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,Ys(t,e,r,i,s)]}))}))},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.convertAnchor=ae,t.copyFrag=li,t.createCopyShader=mi,t.createFilter=D,t.createFilterShaders=N,t.createGLContext=p,t.createKeyFrameMeta=Xe,t.createShaderWithMarcos=Nr,t.createShape=vo,t.createVFXItem=hr,t.createValueGetter=Be,t.decimalEqual=he,t.deepClone=function t(e){if(er(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=un,t.defaultPlugins=pr,t.delayFrag=ji,t.deserializeMipmapTexture=jr,t.disableAllPlayer=function(t){Fl=!!t},t.distortionFrag=Wi,t.distortionVert=Zi,t.earcut=Bo,t.enlargeBuffer=k,t.ensureVec3=ee,t.filters=xa,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=$i,t.gaussianDownVFrag=tn,t.gaussianUpFrag=en,t.generateEmptyTypedArray=Si,t.generateHalfFloatTexture=Kr,t.getActivePlayers=function(){return Array.from(Pl.values())},t.getBackgroundImage=Us,t.getColorFromGradientStops=X,t.getConfig=_i,t.getDefaultTemplateCanvasPool=function(){return Bs},t.getDefaultTextureFactory=ei,t.getGeometryByShape=Yo,t.getGeometryTriangles=Ho,t.getImageItemRenderInfo=Fn,t.getKTXTextureOptions=Jr,t.getKeyFrameMetaByRawValue=Ge,t.getParticleMeshShader=xs,t.getPixelRatio=W,t.getPlayerByCanvas=function(t){return Pl.get(t)},t.getPreMultiAlpha=Ir,t.getStandardComposition=xu,t.getStandardImage=gu,t.getStandardItem=Su,t.getStandardJSON=vu,t.getTextureSize=fn,t.glContext=v,t.gpuTimer=d,t.imageDataFromColor=K,t.imageDataFromGradient=Q,t.initErrors=m,t.initGLContext=y,t.integrate="float calculateMovement(float t,vec2 p1,vec2 p2,vec2 p3,vec2 p4){float movement=0.0;float h=(t-p1.x)*0.05;for(int i=0;i<=20;i++){float t=float(i)*h;float nt=binarySearchT(t,p1.x,p2.x,p3.x,p4.x);float y=cubicBezier(nt,p1.y,p2.y,p3.y,p4.y);float weight=(i==0||i==20)? 1.0 :(mod(float(i),2.)!=0.)? 4.0 : 2.0;movement+=weight*y;}movement*=h/3.;return movement;}float integrateFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i+=2){vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return ret;}vec2 p1=vec2(k0.x,k0.y);vec2 p2=vec2(k0.z,k0.w);vec2 p3=vec2(k1.z,k1.w);vec2 p4=vec2(k1.x,k1.y);if(time>=k1.x){ret+=calculateMovement(k1.x,p1,p2,p3,p4);}if(time>=k0.x&&time<k1.x){return ret+calculateMovement(time,p1,p2,p3,p4);}}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;vec4 tSqr=vec4(t,t,t0,t0);tSqr=tSqr*tSqr;vec4 a=vec4(2.*t,3.,-t0,3.)*tSqr;float t1y0=t1*y0;vec4 b=vec4(y0-y1,t0*y1-t1y0,2.*y0+y1,t1y0);float r=dot(a,b);return r/(t0-t1)*0.16666667;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w);}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}if(type==5.){return integrateFromBezierCurveFrames(t1,value.z,value.w)-integrateFromBezierCurveFrames(t0,value.z,value.w);}return 0.;}",t.interpolateColor=Y,t.isAlipayMiniApp=function(){return"undefined"!=typeof my&&"web"===(null===my||void 0===my?void 0:my.renderTarget)},t.isAndroid=Z,t.isArray=er,t.isCanvasUsedByPlayer=function(t){return Pl.has(t)},t.isFunction=rr,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=ir,t.isScene=wu,t.isSceneWithOptions=Dl,t.isSimulatorCellPhone=q,t.isString=tr,t.isUniformStruct=ni,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&ni(t[0])},t.isValidFontFamily=it,t.isWebGL2=g,t.itemFrag=Bi,t.itemFrameFrag=Di,t.itemVert=zi,t.loadBinary=Hr,t.loadBlob=function(t){return n(this,void 0,void 0,(function(){return o(this,(function(e){return[2,new Promise((function(e,r){(new Ur).downloadBlob(t,e,(function(e,i){r("Couldn't load blob ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))},t.loadImage=Xr,t.loadMedia=ks,t.loadVideo=Yr,t.loadWebPOptional=Gr,t.logger=Je,t.math=Zt,t.modifyMaxKeyframeShader=Ts,t.nearestPowerOfTwo=ue,t.noop=$e,t.numberToFix=fe,t.parsePercent=j,t.particleFrag=Ui,t.particleOriginTranslateMap=se,t.particleUniformTypeMap=ms,t.particleVert=ki,t.pluginLoaderMap=fr,t.pointOnLine=function(t,e,r,i,n,o){var s=t*i+e*n+r*o-n*i-o*t-r*e;return s>-.001&&s<.001},t.random=nr,t.registerFilter=F,t.registerFilters=V,t.registerPlugin=mr,t.removeItem=B,t.requestAsync=Ls,t.rotateVec2=jo,t.screenMeshVert=Qi,t.setBlendMode=Dr,t.setConfig=function(t,e){return Ci[t]=e},t.setDefaultTextureFactory=function(t){$r=t},t.setMaskMode=Br,t.setMaxSpriteMeshItemCount=function(e){t.maxSpriteMeshItemCount=e},t.setRayFromCamera=le,t.setSideMode=zr,t.setSpriteMeshMaxFragmentTextures=function(e){t.maxSpriteTextureCount=e},t.setSpriteMeshMaxItemCountByGPU=Pn,t.sortByOrder=J,t.spec=bt,t.spriteMeshShaderFromFilter=Vn,t.spriteMeshShaderFromRenderInfo=Dn,t.spriteMeshShaderIdFromRenderInfo=Nn,t.thresholdFrag=rn,t.throwDestroyedError=or,t.trailVert=Gi,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=ce,t.unregisterPlugin=function(t){delete dr[t],delete fr[t],B(pr,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#define NONE_CONST_INDEX 1\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#endif\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\nmat4 cubicBezierMatrix=mat4(1.0,-3.0,3.0,-1.0,0.0,3.0,-6.0,3.0,0.0,0.0,3.0,-3.0,0.0,0.0,0.0,1.0);float cubicBezier(float t,float y1,float y2,float y3,float y4){vec4 tVec=vec4(1.0,t,t*t,t*t*t);vec4 yVec=vec4(y1,y2,y3,y4);vec4 result=tVec*cubicBezierMatrix*yVec;return result.x+result.y+result.z+result.w;}float binarySearchT(float x,float x1,float x2,float x3,float x4){float left=0.0;float right=1.0;float mid=0.0;float computedX;for(int i=0;i<8;i++){mid=(left+right)*0.5;computedX=cubicBezier(mid,x1,x2,x3,x4);if(abs(computedX-x)<0.0001){break;}else if(computedX>x){right=mid;}else{left=mid;}}return mid;}float valueFromBezierCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);for(int i=0;i<ITR_END;i+=2){if(i>=count){break;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(i==0&&time<k0.x){return k0.y;}if(i==int(frameCount-2.)&&time>=k1.x){return k1.y;}if(time>=k0.x&&time<=k1.x){float t=(time-k0.x)/(k1.x-k0.x);float nt=binarySearchT(time,k0.x,k0.z,k1.z,k1.x);return cubicBezier(nt,k0.y,k0.w,k1.w,k1.y);}}}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){if(i>count){return lookup_curve(i).w;}vec4 seg=lookup_curve(i+start);vec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}vec2 p2=lookup_curve(i+start+1).xy;if(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed);}if(type==5.){return valueFromBezierCurveFrames(time,value.z,value.w);}return 0.;}",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=ie,t.vecFill=re,t.vecMulCombine=oe,t.vecNormalize=ne,t.version=Ul,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: v1.6.
|
|
6
|
+
* Version: v1.6.10
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/******************************************************************************
|
|
@@ -31040,7 +31040,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31040
31040
|
Engine.create = function (gl) {
|
|
31041
31041
|
return new GLEngine(gl);
|
|
31042
31042
|
};
|
|
31043
|
-
var version = "1.6.
|
|
31043
|
+
var version = "1.6.10";
|
|
31044
31044
|
logger.info('player version: ' + version);
|
|
31045
31045
|
|
|
31046
31046
|
export { AbstractPlugin, AssetManager, BYTES_TYPE_MAP, BezierCurve, BezierCurvePath, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateItem, CalculateLoader, CalculateVFXItem, Camera, CameraController, CameraVFXItem, CameraVFXItemLoader, Composition, CompositionSourceManager, DEFAULT_FONTS, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, Engine, EventSystem, FILTER_NAME_NONE, FilterMode, FilterSpriteVFXItem, Float16ArrayWrapper, FrameBuffer, GLEngine, GLGeometry, GLRenderer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK$1 as HELP_LINK, HitTestType, InteractBehavior$1 as InteractBehavior, InteractItem, InteractLoader, InteractMesh, InteractVFXItem, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleLoader, ParticleMesh, ParticleSystem, ParticleVFXItem, PassTextureCache, 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, 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, Shader, ShaderCompileResultStatus, ShaderType, SpriteItem, SpriteLoader, SpriteMesh, SpriteVFXItem, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TextItem, TextLoader, TextMesh, TextVFXItem, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineComponent, Transform, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, alphaFrameFrag, alphaMaskFrag, assertExist, asserts, blend, bloomMixVert, bloomThresholdVert, calculateTranslation, cameraMove_frag as cameraMoveFrag, cameraMoveVert, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, combineImageTemplate1, combineImageTemplate1Async, combineImageTemplate2, combineImageTemplate2Async, combineImageTemplateAsync, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, convertAnchor, copyFrag, createCopyShader, createFilter, createFilterShaders, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual, deepClone, defaultGlobalVolume, defaultPlugins, delayFrag, deserializeMipmapTexture, disableAllPlayer, distortionFrag, distortionVert, earcut, enlargeBuffer, ensureVec3, filters, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateHalfFloatTexture, getActivePlayers, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getParticleMeshShader, getPixelRatio, getPlayerByCanvas, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvasUsedByPlayer, isFunction, isIOS, isObject, isScene, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, random, registerFilter, registerFilters, registerPlugin, removeItem, requestAsync, rotateVec2, screenMeshVert, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 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
|
@@ -31038,7 +31038,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31038
31038
|
Engine.create = function (gl) {
|
|
31039
31039
|
return new GLEngine(gl);
|
|
31040
31040
|
};
|
|
31041
|
-
var version = "1.6.
|
|
31041
|
+
var version = "1.6.10";
|
|
31042
31042
|
logger.info('player version: ' + version);
|
|
31043
31043
|
|
|
31044
31044
|
exports.AbstractPlugin = AbstractPlugin;
|
package/dist/weapp.mjs
CHANGED
|
@@ -31034,7 +31034,7 @@ Renderer.create = function (canvas, framework, renderOptions) {
|
|
|
31034
31034
|
Engine.create = function (gl) {
|
|
31035
31035
|
return new GLEngine(gl);
|
|
31036
31036
|
};
|
|
31037
|
-
var version = "1.6.
|
|
31037
|
+
var version = "1.6.10";
|
|
31038
31038
|
logger.info('player version: ' + version);
|
|
31039
31039
|
|
|
31040
31040
|
export { AbstractPlugin, AssetManager, BYTES_TYPE_MAP, BezierCurve, BezierCurvePath, COMPRESSED_TEXTURE, COPY_FRAGMENT_SHADER, COPY_MESH_SHADER_ID, COPY_VERTEX_SHADER, CalculateItem, CalculateLoader, CalculateVFXItem, Camera, CameraController, CameraVFXItem, CameraVFXItemLoader, Composition, CompositionSourceManager, DEFAULT_FONTS, DestroyOptions, Downloader, EFFECTS_COPY_MESH_NAME, EVENT_TYPE_CLICK, EVENT_TYPE_TOUCH_END, EVENT_TYPE_TOUCH_MOVE, EVENT_TYPE_TOUCH_START, Engine, EventSystem, FILTER_NAME_NONE, FilterMode, FilterSpriteVFXItem, Float16ArrayWrapper, FrameBuffer, GLEngine, GLGeometry, GLRenderer, GLSLVersion, GPUCapability, Geometry, GlobalUniforms, GradientValue, HELP_LINK$1 as HELP_LINK, HitTestType, InteractBehavior$1 as InteractBehavior, InteractItem, InteractLoader, InteractMesh, InteractVFXItem, Item, KTXTexture, LineSegments, LinearValue, Material, MaterialDataBlock, MaterialRenderType, Mesh, OrderType, PLAYER_OPTIONS_ENV_EDITOR, POST_PROCESS_SETTINGS, ParticleLoader, ParticleMesh, ParticleSystem, ParticleVFXItem, PassTextureCache, 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, 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, Shader, ShaderCompileResultStatus, ShaderType, SpriteItem, SpriteLoader, SpriteMesh, SpriteVFXItem, StaticValue, TEMPLATE_USE_OFFSCREEN_CANVAS, TextItem, TextLoader, TextMesh, TextVFXItem, Texture, TextureFactory, TextureLoadAction, TextureSourceType, TextureStoreAction, Ticker, TimelineComponent, Transform, VFXItem, ValueGetter, addByOrder, addItem, addItemWithOrder, alphaFrameFrag, alphaMaskFrag, assertExist, asserts, blend, bloomMixVert, bloomThresholdVert, calculateTranslation, cameraMove_frag as cameraMoveFrag, cameraMoveVert, canvasPool, colorGradingFrag, colorStopsFromGradient, colorToArr$1 as colorToArr, combineImageTemplate, combineImageTemplate1, combineImageTemplate1Async, combineImageTemplate2, combineImageTemplate2Async, combineImageTemplateAsync, compatible_frag as compatibleFrag, compatible_vert as compatibleVert, convertAnchor, copyFrag, createCopyShader, createFilter, createFilterShaders, createGLContext, createKeyFrameMeta, createShaderWithMarcos, createShape, createVFXItem, createValueGetter, decimalEqual, deepClone, defaultGlobalVolume, defaultPlugins, delayFrag, deserializeMipmapTexture, disableAllPlayer, distortionFrag, distortionVert, earcut, enlargeBuffer, ensureVec3, filters, findPreviousRenderPass, gaussianDown_frag as gaussianDownFrag, gaussianDownHFrag, gaussianDownVFrag, gaussianUpFrag, generateEmptyTypedArray, generateHalfFloatTexture, getActivePlayers, getBackgroundImage, getColorFromGradientStops, getConfig, getDefaultTemplateCanvasPool, getDefaultTextureFactory, getGeometryByShape, getGeometryTriangles, getImageItemRenderInfo, getKTXTextureOptions, getKeyFrameMetaByRawValue, getParticleMeshShader, getPixelRatio, getPlayerByCanvas, getPreMultiAlpha, getStandardComposition, getStandardImage, getStandardItem, getStandardJSON, getTextureSize, glContext, gpuTimer, imageDataFromColor, imageDataFromGradient, initErrors, initGLContext, integrate, interpolateColor, isAlipayMiniApp, isAndroid, isArray, isCanvasUsedByPlayer, isFunction, isIOS, isObject, isScene, isSceneWithOptions, isSimulatorCellPhone, isString, isUniformStruct, isUniformStructArray, isValidFontFamily, isWebGL2, itemFrag, itemFrameFrag, itemVert, loadBinary, loadBlob, loadImage, loadMedia, loadVideo, loadWebPOptional, logger, index as math, maxSpriteMeshItemCount, maxSpriteTextureCount, modifyMaxKeyframeShader, nearestPowerOfTwo, noop, numberToFix, parsePercent$1 as parsePercent, particleFrag, particleOriginTranslateMap, particleUniformTypeMap, particleVert, pluginLoaderMap, pointOnLine, random, registerFilter, registerFilters, registerPlugin, removeItem, requestAsync, rotateVec2, screenMeshVert, setBlendMode, setConfig, setDefaultTextureFactory, setMaskMode, setMaxSpriteMeshItemCount, setRayFromCamera, setSideMode, setSpriteMeshMaxFragmentTextures, setSpriteMeshMaxItemCountByGPU, sortByOrder, index$1 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": "1.6.
|
|
3
|
+
"version": "1.6.10",
|
|
4
4
|
"description": "Galacean Effects runtime player for the web",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"registry": "https://registry.npmjs.org"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@galacean/effects-core": "1.6.
|
|
67
|
-
"@galacean/effects-webgl": "1.6.
|
|
66
|
+
"@galacean/effects-core": "1.6.10",
|
|
67
|
+
"@galacean/effects-webgl": "1.6.10"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"prebuild": "pnpm clean",
|