@galacean/effects-threejs 0.0.1-alpha.3 → 1.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6631 -1485
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +4 -4
- package/dist/index.min.js.map +1 -1
- package/dist/index.mjs +6630 -1448
- package/dist/index.mjs.map +1 -1
- package/dist/material/three-material.d.ts +22 -13
- package/package.json +2 -2
package/dist/index.min.js
CHANGED
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
* Description: Galacean Effects runtime threejs plugin for the web
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
|
|
6
|
-
* Version:
|
|
6
|
+
* Version: v1.1.0-alpha.0
|
|
7
7
|
*/
|
|
8
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).ge=e.ge||{},e.ge.three={}),e.THREE)}(this,(function(e,t){"use strict";function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=r(t),n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o=function(e){return e&&e.Math===Math&&e},a=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof n&&n)||function(){return this}()||n||Function("return this")(),s={},u=function(e){try{return!!e()}catch(e){return!0}},c=!u((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),l=!u((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),f=l,h=Function.prototype.call,p=f?h.bind(h):function(){return h.apply(h,arguments)},d={},m={}.propertyIsEnumerable,v=Object.getOwnPropertyDescriptor,y=v&&!m.call({1:2},1);d.f=y?function(e){var t=v(this,e);return!!t&&t.enumerable}:m;var g,x,T=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},E=l,_=Function.prototype,S=_.call,A=E&&_.bind.bind(S,S),R=E?A:function(e){return function(){return S.apply(e,arguments)}},C=R,O=C({}.toString),b=C("".slice),L=function(e){return b(O(e),8,-1)},I=u,w=L,P=Object,M=R("".split),V=I((function(){return!P("z").propertyIsEnumerable(0)}))?function(e){return"String"===w(e)?M(e,""):P(e)}:P,N=function(e){return null==e},F=N,D=TypeError,U=function(e){if(F(e))throw D("Can't call method on "+e);return e},B=V,k=U,z=function(e){return B(k(e))},G="object"==typeof document&&document.all,j={all:G,IS_HTMLDDA:void 0===G&&void 0!==G},X=j.all,W=j.IS_HTMLDDA?function(e){return"function"==typeof e||e===X}:function(e){return"function"==typeof e},H=W,Y=j.all,Z=j.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:H(e)||e===Y}:function(e){return"object"==typeof e?null!==e:H(e)},q=a,K=W,Q=function(e,t){return arguments.length<2?(r=q[e],K(r)?r:void 0):q[e]&&q[e][t];var r},J=R({}.isPrototypeOf),$="undefined"!=typeof navigator&&String(navigator.userAgent)||"",ee=a,te=$,re=ee.process,ie=ee.Deno,ne=re&&re.versions||ie&&ie.version,oe=ne&&ne.v8;oe&&(x=(g=oe.split("."))[0]>0&&g[0]<4?1:+(g[0]+g[1])),!x&&te&&(!(g=te.match(/Edge\/(\d+)/))||g[1]>=74)&&(g=te.match(/Chrome\/(\d+)/))&&(x=+g[1]);var ae=x,se=ae,ue=u,ce=a.String,le=!!Object.getOwnPropertySymbols&&!ue((function(){var e=Symbol("symbol detection");return!ce(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&se&&se<41})),fe=le&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,he=Q,pe=W,de=J,me=Object,ve=fe?function(e){return"symbol"==typeof e}:function(e){var t=he("Symbol");return pe(t)&&de(t.prototype,me(e))},ye=String,ge=function(e){try{return ye(e)}catch(e){return"Object"}},xe=W,Te=ge,Ee=TypeError,_e=function(e){if(xe(e))return e;throw Ee(Te(e)+" is not a function")},Se=_e,Ae=N,Re=function(e,t){var r=e[t];return Ae(r)?void 0:Se(r)},Ce=p,Oe=W,be=Z,Le=TypeError,Ie={exports:{}},we=a,Pe=Object.defineProperty,Me=function(e,t){try{Pe(we,e,{value:t,configurable:!0,writable:!0})}catch(r){we[e]=t}return t},Ve=Me,Ne="__core-js_shared__",Fe=a[Ne]||Ve(Ne,{}),De=Fe;(Ie.exports=function(e,t){return De[e]||(De[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.32.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Ue=U,Be=Object,ke=function(e){return Be(Ue(e))},ze=ke,Ge=R({}.hasOwnProperty),je=Object.hasOwn||function(e,t){return Ge(ze(e),t)},Xe=R,We=0,He=Math.random(),Ye=Xe(1..toString),Ze=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ye(++We+He,36)},qe=a,Ke=Ie.exports,Qe=je,Je=Ze,$e=le,et=fe,tt=qe.Symbol,rt=Ke("wks"),it=et?tt.for||tt:tt&&tt.withoutSetter||Je,nt=function(e){return Qe(rt,e)||(rt[e]=$e&&Qe(tt,e)?tt[e]:it("Symbol."+e)),rt[e]},ot=p,at=Z,st=ve,ut=Re,ct=function(e,t){var r,i;if("string"===t&&Oe(r=e.toString)&&!be(i=Ce(r,e)))return i;if(Oe(r=e.valueOf)&&!be(i=Ce(r,e)))return i;if("string"!==t&&Oe(r=e.toString)&&!be(i=Ce(r,e)))return i;throw Le("Can't convert object to primitive value")},lt=TypeError,ft=nt("toPrimitive"),ht=function(e,t){if(!at(e)||st(e))return e;var r,i=ut(e,ft);if(i){if(void 0===t&&(t="default"),r=ot(i,e,t),!at(r)||st(r))return r;throw lt("Can't convert object to primitive value")}return void 0===t&&(t="number"),ct(e,t)},pt=ht,dt=ve,mt=function(e){var t=pt(e,"string");return dt(t)?t:t+""},vt=Z,yt=a.document,gt=vt(yt)&&vt(yt.createElement),xt=function(e){return gt?yt.createElement(e):{}},Tt=xt,Et=!c&&!u((function(){return 7!==Object.defineProperty(Tt("div"),"a",{get:function(){return 7}}).a})),_t=c,St=p,At=d,Rt=T,Ct=z,Ot=mt,bt=je,Lt=Et,It=Object.getOwnPropertyDescriptor;s.f=_t?It:function(e,t){if(e=Ct(e),t=Ot(t),Lt)try{return It(e,t)}catch(e){}if(bt(e,t))return Rt(!St(At.f,e,t),e[t])};var wt={},Pt=c&&u((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Mt=Z,Vt=String,Nt=TypeError,Ft=function(e){if(Mt(e))return e;throw Nt(Vt(e)+" is not an object")},Dt=c,Ut=Et,Bt=Pt,kt=Ft,zt=mt,Gt=TypeError,jt=Object.defineProperty,Xt=Object.getOwnPropertyDescriptor,Wt="enumerable",Ht="configurable",Yt="writable";wt.f=Dt?Bt?function(e,t,r){if(kt(e),t=zt(t),kt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Yt in r&&!r[Yt]){var i=Xt(e,t);i&&i[Yt]&&(e[t]=r.value,r={configurable:Ht in r?r[Ht]:i[Ht],enumerable:Wt in r?r[Wt]:i[Wt],writable:!1})}return jt(e,t,r)}:jt:function(e,t,r){if(kt(e),t=zt(t),kt(r),Ut)try{return jt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Gt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Zt=wt,qt=T,Kt=c?function(e,t,r){return Zt.f(e,t,qt(1,r))}:function(e,t,r){return e[t]=r,e},Qt={exports:{}},Jt=c,$t=je,er=Function.prototype,tr=Jt&&Object.getOwnPropertyDescriptor,rr=$t(er,"name"),ir={EXISTS:rr,PROPER:rr&&"something"===function(){}.name,CONFIGURABLE:rr&&(!Jt||Jt&&tr(er,"name").configurable)},nr=W,or=Fe,ar=R(Function.toString);nr(or.inspectSource)||(or.inspectSource=function(e){return ar(e)});var sr,ur,cr,lr=or.inspectSource,fr=W,hr=a.WeakMap,pr=fr(hr)&&/native code/.test(String(hr)),dr=Ie.exports,mr=Ze,vr=dr("keys"),yr=function(e){return vr[e]||(vr[e]=mr(e))},gr={},xr=pr,Tr=a,Er=Z,_r=Kt,Sr=je,Ar=Fe,Rr=yr,Cr=gr,Or="Object already initialized",br=Tr.TypeError,Lr=Tr.WeakMap;if(xr||Ar.state){var Ir=Ar.state||(Ar.state=new Lr);Ir.get=Ir.get,Ir.has=Ir.has,Ir.set=Ir.set,sr=function(e,t){if(Ir.has(e))throw br(Or);return t.facade=e,Ir.set(e,t),t},ur=function(e){return Ir.get(e)||{}},cr=function(e){return Ir.has(e)}}else{var wr=Rr("state");Cr[wr]=!0,sr=function(e,t){if(Sr(e,wr))throw br(Or);return t.facade=e,_r(e,wr,t),t},ur=function(e){return Sr(e,wr)?e[wr]:{}},cr=function(e){return Sr(e,wr)}}var Pr={set:sr,get:ur,has:cr,enforce:function(e){return cr(e)?ur(e):sr(e,{})},getterFor:function(e){return function(t){var r;if(!Er(t)||(r=ur(t)).type!==e)throw br("Incompatible receiver, "+e+" required");return r}}},Mr=R,Vr=u,Nr=W,Fr=je,Dr=c,Ur=ir.CONFIGURABLE,Br=lr,kr=Pr.enforce,zr=Pr.get,Gr=String,jr=Object.defineProperty,Xr=Mr("".slice),Wr=Mr("".replace),Hr=Mr([].join),Yr=Dr&&!Vr((function(){return 8!==jr((function(){}),"length",{value:8}).length})),Zr=String(String).split("String"),qr=Qt.exports=function(e,t,r){"Symbol("===Xr(Gr(t),0,7)&&(t="["+Wr(Gr(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!Fr(e,"name")||Ur&&e.name!==t)&&(Dr?jr(e,"name",{value:t,configurable:!0}):e.name=t),Yr&&r&&Fr(r,"arity")&&e.length!==r.arity&&jr(e,"length",{value:r.arity});try{r&&Fr(r,"constructor")&&r.constructor?Dr&&jr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var i=kr(e);return Fr(i,"source")||(i.source=Hr(Zr,"string"==typeof t?t:"")),e};Function.prototype.toString=qr((function(){return Nr(this)&&zr(this).source||Br(this)}),"toString");var Kr=W,Qr=wt,Jr=Qt.exports,$r=Me,ei=function(e,t,r,i){i||(i={});var n=i.enumerable,o=void 0!==i.name?i.name:t;if(Kr(r)&&Jr(r,o,i),i.global)n?e[t]=r:$r(t,r);else{try{i.unsafe?e[t]&&(n=!0):delete e[t]}catch(e){}n?e[t]=r:Qr.f(e,t,{value:r,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return e},ti={},ri=Math.ceil,ii=Math.floor,ni=Math.trunc||function(e){var t=+e;return(t>0?ii:ri)(t)},oi=ni,ai=function(e){var t=+e;return t!=t||0===t?0:oi(t)},si=ai,ui=Math.max,ci=Math.min,li=function(e,t){var r=si(e);return r<0?ui(r+t,0):ci(r,t)},fi=ai,hi=Math.min,pi=function(e){return e>0?hi(fi(e),9007199254740991):0},di=pi,mi=function(e){return di(e.length)},vi=z,yi=li,gi=mi,xi=function(e){return function(t,r,i){var n,o=vi(t),a=gi(o),s=yi(i,a);if(e&&r!=r){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},Ti={includes:xi(!0),indexOf:xi(!1)},Ei=je,_i=z,Si=Ti.indexOf,Ai=gr,Ri=R([].push),Ci=function(e,t){var r,i=_i(e),n=0,o=[];for(r in i)!Ei(Ai,r)&&Ei(i,r)&&Ri(o,r);for(;t.length>n;)Ei(i,r=t[n++])&&(~Si(o,r)||Ri(o,r));return o},Oi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bi=Ci,Li=Oi.concat("length","prototype");ti.f=Object.getOwnPropertyNames||function(e){return bi(e,Li)};var Ii={};Ii.f=Object.getOwnPropertySymbols;var wi=Q,Pi=ti,Mi=Ii,Vi=Ft,Ni=R([].concat),Fi=wi("Reflect","ownKeys")||function(e){var t=Pi.f(Vi(e)),r=Mi.f;return r?Ni(t,r(e)):t},Di=je,Ui=Fi,Bi=s,ki=wt,zi=u,Gi=W,ji=/#|\.prototype\./,Xi=function(e,t){var r=Hi[Wi(e)];return r===Zi||r!==Yi&&(Gi(t)?zi(t):!!t)},Wi=Xi.normalize=function(e){return String(e).replace(ji,".").toLowerCase()},Hi=Xi.data={},Yi=Xi.NATIVE="N",Zi=Xi.POLYFILL="P",qi=Xi,Ki=a,Qi=s.f,Ji=Kt,$i=ei,en=Me,tn=function(e,t,r){for(var i=Ui(t),n=ki.f,o=Bi.f,a=0;a<i.length;a++){var s=i[a];Di(e,s)||r&&Di(r,s)||n(e,s,o(t,s))}},rn=qi,nn=function(e,t){var r,i,n,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?Ki:c?Ki[s]||en(s,{}):(Ki[s]||{}).prototype)for(i in t){if(o=t[i],n=e.dontCallGetSet?(a=Qi(r,i))&&a.value:r[i],!rn(u?i:s+(c?".":"#")+i,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;tn(o,n)}(e.sham||n&&n.sham)&&Ji(o,"sham",!0),$i(r,i,o,e)}},on={},an=Ci,sn=Oi,un=Object.keys||function(e){return an(e,sn)},cn=c,ln=Pt,fn=wt,hn=Ft,pn=z,dn=un;on.f=cn&&!ln?Object.defineProperties:function(e,t){hn(e);for(var r,i=pn(t),n=dn(t),o=n.length,a=0;o>a;)fn.f(e,r=n[a++],i[r]);return e};var mn,vn=Q("document","documentElement"),yn=Ft,gn=on,xn=Oi,Tn=gr,En=vn,_n=xt,Sn="prototype",An="script",Rn=yr("IE_PROTO"),Cn=function(){},On=function(e){return"<"+An+">"+e+"</"+An+">"},bn=function(e){e.write(On("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ln=function(){try{mn=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Ln="undefined"!=typeof document?document.domain&&mn?bn(mn):(t=_n("iframe"),r="java"+An+":",t.style.display="none",En.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(On("document.F=Object")),e.close(),e.F):bn(mn);for(var i=xn.length;i--;)delete Ln[Sn][xn[i]];return Ln()};Tn[Rn]=!0;var In=Object.create||function(e,t){var r;return null!==e?(Cn[Sn]=yn(e),r=new Cn,Cn[Sn]=null,r[Rn]=e):r=Ln(),void 0===t?r:gn.f(r,t)},wn=nt,Pn=In,Mn=wt.f,Vn=wn("unscopables"),Nn=Array.prototype;void 0===Nn[Vn]&&Mn(Nn,Vn,{configurable:!0,value:Pn(null)});var Fn=function(e){Nn[Vn][e]=!0},Dn=Ti.includes,Un=Fn;nn({target:"Array",proto:!0,forced:u((function(){return!Array(1).includes()}))},{includes:function(e){return Dn(this,e,arguments.length>1?arguments[1]:void 0)}}),Un("includes");var Bn=a,kn=R;(function(e,t){kn(Bn[e].prototype[t])})("Array","includes");var zn=!u((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Gn=je,jn=W,Xn=ke,Wn=zn,Hn=yr("IE_PROTO"),Yn=Object,Zn=Yn.prototype,qn=Wn?Yn.getPrototypeOf:function(e){var t=Xn(e);if(Gn(t,Hn))return t[Hn];var r=t.constructor;return jn(r)&&t instanceof r?r.prototype:t instanceof Yn?Zn:null},Kn=c,Qn=u,Jn=R,$n=qn,eo=un,to=z,ro=Jn(d.f),io=Jn([].push),no=Kn&&Qn((function(){var e=Object.create(null);return e[2]=2,!ro(e,2)})),oo=function(e){return function(t){for(var r,i=to(t),n=eo(i),o=no&&null===$n(i),a=n.length,s=0,u=[];a>s;)r=n[s++],Kn&&!(o?r in i:ro(i,r))||io(u,e?[r,i[r]]:i[r]);return u}},ao={entries:oo(!0),values:oo(!1)},so=ao.values;nn({target:"Object",stat:!0},{values:function(e){return so(e)}});var uo=a;uo.Object.values;var co=ao.entries;nn({target:"Object",stat:!0},{entries:function(e){return co(e)}}),uo.Object.entries;var lo={exports:{}},fo=nt("iterator"),ho=!1;try{var po=0,mo={next:function(){return{done:!!po++}},return:function(){ho=!0}};mo[fo]=function(){return this},Array.from(mo,(function(){throw 2}))}catch(e){}var vo=function(e,t){if(!t&&!ho)return!1;var r=!1;try{var i={};i[fo]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},yo="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,go={};go[nt("toStringTag")]="z";var xo,To,Eo,_o="[object z]"===String(go),So=_o,Ao=W,Ro=L,Co=nt("toStringTag"),Oo=Object,bo="Arguments"===Ro(function(){return arguments}()),Lo=So?Ro:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Oo(e),Co))?r:bo?Ro(t):"Object"===(i=Ro(t))&&Ao(t.callee)?"Arguments":i},Io=Qt.exports,wo=wt,Po=function(e,t,r){return r.get&&Io(r.get,t,{getter:!0}),r.set&&Io(r.set,t,{setter:!0}),wo.f(e,t,r)},Mo=R,Vo=_e,No=W,Fo=String,Do=TypeError,Uo=function(e,t,r){try{return Mo(Vo(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},Bo=Ft,ko=function(e){if("object"==typeof e||No(e))return e;throw Do("Can't set "+Fo(e)+" as a prototype")},zo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Uo(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return Bo(r),ko(i),t?e(r,i):r.__proto__=i,r}}():void 0),Go=yo,jo=c,Xo=a,Wo=W,Ho=Z,Yo=je,Zo=Lo,qo=ge,Ko=Kt,Qo=ei,Jo=Po,$o=J,ea=qn,ta=zo,ra=nt,ia=Ze,na=Pr.enforce,oa=Pr.get,aa=Xo.Int8Array,sa=aa&&aa.prototype,ua=Xo.Uint8ClampedArray,ca=ua&&ua.prototype,la=aa&&ea(aa),fa=sa&&ea(sa),ha=Object.prototype,pa=Xo.TypeError,da=ra("toStringTag"),ma=ia("TYPED_ARRAY_TAG"),va="TypedArrayConstructor",ya=Go&&!!ta&&"Opera"!==Zo(Xo.opera),ga=!1,xa={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Ta={BigInt64Array:8,BigUint64Array:8},Ea=function(e){var t=ea(e);if(Ho(t)){var r=oa(t);return r&&Yo(r,va)?r[va]:Ea(t)}},_a=function(e){if(!Ho(e))return!1;var t=Zo(e);return Yo(xa,t)||Yo(Ta,t)};for(xo in xa)(Eo=(To=Xo[xo])&&To.prototype)?na(Eo)[va]=To:ya=!1;for(xo in Ta)(Eo=(To=Xo[xo])&&To.prototype)&&(na(Eo)[va]=To);if((!ya||!Wo(la)||la===Function.prototype)&&(la=function(){throw pa("Incorrect invocation")},ya))for(xo in xa)Xo[xo]&&ta(Xo[xo],la);if((!ya||!fa||fa===ha)&&(fa=la.prototype,ya))for(xo in xa)Xo[xo]&&ta(Xo[xo].prototype,fa);if(ya&&ea(ca)!==fa&&ta(ca,fa),jo&&!Yo(fa,da))for(xo in ga=!0,Jo(fa,da,{configurable:!0,get:function(){return Ho(this)?this[ma]:void 0}}),xa)Xo[xo]&&Ko(Xo[xo],ma,xo);var Sa={NATIVE_ARRAY_BUFFER_VIEWS:ya,TYPED_ARRAY_TAG:ga&&ma,aTypedArray:function(e){if(_a(e))return e;throw pa("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Wo(e)&&(!ta||$o(la,e)))return e;throw pa(qo(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,i){if(jo){if(r)for(var n in xa){var o=Xo[n];if(o&&Yo(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}fa[e]&&!r||Qo(fa,e,r?t:ya&&sa[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,r){var i,n;if(jo){if(ta){if(r)for(i in xa)if((n=Xo[i])&&Yo(n,e))try{delete n[e]}catch(e){}if(la[e]&&!r)return;try{return Qo(la,e,r?t:ya&&la[e]||t)}catch(e){}}for(i in xa)!(n=Xo[i])||n[e]&&!r||Qo(n,e,t)}},getTypedArrayConstructor:Ea,isView:function(e){if(!Ho(e))return!1;var t=Zo(e);return"DataView"===t||Yo(xa,t)||Yo(Ta,t)},isTypedArray:_a,TypedArray:la,TypedArrayPrototype:fa},Aa=a,Ra=u,Ca=vo,Oa=Sa.NATIVE_ARRAY_BUFFER_VIEWS,ba=Aa.ArrayBuffer,La=Aa.Int8Array,Ia=!Oa||!Ra((function(){La(1)}))||!Ra((function(){new La(-1)}))||!Ca((function(e){new La,new La(null),new La(1.5),new La(e)}),!0)||Ra((function(){return 1!==new La(new ba(2),1,void 0).length})),wa=ei,Pa=function(e,t,r){for(var i in t)wa(e,i,t[i],r);return e},Ma=J,Va=TypeError,Na=function(e,t){if(Ma(t,e))return e;throw Va("Incorrect invocation")},Fa=ai,Da=pi,Ua=RangeError,Ba=function(e){if(void 0===e)return 0;var t=Fa(e),r=Da(t);if(t!==r)throw Ua("Wrong length or index");return r},ka=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1},za=ni,Ga=Array,ja=Math.abs,Xa=Math.pow,Wa=Math.floor,Ha=Math.log,Ya=Math.LN2,Za=function(e){var t=za(e),r=ja(e-t);return r>.5||.5===r&&t%2!=0?t+ka(e):t},qa={pack:function(e,t,r){var i,n,o,a=Ga(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,l=23===t?Xa(2,-24)-Xa(2,-77):0,f=e<0||0===e&&1/e<0?1:0,h=0;for((e=ja(e))!=e||e===1/0?(n=e!=e?1:0,i=u):(i=Wa(Ha(e)/Ya),e*(o=Xa(2,-i))<1&&(i--,o*=2),(e+=i+c>=1?l/o:l*Xa(2,1-c))*o>=2&&(i++,o/=2),i+c>=u?(n=0,i=u):i+c>=1?(n=Za((e*o-1)*Xa(2,t)),i+=c):(n=Za(e*Xa(2,c-1)*Xa(2,t)),i=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(i=i<<t|n,s+=t;s>0;)a[h++]=255&i,i/=256,s-=8;return a[--h]|=128*f,a},unpack:function(e,t){var r,i=e.length,n=8*i-t-1,o=(1<<n)-1,a=o>>1,s=n-7,u=i-1,c=e[u--],l=127&c;for(c>>=7;s>0;)l=256*l+e[u--],s-=8;for(r=l&(1<<-s)-1,l>>=-s,s+=t;s>0;)r=256*r+e[u--],s-=8;if(0===l)l=1-a;else{if(l===o)return r?NaN:c?-1/0:1/0;r+=Xa(2,t),l-=a}return(c?-1:1)*r*Xa(2,l-t)}},Ka=ke,Qa=li,Ja=mi,$a=function(e){for(var t=Ka(this),r=Ja(t),i=arguments.length,n=Qa(i>1?arguments[1]:void 0,r),o=i>2?arguments[2]:void 0,a=void 0===o?r:Qa(o,r);a>n;)t[n++]=e;return t},es=mt,ts=wt,rs=T,is=li,ns=mi,os=function(e,t,r){var i=es(t);i in e?ts.f(e,i,rs(0,r)):e[i]=r},as=Array,ss=Math.max,us=function(e,t,r){for(var i=ns(e),n=is(t,i),o=is(void 0===r?i:r,i),a=as(ss(o-n,0)),s=0;n<o;n++,s++)os(a,s,e[n]);return a.length=s,a},cs=wt.f,ls=je,fs=nt("toStringTag"),hs=function(e,t,r){e&&!r&&(e=e.prototype),e&&!ls(e,fs)&&cs(e,fs,{configurable:!0,value:t})},ps=a,ds=R,ms=c,vs=yo,ys=ir,gs=Kt,xs=Po,Ts=Pa,Es=u,_s=Na,Ss=ai,As=pi,Rs=Ba,Cs=qa,Os=qn,bs=zo,Ls=ti.f,Is=$a,ws=us,Ps=hs,Ms=Pr,Vs=ys.PROPER,Ns=ys.CONFIGURABLE,Fs="ArrayBuffer",Ds="DataView",Us="prototype",Bs="Wrong index",ks=Ms.getterFor(Fs),zs=Ms.getterFor(Ds),Gs=Ms.set,js=ps[Fs],Xs=js,Ws=Xs&&Xs[Us],Hs=ps[Ds],Ys=Hs&&Hs[Us],Zs=Object.prototype,qs=ps.Array,Ks=ps.RangeError,Qs=ds(Is),Js=ds([].reverse),$s=Cs.pack,eu=Cs.unpack,tu=function(e){return[255&e]},ru=function(e){return[255&e,e>>8&255]},iu=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},nu=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},ou=function(e){return $s(e,23,4)},au=function(e){return $s(e,52,8)},su=function(e,t,r){xs(e[Us],t,{configurable:!0,get:function(){return r(this)[t]}})},uu=function(e,t,r,i){var n=zs(e),o=Rs(r),a=!!i;if(o+t>n.byteLength)throw Ks(Bs);var s=n.bytes,u=o+n.byteOffset,c=ws(s,u,u+t);return a?c:Js(c)},cu=function(e,t,r,i,n,o){var a=zs(e),s=Rs(r),u=i(+n),c=!!o;if(s+t>a.byteLength)throw Ks(Bs);for(var l=a.bytes,f=s+a.byteOffset,h=0;h<t;h++)l[f+h]=u[c?h:t-h-1]};if(vs){var lu=Vs&&js.name!==Fs;if(Es((function(){js(1)}))&&Es((function(){new js(-1)}))&&!Es((function(){return new js,new js(1.5),new js(NaN),1!==js.length||lu&&!Ns})))lu&&Ns&&gs(js,"name",Fs);else{(Xs=function(e){return _s(this,Ws),new js(Rs(e))})[Us]=Ws;for(var fu,hu=Ls(js),pu=0;hu.length>pu;)(fu=hu[pu++])in Xs||gs(Xs,fu,js[fu]);Ws.constructor=Xs}bs&&Os(Ys)!==Zs&&bs(Ys,Zs);var du=new Hs(new Xs(2)),mu=ds(Ys.setInt8);du.setInt8(0,2147483648),du.setInt8(1,2147483649),!du.getInt8(0)&&du.getInt8(1)||Ts(Ys,{setInt8:function(e,t){mu(this,e,t<<24>>24)},setUint8:function(e,t){mu(this,e,t<<24>>24)}},{unsafe:!0})}else Ws=(Xs=function(e){_s(this,Ws);var t=Rs(e);Gs(this,{type:Fs,bytes:Qs(qs(t),0),byteLength:t}),ms||(this.byteLength=t,this.detached=!1)})[Us],Ys=(Hs=function(e,t,r){_s(this,Ys),_s(e,Ws);var i=ks(e),n=i.byteLength,o=Ss(t);if(o<0||o>n)throw Ks("Wrong offset");if(o+(r=void 0===r?n-o:As(r))>n)throw Ks("Wrong length");Gs(this,{type:Ds,buffer:e,byteLength:r,byteOffset:o,bytes:i.bytes}),ms||(this.buffer=e,this.byteLength=r,this.byteOffset=o)})[Us],ms&&(su(Xs,"byteLength",ks),su(Hs,"buffer",zs),su(Hs,"byteLength",zs),su(Hs,"byteOffset",zs)),Ts(Ys,{getInt8:function(e){return uu(this,1,e)[0]<<24>>24},getUint8:function(e){return uu(this,1,e)[0]},getInt16:function(e){var t=uu(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=uu(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return nu(uu(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return nu(uu(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return eu(uu(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return eu(uu(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){cu(this,1,e,tu,t)},setUint8:function(e,t){cu(this,1,e,tu,t)},setInt16:function(e,t){cu(this,2,e,ru,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){cu(this,2,e,ru,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){cu(this,4,e,iu,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){cu(this,4,e,iu,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){cu(this,4,e,ou,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){cu(this,8,e,au,t,arguments.length>2&&arguments[2])}});Ps(Xs,Fs),Ps(Hs,Ds);var vu={ArrayBuffer:Xs,DataView:Hs},yu=Z,gu=Math.floor,xu=Number.isInteger||function(e){return!yu(e)&&isFinite(e)&&gu(e)===e},Tu=ai,Eu=RangeError,_u=function(e){var t=Tu(e);if(t<0)throw Eu("The argument can't be less than 0");return t},Su=RangeError,Au=function(e,t){var r=_u(e);if(r%t)throw Su("Wrong offset");return r},Ru=Math.round,Cu=L,Ou=R,bu=function(e){if("Function"===Cu(e))return Ou(e)},Lu=_e,Iu=l,wu=bu(bu.bind),Pu=function(e,t){return Lu(e),void 0===t?e:Iu?wu(e,t):function(){return e.apply(t,arguments)}},Mu=R,Vu=u,Nu=W,Fu=Lo,Du=lr,Uu=function(){},Bu=[],ku=Q("Reflect","construct"),zu=/^\s*(?:class|function)\b/,Gu=Mu(zu.exec),ju=!zu.exec(Uu),Xu=function(e){if(!Nu(e))return!1;try{return ku(Uu,Bu,e),!0}catch(e){return!1}},Wu=function(e){if(!Nu(e))return!1;switch(Fu(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ju||!!Gu(zu,Du(e))}catch(e){return!0}};Wu.sham=!0;var Hu=!ku||Vu((function(){var e;return Xu(Xu.call)||!Xu(Object)||!Xu((function(){e=!0}))||e}))?Wu:Xu,Yu=Hu,Zu=ge,qu=TypeError,Ku=function(e){if(Yu(e))return e;throw qu(Zu(e)+" is not a constructor")},Qu={},Ju=Lo,$u=Re,ec=N,tc=Qu,rc=nt("iterator"),ic=function(e){if(!ec(e))return $u(e,rc)||$u(e,"@@iterator")||tc[Ju(e)]},nc=p,oc=_e,ac=Ft,sc=ge,uc=ic,cc=TypeError,lc=function(e,t){var r=arguments.length<2?uc(e):t;if(oc(r))return ac(nc(r,e));throw cc(sc(e)+" is not iterable")},fc=Qu,hc=nt("iterator"),pc=Array.prototype,dc=function(e){return void 0!==e&&(fc.Array===e||pc[hc]===e)},mc=Lo,vc=function(e){var t=mc(e);return"BigInt64Array"===t||"BigUint64Array"===t},yc=ht,gc=TypeError,xc=function(e){var t=yc(e,"number");if("number"==typeof t)throw gc("Can't convert number to bigint");return BigInt(t)},Tc=Pu,Ec=p,_c=Ku,Sc=ke,Ac=mi,Rc=lc,Cc=ic,Oc=dc,bc=vc,Lc=Sa.aTypedArrayConstructor,Ic=xc,wc=function(e){var t,r,i,n,o,a,s,u,c=_c(this),l=Sc(e),f=arguments.length,h=f>1?arguments[1]:void 0,p=void 0!==h,d=Cc(l);if(d&&!Oc(d))for(u=(s=Rc(l,d)).next,l=[];!(a=Ec(u,s)).done;)l.push(a.value);for(p&&f>2&&(h=Tc(h,arguments[2])),r=Ac(l),i=new(Lc(c))(r),n=bc(i),t=0;r>t;t++)o=p?h(l[t],t):l[t],i[t]=n?Ic(o):+o;return i},Pc=L,Mc=Array.isArray||function(e){return"Array"===Pc(e)},Vc=Hu,Nc=Z,Fc=nt("species"),Dc=Array,Uc=function(e){var t;return Mc(e)&&(t=e.constructor,(Vc(t)&&(t===Dc||Mc(t.prototype))||Nc(t)&&null===(t=t[Fc]))&&(t=void 0)),void 0===t?Dc:t},Bc=Pu,kc=V,zc=ke,Gc=mi,jc=function(e,t){return new(Uc(e))(0===t?0:t)},Xc=R([].push),Wc=function(e){var t=1===e,r=2===e,i=3===e,n=4===e,o=6===e,a=7===e,s=5===e||o;return function(u,c,l,f){for(var h,p,d=zc(u),m=kc(d),v=Bc(c,l),y=Gc(m),g=0,x=f||jc,T=t?x(u,y):r||a?x(u,0):void 0;y>g;g++)if((s||g in m)&&(p=v(h=m[g],g,d),e))if(t)T[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:Xc(T,h)}else switch(e){case 4:return!1;case 7:Xc(T,h)}return o?-1:i||n?n:T}},Hc={forEach:Wc(0),map:Wc(1),filter:Wc(2),some:Wc(3),every:Wc(4),find:Wc(5),findIndex:Wc(6),filterReject:Wc(7)},Yc=Q,Zc=Po,qc=c,Kc=nt("species"),Qc=function(e){var t=Yc(e);qc&&t&&!t[Kc]&&Zc(t,Kc,{configurable:!0,get:function(){return this}})},Jc=W,$c=Z,el=zo,tl=function(e,t,r){var i,n;return el&&Jc(i=t.constructor)&&i!==r&&$c(n=i.prototype)&&n!==r.prototype&&el(e,n),e},rl=nn,il=a,nl=p,ol=c,al=Ia,sl=Sa,ul=vu,cl=Na,ll=T,fl=Kt,hl=xu,pl=pi,dl=Ba,ml=Au,vl=function(e){var t=Ru(e);return t<0?0:t>255?255:255&t},yl=mt,gl=je,xl=Lo,Tl=Z,El=ve,_l=In,Sl=J,Al=zo,Rl=ti.f,Cl=wc,Ol=Hc.forEach,bl=Qc,Ll=Po,Il=wt,wl=s,Pl=tl,Ml=Pr.get,Vl=Pr.set,Nl=Pr.enforce,Fl=Il.f,Dl=wl.f,Ul=il.RangeError,Bl=ul.ArrayBuffer,kl=Bl.prototype,zl=ul.DataView,Gl=sl.NATIVE_ARRAY_BUFFER_VIEWS,jl=sl.TYPED_ARRAY_TAG,Xl=sl.TypedArray,Wl=sl.TypedArrayPrototype,Hl=sl.aTypedArrayConstructor,Yl=sl.isTypedArray,Zl="BYTES_PER_ELEMENT",ql="Wrong length",Kl=function(e,t){Hl(e);for(var r=0,i=t.length,n=new e(i);i>r;)n[r]=t[r++];return n},Ql=function(e,t){Ll(e,t,{configurable:!0,get:function(){return Ml(this)[t]}})},Jl=function(e){var t;return Sl(kl,e)||"ArrayBuffer"===(t=xl(e))||"SharedArrayBuffer"===t},$l=function(e,t){return Yl(e)&&!El(t)&&t in e&&hl(+t)&&t>=0},ef=function(e,t){return t=yl(t),$l(e,t)?ll(2,e[t]):Dl(e,t)},tf=function(e,t,r){return t=yl(t),!($l(e,t)&&Tl(r)&&gl(r,"value"))||gl(r,"get")||gl(r,"set")||r.configurable||gl(r,"writable")&&!r.writable||gl(r,"enumerable")&&!r.enumerable?Fl(e,t,r):(e[t]=r.value,e)};ol?(Gl||(wl.f=ef,Il.f=tf,Ql(Wl,"buffer"),Ql(Wl,"byteOffset"),Ql(Wl,"byteLength"),Ql(Wl,"length")),rl({target:"Object",stat:!0,forced:!Gl},{getOwnPropertyDescriptor:ef,defineProperty:tf}),lo.exports=function(e,t,r){var i=e.match(/\d+/)[0]/8,n=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=il[n],u=s,c=u&&u.prototype,l={},f=function(e,t){Fl(e,t,{get:function(){return function(e,t){var r=Ml(e);return r.view[o](t*i+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=Ml(e);o.view[a](t*i+o.byteOffset,r?vl(n):n,!0)}(this,t,e)},enumerable:!0})};Gl?al&&(u=t((function(e,t,r,n){return cl(e,c),Pl(Tl(t)?Jl(t)?void 0!==n?new s(t,ml(r,i),n):void 0!==r?new s(t,ml(r,i)):new s(t):Yl(t)?Kl(u,t):nl(Cl,u,t):new s(dl(t)),e,u)})),Al&&Al(u,Xl),Ol(Rl(s),(function(e){e in u||fl(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,n){cl(e,c);var o,a,s,l=0,h=0;if(Tl(t)){if(!Jl(t))return Yl(t)?Kl(u,t):nl(Cl,u,t);o=t,h=ml(r,i);var p=t.byteLength;if(void 0===n){if(p%i)throw Ul(ql);if((a=p-h)<0)throw Ul(ql)}else if((a=pl(n)*i)+h>p)throw Ul(ql);s=a/i}else s=dl(t),o=new Bl(a=s*i);for(Vl(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new zl(o)});l<s;)f(e,l++)})),Al&&Al(u,Xl),c=u.prototype=_l(Wl)),c.constructor!==u&&fl(c,"constructor",u),Nl(c).TypedArrayConstructor=u,jl&&fl(c,jl,n);var h=u!==s;l[n]=u,rl({global:!0,constructor:!0,forced:h,sham:!Gl},l),Zl in u||fl(u,Zl,i),Zl in c||fl(c,Zl,i),bl(n)}):lo.exports=function(){},(0,lo.exports)("Int8",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}}),!0),(0,lo.exports)("Int16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Uint16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Int32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Uint32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Float32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,lo.exports)("Float64",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var rf=Lo,nf=_o?{}.toString:function(){return"[object "+rf(this)+"]"};_o||ei(Object.prototype,"toString",nf,{unsafe:!0});var of,af,sf,uf=Lo,cf=String,lf=function(e){if("Symbol"===uf(e))throw TypeError("Cannot convert a Symbol value to a string");return cf(e)},ff=R,hf=ai,pf=lf,df=U,mf=ff("".charAt),vf=ff("".charCodeAt),yf=ff("".slice),gf=function(e){return function(t,r){var i,n,o=pf(df(t)),a=hf(r),s=o.length;return a<0||a>=s?e?"":void 0:(i=vf(o,a))<55296||i>56319||a+1===s||(n=vf(o,a+1))<56320||n>57343?e?mf(o,a):i:e?yf(o,a,a+2):n-56320+(i-55296<<10)+65536}},xf={codeAt:gf(!1),charAt:gf(!0)},Tf=u,Ef=W,_f=Z,Sf=qn,Af=ei,Rf=nt("iterator"),Cf=!1;[].keys&&("next"in(sf=[].keys())?(af=Sf(Sf(sf)))!==Object.prototype&&(of=af):Cf=!0);var Of=!_f(of)||Tf((function(){var e={};return of[Rf].call(e)!==e}));Of&&(of={}),Ef(of[Rf])||Af(of,Rf,(function(){return this}));var bf={IteratorPrototype:of,BUGGY_SAFARI_ITERATORS:Cf},Lf=bf.IteratorPrototype,If=In,wf=T,Pf=hs,Mf=Qu,Vf=function(){return this},Nf=nn,Ff=p,Df=W,Uf=function(e,t,r,i){var n=t+" Iterator";return e.prototype=If(Lf,{next:wf(+!i,r)}),Pf(e,n,!1),Mf[n]=Vf,e},Bf=qn,kf=zo,zf=hs,Gf=Kt,jf=ei,Xf=Qu,Wf=ir.PROPER,Hf=ir.CONFIGURABLE,Yf=bf.IteratorPrototype,Zf=bf.BUGGY_SAFARI_ITERATORS,qf=nt("iterator"),Kf="keys",Qf="values",Jf="entries",$f=function(){return this},eh=function(e,t,r,i,n,o,a){Uf(r,t,i);var s,u,c,l=function(e){if(e===n&&m)return m;if(!Zf&&e in p)return p[e];switch(e){case Kf:case Qf:case Jf:return function(){return new r(this,e)}}return function(){return new r(this)}},f=t+" Iterator",h=!1,p=e.prototype,d=p[qf]||p["@@iterator"]||n&&p[n],m=!Zf&&d||l(n),v="Array"===t&&p.entries||d;if(v&&(s=Bf(v.call(new e)))!==Object.prototype&&s.next&&(Bf(s)!==Yf&&(kf?kf(s,Yf):Df(s[qf])||jf(s,qf,$f)),zf(s,f,!0)),Wf&&n===Qf&&d&&d.name!==Qf&&(Hf?Gf(p,"name",Qf):(h=!0,m=function(){return Ff(d,this)})),n)if(u={values:l(Qf),keys:o?m:l(Kf),entries:l(Jf)},a)for(c in u)(Zf||h||!(c in p))&&jf(p,c,u[c]);else Nf({target:t,proto:!0,forced:Zf||h},u);return p[qf]!==m&&jf(p,qf,m,{name:n}),Xf[t]=m,u},th=function(e,t){return{value:e,done:t}},rh=xf.charAt,ih=lf,nh=Pr,oh=eh,ah=th,sh="String Iterator",uh=nh.set,ch=nh.getterFor(sh);oh(String,"String",(function(e){uh(this,{type:sh,string:ih(e),index:0})}),(function(){var e,t=ch(this),r=t.string,i=t.index;return i>=r.length?ah(void 0,!0):(e=rh(r,i),t.index+=e.length,ah(e,!1))})),(0,Sa.exportTypedArrayStaticMethod)("from",wc,Ia);var lh=Sa.aTypedArrayConstructor;(0,Sa.exportTypedArrayStaticMethod)("of",(function(){for(var e=0,t=arguments.length,r=new(lh(this))(t);t>e;)r[e]=arguments[e++];return r}),Ia);var fh=mi,hh=ai,ph=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("at",(function(e){var t=ph(this),r=fh(t),i=hh(e),n=i>=0?i:r+i;return n<0||n>=r?void 0:t[n]}));var dh=ge,mh=TypeError,vh=ke,yh=li,gh=mi,xh=function(e,t){if(!delete e[t])throw mh("Cannot delete property "+dh(t)+" of "+dh(e))},Th=Math.min,Eh=[].copyWithin||function(e,t){var r=vh(this),i=gh(r),n=yh(e,i),o=yh(t,i),a=arguments.length>2?arguments[2]:void 0,s=Th((void 0===a?i:yh(a,i))-o,i-n),u=1;for(o<n&&n<o+s&&(u=-1,o+=s-1,n+=s-1);s-- >0;)o in r?r[n]=r[o]:xh(r,n),n+=u,o+=u;return r},_h=Sa,Sh=R(Eh),Ah=_h.aTypedArray;(0,_h.exportTypedArrayMethod)("copyWithin",(function(e,t){return Sh(Ah(this),e,t,arguments.length>2?arguments[2]:void 0)}));var Rh=Hc.every,Ch=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("every",(function(e){return Rh(Ch(this),e,arguments.length>1?arguments[1]:void 0)}));var Oh=$a,bh=xc,Lh=Lo,Ih=p,wh=u,Ph=Sa.aTypedArray,Mh=Sa.exportTypedArrayMethod,Vh=R("".slice);Mh("fill",(function(e){var t=arguments.length;Ph(this);var r="Big"===Vh(Lh(this),0,3)?bh(e):+e;return Ih(Oh,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),wh((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})));var Nh=mi,Fh=function(e,t){for(var r=0,i=Nh(t),n=new e(i);i>r;)n[r]=t[r++];return n},Dh=Ft,Uh=Ku,Bh=N,kh=nt("species"),zh=function(e,t){var r,i=Dh(e).constructor;return void 0===i||Bh(r=Dh(i)[kh])?t:Uh(r)},Gh=zh,jh=Sa.aTypedArrayConstructor,Xh=Sa.getTypedArrayConstructor,Wh=function(e){return jh(Gh(e,Xh(e)))},Hh=Fh,Yh=Wh,Zh=function(e,t){return Hh(Yh(e),t)},qh=Hc.filter,Kh=Zh,Qh=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("filter",(function(e){var t=qh(Qh(this),e,arguments.length>1?arguments[1]:void 0);return Kh(this,t)}));var Jh=Hc.find,$h=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("find",(function(e){return Jh($h(this),e,arguments.length>1?arguments[1]:void 0)}));var ep=Hc.findIndex,tp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("findIndex",(function(e){return ep(tp(this),e,arguments.length>1?arguments[1]:void 0)}));var rp=Pu,ip=V,np=ke,op=mi,ap=function(e){var t=1===e;return function(r,i,n){for(var o,a=np(r),s=ip(a),u=rp(i,n),c=op(s);c-- >0;)if(u(o=s[c],c,a))switch(e){case 0:return o;case 1:return c}return t?-1:void 0}},sp={findLast:ap(0),findLastIndex:ap(1)},up=sp.findLast,cp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("findLast",(function(e){return up(cp(this),e,arguments.length>1?arguments[1]:void 0)}));var lp=sp.findLastIndex,fp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("findLastIndex",(function(e){return lp(fp(this),e,arguments.length>1?arguments[1]:void 0)}));var hp=Hc.forEach,pp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("forEach",(function(e){hp(pp(this),e,arguments.length>1?arguments[1]:void 0)}));var dp=Ti.includes,mp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("includes",(function(e){return dp(mp(this),e,arguments.length>1?arguments[1]:void 0)}));var vp=Ti.indexOf,yp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("indexOf",(function(e){return vp(yp(this),e,arguments.length>1?arguments[1]:void 0)}));var gp=Sa.aTypedArray,xp=Sa.exportTypedArrayMethod,Tp=R([].join);xp("join",(function(e){return Tp(gp(this),e)}));var Ep=l,_p=Function.prototype,Sp=_p.apply,Ap=_p.call,Rp="object"==typeof Reflect&&Reflect.apply||(Ep?Ap.bind(Sp):function(){return Ap.apply(Sp,arguments)}),Cp=u,Op=Rp,bp=z,Lp=ai,Ip=mi,wp=function(e,t){var r=[][e];return!!r&&Cp((function(){r.call(null,t||function(){return 1},1)}))},Pp=Math.min,Mp=[].lastIndexOf,Vp=!!Mp&&1/[1].lastIndexOf(1,-0)<0,Np=wp("lastIndexOf"),Fp=Vp||!Np?function(e){if(Vp)return Op(Mp,this,arguments)||0;var t=bp(this),r=Ip(t),i=r-1;for(arguments.length>1&&(i=Pp(i,Lp(arguments[1]))),i<0&&(i=r+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:Mp,Dp=Rp,Up=Fp,Bp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Dp(Up,Bp(this),t>1?[e,arguments[1]]:[e])}));var kp=Hc.map,zp=Wh,Gp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("map",(function(e){return kp(Gp(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(zp(e))(t)}))}));var jp=_e,Xp=ke,Wp=V,Hp=mi,Yp=TypeError,Zp=function(e){return function(t,r,i,n){jp(r);var o=Xp(t),a=Wp(o),s=Hp(o),u=e?s-1:0,c=e?-1:1;if(i<2)for(;;){if(u in a){n=a[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw Yp("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in a&&(n=r(n,a[u],u,o));return n}},qp={left:Zp(!1),right:Zp(!0)},Kp=qp.left,Qp=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return Kp(Qp(this),e,t,t>1?arguments[1]:void 0)}));var Jp=qp.right,$p=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return Jp($p(this),e,t,t>1?arguments[1]:void 0)}));var ed=Sa.aTypedArray,td=Sa.exportTypedArrayMethod,rd=Math.floor;td("reverse",(function(){for(var e,t=this,r=ed(t).length,i=rd(r/2),n=0;n<i;)e=t[n],t[n++]=t[--r],t[r]=e;return t}));var id=a,nd=p,od=Sa,ad=mi,sd=Au,ud=ke,cd=u,ld=id.RangeError,fd=id.Int8Array,hd=fd&&fd.prototype,pd=hd&&hd.set,dd=od.aTypedArray,md=od.exportTypedArrayMethod,vd=!cd((function(){var e=new Uint8ClampedArray(2);return nd(pd,e,{length:1,0:3},1),3!==e[1]})),yd=vd&&od.NATIVE_ARRAY_BUFFER_VIEWS&&cd((function(){var e=new fd(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));md("set",(function(e){dd(this);var t=sd(arguments.length>1?arguments[1]:void 0,1),r=ud(e);if(vd)return nd(pd,this,r,t);var i=this.length,n=ad(r),o=0;if(n+t>i)throw ld("Wrong length");for(;o<n;)this[t+o]=r[o++]}),!vd||yd);var gd=R([].slice),xd=Wh,Td=gd,Ed=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("slice",(function(e,t){for(var r=Td(Ed(this),e,t),i=xd(this),n=0,o=r.length,a=new i(o);o>n;)a[n]=r[n++];return a}),u((function(){new Int8Array(1).slice()})));var _d=Hc.some,Sd=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("some",(function(e){return _d(Sd(this),e,arguments.length>1?arguments[1]:void 0)}));var Ad=us,Rd=Math.floor,Cd=function(e,t){var r=e.length,i=Rd(r/2);return r<8?Od(e,t):bd(e,Cd(Ad(e,0,i),t),Cd(Ad(e,i),t),t)},Od=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},bd=function(e,t,r,i){for(var n=t.length,o=r.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?i(t[a],r[s])<=0?t[a++]:r[s++]:a<n?t[a++]:r[s++];return e},Ld=Cd,Id=$.match(/firefox\/(\d+)/i),wd=!!Id&&+Id[1],Pd=/MSIE|Trident/.test($),Md=$.match(/AppleWebKit\/(\d+)\./),Vd=!!Md&&+Md[1],Nd=bu,Fd=u,Dd=_e,Ud=Ld,Bd=wd,kd=Pd,zd=ae,Gd=Vd,jd=Sa.aTypedArray,Xd=Sa.exportTypedArrayMethod,Wd=a.Uint16Array,Hd=Wd&&Nd(Wd.prototype.sort),Yd=!(!Hd||Fd((function(){Hd(new Wd(2),null)}))&&Fd((function(){Hd(new Wd(2),{})}))),Zd=!!Hd&&!Fd((function(){if(zd)return zd<74;if(Bd)return Bd<67;if(kd)return!0;if(Gd)return Gd<602;var e,t,r=new Wd(516),i=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,i[e]=e-2*t+3;for(Hd(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==i[e])return!0}));Xd("sort",(function(e){return void 0!==e&&Dd(e),Zd?Hd(this,e):Ud(jd(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!Zd||Yd);var qd=pi,Kd=li,Qd=Wh,Jd=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("subarray",(function(e,t){var r=Jd(this),i=r.length,n=Kd(e,i);return new(Qd(r))(r.buffer,r.byteOffset+n*r.BYTES_PER_ELEMENT,qd((void 0===t?i:Kd(t,i))-n))}));var $d=Rp,em=Sa,tm=u,rm=gd,im=a.Int8Array,nm=em.aTypedArray,om=em.exportTypedArrayMethod,am=[].toLocaleString,sm=!!im&&tm((function(){am.call(new im(1))}));om("toLocaleString",(function(){return $d(am,sm?rm(nm(this)):nm(this),rm(arguments))}),tm((function(){return[1,2].toLocaleString()!==new im([1,2]).toLocaleString()}))||!tm((function(){im.prototype.toLocaleString.call([1,2])})));var um=Sa.exportTypedArrayMethod,cm=u,lm=R,fm=a.Uint8Array,hm=fm&&fm.prototype||{},pm=[].toString,dm=lm([].join);cm((function(){pm.call({})}))&&(pm=function(){return dm(this)});var mm=hm.toString!==pm;um("toString",pm,mm);var vm=mi,ym=function(e,t){for(var r=vm(e),i=new t(r),n=0;n<r;n++)i[n]=e[r-n-1];return i},gm=Sa.aTypedArray,xm=Sa.getTypedArrayConstructor;(0,Sa.exportTypedArrayMethod)("toReversed",(function(){return ym(gm(this),xm(this))}));var Tm=_e,Em=Fh,_m=Sa.aTypedArray,Sm=Sa.getTypedArrayConstructor,Am=Sa.exportTypedArrayMethod,Rm=R(Sa.TypedArrayPrototype.sort);Am("toSorted",(function(e){void 0!==e&&Tm(e);var t=_m(this),r=Em(Sm(t),t);return Rm(r,e)}));var Cm=mi,Om=ai,bm=RangeError,Lm=function(e,t,r,i){var n=Cm(e),o=Om(r),a=o<0?n+o:o;if(a>=n||a<0)throw bm("Incorrect index");for(var s=new t(n),u=0;u<n;u++)s[u]=u===a?i:e[u];return s},Im=vc,wm=ai,Pm=xc,Mm=Sa.aTypedArray,Vm=Sa.getTypedArrayConstructor,Nm=Sa.exportTypedArrayMethod,Fm=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}();Nm("with",{with:function(e,t){var r=Mm(this),i=wm(e),n=Im(r)?Pm(t):+t;return Lm(r,Vm(r),i,n)}}.with,!Fm);var Dm=z,Um=Fn,Bm=Qu,km=Pr,zm=wt.f,Gm=eh,jm=th,Xm=c,Wm="Array Iterator",Hm=km.set,Ym=km.getterFor(Wm),Zm=Gm(Array,"Array",(function(e,t){Hm(this,{type:Wm,target:Dm(e),index:0,kind:t})}),(function(){var e=Ym(this),t=e.target,r=e.kind,i=e.index++;if(!t||i>=t.length)return e.target=void 0,jm(void 0,!0);switch(r){case"keys":return jm(i,!1);case"values":return jm(t[i],!1)}return jm([i,t[i]],!1)}),"values"),qm=Bm.Arguments=Bm.Array;if(Um("keys"),Um("values"),Um("entries"),Xm&&"values"!==qm.name)try{zm(qm,"name",{value:"values"})}catch(e){}var Km=a,Qm=u,Jm=R,$m=Sa,ev=Zm,tv=nt("iterator"),rv=Km.Uint8Array,iv=Jm(ev.values),nv=Jm(ev.keys),ov=Jm(ev.entries),av=$m.aTypedArray,sv=$m.exportTypedArrayMethod,uv=rv&&rv.prototype,cv=!Qm((function(){uv[tv].call([1])})),lv=!!uv&&uv.values&&uv[tv]===uv.values&&"values"===uv.values.name,fv=function(){return iv(av(this))};sv("entries",(function(){return ov(av(this))}),cv),sv("keys",(function(){return nv(av(this))}),cv),sv("values",fv,cv||!lv,{name:"values"}),sv(tv,fv,cv||!lv,{name:"values"});var hv=mi,pv=vc,dv=li,mv=xc,vv=ai,yv=u,gv=Sa.aTypedArray,xv=Sa.getTypedArrayConstructor,Tv=Sa.exportTypedArrayMethod,Ev=Math.max,_v=Math.min;Tv("toSpliced",(function(e,t){var r,i,n,o,a,s,u,c=gv(this),l=xv(c),f=hv(c),h=dv(e,f),p=arguments.length,d=0;if(0===p)r=i=0;else if(1===p)r=0,i=f-h;else if(i=_v(Ev(vv(t),0),f-h),r=p-2){o=new l(r),n=pv(o);for(var m=2;m<p;m++)a=arguments[m],o[m-2]=n?mv(a):+a}for(u=new l(s=f+r-i);d<h;d++)u[d]=c[d];for(;d<h+r;d++)u[d]=o[d-h];for(;d<s;d++)u[d]=c[d+i-r];return u}),!!yv((function(){var e=new Int8Array([1]),t=e.toSpliced(1,0,{valueOf:function(){return e[0]=2,3}});return 2!==t[0]||3!==t[1]})));var Sv={exports:{}},Av={},Rv=L,Cv=z,Ov=ti.f,bv=us,Lv="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Av.f=function(e){return Lv&&"Window"===Rv(e)?function(e){try{return Ov(e)}catch(e){return bv(Lv)}}(e):Ov(Cv(e))};var Iv=u((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),wv=u,Pv=Z,Mv=L,Vv=Iv,Nv=Object.isExtensible,Fv=wv((function(){Nv(1)}))||Vv?function(e){return!!Pv(e)&&((!Vv||"ArrayBuffer"!==Mv(e))&&(!Nv||Nv(e)))}:Nv,Dv=!u((function(){return Object.isExtensible(Object.preventExtensions({}))})),Uv=nn,Bv=R,kv=gr,zv=Z,Gv=je,jv=wt.f,Xv=ti,Wv=Av,Hv=Fv,Yv=Dv,Zv=!1,qv=Ze("meta"),Kv=0,Qv=function(e){jv(e,qv,{value:{objectID:"O"+Kv++,weakData:{}}})},Jv=Sv.exports={enable:function(){Jv.enable=function(){},Zv=!0;var e=Xv.f,t=Bv([].splice),r={};r[qv]=1,e(r).length&&(Xv.f=function(r){for(var i=e(r),n=0,o=i.length;n<o;n++)if(i[n]===qv){t(i,n,1);break}return i},Uv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Wv.f}))},fastKey:function(e,t){if(!zv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Gv(e,qv)){if(!Hv(e))return"F";if(!t)return"E";Qv(e)}return e[qv].objectID},getWeakData:function(e,t){if(!Gv(e,qv)){if(!Hv(e))return!0;if(!t)return!1;Qv(e)}return e[qv].weakData},onFreeze:function(e){return Yv&&Zv&&Hv(e)&&!Gv(e,qv)&&Qv(e),e}};kv[qv]=!0;var $v=p,ey=Ft,ty=Re,ry=Pu,iy=p,ny=Ft,oy=ge,ay=dc,sy=mi,uy=J,cy=lc,ly=ic,fy=function(e,t,r){var i,n;ey(e);try{if(!(i=ty(e,"return"))){if("throw"===t)throw r;return r}i=$v(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return ey(i),r},hy=TypeError,py=function(e,t){this.stopped=e,this.result=t},dy=py.prototype,my=function(e,t,r){var i,n,o,a,s,u,c,l=r&&r.that,f=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),d=!(!r||!r.INTERRUPTED),m=ry(t,l),v=function(e){return i&&fy(i,"normal",e),new py(!0,e)},y=function(e){return f?(ny(e),d?m(e[0],e[1],v):m(e[0],e[1])):d?m(e,v):m(e)};if(h)i=e.iterator;else if(p)i=e;else{if(!(n=ly(e)))throw hy(oy(e)+" is not iterable");if(ay(n)){for(o=0,a=sy(e);a>o;o++)if((s=y(e[o]))&&uy(dy,s))return s;return new py(!1)}i=cy(e,n)}for(u=h?e.next:i.next;!(c=iy(u,i)).done;){try{s=y(c.value)}catch(e){fy(i,"throw",e)}if("object"==typeof s&&s&&uy(dy,s))return s}return new py(!1)},vy=nn,yy=a,gy=R,xy=qi,Ty=ei,Ey=Sv.exports,_y=my,Sy=Na,Ay=W,Ry=N,Cy=Z,Oy=u,by=vo,Ly=hs,Iy=tl,wy=In,Py=Po,My=Pa,Vy=Pu,Ny=Na,Fy=N,Dy=my,Uy=eh,By=th,ky=Qc,zy=c,Gy=Sv.exports.fastKey,jy=Pr.set,Xy=Pr.getterFor,Wy={getConstructor:function(e,t,r,i){var n=e((function(e,n){Ny(e,o),jy(e,{type:t,index:wy(null),first:void 0,last:void 0,size:0}),zy||(e.size=0),Fy(n)||Dy(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=Xy(t),s=function(e,t,r){var i,n,o=a(e),s=u(e,t);return s?s.value=r:(o.last=s={index:n=Gy(t,!0),key:t,value:r,previous:i=o.last,next:void 0,removed:!1},o.first||(o.first=s),i&&(i.next=s),zy?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},u=function(e,t){var r,i=a(e),n=Gy(t);if("F"!==n)return i.index[n];for(r=i.first;r;r=r.next)if(r.key===t)return r};return My(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,zy?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),i=u(t,e);if(i){var n=i.next,o=i.previous;delete r.index[i.index],i.removed=!0,o&&(o.next=n),n&&(n.previous=o),r.first===i&&(r.first=n),r.last===i&&(r.last=o),zy?r.size--:t.size--}return!!i},forEach:function(e){for(var t,r=a(this),i=Vy(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(i(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),My(o,r?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),zy&&Py(o,"size",{configurable:!0,get:function(){return a(this).size}}),n},setStrong:function(e,t,r){var i=t+" Iterator",n=Xy(t),o=Xy(i);Uy(e,t,(function(e,t){jy(this,{type:i,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?By("keys"===t?r.key:"values"===t?r.value:[r.key,r.value],!1):(e.target=void 0,By(void 0,!0))}),r?"entries":"values",!r,!0),ky(t)}},Hy=function(e,t,r){var i=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=i?"set":"add",a=yy[e],s=a&&a.prototype,u=a,c={},l=function(e){var t=gy(s[e]);Ty(s,e,"add"===e?function(e){return t(this,0===e?0:e),this}:"delete"===e?function(e){return!(n&&!Cy(e))&&t(this,0===e?0:e)}:"get"===e?function(e){return n&&!Cy(e)?void 0:t(this,0===e?0:e)}:"has"===e?function(e){return!(n&&!Cy(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(xy(e,!Ay(a)||!(n||s.forEach&&!Oy((function(){(new a).entries().next()})))))u=r.getConstructor(t,e,i,o),Ey.enable();else if(xy(e,!0)){var f=new u,h=f[o](n?{}:-0,1)!==f,p=Oy((function(){f.has(1)})),d=by((function(e){new a(e)})),m=!n&&Oy((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));d||((u=t((function(e,t){Sy(e,s);var r=Iy(new a,e,u);return Ry(t)||_y(t,r[o],{that:r,AS_ENTRIES:i}),r}))).prototype=s,s.constructor=u),(p||m)&&(l("delete"),l("has"),i&&l("get")),(m||h)&&l(o),n&&s.clear&&delete s.clear}return c[e]=u,vy({global:!0,constructor:!0,forced:u!==a},c),Ly(u,e),n||r.setStrong(u,e,i),u};Hy("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Wy);var Yy,Zy,qy,Ky,Qy="process"===L(a.process),Jy=TypeError,$y=/(?:ipad|iphone|ipod).*applewebkit/i.test($),eg=a,tg=Rp,rg=Pu,ig=W,ng=je,og=u,ag=vn,sg=gd,ug=xt,cg=function(e,t){if(e<t)throw Jy("Not enough arguments");return e},lg=$y,fg=Qy,hg=eg.setImmediate,pg=eg.clearImmediate,dg=eg.process,mg=eg.Dispatch,vg=eg.Function,yg=eg.MessageChannel,gg=eg.String,xg=0,Tg={},Eg="onreadystatechange";og((function(){Yy=eg.location}));var _g=function(e){if(ng(Tg,e)){var t=Tg[e];delete Tg[e],t()}},Sg=function(e){return function(){_g(e)}},Ag=function(e){_g(e.data)},Rg=function(e){eg.postMessage(gg(e),Yy.protocol+"//"+Yy.host)};hg&&pg||(hg=function(e){cg(arguments.length,1);var t=ig(e)?e:vg(e),r=sg(arguments,1);return Tg[++xg]=function(){tg(t,void 0,r)},Zy(xg),xg},pg=function(e){delete Tg[e]},fg?Zy=function(e){dg.nextTick(Sg(e))}:mg&&mg.now?Zy=function(e){mg.now(Sg(e))}:yg&&!lg?(Ky=(qy=new yg).port2,qy.port1.onmessage=Ag,Zy=rg(Ky.postMessage,Ky)):eg.addEventListener&&ig(eg.postMessage)&&!eg.importScripts&&Yy&&"file:"!==Yy.protocol&&!og(Rg)?(Zy=Rg,eg.addEventListener("message",Ag,!1)):Zy=Eg in ug("script")?function(e){ag.appendChild(ug("script"))[Eg]=function(){ag.removeChild(this),_g(e)}}:function(e){setTimeout(Sg(e),0)});var Cg={set:hg,clear:pg},Og=function(){this.head=null,this.tail=null};Og.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var bg,Lg,Ig,wg,Pg,Mg=Og,Vg=/ipad|iphone|ipod/i.test($)&&"undefined"!=typeof Pebble,Ng=/web0s(?!.*chrome)/i.test($),Fg=a,Dg=Pu,Ug=s.f,Bg=Cg.set,kg=Mg,zg=$y,Gg=Vg,jg=Ng,Xg=Qy,Wg=Fg.MutationObserver||Fg.WebKitMutationObserver,Hg=Fg.document,Yg=Fg.process,Zg=Fg.Promise,qg=Ug(Fg,"queueMicrotask"),Kg=qg&&qg.value;if(!Kg){var Qg=new kg,Jg=function(){var e,t;for(Xg&&(e=Yg.domain)&&e.exit();t=Qg.get();)try{t()}catch(e){throw Qg.head&&bg(),e}e&&e.enter()};zg||Xg||jg||!Wg||!Hg?!Gg&&Zg&&Zg.resolve?((wg=Zg.resolve(void 0)).constructor=Zg,Pg=Dg(wg.then,wg),bg=function(){Pg(Jg)}):Xg?bg=function(){Yg.nextTick(Jg)}:(Bg=Dg(Bg,Fg),bg=function(){Bg(Jg)}):(Lg=!0,Ig=Hg.createTextNode(""),new Wg(Jg).observe(Ig,{characterData:!0}),bg=function(){Ig.data=Lg=!Lg}),Kg=function(e){Qg.head||bg(),Qg.add(e)}}var $g=Kg,ex=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},tx=a.Promise,rx="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,ix=!rx&&!Qy&&"object"==typeof window&&"object"==typeof document,nx=a,ox=tx,ax=W,sx=qi,ux=lr,cx=nt,lx=ix,fx=rx,hx=ae;ox&&ox.prototype;var px=cx("species"),dx=!1,mx=ax(nx.PromiseRejectionEvent),vx=sx("Promise",(function(){var e=ux(ox),t=e!==String(ox);if(!t&&66===hx)return!0;if(!hx||hx<51||!/native code/.test(e)){var r=new ox((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[px]=i,!(dx=r.then((function(){}))instanceof i))return!0}return!t&&(lx||fx)&&!mx})),yx={CONSTRUCTOR:vx,REJECTION_EVENT:mx,SUBCLASSING:dx},gx={},xx=_e,Tx=TypeError,Ex=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw Tx("Bad Promise constructor");t=e,r=i})),this.resolve=xx(t),this.reject=xx(r)};gx.f=function(e){return new Ex(e)};var _x,Sx,Ax,Rx=nn,Cx=Qy,Ox=a,bx=p,Lx=ei,Ix=zo,wx=hs,Px=Qc,Mx=_e,Vx=W,Nx=Z,Fx=Na,Dx=zh,Ux=Cg.set,Bx=$g,kx=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},zx=ex,Gx=Mg,jx=Pr,Xx=tx,Wx=gx,Hx="Promise",Yx=yx.CONSTRUCTOR,Zx=yx.REJECTION_EVENT,qx=yx.SUBCLASSING,Kx=jx.getterFor(Hx),Qx=jx.set,Jx=Xx&&Xx.prototype,$x=Xx,eT=Jx,tT=Ox.TypeError,rT=Ox.document,iT=Ox.process,nT=Wx.f,oT=nT,aT=!!(rT&&rT.createEvent&&Ox.dispatchEvent),sT="unhandledrejection",uT=function(e){var t;return!(!Nx(e)||!Vx(t=e.then))&&t},cT=function(e,t){var r,i,n,o=t.value,a=1===t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(a||(2===t.rejection&&dT(t),t.rejection=1),!0===s?r=o:(l&&l.enter(),r=s(o),l&&(l.exit(),n=!0)),r===e.promise?c(tT("Promise-chain cycle")):(i=uT(r))?bx(i,r,u,c):u(r)):c(o)}catch(e){l&&!n&&l.exit(),c(e)}},lT=function(e,t){e.notified||(e.notified=!0,Bx((function(){for(var r,i=e.reactions;r=i.get();)cT(r,e);e.notified=!1,t&&!e.rejection&&hT(e)})))},fT=function(e,t,r){var i,n;aT?((i=rT.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),Ox.dispatchEvent(i)):i={promise:t,reason:r},!Zx&&(n=Ox["on"+e])?n(i):e===sT&&kx("Unhandled promise rejection",r)},hT=function(e){bx(Ux,Ox,(function(){var t,r=e.facade,i=e.value;if(pT(e)&&(t=zx((function(){Cx?iT.emit("unhandledRejection",i,r):fT(sT,r,i)})),e.rejection=Cx||pT(e)?2:1,t.error))throw t.value}))},pT=function(e){return 1!==e.rejection&&!e.parent},dT=function(e){bx(Ux,Ox,(function(){var t=e.facade;Cx?iT.emit("rejectionHandled",t):fT("rejectionhandled",t,e.value)}))},mT=function(e,t,r){return function(i){e(t,i,r)}},vT=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,lT(e,!0))},yT=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw tT("Promise can't be resolved itself");var i=uT(t);i?Bx((function(){var r={done:!1};try{bx(i,t,mT(yT,r,e),mT(vT,r,e))}catch(t){vT(r,t,e)}})):(e.value=t,e.state=1,lT(e,!1))}catch(t){vT({done:!1},t,e)}}};if(Yx&&(eT=($x=function(e){Fx(this,eT),Mx(e),bx(_x,this);var t=Kx(this);try{e(mT(yT,t),mT(vT,t))}catch(e){vT(t,e)}}).prototype,(_x=function(e){Qx(this,{type:Hx,done:!1,notified:!1,parent:!1,reactions:new Gx,rejection:!1,state:0,value:void 0})}).prototype=Lx(eT,"then",(function(e,t){var r=Kx(this),i=nT(Dx(this,$x));return r.parent=!0,i.ok=!Vx(e)||e,i.fail=Vx(t)&&t,i.domain=Cx?iT.domain:void 0,0===r.state?r.reactions.add(i):Bx((function(){cT(i,r)})),i.promise})),Sx=function(){var e=new _x,t=Kx(e);this.promise=e,this.resolve=mT(yT,t),this.reject=mT(vT,t)},Wx.f=nT=function(e){return e===$x||undefined===e?new Sx(e):oT(e)},Vx(Xx)&&Jx!==Object.prototype)){Ax=Jx.then,qx||Lx(Jx,"then",(function(e,t){var r=this;return new $x((function(e,t){bx(Ax,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete Jx.constructor}catch(e){}Ix&&Ix(Jx,eT)}Rx({global:!0,constructor:!0,wrap:!0,forced:Yx},{Promise:$x}),wx($x,Hx,!1),Px(Hx);var gT=tx,xT=yx.CONSTRUCTOR||!vo((function(e){gT.all(e).then(void 0,(function(){}))})),TT=p,ET=_e,_T=gx,ST=ex,AT=my;nn({target:"Promise",stat:!0,forced:xT},{all:function(e){var t=this,r=_T.f(t),i=r.resolve,n=r.reject,o=ST((function(){var r=ET(t.resolve),o=[],a=0,s=1;AT(e,(function(e){var u=a++,c=!1;s++,TT(r,t,e).then((function(e){c||(c=!0,o[u]=e,--s||i(o))}),n)})),--s||i(o)}));return o.error&&n(o.value),r.promise}});var RT=nn,CT=yx.CONSTRUCTOR,OT=tx,bT=Q,LT=W,IT=ei,wT=OT&&OT.prototype;if(RT({target:"Promise",proto:!0,forced:CT,real:!0},{catch:function(e){return this.then(void 0,e)}}),LT(OT)){var PT=bT("Promise").prototype.catch;wT.catch!==PT&&IT(wT,"catch",PT,{unsafe:!0})}var MT=p,VT=_e,NT=gx,FT=ex,DT=my;nn({target:"Promise",stat:!0,forced:xT},{race:function(e){var t=this,r=NT.f(t),i=r.reject,n=FT((function(){var n=VT(t.resolve);DT(e,(function(e){MT(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var UT=p,BT=gx;nn({target:"Promise",stat:!0,forced:yx.CONSTRUCTOR},{reject:function(e){var t=BT.f(this);return UT(t.reject,void 0,e),t.promise}});var kT=Ft,zT=Z,GT=gx,jT=nn,XT=yx.CONSTRUCTOR,WT=function(e,t){if(kT(e),zT(t)&&t.constructor===e)return t;var r=GT.f(e);return(0,r.resolve)(t),r.promise};Q("Promise"),jT({target:"Promise",stat:!0,forced:XT},{resolve:function(e){return WT(this,e)}});var HT,YT,ZT=a,qT=Fe,KT=W,QT=qn,JT=ei,$T="USE_FUNCTION_CONSTRUCTOR",eE=nt("asyncIterator"),tE=ZT.AsyncIterator,rE=qT.AsyncIteratorPrototype;if(rE)HT=rE;else if(KT(tE))HT=tE.prototype;else if(qT[$T]||ZT[$T])try{YT=QT(QT(QT(Function("return async function*(){}()")()))),QT(YT)===Object.prototype&&(HT=YT)}catch(e){}HT||(HT={}),KT(HT[eE])||JT(HT,eE,(function(){return this}));var iE=p,nE=Ft,oE=In,aE=Re,sE=Pa,uE=Pr,cE=HT,lE=th,fE=Q("Promise"),hE="AsyncFromSyncIterator",pE=uE.set,dE=uE.getterFor(hE),mE=function(e,t,r){var i=e.done;fE.resolve(e.value).then((function(e){t(lE(e,i))}),r)},vE=function(e){e.type=hE,pE(this,e)};vE.prototype=sE(oE(cE),{next:function(){var e=dE(this);return new fE((function(t,r){var i=nE(iE(e.next,e.iterator));mE(i,t,r)}))},return:function(){var e=dE(this).iterator;return new fE((function(t,r){var i=aE(e,"return");if(void 0===i)return t(lE(void 0,!0));var n=nE(iE(i,e));mE(n,t,r)}))}});var yE=vE,gE=function(e){return{iterator:e,next:e.next,done:!1}},xE=p,TE=yE,EE=Ft,_E=lc,SE=gE,AE=Re,RE=nt("asyncIterator"),CE=a,OE=TypeError,bE=p,LE=Q,IE=Re,wE=p,PE=_e,ME=Ft,VE=Z,NE=function(e){if(e>9007199254740991)throw OE("Maximum allowed index exceeded");return e},FE=Q,DE=gE,UE=function(e,t,r,i){try{var n=IE(e,"return");if(n)return LE("Promise").resolve(bE(n,e)).then((function(){t(r)}),(function(e){i(e)}))}catch(e){return i(e)}t(r)},BE=function(e){var t=0===e,r=1===e,i=2===e,n=3===e;return function(e,o,a){ME(e);var s=void 0!==o;!s&&t||PE(o);var u=DE(e),c=FE("Promise"),l=u.iterator,f=u.next,h=0;return new c((function(e,u){var p=function(e){UE(l,u,e,u)},d=function(){try{if(s)try{NE(h)}catch(e){p(e)}c.resolve(ME(wE(f,l))).then((function(f){try{if(ME(f).done)t?(a.length=h,e(a)):e(!n&&(i||void 0));else{var m=f.value;try{if(s){var v=o(m,h),y=function(o){if(r)d();else if(i)o?d():UE(l,e,!1,u);else if(t)try{a[h++]=o,d()}catch(e){p(e)}else o?UE(l,e,n||m,u):d()};VE(v)?c.resolve(v).then(y,p):y(v)}else a[h++]=m,d()}catch(e){p(e)}}}catch(e){u(e)}}),u)}catch(e){u(e)}};d()}))}},kE={toArray:BE(0),forEach:BE(1),every:BE(2),some:BE(3),find:BE(4)},zE=Pu,GE=R,jE=ke,XE=Hu,WE=function(e,t){var r=arguments.length<2?AE(e,RE):t;return r?EE(xE(r,e)):new TE(SE(_E(e)))},HE=lc,YE=gE,ZE=ic,qE=Re,KE=function(e){return CE[e].prototype},QE=Q,JE=yE,$E=kE.toArray,e_=nt("asyncIterator"),t_=GE(KE("Array").values),r_=GE(t_([]).next),i_=function(){return new n_(this)},n_=function(e){this.iterator=t_(e)};n_.prototype.next=function(){return r_(this.iterator)};var o_=Q,a_=Ku,s_=function(e){var t=this,r=arguments.length,i=r>1?arguments[1]:void 0,n=r>2?arguments[2]:void 0;return new(QE("Promise"))((function(r){var o=jE(e);void 0!==i&&(i=zE(i,n));var a=qE(o,e_),s=a?void 0:ZE(o)||i_,u=XE(t)?new t:[],c=a?WE(o,a):new JE(YE(HE(o,s)));r($E(c,i,u))}))},u_=Fh,c_=Sa.aTypedArrayConstructor;(0,Sa.exportTypedArrayStaticMethod)("fromAsync",(function(e){var t=this,r=arguments.length,i=r>1?arguments[1]:void 0,n=r>2?arguments[2]:void 0;return new(o_("Promise"))((function(r){a_(t),r(s_(e,i,n))})).then((function(e){return u_(c_(t),e)}))}),!0);var l_=Hc.filterReject,f_=Zh,h_=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("filterOut",(function(e){var t=l_(h_(this),e,arguments.length>1?arguments[1]:void 0);return f_(this,t)}),!0);var p_=Hc.filterReject,d_=Zh,m_=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("filterReject",(function(e){var t=p_(m_(this),e,arguments.length>1?arguments[1]:void 0);return d_(this,t)}),!0);var v_=Pu,y_=V,g_=ke,x_=mt,T_=mi,E_=In,__=Fh,S_=Array,A_=R([].push),R_=function(e,t,r,i){for(var n,o,a,s=g_(e),u=y_(s),c=v_(t,r),l=E_(null),f=T_(u),h=0;f>h;h++)a=u[h],(o=x_(c(a,h,s)))in l?A_(l[o],a):l[o]=[a];if(i&&(n=i(s))!==S_)for(o in l)l[o]=__(n,l[o]);return l},C_=Wh,O_=Sa.aTypedArray;(0,Sa.exportTypedArrayMethod)("groupBy",(function(e){var t=arguments.length>1?arguments[1]:void 0;return R_(O_(this),e,t,C_)}),!0);var b_=R,L_=Map.prototype,I_={Map:Map,set:b_(L_.set),get:b_(L_.get),has:b_(L_.has),remove:b_(L_.delete),proto:L_},w_=p,P_=R,M_=function(e,t,r){for(var i,n,o=r?e:e.iterator,a=e.next;!(i=w_(a,o)).done;)if(void 0!==(n=t(i.value)))return n},V_=I_.Map,N_=I_.proto,F_=P_(N_.forEach),D_=P_(N_.entries),U_=D_(new V_).next,B_=_e,k_=N,z_=mi,G_=ke,j_=function(e,t,r){return r?M_({iterator:D_(e),next:U_},(function(e){return t(e[1],e[0])})):F_(e,t)},X_=I_.Map,W_=I_.has,H_=I_.set,Y_=R([].push),Z_=Fh,q_=function(e){var t,r,i,n=G_(this),o=z_(n),a=[],s=new X_,u=k_(e)?function(e){return e}:B_(e);for(t=0;t<o;t++)i=u(r=n[t]),W_(s,i)||H_(s,i,r);return j_(s,(function(e){Y_(a,e)})),a},K_=Sa.aTypedArray,Q_=Sa.getTypedArrayConstructor,J_=Sa.exportTypedArrayMethod,$_=R(q_);J_("uniqueBy",(function(e){return K_(this),Z_(Q_(this),$_(this,e))}),!0);var eS=function(e,t){return eS=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},eS(e,t)};function tS(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}eS(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var rS=function(){return rS=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},rS.apply(this,arguments)};function iS(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{u(i.next(e))}catch(e){o(e)}}function s(e){try{u(i.throw(e))}catch(e){o(e)}}function u(e){e.done?n(e.value):function(e){return e instanceof r?e:new r((function(t){t(e)}))}(e.value).then(a,s)}u((i=i.apply(e,t||[])).next())}))}function nS(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function oS(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function aS(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function sS(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var uS=6,cS="tree",lS="PRE_COLOR_0",fS="PRE_COLOR_SIZE_0",hS="PRE_MAIN_COLOR_0",pS="PRE_MAIN_COLOR_SIZE_0",dS="editor",mS="none",vS=.017453292519943295,yS={"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"};var gS=[],xS={};function TS(){"function"==typeof WebGL2RenderingContext?ES(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(ES(WebGLRenderingContext),ES(WebGLRenderingContext.prototype)):gS.push("iOS16 lockdown mode, WebGL Constants not in global"),gS.length||"HALF_FLOAT"in xS||(xS.HALF_FLOAT=5131)}function ES(e){for(var t in e)/^[A-Z_]/.test(t)&&(xS[t]=e[t])}gS.length||TS();var _S,SS,AS,RS,CS,OS,bS,LS,IS,wS,PS,MS,VS={},NS={};function FS(e,t,r){e in VS&&console.error("Filter ".concat(e," registered twice.")),VS[e]=t,NS[e]=r}function DS(e){Object.keys(e).forEach((function(t){var r=aS(e[t],2);FS(t,r[0],r[1])}))}function US(e){var t=NS[e.name];if(!t)throw Error("Filter ".concat(e.name," not imported, see ").concat(yS["Filter not imported"]));return t(e)}function BS(e,t){var r=VS[e.name];if(!r)throw Error("Filter ".concat(e.name," not imported, see ").concat(yS["Filter not imported"]));var i=r(e,t);return i.passSplitOptions||(i.passSplitOptions={attachments:[{texture:{format:xS.RGBA}}]}),i}function kS(e,t){return e.includes(t)||e.push(t),e}function zS(e,t){var r=e.indexOf(t);return r>-1&&e.splice(r,1),e}function GS(e,t,r,i){if(void 0===i&&(i=!1),!e.includes(t)&&(e.push(t),1!==e.length)){var n=e.length-1;if(n){var o=e[n];if(i)for(;e[n-1][r]<o[r]&&(e[n]=e[n-1],0!=--n););else for(;e[n-1][r]>o[r]&&(e[n]=e[n-1],0!=--n););e[n]=o}}}function jS(e,t,r,i){if(void 0===r&&(r=1),e.buffer.byteLength<e.BYTES_PER_ELEMENT*t){var n=Math.ceil(t*r);isNaN(i)||(n=Math.min(n,i));var o=new ArrayBuffer(e.BYTES_PER_ELEMENT*n),a=new e.constructor(o);return a.set(e),a}return e}function XS(e,t){var r=[0,0,0,0];if(lC(e)){e=e.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(e);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(e)?r=[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else e instanceof Array&&(r=[e[0],e[1],e[2],isNaN(e[3])?255:e[3]]);if(t)for(var o=0;o<4;o++)r[o]/=255;return r}function WS(e,t,r){if(e.length){for(var i=void 0,n=1;n<=e.length-1;n++){var o=e[n-1],a=e[n];if(o.stop<=t&&t<=a.stop){i=YS(o.color,a.color,(t-o.stop)/(a.stop-o.stop));break}}return i||(i=e[e.length-1].color),r?i.map((function(e){return e/255})):i}return[0,0,0,0]}function HS(e){var t=[];if(e instanceof Array?e.forEach((function(e){var r=aS(e,5),i=r[0],n=r[1],o=r[2],a=r[3],s=r[4];t.push({stop:ZS(i),color:[n,o,a,s]})})):Object.keys(e).forEach((function(r){var i=XS(e[r]);t.push({stop:ZS(r),color:i})})),(t=t.sort((function(e,t){return e.stop-t.stop}))).length){0!==t[0].stop&&t.unshift({stop:0,color:t[0].color.slice()});var r=t[t.length-1];1!==r.stop&&t.push({stop:1,color:r.color.slice()})}return t}function YS(e,t,r,i){var n=[],o=1-r;if(i)for(var a=0;a<4;a++)n[a]=e[a]*o+t[a]*r;else{for(a=0;a<3;a++)n[a]=Math.round(Math.sqrt(e[a]*e[a]*o+t[a]*t[a]*r));n[3]=Math.round(e[3]*o+t[3]*r)}return n}function ZS(e){var t=/^(-)?([\d+.]+)%$/.exec(e);return t?+t[2]/100*(t[1]?-1:1):+e}function qS(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function KS(){return qS()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function QS(e){var t=128,r={width:t,height:1,data:new Uint8Array(512)},i=r.data,n=HS(e);if(n.length){i.set(n[0].color,0);for(var o=1;o<127;o++){for(var a=o/t,s=void 0,u=void 0,c=0;c<n.length&&(s=n[c],u=n[c+1],!(s.stop<=a&&u.stop>a));c++);var l=YS(s.color,u.color,(a-s.stop)/(u.stop-s.stop));i.set(l,4*o)}i.set(n[n.length-1].color,508)}return r}function JS(t,r){void 0===r&&(r=e.OrderType.ascending);var i=t.length;if(i<=1||r===e.OrderType.none)return t;if(i<=30){for(var n=1;n<i;n++)eA(t,n,r);return t}return tA(t,r)}function $S(t,r,i){return void 0===i&&(i=e.OrderType.ascending),t.includes(r)?t:(t.push(r),1===t.length||i!==e.OrderType.none&&eA(t,t.length-1,i),t)}function eA(t,r,i){var n=t[r];if(i!==e.OrderType.ascending)for(;r>=1&&t[r-1].priority<n.priority&&(t[r]=t[r-1],0!=--r););else for(;r>=1&&t[r-1].priority>n.priority&&(t[r]=t[r-1],0!=--r););t[r]=n}function tA(t,r,i,n){var o,a;if(void 0===i&&(i=0),void 0===n&&(n=t.length-1),i>=n)return t;for(var s=t[i],u=i,c=n;u<c;){if(r===e.OrderType.ascending){for(;t[c].priority>s.priority&&c>=u;)c--;for(;t[u].priority<=s.priority&&u<c;)u++}else{for(;t[c].priority<s.priority&&c>=u;)c--;for(;t[u].priority>=s.priority&&u<c;)u++}o=aS([t[c],t[u]],2),t[u]=o[0],t[c]=o[1]}return a=aS([t[u],t[i]],2),t[i]=a[0],t[u]=a[1],tA(t,r,i,u-1),tA(t,r,c+1,n),t}function rA(e,t){if(void 0===t&&(t="item doesn't exist"),null==e)throw new Error(t)}e.OrderType=void 0,(_S=e.OrderType||(e.OrderType={}))[_S.none=1]="none",_S[_S.ascending=2]="ascending",_S[_S.descending=3]="descending",function(e){e.S="S",e.APlus="A+",e.A="A",e.BPlus="B+",e.B="B"}(SS||(SS={})),function(e){e[e.ALPHA=0]="ALPHA",e[e.ADD=1]="ADD",e[e.MULTIPLY=2]="MULTIPLY",e[e.BRIGHTNESS=3]="BRIGHTNESS",e[e.SUBTRACTION=4]="SUBTRACTION",e[e.STRONG_LIGHT=5]="STRONG_LIGHT",e[e.WEAK_LIGHT=6]="WEAK_LIGHT",e[e.SUPERPOSITION=7]="SUPERPOSITION"}(AS||(AS={})),function(e){e[e.DOUBLE=1032]="DOUBLE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK"}(RS||(RS={})),function(e){e[e.NONE=0]="NONE",e[e.MASK=1]="MASK",e[e.OBSCURED=2]="OBSCURED",e[e.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(CS||(CS={})),function(e){e[e.NONE=0]="NONE",e[e.SPHERE=1]="SPHERE",e[e.CONE=2]="CONE",e[e.HEMISPHERE=3]="HEMISPHERE",e[e.CIRCLE=4]="CIRCLE",e[e.DONUT=5]="DONUT",e[e.RECTANGLE=6]="RECTANGLE",e[e.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",e[e.EDGE=8]="EDGE",e[e.TEXTURE=9]="TEXTURE"}(OS||(OS={})),function(e){e[e.GYROSCOPE=0]="GYROSCOPE",e[e.SPINE=1]="SPINE"}(bS||(bS={})),function(e){e[e.CLICK=0]="CLICK",e[e.MESSAGE=1]="MESSAGE",e[e.DRAG=2]="DRAG"}(LS||(LS={})),function(e){e[e.NONE=0]="NONE",e[e.NOTIFY=1]="NOTIFY",e[e.RESUME_PLAYER=2]="RESUME_PLAYER",e[e.REMOVE=3]="REMOVE",e[e.PAUSE=4]="PAUSE"}(IS||(IS={})),function(e){e.base="0",e.sprite="1",e.particle="2",e.null="3",e.interact="4",e.plugin="5",e.camera="6",e.composition="7",e.filter="8",e.spine="spine",e.mesh="mesh",e.tree="tree",e.text="text",e.light="light",e.skybox="skybox"}(wS||(wS={})),function(e){e[e.BILLBOARD=0]="BILLBOARD",e[e.MESH=1]="MESH",e[e.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",e[e.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(PS||(PS={})),function(e){e[e.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",e[e.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",e[e.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",e[e.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",e[e.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",e[e.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",e[e.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",e[e.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",e[e.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(MS||(MS={}));var iA,nA,oA,aA,sA,uA,cA,lA;!function(e){e[e.portrait=1]="portrait",e[e.landscape=0]="landscape"}(iA||(iA={})),function(e){e[e.destroy=0]="destroy",e[e.pause=1]="pause",e[e.restart=5]="restart",e[e.forward=2]="forward",e[e.pause_destroy=3]="pause_destroy"}(nA||(nA={})),function(e){e[e.CONSTANT=0]="CONSTANT",e[e.CONSTANT_VEC2=1]="CONSTANT_VEC2",e[e.CONSTANT_VEC3=2]="CONSTANT_VEC3",e[e.CONSTANT_VEC4=3]="CONSTANT_VEC4",e[e.RANDOM=4]="RANDOM",e[e.LINE=5]="LINE",e[e.CURVE=6]="CURVE",e[e.BEZIER_PATH=7]="BEZIER_PATH",e[e.RGBA_COLOR=8]="RGBA_COLOR",e[e.GRADIENT_COLOR=9]="GRADIENT_COLOR",e[e.SHAPE_POINTS=10]="SHAPE_POINTS",e[e.SHAPE_SPLITS=11]="SHAPE_SPLITS",e[e.LINEAR_PATH=12]="LINEAR_PATH",e[e.COLORS=13]="COLORS",e[e.BINARY=20]="BINARY",e[e.BEZIER_CURVE=21]="BEZIER_CURVE",e[e.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH"}(oA||(oA={})),function(e){e[e.AUTO=0]="AUTO",e[e.EASE=1]="EASE",e[e.EASE_IN=2]="EASE_IN",e[e.EASE_OUT=3]="EASE_OUT",e[e.LINE=4]="LINE",e[e.HOLD=5]="HOLD",e[e.LINE_OUT=6]="LINE_OUT"}(aA||(aA={})),function(e){e[e.destroy=0]="destroy",e[e.loop=5]="loop",e[e.freeze=4]="freeze"}(sA||(sA={})),function(e){e[e.destroyChildren=6]="destroyChildren"}(uA||(uA={})),function(e){e[e.none=0]="none",e[e.removeParticle=1]="removeParticle"}(cA||(cA={})),function(e){e[e.RANDOM=0]="RANDOM",e[e.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",e[e.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",e[e.UNIFORM_BURST=3]="UNIFORM_BURST"}(lA||(lA={}));var fA,hA,pA,dA,mA,vA,yA,gA,xA;!function(e){e[e.box=2]="box",e[e.sphere=3]="sphere"}(fA||(fA={})),function(e){e.unlit="unlit",e.pbr="pbr",e.hair="hair"}(hA||(hA={})),function(e){e[e.opaque=100]="opaque",e[e.masked=101]="masked",e[e.translucent=102]="translucent",e[e.additive=103]="additive"}(pA||(pA={})),function(e){e.none="none",e.uv="uv",e.normal="normal",e.basecolor="basecolor",e.alpha="alpha",e.metallic="metallic",e.roughness="roughness",e.ao="ao",e.emissive="emissive"}(dA||(dA={})),function(e){e[e.display=0]="display",e[e.clip=1]="clip",e[e.ellipsis=2]="ellipsis"}(mA||(mA={})),function(e){e[e.top=0]="top",e[e.middle=1]="middle",e[e.bottom=2]="bottom"}(vA||(vA={})),function(e){e[e.left=0]="left",e[e.middle=1]="middle",e[e.right=2]="right"}(yA||(yA={})),function(e){e.normal="normal",e.bold="bold",e.lighter="lighter"}(gA||(gA={})),function(e){e.normal="normal",e.italic="italic",e.oblique="oblique"}(xA||(xA={}));var TA,EA=Object.freeze({__proto__:null,get BezierKeyframeType(){return aA},get BlendingMode(){return AS},BloomFilterThresholdAvgColor:0,CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return iA},get CompositionEndBehavior(){return nA},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_DESTROY_CHILDREN:6,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_RESTART:5,get FontStyle(){return xA},get InteractBehavior(){return IS},get InteractType(){return LS},get ItemEndBehavior(){return sA},get ItemType(){return wS},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return CS},get MaterialBlending(){return pA},get MaterialType(){return hA},get ModelBoundingType(){return fA},get ParentItemEndBehavior(){return uA},get ParticleInteractionBehavior(){return cA},get ParticleOrigin(){return MS},get PluginType(){return bS},get RenderLevel(){return SS},get RenderMode(){return PS},get RenderMode3D(){return dA},get ShapeArcMode(){return lA},get ShapeType(){return OS},get SideMode(){return RS},get TextAlignment(){return yA},get TextBaseline(){return vA},get TextOverflow(){return mA},get TextWeight(){return gA},get ValueType(){return oA}}),_A=((TA={})[MS.PARTICLE_ORIGIN_CENTER]=[0,0],TA[MS.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],TA[MS.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],TA[MS.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],TA[MS.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],TA[MS.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],TA[MS.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],TA[MS.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],TA[MS.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],TA);function SA(e,t,r){return e>r?r:e<t?t:e}function AA(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function RA(e,t){return e?[e[0]-.5,.5-e[1]]:t?_A[t]:[0,0]}var CA,OA,bA=(CA=new Float32Array(1),OA=new Int32Array(CA.buffer),function(e){CA[0]=e;var t=OA[0],r=t>>16&32768,i=t>>12&2047,n=t>>23&255;return n<103?r:n>142?(r|=31744,r|=(255==n?0:1)&&8388607&t):n<113?r|=((i|=2048)>>114-n)+(i>>113-n&1):(r|=n-112<<10|i>>1,r+=1&i)}),LA=function(){function e(e){if(Number.isInteger(e))this.data=new Uint16Array(e);else if(e&&"object"==typeof e&&Number.isInteger(e.length))for(var t=this.data=new Uint16Array(e.length),r=0;r<t.length;r++)t[r]=bA(e[r])}return e.prototype.set=function(e,t){for(var r=0;r<e.length;r++)this.data[r+t]=bA(e[r])},e}(),IA=Math.PI/180;function wA(e,t){var r=aS(t,4),i=r[0],n=r[1],o=r[2],a=r[3],s=i+i,u=n+n,c=o+o,l=i*s,f=n*s,h=n*u,p=o*s,d=o*u,m=o*c,v=a*s,y=a*u,g=a*c;return e[0]=1-h-m,e[3]=f-g,e[6]=p+y,e[1]=f+g,e[4]=1-l-m,e[7]=d-v,e[2]=p-y,e[5]=d+v,e[8]=1-l-h,e}function PA(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function MA(e){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1}function VA(e){return 1===e[0]&&0===e[1]&&0===e[2]&&0===e[3]&&0===e[4]&&1===e[5]&&0===e[6]&&0===e[7]&&0===e[8]&&0===e[9]&&1===e[10]&&0===e[11]&&0===e[12]&&0===e[13]&&0===e[14]&&1===e[15]}function NA(e,t,r,i,n){var o=n?-n[0]:0,a=n?-n[1]:0,s=n?-n[2]:0,u=t[0],c=t[1],l=t[2],f=t[3],h=u+u,p=c+c,d=l+l,m=u*h,v=u*p,y=u*d,g=c*p,x=c*d,T=l*d,E=f*h,_=f*p,S=f*d,A=i[0],R=i[1],C=i[2],O=(1-(g+T))*A,b=(v+S)*A,L=(y-_)*A,I=(v-S)*R,w=(1-(m+T))*R,P=(x+E)*R,M=(y+_)*C,V=(x-E)*C,N=(1-(m+g))*C;return e[0]=O,e[1]=b,e[2]=L,e[3]=0,e[4]=I,e[5]=w,e[6]=P,e[7]=0,e[8]=M,e[9]=V,e[10]=N,e[11]=0,e[12]=o*O+a*I+s*M-o+r[0],e[13]=o*b+a*w+s*V-a+r[1],e[14]=o*L+a*P+s*N-s+r[2],e[15]=1,e}function FA(e,t){if(VA(t))return XA(e,t);var r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],u=t[6],c=t[7],l=t[8],f=t[9],h=t[10],p=t[11],d=t[12],m=t[13],v=t[14],y=t[15],g=r*s-i*a,x=r*u-n*a,T=r*c-o*a,E=i*u-n*s,_=i*c-o*s,S=n*c-o*u,A=l*m-f*d,R=l*v-h*d,C=l*y-p*d,O=f*v-h*m,b=f*y-p*m,L=h*y-p*v,I=g*L-x*b+T*O+E*C-_*R+S*A;if(!I){for(var w=0;w<16;w++)e[w]=NaN;return e}return I=1/I,e[0]=(s*L-u*b+c*O)*I,e[1]=(n*b-i*L-o*O)*I,e[2]=(m*S-v*_+y*E)*I,e[3]=(h*_-f*S-p*E)*I,e[4]=(u*C-a*L-c*R)*I,e[5]=(r*L-n*C+o*R)*I,e[6]=(v*T-d*S-y*x)*I,e[7]=(l*S-h*T+p*x)*I,e[8]=(a*b-s*C+c*A)*I,e[9]=(i*C-r*b-o*A)*I,e[10]=(d*_-m*T+y*g)*I,e[11]=(f*T-l*_-p*g)*I,e[12]=(s*R-a*O-u*A)*I,e[13]=(r*O-i*R+n*A)*I,e[14]=(m*x-d*E-v*g)*I,e[15]=(l*E-f*x+h*g)*I,e}function DA(e,t,r){if(VA(t))return XA(e,r),e;if(VA(r))return XA(e,t),e;var i=t[0],n=t[1],o=t[2],a=t[3],s=t[4],u=t[5],c=t[6],l=t[7],f=t[8],h=t[9],p=t[10],d=t[11],m=t[12],v=t[13],y=t[14],g=t[15],x=r[0],T=r[1],E=r[2],_=r[3];return e[0]=x*i+T*s+E*f+_*m,e[1]=x*n+T*u+E*h+_*v,e[2]=x*o+T*c+E*p+_*y,e[3]=x*a+T*l+E*d+_*g,x=r[4],T=r[5],E=r[6],_=r[7],e[4]=x*i+T*s+E*f+_*m,e[5]=x*n+T*u+E*h+_*v,e[6]=x*o+T*c+E*p+_*y,e[7]=x*a+T*l+E*d+_*g,x=r[8],T=r[9],E=r[10],_=r[11],e[8]=x*i+T*s+E*f+_*m,e[9]=x*n+T*u+E*h+_*v,e[10]=x*o+T*c+E*p+_*y,e[11]=x*a+T*l+E*d+_*g,x=r[12],T=r[13],E=r[14],_=r[15],e[12]=x*i+T*s+E*f+_*m,e[13]=x*n+T*u+E*h+_*v,e[14]=x*o+T*c+E*p+_*y,e[15]=x*a+T*l+E*d+_*g,e}function UA(e,t,r,i,n,o){var a,s=1/Math.tan(t*IA/2);e[0]=o?s:s/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o?s*r:s,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,null!=n&&n!==1/0?(a=1/(i-n),e[10]=(n+i)*a,e[14]=2*n*i*a):(e[10]=-1,e[14]=-2*i)}var BA=new Float32Array(9),kA=[0,0,0,1];function zA(e){var t=e[0],r=e[1],i=e[2],n=e[3],o=e[4],a=e[5],s=e[6],u=e[7],c=e[8],l=e[9],f=e[10],h=e[11],p=e[12],d=e[13],m=e[14],v=e[15];return(t*a-r*o)*(f*v-h*m)-(t*s-i*o)*(l*v-h*d)+(t*u-n*o)*(l*m-f*d)+(r*s-i*a)*(c*v-h*p)-(r*u-n*a)*(c*m-f*p)+(i*u-n*s)*(c*d-l*p)}function GA(e,t,r,i){var n=e[0],o=e[1],a=e[2],s=e[4],u=e[5],c=e[6],l=e[8],f=e[9],h=e[10];if(t[0]=e[12],t[1]=e[13],t[2]=e[14],r){var p=1/i[0],d=1/i[1],m=1/i[2];BA[0]=n*p,BA[1]=o*p,BA[2]=a*p,BA[3]=s*d,BA[4]=u*d,BA[5]=c*d,BA[6]=l*m,BA[7]=f*m,BA[8]=h*m;var v=BA[0]+BA[4]+BA[8],y=void 0;if(v>0)y=Math.sqrt(v+1),kA[3]=.5*y,y=.5/y,kA[0]=(BA[5]-BA[7])*y,kA[1]=(BA[6]-BA[2])*y,kA[2]=(BA[1]-BA[3])*y;else{var g=0;BA[4]>BA[0]&&(g=1),BA[8]>BA[3*g+g]&&(g=2);var x=(g+1)%3,T=(g+2)%3;y=Math.sqrt(BA[3*g+g]-BA[3*x+x]-BA[3*T+T]+1),kA[g]=.5*y,y=.5/y,kA[3]=(BA[3*x+T]-BA[3*T+x])*y,kA[x]=(BA[3*x+g]+BA[3*g+x])*y,kA[T]=(BA[3*T+g]+BA[3*g+T])*y}r[0]=kA[0],r[1]=kA[1],r[2]=kA[2],r[3]=kA[3]}}function jA(e,t,r,i){return i[0]=Math.hypot(e[0],e[1],e[2]),i[1]=Math.hypot(e[4],e[5],e[6]),i[2]=Math.hypot(e[8],e[9],e[10]),zA(e)<0&&(i[0]=-i[0]),GA(e,t,r,i)}function XA(e,t){for(var r=0;r<16;r++)e[r]=t[r];return e}var WA=Math.PI/180,HA=180/Math.PI,YA=Math.cos,ZA=Math.sin;function qA(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]+r[i];return e}function KA(e,t){for(var r=0,i=e.length;r<i;r++)e[r]=t;return e}var QA=Number.EPSILON||Math.pow(2,-32);function JA(e){for(var t=0,r=e.length;t<r;t++)if(Math.abs(e[t])>QA)return!1;return!0}function $A(e){return fC(e)?[e[0],e[1],e[2]]:[0,0,0]}function eR(e,t,r){var i=t[0],n=t[1],o=t[2];return e[0]=i*r[0]+n*r[3]+o*r[6],e[1]=i*r[1]+n*r[4]+o*r[7],e[2]=i*r[2]+n*r[5]+o*r[8],e}function tR(e,t,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)e[n]=t[n+i];return e}function rR(e,t,r){if(t&&r)for(var i=0,n=t.length;i<n;i++)e[i]=t[i]*r[i];else if(t){if(e!==t)for(i=0;i<t.length;i++)e[i]=t[i]}else if(r&&e!==r)for(i=0;i<r.length;i++)e[i]=r[i];return e}function iR(e,t){1===arguments.length&&(t=e,e=[]);var r=t,i=Math.hypot.apply(Math,sS([],aS(r),!1));if(0===i)return tR(e,r,r.length);for(var n=0;n<r.length;n++)e[n]=r[n]/i;return e}function nR(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]*r;return e}function oR(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]-r[i];return e}function aR(e,t){for(var r=0,i=0,n=e.length;i<n;i++){var o=e[i]-t[i];r+=o*o}return r}function sR(e,t,r){if(isNaN(r)){for(var i=0,n=0,o=t.length;n<o;n++)i+=e[n]*t[n];return i}for(n=0,o=t.length;n<o;n++)e[n]=t[n]*r;return e}function uR(e,t,r){var i=t[0],n=t[1],o=t[2],a=r[0],s=r[1],u=r[2];return e[0]=n*u-o*s,e[1]=o*a-i*u,e[2]=i*s-n*a,e}function cR(e,t,r){var i=t[0],n=t[1],o=t[2],a=r[3]*i+r[7]*n+r[11]*o+r[15];return a=a||1,e[0]=(r[0]*i+r[4]*n+r[8]*o+r[12])/a,e[1]=(r[1]*i+r[5]*n+r[9]*o+r[13])/a,e[2]=(r[2]*i+r[6]*n+r[10]*o+r[14])/a,e}function lR(e,t,r){var i=t[0],n=t[1],o=t[2],a=r[3]*i+r[7]*n+r[11]*o+r[15]||1;return e[0]=(r[0]*i+r[4]*n+r[8]*o)/a,e[1]=(r[1]*i+r[5]*n+r[9]*o)/a,e[2]=(r[2]*i+r[6]*n+r[10]*o)/a,e}var fR=[0,0,0,0,0,0,0,0,0];function hR(e,t){e||(e=fR);var r=ZA(t),i=YA(t);return e[0]=i,e[1]=r,e[2]=0,e[3]=-r,e[4]=i,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function pR(e,t){return function(e,t,r,i){var n=YA(t*WA),o=YA(r*WA),a=YA(i*WA),s=ZA(t*WA),u=ZA(r*WA),c=ZA(i*WA);return e[0]=o*a,e[1]=o*c,e[2]=-u,e[3]=-n*c+s*u*a,e[4]=n*a+s*u*c,e[5]=s*o,e[6]=c*s+n*u*a,e[7]=-s*a+n*u*c,e[8]=n*o,e}(e,-t[0],-t[1],-t[2])}function dR(e,t){return function(e,t){var r=t,i=r[0],n=r[3];r[6];var o=r[1],a=r[4];r[7];var s=r[2],u=r[5],c=r[8];e[1]=Math.asin(SA(-s,-1,1))*HA,Math.abs(s)<.9999999?(e[0]=Math.atan2(u,c)*HA,e[2]=Math.atan2(o,i)*HA):(e[0]=0,e[2]=Math.atan2(-n,a)*HA)}(e,t),e}var mR=Math.PI/180,vR=Math.cos,yR=Math.sin;function gR(e,t,r){var i=t[0],n=t[1],o=t[2],a=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=i*l+a*s+n*c-o*u,e[1]=n*l+a*u+o*s-i*c,e[2]=o*l+a*c+i*u-n*s,e[3]=a*l-i*s-n*u-o*c,e}function xR(e,t,r,i){var n=vR(t*mR/2),o=vR(r*mR/2),a=vR(i*mR/2),s=yR(t*mR/2),u=yR(r*mR/2),c=yR(i*mR/2);e[0]=s*o*a-n*u*c,e[1]=n*u*a+s*o*c,e[2]=n*o*c-s*u*a,e[3]=n*o*a+s*u*c}function TR(e,t){var r=t[0],i=t[1],n=t[2],o=t[3];e[0]=-r,e[1]=-i,e[2]=-n,e[3]=o}var ER=[0,0,0];function _R(e,t,r){var i,n=null!==(i=r.position)&&void 0!==i?i:[0,0,0],o=[0,0,0];return cR(o,[e,t,0],r.getInverseViewProjectionMatrix()),oR(o,o,n),{center:n,direction:iR([],o)}}function SR(e,t,r,i,n){oR(ER,i,t);var o=sR(r,ER);if(o<0)return null;nR(ER,r,o),qA(ER,t,ER);var a=aR(i,ER),s=n*n;return a>s?null:(nR(e,r,o-Math.sqrt(s-a)),qA(e,e,t))}function AR(e,t,r,i,n){var o,a,s,u,c,l,f=aS(r,3),h=f[0],p=f[1],d=f[2],m=aS(t,3),v=m[0],y=m[1],g=m[2],x=i[0]-n[0]/2,T=i[0]+n[0]/2,E=i[1]-n[1]/2,_=i[1]+n[1]/2,S=i[2]-n[2]/2,A=i[2]+n[2]/2,R=1/h,C=1/p,O=1/d;return R>=0?(o=(x-v)*R,a=(T-v)*R):(o=(T-v)*R,a=(x-v)*R),C>=0?(s=(E-y)*C,u=(_-y)*C):(s=(_-y)*C,u=(E-y)*C),o>u||s>a?null:((s>o||o!=o)&&(o=s),(u<a||a!=a)&&(a=u),(s>o||o!=o)&&(o=s),(u<a||a!=a)&&(a=u),O>=0?(c=(S-g)*O,l=(A-g)*O):(c=(A-g)*O,l=(S-g)*O),o>l||c>a?null:((c>o||o!=o)&&(o=c),(l<a||a!=a)&&(a=l),a<0?null:(nR(e,t,o>=0?o:a),qA(e,e,t))))}var RR=[0,0,0],CR=[0,0,0],OR=[0,0,0],bR=[0,0,0];function LR(e,t,r){var i=aS(e,3),n=i[0],o=i[1],a=i[2],s=[n-t,o+r,a],u=[n+t,o-r,a],c=[n+t,o+r,a];return[[s,[n-t,o-r,a],u],[s.slice(),u.slice(),c]]}function IR(e,t,r,i,n){var o,a,s,u,c,l=r;if(oR(RR,i[1],i[0]),oR(CR,i[2],i[0]),oR(bR,t,i[0]),uR(OR,RR,CR),(a=sR(l,OR))>0){if(n)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}return uR(CR,bR,CR),s=sR(l=r,CR),(s*=o)<0?null:(uR(RR,RR,bR),u=sR(l=r,RR),(u*=o)<0||s+u>a?null:(c=sR(bR,OR),(c*=-o)<0?null:(nR(e,r,c/a),qA(e,e,t))))}var wR=[0,0],PR=[0,0],MR=[0,0];var VR,NR=[];function FR(e,t,r,i,n,o,a,s,u){var c=e,l=i/n,f=i,h=t.speedOverLifetime;h&&(f=h.getIntegrateValue(0,i,n));var p=t.gravityModifier?t.gravityModifier.getIntegrateByTime(0,i):0;s=s||0,u=u||0;for(var d=0;d<3;d++)c[d]=o[s+d]+a[u+d]*f+r[d]*p;var m=t.linearVelOverLifetime||{},v=t.orbitalVelOverLifetime||{},y=["x","y","z"];if(v.enabled){var g=v.center||[0,0,0],x=[c[0]-g[0],c[1]-g[1],c[2]-g[2]],T=v.asRotation,E=eR(x,x,pR(NR,y.map((function(e){var t=v[e];return t?T?t.getValue(l):t.getIntegrateValue(0,i,n):0}))));c=qA(c,g,E)}if(m.enabled){var _=m.asMovement;for(d=0;d<3;d++){var S=m[y[d]];S&&(c[d]+=_?S.getValue(l):S.getIntegrateValue(0,i,n))}}return c}var DR="not_implement",UR=function(){function e(e){this.onCreate(e)}return e.prototype.onCreate=function(e){throw Error(DR)},e.prototype.getIntegrateValue=function(e,t,r){throw Error(DR)},e.prototype.getIntegrateByTime=function(e,t){throw Error(DR)},e.prototype.getValue=function(e){throw Error(DR)},e.prototype.toUniform=function(e){throw Error(DR)},e.prototype.map=function(e){throw Error(DR)},e.prototype.scaleXCoord=function(e){return this},e}(),BR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.value=e},t.prototype.getIntegrateValue=function(e,t,r){return this.value*(t-e)},t.prototype.getIntegrateByTime=function(e,t){return.5*this.value*(t*t-e*e)},t.prototype.getValue=function(e){return this.value},t.prototype.toUniform=function(){return new Float32Array([0,this.value,0,0])},t.prototype.map=function(e){var t=this.value;return this.value=e(t),this},t}(UR),kR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.items=e},t.prototype.getValue=function(e){var t=this.items;return t[Math.floor(Math.random()*t.length)]},t.prototype.map=function(e){return this.items=this.items.map(e),this},t}(UR),zR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.min=e[0],this.max=e[1]},t.prototype.getValue=function(e){return mC(this.min,this.max)},t.prototype.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},t.prototype.map=function(e){return this.min=e(this.min),this.max=e(this.max),this},t}(UR),GR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.min=e[0],this.max=e[1]},t.prototype.getValue=function(e){for(var t=this.min,r=this.max,i=[],n=0;n<t.length;n++){var o=Math.random();i[n]=t[n]*(1-o)+r[n]*o}return i},t.prototype.map=function(e){return this.min=this.min.map(e),this.max=this.max.map(e),this},t}(UR),jR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.min=e[0],this.max=e[1],this.xCoord=1},t.prototype.getValue=function(e){return e/=this.xCoord,this.min*(1-e)+this.max*e},t.prototype.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},t.prototype.getIntegrateValue=function(e,t,r){void 0===r&&(r=1);var i=this.min,n=this.max,o=this.xCoord*r;return((i+t/o*(n-i)+i)*t-(i+e/o*(n-i)+i)*e)/2},t.prototype.getIntegrateByTime=function(e,t){return JR(t,0,this.xCoord,this.min,this.max)-JR(e,0,this.xCoord,this.min,this.max)},t.prototype.map=function(e){return this.min=e(this.min),this.max=e(this.max),this},t.prototype.scaleXCoord=function(e){return this.xCoord=e,this},t}(UR),XR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.stops=HS(e)},t.prototype.getStops=function(){return this.stops},t.prototype.getValue=function(e){for(var t=this.stops,r=t.length-1,i=0;i<r;i++){var n=t[i],o=t[i+1];if(n.stop<=e&&o.stop>e){var a=(e-n.stop)/(o.stop-n.stop);return YS(n.color,o.color,a,!0)}}return t[r].color.slice()},t}(UR),WR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.getAllData=function(e,t){for(var r=new(t?LA:Float32Array)(4*e.index),i=0,n=0,o=e.curves;i<o.length;i++){var a=o[i].toData();r.set(a,n),n+=a.length}return t?r.data:r},t.prototype.onCreate=function(e){var t=1/0,r=-1/0;if(Number.isFinite(e[0])&&Number.isFinite(e[1])){for(var i=[],n=2;n<e.length;n++)i.push(e[n].slice(0,4));this.keys=i,this.min=e[0],this.dist=e[1]-e[0]}else{i=e.map((function(e){if(fC(e))return t=Math.min(t,e[1]),r=Math.max(r,e[1]),e.slice(0,4);if("object"==typeof e&&e){var i=e,n=i.time,o=i.value,a=i.inTangent,s=void 0===a?0:a,u=i.outTangent,c=void 0===u?0:u;return t=Math.min(t,o),r=Math.max(r,o),[n,o,s,c]}throw new Error("invalid keyframe")}));var o=r-t;if(this.keys=i,0!==o)for(n=0;n<i.length;n++){var a=i[n];a[1]=(a[1]-t)/o}var s=i[0];s[0]>0&&(s[2]=0,i.unshift([0,s[1],0,0]));var u=i[i.length-1];u[0]<1&&(u[3]=0,i.push([1,u[1],0,0])),this.min=t,this.dist=o}this.isCurveValue=!0},t.prototype.getValue=function(e){var t=this,r=t.keys,i=t.min,n=t.dist,o=r;if(e<=o[0][0])return o[0][1]*n+i;for(var a=o.length-1,s=0;s<a;s++){var u=o[s],c=o[s+1];if(e>u[0]&&e<=c[0])return $R(e,u,c)*n+i}return o[a][1]*n+i},t.prototype.getIntegrateByTime=function(e,t){var r=this.integrate(t,!0)-this.integrate(e,!0);return.5*this.min*(t-e)*(t-e)+r*this.dist},t.prototype.getIntegrateValue=function(e,t,r){r=r||1;var i=(this.integrate(t/r,!1)-this.integrate(e/r,!1))*r,n=(t-e)/r;return this.min*n+i*this.dist},t.prototype.integrate=function(e,t){var r=this.keys;if(e<=r[0][0])return 0;for(var i=0,n=r.length-1,o=t?tC:eC,a=0;a<n;a++){var s=r[a],u=r[a+1],c=s[0],l=u[0];if(e>c&&e<=l)return i+o(e,s,u);i+=o(l,s,u)}return i},t.prototype.toData=function(){for(var e=this.keys,t=new Float32Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4)t.set(e[r],i);return t},t.prototype.toUniform=function(e){var t=e.index,r=this.keys;return e.curves.push(this),e.index+=r.length,e.max=Math.max(e.max,r.length),e.curveCount+=r.length,new Float32Array([2,t+1/r.length,this.min,this.dist])},t.prototype.map=function(e){return this.keys.forEach((function(t){t[1]=e(t[1])})),this},t.prototype.scaleXCoord=function(e){return this.keys.forEach((function(t){return t[0]=e*t[0]})),this},t}(UR),HR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.keys=e.map((function(e){return e.slice?e.slice(0,2):[e.time,e.value]})).sort((function(e,t){return e[0]-t[0]}));var t=this.keys[this.keys.length-1];t[0]<1&&this.keys.push([1,t[1]]);var r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},t.prototype.getValue=function(e){var t=this.keys;if(e<t[0][0])return t[0][1];for(var r=t.length-1,i=0;i<r;i++){var n=t[i],o=t[i+1],a=n[0],s=o[0];if(e>=a&&e<=s){var u=(e-a)/(s-a),c=n[1];return c+u*(o[1]-c)}}return t[r][1]},t.prototype.getIntegrateValue=function(e,t,r){return void 0===r&&(r=1),(this.integrate(t,!1)-this.integrate(e,!1))*r},t.prototype.getIntegrateByTime=function(e,t){return this.integrate(t,!0)-this.integrate(e,!0)},t.prototype.integrate=function(e,t){var r=this.keys;if(e<=r[0][0])return 0;for(var i=0,n=r.length-1,o=t?JR:QR,a=0;a<n;a++){var s=r[a],u=r[a+1],c=s[0],l=u[0];if(e>c&&e<=l)return i+o(e,c,l,s[1],u[1]);i+=o(l,c,l,s[1],u[1])}return i},t.prototype.toData=function(){for(var e=this.keys,t=new Float32Array(4*Math.ceil(e.length/2)),r=0,i=0;r<e.length;r++,i+=2)t.set(e[r],i);return t.set(e[e.length-1],t.length-2),t},t.prototype.toUniform=function(e){var t=e.index,r=this.keys,i=Math.ceil(r.length/2);return e.lineSegCount+=i,e.curves.push(this),e.index+=i,e.max=Math.max(e.max,i),new Float32Array([3,t,i,0])},t.prototype.map=function(e){return this.keys.forEach((function(t){return t[1]=e(t[1])})),this},t.prototype.scaleXCoord=function(e){return this.keys.forEach((function(t){return t[0]=e*t[0]})),this},t}(UR),YR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(e){this.keys=e[0],this.values=e[1]},t.prototype.getValue=function(e){for(var t=this.keys,r=this.values,i=0;i<t.length-1;i++){var n=t[i],o=t[i+1];if(n[0]<=e&&o[0]>=e){var a=o[1]-n[1],s=void 0;if(0===a)s=(e-n[0])/(o[0]-n[0]);else s=($R(e,n,o)-n[1])/a;return this.calculateVec(i,s)}}return e<=t[0][0]?r[0].slice():r[r.length-1].slice()},t.prototype.calculateVec=function(e,t){for(var r=this.values[e],i=this.values[e+1],n=[0,0,0],o=0;o<r.length;o++)n[o]=r[o]*(1-t)+i[o]*t;return n},t}(UR),ZR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.onCreate=function(t){e.prototype.onCreate.call(this,t),this.cps=t[2]},t.prototype.calculateVec=function(e,t){for(var r=this.values[e],i=this.values[e+1],n=this.cps[e+e],o=this.cps[e+e+1],a=[0,0,0],s=1-t,u=s*s*s,c=3*t*s*s,l=3*t*t*s,f=t*t*t,h=0;h<r.length;h++)a[h]=u*r[h]+c*n[h]+l*o[h]+f*i[h];return a},t}(YR),qR=((VR={})[oA.RANDOM]=function(e){return e[0]instanceof Array?new GR(e):new zR(e)},VR[oA.CONSTANT]=function(e){return new BR(e)},VR[oA.CONSTANT_VEC2]=function(e){return new BR(e)},VR[oA.CONSTANT_VEC3]=function(e){return new BR(e)},VR[oA.CONSTANT_VEC4]=function(e){return new BR(e)},VR[oA.CURVE]=function(e){return new WR(e)},VR[oA.RGBA_COLOR]=function(e){return new BR(e)},VR[oA.COLORS]=function(e){return new kR(e.map((function(e){return XS(e,!1)})))},VR[oA.LINE]=function(e){return 2===e.length&&0===e[0][0]&&1===e[1][0]?new jR([e[0][1],e[1][1]]):new HR(e)},VR[oA.GRADIENT_COLOR]=function(e){return new XR(e)},VR[oA.LINEAR_PATH]=function(e){return new YR(e)},VR[oA.BEZIER_PATH]=function(e){return new ZR(e)},VR);function KR(e){if(!e||!isNaN(+e))return new BR(e||0);if(e instanceof UR)return e;if(hC(qR[e[0]]))return qR[e[0]](e[1]);throw new Error("ValueType: ".concat(e[0]," is not support"))}function QR(e,t,r,i,n){var o=e-t;return(i+i+(n-i)*o/(r-t))*o/2}function JR(e,t,r,i,n){var o=e*e,a=t*t;return(2*(o*e)*(i-n)+3*o*(t*n-r*i)-a*t*(2*i+n)+3*a*r*i)/(6*(t-r))}function $R(e,t,r){var i=r[0]-t[0],n=t[3]*i,o=r[2]*i,a=(e-t[0])/i,s=a*a,u=s*a,c=u-2*s+a,l=u-s,f=-2*u+3*s;return(2*u-3*s+1)*t[1]+c*n+l*o+f*r[1]}function eC(e,t,r){var i=r[0]-t[0],n=t[3]*i,o=r[2]*i,a=t[0],s=t[1],u=r[1],c=a-e,l=c*c,f=l*c;return(n+o+2*s-2*u)*f*c/(4*i*i*i)+(2*n+o+3*s-3*u)*f/(3*i*i)+n*l/2/i-s*c}function tC(e,t,r){var i=r[0]-t[0],n=t[3]*i,o=r[2]*i,a=t[0],s=t[1],u=r[1],c=a-e,l=c*c,f=l*c,h=i*i,p=h*i;return(-30*p*s*(a+e)*c+10*h*n*(a+2*e)*l+5*i*(a+3*e)*(2*n+o+3*s-3*u)*f+3*(a+4*e)*(n+o+2*s-2*u)*f*c)/60/p}function rC(e,t){if(t){var r=t[0],i=t[1];if(r===oA.CURVE){e.curves.push(i);var n=i.length;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++,e.index+=n,e.max=Math.max(e.max,n),e.curveCount+=n}else if(r===oA.LINE){if(2===(n=i.length)&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++;var o=Math.ceil(n/2);e.lineSegCount+=o,e.curves.push(i),e.index+=o,e.max=Math.max(e.max,o)}}}function iC(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var nC,oC=[0,0,0],aC=[1,1,1],sC=[0,0,0],uC=function(){function e(e,t){var r,i=e.positionOverLifetime,n=void 0===i?{}:i,o=t.transform,a=t.duration,s=t.endBehavior,u=o.scale;this.transform=o,this.basicTransform={position:sS([],aS(o.position),!1),rotation:sS([],aS(o.getRotation()),!1),scale:[u[0],u[1],u[2]]},n.path&&(this.basicTransform.path=KR(n.path)),this.positionOverLifetime=n,this.options={startSpeed:n.startSpeed||0,startSize:u&&u[0]||1,sizeAspect:u&&u[0]/(u[1]||1)||1,startColor:[1,1,1,1],duration:a||0,looping:s&&s===sA.loop,gravity:$A(n.gravity),gravityModifier:KR(null!==(r=n.gravityOverLifetime)&&void 0!==r?r:0),direction:n.direction?iR([],n.direction):$A(),endBehavior:s||0};var c=e.sizeOverLifetime;c&&(c.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=KR(c.x||1),this.sizeYOverLifetime=KR(c.y||1),this.sizeZOverLifetime=KR(c.z||1)):this.sizeXOverLifetime=KR(c.size||1));var l=n.linearX||n.linearY||n.linearZ;l&&(this.linearVelOverLifetime={x:n.linearX&&KR(n.linearX),y:n.linearY&&KR(n.linearY),z:n.linearZ&&KR(n.linearZ),asMovement:n.asMovement,enabled:!!l});var f=n.orbitalX||n.orbitalY||n.orbitalZ;f&&(this.orbitalVelOverLifetime={x:n.orbitalX&&KR(n.orbitalX),y:n.orbitalY&&KR(n.orbitalY),z:n.orbitalZ&&KR(n.orbitalZ),center:$A(n.orbCenter),asRotation:n.asRotation,enabled:!!f}),this.speedOverLifetime=n.speedOverLifetime&&KR(n.speedOverLifetime);var h=e.rotationOverLifetime;if(h&&(this.rotationOverLifetime={asRotation:h.asRotation,separateAxes:h.separateAxes,z:KR(h.z||0)},h.separateAxes)){var p=this.rotationOverLifetime;p.x=KR(h.x||0),p.y=KR(h.y||0)}this.gravityModifier=this.options.gravityModifier}return e.prototype.getVelocity=function(){return this.velocity||(this.velocity=nR([],this.options.direction,this.options.startSpeed)),this.velocity},e.prototype.willTranslate=function(){return!!(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled||this.orbitalVelOverLifetime&&this.orbitalVelOverLifetime.enabled||this.options.gravityModifier&&!JA(this.options.gravity)||this.options.startSpeed&&!JA(this.options.direction))},e.prototype.updatePosition=function(e,t,r){this.basicTransform.position=[e,t,r]},e.prototype.getRenderData=function(e,t){var r,i,n=this.options,o=KA(aC,1),a=KA(oC,0),s=e<0?e:Math.max(e,0),u=n.duration,c=s/u,l={life:c,transform:this.transform,startSize:this.basicTransform.scale},f=this.basicTransform;c=c<0?0:c>1?1:c,this.sizeXOverLifetime&&(o[0]=this.sizeXOverLifetime.getValue(c),this.sizeSeparateAxes?(o[1]=this.sizeYOverLifetime.getValue(c),o[2]=this.sizeZOverLifetime.getValue(c)):o[2]=o[1]=o[0],r=!0),(r||t)&&l.transform.setScale(o[0],o[1],o[2]);var h,p=this.rotationOverLifetime;if(p){var d=function(e){return p.asRotation?e.getValue(c):e.getIntegrateValue(0,c,u)},m=d(p.z),v=p.separateAxes;a[0]=v?d(p.x):0,a[1]=v?d(p.y):0,a[2]=m,i=!0}if(i||t){var y=qA(oC,f.rotation,a);l.transform.setRotation(y[0],y[1],y[2])}(this.willTranslate()||t)&&(h=FR(KA(aC,0),this,n.gravity,s,u,f.position,this.getVelocity()));if(f.path&&(h||(h=tR(sC,f.position,3)),qA(h,h,f.path.getValue(c))),h&&l.transform.setPosition(h[0],h[1],h[2]),l.startSize){var g=l.transform.scale;l.transform.setScale(g[0]*l.startSize[0],g[1]*l.startSize[1],g[2]*l.startSize[2])}return l},e}();function cC(){}function lC(e){return"string"==typeof e}e.DestroyOptions=void 0,(nC=e.DestroyOptions||(e.DestroyOptions={}))[nC.destroy=0]="destroy",nC[nC.keep=1]="keep",nC[nC.force=0]="force";var fC=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function hC(e){return"[object Function]"===Object.prototype.toString.call(e)}function pC(e){return"[object Object]"===Object.prototype.toString.call(e)}function dC(e){if(fC(e))return e.map(dC);if(e&&"object"==typeof e){if(ArrayBuffer.isView(e))return e.slice();for(var t={},r=Object.keys(e),i=0;i<r.length;i++){var n=r[i];t[n]=dC(e[n])}return t}return e}function mC(e,t){return e+Math.random()*(t-e)}function vC(){throw Error("destroyed item cannot be used again")}var yC=new Array(9).fill(0),gC=new Array(4).fill(0),xC=1,TC=function(){function e(e,t){void 0===e&&(e={}),this.position=[0,0,0],this.quat=[0,0,0,1],this.rotation=[0,0,0],this.scale=[1,1,1],this.anchor=[0,0,0],this.children=[],this.worldMatrix=PA(),this.localMatrix=PA(),this.valid=!1,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:[0,0,0],quat:[0,0,0,1],scale:[1,1,1]},this.name="transform_".concat(xC++),e&&this.setTransform(e),t&&(this.parentTransform=t),void 0!==e.valid&&this.setValid(e.valid)}return e.getRotation=function(e,t){return TR(gC,t),dR(e,wA(yC,gC))},Object.defineProperty(e.prototype,"parentTransform",{get:function(){return this.parent},set:function(e){e&&this.parent!==e&&this!==e&&(this.parent&&this.parent.removeChild(this),e.addChild(this),this.parent=e,this.parentMatrixDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentMatrixDirty",{get:function(){return this.dirtyFlags.parentMatrix},set:function(e){this.dirtyFlags.parentMatrix!==e&&(this.dirtyFlags.parentMatrix=e,this.dispatchValueChange())},enumerable:!1,configurable:!0}),e.prototype.setPosition=function(e,t,r){this.position[0]===e&&this.position[1]===t&&this.position[2]===r||(this.position[0]=e,this.position[1]=t,this.position[2]=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.translate=function(e,t,r){0===e&&0===t&&0===r||(this.position[0]+=e,this.position[1]+=t,this.position[2]+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.setRotation=function(e,t,r){this.rotation[0]===e&&this.rotation[1]===t&&this.rotation[2]===r||(this.rotation[0]=e,this.rotation[1]=t,this.rotation[2]=r,xR(this.quat,e,t,r),TR(this.quat,this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.setQuaternion=function(e,t,r,i){this.quat[0]===e&&this.quat[1]===t&&this.quat[2]===r&&this.quat[3]===i||(this.quat[0]=e,this.quat[1]=t,this.quat[2]=r,this.quat[3]=i,dR(this.rotation,wA(yC,[e,t,r,i])),this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.setScale=function(e,t,r){this.scale[0]===e&&this.scale[1]===t&&this.scale[2]===r||(this.scale[0]=e,this.scale[1]=t,this.scale[2]=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.rotateByQuat=function(e){gR(this.quat,this.quat,e),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.prototype.scaleBy=function(e,t,r){this.scale[0]*=e,this.scale[1]*=t,this.scale[2]*=r,this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.prototype.setAnchor=function(e,t,r){this.anchor[0]===e&&this.anchor[1]===t&&this.anchor[2]===r||(this.anchor[0]=e,this.anchor[1]=t,this.anchor[2]=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},e.prototype.setTransform=function(e,t){var r,i=e.position,n=e.rotation,o=e.scale,a=e.quat,s=e.name,u=e.anchor;if(s&&(this.name=s),i&&this.setPosition(i[0],i[1],i[2]),a)this.setQuaternion(a[0],a[1],a[2],a[3]);else if(n){var c=t?-1:1;this.setRotation(n[0]*c,n[1]*c,n[2]*c)}o&&this.setScale(o[0],o[1],o[2]),u&&this.setAnchor(u[0],u[1],null!==(r=u[2])&&void 0!==r?r:0)},e.prototype.addChild=function(e){kS(this.children,e)},e.prototype.removeChild=function(e){zS(this.children,e)},e.prototype.getRotation=function(){return e.getRotation([0,0,0],this.quat)},e.prototype.getQuaternion=function(){return this.quat},e.prototype.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(NA(this.localMatrix,this.quat,this.position,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):VA(this.localMatrix)||(MA(this.localMatrix),this.dirtyFlags.localMatrix=!0)},e.prototype.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},e.prototype.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},e.prototype.getWorldMatrix=function(){var e=this.getMatrix(),t=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(t?DA(this.worldMatrix,t,e):XA(this.worldMatrix,e),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},e.prototype.getWorldScale=function(){var e=this.worldTRSCache;return this.dirtyFlags.worldMatrix&&(jA(this.getWorldMatrix(),e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1),sS([],aS(this.worldTRSCache.scale),!1)},e.prototype.getWorldPosition=function(){return this.updateTRSCache(),sS([],aS(this.worldTRSCache.position),!1)},e.prototype.getWorldRotation=function(){this.updateTRSCache();var t=[0,0,0];return e.getRotation(t,this.worldTRSCache.quat),t},e.prototype.assignWorldTRS=function(e,t,r){this.updateTRSCache(),e&&tR(e,this.worldTRSCache.position,3),t&&tR(t,this.worldTRSCache.quat,4),r&&tR(r,this.worldTRSCache.scale,3)},e.prototype.cloneFromMatrix=function(e,t){t?(GA(e,this.position,this.quat,t),tR(this.scale,t,3)):jA(e,this.position,this.quat,this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},e.prototype.setValid=function(e){this.valid!==e&&(this.valid=e,e?this.dirtyFlags.localData=!0:(MA(this.localMatrix),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},e.prototype.getValid=function(){return this.valid},e.prototype.dispose=function(){},e.prototype.updateTRSCache=function(){var e=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var t=this.worldTRSCache;jA(e,t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1}},e.prototype.dispatchValueChange=function(){this.children.forEach((function(e){e.parentMatrixDirty=!0}))},e}(),EC=function(){function e(e,t){this._v_priority=0,this.visible=!0,this._contentVisible=!1,this.timeInms=0,this.time=0,this._frozen=!1;var r=e.id,i=e.name,n=e.delay,o=e.parentId,a=e.endBehavior,s=e.transform,u=e.listIndex,c=void 0===u?0:u,l=e.duration,f=void 0===l?0:l;if(this.composition=t,this.id=r,this.name=i,this.delay=n,this.transform=new TC(rS({name:this.name},s),t.transform),this.parentId=o,this.duration=f,this.delayInms=1e3*(n||0),this.durInms=1e3*this.duration,this.endBehavior=a,this.lifetime=-this.delayInms/this.durInms,this.listIndex=c,this.speed=1,this.onConstructed(e),f<=0)throw Error("Item duration can't be less than 0, see ".concat(yS["Item duration can't be less than 0"]))}return Object.defineProperty(e.prototype,"contentVisible",{get:function(){return this._contentVisible&&this.visible},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"reusable",{get:function(){var e,t;return null!==(t=null===(e=this.composition)||void 0===e?void 0:e.reusable)&&void 0!==t&&t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"type",{get:function(){return wS.base},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frozen",{get:function(){return this._frozen},set:function(e){this.handleFrozenChanged(this._frozen=!!e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lifetimeStarted",{get:function(){return this.started&&!this.delaying},enumerable:!1,configurable:!0}),e.prototype.setSpeed=function(e){this.speed=e},e.prototype.getSpeed=function(){return this.speed},e.prototype.start=function(){this.started&&!this.ended||(this.started=!0,this.delaying=!0,this.timeInms=0,this.time=0,this.callEnd=!1,this.ended=!1)},e.prototype.stop=function(){this.doStop(),this.started=!1},e.prototype.doStop=function(){this._content&&this._content.stop&&this._content.stop()},e.prototype.createContent=function(){return this._content||(this._content=this.doCreateContent(this.composition)),this._content},e.prototype.doCreateContent=function(e){},e.prototype.onConstructed=function(e){},e.prototype.onUpdate=function(e){var t,r;if(this.started&&!this.frozen&&this.composition){var i=e*this.speed,n=this.timeInms+=i;this.time+=i/1e3;var o=n-this.delayInms;if(this.delaying&&o>=0&&(this.delaying=!1,this.transform.setValid(!0),this.createContent(),this.onLifetimeBegin(this.composition,this.content),this.composition.itemLifetimeEvent(this,!0)),!this.delaying){var a=o/this.durInms,s=this.isEnded(o),u=!0;if(this.transform.setValid(!0),s)if(u=!1,this.callEnd||(this.callEnd=!0,this.composition.itemLifetimeEvent(this,!1),this.onEnd()),2!==this.endBehavior&&5!==this.endBehavior){if(this.ended=!0,this.transform.setValid(!1),1===this.endBehavior||3===this.endBehavior?null===(r=(t=this.composition).handlePlayerPause)||void 0===r||r.call(t,this):4===this.endBehavior&&(this.transform.setValid(!0),u=!0,a=1),this.reusable)0===this.endBehavior&&this.setVisible(!1);else{if(0===this.endBehavior||3===this.endBehavior||6===this.endBehavior)return this.dispose();1===this.endBehavior&&(this.endBehavior=2)}a=Math.min(a,1)}else u=!0,5===this.endBehavior&&(this.ended=!0,a%=1);else this.callEnd&&this.reusable&&(this.setVisible(!0),this.callEnd=!1);this.lifetime=a,u&&this.onItemUpdate(i,a)}}},e.prototype.onItemRemoved=function(e,t){},e.prototype.onItemUpdate=function(e,t){},e.prototype.onLifetimeBegin=function(e,t){},e.prototype.onEnd=function(){},e.prototype.setColor=function(e,t,r,i){},e.prototype.setOpacity=function(e){},e.prototype.getVisible=function(){return this.visible},e.prototype.setVisible=function(e){this.visible!==e&&(this.visible=!!e,this.handleVisibleChanged(this.visible))},e.prototype.handleVisibleChanged=function(e){},e.prototype.handleFrozenChanged=function(e){},e.prototype.getWorldTransform=function(e){var t=null!=e?e:new TC({valid:!0});return t.cloneFromMatrix(this.transform.getWorldMatrix()),t},e.prototype.getNodeTransform=function(e){return this.transform},e.prototype.translate=function(e,t,r){this.transform.translate(e,t,r)},e.prototype.rotate=function(e,t,r){var i=[0,0,0,1];xR(i,e,t,r),TR(i,i),this.transform.rotateByQuat(i)},e.prototype.scale=function(e,t,r){this.transform.scaleBy(e,t,r)},e.prototype.setPositionByPixel=function(e,t){if(this.composition){var r=this.transform.getWorldPosition()[2],i=aS(this.composition.camera.getInverseVPRatio(r),2),n=i[0],o=i[1],a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition(2*e*n/a,-2*t*o/s,r)}},e.prototype.setPosition=function(e,t,r){this.transform.setPosition(e,t,r)},e.prototype.setRotation=function(e,t,r){this.transform.setRotation(e,t,r)},e.prototype.setScale=function(e,t,r){this.transform.setScale(e,t,r)},e.prototype.getBoundingBox=function(){},e.prototype.getHitTestParams=function(e){},e.prototype.getRenderData=function(){return{transform:this.transform,life:0,visible:this.visible}},e.prototype.getCurrentPosition=function(){var e=[0,0,0];return this.transform.assignWorldTRS(e),e},e.prototype.isEnded=function(e){return e-this.durInms>.001},e.prototype.reset=function(){this.composition&&(this.onItemRemoved(this.composition,this._content),this._content=void 0),this.started=!1},e.prototype.translateByPixel=function(e,t){if(this.composition){var r=this.transform.getWorldPosition()[2],i=aS(this.composition.camera.getInverseVPRatio(r),2),n=i[0],o=i[1],a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.translate(2*e*n/a,-2*t*o/s,0)}},e.prototype.dispose=function(){this.composition&&(this.composition.destroyItem(this),this.reset(),this.onUpdate=function(){return-1},this.composition=null,this.transform.setValid(!1))},e}();function _C(e,t){var r=e.type,i=e.pluginName;if(!i)switch(r){case wS.null:case wS.base:i="cal";break;case wS.sprite:i="sprite";break;case wS.particle:i="particle";break;case wS.interact:i="interact";break;case wS.camera:i="camera";break;case wS.filter:i="filter";break;case wS.text:i="text";break;case cS:i=cS;break;default:throw new Error("invalid vfx item type")}return t.pluginSystem.createPluginItem(i,e,t)}var SC={},AC=[],RC={};function CC(e,t,r,i){RC[e]=r,SC[e]=t,i&&kS(AC,e)}var OC,bC=function(){function e(e){var t={},r=[],i=function(e){var i=SC[e];r.includes(i)||(r.push(i),t[e]=i)};AC.forEach(i),e.forEach(i),this.plugins=Object.keys(t).map((function(e){var t=SC[e];if(!t)throw new Error("plugin '".concat(e,"' not found"));var r=new t;return r.name=e,r})).sort((function(e,t){return e.order-t.order}))}return e.prototype.initializeComposition=function(e,t){this.plugins.forEach((function(r){return r.onCompositionConstructed(e,t)}))},e.prototype.destroyComposition=function(e){this.plugins.forEach((function(t){return t.onCompositionDestroyed(e)}))},e.prototype.resetComposition=function(e,t){this.plugins.forEach((function(r){return r.onCompositionReset(e,t)}))},e.prototype.createPluginItem=function(e,t,r){var i=RC[e];if(!i)throw new Error("plugin ".concat(e," no registered constructor"));var n=new i(t,r);if(!(n instanceof EC))throw new Error("plugin ".concat(e," invalid constructor type"));return n},e.prototype.processRawJSON=function(e,t){return iS(this,void 0,void 0,(function(){return nS(this,(function(r){return[2,this.callStatic("processRawJSON",e,t)]}))}))},e.prototype.callStatic=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return iS(this,void 0,void 0,(function(){var r,i,n,o,a;return nS(this,(function(s){for(r=[],i=this.plugins,n=0;n<i.length;n++)o=i[n],a=SC[o.name],e in a&&r.push(Promise.resolve(a[e].apply(a,sS([],aS(t),!1))));return[2,Promise.all(r)]}))}))},e.prototype.precompile=function(e,t,r){return iS(this,void 0,void 0,(function(){return nS(this,(function(i){return[2,this.callStatic("precompile",e,t,r)]}))}))},e.prototype.loadResources=function(e,t){return iS(this,void 0,void 0,(function(){return nS(this,(function(r){return[2,this.callStatic("prepareResource",e,t)]}))}))},e}(),LC=function(){function e(){this.order=100,this.name=""}return e.precompile=function(e,t){return Promise.resolve()},e.prototype.onCompositionConstructed=function(e,t){},e.prototype.onCompositionItemLifeBegin=function(e,t){},e.prototype.onCompositionItemLifeEnd=function(e,t){},e.prototype.onCompositionItemRemoved=function(e,t){},e.prototype.onCompositionReset=function(e,t){},e.prototype.onCompositionWillReset=function(e,t){},e.prototype.onCompositionDestroyed=function(e){},e.prototype.onCompositionUpdate=function(e,t){},e.prototype.prepareRenderFrame=function(e,t){return!1},e.prototype.postProcessFrame=function(e,t){},e}(),IC=function(){function e(e,t){this.transform=e;var r=e.position,i=void 0===r?[0,0,0]:r,n=e.getRotation(),o=t.options,a=o.near,s=o.far,u=o.fov,c=o.clipMode;if(this.clipMode=c,this.options={position:tR([0,0,0],i,3),rotation:tR([0,0,0],n,3),near:KR(a),far:KR(s),fov:KR(u)},t.positionOverLifetime){var l=t.positionOverLifetime,f=l.path,h=l.linearX,p=void 0===h?0:h,d=l.linearY,m=void 0===d?0:d,v=l.linearZ,y=void 0===v?0:v;this.translateOverLifetime={path:f&&KR(f),x:KR(p),y:KR(m),z:KR(y)}}if(t.rotationOverLifetime){var g=t.rotationOverLifetime,x=g.separateAxes,T=g.x,E=void 0===T?0:T,_=g.y,S=void 0===_?0:_,A=g.z,R=void 0===A?0:A;this.rotationOverLifetime={separateAxes:x,x:KR(E),y:KR(S),z:KR(R)}}}return e.prototype.update=function(e){var t=[0,0,0,1],r=[0,0,0],i=[0,0,0];tR(r,this.options.position,3),tR(i,this.options.rotation,3);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(e=SA(e,0,1),n&&(r[0]+=n.x.getValue(e),r[1]+=n.y.getValue(e),r[2]+=n.z.getValue(e),n.path&&qA(r,r,n.path.getValue(e))),o){var a=o.z.getValue(e);i[2]+=a,o.separateAxes?(i[0]+=o.x.getValue(e),i[1]+=o.y.getValue(e)):(i[0]+=a,i[1]+=a)}this.far=this.options.far.getValue(e),this.near=this.options.near.getValue(e),this.fov=this.options.fov.getValue(e),this.transform.setPosition(r[0],r[1],r[2]),this.transform.setRotation(i[0],i[1],i[2]),this.transform.assignWorldTRS(r,t),this.position=r,this.rotation=TC.getRotation(i,t)},e}(),wC=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t}(LC),PC=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return wS.camera},enumerable:!1,configurable:!0}),t.prototype.onConstructed=function(e){this.model=e.content},t.prototype.onItemUpdate=function(e,t){var r;null===(r=this.controller)||void 0===r||r.update(t),this.updateCamera()},t.prototype.updateCamera=function(){if(this.controller&&this.composition){var e=this.composition.camera;e.near=this.controller.near,e.far=this.controller.far,e.fov=this.controller.fov,e.clipMode=this.controller.clipMode,e.position=this.controller.position,e.rotation=this.controller.rotation}},t.prototype.getCurrentPosition=function(){return this.controller.position},t.prototype.doCreateContent=function(){return this.controller||(this.controller=new IC(this.transform,this.model)),this.controller},t}(EC);e.HitTestType=void 0,(OC=e.HitTestType||(e.HitTestType={}))[OC.triangle=1]="triangle",OC[OC.box=2]="box",OC[OC.sphere=3]="sphere",OC[OC.custom=4]="custom";var MC,VC,NC="click",FC="touchstart",DC="touchmove",UC="touchend",BC=IS,kC=function(){function e(e,t){void 0===t&&(t=!1),this.target=e,this.allowPropagation=t,this.enabled=!0,this.handlers={},this.nativeHandlers={}}return e.prototype.bindListeners=function(){var e,t,r,i,n,o,a=this;o=function(e){return e};var s="mousedown",u="mousemove",c="mouseup",l=function(e,t,r,i,o){void 0===i&&(i=0),void 0===o&&(o=0);var s=a.target,u=s.width,c=s.height,l=performance.now(),f=0,h=0;if(n){var p=l-n.ts;f=(i-n.dx)/p||0,h=(o-n.dy)/p||0,n={dx:i,dy:o,ts:l}}return{x:t,y:r,vx:f,vy:h,dx:i,dy:o,ts:l,width:u,height:c,origin:e}};KS()&&(o=function(e){var t=e,r=t.touches,i=t.changedTouches;return r[0]||i[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((e={})[s]=function(e){if(a.enabled){var s=o(e),u=zC(s);t=u.x,r=u.y,n=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:r},a.dispatchEvent(FC,l(e,t,r))}},e[u]=function(e){if(i&&a.enabled){var n=zC(o(e));t=n.x,r=n.y,a.dispatchEvent(DC,l(e,t,r,t-i.x,r-i.y))}},e[c]=function(e){if(i&&a.enabled){!a.allowPropagation&&e.cancelable&&(e.preventDefault(),e.stopPropagation());var n=o(e),s=zC(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);t=s.x,r=s.y,u<4&&a.dispatchEvent(NC,l(e,t,r)),a.dispatchEvent(UC,l(e,t,r,t-i.x,r-i.y))}i=0},e),Object.keys(this.nativeHandlers).forEach((function(e){var t;null===(t=a.target)||void 0===t||t.addEventListener(String(e),a.nativeHandlers[e])}))},e.prototype.dispatchEvent=function(e,t){var r=this.handlers[e];null==r||r.forEach((function(e){return e(t)}))},e.prototype.addEventListener=function(e,t){var r=this.handlers[e];return r||(r=this.handlers[e]=[]),kS(r,t),function(){zS(r,t)}},e.prototype.removeEventListener=function(e,t){var r=this.handlers[e];r&&zS(r,t)},e.prototype.dispose=function(){var e=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(t){var r;null===(r=e.target)||void 0===r||r.removeEventListener(String(t),e.nativeHandlers[t])})),this.nativeHandlers={},this.target=null)},e}();function zC(e){var t=e.target,r=e.clientX,i=e.clientY,n=t.getBoundingClientRect(),o=n.left,a=n.top;return{x:(r-o)/n.width*2-1,y:1-(i-a)/n.height*2}}function GC(e){switch(e){case AS.ALPHA:case AS.ADD:case AS.SUBTRACTION:case AS.STRONG_LIGHT:case AS.WEAK_LIGHT:return 1;case AS.SUPERPOSITION:return 2;case AS.BRIGHTNESS:return 3;case AS.MULTIPLY:return 0;default:return 1}}e.ShaderType=void 0,(MC=e.ShaderType||(e.ShaderType={}))[MC.vertex=0]="vertex",MC[MC.fragment=1]="fragment";var jC,XC,WC=((VC={})[e.ShaderType.vertex]={in:"attribute",out:"varying"},VC[e.ShaderType.fragment]={in:"varying"},VC);function HC(e,t,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),e&&(e.forEach((function(e){var t=aS(e,2),r=t[0],i=t[1];!0===i?n.push("#define ".concat(r)):Number.isFinite(i)&&n.push("#define ".concat(r," ").concat(i))})),o=n.length?n.join("\n")+"\n":"");var a="WEBGL".concat(i),s=(o+="\n#ifndef ".concat(a,"\n#define ").concat(a,"\n#endif"))+"\n"+t,u=s.match(/#version\s+\b\d{3}\b\s*(es)?/),c=u?u[0]:"";if(c&&c.includes("300")){var l=new RegExp("".concat(c),"g");1===i&&(s=s.replace(/\b(in|out)\b/g,(function(e){var t;return null!==(t=WC[r][e])&&void 0!==t?t:e}))),s=s.replace(l,"\n")}return s}function YC(e,t){switch(t){case void 0:case AS.ALPHA:e.blendFunction=[xS.ONE,xS.ONE_MINUS_SRC_ALPHA,xS.ONE,xS.ONE_MINUS_SRC_ALPHA];break;case AS.ADD:e.blendFunction=[xS.ONE,xS.ONE,xS.ONE,xS.ONE];break;case AS.SUBTRACTION:e.blendFunction=[xS.ONE,xS.ONE,xS.ZERO,xS.ONE],e.blendEquation=[xS.FUNC_REVERSE_SUBTRACT,xS.FUNC_REVERSE_SUBTRACT];break;case AS.SUPERPOSITION:e.blendFunction=[xS.ONE,xS.ONE,xS.ONE,xS.ONE];break;case AS.MULTIPLY:e.blendFunction=[xS.DST_COLOR,xS.ONE_MINUS_SRC_ALPHA,xS.DST_COLOR,xS.ONE_MINUS_SRC_ALPHA];break;case AS.BRIGHTNESS:e.blendFunction=[xS.ONE,xS.ONE_MINUS_SRC_ALPHA,xS.ONE,xS.ONE_MINUS_SRC_ALPHA];break;case AS.STRONG_LIGHT:e.blendFunction=[xS.DST_COLOR,xS.DST_ALPHA,xS.ZERO,xS.ONE];break;case AS.WEAK_LIGHT:e.blendFunction=[xS.DST_COLOR,xS.ZERO,xS.ZERO,xS.ONE];break;default:console.warn("blendMode ".concat(t," not in specification, please set blend params separately"))}}function ZC(e,t){t===RS.DOUBLE?e.culling=!1:(e.culling=!0,e.frontFace=xS.CW,e.cullFace=t===RS.BACK?xS.BACK:xS.FRONT)}function qC(e,t){switch(t){case void 0:e.stencilTest=!1;break;case CS.MASK:e.stencilTest=!0,e.stencilFunc=[xS.ALWAYS,xS.ALWAYS],e.stencilOpZPass=[xS.REPLACE,xS.REPLACE];break;case CS.OBSCURED:e.stencilTest=!0,e.stencilFunc=[xS.EQUAL,xS.EQUAL];break;case CS.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[xS.NOTEQUAL,xS.NOTEQUAL];break;case CS.NONE:e.stencilTest=!1;break;default:console.warn("maskMode ".concat(t," not in specification, please set stencil params seperately"))}}e.TextureLoadAction=void 0,(jC=e.TextureLoadAction||(e.TextureLoadAction={}))[jC.whatever=0]="whatever",jC[jC.clear=2]="clear",e.TextureSourceType=void 0,(XC=e.TextureSourceType||(e.TextureSourceType={}))[XC.none=0]="none",XC[XC.data=1]="data",XC[XC.image=2]="image",XC[XC.compressed=3]="compressed",XC[XC.video=4]="video",XC[XC.canvas=5]="canvas",XC[XC.framebuffer=6]="framebuffer",XC[XC.mipmaps=7]="mipmaps";var KC=function(){function e(){this.callbacks={}}return e.prototype.downloadJSON=function(e,t,r){this.download(e,"json",t,r)},e.prototype.downloadBinary=function(e,t,r){this.download(e,"arraybuffer",t,r)},e.prototype.downloadBlob=function(e,t,r){this.download(e,"blob",t,r)},e.prototype.download=function(e,t,r,i){var n=this;if(void 0===t&&(t="json"),!this.start(e,r,i)){var o=new XMLHttpRequest,a=function(){n.finish(e,o.status,o.response)};o.responseType=t,o.addEventListener("load",(function(){200==o.status||0==o.status?n.finish(e,200,o.response):a()})),o.addEventListener("error",a),o.open("GET",e,!0),o.send()}},e.prototype.start=function(e,t,r){var i=this.callbacks[e];try{if(i)return!0;this.callbacks[e]=i=[]}finally{i.push(t,r)}},e.prototype.finish=function(e,t,r){var i=this.callbacks[e];delete this.callbacks[e];for(var n=200==t||0==t?[r]:[t,r],o=n.length-1,a=i.length;o<a;o+=2)i[o].apply(null,n)},e}(),QC=!1;function JC(e,t){return iS(this,void 0,void 0,(function(){return nS(this,(function(r){switch(r.label){case 0:return!QC&&t?[3,2]:[4,$C(e)];case 1:case 5:return[2,{image:r.sent(),url:e}];case 2:return r.trys.push([2,4,,6]),[4,$C(t)];case 3:return[2,{image:r.sent(),url:t}];case 4:return r.sent(),QC=!0,[4,$C(e)];case 6:return[2]}}))}))}function $C(e){return iS(this,void 0,void 0,(function(){var t,r;return nS(this,(function(i){if(t="",e instanceof HTMLImageElement){if(e.complete)return[2,e];t=e.src}else e instanceof Blob?(t=URL.createObjectURL(e),r=!0):"string"==typeof e&&(t=e);if(!t)throw new Error("Invalid url type: ".concat(e));return[2,new Promise((function(e,i){var n=new Image;/^data:/.test(t)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,r&&URL.revokeObjectURL(t),e(n)},n.onerror=function(e){return n.onerror=null,r&&URL.revokeObjectURL(t),i("Load image fail: ".concat(e))},n.src=t}))]}))}))}function eO(e){return iS(this,void 0,void 0,(function(){return nS(this,(function(t){return[2,new Promise((function(t,r){(new KC).downloadBinary(e,t,(function(t,i){r("Couldn't load bins ".concat(e,": status ").concat(t,", ").concat(i))}))}))]}))}))}function tO(e,t){return void 0===t&&(t={}),iS(this,void 0,void 0,(function(){var r;return nS(this,(function(i){return r=document.createElement("video"),"string"==typeof e?r.src=e:r.srcObject=e,r.crossOrigin="anonymous",r.muted=!0,t.loop&&r.addEventListener("ended",(function(){return r.play()})),qS()&&r.setAttribute("renderer","standard"),r.setAttribute("playsinline","playsinline"),[2,new Promise((function(e,t){var i=r.play();i?i.then((function(){return e(r)})):r.addEventListener("loadeddata",(function t(){e(r),r.removeEventListener("loadeddata",t)}),!0),r.addEventListener("error",(function(e){t(e)}))}))]}))}))}function rO(t,r,i){return void 0===i&&(i=[]),iS(this,void 0,void 0,(function(){var n,o,a,s,u,c,l;return nS(this,(function(f){switch(f.label){case 0:return 34067!==t.target?[3,2]:(a=(n=t).mipmaps,s=n.target,u=a.map((function(e){return Promise.all(e.map((function(e){return iO(e,r)})))})),[4,Promise.all(u)]);case 1:return c=f.sent(),l=i[a[0][0][1][0]].url,[2,rS(rS({keepImageSource:!1},t),{mipmaps:c,sourceFrom:{target:s,bin:l,type:e.TextureSourceType.mipmaps,mipmaps:a.map((function(e){return e.map((function(e){return[e[1][1],e[1][2]]}))}))}})];case 2:return a=(o=t).mipmaps,s=o.target,u=a.map((function(e){return iO(e,r)})),[4,Promise.all(u)];case 3:return c=f.sent(),l=i[a[0][1][0]].url,[2,rS(rS({keepImageSource:!1},t),{mipmaps:c,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{target:s,bin:l,type:e.TextureSourceType.mipmaps,mipmaps:a.map((function(e){return[e[1][1],e[1][2]]}))}})]}}))}))}function iO(e,t){return iS(this,void 0,void 0,(function(){var r,i,n,o,a;return nS(this,(function(s){if(r=aS(e[1],3),i=r[0],n=r[1],o=r[2],!(a=t[i]))throw new Error("invalid bin pointer: ".concat(JSON.stringify(e)));return[2,$C(new Blob([new Uint8Array(a,n,o)]))]}))}))}var nO=1,oO=function(){function t(){this.destroyed=!1,this.id="Tex"+nO++}return Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.getWidth=function(){return this.width||0},t.prototype.getHeight=function(){return this.height||0},t.prototype.uploadCurrentVideoFrame=function(){},t.prototype.offloadData=function(){},t.prototype.reloadData=function(){},t.prototype.initialize=function(){},t.prototype.assembleOptions=function(t){var r=t.target,i=void 0===r?xS.TEXTURE_2D:r,n=t.format,o=void 0===n?xS.RGBA:n;return t.sourceType||(t.sourceType="image"in t?e.TextureSourceType.image:"data"in t?e.TextureSourceType.data:"video"in t?e.TextureSourceType.video:0),rS({minFilter:xS.NEAREST,magFilter:xS.NEAREST,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE,target:i,format:xS.RGBA,internalFormat:o,type:xS.UNSIGNED_BYTE},t)},t}();function aO(e,t,r,i){var n,o,a=t.length/r/i;return o=n=4===a||0===a?xS.RGBA:3===a?xS.RGB:2===a?xS.LUMINANCE_ALPHA:xS.LUMINANCE,oO.createWithData(e,{data:t,width:r,height:i},{type:xS.HALF_FLOAT,format:n,internalFormat:o,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE})}var sO="galacean-effects",uO="lookup_texture",cO="offscreen_canvas",lO={};function fO(e){return lO[e]}var hO=function(){function e(e,t,r){void 0===r&&(r=0),this.arrayBuffer=e,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[11])throw Error("texture missing KTX identifier");var n=Uint32Array.BYTES_PER_ELEMENT,o=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===o.getUint32(0,!0);this.glType=o.getUint32(1*n,a),this.glTypeSize=o.getUint32(2*n,a),this.glFormat=o.getUint32(3*n,a),this.glInternalFormat=o.getUint32(4*n,a),this.glBaseInternalFormat=o.getUint32(5*n,a),this.pixelWidth=o.getUint32(6*n,a),this.pixelHeight=o.getUint32(7*n,a),this.pixelDepth=o.getUint32(8*n,a),this.numberOfArrayElements=o.getUint32(9*n,a),this.numberOfFaces=o.getUint32(10*n,a),this.numberOfMipmapLevels=o.getUint32(11*n,a),this.bytesOfKeyValueData=o.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===t?0===this.glType?this.loadType=0:this.loadType=2:console.warn({content:"number of faces expected"+t+", but found "+this.numberOfFaces,type:sO}):console.warn({content:"texture arrays not currently supported",type:sO}):console.warn({content:"only 2D textures currently supported",type:sO})}return e.prototype.mipmaps=function(e){for(var t=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,o=e?this.numberOfMipmapLevels:1,a=0;a<o;a++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,s);t.push({data:c,width:i,height:n}),r+=s+4,r+=3-(s+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return t},e}();function pO(t){var r=new hO(t,1),i=r.numberOfMipmapLevels,n=r.pixelWidth,o=r.pixelHeight,a=r.glType,s=r.numberOfFaces,u=r.glInternalFormat,c=r.glFormat,l=i>=Math.floor(Math.log2(Math.max(n,o))+1);return{sourceType:e.TextureSourceType.compressed,type:a,target:6===s?xS.TEXTURE_CUBE_MAP:xS.TEXTURE_2D,internalFormat:u,format:c,mipmaps:r.mipmaps(l)}}var dO,mO=function(){function t(){this.reloadPending={}}return t.prototype.reload=function(e){return iS(this,void 0,void 0,(function(){var t,r;return nS(this,(function(i){switch(i.label){case 0:return t=e.id,this.reloadPending[t]?[2]:e.sourceFrom?(this.reloadPending[t]=!0,[4,this.loadSource(e.sourceFrom)]):[3,2];case 1:return r=i.sent(),e.updateSource(r),this.reloadPending[t]=!1,[3,3];case 2:throw new Error("No source from");case 3:return[2]}}))}))},t.prototype.canOffloadTexture=function(t){if(t){var r=t.type;if(r===e.TextureSourceType.compressed||r===e.TextureSourceType.image){var i=t,n=i.target,o=i.map,a=t.url;return n===xS.TEXTURE_CUBE_MAP?"object"==typeof o&&!!o:lC(a)&&a.length>0}if(r===e.TextureSourceType.mipmaps){var s=t,u=s.bin,c=s.mipmaps,l=t,f=(n=l.target,l.maps),h=t.urls;return u?c.length>0:n===xS.TEXTURE_CUBE_MAP?f.every((function(e){return"object"==typeof e&&e})):h.every((function(e){return lC(e)&&e.length>0}))}}return!1},t.prototype.loadSource=function(t,r){return iS(this,void 0,void 0,(function(){var i,n,o,a,s,u,c,l,f,h,p,d,m,v,y,g,x,T=this;return nS(this,(function(E){switch(E.label){case 0:return i=t.type,n=t.target,o=t.map,a=t.url,u=(s=t).bin,c=s.mipmaps,l=t.urls,f=t.maps,n!==xS.TEXTURE_CUBE_MAP||i===e.TextureSourceType.mipmaps?[3,2]:[4,this.loadCubeMap(o)];case 1:return h=E.sent(),[2,rS(rS({},r),{cube:h,target:xS.TEXTURE_CUBE_MAP,sourceType:e.TextureSourceType.image,sourceFrom:{type:e.TextureSourceType.image,map:rS({},o),target:xS.TEXTURE_CUBE_MAP}})];case 2:return i!==e.TextureSourceType.image?[3,4]:[4,$C(a)];case 3:return p=E.sent(),[2,rS(rS({},r),{image:p,sourceType:e.TextureSourceType.image,sourceFrom:{type:i,url:a,target:xS.TEXTURE_2D}})];case 4:return i!==e.TextureSourceType.video?[3,6]:[4,tO(a)];case 5:return d=E.sent(),[2,rS(rS({},r),{video:d,sourceType:e.TextureSourceType.video})];case 6:return i!==e.TextureSourceType.compressed?[3,8]:[4,eO(a)];case 7:return m=E.sent(),[2,rS(rS(rS({},pO(m)),r),{sourceFrom:{url:a,type:e.TextureSourceType.compressed}})];case 8:return i!==e.TextureSourceType.mipmaps?[3,17]:u?[4,eO(u)]:[3,13];case 9:return v=E.sent(),y=null!=n?n:xS.TEXTURE_2D,g=y===xS.TEXTURE_2D?c.slice():c.map((function(e){return e.slice()})),x=void 0,n!==xS.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(c.map((function(e){return T.loadMipmapImages(e,v)})))];case 10:return x=E.sent(),[3,12];case 11:x=this.loadMipmapImages(c,v),E.label=12;case 12:return[2,rS(rS({},r),{mipmaps:x,target:y,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:e.TextureSourceType.mipmaps}})];case 13:return n!==xS.TEXTURE_2D&&n?[3,15]:[4,Promise.all(l.map((function(e){return $C(e)})))];case 14:return x=E.sent(),[2,rS(rS({},r),{mipmaps:x,target:xS.TEXTURE_2D,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:l.slice(),target:xS.TEXTURE_2D}})];case 15:return n!==xS.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(f.map((function(e){return T.loadCubeMap(e)})))];case 16:return x=E.sent(),[2,rS(rS({},r),{mipmaps:x,target:xS.TEXTURE_CUBE_MAP,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:f.map((function(e){return rS({},e)})),target:xS.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: ".concat(i))}}))}))},t.prototype.loadMipmapImages=function(e,t){return iS(this,void 0,void 0,(function(){return nS(this,(function(r){return[2,Promise.all(e.map((function(e){return $C(new Blob([new Uint8Array(t,e[0],e[1])]))})))]}))}))},t.prototype.loadCubeMap=function(e){return iS(this,void 0,void 0,(function(){return nS(this,(function(t){return[2,Promise.all(e.map((function(e){return $C(e)})))]}))}))},t}();var vO,yO=function(){function e(e){this.destroyed=!1;var t=e.name,r=void 0===t?"defaultDataBlock":t;this.name=r}return e.prototype.setUniformValues=function(e){var t=this;Object.keys(e).forEach((function(r){t.setUniformValue(r,e[r])}))},e.prototype.invalidAllFlags=function(){},e.prototype.updateUniformSubData=function(e,t,r){},e}();function gO(e){return"object"==typeof e&&e&&void 0===e.length&&e instanceof oO}e.MaterialRenderType=void 0,(vO=e.MaterialRenderType||(e.MaterialRenderType={}))[vO.normal=0]="normal",vO[vO.transformFeedback=1]="transformFeedback";var xO,TO,EO=1,_O=function(){function t(t){this.props=t,this.destroyed=!1,this.initialized=!1;var r=t.name,i=void 0===r?"Material"+EO++:r,n=t.renderType,o=void 0===n?e.MaterialRenderType.normal:n,a=t.shader,s=t.uniformSemantics;this.name=i,this.renderType=o,this.shaderSource=a,this.uniformSemantics=rS({},s)}return Object.defineProperty(t.prototype,"blending",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendFunction",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendEquation",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthTest",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthMask",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilTest",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilRef",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilFunc",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilOpZPass",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"culling",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"frontFace",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cullFace",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blendColor",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthRange",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthFunc",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polygonOffsetFill",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polygonOffset",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sampleAlphaToCoverage",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"colorMask",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilMask",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilOpFail",{set:function(e){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilOpZFail",{set:function(e){},enumerable:!1,configurable:!0}),t.prototype.initialize=function(){},t.prototype.use=function(e,t){},t}(),SO="uniform vec2 uFilterSourceSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));return mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}";e.ShaderCompileResultStatus=void 0,(xO=e.ShaderCompileResultStatus||(e.ShaderCompileResultStatus={}))[xO.noShader=0]="noShader",xO[xO.success=1]="success",xO[xO.fail=2]="fail",xO[xO.compiling=3]="compiling",e.GLSLVersion=void 0,(TO=e.GLSLVersion||(e.GLSLVersion={})).GLSL1="100",TO.GLSL3="300 es";var AO=function(e){this.source=e},RO="effects-internal-copy",CO="effects-internal-copy-mesh",OO="\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",bO="precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\n".concat(SO,"\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n fragColor = filterMain(vTex,uFilterSource);\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n");function LO(t,r){var i=2===t,n=i?"#version 300 es":"";return{name:RO,vertex:HC([],n+"\n"+OO,e.ShaderType.vertex,t),fragment:HC([],n+"\n"+bO,e.ShaderType.fragment,t),glslVersion:i?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:CO+ +r}}var IO,wO={format:xS.RGBA,type:xS.UNSIGNED_BYTE,minFilter:xS.LINEAR,magFilter:xS.LINEAR,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE},PO=Symbol("dispose"),MO=function(){function t(e){this.textureCache={},this.textureRef={},this.engine=e}return t.prototype.requestColorAttachmentTexture=function(t){var r=this,i=t.width,n=t.height,o=t.name,a={sourceType:e.TextureSourceType.framebuffer,data:{width:i,height:n},name:o},s=[o];Object.getOwnPropertyNames(wO).forEach((function(e){var r,i=null!==(r=t[e])&&void 0!==r?r:wO[e];a[e]=i,s.push(e,i)}));var u=s.join(":"),c=this.textureCache[u];if(c)this.textureRef[u]++;else{var l=this.engine;rA(l),c=oO.create(l,a),this.textureCache[u]=c,this.textureRef[u]=1,c[PO]=c.dispose,c.dispose=function(){return r.removeTexture(u)}}return c},t.prototype.removeTexture=function(e){var t=this.textureRef[e];if(t<=1){t<0&&console.error("ref count < 0");var r=this.textureCache[e];r&&(r[PO](),r.dispose=r[PO]),delete this.textureCache[e],delete this.textureRef[e]}else this.textureRef[e]=t-1},t.prototype.dispose=function(){Object.values(this.textureCache).forEach((function(e){e[PO](),e.dispose=e[PO]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),VO=function(){function e(e){void 0===e&&(e={}),this.semantics=rS({},e)}return e.prototype.toObject=function(){return rS({},this.semantics)},e.prototype.setSemantic=function(e,t){void 0===t?delete this.semantics[e]:this.semantics[e]=t},e.prototype.getSemanticValue=function(e,t){var r=this.semantics[e];return hC(r)?r(t):r},e.prototype.hasSemanticValue=function(e){return e in this.semantics},e.prototype.dispose=function(){var e=this;Object.keys(this.semantics).forEach((function(t){delete e.semantics[t]}))},e}(),NO=((IO={})[xS.FLOAT]=Float32Array.BYTES_PER_ELEMENT,IO[xS.INT]=Int32Array.BYTES_PER_ELEMENT,IO[xS.SHORT]=Int16Array.BYTES_PER_ELEMENT,IO[xS.BYTE]=Int8Array.BYTES_PER_ELEMENT,IO),FO=function(){function e(e){this.name=e}return e.prototype.initialize=function(){},e.prototype.flush=function(){},e}();function DO(e){return e===xS.INT?new Int32Array(0):e===xS.SHORT?new Int16Array(0):new Float32Array(0)}var UO,BO,kO=1,zO=function(){function t(e,t){this.engine=e,this.destroyed=!1,this.visible=!1;var r=t.material,i=t.geometry,n=t.name,o=void 0===n?"<unnamed>":n,a=t.priority,s=void 0===a?0:a,u=t.worldMatrix,c=void 0===u?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:u;this.id="Mesh"+kO++,this.name=o,this.geometry=i,this.material=r,this.priority=s,this.worldMatrix=c}return Object.defineProperty(t.prototype,"priority",{get:function(){return this._priority},set:function(e){this._priority=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.setVisible=function(e){this.visible=e},t.prototype.render=function(e){var t=e.renderingData,r=this.material;t.currentFrame.globalUniforms&&(t.currentCamera&&(e.setGlobalMatrix("effects_MatrixInvV",t.currentCamera.getInverseViewMatrix()),e.setGlobalMatrix("effects_MatrixV",t.currentCamera.getViewMatrix()),e.setGlobalMatrix("effects_MatrixVP",t.currentCamera.getViewProjectionMatrix()),e.setGlobalMatrix("_MatrixP",t.currentCamera.getProjectionMatrix())),e.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix)),t.currentFrame.editorTransform&&r.setVector4("uEditorTransform",t.currentFrame.editorTransform),r.use(e,t.currentFrame.globalUniforms);var i=this.geometry;i.flush(),e.drawGeometry(i,r)},t.prototype.getVisible=function(){return this.visible},t.prototype.firstGeometry=function(){return this.geometry},t.prototype.setMaterial=function(t,r){r!==e.DestroyOptions.keep&&this.material.dispose(r),this.material=t},t.prototype.restore=function(){},t.prototype.dispose=function(t){if(!this.destroyed){(null==t?void 0:t.geometries)!==e.DestroyOptions.keep&&this.geometry.dispose();var r=null==t?void 0:t.material;r!==e.DestroyOptions.keep&&this.material.dispose(r),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},t}(),GO=1e3;e.RenderPassAttachmentStorageType=void 0,(UO=e.RenderPassAttachmentStorageType||(e.RenderPassAttachmentStorageType={}))[UO.none=0]="none",UO[UO.color=1]="color",UO[UO.stencil_8_opaque=2]="stencil_8_opaque",UO[UO.depth_16_opaque=3]="depth_16_opaque",UO[UO.depth_stencil_opaque=4]="depth_stencil_opaque",UO[UO.depth_16_texture=5]="depth_16_texture",UO[UO.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",e.TextureStoreAction=void 0,(BO=e.TextureStoreAction||(e.TextureStoreAction={}))[BO.store=0]="store",BO[BO.clear=2]="clear";var jO,XO=function(){function t(t,r){if(this.destroyed=!1,r){var i=r.texture,n=r.size;if(i instanceof oO)this.texture=i,this.externalTexture=!0;else if(i){var o=i.wrapT,a=i.wrapS,s=i.minFilter,u=i.magFilter,c=i.internalFormat,l=i.format,f=void 0===l?xS.RGBA:l,h=i.type,p=void 0===h?xS.UNSIGNED_BYTE:h;this.externalTexture=!1,this.textureOptions={size:n,format:f,type:p,internalFormat:c||f,wrapT:o,wrapS:a,minFilter:s,magFilter:u,name:r.name},this.texture=oO.create(t,rS(rS({},this.textureOptions),{sourceType:e.TextureSourceType.framebuffer,data:{width:n[0],height:n[1]}}))}}}return t.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"storageType",{get:function(){return e.RenderPassAttachmentStorageType.color},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var e=this.texture;return e?[e.getWidth(),e.getHeight()]:[0,0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.texture.getWidth()||0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this.texture.getHeight()||0},enumerable:!1,configurable:!0}),t}();e.RenderPassDestroyAttachmentType=void 0,(jO=e.RenderPassDestroyAttachmentType||(e.RenderPassDestroyAttachmentType={}))[jO.force=0]="force",jO[jO.keep=1]="keep",jO[jO.keepExternal=2]="keepExternal",jO[jO.destroy=0]="destroy";var WO=1,HO=function(){function t(t,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+WO++:i,o=r.clearAction,a=r.semantics,s=r.depthStencilAttachment,u=r.storeAction,c=r.priority,l=void 0===c?0:c,f=r.meshOrder,h=void 0===f?e.OrderType.ascending:f,p=r.meshes,d=void 0===p?[]:p,m=r.delegate,v=void 0===m?{}:m;this.name=n,this.renderer=t,this.priority=l,this.meshOrder=h,this.meshes=JS(d.slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||e.RenderPassAttachmentStorageType.none,this.clearAction=rS({},o),this.storeAction=rS({colorAction:e.TextureStoreAction.store,depthAction:e.TextureStoreAction.store,stencilAction:e.TextureStoreAction.store},u),this.semantics=new VO(a),this.options=r,this.delegate=v,this.setViewportOptions(r)}return Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"viewport",{get:function(){return this.getViewport()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stencilAttachment",{get:function(){return this.getStencilAttachment()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthAttachment",{get:function(){return this.getDepthAttachment()},enumerable:!1,configurable:!0}),t.prototype.addMesh=function(e){$S(this.meshes,e,this.meshOrder)},t.prototype.removeMesh=function(e){zS(this.meshes,e)},t.prototype.setMeshes=function(e){var t;return this.meshes.length=0,(t=this.meshes).splice.apply(t,sS([0,0],aS(e),!1)),JS(this.meshes,this.meshOrder),this.meshes},t.prototype.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},t.prototype.configure=function(e){if(this.frameBuffer)e.setFrameBuffer(this.frameBuffer);else{var t=aS(this.getViewport(),4),r=t[0],i=t[1],n=t[2],o=t[3];e.setViewport(r,i,n,o)}},t.prototype.execute=function(e){e.clear(this.clearAction),e.renderMeshes(this.meshes),e.clear(this.storeAction)},t.prototype.frameCleanup=function(e){},t.prototype.resetColorAttachments=function(t){var r=this;if(t.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=t.map((function(t){return t.updateSource({sourceType:e.TextureSourceType.framebuffer}),new XO(r.renderer.engine,{texture:t})}));this.attachments.forEach((function(e){return!e.externalTexture&&e.dispose()})),this.attachments=i,this.frameBuffer&&(this.frameBuffer.bind(),this.frameBuffer.resetColorTextures(t.map((function(e){return e}))))}else this.resetAttachments({attachments:t.map((function(e){return{texture:e}}))})},t.prototype.resetAttachments=function(e){this.options=e,this.setViewportOptions(e),this.renderer&&this._resetAttachments()},t.prototype.setViewportOptions=function(e){if(e.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=e.viewport.slice(0,4),this.frameBuffer){var t=this.customViewport;this.frameBuffer.isCustomViewport=!1,this.frameBuffer.resize(t[0],t[1],t[2],t[3])}}else this.isCustomViewport=!1,this.viewportScale=e.viewportScale||1,this.frameBuffer&&(this.frameBuffer.isCustomViewport=!0,this.frameBuffer.viewportScale=this.viewportScale)},t.prototype._resetAttachments=function(){var t,r,i=this,n=this.renderer,o=this.options;this.attachments.length&&(this.attachments.forEach((function(e){return!e.externalTexture&&e.dispose()})),this.attachments.length=0,null===(t=this.frameBuffer)||void 0===t||t.dispose({depthStencilAttachment:e.RenderPassDestroyAttachmentType.keepExternal}),this.frameBuffer=null);var a=this.viewportScale,s=this.isCustomViewport?this.customViewport:[0,0,n.getWidth()*a,n.getHeight()*a],u=[s[2],s[3]],c=this.name;if(null===(r=o.attachments)||void 0===r?void 0:r.length){var l=o.attachments.map((function(e,t){var r;return new XO(i.renderer.engine,rS({size:u,name:(null===(r=e.texture)||void 0===r?void 0:r.name)||"".concat(c,"##color_").concat(t)},e))}));this.attachments=l;var f=Pb.create({storeAction:this.storeAction,name:c,viewport:s,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:l.map((function(e){return e.texture})),depthStencilAttachment:o.depthStencilAttachment||{storageType:e.RenderPassAttachmentStorageType.none}},n);f.bind(),f.unbind(),this.frameBuffer=f}else this.attachments.length=0},t.prototype.getViewport=function(){var e,t=(null===(e=this.frameBuffer)||void 0===e?void 0:e.viewport)||this.customViewport;if(t)return t;var r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},t.prototype.getDepthAttachment=function(){var e=this.frameBuffer;if(e)return{storageType:e.depthStencilStorageType,storage:e.depthStorage,texture:e.getDepthTexture()?this.getDepthTexture(e.getDepthTexture(),e.externalStorage):void 0}},t.prototype.getStencilAttachment=function(){var e=this.frameBuffer;if(e)return{storageType:e.depthStencilStorageType,storage:e.stencilStorage,texture:e.getStencilTexture()?this.getStencilTexture(e.getStencilTexture(),e.externalStorage):void 0}},t.prototype.getDepthTexture=function(e,t){var r;if(!this.depthTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=e===i?i:e;return t||(this.depthTexture=n),n}return this.depthTexture},t.prototype.getStencilTexture=function(e,t){var r;if(!this.stencilTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=e===i?i:e;return t||(this.stencilTexture=n),n}return this.stencilTexture},t.prototype.initialize=function(e){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},t.prototype.dispose=function(t){var r,i;if(!this.destroyed){var n=(null==t?void 0:t.meshes)||void 0;n!==e.DestroyOptions.keep&&this.meshes.forEach((function(e){e.dispose(n)})),this.meshes.length=0;var o=(null==t?void 0:t.colorAttachment)?t.colorAttachment:e.RenderPassDestroyAttachmentType.force;this.attachments.forEach((function(t){t.externalTexture&&o===e.RenderPassDestroyAttachmentType.keepExternal||o===e.RenderPassDestroyAttachmentType.keep||t.dispose()})),this.attachments.length=0,(null==t?void 0:t.semantics)!==e.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var a=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:e.RenderPassDestroyAttachmentType.force,s=this.frameBuffer;if(s)s.dispose({depthStencilAttachment:a}),s.externalStorage&&a===e.RenderPassDestroyAttachmentType.keepExternal||a===e.RenderPassDestroyAttachmentType.keep||(null===(r=this.stencilTexture)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose());this.options=this.renderer=null,this.initialize=vC}},t}(),YO="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}",ZO="#version 300 es\nprecision highp float;\n#define SHADER_VERTEX 1\n#define SPRITE_SHADER 1\nin vec4 aPoint;in vec2 aIndex;uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixInvV;uniform mat4 effects_MatrixVP;out vec4 vColor;out vec4 vTexCoord;\n#ifdef ADJUST_LAYER\nout vec2 vFeatherCoord;\n#endif\nout highp vec3 vParams;const float d2r=3.141592653589793/180.;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec4 filterMain(float t,vec4 position);\n#pragma FILTER_VERT\nvec3 rotateByQuat(vec3 a,vec4 quat){vec3 qvec=quat.xyz;vec3 uv=cross(qvec,a);vec3 uuv=cross(qvec,uv)*2.;return a+(uv*2.*quat.w+uuv);}void main(){int index=int(aIndex.x);vec4 texParams=uTexParams[index];mat4 mainData=uMainData[index];float life=mainData[1].z;if(life<0.||life>1.){gl_Position=vec4(3.,3.,3.,1.);}else{vec4 _pos=mainData[0];vec2 size=mainData[1].xy;vec3 point=rotateByQuat(vec3(aPoint.xy*size,0.),mainData[2]);vec4 pos=vec4(_pos.xyz,1.0);float renderMode=texParams.z;if(renderMode==0.){pos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixInvV[0].xyz*point.x+effects_MatrixInvV[1].xyz*point.y;}else if(renderMode==1.){pos.xyz+=point;pos=effects_ObjectToWorld*pos;}else if(renderMode==2.){pos=effects_ObjectToWorld*pos;pos.xy+=point.xy;}else if(renderMode==3.){pos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixInvV[0].xyz*point.x+effects_MatrixInvV[2].xyz*point.y;}gl_Position=effects_MatrixVP*pos;\n#ifdef ADJUST_LAYER\nvec4 filter_Position=filterMain(life,pos);\n#endif\ngl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#ifdef ADJUST_LAYER\nfilter_Position=vec4(filter_Position.xy*uEditorTransform.xy+uEditorTransform.zw*filter_Position.w,filter_Position.zw);\n#endif\n#endif\n#ifdef ADJUST_LAYER\nvTexCoord=vec4(filter_Position.xy/filter_Position.w+1.,gl_Position.xy/gl_Position.w+1.)/2.;vFeatherCoord=aPoint.zw;\n#else\nvec4 texOffset=uTexOffset[index];vTexCoord=vec4(aPoint.zw*texOffset.zw+texOffset.xy,texParams.xy);\n#endif\nvColor=mainData[3];vParams=vec3(aIndex.y,texParams.y,texParams.x);}}",qO="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define SPRITE_SHADER 1\nin vec4 vColor;in vec4 vTexCoord;in highp vec3 vParams;\n#ifdef ADJUST_LAYER\nuniform sampler2D uSamplerPre;vec4 filterMain(vec2 coord,sampler2D tex);in vec2 vFeatherCoord;uniform sampler2D uFeatherSampler;\n#endif\nuniform sampler2D uSampler0;uniform sampler2D uSampler1;uniform sampler2D uSampler2;uniform sampler2D uSampler3;uniform sampler2D uSampler4;uniform sampler2D uSampler5;uniform sampler2D uSampler6;uniform sampler2D uSampler7;\n#if MAX_FRAG_TEX == 16\nuniform sampler2D uSampler8;uniform sampler2D uSampler9;uniform sampler2D uSampler10;uniform sampler2D uSampler11;uniform sampler2D uSampler12;uniform sampler2D uSampler13;uniform sampler2D uSampler14;uniform sampler2D uSampler15;\n#endif\nvec4 texture2DbyIndex(float index,vec2 coord);\n#pragma FILTER_FRAG\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\nvoid main(){vec4 color=vec4(0.);\n#ifdef ADJUST_LAYER\nvec2 featherCoord=abs(vFeatherCoord-vec2(0.5))/0.5;float cc=sqrt(max(featherCoord.x,featherCoord.y));float blend=vColor.a*texture2D(uFeatherSampler,vec2(cc,0.)).r;if(blend>=1.){color=filterMain(vTexCoord.xy,uSamplerPre);}else if(blend<=0.){color=texture2D(uSamplerPre,vTexCoord.zw);}else{color=mix(texture2D(uSamplerPre,vTexCoord.zw),filterMain(vTexCoord.xy,uSamplerPre),blend);}\n#else\nvec4 texColor=texture2DbyIndex(round(vParams.x),vTexCoord.xy);color=blendColor(texColor,vColor,round(vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);fragColor=color;}vec4 texture2DbyIndex(float index,vec2 coord){\n#ifndef ADJUST_LAYER\nif(index==0.){return texture2D(uSampler0,coord);}if(index==1.){return texture2D(uSampler1,coord);}if(index==2.){return texture2D(uSampler2,coord);}if(index==3.){return texture2D(uSampler3,coord);}if(index==4.){return texture2D(uSampler4,coord);}if(index==5.){return texture2D(uSampler5,coord);}if(index==6.){return texture2D(uSampler6,coord);}if(index==7.){return texture2D(uSampler7,coord);}\n#if MAX_FRAG_TEX == 16\nif(index==8.){return texture2D(uSampler8,coord);}if(index==9.){return texture2D(uSampler9,coord);}if(index==10.){return texture2D(uSampler10,coord);}if(index==11.){return texture2D(uSampler11,coord);}if(index==12.){return texture2D(uSampler12,coord);}if(index==13.){return texture2D(uSampler13,coord);}if(index==14.){return texture2D(uSampler14,coord);}if(index==15.){return texture2D(uSampler15,coord);}\n#endif\nreturn texture2D(uSampler0,coord);\n#else\nreturn vec4(0.);\n#endif\n}",KO="#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nin float vLife;in vec2 vTexCoord;in vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nin vec4 vTexCoordBlend;\n#ifdef USE_FILTER\nuniform vec4 uFSprite;\n#endif\n#endif\nin float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){fragColor=uPreviewColor;}\n#else\n#pragma FILTER_FRAG\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}\n#ifdef USE_FILTER\n#ifdef USE_SPRITE\ntexOffset=uTexOffset/uFSprite.xy;\n#endif\ncolor=filterMain(vTexCoord,uMaskTex);\n#else\nif(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#endif\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);fragColor=color;}\n#endif\n",QO="#version 300 es\nprecision highp float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).y;}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;float r=dot(vec4(2.*t*t*t,3.*t*t,-t0*t0*t0,3.*t0*t0),vec4(y0-y1,t0*y1-t1*y0,2.*y0+y1,t1*y0));return r/(t0-t1)/6.;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#pragma EDITOR_VERT_DEFINE\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out vec2 vTexCoord;\n#ifdef USE_FILTER\n#pragma FILTER_VERT\n#endif\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef USE_FILTER\nfilterMain(life);\n#endif\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n#pragma EDITOR_VERT_TRANSFORM\n}}",JO="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).y;}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}in vec4 aPos;in vec3 aDir;in vec3 aInfo;in vec4 aColor;in float aTime;\n#ifdef ATTR_TRAIL_START\nin float aTrailStart;\n#else\nuniform float uTrailStart[64];in float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nout float vLife;out vec2 vTexCoord;out vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",$O="uniform vec4 uTexRange;uniform vec2 uFilterSourceSize;\n#define INTERPOLATION 0\nvec4 filterMain(vec2 texCoord,sampler2D source){float x=uTexRange.x+texCoord.x*uTexRange.y;\n#if INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));vec4 color=mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nvec4 color=texture2D(source,vec2(x,texCoord.y));\n#endif\nx=uTexRange.z+texCoord.x*uTexRange.w;vec4 opacity=texture2D(source,vec2(x,texCoord.y));return vec4(color.rgb,opacity.r);}",eb="uniform sampler2D uAlphaXSample;uniform sampler2D uAlphaYSample;vec4 filterMain(vec2 texCoord,sampler2D source){vec4 color=texture2D(source,texCoord);float x=texture2D(uAlphaXSample,vec2(vFeatherCoord.x,0.)).r;float y=texture2D(uAlphaYSample,vec2(vFeatherCoord.y,0.)).r;return vec4(color.rgb,color.a*min(x,y));}",tb="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",rb="uniform sampler2D uLastSource;uniform vec4 uParams;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);if(uParams.x<1.){return c1;}vec4 c2=texture2D(uLastSource,coord);return mix(c1,c2,uParams.y);}",ib="uniform vec4 uWaveParams;\n#ifdef PATICLE_SHADER\nin vec4 vWaveParams;\n#else\nuniform vec4 vWaveParams;\n#endif\nvec4 filterMain(vec2 texCoord,sampler2D tex){vec2 vp=texCoord-uWaveParams.xy;float xx=dot(vp,uWaveParams.zw);float d=sin(vWaveParams.x*xx+vWaveParams.y)*vWaveParams.z;vec2 up=vec2(-uWaveParams.w,uWaveParams.z)*d;return texture2D(tex,clamp(texCoord+up,0.,1.));}",nb="uniform vec4 uMovementValue;uniform vec4 uStrengthValue;uniform vec4 uPeriodValue;out vec4 vWaveParams;void filterMain(float lifetime){const float pi2=3.14159265;vWaveParams=vec4(getValueFromTime(lifetime,uPeriodValue)*pi2,getValueFromTime(lifetime,uMovementValue)*pi2,getValueFromTime(lifetime,uStrengthValue),0.);}",ob="uniform sampler2D uBloomBlur;uniform vec4 uBloomParams;vec4 filterMain(vec2 coord,sampler2D tex){const vec3 gamma=vec3(1./2.2);vec4 c1=texture2D(tex,coord);vec4 bloomColor=texture2D(uBloomBlur,coord);float alpha=max(c1.a,bloomColor.a);vec3 color=max(c1.rgb*c1.a,bloomColor.rgb*bloomColor.a)/alpha*uBloomParams.y+bloomColor.rgb*uBloomParams.x;return vec4(color,alpha);}",ab="uniform vec4 uColorThreshold;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);vec3 color=c1.rgb*c1.a;vec3 s=step(uColorThreshold.xyz,color);float m=min(s.r+s.g+s.b,1.);return c1*m;}",sb="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",ub="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=ACESToneMapping(finalColor);}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",cb="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussH(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[9];offsets[0]=-4.0;offsets[1]=-3.0;offsets[2]=-2.0;offsets[3]=-1.0;offsets[4]=0.0;offsets[5]=1.0;offsets[6]=2.0;offsets[7]=3.0;offsets[8]=4.0;float weights[9];weights[0]=0.01621622;weights[1]=0.05405405;weights[2]=0.12162162;weights[3]=0.19459459;weights[4]=0.22702703;weights[5]=0.19459459;weights[6]=0.12162162;weights[7]=0.05405405;weights[8]=0.01621622;for(int i=0;i<9;i++){vec2 offset=vec2(offsets[i]*2.0*(1.0/_TextureSize.x),0);color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussH(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",lb="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussV(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[5];offsets[0]=-3.23076923;offsets[1]=-1.38461538;offsets[2]=0.0;offsets[3]=1.38461538;offsets[4]=3.23076923;float weights[5];weights[0]=0.07027027;weights[1]=0.31621622;weights[2]=0.22702703;weights[3]=0.31621622;weights[4]=0.07027027;for(int i=0;i<5;i++){vec2 offset=vec2(0,offsets[i]*(1.0/_TextureSize.y));color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussV(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",fb="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform sampler2D _GaussianDownTex;uniform vec2 _GaussianDownTextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=1;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec3 lowResColor=GaussNxN(_MainTex,uv,0.5/_GaussianDownTextureSize,1.0);vec3 highResColor=GaussNxN(_GaussianDownTex,uv,1.0/_GaussianDownTextureSize,1.0);vec3 color=mix(highResColor,lowResColor,0.7);gl_FragColor=vec4(color,1.0);}",hb="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainColor=texture2D(_MainTex,uv);mainColor.rgb=pow(mainColor.rgb,vec3(2.2));float brightness=max(mainColor.r,max(mainColor.g,mainColor.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainColor.rgb*=w;gl_FragColor=vec4(mainColor.rgb,1.0);}",pb=function(t){function r(r,i){var n=t.call(this,r,i)||this,o=n.renderer.engine,a=FO.create(o,{mode:xS.TRIANGLE_STRIP,attributes:{aPos:{type:xS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=_O.create(o,{shader:{vertex:sb,fragment:hb,glslVersion:e.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=zO.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}return tS(r,t),r.prototype.configure=function(e){this.mainTexture=e.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,e.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(t){t.clear({colorAction:e.TextureStoreAction.clear,depthAction:e.TextureStoreAction.clear,stencilAction:e.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var r=t.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",r),t.renderMeshes([this.screenMesh])},r}(HO),db=function(t){function r(r,i,n){var o=t.call(this,r,n)||this;o.type=i;var a=o.renderer.engine,s="PostProcess",u=FO.create(a,{name:s,mode:xS.TRIANGLE_STRIP,attributes:{aPos:{type:xS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:sb,fragment:"H"==i?cb:lb,glslVersion:e.GLSLVersion.GLSL1},l=_O.create(a,{name:s,shader:c});return l.blending=!1,l.depthTest=!1,l.culling=!1,o.screenMesh=zO.create(a,{name:s,geometry:u,material:l,priority:0}),o.priority=5e3,o}return tS(r,t),r.prototype.configure=function(e){this.mainTexture=e.getFrameBuffer().getColorTextures()[0],e.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(t){t.clear({colorAction:e.TextureStoreAction.clear,depthAction:e.TextureStoreAction.clear,stencilAction:e.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",Eb(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFrameBuffer().getColorTextures()[0])},r}(HO),mb=function(t){function r(e,r){var i=t.call(this,e,r)||this,n="PostProcess",o=i.renderer.engine,a=FO.create(o,{name:n,mode:xS.TRIANGLE_STRIP,attributes:{aPos:{type:xS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s={vertex:sb,fragment:fb},u=_O.create(o,{name:n,shader:s});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=zO.create(o,{name:n,geometry:a,material:u,priority:0}),i.priority=5e3,i}return tS(r,t),r.prototype.configure=function(e){this.mainTexture=e.getFrameBuffer().getColorTextures()[0],e.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(t){t.clear({colorAction:e.TextureStoreAction.clear,depthAction:e.TextureStoreAction.clear,stencilAction:e.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",Eb(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},r}(HO),vb=function(t){function r(r,i){var n=t.call(this,r,{})||this,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new XO(a);var s=FO.create(a,{name:o,mode:xS.TRIANGLE_STRIP,attributes:{aPos:{type:xS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=_O.create(a,{name:o,shader:{vertex:sb,fragment:ub,glslVersion:e.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=zO.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}return tS(r,t),r.prototype.configure=function(e){this.mainTexture=e.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),e.setFrameBuffer(null)},r.prototype.execute=function(t){t.clear({colorAction:e.TextureStoreAction.clear,depthAction:e.TextureStoreAction.clear,stencilAction:e.TextureStoreAction.clear});var r=t.renderingData.currentFrame.globalVolume,i=r.bloomIntensity,n=r.brightness,o=r.saturation,a=r.contrast,s=r.useBloom,u=r.useToneMapping;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",n),this.screenMesh.material.setFloat("_Saturation",o),this.screenMesh.material.setFloat("_Contrast",a),this.screenMesh.material.setInt("_UseBloom",s),s&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i)),this.screenMesh.material.setInt("_UseToneMapping",u),t.renderMeshes([this.screenMesh])},r}(HO),yb={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,useToneMapping:1},gb="_effects_default_",xb=1,Tb=function(){function t(t){var r;this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=t.camera,n=t.keepColorBuffer,o=t.renderer,a=t.editorTransform,s=void 0===a?[1,1,0,0]:a,u=t.globalVolume,c=t.clearAction,l=void 0===c?{colorAction:e.TextureLoadAction.whatever,stencilAction:e.TextureLoadAction.clear,depthAction:e.TextureLoadAction.whatever}:c,f=o.engine;u&&(this.globalVolume=rS(rS({},yb),u)),this.globalUniforms=new Sb;var h,p=[],d={};if(this.renderer=o,this.globalVolume){var m=this.globalVolume.useHDR?xS.HALF_FLOAT:xS.UNSIGNED_BYTE;p=[{texture:{format:xS.RGBA,type:m,magFilter:xS.LINEAR,minFilter:xS.LINEAR}}],h={storageType:e.RenderPassAttachmentStorageType.depth_stencil_opaque},d={colorAction:e.TextureLoadAction.clear,stencilAction:e.TextureLoadAction.clear,depthAction:e.TextureLoadAction.clear}}var v=[new HO(o,{name:gb,priority:GO,meshOrder:e.OrderType.ascending,depthStencilAttachment:h,attachments:p,clearAction:d})];if(this.setRenderPasses(v),this.globalVolume){var y=this.globalVolume.useBloom,g=new XO(f);if(y){var x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],T=new Array(7),E=(m=this.globalVolume.useHDR?xS.HALF_FLOAT:xS.UNSIGNED_BYTE,new pb(o,{name:"BloomThresholdPass",attachments:[{texture:{format:xS.RGBA,type:m,minFilter:xS.LINEAR,magFilter:xS.LINEAR}}]}));E.sceneTextureHandle=g,this.addRenderPass(E);for(var _=0;_<7;_++){T[_]=new XO(f);var S=new db(o,"H",{name:"GaussianDownPassH"+_,viewport:x,attachments:[{texture:{format:xS.RGBA,type:m,minFilter:xS.LINEAR,magFilter:xS.LINEAR}}]}),A=new db(o,"V",{name:"GaussianDownPassV"+_,viewport:x,attachments:[{texture:{format:xS.RGBA,type:m,minFilter:xS.LINEAR,magFilter:xS.LINEAR}}]});A.gaussianResult=T[_],this.addRenderPass(S),this.addRenderPass(A),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(_=0;_<6;_++){var R=new mb(o,{name:"GaussianUpPass"+_,viewport:x,attachments:[{texture:{format:xS.RGBA,type:m,minFilter:xS.LINEAR,magFilter:xS.LINEAR}}]});R.gaussianDownSampleResult=T[5-_],this.addRenderPass(R),x[2]*=2,x[3]*=2}}var C=void 0;C=y?new vb(o,g):new vb(o),this.addRenderPass(C)}this.semantics=new VO(t.semantics),this.clearAction=l,this.name="RenderFrame".concat(xb++);var O=v[0],b={type:xS.UNSIGNED_BYTE,format:xS.RGBA,internalFormat:xS.RGBA,wrapS:xS.MIRRORED_REPEAT,wrapT:xS.MIRRORED_REPEAT,minFilter:xS.NEAREST,magFilter:xS.NEAREST};this.emptyTexture=oO.create(f,rS({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:e.TextureSourceType.data},b)),this.transparentTexture=oO.create(f,rS({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:e.TextureSourceType.data},b)),this.camera=i,this.keepColorBuffer=n,this.renderPassInfoMap.set(O,{listStart:0,listEnd:0,renderPass:O,intermedia:!1}),this.editorTransform=s,t.clearAction||this.resetClearActions(),this.passTextureCache=new MO(f);var L=f.gpuCapability,I=L.detail,w=LO(L.level,I.readableDepthStencilTextures&&I.writableFragDepth);null===(r=this.renderer.getShaderLibrary())||void 0===r||r.addShader(w)}return Object.defineProperty(t.prototype,"editorTransform",{get:function(){return this._editorTransform},set:function(e){this._editorTransform=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderPasses",{get:function(){return this._renderPasses.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.addMeshToDefaultRenderPass=function(e){for(var t=this.renderPasses,r=this.renderPassInfoMap,i=e.priority,n=1;n<t.length;n++){var o=t[n-1],a=r.get(t[n]),s=r.get(o);if(a&&s&&(a.listStart>i&&(i>s.listEnd||1===n)))return this.addToRenderPass(o,e)}for(var u=t.length-1,c=t[u];u>=0&&!c.name.includes(gb);)c=t[--u];return this.addToRenderPass(c,e)},t.prototype.removeMeshFromDefaultRenderPass=function(t){for(var r,i,n,o=this,a=this.renderPasses,s=this.renderPassInfoMap,u=a.length-1;u>=0;u--){var c=a[u],l=s.get(c);if(l&&(l.listStart<=t.priority&&l.listEnd>=t.priority)){var f=c.meshes.indexOf(t);if(-1===f)return;var h=1===f&&c.meshes[0].name===RO;if(c.removeMesh(t),h){var p=a[u+1],d=c.meshes;l.intermedia||null===(r=l.preRenderPass)||void 0===r||r.resetColorAttachments([]);for(var m=1;m<d.length;m++)null===(i=l.preRenderPass)||void 0===i||i.addMesh(d[m]);var v=null===(n=c.attachments[0])||void 0===n?void 0:n.texture,y=v===this.resource.color_a||v===this.resource.color_b;c.dispose({meshes:e.DestroyOptions.keep,colorAttachment:y?e.RenderPassDestroyAttachmentType.keep:e.RenderPassDestroyAttachmentType.destroy,depthStencilAttachment:e.RenderPassDestroyAttachmentType.keep}),zS(a,c),this.removeRenderPass(c),s.delete(c),p&&this.updateRenderInfo(p),l.preRenderPass&&this.updateRenderInfo(l.preRenderPass),l.prePasses&&l.prePasses.forEach((function(t){if(o.removeRenderPass(t.pass),!1!==(null==t?void 0:t.destroyOptions)){t.pass.attachments.forEach((function(e){e.texture===o.resource.color_b&&e.texture===o.resource.color_a||e.texture.dispose()}));var r=rS(rS({},(null==t?void 0:t.destroyOptions)?t.destroyOptions:{}),{depthStencilAttachment:e.RenderPassDestroyAttachmentType.keep});t.pass.dispose(r)}})),this.resetRenderPassDefaultAttachment(a,Math.max(u-1,0)),1===a.length&&(a[0].resetColorAttachments([]),this.removeRenderPass(this.resource.finalCopyRP))}return this.resetClearActions()}}},t.prototype.splitDefaultRenderPassByMesh=function(t,r){var i,n,o,a=this.findMeshRenderPassIndex(t),s=this.renderPasses[a];this.createResource();var u=s.meshes.indexOf(t),c=s.meshes.slice(0,u),l=s.meshes.slice(u),f=this.renderPassInfoMap;if(!(null===(i=r.attachments)||void 0===i?void 0:i.length))throw Error("should include at least one color attachment");var h=this.renderPasses,p=h.indexOf(s);h[p-1],zS(h,s);var d=f.get(s);f.delete(s);var m=2===this.renderer.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,v=new HO(this.renderer,{name:gb+p,priority:s.priority,attachments:[{texture:{sourceType:e.TextureSourceType.framebuffer,format:xS.RGBA,name:"frame_a",minFilter:m,magFilter:m}}],clearAction:s.clearAction||{colorAction:e.TextureLoadAction.clear},storeAction:s.storeAction,depthStencilAttachment:this.resource.depthStencil,meshes:c,meshOrder:e.OrderType.ascending});l.unshift(this.createCopyMesh());var y=this.renderPasses;y[a]=v;var g=[],x=l.slice();r.prePasses&&(r.prePasses.forEach((function(e,t){e.priority=s.priority+1+t,e.setMeshes(l),g.push(e)})),y.splice.apply(y,sS([a+1,0],aS(g),!1)),x.splice(0,2));var T=this.resource.finalCopyRP;y.includes(T)||y.push(T);var E=g[g.length-1];E.initialize(this.renderer);var _=new HO(this.renderer,{name:gb+(p+1),priority:s.priority+1+((null===(n=r.prePasses)||void 0===n?void 0:n.length)||0),meshes:x,meshOrder:e.OrderType.ascending,depthStencilAttachment:this.resource.depthStencil,storeAction:r.storeAction,clearAction:{depthAction:e.TextureLoadAction.whatever,stencilAction:e.TextureLoadAction.whatever,colorAction:e.TextureLoadAction.whatever}});return y.splice(a+1+((null===(o=r.prePasses)||void 0===o?void 0:o.length)||0),0,_),this.setRenderPasses(y),this.updateRenderInfo(E),this.updateRenderInfo(v),this.updateRenderInfo(_),f.get(v).prePasses=d.prePasses,g.pop(),f.get(E).prePasses=g.map((function(e,t){return{pass:e,destroyOptions:!1}})),this.resetClearActions(),E},t.prototype.dispose=function(t){var r,i;(null==t?void 0:t.semantics)!==e.DestroyOptions.keep&&this.semantics.dispose();var n=(null==t?void 0:t.passes)?t.passes:void 0;n!==e.DestroyOptions.keep&&this._renderPasses.forEach((function(e){e.dispose(n)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null===(i=null===(r=this.resource.depthStencil)||void 0===r?void 0:r.texture)||void 0===i||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},t.prototype.resetRenderPassDefaultAttachment=function(e,t){for(var r,i,n,o=this.resource,a=o.color_a,s=o.color_b,u=t;u<e.length;u++){var c=e[u],l=null===(r=c.attachments[0])||void 0===r?void 0:r.texture;if(l&&n===l){var f=l===a?s:a;c.resetColorAttachments([f])}(l=null===(i=c.attachments[0])||void 0===i?void 0:i.texture)&&(n=l)}},t.prototype.findMeshRenderPassIndex=function(e){var t=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(gb)||!r.meshes.includes(e)||(t=i,!1)})),t},t.prototype.addToRenderPass=function(e,t){var r=this.renderPassInfoMap.get(e),i=t.priority;0===e.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),e.addMesh(t)},t.prototype.getRPAttachments=function(e,t){var r;if(1===(null==e?void 0:e.length)){var i=e[0],n=i.texture,o=i.persistent,a=n.format,s=null!==(r=null==t?void 0:t.getInitAttachments())&&void 0!==r?r:[];if(a===xS.RGBA&&!o){var u=this.resource.color_a;return 0===s.length?[{texture:u}]:[{texture:s[0].texture===u?this.resource.color_b:u}]}}return e},t.prototype.resetClearActions=function(){var t=this.renderPasses.length>1?e.TextureLoadAction.clear:e.TextureLoadAction.whatever;this.clearAction.stencilAction=t,this.clearAction.depthAction=t,this.clearAction.colorAction=t,this.keepColorBuffer&&(this.clearAction.colorAction=e.TextureLoadAction.whatever)},t.prototype.updateRenderInfo=function(t){var r,i=this,n=this.renderPassInfoMap,o=this.renderPasses;n.has(t)?r=n.get(t):(r={intermedia:!1,renderPass:t,listStart:0,listEnd:0},n.set(t,r)),r.intermedia=t.attachments.length>0;var a=t.meshes;a[0]?(r.listStart=(a[0].name===RO?a[1]:a[0]).priority,r.listEnd=a[a.length-1].priority):(r.listStart=0,r.listEnd=0);var s=o.indexOf(t),u=0===s?e.TextureLoadAction.clear:e.TextureLoadAction.whatever;return 0===s&&(t.clearAction.colorAction=e.TextureLoadAction.clear),t.clearAction.depthAction=u,t.clearAction.stencilAction=u,s>-1?t.semantics.setSemantic("EDITOR_TRANSFORM",(function(){return i.editorTransform})):t.semantics.setSemantic("EDITOR_TRANSFORM",void 0),r.preRenderPass=o[s-1],r},t.prototype.setRenderPasses=function(e){var t=this;void 0!==this.renderer&&e.forEach((function(e){return e.initialize(t.renderer)})),this._renderPasses=e.slice()},t.prototype.addRenderPass=function(e){void 0!==this.renderer&&e.initialize(this.renderer),this._renderPasses.push(e)},t.prototype.createResource=function(){var t,r=this.renderer.engine;if(!this.resource){var i=r.gpuCapability,n=i.detail,o=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?xS.LINEAR:xS.NEAREST,c=oO.create(r,{sourceType:e.TextureSourceType.framebuffer,format:xS.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=oO.create(r,{sourceType:e.TextureSourceType.framebuffer,format:xS.RGBA,data:{width:a,height:s},minFilter:u,magFilter:u,name:"frame_b"}),f=n.readableDepthStencilTextures&&n.writableFragDepth?e.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:e.RenderPassAttachmentStorageType.depth_stencil_opaque,h=new HO(this.renderer,{depthStencilAttachment:{storageType:f},attachments:[{texture:c}]}).initialize(this.renderer),p=new _b(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:e.TextureLoadAction.clear,stencilAction:e.TextureLoadAction.clear,colorAction:e.TextureLoadAction.clear},meshOrder:e.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null===(t=h.getDepthAttachment())||void 0===t?void 0:t.texture})]});this.resource={color_a:h.attachments[0].texture,color_b:l,finalCopyRP:p,depthStencil:h.depthAttachment,resRP:h}}},t.prototype.createCopyMesh=function(e){var t=RO,r=this.renderer.engine,i=FO.create(r,{name:t,mode:xS.TRIANGLE_STRIP,attributes:{aPos:{type:xS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=LO(r.gpuCapability.level,!!(null==e?void 0:e.depthTexture));this.renderer.getShaderLibrary().addShader(n);var o=_O.create(r,{uniformValues:{uDepth:null==e?void 0:e.depthTexture},name:t,shader:n});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==e?void 0:e.blend)&&(o.blending=!0,o.blendFunction=[xS.SRC_ALPHA,xS.ONE_MINUS_SRC_ALPHA,xS.SRC_ALPHA,xS.ONE_MINUS_SRC_ALPHA]),zO.create(r,{name:t,geometry:i,material:o,priority:0})},t.prototype.removeRenderPass=function(e){zS(this._renderPasses,e)},t}();function Eb(e){return e?[e.getWidth(),e.getHeight()]:[0,0]}var _b=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],e.setFrameBuffer(null)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Eb(this.prePassTexture)),e.renderMeshes(this.meshes),this.storeAction&&e.clear(this.storeAction)},t}(HO),Sb=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},Ab=function(){function e(e){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var t=e.storageType,r=e.format,i=e.attachment;this.storageType=t,this.format=r,this.attachment=i}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e}(),Rb="function"==typeof WebGL2RenderingContext,Cb=function(){function e(e){this.setupCapability(e)}return e.prototype.setupCapability=function(e){var t,r=Rb&&e instanceof WebGL2RenderingContext?2:1,i=2===r,n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=e.getExtension("WEBGL_depth_texture"),a=!!e.getExtension("OES_texture_half_float_linear"),s=!!e.getExtension("OES_texture_float_linear");this.level=r,this.type=i?"webgl2":"webgl",this.vaoExt=e.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=e.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=e.UNSIGNED_INT_24_8,this.drawBufferExtension=e.getExtension("WEBGL_draw_buffers"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),i&&!a&&(a=Ob(e,e.HALF_FLOAT)),i&&!s&&(s=Ob(e,e.FLOAT)),this.internalFormatDepth16=i?e.DEPTH_COMPONENT16:e.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=i?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL;var u=i||e.getExtension("OES_texture_float")?e.FLOAT:0,c=i?WebGL2RenderingContext.HALF_FLOAT:(null===(t=e.getExtension("OES_texture_half_float"))||void 0===t?void 0:t.HALF_FLOAT_OES)||0,l={floatTexture:u,halfFloatTexture:c,maxSample:i?e.getParameter(e.MAX_SAMPLES):1,maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:i?!!e.getExtension("EXT_color_buffer_float"):u>0&&!!e.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:i?!!e.getExtension("EXT_color_buffer_float"):c>0&&!!e.getExtension("EXT_color_buffer_half_float"),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxShaderTexCount:e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:wb(e),halfFloatLinear:a,floatLinear:s,maxTextureAnisotropy:n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:i||!!e.getExtension("EXT_shader_texture_lod"),instanceDraw:i||!!e.getExtension("ANGLE_instanced_arrays"),drawBuffers:i||!!this.drawBufferExtension,asyncShaderCompile:!!e.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!e.getExtension("OES_element_index_uint"),standardDerivatives:i||!!e.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:i||!!o,writableFragDepth:i||!!e.getExtension("EXT_frag_depth")};this.detail=l,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},e.prototype.framebufferTexture2D=function(e,t,r,i,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&r>0)throw new Error("draw multiple color buffers not available");var a=o?o["COLOR_ATTACHMENT".concat(r,"_WEBGL")]:e["COLOR_ATTACHMENT".concat(r)];a?e.framebufferTexture2D(t,a,i,n,0):console.error("invalid color attachment index: "+r)},e.prototype.drawBuffers=function(e,t){var r=this.drawBufferExtension;if(1!==this.level||r){var i=t.map((function(t,i){return t?r?r["COLOR_ATTACHMENT".concat(i,"_WEBGL")]:e["COLOR_ATTACHMENT".concat(i)]:e.NONE}));r?r.drawBuffersWEBGL(i):e.drawBuffers(i)}else if(t.length>1)throw Error("draw buffers not available")},e.prototype.setTextureAnisotropic=function(e,t,r){var i=this.detail.maxTextureAnisotropy;i&&e.texParameterf(t,this.textureMaxAnisotropyExt,Math.min(i,r||4))},e}();function Ob(e,t){var r=e.createTexture(),i=!1;return e.getError(),e.bindTexture(e.TEXTURE_2D,r),e.texImage2D(e.TEXTURE_2D,0,e.R16F,1,1,0,e.RED,t,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.getError()||(i=!0),e.deleteTexture(r),i}var bb,Lb,Ib={NONE:0,PVRTC:1,ASTC:2};function wb(e){return e.getExtension("WEBGL_compressed_texture_astc")?Ib.ASTC:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?Ib.PVRTC:Ib.NONE}e.FilterMode=void 0,(bb=e.FilterMode||(e.FilterMode={}))[bb.Nearest=0]="Nearest",bb[bb.Linear=1]="Linear",e.RenderTextureFormat=void 0,(Lb=e.RenderTextureFormat||(e.RenderTextureFormat={}))[Lb.RGBA32=0]="RGBA32",Lb[Lb.RGBAHalf=1]="RGBAHalf";var Pb=function(){function e(){}return e.prototype.resize=function(e,t,r,i){},e.prototype.resetColorTextures=function(e){},e.prototype.unbind=function(){},e.prototype.bind=function(){},Object.defineProperty(e.prototype,"stencilStorage",{get:function(){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthStorage",{get:function(){},enumerable:!1,configurable:!0}),e.prototype.getDepthTexture=function(){},e.prototype.getStencilTexture=function(){},e.prototype.getColorTextures=function(){return[]},e.prototype.dispose=function(e){},e}(),Mb=function(){function e(){}return e.prototype.setGlobalFloat=function(e,t){},e.prototype.setGlobalInt=function(e,t){},e.prototype.setGlobalMatrix=function(e,t){},e.prototype.getFrameBuffer=function(){return null},e.prototype.setFrameBuffer=function(e){},e.prototype.setViewport=function(e,t,r,i){},e.prototype.resize=function(e,t){},e.prototype.clear=function(e){},e.prototype.getWidth=function(){return 0},e.prototype.getHeight=function(){return 0},e.prototype.addLostHandler=function(e){},e.prototype.addRestoreHandler=function(e){},e.prototype.lost=function(e){},e.prototype.restore=function(){},e.prototype.getShaderLibrary=function(){},e.prototype.renderRenderFrame=function(e){},e.prototype.renderMeshes=function(e){},e.prototype.drawGeometry=function(e,t){},e.prototype.getTemporaryRT=function(e,t,r,i,n,o){return null},e.prototype.dispose=function(e){},e}(),Vb=1,Nb=function(){function t(e,t,r,i){this.transform=r,this.engine=i,this.color=e.options.previewColor;var n=this.createMaterial(t),o=this.createGeometry();this.mesh=this.createMesh(o,n),this.updateMesh()}return t.prototype.updateMesh=function(){var e=this.mesh.material,t=e.getVector2("uSize").slice(),r=e.getVector4("uPos").slice(),i=e.getVector4("uQuat").slice(),n=sS([],aS(this.transform.scale),!1);this.transform.assignWorldTRS(r,i,n),t[0]=n[0],t[1]=n[1],e.setVector2("uSize",t),e.setVector4("uPos",r),e.setVector4("uQuat",i)},t.prototype.createMaterial=function(t){var r,i=[["ENV_EDITOR",(null===(r=this.engine.renderer)||void 0===r?void 0:r.env)===dS]],n=KR(this.color).getValue(0),o=this.engine.gpuCapability.level,a={shader:{vertex:HC(i,"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",e.ShaderType.vertex,o),fragment:HC(i,"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n",e.ShaderType.fragment,o),glslVersion:e.GLSLVersion.GLSL1,cacheId:"".concat(t.cachePrefix,"_effects_interact")},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},s=_O.create(this.engine,a);return s.depthTest=!1,s.setVector4("uPos",[0,0,0,0]),s.setVector2("uSize",[1,1]),s.setVector4("uColor",[n[0]/255,n[1]/255,n[2]/255,n[3]]),s.setVector4("uQuat",[0,0,0,0]),s},t.prototype.createGeometry=function(){var e=new Uint8Array([0,1,1,2,2,3,3,0]);return FO.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:e.length,indices:{data:e},mode:xS.LINES,maxVertex:4})},t.prototype.createMesh=function(e,t){return zO.create(this.engine,{name:"Interact_preview"+Vb++,priority:0,worldMatrix:PA(),geometry:e,material:t})},t}(),Fb=function(t){function r(e,r){var i,n=t.call(this,e,r)||this;return n.engine=null===(i=n.composition)||void 0===i?void 0:i.getEngine(),n}return tS(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return wS.interact},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(e){this.ui=e.content},r.prototype.onLifetimeBegin=function(e){var t,r,i,n=this.ui.options,o=(null!==(r=null===(t=this.engine)||void 0===t?void 0:t.renderer)&&void 0!==r?r:{}).env;null===(i=this.composition)||void 0===i||i.addInteractiveItem(this,n.type),n.type===LS.DRAG&&(o!==dS||n.enableInEditor)&&e.event&&this.beginDragTarget(n,e.event)},r.prototype.onItemUpdate=function(){var e;if(null===(e=this.previewContent)||void 0===e||e.updateMesh(),this.dragEvent&&this.bouncingArg){this.bouncingArg.vx*=.95,this.bouncingArg.vy*=.95,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,Db(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg)}},r.prototype.onItemRemoved=function(e){var t;e.removeInteractiveItem(this,this.ui.options.type),this.clickable=!1,null===(t=this.previewContent)||void 0===t||t.mesh.dispose(),this.endDragTarget()},r.prototype.getBoundingBox=function(){var t=this.transform.getWorldMatrix(),r=LR([0,0,0],.5,.5);return r.forEach((function(e){e.forEach((function(e){cR(e,e,t)}))})),{type:e.HitTestType.triangle,area:r}},r.prototype.getHitTestParams=function(){if(this.clickable){var e=this.ui.options.behavior,t=this.getBoundingBox();return t?{type:t.type,triangles:t.area,behavior:e}:void 0}},r.prototype.doCreateContent=function(e){var t,r=this.ui.options,i=r.type,n=r.showPreview,o=this.engine,a=(null!==(t=null==o?void 0:o.renderer)&&void 0!==t?t:{}).env;if(rA(o),i===LS.CLICK&&(this.clickable=!0,n&&a===dS)){var s=e.getRendererOptions();this.previewContent=new Nb(this.ui,s,this.transform,o)}return{}},r.prototype.beginDragTarget=function(e,t){var r=this;if("camera"===e.target){var i,n={touchstart:function(e){var t;r.dragEvent=null,r.bouncingArg=null;var n=null===(t=r.composition)||void 0===t?void 0:t.camera;i={x:e.x,y:e.y,cameraParam:{position:(null==n?void 0:n.position)||[0,0,8],fov:(null==n?void 0:n.fov)||60}}},touchmove:function(e){r.handleDragMove(i,e),r.bouncingArg=e},touchend:function(e){var t=r.bouncingArg;if(!Db(t,3)&&t){t.vx*=5,t.vy*=5,r.dragEvent=rS({},i)}i=null}};Object.keys(n).forEach((function(e){t.addEventListener(e,n[e])})),n.touchmove({dx:0,dy:0,width:1,height:1}),this.endDragTarget=function(){Object.keys(n).forEach((function(e){t.removeEventListener(e,n[e])}))}}},r.prototype.endDragTarget=function(){},r.prototype.handleDragMove=function(e,t){var r,i;if(e&&e.cameraParam&&this.composition){var n=this.ui.options,o=e.cameraParam,a=o.position,s=o.fov,u=t.dy,c=t.dx*t.width/t.height,l=a[2],f=Math.tan(s*Math.PI/180/2)*Math.abs(l),h=u*f,p=c*f,d=a[0]-p,m=a[1]-h;if(n.dxRange){var v=aS(n.dxRange,2);(d=SA(d,y=v[0],g=v[1]))!==y&&d!==g&&y!==g&&(null===(r=t.origin)||void 0===r||r.preventDefault())}if(n.dyRange){var y,g,x=aS(n.dyRange,2);(m=SA(m,y=x[0],g=x[1]))!==y&&m!==g&&y!==g&&(null===(i=t.origin)||void 0===i||i.preventDefault())}this.composition.camera.position=[d,m,l]}},r}(EC);function Db(e,t){var r=1e-5*(t||1);return e&&Math.abs(e.vx||0)<r&&Math.abs(e.vy||0)<r}var Ub=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.mesh=[],t}return tS(t,e),t.prototype.onCompositionItemLifeBegin=function(e,t){t instanceof Fb&&t.previewContent&&this.addMesh(t.previewContent.mesh)},t.prototype.onCompositionItemRemoved=function(e,t){t instanceof Fb&&t.previewContent&&this.removeMesh(t.previewContent.mesh,e.renderFrame)},t.prototype.prepareRenderFrame=function(e,t){return this.mesh&&this.mesh.forEach((function(e){return t.addMeshToDefaultRenderPass(e)})),this.mesh=[],!1},t.prototype.addMesh=function(e){this.mesh.push(e)},t.prototype.removeMesh=function(e,t){t.removeMeshFromDefaultRenderPass(e)},t}(LC),Bb=function(){};e.maxSpriteMeshItemCount=8,e.maxSpriteTextureCount=8;var kb=1,zb=function(){function t(e,t,r){this.engine=e,this.composition=r,this.items=[],this.dirty=!1;var i=t.wireframe,n=this.createGeometry(i?xS.LINES:xS.TRIANGLES),o=this.createMaterial(t,2);this.wireframe=i,this.mesh=zO.create(e,{name:"MSprite"+kb++,priority:0,worldMatrix:PA(),geometry:n,material:o})}return t.prototype.setItems=function(t){var r,i,n,o,a=[],s=[],u=2,c=0,l=0,f=0;if(!t.length)return this.mesh.setVisible(!0),!0;this.items=t.slice(),t.length>2&&(u=e.maxSpriteMeshItemCount);var h=t[0].renderInfo;this.mtlSlotCount!==u&&this.mesh.setMaterial(this.createMaterial(h,u),{textures:e.DestroyOptions.keep});var p=null!==(o=null===(n=null===(i=null===(r=null==h?void 0:h.filter)||void 0===r?void 0:r.passSplitOptions)||void 0===i?void 0:i.attachments)||void 0===n?void 0:n.length)&&void 0!==o?o:0;this.splitLayer=p>0;for(var d=0;d<t.length;d++){(R=null==(m=t[d])?void 0:m.renderer.texture)&&kS(s,R),m.mesh=this}for(d=0;d<t.length;d++){var m,v=(R=null==(m=t[d])?void 0:m.renderer.texture)?s.indexOf(R):-1,y=this.getItemInitData(m,d,f,v);c+=y.aPoint.length,l+=y.index.length,a.push(y),f+=y.aPoint.length/6,this.updateItem(m,!0)}var g={aPoint:new Float32Array(c),index:new Uint16Array(l)},x={aPoint:0,index:0},T=function(e){var t=a[e];Object.keys(g).forEach((function(e){var r=g[e],i=t[e];r.set(i,x[e]),x[e]+=i.length}))};for(d=0;d<a.length;d++)T(d);var E=this.mesh,_=E.material,S=E.geometry,A=g.index;S.setIndexData(A),S.setAttributeData("aPoint",g.aPoint),S.setDrawCount(l),this.mesh.setVisible(!S.getDrawCount()),this.mesh.priority=t[0].listIndex;for(d=0;d<s.length;d++){var R=s[d];_.setTexture("uSampler"+d,R)}for(var C=t[0].emptyTexture,O=s.length;O<e.maxSpriteMeshItemCount;O++)_.setTexture("uSampler"+O,C);if(this.splitLayer){var b=function(e,t){var r;if(t){for(var i=128,n=new Uint8Array(i),o=0,a=i-1;o<i;o++){var s=o/a,u=t.getValue(s);n[o]=Math.round(255*u)}r=oO.createWithData(e,{width:i,height:1,data:n},{name:"feather",format:xS.LUMINANCE,minFilter:xS.LINEAR,magFilter:xS.LINEAR,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE})}else r=oO.createWithData(e);return r}(this.engine,t[0].feather);_.setTexture("uFeatherSampler",b)}},t.prototype.updateItem=function(e,t){var r=this.items.indexOf(e);if(!(r<=-1)){var i=this.mesh.material.getVector4Array("uTexParams"),n=4*r,o=e.getRenderData(e.time,t),a=this.mesh.material.getMatrixArray("uMainData"),s=16*r,u=s,c=s+4,l=s+8,f=s+12;if(o.visible){var h=[0,0,0,0],p=[1,1,1,0],d=[0,0,1,1],m=o.color||[a[f],a[f+1],a[f+2],a[f+3]];isNaN(e.getCustomOpacity())||(m[3]=e.getCustomOpacity()),o.transform.assignWorldTRS(h,d,p);for(var v=0;v<4;v++)a[u+v]=h[v],a[l+v]=d[v],a[c+v]=p[v],a[f+v]=m[v];if(p[2]=o.life,a[c+2]=o.life,t){var y=e.renderer;i[n]=y.occlusion?+y.transparentOcclusion:1,i[n+2]=y.renderMode,i[n+1]=+this.preMultiAlpha}if(o.texOffset){var g=this.mesh.material.getVector4Array("uTexOffset");for(v=0;v<4;v++)g[4*r+v]=o.texOffset[v]}}else a[c+2]=-1}},t.prototype.applyChange=function(){this.dirty&&(this.setItems(this.items),this.dirty=!1)},t.prototype.getItemInitData=function(e,t,r,i){var n=e.geoData;this.lineMode?n=this.getItemGeometryData(e,t):n||(n=e.geoData=this.getItemGeometryData(e,t));var o=n.aPoint;if(o[4]!==t||o[5]!==i)for(var a=0;a<o.length;a+=6)o[a+4]=t,o[a+5]=i;var s=n.index,u=s.length,c=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new s.constructor(u);if(!this.wireframe)for(a=0;a<u;a++)c[a]=r+s[a];return{aPoint:n.aPoint,index:c}},t.prototype.getItemRegionData=function(e){var t=this.items.indexOf(e);if(t>-1){var r=this.mesh.material.getMatrixArray("uMainData"),i=16*t;if(null===r)return;return{position:[r[i]||0,r[i+1]||0,r[i+2]||0],size:[r[i+4],r[i+5]],quat:[r[i+8],r[i+9],r[i+10],r[i+11]],color:[r[i+12],r[i+13],r[i+14],r[i+15]]}}},t.prototype.invalidMaterial=function(){this.mtlSlotCount=0},t.prototype.createGeometry=function(t){var r=Float32Array.BYTES_PER_ELEMENT;return FO.create(this.engine,{attributes:{aPoint:{size:4,offset:0,stride:uS*r,releasable:!0,type:xS.FLOAT,data:new Float32Array(0)},aIndex:{size:2,offset:4*r,stride:uS*r,dataSource:"aPoint",type:xS.FLOAT}},indices:{data:new Uint16Array(0),releasable:!0},mode:t,maxVertex:4*e.maxSpriteMeshItemCount})},t.prototype.createMaterial=function(e,t){var r,i,n,o=e.filter,a=e.side,s=e.occlusion,u=e.blending,c=e.maskMode,l=e.mask,f=(null==o?void 0:o.mesh)||{},h=this.engine,p={shader:Wb(e,t,h.gpuCapability.level,null===(n=h.renderer)||void 0===n?void 0:n.env)};this.preMultiAlpha=GC(u),this.mtlSlotCount=t;var d=_O.create(h,p),m=rS({side:a,blending:!0,blendMode:u,mask:l,maskMode:c,depthTest:!0,depthMask:s},f.materialStates);d.blending=m.blending,d.stencilRef=void 0!==m.mask?[m.mask,m.mask]:void 0,d.depthTest=m.depthTest,d.depthMask=m.depthMask,m.blending&&YC(d,m.blendMode),d.blendFunction=m.blendFunction,qC(d,m.maskMode),ZC(d,m.side);var v=f.uniformValues;if(v)try{for(var y=oS(Object.keys(v)),g=y.next();!g.done;g=y.next()){var x=g.value,T=v[x];T instanceof oO?d.setTexture(x,T):"number"==typeof T?d.setFloat(x,T):2===T.length?d.setVector2(x,T):4===T.length?d.setVector4(x,T):d.setMatrix(x,T)}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}for(var E=[],_=[],S=[],A=0;A<t;A++)E.push(PA()),_.push([0,0,0,0]),S.push([0,0,0,0]);return d.hasUniform("uMainData")||d.setMatrixArray("uMainData",E),d.hasUniform("uTexParams")||d.setVector4Array("uTexParams",_),d.hasUniform("uTexOffset")||d.setVector4Array("uTexOffset",S),d},t.prototype.getItemGeometryData=function(e,t){var r=e.splits,i=e.renderer,n=e.textureSheetAnimation,o=aS(e.startSize,2),a=o[0],s=o[1];if(i.shape){for(var u=i.shape,c=u.index,l=u.aPoint,f=new Float32Array(l),h=0;h<f.length;h+=6)f[h]*=a,f[h+1]*=s;return{index:c,aPoint:Array.from(f)}}var p=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],d=[],m=[],v=2,y=2;1===r.length&&(v=1,y=1);for(var g=0;g<v;g++)for(var x=0;x<y;x++){var T=4*(2*x+g),E=n?[0,0,1,1,r[0][4]]:r[2*x+g],_=E[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],S=((g+g+1)/v-1)/2,A=((x+x+1)/y-1)/2,R=E[0],C=E[1],O=E[4]?E[3]:E[2],b=E[4]?E[2]:E[3],L=[p[0]/v+S,p[1]/y+A,p[2]/v+S,p[3]/y+A,p[4]/v+S,p[5]/y+A,p[6]/v+S,p[7]/y+A];d.push(L[0]*a,L[1]*s,_[0]*O+R,_[1]*b+C,t,0,L[2]*a,L[3]*s,_[2]*O+R,_[3]*b+C,t,0,L[4]*a,L[5]*s,_[4]*O+R,_[5]*b+C,t,0,L[6]*a,L[7]*s,_[6]*O+R,_[7]*b+C,t,0),this.lineMode?m.push(T,1+T,1+T,3+T,3+T,2+T,2+T,T):m.push(T,1+T,2+T,2+T,1+T,3+T)}return{index:m,aPoint:d}},t}();function Gb(e){var t,r=e.renderer,i=e.filter,n=r.blending,o=r.side,a=r.occlusion,s=r.mask,u=r.maskMode,c=r.order,l=+n,f=e.cachePrefix||"-",h=(null===(t=null==i?void 0:i.mesh)||void 0===t?void 0:t.shaderCacheId)||"$F$";return{side:o,occlusion:a,blending:n,mask:s,maskMode:u,cachePrefix:f,filter:i,cacheId:"".concat(f,".").concat(h,".").concat(+o,"+").concat(+a,"+").concat(l,"+").concat(c,"+").concat(u,".").concat(s)}}function jb(t,r,i){var n=null!=i?i:{},o=n.count,a=void 0===o?2:o,s=n.env,u=void 0===s?"":s,c=n.ignoreBlend,l=n.wireframe,f=[["MAX_ITEM_COUNT",a],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",u===dS],["ADJUST_LAYER",!!r],["USE_BLEND",!c],["MAX_FRAG_TEX",e.maxSpriteTextureCount>=16?16:8]],h=l?YO:qO.replace(/#pragma\s+FILTER_FRAG/,(null==r?void 0:r.fragment)||""),p=ZO.replace(/#pragma\s+FILTER_VERT/,(null==r?void 0:r.vertex)||"vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}");return{fragment:HC(f,h,e.ShaderType.fragment,t),vertex:HC(f,p,e.ShaderType.vertex,t),glslVersion:1===t?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,marcos:f,shared:!0}}function Xb(e,t){return e.filter?"".concat(e.filter.mesh.shaderCacheId,"_effects_filter"):"".concat(e.cachePrefix,"_effects_sprite_").concat(t)}function Wb(e,t,r,i){var n=e.filter,o=e.wireframe,a=jb(r,null==n?void 0:n.mesh,{count:t,wireframe:o,env:i});return a.shared=!0,o||(a.cacheId=Xb(e,t)),a}function Hb(t){e.maxSpriteMeshItemCount=t}var Yb="listIndex",Zb=function(){function t(e){this.composition=e,this.meshSplits=[],this.items=[],this.meshes=[],this.time=0,this.itemsToRemove=[],this.itemsToAdd=[],this.engine=e.getEngine()}return t.prototype.resetMeshSplits=function(){this.meshSplits.length=0,this.meshes.length=0,this.items.length=0,this.itemsToAdd.length=0,this.itemsToRemove.length=0},t.prototype.diffMeshSplits=function(){for(var t,r,i,n,o,a,s=this.meshSplits,u=this.itemsToRemove,c=this.itemsToAdd,l=[],f=[],h=[],p=[],d=this.items,m={layerToAdd:[]},v=[],y=0;y<u.length;y++){if(qb(T=u[y]))l.push.apply(l,sS([],aS(this.removeMeshSplitsItem(d,T,s,u)),!1)),this.check();else{var g=d.indexOf(T);g>-1&&(d.splice(g,1),v.length=0,g>0&&(v=this.combineSplits(d,g-1,s),l.push.apply(l,sS([],aS(v),!1))),!v.length&&g<=d.length-1&&(v=this.combineSplits(d,g,s),l.push.apply(l,sS([],aS(v),!1))),this.check())}}var x=!1;for(y=0;y<c.length;y++)for(var T=c[y],E=this.addMeshSplitsItem(d,T,s),_=0;_<E.length;_++){var S=E[_];if(S.spriteMesh)throw new Error("no sprite mesh in neo split");var A=S.spriteMesh=new zb(this.engine,S.renderInfo,this.composition);f.push(A.mesh),A.setItems(S.items.map((function(e){return e.content}))),A.applyChange(),A.splitLayer&&(null===(t=m.layerToAdd)||void 0===t||t.push(A)),S.dirty=!1,this.check(),x=!0}if(x){var R,C=function(t){var u=s[t],c=s[t+1];if(c.cacheId===u.cacheId&&!(null===(r=c.spriteMesh)||void 0===r?void 0:r.splitLayer)&&!(null===(i=u.spriteMesh)||void 0===i?void 0:i.splitLayer)&&u.items.length+c.items.length<=e.maxSpriteMeshItemCount){var l=u.items[0],p=c.items[c.items.length-1],m=O.getMeshSplits(d,d.indexOf(l),d.indexOf(p));if(1===m.length){Object.keys(m[0]).forEach((function(e){u[e]=m[0][e]})),null===(n=u.spriteMesh)||void 0===n||n.setItems(u.items.map((function(e){return e.content}))),null===(o=u.spriteMesh)||void 0===o||o.applyChange();var v=null===(a=c.spriteMesh)||void 0===a?void 0:a.mesh;u.spriteMesh&&u.spriteMesh.mesh&&(u.spriteMesh.mesh.priority=c.indexEnd),f.includes(v)?zS(f,v):kS(h,v),s.splice(t+1,1),t--}}R=t},O=this;for(y=0;y<s.length-1;y++)C(y),y=R}u.length=0;for(y=0;y<s.length;y++){var b=(I=s[y]).spriteMesh;if(0===I.items.length)throw new Error("split not combined");if(I.dirty){var L=I.indexStart;b.mesh.priority!==L&&(b.mesh.priority=L,p.push(b.mesh)),b.setItems(I.items.map((function(e){return e.content})))}b.applyChange(),I.dirty=!1}if(l.length)for(y=0;y<l.length;y++){var I,w=(A=(I=l[y]).spriteMesh).mesh;w.dispose({material:{textures:e.DestroyOptions.keep}}),h.push(w)}if(this.itemsToRemove.length=0,this.itemsToAdd.length=0,f.length+h.length+p.length){var P=this.meshes;return this.meshSplits.forEach((function(e,t){return P[t]=e.spriteMesh.mesh})),P.length=this.meshSplits.length,{add:f.length?f:void 0,remove:h.length?h:void 0,modify:p.length?p:void 0,layer:m.layerToAdd.length>0?m:void 0}}},t.prototype.addItem=function(e){this.items.includes(e)?zS(this.itemsToRemove,e):kS(this.itemsToAdd,e)},t.prototype.removeItem=function(e){this.items.includes(e)?qb(e)?this.itemsToRemove.unshift(e):this.itemsToRemove.push(e):zS(this.itemsToAdd,e)},t.prototype.getSpriteMesh=function(e){for(var t=this.meshSplits,r=0;r<t.length;r++){var i=t[r].spriteMesh;if(i.items.indexOf(e)>-1)return i}},t.prototype.onUpdate=function(e){for(var t=this.meshSplits,r=0;r<t.length;r++){for(var i=t[r].spriteMesh,n=i.items,o=0;o<n.length;o++){var a=n[o];a.ended||i.updateItem(a)}i.applyChange()}},t.prototype.dispose=function(){this.meshSplits.forEach((function(e){var t;null===(t=e.spriteMesh)||void 0===t||t.mesh.dispose()}))},t.prototype.check=function(){},t.prototype.addMeshSplitsItem=function(e,t,r){if(-1!==e.indexOf(t))throw Error("item has been added");if(!r[0]){if(GS(e,t,Yb),qb(t)){var i=t.createContent(),n={indexStart:t.listIndex,indexEnd:t.listIndex,items:[t],renderInfo:i.renderInfo,cacheId:i.renderInfo.cacheId,textures:[t.content.renderer.texture]};return r.unshift(n),[n]}return[]}for(var o=function(i){var n=r[i],o=t.listIndex;if(qb(t)){if(o<=n.indexEnd){GS(e,t,Yb);var s=e.indexOf(t),u=Math.min(s,e.indexOf(n.items[0])),c=Math.max(s,e.indexOf(n.items[n.items.length-1])),l=a.getMeshSplits(e,u,c),f=l.findIndex((function(e){return e.items.includes(t)}));if(2===l.length)return r.splice(i+f,0,l[f]),Object.keys(l[1-f]).forEach((function(e){n[e]=l[1-f][e]})),{value:[l[f]]};if(3===l.length){if(Object.keys(l[0]).forEach((function(e){n[e]=l[0][e]})),r.splice(i+1,0,l[1],l[2]),1!==f)throw Error("neo split not in middle");return{value:[l[1],l[2]]}}if(1!==l.length)throw Error("invalid splits 1");return Object.keys(l[0]).forEach((function(e){n[e]=l[0][e]})),{value:[]}}}else{if(o<n.indexStart||o===n.indexEnd)return GS(e,t,Yb),{value:[]};if(o<n.indexEnd){GS(e,t,Yb);var h=n.items[n.items.length-1],p=e.indexOf(h),d=a.getMeshSplits(e,e.indexOf(n.items[0]),p);if(Object.keys(d[0]).forEach((function(e){n[e]=d[0][e]})),2===d.length)return r.splice(i+1,0,d[1]),{value:[d[1]]};if(1!==d.length)throw Error("invalid splits 2")}}},a=this,s=0;s<r.length;s++){var u=o(s);if("object"==typeof u)return u.value}if(GS(e,t,Yb),qb(t)){var c=r[r.length-1],l=this.getMeshSplits(e,e.indexOf(c.items[0]),e.indexOf(t));if(Object.keys(l[0]).forEach((function(e){c[e]=l[0][e]})),2===l.length)return r.push(l[1]),[l[1]];if(1!==l.length)throw Error("invalid splits 3")}return[]},t.prototype.removeMeshSplitsItem=function(e,t,r,i){for(var n,o,a=null,s=-1,u=[],c=0;c<r.length;c++){var l=r[c];if(l.indexStart<=t.listIndex&&l.indexEnd>=t.listIndex){a=l,s=c;break}}if(a){var f=a.items.indexOf(t);if(f<0){if(null==i?void 0:i.includes(t))return[];throw Error("item not found")}if(a.items.splice(f,1),a.dirty=!0,zS(e,t),0===a.items.length){if(zS(r,a),u.push(a),a=r[s-=1],!r.length||s<0)return u}else a.indexEnd=a.items[a.items.length-1].listIndex,a.indexStart=a.items[0].listIndex;if(0===s||s===r.length-2){var h=r[s],p=r[s+1];if(h&&p){var d=h.items[0],m=p.items[p.items.length-1];1===(v=this.getMeshSplits(e,e.indexOf(d),e.indexOf(m))).length&&(v[0].spriteMesh=r[s].spriteMesh,null===(n=v[0].spriteMesh)||void 0===n||n.invalidMaterial(),r[s]=v[0],u.push(r.splice(s+1,1)[0]))}}else if(s===r.length-1)if(0===a.items.length)u.push(r.splice(s,1)[0]);else{h=r[s-1],p=r[s],d=h.items[0],m=p.items[p.items.length-1];1===(v=this.getMeshSplits(e,e.indexOf(d),e.indexOf(m))).length&&(v[0].spriteMesh=r[s-1].spriteMesh,null===(o=v[0].spriteMesh)||void 0===o||o.invalidMaterial(),r[s-1]=v[0],u.push(r.splice(s,1)[0]))}else{var v;h=r[s-1],p=r[s+1],d=h.items[0],m=p.items[p.items.length-1];2===(v=this.getMeshSplits(e,e.indexOf(d),e.indexOf(m))).length&&(v[0].spriteMesh=r[s].spriteMesh,v[1].spriteMesh=r[s+1].spriteMesh,r[s]=v[0],r[s+1]=v[1],u.push(r.splice(s-1,1)[0]))}}return u},t.prototype.combineSplits=function(e,t,r){var i=e[t],n=[];if(qb(i)&&i.composition){for(var o=void 0,a=0;a<r.length;a++){if(r[a].items.includes(i)){o=a;break}}var s=void 0,u=void 0;if(0===o?(s=r[o],u=r[o+1]):(s=r[o-1],u=r[o]),s&&u){var c=e.indexOf(s.items[0]),l=e.indexOf(u.items[u.items.length-1]);if(Number.isInteger(c)&&Number.isInteger(l)){var f=this.getMeshSplits(e,c,l);1===f.length&&(f[0].spriteMesh=r[o].spriteMesh,0===o?(r[0]=f[0],n.push(r.splice(1,1)[0])):(n.push(r.splice(o-1,1)[0]),r[o-1]=f[0]))}}}return n},t.prototype.getMeshSplits=function(t,r,i,n){void 0===r&&(r=0),void 0===i&&(i=t.length-1);for(var o=null,a=[],s=r;s<=i;s++){var u=t[s];if(n||u.started&&!(u.lifetime<0))if(qb(u)){var c=u.createContent().renderInfo.cacheId,l=u.content.renderer.texture,f=!0;if(o){var h=o.textures.includes(l)?0:1;o.cacheId===c&&u.type===wS.sprite&&o.items.length<e.maxSpriteMeshItemCount&&h+o.textures.length<=e.maxSpriteTextureCount?(GS(o.items,u,Yb),kS(o.textures,l),f=!1):a.push(o)}f&&(o={indexStart:u.listIndex,cacheId:c,renderInfo:u.content.renderInfo,items:[u],textures:[l]})}else{if(n&&!u.contentVisible)continue;o&&(a.push(o),o=null)}}return o&&a.push(o),a.forEach((function(e){e.indexEnd=e.items[e.items.length-1].listIndex,e.dirty=!0})),a},t}();function qb(e){var t=e.type;return t===wS.sprite||t===wS.filter}var Kb={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},Qb=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="sprite",e}return tS(r,t),r.precompile=function(t,r,i){var n,o=r.getShaderLibrary(),a=r.engine.gpuCapability,s=a.level,u=a.detail,c=(null!=i?i:{}).env;if(!o.shaderResults[Xb(Kb,2)]){o.addShader(Wb(Kb,2,s,c)),o.addShader(Wb(Kb,e.maxSpriteMeshItemCount,s,c));var l=!1;null===(n=t[0])||void 0===n||n.items.forEach((function(e){e.type===wS.filter&&e.content.filter&&(l=!0,US(e.content.filter).forEach((function(e){if(!e.isParticle){var t=jb(s,e,e);e.shaderCacheId&&(t.cacheId="".concat(e.shaderCacheId,"_effects_filter")),o.addShader(t)}})))})),l&&o.addShader(LO(s,!1)),u.writableFragDepth&&o.addShader(LO(s,!0))}return Promise.resolve()},r.prototype.onCompositionDestroyed=function(e){e.loaderData.spriteGroup.dispose()},r.prototype.onCompositionReset=function(e,t){var r=new Zb(e);e.loaderData.spriteGroup=r,r.resetMeshSplits()},r.prototype.onCompositionItemLifeBegin=function(e,t){var r=e.loaderData.spriteGroup;t.type!==wS.composition&&r.addItem(t)},r.prototype.onCompositionItemRemoved=function(e,t){e.loaderData.spriteGroup.removeItem(t)},r.prototype.onCompositionUpdate=function(e,t){e.loaderData.spriteGroup.onUpdate(t)},r.prototype.prepareRenderFrame=function(e,t){var r,i,n,o=e.loaderData.spriteGroup.diffMeshSplits();return!!o&&(null===(r=o.remove)||void 0===r||r.forEach((function(e){return t.removeMeshFromDefaultRenderPass(e)})),null===(i=o.add)||void 0===i||i.forEach((function(e){return t.addMeshToDefaultRenderPass(e)})),null===(n=o.modify)||void 0===n||n.forEach((function(e){t.removeMeshFromDefaultRenderPass(e),t.addMeshToDefaultRenderPass(e)})),!!(this.layerInfo=o.layer))},r.prototype.postProcessFrame=function(e,t){var r,i;null===(i=null===(r=this.layerInfo)||void 0===r?void 0:r.layerToAdd)||void 0===i||i.forEach((function(e){var r=e.items[0].filter;if(void 0!==r){var i=r.passSplitOptions,n=t.splitDefaultRenderPassByMesh(e.mesh,i);r.renderPassDelegate&&(n.delegate=r.renderPassDelegate),r.onRenderPassCreated&&r.onRenderPassCreated(n,t)}})),this.layerInfo=void 0},r}(LC),Jb=[0,0,0],$b=[1,1,1],eL=[0,0,0],tL=function(){function e(e,t){var r;this.active=!1,this.transform=t.transform;var i=this.transform.scale;this.basicTransform={position:sS([],aS(this.transform.position),!1),rotation:sS([],aS(this.transform.getRotation()),!1),scale:[i[0],i[1],i[0]]};var n=e.rotationOverLifetime,o=e.sizeOverLifetime,a=e.positionOverLifetime,s=void 0===a?{}:a;if(s){s.path&&(this.basicTransform.path=KR(s.path));var u=s.linearX||s.linearY||s.linearZ;u&&(this.linearVelOverLifetime={x:s.linearX&&KR(s.linearX),y:s.linearY&&KR(s.linearY),z:s.linearZ&&KR(s.linearZ),asMovement:s.asMovement,enabled:!!u});var c=s.orbitalX||s.orbitalY||s.orbitalZ;c&&(this.orbitalVelOverLifetime={x:s.orbitalX&&KR(s.orbitalX),y:s.orbitalY&&KR(s.orbitalY),z:s.orbitalZ&&KR(s.orbitalZ),center:$A(s.orbCenter),asRotation:s.asRotation,enabled:!!c}),this.speedOverLifetime=s.speedOverLifetime&&KR(s.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=KR(o.x||1),this.sizeYOverLifetime=KR(o.y||1),this.sizeZOverLifetime=KR(o.z||1)):this.sizeXOverLifetime=KR(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:KR(n.z||0)},n.separateAxes)){var l=this.rotationOverLifetime;l.x=KR(n.x||0),l.y=KR(n.y||0)}this.options={reusable:!!t.reusable,delay:t.delay||0,startSpeed:s.startSpeed||0,startSize:i&&i[0]||1,sizeAspect:i&&i[0]/(i[1]||1)||1,duration:t.duration||0,looping:t.endBehavior&&t.endBehavior===sA.loop,endBehavior:t.endBehavior||0,gravity:$A(s.gravity),gravityModifier:KR(null!==(r=s.gravityOverLifetime)&&void 0!==r?r:0),direction:s.direction?iR([],s.direction):$A()},this.id=t.id,this.time=0,this.name=t.name,this.visible=t.getVisible()}return Object.defineProperty(e.prototype,"ended",{get:function(){return this.time>this.options.duration&&!this.options.looping&&!this.options.reusable},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"startSize",{get:function(){return this.basicTransform.scale},set:function(e){this.basicTransform.scale=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"velocity",{get:function(){return this._velocity||(this._velocity=nR([],this.options.direction,this.options.startSpeed)),this._velocity},enumerable:!1,configurable:!0}),e.prototype.getWillTranslate=function(){return!!(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled||this.orbitalVelOverLifetime&&this.orbitalVelOverLifetime.enabled||this.options.gravityModifier&&!JA(this.options.gravity)||this.options.startSpeed&&!JA(this.options.direction))},e.prototype.updateTime=function(e){var t=e-this.options.delay,r=this.options.duration;if(t>=r&&this.options.looping){for(var i=t-r;i>r;)i-=r;this.time=i}else{var n=4===this.options.endBehavior;this.time=n?Math.min(r,t):t}},e.prototype.getRenderData=function(e,t){var r=this.options,i=KA($b,1),n=KA(Jb,0),o=!1,a=!1,s=e<0?e:Math.max(e,0),u=r.duration,c=s/u,l={life:c,transform:this.transform};c=c<0?0:c>1?1:c,this.sizeXOverLifetime&&(i[0]=this.sizeXOverLifetime.getValue(c),this.sizeSeparateAxes?(i[1]=this.sizeYOverLifetime.getValue(c),i[2]=this.sizeZOverLifetime.getValue(c)):i[2]=i[1]=i[0],o=!0),this.calculateScaling(o,i,t);var f,h=this.rotationOverLifetime;if(h){var p=function(e){return h.asRotation?e.getValue(c):e.getIntegrateValue(0,c,u)},d=p(h.z),m=h.separateAxes;n[0]=m?p(h.x):0,n[1]=m?p(h.y):0,n[2]=d,a=!0}if(a||t){var v=qA(Jb,this.basicTransform.rotation,n);l.transform.setRotation(v[0],v[1],v[2])}return(this.getWillTranslate()||t)&&FR(f=[0,0,0],this,this.options.gravity,s,u,this.basicTransform.position,this.velocity),this.basicTransform.path&&(f||(f=tR(eL,this.basicTransform.position,3)),qA(f,f,this.basicTransform.path.getValue(c))),f&&this.transform.setPosition(f[0],f[1],f[2]),l.active=this.active,l},e.prototype.calculateScaling=function(e,t,r){this.transform.setScale(t[0]*this.startSize[0],t[1]*this.startSize[1],t[2]*this.startSize[2])},e}(),rL=[[0,0,1,1,void 0]],iL=[1,1,1,1],nL=function(e){function t(t,r,i){var n,o,a,s,u,c,l,f,h=e.call(this,t,i)||this;h.startColor=[1,1,1,1];var p=t.interaction,d=t.renderer,m=t.options,v=t.listIndex,y=void 0===v?0:v,g=r.emptyTexture,x=i.transform.scale;h.options=rS(rS({},h.options),{startColor:m.startColor||[1,1,1,1]}),h.interaction=p,h.renderer={renderMode:null!==(n=d.renderMode)&&void 0!==n?n:PS.BILLBOARD,blending:null!==(o=d.blending)&&void 0!==o?o:AS.ALPHA,texture:h.initTexture(d.texture,g),occlusion:!!d.occlusion,transparentOcclusion:!!d.transparentOcclusion||d.maskMode===CS.MASK,side:null!==(a=d.side)&&void 0!==a?a:RS.DOUBLE,shape:d.shape,mask:null!==(s=d.mask)&&void 0!==s?s:0,maskMode:null!==(u=d.maskMode)&&void 0!==u?u:CS.NONE,order:y};var T=RA(d.anchor,d.particleOrigin);d.anchor||void 0===d.particleOrigin||qA(h.basicTransform.position,h.basicTransform.position,[-T[0]*x[0],-T[1]*x[1],0]),h.transform.setAnchor(T[0]*x[0],T[1]*x[1],0);var E=t.colorOverLifetime;return E&&(h.opacityOverLifetime=KR(null!==(c=E.opacity)&&void 0!==c?c:1),E.color&&E.color[0]===oA.GRADIENT_COLOR&&(h.colorOverLifetime=HS(E.color[1]))),(null===(l=t.filter)||void 0===l?void 0:l.feather)&&1!==(null===(f=t.filter)||void 0===f?void 0:f.feather)&&(h.feather=KR(t.filter.feather)),h.emptyTexture=g,h.splits=t.splits||rL,h.listIndex=i.listIndex||0,h.textureSheetAnimation=t.textureSheetAnimation,h.cachePrefix="-",h.parentId=i.parentId,h.reusable=i.reusable,h._renderInfo=Gb(h),h}return tS(t,e),Object.defineProperty(t.prototype,"filter",{get:function(){return this._filter},set:function(e){this._filter=e,this._renderInfo.filter=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderInfo",{get:function(){return this._renderInfo},enumerable:!1,configurable:!0}),t.prototype.initTexture=function(e,t){return null!=e?e:t},t.prototype.getTextures=function(){var e=[],t=this.renderer.texture;return t&&e.push(t),e},t.prototype.setColor=function(e,t,r,i){this.customColor=[e,t,r,i]},t.prototype.setOpacity=function(e){this.customOpacity=e},t.prototype.getCustomOpacity=function(){return this.customOpacity},t.prototype.getRenderData=function(t,r){var i,n=e.prototype.getRenderData.call(this,t,r),o=KA(iL,1),a=t<0?t:Math.max(t,0),s=this.options.duration,u=a/s<0?0:a/s>1?1:a/s;if(this.customColor)n.color=this.customColor;else{var c=this.opacityOverLifetime,l=this.colorOverLifetime;l&&(o=WS(l,u,!0),i=!0),c&&(o[3]*=c.getValue(u),i=!0),(i||r)&&(n.color=rR(this.startColor,o,this.options.startColor))}var f=this.textureSheetAnimation;if(f){var h=f.total||f.row*f.col,p=0,d=0,m=1,v=1,y=void 0;if(this.splits){var g=this.splits[0];y=g[4],p=g[0],d=g[1],y?(m=g[3],v=g[2]):(m=g[2],v=g[3])}var x=void 0,T=void 0;y?(x=1/f.row*m,T=1/f.col*v):(x=1/f.col*m,T=1/f.row*v);var E=void 0;if(f.animate){var _=Math.round(u*(h-1)),S=Math.floor(_/f.col),A=_-S*f.col;E=y?[x*S,T*(f.col-A)]:[x*A,T*(1+S)]}else E=[0,T];n.texOffset=[p+E[0],v+d-E[1],x,T]}else r&&(n.texOffset=[0,0,1,1]);return n.visible=this.visible,n.startSize=this.startSize,n},t.prototype.calculateScaling=function(e,t,r){(e||r)&&this.transform.setScale(t[0],t[1],t[2])},t}(tL),oL=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return tS(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return wS.sprite},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(e){this.sprite=e.content},r.prototype.onLifetimeBegin=function(e,t){this._contentVisible=!0,t.active=!0},r.prototype.onItemRemoved=function(e,t){this._contentVisible=!1,t&&(delete t.mesh,e.destroyTextures(t.getTextures()))},r.prototype.handleVisibleChanged=function(e){this.content&&(this.content.visible=e)},r.prototype.onItemUpdate=function(e,t){var r;null===(r=this.content)||void 0===r||r.updateTime(this.time)},r.prototype.getCurrentPosition=function(){var e=[0,0,0];return this.transform.assignWorldTRS(e),e},r.prototype.setColor=function(e,t,r,i){this.content.setColor(e,t,r,i)},r.prototype.setOpacity=function(e){this.content.setOpacity(e)},r.prototype.getBoundingBox=function(){var t=this.content;if(t&&this.transform){var r=this.transform.getWorldMatrix(),i=t.startSize,n=LR([0,0,0],i[0]/2,i[1]/2);return n.forEach((function(e){e.forEach((function(e){cR(e,e,r)}))})),{type:e.HitTestType.triangle,area:n}}},r.prototype.getHitTestParams=function(e){var t,r,i=this.content,n=null===(t=this.composition)||void 0===t?void 0:t.loaderData.spriteGroup,o=i&&i.interaction;if((e||o)&&n&&i){var a=this.getBoundingBox();if(a)return{behavior:(null===(r=i.interaction)||void 0===r?void 0:r.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===RS.FRONT}}},r.prototype.getRenderData=function(){return this.content.getRenderData(this.content.time)},r.prototype.doCreateContent=function(e){var t=e.getRendererOptions().emptyTexture;return new nL(this.sprite,{emptyTexture:t},this)},r.prototype.createWireframeMesh=function(e,t){var r=new zb(this.composition.getEngine(),rS({wireframe:!0},e.renderInfo),this.composition);return r.setItems([e]),r.mesh.material.setVector3("uFrameColor",[t[0],t[1],t[2]]),r.mesh.priority=999,r},r}(EC),aL=1,sL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return wS.filter},enumerable:!1,configurable:!0}),t.prototype.onConstructed=function(t){e.prototype.onConstructed.call(this,t),this.filterOptions=t.content.filter,this.cachePrefix="filter:"+aL++,this.sprite.renderer.texture=this.composition.renderFrame.transparentTexture},t.prototype.onItemUpdate=function(t,r){var i,n,o,a,s;e.prototype.onItemUpdate.call(this,t,r);var u=null===(o=this._content)||void 0===o?void 0:o.mesh;if(u){var c=this.filter.mesh.variables;if(c){var l=u.mesh.material;try{for(var f=oS(Object.keys(c)),h=f.next();!h.done;h=f.next()){var p=h.value,d=c[p](r);d.length>4?l.setMatrix(p,d):l.setVector4(p,d)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(n=f.return)&&n.call(f)}finally{if(i)throw i.error}}}}null===(s=(a=this.filter).onItemUpdate)||void 0===s||s.call(a,t,this)},t.prototype.onItemRemoved=function(t,r){var i,n;null===(n=(i=this.filter).onItemRemoved)||void 0===n||n.call(i,this),e.prototype.onItemRemoved.call(this,t,r)},t.prototype.doCreateContent=function(t){var r,i=e.prototype.doCreateContent.call(this,t),n=BS(this.filterOptions,t);this.filter=n,i.renderInfo.filter=n,i.filter=n,i.renderInfo.cacheId=i.renderInfo.cacheId.replace("$F$",null!==(r=n.mesh.shaderCacheId)&&void 0!==r?r:"");var o=n.mesh.variables;return n.mesh.uniformValues||(n.mesh.uniformValues={}),o&&Object.keys(o).forEach((function(e){var t=o[e];n.mesh.uniformValues[e]=t(0)})),i},t}(oL),uL=function(){function t(t,r){var i,n,o,a;this.particleCount=0;var s=r.composition.getEngine(),u=(null!==(i=s.renderer)&&void 0!==i?i:{}).env,c=t.speedOverLifetime,l=t.colorOverLifetime,f=t.linearVelOverLifetime,h=t.orbitalVelOverLifetime,p=t.sizeOverLifetime,d=t.rotationOverLifetime,m=t.sprite,v=t.gravityModifier,y=t.maxCount,g=t.duration,x=t.textureFlip,T=t.useSprite,E=t.name,_=t.filter,S=t.gravity,A=t.forceTarget,R=t.side,C=t.occlusion,O=t.anchor,b=t.blending,L=t.maskMode,I=t.mask,w=t.transparentOcclusion,P=t.listIndex,M=t.meshSlots,V=t.renderMode,N=void 0===V?0:V;t.matrix;var F,D,U=t.diffuse,B=void 0===U?oO.createWithData(s):U,k=s.gpuCapability.detail,z=k.halfFloatTexture,G=k.maxVertexUniforms,j=[["RENDER_MODE",+N],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",u===dS]],X=s.gpuCapability.level,W={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},H={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},Y=G>0,Z={},q=0,K=0;if(this.useSprite=T,Y&&j.push(["ENABLE_VERTEX_TEXTURE",!0]),c&&(j.push(["SPEED_OVER_LIFETIME",!0]),K|=2,Z.uSpeedLifetimeValue=c.toUniform(W)),(null==m?void 0:m.animate)&&(j.push(["USE_SPRITE",!0]),K|=4,Z.uFSprite=Z.uSprite=new Float32Array([m.col,m.row,m.total,m.blend?1:0]),this.useSprite=!0),_&&_.name!==mS){j.push(["USE_FILTER",!0]),K|=8;var Q=BS(_,r.composition);if(!Q.particle)throw new Error("particle filter ".concat(_.name," not implement"));F=Q.particle,Object.keys(null!==(n=F.uniforms)&&void 0!==n?n:{}).forEach((function(e){var t,r=null===(t=F.uniforms)||void 0===t?void 0:t[e];if(Z[e])throw new Error("conflict uniform name:"+e);Z[e]=null==r?void 0:r.toUniform(W)})),Object.keys(null!==(o=F.uniformValues)&&void 0!==o?o:{}).forEach((function(e){var t,r=null===(t=F.uniformValues)||void 0===t?void 0:t[e];if(Z[e])throw new Error("conflict uniform name:"+e);Z[e]=r}))}(null==l?void 0:l.color)&&(j.push(["COLOR_OVER_LIFETIME",!0]),K|=16,Z.uColorOverLifetime=l.color instanceof oO?l.color:oO.createWithData(s,QS(l.color))),(null==l?void 0:l.opacity)?Z.uOpacityOverLifetimeValue=l.opacity.toUniform(W):Z.uOpacityOverLifetimeValue=KR(1).toUniform(W),["x","y","z"].forEach((function(e,t){var r=0,i=0;(null==f?void 0:f[e])&&(Z["uLinear".concat(e.toUpperCase(),"ByLifetimeValue")]=f[e].toUniform(W),r=1,K|=1<<7+t,f.enabled=!0),j.push(["LINEAR_VEL_".concat(e.toUpperCase()),r]),(null==h?void 0:h[e])&&(Z["uOrb".concat(e.toUpperCase(),"ByLifetimeValue")]=h[e].toUniform(W),i=1,K|=1<<10+t,D=!0,h.enabled=!0),j.push(["ORB_VEL_".concat(e.toUpperCase()),i])})),(null==f?void 0:f.asMovement)&&(j.push(["AS_LINEAR_MOVEMENT",!0]),K|=32),D&&((null==h?void 0:h.asRotation)&&(j.push(["AS_ORBITAL_MOVEMENT",!0]),K|=64),Z.uOrbCenter=new Float32Array((null==h?void 0:h.center)||[0,0,0])),Z.uSizeByLifetimeValue=null==p?void 0:p.x.toUniform(W),(null==p?void 0:p.separateAxes)&&(j.push(["SIZE_Y_BY_LIFE",1]),K|=16384,Z.uSizeYByLifetimeValue=null===(a=null==p?void 0:p.y)||void 0===a?void 0:a.toUniform(W)),(null==d?void 0:d.z)&&(Z.uRZByLifeTimeValue=d.z.toUniform(W),K|=32768,j.push(["ROT_Z_LIFETIME",1])),(null==d?void 0:d.x)&&(Z.uRXByLifeTimeValue=d.x.toUniform(W),K|=65536,j.push(["ROT_X_LIFETIME",1])),(null==d?void 0:d.y)&&(Z.uRYByLifeTimeValue=d.y.toUniform(W),K|=1<<17,j.push(["ROT_Y_LIFETIME",1])),(null==d?void 0:d.asRotation)&&(j.push(["ROT_LIFETIME_AS_MOVEMENT",1]),K|=1<<18),Z.uGravityModifierValue=v.toUniform(W),A&&(j.push(["FINAL_TARGET",!0]),K|=1<<19,Z.uFinalTarget=new Float32Array(A.target||[0,0,0]),Z.uForceCurve=A.curve.toUniform(W)),z&&H.max?(K|=1<<20,Z.uFCurveValueTexture=aO(s,WR.getAllData(H,!0),H.index,1)):Z.uFCurveValues=WR.getAllData(H);var J=W.max+W.curves.length-32>G;if(2===X&&(W.max=-1,W.index=M?M[0]:lL(W.index),H.index>0&&(H.max=-1,H.index=M?M[1]:lL(H.index))),J&&z&&Y){var $=aO(s,WR.getAllData(W,!0),W.index,1);Z.uVCurveValueTexture=$,q=1}else Z.uVCurveValues=WR.getAllData(W);var ee=["-p:",N,K,W.index,W.max,H.index,H.max].join("+");j.push(["VERT_CURVE_VALUE_COUNT",W.index],["FRAG_CURVE_VALUE_COUNT",H.index],["VERT_MAX_KEY_FRAME_COUNT",W.max],["FRAG_MAX_KEY_FRAME_COUNT",H.max]);var te=_?KO.replace(/#pragma\s+FILTER_FRAG/,F.fragment):KO,re="#define LOOKUP_TEXTURE_CURVE ".concat(q,"\n").concat(QO),ie=_?re.replace(/#pragma\s+FILTER_VERT/,F.vertex||"void filterMain(float t){}\n"):re,ne={fragment:HC(j,te,e.ShaderType.fragment,X),vertex:HC(j,ie,e.ShaderType.vertex,X),glslVersion:1===X?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,shared:!0,cacheId:ee,marcos:j,name:"particle#".concat(E)};_&&(ne.cacheId+=_.name);var oe={shader:ne,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},ae=GC(b);Z.uTexOffset=new Float32Array(B?[1/B.getWidth(),1/B.getHeight()]:[0,0]),Z.uMaskTex=B,Z.uColorParams=new Float32Array([B?1:0,+ae,0,+(!!C&&!w)]),Z.uParams=[0,g,0,0],Z.uAcceleration=[(null==S?void 0:S[0])||0,(null==S?void 0:S[1])||0,(null==S?void 0:S[2])||0,0];var se=_O.create(s,oe);se.blending=!0,se.depthTest=!0,se.depthMask=!!C,se.stencilRef=I?[I,I]:void 0,qC(se,L),YC(se,b),ZC(se,R);var ue={uSprite:"vec4",uParams:"vec4",uAcceleration:"vec4",uGravityModifierValue:"vec4",uOpacityOverLifetimeValue:"vec4",uRXByLifeTimeValue:"vec4",uRYByLifeTimeValue:"vec4",uRZByLifeTimeValue:"vec4",uLinearXByLifetimeValue:"vec4",uLinearYByLifetimeValue:"vec4",uLinearZByLifetimeValue:"vec4",uSpeedLifetimeValue:"vec4",uOrbXByLifetimeValue:"vec4",uOrbYByLifetimeValue:"vec4",uOrbZByLifetimeValue:"vec4",uSizeByLifetimeValue:"vec4",uSizeYByLifetimeValue:"vec4",uColorParams:"vec4",uFSprite:"vec4",uPreviewColor:"vec4",uVCurveValues:"vec4Array",uFCurveValues:"vec4",uFinalTarget:"vec3",uForceCurve:"vec4",uOrbCenter:"vec3",uTexOffset:"vec2",uPeriodValue:"vec4",uMovementValue:"vec4",uStrengthValue:"vec4",uWaveParams:"vec4"};Object.keys(Z).map((function(e){var t=Z[e];if(t instanceof oO)se.setTexture(e,t);else{var r=[];switch(ue[e]){case"vec4":se.setVector4(e,t);break;case"vec3":se.setVector3(e,t);break;case"vec2":se.setVector2(e,t);break;case"vec4Array":for(var i=0;i<t.length;i+=4){var n=[t[i],t[i+1],t[i+2],t[i+3]];r.push(n)}se.setVector4Array(e,r),r.length=0;break;default:console.warn("uniform ".concat(e,"'s type not in typeMap"))}}})),se.setVector3("emissionColor",[0,0,0]),se.setFloat("emissionIntensity",0);var ce=FO.create(s,function(e,t,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,o={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*i,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*i,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*i,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*i,data:new Float32Array(0)},aSeed:{size:1,offset:3*i,stride:8*i,dataSource:"aRot"},aColor:{size:4,offset:4*i,stride:8*i,dataSource:"aRot"},aOffset:{size:4,stride:4*i,data:new Float32Array(0)}};t&&(o.aSprite={size:3,data:new Float32Array(0)});return{attributes:o,indices:{data:new Uint16Array(0)},name:r,maxVertex:e}}(4*y,this.useSprite,"particle#".concat(E))),le=zO.create(s,{name:"MParticle_".concat(E),priority:P,material:se,geometry:ce});this.anchor=O,this.mesh=le,this.geometry=le.firstGeometry(),this.forceTarget=A,this.sizeOverLifetime=p,this.speedOverLifetime=c,this.linearVelOverLifetime=f,this.orbitalVelOverLifetime=h,this.orbitalVelOverLifetime=h,this.gravityModifier=v,this.maxCount=y,this.duration=g,this.textureOffsets=x?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0]}return Object.defineProperty(t.prototype,"time",{get:function(){return this.mesh.material.getVector4("uParams")[0]},set:function(e){this.mesh.material.setVector4("uParams",[+e,this.duration,0,0])},enumerable:!1,configurable:!0}),t.prototype.getPointColor=function(e){var t=this.geometry.getAttributeData("aRot"),r=32*e+4;return[t[r],t[r+1],t[r+2],t[r+3]]},t.prototype.getPointPosition=function(e){var t=this.geometry,r=48*e,i=t.getAttributeData("aPos"),n=t.getAttributeData("aOffset"),o=this.time-n[16*e+2],a=n[16*e+3],s=this.mesh.material,u=FR([0,0,0],this,s.getVector4("uAcceleration").slice(0,3),o,a,i,i,r,r+3);if(this.forceTarget){var c=s.getVector3("uFinalTarget"),l=this.forceTarget.curve.getValue(o/a),f=1-l;u[0]=u[0]*f+c[0]*l,u[1]=u[1]*f+c[1]*l,u[2]=u[2]*f+c[2]*l}return u},t.prototype.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},t.prototype.resetGeometryData=function(e){for(var t=e.getAttributeNames(),r=e.getIndexData(),i=0;i<t.length;i++){var n=t[i],o=e.getAttributeData(n);o&&e.setAttributeData(n,new o.constructor(0))}e.setIndexData(new r.constructor(0))},t.prototype.minusTime=function(e){for(var t=this.geometry.getAttributeData("aOffset"),r=0;r<t.length;r+=4)t[r+2]-=e;this.geometry.setAttributeData("aOffset",t),this.time-=e},t.prototype.removePoint=function(e){e<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*e,new Float32Array(16))},t.prototype.setPoint=function(e,t){var r=this.maxCount;if(t<r){var i=t+1,n=4*i,o=this.geometry,a=i>this.maxParticleBufferCount,s=1;this.particleCount>300?s=(this.particleCount+100)/this.particleCount:this.particleCount>100?s=1.4:this.particleCount>0&&(s=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},c=this.useSprite;c&&(u.aSprite=new Float32Array(12));var l=[0,0,0],f=[0,0,0],h=[0,0,0,1],p=[1,1,1];e.transform.assignWorldTRS(l,h,p),TC.getRotation(f,h);var d=this.textureOffsets,m=[0,0,e.delay,e.lifetime],v=[0,0,1,1],y=e.vel,g=e.color,x=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],T=Math.random(),E=void 0;c&&(E=e.sprite);for(var _=0;_<4;_++){var S=2*_,A=3*_,R=4*_,C=12*_,O=8*_;u.aPos.set(l,C),u.aPos.set(y,C+3),u.aRot.set(f,O),u.aRot[O+3]=T,u.aRot.set(g,O+4),c&&u.aSprite.set(E,A);var b=e.uv||v;if(b){var L=c?1-d[S+1]:d[S+1];m[0]=b[0]+d[S]*b[2],m[1]=b[1]+L*b[3]}u.aOffset.set(m,R);for(var I=_+_,w=(x[I]-this.anchor[0])*p[0],P=(x[I+1]-this.anchor[1])*p[1],M=0;M<3;M++)u.aPos[C+6+M]=e.dirX[M]*w,u.aPos[C+9+M]=e.dirY[M]*P}var V=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(a){var N=jS(o.getIndexData(),6*i,s,6*r);N.set(V,6*t),o.setIndexData(N),this.maxParticleBufferCount=N.length/6}else o.setIndexSubData(6*t,V);Object.keys(u).forEach((function(e){var i=u[e],c=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(a){var l=jS(o.getAttributeData(e),n*c,s,4*r*c);l.set(i,i.length*t),o.setAttributeData(e,l)}else o.setAttributeSubData(e,i.length*t,i)})),this.particleCount=Math.max(i,this.particleCount),o.setDrawCount(6*this.particleCount)}},t}(),cL=[10,32,64,160];function lL(e){for(var t=0;t<cL.length;t++){var r=cL[t];if(r>e)return r}return e||cL[0]}function fL(e,t,r){var i,n,o,a,s;void 0===t&&(t="");var u=e.content,c=+((null===(i=u.renderer)||void 0===i?void 0:i.renderMode)||0),l=[["RENDER_MODE",c],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",t===dS]],f=r.level,h=r.detail,p={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},d={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},m=h.maxVertexUniforms>0,v=(null!==(n=u.positionOverLifetime)&&void 0!==n?n:{}).speedOverLifetime,y=0,g=0;m&&l.push(["ENABLE_VERTEX_TEXTURE",!0]),v&&(l.push(["SPEED_OVER_LIFETIME",!0]),g|=2,rC(p,v));var x=u.textureSheetAnimation;x&&x.animate&&(l.push(["USE_SPRITE",!0]),g|=4);var T=void 0;if(u.filter&&u.filter.name!==mS){l.push(["USE_FILTER",!0]),g|=8;var E=US(u.filter).find((function(e){return e.isParticle}));if(!E)throw Error("particle filter ".concat(u.filter.name," not implement"));T=E,null===(o=E.uniforms)||void 0===o||o.forEach((function(e){return rC(p,e)}))}var _=u.colorOverLifetime;_&&_.color&&(l.push(["COLOR_OVER_LIFETIME",!0]),g|=16);var S=_&&_.opacity;S&&rC(p,S);var A,R=u.positionOverLifetime;["x","y","z"].forEach((function(e,t){var r=0,i="linear"+e.toUpperCase(),n="orbital"+e.toUpperCase();(null==R?void 0:R[i])&&(rC(p,R[i]),r=1,g|=1<<7+t),l.push(["LINEAR_VEL_".concat(e.toUpperCase()),r]);var o=0;(null==R?void 0:R[n])&&(rC(p,R[n]),o=1,g|=1<<10+t,A=!0),l.push(["ORB_VEL_".concat(e.toUpperCase()),o])})),(null==R?void 0:R.asMovement)&&(l.push(["AS_LINEAR_MOVEMENT",!0]),g|=32),A&&(null==R?void 0:R.asRotation)&&(l.push(["AS_ORBITAL_MOVEMENT",!0]),g|=64);var C=u.sizeOverLifetime;rC(p,null==C?void 0:C.x),(null==C?void 0:C.separateAxes)&&(l.push(["SIZE_Y_BY_LIFE",1]),g|=16384,rC(p,null==C?void 0:C.y));var O=u.rotationOverLifetime;(null==O?void 0:O.z)&&(rC(p,null==O?void 0:O.z),g|=32768,l.push(["ROT_Z_LIFETIME",1])),(null==O?void 0:O.separateAxes)&&(O.x&&(rC(p,O.x),g|=65536,l.push(["ROT_X_LIFETIME",1])),O.y&&(rC(p,O.y),g|=1<<17,l.push(["ROT_Y_LIFETIME",1]))),(null==O?void 0:O.asRotation)&&(l.push(["ROT_LIFETIME_AS_MOVEMENT",1]),g|=1<<18),rC(p,null==R?void 0:R.gravityOverLifetime),(null==R?void 0:R.forceTarget)&&(l.push(["FINAL_TARGET",!0]),g|=1<<19,rC(p,R.forceCurve));var b=h.halfFloatTexture;b&&d.max&&(g|=1<<20);var L=h.maxVertexUniforms,I=p.max+p.curves.length-32>L;fO(uO)&&(I=!0),2===f&&(p.max=-1,d.index>0&&(d.max=-1)),I&&b&&m&&(y=1);var w=["-p:",c,g,p.index,p.max,d.index,d.max].join("+"),P={fragment:KO,vertex:"#define LOOKUP_TEXTURE_CURVE ".concat(y,"\n").concat(QO),shared:!0,cacheId:w,marcos:l,name:"particle#".concat(e.name)};return T&&(P.fragment=P.fragment.replace(/#pragma\s+FILTER_FRAG/,null!==(a=T.fragment)&&void 0!==a?a:""),P.vertex=P.vertex.replace(/#pragma\s+FILTER_VERT/,T.vertex||"void filterMain(float t){}\n"),P.cacheId+="+"+(null===(s=u.filter)||void 0===s?void 0:s.name)),l.push(["VERT_CURVE_VALUE_COUNT",p.index],["FRAG_CURVE_VALUE_COUNT",d.index],["VERT_MAX_KEY_FRAME_COUNT",p.max],["FRAG_MAX_KEY_FRAME_COUNT",d.max]),{shader:P,vertex:p.index,fragment:d.index}}function hL(e,t,r){var i,n=null===(i=e.cacheId)||void 0===i?void 0:i.split("+");if(n[3]=t,n[5]=r,e.cacheId=n.join("+"),e.marcos)for(var o=0;o<e.marcos.length;o++){var a=e.marcos[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=t;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}}var pL=function(e){this.content=e},dL=function(){function e(e){this.sort=e,this.length=0}return e.prototype.findNodeByContent=function(e){var t=this.first;if(t)do{if(e(t.content))return t}while(t=t.next)},e.prototype.insertNode=function(e,t){var r=e.next;e.next=t,t.pre=e,t.next=r,r&&(r.pre=t)},e.prototype.shiftNode=function(e){var t=new pL(e);if(this.length++,1===this.length)return this.first=this.last=t;for(var r=this.first;r;){if(!(this.sort(r.content,t.content)<=0))return r.pre?this.insertNode(r.pre,t):(this.first=t,t.next=r,r.pre=t),t;if(!r.next)return this.insertNode(r,t),this.last=t;r=r.next}},e.prototype.pushNode=function(e){var t=new pL(e);if(this.length++,1===this.length)return this.last=this.first=t;for(var r=this.last;r;){if(!(this.sort(t.content,r.content)<=0))return this.insertNode(r,t),r===this.last&&(this.last=t),t;if(this.first===r)return r.pre=t,t.next=r,this.first=t;r=r.pre}},e.prototype.removeNode=function(e){var t=this.first;if(this.length--,t===e)(r=this.first=t.next)&&(r.pre=null);else if((t=this.last)===e){var r;(r=this.last=t.pre)&&(r.next=null)}else if(e){var i=e.pre,n=e.next;i.next=n,n&&(n.pre=i)}e.pre=null,e.next=null},e.prototype.forEach=function(e,t){var r=this.first,i=0;if(r)do{e.call(t||this,r.content,i++)}while(r=r.next)},e.prototype.forEachReverse=function(e,t){var r=this.last,i=this.length-1;if(r)do{e.call(t||this,r.content,i--)}while(r=r.pre)},e}(),mL=function(){function e(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}return e.prototype.generate=function(e){var t=vL(this.arc,this.arcMode,e)*vS,r=[Math.cos(t)*this.radius,Math.sin(t)*this.radius,0],i=sR([],r,Math.tan(this.angle*vS));return i[2]+=1,{position:sR(r,r,mC(0,1)),direction:iR(i,i)}},e}();function vL(e,t,r){if(t===lA.RANDOM)e=mC(0,e);else if(t===lA.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);e=e/r.total*i}else if(t===lA.BIDIRECTIONAL_CYCLE){var n=(i=r.index/(r.total+1))-Math.floor(i);e*=Math.floor(i)%2?1-n:n}else t===lA.UNIFORM_BURST&&(e=e*r.burstIndex/r.burstCount);return e}var yL,gL=function(){function e(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}return e.prototype.generate=function(e){var t=vL(this.arc,this.arcMode,e)*vS,r=[Math.cos(t),Math.sin(t),0],i=this.radius;return{direction:r,position:r.map((function(e){return e*i}))}},e}(),xL=function(){function e(e){this._d=(e.width||1)/2,this._h=(e.height||1)/2}return e.prototype.generate=function(e){return{direction:[0,0,1],position:[mC(-this._d,this._d),mC(-this._h,this._h),0]}},e}(),TL=function(){function e(e){this._d=(e.width||1)/2,this._h=(e.height||1)/2,this.arcMode=e.arcMode,this.arc=e.arc}return e.prototype.generate=function(e){var t=vL(this.arc,this.arcMode,e)*vS,r=[Math.cos(t),Math.sin(t),0],i=this._d,n=this._h,o=Math.atan2(n,i),a=Math.tan(t);return{direction:r,position:t<o?[i,i*a,0]:t>=o&&t<Math.PI-o?[n/a,n,0]:t<Math.PI+o?[-i,-i*a,0]:t<2*Math.PI-o?[-n/a,-n,0]:[i,i*a,0]}},e}(),EL=function(){function e(e){this._d=e.width||1,this.arcMode=e.arcMode}return e.prototype.generate=function(e){var t=this.arcMode===lA.UNIFORM_BURST?e.burstIndex%e.burstCount/(e.burstCount-1):mC(0,1);return{direction:[0,1,0],position:[this._d*(t-.5),0,0]}},e}(),_L=[],SL=function(){function e(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}return e.prototype.generate=function(e){var t=this.donutRadius,r=this.radius-t,i=mC(0,2*Math.PI),n=vL(this.arc,this.arcMode,e)*vS,o=hR(_L,n),a=[Math.cos(i),Math.sin(i),0],s=[r+Math.cos(i)*t,0,Math.sin(i)*t];return{direction:eR(a,a,o),position:eR(s,s,o)}},e}(),AL=[],RL=function(){function e(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}return e.prototype.getHorizontalAngle=function(){return mC(-90,90)},e.prototype.generate=function(e){var t=vL(this.arc,this.arcMode,e)*vS,r=this.getHorizontalAngle()*vS,i=this.radius,n=[Math.cos(r),0,Math.sin(r)],o=eR(n,n,hR(AL,t));return{position:o.map((function(e){return e*i})),direction:o}},e}(),CL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.getHorizontalAngle=function(){return mC(0,90)},t}(RL),OL=function(){function e(e){var t=e.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(t.anchors),this.width=e.width||1,this.height=e.height||1,this.block=t.block,this.arcMode=e.arcMode,this.random=SA(e.random||0,0,1)}return e.prototype.generate=function(e){var t=this.anchors,r=t.length/2-1,i=Math.floor(vL(r,this.arcMode,e)),n=(t[2*i]+this.block[0]*this.random*Math.random())%1-.5,o=(t[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=[n,o,0];return{position:[n*this.width,o*this.height,0],direction:iR(a,a)}},e}(),bL=function(){function e(){}return e.prototype.generate=function(){return{position:[0,0,0],direction:[0,0,0]}},e}(),LL=((yL={})[OS.NONE]=bL,yL[OS.CONE]=mL,yL[OS.SPHERE]=RL,yL[OS.HEMISPHERE]=CL,yL[OS.CIRCLE]=gL,yL[OS.DONUT]=SL,yL[OS.RECTANGLE]=xL,yL[OS.EDGE]=EL,yL[OS.RECTANGLE_EDGE]=TL,yL[OS.TEXTURE]=OL,yL);function IL(e){if(!e)return new bL;var t=rS({radius:1,arc:360,angle:0,arcMode:lA.RANDOM},e),r=e.type,i=LL[r];if(!i)throw Error("invalid shape:"+r);var n=new i(t);if(r!==OS.NONE){var o=e,a=o.alignSpeedDirection,s=o.upDirection,u=void 0===s?[0,0,1]:s;n.alignSpeedDirection=a,n.upDirection=iR(u)}return n}function wL(e,t,r,i,n){var o,a;if(n===function(e,t,r,i){for(var n=0,o=t,a=r-i;o<r;o+=i)n+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return n}(e,t,r,i)>0)for(o=t;o<r;o+=i)a=qL(o,e[o],e[o+1],a);else for(o=r-i;o>=t;o-=i)a=qL(o,e[o],e[o+1],a);return a&&jL(a,a.next)&&(KL(a),a=a.next),a}function PL(e,t){if(!e)return e;t||(t=e);var r,i=e;do{if(r=!1,i.steiner||!jL(i,i.next)&&0!==GL(i.prev,i,i.next))i=i.next;else{if(KL(i),(i=t=i.prev)===i.next)break;r=!0}}while(r||i!==t);return t}function ML(e){var t=e.prev,r=e,i=e.next;if(GL(t,r,i)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(kL(t.x,t.y,r.x,r.y,i.x,i.y,n.x,n.y)&&GL(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function VL(e,t,r,i){var n=e.prev,o=e,a=e.next;if(GL(n,o,a)>=0)return!1;for(var s=n.x<o.x?n.x<a.x?n.x:a.x:o.x<a.x?o.x:a.x,u=n.y<o.y?n.y<a.y?n.y:a.y:o.y<a.y?o.y:a.y,c=n.x>o.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,l=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,f=UL(s,u,t,r,i),h=UL(c,l,t,r,i),p=e.prevZ,d=e.nextZ;p&&p.z>=f&&d&&d.z<=h;){if(p!==e.prev&&p!==e.next&&kL(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&GL(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==e.prev&&d!==e.next&&kL(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&GL(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=f;){if(p!==e.prev&&p!==e.next&&kL(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&GL(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=h;){if(d!==e.prev&&d!==e.next&&kL(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&GL(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function NL(e,t){return e.x-t.x}function FL(e,t){if(t=function(e,t){var r,i=t,n=e.x,o=e.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>a){if(a=s,s===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!r)return null;if(n===a)return r;var u,c=r,l=r.x,f=r.y,h=1/0;i=r;do{n>=i.x&&i.x>=l&&n!==i.x&&kL(o<f?n:a,o,l,f,o<f?a:n,o,i.x,i.y)&&(u=Math.abs(o-i.y)/(n-i.x),YL(i,e)&&(u<h||u===h&&(i.x>r.x||i.x===r.x&&DL(r,i)))&&(r=i,h=u)),i=i.next}while(i!==c);return r}(e,t),t){var r=ZL(t,e);PL(t,t.next),PL(r,r.next)}}function DL(e,t){return GL(e.prev,e,t.prev)<0&&GL(t.next,e,e.next)<0}function UL(e,t,r,i,n){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*n)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*n)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function BL(e){var t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function kL(e,t,r,i,n,o,a,s){return(n-a)*(t-s)-(e-a)*(o-s)>=0&&(e-a)*(i-s)-(r-a)*(t-s)>=0&&(r-a)*(o-s)-(n-a)*(i-s)>=0}function zL(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&XL(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(YL(e,t)&&YL(t,e)&&function(e,t){var r=e,i=!1,n=(e.x+t.x)/2,o=(e.y+t.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==e);return i}(e,t)&&(GL(e.prev,e,t.prev)||GL(e,t.prev,t))||jL(e,t)&&GL(e.prev,e,e.next)>0&&GL(t.prev,t,t.next)>0)}function GL(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function jL(e,t){return e.x===t.x&&e.y===t.y}function XL(e,t,r,i){var n=HL(GL(e,t,r)),o=HL(GL(e,t,i)),a=HL(GL(r,i,e)),s=HL(GL(r,i,t));return n!==o&&a!==s||(!(0!==n||!WL(e,r,t))||(!(0!==o||!WL(e,i,t))||(!(0!==a||!WL(r,e,i))||!(0!==s||!WL(r,t,i)))))}function WL(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function HL(e){return e>0?1:e<0?-1:0}function YL(e,t){return GL(e.prev,e,e.next)<0?GL(e,t,e.next)>=0&&GL(e,e.prev,t)>=0:GL(e,t,e.prev)<0||GL(e,e.next,t)<0}function ZL(e,t){var r=new QL(e.i,e.x,e.y),i=new QL(t.i,t.x,t.y),n=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function qL(e,t,r,i){var n=new QL(e,t,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function KL(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function QL(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var JL=0;function $L(e,t,r,i){r=r||2,JL=i||0;var n,o,a,s,u,c,l,f=t&&t.length,h=f?t[0]*r:e.length,p=wL(e,0,h,r,!0),d=[];if(!p||p.next===p.prev)return d;if(f&&(p=function(e,t,r,i){var n,o,a,s=[];for(n=0,o=t.length;n<o;n++)(a=wL(e,t[n]*i,n<o-1?t[n+1]*i:e.length,i,!1))===a.next&&(a.steiner=!0),s.push(BL(a));for(s.sort(NL),n=0;n<s.length;n++)FL(s[n],r),r=PL(r,r.next);return r}(e,t,p,r)),e.length>80*r){n=a=e[0],o=s=e[1];for(var m=r;m<h;m+=r)(u=e[m])<n&&(n=u),(c=e[m+1])<o&&(o=c),u>a&&(a=u),c>s&&(s=c);l=0!==(l=Math.max(a-n,s-o))?1/l:0}return eI(p,d,r,n,o,l),d}function eI(e,t,r,i,n,o,a){if(e){!a&&o&&function(e,t,r,i){var n=e;do{null===n.z&&(n.z=UL(n.x,n.y,t,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==e);n.prevZ.nextZ=null,n.prevZ=null,function(e){var t,r,i,n,o,a,s,u,c=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,i=r,s=0,t=0;t<c&&(s++,i=i.nextZ);t++);for(u=c;s>0||u>0&&i;)0!==s&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,u--),o?o.nextZ=n:e=n,n.prevZ=o,o=n;r=i}o.nextZ=null,c*=2}while(a>1)}(n)}(e,i,n,o);for(var s,u,c=e;e.prev!==e.next;)if(s=e.prev,u=e.next,o?VL(e,i,n,o):ML(e))t.push(s.i/r+JL),t.push(e.i/r+JL),t.push(u.i/r+JL),KL(e),e=u.next,c=u.next;else if((e=u)===c){a?1===a?eI(e=tI(PL(e),t,r),t,r,i,n,o,2):2===a&&rI(e,t,r,i,n,o):eI(PL(e),t,r,i,n,o,1);break}}}function tI(e,t,r){var i=e;do{var n=i.prev,o=i.next.next;!jL(n,o)&&XL(n,i,i.next,o)&&YL(n,o)&&YL(o,n)&&(t.push(n.i/r+JL),t.push(i.i/r+JL),t.push(o.i/r+JL),KL(i),KL(i.next),i=e=o),i=i.next}while(i!==e);return PL(i)}function rI(e,t,r,i,n,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&zL(a,s)){var u=ZL(a,s);return a=PL(a,a.next),u=PL(u,u.next),eI(a,t,r,i,n,o),void eI(u,t,r,i,n,o)}s=s.next}a=a.next}while(a!==e)}var iI=2;function nI(e,t){for(var r=e.s,i=e.p,n=r[1],o=i[1],a=0,s=0;s<n.length;s++){a+=(T=n[s]).length-1}var u,c=new Float32Array(a*uS),l=t.indexBase,f=void 0===l?0:l,h=t.uvTransform,p=0,d=0,m=0,v=1,y=1;h&&(d=h[0],m=h[1],u=h[4],v=u?h[3]:h[2],y=u?h[2]:h[3]);var g=[0,0],x=0===u?0:-Math.PI/2;for(s=0;s<n.length;s++)for(var T=n[s],E=o[s],_=o[s+1]||o[0],S=T,A=[0,0],R=0;R<S.length-1;R++){sI(A,S[R],E,_,E[4],E[5],_[2],_[3]),O(A[0],A[1])}var C=$L(Array.from(c),null,uS,f);return{aPoint:c,index:new Uint16Array(C)};function O(e,t){c[p++]=e/2,c[p++]=t/2,h?(g[0]=e,g[1]=t,aI(g,g,x),c[p++]=d+(g[0]+1)/2*v,c[p++]=m+(g[1]+1)/2*y):(c[p++]=(e+1)/2,c[p++]=(t+1)/2),p+=iI}}function oI(e,t){for(var r=[],i=function(e){var t=[];return e.gs?e.gs.forEach((function(e){t.push({p:[oA.SHAPE_POINTS,e.p],s:[oA.SHAPE_SPLITS,e.s]})})):e.g?t.push({p:[oA.SHAPE_POINTS,e.g.p],s:[oA.SHAPE_SPLITS,e.g.s]}):t.push(e),t}(e),n=0,o=0,a=0,s=0;s<i.length;s++){n+=(h=nI(i[s],{indexBase:n,uvTransform:t})).aPoint.length/5,r.push(h),o+=h.aPoint.length,a+=h.index.length}if(1===r.length)return r[0];for(var u=new Float32Array(o),c=new Uint16Array(a),l=(s=0,0),f=0;s<r[s];s++){var h=r[s];u.set(h.aPoint,l),l+=h.aPoint.length,c.set(h.index,f),f+=h.index.length}return{aPoint:u,index:c}}function aI(e,t,r){var i=Math.cos(r),n=Math.sin(r),o=t[0],a=t[1];return e[0]=i*o+n*a,e[1]=-n*o+i*a,e}function sI(e,t,r,i,n,o,a,s){var u=1-t,c=u*u*u,l=3*t*u*u,f=3*t*t*u,h=t*t*t;return e[0]=c*r[0]+l*n+f*a+h*i[0],e[1]=c*r[1]+l*o+f*s+h*i[1],e}var uI=function(){function e(e){var t=e.time,r=e.interval,i=e.count,n=e.cycles,o=e.probability;this.time=+t||0,this.interval=+r||1,this.count=i instanceof UR?i:KR(i),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}return e.prototype.getGeneratorOptions=function(e,t){if(e-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(t),cycleIndex:this.cycles-this.internalCycles-1}:null},e.prototype.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},e.prototype.clone=function(){return new e(this)},e}(),cI=[0,0,0],lI=[0,0,0],fI=function(){function t(t,r){var i;this.pointStart=[];var n=t.colorOverLifetime,o=t.colorOverTrail,a=t.maxTrailCount,s=t.opacityOverLifetime,u=void 0===s?KR(1):s,c=t.widthOverTrail,l=t.name,f=t.occlusion,h=t.blending,p=t.maskMode,d=t.order,m=t.textureMap,v=void 0===m?[0,0,1,1]:m,y=t.texture,g=t.transparentOcclusion,x=t.minimumVertexDistance,T=t.lifetime,E=t.matrix,_=r.gpuCapability,S=_.detail,A=_.level,R=Math.max(t.pointCountPerTrail,2),C={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},O=S.maxVertexTextures>0,b=(null!==(i=r.renderer)&&void 0!==i?i:{}).env,L={},I=[["ENABLE_VERTEX_TEXTURE",O],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",b===dS]],w=a>64,P=0;n&&(I.push(["COLOR_OVER_LIFETIME",!0]),P|=1,L.uColorOverLifetime=oO.createWithData(r,QS(n))),o&&(I.push(["COLOR_OVER_TRAIL",!0]),P|=4,L.uColorOverTrail=oO.createWithData(r,QS(o))),w?(I.push(["ATTR_TRAIL_START",1]),P|=8):L.uTrailStart=new Float32Array(a),L.uOpacityOverLifetimeValue=u.toUniform(C);var M=c.toUniform(C);I.push(["VERT_CURVE_VALUE_COUNT",C.index],["VERT_MAX_KEY_FRAME_COUNT",C.max]),L.uVCurveValues=WR.getAllData(C);var V={shader:{vertex:HC(I,JO,e.ShaderType.vertex,A),fragment:HC(I,KO,e.ShaderType.fragment,A),marcos:I,glslVersion:1===A?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,shared:!0,name:"trail#".concat(l),cacheId:"-t:+".concat(P,"+").concat(C.index,"+").concat(C.max)},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},N=R*a*2,F=(R-1)*a,D=Float32Array.BYTES_PER_ELEMENT,U=12*D,B={attributes:{aColor:{size:4,stride:U,data:new Float32Array(12*N)},aSeed:{size:1,stride:U,offset:4*D,dataSource:"aColor"},aInfo:{size:3,stride:U,offset:5*D,dataSource:"aColor"},aPos:{size:4,stride:U,offset:8*D,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(N)},aDir:{size:3,data:new Float32Array(3*N)}},indices:{data:new Uint16Array(6*N)},drawCount:6*F,name:"trail#".concat(l),bufferUsage:xS.DYNAMIC_DRAW};if(w)B.attributes.aTrailStart={size:1,data:new Float32Array(N)};else{var k=new Float32Array(N);B.attributes.aTrailStartIndex={size:1,data:k};for(var z=0;z<a;z++)for(var G=2*R,j=z*G,X=0;X<G;X++)k[j+X]=z}var W=GC(h),H=_O.create(r,V);H.blending=!0,H.depthMask=f,H.depthTest=!0,qC(H,p),YC(H,h);var Y=this.mesh=zO.create(r,{name:"MTrail_".concat(l),material:H,geometry:FO.create(r,B),priority:d}),Z=null!=y?y:oO.createWithData(r);Object.keys(L).map((function(e){var t=L[e];if(t instanceof oO)H.setTexture(e,t);else if("uTrailStart"===e)H.setFloats("uTrailStart",t);else if("uVCurveValues"===e){var r=[];r.push([t[0],t[1],t[2],t[3]]),r.push([t[4],t[5],t[6],t[7]]),H.setVector4Array(e,r)}else H.setVector4(e,t)})),H.setFloat("uTime",0),H.setVector4("uWidthOverTrail",M),H.setVector2("uTexOffset",[0,0]),H.setVector4("uTextureMap",v),H.setVector4("uParams",[0,R-1,0,0]),H.setTexture("uMaskTex",Z),H.setVector4("uColorParams",[y?1:0,+W,0,+(f&&!g)]),this.maxTrailCount=a,this.pointCountPerTrail=R,this.checkVertexDistance=x>0,this.minimumVertexDistance=Math.pow(x||.001,2),this.useAttributeTrailStart=w,this.lifetime=T,E&&(this.mesh.worldMatrix=E),this.geometry=Y.firstGeometry(),this.trailCursors=new Uint16Array(a)}return Object.defineProperty(t.prototype,"time",{get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(e){this.mesh.material.setFloat("uTime",null!=e?e:0)},enumerable:!1,configurable:!0}),t.prototype.addPoint=function(e,t,r){r=r||{};var i=this.trailCursors[e],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=i%n,u=(i-1)%n,c=(i-2)%n,l=this.getTrailPosition(e,u,cI);if(!(l&&this.checkVertexDistance&&aR(l,t)<this.minimumVertexDistance)){var f=e*n+s,h=mI(l,t),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,v=6*f,y=new Float32Array(6);y.set(h,0),y.set(h,3),o.setAttributeSubData("aDir",v,y),o.setAttributeSubData("aTime",2*f,new Float32Array([p,p]));var g=r.color||[1,1,1,1],x=new Float32Array(24);if(x.set(g,0),x.set(d,4),x[7]=0,x.set(t,8),x[11]=.5*m,x.set(g,12),x.set(d,16),x[19]=1,x.set(t,20),x[23]=-.5*m,o.setAttributeSubData("aColor",24*f,x),u>=0){var T=this.getTrailPosition(e,c,lI),E=new Float32Array(mI(T,l,t)),_=6*(e*n+u);o.setAttributeSubData("aDir",_,E),o.setAttributeSubData("aDir",_+3,E);var S=e*n*2,A=new Uint16Array([2*u+S,2*u+1+S,2*s+S,2*s+S,2*u+1+S,2*s+1+S]),R=6*(e*a+(i-1)%a);o.setIndexSubData(R,A)}i=++this.trailCursors[e];var C=this.mesh.material,O=C.getVector4("uParams"),b=d[2];if(this.useAttributeTrailStart){for(var L=2*n,I=new Float32Array(L),w=0;w<L;w++)I[w]=b;o.setAttributeSubData("aTrailStart",e*I.length,I)}else{var P=C.getFloats("uTrailStart");null!=P&&(P[e]=b,C.setFloats("uTrailStart",P))}O&&(O[1]=Math.max(O[1],i-1)-Math.max(0,i-n),C.setVector4("uParams",O))}},t.prototype.getTrailPosition=function(e,t,r){var i=this.pointCountPerTrail;if(t>=0&&t<i){var n=24*(e*i+t)+8,o=this.geometry.getAttributeData("aColor");return r[0]=o[n],r[1]=o[1+n],r[2]=o[2+n],r}},t.prototype.clearAllTrails=function(){var e=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),e.setIndexData(new Uint16Array(e.getIndexData().length))},t.prototype.minusTime=function(e){for(var t=this.geometry.getAttributeData("aTime"),r=0;r<t.length;r++)t[r]-=e;this.geometry.setAttributeData("aTime",t),this.time-=e},t.prototype.clearTrail=function(e){if(0!==this.trailCursors[e]){var t=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();null==r||r.set(new Uint16Array(t),e*t),this.geometry.setIndexData(r),this.trailCursors[e]=0}},t.prototype.getPointStartPos=function(e){return this.pointStart[e]},t.prototype.setPointStartPos=function(e,t){this.pointStart[e]=t},t.prototype.onUpdate=function(e){},t}(),hI=[0,0,0],pI=[0,0,0],dI=[0,0,0];function mI(e,t,r){var i=hI;return e||r?(e?r?(iR(pI,oR(pI,t,e)),iR(dI,oR(pI,r,t)),qA(i,pI,dI)):oR(i,t,e):oR(i,r,t),iR(i,i)):[0,0,0]}var vI=function(){function e(e,t,r){var i,n,o,a,s,u,c=r.composition,l=r.endBehavior,f=r.name;if(c){var h,p=c.getEngine(),d=t.cachePrefix,m=void 0===d?"":d,v=e.options,y=e.positionOverLifetime,g=e.shape,x=r.duration||1,T=y.gravityOverLifetime,E=$A(y.gravity),_=e.textureSheetAnimation,S=_?{animationDelay:KR(_.animationDelay||0),animationDuration:KR(_.animationDuration||1),cycles:KR(_.cycles||1),animate:_.animate,col:_.col,row:_.row,total:_.total||_.col*_.row}:void 0,A=PA(),R=!!(g&&g.turbulenceX||g.turbulenceY||g.turbulenceZ);R&&(h=[KR(null!==(i=g.turbulenceX)&&void 0!==i?i:0),KR(null!==(n=g.turbulenceY)&&void 0!==n?n:0),KR(null!==(o=g.turbulenceZ)&&void 0!==o?o:0)]),this.name=f,this.shape=IL(g),this.emission={rateOverTime:KR(e.emission.rateOverTime),burstOffsets:RI(null!==(a=e.emission.burstOffsets)&&void 0!==a?a:[]),bursts:(e.emission.bursts||[]).map((function(e){return new uI(e)}))},this.textureSheetAnimation=S;var C,O=e.renderer||{},b={},L=e.rotationOverLifetime;L&&(b.asRotation=!!L.asRotation,b.z=L.z?KR(L.z):KR(0),L.separateAxes&&(b.x=L.x&&KR(L.x),b.y=L.y&&KR(L.y))),y.forceTarget&&(C={target:y.target||[0,0,0],curve:KR(y.forceCurve||[oA.LINE,[[0,0],[1,1]]])});var I={x:y.linearX&&KR(y.linearX||0),y:y.linearY&&KR(y.linearY||0),z:y.linearZ&&KR(y.linearZ||0),asMovement:y.asMovement},w={x:y.orbitalX&&KR(y.orbitalX),y:y.orbitalY&&KR(y.orbitalY),z:y.orbitalZ&&KR(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},P=e.sizeOverLifetime||{},M=e.colorOverLifetime,V=r.listIndex,N=m,F=(null==P?void 0:P.separateAxes)?{separateAxes:!0,x:KR(P.x),y:KR(P.y)}:{separateAxes:!1,x:KR(("size"in P?P.size:P.x)||1)},D=RA(O.anchor,O.particleOrigin);this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:KR(v.startLifetime),startDelay:KR(v.startDelay||0),startSpeed:KR(y.startSpeed||0),startColor:KR(v.startColor),endBehavior:l,duration:x,looping:l===sA.loop,maxCount:null!==(s=v.maxCount)&&void 0!==s?s:0,gravityModifier:KR(T||0).scaleXCoord(x),gravity:E,start3DSize:!!v.start3DSize,startTurbulence:R,turbulence:h,speedOverLifetime:y.speedOverLifetime&&KR(y.speedOverLifetime),linearVelOverLifetime:I,orbitalVelOverLifetime:w,forceTarget:C},v.startRotationZ&&(this.options.startRotation=KR(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=KR(v.startRotationX||0),this.options.startRotationY=KR(v.startRotationY||0),this.options.startRotationZ=KR(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=KR(v.startSizeX),this.options.startSizeY=KR(v.startSizeY)):(this.options.startSize=KR(v.startSize),this.options.sizeAspect=KR(v.sizeAspect||1));var U={listIndex:V,meshSlots:v.meshSlots,name:f,matrix:A,filter:e.filter,shaderCachePrefix:N,renderMode:O.renderMode||PS.BILLBOARD,side:O.side||RS.DOUBLE,gravity:E,duration:r.duration,blending:O.blending||AS.ALPHA,rotationOverLifetime:b,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:S,occlusion:!!O.occlusion,transparentOcclusion:!!O.transparentOcclusion,maxCount:v.maxCount,mask:O.mask,maskMode:null!==(u=O.maskMode)&&void 0!==u?u:CS.NONE,forceTarget:C,diffuse:O.texture,sizeOverLifetime:F,anchor:D};if(M){var B=M.color,k=M.opacity;U.colorOverLifetime={},k&&(U.colorOverLifetime.opacity=KR(M.opacity)),B&&(B[0]===oA.GRADIENT_COLOR?U.colorOverLifetime.color=M.color[1]:B[0]===oA.RGBA_COLOR?U.colorOverLifetime.color=oO.createWithData(p,{data:new Uint8Array(B[1]),width:1,height:1}):B instanceof oO&&(U.colorOverLifetime.color=B))}var z,G=[],j=[0,0,1,1];if(e.splits){var X=e.splits[0];j=(z=X[4])?[X[0],X[1],X[3],X[2]]:[X[0],X[1],X[2],X[3]]}if(S&&!S.animate)for(var W=z?S.row:S.col,H=z?S.col:S.row,Y=S.total||W*H,Z=0,q=0;q<W;q++)for(var K=0;K<H&&Z<Y;K++,Z++)G.push([q*j[2]/W+j[0],K*j[3]/H+j[1],j[2]/W,j[3]/H]);else G.push(j);U.textureFlip=z,this.uvs=G,this.particleMesh=new uL(U,{composition:c});var Q=e.trails;if(Q){this.trails={lifetime:KR(Q.lifetime),dieWithParticles:!1!==Q.dieWithParticles,sizeAffectsWidth:!!Q.sizeAffectsWidth,sizeAffectsLifetime:!!Q.sizeAffectsLifetime,inheritParticleColor:!!Q.inheritParticleColor,parentAffectsPosition:!!Q.parentAffectsPosition};var J={name:r.name+"_trail",matrix:A,minimumVertexDistance:Q.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(Q.maxPointPerTrail)||32,blending:Q.blending,texture:Q.texture,opacityOverLifetime:KR(Q.opacityOverLifetime||1),widthOverTrail:KR(Q.widthOverTrail||1),order:V+(Q.orderOffset||0),shaderCachePrefix:N,lifetime:this.trails.lifetime,occlusion:!!Q.occlusion,transparentOcclusion:!!Q.transparentOcclusion,textureMap:Q.textureMap,mask:O.mask,maskMode:O.maskMode};Q.colorOverLifetime&&Q.colorOverLifetime[0]===oA.GRADIENT_COLOR&&(J.colorOverLifetime=Q.colorOverLifetime[1]),Q.colorOverTrail&&Q.colorOverTrail[0]===oA.GRADIENT_COLOR&&(J.colorOverTrail=Q.colorOverTrail[1]),this.trailMesh=new fI(J,p)}this.transform=r.transform;var $,ee=sS([],aS(this.transform.position),!1),te=sS([],aS(this.transform.rotation),!1),re=e.emitterTransform&&e.emitterTransform.path;re&&(re[0]===oA.CONSTANT_VEC3?qA(ee,ee,re[1]):$=KR(re)),this.basicTransform={position:ee,rotation:te,path:$},this.updateEmitterTransform(0);var ie=[this.particleMesh.mesh];this.trailMesh&&ie.push(this.trailMesh.mesh),this.meshes=ie,this.reusable=r.reusable,this.setVisible(r.getVisible());var ne=e.interaction;ne&&(this.interaction={multiple:ne.multiple,radius:ne.radius,behavior:ne.behavior})}}return Object.defineProperty(e.prototype,"timePassed",{get:function(){return this.lastUpdate-this.loopStartTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lifetime",{get:function(){return this.timePassed/this.options.duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"particleCount",{get:function(){return this.particleLink.length},enumerable:!1,configurable:!0}),e.prototype.updateEmitterTransform=function(e){var t=this.parentTransform,r=this.basicTransform,i=r.path,n=sS([],aS(r.position),!1);if(i){var o=this.options.duration;qA(n,n,i.getValue(e/o))}if(this.transform.setPosition(n[0],n[1],n[2]),this.options.particleFollowParent&&t){var a=t.getWorldMatrix();this.particleMesh.mesh.worldMatrix=a,this.trailMesh&&(this.trailMesh.mesh.worldMatrix=a)}},e.prototype.addParticle=function(e,t){var r,i=this.particleLink,n=[e.delay+e.lifetime,0,e.delay,e];if(i.length<t)r=n[1]=i.length;else{var o=i.first;i.removeNode(o),r=n[1]=o.content[1]}i.pushNode(n),this.particleMesh.setPoint(e,r),this.clearPointTrail(r),this.parentTransform&&this.trailMesh&&this.trailMesh.setPointStartPos(r,this.parentTransform.position)},e.prototype.setVisible=function(e){this.particleMesh.mesh.setVisible(e),this.trailMesh&&this.trailMesh.mesh.setVisible(e)},e.prototype.setOpacity=function(e){var t=this.particleMesh.mesh.material,r=this.particleMesh.mesh.geometry,i=t.getVector4("uOpacityOverLifetimeValue")||[1,1,1,1];t.setVector4("uOpacityOverLifetimeValue",[i[0],i[1],i[2],e]);for(var n=r.getAttributeData("aColor")||[],o=0;o<n.length;o+=32)n[8*o+7]=e},e.prototype.setColor=function(e,t,r,i){var n=this.particleMesh.mesh.material,o=this.particleMesh.mesh.geometry,a=n.getVector4("uOpacityOverLifetimeValue")||[1,1,1,1];n.setVector4("uOpacityOverLifetimeValue",[a[0],a[1],a[2],i]);for(var s=o.getAttributeData("aColor")||[],u=0;u<s.length;u+=32)s[8*u+4]=e,s[8*u+5]=t,s[8*u+6]=r,s[8*u+7]=i},e.prototype.setParentTransform=function(e){this.parentTransform=e},e.prototype.getTextures=function(){var e,t,r,i,n=[];try{for(var o=oS(Object.values(this.particleMesh.mesh.material.textures)),a=o.next();!a.done;a=o.next()){var s=a.value;n.push(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}if(this.trailMesh)try{for(var u=oS(Object.values(this.trailMesh.mesh.material.textures)),c=u.next();!c.done;c=u.next()){s=c.value;n.push(s)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return n},e.prototype.start=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},e.prototype.stop=function(){this.ended=!0,this.started=!1},e.prototype.reset=function(){var e;this.particleMesh.clearPoints(),null===(e=this.trailMesh)||void 0===e||e.clearAllTrails(),this.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new dL((function(e,t){return e[0]-t[0]})),this.emission.bursts.forEach((function(e){return e.reset()})),this.frozen=!1},e.prototype.onUpdate=function(e){var t,r=this;if(this.started&&!this.frozen){var i=this.lastUpdate+e/1e3,n=this.particleMesh,o=this.trailMesh,a=this.options,s=this.loopStartTime,u=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,n.time=i,o&&(o.time=i,o.onUpdate(e));var c=this.particleLink,l=(i-s)/a.duration,f=this.timePassed,h=!1,p=function(){r.trails&&!h&&(h=!0,c.forEach((function(e){var t=aS(e,4),i=t[0],n=t[1],o=t[2],a=t[3];i<f?r.clearPointTrail(n):f>o&&r.updatePointTrail(n,l,a,o)})))};if(this.ended){if(!a.looping)if(this.reusable);else if(0===a.endBehavior){var d=c.last;d&&d.content[0]-s<f&&(this.onUpdate=function(){return r.onDestroy()})}}else{var m=a.duration,v=this.lifetime;if(f<m){var y=1/u.rateOverTime.getValue(v),g=Math.floor((f-this.lastEmitTime)/y),x=g,T=y/g,E=i,_=a.maxCount;this.updateEmitterTransform(f);for(var S=function(){var e=c.first;return r.emissionStopped||c.length===_&&e&&e.content[0]-s>f},A=0;A<x&&A<_&&!S();A++){(P=this.createPoint(v)).delay+=E+A*T,this.addParticle(P,_),this.lastEmitTime=f}for(var R=u.bursts,C=(null==R?void 0:R.length)-1,O=0;C>=0&&O<_&&!S();C--){var b=R[C],L=!b.disabled&&b.getGeneratorOptions(f,v);if(L){var I=u.burstOffsets[C],w=I&&I[L.cycleIndex]||[0,0,0];b.once&&this.removeBurst(C);for(A=0;A<L.count&&O<_&&!S();A++){var P;(P=this.initPoint(this.shape.generate({total:L.total,index:L.index,burstIndex:A,burstCount:L.count}))).delay+=E,O++,(t=P.transform).translate.apply(t,sS([],aS(w),!1)),this.addParticle(P,_)}}}}else if(a.looping)p(),this.loopStartTime=i-m,this.lastEmitTime-=m,this.lastUpdate-=m,u.bursts.forEach((function(e){return e.reset()})),this.particleLink.forEach((function(e){e[0]-=m,e[2]-=m,e[3].delay-=m})),n.minusTime(m),o&&o.minusTime(m),this.onIterate(this);else{this.ended=!0,this.onEnd(this),4===a.endBehavior&&(this.frozen=!0)}}p()}},e.prototype.onDestroy=function(){},e.prototype.getParticleBoxes=function(){var e=this.particleLink,t=this.particleMesh,r=[],i=this.particleCount,n=0;if(!e||!t)return r;for(var o=e.last,a=!1;!a;){var s=o.content[0],u=o.content[3];if(s>this.timePassed){var c=this.getPointPosition(u);r.push({center:c,size:u.transform.scale}),o.pre?o=o.pre:a=!0}++n>i&&(a=!0)}return r},e.prototype.raycast=function(e){var t=this.particleLink,r=this.particleMesh;if(t&&r){var i=t.last,n=[],o=[0,0,0],a=!1;if(i&&i.content)do{var s=aS(i.content,4),u=s[0],c=s[1];s[2];var l=s[3];if(!(u>this.timePassed))break;var f=this.getPointPosition(l),h=e.ray,p=!1;h&&(p=!!SR(o,h.center,h.direction,f,e.radius)),p&&(e.removeParticle&&(r.removePoint(c),this.clearPointTrail(c),t.removeNode(i),i.content=[0]),n.push(f),e.multiple||(a=!0))}while((i=i.pre)&&!a);return n}},e.prototype.clearPointTrail=function(e){var t;this.trails&&this.trails.dieWithParticles&&(null===(t=this.trailMesh)||void 0===t||t.clearTrail(e))},e.prototype.updatePointTrail=function(e,t,r,i){if(this.trailMesh){var n=this.trails,o=this.particleMesh,a=this.getPointPosition(r),s=n.inheritParticleColor?o.getPointColor(e):[1,1,1,1],u=r.transform.getWorldScale(),c=1,l=n.lifetime.getValue(t);if(n.sizeAffectsWidth&&(c*=u[0]),n.sizeAffectsLifetime&&(l*=u[0]),n.parentAffectsPosition&&this.parentTransform){qA(a,a,this.parentTransform.position);var f=this.trailMesh.getPointStartPos(e);f&&oR(a,a,f)}this.trailMesh.addPoint(e,a,{color:s,lifetime:l,size:c,time:i})}},e.prototype.getPointPosition=function(e){var t=e.transform,r=e.vel,i=e.lifetime,n=e.delay,o=e.gravity,a=void 0===o?[0,0,0]:o,s=this.options.forceTarget,u=[0,0,0],c=this.lastUpdate-n;t.assignWorldTRS(u);var l=FR([0,0,0],this.options,a,c,i,u,r);if(s){var f=s.target||[0,0,0],h=s.curve.getValue(c/i),p=1-h;l[0]=l[0]*p+f[0]*h,l[1]=l[1]*p+f[1]*h,l[2]=l[2]*p+f[2]*h}return l},e.prototype.onEnd=function(e){},e.prototype.onIterate=function(e){},e.prototype.initPoint=function(e){var t,r=this.options,i=this.lifetime,n=this.shape,o=r.startSpeed.getValue(i),a=r.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),s=cR([],e.position,a),u=new TC({position:s,valid:!0}),c=e.direction;if(c=iR(yI,lR(yI,c,a)),r.startTurbulence&&r.turbulence){for(var l=0;l<3;l++)_I[l]=r.turbulence[l].getValue(i);var f=pR(AI,_I);c=iR(yI,eR(c,c,f))}var h,p=TI,d=EI;n.alignSpeedDirection?(tR(d,c,3),this.upDirectionWorld||(this.upDirectionWorld=lR([],null!==(t=n.upDirection)&&void 0!==t?t:[0,0,1],a)),p=iR(p,uR(p,d,this.upDirectionWorld))):(p[0]=1,p[1]=p[2]=0,d[1]=1,d[0]=d[2]=0);var m=this.textureSheetAnimation;m&&m.animate&&((h=SI)[0]=m.animationDelay.getValue(i),h[1]=m.animationDuration.getValue(i),h[2]=m.cycles.getValue(i));var v=xI;r.start3DRotation?v=[r.startRotationX.getValue(i),r.startRotationY.getValue(i),r.startRotationZ.getValue(i)]:r.startRotation&&(v=[0,0,r.startRotation.getValue(i)]),u.setRotation.apply(u,sS([],aS(v),!1));var y=r.startColor.getValue(i);3===y.length&&(y[3]=1);var g=gI;if(r.start3DSize)g[0]=r.startSizeX.getValue(i),g[1]=r.startSizeY.getValue(i);else{var x=r.startSize.getValue(i),T=r.sizeAspect.getValue(i);g[0]=x,g[1]=0===T?0:x/T}var E=[0,0,0];return sR(E,c,o),r.particleFollowParent||(this.transform.assignWorldTRS([],[],_I),rR(g,g,_I)),u.setScale(g[0],g[1],1),{size:g,vel:E,color:y,delay:r.startDelay.getValue(i),lifetime:r.startLifetime.getValue(i),uv:CI(this.uvs,!0),gravity:r.gravity,sprite:h,dirY:d,dirX:p,transform:u}},e.prototype.addBurst=function(e,t){var r=!1;if(this.emission.bursts.includes(e)||(this.emission.bursts.push(e),r=!0),r&&t instanceof Array){var i=this.emission.bursts.indexOf(e);return this.emission.burstOffsets[i]=t,i}return-1},e.prototype.removeBurst=function(e){e<this.emission.bursts.length&&(this.emission.burstOffsets[e]=null,this.emission.bursts.splice(e,1))},e.prototype.createPoint=function(e){var t={total:this.emission.rateOverTime.getValue(e),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(t))},e}(),yI=[0,0,0],gI=[0,0],xI=[0,0,0],TI=[0,0,0],EI=[0,0,0],_I=[0,0,0],SI=[0,0,0],AI=[];function RI(e){var t={};return Array.isArray(e)&&e.forEach((function(e){var r=e instanceof Array,i=r?e[0]:e.index,n=t[i];n||(n=t[i]=[]),r?n.push(e.slice(1,4)):n.push([+e.x,+e.y,+e.z])})),t}function CI(e,t){var r=Math.floor(Math.random()*e.length),i=e[r];return t||e.splice(r,1),i}var OI=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return tS(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return wS.particle},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"contentVisible",{get:function(){return!this.destroyed},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(e){this.particle=e.content},r.prototype.onLifetimeBegin=function(e,t){var r=this;return t&&(t.name=this.name,t.start(),t.onDestroy=function(){r.destroyed=!0}),t},r.prototype.onItemUpdate=function(e,t){var r;if(this.content){var i=!this.visible,n=this.parentId&&(null===(r=this.composition)||void 0===r?void 0:r.getItemByID(this.parentId));if(!i&&n){var o=n.getRenderData();o&&(this.content.setParentTransform(o.transform),o.visible||(i=!1))}i?this.content.setVisible(!0):(this.content.setVisible(!1),this.content.onUpdate(e))}},r.prototype.onItemRemoved=function(t,r){r&&(t.destroyTextures(r.getTextures()),r.meshes.forEach((function(t){return t.dispose({material:{textures:e.DestroyOptions.keep}})})))},r.prototype.setColor=function(e,t,r,i){this.content.setColor(e,t,r,i)},r.prototype.setOpacity=function(e){this.content.setOpacity(e)},r.prototype.stopParticleEmission=function(){this.content&&(this.content.emissionStopped=!0)},r.prototype.resumeParticleEmission=function(){this.content&&(this.content.emissionStopped=!1)},r.prototype.doCreateContent=function(e){return rA(this.particle),new vI(this.particle,e.getRendererOptions(),this)},r.prototype.isEnded=function(e){return t.prototype.isEnded.call(this,e)&&this.destroyed},r.prototype.getBoundingBox=function(){var t=this.content;if(t){var r=t.getParticleBoxes();return{type:e.HitTestType.sphere,area:r}}},r.prototype.getHitTestParams=function(t){var r,i=this,n=null===(r=this.content)||void 0===r?void 0:r.interaction;if(t||n)return{type:e.HitTestType.custom,collect:function(e){var t;return null===(t=i.content)||void 0===t?void 0:t.raycast({radius:(null==n?void 0:n.radius)||.4,multiple:!!(null==n?void 0:n.multiple),removeParticle:(null==n?void 0:n.behavior)===cA.removeParticle,ray:e})}}},r}(EC),bI=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.meshes=[],e}return tS(r,t),r.precompile=function(t,r,i){var n=t[0],o={rotationOverLifetime:{x:!1,y:!1,z:!1},positionOverLifetime:{speedOverLifetime:!1,linearX:!1,linearY:!1,linearZ:!1,orbitalX:!1,orbitalY:!1,orbitalZ:!1,forceCurve:!1},colorOverLifetime:{opacity:!1,color:!1},sizeOverLifetime:{x:!1,y:!1}},a={colorOverLifetime:{opacity:1,color:[oA.RGBA_COLOR,[255,255,255,255]]},positionOverLifetime:{speedOverLifetime:1},sizeOverLifetime:{x:1,y:1}},s=r.engine.gpuCapability,u=s.level,c=(null!=i?i:{}).env,l=r.getShaderLibrary(),f=[],h=[],p=[],d=0,m=0;return n.items.forEach((function(e){e.type===wS.particle&&(h.push(e),function(e){if(e.type===wS.particle){var t=e.content;t.rotationOverLifetime||(t.rotationOverLifetime={});var r=t.rotationOverLifetime;r.z||(r.z=[oA.CONSTANT,0]),r.separateAxes||(delete r.y,delete r.x),t.sizeOverLifetime||(t.sizeOverLifetime={});var i=t.sizeOverLifetime;i.separateAxes||delete i.y,i.size&&(i.x=i.size,delete i.size),i.x||(i.x=[oA.CONSTANT,1])}}(e),2===u&&Object.keys(o).forEach((function(t){var r=o[t],i=e.content[t];i&&Object.keys(r).forEach((function(e){i[e]&&(r[e]=!0,kS(f,t))}))})))})),h.forEach((function(t){var r,i,n=t.content;2===u&&(f.forEach((function(e){var t=o[e],r=n[e]||(n[e]={});Object.keys(t).forEach((function(i){if(t[i]&&!r[i]){var n=a[e]&&a[e][i]||0;r[i]=isNaN(n)?n:[oA.CONSTANT,n]}}))})),o.positionOverLifetime.forceCurve&&(n.positionOverLifetime.forceTarget=!0),(o.rotationOverLifetime.x||o.rotationOverLifetime.y)&&(n.rotationOverLifetime.separateAxes=!0),o.sizeOverLifetime.y&&(n.sizeOverLifetime.separateAxes=!0));var h=fL(t,c,s),v=h.shader,y=h.fragment,g=h.vertex;if(p.push(v),d=Math.max(d,y),m=Math.max(m,g),t.content.trails){var x=function(e,t,r,i,n){void 0===i&&(i="");var o=0,a=fO(uO)?1:0,s=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",a],["ENV_EDITOR",i===dS]],u={curves:[],index:0,max:0,lineSegCount:0,curveCount:0};return e.colorOverLifetime&&(s.push(["COLOR_OVER_LIFETIME",!0]),o|=1),e.colorOverTrail&&(s.push(["COLOR_OVER_TRAIL",!0]),o|=4),t>64&&(s.push(["ATTR_TRAIL_START",1]),o|=8),rC(u,e.opacityOverLifetime),rC(u,e.widthOverTrail),s.push(["VERT_CURVE_VALUE_COUNT",u.index],["VERT_MAX_KEY_FRAME_COUNT",u.max]),{vertex:JO,fragment:KO,marcos:s,shared:!0,name:"trail#"+r,cacheId:"-t:+".concat(o,"+").concat(u.index,"+").concat(u.max)}}(t.content.trails,t.content.options.maxCount,t.name,c,s);x.vertex=HC(null!==(r=x.marcos)&&void 0!==r?r:[],x.vertex,e.ShaderType.vertex,u),x.fragment=HC(null!==(i=x.marcos)&&void 0!==i?i:[],x.fragment,e.ShaderType.fragment,u),x.glslVersion=2===u?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1,l.addShader(x)}})),p.forEach((function(t){var r,i;2===u?(hL(t,m,d),t.glslVersion=e.GLSLVersion.GLSL3):t.glslVersion=e.GLSLVersion.GLSL1,t.vertex=HC(null!==(r=t.marcos)&&void 0!==r?r:[],t.vertex,e.ShaderType.vertex,u),t.fragment=HC(null!==(i=t.marcos)&&void 0!==i?i:[],t.fragment,e.ShaderType.fragment,u),l.addShader(t)})),2===u&&h.forEach((function(e){e.content.options.meshSlots=[m,d]})),Promise.resolve()},r.prototype.onCompositionItemLifeBegin=function(e,t){t instanceof OI&&this.add(t.content)},r.prototype.onCompositionItemRemoved=function(e,t){t instanceof OI&&t.content&&this.remove(t.content,e.renderFrame)},r.prototype.prepareRenderFrame=function(e,t){return this.meshes.forEach((function(e){return t.addMeshToDefaultRenderPass(e)})),this.meshes.length=0,!1},r.prototype.add=function(e){var t=this;e.meshes.forEach((function(e){return kS(t.meshes,e)}))},r.prototype.remove=function(e,t){var r=this;e.meshes.forEach((function(e){zS(r.meshes,e),t.removeMeshFromDefaultRenderPass(e)}))},r}(LC);var LI,II=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t}(LC),wI=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._v_priority=1,t.childrenVisible=!0,t}return tS(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return wS.null},enumerable:!1,configurable:!0}),t.prototype.onConstructed=function(e){this.cal=e.content,this.relative=e.relative},t.prototype.onLifetimeBegin=function(e,t){t.active=!0},t.prototype.onItemRemoved=function(e,t){},t.prototype.onItemUpdate=function(e,t){this.content&&(this.content.updateTime(this.time),this.renderData=this.content.getRenderData(this.content.time))},t.prototype.setScale=function(e,t,r){this.content.startSize=[e,t,r]},t.prototype.scale=function(e,t,r){var i=this.content.startSize.slice();this.content.startSize=[e*i[0],t*i[1],r*i[2]]},t.prototype.getHitTestParams=function(e){},t.prototype.getRenderData=function(){return this.renderData},t.prototype.getChildrenVisible=function(){return this.childrenVisible},t.prototype.setChildrenVisible=function(e){this.childrenVisible!==e&&(this.childrenVisible=!!e,this.handleVisibleChanged(this.visible))},t.prototype.doCreateContent=function(e){var t=new tL(this.cal,this);return t.renderData=t.getRenderData(0,!0),t},t.prototype.handleVisibleChanged=function(e){this.content&&(this.content.visible=e||this.childrenVisible)},t}(EC),PI=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return tS(t,e),t.prototype.getItemGeometryData=function(e,t){var r=e,i=r.splits,n=r.renderer,o=r.textureSheetAnimation,a=r.startSize;r.textLayout;var s=aS(a,2),u=s[0],c=s[1];if(n.shape){for(var l=n.shape,f=l.index,h=l.aPoint,p=new Float32Array(h),d=0;d<p.length;d+=6)p[d]*=u,p[d+1]*=c;return{index:f,aPoint:Array.from(p)}}var m=.5,v=.5,y=[-m,v,-m,-v,m,v,m,-v],g=[],x=[],T=2,E=2;1===i.length&&(T=1,E=1);for(var _=0;_<T;_++)for(var S=0;S<E;S++){var A=4*(2*S+_),R=o?[0,0,1,1,i[0][4]]:i[2*S+_],C=R[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],O=((_+_+1)/T-1)/2,b=((S+S+1)/E-1)/2,L=R[0],I=R[1],w=R[4]?R[3]:R[2],P=R[4]?R[2]:R[3],M=[y[0]/T+O,y[1]/E+b,y[2]/T+O,y[3]/E+b,y[4]/T+O,y[5]/E+b,y[6]/T+O,y[7]/E+b];g.push(M[0]*u,M[1]*c,C[0]*w+L,C[1]*P+I,t,0,M[2]*u,M[3]*c,C[2]*w+L,C[3]*P+I,t,0,M[4]*u,M[5]*c,C[4]*w+L,C[5]*P+I,t,0,M[6]*u,M[7]*c,C[6]*w+L,C[7]*P+I,t,0),this.lineMode?x.push(A,1+A,1+A,3+A,3+A,2+A,2+A,A):x.push(A,1+A,2+A,2+A,1+A,3+A)}return{index:x,aPoint:g}},t}(zb),MI=function(e){var t,r,i,n,o,a;this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var s=e.textColor,u=void 0===s?[1,1,1,1]:s,c=e.fontSize,l=void 0===c?40:c,f=e.outline,h=e.shadow,p=e.fontWeight,d=void 0===p?"normal":p,m=e.fontStyle,v=void 0===m?"normal":m,y=e.fontFamily,g=void 0===y?"sans-serif":y;this.textColor=u,this.textWeight=d,this.fontStyle=v,this.fontFamily=g,this.fontSize=l,f&&(this.isOutlined=!0,this.outlineColor=null!==(t=f.outlineColor)&&void 0!==t?t:[1,1,1,1],this.outlineWidth=null!==(r=f.outlineWidth)&&void 0!==r?r:1,this.fontOffset+=this.outlineWidth),h&&(this.hasShadow=!0,this.shadowBlur=null!==(i=h.shadowBlur)&&void 0!==i?i:2,this.shadowColor=null!==(n=h.shadowColor)&&void 0!==n?n:[0,0,0,1],this.shadowOffsetX=null!==(o=h.shadowOffsetX)&&void 0!==o?o:0,this.shadowOffsetY=null!==(a=h.shadowOffsetY)&&void 0!==a?a:0),this.fontStyle!==xA.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},VI=function(){function e(){}return e.measureFont=function(t){if(e._fonts[t])return e._fonts[t];var r={ascent:0,descent:0,fontSize:0},i=e._canvas,n=i.getContext("2d",{willReadFrequently:!0});n.font=t;var o=e.METRICS_STRING+e.BASELINE_SYMBOL,a=Math.ceil(n.measureText(o).width),s=Math.ceil(n.measureText(e.BASELINE_SYMBOL).width),u=Math.ceil(e.HEIGHT_MULTIPLIER*s);s=s*e.BASELINE_MULTIPLIER|0,i.width=a,i.height=u,n.fillStyle="#f00",n.fillRect(0,0,a,u),n.font=t,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,s);var c=n.getImageData(0,0,a,u).data,l=c.length,f=4*a,h=0,p=0,d=!1;for(h=0;h<s;++h){for(var m=0;m<f;m+=4)if(255!==c[p+m]){d=!0;break}if(d)break;p+=f}for(r.ascent=s-h,p=l-f,d=!1,h=u;h>s;--h){for(m=0;m<f;m+=4)if(255!==c[p+m]){d=!0;break}if(d)break;p-=f}return r.descent=h-s,r.fontSize=r.ascent+r.descent,e._fonts[t]=r,r},Object.defineProperty(e,"_canvas",{get:function(){var t;return fO(cO)?(t=window._createOffscreenCanvas(10,10),e.__canvas=t):e.__canvas||((t=document.createElement("canvas")).width=t.height=10,e.__canvas=t),e.__canvas},enumerable:!1,configurable:!0}),e._fonts={},e.METRICS_STRING="|ÉqÅ",e.BASELINE_SYMBOL="M",e.BASELINE_MULTIPLIER=1.4,e.HEIGHT_MULTIPLIER=2,e}(),NI=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];e.QTextWrapMode=void 0,(LI=e.QTextWrapMode||(e.QTextWrapMode={}))[LI.Default=0]="Default",LI[LI.Clip=1]="Clip",LI[LI.Ellipsis=2]="Ellipsis";var FI=function(){function t(t,r){var i,n,o,a,s,u,c,l,f,h;this.left=0,this.top=0,this.fontSize=48,this.fontFamily="Arial",this.color="black",this.letterSpacing=0,this.maxLineWidth=0,this.wrap=e.QTextWrapMode.Clip,this.scaleX=1,this.scaleY=1,this.angle=0,this.active=!0,this.padding=0,this.borderColor="#ffffffff",this.borderWidth=1,this.fontProperties={ascent:0,descent:0,fontSize:0},this.fontVariant="normal",this.originX="left",this.originY="top",this.ellipsis="…",this.text=t,this.left=null!==(i=r.left)&&void 0!==i?i:0,this.top=null!==(n=r.top)&&void 0!==n?n:0,this.maxLineWidth=null!==(o=r.maxWidth)&&void 0!==o?o:0,this.letterSpacing=null!==(a=r.letterSpacing)&&void 0!==a?a:0,this.originX="left",this.originY="top",this.color=null!==(s=r.color)&&void 0!==s?s:"black",this.fontFamily=null!==(u=r.fontFamily)&&void 0!==u?u:"Arial",this.fontSize=null!==(c=r.fontSize)&&void 0!==c?c:48,this.wrap=null!==(l=r.wrap)&&void 0!==l?l:e.QTextWrapMode.Clip,this.fontStyle=null!==(f=r.fontStyle)&&void 0!==f?f:"normal",this.textAlign="left",this.textBaseline="alphabetic",this.fontWeight="normal",this.angle=null!==(h=r.angle)&&void 0!==h?h:0,this.name=r.name||""}return t.prototype.update=function(){this.updateDimension()},t.prototype.render=function(){if(void 0!==this.viewer){var e=this.viewer.renderContext;void 0!==e&&(e.save(),this.setRenderTransform(e),this.renderText(e),this.active&&this.drawBorders(e),e.restore())}},t.prototype.init=function(e){this.viewer=e,this.updateDimension()},t.prototype.getLayout=function(){var e=this.viewer.scaleX,t=this.viewer.scaleY;return{x:this.left*e,y:this.top*t,width:this.width*e,height:this.height*t}},t.prototype.updateDimension=function(){var e=this.viewer.renderContext;this.configTextStyle(e),this.configTextLayout(e);var t=this.getFontDesc();this.fontProperties=VI.measureFont(t),0===this.fontProperties.fontSize&&(this.fontProperties.fontSize=this.fontSize,this.fontProperties.ascent=this.fontSize);var r=this.createCharsFromText(e,this.text),i=0;if(r.length>0){var n=r[r.length-1];i=n.left+n.width}this.chars=r,this.maxLineWidth=i,void 0===this.height&&(this.height=this.fontProperties.fontSize),void 0===this.width&&(this.width=this.maxLineWidth)},t.prototype.configTextStyle=function(e){e.font=this.getFontDesc(),e.fillStyle=this.color},t.prototype.getFontDesc=function(){for(var e="number"==typeof this.fontSize?"".concat(this.fontSize,"px"):this.fontSize,t=this.fontFamily.split(","),r=t.length-1;r>=0;r--){var i=t[r].trim();/([\"\'])[^\'\"]+\1/.test(i)||NI.includes(i)||(i='"'.concat(i,'"')),t[r]=i}return t.push("Arial, Helvetica, sans-serif"),"".concat(this.fontStyle," ").concat(this.fontVariant," ").concat(this.fontWeight," ").concat(e," ").concat(t.join(","))},t.prototype.configTextLayout=function(e){e.textBaseline=this.textBaseline,e.textAlign=this.textAlign},t.prototype.setRenderTransform=function(e){e.scale(this.scaleX,this.scaleY),e.translate(this.left,this.top)},t.prototype.renderText=function(e){this.drawCharsInTextBox(e,{min:[0,0],max:[0+this.width,0+this.height]})},t.prototype.drawCharsInTextBox=function(t,r){var i=this.chars,n=0;if(i.length>0){var o=i[i.length-1];n=o.left+o.width}var a=r.max[0]-r.min[0],s=0;"left"===this.textAlign?s=0:"center"===this.textAlign?s=.5*(a-n):"right"===this.textAlign&&(s=a-n),this.addOffsetToChars(i,s);var u=this.cloneChars(this.clipCharsWithTextBox(i,r)),c=u;this.wrap===e.QTextWrapMode.Ellipsis&&0===(c=this.replaceCharWithEllipsis(t,u,r)).length&&0!==i.length&&this.addEllipsisToChars(t,c,r),this.drawCharsFromLeft(t,c)},t.prototype.addEllipsisToChars=function(e,t,r){var i,n,o,a=e.measureText(this.ellipsis).width;if("left"===this.textAlign)t.push({char:this.ellipsis,left:r.min[0],top:0,width:a,heigh:null!==(i=this.height)&&void 0!==i?i:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else if("right"===this.textAlign)t.push({char:this.ellipsis,left:r.max[0]-a,top:0,width:a,heigh:null!==(n=this.height)&&void 0!==n?n:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else{var s=.5*(r.max[0]+r.min[0]);t.push({char:this.ellipsis,left:s-.5*a,top:0,width:a,heigh:null!==(o=this.height)&&void 0!==o?o:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0})}},t.prototype.createCharsFromText=function(e,t){var r=t.split(""),i=0,n=0;"top"===this.textBaseline?n=0:"middle"===this.textBaseline?n+=.5*this.fontProperties.ascent:"alphabetic"===this.textBaseline&&(n+=this.fontProperties.ascent);for(var o=[],a=0;a<r.length;++a){var s=r[a],u=Math.floor(e.measureText(s).width),c={left:i,top:n,width:u,heigh:this.fontSize,char:s,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!1,scale:1,index:a};o.push(c),i+=u+this.letterSpacing}return o},t.prototype.addOffsetToChars=function(e,t){return e.forEach((function(e){e.left+=t})),e},t.prototype.clipCharsWithTextBox=function(e,t){for(var r=[],i=0;i<e.length;++i){var n=e[i];n.left>=t.min[0]&&n.left+n.width<t.max[0]+.5&&r.push(n)}return r},t.prototype.cloneChars=function(e){return e.map((function(e){return rS({},e)}))},t.prototype.replaceCharWithEllipsis=function(e,t,r){var i=e.measureText(this.ellipsis).width;if(t.length>0){if(0!==t[0].index)(n=rS({},t[0])).char=this.ellipsis,n.isEllipsis=!0,n.width=i,t=this.findEllipsisPositionAndReplaceCharsFromLeft(t,n,r);var n,o=t.length-1,a=this.chars.length;if(t[o].index!==a-1)(n=rS({},t[0])).char=this.ellipsis,n.isEllipsis=!0,n.width=i,t=this.findEllipsisPositionAndReplaceCharsFromRight(t,n,r)}return t},t.prototype.findEllipsisPositionAndReplaceCharsFromLeft=function(e,t,r){for(var i=0,n=0;n<e.length;++n){var o=e[n];if(i=n,o.left+o.width-t.width>=r.min[0])break}var a=e[i];t.left=a.left+a.width-t.width;for(n=0;n<i+1;++n)e.shift();return[t].concat(e)},t.prototype.findEllipsisPositionAndReplaceCharsFromRight=function(e,t,r){for(var i=e.length-1,n=i;n>=0;--n){if(i=n,e[n].left+t.width<=r.max[0])break}t.left=e[i].left;for(n=e.length-1;n>=i;--n)e.pop();return e.concat([t])},t.prototype.drawCharsFromLeft=function(e,t){var r=e.textAlign||"left";e.textAlign="left";for(var i=0;i<t.length;++i){var n=t[i];e.fillText(n.char,n.left,n.top)}e.textAlign=r},t.prototype.drawBorders=function(e){this.padding;var t=this.borderWidth;e.strokeStyle=this.borderColor,e.lineWidth=t;var r=this.width,i=this.height,n=0,o=0;"center"===this.originX?n-=this.width/2:"right"===this.originX&&(n-=this.width),"center"===this.originY?o-=this.height/2:"bottom"===this.originY&&(o-=this.height),e.strokeRect(n+t/2,o+t/2,r-t,i-t)},t}(),DI=function(){function e(e,t,r,i,n,o){var a;this.textList=[],a="string"==typeof e?document.getElementById(e):e,this.scaleX=null!=i?i:1,this.scaleY=null!=n?n:1,this.flipY=null!=o&&o,this.width=t,this.height=r,a.style.width="".concat(t*this.scaleX,"px"),a.style.height="".concat(r*this.scaleY,"px");this.devicePixelRatio=1,a.width=1*t*this.scaleX,a.height=1*r*this.scaleY,a.className="lower-canvas",this.renderCanvas=a,this.renderContext=this.renderCanvas.getContext("2d"),this.renderContext.scale(1*this.scaleX,1*this.scaleY)}return e.prototype.initDimension=function(e,t,r,i){this.width=e,this.height=t,this.scaleX=null!=r?r:1,this.scaleY=null!=i?i:1,this.renderCanvas.style.width="".concat(e*this.scaleX,"px"),this.renderCanvas.style.height="".concat(t*this.scaleY,"px");var n=this.devicePixelRatio;this.renderCanvas.width=n*e*this.scaleX,this.renderCanvas.height=n*t*this.scaleY,this.flipY&&(this.renderContext.translate(0,this.height),this.renderContext.scale(1,-1)),this.renderContext.scale(n*this.scaleX,n*this.scaleY)},e.prototype.clearText=function(){this.textList=[]},e.prototype.clearCanvasWithContext=function(e){e.clearRect(0,0,this.width,this.height)},e.prototype.clearCanvas=function(){this.clearCanvasWithContext(this.renderContext)},e.prototype.addObject=function(e){e.init(this),this.textList.push(e)},e.prototype.render=function(){this.clearCanvasWithContext(this.renderContext),this.renderContext.fillStyle="rgba(255, 255, 255, 0.0039)",this.renderContext.fillRect(0,0,this.width,this.height);var e=this.background;e&&void 0!==e.width&&void 0!==e.height&&this.renderContext.drawImage(e,0,0,e.width,e.height,0,0,this.width,this.height);for(var t=0;t<this.textList.length;++t){this.renderContext.save();var r=this.textList[t];r.update(),r.render(),this.renderContext.restore()}},e}();function UI(e,t){return t=t||{},new Promise((function(r,i){var n=new XMLHttpRequest;n.responseType=(null==t?void 0:t.responseType)||"json",n.addEventListener("load",(function(){return r(n.response)})),n.addEventListener("error",(function(){return i(Error("load ".concat(e," fail")))})),n.open((null==t?void 0:t.method)||"get",e),n.send(null==t?void 0:t.data)}))}function BI(e,t,r,i,n){return iS(this,void 0,void 0,(function(){var o,a,s,u,c,l,f,h,p,d;return nS(this,(function(m){switch(m.label){case 0:return o={},a=[],i=i||{},r=r||{},t.asImage?(s=t.content.replace(/\$/g,""),u=r[s]||t.variables[s],c=function(e){var r=(null==i?void 0:i.canvas)||document.createElement("canvas"),o=r.width=t.backgroundWidth,a=r.height=t.backgroundHeight,s=r.getContext("2d");return null==s||s.clearRect(0,0,o,a),n&&(null==s||s.translate(0,a),null==s||s.scale(1,-1)),null==s||s.drawImage(e,0,0,e.width,e.height,0,0,o,a),r},u?[2,$C(u).then(c)]:[2,kI(e).then(c)]):(l=i.templateScale||1,Object.keys(t.variables).forEach((function(e){var i=t.variables[e];if(r.hasOwnProperty(e)&&(i=r[e]),/^image_/.test(e)){var n=i instanceof Array,s=n?i[0]:i;a.push(function(e,t){return r(e,(function(i){return t?r(t,(function(){return e})):e}));function r(e,t){return/^(https?:)?\/\//.test(e)?UI(e,{responseType:"blob"}).then(zI,t):Promise.resolve(e)}}(s,n&&i[1]).then((function(t){return o[e]=t})))}else o[e]=i})),[4,Promise.all(a)]);case 1:return m.sent(),[4,$C(e)];case 2:return f=m.sent(),h=t.content.replace(/\$([\w_]+)\$/g,(function(e,t){return o[t]})).replace('width="'.concat(t.width,'px"'),'width="'.concat(t.width*l,'px"')).replace('height="'.concat(t.height,'px"'),'height="'.concat(t.height*l,'px"')),[4,$C("data:image/svg+xml,".concat(encodeURIComponent(h)))];case 3:return p=m.sent(),(d=(null==i?void 0:i.canvas)||document.createElement("canvas")).width=f.width*l,d.height=f.height*l,[2,new Promise((function(e,r){var i=d.getContext("2d");i.clearRect(0,0,d.width,d.height),n&&(i.translate(0,d.height),i.scale(1,-1)),i.drawImage(f,0,0,f.width,f.height,0,0,d.width,d.height),i.drawImage(p,0,0,p.width,p.height,(t.x||0)*l,(t.y||0)*l,t.width*l/t.backgroundWidth*f.width,t.height*l/t.backgroundHeight*f.height),e(d)}))]}}))}))}function kI(e){return lC(e)?$C(e):Promise.resolve(e)}function zI(e){return new Promise((function(t,r){var i=new FileReader;i.readAsDataURL(e),i.onload=function(){t(i.result)},i.onerror=r}))}var GI=["serif","sans-serif","monospace","courier"],jI=800,XI=600,WI=new Map,HI=new(function(){function e(){this.elements=[]}return e.prototype.dispose=function(){this.elements.forEach((function(e){return e.remove()})),this.elements=[]},e.prototype.getCanvas=function(){if(this.elements.length)return this.elements.shift();if(fO(cO))return window._createOffscreenCanvas(10,10);var e=document.createElement("canvas");return e.getContext("2d",{willReadFrequently:!0}),e},e.prototype.saveCanvas=function(e){e.width=e.height=1,this.elements.length<3?kS(this.elements,e):e.remove()},e}());function YI(e,t){var r,i,n;if(null===(r=null==e?void 0:e.background)||void 0===r?void 0:r.name){var o=e.background.name;t&&t[o]?n=t[o]:(null===(i=e.background)||void 0===i?void 0:i.url)&&(n=e.background.url)}return n}function ZI(t,r,i,n,o){var a;return iS(this,void 0,void 0,(function(){var s,u,c,l,f,h,p,d,m,v,y;return nS(this,(function(g){switch(g.label){case 0:if(!r)throw Error("image not provided");return s=(null==o?void 0:o.templateScale)||1,u=s,c=s,l=r,f=r.width,h=r.height,i?(f=i.width,h=i.height,r.width===f&&r.height===h||(u*=r.width/i.width,c*=r.height/i.height),(p=YI(i,n))&&p!==r.src?lC(p)?[4,$C(p)]:[3,2]:[3,4]):[3,5];case 1:return d=g.sent(),[3,3];case 2:d=p,g.label=3;case 3:l=d,g.label=4;case 4:(m=i.content)&&(v=function(t,r,i){var n=t.fonts,o=[];return t.texts.forEach((function(a){var s,u=a.t,c=a.x,l=a.y,f={weight:400,family:"serif",size:48,style:xA.normal};void 0!==a.f&&(f=n[a.f]);var h=a.n;h&&r&&r.hasOwnProperty(h)&&(u="".concat(r[h]));var p=new FI(u,{left:c,top:l,fontSize:f.size,fontFamily:f.family,fontWeight:"".concat(f.weight),fontStyle:"normal",name:h});if(void 0!==a.r&&(p.angle=a.r*Math.PI/180),p.active=null!==(s=null==i?void 0:i.debug)&&void 0!==s&&s,void 0!==a.w&&(p.width=a.w),void 0!==f.letterSpace&&(p.letterSpacing=f.letterSpace),a.of===mA.display?p.wrap=e.QTextWrapMode.Default:a.of===mA.clip?p.wrap=e.QTextWrapMode.Clip:a.of===mA.ellipsis&&(p.wrap=e.QTextWrapMode.Ellipsis),void 0!==a.c){var d=t.colors[a.c][1],m=1;void 0!==d[3]&&(m=d[3]/255),p.color="rgba(".concat(d[0],", ").concat(d[1],", ").concat(d[2],", ").concat(m,")")}a.a===yA.left?p.textAlign="left":a.a===yA.middle?p.textAlign="center":a.a===yA.right&&(p.textAlign="right"),f.style===xA.normal?p.fontStyle="normal":f.style===xA.italic?p.fontStyle="italic":f.style===xA.oblique&&(p.fontStyle="oblique"),void 0!==f.weight&&(p.fontWeight=String(f.weight)),(null==i?void 0:i.borderColor)&&(p.borderColor=i.borderColor),void 0!==(null==i?void 0:i.borderWidth)&&(p.borderWidth=i.borderWidth),o.push(p)})),o}(m,n,rS(rS({},o),{scaleX:u,scaleY:c})),v.forEach((function(e){t.addObject(e)}))),g.label=5;case 5:return t.flipY=null!==(a=null==o?void 0:o.flipY)&&void 0!==a&&a,t.initDimension(f,h,u,c),t.background=l,t.render(),(y=null==o?void 0:o.textLayouts)&&(y.length=0,t.textList.forEach((function(e){var t=e.getLayout(),r={x:t.x,y:t.y,width:t.width,height:t.height};y.push(r)}))),[2]}}))}))}function qI(e){return iS(this,void 0,void 0,(function(){var t,r,i;return nS(this,(function(n){switch(n.label){case 0:if(!e.content||!e.content.fonts)return[3,4];t=e.content.fonts,r=function(e){var r,i,n,o,a;return nS(this,(function(s){switch(s.label){case 0:return r=t[e].family,i=t[e].url,n=!1,GI.includes(r)?n=!0:void 0!==document.fonts&&document.fonts.forEach((function(e){e.family===r&&(n=!0)})),n||void 0===i||""===i?[3,2]:(o="url(".concat(i,")"),void 0===document.fonts?[3,2]:[4,(a=new FontFace("".concat(r),o)).load()]);case 1:s.sent(),document.fonts.add(a),s.label=2;case 2:return[2]}}))},i=0,n.label=1;case 1:return i<t.length?[5,r(i)]:[3,4];case 2:n.sent(),n.label=3;case 3:return++i,[3,1];case 4:return[2]}}))}))}function KI(e,t,r,i,n){return iS(this,void 0,void 0,(function(){var o,a,s;return nS(this,(function(u){switch(u.label){case 0:return o=rS(rS({},i),{flipY:n}),a=function(e,t,r){var i,n=(null==r?void 0:r.templateScale)||1,o=(null==r?void 0:r.flipY)||!1;if(null==r?void 0:r.canvas){if(!(i=WI.get(r.canvas))){var a=new DI(r.canvas,e,t,n,n,o);WI.set(r.canvas,a),i=a}}else{var s=HI.getCanvas();i=new DI(s,jI,XI,n,n,o)}return i}(jI,jI,o),void 0===t?[3,2]:[4,qI(t)];case 1:u.sent(),u.label=2;case 2:return a.clearText(),"string"!=typeof e?[3,5]:[4,$C(e)];case 3:return s=u.sent(),[4,ZI(a,s,t,r,o)];case 4:return u.sent(),[2,a.renderCanvas];case 5:return[4,ZI(a,e,t,r,o)];case 6:return u.sent(),[2,a.renderCanvas]}}))}))}function QI(e,t,r,i,n){return iS(this,void 0,void 0,(function(){return nS(this,(function(o){return 2===t.v?[2,KI(e,t,r,{templateScale:null==i?void 0:i.templateScale,toData:!0},n)]:[2,BI(e,t,r,i,n)]}))}))}var JI=function(){function e(e,t){this.width=0,this.height=0;var r=e.textHeight,i=void 0===r?100:r,n=e.textWidth,o=void 0===n?100:n,a=e.textOverflow,s=void 0===a?mA.display:a,u=e.textBaseline,c=void 0===u?vA.top:u,l=e.textAlign,f=void 0===l?yA.left:l,h=e.text,p=e.letterSpace,d=void 0===p?0:p,m=e.autoWidth,v=void 0!==m&&m,y=e.fontSize,g=e.lineHeight,x=void 0===g?y:g,T=y+d;this.autoWidth=v,this.maxTextWidth=h.length*T,this.width=o,this.height=i,this.letterSpace=d,this.overFlow=s,this.textBaseline=c,this.textAlign=f,this.lineHeight=x}return e.prototype.getOffsetY=function(e){var t=0,r=(e.fontSize+e.outlineWidth)*e.fontScale;switch(this.textBaseline){case 0:t=r;break;case 1:t=(this.height+r)/2;break;case 2:t=this.height-r/2}return t},e.prototype.getOffsetX=function(e,t){var r=0;switch(this.textAlign){case 0:r=e.outlineWidth*e.fontScale;break;case 1:r=(this.width*e.fontScale-t)/2;break;case 2:r=this.width*e.fontScale-t}return r},e.prototype.setSize=function(e,t){this.width=e,this.height=t},e}(),$I=function(e){function t(t,r,i){var n=e.call(this,t,r,i)||this;n.isDirty=!0;var o=t.options,a=n.basicTransform.scale;return n.canvas=HI.getCanvas(),HI.saveCanvas(n.canvas),n.context=n.canvas.getContext("2d",{willReadFrequently:!0}),n.engine=i.composition.getEngine(),n.textStyle=new MI(o),n.textLayout=new JI(o,a),n.text=o.text,n.mesh=new PI(n.engine,n.renderInfo,i.composition),n.mesh.setItems([n]),n.updateTexture(),n}return tS(t,e),t.prototype.setFontSize=function(e){this.textStyle.fontSize!==e&&(this.textStyle.fontSize=e,this.textLayout.lineHeight=1.5175*this.textStyle.fontSize,this.isDirty=!0)},t.prototype.setFontWeight=function(e){this.textStyle.textWeight!==e&&(this.textStyle.textWeight=e,this.isDirty=!0)},t.prototype.setFontStyle=function(e){this.textStyle.fontStyle!==e&&(this.textStyle.fontStyle=e,this.isDirty=!0)},t.prototype.setText=function(e){this.text!==e&&(this.text=e,this.isDirty=!0)},t.prototype.setTextAlign=function(e){this.textLayout.textAlign!==e&&(this.textLayout.textAlign=e,this.isDirty=!0)},t.prototype.setTextBaseline=function(e){this.textLayout.textBaseline!==e&&(this.textLayout.textBaseline=e,this.isDirty=!0)},t.prototype.setTextColor=function(e){this.textStyle.textColor!==e&&(this.textStyle.textColor=e,this.isDirty=!0)},t.prototype.setFontFamily=function(e){this.textStyle.fontFamily!==e&&(this.textStyle.fontFamily=e,this.isDirty=!0)},t.prototype.setOutlineColor=function(e){this.textStyle.outlineColor!==e&&(this.textStyle.outlineColor=e,this.isDirty=!0)},t.prototype.setOutlineWidth=function(e){this.textStyle.outlineWidth!==e&&(this.textStyle.outlineWidth=e,this.isDirty=!0)},t.prototype.setShadowBlur=function(e){this.textStyle.shadowBlur!==e&&(this.textStyle.shadowBlur=e,this.isDirty=!0)},t.prototype.setShadowColor=function(e){this.textStyle.shadowColor!==e&&(this.textStyle.shadowColor=e,this.isDirty=!0)},t.prototype.setShadowOffsetX=function(e){this.textStyle.shadowOffsetX!==e&&(this.textStyle.shadowOffsetX=e,this.isDirty=!0)},t.prototype.setShadowOffsetY=function(e){this.textStyle.shadowOffsetY!==e&&(this.textStyle.shadowOffsetY=e,this.isDirty=!0)},t.prototype.setFontScale=function(e){this.textStyle.fontScale!==e&&(this.textStyle.fontScale=e,this.isDirty=!0)},t.prototype.updateTexture=function(){var e;if(this.isDirty&&this.context&&this.canvas){var t=this.context,r=this.textStyle,i=this.textLayout,n=r.fontScale,o=(i.width+r.fontOffset)*n,a=i.height*n,s=r.fontSize*n,u=i.lineHeight*n;this.char=this.text.split(""),this.canvas.width=o,this.canvas.height=a,t.clearRect(0,0,o,this.canvas.height),t.fillStyle="rgba(255, 255, 255, 0.0039)",t.fillRect(0,0,o,this.canvas.height),r.fontDesc=this.getFontDesc(),t.font=r.fontDesc,r.hasShadow&&this.setupShadow(),r.isOutlined&&this.setupOutline(),t.fillStyle="rgba(".concat(r.textColor[0],", ").concat(r.textColor[1],", ").concat(r.textColor[2],", ").concat(r.textColor[3],")");for(var c=[],l=(u-s)/3,f=0,h=i.getOffsetY(r)+l,p=[],d=[],m=0;m<this.char.length;m++){var v=this.char[m],y=t.measureText(v);((f+=i.letterSpace*n)+y.width>o&&m>0||"\n"===v)&&(c.push({y:h,width:f,chars:p,charOffsetX:d}),f=0,h+=u,p=[],d=[]),"\n"!==v&&(p.push(v),d.push(f),f+=y.width)}c.push({y:h,width:f,chars:p,charOffsetX:d}),c.forEach((function(e){var n=i.getOffsetX(r,e.width);e.chars.forEach((function(i,o){r.isOutlined&&t.strokeText(i,n+e.charOffsetX[o],e.y),t.fillText(i,n+e.charOffsetX[o],e.y)}))})),r.hasShadow&&(t.shadowColor="transparent");var g=t.getImageData(0,0,this.canvas.width,this.canvas.height);null===(e=this.mesh)||void 0===e||e.mesh.material.setTexture("uSampler0",oO.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:!0,magFilter:xS.LINEAR,minFilter:xS.LINEAR,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE})),this.isDirty=!1}},t.prototype.getFontDesc=function(){var e=this.textStyle,t="".concat((e.fontSize*e.fontScale).toString(),"px ");return GI.includes(e.fontFamily)?t+=e.fontFamily:t+='"'.concat(e.fontFamily,'"'),e.textWeight!==gA.normal&&(t="".concat(e.textWeight," ").concat(t)),e.fontStyle!==xA.normal&&(t="".concat(e.fontStyle," ").concat(t)),t},t.prototype.setupOutline=function(){var e=this.context,t=this.textStyle;e.strokeStyle="rgba(".concat(255*t.outlineColor[0],", ").concat(255*t.outlineColor[1],", ").concat(255*t.outlineColor[2],", ").concat(t.outlineColor[3],")"),e.lineWidth=2*t.outlineWidth},t.prototype.setupShadow=function(){var e=this.context,t=this.textStyle;e.shadowColor="rgba(".concat(255*t.shadowColor[0],", ").concat(255*t.shadowColor[1],", ").concat(255*t.shadowColor[2],", ").concat(t.shadowColor[3],")"),e.shadowBlur=t.shadowBlur,e.shadowOffsetX=t.shadowOffsetX,e.shadowOffsetY=-t.shadowOffsetY},t}(nL),ew=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return tS(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return wS.text},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(e){this.textContext=e.content},r.prototype.onLifetimeBegin=function(e,t){this._contentVisible=!0,t.active=!0},r.prototype.onItemRemoved=function(e,t){this._contentVisible=!1,t&&(delete t.mesh,e.destroyTextures(t.getTextures()))},r.prototype.handleVisibleChanged=function(e){this.content&&(this.content.visible=e)},r.prototype.onItemUpdate=function(e,t){var r;null===(r=this.content)||void 0===r||r.updateTime(this.time)},r.prototype.getCurrentPosition=function(){var e=[0,0,0];return this.transform.assignWorldTRS(e),e},r.prototype.getBoundingBox=function(){var t=this.content;if(t&&this.transform){var r=this.transform.getWorldMatrix(),i=t.startSize,n=LR([0,0,0],i[0]/2,i[1]/2);return n.forEach((function(e){e.forEach((function(e){cR(e,e,r)}))})),{type:e.HitTestType.triangle,area:n}}},r.prototype.getHitTestParams=function(e){var t,r,i=this.content,n=i&&i.interaction;if((e||n)&&(null===(t=i.mesh)||void 0===t?void 0:t.mesh)&&i){var o=this.getBoundingBox();if(o)return{behavior:(null===(r=i.interaction)||void 0===r?void 0:r.behavior)||0,type:o.type,triangles:o.area,backfaceCulling:i.renderer.side===RS.FRONT}}},r.prototype.getRenderData=function(){return this.content.getRenderData(this.content.time)},r.prototype.doCreateContent=function(e){var t=e.getRendererOptions().emptyTexture;return new $I(this.textContext,{emptyTexture:t},this)},r.prototype.createWireframeMesh=function(e,t){var r=new PI(this.composition.getEngine(),rS({wireframe:!0},e.renderInfo),this.composition);return r.setItems([e]),r.mesh.material.setVector3("uFrameColor",[t[0],t[1],t[2]]),r.mesh.priority=999,r},r}(EC),tw=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="text",e.addItems=[],e.removeItems=[],e.meshes=[],e}return tS(r,t),r.prototype.onCompositionDestroyed=function(t){t.reusable?this.addItems.forEach((function(t){var r;null===(r=t.content.mesh)||void 0===r||r.mesh.dispose({material:{textures:e.DestroyOptions.keep}})})):this.addItems.forEach((function(e){var t;null===(t=e.content.mesh)||void 0===t||t.mesh.dispose()}))},r.prototype.onCompositionUpdate=function(e,t){this.addItems.forEach((function(e){var t;e.content.updateTexture(),!e.content.ended&&e.content.mesh&&e.content.mesh.updateItem(e.content),null===(t=e.content.mesh)||void 0===t||t.applyChange()}))},r.prototype.onCompositionItemLifeBegin=function(e,t){var r;t instanceof ew&&t.content&&(this.addItems.includes(t)||(kS(this.addItems,t),!t.content.ended&&t.content.mesh&&t.content.mesh.updateItem(t.content),null===(r=t.content.mesh)||void 0===r||r.applyChange()))},r.prototype.onCompositionReset=function(e,t){},r.prototype.onCompositionItemRemoved=function(t,r){var i;r instanceof ew&&r&&(kS(this.removeItems,r),this.addItems.includes(r)&&(null===(i=r.content)||void 0===i?void 0:i.mesh)&&(zS(this.addItems,r),r.content.mesh.mesh.dispose({material:{textures:e.DestroyOptions.keep}}),r.dispose()))},r.prototype.prepareRenderFrame=function(t,r){var i=this;return this.removeItems.map((function(t){var n,o;(null===(n=t.content)||void 0===n?void 0:n.mesh)&&(r.removeMeshFromDefaultRenderPass(null===(o=t.content.mesh)||void 0===o?void 0:o.mesh),zS(i.addItems,t),t.content.mesh.mesh.dispose({material:{textures:e.DestroyOptions.keep}}),t.dispose())})),this.addItems.forEach((function(e){var t;e.content.mesh&&r.addMeshToDefaultRenderPass(null===(t=e.content.mesh)||void 0===t?void 0:t.mesh)})),this.removeItems.length=0,!1},r}(LC);function rw(e,t,r){return function(e,t,r){var i=rS(rS({},t.material.props),{shader:r}),n=t.material.clone(i);return n.blending=!1,n.depthTest=!1,n.culling=!1,zO.create(e,{geometry:t.geometry,material:n})}(e,t,jb(e.gpuCapability.level,{fragment:r.fragment},{ignoreBlend:!0}))}var iw=function(t){function r(e,r,i,n,o,a){var s=t.call(this,e,a)||this;return s.uTexStep=i,s.pluginSystem=n,s.fragShader=o,s.type=r,s}return tS(r,t),r.prototype.configure=function(t){if(this.prePassTexture=t.getFrameBuffer().getColorTextures()[0]?t.getFrameBuffer().getColorTextures()[0]:t.renderingData.currentFrame.transparentTexture,"H"===this.type&&(this.preDefaultPassAttachment.texture=this.prePassTexture),this.preDefaultPassTexture=this.preDefaultPassAttachment.texture,!this.mframeBuffer){var r=oO.create(t.engine,{sourceType:e.TextureSourceType.framebuffer,minFilter:xS.LINEAR,magFilter:xS.LINEAR,name:this.type,internalFormat:xS.RGBA,format:xS.RGBA,type:xS.UNSIGNED_BYTE});this.mframeBuffer=Pb.create({name:this.type,storeAction:{},viewport:this.viewport,viewportScale:1,isCustomViewport:!0,attachments:[r],depthStencilAttachment:{storageType:e.RenderPassAttachmentStorageType.none}},t)}t.setFrameBuffer(this.mframeBuffer)},r.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Eb(this.preDefaultPassTexture)),this.meshes[1].material.setVector2("uTexStep",this.uTexStep),this.meshes[1].material.setTexture("uBlurSource",this.uBlurSource?this.uBlurSource:this.prePassTexture),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",Eb(this.prePassTexture));var t=[this.meshes[0],rw(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},r.prototype.dispose=function(e){t.prototype.dispose.call(this,e);var r=this.mframeBuffer;r&&r.dispose(e)},r}(HO),nw=function(e){function t(t,r,i){var n=e.call(this,t,r)||this;return i&&(n.preDefaultPassAttachment=i),n}return tS(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],this.preDefaultPassAttachment||(this.preDefaultPassAttachment=new XO(e.engine,{}),this.preDefaultPassAttachment.texture=this.prePassTexture),e.setFrameBuffer(this.frameBuffer)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassAttachment.texture),this.meshes[0].material.setVector2("uFilterSourceSize",Eb(this.preDefaultPassAttachment.texture)),this.meshes[1].material.setTexture("uFrameSource",this.prePassTexture),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uFilterSourceSize",Eb(this.prePassTexture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(HO);function ow(e){for(var t=e.radius<=3?1:2,r=e.radius/t,i=e.maxStep||4;r>10&&t<i;)t*=2,r=e.radius/t;for(var n=1+e.radius%t/t/t,o=function(e){for(var t=(e+1)/3.329,r=[],i=-e;i<=e;i++)r.push(aw(i,t));return r}(r=Math.floor(r)),a=[],s=-r;s<=r;s++){var u=o[s+r];a.push("color += texture2D(uBlurSource,getTexCoord(".concat(s.toFixed(1),")) * ").concat(u,";"))}return{shader:"\n uniform sampler2D uBlurSource;\n uniform vec2 uTexSize;\n uniform vec2 uTexStep;\n #define getTexCoord(i) coord + uTexStep/uTexSize * i\n vec4 filterMain(vec2 coord,sampler2D tex){\n vec4 color = vec4(0.);\n vec2 texCoord;\n ".concat(a.join("\n"),"\n\n return color;\n }\n "),step:n,downSample:t,radius:r}}function aw(e,t){return Math.exp(-e*e/(2*t*t))/Math.sqrt(2*Math.PI)/t}var sw=function(e){function t(t,r){return e.call(this,t,r)||this}return tS(t,e),t.prototype.configure=function(e){var t=e.getFrameBuffer();this.preDefaultPassAttachment.texture=t?t.getColorTextures()[0]:e.renderingData.currentFrame.transparentTexture,e.setFrameBuffer(this.frameBuffer)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uTexSize",Eb(this.preDefaultPassAttachment.texture));var t=[rw(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},t}(HO),uw=function(e){function t(t,r,i,n,o,a,s){var u=e.call(this,t,a)||this;return u.uTexStep=i,u.pluginSystem=n,u.fragShader=o,u.type=r,s&&(u.uBlurSource=s),u}return tS(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],this.preDefaultPassTexture=this.preDefaultPassAttachment.texture,e.setFrameBuffer(this.frameBuffer),this.uBlurSource||(this.uBlurSource=this.prePassTexture)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[1].material.setVector2("uTexStep",this.uTexStep),this.meshes[1].material.setTexture("uBlurSource",this.uBlurSource),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",Eb(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",Eb(this.uBlurSource));var t=[rw(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},t}(HO),cw=function(e){function t(t,r,i){var n=e.call(this,t,r)||this;return n.preDefaultPassAttachment=i,n}return tS(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],e.setFrameBuffer(this.frameBuffer)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassAttachment.texture),this.meshes[0].material.setVector2("uFilterSourceSize",Eb(this.preDefaultPassAttachment.texture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uFilterSourceSize",Eb(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",Eb(this.preDefaultPassAttachment.texture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(HO),lw=function(e){function t(t,r){return e.call(this,t,r)||this}return tS(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],e.setFrameBuffer(this.frameBuffer)},t.prototype.execute=function(e){e.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",Eb(this.prePassTexture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.prePassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",Eb(this.prePassTexture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(HO);function fw(e,t,r){for(var i=KR(t||1),n=t?256:1,o=new Uint8Array(n),a=0;a<n;a++){var s=a/(n-1);o[a]=Math.round(255*i.getValue(r?1-s:s))}return oO.createWithData(e,{width:n,height:1,data:o},{format:xS.LUMINANCE})}var hw=[1,1,1],pw=function(){function e(e,t){void 0===t&&(t={}),this.name=e,this.viewMatrix=PA(),this.projectionMatrix=PA(),this.viewProjectionMatrix=PA(),this.inverseViewMatrix=PA(),this.dirty=!0;var r=t.near,i=void 0===r?.1:r,n=t.far,o=void 0===n?20:n,a=t.fov,s=void 0===a?60:a,u=t.aspect,c=void 0===u?1:u,l=t.clipMode,f=void 0===l?iA.portrait:l,h=t.position,p=void 0===h?[0,0,8]:h,d=t.rotation,m=void 0===d?[0,0,0]:d;this.options={near:i,far:o,fov:s,aspect:c,clipMode:f,position:p,rotation:m},this.dirty=!0,this.updateMatrix()}return Object.defineProperty(e.prototype,"near",{get:function(){return this.options.near},set:function(e){this.options.near!==e&&(this.options.near=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"far",{get:function(){return this.options.far},set:function(e){this.options.far!==e&&(this.options.far=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fov",{get:function(){return this.options.fov},set:function(e){this.options.fov!==e&&(this.options.fov=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aspect",{get:function(){return this.options.aspect},set:function(e){this.options.aspect!==e&&(this.options.aspect=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clipMode",{get:function(){return this.options.clipMode},set:function(e){void 0!==e&&this.options.clipMode!==e&&(this.options.clipMode=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return sS([],aS(this.options.position),!1)},set:function(e){var t=this;e.map((function(e,r){t.options.position[r]!==e&&(t.options.position[r]=e,t.dirty=!0)}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotation",{get:function(){return sS([],aS(this.options.rotation),!1)},set:function(e){var t=this;e.map((function(e,r){t.options.rotation[r]!==e&&(t.options.rotation[r]=e,t.dirty=!0,t.options.quat=void 0)}))},enumerable:!1,configurable:!0}),e.prototype.getViewMatrix=function(){return this.updateMatrix(),dC(this.viewMatrix)},e.prototype.getInverseViewMatrix=function(){return this.updateMatrix(),dC(this.inverseViewMatrix)},e.prototype.getProjectionMatrix=function(){return this.updateMatrix(),dC(this.projectionMatrix)},e.prototype.getInverseProjectionMatrix=function(){return this.updateMatrix(),dC(this.inverseProjectionMatrix)},e.prototype.getViewProjectionMatrix=function(){return this.updateMatrix(),dC(this.viewProjectionMatrix)},e.prototype.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=FA([],this.viewProjectionMatrix)),dC(this.inverseViewProjectionMatrix)},e.prototype.getModelViewProjection=function(e,t){return DA(e,this.viewProjectionMatrix,t)},e.prototype.getInverseVPRatio=function(e){var t=[0,0,0],r=cR(t,[0,0,e],this.getViewProjectionMatrix())[2];return cR(t,[1,1,r],this.getInverseViewProjectionMatrix()),t},e.prototype.setQuat=function(e){var t=this;if(void 0===this.options.quat)this.options.quat=e,this.dirty=!0;else{var r=this.options.quat;e.map((function(e,i){r[i]!==e&&(r[i]=e,t.dirty=!0)}))}this.dirty&&this.setRotationByQuat(e)},e.prototype.getQuat=function(){var e=this.options.quat;if(void 0===e){e=[0,0,0,1];var t=this.options.rotation;t&&xR(e,t[0],t[1],t[2]),this.options.quat=e}return e},e.prototype.getOptions=function(){return this.options},e.prototype.copy=function(e){var t=e.near,r=e.far,i=e.fov,n=e.clipMode,o=e.aspect,a=e.position,s=e.rotation;this.near=t,this.far=r,this.fov=i,this.clipMode=n,this.aspect=o,this.position=a,this.rotation=s,this.updateMatrix()},e.prototype.updateMatrix=function(){if(this.dirty){var e=this.options,t=e.fov,r=e.aspect,i=e.near,n=e.far,o=e.clipMode,a=e.position;UA(this.projectionMatrix,t,r,i,n,o===iA.portrait),NA(this.inverseViewMatrix,this.getQuat(),a,hw),FA(this.viewMatrix,this.inverseViewMatrix),DA(this.viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.prototype.setRotationByQuat=function(e){this.options.rotation=TC.getRotation([],e)},e}();var dw,mw,vw,yw,gw,xw,Tw,Ew,_w,Sw,Aw,Rw={lum:[function(t,r){var i=r.renderer,n=2===i.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,o=new nw(i,{name:"lumCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:n,magFilter:n}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:SO,uniformValues:{uFilterParams:[1,0,0,0]},materialStates:{blending:!1,depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}]},prePasses:[o],renderPassDelegate:{}}},function(){return[{fragment:SO}]}],alphaFrame:[function(t,r){var i=t,n=i.colorRange,o=void 0===n?[.5,1]:n,a=i.alphaRange,s=void 0===a?[0,.5]:a,u=[s[0],s[1]-s[0],o[0],o[1]-o[0]],c=r.renderer,l=2===c.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,f=new nw(c,{name:"alphaFrameCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{particle:{fragment:$O,uniformValues:{uTexRange:u}},mesh:{fragment:$O,shaderCacheId:"alpha-frame",materialStates:{blending:!1},uniformValues:{uTexRange:u}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[f]}}},function(){return[{fragment:$O,shaderCacheId:"alpha-frame"},{fragment:$O,isParticle:!0}]}],cameraMove:[function(t,r){var i=t.position,n=void 0===i?[0,0,0]:i,o=n;Number.isFinite(n[0])&&Number.isFinite(n[1])&&(o=[oA.CONSTANT_VEC3,n]);var a=KR(o),s=new pw("camera_move"),u=[0,0,0],c=r.renderer,l=2===c.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,f=new nw(c,{name:"cameraCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{vertex:tb,fragment:SO,shaderCacheId:"camera-move",materialStates:{blending:!1,depthTest:!1,culling:!1},variables:{uMoveCameraViewPro:function(e){s.copy(r.camera);var t=a.getValue(e);return qA(u,r.camera.position,[-t[0],-t[1],-t[2]]),s.position=u,s.getViewProjectionMatrix()}}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[f]}}},function(){return[{vertex:tb,fragment:SO,shaderCacheId:"camera-move"}]}],alphaMask:[function(t,r){var i=t,n=i.xOpacity,o=i.yOpacity,a=r.renderer.engine,s=r.renderer,u=fw(a,n),c=fw(a,o,!0),l=2===a.gpuCapability.level?xS.LINEAR:xS.NEAREST,f=new nw(s,{name:"alphaMaskCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:eb,shaderCacheId:"alpha-mask",materialStates:{blending:!1,depthTest:!1,culling:!1},uniformValues:{uAlphaXSample:u,uAlphaYSample:c}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[f]}}},function(){return[{fragment:eb,shaderCacheId:"alpha-mask"}]}],distortion:[function(t,r){var i=t,n=i.center,o=void 0===n?[.5,.5]:n,a=i.direction,s=void 0===a?[1,0]:a,u=i.period,c=i.waveMovement,l=i.strength,f=iR(s),h=[o[0],o[1],f[0],f[1]],p=KR(u),d=KR(c),m=KR(l),v=2*Math.PI,y=r.renderer,g=2===y.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,x=new nw(y,{name:"distortionCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:g,magFilter:g}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{particle:{fragment:ib,vertex:nb,uniforms:{uPeriodValue:p,uMovementValue:d,uStrengthValue:m},uniformValues:{uWaveParams:h}},mesh:{shaderCacheId:"distortion",fragment:ib,materialStates:{blending:!1,culling:!1},variables:{vWaveParams:function(e){return[p.getValue(e)*v,d.getValue(e)*v,m.getValue(e),0]}},uniformValues:{uWaveParams:h}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[x]}}},function(e){var t=e,r=t.period,i=t.waveMovement,n=t.strength;return[{fragment:ib,shaderCacheId:"distortion"},{fragment:ib,vertex:nb,isParticle:!0,uniforms:[r,i,n]}]}],bloom:[function(t,r){var i=t,n=i.radius,o=void 0===n?30:n,a=i.bloomAddon,s=void 0===a?.4:a,u=i.colorAddon,c=void 0===u?1:u,l=i.colorThreshold,f=void 0===l?[255,255,255]:l,h=r.getEngine().gpuCapability.level,p=ow({radius:o}),d=r.renderer.engine,m=r.renderer,v=Math.round(r.width/p.downSample),y=Math.round(r.width/p.downSample);1===h&&(v=AA(v),y=AA(y));var g=[0,0,v,y],x=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:xS.RGBA,magFilter:xS.LINEAR,minFilter:xS.LINEAR,name:"gaussianV",width:v,height:y}),T=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:xS.RGBA,magFilter:xS.LINEAR,minFilter:xS.LINEAR,name:"gaussianH",width:v,height:y}),E=KR(s),_=KR(c),S=new XO(d),A=new sw(m,{name:"threshold",attachments:[{texture:x}],viewport:g,clearAction:{colorAction:e.TextureLoadAction.clear}});A.pluginSystem=r.pluginSystem,A.fragShader=ab,A.preDefaultPassAttachment=S;var R=new uw(m,"H",[p.step,0],r.pluginSystem,p.shader,{name:"gaussianH",viewport:g,attachments:[{texture:T}],clearAction:{colorAction:e.TextureLoadAction.clear}},x);R.preDefaultPassAttachment=S;var C=new uw(m,"V",[0,p.step],r.pluginSystem,p.shader,{name:"gaussianV",viewport:g,attachments:[{texture:x}]},T);C.preDefaultPassAttachment=S;var O=2===h?xS.LINEAR:xS.NEAREST,b=new cw(m,{name:"bloomCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:O,magFilter:O}}],clearAction:{colorAction:e.TextureLoadAction.clear}},S);return{mesh:{name:"bloom-".concat(p.step),fragment:ob,shaderCacheId:"bloom-".concat(p.step),variables:{uBloomParams:function(e){return[E.getValue(e),_.getValue(e),0,1]}},uniformValues:{uColorThreshold:[f[0]/255||1.1,f[1]/255||1.1,f[2]/255||1.1,0],uBloomBlur:x},materialStates:{blending:!1,culling:!1}},onItemRemoved:function(){x.dispose(),T.dispose()},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[A,R,C,b]}}},function(e){var t=e.radius,r=ow({radius:void 0===t?30:t});return[{fragment:ob,shaderCacheId:"bloom-".concat(r.step)},{fragment:ab,ignoreBlend:!0},{fragment:r.shader,ignoreBlend:!0}]}],gaussian:[function(t,r){var i=t.radius,n=r.getEngine().gpuCapability.level,o=r.renderer.engine,a=r.renderer,s=ow({radius:i}),u=s.downSample,c=s.step,l=s.shader,f=Math.round(r.width/u),h=Math.round(r.height/u);1===n&&(h=AA(h),f=AA(f));var p=[0,0,f,h],d=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:xS.LINEAR,magFilter:xS.LINEAR,name:"gaussianV",width:f,height:h}),m=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:xS.LINEAR,magFilter:xS.LINEAR,name:"gaussianH",width:f,height:h}),v=new XO(o,{}),y=new iw(a,"H",[0,c],r.pluginSystem,l,{name:"gaussianH",viewport:p,attachments:[{texture:m}],clearAction:{colorAction:e.TextureLoadAction.clear}});y.preDefaultPassAttachment=v;var g=new iw(a,"V",[c,0],r.pluginSystem,l,{name:"gaussianV",viewport:p,attachments:[{texture:d}],clearAction:{colorAction:e.TextureLoadAction.clear}});g.preDefaultPassAttachment=v;var x=2===n?xS.LINEAR:xS.NEAREST,T=new nw(a,{name:"gaussianCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:x,magFilter:x}}],clearAction:{colorAction:e.TextureLoadAction.clear}},v);return T.preDefaultPassAttachment=v,{mesh:{fragment:SO,shaderCacheId:"gaussian-".concat(c),uniformValues:{uTexSize:[f,h]},materialStates:{blending:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[y,g,T]}}},function(e){var t=ow({radius:e.radius});return[{fragment:SO,shaderCacheId:"gaussian-".concat(t.step)},{fragment:t.shader,ignoreBlend:!0}]}],delay:[function(t,r){var i=r.renderer,n=oO.create(i.engine,{sourceType:e.TextureSourceType.framebuffer}),o=[0,.96,0,0],a=2===i.engine.gpuCapability.level?xS.LINEAR:xS.NEAREST,s=new lw(i,{name:"delayCopyPass",attachments:[{texture:{format:xS.RGBA,minFilter:a,magFilter:a}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:rb,shaderCacheId:"delay",uniformValues:{uLastSource:n},variables:{uParams:function(){return o}},materialStates:{blending:!0,blendFunction:[xS.SRC_ALPHA,xS.ONE_MINUS_SRC_ALPHA,xS.SRC_ALPHA,xS.ONE_MINUS_SRC_ALPHA],depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:xS.RGBA}}],prePasses:[s]},onItemRemoved:function(){n.dispose()},renderPassDelegate:{didEndRenderPass:function(e){i.extension.copyTexture(e.attachments[0].texture,n),o[0]=2}}}},function(){return[{fragment:rb,shaderCacheId:"delay"}]}]};
|
|
8
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).ge=t.ge||{},t.ge.three={}),t.THREE)}(this,(function(t,e){"use strict";function r(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}})),e.default=t,Object.freeze(e)}var i=r(e),n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},o=function(t){return t&&t.Math===Math&&t},a=o("object"==typeof globalThis&&globalThis)||o("object"==typeof window&&window)||o("object"==typeof self&&self)||o("object"==typeof n&&n)||function(){return this}()||n||Function("return this")(),s={},u=function(t){try{return!!t()}catch(t){return!0}},c=!u((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),l=!u((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),h=l,f=Function.prototype.call,p=h?f.bind(f):function(){return f.apply(f,arguments)},d={},m={}.propertyIsEnumerable,v=Object.getOwnPropertyDescriptor,y=v&&!m.call({1:2},1);d.f=y?function(t){var e=v(this,t);return!!e&&e.enumerable}:m;var g,x,T=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},E=l,A=Function.prototype,b=A.call,S=E&&A.bind.bind(b,b),_=E?S:function(t){return function(){return b.apply(t,arguments)}},R=_,C=R({}.toString),O=R("".slice),w=function(t){return O(C(t),8,-1)},M=u,I=w,L=Object,P=_("".split),F=M((function(){return!L("z").propertyIsEnumerable(0)}))?function(t){return"String"===I(t)?P(t,""):L(t)}:L,V=function(t){return null==t},N=V,D=TypeError,z=function(t){if(N(t))throw D("Can't call method on "+t);return t},U=F,B=z,k=function(t){return U(B(t))},G="object"==typeof document&&document.all,j={all:G,IS_HTMLDDA:void 0===G&&void 0!==G},X=j.all,Y=j.IS_HTMLDDA?function(t){return"function"==typeof t||t===X}:function(t){return"function"==typeof t},W=Y,H=j.all,Z=j.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:W(t)||t===H}:function(t){return"object"==typeof t?null!==t:W(t)},q=a,Q=Y,K=function(t,e){return arguments.length<2?(r=q[t],Q(r)?r:void 0):q[t]&&q[t][e];var r},J=_({}.isPrototypeOf),$="undefined"!=typeof navigator&&String(navigator.userAgent)||"",tt=a,et=$,rt=tt.process,it=tt.Deno,nt=rt&&rt.versions||it&&it.version,ot=nt&&nt.v8;ot&&(x=(g=ot.split("."))[0]>0&&g[0]<4?1:+(g[0]+g[1])),!x&&et&&(!(g=et.match(/Edge\/(\d+)/))||g[1]>=74)&&(g=et.match(/Chrome\/(\d+)/))&&(x=+g[1]);var at=x,st=at,ut=u,ct=a.String,lt=!!Object.getOwnPropertySymbols&&!ut((function(){var t=Symbol("symbol detection");return!ct(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&st&&st<41})),ht=lt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ft=K,pt=Y,dt=J,mt=Object,vt=ht?function(t){return"symbol"==typeof t}:function(t){var e=ft("Symbol");return pt(e)&&dt(e.prototype,mt(t))},yt=String,gt=function(t){try{return yt(t)}catch(t){return"Object"}},xt=Y,Tt=gt,Et=TypeError,At=function(t){if(xt(t))return t;throw Et(Tt(t)+" is not a function")},bt=At,St=V,_t=function(t,e){var r=t[e];return St(r)?void 0:bt(r)},Rt=p,Ct=Y,Ot=Z,wt=TypeError,Mt={exports:{}},It=a,Lt=Object.defineProperty,Pt=function(t,e){try{Lt(It,t,{value:e,configurable:!0,writable:!0})}catch(r){It[t]=e}return e},Ft=Pt,Vt="__core-js_shared__",Nt=a[Vt]||Ft(Vt,{}),Dt=Nt;(Mt.exports=function(t,e){return Dt[t]||(Dt[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.32.1",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.32.1/LICENSE",source:"https://github.com/zloirock/core-js"});var zt=z,Ut=Object,Bt=function(t){return Ut(zt(t))},kt=Bt,Gt=_({}.hasOwnProperty),jt=Object.hasOwn||function(t,e){return Gt(kt(t),e)},Xt=_,Yt=0,Wt=Math.random(),Ht=Xt(1..toString),Zt=function(t){return"Symbol("+(void 0===t?"":t)+")_"+Ht(++Yt+Wt,36)},qt=a,Qt=Mt.exports,Kt=jt,Jt=Zt,$t=lt,te=ht,ee=qt.Symbol,re=Qt("wks"),ie=te?ee.for||ee:ee&&ee.withoutSetter||Jt,ne=function(t){return Kt(re,t)||(re[t]=$t&&Kt(ee,t)?ee[t]:ie("Symbol."+t)),re[t]},oe=p,ae=Z,se=vt,ue=_t,ce=function(t,e){var r,i;if("string"===e&&Ct(r=t.toString)&&!Ot(i=Rt(r,t)))return i;if(Ct(r=t.valueOf)&&!Ot(i=Rt(r,t)))return i;if("string"!==e&&Ct(r=t.toString)&&!Ot(i=Rt(r,t)))return i;throw wt("Can't convert object to primitive value")},le=TypeError,he=ne("toPrimitive"),fe=function(t,e){if(!ae(t)||se(t))return t;var r,i=ue(t,he);if(i){if(void 0===e&&(e="default"),r=oe(i,t,e),!ae(r)||se(r))return r;throw le("Can't convert object to primitive value")}return void 0===e&&(e="number"),ce(t,e)},pe=fe,de=vt,me=function(t){var e=pe(t,"string");return de(e)?e:e+""},ve=Z,ye=a.document,ge=ve(ye)&&ve(ye.createElement),xe=function(t){return ge?ye.createElement(t):{}},Te=xe,Ee=!c&&!u((function(){return 7!==Object.defineProperty(Te("div"),"a",{get:function(){return 7}}).a})),Ae=c,be=p,Se=d,_e=T,Re=k,Ce=me,Oe=jt,we=Ee,Me=Object.getOwnPropertyDescriptor;s.f=Ae?Me:function(t,e){if(t=Re(t),e=Ce(e),we)try{return Me(t,e)}catch(t){}if(Oe(t,e))return _e(!be(Se.f,t,e),t[e])};var Ie={},Le=c&&u((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Pe=Z,Fe=String,Ve=TypeError,Ne=function(t){if(Pe(t))return t;throw Ve(Fe(t)+" is not an object")},De=c,ze=Ee,Ue=Le,Be=Ne,ke=me,Ge=TypeError,je=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Ye="enumerable",We="configurable",He="writable";Ie.f=De?Ue?function(t,e,r){if(Be(t),e=ke(e),Be(r),"function"==typeof t&&"prototype"===e&&"value"in r&&He in r&&!r[He]){var i=Xe(t,e);i&&i[He]&&(t[e]=r.value,r={configurable:We in r?r[We]:i[We],enumerable:Ye in r?r[Ye]:i[Ye],writable:!1})}return je(t,e,r)}:je:function(t,e,r){if(Be(t),e=ke(e),Be(r),ze)try{return je(t,e,r)}catch(t){}if("get"in r||"set"in r)throw Ge("Accessors not supported");return"value"in r&&(t[e]=r.value),t};var Ze=Ie,qe=T,Qe=c?function(t,e,r){return Ze.f(t,e,qe(1,r))}:function(t,e,r){return t[e]=r,t},Ke={exports:{}},Je=c,$e=jt,tr=Function.prototype,er=Je&&Object.getOwnPropertyDescriptor,rr=$e(tr,"name"),ir={EXISTS:rr,PROPER:rr&&"something"===function(){}.name,CONFIGURABLE:rr&&(!Je||Je&&er(tr,"name").configurable)},nr=Y,or=Nt,ar=_(Function.toString);nr(or.inspectSource)||(or.inspectSource=function(t){return ar(t)});var sr,ur,cr,lr=or.inspectSource,hr=Y,fr=a.WeakMap,pr=hr(fr)&&/native code/.test(String(fr)),dr=Mt.exports,mr=Zt,vr=dr("keys"),yr=function(t){return vr[t]||(vr[t]=mr(t))},gr={},xr=pr,Tr=a,Er=Z,Ar=Qe,br=jt,Sr=Nt,_r=yr,Rr=gr,Cr="Object already initialized",Or=Tr.TypeError,wr=Tr.WeakMap;if(xr||Sr.state){var Mr=Sr.state||(Sr.state=new wr);Mr.get=Mr.get,Mr.has=Mr.has,Mr.set=Mr.set,sr=function(t,e){if(Mr.has(t))throw Or(Cr);return e.facade=t,Mr.set(t,e),e},ur=function(t){return Mr.get(t)||{}},cr=function(t){return Mr.has(t)}}else{var Ir=_r("state");Rr[Ir]=!0,sr=function(t,e){if(br(t,Ir))throw Or(Cr);return e.facade=t,Ar(t,Ir,e),e},ur=function(t){return br(t,Ir)?t[Ir]:{}},cr=function(t){return br(t,Ir)}}var Lr={set:sr,get:ur,has:cr,enforce:function(t){return cr(t)?ur(t):sr(t,{})},getterFor:function(t){return function(e){var r;if(!Er(e)||(r=ur(e)).type!==t)throw Or("Incompatible receiver, "+t+" required");return r}}},Pr=_,Fr=u,Vr=Y,Nr=jt,Dr=c,zr=ir.CONFIGURABLE,Ur=lr,Br=Lr.enforce,kr=Lr.get,Gr=String,jr=Object.defineProperty,Xr=Pr("".slice),Yr=Pr("".replace),Wr=Pr([].join),Hr=Dr&&!Fr((function(){return 8!==jr((function(){}),"length",{value:8}).length})),Zr=String(String).split("String"),qr=Ke.exports=function(t,e,r){"Symbol("===Xr(Gr(e),0,7)&&(e="["+Yr(Gr(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(e="get "+e),r&&r.setter&&(e="set "+e),(!Nr(t,"name")||zr&&t.name!==e)&&(Dr?jr(t,"name",{value:e,configurable:!0}):t.name=e),Hr&&r&&Nr(r,"arity")&&t.length!==r.arity&&jr(t,"length",{value:r.arity});try{r&&Nr(r,"constructor")&&r.constructor?Dr&&jr(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var i=Br(t);return Nr(i,"source")||(i.source=Wr(Zr,"string"==typeof e?e:"")),t};Function.prototype.toString=qr((function(){return Vr(this)&&kr(this).source||Ur(this)}),"toString");var Qr=Y,Kr=Ie,Jr=Ke.exports,$r=Pt,ti=function(t,e,r,i){i||(i={});var n=i.enumerable,o=void 0!==i.name?i.name:e;if(Qr(r)&&Jr(r,o,i),i.global)n?t[e]=r:$r(e,r);else{try{i.unsafe?t[e]&&(n=!0):delete t[e]}catch(t){}n?t[e]=r:Kr.f(t,e,{value:r,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return t},ei={},ri=Math.ceil,ii=Math.floor,ni=Math.trunc||function(t){var e=+t;return(e>0?ii:ri)(e)},oi=ni,ai=function(t){var e=+t;return e!=e||0===e?0:oi(e)},si=ai,ui=Math.max,ci=Math.min,li=function(t,e){var r=si(t);return r<0?ui(r+e,0):ci(r,e)},hi=ai,fi=Math.min,pi=function(t){return t>0?fi(hi(t),9007199254740991):0},di=pi,mi=function(t){return di(t.length)},vi=k,yi=li,gi=mi,xi=function(t){return function(e,r,i){var n,o=vi(e),a=gi(o),s=yi(i,a);if(t&&r!=r){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===r)return t||s||0;return!t&&-1}},Ti={includes:xi(!0),indexOf:xi(!1)},Ei=jt,Ai=k,bi=Ti.indexOf,Si=gr,_i=_([].push),Ri=function(t,e){var r,i=Ai(t),n=0,o=[];for(r in i)!Ei(Si,r)&&Ei(i,r)&&_i(o,r);for(;e.length>n;)Ei(i,r=e[n++])&&(~bi(o,r)||_i(o,r));return o},Ci=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Oi=Ri,wi=Ci.concat("length","prototype");ei.f=Object.getOwnPropertyNames||function(t){return Oi(t,wi)};var Mi={};Mi.f=Object.getOwnPropertySymbols;var Ii=K,Li=ei,Pi=Mi,Fi=Ne,Vi=_([].concat),Ni=Ii("Reflect","ownKeys")||function(t){var e=Li.f(Fi(t)),r=Pi.f;return r?Vi(e,r(t)):e},Di=jt,zi=Ni,Ui=s,Bi=Ie,ki=u,Gi=Y,ji=/#|\.prototype\./,Xi=function(t,e){var r=Wi[Yi(t)];return r===Zi||r!==Hi&&(Gi(e)?ki(e):!!e)},Yi=Xi.normalize=function(t){return String(t).replace(ji,".").toLowerCase()},Wi=Xi.data={},Hi=Xi.NATIVE="N",Zi=Xi.POLYFILL="P",qi=Xi,Qi=a,Ki=s.f,Ji=Qe,$i=ti,tn=Pt,en=function(t,e,r){for(var i=zi(e),n=Bi.f,o=Ui.f,a=0;a<i.length;a++){var s=i[a];Di(t,s)||r&&Di(r,s)||n(t,s,o(e,s))}},rn=qi,nn=function(t,e){var r,i,n,o,a,s=t.target,u=t.global,c=t.stat;if(r=u?Qi:c?Qi[s]||tn(s,{}):(Qi[s]||{}).prototype)for(i in e){if(o=e[i],n=t.dontCallGetSet?(a=Ki(r,i))&&a.value:r[i],!rn(u?i:s+(c?".":"#")+i,t.forced)&&void 0!==n){if(typeof o==typeof n)continue;en(o,n)}(t.sham||n&&n.sham)&&Ji(o,"sham",!0),$i(r,i,o,t)}},on={},an=Ri,sn=Ci,un=Object.keys||function(t){return an(t,sn)},cn=c,ln=Le,hn=Ie,fn=Ne,pn=k,dn=un;on.f=cn&&!ln?Object.defineProperties:function(t,e){fn(t);for(var r,i=pn(e),n=dn(e),o=n.length,a=0;o>a;)hn.f(t,r=n[a++],i[r]);return t};var mn,vn=K("document","documentElement"),yn=Ne,gn=on,xn=Ci,Tn=gr,En=vn,An=xe,bn="prototype",Sn="script",_n=yr("IE_PROTO"),Rn=function(){},Cn=function(t){return"<"+Sn+">"+t+"</"+Sn+">"},On=function(t){t.write(Cn("")),t.close();var e=t.parentWindow.Object;return t=null,e},wn=function(){try{mn=new ActiveXObject("htmlfile")}catch(t){}var t,e,r;wn="undefined"!=typeof document?document.domain&&mn?On(mn):(e=An("iframe"),r="java"+Sn+":",e.style.display="none",En.appendChild(e),e.src=String(r),(t=e.contentWindow.document).open(),t.write(Cn("document.F=Object")),t.close(),t.F):On(mn);for(var i=xn.length;i--;)delete wn[bn][xn[i]];return wn()};Tn[_n]=!0;var Mn=Object.create||function(t,e){var r;return null!==t?(Rn[bn]=yn(t),r=new Rn,Rn[bn]=null,r[_n]=t):r=wn(),void 0===e?r:gn.f(r,e)},In=ne,Ln=Mn,Pn=Ie.f,Fn=In("unscopables"),Vn=Array.prototype;void 0===Vn[Fn]&&Pn(Vn,Fn,{configurable:!0,value:Ln(null)});var Nn=function(t){Vn[Fn][t]=!0},Dn=Ti.includes,zn=Nn;nn({target:"Array",proto:!0,forced:u((function(){return!Array(1).includes()}))},{includes:function(t){return Dn(this,t,arguments.length>1?arguments[1]:void 0)}}),zn("includes");var Un=a,Bn=_;(function(t,e){Bn(Un[t].prototype[e])})("Array","includes");var kn=!u((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Gn=jt,jn=Y,Xn=Bt,Yn=kn,Wn=yr("IE_PROTO"),Hn=Object,Zn=Hn.prototype,qn=Yn?Hn.getPrototypeOf:function(t){var e=Xn(t);if(Gn(e,Wn))return e[Wn];var r=e.constructor;return jn(r)&&e instanceof r?r.prototype:e instanceof Hn?Zn:null},Qn=c,Kn=u,Jn=_,$n=qn,to=un,eo=k,ro=Jn(d.f),io=Jn([].push),no=Qn&&Kn((function(){var t=Object.create(null);return t[2]=2,!ro(t,2)})),oo=function(t){return function(e){for(var r,i=eo(e),n=to(i),o=no&&null===$n(i),a=n.length,s=0,u=[];a>s;)r=n[s++],Qn&&!(o?r in i:ro(i,r))||io(u,t?[r,i[r]]:i[r]);return u}},ao={entries:oo(!0),values:oo(!1)},so=ao.values;nn({target:"Object",stat:!0},{values:function(t){return so(t)}});var uo=a;uo.Object.values;var co=ao.entries;nn({target:"Object",stat:!0},{entries:function(t){return co(t)}}),uo.Object.entries;var lo={exports:{}},ho=ne("iterator"),fo=!1;try{var po=0,mo={next:function(){return{done:!!po++}},return:function(){fo=!0}};mo[ho]=function(){return this},Array.from(mo,(function(){throw 2}))}catch(t){}var vo=function(t,e){if(!e&&!fo)return!1;var r=!1;try{var i={};i[ho]=function(){return{next:function(){return{done:r=!0}}}},t(i)}catch(t){}return r},yo="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,go={};go[ne("toStringTag")]="z";var xo,To,Eo,Ao="[object z]"===String(go),bo=Ao,So=Y,_o=w,Ro=ne("toStringTag"),Co=Object,Oo="Arguments"===_o(function(){return arguments}()),wo=bo?_o:function(t){var e,r,i;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Co(t),Ro))?r:Oo?_o(e):"Object"===(i=_o(e))&&So(e.callee)?"Arguments":i},Mo=Ke.exports,Io=Ie,Lo=function(t,e,r){return r.get&&Mo(r.get,e,{getter:!0}),r.set&&Mo(r.set,e,{setter:!0}),Io.f(t,e,r)},Po=_,Fo=At,Vo=Y,No=String,Do=TypeError,zo=function(t,e,r){try{return Po(Fo(Object.getOwnPropertyDescriptor(t,e)[r]))}catch(t){}},Uo=Ne,Bo=function(t){if("object"==typeof t||Vo(t))return t;throw Do("Can't set "+No(t)+" as a prototype")},ko=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,r={};try{(t=zo(Object.prototype,"__proto__","set"))(r,[]),e=r instanceof Array}catch(t){}return function(r,i){return Uo(r),Bo(i),e?t(r,i):r.__proto__=i,r}}():void 0),Go=yo,jo=c,Xo=a,Yo=Y,Wo=Z,Ho=jt,Zo=wo,qo=gt,Qo=Qe,Ko=ti,Jo=Lo,$o=J,ta=qn,ea=ko,ra=ne,ia=Zt,na=Lr.enforce,oa=Lr.get,aa=Xo.Int8Array,sa=aa&&aa.prototype,ua=Xo.Uint8ClampedArray,ca=ua&&ua.prototype,la=aa&&ta(aa),ha=sa&&ta(sa),fa=Object.prototype,pa=Xo.TypeError,da=ra("toStringTag"),ma=ia("TYPED_ARRAY_TAG"),va="TypedArrayConstructor",ya=Go&&!!ea&&"Opera"!==Zo(Xo.opera),ga=!1,xa={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},Ta={BigInt64Array:8,BigUint64Array:8},Ea=function(t){var e=ta(t);if(Wo(e)){var r=oa(e);return r&&Ho(r,va)?r[va]:Ea(e)}},Aa=function(t){if(!Wo(t))return!1;var e=Zo(t);return Ho(xa,e)||Ho(Ta,e)};for(xo in xa)(Eo=(To=Xo[xo])&&To.prototype)?na(Eo)[va]=To:ya=!1;for(xo in Ta)(Eo=(To=Xo[xo])&&To.prototype)&&(na(Eo)[va]=To);if((!ya||!Yo(la)||la===Function.prototype)&&(la=function(){throw pa("Incorrect invocation")},ya))for(xo in xa)Xo[xo]&&ea(Xo[xo],la);if((!ya||!ha||ha===fa)&&(ha=la.prototype,ya))for(xo in xa)Xo[xo]&&ea(Xo[xo].prototype,ha);if(ya&&ta(ca)!==ha&&ea(ca,ha),jo&&!Ho(ha,da))for(xo in ga=!0,Jo(ha,da,{configurable:!0,get:function(){return Wo(this)?this[ma]:void 0}}),xa)Xo[xo]&&Qo(Xo[xo],ma,xo);var ba={NATIVE_ARRAY_BUFFER_VIEWS:ya,TYPED_ARRAY_TAG:ga&&ma,aTypedArray:function(t){if(Aa(t))return t;throw pa("Target is not a typed array")},aTypedArrayConstructor:function(t){if(Yo(t)&&(!ea||$o(la,t)))return t;throw pa(qo(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,r,i){if(jo){if(r)for(var n in xa){var o=Xo[n];if(o&&Ho(o.prototype,t))try{delete o.prototype[t]}catch(r){try{o.prototype[t]=e}catch(t){}}}ha[t]&&!r||Ko(ha,t,r?e:ya&&sa[t]||e,i)}},exportTypedArrayStaticMethod:function(t,e,r){var i,n;if(jo){if(ea){if(r)for(i in xa)if((n=Xo[i])&&Ho(n,t))try{delete n[t]}catch(t){}if(la[t]&&!r)return;try{return Ko(la,t,r?e:ya&&la[t]||e)}catch(t){}}for(i in xa)!(n=Xo[i])||n[t]&&!r||Ko(n,t,e)}},getTypedArrayConstructor:Ea,isView:function(t){if(!Wo(t))return!1;var e=Zo(t);return"DataView"===e||Ho(xa,e)||Ho(Ta,e)},isTypedArray:Aa,TypedArray:la,TypedArrayPrototype:ha},Sa=a,_a=u,Ra=vo,Ca=ba.NATIVE_ARRAY_BUFFER_VIEWS,Oa=Sa.ArrayBuffer,wa=Sa.Int8Array,Ma=!Ca||!_a((function(){wa(1)}))||!_a((function(){new wa(-1)}))||!Ra((function(t){new wa,new wa(null),new wa(1.5),new wa(t)}),!0)||_a((function(){return 1!==new wa(new Oa(2),1,void 0).length})),Ia=ti,La=function(t,e,r){for(var i in e)Ia(t,i,e[i],r);return t},Pa=J,Fa=TypeError,Va=function(t,e){if(Pa(e,t))return t;throw Fa("Incorrect invocation")},Na=ai,Da=pi,za=RangeError,Ua=function(t){if(void 0===t)return 0;var e=Na(t),r=Da(e);if(e!==r)throw za("Wrong length or index");return r},Ba=Math.sign||function(t){var e=+t;return 0===e||e!=e?e:e<0?-1:1},ka=ni,Ga=Array,ja=Math.abs,Xa=Math.pow,Ya=Math.floor,Wa=Math.log,Ha=Math.LN2,Za=function(t){var e=ka(t),r=ja(t-e);return r>.5||.5===r&&e%2!=0?e+Ba(t):e},qa={pack:function(t,e,r){var i,n,o,a=Ga(r),s=8*r-e-1,u=(1<<s)-1,c=u>>1,l=23===e?Xa(2,-24)-Xa(2,-77):0,h=t<0||0===t&&1/t<0?1:0,f=0;for((t=ja(t))!=t||t===1/0?(n=t!=t?1:0,i=u):(i=Ya(Wa(t)/Ha),t*(o=Xa(2,-i))<1&&(i--,o*=2),(t+=i+c>=1?l/o:l*Xa(2,1-c))*o>=2&&(i++,o/=2),i+c>=u?(n=0,i=u):i+c>=1?(n=Za((t*o-1)*Xa(2,e)),i+=c):(n=Za(t*Xa(2,c-1)*Xa(2,e)),i=0));e>=8;)a[f++]=255&n,n/=256,e-=8;for(i=i<<e|n,s+=e;s>0;)a[f++]=255&i,i/=256,s-=8;return a[--f]|=128*h,a},unpack:function(t,e){var r,i=t.length,n=8*i-e-1,o=(1<<n)-1,a=o>>1,s=n-7,u=i-1,c=t[u--],l=127&c;for(c>>=7;s>0;)l=256*l+t[u--],s-=8;for(r=l&(1<<-s)-1,l>>=-s,s+=e;s>0;)r=256*r+t[u--],s-=8;if(0===l)l=1-a;else{if(l===o)return r?NaN:c?-1/0:1/0;r+=Xa(2,e),l-=a}return(c?-1:1)*r*Xa(2,l-e)}},Qa=Bt,Ka=li,Ja=mi,$a=function(t){for(var e=Qa(this),r=Ja(e),i=arguments.length,n=Ka(i>1?arguments[1]:void 0,r),o=i>2?arguments[2]:void 0,a=void 0===o?r:Ka(o,r);a>n;)e[n++]=t;return e},ts=me,es=Ie,rs=T,is=li,ns=mi,os=function(t,e,r){var i=ts(e);i in t?es.f(t,i,rs(0,r)):t[i]=r},as=Array,ss=Math.max,us=function(t,e,r){for(var i=ns(t),n=is(e,i),o=is(void 0===r?i:r,i),a=as(ss(o-n,0)),s=0;n<o;n++,s++)os(a,s,t[n]);return a.length=s,a},cs=Ie.f,ls=jt,hs=ne("toStringTag"),fs=function(t,e,r){t&&!r&&(t=t.prototype),t&&!ls(t,hs)&&cs(t,hs,{configurable:!0,value:e})},ps=a,ds=_,ms=c,vs=yo,ys=ir,gs=Qe,xs=Lo,Ts=La,Es=u,As=Va,bs=ai,Ss=pi,_s=Ua,Rs=qa,Cs=qn,Os=ko,ws=ei.f,Ms=$a,Is=us,Ls=fs,Ps=Lr,Fs=ys.PROPER,Vs=ys.CONFIGURABLE,Ns="ArrayBuffer",Ds="DataView",zs="prototype",Us="Wrong index",Bs=Ps.getterFor(Ns),ks=Ps.getterFor(Ds),Gs=Ps.set,js=ps[Ns],Xs=js,Ys=Xs&&Xs[zs],Ws=ps[Ds],Hs=Ws&&Ws[zs],Zs=Object.prototype,qs=ps.Array,Qs=ps.RangeError,Ks=ds(Ms),Js=ds([].reverse),$s=Rs.pack,tu=Rs.unpack,eu=function(t){return[255&t]},ru=function(t){return[255&t,t>>8&255]},iu=function(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]},nu=function(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]},ou=function(t){return $s(t,23,4)},au=function(t){return $s(t,52,8)},su=function(t,e,r){xs(t[zs],e,{configurable:!0,get:function(){return r(this)[e]}})},uu=function(t,e,r,i){var n=ks(t),o=_s(r),a=!!i;if(o+e>n.byteLength)throw Qs(Us);var s=n.bytes,u=o+n.byteOffset,c=Is(s,u,u+e);return a?c:Js(c)},cu=function(t,e,r,i,n,o){var a=ks(t),s=_s(r),u=i(+n),c=!!o;if(s+e>a.byteLength)throw Qs(Us);for(var l=a.bytes,h=s+a.byteOffset,f=0;f<e;f++)l[h+f]=u[c?f:e-f-1]};if(vs){var lu=Fs&&js.name!==Ns;if(Es((function(){js(1)}))&&Es((function(){new js(-1)}))&&!Es((function(){return new js,new js(1.5),new js(NaN),1!==js.length||lu&&!Vs})))lu&&Vs&&gs(js,"name",Ns);else{(Xs=function(t){return As(this,Ys),new js(_s(t))})[zs]=Ys;for(var hu,fu=ws(js),pu=0;fu.length>pu;)(hu=fu[pu++])in Xs||gs(Xs,hu,js[hu]);Ys.constructor=Xs}Os&&Cs(Hs)!==Zs&&Os(Hs,Zs);var du=new Ws(new Xs(2)),mu=ds(Hs.setInt8);du.setInt8(0,2147483648),du.setInt8(1,2147483649),!du.getInt8(0)&&du.getInt8(1)||Ts(Hs,{setInt8:function(t,e){mu(this,t,e<<24>>24)},setUint8:function(t,e){mu(this,t,e<<24>>24)}},{unsafe:!0})}else Ys=(Xs=function(t){As(this,Ys);var e=_s(t);Gs(this,{type:Ns,bytes:Ks(qs(e),0),byteLength:e}),ms||(this.byteLength=e,this.detached=!1)})[zs],Hs=(Ws=function(t,e,r){As(this,Hs),As(t,Ys);var i=Bs(t),n=i.byteLength,o=bs(e);if(o<0||o>n)throw Qs("Wrong offset");if(o+(r=void 0===r?n-o:Ss(r))>n)throw Qs("Wrong length");Gs(this,{type:Ds,buffer:t,byteLength:r,byteOffset:o,bytes:i.bytes}),ms||(this.buffer=t,this.byteLength=r,this.byteOffset=o)})[zs],ms&&(su(Xs,"byteLength",Bs),su(Ws,"buffer",ks),su(Ws,"byteLength",ks),su(Ws,"byteOffset",ks)),Ts(Hs,{getInt8:function(t){return uu(this,1,t)[0]<<24>>24},getUint8:function(t){return uu(this,1,t)[0]},getInt16:function(t){var e=uu(this,2,t,arguments.length>1&&arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=uu(this,2,t,arguments.length>1&&arguments[1]);return e[1]<<8|e[0]},getInt32:function(t){return nu(uu(this,4,t,arguments.length>1&&arguments[1]))},getUint32:function(t){return nu(uu(this,4,t,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(t){return tu(uu(this,4,t,arguments.length>1&&arguments[1]),23)},getFloat64:function(t){return tu(uu(this,8,t,arguments.length>1&&arguments[1]),52)},setInt8:function(t,e){cu(this,1,t,eu,e)},setUint8:function(t,e){cu(this,1,t,eu,e)},setInt16:function(t,e){cu(this,2,t,ru,e,arguments.length>2&&arguments[2])},setUint16:function(t,e){cu(this,2,t,ru,e,arguments.length>2&&arguments[2])},setInt32:function(t,e){cu(this,4,t,iu,e,arguments.length>2&&arguments[2])},setUint32:function(t,e){cu(this,4,t,iu,e,arguments.length>2&&arguments[2])},setFloat32:function(t,e){cu(this,4,t,ou,e,arguments.length>2&&arguments[2])},setFloat64:function(t,e){cu(this,8,t,au,e,arguments.length>2&&arguments[2])}});Ls(Xs,Ns),Ls(Ws,Ds);var vu={ArrayBuffer:Xs,DataView:Ws},yu=Z,gu=Math.floor,xu=Number.isInteger||function(t){return!yu(t)&&isFinite(t)&&gu(t)===t},Tu=ai,Eu=RangeError,Au=function(t){var e=Tu(t);if(e<0)throw Eu("The argument can't be less than 0");return e},bu=RangeError,Su=function(t,e){var r=Au(t);if(r%e)throw bu("Wrong offset");return r},_u=Math.round,Ru=w,Cu=_,Ou=function(t){if("Function"===Ru(t))return Cu(t)},wu=At,Mu=l,Iu=Ou(Ou.bind),Lu=function(t,e){return wu(t),void 0===e?t:Mu?Iu(t,e):function(){return t.apply(e,arguments)}},Pu=_,Fu=u,Vu=Y,Nu=wo,Du=lr,zu=function(){},Uu=[],Bu=K("Reflect","construct"),ku=/^\s*(?:class|function)\b/,Gu=Pu(ku.exec),ju=!ku.exec(zu),Xu=function(t){if(!Vu(t))return!1;try{return Bu(zu,Uu,t),!0}catch(t){return!1}},Yu=function(t){if(!Vu(t))return!1;switch(Nu(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ju||!!Gu(ku,Du(t))}catch(t){return!0}};Yu.sham=!0;var Wu=!Bu||Fu((function(){var t;return Xu(Xu.call)||!Xu(Object)||!Xu((function(){t=!0}))||t}))?Yu:Xu,Hu=Wu,Zu=gt,qu=TypeError,Qu=function(t){if(Hu(t))return t;throw qu(Zu(t)+" is not a constructor")},Ku={},Ju=wo,$u=_t,tc=V,ec=Ku,rc=ne("iterator"),ic=function(t){if(!tc(t))return $u(t,rc)||$u(t,"@@iterator")||ec[Ju(t)]},nc=p,oc=At,ac=Ne,sc=gt,uc=ic,cc=TypeError,lc=function(t,e){var r=arguments.length<2?uc(t):e;if(oc(r))return ac(nc(r,t));throw cc(sc(t)+" is not iterable")},hc=Ku,fc=ne("iterator"),pc=Array.prototype,dc=function(t){return void 0!==t&&(hc.Array===t||pc[fc]===t)},mc=wo,vc=function(t){var e=mc(t);return"BigInt64Array"===e||"BigUint64Array"===e},yc=fe,gc=TypeError,xc=function(t){var e=yc(t,"number");if("number"==typeof e)throw gc("Can't convert number to bigint");return BigInt(e)},Tc=Lu,Ec=p,Ac=Qu,bc=Bt,Sc=mi,_c=lc,Rc=ic,Cc=dc,Oc=vc,wc=ba.aTypedArrayConstructor,Mc=xc,Ic=function(t){var e,r,i,n,o,a,s,u,c=Ac(this),l=bc(t),h=arguments.length,f=h>1?arguments[1]:void 0,p=void 0!==f,d=Rc(l);if(d&&!Cc(d))for(u=(s=_c(l,d)).next,l=[];!(a=Ec(u,s)).done;)l.push(a.value);for(p&&h>2&&(f=Tc(f,arguments[2])),r=Sc(l),i=new(wc(c))(r),n=Oc(i),e=0;r>e;e++)o=p?f(l[e],e):l[e],i[e]=n?Mc(o):+o;return i},Lc=w,Pc=Array.isArray||function(t){return"Array"===Lc(t)},Fc=Wu,Vc=Z,Nc=ne("species"),Dc=Array,zc=function(t){var e;return Pc(t)&&(e=t.constructor,(Fc(e)&&(e===Dc||Pc(e.prototype))||Vc(e)&&null===(e=e[Nc]))&&(e=void 0)),void 0===e?Dc:e},Uc=Lu,Bc=F,kc=Bt,Gc=mi,jc=function(t,e){return new(zc(t))(0===e?0:e)},Xc=_([].push),Yc=function(t){var e=1===t,r=2===t,i=3===t,n=4===t,o=6===t,a=7===t,s=5===t||o;return function(u,c,l,h){for(var f,p,d=kc(u),m=Bc(d),v=Uc(c,l),y=Gc(m),g=0,x=h||jc,T=e?x(u,y):r||a?x(u,0):void 0;y>g;g++)if((s||g in m)&&(p=v(f=m[g],g,d),t))if(e)T[g]=p;else if(p)switch(t){case 3:return!0;case 5:return f;case 6:return g;case 2:Xc(T,f)}else switch(t){case 4:return!1;case 7:Xc(T,f)}return o?-1:i||n?n:T}},Wc={forEach:Yc(0),map:Yc(1),filter:Yc(2),some:Yc(3),every:Yc(4),find:Yc(5),findIndex:Yc(6),filterReject:Yc(7)},Hc=K,Zc=Lo,qc=c,Qc=ne("species"),Kc=function(t){var e=Hc(t);qc&&e&&!e[Qc]&&Zc(e,Qc,{configurable:!0,get:function(){return this}})},Jc=Y,$c=Z,tl=ko,el=function(t,e,r){var i,n;return tl&&Jc(i=e.constructor)&&i!==r&&$c(n=i.prototype)&&n!==r.prototype&&tl(t,n),t},rl=nn,il=a,nl=p,ol=c,al=Ma,sl=ba,ul=vu,cl=Va,ll=T,hl=Qe,fl=xu,pl=pi,dl=Ua,ml=Su,vl=function(t){var e=_u(t);return e<0?0:e>255?255:255&e},yl=me,gl=jt,xl=wo,Tl=Z,El=vt,Al=Mn,bl=J,Sl=ko,_l=ei.f,Rl=Ic,Cl=Wc.forEach,Ol=Kc,wl=Lo,Ml=Ie,Il=s,Ll=el,Pl=Lr.get,Fl=Lr.set,Vl=Lr.enforce,Nl=Ml.f,Dl=Il.f,zl=il.RangeError,Ul=ul.ArrayBuffer,Bl=Ul.prototype,kl=ul.DataView,Gl=sl.NATIVE_ARRAY_BUFFER_VIEWS,jl=sl.TYPED_ARRAY_TAG,Xl=sl.TypedArray,Yl=sl.TypedArrayPrototype,Wl=sl.aTypedArrayConstructor,Hl=sl.isTypedArray,Zl="BYTES_PER_ELEMENT",ql="Wrong length",Ql=function(t,e){Wl(t);for(var r=0,i=e.length,n=new t(i);i>r;)n[r]=e[r++];return n},Kl=function(t,e){wl(t,e,{configurable:!0,get:function(){return Pl(this)[e]}})},Jl=function(t){var e;return bl(Bl,t)||"ArrayBuffer"===(e=xl(t))||"SharedArrayBuffer"===e},$l=function(t,e){return Hl(t)&&!El(e)&&e in t&&fl(+e)&&e>=0},th=function(t,e){return e=yl(e),$l(t,e)?ll(2,t[e]):Dl(t,e)},eh=function(t,e,r){return e=yl(e),!($l(t,e)&&Tl(r)&&gl(r,"value"))||gl(r,"get")||gl(r,"set")||r.configurable||gl(r,"writable")&&!r.writable||gl(r,"enumerable")&&!r.enumerable?Nl(t,e,r):(t[e]=r.value,t)};ol?(Gl||(Il.f=th,Ml.f=eh,Kl(Yl,"buffer"),Kl(Yl,"byteOffset"),Kl(Yl,"byteLength"),Kl(Yl,"length")),rl({target:"Object",stat:!0,forced:!Gl},{getOwnPropertyDescriptor:th,defineProperty:eh}),lo.exports=function(t,e,r){var i=t.match(/\d+/)[0]/8,n=t+(r?"Clamped":"")+"Array",o="get"+t,a="set"+t,s=il[n],u=s,c=u&&u.prototype,l={},h=function(t,e){Nl(t,e,{get:function(){return function(t,e){var r=Pl(t);return r.view[o](e*i+r.byteOffset,!0)}(this,e)},set:function(t){return function(t,e,n){var o=Pl(t);o.view[a](e*i+o.byteOffset,r?vl(n):n,!0)}(this,e,t)},enumerable:!0})};Gl?al&&(u=e((function(t,e,r,n){return cl(t,c),Ll(Tl(e)?Jl(e)?void 0!==n?new s(e,ml(r,i),n):void 0!==r?new s(e,ml(r,i)):new s(e):Hl(e)?Ql(u,e):nl(Rl,u,e):new s(dl(e)),t,u)})),Sl&&Sl(u,Xl),Cl(_l(s),(function(t){t in u||hl(u,t,s[t])})),u.prototype=c):(u=e((function(t,e,r,n){cl(t,c);var o,a,s,l=0,f=0;if(Tl(e)){if(!Jl(e))return Hl(e)?Ql(u,e):nl(Rl,u,e);o=e,f=ml(r,i);var p=e.byteLength;if(void 0===n){if(p%i)throw zl(ql);if((a=p-f)<0)throw zl(ql)}else if((a=pl(n)*i)+f>p)throw zl(ql);s=a/i}else s=dl(e),o=new Ul(a=s*i);for(Fl(t,{buffer:o,byteOffset:f,byteLength:a,length:s,view:new kl(o)});l<s;)h(t,l++)})),Sl&&Sl(u,Xl),c=u.prototype=Al(Yl)),c.constructor!==u&&hl(c,"constructor",u),Vl(c).TypedArrayConstructor=u,jl&&hl(c,jl,n);var f=u!==s;l[n]=u,rl({global:!0,constructor:!0,forced:f,sham:!Gl},l),Zl in u||hl(u,Zl,i),Zl in c||hl(c,Zl,i),Ol(n)}):lo.exports=function(){},(0,lo.exports)("Int8",(function(t){return function(e,r,i){return t(this,e,r,i)}})),(0,lo.exports)("Uint8",(function(t){return function(e,r,i){return t(this,e,r,i)}})),(0,lo.exports)("Uint8",(function(t){return function(e,r,i){return t(this,e,r,i)}}),!0),(0,lo.exports)("Int16",(function(t){return function(e,r,i){return t(this,e,r,i)}})),(0,lo.exports)("Uint16",(function(t){return function(e,r,i){return t(this,e,r,i)}})),(0,lo.exports)("Int32",(function(t){return function(e,r,i){return t(this,e,r,i)}})),(0,lo.exports)("Uint32",(function(t){return function(e,r,i){return t(this,e,r,i)}})),(0,lo.exports)("Float32",(function(t){return function(e,r,i){return t(this,e,r,i)}})),(0,lo.exports)("Float64",(function(t){return function(e,r,i){return t(this,e,r,i)}}));var rh=wo,ih=Ao?{}.toString:function(){return"[object "+rh(this)+"]"};Ao||ti(Object.prototype,"toString",ih,{unsafe:!0});var nh,oh,ah,sh=wo,uh=String,ch=function(t){if("Symbol"===sh(t))throw TypeError("Cannot convert a Symbol value to a string");return uh(t)},lh=_,hh=ai,fh=ch,ph=z,dh=lh("".charAt),mh=lh("".charCodeAt),vh=lh("".slice),yh=function(t){return function(e,r){var i,n,o=fh(ph(e)),a=hh(r),s=o.length;return a<0||a>=s?t?"":void 0:(i=mh(o,a))<55296||i>56319||a+1===s||(n=mh(o,a+1))<56320||n>57343?t?dh(o,a):i:t?vh(o,a,a+2):n-56320+(i-55296<<10)+65536}},gh={codeAt:yh(!1),charAt:yh(!0)},xh=u,Th=Y,Eh=Z,Ah=qn,bh=ti,Sh=ne("iterator"),_h=!1;[].keys&&("next"in(ah=[].keys())?(oh=Ah(Ah(ah)))!==Object.prototype&&(nh=oh):_h=!0);var Rh=!Eh(nh)||xh((function(){var t={};return nh[Sh].call(t)!==t}));Rh&&(nh={}),Th(nh[Sh])||bh(nh,Sh,(function(){return this}));var Ch={IteratorPrototype:nh,BUGGY_SAFARI_ITERATORS:_h},Oh=Ch.IteratorPrototype,wh=Mn,Mh=T,Ih=fs,Lh=Ku,Ph=function(){return this},Fh=nn,Vh=p,Nh=Y,Dh=function(t,e,r,i){var n=e+" Iterator";return t.prototype=wh(Oh,{next:Mh(+!i,r)}),Ih(t,n,!1),Lh[n]=Ph,t},zh=qn,Uh=ko,Bh=fs,kh=Qe,Gh=ti,jh=Ku,Xh=ir.PROPER,Yh=ir.CONFIGURABLE,Wh=Ch.IteratorPrototype,Hh=Ch.BUGGY_SAFARI_ITERATORS,Zh=ne("iterator"),qh="keys",Qh="values",Kh="entries",Jh=function(){return this},$h=function(t,e,r,i,n,o,a){Dh(r,e,i);var s,u,c,l=function(t){if(t===n&&m)return m;if(!Hh&&t in p)return p[t];switch(t){case qh:case Qh:case Kh:return function(){return new r(this,t)}}return function(){return new r(this)}},h=e+" Iterator",f=!1,p=t.prototype,d=p[Zh]||p["@@iterator"]||n&&p[n],m=!Hh&&d||l(n),v="Array"===e&&p.entries||d;if(v&&(s=zh(v.call(new t)))!==Object.prototype&&s.next&&(zh(s)!==Wh&&(Uh?Uh(s,Wh):Nh(s[Zh])||Gh(s,Zh,Jh)),Bh(s,h,!0)),Xh&&n===Qh&&d&&d.name!==Qh&&(Yh?kh(p,"name",Qh):(f=!0,m=function(){return Vh(d,this)})),n)if(u={values:l(Qh),keys:o?m:l(qh),entries:l(Kh)},a)for(c in u)(Hh||f||!(c in p))&&Gh(p,c,u[c]);else Fh({target:e,proto:!0,forced:Hh||f},u);return p[Zh]!==m&&Gh(p,Zh,m,{name:n}),jh[e]=m,u},tf=function(t,e){return{value:t,done:e}},ef=gh.charAt,rf=ch,nf=Lr,of=$h,af=tf,sf="String Iterator",uf=nf.set,cf=nf.getterFor(sf);of(String,"String",(function(t){uf(this,{type:sf,string:rf(t),index:0})}),(function(){var t,e=cf(this),r=e.string,i=e.index;return i>=r.length?af(void 0,!0):(t=ef(r,i),e.index+=t.length,af(t,!1))})),(0,ba.exportTypedArrayStaticMethod)("from",Ic,Ma);var lf=ba.aTypedArrayConstructor;(0,ba.exportTypedArrayStaticMethod)("of",(function(){for(var t=0,e=arguments.length,r=new(lf(this))(e);e>t;)r[t]=arguments[t++];return r}),Ma);var hf=mi,ff=ai,pf=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("at",(function(t){var e=pf(this),r=hf(e),i=ff(t),n=i>=0?i:r+i;return n<0||n>=r?void 0:e[n]}));var df=gt,mf=TypeError,vf=Bt,yf=li,gf=mi,xf=function(t,e){if(!delete t[e])throw mf("Cannot delete property "+df(e)+" of "+df(t))},Tf=Math.min,Ef=[].copyWithin||function(t,e){var r=vf(this),i=gf(r),n=yf(t,i),o=yf(e,i),a=arguments.length>2?arguments[2]:void 0,s=Tf((void 0===a?i:yf(a,i))-o,i-n),u=1;for(o<n&&n<o+s&&(u=-1,o+=s-1,n+=s-1);s-- >0;)o in r?r[n]=r[o]:xf(r,n),n+=u,o+=u;return r},Af=ba,bf=_(Ef),Sf=Af.aTypedArray;(0,Af.exportTypedArrayMethod)("copyWithin",(function(t,e){return bf(Sf(this),t,e,arguments.length>2?arguments[2]:void 0)}));var _f=Wc.every,Rf=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("every",(function(t){return _f(Rf(this),t,arguments.length>1?arguments[1]:void 0)}));var Cf=$a,Of=xc,wf=wo,Mf=p,If=u,Lf=ba.aTypedArray,Pf=ba.exportTypedArrayMethod,Ff=_("".slice);Pf("fill",(function(t){var e=arguments.length;Lf(this);var r="Big"===Ff(wf(this),0,3)?Of(t):+t;return Mf(Cf,this,r,e>1?arguments[1]:void 0,e>2?arguments[2]:void 0)}),If((function(){var t=0;return new Int8Array(2).fill({valueOf:function(){return t++}}),1!==t})));var Vf=mi,Nf=function(t,e){for(var r=0,i=Vf(e),n=new t(i);i>r;)n[r]=e[r++];return n},Df=Ne,zf=Qu,Uf=V,Bf=ne("species"),kf=function(t,e){var r,i=Df(t).constructor;return void 0===i||Uf(r=Df(i)[Bf])?e:zf(r)},Gf=kf,jf=ba.aTypedArrayConstructor,Xf=ba.getTypedArrayConstructor,Yf=function(t){return jf(Gf(t,Xf(t)))},Wf=Nf,Hf=Yf,Zf=function(t,e){return Wf(Hf(t),e)},qf=Wc.filter,Qf=Zf,Kf=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("filter",(function(t){var e=qf(Kf(this),t,arguments.length>1?arguments[1]:void 0);return Qf(this,e)}));var Jf=Wc.find,$f=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("find",(function(t){return Jf($f(this),t,arguments.length>1?arguments[1]:void 0)}));var tp=Wc.findIndex,ep=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("findIndex",(function(t){return tp(ep(this),t,arguments.length>1?arguments[1]:void 0)}));var rp=Lu,ip=F,np=Bt,op=mi,ap=function(t){var e=1===t;return function(r,i,n){for(var o,a=np(r),s=ip(a),u=rp(i,n),c=op(s);c-- >0;)if(u(o=s[c],c,a))switch(t){case 0:return o;case 1:return c}return e?-1:void 0}},sp={findLast:ap(0),findLastIndex:ap(1)},up=sp.findLast,cp=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("findLast",(function(t){return up(cp(this),t,arguments.length>1?arguments[1]:void 0)}));var lp=sp.findLastIndex,hp=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("findLastIndex",(function(t){return lp(hp(this),t,arguments.length>1?arguments[1]:void 0)}));var fp=Wc.forEach,pp=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("forEach",(function(t){fp(pp(this),t,arguments.length>1?arguments[1]:void 0)}));var dp=Ti.includes,mp=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("includes",(function(t){return dp(mp(this),t,arguments.length>1?arguments[1]:void 0)}));var vp=Ti.indexOf,yp=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("indexOf",(function(t){return vp(yp(this),t,arguments.length>1?arguments[1]:void 0)}));var gp=ba.aTypedArray,xp=ba.exportTypedArrayMethod,Tp=_([].join);xp("join",(function(t){return Tp(gp(this),t)}));var Ep=l,Ap=Function.prototype,bp=Ap.apply,Sp=Ap.call,_p="object"==typeof Reflect&&Reflect.apply||(Ep?Sp.bind(bp):function(){return Sp.apply(bp,arguments)}),Rp=u,Cp=_p,Op=k,wp=ai,Mp=mi,Ip=function(t,e){var r=[][t];return!!r&&Rp((function(){r.call(null,e||function(){return 1},1)}))},Lp=Math.min,Pp=[].lastIndexOf,Fp=!!Pp&&1/[1].lastIndexOf(1,-0)<0,Vp=Ip("lastIndexOf"),Np=Fp||!Vp?function(t){if(Fp)return Cp(Pp,this,arguments)||0;var e=Op(this),r=Mp(e),i=r-1;for(arguments.length>1&&(i=Lp(i,wp(arguments[1]))),i<0&&(i=r+i);i>=0;i--)if(i in e&&e[i]===t)return i||0;return-1}:Pp,Dp=_p,zp=Np,Up=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("lastIndexOf",(function(t){var e=arguments.length;return Dp(zp,Up(this),e>1?[t,arguments[1]]:[t])}));var Bp=Wc.map,kp=Yf,Gp=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("map",(function(t){return Bp(Gp(this),t,arguments.length>1?arguments[1]:void 0,(function(t,e){return new(kp(t))(e)}))}));var jp=At,Xp=Bt,Yp=F,Wp=mi,Hp=TypeError,Zp=function(t){return function(e,r,i,n){jp(r);var o=Xp(e),a=Yp(o),s=Wp(o),u=t?s-1:0,c=t?-1:1;if(i<2)for(;;){if(u in a){n=a[u],u+=c;break}if(u+=c,t?u<0:s<=u)throw Hp("Reduce of empty array with no initial value")}for(;t?u>=0:s>u;u+=c)u in a&&(n=r(n,a[u],u,o));return n}},qp={left:Zp(!1),right:Zp(!0)},Qp=qp.left,Kp=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("reduce",(function(t){var e=arguments.length;return Qp(Kp(this),t,e,e>1?arguments[1]:void 0)}));var Jp=qp.right,$p=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("reduceRight",(function(t){var e=arguments.length;return Jp($p(this),t,e,e>1?arguments[1]:void 0)}));var td=ba.aTypedArray,ed=ba.exportTypedArrayMethod,rd=Math.floor;ed("reverse",(function(){for(var t,e=this,r=td(e).length,i=rd(r/2),n=0;n<i;)t=e[n],e[n++]=e[--r],e[r]=t;return e}));var id=a,nd=p,od=ba,ad=mi,sd=Su,ud=Bt,cd=u,ld=id.RangeError,hd=id.Int8Array,fd=hd&&hd.prototype,pd=fd&&fd.set,dd=od.aTypedArray,md=od.exportTypedArrayMethod,vd=!cd((function(){var t=new Uint8ClampedArray(2);return nd(pd,t,{length:1,0:3},1),3!==t[1]})),yd=vd&&od.NATIVE_ARRAY_BUFFER_VIEWS&&cd((function(){var t=new hd(2);return t.set(1),t.set("2",1),0!==t[0]||2!==t[1]}));md("set",(function(t){dd(this);var e=sd(arguments.length>1?arguments[1]:void 0,1),r=ud(t);if(vd)return nd(pd,this,r,e);var i=this.length,n=ad(r),o=0;if(n+e>i)throw ld("Wrong length");for(;o<n;)this[e+o]=r[o++]}),!vd||yd);var gd=_([].slice),xd=Yf,Td=gd,Ed=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("slice",(function(t,e){for(var r=Td(Ed(this),t,e),i=xd(this),n=0,o=r.length,a=new i(o);o>n;)a[n]=r[n++];return a}),u((function(){new Int8Array(1).slice()})));var Ad=Wc.some,bd=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("some",(function(t){return Ad(bd(this),t,arguments.length>1?arguments[1]:void 0)}));var Sd=us,_d=Math.floor,Rd=function(t,e){var r=t.length,i=_d(r/2);return r<8?Cd(t,e):Od(t,Rd(Sd(t,0,i),e),Rd(Sd(t,i),e),e)},Cd=function(t,e){for(var r,i,n=t.length,o=1;o<n;){for(i=o,r=t[o];i&&e(t[i-1],r)>0;)t[i]=t[--i];i!==o++&&(t[i]=r)}return t},Od=function(t,e,r,i){for(var n=e.length,o=r.length,a=0,s=0;a<n||s<o;)t[a+s]=a<n&&s<o?i(e[a],r[s])<=0?e[a++]:r[s++]:a<n?e[a++]:r[s++];return t},wd=Rd,Md=$.match(/firefox\/(\d+)/i),Id=!!Md&&+Md[1],Ld=/MSIE|Trident/.test($),Pd=$.match(/AppleWebKit\/(\d+)\./),Fd=!!Pd&&+Pd[1],Vd=Ou,Nd=u,Dd=At,zd=wd,Ud=Id,Bd=Ld,kd=at,Gd=Fd,jd=ba.aTypedArray,Xd=ba.exportTypedArrayMethod,Yd=a.Uint16Array,Wd=Yd&&Vd(Yd.prototype.sort),Hd=!(!Wd||Nd((function(){Wd(new Yd(2),null)}))&&Nd((function(){Wd(new Yd(2),{})}))),Zd=!!Wd&&!Nd((function(){if(kd)return kd<74;if(Ud)return Ud<67;if(Bd)return!0;if(Gd)return Gd<602;var t,e,r=new Yd(516),i=Array(516);for(t=0;t<516;t++)e=t%4,r[t]=515-t,i[t]=t-2*e+3;for(Wd(r,(function(t,e){return(t/4|0)-(e/4|0)})),t=0;t<516;t++)if(r[t]!==i[t])return!0}));Xd("sort",(function(t){return void 0!==t&&Dd(t),Zd?Wd(this,t):zd(jd(this),function(t){return function(e,r){return void 0!==t?+t(e,r)||0:r!=r?-1:e!=e?1:0===e&&0===r?1/e>0&&1/r<0?1:-1:e>r}}(t))}),!Zd||Hd);var qd=pi,Qd=li,Kd=Yf,Jd=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("subarray",(function(t,e){var r=Jd(this),i=r.length,n=Qd(t,i);return new(Kd(r))(r.buffer,r.byteOffset+n*r.BYTES_PER_ELEMENT,qd((void 0===e?i:Qd(e,i))-n))}));var $d=_p,tm=ba,em=u,rm=gd,im=a.Int8Array,nm=tm.aTypedArray,om=tm.exportTypedArrayMethod,am=[].toLocaleString,sm=!!im&&em((function(){am.call(new im(1))}));om("toLocaleString",(function(){return $d(am,sm?rm(nm(this)):nm(this),rm(arguments))}),em((function(){return[1,2].toLocaleString()!==new im([1,2]).toLocaleString()}))||!em((function(){im.prototype.toLocaleString.call([1,2])})));var um=ba.exportTypedArrayMethod,cm=u,lm=_,hm=a.Uint8Array,fm=hm&&hm.prototype||{},pm=[].toString,dm=lm([].join);cm((function(){pm.call({})}))&&(pm=function(){return dm(this)});var mm=fm.toString!==pm;um("toString",pm,mm);var vm=mi,ym=function(t,e){for(var r=vm(t),i=new e(r),n=0;n<r;n++)i[n]=t[r-n-1];return i},gm=ba.aTypedArray,xm=ba.getTypedArrayConstructor;(0,ba.exportTypedArrayMethod)("toReversed",(function(){return ym(gm(this),xm(this))}));var Tm=At,Em=Nf,Am=ba.aTypedArray,bm=ba.getTypedArrayConstructor,Sm=ba.exportTypedArrayMethod,_m=_(ba.TypedArrayPrototype.sort);Sm("toSorted",(function(t){void 0!==t&&Tm(t);var e=Am(this),r=Em(bm(e),e);return _m(r,t)}));var Rm=mi,Cm=ai,Om=RangeError,wm=function(t,e,r,i){var n=Rm(t),o=Cm(r),a=o<0?n+o:o;if(a>=n||a<0)throw Om("Incorrect index");for(var s=new e(n),u=0;u<n;u++)s[u]=u===a?i:t[u];return s},Mm=vc,Im=ai,Lm=xc,Pm=ba.aTypedArray,Fm=ba.getTypedArrayConstructor,Vm=ba.exportTypedArrayMethod,Nm=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}();Vm("with",{with:function(t,e){var r=Pm(this),i=Im(t),n=Mm(r)?Lm(e):+e;return wm(r,Fm(r),i,n)}}.with,!Nm);var Dm=k,zm=Nn,Um=Ku,Bm=Lr,km=Ie.f,Gm=$h,jm=tf,Xm=c,Ym="Array Iterator",Wm=Bm.set,Hm=Bm.getterFor(Ym),Zm=Gm(Array,"Array",(function(t,e){Wm(this,{type:Ym,target:Dm(t),index:0,kind:e})}),(function(){var t=Hm(this),e=t.target,r=t.kind,i=t.index++;if(!e||i>=e.length)return t.target=void 0,jm(void 0,!0);switch(r){case"keys":return jm(i,!1);case"values":return jm(e[i],!1)}return jm([i,e[i]],!1)}),"values"),qm=Um.Arguments=Um.Array;if(zm("keys"),zm("values"),zm("entries"),Xm&&"values"!==qm.name)try{km(qm,"name",{value:"values"})}catch(t){}var Qm=a,Km=u,Jm=_,$m=ba,tv=Zm,ev=ne("iterator"),rv=Qm.Uint8Array,iv=Jm(tv.values),nv=Jm(tv.keys),ov=Jm(tv.entries),av=$m.aTypedArray,sv=$m.exportTypedArrayMethod,uv=rv&&rv.prototype,cv=!Km((function(){uv[ev].call([1])})),lv=!!uv&&uv.values&&uv[ev]===uv.values&&"values"===uv.values.name,hv=function(){return iv(av(this))};sv("entries",(function(){return ov(av(this))}),cv),sv("keys",(function(){return nv(av(this))}),cv),sv("values",hv,cv||!lv,{name:"values"}),sv(ev,hv,cv||!lv,{name:"values"});var fv=mi,pv=vc,dv=li,mv=xc,vv=ai,yv=u,gv=ba.aTypedArray,xv=ba.getTypedArrayConstructor,Tv=ba.exportTypedArrayMethod,Ev=Math.max,Av=Math.min;Tv("toSpliced",(function(t,e){var r,i,n,o,a,s,u,c=gv(this),l=xv(c),h=fv(c),f=dv(t,h),p=arguments.length,d=0;if(0===p)r=i=0;else if(1===p)r=0,i=h-f;else if(i=Av(Ev(vv(e),0),h-f),r=p-2){o=new l(r),n=pv(o);for(var m=2;m<p;m++)a=arguments[m],o[m-2]=n?mv(a):+a}for(u=new l(s=h+r-i);d<f;d++)u[d]=c[d];for(;d<f+r;d++)u[d]=o[d-f];for(;d<s;d++)u[d]=c[d+i-r];return u}),!!yv((function(){var t=new Int8Array([1]),e=t.toSpliced(1,0,{valueOf:function(){return t[0]=2,3}});return 2!==e[0]||3!==e[1]})));var bv={exports:{}},Sv={},_v=w,Rv=k,Cv=ei.f,Ov=us,wv="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Sv.f=function(t){return wv&&"Window"===_v(t)?function(t){try{return Cv(t)}catch(t){return Ov(wv)}}(t):Cv(Rv(t))};var Mv=u((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),Iv=u,Lv=Z,Pv=w,Fv=Mv,Vv=Object.isExtensible,Nv=Iv((function(){Vv(1)}))||Fv?function(t){return!!Lv(t)&&((!Fv||"ArrayBuffer"!==Pv(t))&&(!Vv||Vv(t)))}:Vv,Dv=!u((function(){return Object.isExtensible(Object.preventExtensions({}))})),zv=nn,Uv=_,Bv=gr,kv=Z,Gv=jt,jv=Ie.f,Xv=ei,Yv=Sv,Wv=Nv,Hv=Dv,Zv=!1,qv=Zt("meta"),Qv=0,Kv=function(t){jv(t,qv,{value:{objectID:"O"+Qv++,weakData:{}}})},Jv=bv.exports={enable:function(){Jv.enable=function(){},Zv=!0;var t=Xv.f,e=Uv([].splice),r={};r[qv]=1,t(r).length&&(Xv.f=function(r){for(var i=t(r),n=0,o=i.length;n<o;n++)if(i[n]===qv){e(i,n,1);break}return i},zv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Yv.f}))},fastKey:function(t,e){if(!kv(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!Gv(t,qv)){if(!Wv(t))return"F";if(!e)return"E";Kv(t)}return t[qv].objectID},getWeakData:function(t,e){if(!Gv(t,qv)){if(!Wv(t))return!0;if(!e)return!1;Kv(t)}return t[qv].weakData},onFreeze:function(t){return Hv&&Zv&&Wv(t)&&!Gv(t,qv)&&Kv(t),t}};Bv[qv]=!0;var $v=p,ty=Ne,ey=_t,ry=Lu,iy=p,ny=Ne,oy=gt,ay=dc,sy=mi,uy=J,cy=lc,ly=ic,hy=function(t,e,r){var i,n;ty(t);try{if(!(i=ey(t,"return"))){if("throw"===e)throw r;return r}i=$v(i,t)}catch(t){n=!0,i=t}if("throw"===e)throw r;if(n)throw i;return ty(i),r},fy=TypeError,py=function(t,e){this.stopped=t,this.result=e},dy=py.prototype,my=function(t,e,r){var i,n,o,a,s,u,c,l=r&&r.that,h=!(!r||!r.AS_ENTRIES),f=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),d=!(!r||!r.INTERRUPTED),m=ry(e,l),v=function(t){return i&&hy(i,"normal",t),new py(!0,t)},y=function(t){return h?(ny(t),d?m(t[0],t[1],v):m(t[0],t[1])):d?m(t,v):m(t)};if(f)i=t.iterator;else if(p)i=t;else{if(!(n=ly(t)))throw fy(oy(t)+" is not iterable");if(ay(n)){for(o=0,a=sy(t);a>o;o++)if((s=y(t[o]))&&uy(dy,s))return s;return new py(!1)}i=cy(t,n)}for(u=f?t.next:i.next;!(c=iy(u,i)).done;){try{s=y(c.value)}catch(t){hy(i,"throw",t)}if("object"==typeof s&&s&&uy(dy,s))return s}return new py(!1)},vy=nn,yy=a,gy=_,xy=qi,Ty=ti,Ey=bv.exports,Ay=my,by=Va,Sy=Y,_y=V,Ry=Z,Cy=u,Oy=vo,wy=fs,My=el,Iy=Mn,Ly=Lo,Py=La,Fy=Lu,Vy=Va,Ny=V,Dy=my,zy=$h,Uy=tf,By=Kc,ky=c,Gy=bv.exports.fastKey,jy=Lr.set,Xy=Lr.getterFor,Yy={getConstructor:function(t,e,r,i){var n=t((function(t,n){Vy(t,o),jy(t,{type:e,index:Iy(null),first:void 0,last:void 0,size:0}),ky||(t.size=0),Ny(n)||Dy(n,t[i],{that:t,AS_ENTRIES:r})})),o=n.prototype,a=Xy(e),s=function(t,e,r){var i,n,o=a(t),s=u(t,e);return s?s.value=r:(o.last=s={index:n=Gy(e,!0),key:e,value:r,previous:i=o.last,next:void 0,removed:!1},o.first||(o.first=s),i&&(i.next=s),ky?o.size++:t.size++,"F"!==n&&(o.index[n]=s)),t},u=function(t,e){var r,i=a(t),n=Gy(e);if("F"!==n)return i.index[n];for(r=i.first;r;r=r.next)if(r.key===e)return r};return Py(o,{clear:function(){for(var t=a(this),e=t.index,r=t.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete e[r.index],r=r.next;t.first=t.last=void 0,ky?t.size=0:this.size=0},delete:function(t){var e=this,r=a(e),i=u(e,t);if(i){var n=i.next,o=i.previous;delete r.index[i.index],i.removed=!0,o&&(o.next=n),n&&(n.previous=o),r.first===i&&(r.first=n),r.last===i&&(r.last=o),ky?r.size--:e.size--}return!!i},forEach:function(t){for(var e,r=a(this),i=Fy(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:r.first;)for(i(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!u(this,t)}}),Py(o,r?{get:function(t){var e=u(this,t);return e&&e.value},set:function(t,e){return s(this,0===t?0:t,e)}}:{add:function(t){return s(this,t=0===t?0:t,t)}}),ky&&Ly(o,"size",{configurable:!0,get:function(){return a(this).size}}),n},setStrong:function(t,e,r){var i=e+" Iterator",n=Xy(e),o=Xy(i);zy(t,e,(function(t,e){jy(this,{type:i,target:t,state:n(t),kind:e,last:void 0})}),(function(){for(var t=o(this),e=t.kind,r=t.last;r&&r.removed;)r=r.previous;return t.target&&(t.last=r=r?r.next:t.state.first)?Uy("keys"===e?r.key:"values"===e?r.value:[r.key,r.value],!1):(t.target=void 0,Uy(void 0,!0))}),r?"entries":"values",!r,!0),By(e)}},Wy=function(t,e,r){var i=-1!==t.indexOf("Map"),n=-1!==t.indexOf("Weak"),o=i?"set":"add",a=yy[t],s=a&&a.prototype,u=a,c={},l=function(t){var e=gy(s[t]);Ty(s,t,"add"===t?function(t){return e(this,0===t?0:t),this}:"delete"===t?function(t){return!(n&&!Ry(t))&&e(this,0===t?0:t)}:"get"===t?function(t){return n&&!Ry(t)?void 0:e(this,0===t?0:t)}:"has"===t?function(t){return!(n&&!Ry(t))&&e(this,0===t?0:t)}:function(t,r){return e(this,0===t?0:t,r),this})};if(xy(t,!Sy(a)||!(n||s.forEach&&!Cy((function(){(new a).entries().next()})))))u=r.getConstructor(e,t,i,o),Ey.enable();else if(xy(t,!0)){var h=new u,f=h[o](n?{}:-0,1)!==h,p=Cy((function(){h.has(1)})),d=Oy((function(t){new a(t)})),m=!n&&Cy((function(){for(var t=new a,e=5;e--;)t[o](e,e);return!t.has(-0)}));d||((u=e((function(t,e){by(t,s);var r=My(new a,t,u);return _y(e)||Ay(e,r[o],{that:r,AS_ENTRIES:i}),r}))).prototype=s,s.constructor=u),(p||m)&&(l("delete"),l("has"),i&&l("get")),(m||f)&&l(o),n&&s.clear&&delete s.clear}return c[t]=u,vy({global:!0,constructor:!0,forced:u!==a},c),wy(u,t),n||r.setStrong(u,t,i),u};Wy("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Yy);var Hy,Zy,qy,Qy,Ky="process"===w(a.process),Jy=TypeError,$y=/(?:ipad|iphone|ipod).*applewebkit/i.test($),tg=a,eg=_p,rg=Lu,ig=Y,ng=jt,og=u,ag=vn,sg=gd,ug=xe,cg=function(t,e){if(t<e)throw Jy("Not enough arguments");return t},lg=$y,hg=Ky,fg=tg.setImmediate,pg=tg.clearImmediate,dg=tg.process,mg=tg.Dispatch,vg=tg.Function,yg=tg.MessageChannel,gg=tg.String,xg=0,Tg={},Eg="onreadystatechange";og((function(){Hy=tg.location}));var Ag=function(t){if(ng(Tg,t)){var e=Tg[t];delete Tg[t],e()}},bg=function(t){return function(){Ag(t)}},Sg=function(t){Ag(t.data)},_g=function(t){tg.postMessage(gg(t),Hy.protocol+"//"+Hy.host)};fg&&pg||(fg=function(t){cg(arguments.length,1);var e=ig(t)?t:vg(t),r=sg(arguments,1);return Tg[++xg]=function(){eg(e,void 0,r)},Zy(xg),xg},pg=function(t){delete Tg[t]},hg?Zy=function(t){dg.nextTick(bg(t))}:mg&&mg.now?Zy=function(t){mg.now(bg(t))}:yg&&!lg?(Qy=(qy=new yg).port2,qy.port1.onmessage=Sg,Zy=rg(Qy.postMessage,Qy)):tg.addEventListener&&ig(tg.postMessage)&&!tg.importScripts&&Hy&&"file:"!==Hy.protocol&&!og(_g)?(Zy=_g,tg.addEventListener("message",Sg,!1)):Zy=Eg in ug("script")?function(t){ag.appendChild(ug("script"))[Eg]=function(){ag.removeChild(this),Ag(t)}}:function(t){setTimeout(bg(t),0)});var Rg={set:fg,clear:pg},Cg=function(){this.head=null,this.tail=null};Cg.prototype={add:function(t){var e={item:t,next:null},r=this.tail;r?r.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}};var Og,wg,Mg,Ig,Lg,Pg=Cg,Fg=/ipad|iphone|ipod/i.test($)&&"undefined"!=typeof Pebble,Vg=/web0s(?!.*chrome)/i.test($),Ng=a,Dg=Lu,zg=s.f,Ug=Rg.set,Bg=Pg,kg=$y,Gg=Fg,jg=Vg,Xg=Ky,Yg=Ng.MutationObserver||Ng.WebKitMutationObserver,Wg=Ng.document,Hg=Ng.process,Zg=Ng.Promise,qg=zg(Ng,"queueMicrotask"),Qg=qg&&qg.value;if(!Qg){var Kg=new Bg,Jg=function(){var t,e;for(Xg&&(t=Hg.domain)&&t.exit();e=Kg.get();)try{e()}catch(t){throw Kg.head&&Og(),t}t&&t.enter()};kg||Xg||jg||!Yg||!Wg?!Gg&&Zg&&Zg.resolve?((Ig=Zg.resolve(void 0)).constructor=Zg,Lg=Dg(Ig.then,Ig),Og=function(){Lg(Jg)}):Xg?Og=function(){Hg.nextTick(Jg)}:(Ug=Dg(Ug,Ng),Og=function(){Ug(Jg)}):(wg=!0,Mg=Wg.createTextNode(""),new Yg(Jg).observe(Mg,{characterData:!0}),Og=function(){Mg.data=wg=!wg}),Qg=function(t){Kg.head||Og(),Kg.add(t)}}var $g=Qg,tx=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},ex=a.Promise,rx="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,ix=!rx&&!Ky&&"object"==typeof window&&"object"==typeof document,nx=a,ox=ex,ax=Y,sx=qi,ux=lr,cx=ne,lx=ix,hx=rx,fx=at;ox&&ox.prototype;var px=cx("species"),dx=!1,mx=ax(nx.PromiseRejectionEvent),vx=sx("Promise",(function(){var t=ux(ox),e=t!==String(ox);if(!e&&66===fx)return!0;if(!fx||fx<51||!/native code/.test(t)){var r=new ox((function(t){t(1)})),i=function(t){t((function(){}),(function(){}))};if((r.constructor={})[px]=i,!(dx=r.then((function(){}))instanceof i))return!0}return!e&&(lx||hx)&&!mx})),yx={CONSTRUCTOR:vx,REJECTION_EVENT:mx,SUBCLASSING:dx},gx={},xx=At,Tx=TypeError,Ex=function(t){var e,r;this.promise=new t((function(t,i){if(void 0!==e||void 0!==r)throw Tx("Bad Promise constructor");e=t,r=i})),this.resolve=xx(e),this.reject=xx(r)};gx.f=function(t){return new Ex(t)};var Ax,bx,Sx,_x=nn,Rx=Ky,Cx=a,Ox=p,wx=ti,Mx=ko,Ix=fs,Lx=Kc,Px=At,Fx=Y,Vx=Z,Nx=Va,Dx=kf,zx=Rg.set,Ux=$g,Bx=function(t,e){try{1===arguments.length?console.error(t):console.error(t,e)}catch(t){}},kx=tx,Gx=Pg,jx=Lr,Xx=ex,Yx=gx,Wx="Promise",Hx=yx.CONSTRUCTOR,Zx=yx.REJECTION_EVENT,qx=yx.SUBCLASSING,Qx=jx.getterFor(Wx),Kx=jx.set,Jx=Xx&&Xx.prototype,$x=Xx,tT=Jx,eT=Cx.TypeError,rT=Cx.document,iT=Cx.process,nT=Yx.f,oT=nT,aT=!!(rT&&rT.createEvent&&Cx.dispatchEvent),sT="unhandledrejection",uT=function(t){var e;return!(!Vx(t)||!Fx(e=t.then))&&e},cT=function(t,e){var r,i,n,o=e.value,a=1===e.state,s=a?t.ok:t.fail,u=t.resolve,c=t.reject,l=t.domain;try{s?(a||(2===e.rejection&&dT(e),e.rejection=1),!0===s?r=o:(l&&l.enter(),r=s(o),l&&(l.exit(),n=!0)),r===t.promise?c(eT("Promise-chain cycle")):(i=uT(r))?Ox(i,r,u,c):u(r)):c(o)}catch(t){l&&!n&&l.exit(),c(t)}},lT=function(t,e){t.notified||(t.notified=!0,Ux((function(){for(var r,i=t.reactions;r=i.get();)cT(r,t);t.notified=!1,e&&!t.rejection&&fT(t)})))},hT=function(t,e,r){var i,n;aT?((i=rT.createEvent("Event")).promise=e,i.reason=r,i.initEvent(t,!1,!0),Cx.dispatchEvent(i)):i={promise:e,reason:r},!Zx&&(n=Cx["on"+t])?n(i):t===sT&&Bx("Unhandled promise rejection",r)},fT=function(t){Ox(zx,Cx,(function(){var e,r=t.facade,i=t.value;if(pT(t)&&(e=kx((function(){Rx?iT.emit("unhandledRejection",i,r):hT(sT,r,i)})),t.rejection=Rx||pT(t)?2:1,e.error))throw e.value}))},pT=function(t){return 1!==t.rejection&&!t.parent},dT=function(t){Ox(zx,Cx,(function(){var e=t.facade;Rx?iT.emit("rejectionHandled",e):hT("rejectionhandled",e,t.value)}))},mT=function(t,e,r){return function(i){t(e,i,r)}},vT=function(t,e,r){t.done||(t.done=!0,r&&(t=r),t.value=e,t.state=2,lT(t,!0))},yT=function(t,e,r){if(!t.done){t.done=!0,r&&(t=r);try{if(t.facade===e)throw eT("Promise can't be resolved itself");var i=uT(e);i?Ux((function(){var r={done:!1};try{Ox(i,e,mT(yT,r,t),mT(vT,r,t))}catch(e){vT(r,e,t)}})):(t.value=e,t.state=1,lT(t,!1))}catch(e){vT({done:!1},e,t)}}};if(Hx&&(tT=($x=function(t){Nx(this,tT),Px(t),Ox(Ax,this);var e=Qx(this);try{t(mT(yT,e),mT(vT,e))}catch(t){vT(e,t)}}).prototype,(Ax=function(t){Kx(this,{type:Wx,done:!1,notified:!1,parent:!1,reactions:new Gx,rejection:!1,state:0,value:void 0})}).prototype=wx(tT,"then",(function(t,e){var r=Qx(this),i=nT(Dx(this,$x));return r.parent=!0,i.ok=!Fx(t)||t,i.fail=Fx(e)&&e,i.domain=Rx?iT.domain:void 0,0===r.state?r.reactions.add(i):Ux((function(){cT(i,r)})),i.promise})),bx=function(){var t=new Ax,e=Qx(t);this.promise=t,this.resolve=mT(yT,e),this.reject=mT(vT,e)},Yx.f=nT=function(t){return t===$x||undefined===t?new bx(t):oT(t)},Fx(Xx)&&Jx!==Object.prototype)){Sx=Jx.then,qx||wx(Jx,"then",(function(t,e){var r=this;return new $x((function(t,e){Ox(Sx,r,t,e)})).then(t,e)}),{unsafe:!0});try{delete Jx.constructor}catch(t){}Mx&&Mx(Jx,tT)}_x({global:!0,constructor:!0,wrap:!0,forced:Hx},{Promise:$x}),Ix($x,Wx,!1),Lx(Wx);var gT=ex,xT=yx.CONSTRUCTOR||!vo((function(t){gT.all(t).then(void 0,(function(){}))})),TT=p,ET=At,AT=gx,bT=tx,ST=my;nn({target:"Promise",stat:!0,forced:xT},{all:function(t){var e=this,r=AT.f(e),i=r.resolve,n=r.reject,o=bT((function(){var r=ET(e.resolve),o=[],a=0,s=1;ST(t,(function(t){var u=a++,c=!1;s++,TT(r,e,t).then((function(t){c||(c=!0,o[u]=t,--s||i(o))}),n)})),--s||i(o)}));return o.error&&n(o.value),r.promise}});var _T=nn,RT=yx.CONSTRUCTOR,CT=ex,OT=K,wT=Y,MT=ti,IT=CT&&CT.prototype;if(_T({target:"Promise",proto:!0,forced:RT,real:!0},{catch:function(t){return this.then(void 0,t)}}),wT(CT)){var LT=OT("Promise").prototype.catch;IT.catch!==LT&&MT(IT,"catch",LT,{unsafe:!0})}var PT=p,FT=At,VT=gx,NT=tx,DT=my;nn({target:"Promise",stat:!0,forced:xT},{race:function(t){var e=this,r=VT.f(e),i=r.reject,n=NT((function(){var n=FT(e.resolve);DT(t,(function(t){PT(n,e,t).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var zT=p,UT=gx;nn({target:"Promise",stat:!0,forced:yx.CONSTRUCTOR},{reject:function(t){var e=UT.f(this);return zT(e.reject,void 0,t),e.promise}});var BT=Ne,kT=Z,GT=gx,jT=nn,XT=yx.CONSTRUCTOR,YT=function(t,e){if(BT(t),kT(e)&&e.constructor===t)return e;var r=GT.f(t);return(0,r.resolve)(e),r.promise};K("Promise"),jT({target:"Promise",stat:!0,forced:XT},{resolve:function(t){return YT(this,t)}});var WT,HT,ZT=a,qT=Nt,QT=Y,KT=qn,JT=ti,$T="USE_FUNCTION_CONSTRUCTOR",tE=ne("asyncIterator"),eE=ZT.AsyncIterator,rE=qT.AsyncIteratorPrototype;if(rE)WT=rE;else if(QT(eE))WT=eE.prototype;else if(qT[$T]||ZT[$T])try{HT=KT(KT(KT(Function("return async function*(){}()")()))),KT(HT)===Object.prototype&&(WT=HT)}catch(t){}WT||(WT={}),QT(WT[tE])||JT(WT,tE,(function(){return this}));var iE=p,nE=Ne,oE=Mn,aE=_t,sE=La,uE=Lr,cE=WT,lE=tf,hE=K("Promise"),fE="AsyncFromSyncIterator",pE=uE.set,dE=uE.getterFor(fE),mE=function(t,e,r){var i=t.done;hE.resolve(t.value).then((function(t){e(lE(t,i))}),r)},vE=function(t){t.type=fE,pE(this,t)};vE.prototype=sE(oE(cE),{next:function(){var t=dE(this);return new hE((function(e,r){var i=nE(iE(t.next,t.iterator));mE(i,e,r)}))},return:function(){var t=dE(this).iterator;return new hE((function(e,r){var i=aE(t,"return");if(void 0===i)return e(lE(void 0,!0));var n=nE(iE(i,t));mE(n,e,r)}))}});var yE=vE,gE=function(t){return{iterator:t,next:t.next,done:!1}},xE=p,TE=yE,EE=Ne,AE=lc,bE=gE,SE=_t,_E=ne("asyncIterator"),RE=a,CE=TypeError,OE=p,wE=K,ME=_t,IE=p,LE=At,PE=Ne,FE=Z,VE=function(t){if(t>9007199254740991)throw CE("Maximum allowed index exceeded");return t},NE=K,DE=gE,zE=function(t,e,r,i){try{var n=ME(t,"return");if(n)return wE("Promise").resolve(OE(n,t)).then((function(){e(r)}),(function(t){i(t)}))}catch(t){return i(t)}e(r)},UE=function(t){var e=0===t,r=1===t,i=2===t,n=3===t;return function(t,o,a){PE(t);var s=void 0!==o;!s&&e||LE(o);var u=DE(t),c=NE("Promise"),l=u.iterator,h=u.next,f=0;return new c((function(t,u){var p=function(t){zE(l,u,t,u)},d=function(){try{if(s)try{VE(f)}catch(t){p(t)}c.resolve(PE(IE(h,l))).then((function(h){try{if(PE(h).done)e?(a.length=f,t(a)):t(!n&&(i||void 0));else{var m=h.value;try{if(s){var v=o(m,f),y=function(o){if(r)d();else if(i)o?d():zE(l,t,!1,u);else if(e)try{a[f++]=o,d()}catch(t){p(t)}else o?zE(l,t,n||m,u):d()};FE(v)?c.resolve(v).then(y,p):y(v)}else a[f++]=m,d()}catch(t){p(t)}}}catch(t){u(t)}}),u)}catch(t){u(t)}};d()}))}},BE={toArray:UE(0),forEach:UE(1),every:UE(2),some:UE(3),find:UE(4)},kE=Lu,GE=_,jE=Bt,XE=Wu,YE=function(t,e){var r=arguments.length<2?SE(t,_E):e;return r?EE(xE(r,t)):new TE(bE(AE(t)))},WE=lc,HE=gE,ZE=ic,qE=_t,QE=function(t){return RE[t].prototype},KE=K,JE=yE,$E=BE.toArray,tA=ne("asyncIterator"),eA=GE(QE("Array").values),rA=GE(eA([]).next),iA=function(){return new nA(this)},nA=function(t){this.iterator=eA(t)};nA.prototype.next=function(){return rA(this.iterator)};var oA=K,aA=Qu,sA=function(t){var e=this,r=arguments.length,i=r>1?arguments[1]:void 0,n=r>2?arguments[2]:void 0;return new(KE("Promise"))((function(r){var o=jE(t);void 0!==i&&(i=kE(i,n));var a=qE(o,tA),s=a?void 0:ZE(o)||iA,u=XE(e)?new e:[],c=a?YE(o,a):new JE(HE(WE(o,s)));r($E(c,i,u))}))},uA=Nf,cA=ba.aTypedArrayConstructor;(0,ba.exportTypedArrayStaticMethod)("fromAsync",(function(t){var e=this,r=arguments.length,i=r>1?arguments[1]:void 0,n=r>2?arguments[2]:void 0;return new(oA("Promise"))((function(r){aA(e),r(sA(t,i,n))})).then((function(t){return uA(cA(e),t)}))}),!0);var lA=Wc.filterReject,hA=Zf,fA=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("filterOut",(function(t){var e=lA(fA(this),t,arguments.length>1?arguments[1]:void 0);return hA(this,e)}),!0);var pA=Wc.filterReject,dA=Zf,mA=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("filterReject",(function(t){var e=pA(mA(this),t,arguments.length>1?arguments[1]:void 0);return dA(this,e)}),!0);var vA=Lu,yA=F,gA=Bt,xA=me,TA=mi,EA=Mn,AA=Nf,bA=Array,SA=_([].push),_A=function(t,e,r,i){for(var n,o,a,s=gA(t),u=yA(s),c=vA(e,r),l=EA(null),h=TA(u),f=0;h>f;f++)a=u[f],(o=xA(c(a,f,s)))in l?SA(l[o],a):l[o]=[a];if(i&&(n=i(s))!==bA)for(o in l)l[o]=AA(n,l[o]);return l},RA=Yf,CA=ba.aTypedArray;(0,ba.exportTypedArrayMethod)("groupBy",(function(t){var e=arguments.length>1?arguments[1]:void 0;return _A(CA(this),t,e,RA)}),!0);var OA=_,wA=Map.prototype,MA={Map:Map,set:OA(wA.set),get:OA(wA.get),has:OA(wA.has),remove:OA(wA.delete),proto:wA},IA=p,LA=_,PA=function(t,e,r){for(var i,n,o=r?t:t.iterator,a=t.next;!(i=IA(a,o)).done;)if(void 0!==(n=e(i.value)))return n},FA=MA.Map,VA=MA.proto,NA=LA(VA.forEach),DA=LA(VA.entries),zA=DA(new FA).next,UA=At,BA=V,kA=mi,GA=Bt,jA=function(t,e,r){return r?PA({iterator:DA(t),next:zA},(function(t){return e(t[1],t[0])})):NA(t,e)},XA=MA.Map,YA=MA.has,WA=MA.set,HA=_([].push),ZA=Nf,qA=function(t){var e,r,i,n=GA(this),o=kA(n),a=[],s=new XA,u=BA(t)?function(t){return t}:UA(t);for(e=0;e<o;e++)i=u(r=n[e]),YA(s,i)||WA(s,i,r);return jA(s,(function(t){HA(a,t)})),a},QA=ba.aTypedArray,KA=ba.getTypedArrayConstructor,JA=ba.exportTypedArrayMethod,$A=_(qA);JA("uniqueBy",(function(t){return QA(this),ZA(KA(this),$A(this,t))}),!0);var tb=function(t,e){return tb=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])},tb(t,e)};function eb(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}tb(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var rb=function(){return rb=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},rb.apply(this,arguments)};function ib(t,e,r,i){return new(r||(r=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(t){o(t)}}function s(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){t.done?n(t.value):function(t){return t instanceof r?t:new r((function(e){e(t)}))}(t.value).then(a,s)}u((i=i.apply(t,e||[])).next())}))}function nb(t,e){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,s[0]&&(a=0)),a;)try{if(r=1,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){a.label=s[1];break}if(6===s[0]&&a.label<n[1]){a.label=n[1],n=s;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(s);break}n[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function ob(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 ab(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function sb(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 ub=6,cb="PRE_COLOR_0",lb="PRE_COLOR_SIZE_0",hb="PRE_MAIN_COLOR_0",fb="PRE_MAIN_COLOR_SIZE_0",pb="editor",db="none",mb={"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"};var vb=[],yb={};function gb(){"function"==typeof WebGL2RenderingContext?xb(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(xb(WebGLRenderingContext),xb(WebGLRenderingContext.prototype)):vb.push("iOS16 lockdown mode, WebGL Constants not in global"),vb.length||"HALF_FLOAT"in yb||(yb.HALF_FLOAT=5131)}function xb(t){for(var e in t)/^[A-Z_]/.test(e)&&(yb[e]=t[e])}vb.length||gb();var Tb,Eb,Ab,bb,Sb,_b,Rb,Cb,Ob,wb,Mb,Ib,Lb={},Pb={};function Fb(t,e,r){t in Lb&&console.error("Filter ".concat(t," registered twice.")),Lb[t]=e,Pb[t]=r}function Vb(t){Object.keys(t).forEach((function(e){var r=ab(t[e],2);Fb(e,r[0],r[1])}))}function Nb(t){var e=Pb[t.name];if(!e)throw Error("Filter ".concat(t.name," not imported, see ").concat(mb["Filter not imported"]));return e(t)}function Db(t,e){var r=Lb[t.name];if(!r)throw Error("Filter ".concat(t.name," not imported, see ").concat(mb["Filter not imported"]));var i=r(t,e);return i.passSplitOptions||(i.passSplitOptions={attachments:[{texture:{format:yb.RGBA}}]}),i}function zb(t,e){return t.includes(e)||t.push(e),t}function Ub(t,e){var r=t.indexOf(e);return r>-1&&t.splice(r,1),t}function Bb(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 kb(t,e,r,i){if(void 0===r&&(r=1),t.buffer.byteLength<t.BYTES_PER_ELEMENT*e){var n=Math.ceil(e*r);isNaN(i)||(n=Math.min(n,i));var o=new ArrayBuffer(t.BYTES_PER_ELEMENT*n),a=new t.constructor(o);return a.set(t),a}return t}function Gb(t,e){var r=[0,0,0,0];if(V_(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 jb(t,e,r){if(t.length){for(var i=void 0,n=1;n<=t.length-1;n++){var o=t[n-1],a=t[n];if(o.stop<=e&&e<=a.stop){i=Yb(o.color,a.color,(e-o.stop)/(a.stop-o.stop));break}}return i||(i=t[t.length-1].color),r?i.map((function(t){return t/255})):i}return[0,0,0,0]}function Xb(t){var e=[];if(t instanceof Array?t.forEach((function(t){var r=ab(t,5),i=r[0],n=r[1],o=r[2],a=r[3],s=r[4];e.push({stop:Wb(i),color:[n,o,a,s]})})):Object.keys(t).forEach((function(r){var i=Gb(t[r]);e.push({stop:Wb(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 Yb(t,e,r,i){var n=[],o=1-r;if(i)for(var a=0;a<4;a++)n[a]=t[a]*o+e[a]*r;else{for(a=0;a<3;a++)n[a]=Math.round(Math.sqrt(t[a]*t[a]*o+e[a]*e[a]*r));n[3]=Math.round(t[3]*o+e[3]*r)}return n}function Wb(t){var e=/^(-)?([\d+.]+)%$/.exec(t);return e?+e[2]/100*(e[1]?-1:1):+t}function Hb(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function Zb(){return Hb()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function qb(t){var e=128,r={width:e,height:1,data:new Uint8Array(512)},i=r.data,n=Xb(t);if(n.length){i.set(n[0].color,0);for(var o=1;o<127;o++){for(var a=o/e,s=void 0,u=void 0,c=0;c<n.length&&(s=n[c],u=n[c+1],!(s.stop<=a&&u.stop>a));c++);var l=Yb(s.color,u.color,(a-s.stop)/(u.stop-s.stop));i.set(l,4*o)}i.set(n[n.length-1].color,508)}return r}function Qb(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++)Jb(e,n,r);return e}return $b(e,r)}function Kb(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&&Jb(e,e.length-1,i),e)}function Jb(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 $b(e,r,i,n){var o,a;if(void 0===i&&(i=0),void 0===n&&(n=e.length-1),i>=n)return e;for(var s=e[i],u=i,c=n;u<c;){if(r===t.OrderType.ascending){for(;e[c].priority>s.priority&&c>=u;)c--;for(;e[u].priority<=s.priority&&u<c;)u++}else{for(;e[c].priority<s.priority&&c>=u;)c--;for(;e[u].priority>=s.priority&&u<c;)u++}o=ab([e[c],e[u]],2),e[u]=o[0],e[c]=o[1]}return a=ab([e[u],e[i]],2),e[i]=a[0],e[u]=a[1],$b(e,r,i,u-1),$b(e,r,c+1,n),e}function tS(t,e){if(void 0===e&&(e="item doesn't exist"),null==t)throw new Error(e)}t.OrderType=void 0,(Tb=t.OrderType||(t.OrderType={}))[Tb.none=1]="none",Tb[Tb.ascending=2]="ascending",Tb[Tb.descending=3]="descending",function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(Eb||(Eb={})),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"}(Ab||(Ab={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(bb||(bb={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(Sb||(Sb={})),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"}(_b||(_b={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(Rb||(Rb={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(Cb||(Cb={})),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"}(Ob||(Ob={})),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"}(wb||(wb={})),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"}(Mb||(Mb={})),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"}(Ib||(Ib={}));var eS,rS,iS,nS,oS,aS,sS,uS;!function(t){t[t.portrait=1]="portrait",t[t.landscape=0]="landscape"}(eS||(eS={})),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"}(rS||(rS={})),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"}(iS||(iS={})),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"}(nS||(nS={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(oS||(oS={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(aS||(aS={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(sS||(sS={})),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"}(uS||(uS={}));var cS,lS,hS,fS,pS,dS,mS,vS,yS;!function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(cS||(cS={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(lS||(lS={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(hS||(hS={})),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"}(fS||(fS={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(pS||(pS={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(dS||(dS={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(mS||(mS={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(vS||(vS={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(yS||(yS={}));var gS=Object.freeze({__proto__:null,get BezierKeyframeType(){return nS},get BlendingMode(){return Ab},BloomFilterThresholdAvgColor:0,CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return eS},get CompositionEndBehavior(){return rS},END_BEHAVIOR_DESTROY:0,END_BEHAVIOR_DESTROY_CHILDREN:6,END_BEHAVIOR_FORWARD:2,END_BEHAVIOR_FREEZE:4,END_BEHAVIOR_PAUSE:1,END_BEHAVIOR_PAUSE_AND_DESTROY:3,END_BEHAVIOR_RESTART:5,get FontStyle(){return yS},get InteractBehavior(){return Ob},get InteractType(){return Cb},get ItemEndBehavior(){return oS},get ItemType(){return wb},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return Sb},get MaterialBlending(){return hS},get MaterialType(){return lS},get ModelBoundingType(){return cS},get ParentItemEndBehavior(){return aS},get ParticleInteractionBehavior(){return sS},get ParticleOrigin(){return Ib},get PluginType(){return Rb},get RenderLevel(){return Eb},get RenderMode(){return Mb},get RenderMode3D(){return fS},get ShapeArcMode(){return uS},get ShapeType(){return _b},get SideMode(){return bb},get TextAlignment(){return mS},get TextBaseline(){return dS},get TextOverflow(){return pS},get TextWeight(){return vS},get ValueType(){return iS}}),xS=2*Math.PI,TS=Math.PI/180,ES=180/Math.PI,AS=1e-6;function bS(t,e){return Math.abs(t-e)<AS||t===1/0&&e===1/0||t===-1/0&&e===-1/0}var SS=function(t,e,r){return(1-r)*t+r*e};function _S(t,e,r){var i=isNaN(e)?-1/0:e,n=isNaN(r)?1/0:r,o=Math.min(i,n),a=Math.max(i,n);return Math.min(Math.max(t,o),a)}var RS,CS=function(){function t(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e}return t.prototype.set=function(t,e){return this.x=t,this.y=e,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this},t.prototype.setFromArray=function(t,e){var r,i;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:console.error("index is out of range: "+t)}return this},t.prototype.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;default:console.error("index is out of range: "+t)}return 0},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t):t instanceof Array?(this.x+=t[0],this.y+=t[1]):(this.x+=t.x,this.y+=t.y),this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t):t instanceof Array?(this.x-=t[0],this.y-=t[1]):(this.x-=t.x,this.y-=t.y),this},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t):t instanceof Array?(this.x*=t[0],this.y*=t[1]):(this.x*=t.x,this.y*=t.y),this},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t):t instanceof Array?(this.x/=t[0],this.y/=t[1]):(this.x/=t.x,this.y/=t.y),this},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this},t.prototype.sum=function(){return this.x+this.y},t.prototype.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y)),this},t.prototype.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y)),this},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this},t.prototype.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y},t.prototype.cross=function(t){return this.x*t.y-this.y*t.x},t.prototype.distance=function(t){var e=this.x-t.x,r=this.y-t.y;return Math.sqrt(e*e+r*r)},t.prototype.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y;return e*e+r*r},t.prototype.equals=function(t){return this.x===t.x&&this.y===t.y},t.prototype.isZero=function(){var t=AS,e=(this,this.x),r=this.y;return Math.abs(e)<=t&&Math.abs(r)<=t},t.prototype.toArray=function(){return[this.x,this.y]},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.ONE=new t(1,1),t.ZERO=new t(0,0),t}(),OS=function(){function t(t,e,r){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),this.x=t,this.y=e,this.z=r}return t.prototype.set=function(t,e,r){return this.x=t,this.y=e,this.z=r,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this},t.prototype.setFromArray=function(t,e){var r,i,n;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this.z=null!==(n=t[e+2])&&void 0!==n?n:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z)},t.prototype.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:console.error("index is out of range: "+t)}return this},t.prototype.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:console.error("index is out of range: "+t)}return 0},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t):t instanceof Array?(this.x+=t[0],this.y+=t[1],this.z+=t[2]):(this.x+=t.x,this.y+=t.y,this.z+=t.z),this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this},t.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t):t instanceof Array?(this.x-=t[0],this.y-=t[1],this.z-=t[2]):(this.x-=t.x,this.y-=t.y,this.z-=t.z),this},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t):t instanceof Array?(this.x*=t[0],this.y*=t[1],this.z*=t[2]):(this.x*=t.x,this.y*=t.y,this.z*=t.z),this},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t):t instanceof Array?(this.x/=t[0],this.y/=t[1],this.z/=t[2]):(this.x/=t.x,this.y/=t.y,this.z/=t.z),this},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this},t.prototype.sum=function(){return this.x+this.y+this.z},t.prototype.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z)),this},t.prototype.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z)),this},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this},t.prototype.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},t.prototype.cross=function(t){return this.crossVectors(this,t)},t.prototype.crossVectors=function(t,e){var r=t.x,i=t.y,n=t.z,o=e.x,a=e.y,s=e.z;return this.x=i*s-n*a,this.y=n*o-r*s,this.z=r*a-i*o,this},t.prototype.reflect=function(t){return this.subtract(t.clone().multiply(2*this.dot(t)))},t.prototype.distance=function(t){return Math.sqrt(this.distanceSquared(t))},t.prototype.distanceSquared=function(t){var e=this.x-t.x,r=this.y-t.y,i=this.z-t.z;return e*e+r*r+i*i},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},t.prototype.isZero=function(){var t,e=AS,r=(t=this).x,i=t.y,n=t.z;return Math.abs(r)<=e&&Math.abs(i)<=e&&Math.abs(n)<=e},t.prototype.toArray=function(){return[this.x,this.y,this.z]},t.prototype.toVector2=function(){return new CS(this.x,this.y)},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this},t.prototype.applyEuler=function(t,e){return t.rotateVector3(this,e)},t.prototype.applyQuaternion=function(t,e){return t.rotateVector3(this,e)},t.prototype.applyMatrix=function(t,e){return t.transformPoint(this,e)},t.prototype.applyNormalMatrix=function(t,e){return t.transformNormal(this,e)},t.prototype.applyProjectionMatrix=function(t,e){return t.projectPoint(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.X=new t(1,0,0),t.Y=new t(0,1,0),t.Z=new t(0,0,1),t.ONE=new t(1,1,1),t.ZERO=new t(0,0,0),t}(),wS=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),this.x=t,this.y=e,this.z=r,this.w=i}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.setFromEuler=function(t){return t.toQuaternion(this),this},t.prototype.setFromAxisAngle=function(e,r){var i=r/2,n=Math.sin(i),o=t.tempVec0;return o.copyFrom(e).normalize(),this.x=o.x*n,this.y=o.y*n,this.z=o.z*n,this.w=Math.cos(i),this},t.prototype.setFromArray=function(t,e){return void 0===e&&(e=0),this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this},t.prototype.setFromRotationMatrix=function(t){var e=t.elements,r=e[0],i=e[4],n=e[8],o=e[1],a=e[5],s=e[9],u=e[2],c=e[6],l=e[10],h=r+a+l;if(h>0){var f=.5/Math.sqrt(h+1);this.w=.25/f,this.x=(c-s)*f,this.y=(n-u)*f,this.z=(o-i)*f}else if(r>a&&r>l){f=2*Math.sqrt(1+r-a-l);this.w=(c-s)/f,this.x=.25*f,this.y=(i+o)/f,this.z=(n+u)/f,this.negate()}else if(a>l){f=2*Math.sqrt(1+a-r-l);this.w=(n-u)/f,this.x=(i+o)/f,this.y=.25*f,this.z=(s+c)/f,this.negate()}else{f=2*Math.sqrt(1+l-r-a);this.w=(o-i)/f,this.x=(n+u)/f,this.y=(s+c)/f,this.z=.25*f,this.negate()}return this},t.prototype.setFromUnitVectors=function(t,e){var r=t.dot(e)+1;return r<Number.EPSILON?(r=0,Math.abs(t.x)>Math.abs(t.z)?(this.x=-t.y,this.y=t.x,this.z=0,this.w=r):(this.x=0,this.y=-t.z,this.z=t.y,this.w=r)):(this.x=t.y*e.z-t.z*e.y,this.y=t.z*e.x-t.x*e.z,this.z=t.x*e.y-t.y*e.x,this.w=r),this.normalize()},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.angleTo=function(t){return 2*Math.acos(Math.abs(_S(this.dot(t),-1,1)))},t.prototype.rotateTowards=function(t,e){var r=this.angleTo(t);if(0===r)return this;var i=Math.min(1,e/r);return this.slerp(t,i),this},t.prototype.identity=function(){return this.set(0,0,0,1)},t.prototype.invert=function(){return this.conjugate()},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},t.prototype.conjugate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.normalize=function(){var t=this.length();return 0===t?(this.x=0,this.y=0,this.z=0,this.w=1):(t=1/t,this.x=this.x*t,this.y=this.y*t,this.z=this.z*t,this.w=this.w*t),this},t.prototype.multiply=function(t){return this.multiplyQuaternions(this,t)},t.prototype.premultiply=function(t){return this.multiplyQuaternions(t,this)},t.prototype.multiplyQuaternions=function(t,e){var r=t.x,i=t.y,n=t.z,o=t.w,a=e.x,s=e.y,u=e.z,c=e.w;return this.x=r*c+o*a+i*u-n*s,this.y=i*c+o*s+n*a-r*u,this.z=n*c+o*u+r*s-i*a,this.w=o*c-r*a-i*s-n*u,this},t.prototype.slerp=function(t,e){var r;if(0===e)return this;if(1===e)return this.copyFrom(t);var i=(r=this).x,n=r.y,o=r.z,a=r.w,s=a*t.w+i*t.x+n*t.y+o*t.z;if(s<0?(this.w=-t.w,this.x=-t.x,this.y=-t.y,this.z=-t.z,s=-s):this.copyFrom(t),s>=1)return this.w=a,this.x=i,this.y=n,this.z=o,this;var u=1-s*s;if(u<=Number.EPSILON){var c=1-e;return this.w=c*a+e*this.w,this.x=c*i+e*this.x,this.y=c*n+e*this.y,this.z=c*o+e*this.z,this.normalize(),this}var l=Math.sqrt(u),h=Math.atan2(l,s),f=Math.sin((1-e)*h)/l,p=Math.sin(e*h)/l;return this.w=a*f+this.w*p,this.x=i*f+this.x*p,this.y=n*f+this.y*p,this.z=o*f+this.z*p,this},t.prototype.slerpQuaternions=function(t,e,r){this.copyFrom(t).slerp(e,r)},t.prototype.rotateVector3=function(t,e){var r,i=(r=this).x,n=r.y,o=r.z,a=r.w,s=t.x,u=t.y,c=t.z,l=a*s+n*c-o*u,h=a*u+o*s-i*c,f=a*c+i*u-n*s,p=-i*s-n*u-o*c,d=null!=e?e:t;return d.x=l*a+p*-i+h*-o-f*-n,d.y=h*a+p*-n+f*-i-l*-o,d.z=f*a+p*-o+l*-n-h*-i,d},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},t.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]},t.prototype.toVector4=function(t){return t.set(this.x,this.y,this.z,this.w)},t.prototype.toEuler=function(t){return t.setFromQuaternion(this)},t.prototype.toMatrix4=function(t){return t.compose(OS.ZERO,this,OS.ONE)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromAxisAngle=function(e,r){return(new t).setFromAxisAngle(e,r)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromRotationMatrix=function(e){return(new t).setFromRotationMatrix(e)},t.fromUnitVectors=function(e,r){return(new t).setFromUnitVectors(e,r)},t.tempVec0=new OS,t}(),MS=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a},IS=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},LS=function(){function t(t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=1),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),void 0===c&&(c=0),void 0===l&&(l=1),void 0===h&&(h=0),void 0===f&&(f=0),void 0===p&&(p=0),void 0===d&&(d=0),void 0===m&&(m=1),this.elements=[t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m]}return t.prototype.set=function(t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m){var v=this.elements;return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=n,v[5]=o,v[6]=a,v[7]=s,v[8]=u,v[9]=c,v[10]=l,v[11]=h,v[12]=f,v[13]=p,v[14]=d,v[15]=m,this},t.prototype.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u,c,l,h,f,p,d,m){var v=this.elements;return v[0]=t,v[4]=e,v[8]=r,v[12]=i,v[1]=n,v[5]=o,v[9]=a,v[13]=s,v[2]=u,v[6]=c,v[10]=l,v[14]=h,v[3]=f,v[7]=p,v[11]=d,v[15]=m,this},t.prototype.setFromColumnVectors=function(t,e,r,i){return this.set(t.x,t.y,t.z,t.w,e.x,e.y,e.z,e.w,r.x,r.y,r.z,r.w,i.x,i.y,i.z,i.w)},t.prototype.setFromMatrix3=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],0,e[3],e[4],e[5],0,e[6],e[7],e[8],0,0,0,0,1),this},t.prototype.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<16;r++)this.elements[r]=t[e+r];return this},t.prototype.setFromScale=function(t,e,r){return this.set(t,0,0,0,0,e,0,0,0,0,r,0,0,0,0,1)},t.prototype.setFromTranslation=function(t,e,r){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,t,e,r,1)},t.prototype.setFromRotationX=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(1,0,0,0,0,e,r,0,0,-r,e,0,0,0,0,1)},t.prototype.setFromRotationY=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,0,-r,0,0,1,0,0,r,0,e,0,0,0,0,1)},t.prototype.setFromRotationZ=function(t){var e=Math.cos(t),r=Math.sin(t);return this.set(e,r,0,0,-r,e,0,0,0,0,1,0,0,0,0,1)},t.prototype.setFromRotationAxis=function(e,r){var i=t.tempVec0;i.copyFrom(e).normalize();var n=Math.cos(r),o=Math.sin(r),a=1-n,s=i.x,u=i.y,c=i.z,l=a*s,h=a*u;return this.set(l*s+n,l*u+o*c,l*c-o*u,0,l*u-o*c,h*u+n,h*c+o*s,0,l*c+o*u,h*c-o*s,a*c*c+n,0,0,0,0,1)},t.prototype.setFromEuler=function(t){return t.toMatrix4(this),this},t.prototype.setFromQuaternion=function(t){return this.compose(OS.ZERO,t,OS.ONE)},t.prototype.setFromShear=function(t,e,r){return this.set(1,t,t,0,e,1,e,0,r,r,1,0,0,0,0,1)},t.prototype.setFromBasis=function(t,e,r){return this.set(t.x,t.y,t.z,0,e.x,e.y,e.z,0,r.x,r.y,r.z,0,0,0,0,1)},t.prototype.setZero=function(){for(var t=0;t<16;t++)this.elements[t]=0;return this},t.prototype.identity=function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.prototype.isIdentity=function(){var t=this.elements;return 1===t[0]&&0===t[4]&&0===t[8]&&0===t[12]&&0===t[1]&&1===t[5]&&0===t[9]&&0===t[13]&&0===t[2]&&0===t[6]&&1===t[10]&&0===t[14]&&0===t[3]&&0===t[7]&&0===t[11]&&1===t[15]},t.prototype.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])},t.prototype.copyFrom=function(t){return this.elements=IS([],MS(t.elements),!1),this},t.prototype.getColumnVector=function(t,e){return e.set(this.elements[4*t],this.elements[4*t+1],this.elements[4*t+2],this.elements[4*t+3])},t.prototype.lookAt=function(e,r,i){var n=t.tempVec0,o=t.tempVec1,a=t.tempVec2;a.subtractVectors(r,e),a.normalize(),o.copyFrom(i),o.normalize(),n.crossVectors(o,a),n.normalize(),o.crossVectors(a,n);var s=this.elements;return s[0]=n.x,s[1]=o.x,s[2]=a.x,s[3]=0,s[4]=n.y,s[5]=o.y,s[6]=a.y,s[7]=0,s[8]=n.z,s[9]=o.z,s[10]=a.z,s[11]=0,s[12]=-n.dot(e),s[13]=-o.dot(e),s[14]=-a.dot(e),s[15]=1,this},t.prototype.addScaledMatrix=function(t,e){for(var r=this.elements,i=t.elements,n=0;n<16;n++)r[n]+=i[n]*e;return this},t.prototype.multiply=function(t){if("number"==typeof t){for(var e=0;e<16;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},t.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},t.prototype.multiplyMatrices=function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[4],s=r[8],u=r[12],c=r[1],l=r[5],h=r[9],f=r[13],p=r[2],d=r[6],m=r[10],v=r[14],y=r[3],g=r[7],x=r[11],T=r[15],E=i[0],A=i[4],b=i[8],S=i[12],_=i[1],R=i[5],C=i[9],O=i[13],w=i[2],M=i[6],I=i[10],L=i[14],P=i[3],F=i[7],V=i[11],N=i[15];return n[0]=o*E+a*_+s*w+u*P,n[4]=o*A+a*R+s*M+u*F,n[8]=o*b+a*C+s*I+u*V,n[12]=o*S+a*O+s*L+u*N,n[1]=c*E+l*_+h*w+f*P,n[5]=c*A+l*R+h*M+f*F,n[9]=c*b+l*C+h*I+f*V,n[13]=c*S+l*O+h*L+f*N,n[2]=p*E+d*_+m*w+v*P,n[6]=p*A+d*R+m*M+v*F,n[10]=p*b+d*C+m*I+v*V,n[14]=p*S+d*O+m*L+v*N,n[3]=y*E+g*_+x*w+T*P,n[7]=y*A+g*R+x*M+T*F,n[11]=y*b+g*C+x*I+T*V,n[15]=y*S+g*O+x*L+T*N,this},t.prototype.multiplyScalar=function(t){var e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this},t.prototype.determinant=function(){var t=this.elements,e=t[0],r=t[4],i=t[8],n=t[12],o=t[1],a=t[5],s=t[9],u=t[13],c=t[2],l=t[6],h=t[10],f=t[14];return t[3]*(+n*s*l-i*u*l-n*a*h+r*u*h+i*a*f-r*s*f)+t[7]*(+e*s*f-e*u*h+n*o*h-i*o*f+i*u*c-n*s*c)+t[11]*(+e*u*l-e*a*f-n*o*l+r*o*f+n*a*c-r*u*c)+t[15]*(-i*a*c-e*s*l+e*a*h+i*o*l-r*o*h+r*s*c)},t.prototype.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},t.prototype.invert=function(){var t=this.elements,e=t[0],r=t[1],i=t[2],n=t[3],o=t[4],a=t[5],s=t[6],u=t[7],c=t[8],l=t[9],h=t[10],f=t[11],p=t[12],d=t[13],m=t[14],v=t[15],y=l*m*u-d*h*u+d*s*f-a*m*f-l*s*v+a*h*v,g=p*h*u-c*m*u-p*s*f+o*m*f+c*s*v-o*h*v,x=c*d*u-p*l*u+p*a*f-o*d*f-c*a*v+o*l*v,T=p*l*s-c*d*s-p*a*h+o*d*h+c*a*m-o*l*m,E=e*y+r*g+i*x+n*T;if(0===E)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);var A=1/E;return t[0]=y*A,t[1]=(d*h*n-l*m*n-d*i*f+r*m*f+l*i*v-r*h*v)*A,t[2]=(a*m*n-d*s*n+d*i*u-r*m*u-a*i*v+r*s*v)*A,t[3]=(l*s*n-a*h*n-l*i*u+r*h*u+a*i*f-r*s*f)*A,t[4]=g*A,t[5]=(c*m*n-p*h*n+p*i*f-e*m*f-c*i*v+e*h*v)*A,t[6]=(p*s*n-o*m*n-p*i*u+e*m*u+o*i*v-e*s*v)*A,t[7]=(o*h*n-c*s*n+c*i*u-e*h*u-o*i*f+e*s*f)*A,t[8]=x*A,t[9]=(p*l*n-c*d*n-p*r*f+e*d*f+c*r*v-e*l*v)*A,t[10]=(o*d*n-p*a*n+p*r*u-e*d*u-o*r*v+e*a*v)*A,t[11]=(c*a*n-o*l*n-c*r*u+e*l*u+o*r*f-e*a*f)*A,t[12]=T*A,t[13]=(c*d*i-p*l*i+p*r*h-e*d*h-c*r*m+e*l*m)*A,t[14]=(p*a*i-o*d*i-p*r*s+e*d*s+o*r*m-e*a*m)*A,t[15]=(o*l*i-c*a*i+c*r*s-e*l*s-o*r*h+e*a*h)*A,this},t.prototype.extractBasis=function(t,e,r){var i=this.elements;return t.set(i[0],i[1],i[2]),e.set(i[4],i[5],i[6]),r.set(i[8],i[9],i[10]),this},t.prototype.compose=function(t,e,r,i){void 0===i&&(i=OS.ZERO);var n=this.elements,o=e.x,a=e.y,s=e.z,u=e.w,c=-i.x,l=-i.y,h=-i.z,f=o+o,p=a+a,d=s+s,m=o*f,v=o*p,y=o*d,g=a*p,x=a*d,T=s*d,E=u*f,A=u*p,b=u*d,S=r.x,_=r.y,R=r.z;return n[0]=(1-(g+T))*S,n[1]=(v+b)*S,n[2]=(y-A)*S,n[3]=0,n[4]=(v-b)*_,n[5]=(1-(m+T))*_,n[6]=(x+E)*_,n[7]=0,n[8]=(y+A)*R,n[9]=(x-E)*R,n[10]=(1-(m+g))*R,n[11]=0,n[12]=c*n[0]+l*n[4]+h*n[8]-c+t.x,n[13]=c*n[1]+l*n[5]+h*n[9]-l+t.y,n[14]=c*n[2]+l*n[6]+h*n[10]-h+t.z,this},t.prototype.decompose=function(e,r,i){var n=t.tempVec0,o=this.elements,a=n.set(o[0],o[1],o[2]).length(),s=n.set(o[4],o[5],o[6]).length(),u=n.set(o[8],o[9],o[10]).length();this.determinant()<0&&(a=-a),e.x=o[12],e.y=o[13],e.z=o[14];var c=t.tempMat0;c.copyFrom(this);var l=1/a,h=1/s,f=1/u;return c.elements[0]*=l,c.elements[1]*=l,c.elements[2]*=l,c.elements[4]*=h,c.elements[5]*=h,c.elements[6]*=h,c.elements[8]*=f,c.elements[9]*=f,c.elements[10]*=f,r.setFromRotationMatrix(c),i.x=a,i.y=s,i.z=u,this},t.prototype.getTranslation=function(t){var e=this.elements;return t.set(e[12],e[13],e[14])},t.prototype.getScale=function(t){var e=this.elements;return t.set(Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10]))},t.prototype.getTransform=function(){var t=new OS,e=new wS,r=new OS;return this.decompose(t,e,r),{translation:t,rotation:e,scale:r}},t.prototype.orthographic=function(t,e,r,i,n,o){var a=1/(e-t),s=1/(r-i),u=1/(o-n),c=-(e+t)*a,l=-(r+i)*s,h=-(o+n)*u;a*=2,s*=2,u*=-2;var f=this.elements;return f[0]=a,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=s,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=u,f[11]=0,f[12]=c,f[13]=l,f[14]=h,f[15]=1,this},t.prototype.perspective=function(t,e,r,i,n){var o=1/Math.tan(.5*t),a=1/(r-i),s=this.elements;return s[0]=n?o:o/e,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=n?o*e:o,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(i+r)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=2*i*r*a,s[15]=0,null!==i&&i!==1/0||(s[10]=-1,s[14]=-2*r),this},t.prototype.projectPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14];var s=o[3]*r+o[7]*i+o[11]*n+o[15];return a.multiply(1/s)},t.prototype.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n+o[12],a.y=o[1]*r+o[5]*i+o[9]*n+o[13],a.z=o[2]*r+o[6]*i+o[10]*n+o[14],a},t.prototype.transformNormal=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[4]*i+o[8]*n,a.y=o[1]*r+o[5]*i+o[9]*n,a.z=o[2]*r+o[6]*i+o[10]*n,a.normalize()},t.prototype.transformVector4=function(t,e){var r=t.x,i=t.y,n=t.z,o=t.w,a=this.elements,s=null!=e?e:t;return s.x=a[0]*r+a[4]*i+a[8]*n+a[12]*o,s.y=a[1]*r+a[5]*i+a[9]*n+a[13]*o,s.z=a[2]*r+a[6]*i+a[10]*n+a[14]*o,s.w=a[3]*r+a[7]*i+a[11]*n+a[15]*o,s},t.prototype.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<16;i++)if(!bS(e[i],r[i]))return!1;return!0},t.prototype.toArray=function(){return IS([],MS(this.elements),!1)},t.prototype.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8],t[e+9]=r[9],t[e+10]=r[10],t[e+11]=r[11],t[e+12]=r[12],t[e+13]=r[13],t[e+14]=r[14],t[e+15]=r[15]},t.fromIdentity=function(){return new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},t.fromLookAt=function(e,r,i){return(new t).lookAt(e,r,i)},t.fromPerspective=function(e,r,i,n,o){return(new t).perspective(e,r,i,n,o)},t.fromColumnVectors=function(e,r,i,n){return(new t).setFromColumnVectors(e,r,i,n)},t.fromMatrix3=function(e){return(new t).setFromMatrix3(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromScale=function(e,r,i){return(new t).setFromScale(e,r,i)},t.fromTranslation=function(e,r,i){return(new t).setFromTranslation(e,r,i)},t.fromRotationX=function(e){return(new t).setFromRotationX(e)},t.fromRotationY=function(e){return(new t).setFromRotationY(e)},t.fromRotationZ=function(e){return(new t).setFromRotationZ(e)},t.fromRotationAxis=function(e,r){return(new t).setFromRotationAxis(e,r)},t.fromEuler=function(e){return(new t).setFromEuler(e)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromShear=function(e,r,i){return(new t).setFromShear(e,r,i)},t.fromBasis=function(e,r,i){return(new t).setFromBasis(e,r,i)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,c,l,h,f,p,d,m,v){return new t(e,o,c,p,r,a,l,d,i,s,h,m,n,u,f,v)},t.IDENTITY=new t(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),t.ZERO=new t(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),t.tempVec0=new OS,t.tempVec1=new OS,t.tempVec2=new OS,t.tempMat0=new t,t}();!function(t){t[t.XYZ=0]="XYZ",t[t.XZY=1]="XZY",t[t.YXZ=2]="YXZ",t[t.YZX=3]="YZX",t[t.ZXY=4]="ZXY",t[t.ZYX=5]="ZYX"}(RS||(RS={}));var PS,FS,VS=function(){function t(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=t.DEFAULT_ORDER),this.x=e,this.y=r,this.z=i,this.order=n}return t.prototype.set=function(t,e,r,i){return void 0===i&&(i=this.order),this.x=t,this.y=e,this.z=r,this.order=i,this},t.prototype.setZero=function(t){return void 0===t&&(t=this.order),this.set(0,0,0,t)},t.prototype.setFromRotationMatrix4=function(t,e){void 0===e&&(e=this.order);var r=t.elements,i=r[0],n=r[4],o=r[8],a=r[1],s=r[5],u=r[9],c=r[2],l=r[6],h=r[10];switch(e){case RS.XYZ:this.y=Math.asin(_S(o,-1,1)),Math.abs(o)<.9999999?(this.x=Math.atan2(-u,h),this.z=Math.atan2(-n,i)):(this.x=Math.atan2(l,s),this.z=0);break;case RS.YXZ:this.x=Math.asin(-_S(u,-1,1)),Math.abs(u)<.9999999?(this.y=Math.atan2(o,h),this.z=Math.atan2(a,s)):(this.y=Math.atan2(-c,i),this.z=0);break;case RS.ZXY:this.x=Math.asin(_S(l,-1,1)),Math.abs(l)<.9999999?(this.y=Math.atan2(-c,h),this.z=Math.atan2(-n,s)):(this.y=0,this.z=Math.atan2(a,i));break;case RS.ZYX:this.y=Math.asin(-_S(c,-1,1)),Math.abs(c)<.9999999?(this.x=Math.atan2(l,h),this.z=Math.atan2(a,i)):(this.x=0,this.z=Math.atan2(-n,s));break;case RS.YZX:this.z=Math.asin(_S(a,-1,1)),Math.abs(a)<.9999999?(this.x=Math.atan2(-u,s),this.y=Math.atan2(-c,i)):(this.x=0,this.y=Math.atan2(o,h));break;case RS.XZY:this.z=Math.asin(-_S(n,-1,1)),Math.abs(n)<.9999999?(this.x=Math.atan2(l,s),this.y=Math.atan2(o,i)):(this.x=Math.atan2(-u,h),this.y=0);break;default:console.error("setFromRotationMatrix: unknown order: "+e)}return this.x*=ES,this.y*=ES,this.z*=ES,this.order=e,this},t.prototype.setFromQuaternion=function(e,r){void 0===r&&(r=this.order);var i=t.tempMat0;return i.setFromQuaternion(e),this.setFromRotationMatrix4(i,r)},t.prototype.setFromVector3=function(t,e){return void 0===e&&(e=this.order),this.set(t.x,t.y,t.z,e)},t.prototype.setFromArray=function(t,e,r){var i,n,o,a;return void 0===e&&(e=0),void 0===r&&(r=this.order),this.x=null!==(i=t[e])&&void 0!==i?i:0,this.y=null!==(n=t[e+1])&&void 0!==n?n:0,this.z=null!==(o=t[e+2])&&void 0!==o?o:0,this.order=null!==(a=t[e+3])&&void 0!==a?a:r,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.order)},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.order=t.order,this},t.prototype.add=function(t){return this.order!=t.order?(console.error("add euler with different order"),this):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this)},t.prototype.addEulers=function(t,e){return t.order!=e.order?(console.error("add euler with different order"),this):(this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.order=t.order,this)},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},t.prototype.reorder=function(t){var e=new wS;return e.setFromEuler(this),this.setFromQuaternion(e,t)},t.prototype.rotateVector3=function(e,r){return t.tempQuat0.setFromEuler(this).rotateVector3(e,r)},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.order===this.order},t.prototype.toVector3=function(t){return t.set(this.x,this.y,this.z)},t.prototype.toArray=function(){return[this.x,this.y,this.z]},t.prototype.toQuaternion=function(t){var e,r=(e=this).x,i=e.y,n=e.z,o=e.order,a=Math.cos(r*TS*.5),s=Math.cos(i*TS*.5),u=Math.cos(n*TS*.5),c=Math.sin(r*TS*.5),l=Math.sin(i*TS*.5),h=Math.sin(n*TS*.5);switch(o){case RS.XYZ:t.set(c*s*u+a*l*h,a*l*u-c*s*h,a*s*h+c*l*u,a*s*u-c*l*h);break;case RS.YXZ:t.set(c*s*u+a*l*h,a*l*u-c*s*h,a*s*h-c*l*u,a*s*u+c*l*h);break;case RS.ZXY:t.set(c*s*u-a*l*h,a*l*u+c*s*h,a*s*h+c*l*u,a*s*u-c*l*h);break;case RS.ZYX:t.set(c*s*u-a*l*h,a*l*u+c*s*h,a*s*h-c*l*u,a*s*u+c*l*h);break;case RS.YZX:t.set(c*s*u+a*l*h,a*l*u+c*s*h,a*s*h-c*l*u,a*s*u-c*l*h);break;case RS.XZY:t.set(c*s*u-a*l*h,a*l*u-c*s*h,a*s*h+c*l*u,a*s*u+c*l*h);break;default:console.error("unknown euler order: "+o)}return t},t.prototype.toMatrix4=function(t){var e,r=t.elements,i=(e=this).x,n=e.y,o=e.z,a=e.order,s=Math.cos(i*TS),u=Math.sin(i*TS),c=Math.cos(n*TS),l=Math.sin(n*TS),h=Math.cos(o*TS),f=Math.sin(o*TS);if(a===RS.XYZ){var p=s*h,d=s*f,m=u*h,v=u*f;r[0]=c*h,r[4]=-c*f,r[8]=l,r[1]=d+m*l,r[5]=p-v*l,r[9]=-u*c,r[2]=v-p*l,r[6]=m+d*l,r[10]=s*c}else if(a===RS.YXZ){var y=c*h,g=c*f,x=l*h,T=l*f;r[0]=y+T*u,r[4]=x*u-g,r[8]=s*l,r[1]=s*f,r[5]=s*h,r[9]=-u,r[2]=g*u-x,r[6]=T+y*u,r[10]=s*c}else if(a===RS.ZXY){y=c*h,g=c*f,x=l*h,T=l*f;r[0]=y-T*u,r[4]=-s*f,r[8]=x+g*u,r[1]=g+x*u,r[5]=s*h,r[9]=T-y*u,r[2]=-s*l,r[6]=u,r[10]=s*c}else if(a===RS.ZYX){p=s*h,d=s*f,m=u*h,v=u*f;r[0]=c*h,r[4]=m*l-d,r[8]=p*l+v,r[1]=c*f,r[5]=v*l+p,r[9]=d*l-m,r[2]=-l,r[6]=u*c,r[10]=s*c}else if(a===RS.YZX){var E=s*c,A=s*l,b=u*c,S=u*l;r[0]=c*h,r[4]=S-E*f,r[8]=b*f+A,r[1]=f,r[5]=s*h,r[9]=-u*h,r[2]=-l*h,r[6]=A*f+b,r[10]=E-S*f}else if(a===RS.XZY){E=s*c,A=s*l,b=u*c,S=u*l;r[0]=c*h,r[4]=-f,r[8]=l*h,r[1]=E*f+S,r[5]=s*h,r[9]=A*f-b,r[2]=b*f-A,r[6]=u*h,r[10]=S*f+E}else console.error("toMatrix4: Invalid order "+a);return r[3]=0,r[7]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,t},t.fromRotationMatrix4=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromRotationMatrix4(e,r)},t.fromQuaternion=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromQuaternion(e,r)},t.fromVector3=function(e,r){return void 0===r&&(r=t.DEFAULT_ORDER),(new t).setFromVector3(e,r)},t.fromArray=function(e,r,i){return void 0===r&&(r=0),void 0===i&&(i=t.DEFAULT_ORDER),(new t).setFromArray(e,r,i)},t.DEFAULT_ORDER=RS.ZYX,t.tempQuat0=new wS,t.tempMat0=new LS,t}(),NS=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=t,this.y=e,this.z=r,this.w=i}return t.prototype.set=function(t,e,r,i){return this.x=t,this.y=e,this.z=r,this.w=i,this},t.prototype.setZero=function(){return this.x=0,this.y=0,this.z=0,this.w=0,this},t.prototype.setFromNumber=function(t){return this.x=t,this.y=t,this.z=t,this.w=t,this},t.prototype.setFromArray=function(t,e){var r,i,n,o;return void 0===e&&(e=0),this.x=null!==(r=t[e])&&void 0!==r?r:0,this.y=null!==(i=t[e+1])&&void 0!==i?i:0,this.z=null!==(n=t[e+2])&&void 0!==n?n:0,this.w=null!==(o=t[e+3])&&void 0!==o?o:0,this},t.prototype.copyFrom=function(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w,this},t.prototype.clone=function(){return new t(this.x,this.y,this.z,this.w)},t.prototype.setElement=function(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:console.error("index is out of range: "+t)}return this},t.prototype.getElement=function(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:console.error("index is out of range: "+t)}return 0},t.prototype.add=function(t){return"number"==typeof t?(this.x+=t,this.y+=t,this.z+=t,this.w+=t):t instanceof Array?(this.x+=t[0],this.y+=t[1],this.z+=t[2],this.w+=t[3]):(this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w),this},t.prototype.addVectors=function(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this},t.prototype.addScaledVector=function(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this},t.prototype.subtract=function(t){return"number"==typeof t?(this.x-=t,this.y-=t,this.z-=t,this.w-=t):t instanceof Array?(this.x-=t[0],this.y-=t[1],this.z-=t[2],this.w-=t[3]):(this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w),this},t.prototype.subtractVectors=function(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this},t.prototype.multiply=function(t){return"number"==typeof t?(this.x*=t,this.y*=t,this.z*=t,this.w*=t):t instanceof Array?(this.x*=t[0],this.y*=t[1],this.z*=t[2],this.w*=t[3]):(this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w),this},t.prototype.multiplyVectors=function(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this.w=t.w*e.w,this},t.prototype.divide=function(t){return"number"==typeof t?(this.x/=t,this.y/=t,this.z/=t,this.w/=t):t instanceof Array?(this.x/=t[0],this.y/=t[1],this.z/=t[2],this.w/=t[3]):(this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w),this},t.prototype.scale=function(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},t.prototype.sum=function(){return this.x+this.y+this.z+this.w},t.prototype.min=function(t){return"number"==typeof t?(this.x=Math.min(this.x,t),this.y=Math.min(this.y,t),this.z=Math.min(this.z,t),this.w=Math.min(this.w,t)):(this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w)),this},t.prototype.max=function(t){return"number"==typeof t?(this.x=Math.max(this.x,t),this.y=Math.max(this.y,t),this.z=Math.max(this.z,t),this.w=Math.max(this.w,t)):(this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w)),this},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.floor=function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},t.prototype.ceil=function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},t.prototype.round=function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},t.prototype.abs=function(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this.z=Math.abs(this.z),this.w=Math.abs(this.w),this},t.prototype.negate=function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},t.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},t.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},t.prototype.normalize=function(){return this.divide(this.length()||1)},t.prototype.setLength=function(t){return this.normalize().multiply(t)},t.prototype.lerp=function(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this},t.prototype.lerpVectors=function(t,e,r){return this.x=t.x+(e.x-t.x)*r,this.y=t.y+(e.y-t.y)*r,this.z=t.z+(e.z-t.z)*r,this.w=t.w+(e.w-t.w)*r,this},t.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w},t.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w},t.prototype.isZero=function(){var t,e=AS,r=(t=this).x,i=t.y,n=t.z,o=t.w;return Math.abs(r)<=e&&Math.abs(i)<=e&&Math.abs(n)<=e&&Math.abs(o)<=e},t.prototype.toArray=function(){return[this.x,this.y,this.z,this.w]},t.prototype.toVector3=function(){return new OS(this.x,this.y,this.z)},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w},t.prototype.random=function(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this},t.prototype.applyMatrix=function(t,e){return t.transformVector4(this,e)},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.ONE=new t(1,1,1,1),t.ZERO=new t(0,0,0,0),t}(),DS=function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a},zS=function(t,e,r){if(r||2===arguments.length)for(var i,n=0,o=e.length;n<o;n++)!i&&n in e||(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))},US=function(){function t(t,e,r,i,n,o,a,s,u){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===o&&(o=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=1),this.elements=[t,e,r,i,n,o,a,s,u]}return t.prototype.set=function(t,e,r,i,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=i,c[6]=a,c[1]=e,c[4]=n,c[7]=s,c[2]=r,c[5]=o,c[8]=u,this},t.prototype.setFromRowMajorData=function(t,e,r,i,n,o,a,s,u){var c=this.elements;return c[0]=t,c[3]=e,c[6]=r,c[1]=i,c[4]=n,c[7]=o,c[2]=a,c[5]=s,c[8]=u,this},t.prototype.setFromColumnVectors=function(t,e,r){return this.set(t.x,t.y,t.z,e.x,e.y,e.z,r.x,r.y,r.z)},t.prototype.setFromMatrix4=function(t){var e=t.elements;return this.set(e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10])},t.prototype.setFromArray=function(t,e){void 0===e&&(e=0);for(var r=0;r<9;r++)this.elements[r]=t[e+r];return this},t.prototype.setFromQuaternion=function(t){var e=t.x,r=t.y,i=t.z,n=t.w,o=e+e,a=r+r,s=i+i,u=e*o,c=e*a,l=e*s,h=r*a,f=r*s,p=i*s,d=n*o,m=n*a,v=n*s,y=this.elements;return y[0]=1-(h+p),y[1]=c+v,y[2]=l-m,y[3]=c-v,y[4]=1-(u+p),y[5]=f+d,y[6]=l+m,y[7]=f-d,y[8]=1-(u+h),this},t.prototype.setZero=function(){for(var t=0;t<9;t++)this.elements[t]=0;return this},t.prototype.identity=function(){return this.set(1,0,0,0,1,0,0,0,1)},t.prototype.clone=function(){var e=this.elements;return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},t.prototype.copyFrom=function(t){return this.elements=zS([],DS(t.elements),!1),this},t.prototype.getColumnVector=function(t,e){return e.set(this.elements[3*t],this.elements[3*t+1],this.elements[3*t+2])},t.prototype.scale=function(t,e){var r=this.elements;return r[0]*=t,r[3]*=t,r[6]*=t,r[1]*=e,r[4]*=e,r[7]*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.elements,n=i[0],o=i[3],a=i[6],s=i[1],u=i[4],c=i[7];return i[0]=e*n+r*s,i[3]=e*o+r*u,i[6]=e*a+r*c,i[1]=-r*n+e*s,i[4]=-r*o+e*u,i[7]=-r*a+e*c,this},t.prototype.translate=function(t,e){var r=this.elements;return r[0]+=t*r[2],r[3]+=t*r[5],r[6]+=t*r[8],r[1]+=e*r[2],r[4]+=e*r[5],r[7]+=e*r[8],this},t.prototype.multiply=function(t){if("number"==typeof t){for(var e=0;e<9;e++)this.elements[e]*=t;return this}return this.multiplyMatrices(this,t)},t.prototype.premultiply=function(t){return this.multiplyMatrices(t,this)},t.prototype.multiplyMatrices=function(t,e){var r=t.elements,i=e.elements,n=this.elements,o=r[0],a=r[3],s=r[6],u=r[1],c=r[4],l=r[7],h=r[2],f=r[5],p=r[8],d=i[0],m=i[3],v=i[6],y=i[1],g=i[4],x=i[7],T=i[2],E=i[5],A=i[8];return n[0]=o*d+a*y+s*T,n[3]=o*m+a*g+s*E,n[6]=o*v+a*x+s*A,n[1]=u*d+c*y+l*T,n[4]=u*m+c*g+l*E,n[7]=u*v+c*x+l*A,n[2]=h*d+f*y+p*T,n[5]=h*m+f*g+p*E,n[8]=h*v+f*x+p*A,this},t.prototype.determinant=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8];return e*(o*c-u*a)+n*(u*i-r*c)+s*(r*a-o*i)},t.prototype.invert=function(){var t=this.elements,e=t[0],r=t[3],i=t[6],n=t[1],o=t[4],a=t[7],s=t[2],u=t[5],c=t[8],l=c*o-u*a,h=u*i-c*r,f=a*r-o*i,p=e*l+n*h+s*f;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);var d=1/p;return t[0]=l*d,t[1]=(s*a-c*n)*d,t[2]=(u*n-s*o)*d,t[3]=h*d,t[4]=(c*e-s*i)*d,t[5]=(s*r-u*e)*d,t[6]=f*d,t[7]=(n*i-a*e)*d,t[8]=(o*e-n*r)*d,this},t.prototype.transpose=function(){var t,e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this},t.prototype.transformPoint=function(t,e){var r=t.x,i=t.y,n=t.z,o=this.elements,a=null!=e?e:t;return a.x=o[0]*r+o[3]*i+o[6]*n,a.y=o[1]*r+o[4]*i+o[7]*n,a.z=o[2]*r+o[5]*i+o[8]*n,a},t.prototype.transformNormal=function(t,e){return this.transformPoint(t,e).normalize()},t.prototype.equals=function(t){for(var e=this.elements,r=t.elements,i=0;i<9;i++)if(!bS(e[i],r[i]))return!1;return!0},t.prototype.toArray=function(){return zS([],DS(this.elements),!1)},t.prototype.fill=function(t,e){void 0===e&&(e=0);var r=this.elements;t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=r[3],t[e+4]=r[4],t[e+5]=r[5],t[e+6]=r[6],t[e+7]=r[7],t[e+8]=r[8]},t.fromIdentity=function(){return new t(1,0,0,0,1,0,0,0,1)},t.fromColumnVectors=function(e,r,i){return(new t).setFromColumnVectors(e,r,i)},t.fromMatrix4=function(e){return(new t).setFromMatrix4(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromQuaternion=function(e){return(new t).setFromQuaternion(e)},t.fromRowMajorData=function(e,r,i,n,o,a,s,u,c){return new t(e,n,s,r,o,u,i,a,c)},t}(),BS=function(){function t(t,e){void 0===t&&(t=OS.ZERO),void 0===e&&(e=OS.X),this.origin=new OS,this.direction=new OS,this.origin.copyFrom(t),this.direction.copyFrom(e).normalize()}return t.prototype.set=function(t,e){return this.origin.copyFrom(t),this.direction.copyFrom(e).normalize(),this},t.prototype.clone=function(){return new t(this.origin,this.direction)},t.prototype.copyFrom=function(t){return this.set(t.origin,t.direction)},t.prototype.recast=function(e){return this.origin.copyFrom(this.at(e,t.tempVec0)),this},t.prototype.at=function(t,e){var r=e||new OS;return r.copyFrom(this.origin),r.addScaledVector(this.direction,t)},t.prototype.equals=function(t){return this.origin.equals(t.origin)&&this.direction.equals(t.direction)},t.prototype.applyMatrix=function(t){return this.origin.applyProjectionMatrix(t),this.direction.applyNormalMatrix(t),this},t.prototype.intersectBox=function(t,e){var r,i,n,o,a,s,u,c,l,h,f=(r=this.origin).x,p=r.y,d=r.z,m=(i=this.direction).x,v=i.y,y=i.z,g=(n=t.min).x,x=n.y,T=n.z,E=(o=t.max).x,A=o.y,b=o.z,S=1/m,_=1/v,R=1/y;if(S>=0?(a=(g-f)*S,s=(E-f)*S):(a=(E-f)*S,s=(g-f)*S),_>=0?(u=(x-p)*_,c=(A-p)*_):(u=(A-p)*_,c=(x-p)*_),!(a>c||u>s||((u>a||a!=a)&&(a=u),(c<s||s!=s)&&(s=c),(u>a||a!=a)&&(a=u),(c<s||s!=s)&&(s=c),R>=0?(l=(T-d)*R,h=(b-d)*R):(l=(b-d)*R,h=(T-d)*R),a>h||l>s||((l>a||a!=a)&&(a=l),(h<s||s!=s)&&(s=h),s<0))))return a>=0?this.at(a,e):this.at(s,e)},t.prototype.intersectPlane=function(t,e){var r=t.normal,i=t.distance,n=r.dot(this.direction);if(0===n)return 0===r.dot(this.origin)+i?(e||new OS).copyFrom(this.origin):void 0;var o=-(this.origin.dot(r)+i)/n;return o>=0?this.at(o,e):void 0},t.prototype.intersectSphere=function(e,r){var i=e.center,n=t.tempVec0.subtractVectors(i,this.origin),o=n.dot(this.direction),a=n.dot(n)-o*o,s=e.radius*e.radius;if(!(a>s)){var u=Math.sqrt(s-a),c=o-u,l=o+u;if(!(l<0))return c>=0?this.at(c,r):this.at(l,r)}},t.prototype.intersectTriangle=function(e,r,i){var n,o=e.p0,a=e.p1,s=e.p2,u=t.tempVec0.subtractVectors(a,o),c=t.tempVec1.subtractVectors(s,o),l=t.tempVec2.subtractVectors(this.origin,o),h=t.tempVec3.crossVectors(u,c),f=this.direction.dot(h);if(f>0){if(i)return;n=1}else{if(!(f<0))return;n=-1,f=-f}c.crossVectors(l,c);var p=n*this.direction.dot(c);if(!(p<0)){u.cross(l);var d=n*this.direction.dot(u);if(!(d<0||p+d>f)){var m=-n*l.dot(h);if(!(m<0))return this.at(m/f,r)}}},t.tempVec0=new OS,t.tempVec1=new OS,t.tempVec2=new OS,t.tempVec3=new OS,t}(),kS=function(){function t(t,e,r,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.r=t,this.g=e,this.b=r,this.a=i}return t.prototype.set=function(t,e,r,i){return this.r=t,this.g=e,this.b=r,this.a=i,this},t.prototype.setZero=function(){return this.r=0,this.g=0,this.b=0,this.a=0,this},t.prototype.setFromNumber=function(t){return this.r=t,this.g=t,this.b=t,this.a=t,this},t.prototype.setFromVector4=function(t){return this.r=t.x,this.g=t.y,this.b=t.z,this.a=t.w,this},t.prototype.setFromArray=function(t,e){var r,i,n,o;return void 0===e&&(e=0),this.r=null!==(r=t[e])&&void 0!==r?r:0,this.g=null!==(i=t[e+1])&&void 0!==i?i:0,this.b=null!==(n=t[e+2])&&void 0!==n?n:0,this.a=null!==(o=t[e+3])&&void 0!==o?o:0,this},t.prototype.setFromHSV=function(t,e,r,i){void 0===i&&(i=1);var n=r*e,o=t/60,a=n*(1-Math.abs(o%2-1)),s=0,u=0,c=0;o>=0&&o<=1?(s=n,u=a):o>=1&&o<=2?(s=a,u=n):o>=2&&o<=3?(u=n,c=a):o>=3&&o<=4?(u=a,c=n):o>=4&&o<=5?(s=a,c=n):o>=5&&o<=6&&(s=n,c=a);var l=r-n;return this.set(s+l,u+l,c+l,i)},t.prototype.setFromHexString=function(t){if("#"!==t.substring(0,1)||9!==t.length&&7!==t.length)return this;var e=parseInt(t.substring(1,3),16)/255,r=parseInt(t.substring(3,5),16)/255,i=parseInt(t.substring(5,7),16)/255,n=9===t.length?parseInt(t.substring(7,9),16)/255:1;return this.set(e,r,i,n)},t.prototype.copyFrom=function(t){return this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a,this},t.prototype.clone=function(){return new t(this.r,this.g,this.b,this.a)},t.prototype.setElement=function(t,e){switch(t){case 0:this.r=e;break;case 1:this.g=e;break;case 2:this.b=e;break;case 3:this.a=e;break;default:console.error("index is out of range: "+t)}return this},t.prototype.getElement=function(t){switch(t){case 0:return this.r;case 1:return this.g;case 2:return this.b;case 3:return this.a;default:console.error("index is out of range: "+t)}return 0},t.prototype.add=function(t){return"number"==typeof t?(this.r+=t,this.g+=t,this.b+=t,this.a+=t):t instanceof Array?(this.r+=t[0],this.g+=t[1],this.b+=t[2],this.a+=t[3]):(this.r+=t.r,this.g+=t.g,this.b+=t.b,this.a+=t.a),this},t.prototype.subtract=function(t){return"number"==typeof t?(this.r-=t,this.g-=t,this.b-=t,this.a-=t):t instanceof Array?(this.r-=t[0],this.g-=t[1],this.b-=t[2],this.a-=t[3]):(this.r-=t.r,this.g-=t.g,this.b-=t.b,this.a-=t.a),this},t.prototype.multiply=function(t){return"number"==typeof t?(this.r*=t,this.g*=t,this.b*=t,this.a*=t):t instanceof Array?(this.r*=t[0],this.g*=t[1],this.b*=t[2],this.a*=t[3]):(this.r*=t.r,this.g*=t.g,this.b*=t.b,this.a*=t.a),this},t.prototype.divide=function(t){return"number"==typeof t?(this.r/=t,this.g/=t,this.b/=t,this.a/=t):t instanceof Array?(this.r/=t[0],this.g/=t[1],this.b/=t[2],this.a/=t[3]):(this.r/=t.r,this.g/=t.g,this.b/=t.b,this.a/=t.a),this},t.prototype.scale=function(t){return this.r*=t,this.g*=t,this.b*=t,this.a*=t,this},t.prototype.min=function(t){return"number"==typeof t?(this.r=Math.min(this.r,t),this.g=Math.min(this.g,t),this.b=Math.min(this.b,t),this.a=Math.min(this.a,t)):(this.r=Math.min(this.r,t.r),this.g=Math.min(this.g,t.g),this.b=Math.min(this.b,t.b),this.a=Math.min(this.a,t.a)),this},t.prototype.max=function(t){return"number"==typeof t?(this.r=Math.max(this.r,t),this.g=Math.max(this.g,t),this.b=Math.max(this.b,t),this.a=Math.max(this.a,t)):(this.r=Math.max(this.r,t.r),this.g=Math.max(this.g,t.g),this.b=Math.max(this.b,t.b),this.a=Math.max(this.a,t.a)),this},t.prototype.clamp=function(t,e){return this.max(t).min(e)},t.prototype.lerp=function(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this.a+=(t.a-this.a)*e,this},t.prototype.luminance=function(){return.3*this.r+.59*this.g+.11*this.b},t.prototype.equals=function(t){return t.r===this.r&&t.g===this.g&&t.b===this.b&&t.a===this.a},t.prototype.toLinear=function(){return this.r=t.gammaToLinear(this.r),this.g=t.gammaToLinear(this.g),this.b=t.gammaToLinear(this.b),this},t.prototype.toGamma=function(){return this.r=t.linearToGamma(this.r),this.g=t.linearToGamma(this.g),this.b=t.linearToGamma(this.b),this},t.prototype.toArray=function(){return[this.r,this.g,this.b,this.a]},t.prototype.toVector4=function(){return new NS(this.r,this.g,this.b,this.a)},t.prototype.toHSV=function(){var e,r=(e=this).r,i=e.g,n=e.b,o=e.a,a=Math.max(r,i,n),s=Math.min(r,i,n),u=a-s,c=0,l=0;return 0!==a&&(l=u/a),a!=s&&(a==r?(c=(i-n)/u,i<n&&(c+=6)):a==i?c=(n-r)/u+2:a==n&&(c=(r-i)/u+4),c*=60),new t(c,l,a,o)},t.prototype.toHexString=function(e){void 0===e&&(e=!0);var r=t.ToHex(Math.round(255*this.r)),i=t.ToHex(Math.round(255*this.g)),n=t.ToHex(Math.round(255*this.b)),o=t.ToHex(Math.round(255*this.a));return e?"#"+r+i+n+o:"#"+r+i+n},t.prototype.fill=function(t,e){void 0===e&&(e=0),t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t[e+3]=this.a},t.fromNumber=function(e){return(new t).setFromNumber(e)},t.fromArray=function(e,r){return void 0===r&&(r=0),(new t).setFromArray(e,r)},t.fromHexString=function(e){return(new t).setFromHexString(e)},t.fromHSV=function(e,r,i,n){return void 0===n&&(n=1),(new t).setFromHSV(e,r,i,n)},t.gammaToLinear=function(t){return t<=0?0:t<=.04045?t/12.92:t<1?Math.pow((t+.055)/1.055,2.4):Math.pow(t,2.4)},t.linearToGamma=function(t){return t<=0?0:t<.0031308?12.92*t:t<1?1.055*Math.pow(t,.41666)-.055:Math.pow(t,.41666)},t.ToHex=function(t){var e=t.toString(16);return t<=15?("0"+e).toUpperCase():e.toUpperCase()},t.BLACK=new t(0,0,0,1),t.BLUE=new t(0,0,1,1),t.CLEAR=new t(0,0,0,0),t.CYAN=new t(0,1,1,1),t.GRAY=new t(.5,.5,.5,1),t.GREEN=new t(0,1,0,1),t.MAGENTA=new t(1,0,1,1),t.RED=new t(1,0,0,1),t.WHITE=new t(1,1,1,1),t.YELLOW=new t(1,.92,.016,1),t}(),GS=function(){function t(t,e){void 0===t&&(t=new OS(1/0,1/0,1/0)),void 0===e&&(e=new OS(-1/0,-1/0,-1/0)),this.min=t.clone(),this.max=e.clone()}return t.prototype.set=function(t,e){return this.min.copyFrom(t),this.max.copyFrom(e),this},t.prototype.setFromArray=function(t){for(var e=Number(1/0),r=Number(1/0),i=Number(1/0),n=-1/0,o=-1/0,a=-1/0,s=0,u=t.length;s<u;s+=3){var c=t[s],l=t[s+1],h=t[s+2];c<e&&(e=c),l<r&&(r=l),h<i&&(i=h),c>n&&(n=c),l>o&&(o=l),h>a&&(a=h)}return this.min.set(e,r,i),this.max.set(n,o,a),this},t.prototype.setFromPoints=function(t){this.makeEmpty();for(var e=0,r=t.length;e<r;e++)this.expandByPoint(t[e]);return this},t.prototype.setFromCenterAndSize=function(t,e){var r=e.clone().multiply(.5);return this.min.copyFrom(t).subtract(r),this.max.copyFrom(t).add(r),this},t.prototype.setFromObject=function(t){return this.makeEmpty(),this.expandByObject(t)},t.prototype.clone=function(){return(new t).copyFrom(this)},t.prototype.copyFrom=function(t){return this.min.copyFrom(t.min),this.max.copyFrom(t.max),this},t.prototype.makeEmpty=function(){return this.min.x=this.min.y=this.min.z=Number(1/0),this.max.x=this.max.y=this.max.z=-1/0,this},t.prototype.isEmpty=function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},t.prototype.getCenter=function(t){return void 0===t&&(t=new OS),this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiply(.5)},t.prototype.getSize=function(t){return void 0===t&&(t=new OS),this.isEmpty()?t.set(0,0,0):t.subtractVectors(this.max,this.min)},t.prototype.expandByPoint=function(t){return this.min.min(t),this.max.max(t),this},t.prototype.expandByVector=function(t){return this.min.subtract(t),this.max.add(t),this},t.prototype.expandByScalar=function(t){return this.min.add(-t),this.max.add(t),this},t.prototype.expandByBox=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.expandByObject=function(e){e.updateWorldMatrix(!1,!1);var r=e.geometry;if(void 0!==r){null===r.boundingBox&&r.computeBoundingBox();var i=new t;i.copyFrom(r.boundingBox),i.applyMatrix4(e.matrixWorld),this.union(i)}for(var n=e.children,o=0,a=n.length;o<a;o++)this.expandByObject(n[o]);return this},t.prototype.containsPoint=function(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y||t.z<this.min.z||t.z>this.max.z)},t.prototype.containsBox=function(t){return this.min.x<=t.min.x&&this.max.x>=t.max.x&&this.min.y<=t.min.y&&this.max.y>=t.max.y&&this.min.z<=t.min.z&&this.max.z>=t.max.z},t.prototype.getParameter=function(t,e){return void 0===e&&(e=new OS),e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))},t.prototype.intersectsBox=function(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y||t.max.z<this.min.z||t.min.z>this.max.z)},t.prototype.intersectsSphere=function(t){var e=new OS;return this.clampPoint(t.center,e),e.distanceSquared(t.center)<=t.radius*t.radius},t.prototype.clampPoint=function(t,e){return void 0===e&&(e=new OS),e.copyFrom(t).clamp(this.min,this.max)},t.prototype.distanceToPoint=function(t){return t.clone().clamp(this.min,this.max).subtract(t).length()},t.prototype.intersect=function(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this},t.prototype.union=function(t){return this.min.min(t.min),this.max.max(t.max),this},t.prototype.applyMatrix4=function(t,e){if(void 0===e&&(e=new OS),this.isEmpty())return this;var r=this.getOBBPoints(t,e);return this.setFromPoints(r),this},t.prototype.getOBBPoints=function(t,e){if(void 0===e&&(e=new OS),this.isEmpty())return[];var r=[];return r[0]=new OS(this.min.x,this.min.y,this.min.z),r[1]=new OS(this.min.x,this.min.y,this.max.z),r[2]=new OS(this.min.x,this.max.y,this.min.z),r[3]=new OS(this.min.x,this.max.y,this.max.z),r[4]=new OS(this.max.x,this.min.y,this.min.z),r[5]=new OS(this.max.x,this.min.y,this.max.z),r[6]=new OS(this.max.x,this.max.y,this.min.z),r[7]=new OS(this.max.x,this.max.y,this.max.z),r.forEach((function(r){r.subtract(e),r.applyMatrix(t),r.add(e)})),r},t.prototype.getBoundingSphere=function(t){this.getCenter(t.center);var e=new OS;return t.radius=.5*this.getSize(e).length(),t},t.prototype.translate=function(t){return this.min.add(t),this.max.add(t),this},t.prototype.equals=function(t){return t.min.equals(this.min)&&t.max.equals(this.max)},t}(),jS=function(){function t(t,e){void 0===t&&(t=OS.ZERO),void 0===e&&(e=-1),this.center=t.clone(),this.radius=e}return t.prototype.set=function(t,e){return this.center.copyFrom(t),this.radius=e,this},t.prototype.setFromPoints=function(t,e){var r=this.center;if(void 0!==e){r.copyFrom(e);for(var i=0,n=0;n<t.length;n++)i=Math.max(i,r.distanceSquared(t[n]));this.radius=Math.sqrt(i)}else{var o=(new GS).setFromPoints(t);o.getCenter(r),this.radius=o.getSize().length()/2}return this},t.prototype.copyFrom=function(t){return this.center.copyFrom(t.center),this.radius=t.radius,this},t.prototype.isEmpty=function(){return this.radius<0},t.prototype.makeEmpty=function(){return this.center.set(0,0,0),this.radius=-1,this},t.prototype.containsPoint=function(t){return t.distanceSquared(this.center)<=this.radius*this.radius},t.prototype.distanceToPoint=function(t){return t.distance(this.center)-this.radius},t.prototype.intersectsSphere=function(t){var e=this.radius+t.radius;return t.center.distanceSquared(this.center)<=e*e},t.prototype.intersectsBox=function(t){return t.intersectsSphere(this)},t.prototype.clampPoint=function(t,e){var r=this.center.distanceSquared(t);return void 0===e&&(e=new OS),e.copyFrom(t),r>this.radius*this.radius&&(e.subtract(this.center).normalize(),e.multiply(this.radius).add(this.center)),e},t.prototype.getBoundingBox=function(t){return void 0===t&&(t=new GS),this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)},t.prototype.applyMatrix4=function(t){var e=t.elements,r=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10],o=Math.sqrt(Math.max(r,i,n));return this.center.applyMatrix(t),this.radius=this.radius*o,this},t.prototype.translate=function(t){return this.center.add(t),this},t.prototype.expandByPoint=function(t){var e=(new OS).subtractVectors(t,this.center),r=e.lengthSquared();if(r>this.radius*this.radius){var i=Math.sqrt(r),n=.5*(i-this.radius);this.center.add(e.multiply(n/i)),this.radius+=n}return this},t.prototype.union=function(t){var e=new OS,r=new OS;return r.subtractVectors(t.center,this.center).normalize().multiply(t.radius),this.expandByPoint(e.copyFrom(t.center).add(r)),this.expandByPoint(e.copyFrom(t.center).subtract(r)),this},t.prototype.intersect=function(t){var e=(new OS).subtractVectors(this.center,t.center),r=e.length();return r>this.radius+t.radius?this.makeEmpty():(this.center=this.center.add(e.normalize().multiply(r/2)),this.radius=this.radius+t.radius-r,this)},t.prototype.equals=function(t){return t.center.equals(this.center)&&t.radius===this.radius},t.prototype.clone=function(){return(new t).copyFrom(this)},t}(),XS=Object.freeze({__proto__:null,get EulerOrder(){return RS},Euler:VS,Quaternion:wS,Vector2:CS,Vector3:OS,Vector4:NS,Matrix3:US,Matrix4:LS,Ray:BS,PI2:xS,DEG2RAD:TS,RAD2DEG:ES,NumberEpsilon:AS,isZero:function(t){return isNaN(t)||Math.abs(t)<AS},isEqual:bS,damp:function(t,e,r,i){return SS(t,e,1-Math.exp(-r*i))},lerp:SS,degToRad:function(t){return t*TS},radToDeg:function(t){return t*ES},clamp:_S,Color:kS,Box3:GS,Sphere:jS}),YS=(PS=new Float32Array(1),FS=new Int32Array(PS.buffer),function(t){PS[0]=t;var e=FS[0],r=e>>16&32768,i=e>>12&2047,n=e>>23&255;return n<103?r:n>142?(r|=31744,r|=(255==n?0:1)&&8388607&e):n<113?r|=((i|=2048)>>114-n)+(i>>113-n&1):(r|=n-112<<10|i>>1,r+=1&i)}),WS=function(){function t(t){if(Number.isInteger(t))this.data=new Uint16Array(t);else if(t&&"object"==typeof t&&Number.isInteger(t.length))for(var e=this.data=new Uint16Array(t.length),r=0;r<e.length;r++)e[r]=YS(t[r])}return t.prototype.set=function(t,e){for(var r=0;r<t.length;r++)this.data[r+e]=YS(t[r])},t}();var HS,ZS=new VS,qS=new LS;function QS(t,e,r,i,n,o,a){var s=t,u=i/n,c=i,l=e.speedOverLifetime;l&&(c=l.getIntegrateValue(0,i,n));var h=e.gravityModifier?e.gravityModifier.getIntegrateByTime(0,i):0;s.copyFrom(o),s.addScaledVector(a,c),s.addScaledVector(r,h);var f=e.linearVelOverLifetime||{},p=e.orbitalVelOverLifetime||{},d=["x","y","z"];if(p.enabled){var m=new OS;p.center&&m.setFromArray(p.center);var v=s.clone().subtract(m),y=p.asRotation,g=d.map((function(t){var e=p[t];return e?y?e.getValue(u):e.getIntegrateValue(0,i,n):0}));ZS.setFromArray(g).negate(),qS.setFromEuler(ZS);var x=qS.transformPoint(v);s.addVectors(m,x)}if(f.enabled)for(var T=f.asMovement,E=0;E<3;E++){var A=f[d[E]];if(A){var b=T?A.getValue(u):A.getIntegrateValue(0,i,n);s.setElement(E,s.getElement(E)+b)}}return s}function KS(t){return Array.isArray(t)?[t[0],t[1],t[2]]:[0,0,0]}function JS(t,e){for(var r=0,i=t.length;r<i;r++)t[r]=e;return t}function $S(t,e,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)t[n]=e[n+i];return t}function t_(t,e){1===arguments.length&&(e=t,t=[]);var r=e,i=Math.hypot.apply(Math,sb([],ab(r),!1));if(0===i)return $S(t,r,r.length);for(var n=0;n<r.length;n++)t[n]=r[n]/i;return t}function e_(t,e,r){if(e&&r)for(var i=0,n=e.length;i<n;i++)t[i]=e[i]*r[i];else if(e){if(t!==e)for(i=0;i<e.length;i++)t[i]=e[i]}else if(r&&t!==r)for(i=0;i<r.length;i++)t[i]=r[i];return t}var r_,i_=((HS={})[Ib.PARTICLE_ORIGIN_CENTER]=[0,0],HS[Ib.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],HS[Ib.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],HS[Ib.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],HS[Ib.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],HS[Ib.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],HS[Ib.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],HS[Ib.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],HS[Ib.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],HS);function n_(t,e){return t?[t[0]-.5,.5-t[1]]:e?i_[e]:[0,0]}function o_(t){return Math.pow(2,Math.round(Math.log(t)/Math.LN2))}function a_(t,e,r){var i=r.position,n=new OS(t,e,0),o=new OS;return r.getInverseViewProjectionMatrix().projectPoint(n,o),o.subtract(i),new BS(i,o)}function s_(t,e,r){var i=t.x,n=t.y,o=t.z,a=new OS(i-e,n+r,o),s=new OS(i-e,n-r,o),u=new OS(i+e,n-r,o),c=new OS(i+e,n+r,o);return[{p0:a,p1:s,p2:u},{p0:a.clone(),p1:u.clone(),p2:c}]}var u_="not_implement",c_=function(){function t(t){this.onCreate(t)}return t.prototype.onCreate=function(t){throw Error(u_)},t.prototype.getIntegrateValue=function(t,e,r){throw Error(u_)},t.prototype.getIntegrateByTime=function(t,e){throw Error(u_)},t.prototype.getValue=function(t){throw Error(u_)},t.prototype.toUniform=function(t){throw Error(u_)},t.prototype.map=function(t){throw Error(u_)},t.prototype.scaleXCoord=function(t){return this},t}(),l_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.onCreate=function(t){this.value=t},e.prototype.getIntegrateValue=function(t,e,r){return this.value*(e-t)},e.prototype.getIntegrateByTime=function(t,e){return.5*this.value*(e*e-t*t)},e.prototype.getValue=function(t){return this.value},e.prototype.toUniform=function(){return new Float32Array([0,this.value,0,0])},e.prototype.map=function(t){var e=this.value;return this.value=t(e),this},e}(c_),h_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.onCreate=function(t){this.items=t},e.prototype.getValue=function(t){var e=this.items;return e[Math.floor(Math.random()*e.length)]},e.prototype.map=function(t){return this.items=this.items.map(t),this},e}(c_),f_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1]},e.prototype.getValue=function(t){return U_(this.min,this.max)},e.prototype.toUniform=function(){return new Float32Array([4,this.min,this.max,0])},e.prototype.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e}(c_),p_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1]},e.prototype.getValue=function(t){for(var e=this.min,r=this.max,i=[],n=0;n<e.length;n++){var o=Math.random();i[n]=e[n]*(1-o)+r[n]*o}return i},e.prototype.map=function(t){return this.min=this.min.map(t),this.max=this.max.map(t),this},e}(c_),d_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.onCreate=function(t){this.min=t[0],this.max=t[1],this.xCoord=1},e.prototype.getValue=function(t){return t/=this.xCoord,this.min*(1-t)+this.max*t},e.prototype.toUniform=function(){return new Float32Array([1,this.min,this.max,this.xCoord])},e.prototype.getIntegrateValue=function(t,e,r){void 0===r&&(r=1);var i=this.min,n=this.max,o=this.xCoord*r;return((i+e/o*(n-i)+i)*e-(i+t/o*(n-i)+i)*t)/2},e.prototype.getIntegrateByTime=function(t,e){return b_(e,0,this.xCoord,this.min,this.max)-b_(t,0,this.xCoord,this.min,this.max)},e.prototype.map=function(t){return this.min=t(this.min),this.max=t(this.max),this},e.prototype.scaleXCoord=function(t){return this.xCoord=t,this},e}(c_),m_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.onCreate=function(t){this.stops=Xb(t)},e.prototype.getStops=function(){return this.stops},e.prototype.getValue=function(t){for(var e=this.stops,r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1];if(n.stop<=t&&o.stop>t){var a=(t-n.stop)/(o.stop-n.stop);return Yb(n.color,o.color,a,!0)}}return e[r].color.slice()},e}(c_),v_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.getAllData=function(t,e){for(var r=new(e?WS:Float32Array)(4*t.index),i=0,n=0,o=t.curves;i<o.length;i++){var a=o[i].toData();r.set(a,n),n+=a.length}return e?r.data:r},e.prototype.onCreate=function(t){var e=1/0,r=-1/0;if(Number.isFinite(t[0])&&Number.isFinite(t[1])){for(var i=[],n=2;n<t.length;n++)i.push(t[n].slice(0,4));this.keys=i,this.min=t[0],this.dist=t[1]-t[0]}else{i=t.map((function(t){if(N_(t))return e=Math.min(e,t[1]),r=Math.max(r,t[1]),t.slice(0,4);if("object"==typeof t&&t){var i=t,n=i.time,o=i.value,a=i.inTangent,s=void 0===a?0:a,u=i.outTangent,c=void 0===u?0:u;return e=Math.min(e,o),r=Math.max(r,o),[n,o,s,c]}throw new Error("invalid keyframe")}));var o=r-e;if(this.keys=i,0!==o)for(n=0;n<i.length;n++){var a=i[n];a[1]=(a[1]-e)/o}var s=i[0];s[0]>0&&(s[2]=0,i.unshift([0,s[1],0,0]));var u=i[i.length-1];u[0]<1&&(u[3]=0,i.push([1,u[1],0,0])),this.min=e,this.dist=o}this.isCurveValue=!0},e.prototype.getValue=function(t){var e=this,r=e.keys,i=e.min,n=e.dist,o=r;if(t<=o[0][0])return o[0][1]*n+i;for(var a=o.length-1,s=0;s<a;s++){var u=o[s],c=o[s+1];if(t>u[0]&&t<=c[0])return S_(t,u,c)*n+i}return o[a][1]*n+i},e.prototype.getIntegrateByTime=function(t,e){var r=this.integrate(e,!0)-this.integrate(t,!0);return.5*this.min*(e-t)*(e-t)+r*this.dist},e.prototype.getIntegrateValue=function(t,e,r){r=r||1;var i=(this.integrate(e/r,!1)-this.integrate(t/r,!1))*r,n=(e-t)/r;return this.min*n+i*this.dist},e.prototype.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,o=e?R_:__,a=0;a<n;a++){var s=r[a],u=r[a+1],c=s[0],l=u[0];if(t>c&&t<=l)return i+o(t,s,u);i+=o(l,s,u)}return i},e.prototype.toData=function(){for(var t=this.keys,e=new Float32Array(4*t.length),r=0,i=0;r<t.length;r++,i+=4)e.set(t[r],i);return e},e.prototype.toUniform=function(t){var e=t.index,r=this.keys;return t.curves.push(this),t.index+=r.length,t.max=Math.max(t.max,r.length),t.curveCount+=r.length,new Float32Array([2,e+1/r.length,this.min,this.dist])},e.prototype.map=function(t){return this.keys.forEach((function(e){e[1]=t(e[1])})),this},e.prototype.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(c_),y_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.onCreate=function(t){this.keys=t.map((function(t){return t.slice?t.slice(0,2):[t.time,t.value]})).sort((function(t,e){return t[0]-e[0]}));var e=this.keys[this.keys.length-1];e[0]<1&&this.keys.push([1,e[1]]);var r=this.keys[0];r[0]>0&&this.keys.unshift([0,r[1]]),this.isLineSeg=!0},e.prototype.getValue=function(t){var e=this.keys;if(t<e[0][0])return e[0][1];for(var r=e.length-1,i=0;i<r;i++){var n=e[i],o=e[i+1],a=n[0],s=o[0];if(t>=a&&t<=s){var u=(t-a)/(s-a),c=n[1];return c+u*(o[1]-c)}}return e[r][1]},e.prototype.getIntegrateValue=function(t,e,r){return void 0===r&&(r=1),(this.integrate(e,!1)-this.integrate(t,!1))*r},e.prototype.getIntegrateByTime=function(t,e){return this.integrate(e,!0)-this.integrate(t,!0)},e.prototype.integrate=function(t,e){var r=this.keys;if(t<=r[0][0])return 0;for(var i=0,n=r.length-1,o=e?b_:A_,a=0;a<n;a++){var s=r[a],u=r[a+1],c=s[0],l=u[0];if(t>c&&t<=l)return i+o(t,c,l,s[1],u[1]);i+=o(l,c,l,s[1],u[1])}return i},e.prototype.toData=function(){for(var t=this.keys,e=new Float32Array(4*Math.ceil(t.length/2)),r=0,i=0;r<t.length;r++,i+=2)e.set(t[r],i);return e.set(t[t.length-1],e.length-2),e},e.prototype.toUniform=function(t){var e=t.index,r=this.keys,i=Math.ceil(r.length/2);return t.lineSegCount+=i,t.curves.push(this),t.index+=i,t.max=Math.max(t.max,i),new Float32Array([3,e,i,0])},e.prototype.map=function(t){return this.keys.forEach((function(e){return e[1]=t(e[1])})),this},e.prototype.scaleXCoord=function(t){return this.keys.forEach((function(e){return e[0]=t*e[0]})),this},e}(c_),g_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.onCreate=function(t){this.keys=t[0],this.values=t[1]},e.prototype.getValue=function(t){for(var e=this.keys,r=this.values,i=0;i<e.length-1;i++){var n=e[i],o=e[i+1];if(n[0]<=t&&o[0]>=t){var a=o[1]-n[1],s=void 0;if(0===a)s=(t-n[0])/(o[0]-n[0]);else s=(S_(t,n,o)-n[1])/a;return this.calculateVec(i,s)}}return t<=e[0][0]?r[0].slice():r[r.length-1].slice()},e.prototype.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=[0,0,0],o=0;o<r.length;o++)n[o]=r[o]*(1-e)+i[o]*e;return n},e}(c_),x_=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.onCreate=function(e){t.prototype.onCreate.call(this,e),this.cps=e[2]},e.prototype.calculateVec=function(t,e){for(var r=this.values[t],i=this.values[t+1],n=this.cps[t+t],o=this.cps[t+t+1],a=[0,0,0],s=1-e,u=s*s*s,c=3*e*s*s,l=3*e*e*s,h=e*e*e,f=0;f<r.length;f++)a[f]=u*r[f]+c*n[f]+l*o[f]+h*i[f];return a},e}(g_),T_=((r_={})[iS.RANDOM]=function(t){return t[0]instanceof Array?new p_(t):new f_(t)},r_[iS.CONSTANT]=function(t){return new l_(t)},r_[iS.CONSTANT_VEC2]=function(t){return new l_(t)},r_[iS.CONSTANT_VEC3]=function(t){return new l_(t)},r_[iS.CONSTANT_VEC4]=function(t){return new l_(t)},r_[iS.CURVE]=function(t){return new v_(t)},r_[iS.RGBA_COLOR]=function(t){return new l_(t)},r_[iS.COLORS]=function(t){return new h_(t.map((function(t){return Gb(t,!1)})))},r_[iS.LINE]=function(t){return 2===t.length&&0===t[0][0]&&1===t[1][0]?new d_([t[0][1],t[1][1]]):new y_(t)},r_[iS.GRADIENT_COLOR]=function(t){return new m_(t)},r_[iS.LINEAR_PATH]=function(t){return new g_(t)},r_[iS.BEZIER_PATH]=function(t){return new x_(t)},r_);function E_(t){if(!t||!isNaN(+t))return new l_(t||0);if(t instanceof c_)return t;if(D_(T_[t[0]]))return T_[t[0]](t[1]);throw new Error("ValueType: ".concat(t[0]," is not support"))}function A_(t,e,r,i,n){var o=t-e;return(i+i+(n-i)*o/(r-e))*o/2}function b_(t,e,r,i,n){var o=t*t,a=e*e;return(2*(o*t)*(i-n)+3*o*(e*n-r*i)-a*e*(2*i+n)+3*a*r*i)/(6*(e-r))}function S_(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=(t-e[0])/i,s=a*a,u=s*a,c=u-2*s+a,l=u-s,h=-2*u+3*s;return(2*u-3*s+1)*e[1]+c*n+l*o+h*r[1]}function __(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=e[0],s=e[1],u=r[1],c=a-t,l=c*c,h=l*c;return(n+o+2*s-2*u)*h*c/(4*i*i*i)+(2*n+o+3*s-3*u)*h/(3*i*i)+n*l/2/i-s*c}function R_(t,e,r){var i=r[0]-e[0],n=e[3]*i,o=r[2]*i,a=e[0],s=e[1],u=r[1],c=a-t,l=c*c,h=l*c,f=i*i,p=f*i;return(-30*p*s*(a+t)*c+10*f*n*(a+2*t)*l+5*i*(a+3*t)*(2*n+o+3*s-3*u)*h+3*(a+4*t)*(n+o+2*s-2*u)*h*c)/60/p}function C_(t,e){if(e){var r=e[0],i=e[1];if(r===iS.CURVE){t.curves.push(i);var n=i.length;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++,t.index+=n,t.max=Math.max(t.max,n),t.curveCount+=n}else if(r===iS.LINE){if(2===(n=i.length)&&0===i[0][0]&&1===i[1][0])return;i[0][0]>0&&n++,i[i.length-1][0]<1&&n++;var o=Math.ceil(n/2);t.lineSegCount+=o,t.curves.push(i),t.index+=o,t.max=Math.max(t.max,o)}}}function O_(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var w_,M_=new VS,I_=new OS(1,1,1),L_=new OS(0,0,0),P_=function(){function t(t,e){var r,i=t.positionOverLifetime,n=void 0===i?{}:i,o=e.transform,a=e.duration,s=e.endBehavior,u=o.scale;this.transform=o,this.basicTransform={position:o.position.clone(),rotation:o.getRotation(),scale:u},n.path&&(this.basicTransform.path=E_(n.path)),this.positionOverLifetime=n,this.options={startSpeed:n.startSpeed||0,startSize:u&&u.x||1,sizeAspect:u&&u.x/(u.y||1)||1,startColor:[1,1,1,1],duration:a||0,looping:s&&s===oS.loop,gravity:OS.fromArray(n.gravity||[]),gravityModifier:E_(null!==(r=n.gravityOverLifetime)&&void 0!==r?r:0),direction:n.direction?OS.fromArray(n.direction).normalize():new OS,endBehavior:s||0};var c=t.sizeOverLifetime;c&&(c.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=E_(c.x||1),this.sizeYOverLifetime=E_(c.y||1),this.sizeZOverLifetime=E_(c.z||1)):this.sizeXOverLifetime=E_(c.size||1));var l=n.linearX||n.linearY||n.linearZ;l&&(this.linearVelOverLifetime={x:n.linearX&&E_(n.linearX),y:n.linearY&&E_(n.linearY),z:n.linearZ&&E_(n.linearZ),asMovement:n.asMovement,enabled:!!l});var h=n.orbitalX||n.orbitalY||n.orbitalZ;h&&(this.orbitalVelOverLifetime={x:n.orbitalX&&E_(n.orbitalX),y:n.orbitalY&&E_(n.orbitalY),z:n.orbitalZ&&E_(n.orbitalZ),center:KS(n.orbCenter),asRotation:n.asRotation,enabled:!!h}),this.speedOverLifetime=n.speedOverLifetime&&E_(n.speedOverLifetime);var f=t.rotationOverLifetime;if(f&&(this.rotationOverLifetime={asRotation:f.asRotation,separateAxes:f.separateAxes,z:E_(f.z||0)},f.separateAxes)){var p=this.rotationOverLifetime;p.x=E_(f.x||0),p.y=E_(f.y||0)}this.gravityModifier=this.options.gravityModifier}return t.prototype.getVelocity=function(){return this.velocity||(this.velocity=this.options.direction.clone().multiply(this.options.startSpeed)),this.velocity},t.prototype.willTranslate=function(){return!!(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled||this.orbitalVelOverLifetime&&this.orbitalVelOverLifetime.enabled||this.options.gravityModifier&&!this.options.gravity.isZero()||this.options.startSpeed&&!this.options.direction.isZero())},t.prototype.updatePosition=function(t,e,r){this.basicTransform.position.set(t,e,r)},t.prototype.updateRotation=function(t,e,r){this.basicTransform.rotation.set(t,e,r)},t.prototype.getRenderData=function(t,e){var r,i,n=this.options,o=I_.setFromNumber(1),a=M_.set(0,0,0),s=t<0?t:Math.max(t,0),u=n.duration,c=s/u,l={life:c,transform:this.transform,startSize:this.basicTransform.scale.clone()},h=this.basicTransform;c=c<0?0:c>1?1:c,this.sizeXOverLifetime&&(o.x=this.sizeXOverLifetime.getValue(c),this.sizeSeparateAxes?(o.y=this.sizeYOverLifetime.getValue(c),o.z=this.sizeZOverLifetime.getValue(c)):o.z=o.y=o.x,r=!0),(r||e)&&l.transform.setScale(o.x,o.y,o.z);var f,p=this.rotationOverLifetime;if(p){var d=function(t){return p.asRotation?t.getValue(c):t.getIntegrateValue(0,c,u)},m=d(p.z),v=p.separateAxes;a.x=v?d(p.x):0,a.y=v?d(p.y):0,a.z=m,i=!0}if(i||e){var y=M_.addEulers(h.rotation,a);l.transform.setRotation(y.x,y.y,y.z)}(this.willTranslate()||e)&&(f=QS(I_.setFromNumber(0),this,n.gravity,s,u,h.position,this.getVelocity()));if(h.path&&(f||(f=L_.copyFrom(h.position)),f.add(h.path.getValue(c))),f&&l.transform.setPosition(f.x,f.y,f.z),l.startSize){var g=l.transform.scale;l.transform.setScale(g.x*l.startSize.x,g.y*l.startSize.y,g.z*l.startSize.z)}return l},t}();function F_(){}function V_(t){return"string"==typeof t}t.DestroyOptions=void 0,(w_=t.DestroyOptions||(t.DestroyOptions={}))[w_.destroy=0]="destroy",w_[w_.keep=1]="keep",w_[w_.force=0]="force";var N_=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function D_(t){return"[object Function]"===Object.prototype.toString.call(t)}function z_(t){return"[object Object]"===Object.prototype.toString.call(t)}function U_(t,e){return t+Math.random()*(e-t)}function B_(){throw Error("destroyed item cannot be used again")}var k_,G_=new wS,j_=1,X_=function(){function t(t,e){void 0===t&&(t={}),this.position=new OS(0,0,0),this.quat=new wS(0,0,0,1),this.rotation=new VS(0,0,0),this.scale=new OS(1,1,1),this.anchor=new OS(0,0,0),this.children=[],this.worldMatrix=LS.fromIdentity(),this.localMatrix=LS.fromIdentity(),this.valid=!1,this.dirtyFlags={localData:!1,localMatrix:!1,worldMatrix:!1,parentMatrix:!1},this.worldTRSCache={position:new OS(0,0,0),quat:new wS(0,0,0,1),scale:new OS(1,1,1)},this.name="transform_".concat(j_++),t&&this.setTransform(t),e&&(this.parentTransform=e),void 0!==t.valid&&this.setValid(t.valid)}return t.getRotation=function(t,e){var r=G_.copyFrom(t);return r.conjugate(),e.setFromQuaternion(r)},Object.defineProperty(t.prototype,"parentTransform",{get:function(){return this.parent},set:function(t){t&&this.parent!==t&&this!==t&&(this.parent&&this.parent.removeChild(this),t.addChild(this),this.parent=t,this.parentMatrixDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parentMatrixDirty",{get:function(){return this.dirtyFlags.parentMatrix},set:function(t){this.dirtyFlags.parentMatrix!==t&&(this.dirtyFlags.parentMatrix=t,this.dispatchValueChange())},enumerable:!1,configurable:!0}),t.prototype.setPosition=function(t,e,r){this.position.x===t&&this.position.y===e&&this.position.z===r||(this.position.x=t,this.position.y=e,this.position.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.translate=function(t,e,r){0===t&&0===e&&0===r||(this.position.x+=t,this.position.y+=e,this.position.z+=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.setRotation=function(t,e,r){this.rotation.x===t&&this.rotation.y===e&&this.rotation.z===r||(this.rotation.x=t,this.rotation.y=e,this.rotation.z=r,this.quat.setFromEuler(this.rotation),this.quat.conjugate(),this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.setQuaternion=function(t,e,r,i){this.quat.x===t&&this.quat.y===e&&this.quat.z===r&&this.quat.w===i||(this.quat.x=t,this.quat.y=e,this.quat.z=r,this.quat.w=i,this.rotation.setFromQuaternion(this.quat),this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.setScale=function(t,e,r){this.scale.x===t&&this.scale.y===e&&this.scale.z===r||(this.scale.x=t,this.scale.y=e,this.scale.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.rotateByQuat=function(t){this.quat.multiply(t),this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.scaleBy=function(t,e,r){this.scale.x*=t,this.scale.y*=e,this.scale.z*=r,this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.setAnchor=function(t,e,r){this.anchor.x===t&&this.anchor.y===e&&this.anchor.z===r||(this.anchor.x=t,this.anchor.y=e,this.anchor.z=r,this.dirtyFlags.localData=!0,this.dispatchValueChange())},t.prototype.setTransform=function(t,e){var r,i=t.position,n=t.rotation,o=t.scale,a=t.quat,s=t.name,u=t.anchor;if(s&&(this.name=s),i&&(i instanceof OS?this.setPosition(i.x,i.y,i.z):this.setPosition(i[0],i[1],i[2])),a)a instanceof wS?this.setQuaternion(a.x,a.y,a.z,a.w):this.setQuaternion(a[0],a[1],a[2],a[3]);else if(n){var c=e?-1:1;n instanceof VS?this.setRotation(n.x*c,n.y*c,n.z*c):this.setRotation(n[0]*c,n[1]*c,n[2]*c)}o&&(o instanceof OS?this.setScale(o.x,o.y,o.z):this.setScale(o[0],o[1],o[2])),u&&(u instanceof OS?this.setAnchor(u.x,u.y,u.z):this.setAnchor(u[0],u[1],null!==(r=u[2])&&void 0!==r?r:0))},t.prototype.addChild=function(t){zb(this.children,t)},t.prototype.removeChild=function(t){Ub(this.children,t)},t.prototype.getRotation=function(){return t.getRotation(this.quat,new VS)},t.prototype.getQuaternion=function(){return this.quat},t.prototype.updateLocalMatrix=function(){this.valid?(this.dirtyFlags.localData&&(this.localMatrix.compose(this.position,this.quat,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):this.localMatrix.isIdentity()||(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0)},t.prototype.getMatrix=function(){return this.updateLocalMatrix(),this.localMatrix},t.prototype.getParentMatrix=function(){return this.parent&&(this.parentMatrix=this.parent.getWorldMatrix(),this.dirtyFlags.parentMatrix=this.dirtyFlags.parentMatrix||this.parent.dirtyFlags.localMatrix||this.parent.dirtyFlags.worldMatrix),this.parentMatrix},t.prototype.getWorldMatrix=function(){var t=this.getMatrix(),e=this.getParentMatrix();return(this.dirtyFlags.localMatrix||this.dirtyFlags.parentMatrix)&&(e?this.worldMatrix.multiplyMatrices(e,t):this.worldMatrix.copyFrom(t),this.dirtyFlags.worldMatrix=!0,this.dirtyFlags.localMatrix=!1,this.dirtyFlags.parentMatrix=!1),this.worldMatrix},t.prototype.getWorldScale=function(){var t=this.worldTRSCache;this.dirtyFlags.worldMatrix&&(this.getWorldMatrix().decompose(t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1);return this.worldTRSCache.scale.clone()},t.prototype.getWorldPosition=function(){return this.updateTRSCache(),this.worldTRSCache.position.clone()},t.prototype.getWorldRotation=function(){return this.updateTRSCache(),t.getRotation(this.worldTRSCache.quat,new VS)},t.prototype.assignWorldTRS=function(t,e,r){this.updateTRSCache(),t&&t.copyFrom(this.worldTRSCache.position),e&&e.copyFrom(this.worldTRSCache.quat),r&&r.copyFrom(this.worldTRSCache.scale)},t.prototype.cloneFromMatrix=function(t,e){t.decompose(this.position,this.quat,this.scale),e&&e.copyFrom(this.scale),this.dirtyFlags.localData=!0,this.dispatchValueChange()},t.prototype.setValid=function(t){this.valid!==t&&(this.valid=t,t?this.dirtyFlags.localData=!0:(this.localMatrix.identity(),this.dirtyFlags.localMatrix=!0),this.dispatchValueChange())},t.prototype.getValid=function(){return this.valid},t.prototype.dispose=function(){},t.prototype.updateTRSCache=function(){var t=this.getWorldMatrix();if(this.dirtyFlags.worldMatrix){var e=this.worldTRSCache;t.decompose(e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1}},t.prototype.dispatchValueChange=function(){this.children.forEach((function(t){t.parentMatrixDirty=!0}))},t}(),Y_=function(){function t(t,e){this._v_priority=0,this.visible=!0,this._contentVisible=!1,this.timeInms=0,this.time=0,this._frozen=!1;var r=t.id,i=t.name,n=t.delay,o=t.parentId,a=t.endBehavior,s=t.transform,u=t.listIndex,c=void 0===u?0:u,l=t.duration,h=void 0===l?0:l;if(this.composition=e,this.id=r,this.name=i,this.delay=n,this.transform=new X_(rb({name:this.name},s),e.transform),this.parentId=o,this.duration=h,this.delayInms=1e3*(n||0),this.durInms=1e3*this.duration,this.endBehavior=a,this.lifetime=-this.delayInms/this.durInms,this.listIndex=c,this.speed=1,this.onConstructed(t),h<=0)throw Error("Item duration can't be less than 0, see ".concat(mb["Item duration can't be less than 0"]))}return t.isComposition=function(t){return t.type===wb.composition},t.isSprite=function(t){return t.type===wb.sprite},t.isParticle=function(t){return t.type===wb.particle},t.isFilterSprite=function(t){return t.type===wb.filter},t.isNull=function(t){return t.type===wb.null},t.isTree=function(t){return t.type===wb.tree},t.isExtraCamera=function(t){return"extra-camera"===t.id&&"extra-camera"===t.name},Object.defineProperty(t.prototype,"contentVisible",{get:function(){return this._contentVisible&&this.visible},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"content",{get:function(){return this._content},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reusable",{get:function(){var t,e;return null!==(e=null===(t=this.composition)||void 0===t?void 0:t.reusable)&&void 0!==e&&e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return wb.base},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"frozen",{get:function(){return this._frozen},set:function(t){this.handleFrozenChanged(this._frozen=!!t)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lifetimeStarted",{get:function(){return this.started&&!this.delaying},enumerable:!1,configurable:!0}),t.prototype.setSpeed=function(t){this.speed=t},t.prototype.getSpeed=function(){return this.speed},t.prototype.start=function(){this.started&&!this.ended||(this.started=!0,this.delaying=!0,this.timeInms=0,this.time=0,this.callEnd=!1,this.ended=!1)},t.prototype.stop=function(){this.doStop(),this.started=!1},t.prototype.doStop=function(){this._content&&this._content.stop&&this._content.stop()},t.prototype.createContent=function(){return this._content||(this._content=this.doCreateContent(this.composition)),this._content},t.prototype.doCreateContent=function(t){},t.prototype.onConstructed=function(t){},t.prototype.onUpdate=function(t){var e,r;if(this.started&&!this.frozen&&this.composition){var i=t*this.speed,n=this.timeInms+=i;this.time+=i/1e3;var o=n-this.delayInms;if(this.delaying&&o>=0&&(this.delaying=!1,this.transform.setValid(!0),this.createContent(),this.onLifetimeBegin(this.composition,this.content),this.composition.itemLifetimeEvent(this,!0)),!this.delaying){var a=o/this.durInms,s=this.isEnded(o),u=!0;if(this.transform.setValid(!0),s)if(u=!1,this.callEnd||(this.callEnd=!0,this.composition.itemLifetimeEvent(this,!1),this.onEnd()),2!==this.endBehavior&&5!==this.endBehavior){if(this.ended=!0,this.transform.setValid(!1),1===this.endBehavior||3===this.endBehavior?null===(r=(e=this.composition).handlePlayerPause)||void 0===r||r.call(e,this):4===this.endBehavior&&(this.transform.setValid(!0),u=!0,a=1,i=0),this.reusable)0===this.endBehavior&&this.setVisible(!1);else{if(0===this.endBehavior||3===this.endBehavior||6===this.endBehavior)return this.dispose();1===this.endBehavior&&(this.endBehavior=2)}a=Math.min(a,1)}else u=!0,5===this.endBehavior&&(this.ended=!0,a%=1);else this.callEnd&&this.reusable&&(this.setVisible(!0),this.callEnd=!1);this.lifetime=a,u&&this.onItemUpdate(i,a)}}},t.prototype.onItemRemoved=function(t,e){},t.prototype.onItemUpdate=function(t,e){},t.prototype.onLifetimeBegin=function(t,e){},t.prototype.onEnd=function(){},t.prototype.setColor=function(t,e,r,i){},t.prototype.setOpacity=function(t){},t.prototype.getVisible=function(){return this.visible},t.prototype.setVisible=function(t){this.visible!==t&&(this.visible=!!t,this.handleVisibleChanged(this.visible))},t.prototype.handleVisibleChanged=function(t){},t.prototype.handleFrozenChanged=function(t){},t.prototype.getWorldTransform=function(t){var e=null!=t?t:new X_({valid:!0});return e.cloneFromMatrix(this.transform.getWorldMatrix()),e},t.prototype.getNodeTransform=function(t){return this.transform},t.prototype.translate=function(t,e,r){this.transform.translate(t,e,r)},t.prototype.rotate=function(t,e,r){var i=new VS(t,e,r),n=wS.fromEuler(i);n.conjugate(),this.transform.rotateByQuat(n)},t.prototype.scale=function(t,e,r){this.transform.scaleBy(t,e,r)},t.prototype.setPositionByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,o=i.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.setPosition(2*t*n/a,-2*e*o/s,r)}},t.prototype.setPosition=function(t,e,r){this.transform.setPosition(t,e,r)},t.prototype.setRotation=function(t,e,r){this.transform.setRotation(t,e,r)},t.prototype.setScale=function(t,e,r){this.transform.setScale(t,e,r)},t.prototype.getBoundingBox=function(){},t.prototype.getHitTestParams=function(t){},t.prototype.getRenderData=function(){return{transform:this.transform,life:0,visible:this.visible}},t.prototype.getCurrentPosition=function(){var t=new OS;return this.transform.assignWorldTRS(t),t},t.prototype.isEnded=function(t){return t-this.durInms>.001},t.prototype.reset=function(){this.composition&&(this.onItemRemoved(this.composition,this._content),this._content=void 0),this.started=!1},t.prototype.translateByPixel=function(t,e){if(this.composition){var r=this.transform.getWorldPosition().z,i=this.composition.camera.getInverseVPRatio(r),n=i.x,o=i.y,a=this.composition.renderer.getWidth()/2,s=this.composition.renderer.getHeight()/2;this.transform.translate(2*t*n/a,-2*e*o/s,0)}},t.prototype.dispose=function(){this.composition&&(this.composition.destroyItem(this),this.reset(),this.onUpdate=function(){return-1},this.composition=null,this.transform.setValid(!1))},t}();function W_(t,e){var r=t.type,i=t.pluginName;if(!i)switch(r){case wb.null:case wb.base:i="cal";break;case wb.sprite:i="sprite";break;case wb.particle:i="particle";break;case wb.interact:i="interact";break;case wb.camera:i="camera";break;case wb.filter:i="filter";break;case wb.text:i="text";break;case wb.tree:i="tree";break;default:throw new Error("invalid vfx item type")}return e.pluginSystem.createPluginItem(i,t,e)}t.Item=void 0,(k_=t.Item||(t.Item={})).is=function(t,e){return t.type===e},k_.isFilter=function(t){return t.type===wb.filter},k_.isComposition=function(t){return t.type===wb.composition},k_.isParticle=function(t){return t.type===wb.particle},k_.isNull=function(t){return t.type===wb.null};var H_={},Z_=[],q_={};function Q_(t,e,r,i){q_[t]=r,H_[t]=e,i&&zb(Z_,t)}var K_,J_=function(){function t(t){var e={},r=[],i=function(t){var i=H_[t];r.includes(i)||(r.push(i),e[t]=i)};Z_.forEach(i),t.forEach(i),this.plugins=Object.keys(e).map((function(t){var e=H_[t];if(!e)throw new Error("plugin '".concat(t,"' not found"));var r=new e;return r.name=t,r})).sort((function(t,e){return t.order-e.order}))}return t.prototype.initializeComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionConstructed(t,e)}))},t.prototype.destroyComposition=function(t){this.plugins.forEach((function(e){return e.onCompositionDestroyed(t)}))},t.prototype.resetComposition=function(t,e){this.plugins.forEach((function(r){return r.onCompositionReset(t,e)}))},t.prototype.createPluginItem=function(t,e,r){var i=q_[t];if(!i)throw new Error("plugin ".concat(t," no registered constructor"));var n=new i(e,r);if(!(n instanceof Y_))throw new Error("plugin ".concat(t," invalid constructor type"));return n},t.prototype.processRawJSON=function(t,e){return ib(this,void 0,void 0,(function(){return nb(this,(function(r){return[2,this.callStatic("processRawJSON",t,e)]}))}))},t.prototype.callStatic=function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return ib(this,void 0,void 0,(function(){var r,i,n,o,a;return nb(this,(function(s){for(r=[],i=this.plugins,n=0;n<i.length;n++)o=i[n],a=H_[o.name],t in a&&r.push(Promise.resolve(a[t].apply(a,sb([],ab(e),!1))));return[2,Promise.all(r)]}))}))},t.prototype.precompile=function(t,e,r){return ib(this,void 0,void 0,(function(){return nb(this,(function(i){return[2,this.callStatic("precompile",t,e,r)]}))}))},t.prototype.loadResources=function(t,e){return ib(this,void 0,void 0,(function(){return nb(this,(function(r){return[2,this.callStatic("prepareResource",t,e)]}))}))},t}(),$_=function(){function t(){this.order=100,this.name=""}return t.precompile=function(t,e){return Promise.resolve()},t.prototype.onCompositionConstructed=function(t,e){},t.prototype.onCompositionItemLifeBegin=function(t,e){},t.prototype.onCompositionItemLifeEnd=function(t,e){},t.prototype.onCompositionItemRemoved=function(t,e){},t.prototype.onCompositionReset=function(t,e){},t.prototype.onCompositionWillReset=function(t,e){},t.prototype.onCompositionDestroyed=function(t){},t.prototype.onCompositionUpdate=function(t,e){},t.prototype.prepareRenderFrame=function(t,e){return!1},t.prototype.postProcessFrame=function(t,e){},t}(),tR=function(){function t(t,e){this.transform=t;var r=t.position,i=t.getRotation(),n=e.options,o=n.near,a=n.far,s=n.fov,u=n.clipMode;if(this.clipMode=u,this.options={position:r.clone(),rotation:i.clone(),near:E_(o),far:E_(a),fov:E_(s)},e.positionOverLifetime){var c=e.positionOverLifetime,l=c.path,h=c.linearX,f=void 0===h?0:h,p=c.linearY,d=void 0===p?0:p,m=c.linearZ,v=void 0===m?0:m;this.translateOverLifetime={path:l&&E_(l),x:E_(f),y:E_(d),z:E_(v)}}if(e.rotationOverLifetime){var y=e.rotationOverLifetime,g=y.separateAxes,x=y.x,T=void 0===x?0:x,E=y.y,A=void 0===E?0:E,b=y.z,S=void 0===b?0:b;this.rotationOverLifetime={separateAxes:g,x:E_(T),y:E_(A),z:E_(S)}}}return t.prototype.update=function(t){var e=new wS,r=new OS,i=new VS;r.copyFrom(this.options.position),i.copyFrom(this.options.rotation);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(t=_S(t,0,1),n&&(r.x+=n.x.getValue(t),r.y+=n.y.getValue(t),r.z+=n.z.getValue(t),n.path)){var a=n.path.getValue(t);r.x+=a[0],r.y+=a[1],r.z+=a[2]}if(o){var s=o.z.getValue(t);i.z+=s,o.separateAxes?(i.x+=o.x.getValue(t),i.y+=o.y.getValue(t)):(i.x+=s,i.y+=s)}this.far=this.options.far.getValue(t),this.near=this.options.near.getValue(t),this.fov=this.options.fov.getValue(t),this.transform.setPosition(r.x,r.y,r.z),this.transform.setRotation(i.x,i.y,i.z),this.transform.assignWorldTRS(r,e),this.position=r,this.rotation=X_.getRotation(e,i)},t}(),eR=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e}($_),rR=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),Object.defineProperty(e.prototype,"type",{get:function(){return wb.camera},enumerable:!1,configurable:!0}),e.prototype.onConstructed=function(t){this.model=t.content},e.prototype.onItemUpdate=function(t,e){var r;null===(r=this.controller)||void 0===r||r.update(e),this.updateCamera()},e.prototype.updateCamera=function(){if(this.controller&&this.composition){var t=this.composition.camera;t.near=this.controller.near,t.far=this.controller.far,t.fov=this.controller.fov,t.clipMode=this.controller.clipMode,t.position=this.controller.position,t.rotation=this.controller.rotation}},e.prototype.getCurrentPosition=function(){return this.controller.position},e.prototype.doCreateContent=function(){return this.controller||(this.controller=new tR(this.transform,this.model)),this.controller},e}(Y_);t.HitTestType=void 0,(K_=t.HitTestType||(t.HitTestType={}))[K_.triangle=1]="triangle",K_[K_.box=2]="box",K_[K_.sphere=3]="sphere",K_[K_.custom=4]="custom";var iR,nR,oR="click",aR="touchstart",sR="touchmove",uR="touchend",cR=Ob,lR=function(){function t(t,e){void 0===e&&(e=!1),this.target=t,this.allowPropagation=e,this.enabled=!0,this.handlers={},this.nativeHandlers={}}return t.prototype.bindListeners=function(){var t,e,r,i,n,o,a=this;o=function(t){return t};var s="mousedown",u="mousemove",c="mouseup",l=function(t,e,r,i,o){void 0===i&&(i=0),void 0===o&&(o=0);var s=a.target,u=s.width,c=s.height,l=performance.now(),h=0,f=0;if(n){var p=l-n.ts;h=(i-n.dx)/p||0,f=(o-n.dy)/p||0,n={dx:i,dy:o,ts:l}}return{x:e,y:r,vx:h,vy:f,dx:i,dy:o,ts:l,width:u,height:c,origin:t}};Zb()&&(o=function(t){var e=t,r=e.touches,i=e.changedTouches;return r[0]||i[0]},s="touchstart",u="touchmove",c="touchend"),this.nativeHandlers=((t={})[s]=function(t){if(a.enabled){var s=o(t),u=hR(s);e=u.x,r=u.y,n=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:e,y:r},a.dispatchEvent(aR,l(t,e,r))}},t[u]=function(t){if(i&&a.enabled){var n=hR(o(t));e=n.x,r=n.y,a.dispatchEvent(sR,l(t,e,r,e-i.x,r-i.y))}},t[c]=function(t){if(i&&a.enabled){!a.allowPropagation&&t.cancelable&&(t.preventDefault(),t.stopPropagation());var n=o(t),s=hR(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);e=s.x,r=s.y,u<4&&a.dispatchEvent(oR,l(t,e,r)),a.dispatchEvent(uR,l(t,e,r,e-i.x,r-i.y))}i=0},t),Object.keys(this.nativeHandlers).forEach((function(t){var e;null===(e=a.target)||void 0===e||e.addEventListener(String(t),a.nativeHandlers[t])}))},t.prototype.dispatchEvent=function(t,e){var r=this.handlers[t];null==r||r.forEach((function(t){return t(e)}))},t.prototype.addEventListener=function(t,e){var r=this.handlers[t];return r||(r=this.handlers[t]=[]),zb(r,e),function(){Ub(r,e)}},t.prototype.removeEventListener=function(t,e){var r=this.handlers[t];r&&Ub(r,e)},t.prototype.dispose=function(){var t=this;this.target&&(this.handlers={},Object.keys(this.nativeHandlers).forEach((function(e){var r;null===(r=t.target)||void 0===r||r.removeEventListener(String(e),t.nativeHandlers[e])})),this.nativeHandlers={},this.target=null)},t}();function hR(t){var e=t.target,r=t.clientX,i=t.clientY,n=e.getBoundingClientRect(),o=n.left,a=n.top;return{x:(r-o)/n.width*2-1,y:1-(i-a)/n.height*2}}function fR(t){switch(t){case Ab.ALPHA:case Ab.ADD:case Ab.SUBTRACTION:case Ab.STRONG_LIGHT:case Ab.WEAK_LIGHT:return 1;case Ab.SUPERPOSITION:return 2;case Ab.BRIGHTNESS:return 3;case Ab.MULTIPLY:return 0;default:return 1}}t.ShaderType=void 0,(iR=t.ShaderType||(t.ShaderType={}))[iR.vertex=0]="vertex",iR[iR.fragment=1]="fragment";var pR,dR,mR=((nR={})[t.ShaderType.vertex]={in:"attribute",out:"varying"},nR[t.ShaderType.fragment]={in:"varying"},nR);function vR(t,e,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),t&&(t.forEach((function(t){var e=ab(t,2),r=e[0],i=e[1];!0===i?n.push("#define ".concat(r)):Number.isFinite(i)&&n.push("#define ".concat(r," ").concat(i))})),o=n.length?n.join("\n")+"\n":"");var a="WEBGL".concat(i),s=(o+="\n#ifndef ".concat(a,"\n#define ").concat(a,"\n#endif"))+"\n"+e,u=s.match(/#version\s+\b\d{3}\b\s*(es)?/),c=u?u[0]:"";if(c&&c.includes("300")){var l=new RegExp("".concat(c),"g");1===i&&(s=s.replace(/\b(in|out)\b/g,(function(t){var e;return null!==(e=mR[r][t])&&void 0!==e?e:t}))),s=s.replace(l,"\n")}return s}function yR(t,e){switch(e){case void 0:case Ab.ALPHA:t.blendFunction=[yb.ONE,yb.ONE_MINUS_SRC_ALPHA,yb.ONE,yb.ONE_MINUS_SRC_ALPHA];break;case Ab.ADD:t.blendFunction=[yb.ONE,yb.ONE,yb.ONE,yb.ONE];break;case Ab.SUBTRACTION:t.blendFunction=[yb.ONE,yb.ONE,yb.ZERO,yb.ONE],t.blendEquation=[yb.FUNC_REVERSE_SUBTRACT,yb.FUNC_REVERSE_SUBTRACT];break;case Ab.SUPERPOSITION:t.blendFunction=[yb.ONE,yb.ONE,yb.ONE,yb.ONE];break;case Ab.MULTIPLY:t.blendFunction=[yb.DST_COLOR,yb.ONE_MINUS_SRC_ALPHA,yb.DST_COLOR,yb.ONE_MINUS_SRC_ALPHA];break;case Ab.BRIGHTNESS:t.blendFunction=[yb.ONE,yb.ONE_MINUS_SRC_ALPHA,yb.ONE,yb.ONE_MINUS_SRC_ALPHA];break;case Ab.STRONG_LIGHT:t.blendFunction=[yb.DST_COLOR,yb.DST_ALPHA,yb.ZERO,yb.ONE];break;case Ab.WEAK_LIGHT:t.blendFunction=[yb.DST_COLOR,yb.ZERO,yb.ZERO,yb.ONE];break;default:console.warn("blendMode ".concat(e," not in specification, please set blend params separately"))}}function gR(t,e){e===bb.DOUBLE?t.culling=!1:(t.culling=!0,t.frontFace=yb.CW,t.cullFace=e===bb.BACK?yb.BACK:yb.FRONT)}function xR(t,e){switch(e){case void 0:t.stencilTest=!1;break;case Sb.MASK:t.stencilTest=!0,t.stencilFunc=[yb.ALWAYS,yb.ALWAYS],t.stencilOpZPass=[yb.REPLACE,yb.REPLACE];break;case Sb.OBSCURED:t.stencilTest=!0,t.stencilFunc=[yb.EQUAL,yb.EQUAL];break;case Sb.REVERSE_OBSCURED:t.stencilTest=!0,t.stencilFunc=[yb.NOTEQUAL,yb.NOTEQUAL];break;case Sb.NONE:t.stencilTest=!1;break;default:console.warn("maskMode ".concat(e," not in specification, please set stencil params seperately"))}}t.TextureLoadAction=void 0,(pR=t.TextureLoadAction||(t.TextureLoadAction={}))[pR.whatever=0]="whatever",pR[pR.clear=2]="clear",t.TextureSourceType=void 0,(dR=t.TextureSourceType||(t.TextureSourceType={}))[dR.none=0]="none",dR[dR.data=1]="data",dR[dR.image=2]="image",dR[dR.compressed=3]="compressed",dR[dR.video=4]="video",dR[dR.canvas=5]="canvas",dR[dR.framebuffer=6]="framebuffer",dR[dR.mipmaps=7]="mipmaps";var TR=function(){function t(){this.callbacks={}}return t.prototype.downloadJSON=function(t,e,r){this.download(t,"json",e,r)},t.prototype.downloadBinary=function(t,e,r){this.download(t,"arraybuffer",e,r)},t.prototype.downloadBlob=function(t,e,r){this.download(t,"blob",e,r)},t.prototype.download=function(t,e,r,i){var n=this;if(void 0===e&&(e="json"),!this.start(t,r,i)){var o=new XMLHttpRequest,a=function(){n.finish(t,o.status,o.response)};o.responseType=e,o.addEventListener("load",(function(){200==o.status||0==o.status?n.finish(t,200,o.response):a()})),o.addEventListener("error",a),o.open("GET",t,!0),o.send()}},t.prototype.start=function(t,e,r){var i=this.callbacks[t];try{if(i)return!0;this.callbacks[t]=i=[]}finally{i.push(e,r)}},t.prototype.finish=function(t,e,r){var i=this.callbacks[t];delete this.callbacks[t];for(var n=200==e||0==e?[r]:[e,r],o=n.length-1,a=i.length;o<a;o+=2)i[o].apply(null,n)},t}(),ER=!1;function AR(t,e){return ib(this,void 0,void 0,(function(){return nb(this,(function(r){switch(r.label){case 0:return!ER&&e?[3,2]:[4,bR(t)];case 1:case 5:return[2,{image:r.sent(),url:t}];case 2:return r.trys.push([2,4,,6]),[4,bR(e)];case 3:return[2,{image:r.sent(),url:e}];case 4:return r.sent(),ER=!0,[4,bR(t)];case 6:return[2]}}))}))}function bR(t){return ib(this,void 0,void 0,(function(){var e,r;return nb(this,(function(i){if(e="",t instanceof HTMLImageElement){if(t.complete)return[2,t];e=t.src}else t instanceof Blob?(e=URL.createObjectURL(t),r=!0):"string"==typeof t&&(e=t);if(!e)throw new Error("Invalid url type: ".concat(t));return[2,new Promise((function(t,i){var n=new Image;/^data:/.test(e)||(n.crossOrigin="*"),n.onload=function(){return n.onload=null,r&&URL.revokeObjectURL(e),t(n)},n.onerror=function(t){return n.onerror=null,r&&URL.revokeObjectURL(e),i("Load image fail: ".concat(t))},n.src=e}))]}))}))}function SR(t){return ib(this,void 0,void 0,(function(){return nb(this,(function(e){return[2,new Promise((function(e,r){(new TR).downloadBinary(t,e,(function(e,i){r("Couldn't load bins ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))}function _R(t,e){return void 0===e&&(e={}),ib(this,void 0,void 0,(function(){var r;return nb(this,(function(i){return r=document.createElement("video"),"string"==typeof t?r.src=t:r.srcObject=t,r.crossOrigin="anonymous",r.muted=!0,e.loop&&r.addEventListener("ended",(function(){return r.play()})),Hb()&&r.setAttribute("renderer","standard"),r.setAttribute("playsinline","playsinline"),[2,new Promise((function(t,e){var i=r.play();i?i.then((function(){return t(r)})):r.addEventListener("loadeddata",(function e(){t(r),r.removeEventListener("loadeddata",e)}),!0),r.addEventListener("error",(function(t){e(t)}))}))]}))}))}function RR(e,r,i){return void 0===i&&(i=[]),ib(this,void 0,void 0,(function(){var n,o,a,s,u,c,l;return nb(this,(function(h){switch(h.label){case 0:return 34067!==e.target?[3,2]:(a=(n=e).mipmaps,s=n.target,u=a.map((function(t){return Promise.all(t.map((function(t){return CR(t,r)})))})),[4,Promise.all(u)]);case 1:return c=h.sent(),l=i[a[0][0][1][0]].url,[2,rb(rb({keepImageSource:!1},e),{mipmaps:c,sourceFrom:{target:s,bin:l,type:t.TextureSourceType.mipmaps,mipmaps:a.map((function(t){return t.map((function(t){return[t[1][1],t[1][2]]}))}))}})];case 2:return a=(o=e).mipmaps,s=o.target,u=a.map((function(t){return CR(t,r)})),[4,Promise.all(u)];case 3:return c=h.sent(),l=i[a[0][1][0]].url,[2,rb(rb({keepImageSource:!1},e),{mipmaps:c,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{target:s,bin:l,type:t.TextureSourceType.mipmaps,mipmaps:a.map((function(t){return[t[1][1],t[1][2]]}))}})]}}))}))}function CR(t,e){return ib(this,void 0,void 0,(function(){var r,i,n,o,a;return nb(this,(function(s){if(r=ab(t[1],3),i=r[0],n=r[1],o=r[2],!(a=e[i]))throw new Error("invalid bin pointer: ".concat(JSON.stringify(t)));return[2,bR(new Blob([new Uint8Array(a,n,o)]))]}))}))}var OR=1,wR=function(){function e(){this.destroyed=!1,this.id="Tex"+OR++}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getWidth=function(){return this.width||0},e.prototype.getHeight=function(){return this.height||0},e.prototype.uploadCurrentVideoFrame=function(){},e.prototype.offloadData=function(){},e.prototype.reloadData=function(){},e.prototype.initialize=function(){},e.prototype.assembleOptions=function(e){var r=e.target,i=void 0===r?yb.TEXTURE_2D:r,n=e.format,o=void 0===n?yb.RGBA:n;return e.sourceType||(e.sourceType="image"in e?t.TextureSourceType.image:"data"in e?t.TextureSourceType.data:"video"in e?t.TextureSourceType.video:0),rb({minFilter:yb.NEAREST,magFilter:yb.NEAREST,wrapS:yb.CLAMP_TO_EDGE,wrapT:yb.CLAMP_TO_EDGE,target:i,format:yb.RGBA,internalFormat:o,type:yb.UNSIGNED_BYTE},e)},e}();function MR(t,e,r,i){var n,o,a=e.length/r/i;return o=n=4===a||0===a?yb.RGBA:3===a?yb.RGB:2===a?yb.LUMINANCE_ALPHA:yb.LUMINANCE,wR.createWithData(t,{data:e,width:r,height:i},{type:yb.HALF_FLOAT,format:n,internalFormat:o,wrapS:yb.CLAMP_TO_EDGE,wrapT:yb.CLAMP_TO_EDGE})}var IR="galacean-effects",LR="lookup_texture",PR="offscreen_canvas",FR={};function VR(t){return FR[t]}var NR=function(){function t(t,e,r){void 0===r&&(r=0),this.arrayBuffer=t,this.baseOffset=r;var i=new Uint8Array(this.arrayBuffer,this.baseOffset,12);if(171!==i[0]||75!==i[1]||84!==i[2]||88!==i[3]||32!==i[4]||49!==i[5]||49!==i[6]||187!==i[7]||13!==i[8]||10!==i[9]||26!==i[10]||10!==i[11])throw Error("texture missing KTX identifier");var n=Uint32Array.BYTES_PER_ELEMENT,o=new DataView(this.arrayBuffer,this.baseOffset+12,13*n),a=67305985===o.getUint32(0,!0);this.glType=o.getUint32(1*n,a),this.glTypeSize=o.getUint32(2*n,a),this.glFormat=o.getUint32(3*n,a),this.glInternalFormat=o.getUint32(4*n,a),this.glBaseInternalFormat=o.getUint32(5*n,a),this.pixelWidth=o.getUint32(6*n,a),this.pixelHeight=o.getUint32(7*n,a),this.pixelDepth=o.getUint32(8*n,a),this.numberOfArrayElements=o.getUint32(9*n,a),this.numberOfFaces=o.getUint32(10*n,a),this.numberOfMipmapLevels=o.getUint32(11*n,a),this.bytesOfKeyValueData=o.getUint32(12*n,a),this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===e?0===this.glType?this.loadType=0:this.loadType=2:console.warn({content:"number of faces expected"+e+", but found "+this.numberOfFaces,type:IR}):console.warn({content:"texture arrays not currently supported",type:IR}):console.warn({content:"only 2D textures currently supported",type:IR})}return t.prototype.mipmaps=function(t){for(var e=[],r=64+this.bytesOfKeyValueData,i=this.pixelWidth,n=this.pixelHeight,o=t?this.numberOfMipmapLevels:1,a=0;a<o;a++){for(var s=new Int32Array(this.arrayBuffer,this.baseOffset+r,1)[0],u=0;u<this.numberOfFaces;u++){var c=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,s);e.push({data:c,width:i,height:n}),r+=s+4,r+=3-(s+3)%4}i=Math.max(1,.5*i),n=Math.max(1,.5*n)}return e},t}();function DR(e){var r=new NR(e,1),i=r.numberOfMipmapLevels,n=r.pixelWidth,o=r.pixelHeight,a=r.glType,s=r.numberOfFaces,u=r.glInternalFormat,c=r.glFormat,l=i>=Math.floor(Math.log2(Math.max(n,o))+1);return{sourceType:t.TextureSourceType.compressed,type:a,target:6===s?yb.TEXTURE_CUBE_MAP:yb.TEXTURE_2D,internalFormat:u,format:c,mipmaps:r.mipmaps(l)}}var zR,UR=function(){function e(){this.reloadPending={}}return e.prototype.reload=function(t){return ib(this,void 0,void 0,(function(){var e,r;return nb(this,(function(i){switch(i.label){case 0:return e=t.id,this.reloadPending[e]?[2]:t.sourceFrom?(this.reloadPending[e]=!0,[4,this.loadSource(t.sourceFrom)]):[3,2];case 1:return r=i.sent(),t.updateSource(r),this.reloadPending[e]=!1,[3,3];case 2:throw new Error("No source from");case 3:return[2]}}))}))},e.prototype.canOffloadTexture=function(e){if(e){var r=e.type;if(r===t.TextureSourceType.compressed||r===t.TextureSourceType.image){var i=e,n=i.target,o=i.map,a=e.url;return n===yb.TEXTURE_CUBE_MAP?"object"==typeof o&&!!o:V_(a)&&a.length>0}if(r===t.TextureSourceType.mipmaps){var s=e,u=s.bin,c=s.mipmaps,l=e,h=(n=l.target,l.maps),f=e.urls;return u?c.length>0:n===yb.TEXTURE_CUBE_MAP?h.every((function(t){return"object"==typeof t&&t})):f.every((function(t){return V_(t)&&t.length>0}))}}return!1},e.prototype.loadSource=function(e,r){return ib(this,void 0,void 0,(function(){var i,n,o,a,s,u,c,l,h,f,p,d,m,v,y,g,x,T=this;return nb(this,(function(E){switch(E.label){case 0:return i=e.type,n=e.target,o=e.map,a=e.url,u=(s=e).bin,c=s.mipmaps,l=e.urls,h=e.maps,n!==yb.TEXTURE_CUBE_MAP||i===t.TextureSourceType.mipmaps?[3,2]:[4,this.loadCubeMap(o)];case 1:return f=E.sent(),[2,rb(rb({},r),{cube:f,target:yb.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.image,sourceFrom:{type:t.TextureSourceType.image,map:rb({},o),target:yb.TEXTURE_CUBE_MAP}})];case 2:return i!==t.TextureSourceType.image?[3,4]:[4,bR(a)];case 3:return p=E.sent(),[2,rb(rb({},r),{image:p,sourceType:t.TextureSourceType.image,sourceFrom:{type:i,url:a,target:yb.TEXTURE_2D}})];case 4:return i!==t.TextureSourceType.video?[3,6]:[4,_R(a)];case 5:return d=E.sent(),[2,rb(rb({},r),{video:d,sourceType:t.TextureSourceType.video})];case 6:return i!==t.TextureSourceType.compressed?[3,8]:[4,SR(a)];case 7:return m=E.sent(),[2,rb(rb(rb({},DR(m)),r),{sourceFrom:{url:a,type:t.TextureSourceType.compressed}})];case 8:return i!==t.TextureSourceType.mipmaps?[3,17]:u?[4,SR(u)]:[3,13];case 9:return v=E.sent(),y=null!=n?n:yb.TEXTURE_2D,g=y===yb.TEXTURE_2D?c.slice():c.map((function(t){return t.slice()})),x=void 0,n!==yb.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(c.map((function(t){return T.loadMipmapImages(t,v)})))];case 10:return x=E.sent(),[3,12];case 11:x=this.loadMipmapImages(c,v),E.label=12;case 12:return[2,rb(rb({},r),{mipmaps:x,target:y,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:t.TextureSourceType.mipmaps}})];case 13:return n!==yb.TEXTURE_2D&&n?[3,15]:[4,Promise.all(l.map((function(t){return bR(t)})))];case 14:return x=E.sent(),[2,rb(rb({},r),{mipmaps:x,target:yb.TEXTURE_2D,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:l.slice(),target:yb.TEXTURE_2D}})];case 15:return n!==yb.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(h.map((function(t){return T.loadCubeMap(t)})))];case 16:return x=E.sent(),[2,rb(rb({},r),{mipmaps:x,target:yb.TEXTURE_CUBE_MAP,sourceType:t.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:h.map((function(t){return rb({},t)})),target:yb.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: ".concat(i))}}))}))},e.prototype.loadMipmapImages=function(t,e){return ib(this,void 0,void 0,(function(){return nb(this,(function(r){return[2,Promise.all(t.map((function(t){return bR(new Blob([new Uint8Array(e,t[0],t[1])]))})))]}))}))},e.prototype.loadCubeMap=function(t){return ib(this,void 0,void 0,(function(){return nb(this,(function(e){return[2,Promise.all(t.map((function(t){return bR(t)})))]}))}))},e}();var BR,kR=function(){function t(t){this.destroyed=!1;var e=t.name,r=void 0===e?"defaultDataBlock":e;this.name=r}return t.prototype.setUniformValues=function(t){var e=this;Object.keys(t).forEach((function(r){e.setUniformValue(r,t[r])}))},t.prototype.invalidAllFlags=function(){},t.prototype.updateUniformSubData=function(t,e,r){},t}();function GR(t){return"object"==typeof t&&t&&void 0===t.length&&t instanceof wR}t.MaterialRenderType=void 0,(BR=t.MaterialRenderType||(t.MaterialRenderType={}))[BR.normal=0]="normal",BR[BR.transformFeedback=1]="transformFeedback";var jR,XR,YR=1,WR=function(){function e(e){this.props=e,this.destroyed=!1,this.initialized=!1;var r=e.name,i=void 0===r?"Material"+YR++:r,n=e.renderType,o=void 0===n?t.MaterialRenderType.normal:n,a=e.shader,s=e.uniformSemantics;this.name=i,this.renderType=o,this.shaderSource=a,this.uniformSemantics=rb({},s)}return Object.defineProperty(e.prototype,"blending",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendFunction",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendEquation",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthTest",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilTest",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilRef",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilFunc",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpZPass",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"culling",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"frontFace",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cullFace",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blendColor",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthRange",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthFunc",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polygonOffsetFill",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polygonOffset",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sampleAlphaToCoverage",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilMask",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpFail",{set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpZFail",{set:function(t){},enumerable:!1,configurable:!0}),e.prototype.initialize=function(){},e.prototype.use=function(t,e){},e}(),HR="uniform vec2 uFilterSourceSize;uniform sampler2D uFilterSource;\n#define INTERPOLATION 1\nvec4 filterMain(vec2 texCoord,sampler2D tex){\n#ifdef INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));return mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nreturn texture2D(uFilterSource,texCoord);\n#endif\n}";t.ShaderCompileResultStatus=void 0,(jR=t.ShaderCompileResultStatus||(t.ShaderCompileResultStatus={}))[jR.noShader=0]="noShader",jR[jR.success=1]="success",jR[jR.fail=2]="fail",jR[jR.compiling=3]="compiling",t.GLSLVersion=void 0,(XR=t.GLSLVersion||(t.GLSLVersion={})).GLSL1="100",XR.GLSL3="300 es";var ZR=function(t){this.source=t},qR="effects-internal-copy",QR="effects-internal-copy-mesh",KR="\n#ifdef WEBGL2\n#define vsIn in\n#define vsOut out\n#else\n#define vsIn attribute\n#define vsOut varying\n#endif\nprecision highp float;\nvsIn vec2 aPos;\nvsOut vec2 vTex;\nvoid main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.0))/2.;\n}",JR="precision mediump float;\n#ifdef WEBGL2\n#define fsIn in\n#define fsOut out\n#define texture2D texture\n#else\n#define fsIn varying\n#endif\n".concat(HR,"\nfsIn vec2 vTex;\n#ifdef WEBGL2\nlayout (location = 0) out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n\n#ifdef DEPTH_TEXTURE\nuniform sampler2D uDepth;\n#ifndef WEBGL2\n#extension GL_EXT_frag_depth : enable\n#define gl_FragDepth gl_FragDepthEXT\n#endif\n#endif\nvoid main(){\n fragColor = filterMain(vTex,uFilterSource);\n #ifdef DEPTH_TEXTURE\n gl_FragDepth = texture2D(uDepth,vTex).r;\n #endif\n}\n");function $R(e,r){var i=2===e,n=i?"#version 300 es":"";return{name:qR,vertex:vR([],n+"\n"+KR,t.ShaderType.vertex,e),fragment:vR([],n+"\n"+JR,t.ShaderType.fragment,e),glslVersion:i?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:QR+ +r}}var tC,eC={format:yb.RGBA,type:yb.UNSIGNED_BYTE,minFilter:yb.LINEAR,magFilter:yb.LINEAR,wrapS:yb.CLAMP_TO_EDGE,wrapT:yb.CLAMP_TO_EDGE},rC=Symbol("dispose"),iC=function(){function e(t){this.textureCache={},this.textureRef={},this.engine=t}return e.prototype.requestColorAttachmentTexture=function(e){var r=this,i=e.width,n=e.height,o=e.name,a={sourceType:t.TextureSourceType.framebuffer,data:{width:i,height:n},name:o},s=[o];Object.getOwnPropertyNames(eC).forEach((function(t){var r,i=null!==(r=e[t])&&void 0!==r?r:eC[t];a[t]=i,s.push(t,i)}));var u=s.join(":"),c=this.textureCache[u];if(c)this.textureRef[u]++;else{var l=this.engine;tS(l),c=wR.create(l,a),this.textureCache[u]=c,this.textureRef[u]=1,c[rC]=c.dispose,c.dispose=function(){return r.removeTexture(u)}}return c},e.prototype.removeTexture=function(t){var e=this.textureRef[t];if(e<=1){e<0&&console.error("ref count < 0");var r=this.textureCache[t];r&&(r[rC](),r.dispose=r[rC]),delete this.textureCache[t],delete this.textureRef[t]}else this.textureRef[t]=e-1},e.prototype.dispose=function(){Object.values(this.textureCache).forEach((function(t){t[rC](),t.dispose=t[rC]})),this.textureCache={},this.textureRef={},this.engine=void 0},e}(),nC=function(){function t(t){void 0===t&&(t={}),this.semantics=rb({},t)}return t.prototype.toObject=function(){return rb({},this.semantics)},t.prototype.setSemantic=function(t,e){void 0===e?delete this.semantics[t]:this.semantics[t]=e},t.prototype.getSemanticValue=function(t,e){var r=this.semantics[t];return D_(r)?r(e):r},t.prototype.hasSemanticValue=function(t){return t in this.semantics},t.prototype.dispose=function(){var t=this;Object.keys(this.semantics).forEach((function(e){delete t.semantics[e]}))},t}(),oC=((tC={})[yb.FLOAT]=Float32Array.BYTES_PER_ELEMENT,tC[yb.INT]=Int32Array.BYTES_PER_ELEMENT,tC[yb.SHORT]=Int16Array.BYTES_PER_ELEMENT,tC[yb.BYTE]=Int8Array.BYTES_PER_ELEMENT,tC),aC=function(){function t(t){this.name=t}return t.prototype.initialize=function(){},t.prototype.flush=function(){},t}();function sC(t){return t===yb.INT?new Int32Array(0):t===yb.SHORT?new Int16Array(0):new Float32Array(0)}var uC,cC,lC=1,hC=function(){function e(t,e){this.engine=t,this.destroyed=!1,this.visible=!1;var r=e.material,i=e.geometry,n=e.name,o=void 0===n?"<unnamed>":n,a=e.priority,s=void 0===a?0:a,u=e.worldMatrix,c=void 0===u?LS.fromIdentity():u;this.id="Mesh"+lC++,this.name=o,this.geometry=i,this.material=r,this.priority=s,this.worldMatrix=c}return Object.defineProperty(e.prototype,"priority",{get:function(){return this._priority},set:function(t){this._priority=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.setVisible=function(t){this.visible=t},e.prototype.render=function(t){var e=t.renderingData,r=this.material;e.currentFrame.globalUniforms&&(e.currentCamera&&(t.setGlobalMatrix("effects_MatrixInvV",e.currentCamera.getInverseViewMatrix()),t.setGlobalMatrix("effects_MatrixV",e.currentCamera.getViewMatrix()),t.setGlobalMatrix("effects_MatrixVP",e.currentCamera.getViewProjectionMatrix()),t.setGlobalMatrix("_MatrixP",e.currentCamera.getProjectionMatrix())),t.setGlobalMatrix("effects_ObjectToWorld",this.worldMatrix)),e.currentFrame.editorTransform&&r.setVector4("uEditorTransform",e.currentFrame.editorTransform),r.use(t,e.currentFrame.globalUniforms);var i=this.geometry;i.flush(),t.drawGeometry(i,r)},e.prototype.getVisible=function(){return this.visible},e.prototype.firstGeometry=function(){return this.geometry},e.prototype.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e},e.prototype.restore=function(){},e.prototype.dispose=function(e){if(!this.destroyed){(null==e?void 0:e.geometries)!==t.DestroyOptions.keep&&this.geometry.dispose();var r=null==e?void 0:e.material;r!==t.DestroyOptions.keep&&this.material.dispose(r),this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMesh(this),this.engine=void 0)}},e}(),fC=1e3;t.RenderPassAttachmentStorageType=void 0,(uC=t.RenderPassAttachmentStorageType||(t.RenderPassAttachmentStorageType={}))[uC.none=0]="none",uC[uC.color=1]="color",uC[uC.stencil_8_opaque=2]="stencil_8_opaque",uC[uC.depth_16_opaque=3]="depth_16_opaque",uC[uC.depth_stencil_opaque=4]="depth_stencil_opaque",uC[uC.depth_16_texture=5]="depth_16_texture",uC[uC.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",t.TextureStoreAction=void 0,(cC=t.TextureStoreAction||(t.TextureStoreAction={}))[cC.store=0]="store",cC[cC.clear=2]="clear";var pC,dC=function(){function e(e,r){if(this.destroyed=!1,r){var i=r.texture,n=r.size;if(i instanceof wR)this.texture=i,this.externalTexture=!0;else if(i){var o=i.wrapT,a=i.wrapS,s=i.minFilter,u=i.magFilter,c=i.internalFormat,l=i.format,h=void 0===l?yb.RGBA:l,f=i.type,p=void 0===f?yb.UNSIGNED_BYTE:f;this.externalTexture=!1,this.textureOptions={size:n,format:h,type:p,internalFormat:c||h,wrapT:o,wrapS:a,minFilter:s,magFilter:u,name:r.name},this.texture=wR.create(e,rb(rb({},this.textureOptions),{sourceType:t.TextureSourceType.framebuffer,data:{width:n[0],height:n[1]}}))}}}return e.prototype.dispose=function(){this.destroyed||(this.texture.dispose(),this.destroyed=!0)},Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"storageType",{get:function(){return t.RenderPassAttachmentStorageType.color},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){var t=this.texture;return t?[t.getWidth(),t.getHeight()]:[0,0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.texture.getWidth()||0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.texture.getHeight()||0},enumerable:!1,configurable:!0}),e}();t.RenderPassDestroyAttachmentType=void 0,(pC=t.RenderPassDestroyAttachmentType||(t.RenderPassDestroyAttachmentType={}))[pC.force=0]="force",pC[pC.keep=1]="keep",pC[pC.keepExternal=2]="keepExternal",pC[pC.destroy=0]="destroy";var mC=1,vC=function(){function e(e,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+mC++:i,o=r.clearAction,a=r.semantics,s=r.depthStencilAttachment,u=r.storeAction,c=r.priority,l=void 0===c?0:c,h=r.meshOrder,f=void 0===h?t.OrderType.ascending:h,p=r.meshes,d=void 0===p?[]:p,m=r.delegate,v=void 0===m?{}:m;this.name=n,this.renderer=e,this.priority=l,this.meshOrder=f,this.meshes=Qb(d.slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||t.RenderPassAttachmentStorageType.none,this.clearAction=rb({},o),this.storeAction=rb({colorAction:t.TextureStoreAction.store,depthAction:t.TextureStoreAction.store,stencilAction:t.TextureStoreAction.store},u),this.semantics=new nC(a),this.options=r,this.delegate=v,this.setViewportOptions(r)}return Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewport",{get:function(){return this.getViewport()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stencilAttachment",{get:function(){return this.getStencilAttachment()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"depthAttachment",{get:function(){return this.getDepthAttachment()},enumerable:!1,configurable:!0}),e.prototype.addMesh=function(t){Kb(this.meshes,t,this.meshOrder)},e.prototype.removeMesh=function(t){Ub(this.meshes,t)},e.prototype.setMeshes=function(t){var e;return this.meshes.length=0,(e=this.meshes).splice.apply(e,sb([0,0],ab(t),!1)),Qb(this.meshes,this.meshOrder),this.meshes},e.prototype.getInitAttachments=function(){return this.attachments.length>0?this.attachments:this.options.attachments},e.prototype.configure=function(t){if(this.frameBuffer)t.setFrameBuffer(this.frameBuffer);else{var e=ab(this.getViewport(),4),r=e[0],i=e[1],n=e[2],o=e[3];t.setViewport(r,i,n,o)}},e.prototype.execute=function(t){t.clear(this.clearAction),t.renderMeshes(this.meshes),t.clear(this.storeAction)},e.prototype.frameCleanup=function(t){},e.prototype.resetColorAttachments=function(e){var r=this;if(e.length||this.resetAttachments({attachments:[]}),this.attachments.length){var i=e.map((function(e){return e.updateSource({sourceType:t.TextureSourceType.framebuffer}),new dC(r.renderer.engine,{texture:e})}));this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments=i,this.frameBuffer&&(this.frameBuffer.bind(),this.frameBuffer.resetColorTextures(e.map((function(t){return t}))))}else this.resetAttachments({attachments:e.map((function(t){return{texture:t}}))})},e.prototype.resetAttachments=function(t){this.options=t,this.setViewportOptions(t),this.renderer&&this._resetAttachments()},e.prototype.setViewportOptions=function(t){if(t.viewport){if(this.isCustomViewport=!0,this.viewportScale=1,this.customViewport=t.viewport.slice(0,4),this.frameBuffer){var e=this.customViewport;this.frameBuffer.isCustomViewport=!1,this.frameBuffer.resize(e[0],e[1],e[2],e[3])}}else this.isCustomViewport=!1,this.viewportScale=t.viewportScale||1,this.frameBuffer&&(this.frameBuffer.isCustomViewport=!0,this.frameBuffer.viewportScale=this.viewportScale)},e.prototype._resetAttachments=function(){var e,r,i=this,n=this.renderer,o=this.options;this.attachments.length&&(this.attachments.forEach((function(t){return!t.externalTexture&&t.dispose()})),this.attachments.length=0,null===(e=this.frameBuffer)||void 0===e||e.dispose({depthStencilAttachment:t.RenderPassDestroyAttachmentType.keepExternal}),this.frameBuffer=null);var a=this.viewportScale,s=this.isCustomViewport?this.customViewport:[0,0,n.getWidth()*a,n.getHeight()*a],u=[s[2],s[3]],c=this.name;if(null===(r=o.attachments)||void 0===r?void 0:r.length){var l=o.attachments.map((function(t,e){var r;return new dC(i.renderer.engine,rb({size:u,name:(null===(r=t.texture)||void 0===r?void 0:r.name)||"".concat(c,"##color_").concat(e)},t))}));this.attachments=l;var h=rO.create({storeAction:this.storeAction,name:c,viewport:s,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:l.map((function(t){return t.texture})),depthStencilAttachment:o.depthStencilAttachment||{storageType:t.RenderPassAttachmentStorageType.none}},n);h.bind(),h.unbind(),this.frameBuffer=h}else this.attachments.length=0},e.prototype.getViewport=function(){var t,e=(null===(t=this.frameBuffer)||void 0===t?void 0:t.viewport)||this.customViewport;if(e)return e;var r=this.renderer,i=this.viewportScale;return r?[0,0,r.getWidth()*i,r.getHeight()*i]:[0,0,0,0]},e.prototype.getDepthAttachment=function(){var t=this.frameBuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.depthStorage,texture:t.getDepthTexture()?this.getDepthTexture(t.getDepthTexture(),t.externalStorage):void 0}},e.prototype.getStencilAttachment=function(){var t=this.frameBuffer;if(t)return{storageType:t.depthStencilStorageType,storage:t.stencilStorage,texture:t.getStencilTexture()?this.getStencilTexture(t.getStencilTexture(),t.externalStorage):void 0}},e.prototype.getDepthTexture=function(t,e){var r;if(!this.depthTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=t===i?i:t;return e||(this.depthTexture=n),n}return this.depthTexture},e.prototype.getStencilTexture=function(t,e){var r;if(!this.stencilTexture){var i=null===(r=this.options.depthStencilAttachment)||void 0===r?void 0:r.texture,n=t===i?i:t;return e||(this.stencilTexture=n),n}return this.stencilTexture},e.prototype.initialize=function(t){return this.initialized||(this._resetAttachments(),this.initialized=!0),this},e.prototype.dispose=function(e){var r,i;if(!this.destroyed){var n=(null==e?void 0:e.meshes)||void 0;n!==t.DestroyOptions.keep&&this.meshes.forEach((function(t){t.dispose(n)})),this.meshes.length=0;var o=(null==e?void 0:e.colorAttachment)?e.colorAttachment:t.RenderPassDestroyAttachmentType.force;this.attachments.forEach((function(e){e.externalTexture&&o===t.RenderPassDestroyAttachmentType.keepExternal||o===t.RenderPassDestroyAttachmentType.keep||e.dispose()})),this.attachments.length=0,(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose(),this.destroyed=!0;var a=(null==e?void 0:e.depthStencilAttachment)?e.depthStencilAttachment:t.RenderPassDestroyAttachmentType.force,s=this.frameBuffer;if(s)s.dispose({depthStencilAttachment:a}),s.externalStorage&&a===t.RenderPassDestroyAttachmentType.keepExternal||a===t.RenderPassDestroyAttachmentType.keep||(null===(r=this.stencilTexture)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose());this.options=this.renderer=null,this.initialize=B_}},e}(),yC="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}in vec4 vColor;in vec4 vTexCoord;in highp vec2 vParams;uniform vec3 uFrameColor;void main(){fragColor=vec4(uFrameColor.xyz,1.0);}",gC="#version 300 es\nprecision highp float;\n#define SHADER_VERTEX 1\n#define SPRITE_SHADER 1\nin vec4 aPoint;in vec2 aIndex;uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixInvV;uniform mat4 effects_MatrixVP;out vec4 vColor;out vec4 vTexCoord;\n#ifdef ADJUST_LAYER\nout vec2 vFeatherCoord;\n#endif\nout highp vec3 vParams;const float d2r=3.141592653589793/180.;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec4 filterMain(float t,vec4 position);\n#pragma FILTER_VERT\nvec3 rotateByQuat(vec3 a,vec4 quat){vec3 qvec=quat.xyz;vec3 uv=cross(qvec,a);vec3 uuv=cross(qvec,uv)*2.;return a+(uv*2.*quat.w+uuv);}void main(){int index=int(aIndex.x);vec4 texParams=uTexParams[index];mat4 mainData=uMainData[index];float life=mainData[1].z;if(life<0.||life>1.){gl_Position=vec4(3.,3.,3.,1.);}else{vec4 _pos=mainData[0];vec2 size=mainData[1].xy;vec3 point=rotateByQuat(vec3(aPoint.xy*size,0.),mainData[2]);vec4 pos=vec4(_pos.xyz,1.0);float renderMode=texParams.z;if(renderMode==0.){pos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixInvV[0].xyz*point.x+effects_MatrixInvV[1].xyz*point.y;}else if(renderMode==1.){pos.xyz+=point;pos=effects_ObjectToWorld*pos;}else if(renderMode==2.){pos=effects_ObjectToWorld*pos;pos.xy+=point.xy;}else if(renderMode==3.){pos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixInvV[0].xyz*point.x+effects_MatrixInvV[2].xyz*point.y;}gl_Position=effects_MatrixVP*pos;\n#ifdef ADJUST_LAYER\nvec4 filter_Position=filterMain(life,pos);\n#endif\ngl_PointSize=6.0;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#ifdef ADJUST_LAYER\nfilter_Position=vec4(filter_Position.xy*uEditorTransform.xy+uEditorTransform.zw*filter_Position.w,filter_Position.zw);\n#endif\n#endif\n#ifdef ADJUST_LAYER\nvTexCoord=vec4(filter_Position.xy/filter_Position.w+1.,gl_Position.xy/gl_Position.w+1.)/2.;vFeatherCoord=aPoint.zw;\n#else\nvec4 texOffset=uTexOffset[index];vTexCoord=vec4(aPoint.zw*texOffset.zw+texOffset.xy,texParams.xy);\n#endif\nvColor=mainData[3];vParams=vec3(aIndex.y,texParams.y,texParams.x);}}",xC="#version 300 es\nprecision highp float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define SPRITE_SHADER 1\nin vec4 vColor;in vec4 vTexCoord;in highp vec3 vParams;\n#ifdef ADJUST_LAYER\nuniform sampler2D uSamplerPre;vec4 filterMain(vec2 coord,sampler2D tex);in vec2 vFeatherCoord;uniform sampler2D uFeatherSampler;\n#endif\nuniform sampler2D uSampler0;uniform sampler2D uSampler1;uniform sampler2D uSampler2;uniform sampler2D uSampler3;uniform sampler2D uSampler4;uniform sampler2D uSampler5;uniform sampler2D uSampler6;uniform sampler2D uSampler7;\n#if MAX_FRAG_TEX == 16\nuniform sampler2D uSampler8;uniform sampler2D uSampler9;uniform sampler2D uSampler10;uniform sampler2D uSampler11;uniform sampler2D uSampler12;uniform sampler2D uSampler13;uniform sampler2D uSampler14;uniform sampler2D uSampler15;\n#endif\nvec4 texture2DbyIndex(float index,vec2 coord);\n#pragma FILTER_FRAG\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\nvoid main(){vec4 color=vec4(0.);\n#ifdef ADJUST_LAYER\nvec2 featherCoord=abs(vFeatherCoord-vec2(0.5))/0.5;float cc=sqrt(max(featherCoord.x,featherCoord.y));float blend=vColor.a*texture2D(uFeatherSampler,vec2(cc,0.)).r;if(blend>=1.){color=filterMain(vTexCoord.xy,uSamplerPre);}else if(blend<=0.){color=texture2D(uSamplerPre,vTexCoord.zw);}else{color=mix(texture2D(uSamplerPre,vTexCoord.zw),filterMain(vTexCoord.xy,uSamplerPre),blend);}\n#else\nvec4 texColor=texture2DbyIndex(round(vParams.x),vTexCoord.xy);color=blendColor(texColor,vColor,round(vParams.y));if(vParams.z==0.&&color.a<0.04){discard;}\n#endif\ncolor.a=clamp(color.a,0.0,1.0);fragColor=color;}vec4 texture2DbyIndex(float index,vec2 coord){\n#ifndef ADJUST_LAYER\nif(index==0.){return texture2D(uSampler0,coord);}if(index==1.){return texture2D(uSampler1,coord);}if(index==2.){return texture2D(uSampler2,coord);}if(index==3.){return texture2D(uSampler3,coord);}if(index==4.){return texture2D(uSampler4,coord);}if(index==5.){return texture2D(uSampler5,coord);}if(index==6.){return texture2D(uSampler6,coord);}if(index==7.){return texture2D(uSampler7,coord);}\n#if MAX_FRAG_TEX == 16\nif(index==8.){return texture2D(uSampler8,coord);}if(index==9.){return texture2D(uSampler9,coord);}if(index==10.){return texture2D(uSampler10,coord);}if(index==11.){return texture2D(uSampler11,coord);}if(index==12.){return texture2D(uSampler12,coord);}if(index==13.){return texture2D(uSampler13,coord);}if(index==14.){return texture2D(uSampler14,coord);}if(index==15.){return texture2D(uSampler15,coord);}\n#endif\nreturn texture2D(uSampler0,coord);\n#else\nreturn vec4(0.);\n#endif\n}",TC="#version 300 es\nprecision mediump float;\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\nvec4 blendColor(vec4 color,vec4 vc,float mode){vec4 ret=color*vc;\n#ifdef PRE_MULTIPLY_ALPHA\nfloat alpha=vc.a;\n#else\nfloat alpha=ret.a;\n#endif\nif(mode==1.){ret.rgb*=alpha;}else if(mode==2.){ret.rgb*=alpha;ret.a=dot(ret.rgb,vec3(0.33333333));}else if(mode==3.){alpha=color.r*alpha;ret=vec4(vc.rgb*alpha,alpha);}return ret;}\n#define PATICLE_SHADER 1\nin float vLife;in vec2 vTexCoord;in vec4 vColor;uniform vec3 emissionColor;uniform float emissionIntensity;uniform sampler2D uMaskTex;uniform vec4 uColorParams;uniform vec2 uTexOffset;\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#ifdef USE_SPRITE\nin vec4 vTexCoordBlend;\n#ifdef USE_FILTER\nuniform vec4 uFSprite;\n#endif\n#endif\nin float vSeed;\n#ifdef PREVIEW_BORDER\nuniform vec4 uPreviewColor;\n#endif\n#ifdef USE_SPRITE\nvec4 getTextureColor(sampler2D tex,vec2 texCoord){if(vTexCoordBlend.w>0.){return mix(texture2D(tex,texCoord),texture2D(tex,vTexCoordBlend.xy+texCoord),vTexCoordBlend.z);}return texture2D(tex,texCoord);}\n#else\n#define getTextureColor texture2D\n#endif\n#ifndef WEBGL2\n#define round(a) floor(0.5+a)\n#endif\n#ifdef PREVIEW_BORDER\nvoid main(){fragColor=uPreviewColor;}\n#else\n#pragma FILTER_FRAG\nvoid main(){vec4 color=vec4(1.0);vec4 tempColor=vColor;vec2 texOffset=uTexOffset;if(vLife<0.){discard;}\n#ifdef USE_FILTER\n#ifdef USE_SPRITE\ntexOffset=uTexOffset/uFSprite.xy;\n#endif\ncolor=filterMain(vTexCoord,uMaskTex);\n#else\nif(uColorParams.x>0.0){color=getTextureColor(uMaskTex,vTexCoord);}\n#endif\n#ifdef COLOR_OVER_LIFETIME\n#ifndef ENABLE_VERTEX_TEXTURE\ntempColor*=texture2D(uColorOverLifetime,vec2(vLife,0.));\n#endif\n#endif\ncolor=blendColor(color,tempColor,round(uColorParams.y));if(color.a<=0.01&&uColorParams.w>0.){float _at=texture2D(uMaskTex,vTexCoord+texOffset).a+texture2D(uMaskTex,vTexCoord+texOffset*-1.).a;if(_at<=0.02){discard;}}vec3 emission=emissionColor*pow(2.0,emissionIntensity);color=vec4(pow(pow(color.rgb,vec3(2.2))+emission,vec3(1.0/2.2)),color.a);fragColor=color;}\n#endif\n",EC="#version 300 es\nprecision highp float;\n#define SHADER_VERTEX 1\n#define PATICLE_SHADER 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).y;}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;float r=dot(vec4(2.*t*t*t,3.*t*t,-t0*t0*t0,3.*t0*t0),vec4(y0-y1,t0*y1-t1*y0,2.*y0+y1,t1*y0));return r/(t0-t1)/6.;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}return 0.;}const float d2r=3.141592653589793/180.;in vec3 aPos;in vec4 aOffset;in vec3 aVel;in vec3 aRot;in vec4 aColor;in vec3 aDirX;in vec3 aDirY;\n#ifdef USE_SPRITE\nin vec3 aSprite;uniform vec4 uSprite;struct UVDetail{vec2 uv0;vec3 uv1;};UVDetail getSpriteUV(vec2 uv,float lifeTime);out vec4 vTexCoordBlend;\n#endif\n#pragma EDITOR_VERT_DEFINE\n#ifdef FINAL_TARGET\nuniform vec3 uFinalTarget;uniform vec4 uForceCurve;\n#endif\nuniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixV;uniform mat4 effects_MatrixVP;uniform vec4 uParams;uniform vec4 uAcceleration;uniform vec4 uGravityModifierValue;uniform vec4 uOpacityOverLifetimeValue;\n#ifdef ROT_X_LIFETIME\nuniform vec4 uRXByLifeTimeValue;\n#endif\n#ifdef ROT_Y_LIFETIME\nuniform vec4 uRYByLifeTimeValue;\n#endif\n#ifdef ROT_Z_LIFETIME\nuniform vec4 uRZByLifeTimeValue;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n#if LINEAR_VEL_X\nuniform vec4 uLinearXByLifetimeValue;\n#endif\n#if LINEAR_VEL_Y\nuniform vec4 uLinearYByLifetimeValue;\n#endif\n#if LINEAR_VEL_Z\nuniform vec4 uLinearZByLifetimeValue;\n#endif\n#endif\n#ifdef SPEED_OVER_LIFETIME\nuniform vec4 uSpeedLifetimeValue;\n#endif\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n#if ORB_VEL_X\nuniform vec4 uOrbXByLifetimeValue;\n#endif\n#if ORB_VEL_Y\nuniform vec4 uOrbYByLifetimeValue;\n#endif\n#if ORB_VEL_Z\nuniform vec4 uOrbZByLifetimeValue;\n#endif\nuniform vec3 uOrbCenter;\n#endif\nuniform vec4 uSizeByLifetimeValue;\n#ifdef SIZE_Y_BY_LIFE\nuniform vec4 uSizeYByLifetimeValue;\n#endif\nout float vLife;out vec4 vColor;out vec2 vTexCoord;\n#ifdef USE_FILTER\n#pragma FILTER_VERT\n#endif\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvec3 calOrbitalMov(float _life,float _dur){vec3 orb=vec3(0.0);\n#ifdef AS_ORBITAL_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if ORB_VEL_X\norb.x=FUNC(uOrbXByLifetimeValue);\n#endif\n#if ORB_VEL_Y\norb.y=FUNC(uOrbYByLifetimeValue);\n#endif\n#if ORB_VEL_Z\norb.z=FUNC(uOrbZByLifetimeValue);\n#endif\n#undef FUNC\nreturn orb;}vec3 calLinearMov(float _life,float _dur){vec3 mov=vec3(0.0);\n#ifdef AS_LINEAR_MOVEMENT\n#define FUNC(a) getValueFromTime(_life,a)\n#else\n#define FUNC(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#if LINEAR_VEL_X\nmov.x=FUNC(uLinearXByLifetimeValue);\n#endif\n#if LINEAR_VEL_Y\nmov.y=FUNC(uLinearYByLifetimeValue);\n#endif\n#if LINEAR_VEL_Z\nmov.z=FUNC(uLinearZByLifetimeValue);\n#endif\n#undef FUNC\nreturn mov;}mat3 mat3FromRotation(vec3 rotation){vec3 sinR=sin(rotation*d2r);vec3 cosR=cos(rotation*d2r);return mat3(cosR.z,-sinR.z,0.,sinR.z,cosR.z,0.,0.,0.,1.)*mat3(cosR.y,0.,sinR.y,0.,1.,0.,-sinR.y,0,cosR.y)*mat3(1.,0.,0.,0,cosR.x,-sinR.x,0.,sinR.x,cosR.x);}\n#ifdef USE_SPRITE\nUVDetail getSpriteUV(vec2 uv,float lifeTime){float t=fract(clamp((lifeTime-aSprite.x)/aSprite.y,0.0,1.)*aSprite.z);float frame=uSprite.z*t;float frameIndex=max(ceil(frame)-1.,0.);float row=floor((frameIndex+0.1)/uSprite.x);float col=frameIndex-row*uSprite.x;vec2 retUV=(vec2(col,row)+uv)/uSprite.xy;UVDetail ret;if(uSprite.w>0.){float blend=frame-frameIndex;float frameIndex1=min(ceil(frame),uSprite.z-1.);float row1=floor((frameIndex1+0.1)/uSprite.x);float col1=frameIndex1-row1*uSprite.x;vec2 coord=(vec2(col1,row1)+uv)/uSprite.xy-retUV;ret.uv1=vec3(coord.x,1.-coord.y,blend);}ret.uv0=vec2(retUV.x,1.-retUV.y);return ret;}\n#endif\nvec3 calculateTranslation(vec3 vel,float t0,float t1,float dur){float dt=t1-t0;float d=getIntegrateByTimeFromTime(0.,dt,uGravityModifierValue);vec3 acc=uAcceleration.xyz*d;\n#ifdef SPEED_OVER_LIFETIME\nreturn vel*getIntegrateFromTime0(dt/dur,uSpeedLifetimeValue)*dur+acc;\n#endif\nreturn vel*dt+acc;}mat3 transformFromRotation(vec3 rot,float _life,float _dur){vec3 rotation=rot;\n#ifdef ROT_LIFETIME_AS_MOVEMENT\n#define FUNC1(a) getValueFromTime(_life,a)\n#else\n#define FUNC1(a) getIntegrateFromTime0(_life,a) * _dur\n#endif\n#ifdef ROT_X_LIFETIME\nrotation.x+=FUNC1(uRXByLifeTimeValue);\n#endif\n#ifdef ROT_Y_LIFETIME\nrotation.y+=FUNC1(uRYByLifeTimeValue);\n#endif\n#ifdef ROT_Z_LIFETIME\nrotation.z+=FUNC1(uRZByLifeTimeValue);\n#endif\nif(dot(rotation,rotation)==0.0){return mat3(1.0);}\n#undef FUNC1\nreturn mat3FromRotation(rotation);}void main(){float time=uParams.x-aOffset.z;float dur=aOffset.w;if(time<0.||time>dur){gl_Position=vec4(-3.,-3.,-3.,1.);}else{float life=clamp(time/dur,0.0,1.0);vLife=life;\n#ifdef USE_SPRITE\nUVDetail uvD=getSpriteUV(aOffset.xy,time);vTexCoord=uvD.uv0;vTexCoordBlend=vec4(uvD.uv1,uSprite.w);\n#else\nvTexCoord=aOffset.xy;\n#endif\nvColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(life,0.));\n#endif\n#endif\nvColor.a*=clamp(getValueFromTime(life,uOpacityOverLifetimeValue),0.,1.);vec3 size=vec3(vec2(getValueFromTime(life,uSizeByLifetimeValue)),1.0);\n#ifdef SIZE_Y_BY_LIFE\nsize.y=getValueFromTime(life,uSizeYByLifetimeValue);\n#endif\nvec3 point=transformFromRotation(aRot,life,dur)*(aDirX*size.x+aDirY*size.y);vec3 pt=calculateTranslation(aVel,aOffset.z,uParams.x,dur);vec3 _pos=aPos+pt;\n#if ORB_VEL_X + ORB_VEL_Y + ORB_VEL_Z\n_pos=mat3FromRotation(calOrbitalMov(life,dur))*(_pos-uOrbCenter);_pos+=uOrbCenter;\n#endif\n#if LINEAR_VEL_X + LINEAR_VEL_Y + LINEAR_VEL_Z\n_pos.xyz+=calLinearMov(life,dur);\n#endif\n#ifdef FINAL_TARGET\nfloat force=getValueFromTime(life,uForceCurve);vec4 pos=vec4(mix(_pos,uFinalTarget,force),1.);\n#else\nvec4 pos=vec4(_pos,1.0);\n#endif\n#if RENDER_MODE == 1\npos.xyz+=point;pos=effects_ObjectToWorld*pos;\n#elif RENDER_MODE == 3\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[2].xyz*point.y;\n#elif RENDER_MODE == 2\npos=effects_ObjectToWorld*pos;pos.xy+=point.xy;\n#elif RENDER_MODE == 0\npos=effects_ObjectToWorld*pos;pos.xyz+=effects_MatrixV[0].xyz*point.x+effects_MatrixV[1].xyz*point.y;\n#endif\ngl_Position=effects_MatrixVP*pos;vSeed=aSeed;gl_PointSize=6.0;\n#ifdef USE_FILTER\nfilterMain(life);\n#endif\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n#pragma EDITOR_VERT_TRANSFORM\n}}",AC="#version 300 es\nprecision mediump float;\n#define SHADER_VERTEX 1\n#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).y;}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}in vec4 aPos;in vec3 aDir;in vec3 aInfo;in vec4 aColor;in float aTime;\n#ifdef ATTR_TRAIL_START\nin float aTrailStart;\n#else\nuniform float uTrailStart[64];in float aTrailStartIndex;\n#endif\nuniform mat4 effects_MatrixInvV;uniform mat4 effects_ObjectToWorld;uniform mat4 effects_MatrixVP;uniform vec4 uTextureMap;uniform float uTime;uniform vec4 uParams;uniform vec4 uColorParams;uniform vec4 uOpacityOverLifetimeValue;uniform vec4 uWidthOverTrail;\n#ifdef COLOR_OVER_TRAIL\nuniform sampler2D uColorOverTrail;\n#endif\n#ifdef COLOR_OVER_LIFETIME\nuniform sampler2D uColorOverLifetime;\n#endif\nout float vLife;out vec2 vTexCoord;out vec4 vColor;\n#ifdef ENV_EDITOR\nuniform vec4 uEditorTransform;\n#endif\nvoid main(){vec4 _pa=effects_MatrixVP*vec4(aPos.xyz,1.);vec4 _pb=effects_MatrixVP*vec4(aPos.xyz+aDir,1.);vec2 dir=normalize(_pb.xy/_pb.w-_pa.xy/_pa.w);vec2 screen_xy=vec2(-dir.y,dir.x);vec4 pos=effects_ObjectToWorld*vec4(aPos.xyz,1.);\n#ifdef ATTR_TRAIL_START\nfloat ts=aTrailStart;\n#else\nfloat ts=uTrailStart[int(aTrailStartIndex)];\n#endif\nfloat trail=(ts-aInfo.y)/uParams.y;float width=aPos.w*getValueFromTime(trail,uWidthOverTrail)/max(abs(screen_xy.x),abs(screen_xy.y));pos.xyz+=(effects_MatrixInvV[0].xyz*screen_xy.x+effects_MatrixInvV[1].xyz*screen_xy.y)*width;float time=min((uTime-aTime)/aInfo.x,1.0);gl_Position=effects_MatrixVP*pos;vColor=aColor;\n#ifdef COLOR_OVER_LIFETIME\n#ifdef ENABLE_VERTEX_TEXTURE\nvColor*=texture2D(uColorOverLifetime,vec2(time,0.));\n#endif\n#endif\n#ifdef COLOR_OVER_TRAIL\nvColor*=texture2D(uColorOverTrail,vec2(trail,0.));\n#endif\nvColor.a*=clamp(getValueFromTime(time,uOpacityOverLifetimeValue),0.,1.);vLife=time;vTexCoord=uTextureMap.xy+vec2(trail,aInfo.z)*uTextureMap.zw;vSeed=aSeed;\n#ifdef ENV_EDITOR\ngl_Position=vec4(gl_Position.xy*uEditorTransform.xy+uEditorTransform.zw*gl_Position.w,gl_Position.zw);\n#endif\n}",bC="uniform vec4 uTexRange;uniform vec2 uFilterSourceSize;\n#define INTERPOLATION 0\nvec4 filterMain(vec2 texCoord,sampler2D source){float x=uTexRange.x+texCoord.x*uTexRange.y;\n#if INTERPOLATION\nvec2 texInPixel=texCoord*uFilterSourceSize;vec2 coordMin=floor(texInPixel);vec2 pp=texInPixel-coordMin;vec4 fCoord=vec4(coordMin/uFilterSourceSize,(coordMin+vec2(1.))/uFilterSourceSize);vec4 cLT=texture2D(uFilterSource,vec2(fCoord.x,fCoord.w));vec4 cLB=texture2D(uFilterSource,vec2(fCoord.x,fCoord.y));vec4 cRT=texture2D(uFilterSource,vec2(fCoord.z,fCoord.w));vec4 cRB=texture2D(uFilterSource,vec2(fCoord.z,fCoord.y));vec4 color=mix(mix(cLB,cRB,pp.x),mix(cLT,cRT,pp.x),pp.y);\n#else\nvec4 color=texture2D(source,vec2(x,texCoord.y));\n#endif\nx=uTexRange.z+texCoord.x*uTexRange.w;vec4 opacity=texture2D(source,vec2(x,texCoord.y));return vec4(color.rgb,opacity.r);}",SC="uniform sampler2D uAlphaXSample;uniform sampler2D uAlphaYSample;vec4 filterMain(vec2 texCoord,sampler2D source){vec4 color=texture2D(source,texCoord);float x=texture2D(uAlphaXSample,vec2(vFeatherCoord.x,0.)).r;float y=texture2D(uAlphaYSample,vec2(vFeatherCoord.y,0.)).r;return vec4(color.rgb,color.a*min(x,y));}",_C="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",RC="uniform sampler2D uLastSource;uniform vec4 uParams;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);if(uParams.x<1.){return c1;}vec4 c2=texture2D(uLastSource,coord);return mix(c1,c2,uParams.y);}",CC="uniform vec4 uWaveParams;\n#ifdef PATICLE_SHADER\nin vec4 vWaveParams;\n#else\nuniform vec4 vWaveParams;\n#endif\nvec4 filterMain(vec2 texCoord,sampler2D tex){vec2 vp=texCoord-uWaveParams.xy;float xx=dot(vp,uWaveParams.zw);float d=sin(vWaveParams.x*xx+vWaveParams.y)*vWaveParams.z;vec2 up=vec2(-uWaveParams.w,uWaveParams.z)*d;return texture2D(tex,clamp(texCoord+up,0.,1.));}",OC="uniform vec4 uMovementValue;uniform vec4 uStrengthValue;uniform vec4 uPeriodValue;out vec4 vWaveParams;void filterMain(float lifetime){const float pi2=3.14159265;vWaveParams=vec4(getValueFromTime(lifetime,uPeriodValue)*pi2,getValueFromTime(lifetime,uMovementValue)*pi2,getValueFromTime(lifetime,uStrengthValue),0.);}",wC="uniform sampler2D uBloomBlur;uniform vec4 uBloomParams;vec4 filterMain(vec2 coord,sampler2D tex){const vec3 gamma=vec3(1./2.2);vec4 c1=texture2D(tex,coord);vec4 bloomColor=texture2D(uBloomBlur,coord);float alpha=max(c1.a,bloomColor.a);vec3 color=max(c1.rgb*c1.a,bloomColor.rgb*bloomColor.a)/alpha*uBloomParams.y+bloomColor.rgb*uBloomParams.x;return vec4(color,alpha);}",MC="uniform vec4 uColorThreshold;vec4 filterMain(vec2 coord,sampler2D tex){vec4 c1=texture2D(tex,coord);vec3 color=c1.rgb*c1.a;vec3 s=step(uColorThreshold.xyz,color);float m=min(s.r+s.g+s.b,1.);return c1*m;}",IC="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",LC="precision highp float;\n#define HALF_MAX 60000.0\n#define ACEScc_MIDGRAY 0.4135884\nvarying vec2 uv;uniform sampler2D _GaussianTex;uniform sampler2D _SceneTex;uniform float _BloomIntensity;uniform float _Brightness;uniform float _Saturation;uniform float _Contrast;uniform bool _UseBloom;uniform bool _UseToneMapping;mat3 LinearToACES=mat3(0.59719,0.07600,0.02840,0.35458,0.90834,0.13383,0.04823,0.01566,0.83777);mat3 ACESToLinear=mat3(1.60475,-0.10208,-0.00327,-0.53108,1.10813,-0.07276,-0.07367,-0.00605,1.07602);float log10(float x){return log(x)/log(10.0);}vec3 log10(vec3 v){return vec3(log10(v.x),log10(v.y),log10(v.z));}vec3 LinearToLogC(vec3 x){return 0.244161*log10(5.555556*x+0.047996)+0.386036;}vec3 LogCToLinear(vec3 x){return(pow(vec3(10.0),(x-0.386036)/0.244161)-0.047996)/5.555556;}vec3 rrt_and_odt_fit(vec3 col){vec3 a=col*(col+0.0245786)-0.000090537;vec3 b=col*(0.983729*col+0.4329510)+0.238081;return a/b;}vec3 ACESToneMapping(vec3 col){vec3 aces=LinearToACES*col;aces=rrt_and_odt_fit(aces);col=ACESToLinear*aces;return col;}vec3 LinearToSrgb(vec3 c){return mix(1.055*pow(c,vec3(1./2.4))-0.055,12.92*c,step(c,vec3(0.0031308)));}vec3 GammaCorrection(vec3 c){return pow(c,vec3(1.0/2.2));}void main(){vec4 hdrColor=texture2D(_SceneTex,uv);hdrColor.rgb=pow(hdrColor.rgb,vec3(2.2));vec3 finalColor=hdrColor.rgb;if(_UseBloom){vec4 bloomColor=texture2D(_GaussianTex,uv);bloomColor.rgb*=_BloomIntensity;finalColor+=bloomColor.rgb;}finalColor=finalColor*_Brightness;vec3 colorLog=LinearToLogC(finalColor);colorLog=(colorLog-ACEScc_MIDGRAY)*_Contrast+ACEScc_MIDGRAY;finalColor=LogCToLinear(colorLog);finalColor=max(finalColor,0.0);float luminance=0.2125*finalColor.r+0.7154*finalColor.g+0.0721*finalColor.b;vec3 luminanceColor=vec3(luminance,luminance,luminance);finalColor=(finalColor-luminanceColor)*_Saturation+luminanceColor;finalColor=max(finalColor,0.0);if(_UseToneMapping){finalColor=ACESToneMapping(finalColor);}gl_FragColor=vec4(clamp(GammaCorrection(finalColor),0.0,1.0),1.0);}",PC="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussH(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[9];offsets[0]=-4.0;offsets[1]=-3.0;offsets[2]=-2.0;offsets[3]=-1.0;offsets[4]=0.0;offsets[5]=1.0;offsets[6]=2.0;offsets[7]=3.0;offsets[8]=4.0;float weights[9];weights[0]=0.01621622;weights[1]=0.05405405;weights[2]=0.12162162;weights[3]=0.19459459;weights[4]=0.22702703;weights[5]=0.19459459;weights[6]=0.12162162;weights[7]=0.05405405;weights[8]=0.01621622;for(int i=0;i<9;i++){vec2 offset=vec2(offsets[i]*2.0*(1.0/_TextureSize.x),0);color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussH(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",FC="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform vec2 _TextureSize;vec3 GaussV(sampler2D tex,vec2 uv){vec3 color=vec3(0.0);float offsets[5];offsets[0]=-3.23076923;offsets[1]=-1.38461538;offsets[2]=0.0;offsets[3]=1.38461538;offsets[4]=3.23076923;float weights[5];weights[0]=0.07027027;weights[1]=0.31621622;weights[2]=0.22702703;weights[3]=0.31621622;weights[4]=0.07027027;for(int i=0;i<5;i++){vec2 offset=vec2(0,offsets[i]*(1.0/_TextureSize.y));color+=texture2D(tex,uv+offset).rgb*weights[i];}return color;}void main(){vec3 color=GaussV(_MainTex,uv);gl_FragColor=vec4(color,1.0);}",VC="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform sampler2D _GaussianDownTex;uniform vec2 _GaussianDownTextureSize;float GaussWeight2D(float x,float y,float sigma){float PI=3.14159265358;float E=2.71828182846;float sigma_2=pow(sigma,2.0);float a=-(x*x+y*y)/(2.0*sigma_2);return pow(E,a)/(2.0*PI*sigma_2);}vec3 GaussNxN(sampler2D tex,vec2 uv,vec2 stride,float sigma){vec3 color=vec3(0.,0.,0.);const int r=1;float weight=0.0;for(int i=-r;i<=r;i++){for(int j=-r;j<=r;j++){float w=GaussWeight2D(float(i),float(j),sigma);vec2 coord=uv+vec2(i,j)*stride;color+=texture2D(tex,coord).rgb*w;weight+=w;}}color/=weight;return color;}void main(){vec3 lowResColor=GaussNxN(_MainTex,uv,0.5/_GaussianDownTextureSize,1.0);vec3 highResColor=GaussNxN(_GaussianDownTex,uv,1.0/_GaussianDownTextureSize,1.0);vec3 color=mix(highResColor,lowResColor,0.7);gl_FragColor=vec4(color,1.0);}",NC="precision highp float;varying vec2 uv;uniform sampler2D _MainTex;uniform float _Threshold;void main(){vec4 mainColor=texture2D(_MainTex,uv);mainColor.rgb=pow(mainColor.rgb,vec3(2.2));float brightness=max(mainColor.r,max(mainColor.g,mainColor.b));float w=max(0.0,brightness-_Threshold)/max(brightness,0.00001);mainColor.rgb*=w;gl_FragColor=vec4(mainColor.rgb,1.0);}",DC=function(e){function r(r,i){var n=e.call(this,r,i)||this,o=n.renderer.engine,a=aC.create(o,{mode:yb.TRIANGLE_STRIP,attributes:{aPos:{type:yb.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=WR.create(o,{shader:{vertex:IC,fragment:NC,glslVersion:t.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=hC.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}return eb(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture=this.mainTexture,t.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture);var r=e.renderingData.currentFrame.globalVolume.threshold;this.screenMesh.material.setFloat("_Threshold",r),e.renderMeshes([this.screenMesh])},r}(vC),zC=function(e){function r(r,i,n){var o=e.call(this,r,n)||this;o.type=i;var a=o.renderer.engine,s="PostProcess",u=aC.create(a,{name:s,mode:yb.TRIANGLE_STRIP,attributes:{aPos:{type:yb.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:IC,fragment:"H"==i?PC:FC,glslVersion:t.GLSLVersion.GLSL1},l=WR.create(a,{name:s,shader:c});return l.blending=!1,l.depthTest=!1,l.culling=!1,o.screenMesh=hC.create(a,{name:s,geometry:u,material:l,priority:0}),o.priority=5e3,o}return eb(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setVector2("_TextureSize",YC(this.mainTexture)),e.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=e.getFrameBuffer().getColorTextures()[0])},r}(vC),UC=function(e){function r(t,r){var i=e.call(this,t,r)||this,n="PostProcess",o=i.renderer.engine,a=aC.create(o,{name:n,mode:yb.TRIANGLE_STRIP,attributes:{aPos:{type:yb.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s={vertex:IC,fragment:VC},u=WR.create(o,{name:n,shader:s});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=hC.create(o,{name:n,geometry:a,material:u,priority:0}),i.priority=5e3,i}return eb(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},r.prototype.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear}),this.screenMesh.material.setTexture("_MainTex",this.mainTexture),this.screenMesh.material.setTexture("_GaussianDownTex",this.gaussianDownSampleResult.texture),this.screenMesh.material.setVector2("_GaussianDownTextureSize",YC(this.gaussianDownSampleResult.texture)),e.renderMeshes([this.screenMesh])},r}(vC),BC=function(e){function r(r,i){var n=e.call(this,r,{})||this,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new dC(a);var s=aC.create(a,{name:o,mode:yb.TRIANGLE_STRIP,attributes:{aPos:{type:yb.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=WR.create(a,{name:o,shader:{vertex:IC,fragment:LC,glslVersion:t.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=hC.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}return eb(r,e),r.prototype.configure=function(t){this.mainTexture=t.getFrameBuffer().getColorTextures()[0],this.sceneTextureHandle.texture||(this.sceneTextureHandle.texture=this.mainTexture),t.setFrameBuffer(null)},r.prototype.execute=function(e){e.clear({colorAction:t.TextureStoreAction.clear,depthAction:t.TextureStoreAction.clear,stencilAction:t.TextureStoreAction.clear});var r=e.renderingData.currentFrame.globalVolume,i=r.bloomIntensity,n=r.brightness,o=r.saturation,a=r.contrast,s=r.useBloom,u=r.useToneMapping;this.screenMesh.material.setTexture("_SceneTex",this.sceneTextureHandle.texture),this.screenMesh.material.setFloat("_Brightness",n),this.screenMesh.material.setFloat("_Saturation",o),this.screenMesh.material.setFloat("_Contrast",a),this.screenMesh.material.setInt("_UseBloom",s),s&&(this.screenMesh.material.setTexture("_GaussianTex",this.mainTexture),this.screenMesh.material.setFloat("_BloomIntensity",i)),this.screenMesh.material.setInt("_UseToneMapping",u),e.renderMeshes([this.screenMesh])},r}(vC),kC={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,useToneMapping:1},GC="_effects_default_",jC=1,XC=function(){function e(e){var r;this.destroyed=!1,this.renderPassInfoMap=new WeakMap;var i=e.camera,n=e.keepColorBuffer,o=e.renderer,a=e.editorTransform,s=void 0===a?[1,1,0,0]:a,u=e.globalVolume,c=e.clearAction,l=void 0===c?{colorAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.whatever}:c,h=o.engine;u&&(this.globalVolume=rb(rb({},kC),u)),this.globalUniforms=new HC;var f,p=[],d={};if(this.renderer=o,this.globalVolume){var m=this.globalVolume.useHDR?yb.HALF_FLOAT:yb.UNSIGNED_BYTE;p=[{texture:{format:yb.RGBA,type:m,magFilter:yb.LINEAR,minFilter:yb.LINEAR}}],f={storageType:t.RenderPassAttachmentStorageType.depth_stencil_opaque},d={colorAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,depthAction:t.TextureLoadAction.clear}}var v=[new vC(o,{name:GC,priority:fC,meshOrder:t.OrderType.ascending,depthStencilAttachment:f,attachments:p,clearAction:d})];if(this.setRenderPasses(v),this.globalVolume){var y=this.globalVolume.useBloom,g=new dC(h);if(y){var x=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],T=new Array(7),E=(m=this.globalVolume.useHDR?yb.HALF_FLOAT:yb.UNSIGNED_BYTE,new DC(o,{name:"BloomThresholdPass",attachments:[{texture:{format:yb.RGBA,type:m,minFilter:yb.LINEAR,magFilter:yb.LINEAR}}]}));E.sceneTextureHandle=g,this.addRenderPass(E);for(var A=0;A<7;A++){T[A]=new dC(h);var b=new zC(o,"H",{name:"GaussianDownPassH"+A,viewport:x,attachments:[{texture:{format:yb.RGBA,type:m,minFilter:yb.LINEAR,magFilter:yb.LINEAR}}]}),S=new zC(o,"V",{name:"GaussianDownPassV"+A,viewport:x,attachments:[{texture:{format:yb.RGBA,type:m,minFilter:yb.LINEAR,magFilter:yb.LINEAR}}]});S.gaussianResult=T[A],this.addRenderPass(b),this.addRenderPass(S),x[2]/=2,x[3]/=2}x[2]*=4,x[3]*=4;for(A=0;A<6;A++){var _=new UC(o,{name:"GaussianUpPass"+A,viewport:x,attachments:[{texture:{format:yb.RGBA,type:m,minFilter:yb.LINEAR,magFilter:yb.LINEAR}}]});_.gaussianDownSampleResult=T[5-A],this.addRenderPass(_),x[2]*=2,x[3]*=2}}var R=void 0;R=y?new BC(o,g):new BC(o),this.addRenderPass(R)}this.semantics=new nC(e.semantics),this.clearAction=l,this.name="RenderFrame".concat(jC++);var C=v[0],O={type:yb.UNSIGNED_BYTE,format:yb.RGBA,internalFormat:yb.RGBA,wrapS:yb.MIRRORED_REPEAT,wrapT:yb.MIRRORED_REPEAT,minFilter:yb.NEAREST,magFilter:yb.NEAREST};this.emptyTexture=wR.create(h,rb({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:t.TextureSourceType.data},O)),this.transparentTexture=wR.create(h,rb({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:t.TextureSourceType.data},O)),this.camera=i,this.keepColorBuffer=n,this.renderPassInfoMap.set(C,{listStart:0,listEnd:0,renderPass:C,intermedia:!1}),this.editorTransform=NS.fromArray(s),e.clearAction||this.resetClearActions(),this.passTextureCache=new iC(h);var w=h.gpuCapability,M=w.detail,I=$R(w.level,M.readableDepthStencilTextures&&M.writableFragDepth);null===(r=this.renderer.getShaderLibrary())||void 0===r||r.addShader(I)}return Object.defineProperty(e.prototype,"renderPasses",{get:function(){return this._renderPasses.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.addMeshToDefaultRenderPass=function(t){for(var e=this.renderPasses,r=this.renderPassInfoMap,i=t.priority,n=1;n<e.length;n++){var o=e[n-1],a=r.get(e[n]),s=r.get(o);if(a&&s&&(a.listStart>i&&(i>s.listEnd||1===n)))return this.addToRenderPass(o,t)}for(var u=e.length-1,c=e[u];u>=0&&!c.name.includes(GC);)c=e[--u];return this.addToRenderPass(c,t)},e.prototype.removeMeshFromDefaultRenderPass=function(e){for(var r,i,n,o=this,a=this.renderPasses,s=this.renderPassInfoMap,u=a.length-1;u>=0;u--){var c=a[u],l=s.get(c);if(l&&(l.listStart<=e.priority&&l.listEnd>=e.priority)){var h=c.meshes.indexOf(e);if(-1===h)return;var f=1===h&&c.meshes[0].name===qR;if(c.removeMesh(e),f){var p=a[u+1],d=c.meshes;l.intermedia||null===(r=l.preRenderPass)||void 0===r||r.resetColorAttachments([]);for(var m=1;m<d.length;m++)null===(i=l.preRenderPass)||void 0===i||i.addMesh(d[m]);var v=null===(n=c.attachments[0])||void 0===n?void 0:n.texture,y=v===this.resource.color_a||v===this.resource.color_b;c.dispose({meshes:t.DestroyOptions.keep,colorAttachment:y?t.RenderPassDestroyAttachmentType.keep:t.RenderPassDestroyAttachmentType.destroy,depthStencilAttachment:t.RenderPassDestroyAttachmentType.keep}),Ub(a,c),this.removeRenderPass(c),s.delete(c),p&&this.updateRenderInfo(p),l.preRenderPass&&this.updateRenderInfo(l.preRenderPass),l.prePasses&&l.prePasses.forEach((function(e){if(o.removeRenderPass(e.pass),!1!==(null==e?void 0:e.destroyOptions)){e.pass.attachments.forEach((function(t){t.texture===o.resource.color_b&&t.texture===o.resource.color_a||t.texture.dispose()}));var r=rb(rb({},(null==e?void 0:e.destroyOptions)?e.destroyOptions:{}),{depthStencilAttachment:t.RenderPassDestroyAttachmentType.keep});e.pass.dispose(r)}})),this.resetRenderPassDefaultAttachment(a,Math.max(u-1,0)),1===a.length&&(a[0].resetColorAttachments([]),this.removeRenderPass(this.resource.finalCopyRP))}return this.resetClearActions()}}},e.prototype.splitDefaultRenderPassByMesh=function(e,r){var i,n,o,a=this.findMeshRenderPassIndex(e),s=this.renderPasses[a];this.createResource();var u=s.meshes.indexOf(e),c=s.meshes.slice(0,u),l=s.meshes.slice(u),h=this.renderPassInfoMap;if(!(null===(i=r.attachments)||void 0===i?void 0:i.length))throw Error("should include at least one color attachment");var f=this.renderPasses,p=f.indexOf(s);f[p-1],Ub(f,s);var d=h.get(s);h.delete(s);var m=2===this.renderer.engine.gpuCapability.level?yb.LINEAR:yb.NEAREST,v=new vC(this.renderer,{name:GC+p,priority:s.priority,attachments:[{texture:{sourceType:t.TextureSourceType.framebuffer,format:yb.RGBA,name:"frame_a",minFilter:m,magFilter:m}}],clearAction:s.clearAction||{colorAction:t.TextureLoadAction.clear},storeAction:s.storeAction,depthStencilAttachment:this.resource.depthStencil,meshes:c,meshOrder:t.OrderType.ascending});l.unshift(this.createCopyMesh());var y=this.renderPasses;y[a]=v;var g=[],x=l.slice();r.prePasses&&(r.prePasses.forEach((function(t,e){t.priority=s.priority+1+e,t.setMeshes(l),g.push(t)})),y.splice.apply(y,sb([a+1,0],ab(g),!1)),x.splice(0,2));var T=this.resource.finalCopyRP;y.includes(T)||y.push(T);var E=g[g.length-1];E.initialize(this.renderer);var A=new vC(this.renderer,{name:GC+(p+1),priority:s.priority+1+((null===(n=r.prePasses)||void 0===n?void 0:n.length)||0),meshes:x,meshOrder:t.OrderType.ascending,depthStencilAttachment:this.resource.depthStencil,storeAction:r.storeAction,clearAction:{depthAction:t.TextureLoadAction.whatever,stencilAction:t.TextureLoadAction.whatever,colorAction:t.TextureLoadAction.whatever}});return y.splice(a+1+((null===(o=r.prePasses)||void 0===o?void 0:o.length)||0),0,A),this.setRenderPasses(y),this.updateRenderInfo(E),this.updateRenderInfo(v),this.updateRenderInfo(A),h.get(v).prePasses=d.prePasses,g.pop(),h.get(E).prePasses=g.map((function(t,e){return{pass:t,destroyOptions:!1}})),this.resetClearActions(),E},e.prototype.dispose=function(e){var r,i;(null==e?void 0:e.semantics)!==t.DestroyOptions.keep&&this.semantics.dispose();var n=(null==e?void 0:e.passes)?e.passes:void 0;n!==t.DestroyOptions.keep&&this._renderPasses.forEach((function(t){t.dispose(n)})),this.passTextureCache.dispose(),this._renderPasses.length=0,this.emptyTexture.dispose(),this.transparentTexture.dispose(),this.resource&&(this.resource.color_a.dispose(),this.resource.color_b.dispose(),null===(i=null===(r=this.resource.depthStencil)||void 0===r?void 0:r.texture)||void 0===i||i.dispose(),this.resource.finalCopyRP.dispose(),this.resource.resRP.dispose(),this.resource=null),this.destroyed=!0},e.prototype.resetRenderPassDefaultAttachment=function(t,e){for(var r,i,n,o=this.resource,a=o.color_a,s=o.color_b,u=e;u<t.length;u++){var c=t[u],l=null===(r=c.attachments[0])||void 0===r?void 0:r.texture;if(l&&n===l){var h=l===a?s:a;c.resetColorAttachments([h])}(l=null===(i=c.attachments[0])||void 0===i?void 0:i.texture)&&(n=l)}},e.prototype.findMeshRenderPassIndex=function(t){var e=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(GC)||!r.meshes.includes(t)||(e=i,!1)})),e},e.prototype.addToRenderPass=function(t,e){var r=this.renderPassInfoMap.get(t),i=e.priority;0===t.meshes.length?r.listStart=r.listEnd=i:i<r.listStart?r.listStart=i:i>r.listEnd&&(r.listEnd=i),t.addMesh(e)},e.prototype.getRPAttachments=function(t,e){var r;if(1===(null==t?void 0:t.length)){var i=t[0],n=i.texture,o=i.persistent,a=n.format,s=null!==(r=null==e?void 0:e.getInitAttachments())&&void 0!==r?r:[];if(a===yb.RGBA&&!o){var u=this.resource.color_a;return 0===s.length?[{texture:u}]:[{texture:s[0].texture===u?this.resource.color_b:u}]}}return t},e.prototype.resetClearActions=function(){var e=this.renderPasses.length>1?t.TextureLoadAction.clear:t.TextureLoadAction.whatever;this.clearAction.stencilAction=e,this.clearAction.depthAction=e,this.clearAction.colorAction=e,this.keepColorBuffer&&(this.clearAction.colorAction=t.TextureLoadAction.whatever)},e.prototype.updateRenderInfo=function(e){var r,i=this,n=this.renderPassInfoMap,o=this.renderPasses;n.has(e)?r=n.get(e):(r={intermedia:!1,renderPass:e,listStart:0,listEnd:0},n.set(e,r)),r.intermedia=e.attachments.length>0;var a=e.meshes;a[0]?(r.listStart=(a[0].name===qR?a[1]:a[0]).priority,r.listEnd=a[a.length-1].priority):(r.listStart=0,r.listEnd=0);var s=o.indexOf(e),u=0===s?t.TextureLoadAction.clear:t.TextureLoadAction.whatever;return 0===s&&(e.clearAction.colorAction=t.TextureLoadAction.clear),e.clearAction.depthAction=u,e.clearAction.stencilAction=u,s>-1?e.semantics.setSemantic("EDITOR_TRANSFORM",(function(){return i.editorTransform})):e.semantics.setSemantic("EDITOR_TRANSFORM",void 0),r.preRenderPass=o[s-1],r},e.prototype.setRenderPasses=function(t){var e=this;void 0!==this.renderer&&t.forEach((function(t){return t.initialize(e.renderer)})),this._renderPasses=t.slice()},e.prototype.addRenderPass=function(t){void 0!==this.renderer&&t.initialize(this.renderer),this._renderPasses.push(t)},e.prototype.createResource=function(){var e,r=this.renderer.engine;if(!this.resource){var i=r.gpuCapability,n=i.detail,o=i.level,a=this.renderer.getWidth(),s=this.renderer.getHeight(),u=2===o?yb.LINEAR:yb.NEAREST,c=wR.create(r,{sourceType:t.TextureSourceType.framebuffer,format:yb.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=wR.create(r,{sourceType:t.TextureSourceType.framebuffer,format:yb.RGBA,data:{width:a,height:s},minFilter:u,magFilter:u,name:"frame_b"}),h=n.readableDepthStencilTextures&&n.writableFragDepth?t.RenderPassAttachmentStorageType.depth_24_stencil_8_texture:t.RenderPassAttachmentStorageType.depth_stencil_opaque,f=new vC(this.renderer,{depthStencilAttachment:{storageType:h},attachments:[{texture:c}]}).initialize(this.renderer),p=new WC(this.renderer,{name:"effects-final-copy",priority:1600,clearAction:{depthAction:t.TextureLoadAction.clear,stencilAction:t.TextureLoadAction.clear,colorAction:t.TextureLoadAction.clear},meshOrder:t.OrderType.ascending,meshes:[this.createCopyMesh({blend:!0,depthTexture:null===(e=f.getDepthAttachment())||void 0===e?void 0:e.texture})]});this.resource={color_a:f.attachments[0].texture,color_b:l,finalCopyRP:p,depthStencil:f.depthAttachment,resRP:f}}},e.prototype.createCopyMesh=function(t){var e=qR,r=this.renderer.engine,i=aC.create(r,{name:e,mode:yb.TRIANGLE_STRIP,attributes:{aPos:{type:yb.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=$R(r.gpuCapability.level,!!(null==t?void 0:t.depthTexture));this.renderer.getShaderLibrary().addShader(n);var o=WR.create(r,{uniformValues:{uDepth:null==t?void 0:t.depthTexture},name:e,shader:n});return o.blending=!1,o.depthTest=!1,o.culling=!1,(null==t?void 0:t.blend)&&(o.blending=!0,o.blendFunction=[yb.SRC_ALPHA,yb.ONE_MINUS_SRC_ALPHA,yb.SRC_ALPHA,yb.ONE_MINUS_SRC_ALPHA]),hC.create(r,{name:e,geometry:i,material:o,priority:0})},e.prototype.removeRenderPass=function(t){Ub(this._renderPasses,t)},e}();function YC(t){return t?new CS(t.getWidth(),t.getHeight()):new CS}var WC=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(null)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",YC(this.prePassTexture)),t.renderMeshes(this.meshes),this.storeAction&&t.clear(this.storeAction)},e}(vC),HC=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},ZC=function(){function t(t){this.size=[0,0],this.multiSample=1,this.destroyed=!1;var e=t.storageType,r=t.format,i=t.attachment;this.storageType=e,this.format=r,this.attachment=i}return Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t}(),qC="function"==typeof WebGL2RenderingContext,QC=function(){function t(t){this.setupCapability(t)}return t.prototype.setupCapability=function(t){var e,r=qC&&t instanceof WebGL2RenderingContext?2:1,i=2===r,n=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),o=t.getExtension("WEBGL_depth_texture"),a=!!t.getExtension("OES_texture_half_float_linear"),s=!!t.getExtension("OES_texture_float_linear");this.level=r,this.type=i?"webgl2":"webgl",this.vaoExt=t.getExtension("OES_vertex_array_object"),this.glAsyncCompileExt=t.getExtension("KHR_parallel_shader_compile"),this.UNSIGNED_INT_24_8=t.UNSIGNED_INT_24_8,this.drawBufferExtension=t.getExtension("WEBGL_draw_buffers"),o&&(this.UNSIGNED_INT_24_8=o.UNSIGNED_INT_24_8_WEBGL),i&&!a&&(a=KC(t,t.HALF_FLOAT)),i&&!s&&(s=KC(t,t.FLOAT)),this.internalFormatDepth16=i?t.DEPTH_COMPONENT16:t.DEPTH_COMPONENT,this.internalFormatDepth24_stencil8=i?t.DEPTH24_STENCIL8:t.DEPTH_STENCIL;var u=i||t.getExtension("OES_texture_float")?t.FLOAT:0,c=i?WebGL2RenderingContext.HALF_FLOAT:(null===(e=t.getExtension("OES_texture_half_float"))||void 0===e?void 0:e.HALF_FLOAT_OES)||0,l={floatTexture:u,halfFloatTexture:c,maxSample:i?t.getParameter(t.MAX_SAMPLES):1,maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxFragmentTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),floatColorAttachment:i?!!t.getExtension("EXT_color_buffer_float"):u>0&&!!t.getExtension("WEBGL_color_buffer_float"),halfFloatColorAttachment:i?!!t.getExtension("EXT_color_buffer_float"):c>0&&!!t.getExtension("EXT_color_buffer_half_float"),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxShaderTexCount:t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS),compressedTexture:eO(t),halfFloatLinear:a,floatLinear:s,maxTextureAnisotropy:n?t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,shaderTextureLod:i||!!t.getExtension("EXT_shader_texture_lod"),instanceDraw:i||!!t.getExtension("ANGLE_instanced_arrays"),drawBuffers:i||!!this.drawBufferExtension,asyncShaderCompile:!!t.getExtension("KHR_parallel_shader_compile"),intIndexElementBuffer:!!t.getExtension("OES_element_index_uint"),standardDerivatives:i||!!t.getExtension("OES_standard_derivatives"),readableDepthStencilTextures:i||!!o,writableFragDepth:i||!!t.getExtension("EXT_frag_depth")};this.detail=l,n&&(this.textureMaxAnisotropyExt=n.TEXTURE_MAX_ANISOTROPY_EXT)},t.prototype.framebufferTexture2D=function(t,e,r,i,n){var o=this.drawBufferExtension;if(1===this.level&&!o&&r>0)throw new Error("draw multiple color buffers not available");var a=o?o["COLOR_ATTACHMENT".concat(r,"_WEBGL")]:t["COLOR_ATTACHMENT".concat(r)];a?t.framebufferTexture2D(e,a,i,n,0):console.error("invalid color attachment index: "+r)},t.prototype.drawBuffers=function(t,e){var r=this.drawBufferExtension;if(1!==this.level||r){var i=e.map((function(e,i){return e?r?r["COLOR_ATTACHMENT".concat(i,"_WEBGL")]:t["COLOR_ATTACHMENT".concat(i)]:t.NONE}));r?r.drawBuffersWEBGL(i):t.drawBuffers(i)}else if(e.length>1)throw Error("draw buffers not available")},t.prototype.setTextureAnisotropic=function(t,e,r){var i=this.detail.maxTextureAnisotropy;i&&t.texParameterf(e,this.textureMaxAnisotropyExt,Math.min(i,r||4))},t}();function KC(t,e){var r=t.createTexture(),i=!1;return t.getError(),t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,t.R16F,1,1,0,t.RED,e,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.getError()||(i=!0),t.deleteTexture(r),i}var JC,$C,tO={NONE:0,PVRTC:1,ASTC:2};function eO(t){return t.getExtension("WEBGL_compressed_texture_astc")?tO.ASTC:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?tO.PVRTC:tO.NONE}t.FilterMode=void 0,(JC=t.FilterMode||(t.FilterMode={}))[JC.Nearest=0]="Nearest",JC[JC.Linear=1]="Linear",t.RenderTextureFormat=void 0,($C=t.RenderTextureFormat||(t.RenderTextureFormat={}))[$C.RGBA32=0]="RGBA32",$C[$C.RGBAHalf=1]="RGBAHalf";var rO=function(){function t(){}return t.prototype.resize=function(t,e,r,i){},t.prototype.resetColorTextures=function(t){},t.prototype.unbind=function(){},t.prototype.bind=function(){},Object.defineProperty(t.prototype,"stencilStorage",{get:function(){},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"depthStorage",{get:function(){},enumerable:!1,configurable:!0}),t.prototype.getDepthTexture=function(){},t.prototype.getStencilTexture=function(){},t.prototype.getColorTextures=function(){return[]},t.prototype.dispose=function(t){},t}(),iO=function(){function t(){}return t.prototype.setGlobalFloat=function(t,e){},t.prototype.setGlobalInt=function(t,e){},t.prototype.setGlobalMatrix=function(t,e){},t.prototype.getFrameBuffer=function(){return null},t.prototype.setFrameBuffer=function(t){},t.prototype.setViewport=function(t,e,r,i){},t.prototype.resize=function(t,e){},t.prototype.clear=function(t){},t.prototype.getWidth=function(){return 0},t.prototype.getHeight=function(){return 0},t.prototype.addLostHandler=function(t){},t.prototype.addRestoreHandler=function(t){},t.prototype.lost=function(t){},t.prototype.restore=function(){},t.prototype.getShaderLibrary=function(){},t.prototype.renderRenderFrame=function(t){},t.prototype.renderMeshes=function(t){},t.prototype.drawGeometry=function(t,e){},t.prototype.getTemporaryRT=function(t,e,r,i,n,o){return null},t.prototype.dispose=function(t){},t}(),nO=1,oO=function(){function e(t,e,r,i){this.transform=r,this.engine=i,this.color=t.options.previewColor;var n=this.createMaterial(e),o=this.createGeometry();this.mesh=this.createMesh(o,n),this.updateMesh()}return e.prototype.updateMesh=function(){var t=this.mesh.material,e=t.getVector2("uSize").clone(),r=t.getVector4("uPos").clone(),i=new OS,n=new wS,o=this.transform.scale.clone();this.transform.assignWorldTRS(i,n,o),e.x=o.x,e.y=o.y,r.x=i.x,r.y=i.y,r.z=i.z,t.setVector2("uSize",e),t.setVector4("uPos",r),t.setQuaternion("uQuat",n)},e.prototype.createMaterial=function(e){var r,i=[["ENV_EDITOR",(null===(r=this.engine.renderer)||void 0===r?void 0:r.env)===pb]],n=E_(this.color).getValue(0),o=this.engine.gpuCapability.level,a={shader:{vertex:vR(i,"\nprecision highp float;\n\nattribute vec2 aPoint;\nuniform vec4 uPos;\nuniform vec2 uSize;\nuniform vec4 uQuat;\nuniform vec4 uColor;\nuniform mat4 effects_ObjectToWorld;\nuniform mat4 effects_MatrixInvV;\nuniform mat4 effects_MatrixVP;\nvarying vec4 vColor;\n#ifdef ENV_EDITOR\n uniform vec4 uEditorTransform;\n#endif\n\nvec3 rotateByQuat(vec3 a, vec4 quat){\n vec3 qvec = quat.xyz;\n vec3 uv = cross(qvec, a);\n vec3 uuv = cross(qvec, uv) * 2.;\n return a +(uv * 2. * quat.w + uuv);\n}\n\nvoid main() {\n vec4 _pos = uPos;\n vec3 point = rotateByQuat(vec3(aPoint.xy * uSize, 0.),uQuat);\n vec4 pos = vec4(_pos.xyz, 1.0);\n pos = effects_ObjectToWorld * pos;\n pos.xyz += effects_MatrixInvV[0].xyz * point.x+ effects_MatrixInvV[1].xyz * point.y;\n gl_Position = effects_MatrixVP * pos;\n vColor = uColor;\n #ifdef ENV_EDITOR\n gl_Position = vec4(gl_Position.xy * uEditorTransform.xy + uEditorTransform.zw * gl_Position.w, gl_Position.zw);\n #endif\n}\n",t.ShaderType.vertex,o),fragment:vR(i,"\nprecision highp float;\n\n#define fragColor gl_FragColor\n\nvarying vec4 vColor;\nvoid main() {\n gl_FragColor = vColor;\n}\n",t.ShaderType.fragment,o),glslVersion:t.GLSLVersion.GLSL1,cacheId:"".concat(e.cachePrefix,"_effects_interact")},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},s=WR.create(this.engine,a);return s.depthTest=!1,s.setVector4("uPos",new NS(0,0,0,0)),s.setVector2("uSize",new CS(1,1)),s.setVector4("uColor",new NS(n[0]/255,n[1]/255,n[2]/255,n[3])),s.setQuaternion("uQuat",new wS(0,0,0,0)),s},e.prototype.createGeometry=function(){var t=new Uint8Array([0,1,1,2,2,3,3,0]);return aC.create(this.engine,{attributes:{aPoint:{size:2,offset:0,stride:2*Float32Array.BYTES_PER_ELEMENT,data:new Float32Array([-.5,.5,.5,.5,.5,-.5,-.5,-.5])}},drawCount:t.length,indices:{data:t},mode:yb.LINES,maxVertex:4})},e.prototype.createMesh=function(t,e){return hC.create(this.engine,{name:"Interact_preview"+nO++,priority:0,worldMatrix:LS.fromIdentity(),geometry:t,material:e})},e}(),aO=function(e){function r(t,r){var i,n=e.call(this,t,r)||this;return n.engine=null===(i=n.composition)||void 0===i?void 0:i.getEngine(),n}return eb(r,e),Object.defineProperty(r.prototype,"type",{get:function(){return wb.interact},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(t){this.ui=t.content},r.prototype.onLifetimeBegin=function(t){var e,r,i,n=this.ui.options,o=(null!==(r=null===(e=this.engine)||void 0===e?void 0:e.renderer)&&void 0!==r?r:{}).env;null===(i=this.composition)||void 0===i||i.addInteractiveItem(this,n.type),n.type===Cb.DRAG&&(o!==pb||n.enableInEditor)&&t.event&&this.beginDragTarget(n,t.event)},r.prototype.onItemUpdate=function(){var t;if(null===(t=this.previewContent)||void 0===t||t.updateMesh(),this.dragEvent&&this.bouncingArg){this.bouncingArg.vx*=.95,this.bouncingArg.vy*=.95,this.bouncingArg.dy+=this.bouncingArg.vy,this.bouncingArg.dx+=this.bouncingArg.vx,sO(this.bouncingArg)?(this.dragEvent=null,this.bouncingArg=null):this.handleDragMove(this.dragEvent,this.bouncingArg)}},r.prototype.onItemRemoved=function(t){var e;t.removeInteractiveItem(this,this.ui.options.type),this.clickable=!1,null===(e=this.previewContent)||void 0===e||e.mesh.dispose(),this.endDragTarget()},r.prototype.getBoundingBox=function(){var e=this.transform.getWorldMatrix(),r=s_(OS.ZERO,.5,.5);return r.forEach((function(t){e.transformPoint(t.p0),e.transformPoint(t.p1),e.transformPoint(t.p2)})),{type:t.HitTestType.triangle,area:r}},r.prototype.getHitTestParams=function(){if(this.clickable){var t=this.ui.options.behavior,e=this.getBoundingBox();return e?{type:e.type,triangles:e.area,behavior:t}:void 0}},r.prototype.doCreateContent=function(t){var e,r=this.ui.options,i=r.type,n=r.showPreview,o=this.engine,a=(null!==(e=null==o?void 0:o.renderer)&&void 0!==e?e:{}).env;if(tS(o),i===Cb.CLICK&&(this.clickable=!0,n&&a===pb)){var s=t.getRendererOptions();this.previewContent=new oO(this.ui,s,this.transform,o)}return{}},r.prototype.beginDragTarget=function(t,e){var r=this;if("camera"===t.target){var i,n={touchstart:function(t){var e;r.dragEvent=null,r.bouncingArg=null;var n=null===(e=r.composition)||void 0===e?void 0:e.camera;i={x:t.x,y:t.y,cameraParam:{position:(null==n?void 0:n.position.toArray())||[0,0,8],fov:(null==n?void 0:n.fov)||60}}},touchmove:function(t){r.handleDragMove(i,t),r.bouncingArg=t},touchend:function(t){var e=r.bouncingArg;if(!sO(e,3)&&e){e.vx*=5,e.vy*=5,r.dragEvent=rb({},i)}i=null}};Object.keys(n).forEach((function(t){e.addEventListener(t,n[t])})),n.touchmove({dx:0,dy:0,width:1,height:1}),this.endDragTarget=function(){Object.keys(n).forEach((function(t){e.removeEventListener(t,n[t])}))}}},r.prototype.endDragTarget=function(){},r.prototype.handleDragMove=function(t,e){var r,i;if(t&&t.cameraParam&&this.composition){var n=this.ui.options,o=t.cameraParam,a=o.position,s=o.fov,u=e.dy,c=e.dx*e.width/e.height,l=a[2],h=Math.tan(s*Math.PI/180/2)*Math.abs(l),f=u*h,p=c*h,d=a[0]-p,m=a[1]-f;if(n.dxRange){var v=ab(n.dxRange,2);(d=_S(d,y=v[0],g=v[1]))!==y&&d!==g&&y!==g&&(null===(r=e.origin)||void 0===r||r.preventDefault())}if(n.dyRange){var y,g,x=ab(n.dyRange,2);(m=_S(m,y=x[0],g=x[1]))!==y&&m!==g&&y!==g&&(null===(i=e.origin)||void 0===i||i.preventDefault())}this.composition.camera.position.set(d,m,l)}},r}(Y_);function sO(t,e){var r=1e-5*(e||1);return t&&Math.abs(t.vx||0)<r&&Math.abs(t.vy||0)<r}var uO=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.mesh=[],e}return eb(e,t),e.prototype.onCompositionItemLifeBegin=function(t,e){e instanceof aO&&e.previewContent&&this.addMesh(e.previewContent.mesh)},e.prototype.onCompositionItemRemoved=function(t,e){e instanceof aO&&e.previewContent&&this.removeMesh(e.previewContent.mesh,t.renderFrame)},e.prototype.prepareRenderFrame=function(t,e){return this.mesh&&this.mesh.forEach((function(t){return e.addMeshToDefaultRenderPass(t)})),this.mesh=[],!1},e.prototype.addMesh=function(t){this.mesh.push(t)},e.prototype.removeMesh=function(t,e){e.removeMeshFromDefaultRenderPass(t)},e}($_),cO=function(){};t.maxSpriteMeshItemCount=8,t.maxSpriteTextureCount=8;var lO=1,hO=function(){function e(t,e,r){this.engine=t,this.composition=r,this.items=[],this.dirty=!1;var i=e.wireframe,n=this.createGeometry(i?yb.LINES:yb.TRIANGLES),o=this.createMaterial(e,2);this.wireframe=i,this.mesh=hC.create(t,{name:"MSprite"+lO++,priority:0,worldMatrix:LS.fromIdentity(),geometry:n,material:o})}return e.prototype.setItems=function(e){var r,i,n,o,a=[],s=[],u=2,c=0,l=0,h=0;if(!e.length)return this.mesh.setVisible(!0),!0;this.items=e.slice(),e.length>2&&(u=t.maxSpriteMeshItemCount);var f=e[0].renderInfo;this.mtlSlotCount!==u&&this.mesh.setMaterial(this.createMaterial(f,u),{textures:t.DestroyOptions.keep});var p=null!==(o=null===(n=null===(i=null===(r=null==f?void 0:f.filter)||void 0===r?void 0:r.passSplitOptions)||void 0===i?void 0:i.attachments)||void 0===n?void 0:n.length)&&void 0!==o?o:0;this.splitLayer=p>0;for(var d=0;d<e.length;d++){(_=null==(m=e[d])?void 0:m.renderer.texture)&&zb(s,_),m.mesh=this}for(d=0;d<e.length;d++){var m,v=(_=null==(m=e[d])?void 0:m.renderer.texture)?s.indexOf(_):-1,y=this.getItemInitData(m,d,h,v);c+=y.aPoint.length,l+=y.index.length,a.push(y),h+=y.aPoint.length/6,this.updateItem(m,!0)}var g={aPoint:new Float32Array(c),index:new Uint16Array(l)},x={aPoint:0,index:0},T=function(t){var e=a[t];Object.keys(g).forEach((function(t){var r=g[t],i=e[t];r.set(i,x[t]),x[t]+=i.length}))};for(d=0;d<a.length;d++)T(d);var E=this.mesh,A=E.material,b=E.geometry,S=g.index;b.setIndexData(S),b.setAttributeData("aPoint",g.aPoint),b.setDrawCount(l),this.mesh.setVisible(!b.getDrawCount()),this.mesh.priority=e[0].listIndex;for(d=0;d<s.length;d++){var _=s[d];A.setTexture("uSampler"+d,_)}for(var R=e[0].emptyTexture,C=s.length;C<t.maxSpriteMeshItemCount;C++)A.setTexture("uSampler"+C,R);if(this.splitLayer){var O=function(t,e){var r;if(e){for(var i=128,n=new Uint8Array(i),o=0,a=i-1;o<i;o++){var s=o/a,u=e.getValue(s);n[o]=Math.round(255*u)}r=wR.createWithData(t,{width:i,height:1,data:n},{name:"feather",format:yb.LUMINANCE,minFilter:yb.LINEAR,magFilter:yb.LINEAR,wrapS:yb.CLAMP_TO_EDGE,wrapT:yb.CLAMP_TO_EDGE})}else r=wR.createWithData(t);return r}(this.engine,e[0].feather);A.setTexture("uFeatherSampler",O)}},e.prototype.updateItem=function(t,e){var r=this.items.indexOf(t);if(!(r<=-1)){var i=this.mesh.material.getVector4Array("uTexParams"),n=4*r,o=t.getRenderData(t.time,e),a=this.mesh.material.getMatrixArray("uMainData"),s=16*r,u=s,c=s+4,l=s+8,h=s+12;if(o.visible){var f=o.color||[a[h],a[h+1],a[h+2],a[h+3]],p=new OS,d=new wS,m=new OS;o.transform.assignWorldTRS(p,d,m);var v=sb(sb([],ab(p.toArray()),!1),[0],!1),y=sb(sb([],ab(m.toArray()),!1),[0],!1),g=d.toArray();isNaN(t.getCustomOpacity())||(f[3]=t.getCustomOpacity());for(var x=0;x<4;x++)a[u+x]=v[x],a[l+x]=g[x],a[c+x]=y[x],a[h+x]=f[x];if(y[2]=o.life,a[c+2]=o.life,e){var T=t.renderer;i[n]=T.occlusion?+T.transparentOcclusion:1,i[n+2]=T.renderMode,i[n+1]=+this.preMultiAlpha}if(o.texOffset){var E=this.mesh.material.getVector4Array("uTexOffset");for(x=0;x<4;x++)E[4*r+x]=o.texOffset[x]}}else a[c+2]=-1}},e.prototype.applyChange=function(){this.dirty&&(this.setItems(this.items),this.dirty=!1)},e.prototype.getItemInitData=function(t,e,r,i){var n=t.geoData;this.lineMode?n=this.getItemGeometryData(t,e):n||(n=t.geoData=this.getItemGeometryData(t,e));var o=n.aPoint;if(o[4]!==e||o[5]!==i)for(var a=0;a<o.length;a+=6)o[a+4]=e,o[a+5]=i;var s=n.index,u=s.length,c=this.wireframe?new Uint8Array([0,1,1,3,2,3,2,0]):new s.constructor(u);if(!this.wireframe)for(a=0;a<u;a++)c[a]=r+s[a];return{aPoint:n.aPoint,index:c}},e.prototype.getItemRegionData=function(t){var e=this.items.indexOf(t);if(e>-1){var r=this.mesh.material.getMatrixArray("uMainData"),i=16*e;if(null===r)return;return{position:[r[i]||0,r[i+1]||0,r[i+2]||0],size:[r[i+4],r[i+5]],quat:[r[i+8],r[i+9],r[i+10],r[i+11]],color:[r[i+12],r[i+13],r[i+14],r[i+15]]}}},e.prototype.invalidMaterial=function(){this.mtlSlotCount=0},e.prototype.createGeometry=function(e){var r=Float32Array.BYTES_PER_ELEMENT;return aC.create(this.engine,{attributes:{aPoint:{size:4,offset:0,stride:ub*r,releasable:!0,type:yb.FLOAT,data:new Float32Array(0)},aIndex:{size:2,offset:4*r,stride:ub*r,dataSource:"aPoint",type:yb.FLOAT}},indices:{data:new Uint16Array(0),releasable:!0},mode:e,maxVertex:4*t.maxSpriteMeshItemCount})},e.prototype.createMaterial=function(t,e){var r,i,n,o=t.filter,a=t.side,s=t.occlusion,u=t.blending,c=t.maskMode,l=t.mask,h=(null==o?void 0:o.mesh)||{},f=this.engine,p={shader:mO(t,e,f.gpuCapability.level,null===(n=f.renderer)||void 0===n?void 0:n.env)};this.preMultiAlpha=fR(u),this.mtlSlotCount=e;var d=WR.create(f,p),m=rb({side:a,blending:!0,blendMode:u,mask:l,maskMode:c,depthTest:!0,depthMask:s},h.materialStates);d.blending=m.blending,d.stencilRef=void 0!==m.mask?[m.mask,m.mask]:void 0,d.depthTest=m.depthTest,d.depthMask=m.depthMask,m.blending&&yR(d,m.blendMode),d.blendFunction=m.blendFunction,xR(d,m.maskMode),gR(d,m.side);var v=h.uniformValues;if(v)try{for(var y=ob(Object.keys(v)),g=y.next();!g.done;g=y.next()){var x=g.value,T=v[x];T instanceof wR?d.setTexture(x,T):"number"==typeof T?d.setFloat(x,T):2===T.length?d.setVector2(x,CS.fromArray(T)):4===T.length?d.setVector4(x,NS.fromArray(T)):d.setMatrix(x,LS.fromArray(T))}}catch(t){r={error:t}}finally{try{g&&!g.done&&(i=y.return)&&i.call(y)}finally{if(r)throw r.error}}for(var E=[],A=[],b=[],S=0;S<e;S++)E.push(LS.fromIdentity()),A.push(new NS),b.push(new NS);return d.hasUniform("uMainData")||d.setMatrixArray("uMainData",E),d.hasUniform("uTexParams")||d.setVector4Array("uTexParams",A),d.hasUniform("uTexOffset")||d.setVector4Array("uTexOffset",b),d},e.prototype.getItemGeometryData=function(t,e){var r=t.splits,i=t.renderer,n=t.textureSheetAnimation,o=t.startSize,a=o.x,s=o.y;if(i.shape){for(var u=i.shape,c=u.index,l=u.aPoint,h=new Float32Array(l),f=0;f<h.length;f+=6)h[f]*=a,h[f+1]*=s;return{index:c,aPoint:Array.from(h)}}var p=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],d=[],m=[],v=2,y=2;1===r.length&&(v=1,y=1);for(var g=0;g<v;g++)for(var x=0;x<y;x++){var T=4*(2*x+g),E=n?[0,0,1,1,r[0][4]]:r[2*x+g],A=E[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],b=((g+g+1)/v-1)/2,S=((x+x+1)/y-1)/2,_=E[0],R=E[1],C=E[4]?E[3]:E[2],O=E[4]?E[2]:E[3],w=[p[0]/v+b,p[1]/y+S,p[2]/v+b,p[3]/y+S,p[4]/v+b,p[5]/y+S,p[6]/v+b,p[7]/y+S];d.push(w[0]*a,w[1]*s,A[0]*C+_,A[1]*O+R,e,0,w[2]*a,w[3]*s,A[2]*C+_,A[3]*O+R,e,0,w[4]*a,w[5]*s,A[4]*C+_,A[5]*O+R,e,0,w[6]*a,w[7]*s,A[6]*C+_,A[7]*O+R,e,0),this.lineMode?m.push(T,1+T,1+T,3+T,3+T,2+T,2+T,T):m.push(T,1+T,2+T,2+T,1+T,3+T)}return{index:m,aPoint:d}},e}();function fO(t){var e,r=t.renderer,i=t.filter,n=r.blending,o=r.side,a=r.occlusion,s=r.mask,u=r.maskMode,c=r.order,l=+n,h=t.cachePrefix||"-",f=(null===(e=null==i?void 0:i.mesh)||void 0===e?void 0:e.shaderCacheId)||"$F$";return{side:o,occlusion:a,blending:n,mask:s,maskMode:u,cachePrefix:h,filter:i,cacheId:"".concat(h,".").concat(f,".").concat(+o,"+").concat(+a,"+").concat(l,"+").concat(c,"+").concat(u,".").concat(s)}}function pO(e,r,i){var n=null!=i?i:{},o=n.count,a=void 0===o?2:o,s=n.env,u=void 0===s?"":s,c=n.ignoreBlend,l=n.wireframe,h=[["MAX_ITEM_COUNT",a],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",u===pb],["ADJUST_LAYER",!!r],["USE_BLEND",!c],["MAX_FRAG_TEX",t.maxSpriteTextureCount>=16?16:8]],f=l?yC:xC.replace(/#pragma\s+FILTER_FRAG/,(null==r?void 0:r.fragment)||""),p=gC.replace(/#pragma\s+FILTER_VERT/,(null==r?void 0:r.vertex)||"vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}");return{fragment:vR(h,f,t.ShaderType.fragment,e),vertex:vR(h,p,t.ShaderType.vertex,e),glslVersion:1===e?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,marcos:h,shared:!0}}function dO(t,e){return t.filter?"".concat(t.filter.mesh.shaderCacheId,"_effects_filter"):"".concat(t.cachePrefix,"_effects_sprite_").concat(e)}function mO(t,e,r,i){var n=t.filter,o=t.wireframe,a=pO(r,null==n?void 0:n.mesh,{count:e,wireframe:o,env:i});return a.shared=!0,o||(a.cacheId=dO(t,e)),a}function vO(e){t.maxSpriteMeshItemCount=e}var yO="listIndex",gO=function(){function e(t){this.composition=t,this.meshSplits=[],this.items=[],this.meshes=[],this.time=0,this.itemsToRemove=[],this.itemsToAdd=[],this.engine=t.getEngine()}return e.prototype.resetMeshSplits=function(){this.meshSplits.length=0,this.meshes.length=0,this.items.length=0,this.itemsToAdd.length=0,this.itemsToRemove.length=0},e.prototype.diffMeshSplits=function(){for(var e,r,i,n,o,a,s=this.meshSplits,u=this.itemsToRemove,c=this.itemsToAdd,l=[],h=[],f=[],p=[],d=this.items,m={layerToAdd:[]},v=[],y=0;y<u.length;y++){if(xO(T=u[y]))l.push.apply(l,sb([],ab(this.removeMeshSplitsItem(d,T,s,u)),!1)),this.check();else{var g=d.indexOf(T);g>-1&&(d.splice(g,1),v.length=0,g>0&&(v=this.combineSplits(d,g-1,s),l.push.apply(l,sb([],ab(v),!1))),!v.length&&g<=d.length-1&&(v=this.combineSplits(d,g,s),l.push.apply(l,sb([],ab(v),!1))),this.check())}}var x=!1;for(y=0;y<c.length;y++)for(var T=c[y],E=this.addMeshSplitsItem(d,T,s),A=0;A<E.length;A++){var b=E[A];if(b.spriteMesh)throw new Error("no sprite mesh in neo split");var S=b.spriteMesh=new hO(this.engine,b.renderInfo,this.composition);h.push(S.mesh),S.setItems(b.items.map((function(t){return t.content}))),S.applyChange(),S.splitLayer&&(null===(e=m.layerToAdd)||void 0===e||e.push(S)),b.dirty=!1,this.check(),x=!0}if(x){var _,R=function(e){var u=s[e],c=s[e+1];if(c.cacheId===u.cacheId&&!(null===(r=c.spriteMesh)||void 0===r?void 0:r.splitLayer)&&!(null===(i=u.spriteMesh)||void 0===i?void 0:i.splitLayer)&&u.items.length+c.items.length<=t.maxSpriteMeshItemCount){var l=u.items[0],p=c.items[c.items.length-1],m=C.getMeshSplits(d,d.indexOf(l),d.indexOf(p));if(1===m.length){Object.keys(m[0]).forEach((function(t){u[t]=m[0][t]})),null===(n=u.spriteMesh)||void 0===n||n.setItems(u.items.map((function(t){return t.content}))),null===(o=u.spriteMesh)||void 0===o||o.applyChange();var v=null===(a=c.spriteMesh)||void 0===a?void 0:a.mesh;u.spriteMesh&&u.spriteMesh.mesh&&(u.spriteMesh.mesh.priority=c.indexEnd),h.includes(v)?Ub(h,v):zb(f,v),s.splice(e+1,1),e--}}_=e},C=this;for(y=0;y<s.length-1;y++)R(y),y=_}u.length=0;for(y=0;y<s.length;y++){var O=(M=s[y]).spriteMesh;if(0===M.items.length)throw new Error("split not combined");if(M.dirty){var w=M.indexStart;O.mesh.priority!==w&&(O.mesh.priority=w,p.push(O.mesh)),O.setItems(M.items.map((function(t){return t.content})))}O.applyChange(),M.dirty=!1}if(l.length)for(y=0;y<l.length;y++){var M,I=(S=(M=l[y]).spriteMesh).mesh;I.dispose({material:{textures:t.DestroyOptions.keep}}),f.push(I)}if(this.itemsToRemove.length=0,this.itemsToAdd.length=0,h.length+f.length+p.length){var L=this.meshes;return this.meshSplits.forEach((function(t,e){return L[e]=t.spriteMesh.mesh})),L.length=this.meshSplits.length,{add:h.length?h:void 0,remove:f.length?f:void 0,modify:p.length?p:void 0,layer:m.layerToAdd.length>0?m:void 0}}},e.prototype.addItem=function(t){this.items.includes(t)?Ub(this.itemsToRemove,t):zb(this.itemsToAdd,t)},e.prototype.removeItem=function(t){this.items.includes(t)?xO(t)?this.itemsToRemove.unshift(t):this.itemsToRemove.push(t):Ub(this.itemsToAdd,t)},e.prototype.getSpriteMesh=function(t){for(var e=this.meshSplits,r=0;r<e.length;r++){var i=e[r].spriteMesh;if(i.items.indexOf(t)>-1)return i}},e.prototype.onUpdate=function(t){for(var e=this.meshSplits,r=0;r<e.length;r++){for(var i=e[r].spriteMesh,n=i.items,o=0;o<n.length;o++){var a=n[o];a.ended||i.updateItem(a)}i.applyChange()}},e.prototype.dispose=function(){this.meshSplits.forEach((function(t){var e;null===(e=t.spriteMesh)||void 0===e||e.mesh.dispose()}))},e.prototype.check=function(){},e.prototype.addMeshSplitsItem=function(t,e,r){if(-1!==t.indexOf(e))throw Error("item has been added");if(!r[0]){if(Bb(t,e,yO),xO(e)){var i=e.createContent(),n={indexStart:e.listIndex,indexEnd:e.listIndex,items:[e],renderInfo:i.renderInfo,cacheId:i.renderInfo.cacheId,textures:[e.content.renderer.texture]};return r.unshift(n),[n]}return[]}for(var o=function(i){var n=r[i],o=e.listIndex;if(xO(e)){if(o<=n.indexEnd){Bb(t,e,yO);var s=t.indexOf(e),u=Math.min(s,t.indexOf(n.items[0])),c=Math.max(s,t.indexOf(n.items[n.items.length-1])),l=a.getMeshSplits(t,u,c),h=l.findIndex((function(t){return t.items.includes(e)}));if(2===l.length)return r.splice(i+h,0,l[h]),Object.keys(l[1-h]).forEach((function(t){n[t]=l[1-h][t]})),{value:[l[h]]};if(3===l.length){if(Object.keys(l[0]).forEach((function(t){n[t]=l[0][t]})),r.splice(i+1,0,l[1],l[2]),1!==h)throw Error("neo split not in middle");return{value:[l[1],l[2]]}}if(1!==l.length)throw Error("invalid splits 1");return Object.keys(l[0]).forEach((function(t){n[t]=l[0][t]})),{value:[]}}}else{if(o<n.indexStart||o===n.indexEnd)return Bb(t,e,yO),{value:[]};if(o<n.indexEnd){Bb(t,e,yO);var f=n.items[n.items.length-1],p=t.indexOf(f),d=a.getMeshSplits(t,t.indexOf(n.items[0]),p);if(Object.keys(d[0]).forEach((function(t){n[t]=d[0][t]})),2===d.length)return r.splice(i+1,0,d[1]),{value:[d[1]]};if(1!==d.length)throw Error("invalid splits 2")}}},a=this,s=0;s<r.length;s++){var u=o(s);if("object"==typeof u)return u.value}if(Bb(t,e,yO),xO(e)){var c=r[r.length-1],l=this.getMeshSplits(t,t.indexOf(c.items[0]),t.indexOf(e));if(Object.keys(l[0]).forEach((function(t){c[t]=l[0][t]})),2===l.length)return r.push(l[1]),[l[1]];if(1!==l.length)throw Error("invalid splits 3")}return[]},e.prototype.removeMeshSplitsItem=function(t,e,r,i){for(var n,o,a=null,s=-1,u=[],c=0;c<r.length;c++){var l=r[c];if(l.indexStart<=e.listIndex&&l.indexEnd>=e.listIndex){a=l,s=c;break}}if(a){var h=a.items.indexOf(e);if(h<0){if(null==i?void 0:i.includes(e))return[];throw Error("item not found")}if(a.items.splice(h,1),a.dirty=!0,Ub(t,e),0===a.items.length){if(Ub(r,a),u.push(a),a=r[s-=1],!r.length||s<0)return u}else a.indexEnd=a.items[a.items.length-1].listIndex,a.indexStart=a.items[0].listIndex;if(0===s||s===r.length-2){var f=r[s],p=r[s+1];if(f&&p){var d=f.items[0],m=p.items[p.items.length-1];1===(v=this.getMeshSplits(t,t.indexOf(d),t.indexOf(m))).length&&(v[0].spriteMesh=r[s].spriteMesh,null===(n=v[0].spriteMesh)||void 0===n||n.invalidMaterial(),r[s]=v[0],u.push(r.splice(s+1,1)[0]))}}else if(s===r.length-1)if(0===a.items.length)u.push(r.splice(s,1)[0]);else{f=r[s-1],p=r[s],d=f.items[0],m=p.items[p.items.length-1];1===(v=this.getMeshSplits(t,t.indexOf(d),t.indexOf(m))).length&&(v[0].spriteMesh=r[s-1].spriteMesh,null===(o=v[0].spriteMesh)||void 0===o||o.invalidMaterial(),r[s-1]=v[0],u.push(r.splice(s,1)[0]))}else{var v;f=r[s-1],p=r[s+1],d=f.items[0],m=p.items[p.items.length-1];2===(v=this.getMeshSplits(t,t.indexOf(d),t.indexOf(m))).length&&(v[0].spriteMesh=r[s].spriteMesh,v[1].spriteMesh=r[s+1].spriteMesh,r[s]=v[0],r[s+1]=v[1],u.push(r.splice(s-1,1)[0]))}}return u},e.prototype.combineSplits=function(t,e,r){var i=t[e],n=[];if(xO(i)&&i.composition){for(var o=void 0,a=0;a<r.length;a++){if(r[a].items.includes(i)){o=a;break}}var s=void 0,u=void 0;if(0===o?(s=r[o],u=r[o+1]):(s=r[o-1],u=r[o]),s&&u){var c=t.indexOf(s.items[0]),l=t.indexOf(u.items[u.items.length-1]);if(Number.isInteger(c)&&Number.isInteger(l)){var h=this.getMeshSplits(t,c,l);1===h.length&&(h[0].spriteMesh=r[o].spriteMesh,0===o?(r[0]=h[0],n.push(r.splice(1,1)[0])):(n.push(r.splice(o-1,1)[0]),r[o-1]=h[0]))}}}return n},e.prototype.getMeshSplits=function(e,r,i,n){void 0===r&&(r=0),void 0===i&&(i=e.length-1);for(var o=null,a=[],s=r;s<=i;s++){var u=e[s];if(n||u.started&&!(u.lifetime<0))if(xO(u)){var c=u.createContent().renderInfo.cacheId,l=u.content.renderer.texture,h=!0;if(o){var f=o.textures.includes(l)?0:1;o.cacheId===c&&Y_.isSprite(u)&&o.items.length<t.maxSpriteMeshItemCount&&f+o.textures.length<=t.maxSpriteTextureCount?(Bb(o.items,u,yO),zb(o.textures,l),h=!1):a.push(o)}h&&(o={indexStart:u.listIndex,cacheId:c,renderInfo:u.content.renderInfo,items:[u],textures:[l]})}else{if(n&&!u.contentVisible)continue;o&&(a.push(o),o=null)}}return o&&a.push(o),a.forEach((function(t){t.indexEnd=t.items[t.items.length-1].listIndex,t.dirty=!0})),a},e}();function xO(t){return Y_.isSprite(t)||Y_.isFilterSprite(t)}var TO={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},EO=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="sprite",t}return eb(r,e),r.precompile=function(e,r,i){var n,o=r.getShaderLibrary(),a=r.engine.gpuCapability,s=a.level,u=a.detail,c=(null!=i?i:{}).env;if(!o.shaderResults[dO(TO,2)]){o.addShader(mO(TO,2,s,c)),o.addShader(mO(TO,t.maxSpriteMeshItemCount,s,c));var l=!1;null===(n=e[0])||void 0===n||n.items.forEach((function(e){t.Item.isFilter(e)&&e.content.filter&&(l=!0,Nb(e.content.filter).forEach((function(t){if(!t.isParticle){var e=pO(s,t,t);t.shaderCacheId&&(e.cacheId="".concat(t.shaderCacheId,"_effects_filter")),o.addShader(e)}})))})),l&&o.addShader($R(s,!1)),u.writableFragDepth&&o.addShader($R(s,!0))}return Promise.resolve()},r.prototype.onCompositionDestroyed=function(t){t.loaderData.spriteGroup.dispose(),delete t.loaderData.spriteGroup},r.prototype.onCompositionReset=function(t,e){if(!t.loaderData.spriteGroup){var r=new gO(t);t.loaderData.spriteGroup=r,r.resetMeshSplits()}},r.prototype.onCompositionItemLifeBegin=function(t,e){var r=t.loaderData.spriteGroup;e.type!==wb.composition&&r.addItem(e)},r.prototype.onCompositionItemRemoved=function(t,e){t.loaderData.spriteGroup.removeItem(e)},r.prototype.onCompositionUpdate=function(t,e){t.loaderData.spriteGroup.onUpdate(e)},r.prototype.prepareRenderFrame=function(t,e){var r,i,n,o=t.loaderData.spriteGroup.diffMeshSplits();return!!o&&(null===(r=o.remove)||void 0===r||r.forEach((function(t){return e.removeMeshFromDefaultRenderPass(t)})),null===(i=o.add)||void 0===i||i.forEach((function(t){return e.addMeshToDefaultRenderPass(t)})),null===(n=o.modify)||void 0===n||n.forEach((function(t){e.removeMeshFromDefaultRenderPass(t),e.addMeshToDefaultRenderPass(t)})),!!(this.layerInfo=o.layer))},r.prototype.postProcessFrame=function(t,e){var r,i;null===(i=null===(r=this.layerInfo)||void 0===r?void 0:r.layerToAdd)||void 0===i||i.forEach((function(t){var r=t.items[0].filter;if(void 0!==r){var i=r.passSplitOptions,n=e.splitDefaultRenderPassByMesh(t.mesh,i);r.renderPassDelegate&&(n.delegate=r.renderPassDelegate),r.onRenderPassCreated&&r.onRenderPassCreated(n,e)}})),this.layerInfo=void 0},r}($_),AO=new VS,bO=new OS(1,1,1);new OS;var SO=function(){function t(t,e){var r;this.active=!1,this.transform=e.transform;var i=this.transform.scale;this.basicTransform={position:this.transform.position.clone(),rotation:this.transform.getRotation(),scale:new OS(i.x,i.y,i.x)};var n=t.rotationOverLifetime,o=t.sizeOverLifetime,a=t.positionOverLifetime,s=void 0===a?{}:a;if(s){s.path&&(this.basicTransform.path=E_(s.path));var u=s.linearX||s.linearY||s.linearZ;u&&(this.linearVelOverLifetime={x:s.linearX&&E_(s.linearX),y:s.linearY&&E_(s.linearY),z:s.linearZ&&E_(s.linearZ),asMovement:s.asMovement,enabled:!!u});var c=s.orbitalX||s.orbitalY||s.orbitalZ;c&&(this.orbitalVelOverLifetime={x:s.orbitalX&&E_(s.orbitalX),y:s.orbitalY&&E_(s.orbitalY),z:s.orbitalZ&&E_(s.orbitalZ),center:KS(s.orbCenter),asRotation:s.asRotation,enabled:!!c}),this.speedOverLifetime=s.speedOverLifetime&&E_(s.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=E_(o.x||1),this.sizeYOverLifetime=E_(o.y||1),this.sizeZOverLifetime=E_(o.z||1)):this.sizeXOverLifetime=E_(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:E_(n.z||0)},n.separateAxes)){var l=this.rotationOverLifetime;l.x=E_(n.x||0),l.y=E_(n.y||0)}this.options={reusable:!!e.reusable,delay:e.delay||0,startSpeed:s.startSpeed||0,startSize:i&&i.x||1,sizeAspect:i&&i.x/(i.y||1)||1,duration:e.duration||0,looping:e.endBehavior&&e.endBehavior===oS.loop,endBehavior:e.endBehavior||0,gravity:OS.fromArray(s.gravity||[]),gravityModifier:E_(null!==(r=s.gravityOverLifetime)&&void 0!==r?r:0),direction:s.direction?OS.fromArray(s.direction).normalize():new OS},this.id=e.id,this.time=0,this.name=e.name,this.visible=e.getVisible()}return Object.defineProperty(t.prototype,"ended",{get:function(){return this.time>this.options.duration&&!this.options.looping&&!this.options.reusable},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startSize",{get:function(){return this.basicTransform.scale},set:function(t){this.basicTransform.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"velocity",{get:function(){return this._velocity||(this._velocity=this.options.direction.clone(),this._velocity.multiply(this.options.startSpeed)),this._velocity},enumerable:!1,configurable:!0}),t.prototype.getWillTranslate=function(){return!!(this.linearVelOverLifetime&&this.linearVelOverLifetime.enabled||this.orbitalVelOverLifetime&&this.orbitalVelOverLifetime.enabled||this.options.gravityModifier&&!this.options.gravity.isZero()||this.options.startSpeed&&!this.options.direction.isZero())},t.prototype.updateTime=function(t){var e=t-this.options.delay,r=this.options.duration;if(e>=r&&this.options.looping){for(var i=e-r;i>r;)i-=r;this.time=i}else{var n=4===this.options.endBehavior;this.time=n?Math.min(r,e):e}},t.prototype.getRenderData=function(t,e){var r=this.options,i=bO.setFromNumber(1),n=AO.set(0,0,0),o=!1,a=!1,s=t<0?t:Math.max(t,0),u=r.duration,c=s/u,l={life:c,transform:this.transform};c=c<0?0:c>1?1:c,this.sizeXOverLifetime&&(i.x=this.sizeXOverLifetime.getValue(c),this.sizeSeparateAxes?(i.y=this.sizeYOverLifetime.getValue(c),i.z=this.sizeZOverLifetime.getValue(c)):i.z=i.y=i.x,o=!0),this.calculateScaling(o,i,e);var h,f=this.rotationOverLifetime;if(f){var p=function(t){return f.asRotation?t.getValue(c):t.getIntegrateValue(0,c,u)},d=p(f.z),m=f.separateAxes;n.x=m?p(f.x):0,n.y=m?p(f.y):0,n.z=d,a=!0}if(a||e){var v=AO.addEulers(this.basicTransform.rotation,n);l.transform.setRotation(v.x,v.y,v.z)}return(this.getWillTranslate()||e)&&QS(h=new OS,this,this.options.gravity,s,u,this.basicTransform.position,this.velocity),this.basicTransform.path&&(h||(h=this.basicTransform.position.clone()),h.add(this.basicTransform.path.getValue(c))),h&&this.transform.setPosition(h.x,h.y,h.z),l.active=this.active,l},t.prototype.calculateScaling=function(t,e,r){this.transform.setScale(e.x*this.startSize.x,e.y*this.startSize.y,e.z*this.startSize.z)},t}(),_O=[[0,0,1,1,void 0]],RO=[1,1,1,1],CO=function(t){function e(e,r,i){var n,o,a,s,u,c,l,h,f=t.call(this,e,i)||this;f.startColor=[1,1,1,1];var p=e.interaction,d=e.renderer,m=e.options,v=e.listIndex,y=void 0===v?0:v,g=r.emptyTexture,x=i.transform.scale;f.options=rb(rb({},f.options),{startColor:m.startColor||[1,1,1,1]}),f.interaction=p,f.renderer={renderMode:null!==(n=d.renderMode)&&void 0!==n?n:Mb.BILLBOARD,blending:null!==(o=d.blending)&&void 0!==o?o:Ab.ALPHA,texture:f.initTexture(d.texture,g),occlusion:!!d.occlusion,transparentOcclusion:!!d.transparentOcclusion||d.maskMode===Sb.MASK,side:null!==(a=d.side)&&void 0!==a?a:bb.DOUBLE,shape:d.shape,mask:null!==(s=d.mask)&&void 0!==s?s:0,maskMode:null!==(u=d.maskMode)&&void 0!==u?u:Sb.NONE,order:y};var T=n_(d.anchor,d.particleOrigin);d.anchor||void 0===d.particleOrigin||f.basicTransform.position.add([-T[0]*x.x,-T[1]*x.y,0]),f.transform.setAnchor(T[0]*x.x,T[1]*x.y,0);var E=e.colorOverLifetime;return E&&(f.opacityOverLifetime=E_(null!==(c=E.opacity)&&void 0!==c?c:1),E.color&&E.color[0]===iS.GRADIENT_COLOR&&(f.colorOverLifetime=Xb(E.color[1]))),(null===(l=e.filter)||void 0===l?void 0:l.feather)&&1!==(null===(h=e.filter)||void 0===h?void 0:h.feather)&&(f.feather=E_(e.filter.feather)),f.emptyTexture=g,f.splits=e.splits||_O,f.listIndex=i.listIndex||0,f.textureSheetAnimation=e.textureSheetAnimation,f.cachePrefix="-",f.parentId=i.parentId,f.reusable=i.reusable,f._renderInfo=fO(f),f}return eb(e,t),Object.defineProperty(e.prototype,"filter",{get:function(){return this._filter},set:function(t){this._filter=t,this._renderInfo.filter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"renderInfo",{get:function(){return this._renderInfo},enumerable:!1,configurable:!0}),e.prototype.initTexture=function(t,e){return null!=t?t:e},e.prototype.getTextures=function(){var t=[],e=this.renderer.texture;return e&&t.push(e),t},e.prototype.setColor=function(t,e,r,i){this.customColor=[t,e,r,i]},e.prototype.setOpacity=function(t){this.customOpacity=t},e.prototype.getCustomOpacity=function(){return this.customOpacity},e.prototype.getRenderData=function(e,r){var i,n=t.prototype.getRenderData.call(this,e,r),o=JS(RO,1),a=e<0?e:Math.max(e,0),s=this.options.duration,u=a/s<0?0:a/s>1?1:a/s;if(this.customColor)n.color=this.customColor;else{var c=this.opacityOverLifetime,l=this.colorOverLifetime;l&&(o=jb(l,u,!0),i=!0),c&&(o[3]*=c.getValue(u),i=!0),(i||r)&&(n.color=e_(this.startColor,o,this.options.startColor))}var h=this.textureSheetAnimation;if(h){var f=h.total||h.row*h.col,p=0,d=0,m=1,v=1,y=void 0;if(this.splits){var g=this.splits[0];y=g[4],p=g[0],d=g[1],y?(m=g[3],v=g[2]):(m=g[2],v=g[3])}var x=void 0,T=void 0;y?(x=1/h.row*m,T=1/h.col*v):(x=1/h.col*m,T=1/h.row*v);var E=void 0;if(h.animate){var A=Math.round(u*(f-1)),b=Math.floor(A/h.col),S=A-b*h.col;E=y?[x*b,T*(h.col-S)]:[x*S,T*(1+b)]}else E=[0,T];n.texOffset=[p+E[0],v+d-E[1],x,T]}else r&&(n.texOffset=[0,0,1,1]);return n.visible=this.visible,n.startSize=this.startSize,n},e.prototype.calculateScaling=function(t,e,r){(t||r)&&this.transform.setScale(e.x,e.y,e.z)},e}(SO),OO=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return eb(r,e),Object.defineProperty(r.prototype,"type",{get:function(){return wb.sprite},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(t){this.sprite=t.content},r.prototype.onLifetimeBegin=function(t,e){this._contentVisible=!0,e.active=!0},r.prototype.onItemRemoved=function(t,e){this._contentVisible=!1,e&&(delete e.mesh,t.destroyTextures(e.getTextures()))},r.prototype.handleVisibleChanged=function(t){this.content&&(this.content.visible=t)},r.prototype.onItemUpdate=function(t,e){var r;null===(r=this.content)||void 0===r||r.updateTime(this.time)},r.prototype.getCurrentPosition=function(){var t=new OS;return this.transform.assignWorldTRS(t),t},r.prototype.setColor=function(t,e,r,i){this.content.setColor(t,e,r,i)},r.prototype.setOpacity=function(t){this.content.setOpacity(t)},r.prototype.getBoundingBox=function(){var e=this.content;if(e&&this.transform){var r=this.transform.getWorldMatrix(),i=e.startSize,n=s_(OS.ZERO,i.x/2,i.y/2);return n.forEach((function(t){r.transformPoint(t.p0),r.transformPoint(t.p1),r.transformPoint(t.p2)})),{type:t.HitTestType.triangle,area:n}}},r.prototype.getHitTestParams=function(t){var e,r,i=this.content,n=null===(e=this.composition)||void 0===e?void 0:e.loaderData.spriteGroup,o=i&&i.interaction;if((t||o)&&n&&i){var a=this.getBoundingBox();if(a)return{behavior:(null===(r=i.interaction)||void 0===r?void 0:r.behavior)||0,type:a.type,triangles:a.area,backfaceCulling:i.renderer.side===bb.FRONT}}},r.prototype.getRenderData=function(){return this.content.getRenderData(this.content.time)},r.prototype.doCreateContent=function(t){var e=t.getRendererOptions().emptyTexture;return new CO(this.sprite,{emptyTexture:e},this)},r.prototype.createWireframeMesh=function(t,e){var r=new hO(this.composition.getEngine(),rb({wireframe:!0},t.renderInfo),this.composition);return r.setItems([t]),r.mesh.material.setVector3("uFrameColor",OS.fromArray(e)),r.mesh.priority=999,r},r}(Y_),wO=1,MO=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),Object.defineProperty(e.prototype,"type",{get:function(){return wb.filter},enumerable:!1,configurable:!0}),e.prototype.onConstructed=function(e){t.prototype.onConstructed.call(this,e),this.filterOptions=e.content.filter,this.cachePrefix="filter:"+wO++,this.sprite.renderer.texture=this.composition.renderFrame.transparentTexture},e.prototype.onItemUpdate=function(e,r){var i,n,o,a,s;t.prototype.onItemUpdate.call(this,e,r);var u=null===(o=this._content)||void 0===o?void 0:o.mesh;if(u){var c=this.filter.mesh.variables;if(c){var l=u.mesh.material;try{for(var h=ob(Object.keys(c)),f=h.next();!f.done;f=h.next()){var p=f.value,d=c[p](r);d.length>4?l.setMatrix(p,LS.fromArray(d)):l.setVector4(p,NS.fromArray(d))}}catch(t){i={error:t}}finally{try{f&&!f.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}}}null===(s=(a=this.filter).onItemUpdate)||void 0===s||s.call(a,e,this)},e.prototype.onItemRemoved=function(e,r){var i,n;null===(n=(i=this.filter).onItemRemoved)||void 0===n||n.call(i,this),t.prototype.onItemRemoved.call(this,e,r)},e.prototype.doCreateContent=function(e){var r,i=t.prototype.doCreateContent.call(this,e),n=Db(this.filterOptions,e);this.filter=n,i.renderInfo.filter=n,i.filter=n,i.renderInfo.cacheId=i.renderInfo.cacheId.replace("$F$",null!==(r=n.mesh.shaderCacheId)&&void 0!==r?r:"");var o=n.mesh.variables;return n.mesh.uniformValues||(n.mesh.uniformValues={}),o&&Object.keys(o).forEach((function(t){var e=o[t];n.mesh.uniformValues[t]=e(0)})),i},e}(OO),IO=function(){function e(e,r){var i,n,o,a;this.particleCount=0;var s,u,c=r.composition.getEngine(),l=(null!==(i=c.renderer)&&void 0!==i?i:{}).env,h=e.speedOverLifetime,f=e.colorOverLifetime,p=e.linearVelOverLifetime,d=e.orbitalVelOverLifetime,m=e.sizeOverLifetime,v=e.rotationOverLifetime,y=e.sprite,g=e.gravityModifier,x=e.maxCount,T=e.duration,E=e.textureFlip,A=e.useSprite,b=e.name,S=e.filter,_=e.gravity,R=e.forceTarget,C=e.side,O=e.occlusion,w=e.anchor,M=e.blending,I=e.maskMode,L=e.mask,P=e.transparentOcclusion,F=e.listIndex,V=e.meshSlots,N=e.renderMode,D=void 0===N?0:N,z=e.diffuse,U=void 0===z?wR.createWithData(c):z,B=c.gpuCapability.detail,k=B.halfFloatTexture,G=B.maxVertexUniforms,j=[["RENDER_MODE",+D],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",l===pb]],X=c.gpuCapability.level,Y={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},W={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},H=G>0,Z={},q=0,Q=0;if(this.useSprite=A,H&&j.push(["ENABLE_VERTEX_TEXTURE",!0]),h&&(j.push(["SPEED_OVER_LIFETIME",!0]),Q|=2,Z.uSpeedLifetimeValue=h.toUniform(Y)),(null==y?void 0:y.animate)&&(j.push(["USE_SPRITE",!0]),Q|=4,Z.uFSprite=Z.uSprite=new Float32Array([y.col,y.row,y.total,y.blend?1:0]),this.useSprite=!0),S&&S.name!==db){j.push(["USE_FILTER",!0]),Q|=8;var K=Db(S,r.composition);if(!K.particle)throw new Error("particle filter ".concat(S.name," not implement"));s=K.particle,Object.keys(null!==(n=s.uniforms)&&void 0!==n?n:{}).forEach((function(t){var e,r=null===(e=s.uniforms)||void 0===e?void 0:e[t];if(Z[t])throw new Error("conflict uniform name:"+t);Z[t]=null==r?void 0:r.toUniform(Y)})),Object.keys(null!==(o=s.uniformValues)&&void 0!==o?o:{}).forEach((function(t){var e,r=null===(e=s.uniformValues)||void 0===e?void 0:e[t];if(Z[t])throw new Error("conflict uniform name:"+t);Z[t]=r}))}(null==f?void 0:f.color)&&(j.push(["COLOR_OVER_LIFETIME",!0]),Q|=16,Z.uColorOverLifetime=f.color instanceof wR?f.color:wR.createWithData(c,qb(f.color))),(null==f?void 0:f.opacity)?Z.uOpacityOverLifetimeValue=f.opacity.toUniform(Y):Z.uOpacityOverLifetimeValue=E_(1).toUniform(Y),["x","y","z"].forEach((function(t,e){var r=0,i=0;(null==p?void 0:p[t])&&(Z["uLinear".concat(t.toUpperCase(),"ByLifetimeValue")]=p[t].toUniform(Y),r=1,Q|=1<<7+e,p.enabled=!0),j.push(["LINEAR_VEL_".concat(t.toUpperCase()),r]),(null==d?void 0:d[t])&&(Z["uOrb".concat(t.toUpperCase(),"ByLifetimeValue")]=d[t].toUniform(Y),i=1,Q|=1<<10+e,u=!0,d.enabled=!0),j.push(["ORB_VEL_".concat(t.toUpperCase()),i])})),(null==p?void 0:p.asMovement)&&(j.push(["AS_LINEAR_MOVEMENT",!0]),Q|=32),u&&((null==d?void 0:d.asRotation)&&(j.push(["AS_ORBITAL_MOVEMENT",!0]),Q|=64),Z.uOrbCenter=new Float32Array((null==d?void 0:d.center)||[0,0,0])),Z.uSizeByLifetimeValue=null==m?void 0:m.x.toUniform(Y),(null==m?void 0:m.separateAxes)&&(j.push(["SIZE_Y_BY_LIFE",1]),Q|=16384,Z.uSizeYByLifetimeValue=null===(a=null==m?void 0:m.y)||void 0===a?void 0:a.toUniform(Y)),(null==v?void 0:v.z)&&(Z.uRZByLifeTimeValue=v.z.toUniform(Y),Q|=32768,j.push(["ROT_Z_LIFETIME",1])),(null==v?void 0:v.x)&&(Z.uRXByLifeTimeValue=v.x.toUniform(Y),Q|=65536,j.push(["ROT_X_LIFETIME",1])),(null==v?void 0:v.y)&&(Z.uRYByLifeTimeValue=v.y.toUniform(Y),Q|=1<<17,j.push(["ROT_Y_LIFETIME",1])),(null==v?void 0:v.asRotation)&&(j.push(["ROT_LIFETIME_AS_MOVEMENT",1]),Q|=1<<18),Z.uGravityModifierValue=g.toUniform(Y),R&&(j.push(["FINAL_TARGET",!0]),Q|=1<<19,Z.uFinalTarget=new Float32Array(R.target||[0,0,0]),Z.uForceCurve=R.curve.toUniform(Y)),k&&W.max?(Q|=1<<20,Z.uFCurveValueTexture=MR(c,v_.getAllData(W,!0),W.index,1)):Z.uFCurveValues=v_.getAllData(W);var J=Y.max+Y.curves.length-32>G;if(2===X&&(Y.max=-1,Y.index=V?V[0]:PO(Y.index),W.index>0&&(W.max=-1,W.index=V?V[1]:PO(W.index))),J&&k&&H){var $=MR(c,v_.getAllData(Y,!0),Y.index,1);Z.uVCurveValueTexture=$,q=1}else Z.uVCurveValues=v_.getAllData(Y);var tt=["-p:",D,Q,Y.index,Y.max,W.index,W.max].join("+");j.push(["VERT_CURVE_VALUE_COUNT",Y.index],["FRAG_CURVE_VALUE_COUNT",W.index],["VERT_MAX_KEY_FRAME_COUNT",Y.max],["FRAG_MAX_KEY_FRAME_COUNT",W.max]);var et=S?TC.replace(/#pragma\s+FILTER_FRAG/,s.fragment):TC,rt="#define LOOKUP_TEXTURE_CURVE ".concat(q,"\n").concat(EC),it=S?rt.replace(/#pragma\s+FILTER_VERT/,s.vertex||"void filterMain(float t){}\n"):rt,nt={fragment:vR(j,et,t.ShaderType.fragment,X),vertex:vR(j,it,t.ShaderType.vertex,X),glslVersion:1===X?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,cacheId:tt,marcos:j,name:"particle#".concat(b)};S&&(nt.cacheId+=S.name);var ot={shader:nt,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},at=fR(M);Z.uTexOffset=new Float32Array(U?[1/U.getWidth(),1/U.getHeight()]:[0,0]),Z.uMaskTex=U,Z.uColorParams=new Float32Array([U?1:0,+at,0,+(!!O&&!P)]),Z.uParams=[0,T,0,0],Z.uAcceleration=[(null==_?void 0:_[0])||0,(null==_?void 0:_[1])||0,(null==_?void 0:_[2])||0,0];var st=WR.create(c,ot);st.blending=!0,st.depthTest=!0,st.depthMask=!!O,st.stencilRef=L?[L,L]:void 0,xR(st,I),yR(st,M),gR(st,C);var ut={uSprite:"vec4",uParams:"vec4",uAcceleration:"vec4",uGravityModifierValue:"vec4",uOpacityOverLifetimeValue:"vec4",uRXByLifeTimeValue:"vec4",uRYByLifeTimeValue:"vec4",uRZByLifeTimeValue:"vec4",uLinearXByLifetimeValue:"vec4",uLinearYByLifetimeValue:"vec4",uLinearZByLifetimeValue:"vec4",uSpeedLifetimeValue:"vec4",uOrbXByLifetimeValue:"vec4",uOrbYByLifetimeValue:"vec4",uOrbZByLifetimeValue:"vec4",uSizeByLifetimeValue:"vec4",uSizeYByLifetimeValue:"vec4",uColorParams:"vec4",uFSprite:"vec4",uPreviewColor:"vec4",uVCurveValues:"vec4Array",uFCurveValues:"vec4",uFinalTarget:"vec3",uForceCurve:"vec4",uOrbCenter:"vec3",uTexOffset:"vec2",uPeriodValue:"vec4",uMovementValue:"vec4",uStrengthValue:"vec4",uWaveParams:"vec4"};Object.keys(Z).map((function(t){var e=Z[t];if(e instanceof wR)st.setTexture(t,e);else{var r=[];switch(ut[t]){case"vec4":st.setVector4(t,NS.fromArray(e));break;case"vec3":st.setVector3(t,OS.fromArray(e));break;case"vec2":st.setVector2(t,CS.fromArray(e));break;case"vec4Array":for(var i=0;i<e.length;i+=4){var n=new NS(e[i],e[i+1],e[i+2],e[i+3]);r.push(n)}st.setVector4Array(t,r),r.length=0;break;default:console.warn("uniform ".concat(t,"'s type not in typeMap"))}}})),st.setVector3("emissionColor",new OS(0,0,0)),st.setFloat("emissionIntensity",0);var ct=aC.create(c,function(t,e,r){var i=Float32Array.BYTES_PER_ELEMENT,n=12*i,o={aPos:{size:3,offset:0,stride:n,data:new Float32Array(0)},aVel:{size:3,offset:3*i,stride:n,dataSource:"aPos"},aDirX:{size:3,offset:6*i,stride:n,dataSource:"aPos"},aDirY:{size:3,offset:9*i,stride:n,dataSource:"aPos"},aRot:{size:3,offset:0,stride:8*i,data:new Float32Array(0)},aSeed:{size:1,offset:3*i,stride:8*i,dataSource:"aRot"},aColor:{size:4,offset:4*i,stride:8*i,dataSource:"aRot"},aOffset:{size:4,stride:4*i,data:new Float32Array(0)}};e&&(o.aSprite={size:3,data:new Float32Array(0)});return{attributes:o,indices:{data:new Uint16Array(0)},name:r,maxVertex:t}}(4*x,this.useSprite,"particle#".concat(b))),lt=hC.create(c,{name:"MParticle_".concat(b),priority:F,material:st,geometry:ct});this.anchor=w,this.mesh=lt,this.geometry=lt.firstGeometry(),this.forceTarget=R,this.sizeOverLifetime=m,this.speedOverLifetime=h,this.linearVelOverLifetime=p,this.orbitalVelOverLifetime=d,this.orbitalVelOverLifetime=d,this.gravityModifier=g,this.maxCount=x,this.duration=T,this.textureOffsets=E?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0]}return Object.defineProperty(e.prototype,"time",{get:function(){return this.mesh.material.getVector4("uParams").x},set:function(t){this.mesh.material.setVector4("uParams",new NS(+t,this.duration,0,0))},enumerable:!1,configurable:!0}),e.prototype.getPointColor=function(t){var e=this.geometry.getAttributeData("aRot"),r=32*t+4;return[e[r],e[r+1],e[r+2],e[r+3]]},e.prototype.getPointPosition=function(t){var e=this.geometry,r=48*t,i=e.getAttributeData("aPos"),n=e.getAttributeData("aOffset"),o=this.time-n[16*t+2],a=n[16*t+3],s=this.mesh.material,u=s.getVector4("uAcceleration").toVector3(),c=OS.fromArray(i,r),l=OS.fromArray(i,r+3),h=QS(new OS,this,u,o,a,c,l);if(this.forceTarget){var f=s.getVector3("uFinalTarget"),p=this.forceTarget.curve.getValue(o/a),d=1-p;h.x=h.x*d+f.x*p,h.y=h.y*d+f.y*p,h.z=h.z*d+f.z*p}return h},e.prototype.clearPoints=function(){this.resetGeometryData(this.geometry),this.particleCount=0,this.geometry.setDrawCount(0),this.maxParticleBufferCount=0},e.prototype.resetGeometryData=function(t){for(var e=t.getAttributeNames(),r=t.getIndexData(),i=0;i<e.length;i++){var n=e[i],o=t.getAttributeData(n);o&&t.setAttributeData(n,new o.constructor(0))}t.setIndexData(new r.constructor(0))},e.prototype.minusTime=function(t){for(var e=this.geometry.getAttributeData("aOffset"),r=0;r<e.length;r+=4)e[r+2]-=t;this.geometry.setAttributeData("aOffset",e),this.time-=t},e.prototype.removePoint=function(t){t<this.particleCount&&this.geometry.setAttributeSubData("aOffset",16*t,new Float32Array(16))},e.prototype.setPoint=function(t,e){var r=this.maxCount;if(e<r){var i=e+1,n=4*i,o=this.geometry,a=i>this.maxParticleBufferCount,s=1;this.particleCount>300?s=(this.particleCount+100)/this.particleCount:this.particleCount>100?s=1.4:this.particleCount>0&&(s=2);var u={aPos:new Float32Array(48),aRot:new Float32Array(32),aOffset:new Float32Array(16)},c=this.useSprite;c&&(u.aSprite=new Float32Array(12));var l=new OS,h=new wS,f=new OS(1,1,1);t.transform.assignWorldTRS(l,h,f);var p=X_.getRotation(h,new VS),d=l.toArray(),m=p.toArray(),v=this.textureOffsets,y=[0,0,t.delay,t.lifetime],g=[0,0,1,1],x=t.vel,T=t.color,E=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],A=Math.random(),b=void 0;c&&(b=t.sprite);for(var S=0;S<4;S++){var _=2*S,R=3*S,C=4*S,O=12*S,w=8*S;u.aPos.set(d,O),x.fill(u.aPos,O+3),u.aRot.set(m,w),u.aRot[w+3]=A,u.aRot.set(T,w+4),c&&u.aSprite.set(b,R);var M=t.uv||g;if(M){var I=c?1-v[_+1]:v[_+1];y[0]=M[0]+v[_]*M[2],y[1]=M[1]+I*M[3]}u.aOffset.set(y,C);for(var L=S+S,P=(E[L]-this.anchor.x)*f.x,F=(E[L+1]-this.anchor.y)*f.y,V=0;V<3;V++)u.aPos[O+6+V]=t.dirX.getElement(V)*P,u.aPos[O+9+V]=t.dirY.getElement(V)*F}var N=new Uint16Array([0,1,2,2,1,3].map((function(t){return t+4*e})));if(a){var D=kb(o.getIndexData(),6*i,s,6*r);D.set(N,6*e),o.setIndexData(D),this.maxParticleBufferCount=D.length/6}else o.setIndexSubData(6*e,N);Object.keys(u).forEach((function(t){var i=u[t],c=o.getAttributeStride(t)/Float32Array.BYTES_PER_ELEMENT;if(a){var l=kb(o.getAttributeData(t),n*c,s,4*r*c);l.set(i,i.length*e),o.setAttributeData(t,l)}else o.setAttributeSubData(t,i.length*e,i)})),this.particleCount=Math.max(i,this.particleCount),o.setDrawCount(6*this.particleCount)}},e}(),LO=[10,32,64,160];function PO(t){for(var e=0;e<LO.length;e++){var r=LO[e];if(r>t)return r}return t||LO[0]}function FO(t,e,r){var i,n,o,a,s;void 0===e&&(e="");var u=t.content,c=+((null===(i=u.renderer)||void 0===i?void 0:i.renderMode)||0),l=[["RENDER_MODE",c],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",e===pb]],h=r.level,f=r.detail,p={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},d={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},m=f.maxVertexUniforms>0,v=(null!==(n=u.positionOverLifetime)&&void 0!==n?n:{}).speedOverLifetime,y=0,g=0;m&&l.push(["ENABLE_VERTEX_TEXTURE",!0]),v&&(l.push(["SPEED_OVER_LIFETIME",!0]),g|=2,C_(p,v));var x=u.textureSheetAnimation;x&&x.animate&&(l.push(["USE_SPRITE",!0]),g|=4);var T=void 0;if(u.filter&&u.filter.name!==db){l.push(["USE_FILTER",!0]),g|=8;var E=Nb(u.filter).find((function(t){return t.isParticle}));if(!E)throw Error("particle filter ".concat(u.filter.name," not implement"));T=E,null===(o=E.uniforms)||void 0===o||o.forEach((function(t){return C_(p,t)}))}var A=u.colorOverLifetime;A&&A.color&&(l.push(["COLOR_OVER_LIFETIME",!0]),g|=16);var b=A&&A.opacity;b&&C_(p,b);var S,_=u.positionOverLifetime;["x","y","z"].forEach((function(t,e){var r=0,i="linear"+t.toUpperCase(),n="orbital"+t.toUpperCase();(null==_?void 0:_[i])&&(C_(p,_[i]),r=1,g|=1<<7+e),l.push(["LINEAR_VEL_".concat(t.toUpperCase()),r]);var o=0;(null==_?void 0:_[n])&&(C_(p,_[n]),o=1,g|=1<<10+e,S=!0),l.push(["ORB_VEL_".concat(t.toUpperCase()),o])})),(null==_?void 0:_.asMovement)&&(l.push(["AS_LINEAR_MOVEMENT",!0]),g|=32),S&&(null==_?void 0:_.asRotation)&&(l.push(["AS_ORBITAL_MOVEMENT",!0]),g|=64);var R=u.sizeOverLifetime;C_(p,null==R?void 0:R.x),(null==R?void 0:R.separateAxes)&&(l.push(["SIZE_Y_BY_LIFE",1]),g|=16384,C_(p,null==R?void 0:R.y));var C=u.rotationOverLifetime;(null==C?void 0:C.z)&&(C_(p,null==C?void 0:C.z),g|=32768,l.push(["ROT_Z_LIFETIME",1])),(null==C?void 0:C.separateAxes)&&(C.x&&(C_(p,C.x),g|=65536,l.push(["ROT_X_LIFETIME",1])),C.y&&(C_(p,C.y),g|=1<<17,l.push(["ROT_Y_LIFETIME",1]))),(null==C?void 0:C.asRotation)&&(l.push(["ROT_LIFETIME_AS_MOVEMENT",1]),g|=1<<18),C_(p,null==_?void 0:_.gravityOverLifetime),(null==_?void 0:_.forceTarget)&&(l.push(["FINAL_TARGET",!0]),g|=1<<19,C_(p,_.forceCurve));var O=f.halfFloatTexture;O&&d.max&&(g|=1<<20);var w=f.maxVertexUniforms,M=p.max+p.curves.length-32>w;VR(LR)&&(M=!0),2===h&&(p.max=-1,d.index>0&&(d.max=-1)),M&&O&&m&&(y=1);var I=["-p:",c,g,p.index,p.max,d.index,d.max].join("+"),L={fragment:TC,vertex:"#define LOOKUP_TEXTURE_CURVE ".concat(y,"\n").concat(EC),shared:!0,cacheId:I,marcos:l,name:"particle#".concat(t.name)};return T&&(L.fragment=L.fragment.replace(/#pragma\s+FILTER_FRAG/,null!==(a=T.fragment)&&void 0!==a?a:""),L.vertex=L.vertex.replace(/#pragma\s+FILTER_VERT/,T.vertex||"void filterMain(float t){}\n"),L.cacheId+="+"+(null===(s=u.filter)||void 0===s?void 0:s.name)),l.push(["VERT_CURVE_VALUE_COUNT",p.index],["FRAG_CURVE_VALUE_COUNT",d.index],["VERT_MAX_KEY_FRAME_COUNT",p.max],["FRAG_MAX_KEY_FRAME_COUNT",d.max]),{shader:L,vertex:p.index,fragment:d.index}}function VO(t,e,r){var i,n=null===(i=t.cacheId)||void 0===i?void 0:i.split("+");if(n[3]=e,n[5]=r,t.cacheId=n.join("+"),t.marcos)for(var o=0;o<t.marcos.length;o++){var a=t.marcos[o];if("VERT_CURVE_VALUE_COUNT"===a[0])a[1]=e;else if("FRAG_CURVE_VALUE_COUNT"===a[0]){a[1]=r;break}}}var NO=function(t){this.content=t},DO=function(){function t(t){this.sort=t,this.length=0}return t.prototype.findNodeByContent=function(t){var e=this.first;if(e)do{if(t(e.content))return e}while(e=e.next)},t.prototype.insertNode=function(t,e){var r=t.next;t.next=e,e.pre=t,e.next=r,r&&(r.pre=e)},t.prototype.shiftNode=function(t){var e=new NO(t);if(this.length++,1===this.length)return this.first=this.last=e;for(var r=this.first;r;){if(!(this.sort(r.content,e.content)<=0))return r.pre?this.insertNode(r.pre,e):(this.first=e,e.next=r,r.pre=e),e;if(!r.next)return this.insertNode(r,e),this.last=e;r=r.next}},t.prototype.pushNode=function(t){var e=new NO(t);if(this.length++,1===this.length)return this.last=this.first=e;for(var r=this.last;r;){if(!(this.sort(e.content,r.content)<=0))return this.insertNode(r,e),r===this.last&&(this.last=e),e;if(this.first===r)return r.pre=e,e.next=r,this.first=e;r=r.pre}},t.prototype.removeNode=function(t){var e=this.first;if(this.length--,e===t)(r=this.first=e.next)&&(r.pre=null);else if((e=this.last)===t){var r;(r=this.last=e.pre)&&(r.next=null)}else if(t){var i=t.pre,n=t.next;i.next=n,n&&(n.pre=i)}t.pre=null,t.next=null},t.prototype.forEach=function(t,e){var r=this.first,i=0;if(r)do{t.call(e||this,r.content,i++)}while(r=r.next)},t.prototype.forEachReverse=function(t,e){var r=this.last,i=this.length-1;if(r)do{t.call(e||this,r.content,i--)}while(r=r.pre)},t}(),zO=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=UO(this.arc,this.arcMode,t)*TS,r=Math.cos(e)*this.radius,i=Math.sin(e)*this.radius,n=new OS(r,i,0),o=Math.tan(this.angle*TS),a=n.clone().multiply(o);return a.z+=1,{position:n.multiply(U_(0,1)),direction:a.normalize()}},t}();function UO(t,e,r){if(e===uS.RANDOM)t=U_(0,t);else if(e===uS.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);t=t/r.total*i}else if(e===uS.BIDIRECTIONAL_CYCLE){var n=(i=r.index/(r.total+1))-Math.floor(i);t*=Math.floor(i)%2?1-n:n}else e===uS.UNIFORM_BURST&&(t=t*r.burstIndex/r.burstCount);return t}var BO,kO=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=UO(this.arc,this.arcMode,t)*TS,r=new OS(Math.cos(e),Math.sin(e),0),i=this.radius;return{direction:r,position:r.clone().multiply(i)}},t}(),GO=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2}return t.prototype.generate=function(t){var e=U_(-this._d,this._d),r=U_(-this._h,this._h);return{direction:new OS(0,0,1),position:new OS(e,r,0)}},t}(),jO=function(){function t(t){this._d=(t.width||1)/2,this._h=(t.height||1)/2,this.arcMode=t.arcMode,this.arc=t.arc}return t.prototype.generate=function(t){var e=UO(this.arc,this.arcMode,t)*TS,r=new OS(Math.cos(e),Math.sin(e),0),i=this._d,n=this._h,o=Math.atan2(n,i),a=Math.tan(e),s=new OS;return e<o?s.set(i,i*a,0):e>=o&&e<Math.PI-o?s.set(n/a,n,0):e<Math.PI+o?s.set(-i,-i*a,0):e<2*Math.PI-o?s.set(-n/a,-n,0):s.set(i,i*a,0),{direction:r,position:s}},t}(),XO=function(){function t(t){this._d=t.width||1,this.arcMode=t.arcMode}return t.prototype.generate=function(t){var e=this.arcMode===uS.UNIFORM_BURST?t.burstIndex%t.burstCount/(t.burstCount-1):U_(0,1);return{direction:new OS(0,1,0),position:new OS(this._d*(e-.5),0,0)}},t}(),YO=new LS,WO=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.generate=function(t){var e=this.donutRadius,r=this.radius-e,i=U_(0,2*Math.PI),n=UO(this.arc,this.arcMode,t)*TS,o=YO.setFromRotationZ(n),a=new OS(Math.cos(i),Math.sin(i),0),s=new OS(r+Math.cos(i)*e,0,Math.sin(i)*e);return{direction:o.transformNormal(a),position:o.transformPoint(s)}},t}(),HO=new LS,ZO=function(){function t(t){var e=this;Object.keys(t).forEach((function(r){e[r]=t[r]}))}return t.prototype.getHorizontalAngle=function(){return U_(-90,90)},t.prototype.generate=function(t){var e=UO(this.arc,this.arcMode,t)*TS,r=this.getHorizontalAngle()*TS,i=this.radius,n=new OS(Math.cos(r),0,Math.sin(r)),o=HO.setFromRotationZ(e).transformNormal(n);return{position:o.clone().multiply(i),direction:o}},t}(),qO=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.getHorizontalAngle=function(){return U_(0,90)},e}(ZO),QO=function(){function t(t){var e=t.detail||{anchors:[.5,.5],block:[0,0]};this.anchors=new Float32Array(e.anchors),this.width=t.width||1,this.height=t.height||1,this.block=e.block,this.arcMode=t.arcMode,this.random=_S(t.random||0,0,1)}return t.prototype.generate=function(t){var e=this.anchors,r=e.length/2-1,i=Math.floor(UO(r,this.arcMode,t)),n=(e[2*i]+this.block[0]*this.random*Math.random())%1-.5,o=(e[2*i+1]+this.block[1]*this.random*Math.random())%1-.5,a=new OS(n,o,0);return{position:new OS(n*this.width,o*this.height,0),direction:a.normalize()}},t}(),KO=function(){function t(){}return t.prototype.generate=function(){return{position:new OS,direction:new OS}},t}(),JO=((BO={})[_b.NONE]=KO,BO[_b.CONE]=zO,BO[_b.SPHERE]=ZO,BO[_b.HEMISPHERE]=qO,BO[_b.CIRCLE]=kO,BO[_b.DONUT]=WO,BO[_b.RECTANGLE]=GO,BO[_b.EDGE]=XO,BO[_b.RECTANGLE_EDGE]=jO,BO[_b.TEXTURE]=QO,BO);function $O(t){if(!t)return new KO;var e=rb({radius:1,arc:360,angle:0,arcMode:uS.RANDOM},t),r=t.type,i=JO[r];if(!i)throw Error("invalid shape:"+r);var n=new i(e);if(r!==_b.NONE){var o=t,a=o.alignSpeedDirection,s=o.upDirection,u=void 0===s?[0,0,1]:s;n.alignSpeedDirection=a,n.upDirection=OS.fromArray(u).normalize()}return n}function tw(t,e,r,i,n){var o,a;if(n===function(t,e,r,i){for(var n=0,o=e,a=r-i;o<r;o+=i)n+=(t[a]-t[o])*(t[o+1]+t[a+1]),a=o;return n}(t,e,r,i)>0)for(o=e;o<r;o+=i)a=gw(o,t[o],t[o+1],a);else for(o=r-i;o>=e;o-=i)a=gw(o,t[o],t[o+1],a);return a&&fw(a,a.next)&&(xw(a),a=a.next),a}function ew(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!fw(i,i.next)&&0!==hw(i.prev,i,i.next))i=i.next;else{if(xw(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function rw(t){var e=t.prev,r=t,i=t.next;if(hw(e,r,i)>=0)return!1;for(var n=t.next.next;n!==t.prev;){if(cw(e.x,e.y,r.x,r.y,i.x,i.y,n.x,n.y)&&hw(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function iw(t,e,r,i){var n=t.prev,o=t,a=t.next;if(hw(n,o,a)>=0)return!1;for(var s=n.x<o.x?n.x<a.x?n.x:a.x:o.x<a.x?o.x:a.x,u=n.y<o.y?n.y<a.y?n.y:a.y:o.y<a.y?o.y:a.y,c=n.x>o.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,l=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,h=sw(s,u,e,r,i),f=sw(c,l,e,r,i),p=t.prevZ,d=t.nextZ;p&&p.z>=h&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&cw(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&hw(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&cw(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&hw(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&cw(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&hw(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&cw(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&hw(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function nw(t,e){return t.x-e.x}function ow(t,e){if(e=function(t,e){var r,i=e,n=t.x,o=t.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>a){if(a=s,s===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==e);if(!r)return null;if(n===a)return r;var u,c=r,l=r.x,h=r.y,f=1/0;i=r;do{n>=i.x&&i.x>=l&&n!==i.x&&cw(o<h?n:a,o,l,h,o<h?a:n,o,i.x,i.y)&&(u=Math.abs(o-i.y)/(n-i.x),vw(i,t)&&(u<f||u===f&&(i.x>r.x||i.x===r.x&&aw(r,i)))&&(r=i,f=u)),i=i.next}while(i!==c);return r}(t,e),e){var r=yw(e,t);ew(e,e.next),ew(r,r.next)}}function aw(t,e){return hw(t.prev,t,e.prev)<0&&hw(e.next,t,t.next)<0}function sw(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*n)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-i)*n)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function uw(t){var e=t,r=t;do{(e.x<r.x||e.x===r.x&&e.y<r.y)&&(r=e),e=e.next}while(e!==t);return r}function cw(t,e,r,i,n,o,a,s){return(n-a)*(e-s)-(t-a)*(o-s)>=0&&(t-a)*(i-s)-(r-a)*(e-s)>=0&&(r-a)*(o-s)-(n-a)*(i-s)>=0}function lw(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&pw(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(vw(t,e)&&vw(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(hw(t.prev,t,e.prev)||hw(t,e.prev,e))||fw(t,e)&&hw(t.prev,t,t.next)>0&&hw(e.prev,e,e.next)>0)}function hw(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function fw(t,e){return t.x===e.x&&t.y===e.y}function pw(t,e,r,i){var n=mw(hw(t,e,r)),o=mw(hw(t,e,i)),a=mw(hw(r,i,t)),s=mw(hw(r,i,e));return n!==o&&a!==s||(!(0!==n||!dw(t,r,e))||(!(0!==o||!dw(t,i,e))||(!(0!==a||!dw(r,t,i))||!(0!==s||!dw(r,e,i)))))}function dw(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function mw(t){return t>0?1:t<0?-1:0}function vw(t,e){return hw(t.prev,t,t.next)<0?hw(t,e,t.next)>=0&&hw(t,t.prev,e)>=0:hw(t,e,t.prev)<0||hw(t,t.next,e)<0}function yw(t,e){var r=new Tw(t.i,t.x,t.y),i=new Tw(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function gw(t,e,r,i){var n=new Tw(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function xw(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Tw(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Ew=0;function Aw(t,e,r,i){r=r||2,Ew=i||0;var n,o,a,s,u,c,l,h=e&&e.length,f=h?e[0]*r:t.length,p=tw(t,0,f,r,!0),d=[];if(!p||p.next===p.prev)return d;if(h&&(p=function(t,e,r,i){var n,o,a,s=[];for(n=0,o=e.length;n<o;n++)(a=tw(t,e[n]*i,n<o-1?e[n+1]*i:t.length,i,!1))===a.next&&(a.steiner=!0),s.push(uw(a));for(s.sort(nw),n=0;n<s.length;n++)ow(s[n],r),r=ew(r,r.next);return r}(t,e,p,r)),t.length>80*r){n=a=t[0],o=s=t[1];for(var m=r;m<f;m+=r)(u=t[m])<n&&(n=u),(c=t[m+1])<o&&(o=c),u>a&&(a=u),c>s&&(s=c);l=0!==(l=Math.max(a-n,s-o))?1/l:0}return bw(p,d,r,n,o,l),d}function bw(t,e,r,i,n,o,a){if(t){!a&&o&&function(t,e,r,i){var n=t;do{null===n.z&&(n.z=sw(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,o,a,s,u,c=1;do{for(r=t,t=null,o=null,a=0;r;){for(a++,i=r,s=0,e=0;e<c&&(s++,i=i.nextZ);e++);for(u=c;s>0||u>0&&i;)0!==s&&(0===u||!i||r.z<=i.z)?(n=r,r=r.nextZ,s--):(n=i,i=i.nextZ,u--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,c*=2}while(a>1)}(n)}(t,i,n,o);for(var s,u,c=t;t.prev!==t.next;)if(s=t.prev,u=t.next,o?iw(t,i,n,o):rw(t))e.push(s.i/r+Ew),e.push(t.i/r+Ew),e.push(u.i/r+Ew),xw(t),t=u.next,c=u.next;else if((t=u)===c){a?1===a?bw(t=Sw(ew(t),e,r),e,r,i,n,o,2):2===a&&_w(t,e,r,i,n,o):bw(ew(t),e,r,i,n,o,1);break}}}function Sw(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!fw(n,o)&&pw(n,i,i.next,o)&&vw(n,o)&&vw(o,n)&&(e.push(n.i/r+Ew),e.push(i.i/r+Ew),e.push(o.i/r+Ew),xw(i),xw(i.next),i=t=o),i=i.next}while(i!==t);return ew(i)}function _w(t,e,r,i,n,o){var a=t;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&lw(a,s)){var u=yw(a,s);return a=ew(a,a.next),u=ew(u,u.next),bw(a,e,r,i,n,o),void bw(u,e,r,i,n,o)}s=s.next}a=a.next}while(a!==t)}var Rw=2;function Cw(t,e){for(var r=t.s,i=t.p,n=r[1],o=i[1],a=0,s=0;s<n.length;s++){a+=(T=n[s]).length-1}var u,c=new Float32Array(a*ub),l=e.indexBase,h=void 0===l?0:l,f=e.uvTransform,p=0,d=0,m=0,v=1,y=1;f&&(d=f[0],m=f[1],u=f[4],v=u?f[3]:f[2],y=u?f[2]:f[3]);var g=[0,0],x=0===u?0:-Math.PI/2;for(s=0;s<n.length;s++)for(var T=n[s],E=o[s],A=o[s+1]||o[0],b=T,S=[0,0],_=0;_<b.length-1;_++){Mw(S,b[_],E,A,E[4],E[5],A[2],A[3]),C(S[0],S[1])}var R=Aw(Array.from(c),null,ub,h);return{aPoint:c,index:new Uint16Array(R)};function C(t,e){c[p++]=t/2,c[p++]=e/2,f?(g[0]=t,g[1]=e,ww(g,g,x),c[p++]=d+(g[0]+1)/2*v,c[p++]=m+(g[1]+1)/2*y):(c[p++]=(t+1)/2,c[p++]=(e+1)/2),p+=Rw}}function Ow(t,e){for(var r=[],i=function(t){var e=[];return t.gs?t.gs.forEach((function(t){e.push({p:[iS.SHAPE_POINTS,t.p],s:[iS.SHAPE_SPLITS,t.s]})})):t.g?e.push({p:[iS.SHAPE_POINTS,t.g.p],s:[iS.SHAPE_SPLITS,t.g.s]}):e.push(t),e}(t),n=0,o=0,a=0,s=0;s<i.length;s++){n+=(f=Cw(i[s],{indexBase:n,uvTransform:e})).aPoint.length/5,r.push(f),o+=f.aPoint.length,a+=f.index.length}if(1===r.length)return r[0];for(var u=new Float32Array(o),c=new Uint16Array(a),l=(s=0,0),h=0;s<r[s];s++){var f=r[s];u.set(f.aPoint,l),l+=f.aPoint.length,c.set(f.index,h),h+=f.index.length}return{aPoint:u,index:c}}function ww(t,e,r){var i=Math.cos(r),n=Math.sin(r),o=e[0],a=e[1];return t[0]=i*o+n*a,t[1]=-n*o+i*a,t}function Mw(t,e,r,i,n,o,a,s){var u=1-e,c=u*u*u,l=3*e*u*u,h=3*e*e*u,f=e*e*e;return t[0]=c*r[0]+l*n+h*a+f*i[0],t[1]=c*r[1]+l*o+h*s+f*i[1],t}var Iw=function(){function t(t){var e=t.time,r=t.interval,i=t.count,n=t.cycles,o=t.probability;this.time=+e||0,this.interval=+r||1,this.count=i instanceof c_?i:E_(i),this.cycles=+n||1/0,this.probability=isNaN(o)?1:+o,this.reset()}return t.prototype.getGeneratorOptions=function(t,e){if(t-this.time-this.now>this.interval*this.index&&this.internalCycles>0)return this.internalCycles--,this.index++,Math.random()<=this.probability?{index:this.index,total:1/this.interval,count:this.count.getValue(e),cycleIndex:this.cycles-this.internalCycles-1}:null},t.prototype.reset=function(){this.internalCycles=this.cycles,this.index=0,this.now=0},t.prototype.clone=function(){return new t(this)},t}(),Lw=new OS,Pw=new OS,Fw=function(){function e(e,r){var i;this.pointStart=[];var n=e.colorOverLifetime,o=e.colorOverTrail,a=e.maxTrailCount,s=e.opacityOverLifetime,u=void 0===s?E_(1):s,c=e.widthOverTrail,l=e.name,h=e.occlusion,f=e.blending,p=e.maskMode,d=e.order,m=e.textureMap,v=void 0===m?[0,0,1,1]:m,y=e.texture,g=e.transparentOcclusion,x=e.minimumVertexDistance,T=e.lifetime,E=e.matrix,A=r.gpuCapability,b=A.detail,S=A.level,_=Math.max(e.pointCountPerTrail,2),R={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},C=b.maxVertexTextures>0,O=(null!==(i=r.renderer)&&void 0!==i?i:{}).env,w={},M=[["ENABLE_VERTEX_TEXTURE",C],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",O===pb]],I=a>64,L=0;n&&(M.push(["COLOR_OVER_LIFETIME",!0]),L|=1,w.uColorOverLifetime=wR.createWithData(r,qb(n))),o&&(M.push(["COLOR_OVER_TRAIL",!0]),L|=4,w.uColorOverTrail=wR.createWithData(r,qb(o))),I?(M.push(["ATTR_TRAIL_START",1]),L|=8):w.uTrailStart=new Float32Array(a),w.uOpacityOverLifetimeValue=u.toUniform(R);var P=c.toUniform(R);M.push(["VERT_CURVE_VALUE_COUNT",R.index],["VERT_MAX_KEY_FRAME_COUNT",R.max]),w.uVCurveValues=v_.getAllData(R);var F={shader:{vertex:vR(M,AC,t.ShaderType.vertex,S),fragment:vR(M,TC,t.ShaderType.fragment,S),marcos:M,glslVersion:1===S?t.GLSLVersion.GLSL1:t.GLSLVersion.GLSL3,shared:!0,name:"trail#".concat(l),cacheId:"-t:+".concat(L,"+").concat(R.index,"+").concat(R.max)},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},V=_*a*2,N=(_-1)*a,D=Float32Array.BYTES_PER_ELEMENT,z=12*D,U={attributes:{aColor:{size:4,stride:z,data:new Float32Array(12*V)},aSeed:{size:1,stride:z,offset:4*D,dataSource:"aColor"},aInfo:{size:3,stride:z,offset:5*D,dataSource:"aColor"},aPos:{size:4,stride:z,offset:8*D,dataSource:"aColor"},aTime:{size:1,data:new Float32Array(V)},aDir:{size:3,data:new Float32Array(3*V)}},indices:{data:new Uint16Array(6*V)},drawCount:6*N,name:"trail#".concat(l),bufferUsage:yb.DYNAMIC_DRAW};if(I)U.attributes.aTrailStart={size:1,data:new Float32Array(V)};else{var B=new Float32Array(V);U.attributes.aTrailStartIndex={size:1,data:B};for(var k=0;k<a;k++)for(var G=2*_,j=k*G,X=0;X<G;X++)B[j+X]=k}var Y=fR(f),W=WR.create(r,F);W.blending=!0,W.depthMask=h,W.depthTest=!0,xR(W,p),yR(W,f);var H=this.mesh=hC.create(r,{name:"MTrail_".concat(l),material:W,geometry:aC.create(r,U),priority:d}),Z=null!=y?y:wR.createWithData(r);Object.keys(w).map((function(t){var e=w[t];if(e instanceof wR)W.setTexture(t,e);else if("uTrailStart"===t)W.setFloats("uTrailStart",e);else if("uVCurveValues"===t){var r=[];r.push(new NS(e[0],e[1],e[2],e[3])),r.push(new NS(e[4],e[5],e[6],e[7])),W.setVector4Array(t,r)}else W.setVector4(t,NS.fromArray(e))})),W.setFloat("uTime",0),W.setVector4("uWidthOverTrail",NS.fromArray(P)),W.setVector2("uTexOffset",new CS(0,0)),W.setVector4("uTextureMap",NS.fromArray(v)),W.setVector4("uParams",new NS(0,_-1,0,0)),W.setTexture("uMaskTex",Z),W.setVector4("uColorParams",new NS(y?1:0,+Y,0,+(h&&!g))),this.maxTrailCount=a,this.pointCountPerTrail=_,this.checkVertexDistance=x>0,this.minimumVertexDistance=Math.pow(x||.001,2),this.useAttributeTrailStart=I,this.lifetime=T,E&&(this.mesh.worldMatrix=E),this.geometry=H.firstGeometry(),this.trailCursors=new Uint16Array(a)}return Object.defineProperty(e.prototype,"time",{get:function(){return this.mesh.material.getFloat("uTime")||0},set:function(t){this.mesh.material.setFloat("uTime",null!=t?t:0)},enumerable:!1,configurable:!0}),e.prototype.addPoint=function(t,e,r){r=r||{};var i=this.trailCursors[t],n=this.pointCountPerTrail,o=this.geometry,a=n-1,s=i%n,u=(i-1)%n,c=(i-2)%n,l=this.getTrailPosition(t,u,Lw);if(!(l&&this.checkVertexDistance&&(null==l?void 0:l.distanceSquared(e))<this.minimumVertexDistance)){var h=t*n+s,f=zw(l,e),p=r.time||this.time,d=[Math.random(),r.lifetime||this.lifetime,i],m=r.size||1,v=6*h,y=new Float32Array(6);y.set(f,0),y.set(f,3),o.setAttributeSubData("aDir",v,y),o.setAttributeSubData("aTime",2*h,new Float32Array([p,p]));var g=r.color||[1,1,1,1],x=new Float32Array(24),T=e.toArray();if(x.set(g,0),x.set(d,4),x[7]=0,x.set(T,8),x[11]=.5*m,x.set(g,12),x.set(d,16),x[19]=1,x.set(T,20),x[23]=-.5*m,o.setAttributeSubData("aColor",24*h,x),u>=0){var E=this.getTrailPosition(t,c,Pw),A=new Float32Array(zw(E,l,e)),b=6*(t*n+u);o.setAttributeSubData("aDir",b,A),o.setAttributeSubData("aDir",b+3,A);var S=t*n*2,_=new Uint16Array([2*u+S,2*u+1+S,2*s+S,2*s+S,2*u+1+S,2*s+1+S]),R=6*(t*a+(i-1)%a);o.setIndexSubData(R,_)}i=++this.trailCursors[t];var C=this.mesh.material,O=C.getVector4("uParams"),w=d[2];if(this.useAttributeTrailStart){for(var M=2*n,I=new Float32Array(M),L=0;L<M;L++)I[L]=w;o.setAttributeSubData("aTrailStart",t*I.length,I)}else{var P=C.getFloats("uTrailStart");null!=P&&(P[t]=w,C.setFloats("uTrailStart",P))}O&&(O.y=Math.max(O.y,i-1)-Math.max(0,i-n),C.setVector4("uParams",O))}},e.prototype.getTrailPosition=function(t,e,r){var i=this.pointCountPerTrail;if(e>=0&&e<i){var n=24*(t*i+e)+8,o=this.geometry.getAttributeData("aColor");return r.x=o[n],r.y=o[1+n],r.z=o[2+n],r}},e.prototype.clearAllTrails=function(){var t=this.geometry;this.trailCursors=new Uint16Array(this.trailCursors.length),t.setIndexData(new Uint16Array(t.getIndexData().length))},e.prototype.minusTime=function(t){for(var e=this.geometry.getAttributeData("aTime"),r=0;r<e.length;r++)e[r]-=t;this.geometry.setAttributeData("aTime",e),this.time-=t},e.prototype.clearTrail=function(t){if(0!==this.trailCursors[t]){var e=6*(this.pointCountPerTrail-1),r=this.geometry.getIndexData();null==r||r.set(new Uint16Array(e),t*e),this.geometry.setIndexData(r),this.trailCursors[t]=0}},e.prototype.getPointStartPos=function(t){return this.pointStart[t]},e.prototype.setPointStartPos=function(t,e){this.pointStart[t]=e},e.prototype.onUpdate=function(t){},e}(),Vw=new OS,Nw=new OS,Dw=new OS;function zw(t,e,r){var i=Vw;return t||r?(t?r?(Nw.subtractVectors(e,t).normalize(),Nw.subtractVectors(r,e),Dw.copyFrom(Nw).normalize(),i.addVectors(Nw,Dw)):i.subtractVectors(e,t):i.subtractVectors(r,e),i.normalize().toArray()):[0,0,0]}var Uw=function(){function t(t,e,r){var i,n,o,a,s,u,c=r.composition,l=r.endBehavior,h=r.name;if(c){var f,p=c.getEngine(),d=e.cachePrefix,m=void 0===d?"":d,v=t.options,y=t.positionOverLifetime,g=t.shape,x=r.duration||1,T=y.gravityOverLifetime,E=KS(y.gravity),A=t.textureSheetAnimation,b=A?{animationDelay:E_(A.animationDelay||0),animationDuration:E_(A.animationDuration||1),cycles:E_(A.cycles||1),animate:A.animate,col:A.col,row:A.row,total:A.total||A.col*A.row}:void 0,S=LS.fromIdentity(),_=!!(g&&g.turbulenceX||g.turbulenceY||g.turbulenceZ);_&&(f=[E_(null!==(i=g.turbulenceX)&&void 0!==i?i:0),E_(null!==(n=g.turbulenceY)&&void 0!==n?n:0),E_(null!==(o=g.turbulenceZ)&&void 0!==o?o:0)]),this.name=h,this.shape=$O(g),this.emission={rateOverTime:E_(t.emission.rateOverTime),burstOffsets:qw(null!==(a=t.emission.burstOffsets)&&void 0!==a?a:[]),bursts:(t.emission.bursts||[]).map((function(t){return new Iw(t)}))},this.textureSheetAnimation=b;var R,C=t.renderer||{},O={},w=t.rotationOverLifetime;w&&(O.asRotation=!!w.asRotation,O.z=w.z?E_(w.z):E_(0),w.separateAxes&&(O.x=w.x&&E_(w.x),O.y=w.y&&E_(w.y))),y.forceTarget&&(R={target:y.target||[0,0,0],curve:E_(y.forceCurve||[iS.LINE,[[0,0],[1,1]]])});var M={x:y.linearX&&E_(y.linearX||0),y:y.linearY&&E_(y.linearY||0),z:y.linearZ&&E_(y.linearZ||0),asMovement:y.asMovement},I={x:y.orbitalX&&E_(y.orbitalX),y:y.orbitalY&&E_(y.orbitalY),z:y.orbitalZ&&E_(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},L=t.sizeOverLifetime||{},P=t.colorOverLifetime,F=r.listIndex,V=m,N=(null==L?void 0:L.separateAxes)?{separateAxes:!0,x:E_(L.x),y:E_(L.y)}:{separateAxes:!1,x:E_(("size"in L?L.size:L.x)||1)},D=CS.fromArray(n_(C.anchor,C.particleOrigin));this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:E_(v.startLifetime),startDelay:E_(v.startDelay||0),startSpeed:E_(y.startSpeed||0),startColor:E_(v.startColor),endBehavior:l,duration:x,looping:l===oS.loop,maxCount:null!==(s=v.maxCount)&&void 0!==s?s:0,gravityModifier:E_(T||0).scaleXCoord(x),gravity:E,start3DSize:!!v.start3DSize,startTurbulence:_,turbulence:f,speedOverLifetime:y.speedOverLifetime&&E_(y.speedOverLifetime),linearVelOverLifetime:M,orbitalVelOverLifetime:I,forceTarget:R},v.startRotationZ&&(this.options.startRotation=E_(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=E_(v.startRotationX||0),this.options.startRotationY=E_(v.startRotationY||0),this.options.startRotationZ=E_(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=E_(v.startSizeX),this.options.startSizeY=E_(v.startSizeY)):(this.options.startSize=E_(v.startSize),this.options.sizeAspect=E_(v.sizeAspect||1));var z={listIndex:F,meshSlots:v.meshSlots,name:h,matrix:S,filter:t.filter,shaderCachePrefix:V,renderMode:C.renderMode||Mb.BILLBOARD,side:C.side||bb.DOUBLE,gravity:E,duration:r.duration,blending:C.blending||Ab.ALPHA,rotationOverLifetime:O,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:b,occlusion:!!C.occlusion,transparentOcclusion:!!C.transparentOcclusion,maxCount:v.maxCount,mask:C.mask,maskMode:null!==(u=C.maskMode)&&void 0!==u?u:Sb.NONE,forceTarget:R,diffuse:C.texture,sizeOverLifetime:N,anchor:D};if(P){var U=P.color,B=P.opacity;z.colorOverLifetime={},B&&(z.colorOverLifetime.opacity=E_(P.opacity)),U&&(U[0]===iS.GRADIENT_COLOR?z.colorOverLifetime.color=P.color[1]:U[0]===iS.RGBA_COLOR?z.colorOverLifetime.color=wR.createWithData(p,{data:new Uint8Array(U[1]),width:1,height:1}):U instanceof wR&&(z.colorOverLifetime.color=U))}var k,G=[],j=[0,0,1,1];if(t.splits){var X=t.splits[0];j=(k=X[4])?[X[0],X[1],X[3],X[2]]:[X[0],X[1],X[2],X[3]]}if(b&&!b.animate)for(var Y=k?b.row:b.col,W=k?b.col:b.row,H=b.total||Y*W,Z=0,q=0;q<Y;q++)for(var Q=0;Q<W&&Z<H;Q++,Z++)G.push([q*j[2]/Y+j[0],Q*j[3]/W+j[1],j[2]/Y,j[3]/W]);else G.push(j);z.textureFlip=k,this.uvs=G,this.particleMesh=new IO(z,{composition:c});var K=t.trails;if(K){this.trails={lifetime:E_(K.lifetime),dieWithParticles:!1!==K.dieWithParticles,sizeAffectsWidth:!!K.sizeAffectsWidth,sizeAffectsLifetime:!!K.sizeAffectsLifetime,inheritParticleColor:!!K.inheritParticleColor,parentAffectsPosition:!!K.parentAffectsPosition};var J={name:r.name+"_trail",matrix:S,minimumVertexDistance:K.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(K.maxPointPerTrail)||32,blending:K.blending,texture:K.texture,opacityOverLifetime:E_(K.opacityOverLifetime||1),widthOverTrail:E_(K.widthOverTrail||1),order:F+(K.orderOffset||0),shaderCachePrefix:V,lifetime:this.trails.lifetime,occlusion:!!K.occlusion,transparentOcclusion:!!K.transparentOcclusion,textureMap:K.textureMap,mask:C.mask,maskMode:C.maskMode};K.colorOverLifetime&&K.colorOverLifetime[0]===iS.GRADIENT_COLOR&&(J.colorOverLifetime=K.colorOverLifetime[1]),K.colorOverTrail&&K.colorOverTrail[0]===iS.GRADIENT_COLOR&&(J.colorOverTrail=K.colorOverTrail[1]),this.trailMesh=new Fw(J,p)}this.transform=r.transform;var $,tt=this.transform.position.clone(),et=this.transform.rotation.clone(),rt=t.emitterTransform&&t.emitterTransform.path;rt&&(rt[0]===iS.CONSTANT_VEC3?tt.add(rt[1]):$=E_(rt)),this.basicTransform={position:tt,rotation:et,path:$},this.updateEmitterTransform(0);var it=[this.particleMesh.mesh];this.trailMesh&&it.push(this.trailMesh.mesh),this.meshes=it,this.reusable=r.reusable,this.setVisible(r.getVisible());var nt=t.interaction;nt&&(this.interaction={multiple:nt.multiple,radius:nt.radius,behavior:nt.behavior})}}return Object.defineProperty(t.prototype,"timePassed",{get:function(){return this.lastUpdate-this.loopStartTime},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lifetime",{get:function(){return this.timePassed/this.options.duration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"particleCount",{get:function(){return this.particleLink.length},enumerable:!1,configurable:!0}),t.prototype.updateEmitterTransform=function(t){var e=this.parentTransform,r=this.basicTransform,i=r.path,n=r.position.clone();if(i){var o=this.options.duration;n.add(i.getValue(t/o))}if(this.transform.setPosition(n.x,n.y,n.z),this.options.particleFollowParent&&e){var a=e.getWorldMatrix();this.particleMesh.mesh.worldMatrix=a.clone(),this.trailMesh&&(this.trailMesh.mesh.worldMatrix=a.clone())}},t.prototype.addParticle=function(t,e){var r,i=this.particleLink,n=[t.delay+t.lifetime,0,t.delay,t];if(i.length<e)r=n[1]=i.length;else{var o=i.first;i.removeNode(o),r=n[1]=o.content[1]}i.pushNode(n),this.particleMesh.setPoint(t,r),this.clearPointTrail(r),this.parentTransform&&this.trailMesh&&this.trailMesh.setPointStartPos(r,this.parentTransform.position.clone())},t.prototype.setVisible=function(t){this.particleMesh.mesh.setVisible(t),this.trailMesh&&this.trailMesh.mesh.setVisible(t)},t.prototype.setOpacity=function(t){var e,r=this.particleMesh.mesh.material,i=this.particleMesh.mesh.geometry,n=(null===(e=r.getVector4("uOpacityOverLifetimeValue"))||void 0===e?void 0:e.toArray())||[1,1,1,1];r.setVector4("uOpacityOverLifetimeValue",new NS(n[0],n[1],n[2],t));for(var o=i.getAttributeData("aColor")||[],a=0;a<o.length;a+=32)o[8*a+7]=t},t.prototype.setColor=function(t,e,r,i){var n,o=this.particleMesh.mesh.material,a=this.particleMesh.mesh.geometry,s=(null===(n=o.getVector4("uOpacityOverLifetimeValue"))||void 0===n?void 0:n.toArray())||[1,1,1,1];o.setVector4("uOpacityOverLifetimeValue",new NS(s[0],s[1],s[2],i));for(var u=a.getAttributeData("aColor")||[],c=0;c<u.length;c+=32)u[8*c+4]=t,u[8*c+5]=e,u[8*c+6]=r,u[8*c+7]=i},t.prototype.setParentTransform=function(t){this.parentTransform=t},t.prototype.getTextures=function(){var t,e,r,i,n=[];try{for(var o=ob(Object.values(this.particleMesh.mesh.material.textures)),a=o.next();!a.done;a=o.next()){var s=a.value;n.push(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}if(this.trailMesh)try{for(var u=ob(Object.values(this.trailMesh.mesh.material.textures)),c=u.next();!c.done;c=u.next()){s=c.value;n.push(s)}}catch(t){r={error:t}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}return n},t.prototype.start=function(){this.started&&!this.ended||(this.reset(),this.started=!0,this.ended=!1)},t.prototype.stop=function(){this.ended=!0,this.started=!1},t.prototype.reset=function(){var t;this.particleMesh.clearPoints(),null===(t=this.trailMesh)||void 0===t||t.clearAllTrails(),this.lastUpdate=0,this.loopStartTime=0,this.lastEmitTime=-1/this.emission.rateOverTime.getValue(0),this.generatedCount=0,this.particleLink=new DO((function(t,e){return t[0]-e[0]})),this.emission.bursts.forEach((function(t){return t.reset()})),this.frozen=!1},t.prototype.onUpdate=function(t){var e,r=this;if(this.started&&!this.frozen){var i=this.lastUpdate+t/1e3,n=this.particleMesh,o=this.trailMesh,a=this.options,s=this.loopStartTime,u=this.emission;this.lastUpdate=i,this.upDirectionWorld=null,n.time=i,o&&(o.time=i,o.onUpdate(t));var c=this.particleLink,l=(i-s)/a.duration,h=this.timePassed,f=!1,p=function(){r.trails&&!f&&(f=!0,c.forEach((function(t){var e=ab(t,4),i=e[0],n=e[1],o=e[2],a=e[3];i<h?r.clearPointTrail(n):h>o&&r.updatePointTrail(n,l,a,o)})))};if(this.ended){if(!a.looping)if(this.reusable);else if(0===a.endBehavior){var d=c.last;d&&d.content[0]-s<h&&(this.onUpdate=function(){return r.onDestroy()})}}else{var m=a.duration,v=this.lifetime;if(h<m){var y=1/u.rateOverTime.getValue(v),g=Math.floor((h-this.lastEmitTime)/y),x=g,T=y/g,E=i,A=a.maxCount;this.updateEmitterTransform(h);for(var b=function(){var t=c.first;return r.emissionStopped||c.length===A&&t&&t.content[0]-s>h},S=0;S<x&&S<A&&!b();S++){(L=this.createPoint(v)).delay+=E+S*T,this.addParticle(L,A),this.lastEmitTime=h}for(var _=u.bursts,R=(null==_?void 0:_.length)-1,C=0;R>=0&&C<A&&!b();R--){var O=_[R],w=!O.disabled&&O.getGeneratorOptions(h,v);if(w){var M=u.burstOffsets[R],I=M&&M[w.cycleIndex]||[0,0,0];O.once&&this.removeBurst(R);for(S=0;S<w.count&&C<A&&!b();S++){var L;(L=this.initPoint(this.shape.generate({total:w.total,index:w.index,burstIndex:S,burstCount:w.count}))).delay+=E,C++,(e=L.transform).translate.apply(e,sb([],ab(I),!1)),this.addParticle(L,A)}}}}else if(a.looping)p(),this.loopStartTime=i-m,this.lastEmitTime-=m,this.lastUpdate-=m,u.bursts.forEach((function(t){return t.reset()})),this.particleLink.forEach((function(t){t[0]-=m,t[2]-=m,t[3].delay-=m})),n.minusTime(m),o&&o.minusTime(m),this.onIterate(this);else{this.ended=!0,this.onEnd(this),4===a.endBehavior&&(this.frozen=!0)}}p()}},t.prototype.onDestroy=function(){},t.prototype.getParticleBoxes=function(){var t=this.particleLink,e=this.particleMesh,r=[],i=this.particleCount,n=0;if(!t||!e)return r;for(var o=t.last,a=!1;!a;){var s=o.content[0],u=o.content[3];if(s>this.timePassed){var c=this.getPointPosition(u);r.push({center:c,size:u.transform.scale}),o.pre?o=o.pre:a=!0}++n>i&&(a=!0)}return r},t.prototype.raycast=function(t){var e=this.particleLink,r=this.particleMesh;if(e&&r){var i=e.last,n=[],o=new OS,a=!1;if(i&&i.content)do{var s=ab(i.content,4),u=s[0],c=s[1];s[2];var l=s[3];if(!(u>this.timePassed))break;var h=this.getPointPosition(l),f=t.ray,p=!1;f&&(p=!!f.intersectSphere({center:h,radius:t.radius},o)),p&&(t.removeParticle&&(r.removePoint(c),this.clearPointTrail(c),e.removeNode(i),i.content=[0]),n.push(h),t.multiple||(a=!0))}while((i=i.pre)&&!a);return n}},t.prototype.clearPointTrail=function(t){var e;this.trails&&this.trails.dieWithParticles&&(null===(e=this.trailMesh)||void 0===e||e.clearTrail(t))},t.prototype.updatePointTrail=function(t,e,r,i){if(this.trailMesh){var n=this.trails,o=this.particleMesh,a=this.getPointPosition(r),s=n.inheritParticleColor?o.getPointColor(t):[1,1,1,1],u=r.transform.getWorldScale().toArray(),c=1,l=n.lifetime.getValue(e);if(n.sizeAffectsWidth&&(c*=u[0]),n.sizeAffectsLifetime&&(l*=u[0]),n.parentAffectsPosition&&this.parentTransform){a.add(this.parentTransform.position);var h=this.trailMesh.getPointStartPos(t);h&&a.subtract(h)}this.trailMesh.addPoint(t,a,{color:s,lifetime:l,size:c,time:i})}},t.prototype.getPointPosition=function(t){var e=t.transform,r=t.vel,i=t.lifetime,n=t.delay,o=t.gravity,a=void 0===o?[]:o,s=this.options.forceTarget,u=this.lastUpdate-n,c=new OS,l=OS.fromArray(a);e.assignWorldTRS(c);var h=QS(new OS,this.options,l,u,i,c,r);if(s){var f=s.target||[0,0,0],p=s.curve.getValue(u/i),d=1-p;h.x=h.x*d+f[0]*p,h.y=h.y*d+f[1]*p,h.z=h.z*d+f[2]*p}return h},t.prototype.onEnd=function(t){},t.prototype.onIterate=function(t){},t.prototype.initPoint=function(t){var e=this.options,r=this.lifetime,i=this.shape,n=e.startSpeed.getValue(r),o=e.particleFollowParent?this.transform.getMatrix():this.transform.getWorldMatrix(),a=o.transformPoint(t.position,new OS),s=new X_({position:a,valid:!0}),u=t.direction;if(u=o.transformNormal(u,Bw).normalize(),e.startTurbulence&&e.turbulence){for(var c=0;c<3;c++)Yw.setElement(c,e.turbulence[c].getValue(r));Ww.setFromVector3(Yw.negate()),Zw.setFromEuler(Ww).transformNormal(u).normalize()}var l,h=jw,f=Xw;i.alignSpeedDirection?(f.copyFrom(u),this.upDirectionWorld||(i.upDirection?this.upDirectionWorld=i.upDirection.clone():this.upDirectionWorld=OS.Z.clone(),o.transformNormal(this.upDirectionWorld)),h.crossVectors(f,this.upDirectionWorld).normalize(),h.isZero()&&h.set(1,0,0)):(h.set(1,0,0),f.set(0,1,0));var p=this.textureSheetAnimation;p&&p.animate&&((l=Hw)[0]=p.animationDelay.getValue(r),l[1]=p.animationDuration.getValue(r),l[2]=p.cycles.getValue(r));var d=Gw;e.start3DRotation?d.set(e.startRotationX.getValue(r),e.startRotationY.getValue(r),e.startRotationZ.getValue(r)):e.startRotation?d.set(0,0,e.startRotation.getValue(r)):d.set(0,0,0),s.setRotation(d.x,d.y,d.z);var m=e.startColor.getValue(r);3===m.length&&(m[3]=1);var v=kw;if(e.start3DSize)v.x=e.startSizeX.getValue(r),v.y=e.startSizeY.getValue(r);else{var y=e.startSize.getValue(r),g=e.sizeAspect.getValue(r);v.x=y,v.y=0===g?0:y/g}var x=u.clone();if(x.multiply(n),!e.particleFollowParent){var T=new OS;this.transform.assignWorldTRS(void 0,void 0,T),v.x*=T.x,v.y*=T.y}return s.setScale(v.x,v.y,1),{size:v,vel:x,color:m,delay:e.startDelay.getValue(r),lifetime:e.startLifetime.getValue(r),uv:Qw(this.uvs,!0),gravity:e.gravity,sprite:l,dirY:f,dirX:h,transform:s}},t.prototype.addBurst=function(t,e){var r=!1;if(this.emission.bursts.includes(t)||(this.emission.bursts.push(t),r=!0),r&&e instanceof Array){var i=this.emission.bursts.indexOf(t);return this.emission.burstOffsets[i]=e,i}return-1},t.prototype.removeBurst=function(t){t<this.emission.bursts.length&&(this.emission.burstOffsets[t]=null,this.emission.bursts.splice(t,1))},t.prototype.createPoint=function(t){var e={total:this.emission.rateOverTime.getValue(t),index:this.generatedCount,burstIndex:0,burstCount:0};return this.generatedCount++,this.initPoint(this.shape.generate(e))},t}(),Bw=new OS,kw=new CS,Gw=new VS,jw=new OS,Xw=new OS,Yw=new OS,Ww=new VS,Hw=[0,0,0],Zw=new LS;function qw(t){var e={};return Array.isArray(t)&&t.forEach((function(t){var r=t instanceof Array,i=r?t[0]:t.index,n=e[i];n||(n=e[i]=[]),r?n.push(t.slice(1,4)):n.push([+t.x,+t.y,+t.z])})),e}function Qw(t,e){var r=Math.floor(Math.random()*t.length),i=t[r];return e||t.splice(r,1),i}var Kw=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return eb(r,e),Object.defineProperty(r.prototype,"type",{get:function(){return wb.particle},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"contentVisible",{get:function(){return!this.destroyed},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(t){this.particle=t.content},r.prototype.onLifetimeBegin=function(t,e){var r=this;return e&&(e.name=this.name,e.start(),e.onDestroy=function(){r.destroyed=!0}),e},r.prototype.onItemUpdate=function(t,e){var r;if(this.content){var i=!this.visible,n=this.parentId&&(null===(r=this.composition)||void 0===r?void 0:r.getItemByID(this.parentId));if(!i&&n){var o=n.getRenderData();o&&(this.content.setParentTransform(o.transform),o.visible||(i=!1))}i?this.content.setVisible(!0):(this.content.setVisible(!1),this.content.onUpdate(t))}},r.prototype.onItemRemoved=function(e,r){r&&(e.destroyTextures(r.getTextures()),r.meshes.forEach((function(e){return e.dispose({material:{textures:t.DestroyOptions.keep}})})))},r.prototype.setColor=function(t,e,r,i){this.content.setColor(t,e,r,i)},r.prototype.setOpacity=function(t){this.content.setOpacity(t)},r.prototype.stopParticleEmission=function(){this.content&&(this.content.emissionStopped=!0)},r.prototype.resumeParticleEmission=function(){this.content&&(this.content.emissionStopped=!1)},r.prototype.doCreateContent=function(t){return tS(this.particle),new Uw(this.particle,t.getRendererOptions(),this)},r.prototype.isEnded=function(t){return e.prototype.isEnded.call(this,t)&&this.destroyed},r.prototype.getBoundingBox=function(){var e=this.content;if(e){var r=e.getParticleBoxes();return{type:t.HitTestType.sphere,area:r}}},r.prototype.getHitTestParams=function(e){var r,i=this,n=null===(r=this.content)||void 0===r?void 0:r.interaction;if(e||n)return{type:t.HitTestType.custom,collect:function(t){var e;return null===(e=i.content)||void 0===e?void 0:e.raycast({radius:(null==n?void 0:n.radius)||.4,multiple:!!(null==n?void 0:n.multiple),removeParticle:(null==n?void 0:n.behavior)===sS.removeParticle,ray:t})}}},r}(Y_),Jw=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.meshes=[],t}return eb(r,e),r.precompile=function(e,r,i){var n=e[0],o={rotationOverLifetime:{x:!1,y:!1,z:!1},positionOverLifetime:{speedOverLifetime:!1,linearX:!1,linearY:!1,linearZ:!1,orbitalX:!1,orbitalY:!1,orbitalZ:!1,forceCurve:!1},colorOverLifetime:{opacity:!1,color:!1},sizeOverLifetime:{x:!1,y:!1}},a={colorOverLifetime:{opacity:1,color:[iS.RGBA_COLOR,[255,255,255,255]]},positionOverLifetime:{speedOverLifetime:1},sizeOverLifetime:{x:1,y:1}},s=r.engine.gpuCapability,u=s.level,c=(null!=i?i:{}).env,l=r.getShaderLibrary(),h=[],f=[],p=[],d=0,m=0;return n.items.forEach((function(e){t.Item.isParticle(e)&&(f.push(e),function(e){if(t.Item.isParticle(e)){var r=e.content;r.rotationOverLifetime||(r.rotationOverLifetime={});var i=r.rotationOverLifetime;i.z||(i.z=[iS.CONSTANT,0]),i.separateAxes||(delete i.y,delete i.x),r.sizeOverLifetime||(r.sizeOverLifetime={});var n=r.sizeOverLifetime;n.separateAxes||delete n.y,n.size&&(n.x=n.size,delete n.size),n.x||(n.x=[iS.CONSTANT,1])}}(e),2===u&&Object.keys(o).forEach((function(t){var r=o[t],i=e.content[t];i&&Object.keys(r).forEach((function(e){i[e]&&(r[e]=!0,zb(h,t))}))})))})),f.forEach((function(e){var r,i,n=e.content;2===u&&(h.forEach((function(t){var e=o[t],r=n[t]||(n[t]={});Object.keys(e).forEach((function(i){if(e[i]&&!r[i]){var n=a[t]&&a[t][i]||0;r[i]=isNaN(n)?n:[iS.CONSTANT,n]}}))})),o.positionOverLifetime.forceCurve&&(n.positionOverLifetime.forceTarget=!0),(o.rotationOverLifetime.x||o.rotationOverLifetime.y)&&(n.rotationOverLifetime.separateAxes=!0),o.sizeOverLifetime.y&&(n.sizeOverLifetime.separateAxes=!0));var f=FO(e,c,s),v=f.shader,y=f.fragment,g=f.vertex;if(p.push(v),d=Math.max(d,y),m=Math.max(m,g),e.content.trails){var x=function(t,e,r,i,n){void 0===i&&(i="");var o=0,a=VR(LR)?1:0,s=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",a],["ENV_EDITOR",i===pb]],u={curves:[],index:0,max:0,lineSegCount:0,curveCount:0};return t.colorOverLifetime&&(s.push(["COLOR_OVER_LIFETIME",!0]),o|=1),t.colorOverTrail&&(s.push(["COLOR_OVER_TRAIL",!0]),o|=4),e>64&&(s.push(["ATTR_TRAIL_START",1]),o|=8),C_(u,t.opacityOverLifetime),C_(u,t.widthOverTrail),s.push(["VERT_CURVE_VALUE_COUNT",u.index],["VERT_MAX_KEY_FRAME_COUNT",u.max]),{vertex:AC,fragment:TC,marcos:s,shared:!0,name:"trail#"+r,cacheId:"-t:+".concat(o,"+").concat(u.index,"+").concat(u.max)}}(e.content.trails,e.content.options.maxCount,e.name,c,s);x.vertex=vR(null!==(r=x.marcos)&&void 0!==r?r:[],x.vertex,t.ShaderType.vertex,u),x.fragment=vR(null!==(i=x.marcos)&&void 0!==i?i:[],x.fragment,t.ShaderType.fragment,u),x.glslVersion=2===u?t.GLSLVersion.GLSL3:t.GLSLVersion.GLSL1,l.addShader(x)}})),p.forEach((function(e){var r,i;2===u?(VO(e,m,d),e.glslVersion=t.GLSLVersion.GLSL3):e.glslVersion=t.GLSLVersion.GLSL1,e.vertex=vR(null!==(r=e.marcos)&&void 0!==r?r:[],e.vertex,t.ShaderType.vertex,u),e.fragment=vR(null!==(i=e.marcos)&&void 0!==i?i:[],e.fragment,t.ShaderType.fragment,u),l.addShader(e)})),2===u&&f.forEach((function(t){t.content.options.meshSlots=[m,d]})),Promise.resolve()},r.prototype.onCompositionItemLifeBegin=function(t,e){e instanceof Kw&&this.add(e.content)},r.prototype.onCompositionItemRemoved=function(t,e){e instanceof Kw&&e.content&&this.remove(e.content,t.renderFrame)},r.prototype.prepareRenderFrame=function(t,e){return this.meshes.forEach((function(t){return e.addMeshToDefaultRenderPass(t)})),this.meshes.length=0,!1},r.prototype.add=function(t){var e=this;t.meshes.forEach((function(t){return zb(e.meshes,t)}))},r.prototype.remove=function(t,e){var r=this;t.meshes.forEach((function(t){Ub(r.meshes,t),e.removeMeshFromDefaultRenderPass(t)}))},r}($_);var $w,tM=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e}($_),eM=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._v_priority=1,e.childrenVisible=!0,e}return eb(e,t),Object.defineProperty(e.prototype,"type",{get:function(){return wb.null},enumerable:!1,configurable:!0}),e.prototype.onConstructed=function(t){this.cal=t.content,this.relative=t.relative},e.prototype.onLifetimeBegin=function(t,e){e.active=!0},e.prototype.onItemRemoved=function(t,e){},e.prototype.onItemUpdate=function(t,e){this.content&&(this.content.updateTime(this.time),this.renderData=this.content.getRenderData(this.content.time))},e.prototype.setScale=function(t,e,r){this.content.startSize=new OS(t,e,r)},e.prototype.scale=function(t,e,r){var i=this.content.startSize.clone();this.content.startSize=new OS(t*i.x,e*i.y,r*i.z)},e.prototype.getHitTestParams=function(t){},e.prototype.getRenderData=function(){return this.renderData},e.prototype.getChildrenVisible=function(){return this.childrenVisible},e.prototype.setChildrenVisible=function(t){this.childrenVisible!==t&&(this.childrenVisible=!!t,this.handleVisibleChanged(this.visible))},e.prototype.doCreateContent=function(t){var e=new SO(this.cal,this);return e.renderData=e.getRenderData(0,!0),e},e.prototype.handleVisibleChanged=function(t){this.content&&(this.content.visible=t||this.childrenVisible)},e}(Y_),rM=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return eb(e,t),e.prototype.getItemGeometryData=function(t,e){var r=t,i=r.splits,n=r.renderer,o=r.textureSheetAnimation,a=r.startSize;r.textLayout;var s=a.x,u=a.y;if(n.shape){for(var c=n.shape,l=c.index,h=c.aPoint,f=new Float32Array(h),p=0;p<f.length;p+=6)f[p]*=s,f[p+1]*=u;return{index:l,aPoint:Array.from(f)}}var d=.5,m=.5,v=[-d,m,-d,-m,d,m,d,-m],y=[],g=[],x=2,T=2;1===i.length&&(x=1,T=1);for(var E=0;E<x;E++)for(var A=0;A<T;A++){var b=4*(2*A+E),S=o?[0,0,1,1,i[0][4]]:i[2*A+E],_=S[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],R=((E+E+1)/x-1)/2,C=((A+A+1)/T-1)/2,O=S[0],w=S[1],M=S[4]?S[3]:S[2],I=S[4]?S[2]:S[3],L=[v[0]/x+R,v[1]/T+C,v[2]/x+R,v[3]/T+C,v[4]/x+R,v[5]/T+C,v[6]/x+R,v[7]/T+C];y.push(L[0]*s,L[1]*u,_[0]*M+O,_[1]*I+w,e,0,L[2]*s,L[3]*u,_[2]*M+O,_[3]*I+w,e,0,L[4]*s,L[5]*u,_[4]*M+O,_[5]*I+w,e,0,L[6]*s,L[7]*u,_[6]*M+O,_[7]*I+w,e,0),this.lineMode?g.push(b,1+b,1+b,3+b,3+b,2+b,2+b,b):g.push(b,1+b,2+b,2+b,1+b,3+b)}return{index:g,aPoint:y}},e}(hO),iM=function(t){var e,r,i,n,o,a;this.isUnderline=!1,this.underlineHeight=1,this.isOutlined=!1,this.outlineWidth=0,this.hasShadow=!1,this.fontDesc="",this.fontScale=2,this.fontOffset=0;var s=t.textColor,u=void 0===s?[1,1,1,1]:s,c=t.fontSize,l=void 0===c?40:c,h=t.outline,f=t.shadow,p=t.fontWeight,d=void 0===p?"normal":p,m=t.fontStyle,v=void 0===m?"normal":m,y=t.fontFamily,g=void 0===y?"sans-serif":y;this.textColor=u,this.textWeight=d,this.fontStyle=v,this.fontFamily=g,this.fontSize=l,h&&(this.isOutlined=!0,this.outlineColor=null!==(e=h.outlineColor)&&void 0!==e?e:[1,1,1,1],this.outlineWidth=null!==(r=h.outlineWidth)&&void 0!==r?r:1,this.fontOffset+=this.outlineWidth),f&&(this.hasShadow=!0,this.shadowBlur=null!==(i=f.shadowBlur)&&void 0!==i?i:2,this.shadowColor=null!==(n=f.shadowColor)&&void 0!==n?n:[0,0,0,1],this.shadowOffsetX=null!==(o=f.shadowOffsetX)&&void 0!==o?o:0,this.shadowOffsetY=null!==(a=f.shadowOffsetY)&&void 0!==a?a:0),this.fontStyle!==yS.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},nM=function(){function t(){}return t.measureFont=function(e){if(t._fonts[e])return t._fonts[e];var r={ascent:0,descent:0,fontSize:0},i=t._canvas,n=i.getContext("2d",{willReadFrequently:!0});n.font=e;var o=t.METRICS_STRING+t.BASELINE_SYMBOL,a=Math.ceil(n.measureText(o).width),s=Math.ceil(n.measureText(t.BASELINE_SYMBOL).width),u=Math.ceil(t.HEIGHT_MULTIPLIER*s);s=s*t.BASELINE_MULTIPLIER|0,i.width=a,i.height=u,n.fillStyle="#f00",n.fillRect(0,0,a,u),n.font=e,n.textBaseline="alphabetic",n.fillStyle="#000",n.fillText(o,0,s);var c=n.getImageData(0,0,a,u).data,l=c.length,h=4*a,f=0,p=0,d=!1;for(f=0;f<s;++f){for(var m=0;m<h;m+=4)if(255!==c[p+m]){d=!0;break}if(d)break;p+=h}for(r.ascent=s-f,p=l-h,d=!1,f=u;f>s;--f){for(m=0;m<h;m+=4)if(255!==c[p+m]){d=!0;break}if(d)break;p-=h}return r.descent=f-s,r.fontSize=r.ascent+r.descent,t._fonts[e]=r,r},Object.defineProperty(t,"_canvas",{get:function(){var e;return VR(PR)?(e=window._createOffscreenCanvas(10,10),t.__canvas=e):t.__canvas||((e=document.createElement("canvas")).width=e.height=10,t.__canvas=e),t.__canvas},enumerable:!1,configurable:!0}),t._fonts={},t.METRICS_STRING="|ÉqÅ",t.BASELINE_SYMBOL="M",t.BASELINE_MULTIPLIER=1.4,t.HEIGHT_MULTIPLIER=2,t}(),oM=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];t.QTextWrapMode=void 0,($w=t.QTextWrapMode||(t.QTextWrapMode={}))[$w.Default=0]="Default",$w[$w.Clip=1]="Clip",$w[$w.Ellipsis=2]="Ellipsis";var aM=function(){function e(e,r){var i,n,o,a,s,u,c,l,h,f;this.left=0,this.top=0,this.fontSize=48,this.fontFamily="Arial",this.color="black",this.letterSpacing=0,this.maxLineWidth=0,this.wrap=t.QTextWrapMode.Clip,this.scaleX=1,this.scaleY=1,this.angle=0,this.active=!0,this.padding=0,this.borderColor="#ffffffff",this.borderWidth=1,this.fontProperties={ascent:0,descent:0,fontSize:0},this.fontVariant="normal",this.originX="left",this.originY="top",this.ellipsis="…",this.text=e,this.left=null!==(i=r.left)&&void 0!==i?i:0,this.top=null!==(n=r.top)&&void 0!==n?n:0,this.maxLineWidth=null!==(o=r.maxWidth)&&void 0!==o?o:0,this.letterSpacing=null!==(a=r.letterSpacing)&&void 0!==a?a:0,this.originX="left",this.originY="top",this.color=null!==(s=r.color)&&void 0!==s?s:"black",this.fontFamily=null!==(u=r.fontFamily)&&void 0!==u?u:"Arial",this.fontSize=null!==(c=r.fontSize)&&void 0!==c?c:48,this.wrap=null!==(l=r.wrap)&&void 0!==l?l:t.QTextWrapMode.Clip,this.fontStyle=null!==(h=r.fontStyle)&&void 0!==h?h:"normal",this.textAlign="left",this.textBaseline="alphabetic",this.fontWeight="normal",this.angle=null!==(f=r.angle)&&void 0!==f?f:0,this.name=r.name||""}return e.prototype.update=function(){this.updateDimension()},e.prototype.render=function(){if(void 0!==this.viewer){var t=this.viewer.renderContext;void 0!==t&&(t.save(),this.setRenderTransform(t),this.renderText(t),this.active&&this.drawBorders(t),t.restore())}},e.prototype.init=function(t){this.viewer=t,this.updateDimension()},e.prototype.getLayout=function(){var t=this.viewer.scaleX,e=this.viewer.scaleY;return{x:this.left*t,y:this.top*e,width:this.width*t,height:this.height*e}},e.prototype.updateDimension=function(){var t=this.viewer.renderContext;this.configTextStyle(t),this.configTextLayout(t);var e=this.getFontDesc();this.fontProperties=nM.measureFont(e),0===this.fontProperties.fontSize&&(this.fontProperties.fontSize=this.fontSize,this.fontProperties.ascent=this.fontSize);var r=this.createCharsFromText(t,this.text),i=0;if(r.length>0){var n=r[r.length-1];i=n.left+n.width}this.chars=r,this.maxLineWidth=i,void 0===this.height&&(this.height=this.fontProperties.fontSize),void 0===this.width&&(this.width=this.maxLineWidth)},e.prototype.configTextStyle=function(t){t.font=this.getFontDesc(),t.fillStyle=this.color},e.prototype.getFontDesc=function(){for(var t="number"==typeof this.fontSize?"".concat(this.fontSize,"px"):this.fontSize,e=this.fontFamily.split(","),r=e.length-1;r>=0;r--){var i=e[r].trim();/([\"\'])[^\'\"]+\1/.test(i)||oM.includes(i)||(i='"'.concat(i,'"')),e[r]=i}return e.push("Arial, Helvetica, sans-serif"),"".concat(this.fontStyle," ").concat(this.fontVariant," ").concat(this.fontWeight," ").concat(t," ").concat(e.join(","))},e.prototype.configTextLayout=function(t){t.textBaseline=this.textBaseline,t.textAlign=this.textAlign},e.prototype.setRenderTransform=function(t){t.scale(this.scaleX,this.scaleY),t.translate(this.left,this.top)},e.prototype.renderText=function(t){this.drawCharsInTextBox(t,{min:[0,0],max:[0+this.width,0+this.height]})},e.prototype.drawCharsInTextBox=function(e,r){var i=this.chars,n=0;if(i.length>0){var o=i[i.length-1];n=o.left+o.width}var a=r.max[0]-r.min[0],s=0;"left"===this.textAlign?s=0:"center"===this.textAlign?s=.5*(a-n):"right"===this.textAlign&&(s=a-n),this.addOffsetToChars(i,s);var u=this.cloneChars(this.clipCharsWithTextBox(i,r)),c=u;this.wrap===t.QTextWrapMode.Ellipsis&&0===(c=this.replaceCharWithEllipsis(e,u,r)).length&&0!==i.length&&this.addEllipsisToChars(e,c,r),this.drawCharsFromLeft(e,c)},e.prototype.addEllipsisToChars=function(t,e,r){var i,n,o,a=t.measureText(this.ellipsis).width;if("left"===this.textAlign)e.push({char:this.ellipsis,left:r.min[0],top:0,width:a,heigh:null!==(i=this.height)&&void 0!==i?i:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else if("right"===this.textAlign)e.push({char:this.ellipsis,left:r.max[0]-a,top:0,width:a,heigh:null!==(n=this.height)&&void 0!==n?n:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0});else{var s=.5*(r.max[0]+r.min[0]);e.push({char:this.ellipsis,left:s-.5*a,top:0,width:a,heigh:null!==(o=this.height)&&void 0!==o?o:0,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!0,scale:1,index:0})}},e.prototype.createCharsFromText=function(t,e){var r=e.split(""),i=0,n=0;"top"===this.textBaseline?n=0:"middle"===this.textBaseline?n+=.5*this.fontProperties.ascent:"alphabetic"===this.textBaseline&&(n+=this.fontProperties.ascent);for(var o=[],a=0;a<r.length;++a){var s=r[a],u=Math.floor(t.measureText(s).width),c={left:i,top:n,width:u,heigh:this.fontSize,char:s,font:this.fontFamily,fontSize:this.fontSize,isEllipsis:!1,scale:1,index:a};o.push(c),i+=u+this.letterSpacing}return o},e.prototype.addOffsetToChars=function(t,e){return t.forEach((function(t){t.left+=e})),t},e.prototype.clipCharsWithTextBox=function(t,e){for(var r=[],i=0;i<t.length;++i){var n=t[i];n.left>=e.min[0]&&n.left+n.width<e.max[0]+.5&&r.push(n)}return r},e.prototype.cloneChars=function(t){return t.map((function(t){return rb({},t)}))},e.prototype.replaceCharWithEllipsis=function(t,e,r){var i=t.measureText(this.ellipsis).width;if(e.length>0){if(0!==e[0].index)(n=rb({},e[0])).char=this.ellipsis,n.isEllipsis=!0,n.width=i,e=this.findEllipsisPositionAndReplaceCharsFromLeft(e,n,r);var n,o=e.length-1,a=this.chars.length;if(e[o].index!==a-1)(n=rb({},e[0])).char=this.ellipsis,n.isEllipsis=!0,n.width=i,e=this.findEllipsisPositionAndReplaceCharsFromRight(e,n,r)}return e},e.prototype.findEllipsisPositionAndReplaceCharsFromLeft=function(t,e,r){for(var i=0,n=0;n<t.length;++n){var o=t[n];if(i=n,o.left+o.width-e.width>=r.min[0])break}var a=t[i];e.left=a.left+a.width-e.width;for(n=0;n<i+1;++n)t.shift();return[e].concat(t)},e.prototype.findEllipsisPositionAndReplaceCharsFromRight=function(t,e,r){for(var i=t.length-1,n=i;n>=0;--n){if(i=n,t[n].left+e.width<=r.max[0])break}e.left=t[i].left;for(n=t.length-1;n>=i;--n)t.pop();return t.concat([e])},e.prototype.drawCharsFromLeft=function(t,e){var r=t.textAlign||"left";t.textAlign="left";for(var i=0;i<e.length;++i){var n=e[i];t.fillText(n.char,n.left,n.top)}t.textAlign=r},e.prototype.drawBorders=function(t){this.padding;var e=this.borderWidth;t.strokeStyle=this.borderColor,t.lineWidth=e;var r=this.width,i=this.height,n=0,o=0;"center"===this.originX?n-=this.width/2:"right"===this.originX&&(n-=this.width),"center"===this.originY?o-=this.height/2:"bottom"===this.originY&&(o-=this.height),t.strokeRect(n+e/2,o+e/2,r-e,i-e)},e}(),sM=function(){function t(t,e,r,i,n,o){var a;this.textList=[],a="string"==typeof t?document.getElementById(t):t,this.scaleX=null!=i?i:1,this.scaleY=null!=n?n:1,this.flipY=null!=o&&o,this.width=e,this.height=r,a.style.width="".concat(e*this.scaleX,"px"),a.style.height="".concat(r*this.scaleY,"px");this.devicePixelRatio=1,a.width=1*e*this.scaleX,a.height=1*r*this.scaleY,a.className="lower-canvas",this.renderCanvas=a,this.renderContext=this.renderCanvas.getContext("2d"),this.renderContext.scale(1*this.scaleX,1*this.scaleY)}return t.prototype.initDimension=function(t,e,r,i){this.width=t,this.height=e,this.scaleX=null!=r?r:1,this.scaleY=null!=i?i:1,this.renderCanvas.style.width="".concat(t*this.scaleX,"px"),this.renderCanvas.style.height="".concat(e*this.scaleY,"px");var n=this.devicePixelRatio;this.renderCanvas.width=n*t*this.scaleX,this.renderCanvas.height=n*e*this.scaleY,this.flipY&&(this.renderContext.translate(0,this.height),this.renderContext.scale(1,-1)),this.renderContext.scale(n*this.scaleX,n*this.scaleY)},t.prototype.clearText=function(){this.textList=[]},t.prototype.clearCanvasWithContext=function(t){t.clearRect(0,0,this.width,this.height)},t.prototype.clearCanvas=function(){this.clearCanvasWithContext(this.renderContext)},t.prototype.addObject=function(t){t.init(this),this.textList.push(t)},t.prototype.render=function(){this.clearCanvasWithContext(this.renderContext),this.renderContext.fillStyle="rgba(255, 255, 255, 0.0039)",this.renderContext.fillRect(0,0,this.width,this.height);var t=this.background;t&&void 0!==t.width&&void 0!==t.height&&this.renderContext.drawImage(t,0,0,t.width,t.height,0,0,this.width,this.height);for(var e=0;e<this.textList.length;++e){this.renderContext.save();var r=this.textList[e];r.update(),r.render(),this.renderContext.restore()}},t}();function uM(t,e){return e=e||{},new Promise((function(r,i){var n=new XMLHttpRequest;n.responseType=(null==e?void 0:e.responseType)||"json",n.addEventListener("load",(function(){return r(n.response)})),n.addEventListener("error",(function(){return i(Error("load ".concat(t," fail")))})),n.open((null==e?void 0:e.method)||"get",t),n.send(null==e?void 0:e.data)}))}function cM(t,e,r,i,n){return ib(this,void 0,void 0,(function(){var o,a,s,u,c,l,h,f,p,d;return nb(this,(function(m){switch(m.label){case 0:return o={},a=[],i=i||{},r=r||{},e.asImage?(s=e.content.replace(/\$/g,""),u=r[s]||e.variables[s],c=function(t){var r=(null==i?void 0:i.canvas)||document.createElement("canvas"),o=r.width=e.backgroundWidth,a=r.height=e.backgroundHeight,s=r.getContext("2d");return null==s||s.clearRect(0,0,o,a),n&&(null==s||s.translate(0,a),null==s||s.scale(1,-1)),null==s||s.drawImage(t,0,0,t.width,t.height,0,0,o,a),r},u?[2,bR(u).then(c)]:[2,lM(t).then(c)]):(l=i.templateScale||1,Object.keys(e.variables).forEach((function(t){var i=e.variables[t];if(r.hasOwnProperty(t)&&(i=r[t]),/^image_/.test(t)){var n=i instanceof Array,s=n?i[0]:i;a.push(function(t,e){return r(t,(function(i){return e?r(e,(function(){return t})):t}));function r(t,e){return/^(https?:)?\/\//.test(t)?uM(t,{responseType:"blob"}).then(hM,e):Promise.resolve(t)}}(s,n&&i[1]).then((function(e){return o[t]=e})))}else o[t]=i})),[4,Promise.all(a)]);case 1:return m.sent(),[4,bR(t)];case 2:return h=m.sent(),f=e.content.replace(/\$([\w_]+)\$/g,(function(t,e){return o[e]})).replace('width="'.concat(e.width,'px"'),'width="'.concat(e.width*l,'px"')).replace('height="'.concat(e.height,'px"'),'height="'.concat(e.height*l,'px"')),[4,bR("data:image/svg+xml,".concat(encodeURIComponent(f)))];case 3:return p=m.sent(),(d=(null==i?void 0:i.canvas)||document.createElement("canvas")).width=h.width*l,d.height=h.height*l,[2,new Promise((function(t,r){var i=d.getContext("2d");i.clearRect(0,0,d.width,d.height),n&&(i.translate(0,d.height),i.scale(1,-1)),i.drawImage(h,0,0,h.width,h.height,0,0,d.width,d.height),i.drawImage(p,0,0,p.width,p.height,(e.x||0)*l,(e.y||0)*l,e.width*l/e.backgroundWidth*h.width,e.height*l/e.backgroundHeight*h.height),t(d)}))]}}))}))}function lM(t){return V_(t)?bR(t):Promise.resolve(t)}function hM(t){return new Promise((function(e,r){var i=new FileReader;i.readAsDataURL(t),i.onload=function(){e(i.result)},i.onerror=r}))}var fM=["serif","sans-serif","monospace","courier"],pM=800,dM=600,mM=new Map,vM=new(function(){function t(){this.elements=[]}return t.prototype.dispose=function(){this.elements.forEach((function(t){return t.remove()})),this.elements=[]},t.prototype.getCanvas=function(){if(this.elements.length)return this.elements.shift();if(VR(PR))return window._createOffscreenCanvas(10,10);var t=document.createElement("canvas");return t.getContext("2d",{willReadFrequently:!0}),t},t.prototype.saveCanvas=function(t){t.width=t.height=1,this.elements.length<3?zb(this.elements,t):t.remove()},t}());function yM(t,e){var r,i,n;if(null===(r=null==t?void 0:t.background)||void 0===r?void 0:r.name){var o=t.background.name;e&&e[o]?n=e[o]:(null===(i=t.background)||void 0===i?void 0:i.url)&&(n=t.background.url)}return n}function gM(e,r,i,n,o){var a;return ib(this,void 0,void 0,(function(){var s,u,c,l,h,f,p,d,m,v,y;return nb(this,(function(g){switch(g.label){case 0:if(!r)throw Error("image not provided");return s=(null==o?void 0:o.templateScale)||1,u=s,c=s,l=r,h=r.width,f=r.height,i?(h=i.width,f=i.height,r.width===h&&r.height===f||(u*=r.width/i.width,c*=r.height/i.height),(p=yM(i,n))&&p!==r.src?V_(p)?[4,bR(p)]:[3,2]:[3,4]):[3,5];case 1:return d=g.sent(),[3,3];case 2:d=p,g.label=3;case 3:l=d,g.label=4;case 4:(m=i.content)&&(v=function(e,r,i){var n=e.fonts,o=[];return e.texts.forEach((function(a){var s,u=a.t,c=a.x,l=a.y,h={weight:400,family:"serif",size:48,style:yS.normal};void 0!==a.f&&(h=n[a.f]);var f=a.n;f&&r&&r.hasOwnProperty(f)&&(u="".concat(r[f]));var p=new aM(u,{left:c,top:l,fontSize:h.size,fontFamily:h.family,fontWeight:"".concat(h.weight),fontStyle:"normal",name:f});if(void 0!==a.r&&(p.angle=a.r*Math.PI/180),p.active=null!==(s=null==i?void 0:i.debug)&&void 0!==s&&s,void 0!==a.w&&(p.width=a.w),void 0!==h.letterSpace&&(p.letterSpacing=h.letterSpace),a.of===pS.display?p.wrap=t.QTextWrapMode.Default:a.of===pS.clip?p.wrap=t.QTextWrapMode.Clip:a.of===pS.ellipsis&&(p.wrap=t.QTextWrapMode.Ellipsis),void 0!==a.c){var d=e.colors[a.c][1],m=1;void 0!==d[3]&&(m=d[3]/255),p.color="rgba(".concat(d[0],", ").concat(d[1],", ").concat(d[2],", ").concat(m,")")}a.a===mS.left?p.textAlign="left":a.a===mS.middle?p.textAlign="center":a.a===mS.right&&(p.textAlign="right"),h.style===yS.normal?p.fontStyle="normal":h.style===yS.italic?p.fontStyle="italic":h.style===yS.oblique&&(p.fontStyle="oblique"),void 0!==h.weight&&(p.fontWeight=String(h.weight)),(null==i?void 0:i.borderColor)&&(p.borderColor=i.borderColor),void 0!==(null==i?void 0:i.borderWidth)&&(p.borderWidth=i.borderWidth),o.push(p)})),o}(m,n,rb(rb({},o),{scaleX:u,scaleY:c})),v.forEach((function(t){e.addObject(t)}))),g.label=5;case 5:return e.flipY=null!==(a=null==o?void 0:o.flipY)&&void 0!==a&&a,e.initDimension(h,f,u,c),e.background=l,e.render(),(y=null==o?void 0:o.textLayouts)&&(y.length=0,e.textList.forEach((function(t){var e=t.getLayout(),r={x:e.x,y:e.y,width:e.width,height:e.height};y.push(r)}))),[2]}}))}))}function xM(t){return ib(this,void 0,void 0,(function(){var e,r,i;return nb(this,(function(n){switch(n.label){case 0:if(!t.content||!t.content.fonts)return[3,4];e=t.content.fonts,r=function(t){var r,i,n,o,a;return nb(this,(function(s){switch(s.label){case 0:return r=e[t].family,i=e[t].url,n=!1,fM.includes(r)?n=!0:void 0!==document.fonts&&document.fonts.forEach((function(t){t.family===r&&(n=!0)})),n||void 0===i||""===i?[3,2]:(o="url(".concat(i,")"),void 0===document.fonts?[3,2]:[4,(a=new FontFace("".concat(r),o)).load()]);case 1:s.sent(),document.fonts.add(a),s.label=2;case 2:return[2]}}))},i=0,n.label=1;case 1:return i<e.length?[5,r(i)]:[3,4];case 2:n.sent(),n.label=3;case 3:return++i,[3,1];case 4:return[2]}}))}))}function TM(t,e,r,i,n){return ib(this,void 0,void 0,(function(){var o,a,s;return nb(this,(function(u){switch(u.label){case 0:return o=rb(rb({},i),{flipY:n}),a=function(t,e,r){var i,n=(null==r?void 0:r.templateScale)||1,o=(null==r?void 0:r.flipY)||!1;if(null==r?void 0:r.canvas){if(!(i=mM.get(r.canvas))){var a=new sM(r.canvas,t,e,n,n,o);mM.set(r.canvas,a),i=a}}else{var s=vM.getCanvas();i=new sM(s,pM,dM,n,n,o)}return i}(pM,pM,o),void 0===e?[3,2]:[4,xM(e)];case 1:u.sent(),u.label=2;case 2:return a.clearText(),"string"!=typeof t?[3,5]:[4,bR(t)];case 3:return s=u.sent(),[4,gM(a,s,e,r,o)];case 4:return u.sent(),[2,a.renderCanvas];case 5:return[4,gM(a,t,e,r,o)];case 6:return u.sent(),[2,a.renderCanvas]}}))}))}function EM(t,e,r,i,n){return ib(this,void 0,void 0,(function(){return nb(this,(function(o){return 2===e.v?[2,TM(t,e,r,{templateScale:null==i?void 0:i.templateScale,toData:!0},n)]:[2,cM(t,e,r,i,n)]}))}))}var AM=function(){function t(t){this.width=0,this.height=0;var e=t.textHeight,r=void 0===e?100:e,i=t.textWidth,n=void 0===i?100:i,o=t.textOverflow,a=void 0===o?pS.display:o,s=t.textBaseline,u=void 0===s?dS.top:s,c=t.textAlign,l=void 0===c?mS.left:c,h=t.text,f=t.letterSpace,p=void 0===f?0:f,d=t.autoWidth,m=void 0!==d&&d,v=t.fontSize,y=t.lineHeight,g=void 0===y?v:y,x=v+p;this.autoWidth=m,this.maxTextWidth=h.length*x,this.width=n,this.height=r,this.letterSpace=p,this.overFlow=a,this.textBaseline=u,this.textAlign=l,this.lineHeight=g}return t.prototype.getOffsetY=function(t){var e=0,r=(t.fontSize+t.outlineWidth)*t.fontScale;switch(this.textBaseline){case 0:e=r;break;case 1:e=(this.height+r)/2;break;case 2:e=this.height-r/2}return e},t.prototype.getOffsetX=function(t,e){var r=0;switch(this.textAlign){case 0:r=t.outlineWidth*t.fontScale;break;case 1:r=(this.width*t.fontScale-e)/2;break;case 2:r=this.width*t.fontScale-e}return r},t.prototype.setSize=function(t,e){this.width=t,this.height=e},t}(),bM=function(t){function e(e,r,i){var n=t.call(this,e,r,i)||this;n.isDirty=!0;var o=e.options;return n.canvas=vM.getCanvas(),vM.saveCanvas(n.canvas),n.context=n.canvas.getContext("2d",{willReadFrequently:!0}),n.engine=i.composition.getEngine(),n.textStyle=new iM(o),n.textLayout=new AM(o),n.text=o.text,n.mesh=new rM(n.engine,n.renderInfo,i.composition),n.mesh.setItems([n]),n.updateTexture(),n}return eb(e,t),e.prototype.setFontSize=function(t){this.textStyle.fontSize!==t&&(this.textStyle.fontSize=t,this.textLayout.lineHeight=1.5175*this.textStyle.fontSize,this.isDirty=!0)},e.prototype.setFontWeight=function(t){this.textStyle.textWeight!==t&&(this.textStyle.textWeight=t,this.isDirty=!0)},e.prototype.setFontStyle=function(t){this.textStyle.fontStyle!==t&&(this.textStyle.fontStyle=t,this.isDirty=!0)},e.prototype.setText=function(t){this.text!==t&&(this.text=t,this.isDirty=!0)},e.prototype.setTextAlign=function(t){this.textLayout.textAlign!==t&&(this.textLayout.textAlign=t,this.isDirty=!0)},e.prototype.setTextBaseline=function(t){this.textLayout.textBaseline!==t&&(this.textLayout.textBaseline=t,this.isDirty=!0)},e.prototype.setTextColor=function(t){this.textStyle.textColor!==t&&(this.textStyle.textColor=t,this.isDirty=!0)},e.prototype.setFontFamily=function(t){this.textStyle.fontFamily!==t&&(this.textStyle.fontFamily=t,this.isDirty=!0)},e.prototype.setOutlineColor=function(t){this.textStyle.outlineColor!==t&&(this.textStyle.outlineColor=t,this.isDirty=!0)},e.prototype.setOutlineWidth=function(t){this.textStyle.outlineWidth!==t&&(this.textStyle.outlineWidth=t,this.isDirty=!0)},e.prototype.setShadowBlur=function(t){this.textStyle.shadowBlur!==t&&(this.textStyle.shadowBlur=t,this.isDirty=!0)},e.prototype.setShadowColor=function(t){this.textStyle.shadowColor!==t&&(this.textStyle.shadowColor=t,this.isDirty=!0)},e.prototype.setShadowOffsetX=function(t){this.textStyle.shadowOffsetX!==t&&(this.textStyle.shadowOffsetX=t,this.isDirty=!0)},e.prototype.setShadowOffsetY=function(t){this.textStyle.shadowOffsetY!==t&&(this.textStyle.shadowOffsetY=t,this.isDirty=!0)},e.prototype.setFontScale=function(t){this.textStyle.fontScale!==t&&(this.textStyle.fontScale=t,this.isDirty=!0)},e.prototype.updateTexture=function(){var t;if(this.isDirty&&this.context&&this.canvas){var e=this.context,r=this.textStyle,i=this.textLayout,n=r.fontScale,o=(i.width+r.fontOffset)*n,a=i.height*n,s=r.fontSize*n,u=i.lineHeight*n;this.char=this.text.split(""),this.canvas.width=o,this.canvas.height=a,e.clearRect(0,0,o,this.canvas.height),e.fillStyle="rgba(255, 255, 255, 0.0039)",e.fillRect(0,0,o,this.canvas.height),r.fontDesc=this.getFontDesc(),e.font=r.fontDesc,r.hasShadow&&this.setupShadow(),r.isOutlined&&this.setupOutline(),e.fillStyle="rgba(".concat(r.textColor[0],", ").concat(r.textColor[1],", ").concat(r.textColor[2],", ").concat(r.textColor[3],")");for(var c=[],l=(u-s)/3,h=0,f=i.getOffsetY(r)+l,p=[],d=[],m=0;m<this.char.length;m++){var v=this.char[m],y=e.measureText(v);((h+=i.letterSpace*n)+y.width>o&&m>0||"\n"===v)&&(c.push({y:f,width:h,chars:p,charOffsetX:d}),h=0,f+=u,p=[],d=[]),"\n"!==v&&(p.push(v),d.push(h),h+=y.width)}c.push({y:f,width:h,chars:p,charOffsetX:d}),c.forEach((function(t){var n=i.getOffsetX(r,t.width);t.chars.forEach((function(i,o){r.isOutlined&&e.strokeText(i,n+t.charOffsetX[o],t.y),e.fillText(i,n+t.charOffsetX[o],t.y)}))})),r.hasShadow&&(e.shadowColor="transparent");var g=e.getImageData(0,0,this.canvas.width,this.canvas.height);null===(t=this.mesh)||void 0===t||t.mesh.material.setTexture("uSampler0",wR.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:!0,magFilter:yb.LINEAR,minFilter:yb.LINEAR,wrapS:yb.CLAMP_TO_EDGE,wrapT:yb.CLAMP_TO_EDGE})),this.isDirty=!1}},e.prototype.getFontDesc=function(){var t=this.textStyle,e="".concat((t.fontSize*t.fontScale).toString(),"px ");return fM.includes(t.fontFamily)?e+=t.fontFamily:e+='"'.concat(t.fontFamily,'"'),t.textWeight!==vS.normal&&(e="".concat(t.textWeight," ").concat(e)),t.fontStyle!==yS.normal&&(e="".concat(t.fontStyle," ").concat(e)),e},e.prototype.setupOutline=function(){var t=this.context,e=this.textStyle;t.strokeStyle="rgba(".concat(255*e.outlineColor[0],", ").concat(255*e.outlineColor[1],", ").concat(255*e.outlineColor[2],", ").concat(e.outlineColor[3],")"),t.lineWidth=2*e.outlineWidth},e.prototype.setupShadow=function(){var t=this.context,e=this.textStyle;t.shadowColor="rgba(".concat(255*e.shadowColor[0],", ").concat(255*e.shadowColor[1],", ").concat(255*e.shadowColor[2],", ").concat(e.shadowColor[3],")"),t.shadowBlur=e.shadowBlur,t.shadowOffsetX=e.shadowOffsetX,t.shadowOffsetY=-e.shadowOffsetY},e}(CO),SM=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return eb(r,e),Object.defineProperty(r.prototype,"type",{get:function(){return wb.text},enumerable:!1,configurable:!0}),r.prototype.onConstructed=function(t){this.textContext=t.content},r.prototype.onLifetimeBegin=function(t,e){this._contentVisible=!0,e.active=!0},r.prototype.onItemRemoved=function(t,e){this._contentVisible=!1,e&&(delete e.mesh,t.destroyTextures(e.getTextures()))},r.prototype.handleVisibleChanged=function(t){this.content&&(this.content.visible=t)},r.prototype.onItemUpdate=function(t,e){var r;null===(r=this.content)||void 0===r||r.updateTime(this.time)},r.prototype.getCurrentPosition=function(){var t=new OS;return this.transform.assignWorldTRS(t),t},r.prototype.getBoundingBox=function(){var e=this.content;if(e&&this.transform){var r=this.transform.getWorldMatrix(),i=e.startSize,n=s_(OS.ZERO,i.x/2,i.y/2);return n.forEach((function(t){r.transformPoint(t.p0),r.transformPoint(t.p1),r.transformPoint(t.p2)})),{type:t.HitTestType.triangle,area:n}}},r.prototype.getHitTestParams=function(t){var e,r,i=this.content,n=i&&i.interaction;if((t||n)&&(null===(e=i.mesh)||void 0===e?void 0:e.mesh)&&i){var o=this.getBoundingBox();if(o)return{behavior:(null===(r=i.interaction)||void 0===r?void 0:r.behavior)||0,type:o.type,triangles:o.area,backfaceCulling:i.renderer.side===bb.FRONT}}},r.prototype.getRenderData=function(){return this.content.getRenderData(this.content.time)},r.prototype.doCreateContent=function(t){var e=t.getRendererOptions().emptyTexture;return new bM(this.textContext,{emptyTexture:e},this)},r.prototype.createWireframeMesh=function(t,e){var r=new rM(this.composition.getEngine(),rb({wireframe:!0},t.renderInfo),this.composition);return r.setItems([t]),r.mesh.material.setVector3("uFrameColor",OS.fromArray(e)),r.mesh.priority=999,r},r}(Y_),_M=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="text",t.addItems=[],t.removeItems=[],t.meshes=[],t}return eb(r,e),r.prototype.onCompositionDestroyed=function(e){e.reusable?this.addItems.forEach((function(e){var r;null===(r=e.content.mesh)||void 0===r||r.mesh.dispose({material:{textures:t.DestroyOptions.keep}})})):this.addItems.forEach((function(t){var e;null===(e=t.content.mesh)||void 0===e||e.mesh.dispose()}))},r.prototype.onCompositionUpdate=function(t,e){this.addItems.forEach((function(t){var e;t.content.updateTexture(),!t.content.ended&&t.content.mesh&&t.content.mesh.updateItem(t.content),null===(e=t.content.mesh)||void 0===e||e.applyChange()}))},r.prototype.onCompositionItemLifeBegin=function(t,e){var r;e instanceof SM&&e.content&&(this.addItems.includes(e)||(zb(this.addItems,e),!e.content.ended&&e.content.mesh&&e.content.mesh.updateItem(e.content),null===(r=e.content.mesh)||void 0===r||r.applyChange()))},r.prototype.onCompositionReset=function(t,e){},r.prototype.onCompositionItemRemoved=function(e,r){var i;r instanceof SM&&r&&(zb(this.removeItems,r),this.addItems.includes(r)&&(null===(i=r.content)||void 0===i?void 0:i.mesh)&&(Ub(this.addItems,r),r.content.mesh.mesh.dispose({material:{textures:t.DestroyOptions.keep}}),r.dispose()))},r.prototype.prepareRenderFrame=function(e,r){var i=this;return this.removeItems.map((function(e){var n,o;(null===(n=e.content)||void 0===n?void 0:n.mesh)&&(r.removeMeshFromDefaultRenderPass(null===(o=e.content.mesh)||void 0===o?void 0:o.mesh),Ub(i.addItems,e),e.content.mesh.mesh.dispose({material:{textures:t.DestroyOptions.keep}}),e.dispose())})),this.addItems.forEach((function(t){var e;t.content.mesh&&r.addMeshToDefaultRenderPass(null===(e=t.content.mesh)||void 0===e?void 0:e.mesh)})),this.removeItems.length=0,!1},r}($_);function RM(t,e,r){return function(t,e,r){var i=rb(rb({},e.material.props),{shader:r}),n=e.material.clone(i);return n.blending=!1,n.depthTest=!1,n.culling=!1,hC.create(t,{geometry:e.geometry,material:n})}(t,e,pO(t.gpuCapability.level,{fragment:r.fragment},{ignoreBlend:!0}))}var CM=function(e){function r(t,r,i,n,o,a){var s=e.call(this,t,a)||this;return s.uTexStep=i,s.pluginSystem=n,s.fragShader=o,s.type=r,s}return eb(r,e),r.prototype.configure=function(e){if(this.prePassTexture=e.getFrameBuffer().getColorTextures()[0]?e.getFrameBuffer().getColorTextures()[0]:e.renderingData.currentFrame.transparentTexture,"H"===this.type&&(this.preDefaultPassAttachment.texture=this.prePassTexture),this.preDefaultPassTexture=this.preDefaultPassAttachment.texture,!this.mframeBuffer){var r=wR.create(e.engine,{sourceType:t.TextureSourceType.framebuffer,minFilter:yb.LINEAR,magFilter:yb.LINEAR,name:this.type,internalFormat:yb.RGBA,format:yb.RGBA,type:yb.UNSIGNED_BYTE});this.mframeBuffer=rO.create({name:this.type,storeAction:{},viewport:this.viewport,viewportScale:1,isCustomViewport:!0,attachments:[r],depthStencilAttachment:{storageType:t.RenderPassAttachmentStorageType.none}},e)}e.setFrameBuffer(this.mframeBuffer)},r.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",YC(this.preDefaultPassTexture)),this.meshes[1].material.setVector2("uTexStep",this.uTexStep),this.meshes[1].material.setTexture("uBlurSource",this.uBlurSource?this.uBlurSource:this.prePassTexture),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",YC(this.prePassTexture));var e=[this.meshes[0],RM(t.engine,this.meshes[1],{fragment:this.fragShader})];t.renderMeshes(e)},r.prototype.dispose=function(t){e.prototype.dispose.call(this,t);var r=this.mframeBuffer;r&&r.dispose(t)},r}(vC),OM=function(t){function e(e,r,i){var n=t.call(this,e,r)||this;return i&&(n.preDefaultPassAttachment=i),n}return eb(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],this.preDefaultPassAttachment||(this.preDefaultPassAttachment=new dC(t.engine,{}),this.preDefaultPassAttachment.texture=this.prePassTexture),t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassAttachment.texture),this.meshes[0].material.setVector2("uFilterSourceSize",YC(this.preDefaultPassAttachment.texture)),this.meshes[1].material.setTexture("uFrameSource",this.prePassTexture),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uFilterSourceSize",YC(this.prePassTexture));var e=[this.meshes[0],this.meshes[1]];t.renderMeshes(e)},e}(vC);function wM(t){for(var e=t.radius<=3?1:2,r=t.radius/e,i=t.maxStep||4;r>10&&e<i;)e*=2,r=t.radius/e;for(var n=1+t.radius%e/e/e,o=function(t){for(var e=(t+1)/3.329,r=[],i=-t;i<=t;i++)r.push(MM(i,e));return r}(r=Math.floor(r)),a=[],s=-r;s<=r;s++){var u=o[s+r];a.push("color += texture2D(uBlurSource,getTexCoord(".concat(s.toFixed(1),")) * ").concat(u,";"))}return{shader:"\n uniform sampler2D uBlurSource;\n uniform vec2 uTexSize;\n uniform vec2 uTexStep;\n #define getTexCoord(i) coord + uTexStep/uTexSize * i\n vec4 filterMain(vec2 coord,sampler2D tex){\n vec4 color = vec4(0.);\n vec2 texCoord;\n ".concat(a.join("\n"),"\n\n return color;\n }\n "),step:n,downSample:e,radius:r}}function MM(t,e){return Math.exp(-t*t/(2*e*e))/Math.sqrt(2*Math.PI)/e}var IM=function(t){function e(e,r){return t.call(this,e,r)||this}return eb(e,t),e.prototype.configure=function(t){var e=t.getFrameBuffer();this.preDefaultPassAttachment.texture=e?e.getColorTextures()[0]:t.renderingData.currentFrame.transparentTexture,t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uTexSize",YC(this.preDefaultPassAttachment.texture));var e=[RM(t.engine,this.meshes[1],{fragment:this.fragShader})];t.renderMeshes(e)},e}(vC),LM=function(t){function e(e,r,i,n,o,a,s){var u=t.call(this,e,a)||this;return u.uTexStep=i,u.pluginSystem=n,u.fragShader=o,u.type=r,s&&(u.uBlurSource=s),u}return eb(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],this.preDefaultPassTexture=this.preDefaultPassAttachment.texture,t.setFrameBuffer(this.frameBuffer),this.uBlurSource||(this.uBlurSource=this.prePassTexture)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[1].material.setVector2("uTexStep",this.uTexStep),this.meshes[1].material.setTexture("uBlurSource",this.uBlurSource),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",YC(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",YC(this.uBlurSource));var e=[RM(t.engine,this.meshes[1],{fragment:this.fragShader})];t.renderMeshes(e)},e}(vC),PM=function(t){function e(e,r,i){var n=t.call(this,e,r)||this;return n.preDefaultPassAttachment=i,n}return eb(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.preDefaultPassAttachment.texture),this.meshes[0].material.setVector2("uFilterSourceSize",YC(this.preDefaultPassAttachment.texture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.preDefaultPassAttachment.texture),this.meshes[1].material.setVector2("uFilterSourceSize",YC(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",YC(this.preDefaultPassAttachment.texture));var e=[this.meshes[0],this.meshes[1]];t.renderMeshes(e)},e}(vC),FM=function(t){function e(e,r){return t.call(this,e,r)||this}return eb(e,t),e.prototype.configure=function(t){this.prePassTexture=t.getFrameBuffer().getColorTextures()[0],t.setFrameBuffer(this.frameBuffer)},e.prototype.execute=function(t){t.clear(this.clearAction),this.meshes[0].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[0].material.setVector2("uFilterSourceSize",YC(this.prePassTexture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.prePassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",YC(this.prePassTexture));var e=[this.meshes[0],this.meshes[1]];t.renderMeshes(e)},e}(vC);function VM(t,e,r){for(var i=E_(e||1),n=e?256:1,o=new Uint8Array(n),a=0;a<n;a++){var s=a/(n-1);o[a]=Math.round(255*i.getValue(r?1-s:s))}return wR.createWithData(t,{width:n,height:1,data:o},{format:yb.LUMINANCE})}var NM=new OS(1,1,1),DM=function(){function t(t,e){void 0===e&&(e={}),this.name=t,this.viewMatrix=LS.fromIdentity(),this.projectionMatrix=LS.fromIdentity(),this.viewProjectionMatrix=LS.fromIdentity(),this.inverseViewMatrix=LS.fromIdentity(),this.dirty=!0;var r=e.near,i=void 0===r?.1:r,n=e.far,o=void 0===n?20:n,a=e.fov,s=void 0===a?60:a,u=e.aspect,c=void 0===u?1:u,l=e.clipMode,h=void 0===l?eS.portrait:l,f=e.position,p=void 0===f?[0,0,8]:f,d=e.rotation,m=void 0===d?[0,0,0]:d;this.options={near:i,far:o,fov:s,aspect:c,clipMode:h,position:OS.fromArray(p),rotation:VS.fromArray(m)},this.dirty=!0,this.updateMatrix()}return Object.defineProperty(t.prototype,"near",{get:function(){return this.options.near},set:function(t){this.options.near!==t&&(this.options.near=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"far",{get:function(){return this.options.far},set:function(t){this.options.far!==t&&(this.options.far=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fov",{get:function(){return this.options.fov},set:function(t){this.options.fov!==t&&(this.options.fov=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aspect",{get:function(){return this.options.aspect},set:function(t){this.options.aspect!==t&&(this.options.aspect=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"clipMode",{get:function(){return this.options.clipMode},set:function(t){void 0!==t&&this.options.clipMode!==t&&(this.options.clipMode=t,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"position",{get:function(){return this.options.position.clone()},set:function(t){this.options.position.equals(t)||(this.options.position.copyFrom(t),this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this.options.rotation.clone()},set:function(t){this.options.rotation.equals(t)||(this.options.rotation.copyFrom(t),this.dirty=!0,this.options.quat=void 0)},enumerable:!1,configurable:!0}),t.prototype.getViewMatrix=function(){return this.updateMatrix(),this.viewMatrix.clone()},t.prototype.getInverseViewMatrix=function(){return this.updateMatrix(),this.inverseViewMatrix.clone()},t.prototype.getProjectionMatrix=function(){return this.updateMatrix(),this.projectionMatrix.clone()},t.prototype.getInverseProjectionMatrix=function(){var t;return this.updateMatrix(),null===(t=this.inverseProjectionMatrix)||void 0===t?void 0:t.clone()},t.prototype.getViewProjectionMatrix=function(){return this.updateMatrix(),this.viewProjectionMatrix.clone()},t.prototype.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=this.viewProjectionMatrix.clone(),this.inverseViewProjectionMatrix.invert()),this.inverseViewProjectionMatrix.clone()},t.prototype.getModelViewProjection=function(t,e){return t.multiplyMatrices(this.viewProjectionMatrix,e)},t.prototype.getInverseVPRatio=function(t){var e=new OS(0,0,t),r=this.getViewProjectionMatrix(),i=e.applyMatrix(r).z;return new OS(1,1,i).applyMatrix(r)},t.prototype.setQuat=function(t){void 0===this.options.quat?(this.options.quat=t.clone(),this.dirty=!0):(this.options.quat,this.options.quat.equals(t)||(this.options.quat.copyFrom(t),this.dirty=!0)),this.dirty&&this.setRotationByQuat(t)},t.prototype.getQuat=function(){var t=this.options.quat;if(void 0===t){t=new wS;var e=this.options.rotation;e&&t.setFromEuler(e),this.options.quat=t}return t},t.prototype.getOptions=function(){return this.options},t.prototype.copy=function(t){var e=t.near,r=t.far,i=t.fov,n=t.clipMode,o=t.aspect,a=t.position,s=t.rotation;this.near=e,this.far=r,this.fov=i,this.clipMode=n,this.aspect=o,this.position=a,this.rotation=s,this.updateMatrix()},t.prototype.updateMatrix=function(){if(this.dirty){var t=this.options,e=t.fov,r=t.aspect,i=t.near,n=t.far,o=t.clipMode,a=t.position;this.projectionMatrix.perspective(e*TS,r,i,n,o===eS.portrait),this.inverseViewMatrix.compose(a,this.getQuat(),NM),this.viewMatrix.copyFrom(this.inverseViewMatrix).invert(),this.viewProjectionMatrix.multiplyMatrices(this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},t.prototype.setRotationByQuat=function(t){X_.getRotation(t,this.options.rotation)},t}();var zM,UM,BM,kM,GM,jM,XM,YM,WM,HM,ZM,qM={lum:[function(e,r){var i=r.renderer,n=2===i.engine.gpuCapability.level?yb.LINEAR:yb.NEAREST,o=new OM(i,{name:"lumCopyPass",attachments:[{texture:{format:yb.RGBA,minFilter:n,magFilter:n}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{mesh:{fragment:HR,uniformValues:{uFilterParams:[1,0,0,0]},materialStates:{blending:!1,depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:yb.RGBA}}]},prePasses:[o],renderPassDelegate:{}}},function(){return[{fragment:HR}]}],alphaFrame:[function(e,r){var i=e,n=i.colorRange,o=void 0===n?[.5,1]:n,a=i.alphaRange,s=void 0===a?[0,.5]:a,u=[s[0],s[1]-s[0],o[0],o[1]-o[0]],c=r.renderer,l=2===c.engine.gpuCapability.level?yb.LINEAR:yb.NEAREST,h=new OM(c,{name:"alphaFrameCopyPass",attachments:[{texture:{format:yb.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{particle:{fragment:bC,uniformValues:{uTexRange:u}},mesh:{fragment:bC,shaderCacheId:"alpha-frame",materialStates:{blending:!1},uniformValues:{uTexRange:u}},passSplitOptions:{attachments:[{texture:{format:yb.RGBA}}],prePasses:[h]}}},function(){return[{fragment:bC,shaderCacheId:"alpha-frame"},{fragment:bC,isParticle:!0}]}],cameraMove:[function(e,r){var i=e.position,n=void 0===i?[0,0,0]:i,o=n;Number.isFinite(n[0])&&Number.isFinite(n[1])&&(o=[iS.CONSTANT_VEC3,n]);var a=E_(o),s=new DM("camera_move"),u=new OS,c=r.renderer,l=2===c.engine.gpuCapability.level?yb.LINEAR:yb.NEAREST,h=new OM(c,{name:"cameraCopyPass",attachments:[{texture:{format:yb.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{mesh:{vertex:_C,fragment:HR,shaderCacheId:"camera-move",materialStates:{blending:!1,depthTest:!1,culling:!1},variables:{uMoveCameraViewPro:function(t){s.copy(r.camera);var e=a.getValue(t);return u.addVectors(r.camera.position,new OS(-e[0],-e[1],-e[2])),s.position=u,s.getViewProjectionMatrix().toArray()}}},passSplitOptions:{attachments:[{texture:{format:yb.RGBA}}],prePasses:[h]}}},function(){return[{vertex:_C,fragment:HR,shaderCacheId:"camera-move"}]}],alphaMask:[function(e,r){var i=e,n=i.xOpacity,o=i.yOpacity,a=r.renderer.engine,s=r.renderer,u=VM(a,n),c=VM(a,o,!0),l=2===a.gpuCapability.level?yb.LINEAR:yb.NEAREST,h=new OM(s,{name:"alphaMaskCopyPass",attachments:[{texture:{format:yb.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{mesh:{fragment:SC,shaderCacheId:"alpha-mask",materialStates:{blending:!1,depthTest:!1,culling:!1},uniformValues:{uAlphaXSample:u,uAlphaYSample:c}},passSplitOptions:{attachments:[{texture:{format:yb.RGBA}}],prePasses:[h]}}},function(){return[{fragment:SC,shaderCacheId:"alpha-mask"}]}],distortion:[function(e,r){var i=e,n=i.center,o=void 0===n?[.5,.5]:n,a=i.direction,s=void 0===a?[1,0]:a,u=i.period,c=i.waveMovement,l=i.strength,h=t_(s),f=[o[0],o[1],h[0],h[1]],p=E_(u),d=E_(c),m=E_(l),v=2*Math.PI,y=r.renderer,g=2===y.engine.gpuCapability.level?yb.LINEAR:yb.NEAREST,x=new OM(y,{name:"distortionCopyPass",attachments:[{texture:{format:yb.RGBA,minFilter:g,magFilter:g}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{particle:{fragment:CC,vertex:OC,uniforms:{uPeriodValue:p,uMovementValue:d,uStrengthValue:m},uniformValues:{uWaveParams:f}},mesh:{shaderCacheId:"distortion",fragment:CC,materialStates:{blending:!1,culling:!1},variables:{vWaveParams:function(t){return[p.getValue(t)*v,d.getValue(t)*v,m.getValue(t),0]}},uniformValues:{uWaveParams:f}},passSplitOptions:{attachments:[{texture:{format:yb.RGBA}}],prePasses:[x]}}},function(t){var e=t,r=e.period,i=e.waveMovement,n=e.strength;return[{fragment:CC,shaderCacheId:"distortion"},{fragment:CC,vertex:OC,isParticle:!0,uniforms:[r,i,n]}]}],bloom:[function(e,r){var i=e,n=i.radius,o=void 0===n?30:n,a=i.bloomAddon,s=void 0===a?.4:a,u=i.colorAddon,c=void 0===u?1:u,l=i.colorThreshold,h=void 0===l?[255,255,255]:l,f=r.getEngine().gpuCapability.level,p=wM({radius:o}),d=r.renderer.engine,m=r.renderer,v=Math.round(r.width/p.downSample),y=Math.round(r.width/p.downSample);1===f&&(v=o_(v),y=o_(y));var g=[0,0,v,y],x=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:yb.RGBA,magFilter:yb.LINEAR,minFilter:yb.LINEAR,name:"gaussianV",width:v,height:y}),T=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:yb.RGBA,magFilter:yb.LINEAR,minFilter:yb.LINEAR,name:"gaussianH",width:v,height:y}),E=E_(s),A=E_(c),b=new dC(d),S=new IM(m,{name:"threshold",attachments:[{texture:x}],viewport:g,clearAction:{colorAction:t.TextureLoadAction.clear}});S.pluginSystem=r.pluginSystem,S.fragShader=MC,S.preDefaultPassAttachment=b;var _=new LM(m,"H",new CS(p.step,0),r.pluginSystem,p.shader,{name:"gaussianH",viewport:g,attachments:[{texture:T}],clearAction:{colorAction:t.TextureLoadAction.clear}},x);_.preDefaultPassAttachment=b;var R=new LM(m,"V",new CS(0,p.step),r.pluginSystem,p.shader,{name:"gaussianV",viewport:g,attachments:[{texture:x}]},T);R.preDefaultPassAttachment=b;var C=2===f?yb.LINEAR:yb.NEAREST,O=new PM(m,{name:"bloomCopyPass",attachments:[{texture:{format:yb.RGBA,minFilter:C,magFilter:C}}],clearAction:{colorAction:t.TextureLoadAction.clear}},b);return{mesh:{name:"bloom-".concat(p.step),fragment:wC,shaderCacheId:"bloom-".concat(p.step),variables:{uBloomParams:function(t){return[E.getValue(t),A.getValue(t),0,1]}},uniformValues:{uColorThreshold:[h[0]/255||1.1,h[1]/255||1.1,h[2]/255||1.1,0],uBloomBlur:x},materialStates:{blending:!1,culling:!1}},onItemRemoved:function(){x.dispose(),T.dispose()},passSplitOptions:{attachments:[{texture:{format:yb.RGBA}}],prePasses:[S,_,R,O]}}},function(t){var e=t.radius,r=wM({radius:void 0===e?30:e});return[{fragment:wC,shaderCacheId:"bloom-".concat(r.step)},{fragment:MC,ignoreBlend:!0},{fragment:r.shader,ignoreBlend:!0}]}],gaussian:[function(e,r){var i=e.radius,n=r.getEngine().gpuCapability.level,o=r.renderer.engine,a=r.renderer,s=wM({radius:i}),u=s.downSample,c=s.step,l=s.shader,h=Math.round(r.width/u),f=Math.round(r.height/u);1===n&&(f=o_(f),h=o_(h));var p=[0,0,h,f],d=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:yb.LINEAR,magFilter:yb.LINEAR,name:"gaussianV",width:h,height:f}),m=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:yb.LINEAR,magFilter:yb.LINEAR,name:"gaussianH",width:h,height:f}),v=new dC(o,{}),y=new CM(a,"H",new CS(0,c),r.pluginSystem,l,{name:"gaussianH",viewport:p,attachments:[{texture:m}],clearAction:{colorAction:t.TextureLoadAction.clear}});y.preDefaultPassAttachment=v;var g=new CM(a,"V",new CS(c,0),r.pluginSystem,l,{name:"gaussianV",viewport:p,attachments:[{texture:d}],clearAction:{colorAction:t.TextureLoadAction.clear}});g.preDefaultPassAttachment=v;var x=2===n?yb.LINEAR:yb.NEAREST,T=new OM(a,{name:"gaussianCopyPass",attachments:[{texture:{format:yb.RGBA,minFilter:x,magFilter:x}}],clearAction:{colorAction:t.TextureLoadAction.clear}},v);return T.preDefaultPassAttachment=v,{mesh:{fragment:HR,shaderCacheId:"gaussian-".concat(c),uniformValues:{uTexSize:[h,f]},materialStates:{blending:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:yb.RGBA}}],prePasses:[y,g,T]}}},function(t){var e=wM({radius:t.radius});return[{fragment:HR,shaderCacheId:"gaussian-".concat(e.step)},{fragment:e.shader,ignoreBlend:!0}]}],delay:[function(e,r){var i=r.renderer,n=wR.create(i.engine,{sourceType:t.TextureSourceType.framebuffer}),o=[0,.96,0,0],a=2===i.engine.gpuCapability.level?yb.LINEAR:yb.NEAREST,s=new FM(i,{name:"delayCopyPass",attachments:[{texture:{format:yb.RGBA,minFilter:a,magFilter:a}}],clearAction:{colorAction:t.TextureLoadAction.clear}});return{mesh:{fragment:RC,shaderCacheId:"delay",uniformValues:{uLastSource:n},variables:{uParams:function(){return o}},materialStates:{blending:!0,blendFunction:[yb.SRC_ALPHA,yb.ONE_MINUS_SRC_ALPHA,yb.SRC_ALPHA,yb.ONE_MINUS_SRC_ALPHA],depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:yb.RGBA}}],prePasses:[s]},onItemRemoved:function(){n.dispose()},renderPassDelegate:{didEndRenderPass:function(t){i.extension.copyTexture(t.attachments[0].texture,n),o[0]=2}}}},function(){return[{fragment:RC,shaderCacheId:"delay"}]}]};
|
|
9
9
|
/*!
|
|
10
10
|
* Name: @galacean/effects-specification
|
|
11
11
|
* Description: Galacean Effects JSON Specification
|
|
12
12
|
* Author: Ant Group CO., Ltd.
|
|
13
13
|
* Version: v1.0.0
|
|
14
|
-
*/!function(e){e.S="S",e.APlus="A+",e.A="A",e.BPlus="B+",e.B="B"}(dw||(dw={})),function(e){e[e.ALPHA=0]="ALPHA",e[e.ADD=1]="ADD",e[e.MULTIPLY=2]="MULTIPLY",e[e.BRIGHTNESS=3]="BRIGHTNESS",e[e.SUBTRACTION=4]="SUBTRACTION",e[e.STRONG_LIGHT=5]="STRONG_LIGHT",e[e.WEAK_LIGHT=6]="WEAK_LIGHT",e[e.SUPERPOSITION=7]="SUPERPOSITION"}(mw||(mw={})),function(e){e[e.DOUBLE=1032]="DOUBLE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK"}(vw||(vw={})),function(e){e[e.NONE=0]="NONE",e[e.MASK=1]="MASK",e[e.OBSCURED=2]="OBSCURED",e[e.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(yw||(yw={})),function(e){e[e.NONE=0]="NONE",e[e.SPHERE=1]="SPHERE",e[e.CONE=2]="CONE",e[e.HEMISPHERE=3]="HEMISPHERE",e[e.CIRCLE=4]="CIRCLE",e[e.DONUT=5]="DONUT",e[e.RECTANGLE=6]="RECTANGLE",e[e.RECTANGLE_EDGE=7]="RECTANGLE_EDGE",e[e.EDGE=8]="EDGE",e[e.TEXTURE=9]="TEXTURE"}(gw||(gw={})),function(e){e[e.GYROSCOPE=0]="GYROSCOPE",e[e.SPINE=1]="SPINE"}(xw||(xw={})),function(e){e[e.CLICK=0]="CLICK",e[e.MESSAGE=1]="MESSAGE",e[e.DRAG=2]="DRAG"}(Tw||(Tw={})),function(e){e[e.NONE=0]="NONE",e[e.NOTIFY=1]="NOTIFY",e[e.RESUME_PLAYER=2]="RESUME_PLAYER",e[e.REMOVE=3]="REMOVE",e[e.PAUSE=4]="PAUSE"}(Ew||(Ew={})),function(e){e.base="0",e.sprite="1",e.particle="2",e.null="3",e.interact="4",e.plugin="5",e.camera="6",e.composition="7",e.filter="8",e.spine="spine",e.mesh="mesh",e.tree="tree",e.text="text",e.light="light",e.skybox="skybox"}(_w||(_w={})),function(e){e[e.BILLBOARD=0]="BILLBOARD",e[e.MESH=1]="MESH",e[e.VERTICAL_BILLBOARD=2]="VERTICAL_BILLBOARD",e[e.HORIZONTAL_BILLBOARD=3]="HORIZONTAL_BILLBOARD"}(Sw||(Sw={})),function(e){e[e.PARTICLE_ORIGIN_CENTER=0]="PARTICLE_ORIGIN_CENTER",e[e.PARTICLE_ORIGIN_LEFT_TOP=1]="PARTICLE_ORIGIN_LEFT_TOP",e[e.PARTICLE_ORIGIN_LEFT_CENTER=2]="PARTICLE_ORIGIN_LEFT_CENTER",e[e.PARTICLE_ORIGIN_LEFT_BOTTOM=3]="PARTICLE_ORIGIN_LEFT_BOTTOM",e[e.PARTICLE_ORIGIN_CENTER_TOP=4]="PARTICLE_ORIGIN_CENTER_TOP",e[e.PARTICLE_ORIGIN_CENTER_BOTTOM=5]="PARTICLE_ORIGIN_CENTER_BOTTOM",e[e.PARTICLE_ORIGIN_RIGHT_TOP=6]="PARTICLE_ORIGIN_RIGHT_TOP",e[e.PARTICLE_ORIGIN_RIGHT_CENTER=7]="PARTICLE_ORIGIN_RIGHT_CENTER",e[e.PARTICLE_ORIGIN_RIGHT_BOTTOM=8]="PARTICLE_ORIGIN_RIGHT_BOTTOM"}(Aw||(Aw={}));var Cw,Ow,bw,Lw,Iw,ww,Pw,Mw,Vw,Nw,Fw,Dw,Uw,Bw,kw,zw,Gw,jw=0;!function(e){e[e.portrait=1]="portrait",e[e.landscape=jw]="landscape"}(Cw||(Cw={})),function(e){e[e.destroy=0]="destroy",e[e.pause=1]="pause",e[e.restart=5]="restart",e[e.forward=2]="forward",e[e.pause_destroy=3]="pause_destroy"}(Ow||(Ow={})),function(e){e[e.CONSTANT=0]="CONSTANT",e[e.CONSTANT_VEC2=1]="CONSTANT_VEC2",e[e.CONSTANT_VEC3=2]="CONSTANT_VEC3",e[e.CONSTANT_VEC4=3]="CONSTANT_VEC4",e[e.RANDOM=4]="RANDOM",e[e.LINE=5]="LINE",e[e.CURVE=6]="CURVE",e[e.BEZIER_PATH=7]="BEZIER_PATH",e[e.RGBA_COLOR=8]="RGBA_COLOR",e[e.GRADIENT_COLOR=9]="GRADIENT_COLOR",e[e.SHAPE_POINTS=10]="SHAPE_POINTS",e[e.SHAPE_SPLITS=11]="SHAPE_SPLITS",e[e.LINEAR_PATH=12]="LINEAR_PATH",e[e.COLORS=13]="COLORS",e[e.BINARY=20]="BINARY",e[e.BEZIER_CURVE=21]="BEZIER_CURVE",e[e.BEZIER_CURVE_PATH=22]="BEZIER_CURVE_PATH"}(bw||(bw={})),function(e){e[e.AUTO=0]="AUTO",e[e.EASE=1]="EASE",e[e.EASE_IN=2]="EASE_IN",e[e.EASE_OUT=3]="EASE_OUT",e[e.LINE=4]="LINE",e[e.HOLD=5]="HOLD",e[e.LINE_OUT=6]="LINE_OUT"}(Lw||(Lw={})),function(e){e[e.destroy=0]="destroy",e[e.loop=5]="loop",e[e.freeze=4]="freeze"}(Iw||(Iw={})),function(e){e[e.destroyChildren=6]="destroyChildren"}(ww||(ww={})),function(e){e[e.none=0]="none",e[e.removeParticle=1]="removeParticle"}(Pw||(Pw={})),function(e){e[e.RANDOM=0]="RANDOM",e[e.UNIDIRECTIONAL_CYCLE=1]="UNIDIRECTIONAL_CYCLE",e[e.BIDIRECTIONAL_CYCLE=2]="BIDIRECTIONAL_CYCLE",e[e.UNIFORM_BURST=3]="UNIFORM_BURST"}(Mw||(Mw={})),function(e){e[e.box=2]="box",e[e.sphere=3]="sphere"}(Vw||(Vw={})),function(e){e.unlit="unlit",e.pbr="pbr",e.hair="hair"}(Nw||(Nw={})),function(e){e[e.opaque=100]="opaque",e[e.masked=101]="masked",e[e.translucent=102]="translucent",e[e.additive=103]="additive"}(Fw||(Fw={})),function(e){e.none="none",e.uv="uv",e.normal="normal",e.basecolor="basecolor",e.alpha="alpha",e.metallic="metallic",e.roughness="roughness",e.ao="ao",e.emissive="emissive"}(Dw||(Dw={})),function(e){e[e.display=0]="display",e[e.clip=1]="clip",e[e.ellipsis=2]="ellipsis"}(Uw||(Uw={})),function(e){e[e.top=0]="top",e[e.middle=1]="middle",e[e.bottom=2]="bottom"}(Bw||(Bw={})),function(e){e[e.left=0]="left",e[e.middle=1]="middle",e[e.right=2]="right"}(kw||(kw={})),function(e){e.normal="normal",e.bold="bold",e.lighter="lighter"}(zw||(zw={})),function(e){e.normal="normal",e.italic="italic",e.oblique="oblique"}(Gw||(Gw={}));var Xw=function(){return Xw=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Xw.apply(this,arguments)};function Ww(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Hw(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function Yw(e,t){if(!e.includes(t))return e.push(t),!0}function Zw(e,t,r){if(e)for(var i in e)Object.hasOwnProperty.call(e,i)&&t.call(r,e[i],i);return e}function qw(e){if(Number.isFinite(e))return[bw.CONSTANT,e];if(e){if("lines"===e[0])return[bw.LINE,e[1]];if("curve"===e[0])return[bw.CURVE,e[1]];if("static"===e[0])return[bw.CONSTANT,e[1]]}}function Kw(e,t){return Array.isArray(e)&&"random"===e[0]?[bw.CONSTANT,e[1][t]]:qw(e)}function Qw(e){return e&&"color"===e[0]?tP(e[1],!0):[1,1,1,1]}function Jw(e,t){if(e){if("colors"===e[0])return[bw.COLORS,e[1].map((function(e){return tP(e,t)}))];if("gradient"===e[0])return eP(e[1],t);if("color"===e[0])return[bw.RGBA_COLOR,tP(e[1],t)]}}function $w(e){return e&&"random"===e[0]?[bw.RANDOM,e[1]]:qw(e)}function eP(e,t){if(e){var r=[];return Object.getOwnPropertyNames(e).forEach((function(i){var n=function(e){var t=/^(-)?([\d+.]+)%$/.exec(e);if(t)return+t[2]/100*(t[1]?-1:1);return+e}(i),o=tP(e[i],t);r.push([n,o[0],o[1],o[2],o[3]])})),r=r.sort((function(e,t){return e[0]-t[0]})),[bw.GRADIENT_COLOR,r]}}function tP(e,t){var r;if("string"==typeof e){e=e.replace(/[\s\t\r\n]/g,"");var i=/rgba?\(([.\d]+),([.\d]+),([.\d]+),?([.\d]+)?\)/.exec(e);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(e)?r=[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16),255]:(i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e))&&(r=[parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),255]||[0,0,0,255])}else e instanceof Array&&(r=[e[0],e[1],e[2],isNaN(e[3])?255:Math.round(255*e[3])]);return t&&(r=function(e){if(Array.isArray(e))return e.map((function(e){return Number.isFinite(e/255)?Number((e/255).toFixed(6)):0}))}(r)),r}function rP(e,t){return Array.isArray(e)?("gradient"===e[0]||"color"===e[0])&&eP(e[1],t):eP(e,t)}function iP(e){if(e){if(3===e.length)return[bw.CONSTANT_VEC3,e];if("path"===e[0])return[bw.LINEAR_PATH,e[1]];if("bezier"===e[0])return[bw.BEZIER_PATH,e[1]]}}function nP(e){var t,r;try{for(var i=Ww(Object.entries(e)),n=i.next();!n.done;n=i.next()){var o=Hw(n.value,2),a=o[0],s=o[1];e[a]=Number(s)}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return e}function oP(e){var t,r;try{for(var i=Ww(Object.keys(e)),n=i.next();!n.done;n=i.next()){var o=n.value;void 0===e[o]&&delete e[o]}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return e}"function"==typeof SuppressedError&&SuppressedError;var aP=Math.cos,sP=Math.sin,uP=Math.PI/180,cP=180/Math.PI;function lP(e){var t,r=e.options,i=e.transform,n={type:gw.NONE};if(e.shape){var o=null===(t=e.shape.shape)||void 0===t?void 0:t.replace(/([A-Z])/g,"_$1").toUpperCase().replace(/^_/,"");if(n=Xw(Xw({},e.shape),{type:gw[o]}),e.shape.upDirection){var a=Hw(e.shape.upDirection,3),s=a[0],u=a[1],c=a[2];0===s&&0===u&&0===c&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=$w(r.turbulenceX),n.turbulenceY=$w(r.turbulenceY),n.turbulenceZ=$w(r.turbulenceZ));var l=e.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(e){return nP(e)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(e){return nP(e)}))),l.rateOverTime&&(l.rateOverTime=$w(l.rateOverTime));var f={renderer:e.renderer,shape:n,splits:e.splits,emission:l,options:{startLifetime:$w(r.startLifetime),start3DSize:!!r.start3DSize,startSize:$w(r.startSize),startSizeX:$w(r.startSizeX),startSizeY:$w(r.startSizeY),sizeAspect:$w(r.sizeAspect),maxCount:r.maxCount,startDelay:$w(r.startDelay),startColor:Jw(r.startColor,!0),startRotationZ:$w(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(f.options.startRotationX=$w(r.startRotationX),f.options.startRotationY=$w(r.startRotationY)),e.filter){var h={};Zw(e.filter,(function(e,t){var r;h[t]=(r=e,Array.isArray(r)&&"string"==typeof r[0]&&($w(r)||iP(r)||Jw(r))||r)})),f.filter=h}i&&i.path&&(f.emitterTransform={path:iP(i.path)});var p=e.sizeOverLifetime;p&&(p.separateAxes?f.sizeOverLifetime={separateAxes:!0,x:$w(p.x),y:$w(p.y)}:f.sizeOverLifetime={size:$w(p.size)});var d=e.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?qw(m):void 0,f.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:qw(r.gravityModifier),startSpeed:$w(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:$w(d.linearX),linearY:$w(d.linearY),linearZ:$w(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:$w(d.orbitalX),orbitalY:$w(d.orbitalY),orbitalZ:$w(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:qw(d.forceCurve)},oP(f.positionOverLifetime);var v=e.rotationOverLifetime;v&&(f.rotationOverLifetime={separateAxes:v.separateAxes,asRotation:v.asRotation,z:$w(v.separateAxes?v.z:v.angularVelocity)},v.separateAxes&&(f.rotationOverLifetime.y=qw(v.y),f.rotationOverLifetime.x=qw(v.x)));var y=e.colorOverLifetime;if(y){var g=f.colorOverLifetime={opacity:qw(y.opacity)};y.color&&(g.color=rP(y.color))}var x=e.textureSheetAnimation;x&&(f.textureSheetAnimation={row:x.row,col:x.col,total:x.total,animate:x.animate,cycles:qw(x.cycles),animationDelay:Kw(x.animationDelay,0),animationDuration:Kw(x.animationDuration,0)});var T=e.trails;T&&(f.trails={lifetime:$w(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:qw(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&rP(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&rP(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:$w(T.opacityOverLifetime)}),f.trails&&oP(f.trails);var E=e.interaction;return E&&(f.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),f}function fP(e,t){var r,i=e.options,n=e.velocityOverLifetime||{},o={path:iP(null===(r=e.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:qw(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:qw(n.linearX),linearY:qw(n.linearY),linearZ:qw(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:qw(n.orbitalX),orbitalY:qw(n.orbitalY),orbitalZ:qw(n.orbitalZ),speedOverLifetime:qw(n.speedOverLifetime)};oP(o);var a={options:{startColor:Qw(i.startColor)},positionOverLifetime:o};i.startSize&&(t.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(t.rotation?t.rotation[2]+=i.startRotation:t.rotation=[0,0,i.startRotation]);var s=e.rotationOverLifetime;if(s){var u=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=qw(s.x),u.y=qw(s.y),u.z=qw(s.z)):u.z=qw(s.angularVelocity)}var c=e.colorOverLifetime;if(c){var l=a.colorOverLifetime={opacity:qw(c.opacity)};c.color&&(l.color=rP(c.color))}var f=e.sizeOverLifetime;return f&&(a.sizeOverLifetime={separateAxes:f.separateAxes,size:qw(f.size),x:qw(f.x),y:qw(f.y),z:qw(f.z)}),a}function hP(e,t){var r=fP(e,t),i=e.textureSheetAnimation;return i&&(r.textureSheetAnimation={row:i.row,col:i.col,total:i.total||void 0,animate:i.animate}),r.renderer=e.renderer,e.splits&&(r.splits=e.splits),e.interaction&&(r.interaction=e.interaction),r}var pP=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],dP=["path","position"];function mP(e){return e.compositions.forEach((function(e){e.items.forEach((function(e){e.type===_w.null&&e.endBehavior===Iw.destroy&&(e.endBehavior=Iw.freeze)}))})),e.version="2.1",e}var vP=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,yP=/^(\d+)\.(\d+)$/,gP=!1;function xP(e){var t,r;if(!e||"object"!=typeof e)throw Error("expect a json object");if(function(e){var t,r=null===(t=e.version)||void 0===t?void 0:t.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||e.compositions.forEach((function(e){e.items.forEach((function(e){e.type!==_w.mesh&&e.type!==_w.light||(e.endBehavior=1===e.endBehavior?Iw.destroy:e.endBehavior)}))}))}(e),vP.test(e.version))return gP="0"===(null===(t=/^(\d+)/.exec(e.version))||void 0===t?void 0:t[0]),mP(function(e){var t,r;TP="1.0";var i=e.plugins||[];(null===(t=e.bins)||void 0===t?void 0:t.length)&&(TP="1.3");var n=(e.requires||[]).slice(),o=e.images.map((function(t,r){return EP(t,r,e.imageTags||[])})),a=e.textures||o.map((function(e,t){return{source:t,flipY:!0}})),s={plugins:i,shapes:e.shapes||[],type:"ge",version:TP,playerVersion:null!==(r=e.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map((function(e){return _P(e,{plugins:i,requires:n})})),images:o,imgUsage:e._imgs,binUsage:e.binUsage,spines:e.spines,requires:e.requires,textures:a,bins:(e.bins||[]).slice()};e._textures&&(s._textures=e._textures);return s}(e));var i=null===(r=yP.exec(e.version))||void 0===r?void 0:r[1];if(i)return Number(i)<2?mP(e):e;throw Error("invalid json version "+e.version)}var TP="1.0";function EP(e,t,r){var i=r[t],n=e.oriY;if("string"==typeof e)return{renderLevel:i,url:e,oriY:n};if(e.template)return{url:e.url,template:e.template,webp:e.webp,renderLevel:i,oriY:n};if(e.compressed)return{url:e.url,oriY:n,compressed:{astc:e.compressed.android,pvrtc:e.compressed.iOS},webp:e.webp,renderLevel:i};if(e.url)return{url:e.url,type:e.type,webp:e.webp,renderLevel:i,oriY:n,loop:e.loop};if(e&&e.sourceType)return e;throw Error("invalid image type")}function _P(e,t){var r;void 0===t&&(t={});var i={id:e.id+"",camera:Object.assign({clipMode:jw},e.camera),duration:e.duration,endBehavior:e.endBehavior,items:e.items.map((function(e){return CP(e,t)})),name:e.name},n=e.startTime||e.st;n&&(i.startTime=n);var o=null===(r=e.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 SP,AP=[0,0,0,1],RP=.5;function CP(e,t){var r,i,n;void 0===t&&(t={});var o,a,s,u,c,l,f=_w.base,h=e.endBehavior,p=NaN;if(e.content?(f=e.type||_w.plugin,l=e.pn,c=e.pluginName,s=e.content,a=e.content,isNaN(l)&&!c&&(c=s.options.type),e.duration&&(p=e.duration),o=e.transform||y(a.transform),f===_w.filter&&(TP<"1.1"&&(TP="1.1"),(s=hP(a,o)).filter=function(e){var t={};return Zw(e,(function(e,r){pP.includes(r)?t[r]=qw(e):dP.includes(r)?t[r]=iP(e):t[r]=e})),t}(a.filter))):e.particle?(f=_w.particle,o=y((a=e.particle).transform,gP,!0),s=lP(a)):e.sprite?(f=_w.sprite,s=hP(a=e.sprite,o=y(a.transform,!1,!0))):e.cal?(f=_w.null,s=fP(a=e.cal,o=y(a.transform,!1,!0))):e.ui?(f=_w.interact,o=y((a=e.ui).transform),s=function(e){var t,r=e.options;switch(r.type){case"click":t={type:Tw.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&Qw(r.previewColor),behavior:r.behavior||Ew.NOTIFY};break;case"drag":t={type:Tw.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":t={type:Tw.MESSAGE}}return{options:t}}(a),o.scale=[a.options.width||1,a.options.height||1,1]):e.model&&(a=e.model,1===e.model.options.type&&(f=_w.camera,o=y(a.transform),s=function(e){var t,r,i=e.options,n={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},o=e.velocityOverLifetime;if(o||(null===(t=e.transform)||void 0===t?void 0:t.path)){var a={path:iP(null===(r=e.transform)||void 0===r?void 0:r.path),linearX:qw(null==o?void 0:o.translateX),linearY:qw(null==o?void 0:o.translateY),linearZ:qw(null==o?void 0:o.translateZ)};oP(a),n.positionOverLifetime=a}var s=e.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:qw(null==s?void 0:s.rotateX),y:qw(null==s?void 0:s.rotateY),z:s.separateAxes?qw(null==s?void 0:s.rotateZ):qw(s.rotation)};oP(u),n.rotationOverLifetime=u}return n}(a))),null===(r=s.renderer)||void 0===r?void 0:r.anchor){var d=new Float32Array(s.renderer.anchor);d[0]==RP&&d[1]==RP?delete s.renderer.anchor:t.requires&&Yw(t.requires,"anchor")}if(a){var m=null===(i=a.options)||void 0===i?void 0:i.looping;h=m?Array.isArray(m)?m[1]?Iw.loop:Iw.destroy:Iw.loop:h||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||Iw.destroy,a.options.renderLevel&&(u=a.options.renderLevel),isNaN(p)&&(p=a.options.duration)}var v={type:f,name:e.name,delay:e.delay,duration:p,id:e.id+"",transform:o,endBehavior:h,renderLevel:u,content:s};return c?t.plugins?(Yw(t.plugins,c),v.pn=t.plugins.indexOf(c)):v.pluginName=c:Number.isInteger(l)&&(v.pn=l),e.parentId&&(v.parentId=e.parentId+""),v;function y(e,t,r){if(e){var i={},n=e.rotation;if(n&&(i.rotation=t?[-n[0],-n[1],-n[2]]:[n[0],n[1],n[2]],r)){var o=(a=AP,s=i.rotation[0],u=i.rotation[1],c=i.rotation[2],l=aP(s*uP/2),f=aP(u*uP/2),h=aP(c*uP/2),p=sP(s*uP/2),d=sP(u*uP/2),m=sP(c*uP/2),a[0]=p*f*h+l*d*m,a[1]=l*d*h-p*f*m,a[2]=l*f*m+p*d*h,a[3]=l*f*h-p*d*m,a);i.rotation=function(e,t){var r=t[0],i=t[1],n=t[2],o=t[3],a=r+r,s=i+i,u=n+n,c=r*a,l=i*a,f=i*s,h=n*u,p=o*u,d=1-f-h,m=l-p,v=l+p,y=1-c-h,g=n*a-o*s,x=n*s+o*a,T=1-c-f;return e[1]=Math.asin(function(e,t,r){return e>r?r:e<t?t:e}(-g,-1,1))*cP,Math.abs(g)<.9999999?(e[0]=Math.atan2(x,T)*cP,e[2]=Math.atan2(v,d)*cP):(e[0]=0,e[2]=Math.atan2(-m,y)*cP),e}([],o)}return e.position&&(i.position=e.position),Array.isArray(e.scale)&&(i.scale=[e.scale[0]||1,e.scale[1]||1,e.scale[2]||1]),i}var a,s,u,c,l,f,h,p,d,m;return{}}}var OP=((SP={})[SS.S]=[SS.S,SS.BPlus,SS.APlus],SP[SS.A]=[SS.A,SS.BPlus,SS.APlus],SP[SS.B]=[SS.B,SS.BPlus],SP);function bP(e,t){if(!e||!t)return!0;var r=OP[t];return!!r&&r.includes(e)}var LP=0,IP=function(){function e(e,t){var r=e.jsonScene,i=e.renderLevel,n=e.textureOptions,o=e.pluginSystem,a=e.totalTime,s=r.compositions,u=r.imgUsage,c=r.compositionId;if(!n)throw new Error("scene.textures expected");var l=n.map((function(e){return e&&(e instanceof oO?e:oO.create(t,e))}));e.textureOptions=l;var f=s.find((function(e){return e.id===c}));if(null==l||l.forEach((function(e){return null==e?void 0:e.initialize()})),!f)throw new Error("Invalid composition id: "+c);LP=0,this.composition=f,this.jsonScene=r,this.renderLevel=i,this.pluginSystem=o,this.totalTime=null!=a?a:0,this.imgUsage=null!=u?u:{},this.textures=l,this.mask=0,this.textureOptions=n,this.sourceContent=this.getContent()}return e.prototype.getContent=function(){var e=this.composition,t=e.id,r=e.duration,i=e.name,n=e.endBehavior,o=e.camera,a=e.globalVolume,s=e.startTime,u=void 0===s?0:s,c=this.assembleItems();return{id:t,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:c,camera:o,startTime:u,globalVolume:a}},e.prototype.assembleItems=function(){var e,t=this,r=[],i=this.mask;return isNaN(i)&&(i=0),null===(e=this.composition)||void 0===e||e.items.forEach((function(e){var n,o={},a=e.visible,s=e.renderLevel,u=e.type;if(!1!==a){var c=rS({},e.content);if(c&&(o.content=rS({},c),bP(s,t.renderLevel))){var l=o.content;if(o.type=u,l.renderer){if(l.renderer=t.changeTex(l.renderer),!l.renderer.mask){var f=l.renderer.maskMode;f===CS.MASK?l.renderer.mask=++i:f!==CS.OBSCURED&&f!==CS.REVERSE_OBSCURED||(l.renderer.mask=i)}var h=l.splits&&!l.textureSheetAnimation&&l.splits[0];Number.isInteger(l.renderer.shape)?l.renderer.shape=oI(null===(n=t.jsonScene)||void 0===n?void 0:n.shapes[l.renderer.shape],h):l.renderer.shape&&pC(l.renderer.shape)&&(l.renderer.shape=oI(l.renderer.shape,h))}else o.content.renderer={order:0};l.trails&&(l.trails=t.changeTex(l.trails)),l.filter&&(l.filter=rS({},l.filter));var p=e.name,d=e.delay,m=void 0===d?0:d,v=e.id,y=e.parentId,g=e.duration,x=e.endBehavior,T=e.pluginName,E=e.pn,_=e.transform,S=e.refCount,A=t.jsonScene.plugins,R=void 0===A?[]:A;o.name=p,o.delay=m,o.id=v,y&&(o.parentId=y),o.refCount=S,o.duration=g,o.listIndex=LP++,o.endBehavior=x,T?o.pluginName=T:void 0!==E&&Number.isInteger(E)&&(o.pluginName=R[E]),_&&(o.transform=_),r.push(o)}}})),r},e.prototype.changeTex=function(e){var t=e.texture,r=rS({},e);return void 0!==t&&(r.texture=this.addTextureUsage(t)||t),r},e.prototype.addTextureUsage=function(e){var t,r;if(Number.isInteger(e)){var i=null===(t=this.textures)||void 0===t?void 0:t[e],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}},e.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},e}();var wP=1,PP=function(){function t(e,t){void 0===e&&(e={}),void 0===t&&(t=new KC),this.options=e,this.downloader=t,this.assets={},this.id=wP++,this.updateOptions(e)}return t.prototype.updateOptions=function(e){void 0===e&&(e={}),this.options=e,e.pluginData||(e.pluginData={});var t=e.timeout,r=void 0===t?10:t;this.timeout=r},t.prototype.loadScene=function(e,t,r){var i,n;return iS(this,void 0,void 0,(function(){var o,a,s,u,c,l,f,h,p,d,m,v=this;return nS(this,(function(y){return a="Load asset: ".concat(lC(e)?e:this.id),s=performance.now(),u=[],c=null==t?void 0:t.engine.gpuCapability,l=null!==(n=null===(i=null==c?void 0:c.detail)||void 0===i?void 0:i.asyncShaderCompile)&&void 0!==n&&n,h=!1,p=new Promise((function(t,r){return f=window.setTimeout((function(){h=!0,r("Load time out: ".concat(e))}),1e3*v.timeout)})),d=function(e,t){return iS(v,void 0,void 0,(function(){var r,i;return nS(this,(function(n){switch(n.label){case 0:return h?[3,2]:(r=performance.now(),[4,t()]);case 1:return i=n.sent(),u.push("[".concat(e,": ").concat((performance.now()-r).toFixed(2),"]")),[2,i];case 2:throw new Error("load canceled.")}}))}))},m=function(){return iS(v,void 0,void 0,(function(){var i,n,h,p,m,v,y,g,x,T,E,_,S,A,R=this;return nS(this,(function(C){switch(C.label){case 0:return pC(e)?(o=e,this.baseUrl=location.href,[3,3]):[3,1];case 1:return e=new URL(e,location.href).href,this.baseUrl=e,[4,d("loadJSON",(function(){return R.loadJSON(e)}))];case 2:o=C.sent(),C.label=3;case 3:return[4,d("processJSON",(function(){return R.processJSON(o)}))];case 4:return i=C.sent(),n=i.usedImages,h=i.jsonScene,p=h.bins,m=void 0===p?[]:p,v=h.images,y=h.compositions,g=h.fonts,[4,Promise.all([d("processBins",(function(){return R.processBins(m)})),d("processImages",(function(){var e;return R.processImages(v,n,null!==(e=null==c?void 0:c.detail.compressedTexture)&&void 0!==e?e:0)})),d("".concat(l?"async":"sync"," compile"),(function(){return R.precompile(y,t,r)}))])];case 5:return x=aS.apply(void 0,[C.sent(),2]),T=x[0],E=x[1],[4,d("processFontURL",(function(){return R.processFontURL(g)}))];case 6:return C.sent(),[4,d("processTextures",(function(){return R.processTextures(E,T,h)}))];case 7:return _=C.sent(),S={jsonScene:h,images:E,textureOptions:_,bins:T,storage:{},pluginSystem:this.pluginSystem,renderLevel:this.options.renderLevel,totalTime:0,startTime:0,url:e},[4,d("processPlugins",(function(){return R.pluginSystem.loadResources(S,R.options)}))];case 8:return C.sent(),A=performance.now()-s,console.info({content:"".concat(a,": ").concat(A.toFixed(4),"ms, ").concat(u.join(" ")),type:sO}),window.clearTimeout(f),S.totalTime=A,S.startTime=s,[2,S]}}))}))},[2,Promise.race([p,m()])]}))}))},t.prototype.precompile=function(e,t,r){return iS(this,void 0,void 0,(function(){var i;return nS(this,(function(n){switch(n.label){case 0:return t&&t.getShaderLibrary()?(i=null==t?void 0:t.getShaderLibrary(),[4,this.pluginSystem.precompile(e,t,r)]):[2];case 1:return n.sent(),[4,new Promise((function(e){i.compileAllShaders((function(){e(null)}))}))];case 2:return n.sent(),[2]}}))}))},t.prototype.processJSON=function(e){return iS(this,void 0,void 0,(function(){var t,r,i,n,o,a,s,u;return nS(this,(function(c){switch(c.label){case 0:return t=xP(e),e.compositions.forEach((function(e,r){e.globalVolume&&(t.compositions[r].globalVolume=e.globalVolume)})),r=t.plugins,i=void 0===r?[]:r,n=t.compositions,o=t.imgUsage,a=t.images,this.pluginSystem=new bC(i),[4,this.pluginSystem.processRawJSON(t,this.options)];case 1:return c.sent(),s=this.options.renderLevel,u={},o?function(e,t,r,i,n){for(var o=0;o<t.length;o++){var a=r[t[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];bP(i[u].renderLevel,n)&&(e[u]=!0)}}}(u,n,o,a,s):null==a||a.forEach((function(e,t){u[t]=!0})),[2,{usedImages:u,jsonScene:t}]}}))}))},t.prototype.processBins=function(e){return iS(this,void 0,void 0,(function(){var t,r,i=this;return nS(this,(function(n){return t=this.options.renderLevel,r=e.map((function(r){if(r instanceof ArrayBuffer)return r;if(bP(r.renderLevel,t))return i.loadBins(r.url);throw new Error("Invalid bins source: ".concat(e))})),[2,Promise.all(r)]}))}))},t.prototype.processFontURL=function(e){return iS(this,void 0,void 0,(function(){var r,i=this;return nS(this,(function(n){return e?(r=e.map((function(e){return iS(i,void 0,void 0,(function(){var r,i;return nS(this,(function(n){switch(n.label){case 0:if(!e.fontURL||t.fonts.has(e.fontFamily))return[3,4];r=new FontFace(null!==(i=e.fontFamily)&&void 0!==i?i:"","url("+e.fontURL+")"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r.load()];case 2:return n.sent(),document.fonts.add(r),t.fonts.add(e.fontFamily),[3,4];case 3:return n.sent(),console.warn({content:"Invalid fonts source: ".concat(e.fontURL),type:sO}),[3,4];case 4:return[2]}}))}))})),[2,Promise.all(r)]):[2]}))}))},t.prototype.processImages=function(t,r,i){return iS(this,void 0,void 0,(function(){var n,o,a,s,u,c=this;return nS(this,(function(l){return n=this.options,o=n.useCompressedTexture,a=n.variables,s=this.baseUrl,u=t.map((function(t,n){return iS(c,void 0,void 0,(function(){var u,c,l,f,h,p,d,m,v,y,g,x,T,E,_,S,A,R,C;return nS(this,(function(O){switch(O.label){case 0:if(!r[n])return[3,19];if(u=t.url,c=t.webp,l=new URL(u,s).href,f=c&&new URL(c,s).href,!("template"in t))return[3,16];if(h=t.template,p=void 0,!("v"in h)||2!==h.v||!h.background)return[3,9];if(!((d=YI(h,a))instanceof Array))return[3,6];m=h.background.name,O.label=1;case 1:return O.trys.push([1,3,,5]),A={},[4,$C(d[0])];case 2:return A.image=O.sent(),A.url=d[0],p=A,[3,5];case 3:return O.sent(),R={},[4,$C(d[1])];case 4:return R.image=O.sent(),R.url=d[1],p=R,[3,5];case 5:return a&&(a[m]=p.url),[3,8];case 6:return"string"!=typeof d?[3,8]:(C={},[4,$C(d)]);case 7:C.image=O.sent(),C.url=d,p=C,O.label=8;case 8:return[3,11];case 9:return[4,JC(l,f)];case 10:p=O.sent(),O.label=11;case 11:v=void 0,O.label=12;case 12:return O.trys.push([12,14,,15]),[4,QI(p.image,h,a,this.options,-1===t.oriY)];case 13:return v=O.sent(),[3,15];case 14:throw O.sent(),new Error("image template fail: ".concat(l));case 15:return[2,v];case 16:if("type"in t&&"video"===t.type)return y=t.loop,[2,tO(t.url,{loop:y})];if("compressed"in t&&o&&i){if(g=t.compressed,x=void 0,i===Ib.ASTC?x=g.astc:i===Ib.PVRTC&&(x=g.pvrtc),x)return T=new URL(x,s).href,this.assets[n]={url:T,type:e.TextureSourceType.compressed},[2,this.loadBins(T)]}else{if("sourceType"in t)return[2,t];if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof oO)return[2,t]}O.label=17;case 17:return[4,JC(l,f)];case 18:return E=O.sent(),_=E.url,S=E.image,this.assets[n]={url:_,type:e.TextureSourceType.image},[2,S];case 19:return[2,void 0]}}))}))})),[2,Promise.all(u)]}))}))},t.prototype.processTextures=function(t,r,i){var n;return iS(this,void 0,void 0,(function(){var o,a,s=this;return nS(this,(function(u){return o=null!==(n=i.textures)&&void 0!==n?n:t.map((function(e,t){return{source:t}})),a=o.map((function(n,o){if(n instanceof oO)return n;if("mipmaps"in n)try{return rO(n,r,i.bins)}catch(e){throw new Error("load texture ".concat(o," fails, error message: ").concat(e))}var a=n.source,u=t[a];if(u){var c=function(t,r){if(t instanceof oO)return t.source;if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)return{image:t,sourceType:e.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:xS.LINEAR,magFilter:xS.LINEAR};if(t instanceof HTMLVideoElement)return{sourceType:e.TextureSourceType.video,video:t,minFilter:xS.LINEAR,magFilter:xS.LINEAR};if(t instanceof ArrayBuffer)return rS(rS({},pO(t)),{sourceFrom:r});if("width"in t&&"height"in t&&"data"in t)return{sourceType:e.TextureSourceType.data,data:t,wrapS:xS.CLAMP_TO_EDGE,wrapT:xS.CLAMP_TO_EDGE,minFilter:xS.NEAREST,magFilter:xS.NEAREST};throw new Error("Invalid texture options")}(u,s.assets[o]);return c.sourceType===e.TextureSourceType.compressed?c:rS(rS({},c),n)}throw new Error("Invalid texture source: ".concat(a))})),[2,Promise.all(a)]}))}))},t.prototype.loadJSON=function(e){return iS(this,void 0,void 0,(function(){var t=this;return nS(this,(function(r){return[2,new Promise((function(r,i){t.downloader.downloadJSON(e,r,(function(t,r){i("Couldn't load JSON ".concat(e,": status ").concat(t,", ").concat(r))}))}))]}))}))},t.prototype.loadBins=function(e){return iS(this,void 0,void 0,(function(){var t=this;return nS(this,(function(r){return[2,new Promise((function(r,i){t.downloader.downloadBinary(e,r,(function(t,r){i("Couldn't load bins ".concat(e,": status ").concat(t,", ").concat(r))}))}))]}))}))},t.prototype.dispose=function(){var e;for(var t in this.assets){var r=this.assets[t];null===(e=null==r?void 0:r.dispose)||void 0===e||e.call(r)}this.assets={}},t.fonts=new Set,t}();var MP,VP,NP,FP,DP=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.items=[],t.itemTree=[],t.itemCacheMap=new Map,t.itemsToRemove=[],t.tempQueue=[],t}return tS(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return wS.composition},enumerable:!1,configurable:!0}),t.prototype.onConstructed=function(e){var t=e.items,r=void 0===t?[]:t,i=e.startTime,n=void 0===i?0:i;this.itemProps=r;var o=this.endBehavior;5!==o&&1!==o&&3!==o||(this.freezeOnEnd=!0),this.startTime=n,this.startTimeInms=Math.round(1e3*this.startTime)},t.prototype.createContent=function(){if(!this.items.length&&this.composition)for(var e=0;e<this.itemProps.length;e++){var t=_C(this.itemProps[e],this.composition);"extra-camera"===t.id&&"extra-camera"===t.name&&(this.extraCamera=t),this.items.push(t),this.tempQueue.push(t)}},t.prototype.onLifetimeBegin=function(){var e;null===(e=this.items)||void 0===e||e.forEach((function(e){e.start(),e.createContent()})),this.buildItemTree()},t.prototype.doStop=function(){this.items&&this.items.forEach((function(e){return e.stop()}))},t.prototype.onItemUpdate=function(e,t){var r,i=this;if(this.items){null===(r=this.composition)||void 0===r||r.updatePluginLoaders(e);var n=[];this.itemsToRemove.length&&(this.itemsToRemove.forEach((function(e){var t,r,n=i.itemCacheMap.get(e.id);if(n){var o=n.children;if(n.parentId){var a=i.itemCacheMap.get(n.parentId);a?(a.children.splice(a.children.indexOf(n),1),o.forEach((function(e){return i.setItemParent(e.item,a.item)}))):(o.forEach((function(e){return i.setItemParent(e.item,void 0)})),(t=i.itemTree).push.apply(t,sS([],aS(o),!1)))}else(r=i.itemTree).splice.apply(r,sS([i.itemTree.indexOf(n),1],aS(o),!1)),o.forEach((function(e){return i.setItemParent(e.item,void 0)}));i.itemCacheMap.delete(e.id),i.items.splice(i.items.indexOf(e),1)}})),this.itemsToRemove.length=0);for(var o=0;o<this.itemTree.length;o++){(a=this.itemTree[o])&&a.item&&(a.item.onUpdate(e),n.push.apply(n,sS([],aS(a.children),!1)))}for(;n.length;){var a;if((a=n.shift())&&a.item){var s=a.item;s.onUpdate(e),n.push.apply(n,sS([],aS(a.children),!1)),s.composition||kS(this.itemsToRemove,s)}}this.extraCamera&&this.extraCamera.onUpdate(e)}},t.prototype.onItemRemoved=function(e){this.items&&(this.items.forEach((function(e){return e.dispose()})),this.items.length=0,this.itemTree.length=0,this.itemCacheMap.clear())},t.prototype.reset=function(){e.prototype.reset.call(this),this.itemTree=[],this.itemCacheMap.clear(),this.tempQueue.length=0,this.itemsToRemove.length=0},t.prototype.handleVisibleChanged=function(e){this.items.forEach((function(t){return t.setVisible(e)}))},t.prototype.getUpdateTime=function(e){var t=this.startTimeInms,r=this.timeInms;if(e<0&&r+e<t)return t-r;if(this.freezeOnEnd){var i=this.durInms-r;if(i<e)return i}return e},t.prototype.removeItem=function(e){var t,r=this;if(this.items.indexOf(e)>-1){if(kS(this.itemsToRemove,e),e.type===cS||e.type===wS.null){var i=6===e.endBehavior,n=e.type===wS.null&&!!this.itemCacheMap.get(e.id);((null===(t=this.itemCacheMap.get(e.id))||void 0===t?void 0:t.children)||[]).forEach((function(e){n||r.setItemParent(e.item,void 0),i&&r.removeItem(e.item)}))}return!0}return!1},t.prototype.setItemParent=function(e,t){var r=this.itemCacheMap.get(e.id);if(r)if(t){var i=this.itemCacheMap.get(t.id);if(r.parentId){var n=this.itemCacheMap.get(r.parentId);n.children.splice(n.children.indexOf(r),1)}e.parent=t,r.parentId=t.id,i.children.push(r),e.transform.parentTransform=t.transform}else r.parentId=void 0,e.parent=void 0,e.transform.parentTransform=this.transform;else console.error("item has been remove, please set item's parent in valid lifetime")},t.prototype.getItemCurrentParent=function(e){var t=e.id,r=this.itemCacheMap.get(t);if(r){var i=r.parentId;if(i){var n=this.itemCacheMap.get(i);return i&&n?n.item:void 0}}},t.prototype.isEnded=function(e){return e>=this.durInms},t.prototype.buildItemTree=function(){if(!this.itemTree.length&&this.composition){this.itemTree=[];for(var e=this.itemCacheMap,t=this.tempQueue,r=function(){var r=t.shift();if(void 0===r.parentId){var n={id:r.id,item:r,children:[]};i.itemTree.push(n),e.set(r.id,n)}else{var o=i.getParentIdWithoutSuffix(r.parentId),a=e.get(o);if(a){n={id:r.id,parentId:o,item:r,children:[]};r.parent=a.item,r.transform.parentTransform=a.item.getNodeTransform(r.parentId),a.children.push(n),e.set(r.id,n)}else{if(-1===i.items.findIndex((function(e){return e.id===o})))throw Error("元素引用了不存在的元素,请检查数据");t.push(r)}}},i=this;t.length;)r()}},t.prototype.getParentIdWithoutSuffix=function(e){var t=e.lastIndexOf("^");return t>-1?e.substring(0,t):e},t}(EC),UP=1,BP=function(){function t(e,t){var r;this.speed=1,this.loaderData={},this.assigned=!1,this.destroyed=!1,this.paused=!1,this.lastVideoUpdateTime=0,this.postLoaders=[];var i=e.reusable,n=void 0!==i&&i,o=e.speed,a=void 0===o?1:o,s=e.baseRenderOrder,u=void 0===s?0:s,c=e.renderer,l=e.handlePlayerPause,f=e.handleMessageItem,h=e.handleEnd,p=e.event,d=e.width,m=e.height;this.compositionSourceManager=new IP(t,c.engine),t.jsonScene.imgUsage=void 0,n&&(this.keepResource=!0,t.textures=void 0,t.consumed=!0);var v=this.compositionSourceManager,y=v.sourceContent,g=v.pluginSystem,x=v.imgUsage,T=v.totalTime,E=v.renderLevel;rA(y);var _=new DP(y,this),S=!n&&x;this.transform=new TC({name:this.name}),_.transform=this.transform,this.globalVolume=y.globalVolume,this.width=d,this.height=m,this.renderOrder=u,this.id=UP++,this.renderer=c,this.texInfo=null!=S?S:{},this.event=p,this.statistic={loadTime:null!=T?T:0,loadStart:null!==(r=t.startTime)&&void 0!==r?r:0,firstFrameTime:0},this.reusable=n,this.speed=a,this.renderLevel=E,this.autoRefTex=!this.keepResource&&S&&5!==_.endBehavior,this.content=_,this.name=_.name,this.pluginSystem=g,this.pluginSystem.initializeComposition(this,t),this.camera=new pw(this.name,rS(rS({},null==y?void 0:y.camera),{aspect:d/m})),this.url=t.url,this.assigned=!0,this.handlePlayerPause=l,this.handleMessageItem=f,this.handleEnd=h,this.createRenderFrame(),this.reset()}return Object.defineProperty(t.prototype,"textures",{get:function(){return this.compositionSourceManager.textures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return this.content.items},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"startTime",{get:function(){var e;return null!==(e=this.content.startTime)&&void 0!==e?e:0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"time",{get:function(){return this.content.timeInms/1e3},enumerable:!1,configurable:!0}),t.prototype.getDuration=function(){return this.content.duration},Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.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)},t.prototype.setIndex=function(e){this.renderOrder=e},t.prototype.getIndex=function(){return this.renderOrder},t.prototype.setSpeed=function(e){this.speed=e},t.prototype.getSpeed=function(){return this.speed},t.prototype.play=function(){this.content.ended&&this.reusable&&this.restart(),this.gotoAndPlay(this.time)},t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.gotoAndPlay=function(e){this.resume(),this.content.started||(this.content.start(),this.forwardTime(this.startTime)),this.forwardTime(e)},t.prototype.gotoAndStop=function(e){this.gotoAndPlay(e),this.pause()},t.prototype.createRenderFrame=function(){this.renderFrame=new Tb({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},t.prototype.setTime=function(e){var t=this.paused;t&&this.resume(),this.forwardTime(e,!0),t&&this.pause()},t.prototype.forwardTime=function(e,t){void 0===t&&(t=!1);for(var r=1e3*(this.startTime+Math.max(0,e))-this.content.timeInms,i=r<0,n=Math.abs(r),o=i?-15:15;n>15;n-=15)this.update(o,t);this.update(i?-n:n,t)},t.prototype.reset=function(){var e=this;this.rendererOptions=null,this.pluginSystem.plugins.forEach((function(t){return t.onCompositionWillReset(e,e.renderFrame)})),this.content.createContent(),this.content.onEnd=function(){window.setTimeout((function(){var t;null===(t=e.handleEnd)||void 0===t||t.call(e,e)}),0)},this.pluginSystem.resetComposition(this,this.renderFrame)},t.prototype.prepareRender=function(){var e=this,t=this.renderFrame;this.postLoaders.length=0,this.pluginSystem.plugins.forEach((function(r){r.prepareRenderFrame(e,t)&&e.postLoaders.push(r)})),this.postLoaders.forEach((function(r){return r.postProcessFrame(e,t)}))},t.prototype.shouldRestart=function(){var e=this.content,t=e.ended,r=e.endBehavior;return t&&5===r},t.prototype.shouldDispose=function(){if(this.reusable)return!1;var e=this.content,t=e.ended,r=e.endBehavior;return t&&(!r||3===r)},t.prototype.update=function(e,t){if(void 0===t&&(t=!1),this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var r=this.content.getUpdateTime(e*this.speed);this.updateVideo(),this.content.onUpdate(r),this.loaderData.spriteGroup.onUpdate(r),this.updateCamera(),this.shouldDispose()?this.dispose():t||this.prepareRender()}},t.prototype.updateVideo=function(){var e,t=performance.now();t-this.lastVideoUpdateTime>33&&((null!==(e=this.textures)&&void 0!==e?e:[]).forEach((function(e){return null==e?void 0:e.uploadCurrentVideoFrame()})),this.lastVideoUpdateTime=t)},t.prototype.updateCamera=function(){this.camera.updateMatrix()},t.prototype.updatePluginLoaders=function(e){var t=this;this.pluginSystem.plugins.forEach((function(r){return r.onCompositionUpdate(t,e)}))},t.prototype.getItemByName=function(e,t){var r=this.content&&this.content.items;if(r)return r.find((function(r){return r.name===e&&(!t||t===r.type)}))},t.prototype.getItemByID=function(e){return this.content&&this.content.items&&this.content.itemCacheMap.has(e)?this.content.itemCacheMap.get(e).item:null},t.prototype.getItemCurrentParent=function(e){return this.content.getItemCurrentParent(e)},t.prototype.itemLifetimeEvent=function(e,t){var r=this,i=t?function(t){return t.onCompositionItemLifeBegin(r,e)}:function(t){return t.onCompositionItemLifeEnd(r,e)};this.pluginSystem.plugins.forEach(i)},t.prototype.getHitTestRay=function(e,t){var r=aS(this.renderFrame.editorTransform,4),i=r[0],n=r[1];return _R((e-r[2])/i,(t-r[3])/n,this.camera)},t.prototype.getEngine=function(){var e;return null===(e=this.renderer)||void 0===e?void 0:e.engine},t.prototype.hitTest=function(t,r,i,n){if(this.isDestroyed)return[];for(var o=[],a=[],s=aS(this.renderFrame.editorTransform,4),u=s[0],c=s[1],l=_R((t-s[2])/u,(r-s[3])/c,this.camera),f=(null==n?void 0:n.stop)||cC,h=(null==n?void 0:n.skip)||cC,p=(null==n?void 0:n.maxCount)||this.items.length,d=0;d<this.items.length&&a.length<p;d++){var m=this.items[d];if(m.lifetime>=0&&m.lifetime<=1&&!h(m)){var v=m.getHitTestParams(i);if(v){var y=!1,g=[];if(v.type===e.HitTestType.triangle)for(var x=v.triangles,T=v.backfaceCulling,E=0;E<x.length;E++){var _=x[E];if(IR(g,l.center,l.direction,_,T),g.length){y=!0,o.push(g);break}}else if(v.type===e.HitTestType.box){var S=v.center,A=v.size;AR(g,l.center,l.direction,S,A),g.length&&(y=!0,o.push(g))}else if(v.type===e.HitTestType.sphere){S=v.center;var R=v.radius;SR(g,l.center,l.direction,S,R),g.length&&(y=!0,o.push(g))}else if(v.type===e.HitTestType.custom){var C=v.collect(l,[t,r]);C&&C.length>0&&(o.push.apply(o,sS([],aS(C),!1)),y=!0)}if(y){var O={id:m.id,name:m.name,position:o[o.length-1],parentId:m.parentId,hitPositions:o,behavior:v.behavior};if(a.push(O),f(O))return a}}}}return a},t.prototype.addInteractiveItem=function(e,t){var r;if(t===LS.MESSAGE)return null===(r=this.handleMessageItem)||void 0===r||r.call(this,{name:e.name,phrase:2,id:e.id,compositionId:this.id}),e.id},t.prototype.removeInteractiveItem=function(e,t){var r;t===LS.MESSAGE&&(null===(r=this.handleMessageItem)||void 0===r||r.call(this,{name:e.name,phrase:1,id:e.id,compositionId:this.id}))},t.prototype.destroyTextures=function(t){for(var r,i=0;i<t.length;i++){var n=t[i];if(n)if(n.sourceType!==e.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()}},t.prototype.destroyItem=function(e){var t=this;this.content.removeItem(e)&&this.pluginSystem.plugins.forEach((function(r){return r.onCompositionItemRemoved(t,e)}))},t.prototype.lost=function(e){this.videoState=this.textures.map((function(e){if("video"in e.source)return e.source.video.pause(),e.source.video.currentTime})),this.textures.map((function(e){return e.dispose()})),this.dispose()},t.prototype.dispose=function(){var e,t,r=this;if(!this.destroyed){this.destroyed=!0;var i={},n=this.textures;n&&(this.keepResource?n.forEach((function(e){(null==e?void 0:e.dispose)&&(i[e.id]=e.dispose,e.dispose=cC)})):n.forEach((function(e){return e&&e.dispose()}))),this.content.dispose(),this.renderFrame.dispose(),null===(e=this.rendererOptions)||void 0===e||e.emptyTexture.dispose(),null===(t=this.pluginSystem)||void 0===t||t.destroyComposition(this),this.update=function(){console.error({content:"Update disposed composition: ".concat(r.name,"."),type:sO})},this.handlePlayerPause=cC,this.dispose=cC,n&&this.keepResource&&n.forEach((function(e){return e.dispose=i[e.id]})),this.compositionSourceManager.dispose()}},t.prototype.setEditorTransform=function(e,t,r){this.renderFrame.editorTransform=[e,e,t,r]},t.prototype.translateByPixel=function(e,t){this.renderer?this.content.translateByPixel(e,t):console.warn("Can not translate position when container not assigned")},t.prototype.translate=function(e,t,r){this.content.translate(e,t,r)},t.prototype.rotate=function(e,t,r){this.content.rotate(e,t,r)},t.prototype.scale=function(e,t,r){this.content.scale(e,t,r)},t.prototype.offloadTexture=function(){this.textureOffloaded||(this.textures.forEach((function(e){return e&&e.offloadData()})),this.textureOffloaded=!0)},t.prototype.getRendererOptions=function(){return this.rendererOptions||(this.rendererOptions={emptyTexture:this.renderFrame.emptyTexture,cachePrefix:"-"}),this.rendererOptions},t.prototype.reloadTexture=function(){return iS(this,void 0,void 0,(function(){return nS(this,(function(e){switch(e.label){case 0:return this.textureOffloaded?[4,Promise.all(this.textures.map((function(e){return null==e?void 0:e.reloadData()})))]:[3,2];case 1:e.sent(),this.textureOffloaded=!1,e.label=2;case 2:return[2]}}))}))},t}(),kP=function(){function e(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[]}return e.prototype.addTexture=function(e){this.destroyed||kS(this.textures,e)},e.prototype.removeTexture=function(e){this.destroyed||zS(this.textures,e)},e.prototype.addMaterial=function(e){this.destroyed||kS(this.materials,e)},e.prototype.removeMaterial=function(e){this.destroyed||zS(this.materials,e)},e.prototype.addGeometry=function(e){this.destroyed||kS(this.geometries,e)},e.prototype.removeGeometry=function(e){this.destroyed||zS(this.geometries,e)},e.prototype.addMesh=function(e){this.destroyed||kS(this.meshes,e)},e.prototype.removeMesh=function(e){this.destroyed||zS(this.meshes,e)},e.prototype.addRenderPass=function(e){this.destroyed||kS(this.renderPasses,e)},e.prototype.removeRenderPass=function(e){this.destroyed||zS(this.renderPasses,e)},Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.getShaderLibrary=function(){return this.renderer.getShaderLibrary()},e.prototype.dispose=function(){if(!this.destroyed){this.destroyed=!0;var e=[];this.renderPasses.length>0&&e.push("Pass ".concat(this.renderPasses.length)),this.meshes.length>0&&e.push("Mesh ".concat(this.meshes.length)),this.geometries.length>0&&e.push("Geom ".concat(this.geometries.length)),this.textures.length>0&&e.push("Tex ".concat(this.textures.length)),e.length>0&&console.warn({content:"Release GPU memory: ".concat(e.join(", ")),type:sO}),this.renderPasses.forEach((function(e){e.dispose()})),this.meshes.forEach((function(e){e.dispose()})),this.geometries.forEach((function(e){e.dispose()})),this.materials.forEach((function(e){e.dispose()})),this.textures.forEach((function(e){e.dispose()})),this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[],this.renderer=null}},e}(),zP=function(){function e(e){void 0===e&&(e=60),this.paused=!0,this.lastTime=0,this.setFPS(e),this.tickers=[]}return e.prototype.getFPS=function(){return this.targetFPS},e.prototype.setFPS=function(e){this.targetFPS=SA(e,1,120),this.interval=Math.floor(1e3/e)-1},e.prototype.getPaused=function(){return this.paused},e.prototype.start=function(){var e=this;if(this.paused=!1,!this.intervalId){this.lastTime=performance.now();var t=requestAnimationFrame||function(e){return window.setTimeout(e,16.7)},r=function(){e.intervalId=t(r),e.paused||e.tick()};r()}},e.prototype.stop=function(){(cancelAnimationFrame||window.clearTimeout)(this.intervalId),this.intervalId=0,this.lastTime=0,this.paused=!0,this.tickers=[]},e.prototype.pause=function(){this.paused=!0},e.prototype.resume=function(){this.paused=!1},e.prototype.tick=function(){if(!this.paused){var e=performance.now(),t=e-this.lastTime;if(t>=this.interval){this.lastTime=e,this.resetTickers&&(this.tickers=this.tickers.filter((function(e){return e})),this.resetTickers=!1);for(var r=0,i=this.tickers.length;r<i;r++){(0,this.tickers[r])(t)}}}},e.prototype.add=function(e){if("function"!=typeof e)throw new Error("Ticker: The tick object must implement the tick method.");this.tickers.push(e)},e}();CC("camera",wC,PC,!0),CC("sprite",Qb,oL,!0),CC("particle",bI,OI,!0),CC("cal",II,wI,!0),CC("interact",Ub,Fb,!0),CC("filter",Qb,sL,!0),CC("text",tw,ew,!0),DS(Rw);var GP=((MP={})[xS.ONE]=i.OneFactor,MP[xS.ZERO]=i.ZeroFactor,MP[xS.SRC_COLOR]=i.SrcColorFactor,MP[xS.SRC_ALPHA]=i.SrcAlphaFactor,MP[xS.ONE_MINUS_SRC_COLOR]=i.OneMinusSrcColorFactor,MP[xS.ONE_MINUS_SRC_ALPHA]=i.OneMinusSrcAlphaFactor,MP[xS.DST_COLOR]=i.DstColorFactor,MP[xS.DST_ALPHA]=i.DstAlphaFactor,MP[xS.ONE_MINUS_DST_COLOR]=i.OneMinusDstColorFactor,MP[xS.ONE_MINUS_DST_ALPHA]=i.OneMinusDstAlphaFactor,MP),jP=((VP={})[xS.NEVER]=i.NeverStencilFunc,VP[xS.EQUAL]=i.EqualStencilFunc,VP[xS.LESS]=i.LessStencilFunc,VP[xS.LEQUAL]=i.LessEqualStencilFunc,VP[xS.ALWAYS]=i.AlwaysStencilFunc,VP[xS.NOTEQUAL]=i.NotEqualStencilFunc,VP[xS.GREATER]=i.GreaterStencilFunc,VP[xS.GEQUAL]=i.GreaterEqualStencilFunc,VP),XP=((NP={})[xS.KEEP]=i.KeepStencilOp,NP[xS.ZERO]=i.ZeroStencilOp,NP[xS.REPLACE]=i.ReplaceStencilOp,NP[xS.INCR]=i.IncrementStencilOp,NP[xS.DECR]=i.DecrementStencilOp,NP[xS.INCR_WRAP]=i.IncrementWrapStencilOp,NP[xS.DECR_WRAP]=i.IncrementWrapStencilOp,NP[xS.INVERT]=i.InvertStencilOp,NP),WP=((FP={})[xS.NEVER]=i.NeverDepth,FP[xS.ALWAYS]=i.AlwaysDepth,FP[xS.EQUAL]=i.EqualDepth,FP[xS.LESS]=i.LessDepth,FP[xS.LEQUAL]=i.LessEqualDepth,FP[xS.GREATER]=i.GreaterDepth,FP[xS.GEQUAL]=i.GreaterEqualDepth,FP[xS.NOTEQUAL]=i.NotEqualDepth,FP);function HP(e,t,r){e[t]?e[t].value=r:e[t]=new i.Uniform(r)}var YP=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],ZP=function(t){function r(r,n){var o=t.call(this,n)||this;o.textures={},o.material=new i.RawShaderMaterial,o.uniforms={};for(var a=n.shader,s=r.gpuCapability.level,u=0;u<e.maxSpriteMeshItemCount;u++)o.uniforms["uSampler".concat(u)]=new i.Uniform(null);return o.uniforms.uEditorTransform=new i.Uniform([1,1,0,0]),o.uniforms.effects_ObjectToWorld=new i.Uniform((new i.Matrix4).identity()),o.uniforms.effects_MatrixInvV=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),o.uniforms.effects_MatrixVP=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),o.uniforms.effects_MatrixV=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),o.material=new i.RawShaderMaterial({vertexShader:a.vertex,fragmentShader:a.fragment,alphaToCoverage:!1,depthFunc:i.LessDepth,polygonOffsetFactor:i.ZeroFactor,polygonOffsetUnits:i.ZeroFactor,polygonOffset:!1,uniforms:o.uniforms}),o.material.glslVersion=1===s?i.GLSL1:i.GLSL3,o}return tS(r,t),r.prototype.onSetUniformValue=function(e,t){var r;YP.includes(e)&&(r=t.texture),this.material.uniforms[e]?this.material.uniforms[e].value=r||t:this.material.uniforms[e]=new i.Uniform(r||t)},r.prototype.onRemoveUniformValue=function(e){this.material.uniforms[e]&&(this.material.uniforms[e].value=null)},Object.defineProperty(r.prototype,"blending",{get:function(){return this.material.blending!==i.NoBlending},set:function(e){this.material.blending=e?i.CustomBlending:i.NoBlending},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendFunction",{get:function(){var e=this.material,t=e.blendSrc,r=e.blendDst;return[t,r,e.blendSrcAlpha||t,e.blendDstAlpha||r]},set:function(e){if(e){var t=aS(e,4),r=t[0],i=t[1],n=t[2],o=t[3];this.material.blendSrc=GP[r],this.material.blendDst=GP[i],this.material.blendSrcAlpha=GP[n],this.material.blendDstAlpha=GP[o]}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendEquation",{get:function(){var e=this.material,t=e.blendEquation;return[t,e.blendEquationAlpha||t]},set:function(e){if(e){var t=aS(e,2),r=t[0],i=t[1];this.material.blendEquation=r,this.material.blendEquationAlpha=i}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return this.material.depthTest},set:function(e){this.material.depthTest=!!e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return this.material.depthWrite},set:function(e){this.material.depthWrite=!!e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthFunc",{get:function(){return this.material.depthFunc},set:function(e){void 0!==e&&(this.material.depthFunc=WP[e])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffsetFill",{get:function(){return this.material.polygonOffset},set:function(e){this.material.polygonOffset=!!e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(e){if(e){var t=aS(e,2),r=t[0],i=t[1];this.material.polygonOffsetFactor=r,this.material.polygonOffsetUnits=i}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sampleAlphaToCoverage",{get:function(){return this.material.alphaToCoverage},set:function(e){this.material.alphaToCoverage=!!e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilTest",{get:function(){return this.material.stencilWrite},set:function(e){this.material.stencilWrite=!!e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilMask",{get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(e){e&&(this.material.stencilWriteMask=e[0])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilRef",{get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(e){e&&(this.material.stencilRef=e[0])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilFunc",{get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(e){e&&(this.material.stencilFunc=jP[e[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpFail",{get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(e){e&&(this.material.stencilFail=XP[e[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZFail",{get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(e){e&&(this.material.stencilZFail=XP[e[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZPass",{get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(e){e&&(this.material.stencilZPass=XP[e[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return this.material.side!==i.DoubleSide},set:function(e){this.material.side=e?i.FrontSide:i.DoubleSide},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cullFace",{get:function(){return this.material.side},set:function(e){e===RS.FRONT?this.material.side=i.FrontSide:e===RS.BACK&&(this.material.side=i.BackSide)},enumerable:!1,configurable:!0}),r.prototype.getTexture=function(e){return this.textures[e]},r.prototype.setTexture=function(e,t){this.setUniform(e,t.texture),this.textures[e]=t},r.prototype.getVector4Array=function(e){return this.uniforms[e].value},r.prototype.setVector4Array=function(e,t){var r,i,n=[];try{for(var o=oS(t),a=o.next();!a.done;a=o.next()){var s=a.value;n=n.concat(s)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.setUniform(e,n)},r.prototype.getMatrixArray=function(e){return this.uniforms[e].value},r.prototype.setMatrixArray=function(e,t){var r,i,n=[];try{for(var o=oS(t),a=o.next();!a.done;a=o.next()){var s=a.value;n=n.concat(s)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.setUniform(e,n)},r.prototype.setMatrixNumberArray=function(e,t){this.setUniform(e,t)},r.prototype.getMatrix=function(e){return this.uniforms[e].value},r.prototype.setMatrix=function(e,t){this.setUniform(e,t)},r.prototype.setMatrix3=function(e,t){this.setUniform(e,t)},r.prototype.getVector2=function(e){return this.uniforms[e].value},r.prototype.setVector2=function(e,t){this.setUniform(e,t)},r.prototype.getVector3=function(e){return this.uniforms[e].value},r.prototype.setVector3=function(e,t){this.setUniform(e,t)},r.prototype.getVector4=function(e){return this.uniforms[e].value},r.prototype.setVector4=function(e,t){this.setUniform(e,t)},r.prototype.getFloat=function(e){return this.uniforms[e].value},r.prototype.setFloat=function(e,t){this.setUniform(e,t)},r.prototype.getFloats=function(e){return this.uniforms[e].value},r.prototype.setFloats=function(e,t){this.setUniform(e,t)},r.prototype.getInt=function(e){return this.uniforms[e].value},r.prototype.setInt=function(e,t){this.setUniform(e,t)},r.prototype.hasUniform=function(e){return!!this.uniforms[e]},r.prototype.setUniform=function(e,t){var r=new i.Uniform(t);this.uniforms[e]=this.material.uniforms[e]=r},r.prototype.enableKeyword=function(e){throw new Error("Method not implemented.")},r.prototype.disableKeyword=function(e){throw new Error("Method not implemented.")},r.prototype.isKeywordEnabled=function(e){throw new Error("Method not implemented.")},r.prototype.clone=function(e){throw new Error("Method not implemented.")},r.prototype.cloneUniforms=function(e){throw new Error("Method not implemented.")},r.prototype.dispose=function(e){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},r}(_O),qP=function(e){function t(t){var r=e.call(this,t)||this;return r.semantics.setSemantic(lS),r.semantics.setSemantic(fS),r.semantics.setSemantic(hS),r.semantics.setSemantic(pS),r}return tS(t,e),t.prototype.setRenderPasses=function(e){this._renderPasses=JS(e.slice())},t.prototype.addRenderPass=function(e){$S(this._renderPasses,e)},t.prototype.createResource=function(){this.resource={}},t.prototype.createCopyMesh=function(e){},t.prototype.addMeshToDefaultRenderPass=function(e){var t,r=e.material.material,n=r.uniforms,o=e.material.uniformSemantics;if(this.threeCamera){var a=this.threeCamera,s=(new i.Matrix4).multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse);t={effects_ObjectToWorld:e.mesh.matrixWorld,effects_MatrixV:a.matrixWorldInverse,effects_MatrixVP:s,effects_MatrixInvV:a.matrixWorld}}else{a=this.camera;t={effects_MatrixV:a.getViewMatrix(),effects_MatrixVP:a.getViewProjectionMatrix(),effects_MatrixInvV:a.getInverseViewMatrix()}}Object.keys(o).forEach((function(e){t[e]&&HP(n,e,t[e])})),r.uniformsNeedUpdate=!0,this.group.add(e.mesh)},t.prototype.removeMeshFromDefaultRenderPass=function(e){this.group.remove(e.mesh)},t.prototype.updateMatrix=function(){var e=this.group,t=this.threeCamera;t&&e.children.forEach((function(e){var r=e.material,n=r.uniforms,o=(new i.Matrix4).multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse);HP(n,"effects_ObjectToWorld",e.matrixWorld),HP(n,"effects_MatrixVP",o),r.uniformsNeedUpdate=!0}))},t.prototype.updateUniform=function(){var e=this.group,t=this.camera;e.children.forEach((function(e){var r=e.material;HP(r.uniforms,"effects_MatrixInvV",t.getInverseViewMatrix()),HP(r.uniforms,"effects_MatrixVP",t.getViewProjectionMatrix()),HP(r.uniforms,"effects_MatrixV",t.getViewMatrix()),r.uniformsNeedUpdate=!0}))},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.group&&this.group.clear()},t}(Tb),KP=function(t){function r(r,i){void 0===i&&(i={});var n=t.call(this)||this;if(r){var o=r.width,a=void 0===o?1:o,s=r.height,u=void 0===s?1:s;n.texture=n.createTextureByType(rS(rS({},i),{sourceType:e.TextureSourceType.data,data:r})),n.width=a,n.height=u}else n.texture=n.createTextureByType(i);return n.texture.needsUpdate=!0,n}return tS(r,t),r.toThreeJsTextureFilter=function(e){return e===xS.LINEAR?i.LinearFilter:i.NearestFilter},r.toThreeJsTextureWrap=function(e){switch(e){case xS.MIRRORED_REPEAT:return i.MirroredRepeatWrapping;case xS.REPEAT:return i.RepeatWrapping;default:return i.ClampToEdgeWrapping}},r.prototype.updateSource=function(e){this.texture.dispose(),this.texture=this.createTextureByType(e),this.texture.needsUpdate=!0},r.prototype.startVideo=function(){return iS(this,void 0,void 0,(function(){var t;return nS(this,(function(r){switch(r.label){case 0:return this.sourceType!==e.TextureSourceType.video?[3,2]:(t=this.texture.source.data).paused?[4,t.play()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r.prototype.assembleOptions=function(t){var n=t.target,o=void 0===n?xS.TEXTURE_2D:n;return t.sourceType||(t.sourceType="image"in t?e.TextureSourceType.image:"data"in t?e.TextureSourceType.data:"video"in t?e.TextureSourceType.video:e.TextureSourceType.none),rS(rS({target:o,format:i.RGBAFormat,type:i.UnsignedByteType},t),{minFilter:r.toThreeJsTextureFilter(t.minFilter),magFilter:r.toThreeJsTextureFilter(t.magFilter),wrapS:r.toThreeJsTextureWrap(t.wrapS),wrapT:r.toThreeJsTextureWrap(t.wrapT)})},r.prototype.dispose=function(){this.texture.dispose()},r.prototype.createTextureByType=function(t){var r,n,o=this.assembleOptions(t),a=o.flipY,s=o.type,u=o.wrapS,c=o.wrapT,l=o.minFilter,f=o.magFilter,h=o.sourceType,p=i.UVMapping,d=o.format,m=void 0;if(this.sourceType=h,h===e.TextureSourceType.data){var v=t.data;m=new i.DataTexture(v.data,v.width,v.height,d,s,p,u,c,f,l),this.width=v.width,this.height=v.height}else if(h===e.TextureSourceType.image){var y=t.image;m=new i.Texture(y,p,u,c,f,l,d,s),this.width=y.width,this.height=y.height}else if(h===e.TextureSourceType.compressed){var g=0,x=0,T=t.mipmaps.map((function(e){var t=e.data,r=e.width,i=e.height;return g=g<r?r:g,x=x<i?i:x,{data:t,width:r,height:i,colorSpace:"srgb"}}));d=i.RGBA_ASTC_4x4_Format,m=new i.CompressedTexture(T,g,x,d,s,p,u,c,f,l),this.width=g,this.height=x}else if(h===e.TextureSourceType.video)m=new i.VideoTexture(t.video,p,u,c,f,l,d,s);else if(h===e.TextureSourceType.framebuffer){if(v=t.data){var E=null!==(r=v.width)&&void 0!==r?r:0,_=null!==(n=v.height)&&void 0!==n?n:0;m=new i.FramebufferTexture(E,_,d),this.width=E,this.height=_}}else h===e.TextureSourceType.none&&((m=new i.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=i.MirroredRepeatWrapping,m.wrapT=i.MirroredRepeatWrapping,this.width=this.height=1);if(m)return m.flipY=!!a,m;throw new Error("使用未知的数据类型创建纹理")},r}(oO),QP=function(e){function t(r,i){var n,o=e.call(this,r,i)||this;return null===(n=o.compositionSourceManager.sourceContent)||void 0===n||n.items.forEach((function(e){var r=e.content.renderer.shape;r&&Object.keys(r).forEach((function(e){var i=r[e];t.shape[e]||(t.shape[e]=0),t.shape[e]+=i.length}))})),o.content.start(),o}return tS(t,e),t.prototype.createRenderFrame=function(){this.renderFrame=new qP({camera:this.camera,keepColorBuffer:this.keepColorBuffer,renderer:this.renderer})},t.prototype.updateVideo=function(){this.textures.map((function(e){return e.startVideo()}))},t.prototype.updateCamera=function(){var e=this.renderFrame;e.threeCamera?e.updateMatrix():e.updateUniform()},t.prototype.getRendererOptions=function(){var e=KP.createWithData(this.renderer.engine,{data:new Uint8Array(4).fill(255),width:1,height:1});return e.texture.needsUpdate=!0,this.rendererOptions||(this.rendererOptions={emptyTexture:e,cachePrefix:"-"}),this.rendererOptions},t.shape={},t}(BP),JP=1,$P=function(e){function t(t,r){var n=this,o=r.drawStart,a=void 0===o?0:o,s=r.drawCount,u=r.indices,c=r.mode,l=r.name,f=void 0===l?"effectsGeometry:".concat(JP++):l;(n=e.call(this,f)||this).attributes={},n.destroyed=!1,n.attributesName=[],n.mode=null!=c?c:xS.TRIANGLES;var h=[],p={},d=new i.BufferGeometry;return Object.keys(r.attributes).forEach((function(e){var t=r.attributes[e];if("dataSource"in t){var o=t.dataSource;if(o){void 0===p[o]&&n.setAttributeType(o,t,d,p,r.maxVertex);var a=t.size,s=t.offset,u=t.normalize,c=p[o],l=c.buffer,f=c.dataLength,m=new i.InterleavedBufferAttribute(l,a,(null!=s?s:0)/f,u);d.setAttribute(e,m),p[e]={buffer:l,attribute:m,type:c.type,dataLength:f}}}else n.setAttributeType(e,t,d,p,r.maxVertex);h.push(e)})),u&&u.data&&d.setIndex(new i.BufferAttribute(u.data,1)),n.geometry=d,n.attributes=p,n.attributesName=h,n.drawStart=a,n.drawCount=null!=s?s:0,n}return tS(t,e),Object.defineProperty(t.prototype,"drawCount",{get:function(){return this.geometry.drawRange.count},set:function(e){this.geometry.drawRange.count=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"drawStart",{get:function(){return this.geometry.drawRange.start},set:function(e){this.geometry.drawRange.start=e},enumerable:!1,configurable:!0}),t.prototype.getAttributeData=function(e){if(null!=this.attributes[e])return this.attributes[e].buffer.array},t.prototype.setAttributeData=function(e,t){if(null!=this.attributes[e]){var r=this.attributes[e].buffer;r.updateRange.count=t.length,r.updateRange.offset=0,r.set(t,0),this.geometry.attributes[e].needsUpdate=!0}},t.prototype.setAttributeSubData=function(e,t,r){null!=this.attributes[e]&&(this.attributes[e].buffer.set(r,t),this.geometry.attributes[e].needsUpdate=!0)},t.prototype.getAttributeStride=function(e){var t=this.attributes[e];return t.buffer.stride*NO[t.type]},t.prototype.getAttributeNames=function(){return this.attributesName},t.prototype.getIndexData=function(){var e=this.geometry.getIndex();return null===e?void 0:e.array},t.prototype.setIndexData=function(e){e&&(this.geometry.setIndex(new i.BufferAttribute(e,1)),this.geometry.index.needsUpdate=!0)},t.prototype.setIndexSubData=function(e,t){var r=this.geometry.getIndex();if(null!==r){var i=e,n=e+t.length;if(r.count<n){var o=new t.constructor(end);o.set(r.array),r.array=o}r.array.set(t,i),this.geometry.index.needsUpdate=!0}},t.prototype.setDrawStart=function(e){this.drawStart=e},t.prototype.getDrawStart=function(){return this.drawStart},t.prototype.setDrawCount=function(e){this.drawCount=e},t.prototype.getDrawCount=function(){return this.drawCount},t.prototype.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},t.prototype.setAttributeType=function(e,t,r,n,o){var a,s=t,u=s.size,c=s.offset,l=s.normalize,f=s.type,h=void 0===f?xS.FLOAT:f,p=t,d=p.stride,m=p.data;if(h&&!m&&(m=DO(h)),m){d="aSprite"===e?12:null!=d?d:0;var v=m instanceof Float32Array?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,y=d/v;if(o){var g=o*d+(null!==(a=QP.shape[e])&&void 0!==a?a:0);0===m.length&&(m=m instanceof Float32Array?new Float32Array(g):new Uint16Array(g))}var x=new i.InterleavedBuffer(m,y),T=new i.InterleavedBufferAttribute(x,u,(null!=c?c:0)/v,l);r.setAttribute(e,T),n[e]={buffer:x,attribute:T,type:h,dataLength:v}}},t}(FO),eM=function(t){function r(e,r){var n=this,o=r.material,a=r.geometry,s=r.priority,u=void 0===s?0:s;return(n=t.call(this,e,r)||this).geometry=a,n.material=o,a.mode===xS.LINES?n.mesh=new i.LineSegments(a.geometry,o.material):n.mesh=new i.Mesh(a.geometry,o.material),n.worldMatrix=n.mesh.matrixWorld,n.priority=u,n}return tS(r,t),Object.defineProperty(r.prototype,"priority",{get:function(){return this.mesh.renderOrder},set:function(e){this.mesh&&(this.mesh.renderOrder=e)},enumerable:!1,configurable:!0}),r.prototype.setVisible=function(e){this.mesh.visible=!e},r.prototype.getVisible=function(){return!this.mesh.visible},r.prototype.firstGeometry=function(){return this.geometry},r.prototype.setMaterial=function(t,r){r!==e.DestroyOptions.keep&&this.material.dispose(r),this.material=t,this.mesh.material=t.material},r.prototype.restore=function(){},r.prototype.dispose=function(e){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},r}(zO),tM=function(e){function t(t){var r=e.call(this)||this;return r.gpuCapability=new Cb(t),r}return tS(t,e),t}(kP),rM=function(e){function t(t){var r=e.call(this)||this;return r.engine=new tM(t),r}return tS(t,e),t}(Mb),iM=function(e){function t(t,r){var i=e.call(this)||this,n=r.width,o=r.height,a=r.camera;return i.renderer=new rM(t),i.width=n,i.height=o,i.camera=a,i}return tS(t,e),Object.defineProperty(t.prototype,"currentComposition",{get:function(){return this.compositions[0]},enumerable:!1,configurable:!0}),t.prototype.loadScene=function(e,t){return iS(this,void 0,void 0,(function(){var t,r;return nS(this,(function(i){switch(i.label){case 0:return[4,new PP({}).loadScene(e)];case 1:return t=i.sent(),(r=new QP({renderer:this.renderer,width:this.width,height:this.height},t)).renderFrame.group=this,r.renderFrame.threeCamera=this.camera,this.compositions=[r],[2]}}))}))},t.prototype.update=function(e){this.compositions.forEach((function(t){t.update(e)}))},t}(i.Group);Hb(8),oO.create=function(e,t){return new KP(void 0,t)},oO.createWithData=function(e,t,r){return new KP(t,r)},_O.create=function(e,t){return new ZP(e,t)},FO.create=function(e,t){return new $P(e,t)},zO.create=function(e,t){return new eM(e,t)};console.info({content:"[Galacean Effects THREEJS] version: 0.0.1-alpha.3",type:sO}),e.AbstractPlugin=LC,e.AssetManager=PP,e.BYTES_TYPE_MAP=NO,e.BezierSegments=ZR,e.COMPRESSED_TEXTURE=Ib,e.CONSTANT_MAP_BLEND=GP,e.CONSTANT_MAP_DEPTH=WP,e.CONSTANT_MAP_STENCIL_FUNC=jP,e.CONSTANT_MAP_STENCIL_OP=XP,e.COPY_FRAGMENT_SHADER=bO,e.COPY_MESH_SHADER_ID=CO,e.COPY_VERTEX_SHADER=OO,e.CalculateItem=tL,e.CalculateLoader=II,e.CalculateVFXItem=wI,e.Camera=pw,e.CameraController=IC,e.CameraVFXItem=PC,e.CameraVFXItemLoader=wC,e.Composition=BP,e.CompositionSourceManager=IP,e.CurveValue=WR,e.DEFAULT_FONTS=GI,e.DEG2RAD=vS,e.Downloader=KC,e.EFFECTS_COPY_MESH_NAME=RO,e.EVENT_TYPE_CLICK=NC,e.EVENT_TYPE_TOUCH_END=UC,e.EVENT_TYPE_TOUCH_MOVE=DC,e.EVENT_TYPE_TOUCH_START=FC,e.Engine=kP,e.EventSystem=kC,e.FILTER_NAME_NONE=mS,e.FilterSpriteVFXItem=sL,e.Float16ArrayWrapper=LA,e.FrameBuffer=Pb,e.GPUCapability=Cb,e.Geometry=FO,e.GlobalUniforms=Sb,e.GradientValue=XR,e.HELP_LINK=yS,e.InteractBehavior=BC,e.InteractItem=Bb,e.InteractLoader=Ub,e.InteractMesh=Nb,e.InteractVFXItem=Fb,e.KTXTexture=hO,e.LOG_TYPE=sO,e.LineSegments=HR,e.LinearValue=jR,e.Material=_O,e.MaterialDataBlock=yO,e.Mesh=zO,e.NumberEpsilon=QA,e.PLAYER_OPTIONS_ENV_EDITOR=dS,e.POST_PROCESS_SETTINGS="post_process_settings",e.ParticleLoader=bI,e.ParticleMesh=uL,e.ParticleSystem=vI,e.ParticleVFXItem=OI,e.PassTextureCache=MO,e.PathSegments=YR,e.PluginSystem=bC,e.QCanvasViewer=DI,e.QText=FI,e.RENDER_PASS_NAME_PREFIX=gb,e.RENDER_PREFER_LOOKUP_TEXTURE=uO,e.RUNTIME_ENV="runtime_env",e.RandomSetValue=kR,e.RandomValue=zR,e.RandomVectorValue=GR,e.RenderBuffer=Ab,e.RenderFrame=Tb,e.RenderPass=HO,e.RenderPassPriorityNormal=GO,e.RenderPassPriorityPostprocess=3e3,e.RenderPassPriorityPrepare=0,e.RenderTargetHandle=XO,e.Renderer=Mb,e.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0=hS,e.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0=pS,e.SEMANTIC_PRE_COLOR_ATTACHMENT_0=lS,e.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0=fS,e.SPRITE_VERTEX_STRIDE=uS,e.SemanticMap=VO,e.Shader=AO,e.SpriteItem=nL,e.SpriteLoader=Qb,e.SpriteMesh=zb,e.SpriteVFXItem=oL,e.StaticValue=BR,e.TEMPLATE_USE_OFFSCREEN_CANVAS=cO,e.TEXTURE_UNIFORM_MAP=YP,e.TextItem=$I,e.TextLoader=tw,e.TextMesh=PI,e.TextVFXItem=ew,e.Texture=oO,e.TextureFactory=mO,e.ThreeComposition=QP,e.ThreeDisplayObject=iM,e.ThreeMaterial=ZP,e.ThreeTexture=KP,e.Ticker=zP,e.TimelineComponent=uC,e.Transform=TC,e.VFXItem=EC,e.VFX_ITEM_TYPE_TREE=cS,e.ValueGetter=UR,e.addByOrder=$S,e.addItem=kS,e.addItemWithOrder=GS,e.alphaFrameFrag=$O,e.alphaMaskFrag=eb,e.assertExist=rA,e.asserts=function(e,t){if(void 0===t&&(t="asserts failed"),!e)throw new Error(t)}
|
|
14
|
+
*/!function(t){t.S="S",t.APlus="A+",t.A="A",t.BPlus="B+",t.B="B"}(zM||(zM={})),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"}(UM||(UM={})),function(t){t[t.DOUBLE=1032]="DOUBLE",t[t.FRONT=1028]="FRONT",t[t.BACK=1029]="BACK"}(BM||(BM={})),function(t){t[t.NONE=0]="NONE",t[t.MASK=1]="MASK",t[t.OBSCURED=2]="OBSCURED",t[t.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(kM||(kM={})),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"}(GM||(GM={})),function(t){t[t.GYROSCOPE=0]="GYROSCOPE",t[t.SPINE=1]="SPINE"}(jM||(jM={})),function(t){t[t.CLICK=0]="CLICK",t[t.MESSAGE=1]="MESSAGE",t[t.DRAG=2]="DRAG"}(XM||(XM={})),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"}(YM||(YM={})),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"}(WM||(WM={})),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"}(HM||(HM={})),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"}(ZM||(ZM={}));var QM,KM,JM,$M,tI,eI,rI,iI,nI,oI,aI,sI,uI,cI,lI,hI,fI,pI=0;!function(t){t[t.portrait=1]="portrait",t[t.landscape=pI]="landscape"}(QM||(QM={})),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"}(KM||(KM={})),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"}(JM||(JM={})),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"}($M||($M={})),function(t){t[t.destroy=0]="destroy",t[t.loop=5]="loop",t[t.freeze=4]="freeze"}(tI||(tI={})),function(t){t[t.destroyChildren=6]="destroyChildren"}(eI||(eI={})),function(t){t[t.none=0]="none",t[t.removeParticle=1]="removeParticle"}(rI||(rI={})),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"}(iI||(iI={})),function(t){t[t.box=2]="box",t[t.sphere=3]="sphere"}(nI||(nI={})),function(t){t.unlit="unlit",t.pbr="pbr",t.hair="hair"}(oI||(oI={})),function(t){t[t.opaque=100]="opaque",t[t.masked=101]="masked",t[t.translucent=102]="translucent",t[t.additive=103]="additive"}(aI||(aI={})),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"}(sI||(sI={})),function(t){t[t.display=0]="display",t[t.clip=1]="clip",t[t.ellipsis=2]="ellipsis"}(uI||(uI={})),function(t){t[t.top=0]="top",t[t.middle=1]="middle",t[t.bottom=2]="bottom"}(cI||(cI={})),function(t){t[t.left=0]="left",t[t.middle=1]="middle",t[t.right=2]="right"}(lI||(lI={})),function(t){t.normal="normal",t.bold="bold",t.lighter="lighter"}(hI||(hI={})),function(t){t.normal="normal",t.italic="italic",t.oblique="oblique"}(fI||(fI={}));var dI=function(){return dI=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},dI.apply(this,arguments)};function mI(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 vI(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function yI(t,e){if(!t.includes(e))return t.push(e),!0}function gI(t,e,r){if(t)for(var i in t)Object.hasOwnProperty.call(t,i)&&e.call(r,t[i],i);return t}function xI(t){if(Number.isFinite(t))return[JM.CONSTANT,t];if(t){if("lines"===t[0])return[JM.LINE,t[1]];if("curve"===t[0])return[JM.CURVE,t[1]];if("static"===t[0])return[JM.CONSTANT,t[1]]}}function TI(t,e){return Array.isArray(t)&&"random"===t[0]?[JM.CONSTANT,t[1][e]]:xI(t)}function EI(t){return t&&"color"===t[0]?_I(t[1],!0):[1,1,1,1]}function AI(t,e){if(t){if("colors"===t[0])return[JM.COLORS,t[1].map((function(t){return _I(t,e)}))];if("gradient"===t[0])return SI(t[1],e);if("color"===t[0])return[JM.RGBA_COLOR,_I(t[1],e)]}}function bI(t){return t&&"random"===t[0]?[JM.RANDOM,t[1]]:xI(t)}function SI(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=_I(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]})),[JM.GRADIENT_COLOR,r]}}function _I(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 RI(t,e){return Array.isArray(t)?("gradient"===t[0]||"color"===t[0])&&SI(t[1],e):SI(t,e)}function CI(t){if(t){if(3===t.length)return[JM.CONSTANT_VEC3,t];if("path"===t[0])return[JM.LINEAR_PATH,t[1]];if("bezier"===t[0])return[JM.BEZIER_PATH,t[1]]}}function OI(t){var e,r;try{for(var i=mI(Object.entries(t)),n=i.next();!n.done;n=i.next()){var o=vI(n.value,2),a=o[0],s=o[1];t[a]=Number(s)}}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 wI(t){var e,r;try{for(var i=mI(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 MI=Math.cos,II=Math.sin,LI=Math.PI/180,PI=180/Math.PI;function FI(t){var e,r=t.options,i=t.transform,n={type:GM.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=dI(dI({},t.shape),{type:GM[o]}),t.shape.upDirection){var a=vI(t.shape.upDirection,3),s=a[0],u=a[1],c=a[2];0===s&&0===u&&0===c&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=bI(r.turbulenceX),n.turbulenceY=bI(r.turbulenceY),n.turbulenceZ=bI(r.turbulenceZ));var l=t.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(t){return OI(t)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(t){return OI(t)}))),l.rateOverTime&&(l.rateOverTime=bI(l.rateOverTime));var h={renderer:t.renderer,shape:n,splits:t.splits,emission:l,options:{startLifetime:bI(r.startLifetime),start3DSize:!!r.start3DSize,startSize:bI(r.startSize),startSizeX:bI(r.startSizeX),startSizeY:bI(r.startSizeY),sizeAspect:bI(r.sizeAspect),maxCount:r.maxCount,startDelay:bI(r.startDelay),startColor:AI(r.startColor,!0),startRotationZ:bI(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(h.options.startRotationX=bI(r.startRotationX),h.options.startRotationY=bI(r.startRotationY)),t.filter){var f={};gI(t.filter,(function(t,e){var r;f[e]=(r=t,Array.isArray(r)&&"string"==typeof r[0]&&(bI(r)||CI(r)||AI(r))||r)})),h.filter=f}i&&i.path&&(h.emitterTransform={path:CI(i.path)});var p=t.sizeOverLifetime;p&&(p.separateAxes?h.sizeOverLifetime={separateAxes:!0,x:bI(p.x),y:bI(p.y)}:h.sizeOverLifetime={size:bI(p.size)});var d=t.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?xI(m):void 0,h.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:xI(r.gravityModifier),startSpeed:bI(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:bI(d.linearX),linearY:bI(d.linearY),linearZ:bI(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:bI(d.orbitalX),orbitalY:bI(d.orbitalY),orbitalZ:bI(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:xI(d.forceCurve)},wI(h.positionOverLifetime);var v=t.rotationOverLifetime;v&&(h.rotationOverLifetime={separateAxes:v.separateAxes,asRotation:v.asRotation,z:bI(v.separateAxes?v.z:v.angularVelocity)},v.separateAxes&&(h.rotationOverLifetime.y=xI(v.y),h.rotationOverLifetime.x=xI(v.x)));var y=t.colorOverLifetime;if(y){var g=h.colorOverLifetime={opacity:xI(y.opacity)};y.color&&(g.color=RI(y.color))}var x=t.textureSheetAnimation;x&&(h.textureSheetAnimation={row:x.row,col:x.col,total:x.total,animate:x.animate,cycles:xI(x.cycles),animationDelay:TI(x.animationDelay,0),animationDuration:TI(x.animationDuration,0)});var T=t.trails;T&&(h.trails={lifetime:bI(T.lifetime),dieWithParticles:T.dieWithParticles,maxPointPerTrail:T.maxPointPerTrail,minimumVertexDistance:T.minimumVertexDistance,widthOverTrail:xI(T.widthOverTrail),colorOverTrail:T.colorOverTrail&&RI(T.colorOverTrail,!1),blending:T.blending,colorOverLifetime:T.colorOverLifetime&&RI(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:bI(T.opacityOverLifetime)}),h.trails&&wI(h.trails);var E=t.interaction;return E&&(h.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),h}function VI(t,e){var r,i=t.options,n=t.velocityOverLifetime||{},o={path:CI(null===(r=t.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:xI(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:xI(n.linearX),linearY:xI(n.linearY),linearZ:xI(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:xI(n.orbitalX),orbitalY:xI(n.orbitalY),orbitalZ:xI(n.orbitalZ),speedOverLifetime:xI(n.speedOverLifetime)};wI(o);var a={options:{startColor:EI(i.startColor)},positionOverLifetime:o};i.startSize&&(e.scale=[i.startSize,i.startSize/(i.sizeAspect||1),1]),i.startRotation&&(e.rotation?e.rotation[2]+=i.startRotation:e.rotation=[0,0,i.startRotation]);var s=t.rotationOverLifetime;if(s){var u=a.rotationOverLifetime={separateAxes:s.separateAxes,asRotation:s.asRotation};u.separateAxes?(u.x=xI(s.x),u.y=xI(s.y),u.z=xI(s.z)):u.z=xI(s.angularVelocity)}var c=t.colorOverLifetime;if(c){var l=a.colorOverLifetime={opacity:xI(c.opacity)};c.color&&(l.color=RI(c.color))}var h=t.sizeOverLifetime;return h&&(a.sizeOverLifetime={separateAxes:h.separateAxes,size:xI(h.size),x:xI(h.x),y:xI(h.y),z:xI(h.z)}),a}function NI(t,e){var r=VI(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 DI=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],zI=["path","position"];function UI(t){return t.compositions.forEach((function(t){t.items.forEach((function(t){t.type===WM.null&&t.endBehavior===tI.destroy&&(t.endBehavior=tI.freeze)}))})),t.version="2.1",t}var BI=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,kI=/^(\d+)\.(\d+)$/,GI=!1;function jI(t){var e,r;if(!t||"object"!=typeof t)throw Error("expect a json object");if(function(t){var e,r=null===(e=t.version)||void 0===e?void 0:e.split(".");!r||Number(r[0])>2||2===Number(r[0])&&Number(r[1])>=2||t.compositions.forEach((function(t){t.items.forEach((function(t){t.type!==WM.mesh&&t.type!==WM.light||(t.endBehavior=1===t.endBehavior?tI.destroy:t.endBehavior)}))}))}(t),BI.test(t.version))return GI="0"===(null===(e=/^(\d+)/.exec(t.version))||void 0===e?void 0:e[0]),UI(function(t){var e,r;XI="1.0";var i=t.plugins||[];(null===(e=t.bins)||void 0===e?void 0:e.length)&&(XI="1.3");var n=(t.requires||[]).slice(),o=t.images.map((function(e,r){return YI(e,r,t.imageTags||[])})),a=t.textures||o.map((function(t,e){return{source:e,flipY:!0}})),s={plugins:i,shapes:t.shapes||[],type:"ge",version:XI,playerVersion:null!==(r=t.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:t.compositionId+"",compositions:t.compositions.map((function(t){return WI(t,{plugins:i,requires:n})})),images:o,imgUsage:t._imgs,binUsage:t.binUsage,spines:t.spines,requires:t.requires,textures:a,bins:(t.bins||[]).slice()};t._textures&&(s._textures=t._textures);return s}(t));var i=null===(r=kI.exec(t.version))||void 0===r?void 0:r[1];if(i)return Number(i)<2?UI(t):t;throw Error("invalid json version "+t.version)}var XI="1.0";function YI(t,e,r){var i=r[e],n=t.oriY;if("string"==typeof t)return{renderLevel:i,url:t,oriY:n};if(t.template)return{url:t.url,template:t.template,webp:t.webp,renderLevel:i,oriY:n};if(t.compressed)return{url:t.url,oriY:n,compressed:{astc:t.compressed.android,pvrtc:t.compressed.iOS},webp:t.webp,renderLevel:i};if(t.url)return{url:t.url,type:t.type,webp:t.webp,renderLevel:i,oriY:n,loop:t.loop};if(t&&t.sourceType)return t;throw Error("invalid image type")}function WI(t,e){var r;void 0===e&&(e={});var i={id:t.id+"",camera:Object.assign({clipMode:pI},t.camera),duration:t.duration,endBehavior:t.endBehavior,items:t.items.map((function(t){return QI(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 HI,ZI=[0,0,0,1],qI=.5;function QI(t,e){var r,i,n;void 0===e&&(e={});var o,a,s,u,c,l,h=WM.base,f=t.endBehavior,p=NaN;if(t.content?(h=t.type||WM.plugin,l=t.pn,c=t.pluginName,s=t.content,a=t.content,isNaN(l)&&!c&&(c=s.options.type),t.duration&&(p=t.duration),o=t.transform||y(a.transform),h===WM.filter&&(XI<"1.1"&&(XI="1.1"),(s=NI(a,o)).filter=function(t){var e={};return gI(t,(function(t,r){DI.includes(r)?e[r]=xI(t):zI.includes(r)?e[r]=CI(t):e[r]=t})),e}(a.filter))):t.particle?(h=WM.particle,o=y((a=t.particle).transform,GI,!0),s=FI(a)):t.sprite?(h=WM.sprite,s=NI(a=t.sprite,o=y(a.transform,!1,!0))):t.cal?(h=WM.null,s=VI(a=t.cal,o=y(a.transform,!1,!0))):t.ui?(h=WM.interact,o=y((a=t.ui).transform),s=function(t){var e,r=t.options;switch(r.type){case"click":e={type:XM.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&EI(r.previewColor),behavior:r.behavior||YM.NOTIFY};break;case"drag":e={type:XM.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":e={type:XM.MESSAGE}}return{options:e}}(a),o.scale=[a.options.width||1,a.options.height||1,1]):t.model&&(a=t.model,1===t.model.options.type&&(h=WM.camera,o=y(a.transform),s=function(t){var e,r,i=t.options,n={options:{fov:i.fov,far:i.far,near:i.near,clipMode:i.clipMode}},o=t.velocityOverLifetime;if(o||(null===(e=t.transform)||void 0===e?void 0:e.path)){var a={path:CI(null===(r=t.transform)||void 0===r?void 0:r.path),linearX:xI(null==o?void 0:o.translateX),linearY:xI(null==o?void 0:o.translateY),linearZ:xI(null==o?void 0:o.translateZ)};wI(a),n.positionOverLifetime=a}var s=t.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:xI(null==s?void 0:s.rotateX),y:xI(null==s?void 0:s.rotateY),z:s.separateAxes?xI(null==s?void 0:s.rotateZ):xI(s.rotation)};wI(u),n.rotationOverLifetime=u}return n}(a))),null===(r=s.renderer)||void 0===r?void 0:r.anchor){var d=new Float32Array(s.renderer.anchor);d[0]==qI&&d[1]==qI?delete s.renderer.anchor:e.requires&&yI(e.requires,"anchor")}if(a){var m=null===(i=a.options)||void 0===i?void 0:i.looping;f=m?Array.isArray(m)?m[1]?tI.loop:tI.destroy:tI.loop:f||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||tI.destroy,a.options.renderLevel&&(u=a.options.renderLevel),isNaN(p)&&(p=a.options.duration)}var v={type:h,name:t.name,delay:t.delay,duration:p,id:t.id+"",transform:o,endBehavior:f,renderLevel:u,content:s};return c?e.plugins?(yI(e.plugins,c),v.pn=e.plugins.indexOf(c)):v.pluginName=c:Number.isInteger(l)&&(v.pn=l),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=(a=ZI,s=i.rotation[0],u=i.rotation[1],c=i.rotation[2],l=MI(s*LI/2),h=MI(u*LI/2),f=MI(c*LI/2),p=II(s*LI/2),d=II(u*LI/2),m=II(c*LI/2),a[0]=p*h*f+l*d*m,a[1]=l*d*f-p*h*m,a[2]=l*h*m+p*d*f,a[3]=l*h*f-p*d*m,a);i.rotation=function(t,e){var r=e[0],i=e[1],n=e[2],o=e[3],a=r+r,s=i+i,u=n+n,c=r*a,l=i*a,h=i*s,f=n*u,p=o*u,d=1-h-f,m=l-p,v=l+p,y=1-c-f,g=n*a-o*s,x=n*s+o*a,T=1-c-h;return t[1]=Math.asin(function(t,e,r){return t>r?r:t<e?e:t}(-g,-1,1))*PI,Math.abs(g)<.9999999?(t[0]=Math.atan2(x,T)*PI,t[2]=Math.atan2(v,d)*PI):(t[0]=0,t[2]=Math.atan2(-m,y)*PI),t}([],o)}return t.position&&(i.position=t.position),Array.isArray(t.scale)&&(i.scale=[t.scale[0]||1,t.scale[1]||1,t.scale[2]||1]),i}var a,s,u,c,l,h,f,p,d,m;return{}}}var KI=((HI={})[Eb.S]=[Eb.S,Eb.BPlus,Eb.APlus],HI[Eb.A]=[Eb.A,Eb.BPlus,Eb.APlus],HI[Eb.B]=[Eb.B,Eb.BPlus],HI);function JI(t,e){if(!t||!e)return!0;var r=KI[e];return!!r&&r.includes(t)}var $I=0,tL=function(){function t(t,e){var r,i;this.refCompositions=new Map,this.refCompositionProps=new Map;var n=t.jsonScene,o=t.renderLevel,a=t.textureOptions,s=t.pluginSystem,u=t.totalTime,c=n.compositions,l=n.imgUsage,h=n.compositionId;if(!a)throw new Error("scene.textures expected");var f=a.map((function(t){return t&&(t instanceof wR?t:wR.create(e,t))}));t.textureOptions=f,null==f||f.forEach((function(t){return null==t?void 0:t.initialize()}));try{for(var p=ob(c),d=p.next();!d.done;d=p.next()){var m=d.value;m.id===h?this.composition=m:this.refCompositions.set(m.id,m)}}catch(t){r={error:t}}finally{try{d&&!d.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}if(!this.composition)throw new Error("Invalid composition id: "+h);this.jsonScene=n,this.renderLevel=o,this.pluginSystem=s,this.totalTime=null!=u?u:0,this.imgUsage=null!=l?l:{},this.textures=f,this.mask=0,$I=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,a=t.globalVolume,s=t.startTime,u=void 0===s?0:s,c=this.assembleItems(t);return{id:e,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:c,camera:o,startTime:u,globalVolume:a}},t.prototype.assembleItems=function(t){var e=this,r=[],i=this.mask;return isNaN(i)&&(i=0),t.items.forEach((function(t){var n,o={},a=t.visible,s=t.renderLevel,u=t.type;if(!1!==a){var c=rb({},t.content);if(c&&(o.content=rb({},c),JI(s,e.renderLevel))){var l=o.content;if(o.type=u,l.renderer){if(l.renderer=e.changeTex(l.renderer),!l.renderer.mask){var h=l.renderer.maskMode;h===Sb.MASK?l.renderer.mask=++i:h!==Sb.OBSCURED&&h!==Sb.REVERSE_OBSCURED||(l.renderer.mask=i)}var f=l.splits&&!l.textureSheetAnimation&&l.splits[0];Number.isInteger(l.renderer.shape)?l.renderer.shape=Ow(null===(n=e.jsonScene)||void 0===n?void 0:n.shapes[l.renderer.shape],f):l.renderer.shape&&z_(l.renderer.shape)&&(l.renderer.shape=Ow(l.renderer.shape,f))}else o.content.renderer={order:0};l.trails&&(l.trails=e.changeTex(l.trails)),l.filter&&(l.filter=rb({},l.filter));var p=t.name,d=t.delay,m=void 0===d?0:d,v=t.id,y=t.parentId,g=t.duration,x=t.endBehavior,T=t.pluginName,E=t.pn,A=t.transform,b=t.refCount,S=e.jsonScene.plugins,_=void 0===S?[]:S;if(o.name=p,o.delay=m,o.id=v,y&&(o.parentId=y),o.refCount=b,o.duration=g,o.listIndex=$I++,o.endBehavior=x,T?o.pluginName=T:void 0!==E&&Number.isInteger(E)&&(o.pluginName=_[E]),A&&(o.transform=A),o.type===wb.composition){var R=t.content.options.refId;if(!e.refCompositions.get(R))throw new Error("Invalid Ref Composition id: "+R);e.refCompositionProps.has(R)||e.refCompositionProps.set(R,e.getContent(e.refCompositions.get(R)));var C=e.refCompositionProps.get(R);C.items.forEach((function(t){t.listIndex=$I++})),o.items=C.items}r.push(o)}}})),r},t.prototype.changeTex=function(t){var e=t.texture,r=rb({},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.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}();var eL=1,rL=function(){function e(t,e){void 0===t&&(t={}),void 0===e&&(e=new TR),this.options=t,this.downloader=e,this.assets={},this.id=eL++,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.loadScene=function(t,e,r){var i,n;return ib(this,void 0,void 0,(function(){var o,a,s,u,c,l,h,f,p,d,m,v=this;return nb(this,(function(y){return a="Load asset: ".concat(V_(t)?t:this.id),s=performance.now(),u=[],c=null==e?void 0:e.engine.gpuCapability,l=null!==(n=null===(i=null==c?void 0:c.detail)||void 0===i?void 0:i.asyncShaderCompile)&&void 0!==n&&n,f=!1,p=new Promise((function(e,r){return h=window.setTimeout((function(){f=!0,r("Load time out: ".concat(t))}),1e3*v.timeout)})),d=function(t,e){return ib(v,void 0,void 0,(function(){var r,i;return nb(this,(function(n){switch(n.label){case 0:return f?[3,2]:(r=performance.now(),[4,e()]);case 1:return i=n.sent(),u.push("[".concat(t,": ").concat((performance.now()-r).toFixed(2),"]")),[2,i];case 2:throw new Error("load canceled.")}}))}))},m=function(){return ib(v,void 0,void 0,(function(){var i,n,f,p,m,v,y,g,x,T,E,A,b,S,_=this;return nb(this,(function(R){switch(R.label){case 0:return z_(t)?(o=t,this.baseUrl=location.href,[3,3]):[3,1];case 1:return t=new URL(t,location.href).href,this.baseUrl=t,[4,d("loadJSON",(function(){return _.loadJSON(t)}))];case 2:o=R.sent(),R.label=3;case 3:return[4,d("processJSON",(function(){return _.processJSON(o)}))];case 4:return i=R.sent(),n=i.usedImages,f=i.jsonScene,p=f.bins,m=void 0===p?[]:p,v=f.images,y=f.compositions,g=f.fonts,[4,Promise.all([d("processBins",(function(){return _.processBins(m)})),d("processImages",(function(){var t;return _.processImages(v,n,null!==(t=null==c?void 0:c.detail.compressedTexture)&&void 0!==t?t:0)})),d("".concat(l?"async":"sync"," compile"),(function(){return _.precompile(y,e,r)}))])];case 5:return x=ab.apply(void 0,[R.sent(),2]),T=x[0],E=x[1],[4,d("processFontURL",(function(){return _.processFontURL(g)}))];case 6:return R.sent(),[4,d("processTextures",(function(){return _.processTextures(E,T,f)}))];case 7:return A=R.sent(),b={jsonScene:f,images:E,textureOptions:A,bins:T,storage:{},pluginSystem:this.pluginSystem,renderLevel:this.options.renderLevel,totalTime:0,startTime:0,url:t},[4,d("processPlugins",(function(){return _.pluginSystem.loadResources(b,_.options)}))];case 8:return R.sent(),S=performance.now()-s,console.info({content:"".concat(a,": ").concat(S.toFixed(4),"ms, ").concat(u.join(" ")),type:IR}),window.clearTimeout(h),b.totalTime=S,b.startTime=s,[2,b]}}))}))},[2,Promise.race([p,m()])]}))}))},e.prototype.precompile=function(t,e,r){return ib(this,void 0,void 0,(function(){var i;return nb(this,(function(n){switch(n.label){case 0:return e&&e.getShaderLibrary()?(i=null==e?void 0:e.getShaderLibrary(),[4,this.pluginSystem.precompile(t,e,r)]):[2];case 1:return n.sent(),[4,new Promise((function(t){i.compileAllShaders((function(){t(null)}))}))];case 2:return n.sent(),[2]}}))}))},e.prototype.processJSON=function(t){return ib(this,void 0,void 0,(function(){var e,r,i,n,o,a,s,u;return nb(this,(function(c){switch(c.label){case 0:return e=jI(t),t.compositions.forEach((function(t,r){t.globalVolume&&(e.compositions[r].globalVolume=t.globalVolume)})),r=e.plugins,i=void 0===r?[]:r,n=e.compositions,o=e.imgUsage,a=e.images,this.pluginSystem=new J_(i),[4,this.pluginSystem.processRawJSON(e,this.options)];case 1:return c.sent(),s=this.options.renderLevel,u={},o?function(t,e,r,i,n){for(var o=0;o<e.length;o++){var a=r[e[o].id];if(a)for(var s=0;s<a.length;s++){var u=a[s];JI(i[u].renderLevel,n)&&(t[u]=!0)}}}(u,n,o,a,s):null==a||a.forEach((function(t,e){u[e]=!0})),[2,{usedImages:u,jsonScene:e}]}}))}))},e.prototype.processBins=function(t){return ib(this,void 0,void 0,(function(){var e,r,i=this;return nb(this,(function(n){return e=this.options.renderLevel,r=t.map((function(r){if(r instanceof ArrayBuffer)return r;if(JI(r.renderLevel,e))return i.loadBins(r.url);throw new Error("Invalid bins source: ".concat(t))})),[2,Promise.all(r)]}))}))},e.prototype.processFontURL=function(t){return ib(this,void 0,void 0,(function(){var r,i=this;return nb(this,(function(n){return t?(r=t.map((function(t){return ib(i,void 0,void 0,(function(){var r,i;return nb(this,(function(n){switch(n.label){case 0:if(!t.fontURL||e.fonts.has(t.fontFamily))return[3,4];r=new FontFace(null!==(i=t.fontFamily)&&void 0!==i?i:"","url("+t.fontURL+")"),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,r.load()];case 2:return n.sent(),document.fonts.add(r),e.fonts.add(t.fontFamily),[3,4];case 3:return n.sent(),console.warn({content:"Invalid fonts source: ".concat(t.fontURL),type:IR}),[3,4];case 4:return[2]}}))}))})),[2,Promise.all(r)]):[2]}))}))},e.prototype.processImages=function(e,r,i){return ib(this,void 0,void 0,(function(){var n,o,a,s,u,c=this;return nb(this,(function(l){return n=this.options,o=n.useCompressedTexture,a=n.variables,s=this.baseUrl,u=e.map((function(e,n){return ib(c,void 0,void 0,(function(){var u,c,l,h,f,p,d,m,v,y,g,x,T,E,A,b,S,_,R;return nb(this,(function(C){switch(C.label){case 0:if(!r[n])return[3,19];if(u=e.url,c=e.webp,l=new URL(u,s).href,h=c&&new URL(c,s).href,!("template"in e))return[3,16];if(f=e.template,p=void 0,!("v"in f)||2!==f.v||!f.background)return[3,9];if(!((d=yM(f,a))instanceof Array))return[3,6];m=f.background.name,C.label=1;case 1:return C.trys.push([1,3,,5]),S={},[4,bR(d[0])];case 2:return S.image=C.sent(),S.url=d[0],p=S,[3,5];case 3:return C.sent(),_={},[4,bR(d[1])];case 4:return _.image=C.sent(),_.url=d[1],p=_,[3,5];case 5:return a&&(a[m]=p.url),[3,8];case 6:return"string"!=typeof d?[3,8]:(R={},[4,bR(d)]);case 7:R.image=C.sent(),R.url=d,p=R,C.label=8;case 8:return[3,11];case 9:return[4,AR(l,h)];case 10:p=C.sent(),C.label=11;case 11:v=void 0,C.label=12;case 12:return C.trys.push([12,14,,15]),[4,EM(p.image,f,a,this.options,-1===e.oriY)];case 13:return v=C.sent(),[3,15];case 14:throw C.sent(),new Error("image template fail: ".concat(l));case 15:return[2,v];case 16:if("type"in e&&"video"===e.type)return y=e.loop,[2,_R(e.url,{loop:y})];if("compressed"in e&&o&&i){if(g=e.compressed,x=void 0,i===tO.ASTC?x=g.astc:i===tO.PVRTC&&(x=g.pvrtc),x)return T=new URL(x,s).href,this.assets[n]={url:T,type:t.TextureSourceType.compressed},[2,this.loadBins(T)]}else{if("sourceType"in e)return[2,e];if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof wR)return[2,e]}C.label=17;case 17:return[4,AR(l,h)];case 18:return E=C.sent(),A=E.url,b=E.image,this.assets[n]={url:A,type:t.TextureSourceType.image},[2,b];case 19:return[2,void 0]}}))}))})),[2,Promise.all(u)]}))}))},e.prototype.processTextures=function(e,r,i){var n;return ib(this,void 0,void 0,(function(){var o,a,s=this;return nb(this,(function(u){return o=null!==(n=i.textures)&&void 0!==n?n:e.map((function(t,e){return{source:e}})),a=o.map((function(n,o){if(n instanceof wR)return n;if("mipmaps"in n)try{return RR(n,r,i.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 wR)return e.source;if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement)return{image:e,sourceType:t.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:yb.LINEAR,magFilter:yb.LINEAR};if(e instanceof HTMLVideoElement)return{sourceType:t.TextureSourceType.video,video:e,minFilter:yb.LINEAR,magFilter:yb.LINEAR};if(e instanceof ArrayBuffer)return rb(rb({},DR(e)),{sourceFrom:r});if("width"in e&&"height"in e&&"data"in e)return{sourceType:t.TextureSourceType.data,data:e,wrapS:yb.CLAMP_TO_EDGE,wrapT:yb.CLAMP_TO_EDGE,minFilter:yb.NEAREST,magFilter:yb.NEAREST};throw new Error("Invalid texture options")}(u,s.assets[o]);return c.sourceType===t.TextureSourceType.compressed?c:rb(rb({},c),n)}throw new Error("Invalid texture source: ".concat(a))})),[2,Promise.all(a)]}))}))},e.prototype.loadJSON=function(t){return ib(this,void 0,void 0,(function(){var e=this;return nb(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadJSON(t,r,(function(e,r){i("Couldn't load JSON ".concat(t,": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.loadBins=function(t){return ib(this,void 0,void 0,(function(){var e=this;return nb(this,(function(r){return[2,new Promise((function(r,i){e.downloader.downloadBinary(t,r,(function(e,r){i("Couldn't load bins ".concat(t,": status ").concat(e,", ").concat(r))}))}))]}))}))},e.prototype.dispose=function(){var t;for(var e in this.assets){var r=this.assets[e];null===(t=null==r?void 0:r.dispose)||void 0===t||t.call(r)}this.assets={}},e.fonts=new Set,e}();var iL,nL,oL,aL,sL=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.items=[],t.itemTree=[],t.itemCacheMap=new Map,t.itemsToRemove=[],t.tempQueue=[],t}return eb(r,e),Object.defineProperty(r.prototype,"type",{get:function(){return wb.composition},enumerable:!1,configurable:!0}),r.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;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)},r.prototype.createContent=function(){if(!this.items.length&&this.composition)for(var e=0;e<this.itemProps.length;e++){var i=void 0,n=this.itemProps[e];if(t.Item.isComposition(n)){var o=n.content.options.refId,a=this.composition.refCompositionProps.get(o);if(!a)throw new Error("引用的Id: ".concat(o," 的预合成不存在"));a.name=n.name,a.duration=n.duration,a.endBehavior=n.endBehavior,a.delay=n.delay,a.parentId=n.parentId,a.content=n.content,(i=new r(a,this.composition)).contentProps=n.content,i.transform.parentTransform=this.transform,this.composition.refContent.push(i),5===i.endBehavior&&(this.composition.autoRefTex=!1)}else(i=W_(this.itemProps[e],this.composition)).transform.parentTransform=this.transform;Y_.isExtraCamera(i)&&(this.extraCamera=i),this.items.push(i),this.tempQueue.push(i)}!this.content&&this.contentProps&&(this._content=this.doCreateContent())},r.prototype.doCreateContent=function(){var t=new SO(this.contentProps,this);return t.renderData=t.getRenderData(0,!0),t},r.prototype.onLifetimeBegin=function(){var t;null===(t=this.items)||void 0===t||t.forEach((function(t){t.start(),t.createContent()})),this.buildItemTree()},r.prototype.doStop=function(){this.items&&this.items.forEach((function(t){return t.stop()}))},r.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 a=n.itemCacheMap.get(i.parentId);a?(a.children.splice(a.children.indexOf(i),1),o.forEach((function(t){return n.setItemParent(t.item,a.item)}))):(o.forEach((function(t){return n.setItemParent(t.item,void 0)})),(e=n.itemTree).push.apply(e,sb([],ab(o),!1)))}else(r=n.itemTree).splice.apply(r,sb([n.itemTree.indexOf(i),1],ab(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 a=0;a<this.itemTree.length;a++){if((u=this.itemTree[a])&&u.item){var s=u.item;Y_.isComposition(s)&&s.ended&&5===s.endBehavior?s.restart():s.onUpdate(t),o.push.apply(o,sb([],ab(u.children),!1))}}for(;o.length;){var u;if((u=o.shift())&&u.item)(s=u.item).onUpdate(t),o.push.apply(o,sb([],ab(u.children),!1)),s.composition||zb(this.itemsToRemove,s)}null===(i=this.extraCamera)||void 0===i||i.onUpdate(t)}},r.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())},r.prototype.reset=function(){e.prototype.reset.call(this),this.itemTree=[],this.itemCacheMap.clear(),this.tempQueue.length=0,this.itemsToRemove.length=0},r.prototype.handleVisibleChanged=function(t){this.items.forEach((function(e){return e.setVisible(t)}))},r.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},r.prototype.removeItem=function(t){var e,r=this;if(this.items.indexOf(t)>-1){if(zb(this.itemsToRemove,t),Y_.isTree(t)||Y_.isNull(t)){var i=6===t.endBehavior,n=Y_.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(Y_.isComposition(e)&&e.items.indexOf(t)>-1)return e.removeItem(t),!0})),!1},r.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=this.transform;else console.error("item has been remove, please set item's parent in valid lifetime")},r.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}}},r.prototype.getItemByName=function(t){var e,r,i=[];try{for(var n=ob(this.items),o=n.next();!o.done;o=n.next()){var a=o.value;a.name===t?i.push(a):Y_.isComposition(a)&&i.push.apply(i,sb([],ab(a.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},r.prototype.isEnded=function(t){return t>=this.durInms},r.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),a=t.get(o);if(a){n={id:r.id,parentId:o,item:r,children:[]};r.parent=a.item,r.transform.parentTransform=a.item.getNodeTransform(r.parentId),a.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()}},r.prototype.getParentIdWithoutSuffix=function(t){var e=t.lastIndexOf("^");return e>-1?t.substring(0,e):t},r.prototype.restart=function(){this.reset(),this.createContent(),this.start()},r}(Y_),uL=1,cL=function(){function e(t,e){var r;this.speed=1,this.loaderData={},this.refContent=[],this.refCompositionProps=new Map,this.assigned=!1,this.destroyed=!1,this.paused=!1,this.lastVideoUpdateTime=0,this.postLoaders=[];var i=t.reusable,n=void 0!==i&&i,o=t.speed,a=void 0===o?1:o,s=t.baseRenderOrder,u=void 0===s?0:s,c=t.renderer,l=t.handlePlayerPause,h=t.handleMessageItem,f=t.handleEnd,p=t.event,d=t.width,m=t.height;this.compositionSourceManager=new tL(e,c.engine),e.jsonScene.imgUsage=void 0,n&&(this.keepResource=!0,e.textures=void 0,e.consumed=!0);var v=this.compositionSourceManager,y=v.sourceContent,g=v.pluginSystem,x=v.imgUsage,T=v.totalTime,E=v.renderLevel,A=v.refCompositionProps;tS(y),this.refCompositionProps=A;var b=new sL(y,this),S=!n&&x;this.transform=new X_({name:this.name}),b.transform=this.transform,this.globalVolume=y.globalVolume,this.width=d,this.height=m,this.renderOrder=u,this.id=uL++,this.renderer=c,this.texInfo=null!=S?S:{},this.event=p,this.statistic={loadTime:null!=T?T:0,loadStart:null!==(r=e.startTime)&&void 0!==r?r:0,firstFrameTime:0},this.reusable=n,this.speed=a,this.renderLevel=E,this.autoRefTex=!this.keepResource&&S&&5!==b.endBehavior,this.content=b,this.name=b.name,this.pluginSystem=g,this.pluginSystem.initializeComposition(this,e),this.camera=new DM(this.name,rb(rb({},null==y?void 0:y.camera),{aspect:d/m})),this.url=e.url,this.assigned=!0,this.handlePlayerPause=l,this.handleMessageItem=h,this.handleEnd=f,this.createRenderFrame(),this.reset()}return 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.gotoAndPlay(this.time)},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(this.startTime)),this.forwardTime(t)},e.prototype.gotoAndStop=function(t){this.gotoAndPlay(t),this.pause()},e.prototype.createRenderFrame=function(){this.renderFrame=new XC({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.forwardTime(t,!0),e&&this.pause()},e.prototype.forwardTime=function(t,e){void 0===e&&(e=!1);for(var r=1e3*(this.startTime+Math.max(0,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.handleEnd)||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 a_((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(e,r,i,n){if(this.isDestroyed)return[];for(var o=[],a=[],s=this.renderFrame.editorTransform,u=s.x,c=s.y,l=a_((e-s.z)/u,(r-s.w)/c,this.camera),h=(null==n?void 0:n.stop)||F_,f=(null==n?void 0:n.skip)||F_,p=(null==n?void 0:n.maxCount)||this.items.length,d=0;d<this.items.length&&a.length<p;d++){var m=this.items[d];if(m.lifetime>=0&&m.lifetime<=1&&!f(m)){var v=m.getHitTestParams(i);if(v){var y=!1,g=new OS;if(v.type===t.HitTestType.triangle)for(var x=v.triangles,T=v.backfaceCulling,E=0;E<x.length;E++){var A=x[E];if(l.intersectTriangle(A,g,T)){y=!0,o.push(g);break}}else if(v.type===t.HitTestType.box){var b=v.center,S=v.size,_=b.clone().addScaledVector(S,.5),R=b.clone().addScaledVector(S,-.5);l.intersectBox({min:_,max:R},g)&&(y=!0,o.push(g))}else if(v.type===t.HitTestType.sphere){b=v.center;var C=v.radius;l.intersectSphere({center:b,radius:C},g)&&(y=!0,o.push(g))}else if(v.type===t.HitTestType.custom){var O=v.collect(l,new CS(e,r));O&&O.length>0&&(O.forEach((function(t){o.push(t)})),y=!0)}if(y){var w={id:m.id,name:m.name,position:o[o.length-1],parentId:m.parentId,hitPositions:o,behavior:v.behavior};if(a.push(w),h(w))return a}}}}return a},e.prototype.addInteractiveItem=function(t,e){var r;if(e===Cb.MESSAGE)return null===(r=this.handleMessageItem)||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===Cb.MESSAGE&&(null===(r=this.handleMessageItem)||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==wb.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=F_)})):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(){console.error({content:"Update disposed composition: ".concat(r.name,"."),type:IR})},this.handlePlayerPause=F_,this.dispose=F_,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.rotate=function(t,e,r){this.content.rotate(t,e,r)},e.prototype.scale=function(t,e,r){this.content.scale(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 ib(this,void 0,void 0,(function(){return nb(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}(),lL=function(){function t(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[]}return t.prototype.addTexture=function(t){this.destroyed||zb(this.textures,t)},t.prototype.removeTexture=function(t){this.destroyed||Ub(this.textures,t)},t.prototype.addMaterial=function(t){this.destroyed||zb(this.materials,t)},t.prototype.removeMaterial=function(t){this.destroyed||Ub(this.materials,t)},t.prototype.addGeometry=function(t){this.destroyed||zb(this.geometries,t)},t.prototype.removeGeometry=function(t){this.destroyed||Ub(this.geometries,t)},t.prototype.addMesh=function(t){this.destroyed||zb(this.meshes,t)},t.prototype.removeMesh=function(t){this.destroyed||Ub(this.meshes,t)},t.prototype.addRenderPass=function(t){this.destroyed||zb(this.renderPasses,t)},t.prototype.removeRenderPass=function(t){this.destroyed||Ub(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&&console.warn({content:"Release GPU memory: ".concat(t.join(", ")),type:IR}),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}(),hL=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=_S(t,1,120),this.interval=Math.floor(1e3/t)-1},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}();Q_("camera",eR,rR,!0),Q_("sprite",EO,OO,!0),Q_("particle",Jw,Kw,!0),Q_("cal",tM,eM,!0),Q_("interact",uO,aO,!0),Q_("filter",EO,MO,!0),Q_("text",_M,SM,!0),Vb(qM);var fL=((iL={})[yb.ONE]=i.OneFactor,iL[yb.ZERO]=i.ZeroFactor,iL[yb.SRC_COLOR]=i.SrcColorFactor,iL[yb.SRC_ALPHA]=i.SrcAlphaFactor,iL[yb.ONE_MINUS_SRC_COLOR]=i.OneMinusSrcColorFactor,iL[yb.ONE_MINUS_SRC_ALPHA]=i.OneMinusSrcAlphaFactor,iL[yb.DST_COLOR]=i.DstColorFactor,iL[yb.DST_ALPHA]=i.DstAlphaFactor,iL[yb.ONE_MINUS_DST_COLOR]=i.OneMinusDstColorFactor,iL[yb.ONE_MINUS_DST_ALPHA]=i.OneMinusDstAlphaFactor,iL),pL=((nL={})[yb.NEVER]=i.NeverStencilFunc,nL[yb.EQUAL]=i.EqualStencilFunc,nL[yb.LESS]=i.LessStencilFunc,nL[yb.LEQUAL]=i.LessEqualStencilFunc,nL[yb.ALWAYS]=i.AlwaysStencilFunc,nL[yb.NOTEQUAL]=i.NotEqualStencilFunc,nL[yb.GREATER]=i.GreaterStencilFunc,nL[yb.GEQUAL]=i.GreaterEqualStencilFunc,nL),dL=((oL={})[yb.KEEP]=i.KeepStencilOp,oL[yb.ZERO]=i.ZeroStencilOp,oL[yb.REPLACE]=i.ReplaceStencilOp,oL[yb.INCR]=i.IncrementStencilOp,oL[yb.DECR]=i.DecrementStencilOp,oL[yb.INCR_WRAP]=i.IncrementWrapStencilOp,oL[yb.DECR_WRAP]=i.IncrementWrapStencilOp,oL[yb.INVERT]=i.InvertStencilOp,oL),mL=((aL={})[yb.NEVER]=i.NeverDepth,aL[yb.ALWAYS]=i.AlwaysDepth,aL[yb.EQUAL]=i.EqualDepth,aL[yb.LESS]=i.LessDepth,aL[yb.LEQUAL]=i.LessEqualDepth,aL[yb.GREATER]=i.GreaterDepth,aL[yb.GEQUAL]=i.GreaterEqualDepth,aL[yb.NOTEQUAL]=i.NotEqualDepth,aL);function vL(t,e,r){t[e]?t[e].value=r:t[e]=new i.Uniform(r)}var yL=["uMaskTex","uSampler0","uSampler1","uSampler2","uSampler3","uSampler4","uSampler5","uSampler6","uSampler7","uSampler8","uSampler9","uSampler10","uSampler11","uSampler12","uSampler13","uSampler14","uSampler15","uColorOverLifetime","uColorOverTrail"],gL=function(e){function r(r,n){var o=e.call(this,n)||this;o.textures={},o.material=new i.RawShaderMaterial,o.uniforms={};for(var a=n.shader,s=r.gpuCapability.level,u=0;u<t.maxSpriteMeshItemCount;u++)o.uniforms["uSampler".concat(u)]=new i.Uniform(null);return o.uniforms.uEditorTransform=new i.Uniform([1,1,0,0]),o.uniforms.effects_ObjectToWorld=new i.Uniform((new i.Matrix4).identity()),o.uniforms.effects_MatrixInvV=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),o.uniforms.effects_MatrixVP=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,-8,1]),o.uniforms.effects_MatrixV=new i.Uniform([1,0,0,0,0,1,0,0,0,0,1,0,0,0,8,1]),o.material=new i.RawShaderMaterial({vertexShader:a.vertex,fragmentShader:a.fragment,alphaToCoverage:!1,depthFunc:i.LessDepth,polygonOffsetFactor:i.ZeroFactor,polygonOffsetUnits:i.ZeroFactor,polygonOffset:!1,uniforms:o.uniforms}),o.material.glslVersion=1===s?i.GLSL1:i.GLSL3,o}return eb(r,e),r.prototype.onSetUniformValue=function(t,e){var r;yL.includes(t)&&(r=e.texture),this.material.uniforms[t]?this.material.uniforms[t].value=r||e:this.material.uniforms[t]=new i.Uniform(r||e)},r.prototype.onRemoveUniformValue=function(t){this.material.uniforms[t]&&(this.material.uniforms[t].value=null)},Object.defineProperty(r.prototype,"blending",{get:function(){return this.material.blending!==i.NoBlending},set:function(t){this.material.blending=t?i.CustomBlending:i.NoBlending},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendFunction",{get:function(){var t=this.material,e=t.blendSrc,r=t.blendDst;return[e,r,t.blendSrcAlpha||e,t.blendDstAlpha||r]},set:function(t){if(t){var e=ab(t,4),r=e[0],i=e[1],n=e[2],o=e[3];this.material.blendSrc=fL[r],this.material.blendDst=fL[i],this.material.blendSrcAlpha=fL[n],this.material.blendDstAlpha=fL[o]}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendEquation",{get:function(){var t=this.material,e=t.blendEquation;return[e,t.blendEquationAlpha||e]},set:function(t){if(t){var e=ab(t,2),r=e[0],i=e[1];this.material.blendEquation=r,this.material.blendEquationAlpha=i}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return this.material.depthTest},set:function(t){this.material.depthTest=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return this.material.depthWrite},set:function(t){this.material.depthWrite=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthFunc",{get:function(){return this.material.depthFunc},set:function(t){void 0!==t&&(this.material.depthFunc=mL[t])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffsetFill",{get:function(){return this.material.polygonOffset},set:function(t){this.material.polygonOffset=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return[this.material.polygonOffsetFactor,this.material.polygonOffsetUnits]},set:function(t){if(t){var e=ab(t,2),r=e[0],i=e[1];this.material.polygonOffsetFactor=r,this.material.polygonOffsetUnits=i}},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sampleAlphaToCoverage",{get:function(){return this.material.alphaToCoverage},set:function(t){this.material.alphaToCoverage=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilTest",{get:function(){return this.material.stencilWrite},set:function(t){this.material.stencilWrite=!!t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilMask",{get:function(){return[this.material.stencilWriteMask,this.material.stencilWriteMask]},set:function(t){t&&(this.material.stencilWriteMask=t[0])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilRef",{get:function(){return[this.material.stencilRef,this.material.stencilRef]},set:function(t){t&&(this.material.stencilRef=t[0])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilFunc",{get:function(){return[this.material.stencilFunc,this.material.stencilFunc]},set:function(t){t&&(this.material.stencilFunc=pL[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpFail",{get:function(){return[this.material.stencilFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilFail=dL[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZFail",{get:function(){return[this.material.stencilZFail,this.material.stencilZFail]},set:function(t){t&&(this.material.stencilZFail=dL[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZPass",{get:function(){return[this.material.stencilZPass,this.material.stencilZPass]},set:function(t){t&&(this.material.stencilZPass=dL[t[0]])},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return this.material.side!==i.DoubleSide},set:function(t){this.material.side=t?i.FrontSide:i.DoubleSide},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cullFace",{get:function(){return this.material.side},set:function(t){t===bb.FRONT?this.material.side=i.FrontSide:t===bb.BACK&&(this.material.side=i.BackSide)},enumerable:!1,configurable:!0}),r.prototype.getTexture=function(t){return this.textures[t]},r.prototype.setTexture=function(t,e){this.setUniform(t,e.texture),this.textures[t]=e},r.prototype.getVector4Array=function(t){return this.uniforms[t].value},r.prototype.setVector4Array=function(t,e){var r,i,n=[];try{for(var o=ob(e),a=o.next();!a.done;a=o.next()){var s=a.value;n=n.concat(s.toArray())}}catch(t){r={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.setUniform(t,n)},r.prototype.getMatrixArray=function(t){return this.uniforms[t].value},r.prototype.setMatrixArray=function(t,e){var r,i,n=[];try{for(var o=ob(e),a=o.next();!a.done;a=o.next()){var s=a.value;n=n.concat(s.elements)}}catch(t){r={error:t}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.setUniform(t,n)},r.prototype.setMatrixNumberArray=function(t,e){this.setUniform(t,e)},r.prototype.getMatrix=function(t){return this.uniforms[t].value},r.prototype.setMatrix=function(t,e){this.setUniform(t,e)},r.prototype.setMatrix3=function(t,e){this.setUniform(t,e)},r.prototype.getVector2=function(t){return this.uniforms[t].value},r.prototype.setVector2=function(t,e){this.setUniform(t,e)},r.prototype.getVector3=function(t){return this.uniforms[t].value},r.prototype.setVector3=function(t,e){this.setUniform(t,e)},r.prototype.getVector4=function(t){return this.uniforms[t].value},r.prototype.setVector4=function(t,e){this.setUniform(t,e)},r.prototype.getQuaternion=function(t){return this.uniforms[t].value},r.prototype.setQuaternion=function(t,e){this.setUniform(t,e)},r.prototype.getFloat=function(t){return this.uniforms[t].value},r.prototype.setFloat=function(t,e){this.setUniform(t,e)},r.prototype.getFloats=function(t){return this.uniforms[t].value},r.prototype.setFloats=function(t,e){this.setUniform(t,e)},r.prototype.getInt=function(t){return this.uniforms[t].value},r.prototype.setInt=function(t,e){this.setUniform(t,e)},r.prototype.hasUniform=function(t){return!!this.uniforms[t]},r.prototype.setUniform=function(t,e){var r=new i.Uniform(e);this.uniforms[t]=this.material.uniforms[t]=r},r.prototype.enableKeyword=function(t){throw new Error("Method not implemented.")},r.prototype.disableKeyword=function(t){throw new Error("Method not implemented.")},r.prototype.isKeywordEnabled=function(t){throw new Error("Method not implemented.")},r.prototype.clone=function(t){throw new Error("Method not implemented.")},r.prototype.cloneUniforms=function(t){throw new Error("Method not implemented.")},r.prototype.dispose=function(t){this.destroyed&&(this.material.dispose(),this.destroyed=!0)},r}(WR),xL=function(t){function e(e){var r=t.call(this,e)||this;return r.semantics.setSemantic(cb),r.semantics.setSemantic(lb),r.semantics.setSemantic(hb),r.semantics.setSemantic(fb),r}return eb(e,t),e.prototype.setRenderPasses=function(t){this._renderPasses=Qb(t.slice())},e.prototype.addRenderPass=function(t){Kb(this._renderPasses,t)},e.prototype.createResource=function(){this.resource={}},e.prototype.createCopyMesh=function(t){},e.prototype.addMeshToDefaultRenderPass=function(t){var e,r=t.material.material,n=r.uniforms,o=t.material.uniformSemantics;if(this.threeCamera){var a=this.threeCamera,s=(new i.Matrix4).multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse);e={effects_ObjectToWorld:t.mesh.matrixWorld,effects_MatrixV:a.matrixWorldInverse,effects_MatrixVP:s,effects_MatrixInvV:a.matrixWorld}}else{a=this.camera;e={effects_ObjectToWorld:t.worldMatrix.toArray(),effects_MatrixV:a.getViewMatrix().toArray(),effects_MatrixVP:a.getViewProjectionMatrix().toArray(),effects_MatrixInvV:a.getInverseViewMatrix().toArray()}}Object.keys(o).forEach((function(t){e[t]&&vL(n,t,e[t])})),r.uniformsNeedUpdate=!0,this.group.add(t.mesh)},e.prototype.removeMeshFromDefaultRenderPass=function(t){this.group.remove(t.mesh)},e.prototype.updateMatrix=function(){var t=this.group,e=this.threeCamera;e&&t.children.forEach((function(t){var r=t.material,n=r.uniforms,o=(new i.Matrix4).multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse);vL(n,"effects_ObjectToWorld",t.matrixWorld),vL(n,"effects_MatrixVP",o),r.uniformsNeedUpdate=!0}))},e.prototype.updateUniform=function(){var t=this.group,e=this.camera;t.children.forEach((function(t){var r=t.material;vL(r.uniforms,"effects_MatrixInvV",e.getInverseViewMatrix().toArray()),vL(r.uniforms,"effects_MatrixVP",e.getViewProjectionMatrix().toArray()),vL(r.uniforms,"effects_MatrixV",e.getViewMatrix().toArray()),r.uniformsNeedUpdate=!0}))},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.group&&this.group.clear()},e}(XC),TL=function(e){function r(r,i){void 0===i&&(i={});var n=e.call(this)||this;if(r){var o=r.width,a=void 0===o?1:o,s=r.height,u=void 0===s?1:s;n.texture=n.createTextureByType(rb(rb({},i),{sourceType:t.TextureSourceType.data,data:r})),n.width=a,n.height=u}else n.texture=n.createTextureByType(i);return n.texture.needsUpdate=!0,n}return eb(r,e),r.toThreeJsTextureFilter=function(t){return t===yb.LINEAR?i.LinearFilter:i.NearestFilter},r.toThreeJsTextureWrap=function(t){switch(t){case yb.MIRRORED_REPEAT:return i.MirroredRepeatWrapping;case yb.REPEAT:return i.RepeatWrapping;default:return i.ClampToEdgeWrapping}},r.prototype.updateSource=function(t){this.texture.dispose(),this.texture=this.createTextureByType(t),this.texture.needsUpdate=!0},r.prototype.startVideo=function(){return ib(this,void 0,void 0,(function(){var e;return nb(this,(function(r){switch(r.label){case 0:return this.sourceType!==t.TextureSourceType.video?[3,2]:(e=this.texture.source.data).paused?[4,e.play()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r.prototype.assembleOptions=function(e){var n=e.target,o=void 0===n?yb.TEXTURE_2D:n;return e.sourceType||(e.sourceType="image"in e?t.TextureSourceType.image:"data"in e?t.TextureSourceType.data:"video"in e?t.TextureSourceType.video:t.TextureSourceType.none),rb(rb({target:o,format:i.RGBAFormat,type:i.UnsignedByteType},e),{minFilter:r.toThreeJsTextureFilter(e.minFilter),magFilter:r.toThreeJsTextureFilter(e.magFilter),wrapS:r.toThreeJsTextureWrap(e.wrapS),wrapT:r.toThreeJsTextureWrap(e.wrapT)})},r.prototype.dispose=function(){this.texture.dispose()},r.prototype.createTextureByType=function(e){var r,n,o=this.assembleOptions(e),a=o.flipY,s=o.type,u=o.wrapS,c=o.wrapT,l=o.minFilter,h=o.magFilter,f=o.sourceType,p=i.UVMapping,d=o.format,m=void 0;if(this.sourceType=f,f===t.TextureSourceType.data){var v=e.data;m=new i.DataTexture(v.data,v.width,v.height,d,s,p,u,c,h,l),this.width=v.width,this.height=v.height}else if(f===t.TextureSourceType.image){var y=e.image;m=new i.Texture(y,p,u,c,h,l,d,s),this.width=y.width,this.height=y.height}else if(f===t.TextureSourceType.compressed){var g=0,x=0,T=e.mipmaps.map((function(t){var e=t.data,r=t.width,i=t.height;return g=g<r?r:g,x=x<i?i:x,{data:e,width:r,height:i,colorSpace:"srgb"}}));d=i.RGBA_ASTC_4x4_Format,m=new i.CompressedTexture(T,g,x,d,s,p,u,c,h,l),this.width=g,this.height=x}else if(f===t.TextureSourceType.video)m=new i.VideoTexture(e.video,p,u,c,h,l,d,s);else if(f===t.TextureSourceType.framebuffer){if(v=e.data){var E=null!==(r=v.width)&&void 0!==r?r:0,A=null!==(n=v.height)&&void 0!==n?n:0;m=new i.FramebufferTexture(E,A,d),this.width=E,this.height=A}}else f===t.TextureSourceType.none&&((m=new i.DataTexture(new Uint8Array(4).fill(255),1,1)).wrapS=i.MirroredRepeatWrapping,m.wrapT=i.MirroredRepeatWrapping,this.width=this.height=1);if(m)return m.flipY=!!a,m;throw new Error("使用未知的数据类型创建纹理")},r}(wR),EL=function(t){function e(r,i){var n,o=t.call(this,r,i)||this;return null===(n=o.compositionSourceManager.sourceContent)||void 0===n||n.items.forEach((function(t){var r=t.content.renderer.shape;r&&Object.keys(r).forEach((function(t){var i=r[t];e.shape[t]||(e.shape[t]=0),e.shape[t]+=i.length}))})),o.content.start(),o}return eb(e,t),e.prototype.createRenderFrame=function(){this.renderFrame=new xL({camera:this.camera,keepColorBuffer:this.keepColorBuffer,renderer:this.renderer})},e.prototype.updateVideo=function(){this.textures.map((function(t){return t.startVideo()}))},e.prototype.updateCamera=function(){var t=this.renderFrame;t.threeCamera?t.updateMatrix():t.updateUniform()},e.prototype.getRendererOptions=function(){var t=TL.createWithData(this.renderer.engine,{data:new Uint8Array(4).fill(255),width:1,height:1});return t.texture.needsUpdate=!0,this.rendererOptions||(this.rendererOptions={emptyTexture:t,cachePrefix:"-"}),this.rendererOptions},e.shape={},e}(cL),AL=1,bL=function(t){function e(e,r){var n=this,o=r.drawStart,a=void 0===o?0:o,s=r.drawCount,u=r.indices,c=r.mode,l=r.name,h=void 0===l?"effectsGeometry:".concat(AL++):l;(n=t.call(this,h)||this).attributes={},n.destroyed=!1,n.attributesName=[],n.mode=null!=c?c:yb.TRIANGLES;var f=[],p={},d=new i.BufferGeometry;return Object.keys(r.attributes).forEach((function(t){var e=r.attributes[t];if("dataSource"in e){var o=e.dataSource;if(o){void 0===p[o]&&n.setAttributeType(o,e,d,p,r.maxVertex);var a=e.size,s=e.offset,u=e.normalize,c=p[o],l=c.buffer,h=c.dataLength,m=new i.InterleavedBufferAttribute(l,a,(null!=s?s:0)/h,u);d.setAttribute(t,m),p[t]={buffer:l,attribute:m,type:c.type,dataLength:h}}}else n.setAttributeType(t,e,d,p,r.maxVertex);f.push(t)})),u&&u.data&&d.setIndex(new i.BufferAttribute(u.data,1)),n.geometry=d,n.attributes=p,n.attributesName=f,n.drawStart=a,n.drawCount=null!=s?s:0,n}return eb(e,t),Object.defineProperty(e.prototype,"drawCount",{get:function(){return this.geometry.drawRange.count},set:function(t){this.geometry.drawRange.count=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"drawStart",{get:function(){return this.geometry.drawRange.start},set:function(t){this.geometry.drawRange.start=t},enumerable:!1,configurable:!0}),e.prototype.getAttributeData=function(t){if(null!=this.attributes[t])return this.attributes[t].buffer.array},e.prototype.setAttributeData=function(t,e){if(null!=this.attributes[t]){var r=this.attributes[t].buffer;r.updateRange.count=e.length,r.updateRange.offset=0,r.set(e,0),this.geometry.attributes[t].needsUpdate=!0}},e.prototype.setAttributeSubData=function(t,e,r){null!=this.attributes[t]&&(this.attributes[t].buffer.set(r,e),this.geometry.attributes[t].needsUpdate=!0)},e.prototype.getAttributeStride=function(t){var e=this.attributes[t];return e.buffer.stride*oC[e.type]},e.prototype.getAttributeNames=function(){return this.attributesName},e.prototype.getIndexData=function(){var t=this.geometry.getIndex();return null===t?void 0:t.array},e.prototype.setIndexData=function(t){t&&(this.geometry.setIndex(new i.BufferAttribute(t,1)),this.geometry.index.needsUpdate=!0)},e.prototype.setIndexSubData=function(t,e){var r=this.geometry.getIndex();if(null!==r){var i=t,n=t+e.length;if(r.count<n){var o=new e.constructor(end);o.set(r.array),r.array=o}r.array.set(e,i),this.geometry.index.needsUpdate=!0}},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.dispose=function(){this.destroyed||(this.geometry.dispose(),this.destroyed=!0)},e.prototype.setAttributeType=function(t,e,r,n,o){var a,s=e,u=s.size,c=s.offset,l=s.normalize,h=s.type,f=void 0===h?yb.FLOAT:h,p=e,d=p.stride,m=p.data;if(f&&!m&&(m=sC(f)),m){d="aSprite"===t?12:null!=d?d:0;var v=m instanceof Float32Array?Float32Array.BYTES_PER_ELEMENT:Uint16Array.BYTES_PER_ELEMENT,y=d/v;if(o){var g=o*d+(null!==(a=EL.shape[t])&&void 0!==a?a:0);0===m.length&&(m=m instanceof Float32Array?new Float32Array(g):new Uint16Array(g))}var x=new i.InterleavedBuffer(m,y),T=new i.InterleavedBufferAttribute(x,u,(null!=c?c:0)/v,l);r.setAttribute(t,T),n[t]={buffer:x,attribute:T,type:f,dataLength:v}}},e}(aC),SL=function(e){function r(t,r){var n=this,o=r.material,a=r.geometry,s=r.priority,u=void 0===s?0:s;return(n=e.call(this,t,r)||this).geometry=a,n.material=o,a.mode===yb.LINES?n.mesh=new i.LineSegments(a.geometry,o.material):n.mesh=new i.Mesh(a.geometry,o.material),n.worldMatrix=n.mesh.matrixWorld,n.priority=u,n}return eb(r,e),Object.defineProperty(r.prototype,"priority",{get:function(){return this.mesh.renderOrder},set:function(t){this.mesh&&(this.mesh.renderOrder=t)},enumerable:!1,configurable:!0}),r.prototype.setVisible=function(t){this.mesh.visible=!t},r.prototype.getVisible=function(){return!this.mesh.visible},r.prototype.firstGeometry=function(){return this.geometry},r.prototype.setMaterial=function(e,r){r!==t.DestroyOptions.keep&&this.material.dispose(r),this.material=e,this.mesh.material=e.material},r.prototype.restore=function(){},r.prototype.dispose=function(t){this.destroyed||(this.mesh.clear(),this.destroyed=!0)},r}(hC),_L=function(t){function e(e){var r=t.call(this)||this;return r.gpuCapability=new QC(e),r}return eb(e,t),e}(lL),RL=function(t){function e(e){var r=t.call(this)||this;return r.engine=new _L(e),r}return eb(e,t),e}(iO),CL=function(t){function e(e,r){var i=t.call(this)||this,n=r.width,o=r.height,a=r.camera;return i.renderer=new RL(e),i.width=n,i.height=o,i.camera=a,i}return eb(e,t),Object.defineProperty(e.prototype,"currentComposition",{get:function(){return this.compositions[0]},enumerable:!1,configurable:!0}),e.prototype.loadScene=function(t,e){return ib(this,void 0,void 0,(function(){var e,r;return nb(this,(function(i){switch(i.label){case 0:return[4,new rL({}).loadScene(t)];case 1:return e=i.sent(),(r=new EL({renderer:this.renderer,width:this.width,height:this.height},e)).renderFrame.group=this,r.renderFrame.threeCamera=this.camera,this.compositions=[r],[2]}}))}))},e.prototype.update=function(t){this.compositions.forEach((function(e){e.update(t)}))},e}(i.Group);vO(8),wR.create=function(t,e){return new TL(void 0,e)},wR.createWithData=function(t,e,r){return new TL(e,r)},WR.create=function(t,e){return new gL(t,e)},aC.create=function(t,e){return new bL(t,e)},hC.create=function(t,e){return new SL(t,e)};console.info({content:"[Galacean Effects THREEJS] version: 1.1.0-alpha.0",type:IR}),t.AbstractPlugin=$_,t.AssetManager=rL,t.BYTES_TYPE_MAP=oC,t.BezierSegments=x_,t.COMPRESSED_TEXTURE=tO,t.CONSTANT_MAP_BLEND=fL,t.CONSTANT_MAP_DEPTH=mL,t.CONSTANT_MAP_STENCIL_FUNC=pL,t.CONSTANT_MAP_STENCIL_OP=dL,t.COPY_FRAGMENT_SHADER=JR,t.COPY_MESH_SHADER_ID=QR,t.COPY_VERTEX_SHADER=KR,t.CalculateItem=SO,t.CalculateLoader=tM,t.CalculateVFXItem=eM,t.Camera=DM,t.CameraController=tR,t.CameraVFXItem=rR,t.CameraVFXItemLoader=eR,t.Composition=cL,t.CompositionSourceManager=tL,t.CurveValue=v_,t.DEFAULT_FONTS=fM,t.Downloader=TR,t.EFFECTS_COPY_MESH_NAME=qR,t.EVENT_TYPE_CLICK=oR,t.EVENT_TYPE_TOUCH_END=uR,t.EVENT_TYPE_TOUCH_MOVE=sR,t.EVENT_TYPE_TOUCH_START=aR,t.Engine=lL,t.EventSystem=lR,t.FILTER_NAME_NONE=db,t.FilterSpriteVFXItem=MO,t.Float16ArrayWrapper=WS,t.FrameBuffer=rO,t.GPUCapability=QC,t.Geometry=aC,t.GlobalUniforms=HC,t.GradientValue=m_,t.HELP_LINK=mb,t.InteractBehavior=cR,t.InteractItem=cO,t.InteractLoader=uO,t.InteractMesh=oO,t.InteractVFXItem=aO,t.KTXTexture=NR,t.LOG_TYPE=IR,t.LineSegments=y_,t.LinearValue=d_,t.Material=WR,t.MaterialDataBlock=kR,t.Mesh=hC,t.PLAYER_OPTIONS_ENV_EDITOR=pb,t.POST_PROCESS_SETTINGS="post_process_settings",t.ParticleLoader=Jw,t.ParticleMesh=IO,t.ParticleSystem=Uw,t.ParticleVFXItem=Kw,t.PassTextureCache=iC,t.PathSegments=g_,t.PluginSystem=J_,t.QCanvasViewer=sM,t.QText=aM,t.RENDER_PASS_NAME_PREFIX=GC,t.RENDER_PREFER_LOOKUP_TEXTURE=LR,t.RUNTIME_ENV="runtime_env",t.RandomSetValue=h_,t.RandomValue=f_,t.RandomVectorValue=p_,t.RenderBuffer=ZC,t.RenderFrame=XC,t.RenderPass=vC,t.RenderPassPriorityNormal=fC,t.RenderPassPriorityPostprocess=3e3,t.RenderPassPriorityPrepare=0,t.RenderTargetHandle=dC,t.Renderer=iO,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0=hb,t.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0=fb,t.SEMANTIC_PRE_COLOR_ATTACHMENT_0=cb,t.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0=lb,t.SPRITE_VERTEX_STRIDE=ub,t.SemanticMap=nC,t.Shader=ZR,t.SpriteItem=CO,t.SpriteLoader=EO,t.SpriteMesh=hO,t.SpriteVFXItem=OO,t.StaticValue=l_,t.TEMPLATE_USE_OFFSCREEN_CANVAS=PR,t.TEXTURE_UNIFORM_MAP=yL,t.TextItem=bM,t.TextLoader=_M,t.TextMesh=rM,t.TextVFXItem=SM,t.Texture=wR,t.TextureFactory=UR,t.ThreeComposition=EL,t.ThreeDisplayObject=CL,t.ThreeMaterial=gL,t.ThreeTexture=TL,t.Ticker=hL,t.TimelineComponent=P_,t.Transform=X_,t.VFXItem=Y_,t.ValueGetter=c_,t.addByOrder=Kb,t.addItem=zb,t.addItemWithOrder=Bb,t.alphaFrameFrag=bC,t.alphaMaskFrag=SC,t.assertExist=tS,t.asserts=function(t,e){if(void 0===e&&(e="asserts failed"),!t)throw new Error(e)}
|
|
15
15
|
/*!
|
|
16
16
|
* Name: @galacean/effects-specification
|
|
17
17
|
* Description: Galacean Effects JSON Specification
|
|
18
18
|
* Author: Ant Group CO., Ltd.
|
|
19
19
|
* Version: v1.0.0
|
|
20
|
-
*/,e.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;}",e.bloomMixVert=ob,e.bloomThresholdVert=ab,e.calculateTranslation=FR,e.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}",e.cameraMoveVert=tb,e.canvasPool=HI,e.clamp=SA,e.colorGradingFrag=ub,e.colorStopsFromGradient=HS,e.colorToArr=XS,e.combineImageTemplate=QI,e.combineImageTemplate1=BI,e.combineImageTemplate1Async=function(e,t,r,i,n){return iS(this,void 0,void 0,(function(){return nS(this,(function(o){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,BI(e,t,r,i,n)]}))}))},e.combineImageTemplate2=KI,e.combineImageTemplate2Async=function(e,t,r,i,n){return iS(this,void 0,void 0,(function(){return nS(this,(function(o){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,KI(e,t,r,i,n)]}))}))},e.combineImageTemplateAsync=function(e,t,r,i,n){return iS(this,void 0,void 0,(function(){return nS(this,(function(o){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,QI(e,t,r,i,n)]}))}))},e.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",e.compatibleVert="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n",e.convertAnchor=RA,e.copyFrag=SO,e.createCopyShader=LO,e.createFilter=BS,e.createFilterShaders=US,e.createGLContext=function(e,t,r){var i;if(void 0===t&&(t="webgl"),"webgl2"===t&&((i=e.getContext("webgl2",r))||console.debug("WebGL2 context retrieval failed, falling back to WebGL context.")),i&&"webgl"!==t||(i=e.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},e.createKeyFrameMeta=iC,e.createShaderWithMarcos=HC,e.createShape=IL,e.createVFXItem=_C,e.createValueGetter=KR,e.deepClone=dC,e.defaultGlobalVolume=yb,e.defaultPlugins=AC,e.delayFrag=rb,e.deserializeMipmapTexture=rO,e.distortionFrag=ib,e.distortionVert=nb,e.dotInTriangle=function(e,t,r){var i=aS(r,3),n=i[0],o=i[1],a=i[2],s=[n[0],n[1]],u=[o[0],o[1]],c=[a[0],a[1]];oR(wR,c,s),oR(PR,u,s),oR(MR,t,s);var l=sR(wR,wR),f=sR(wR,PR),h=sR(wR,MR),p=sR(PR,PR),d=sR(PR,MR),m=l*p-f*f;if(0===m)return!1;var v=1/m,y=(p*h-f*d)*v,g=(l*d-f*h)*v;return 1-y-g>=0&&g>=0&&1-y<=1},e.earcut=$L,e.enlargeBuffer=jS,e.ensureVec3=$A,e.filters=Rw,e.findPreviousRenderPass=function(e,t){var r=e.indexOf(t);return e[r-1]},e.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);}",e.gaussianDownHFrag=cb,e.gaussianDownVFrag=lb,e.gaussianUpFrag=fb,e.generateEmptyTypedArray=DO,e.generateHalfFloatTexture=aO,e.getBackgroundImage=YI,e.getColorFromGradientStops=WS,e.getConfig=fO,e.getDefaultTemplateCanvasPool=function(){return HI},e.getDefaultTextureFactory=function(){return dO||(dO=new mO),dO},e.getGeometryByShape=oI,e.getGeometryTriangles=nI,e.getImageItemRenderInfo=Gb,e.getKTXTextureOptions=pO,e.getKeyFrameMetaByRawValue=rC,e.getMat4TR=GA,e.getMat4TRS=jA,e.getParticleMeshShader=fL,e.getPixelRatio=function(){if("object"==typeof screen&&"object"==typeof document){var e=Math.max(document.documentElement.clientWidth,window.innerWidth||0),t=screen.width/e;return Math.min(2*t,2)}return 1},e.getPreMultiAlpha=GC,e.getStandardComposition=_P,e.getStandardImage=EP,e.getStandardItem=CP,e.getStandardJSON=xP,e.getTextureSize=Eb,e.glContext=xS,e.gpuTimer=function(e){var t=this,r=e.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var i=e.createQuery(),n=function(){return iS(t,void 0,void 0,(function(){return nS(this,(function(t){return[2,new Promise((function(t,o){if(i){var a=e.getQueryParameter(i,e.QUERY_RESULT_AVAILABLE),s=e.getParameter(r.GPU_DISJOINT_EXT);if(a&&!s){var u=e.getQueryParameter(i,e.QUERY_RESULT);t(u/1e3/1e3)}(a||s)&&(e.deleteQuery(i),i=null),null!==a&&i&&window.setTimeout((function(){n().then(t).catch}),1)}}))]}))}))};if(!i)return;return{begin:function(){i&&e.beginQuery(r.TIME_ELAPSED_EXT,i)},end:function(){e.endQuery(r.TIME_ELAPSED_EXT)},getTime:n}}},e.imageDataFromColor=function(e){lC(e)&&(e=XS(e));for(var t=e,r={width:1,height:1,data:new Uint8Array(4)},i=r.data,n=0;n<4;n++)i[n]=t[n];return r},e.imageDataFromGradient=QS,e.initErrors=gS,e.initGLContext=TS,e.integrate="float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;float r=dot(vec4(2.*t*t*t,3.*t*t,-t0*t0*t0,3.*t0*t0),vec4(y0-y1,t0*y1-t1*y0,2.*y0+y1,t1*y0));return r/(t0-t1)/6.;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}return 0.;}",e.interpolateColor=YS,e.intersectRayBox=AR,e.intersectRaySphere=SR,e.intersectRayTriangle=IR,e.isAndroid=qS,e.isArray=fC,e.isFunction=hC,e.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},e.isIdentityMatrix=VA,e.isObject=pC,e.isScene=function(e){return pC(e)&&"jsonScene"in e},e.isSimulatorCellPhone=KS,e.isString=lC,e.isUniformStruct=gO,e.isUniformStructArray=function(e){return e&&void 0!==e.length&&gO(e[0])},e.isWebGL2=function(e){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name},e.isZeroVec=JA,e.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",e.itemFrag=qO,e.itemFrameFrag=YO,e.itemVert=ZO,e.loadBinary=eO,e.loadBlob=function(e){return iS(this,void 0,void 0,(function(){return nS(this,(function(t){return[2,new Promise((function(t,r){(new KC).downloadBlob(e,t,(function(t,i){r("Couldn't load blob ".concat(e,": status ").concat(t,", ").concat(i))}))}))]}))}))},e.loadImage=$C,e.loadVideo=tO,e.loadWebPOptional=JC,e.mat3FromQuat=wA,e.mat3FromRotation=pR,e.mat3FromRotationZ=hR,e.mat4Clone=XA,e.mat4Determinate=zA,e.mat4ToIdentityMatrix=MA,e.mat4create=PA,e.mat4fromRotationTranslationScale=NA,e.mat4invert=FA,e.mat4multiply=DA,e.mat4perspective=UA,e.modifyMaxKeyframeShader=hL,e.nearestPowerOfTwo=AA,e.noop=cC,e.parsePercent=ZS,e.particleFrag=KO,e.particleOriginTranslateMap=_A,e.particleVert=QO,e.pluginLoaderMap=SC,e.quatFromRotation=xR,e.quatMultiply=gR,e.quatStar=TR,e.random=mC,e.registerFilter=FS,e.registerFilters=DS,e.registerPlugin=CC,e.removeItem=zS,e.requestAsync=UI,e.rotateByQuat=function(e,t,r){var i=r[0],n=r[1],o=r[2],a=r[3],s=[i,n,o],u=uR([],s,t),c=uR([],s,u);sR(c,c,2),sR(u,u,2*a),qA(c,c,u),qA(e,t,c)},e.rotateVec2=aI,e.rotationFromMat3=dR,e.screenMeshVert=sb,e.setBlendMode=YC,e.setConfig=function(e,t){return lO[e]=t},e.setDefaultTextureFactory=function(e){dO=e},e.setMaskMode=qC,e.setMaxSpriteMeshItemCount=Hb,e.setRayFromCamera=_R,e.setSideMode=ZC,e.setSpriteMeshMaxFragmentTextures=function(t){e.maxSpriteTextureCount=t},e.setSpriteMeshMaxItemCountByGPU=function(t){return e.maxSpriteTextureCount=Math.min(t.maxFragmentTextures,16),t.maxVertexUniforms>=256?e.maxSpriteMeshItemCount=32:t.maxVertexUniforms>=128?e.maxSpriteMeshItemCount=16:void(e.maxSpriteTextureCount=8)},e.setUniformValue=HP,e.sortByOrder=JS,e.spec=EA,e.spriteMeshShaderFromFilter=jb,e.spriteMeshShaderFromRenderInfo=Wb,e.spriteMeshShaderIdFromRenderInfo=Xb,e.thresholdFrag=hb,e.throwDestroyedError=vC,e.trailVert=JO,e.translatePoint=function(e,t){for(var r=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],i=0;i<8;i+=2)r[i]+=e,r[i+1]+=t;return r},e.trianglesFromRect=LR,e.unregisterPlugin=function(e){delete RC[e],delete SC[e],zS(AC,e)},e.valIfUndefined=function(e,t){return null==e?t:e},e.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).y;}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}",e.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",e.vec3Cross=uR,e.vec3MulMat3=eR,e.vec3MulMat4=cR,e.vec3RotateByMat4=lR,e.vecAdd=qA,e.vecAssign=tR,e.vecDot=sR,e.vecFill=KA,e.vecMinus=oR,e.vecMulCombine=rR,e.vecMulScalar=nR,e.vecNormalize=iR,e.vecSquareDistance=aR,e.version="0.0.1-alpha.3",Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
20
|
+
*/,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=wC,t.bloomThresholdVert=MC,t.calculateTranslation=QS,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=_C,t.canvasPool=vM,t.colorGradingFrag=LC,t.colorStopsFromGradient=Xb,t.colorToArr=Gb,t.combineImageTemplate=EM,t.combineImageTemplate1=cM,t.combineImageTemplate1Async=function(t,e,r,i,n){return ib(this,void 0,void 0,(function(){return nb(this,(function(o){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,cM(t,e,r,i,n)]}))}))},t.combineImageTemplate2=TM,t.combineImageTemplate2Async=function(t,e,r,i,n){return ib(this,void 0,void 0,(function(){return nb(this,(function(o){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,TM(t,e,r,i,n)]}))}))},t.combineImageTemplateAsync=function(t,e,r,i,n){return ib(this,void 0,void 0,(function(){return nb(this,(function(o){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,EM(t,e,r,i,n)]}))}))},t.compatibleFrag="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#define textureCube texture\n#define textureCubeLodEXT textureLod\nlayout(location=0)out vec4 fragColor;\n#else\n#define fragColor gl_FragColor\n#endif\n",t.compatibleVert="#version 300 es\n#ifdef WEBGL2\n#define texture2D texture\n#else\n#endif\n",t.convertAnchor=n_,t.copyFrag=HR,t.createCopyShader=$R,t.createFilter=Db,t.createFilterShaders=Nb,t.createGLContext=function(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},t.createKeyFrameMeta=O_,t.createShaderWithMarcos=vR,t.createShape=$O,t.createVFXItem=W_,t.createValueGetter=E_,t.deepClone=function t(e){if(N_(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=kC,t.defaultPlugins=Z_,t.delayFrag=RC,t.deserializeMipmapTexture=RR,t.distortionFrag=CC,t.distortionVert=OC,t.earcut=Aw,t.enlargeBuffer=kb,t.ensureVec3=KS,t.filters=qM,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=PC,t.gaussianDownVFrag=FC,t.gaussianUpFrag=VC,t.generateEmptyTypedArray=sC,t.generateHalfFloatTexture=MR,t.getBackgroundImage=yM,t.getColorFromGradientStops=jb,t.getConfig=VR,t.getDefaultTemplateCanvasPool=function(){return vM},t.getDefaultTextureFactory=function(){return zR||(zR=new UR),zR},t.getGeometryByShape=Ow,t.getGeometryTriangles=Cw,t.getImageItemRenderInfo=fO,t.getKTXTextureOptions=DR,t.getKeyFrameMetaByRawValue=C_,t.getParticleMeshShader=FO,t.getPixelRatio=function(){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},t.getPreMultiAlpha=fR,t.getStandardComposition=WI,t.getStandardImage=YI,t.getStandardItem=QI,t.getStandardJSON=jI,t.getTextureSize=YC,t.glContext=yb,t.gpuTimer=function(t){var e=this,r=t.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var i=t.createQuery(),n=function(){return ib(e,void 0,void 0,(function(){return nb(this,(function(e){return[2,new Promise((function(e,o){if(i){var a=t.getQueryParameter(i,t.QUERY_RESULT_AVAILABLE),s=t.getParameter(r.GPU_DISJOINT_EXT);if(a&&!s){var u=t.getQueryParameter(i,t.QUERY_RESULT);e(u/1e3/1e3)}(a||s)&&(t.deleteQuery(i),i=null),null!==a&&i&&window.setTimeout((function(){n().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:n}}},t.imageDataFromColor=function(t){V_(t)&&(t=Gb(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},t.imageDataFromGradient=qb,t.initErrors=vb,t.initGLContext=gb,t.integrate="float integrateCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;vec4 a=vec4(dt3*dt,dt3,dt2,dt)/vec4(4.*k*k*k,3.*k*k,2.*k,1.);vec4 b=vec4(m0+m1+2.*v0-2.*v1,2.*m0+m1+3.*v0-3.*v1,m0,-v0);return dot(a,b);}float integrateByTimeCurveFrames(float t1,vec4 k0,vec4 k1){float k=k1.x-k0.x;float m0=k0.w*k;float m1=k1.z*k;float t0=k0.x;float v0=k0.y;float v1=k1.y;float dt=t0-t1;float dt2=dt*dt;float dt3=dt2*dt;float k2=k*k;float k3=k2*k;vec4 a=vec4(-30.*k3,10.*k2,5.*k,3.)*vec4(dt,dt2,dt3,dt3*dt);vec4 b=vec4(v0,m0,2.*m0+m1+3.*v0-3.*v1,m0+m1+2.*v0-2.*v1)*vec4(t0+t1,t0+2.*t1,t0+3.*t1,t0+4.*t1);return dot(a,b)/60./k3;}float integrateByTimeFromCurveFrames(float t1,float frameStart,float frameCount){if(t1==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(t1>k0.x&&t1<=k1.x){return ret+integrateByTimeCurveFrames(t1,k0,k1);}ret+=integrateByTimeCurveFrames(k1.x,k0,k1);}return ret;}float integrateFromCurveFrames(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i==count){return ret;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);if(time>k0.x&&time<=k1.x){return ret+integrateCurveFrames(time,k0,k1);}ret+=integrateCurveFrames(k1.x,k0,k1);}return ret;}float integrateByTimeLineSeg(float t,vec2 p0,vec2 p1){float t0=p0.x;float t1=p1.x;float y0=p0.y;float y1=p1.y;float r=dot(vec4(2.*t*t*t,3.*t*t,-t0*t0*t0,3.*t0*t0),vec4(y0-y1,t0*y1-t1*y0,2.*y0+y1,t1*y0));return r/(t0-t1)/6.;}float integrateLineSeg(float time,vec2 p0,vec2 p1){float h=time-p0.x;float y0=p0.y;return(y0+y0+(p1.y-y0)*h/(p1.x-p0.x))*h/2.;}float integrateFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateLineSeg(time,k0,k1);}ret+=integrateLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateLineSeg(time,k1,k2);}ret+=integrateLineSeg(k2.x,k1,k2);}return ret;}float integrateByTimeFromLineSeg(float time,float frameStart,float frameCount){if(time==0.){return 0.;}int start=int(frameStart);int count=int(frameCount-1.);float ret=0.;for(int i=0;i<ITR_END;i++){if(i>count){return ret;}vec4 ks=lookup_curve(i+start);vec2 k0=ks.xy;vec2 k1=ks.zw;if(time>k0.x&&time<=k1.x){return ret+integrateByTimeLineSeg(time,k0,k1);}ret+=integrateByTimeLineSeg(k1.x,k0,k1);vec2 k2=lookup_curve(i+start+1).xy;if(time>k1.x&&time<=k2.x){return ret+integrateByTimeLineSeg(time,k1,k2);}ret+=integrateByTimeLineSeg(k2.x,k1,k2);}return ret;}float getIntegrateFromTime0(float t1,vec4 value){float type=value.x;if(type==0.){return value.y*t1;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateLineSeg(t1,p0,p1);}if(type==3.){return integrateFromLineSeg(t1,value.y,value.z);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateFromCurveFrames(t1,idx,ilen);return d*value.w+value.z*t1;}if(type==4.){return mix(value.y,value.z,aSeed)*t1;}return 0.;}float getIntegrateByTimeFromTime(float t0,float t1,vec4 value){float type=value.x;if(type==0.){return value.y*(t1*t1-t0*t0)/2.;}else if(type==1.){vec2 p0=vec2(0.,value.y);vec2 p1=vec2(value.w,value.z);return integrateByTimeLineSeg(t1,p0,p1)-integrateByTimeLineSeg(t0,p0,p1);}if(type==2.){float idx=floor(value.y);float ilen=floor(1./fract(value.y)+0.5);float d=integrateByTimeFromCurveFrames(t1,idx,ilen)-integrateByTimeFromCurveFrames(t0,idx,ilen);return d*value.w+value.z*pow(t1-t0,2.)*0.5;}if(type==3.){return integrateByTimeFromLineSeg(t1,value.y,value.z)-integrateByTimeFromLineSeg(t0,value.y,value.z);}if(type==4.){return mix(value.y,value.z,aSeed)*(t1*t1-t0*t0)/2.;}return 0.;}",t.interpolateColor=Yb,t.isAndroid=Hb,t.isArray=N_,t.isFunction=D_,t.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},t.isObject=z_,t.isScene=function(t){return z_(t)&&"jsonScene"in t},t.isSimulatorCellPhone=Zb,t.isString=V_,t.isUniformStruct=GR,t.isUniformStructArray=function(t){return t&&void 0!==t.length&&GR(t[0])},t.isWebGL2=function(t){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===t.constructor.name},t.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",t.itemFrag=xC,t.itemFrameFrag=yC,t.itemVert=gC,t.loadBinary=SR,t.loadBlob=function(t){return ib(this,void 0,void 0,(function(){return nb(this,(function(e){return[2,new Promise((function(e,r){(new TR).downloadBlob(t,e,(function(e,i){r("Couldn't load blob ".concat(t,": status ").concat(e,", ").concat(i))}))}))]}))}))},t.loadImage=bR,t.loadVideo=_R,t.loadWebPOptional=AR,t.math=XS,t.modifyMaxKeyframeShader=VO,t.nearestPowerOfTwo=o_,t.noop=F_,t.parsePercent=Wb,t.particleFrag=TC,t.particleOriginTranslateMap=i_,t.particleVert=EC,t.pluginLoaderMap=H_,t.random=U_,t.registerFilter=Fb,t.registerFilters=Vb,t.registerPlugin=Q_,t.removeItem=Ub,t.requestAsync=uM,t.rotateVec2=ww,t.screenMeshVert=IC,t.setBlendMode=yR,t.setConfig=function(t,e){return FR[t]=e},t.setDefaultTextureFactory=function(t){zR=t},t.setMaskMode=xR,t.setMaxSpriteMeshItemCount=vO,t.setRayFromCamera=a_,t.setSideMode=gR,t.setSpriteMeshMaxFragmentTextures=function(e){t.maxSpriteTextureCount=e},t.setSpriteMeshMaxItemCountByGPU=function(e){return t.maxSpriteTextureCount=Math.min(e.maxFragmentTextures,16),e.maxVertexUniforms>=256?t.maxSpriteMeshItemCount=32:e.maxVertexUniforms>=128?t.maxSpriteMeshItemCount=16:void(t.maxSpriteTextureCount=8)},t.setUniformValue=vL,t.sortByOrder=Qb,t.spec=gS,t.spriteMeshShaderFromFilter=pO,t.spriteMeshShaderFromRenderInfo=mO,t.spriteMeshShaderIdFromRenderInfo=dO,t.thresholdFrag=NC,t.throwDestroyedError=B_,t.trailVert=AC,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=s_,t.unregisterPlugin=function(t){delete q_[t],delete H_[t],Ub(Z_,t)},t.valIfUndefined=function(t,e){return null==t?e:t},t.value="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n#ifdef SHADER_VERTEX\nin float aSeed;out float vSeed;\n#define NONE_CONST_INDEX 1\n#else\n#if LOOKUP_TEXTURE_CURVE\n#define NONE_CONST_INDEX 1\n#endif\n#endif\n#ifdef NONE_CONST_INDEX\n#ifdef SHADER_VERTEX\n#define MAX_C VERT_MAX_KEY_FRAME_COUNT\n#else\n#define MAX_C FRAG_MAX_KEY_FRAME_COUNT\n#endif\n#else\n#define MAX_C CURVE_VALUE_COUNT\n#endif\nfloat evaluateCurveFrames(float time,vec4 keyframe0,vec4 keyframe1){float dt=keyframe1.x-keyframe0.x;float m0=keyframe0.w*dt;float m1=keyframe1.z*dt;float t=(time-keyframe0.x)/dt;float t2=t*t;float t3=t2*t;return dot(vec4(dot(vec3(2.,-3.,1.),vec3(t3,t2,1.)),dot(vec3(1,-2.,1),vec3(t3,t2,t)),t3-t2,dot(vec2(-2,3),vec2(t3,t2))),vec4(keyframe0.y,m0,m1,keyframe1.y));}float valueFromCurveFrames(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i==count){return lookup_curve(count).y;}vec4 k0=lookup_curve(i+start);vec4 k1=lookup_curve(i+1+start);\n#else\nif(i<start){continue;}vec4 k0=lookup_curve(i);vec4 k1=lookup_curve(i+1);if(i==end){return k0.y;}\n#endif\nif(time>=k0.x&&time<=k1.x){return evaluateCurveFrames(time,k0,k1);}}return lookup_curve(0).y;}float evaluteLineSeg(float t,vec2 p0,vec2 p1){return p0.y+(p1.y-p0.y)*(t-p0.x)/(p1.x-p0.x);}float valueFromLineSegs(float time,float frameStart,float frameCount){int start=int(frameStart);int count=int(frameCount-1.);int end=start+count;for(int i=0;i<ITR_END;i++){\n#ifdef NONE_CONST_INDEX\nif(i>count){return lookup_curve(i).w;}\n#else\nif(i<start){continue;}if(i>end){return lookup_curve(i-2).w;}\n#endif\n#ifdef NONE_CONST_INDEX\nvec4 seg=lookup_curve(i+start);\n#else\nvec4 seg=lookup_curve(i);\n#endif\nvec2 p0=seg.xy;vec2 p1=seg.zw;if(time>=p0.x&&time<=p1.x){return evaluteLineSeg(time,p0,p1);}\n#ifdef NONE_CONST_INDEX\nvec2 p2=lookup_curve(i+start+1).xy;\n#else\nvec2 p2=lookup_curve(i+1).xy;\n#endif\nif(time>p1.x&&time<=p2.x){return evaluteLineSeg(time,p1,p2);}}return lookup_curve(0).y;}float getValueFromTime(float time,vec4 value){float type=value.x;if(type==0.){return value.y;}else if(type==1.){return mix(value.y,value.z,time/value.w);}if(type==2.){return valueFromCurveFrames(time,floor(value.y),floor(1./fract(value.y)+0.5))*value.w+value.z;}if(type==3.){return valueFromLineSegs(time,value.y,value.z);}if(type==4.){\n#ifdef SHADER_VERTEX\nfloat seed=aSeed;\n#else\nfloat seed=vSeed;\n#endif\nreturn mix(value.y,value.z,seed);}return 0.;}",t.valueDefine="#ifdef SHADER_VERTEX\n#define CURVE_VALUE_TEXTURE uVCurveValueTexture\n#define CURVE_VALUE_ARRAY uVCurveValues\n#define CURVE_VALUE_COUNT VERT_CURVE_VALUE_COUNT\n#define FRAG_CURVE_VALUE_COUNT 0\n#else\n#define CURVE_VALUE_TEXTURE uFCurveValueTexture\n#define CURVE_VALUE_ARRAY uFCurveValues\n#define CURVE_VALUE_COUNT FRAG_CURVE_VALUE_COUNT\n#define VERT_CURVE_VALUE_COUNT 0\n#endif\n#if CURVE_VALUE_COUNT > 0\n#if LOOKUP_TEXTURE_CURVE\nuniform sampler2D CURVE_VALUE_TEXTURE;const float uCurveCount=1./float(CURVE_VALUE_COUNT);\n#define lookup_curve(i) texture2D(CURVE_VALUE_TEXTURE,vec2(float(i) * uCurveCount,0.))\n#else\nuniform vec4 CURVE_VALUE_ARRAY[CURVE_VALUE_COUNT];\n#define lookup_curve(i) CURVE_VALUE_ARRAY[i]\n#endif\n#else\n#define lookup_curve(i) vec4(0.)\n#endif\n#ifdef WEBGL2\n#define ITR_END (count + 1)\n#else\n#define ITR_END MAX_C\n#endif\n",t.vecAssign=$S,t.vecFill=JS,t.vecMulCombine=e_,t.vecNormalize=t_,t.version="1.1.0-alpha.0",Object.defineProperty(t,"__esModule",{value:!0})}));
|
|
21
21
|
//# sourceMappingURL=index.min.js.map
|