@galacean/effects 1.0.0 → 1.0.1

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.min.js CHANGED
@@ -3,19 +3,19 @@
3
3
  * Description: Galacean Effects runtime player for the web
4
4
  * Author: Ant Group CO., Ltd.
5
5
  * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
- * Version: v1.0.0
6
+ * Version: v1.0.1
7
7
  */
8
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ge={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math===Math&&e},i=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||t||Function("return this")(),n={},o=function(e){try{return!!e()}catch(e){return!0}},a=!o((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),s=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),u=s,c=Function.prototype.call,l=u?c.bind(c):function(){return c.apply(c,arguments)},f={},h={}.propertyIsEnumerable,p=Object.getOwnPropertyDescriptor,d=p&&!h.call({1:2},1);f.f=d?function(e){var t=p(this,e);return!!t&&t.enumerable}:h;var m,v,y=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},g=s,T=Function.prototype,x=T.call,E=g&&T.bind.bind(x,x),A=g?E:function(e){return function(){return x.apply(e,arguments)}},S=A,b=S({}.toString),_=S("".slice),R=function(e){return _(b(e),8,-1)},C=o,O=R,L=Object,I=A("".split),P=C((function(){return!L("z").propertyIsEnumerable(0)}))?function(e){return"String"===O(e)?I(e,""):L(e)}:L,M=function(e){return null==e},w=M,F=TypeError,N=function(e){if(w(e))throw F("Can't call method on "+e);return e},D=P,V=N,U=function(e){return D(V(e))},B="object"==typeof document&&document.all,k={all:B,IS_HTMLDDA:void 0===B&&void 0!==B},z=k.all,G=k.IS_HTMLDDA?function(e){return"function"==typeof e||e===z}:function(e){return"function"==typeof e},j=G,X=k.all,H=k.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:j(e)||e===X}:function(e){return"object"==typeof e?null!==e:j(e)},Y=i,W=G,Z=function(e,t){return arguments.length<2?(r=Y[e],W(r)?r:void 0):Y[e]&&Y[e][t];var r},q=A({}.isPrototypeOf),K="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Q=i,J=K,$=Q.process,ee=Q.Deno,te=$&&$.versions||ee&&ee.version,re=te&&te.v8;re&&(v=(m=re.split("."))[0]>0&&m[0]<4?1:+(m[0]+m[1])),!v&&J&&(!(m=J.match(/Edge\/(\d+)/))||m[1]>=74)&&(m=J.match(/Chrome\/(\d+)/))&&(v=+m[1]);var ie=v,ne=ie,oe=o,ae=i.String,se=!!Object.getOwnPropertySymbols&&!oe((function(){var e=Symbol("symbol detection");return!ae(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ne&&ne<41})),ue=se&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ce=Z,le=G,fe=q,he=Object,pe=ue?function(e){return"symbol"==typeof e}:function(e){var t=ce("Symbol");return le(t)&&fe(t.prototype,he(e))},de=String,me=function(e){try{return de(e)}catch(e){return"Object"}},ve=G,ye=me,ge=TypeError,Te=function(e){if(ve(e))return e;throw ge(ye(e)+" is not a function")},xe=Te,Ee=M,Ae=function(e,t){var r=e[t];return Ee(r)?void 0:xe(r)},Se=l,be=G,_e=H,Re=TypeError,Ce={exports:{}},Oe=i,Le=Object.defineProperty,Ie=function(e,t){try{Le(Oe,e,{value:t,configurable:!0,writable:!0})}catch(r){Oe[e]=t}return t},Pe=Ie,Me="__core-js_shared__",we=i[Me]||Pe(Me,{}),Fe=we;(Ce.exports=function(e,t){return Fe[e]||(Fe[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 Ne=N,De=Object,Ve=function(e){return De(Ne(e))},Ue=Ve,Be=A({}.hasOwnProperty),ke=Object.hasOwn||function(e,t){return Be(Ue(e),t)},ze=A,Ge=0,je=Math.random(),Xe=ze(1..toString),He=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Xe(++Ge+je,36)},Ye=i,We=Ce.exports,Ze=ke,qe=He,Ke=se,Qe=ue,Je=Ye.Symbol,$e=We("wks"),et=Qe?Je.for||Je:Je&&Je.withoutSetter||qe,tt=function(e){return Ze($e,e)||($e[e]=Ke&&Ze(Je,e)?Je[e]:et("Symbol."+e)),$e[e]},rt=l,it=H,nt=pe,ot=Ae,at=function(e,t){var r,i;if("string"===t&&be(r=e.toString)&&!_e(i=Se(r,e)))return i;if(be(r=e.valueOf)&&!_e(i=Se(r,e)))return i;if("string"!==t&&be(r=e.toString)&&!_e(i=Se(r,e)))return i;throw Re("Can't convert object to primitive value")},st=TypeError,ut=tt("toPrimitive"),ct=function(e,t){if(!it(e)||nt(e))return e;var r,i=ot(e,ut);if(i){if(void 0===t&&(t="default"),r=rt(i,e,t),!it(r)||nt(r))return r;throw st("Can't convert object to primitive value")}return void 0===t&&(t="number"),at(e,t)},lt=ct,ft=pe,ht=function(e){var t=lt(e,"string");return ft(t)?t:t+""},pt=H,dt=i.document,mt=pt(dt)&&pt(dt.createElement),vt=function(e){return mt?dt.createElement(e):{}},yt=vt,gt=!a&&!o((function(){return 7!==Object.defineProperty(yt("div"),"a",{get:function(){return 7}}).a})),Tt=a,xt=l,Et=f,At=y,St=U,bt=ht,_t=ke,Rt=gt,Ct=Object.getOwnPropertyDescriptor;n.f=Tt?Ct:function(e,t){if(e=St(e),t=bt(t),Rt)try{return Ct(e,t)}catch(e){}if(_t(e,t))return At(!xt(Et.f,e,t),e[t])};var Ot={},Lt=a&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),It=H,Pt=String,Mt=TypeError,wt=function(e){if(It(e))return e;throw Mt(Pt(e)+" is not an object")},Ft=a,Nt=gt,Dt=Lt,Vt=wt,Ut=ht,Bt=TypeError,kt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,Gt="enumerable",jt="configurable",Xt="writable";Ot.f=Ft?Dt?function(e,t,r){if(Vt(e),t=Ut(t),Vt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Xt in r&&!r[Xt]){var i=zt(e,t);i&&i[Xt]&&(e[t]=r.value,r={configurable:jt in r?r[jt]:i[jt],enumerable:Gt in r?r[Gt]:i[Gt],writable:!1})}return kt(e,t,r)}:kt:function(e,t,r){if(Vt(e),t=Ut(t),Vt(r),Nt)try{return kt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Bt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ht=Ot,Yt=y,Wt=a?function(e,t,r){return Ht.f(e,t,Yt(1,r))}:function(e,t,r){return e[t]=r,e},Zt={exports:{}},qt=a,Kt=ke,Qt=Function.prototype,Jt=qt&&Object.getOwnPropertyDescriptor,$t=Kt(Qt,"name"),er={EXISTS:$t,PROPER:$t&&"something"===function(){}.name,CONFIGURABLE:$t&&(!qt||qt&&Jt(Qt,"name").configurable)},tr=G,rr=we,ir=A(Function.toString);tr(rr.inspectSource)||(rr.inspectSource=function(e){return ir(e)});var nr,or,ar,sr=rr.inspectSource,ur=G,cr=i.WeakMap,lr=ur(cr)&&/native code/.test(String(cr)),fr=Ce.exports,hr=He,pr=fr("keys"),dr=function(e){return pr[e]||(pr[e]=hr(e))},mr={},vr=lr,yr=i,gr=H,Tr=Wt,xr=ke,Er=we,Ar=dr,Sr=mr,br="Object already initialized",_r=yr.TypeError,Rr=yr.WeakMap;if(vr||Er.state){var Cr=Er.state||(Er.state=new Rr);Cr.get=Cr.get,Cr.has=Cr.has,Cr.set=Cr.set,nr=function(e,t){if(Cr.has(e))throw _r(br);return t.facade=e,Cr.set(e,t),t},or=function(e){return Cr.get(e)||{}},ar=function(e){return Cr.has(e)}}else{var Or=Ar("state");Sr[Or]=!0,nr=function(e,t){if(xr(e,Or))throw _r(br);return t.facade=e,Tr(e,Or,t),t},or=function(e){return xr(e,Or)?e[Or]:{}},ar=function(e){return xr(e,Or)}}var Lr={set:nr,get:or,has:ar,enforce:function(e){return ar(e)?or(e):nr(e,{})},getterFor:function(e){return function(t){var r;if(!gr(t)||(r=or(t)).type!==e)throw _r("Incompatible receiver, "+e+" required");return r}}},Ir=A,Pr=o,Mr=G,wr=ke,Fr=a,Nr=er.CONFIGURABLE,Dr=sr,Vr=Lr.enforce,Ur=Lr.get,Br=String,kr=Object.defineProperty,zr=Ir("".slice),Gr=Ir("".replace),jr=Ir([].join),Xr=Fr&&!Pr((function(){return 8!==kr((function(){}),"length",{value:8}).length})),Hr=String(String).split("String"),Yr=Zt.exports=function(e,t,r){"Symbol("===zr(Br(t),0,7)&&(t="["+Gr(Br(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!wr(e,"name")||Nr&&e.name!==t)&&(Fr?kr(e,"name",{value:t,configurable:!0}):e.name=t),Xr&&r&&wr(r,"arity")&&e.length!==r.arity&&kr(e,"length",{value:r.arity});try{r&&wr(r,"constructor")&&r.constructor?Fr&&kr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var i=Vr(e);return wr(i,"source")||(i.source=jr(Hr,"string"==typeof t?t:"")),e};Function.prototype.toString=Yr((function(){return Mr(this)&&Ur(this).source||Dr(this)}),"toString");var Wr=G,Zr=Ot,qr=Zt.exports,Kr=Ie,Qr=function(e,t,r,i){i||(i={});var n=i.enumerable,o=void 0!==i.name?i.name:t;if(Wr(r)&&qr(r,o,i),i.global)n?e[t]=r:Kr(t,r);else{try{i.unsafe?e[t]&&(n=!0):delete e[t]}catch(e){}n?e[t]=r:Zr.f(e,t,{value:r,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return e},Jr={},$r=Math.ceil,ei=Math.floor,ti=Math.trunc||function(e){var t=+e;return(t>0?ei:$r)(t)},ri=ti,ii=function(e){var t=+e;return t!=t||0===t?0:ri(t)},ni=ii,oi=Math.max,ai=Math.min,si=function(e,t){var r=ni(e);return r<0?oi(r+t,0):ai(r,t)},ui=ii,ci=Math.min,li=function(e){return e>0?ci(ui(e),9007199254740991):0},fi=li,hi=function(e){return fi(e.length)},pi=U,di=si,mi=hi,vi=function(e){return function(t,r,i){var n,o=pi(t),a=mi(o),s=di(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}},yi={includes:vi(!0),indexOf:vi(!1)},gi=ke,Ti=U,xi=yi.indexOf,Ei=mr,Ai=A([].push),Si=function(e,t){var r,i=Ti(e),n=0,o=[];for(r in i)!gi(Ei,r)&&gi(i,r)&&Ai(o,r);for(;t.length>n;)gi(i,r=t[n++])&&(~xi(o,r)||Ai(o,r));return o},bi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],_i=Si,Ri=bi.concat("length","prototype");Jr.f=Object.getOwnPropertyNames||function(e){return _i(e,Ri)};var Ci={};Ci.f=Object.getOwnPropertySymbols;var Oi=Z,Li=Jr,Ii=Ci,Pi=wt,Mi=A([].concat),wi=Oi("Reflect","ownKeys")||function(e){var t=Li.f(Pi(e)),r=Ii.f;return r?Mi(t,r(e)):t},Fi=ke,Ni=wi,Di=n,Vi=Ot,Ui=o,Bi=G,ki=/#|\.prototype\./,zi=function(e,t){var r=ji[Gi(e)];return r===Hi||r!==Xi&&(Bi(t)?Ui(t):!!t)},Gi=zi.normalize=function(e){return String(e).replace(ki,".").toLowerCase()},ji=zi.data={},Xi=zi.NATIVE="N",Hi=zi.POLYFILL="P",Yi=zi,Wi=i,Zi=n.f,qi=Wt,Ki=Qr,Qi=Ie,Ji=function(e,t,r){for(var i=Ni(t),n=Vi.f,o=Di.f,a=0;a<i.length;a++){var s=i[a];Fi(e,s)||r&&Fi(r,s)||n(e,s,o(t,s))}},$i=Yi,en=function(e,t){var r,i,n,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?Wi:c?Wi[s]||Qi(s,{}):(Wi[s]||{}).prototype)for(i in t){if(o=t[i],n=e.dontCallGetSet?(a=Zi(r,i))&&a.value:r[i],!$i(u?i:s+(c?".":"#")+i,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;Ji(o,n)}(e.sham||n&&n.sham)&&qi(o,"sham",!0),Ki(r,i,o,e)}},tn={},rn=Si,nn=bi,on=Object.keys||function(e){return rn(e,nn)},an=a,sn=Lt,un=Ot,cn=wt,ln=U,fn=on;tn.f=an&&!sn?Object.defineProperties:function(e,t){cn(e);for(var r,i=ln(t),n=fn(t),o=n.length,a=0;o>a;)un.f(e,r=n[a++],i[r]);return e};var hn,pn=Z("document","documentElement"),dn=wt,mn=tn,vn=bi,yn=mr,gn=pn,Tn=vt,xn="prototype",En="script",An=dr("IE_PROTO"),Sn=function(){},bn=function(e){return"<"+En+">"+e+"</"+En+">"},_n=function(e){e.write(bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Rn=function(){try{hn=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Rn="undefined"!=typeof document?document.domain&&hn?_n(hn):(t=Tn("iframe"),r="java"+En+":",t.style.display="none",gn.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(bn("document.F=Object")),e.close(),e.F):_n(hn);for(var i=vn.length;i--;)delete Rn[xn][vn[i]];return Rn()};yn[An]=!0;var Cn=Object.create||function(e,t){var r;return null!==e?(Sn[xn]=dn(e),r=new Sn,Sn[xn]=null,r[An]=e):r=Rn(),void 0===t?r:mn.f(r,t)},On=tt,Ln=Cn,In=Ot.f,Pn=On("unscopables"),Mn=Array.prototype;void 0===Mn[Pn]&&In(Mn,Pn,{configurable:!0,value:Ln(null)});var wn=function(e){Mn[Pn][e]=!0},Fn=yi.includes,Nn=wn;en({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return Fn(this,e,arguments.length>1?arguments[1]:void 0)}}),Nn("includes");var Dn=i,Vn=A;(function(e,t){Vn(Dn[e].prototype[t])})("Array","includes");var Un=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Bn=ke,kn=G,zn=Ve,Gn=Un,jn=dr("IE_PROTO"),Xn=Object,Hn=Xn.prototype,Yn=Gn?Xn.getPrototypeOf:function(e){var t=zn(e);if(Bn(t,jn))return t[jn];var r=t.constructor;return kn(r)&&t instanceof r?r.prototype:t instanceof Xn?Hn:null},Wn=a,Zn=o,qn=A,Kn=Yn,Qn=on,Jn=U,$n=qn(f.f),eo=qn([].push),to=Wn&&Zn((function(){var e=Object.create(null);return e[2]=2,!$n(e,2)})),ro=function(e){return function(t){for(var r,i=Jn(t),n=Qn(i),o=to&&null===Kn(i),a=n.length,s=0,u=[];a>s;)r=n[s++],Wn&&!(o?r in i:$n(i,r))||eo(u,e?[r,i[r]]:i[r]);return u}},io={entries:ro(!0),values:ro(!1)},no=io.values;en({target:"Object",stat:!0},{values:function(e){return no(e)}});var oo=i;oo.Object.values;var ao=io.entries;en({target:"Object",stat:!0},{entries:function(e){return ao(e)}}),oo.Object.entries;var so={exports:{}},uo=tt("iterator"),co=!1;try{var lo=0,fo={next:function(){return{done:!!lo++}},return:function(){co=!0}};fo[uo]=function(){return this},Array.from(fo,(function(){throw 2}))}catch(e){}var ho=function(e,t){if(!t&&!co)return!1;var r=!1;try{var i={};i[uo]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},po="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,mo={};mo[tt("toStringTag")]="z";var vo,yo,go,To="[object z]"===String(mo),xo=To,Eo=G,Ao=R,So=tt("toStringTag"),bo=Object,_o="Arguments"===Ao(function(){return arguments}()),Ro=xo?Ao: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=bo(e),So))?r:_o?Ao(t):"Object"===(i=Ao(t))&&Eo(t.callee)?"Arguments":i},Co=Zt.exports,Oo=Ot,Lo=function(e,t,r){return r.get&&Co(r.get,t,{getter:!0}),r.set&&Co(r.set,t,{setter:!0}),Oo.f(e,t,r)},Io=A,Po=Te,Mo=G,wo=String,Fo=TypeError,No=function(e,t,r){try{return Io(Po(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},Do=wt,Vo=function(e){if("object"==typeof e||Mo(e))return e;throw Fo("Can't set "+wo(e)+" as a prototype")},Uo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=No(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return Do(r),Vo(i),t?e(r,i):r.__proto__=i,r}}():void 0),Bo=po,ko=a,zo=i,Go=G,jo=H,Xo=ke,Ho=Ro,Yo=me,Wo=Wt,Zo=Qr,qo=Lo,Ko=q,Qo=Yn,Jo=Uo,$o=tt,ea=He,ta=Lr.enforce,ra=Lr.get,ia=zo.Int8Array,na=ia&&ia.prototype,oa=zo.Uint8ClampedArray,aa=oa&&oa.prototype,sa=ia&&Qo(ia),ua=na&&Qo(na),ca=Object.prototype,la=zo.TypeError,fa=$o("toStringTag"),ha=ea("TYPED_ARRAY_TAG"),pa="TypedArrayConstructor",da=Bo&&!!Jo&&"Opera"!==Ho(zo.opera),ma=!1,va={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ya={BigInt64Array:8,BigUint64Array:8},ga=function(e){var t=Qo(e);if(jo(t)){var r=ra(t);return r&&Xo(r,pa)?r[pa]:ga(t)}},Ta=function(e){if(!jo(e))return!1;var t=Ho(e);return Xo(va,t)||Xo(ya,t)};for(vo in va)(go=(yo=zo[vo])&&yo.prototype)?ta(go)[pa]=yo:da=!1;for(vo in ya)(go=(yo=zo[vo])&&yo.prototype)&&(ta(go)[pa]=yo);if((!da||!Go(sa)||sa===Function.prototype)&&(sa=function(){throw la("Incorrect invocation")},da))for(vo in va)zo[vo]&&Jo(zo[vo],sa);if((!da||!ua||ua===ca)&&(ua=sa.prototype,da))for(vo in va)zo[vo]&&Jo(zo[vo].prototype,ua);if(da&&Qo(aa)!==ua&&Jo(aa,ua),ko&&!Xo(ua,fa))for(vo in ma=!0,qo(ua,fa,{configurable:!0,get:function(){return jo(this)?this[ha]:void 0}}),va)zo[vo]&&Wo(zo[vo],ha,vo);var xa={NATIVE_ARRAY_BUFFER_VIEWS:da,TYPED_ARRAY_TAG:ma&&ha,aTypedArray:function(e){if(Ta(e))return e;throw la("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Go(e)&&(!Jo||Ko(sa,e)))return e;throw la(Yo(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,i){if(ko){if(r)for(var n in va){var o=zo[n];if(o&&Xo(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}ua[e]&&!r||Zo(ua,e,r?t:da&&na[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,r){var i,n;if(ko){if(Jo){if(r)for(i in va)if((n=zo[i])&&Xo(n,e))try{delete n[e]}catch(e){}if(sa[e]&&!r)return;try{return Zo(sa,e,r?t:da&&sa[e]||t)}catch(e){}}for(i in va)!(n=zo[i])||n[e]&&!r||Zo(n,e,t)}},getTypedArrayConstructor:ga,isView:function(e){if(!jo(e))return!1;var t=Ho(e);return"DataView"===t||Xo(va,t)||Xo(ya,t)},isTypedArray:Ta,TypedArray:sa,TypedArrayPrototype:ua},Ea=i,Aa=o,Sa=ho,ba=xa.NATIVE_ARRAY_BUFFER_VIEWS,_a=Ea.ArrayBuffer,Ra=Ea.Int8Array,Ca=!ba||!Aa((function(){Ra(1)}))||!Aa((function(){new Ra(-1)}))||!Sa((function(e){new Ra,new Ra(null),new Ra(1.5),new Ra(e)}),!0)||Aa((function(){return 1!==new Ra(new _a(2),1,void 0).length})),Oa=Qr,La=function(e,t,r){for(var i in t)Oa(e,i,t[i],r);return e},Ia=q,Pa=TypeError,Ma=function(e,t){if(Ia(t,e))return e;throw Pa("Incorrect invocation")},wa=ii,Fa=li,Na=RangeError,Da=function(e){if(void 0===e)return 0;var t=wa(e),r=Fa(t);if(t!==r)throw Na("Wrong length or index");return r},Va=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1},Ua=ti,Ba=Array,ka=Math.abs,za=Math.pow,Ga=Math.floor,ja=Math.log,Xa=Math.LN2,Ha=function(e){var t=Ua(e),r=ka(e-t);return r>.5||.5===r&&t%2!=0?t+Va(e):t},Ya={pack:function(e,t,r){var i,n,o,a=Ba(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,l=23===t?za(2,-24)-za(2,-77):0,f=e<0||0===e&&1/e<0?1:0,h=0;for((e=ka(e))!=e||e===1/0?(n=e!=e?1:0,i=u):(i=Ga(ja(e)/Xa),e*(o=za(2,-i))<1&&(i--,o*=2),(e+=i+c>=1?l/o:l*za(2,1-c))*o>=2&&(i++,o/=2),i+c>=u?(n=0,i=u):i+c>=1?(n=Ha((e*o-1)*za(2,t)),i+=c):(n=Ha(e*za(2,c-1)*za(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+=za(2,t),l-=a}return(c?-1:1)*r*za(2,l-t)}},Wa=Ve,Za=si,qa=hi,Ka=function(e){for(var t=Wa(this),r=qa(t),i=arguments.length,n=Za(i>1?arguments[1]:void 0,r),o=i>2?arguments[2]:void 0,a=void 0===o?r:Za(o,r);a>n;)t[n++]=e;return t},Qa=ht,Ja=Ot,$a=y,es=si,ts=hi,rs=function(e,t,r){var i=Qa(t);i in e?Ja.f(e,i,$a(0,r)):e[i]=r},is=Array,ns=Math.max,os=function(e,t,r){for(var i=ts(e),n=es(t,i),o=es(void 0===r?i:r,i),a=is(ns(o-n,0)),s=0;n<o;n++,s++)rs(a,s,e[n]);return a.length=s,a},as=Ot.f,ss=ke,us=tt("toStringTag"),cs=function(e,t,r){e&&!r&&(e=e.prototype),e&&!ss(e,us)&&as(e,us,{configurable:!0,value:t})},ls=i,fs=A,hs=a,ps=po,ds=er,ms=Wt,vs=Lo,ys=La,gs=o,Ts=Ma,xs=ii,Es=li,As=Da,Ss=Ya,bs=Yn,_s=Uo,Rs=Jr.f,Cs=Ka,Os=os,Ls=cs,Is=Lr,Ps=ds.PROPER,Ms=ds.CONFIGURABLE,ws="ArrayBuffer",Fs="DataView",Ns="prototype",Ds="Wrong index",Vs=Is.getterFor(ws),Us=Is.getterFor(Fs),Bs=Is.set,ks=ls[ws],zs=ks,Gs=zs&&zs[Ns],js=ls[Fs],Xs=js&&js[Ns],Hs=Object.prototype,Ys=ls.Array,Ws=ls.RangeError,Zs=fs(Cs),qs=fs([].reverse),Ks=Ss.pack,Qs=Ss.unpack,Js=function(e){return[255&e]},$s=function(e){return[255&e,e>>8&255]},eu=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},tu=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},ru=function(e){return Ks(e,23,4)},iu=function(e){return Ks(e,52,8)},nu=function(e,t,r){vs(e[Ns],t,{configurable:!0,get:function(){return r(this)[t]}})},ou=function(e,t,r,i){var n=Us(e),o=As(r),a=!!i;if(o+t>n.byteLength)throw Ws(Ds);var s=n.bytes,u=o+n.byteOffset,c=Os(s,u,u+t);return a?c:qs(c)},au=function(e,t,r,i,n,o){var a=Us(e),s=As(r),u=i(+n),c=!!o;if(s+t>a.byteLength)throw Ws(Ds);for(var l=a.bytes,f=s+a.byteOffset,h=0;h<t;h++)l[f+h]=u[c?h:t-h-1]};if(ps){var su=Ps&&ks.name!==ws;if(gs((function(){ks(1)}))&&gs((function(){new ks(-1)}))&&!gs((function(){return new ks,new ks(1.5),new ks(NaN),1!==ks.length||su&&!Ms})))su&&Ms&&ms(ks,"name",ws);else{(zs=function(e){return Ts(this,Gs),new ks(As(e))})[Ns]=Gs;for(var uu,cu=Rs(ks),lu=0;cu.length>lu;)(uu=cu[lu++])in zs||ms(zs,uu,ks[uu]);Gs.constructor=zs}_s&&bs(Xs)!==Hs&&_s(Xs,Hs);var fu=new js(new zs(2)),hu=fs(Xs.setInt8);fu.setInt8(0,2147483648),fu.setInt8(1,2147483649),!fu.getInt8(0)&&fu.getInt8(1)||ys(Xs,{setInt8:function(e,t){hu(this,e,t<<24>>24)},setUint8:function(e,t){hu(this,e,t<<24>>24)}},{unsafe:!0})}else Gs=(zs=function(e){Ts(this,Gs);var t=As(e);Bs(this,{type:ws,bytes:Zs(Ys(t),0),byteLength:t}),hs||(this.byteLength=t,this.detached=!1)})[Ns],Xs=(js=function(e,t,r){Ts(this,Xs),Ts(e,Gs);var i=Vs(e),n=i.byteLength,o=xs(t);if(o<0||o>n)throw Ws("Wrong offset");if(o+(r=void 0===r?n-o:Es(r))>n)throw Ws("Wrong length");Bs(this,{type:Fs,buffer:e,byteLength:r,byteOffset:o,bytes:i.bytes}),hs||(this.buffer=e,this.byteLength=r,this.byteOffset=o)})[Ns],hs&&(nu(zs,"byteLength",Vs),nu(js,"buffer",Us),nu(js,"byteLength",Us),nu(js,"byteOffset",Us)),ys(Xs,{getInt8:function(e){return ou(this,1,e)[0]<<24>>24},getUint8:function(e){return ou(this,1,e)[0]},getInt16:function(e){var t=ou(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=ou(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return tu(ou(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return tu(ou(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return Qs(ou(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return Qs(ou(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){au(this,1,e,Js,t)},setUint8:function(e,t){au(this,1,e,Js,t)},setInt16:function(e,t){au(this,2,e,$s,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){au(this,2,e,$s,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){au(this,4,e,eu,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){au(this,4,e,eu,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){au(this,4,e,ru,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){au(this,8,e,iu,t,arguments.length>2&&arguments[2])}});Ls(zs,ws),Ls(js,Fs);var pu={ArrayBuffer:zs,DataView:js},du=H,mu=Math.floor,vu=Number.isInteger||function(e){return!du(e)&&isFinite(e)&&mu(e)===e},yu=ii,gu=RangeError,Tu=function(e){var t=yu(e);if(t<0)throw gu("The argument can't be less than 0");return t},xu=RangeError,Eu=function(e,t){var r=Tu(e);if(r%t)throw xu("Wrong offset");return r},Au=Math.round,Su=R,bu=A,_u=function(e){if("Function"===Su(e))return bu(e)},Ru=Te,Cu=s,Ou=_u(_u.bind),Lu=function(e,t){return Ru(e),void 0===t?e:Cu?Ou(e,t):function(){return e.apply(t,arguments)}},Iu=A,Pu=o,Mu=G,wu=Ro,Fu=sr,Nu=function(){},Du=[],Vu=Z("Reflect","construct"),Uu=/^\s*(?:class|function)\b/,Bu=Iu(Uu.exec),ku=!Uu.exec(Nu),zu=function(e){if(!Mu(e))return!1;try{return Vu(Nu,Du,e),!0}catch(e){return!1}},Gu=function(e){if(!Mu(e))return!1;switch(wu(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ku||!!Bu(Uu,Fu(e))}catch(e){return!0}};Gu.sham=!0;var ju=!Vu||Pu((function(){var e;return zu(zu.call)||!zu(Object)||!zu((function(){e=!0}))||e}))?Gu:zu,Xu=ju,Hu=me,Yu=TypeError,Wu=function(e){if(Xu(e))return e;throw Yu(Hu(e)+" is not a constructor")},Zu={},qu=Ro,Ku=Ae,Qu=M,Ju=Zu,$u=tt("iterator"),ec=function(e){if(!Qu(e))return Ku(e,$u)||Ku(e,"@@iterator")||Ju[qu(e)]},tc=l,rc=Te,ic=wt,nc=me,oc=ec,ac=TypeError,sc=function(e,t){var r=arguments.length<2?oc(e):t;if(rc(r))return ic(tc(r,e));throw ac(nc(e)+" is not iterable")},uc=Zu,cc=tt("iterator"),lc=Array.prototype,fc=function(e){return void 0!==e&&(uc.Array===e||lc[cc]===e)},hc=Ro,pc=function(e){var t=hc(e);return"BigInt64Array"===t||"BigUint64Array"===t},dc=ct,mc=TypeError,vc=function(e){var t=dc(e,"number");if("number"==typeof t)throw mc("Can't convert number to bigint");return BigInt(t)},yc=Lu,gc=l,Tc=Wu,xc=Ve,Ec=hi,Ac=sc,Sc=ec,bc=fc,_c=pc,Rc=xa.aTypedArrayConstructor,Cc=vc,Oc=function(e){var t,r,i,n,o,a,s,u,c=Tc(this),l=xc(e),f=arguments.length,h=f>1?arguments[1]:void 0,p=void 0!==h,d=Sc(l);if(d&&!bc(d))for(u=(s=Ac(l,d)).next,l=[];!(a=gc(u,s)).done;)l.push(a.value);for(p&&f>2&&(h=yc(h,arguments[2])),r=Ec(l),i=new(Rc(c))(r),n=_c(i),t=0;r>t;t++)o=p?h(l[t],t):l[t],i[t]=n?Cc(o):+o;return i},Lc=R,Ic=Array.isArray||function(e){return"Array"===Lc(e)},Pc=ju,Mc=H,wc=tt("species"),Fc=Array,Nc=function(e){var t;return Ic(e)&&(t=e.constructor,(Pc(t)&&(t===Fc||Ic(t.prototype))||Mc(t)&&null===(t=t[wc]))&&(t=void 0)),void 0===t?Fc:t},Dc=Lu,Vc=P,Uc=Ve,Bc=hi,kc=function(e,t){return new(Nc(e))(0===t?0:t)},zc=A([].push),Gc=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=Uc(u),m=Vc(d),v=Dc(c,l),y=Bc(m),g=0,T=f||kc,x=t?T(u,y):r||a?T(u,0):void 0;y>g;g++)if((s||g in m)&&(p=v(h=m[g],g,d),e))if(t)x[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:zc(x,h)}else switch(e){case 4:return!1;case 7:zc(x,h)}return o?-1:i||n?n:x}},jc={forEach:Gc(0),map:Gc(1),filter:Gc(2),some:Gc(3),every:Gc(4),find:Gc(5),findIndex:Gc(6),filterReject:Gc(7)},Xc=Z,Hc=Lo,Yc=a,Wc=tt("species"),Zc=function(e){var t=Xc(e);Yc&&t&&!t[Wc]&&Hc(t,Wc,{configurable:!0,get:function(){return this}})},qc=G,Kc=H,Qc=Uo,Jc=function(e,t,r){var i,n;return Qc&&qc(i=t.constructor)&&i!==r&&Kc(n=i.prototype)&&n!==r.prototype&&Qc(e,n),e},$c=en,el=i,tl=l,rl=a,il=Ca,nl=xa,ol=pu,al=Ma,sl=y,ul=Wt,cl=vu,ll=li,fl=Da,hl=Eu,pl=function(e){var t=Au(e);return t<0?0:t>255?255:255&t},dl=ht,ml=ke,vl=Ro,yl=H,gl=pe,Tl=Cn,xl=q,El=Uo,Al=Jr.f,Sl=Oc,bl=jc.forEach,_l=Zc,Rl=Lo,Cl=Ot,Ol=n,Ll=Jc,Il=Lr.get,Pl=Lr.set,Ml=Lr.enforce,wl=Cl.f,Fl=Ol.f,Nl=el.RangeError,Dl=ol.ArrayBuffer,Vl=Dl.prototype,Ul=ol.DataView,Bl=nl.NATIVE_ARRAY_BUFFER_VIEWS,kl=nl.TYPED_ARRAY_TAG,zl=nl.TypedArray,Gl=nl.TypedArrayPrototype,jl=nl.aTypedArrayConstructor,Xl=nl.isTypedArray,Hl="BYTES_PER_ELEMENT",Yl="Wrong length",Wl=function(e,t){jl(e);for(var r=0,i=t.length,n=new e(i);i>r;)n[r]=t[r++];return n},Zl=function(e,t){Rl(e,t,{configurable:!0,get:function(){return Il(this)[t]}})},ql=function(e){var t;return xl(Vl,e)||"ArrayBuffer"===(t=vl(e))||"SharedArrayBuffer"===t},Kl=function(e,t){return Xl(e)&&!gl(t)&&t in e&&cl(+t)&&t>=0},Ql=function(e,t){return t=dl(t),Kl(e,t)?sl(2,e[t]):Fl(e,t)},Jl=function(e,t,r){return t=dl(t),!(Kl(e,t)&&yl(r)&&ml(r,"value"))||ml(r,"get")||ml(r,"set")||r.configurable||ml(r,"writable")&&!r.writable||ml(r,"enumerable")&&!r.enumerable?wl(e,t,r):(e[t]=r.value,e)};rl?(Bl||(Ol.f=Ql,Cl.f=Jl,Zl(Gl,"buffer"),Zl(Gl,"byteOffset"),Zl(Gl,"byteLength"),Zl(Gl,"length")),$c({target:"Object",stat:!0,forced:!Bl},{getOwnPropertyDescriptor:Ql,defineProperty:Jl}),so.exports=function(e,t,r){var i=e.match(/\d+/)[0]/8,n=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=el[n],u=s,c=u&&u.prototype,l={},f=function(e,t){wl(e,t,{get:function(){return function(e,t){var r=Il(e);return r.view[o](t*i+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=Il(e);o.view[a](t*i+o.byteOffset,r?pl(n):n,!0)}(this,t,e)},enumerable:!0})};Bl?il&&(u=t((function(e,t,r,n){return al(e,c),Ll(yl(t)?ql(t)?void 0!==n?new s(t,hl(r,i),n):void 0!==r?new s(t,hl(r,i)):new s(t):Xl(t)?Wl(u,t):tl(Sl,u,t):new s(fl(t)),e,u)})),El&&El(u,zl),bl(Al(s),(function(e){e in u||ul(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,n){al(e,c);var o,a,s,l=0,h=0;if(yl(t)){if(!ql(t))return Xl(t)?Wl(u,t):tl(Sl,u,t);o=t,h=hl(r,i);var p=t.byteLength;if(void 0===n){if(p%i)throw Nl(Yl);if((a=p-h)<0)throw Nl(Yl)}else if((a=ll(n)*i)+h>p)throw Nl(Yl);s=a/i}else s=fl(t),o=new Dl(a=s*i);for(Pl(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new Ul(o)});l<s;)f(e,l++)})),El&&El(u,zl),c=u.prototype=Tl(Gl)),c.constructor!==u&&ul(c,"constructor",u),Ml(c).TypedArrayConstructor=u,kl&&ul(c,kl,n);var h=u!==s;l[n]=u,$c({global:!0,constructor:!0,forced:h,sham:!Bl},l),Hl in u||ul(u,Hl,i),Hl in c||ul(c,Hl,i),_l(n)}):so.exports=function(){},(0,so.exports)("Int8",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}}),!0),(0,so.exports)("Int16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Uint16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Int32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Uint32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Float32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Float64",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var $l=Ro,ef=To?{}.toString:function(){return"[object "+$l(this)+"]"};To||Qr(Object.prototype,"toString",ef,{unsafe:!0});var tf,rf,nf,of=Ro,af=String,sf=function(e){if("Symbol"===of(e))throw TypeError("Cannot convert a Symbol value to a string");return af(e)},uf=A,cf=ii,lf=sf,ff=N,hf=uf("".charAt),pf=uf("".charCodeAt),df=uf("".slice),mf=function(e){return function(t,r){var i,n,o=lf(ff(t)),a=cf(r),s=o.length;return a<0||a>=s?e?"":void 0:(i=pf(o,a))<55296||i>56319||a+1===s||(n=pf(o,a+1))<56320||n>57343?e?hf(o,a):i:e?df(o,a,a+2):n-56320+(i-55296<<10)+65536}},vf={codeAt:mf(!1),charAt:mf(!0)},yf=o,gf=G,Tf=H,xf=Yn,Ef=Qr,Af=tt("iterator"),Sf=!1;[].keys&&("next"in(nf=[].keys())?(rf=xf(xf(nf)))!==Object.prototype&&(tf=rf):Sf=!0);var bf=!Tf(tf)||yf((function(){var e={};return tf[Af].call(e)!==e}));bf&&(tf={}),gf(tf[Af])||Ef(tf,Af,(function(){return this}));var _f={IteratorPrototype:tf,BUGGY_SAFARI_ITERATORS:Sf},Rf=_f.IteratorPrototype,Cf=Cn,Of=y,Lf=cs,If=Zu,Pf=function(){return this},Mf=en,wf=l,Ff=G,Nf=function(e,t,r,i){var n=t+" Iterator";return e.prototype=Cf(Rf,{next:Of(+!i,r)}),Lf(e,n,!1),If[n]=Pf,e},Df=Yn,Vf=Uo,Uf=cs,Bf=Wt,kf=Qr,zf=Zu,Gf=er.PROPER,jf=er.CONFIGURABLE,Xf=_f.IteratorPrototype,Hf=_f.BUGGY_SAFARI_ITERATORS,Yf=tt("iterator"),Wf="keys",Zf="values",qf="entries",Kf=function(){return this},Qf=function(e,t,r,i,n,o,a){Nf(r,t,i);var s,u,c,l=function(e){if(e===n&&m)return m;if(!Hf&&e in p)return p[e];switch(e){case Wf:case Zf:case qf:return function(){return new r(this,e)}}return function(){return new r(this)}},f=t+" Iterator",h=!1,p=e.prototype,d=p[Yf]||p["@@iterator"]||n&&p[n],m=!Hf&&d||l(n),v="Array"===t&&p.entries||d;if(v&&(s=Df(v.call(new e)))!==Object.prototype&&s.next&&(Df(s)!==Xf&&(Vf?Vf(s,Xf):Ff(s[Yf])||kf(s,Yf,Kf)),Uf(s,f,!0)),Gf&&n===Zf&&d&&d.name!==Zf&&(jf?Bf(p,"name",Zf):(h=!0,m=function(){return wf(d,this)})),n)if(u={values:l(Zf),keys:o?m:l(Wf),entries:l(qf)},a)for(c in u)(Hf||h||!(c in p))&&kf(p,c,u[c]);else Mf({target:t,proto:!0,forced:Hf||h},u);return p[Yf]!==m&&kf(p,Yf,m,{name:n}),zf[t]=m,u},Jf=function(e,t){return{value:e,done:t}},$f=vf.charAt,eh=sf,th=Lr,rh=Qf,ih=Jf,nh="String Iterator",oh=th.set,ah=th.getterFor(nh);rh(String,"String",(function(e){oh(this,{type:nh,string:eh(e),index:0})}),(function(){var e,t=ah(this),r=t.string,i=t.index;return i>=r.length?ih(void 0,!0):(e=$f(r,i),t.index+=e.length,ih(e,!1))})),(0,xa.exportTypedArrayStaticMethod)("from",Oc,Ca);var sh=xa.aTypedArrayConstructor;(0,xa.exportTypedArrayStaticMethod)("of",(function(){for(var e=0,t=arguments.length,r=new(sh(this))(t);t>e;)r[e]=arguments[e++];return r}),Ca);var uh=hi,ch=ii,lh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("at",(function(e){var t=lh(this),r=uh(t),i=ch(e),n=i>=0?i:r+i;return n<0||n>=r?void 0:t[n]}));var fh=me,hh=TypeError,ph=Ve,dh=si,mh=hi,vh=function(e,t){if(!delete e[t])throw hh("Cannot delete property "+fh(t)+" of "+fh(e))},yh=Math.min,gh=[].copyWithin||function(e,t){var r=ph(this),i=mh(r),n=dh(e,i),o=dh(t,i),a=arguments.length>2?arguments[2]:void 0,s=yh((void 0===a?i:dh(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]:vh(r,n),n+=u,o+=u;return r},Th=xa,xh=A(gh),Eh=Th.aTypedArray;(0,Th.exportTypedArrayMethod)("copyWithin",(function(e,t){return xh(Eh(this),e,t,arguments.length>2?arguments[2]:void 0)}));var Ah=jc.every,Sh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("every",(function(e){return Ah(Sh(this),e,arguments.length>1?arguments[1]:void 0)}));var bh=Ka,_h=vc,Rh=Ro,Ch=l,Oh=o,Lh=xa.aTypedArray,Ih=xa.exportTypedArrayMethod,Ph=A("".slice);Ih("fill",(function(e){var t=arguments.length;Lh(this);var r="Big"===Ph(Rh(this),0,3)?_h(e):+e;return Ch(bh,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),Oh((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})));var Mh=hi,wh=function(e,t){for(var r=0,i=Mh(t),n=new e(i);i>r;)n[r]=t[r++];return n},Fh=wt,Nh=Wu,Dh=M,Vh=tt("species"),Uh=function(e,t){var r,i=Fh(e).constructor;return void 0===i||Dh(r=Fh(i)[Vh])?t:Nh(r)},Bh=Uh,kh=xa.aTypedArrayConstructor,zh=xa.getTypedArrayConstructor,Gh=function(e){return kh(Bh(e,zh(e)))},jh=wh,Xh=Gh,Hh=function(e,t){return jh(Xh(e),t)},Yh=jc.filter,Wh=Hh,Zh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("filter",(function(e){var t=Yh(Zh(this),e,arguments.length>1?arguments[1]:void 0);return Wh(this,t)}));var qh=jc.find,Kh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("find",(function(e){return qh(Kh(this),e,arguments.length>1?arguments[1]:void 0)}));var Qh=jc.findIndex,Jh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("findIndex",(function(e){return Qh(Jh(this),e,arguments.length>1?arguments[1]:void 0)}));var $h=Lu,ep=P,tp=Ve,rp=hi,ip=function(e){var t=1===e;return function(r,i,n){for(var o,a=tp(r),s=ep(a),u=$h(i,n),c=rp(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}},np={findLast:ip(0),findLastIndex:ip(1)},op=np.findLast,ap=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("findLast",(function(e){return op(ap(this),e,arguments.length>1?arguments[1]:void 0)}));var sp=np.findLastIndex,up=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("findLastIndex",(function(e){return sp(up(this),e,arguments.length>1?arguments[1]:void 0)}));var cp=jc.forEach,lp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("forEach",(function(e){cp(lp(this),e,arguments.length>1?arguments[1]:void 0)}));var fp=yi.includes,hp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("includes",(function(e){return fp(hp(this),e,arguments.length>1?arguments[1]:void 0)}));var pp=yi.indexOf,dp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("indexOf",(function(e){return pp(dp(this),e,arguments.length>1?arguments[1]:void 0)}));var mp=xa.aTypedArray,vp=xa.exportTypedArrayMethod,yp=A([].join);vp("join",(function(e){return yp(mp(this),e)}));var gp=s,Tp=Function.prototype,xp=Tp.apply,Ep=Tp.call,Ap="object"==typeof Reflect&&Reflect.apply||(gp?Ep.bind(xp):function(){return Ep.apply(xp,arguments)}),Sp=o,bp=Ap,_p=U,Rp=ii,Cp=hi,Op=function(e,t){var r=[][e];return!!r&&Sp((function(){r.call(null,t||function(){return 1},1)}))},Lp=Math.min,Ip=[].lastIndexOf,Pp=!!Ip&&1/[1].lastIndexOf(1,-0)<0,Mp=Op("lastIndexOf"),wp=Pp||!Mp?function(e){if(Pp)return bp(Ip,this,arguments)||0;var t=_p(this),r=Cp(t),i=r-1;for(arguments.length>1&&(i=Lp(i,Rp(arguments[1]))),i<0&&(i=r+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:Ip,Fp=Ap,Np=wp,Dp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Fp(Np,Dp(this),t>1?[e,arguments[1]]:[e])}));var Vp=jc.map,Up=Gh,Bp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("map",(function(e){return Vp(Bp(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(Up(e))(t)}))}));var kp=Te,zp=Ve,Gp=P,jp=hi,Xp=TypeError,Hp=function(e){return function(t,r,i,n){kp(r);var o=zp(t),a=Gp(o),s=jp(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 Xp("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}},Yp={left:Hp(!1),right:Hp(!0)},Wp=Yp.left,Zp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return Wp(Zp(this),e,t,t>1?arguments[1]:void 0)}));var qp=Yp.right,Kp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return qp(Kp(this),e,t,t>1?arguments[1]:void 0)}));var Qp=xa.aTypedArray,Jp=xa.exportTypedArrayMethod,$p=Math.floor;Jp("reverse",(function(){for(var e,t=this,r=Qp(t).length,i=$p(r/2),n=0;n<i;)e=t[n],t[n++]=t[--r],t[r]=e;return t}));var ed=i,td=l,rd=xa,id=hi,nd=Eu,od=Ve,ad=o,sd=ed.RangeError,ud=ed.Int8Array,cd=ud&&ud.prototype,ld=cd&&cd.set,fd=rd.aTypedArray,hd=rd.exportTypedArrayMethod,pd=!ad((function(){var e=new Uint8ClampedArray(2);return td(ld,e,{length:1,0:3},1),3!==e[1]})),dd=pd&&rd.NATIVE_ARRAY_BUFFER_VIEWS&&ad((function(){var e=new ud(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));hd("set",(function(e){fd(this);var t=nd(arguments.length>1?arguments[1]:void 0,1),r=od(e);if(pd)return td(ld,this,r,t);var i=this.length,n=id(r),o=0;if(n+t>i)throw sd("Wrong length");for(;o<n;)this[t+o]=r[o++]}),!pd||dd);var md=A([].slice),vd=Gh,yd=md,gd=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("slice",(function(e,t){for(var r=yd(gd(this),e,t),i=vd(this),n=0,o=r.length,a=new i(o);o>n;)a[n]=r[n++];return a}),o((function(){new Int8Array(1).slice()})));var Td=jc.some,xd=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("some",(function(e){return Td(xd(this),e,arguments.length>1?arguments[1]:void 0)}));var Ed=os,Ad=Math.floor,Sd=function(e,t){var r=e.length,i=Ad(r/2);return r<8?bd(e,t):_d(e,Sd(Ed(e,0,i),t),Sd(Ed(e,i),t),t)},bd=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},_d=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},Rd=Sd,Cd=K.match(/firefox\/(\d+)/i),Od=!!Cd&&+Cd[1],Ld=/MSIE|Trident/.test(K),Id=K.match(/AppleWebKit\/(\d+)\./),Pd=!!Id&&+Id[1],Md=_u,wd=o,Fd=Te,Nd=Rd,Dd=Od,Vd=Ld,Ud=ie,Bd=Pd,kd=xa.aTypedArray,zd=xa.exportTypedArrayMethod,Gd=i.Uint16Array,jd=Gd&&Md(Gd.prototype.sort),Xd=!(!jd||wd((function(){jd(new Gd(2),null)}))&&wd((function(){jd(new Gd(2),{})}))),Hd=!!jd&&!wd((function(){if(Ud)return Ud<74;if(Dd)return Dd<67;if(Vd)return!0;if(Bd)return Bd<602;var e,t,r=new Gd(516),i=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,i[e]=e-2*t+3;for(jd(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==i[e])return!0}));zd("sort",(function(e){return void 0!==e&&Fd(e),Hd?jd(this,e):Nd(kd(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))}),!Hd||Xd);var Yd=li,Wd=si,Zd=Gh,qd=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("subarray",(function(e,t){var r=qd(this),i=r.length,n=Wd(e,i);return new(Zd(r))(r.buffer,r.byteOffset+n*r.BYTES_PER_ELEMENT,Yd((void 0===t?i:Wd(t,i))-n))}));var Kd=Ap,Qd=xa,Jd=o,$d=md,em=i.Int8Array,tm=Qd.aTypedArray,rm=Qd.exportTypedArrayMethod,im=[].toLocaleString,nm=!!em&&Jd((function(){im.call(new em(1))}));rm("toLocaleString",(function(){return Kd(im,nm?$d(tm(this)):tm(this),$d(arguments))}),Jd((function(){return[1,2].toLocaleString()!==new em([1,2]).toLocaleString()}))||!Jd((function(){em.prototype.toLocaleString.call([1,2])})));var om=xa.exportTypedArrayMethod,am=o,sm=A,um=i.Uint8Array,cm=um&&um.prototype||{},lm=[].toString,fm=sm([].join);am((function(){lm.call({})}))&&(lm=function(){return fm(this)});var hm=cm.toString!==lm;om("toString",lm,hm);var pm=hi,dm=function(e,t){for(var r=pm(e),i=new t(r),n=0;n<r;n++)i[n]=e[r-n-1];return i},mm=xa.aTypedArray,vm=xa.getTypedArrayConstructor;(0,xa.exportTypedArrayMethod)("toReversed",(function(){return dm(mm(this),vm(this))}));var ym=Te,gm=wh,Tm=xa.aTypedArray,xm=xa.getTypedArrayConstructor,Em=xa.exportTypedArrayMethod,Am=A(xa.TypedArrayPrototype.sort);Em("toSorted",(function(e){void 0!==e&&ym(e);var t=Tm(this),r=gm(xm(t),t);return Am(r,e)}));var Sm=hi,bm=ii,_m=RangeError,Rm=function(e,t,r,i){var n=Sm(e),o=bm(r),a=o<0?n+o:o;if(a>=n||a<0)throw _m("Incorrect index");for(var s=new t(n),u=0;u<n;u++)s[u]=u===a?i:e[u];return s},Cm=pc,Om=ii,Lm=vc,Im=xa.aTypedArray,Pm=xa.getTypedArrayConstructor,Mm=xa.exportTypedArrayMethod,wm=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}();Mm("with",{with:function(e,t){var r=Im(this),i=Om(e),n=Cm(r)?Lm(t):+t;return Rm(r,Pm(r),i,n)}}.with,!wm);var Fm=U,Nm=wn,Dm=Zu,Vm=Lr,Um=Ot.f,Bm=Qf,km=Jf,zm=a,Gm="Array Iterator",jm=Vm.set,Xm=Vm.getterFor(Gm),Hm=Bm(Array,"Array",(function(e,t){jm(this,{type:Gm,target:Fm(e),index:0,kind:t})}),(function(){var e=Xm(this),t=e.target,r=e.kind,i=e.index++;if(!t||i>=t.length)return e.target=void 0,km(void 0,!0);switch(r){case"keys":return km(i,!1);case"values":return km(t[i],!1)}return km([i,t[i]],!1)}),"values"),Ym=Dm.Arguments=Dm.Array;if(Nm("keys"),Nm("values"),Nm("entries"),zm&&"values"!==Ym.name)try{Um(Ym,"name",{value:"values"})}catch(e){}var Wm=i,Zm=o,qm=A,Km=xa,Qm=Hm,Jm=tt("iterator"),$m=Wm.Uint8Array,ev=qm(Qm.values),tv=qm(Qm.keys),rv=qm(Qm.entries),iv=Km.aTypedArray,nv=Km.exportTypedArrayMethod,ov=$m&&$m.prototype,av=!Zm((function(){ov[Jm].call([1])})),sv=!!ov&&ov.values&&ov[Jm]===ov.values&&"values"===ov.values.name,uv=function(){return ev(iv(this))};nv("entries",(function(){return rv(iv(this))}),av),nv("keys",(function(){return tv(iv(this))}),av),nv("values",uv,av||!sv,{name:"values"}),nv(Jm,uv,av||!sv,{name:"values"});var cv=hi,lv=pc,fv=si,hv=vc,pv=ii,dv=o,mv=xa.aTypedArray,vv=xa.getTypedArrayConstructor,yv=xa.exportTypedArrayMethod,gv=Math.max,Tv=Math.min;yv("toSpliced",(function(e,t){var r,i,n,o,a,s,u,c=mv(this),l=vv(c),f=cv(c),h=fv(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=Tv(gv(pv(t),0),f-h),r=p-2){o=new l(r),n=lv(o);for(var m=2;m<p;m++)a=arguments[m],o[m-2]=n?hv(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}),!!dv((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 xv={exports:{}},Ev={},Av=R,Sv=U,bv=Jr.f,_v=os,Rv="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Ev.f=function(e){return Rv&&"Window"===Av(e)?function(e){try{return bv(e)}catch(e){return _v(Rv)}}(e):bv(Sv(e))};var Cv=o((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Ov=o,Lv=H,Iv=R,Pv=Cv,Mv=Object.isExtensible,wv=Ov((function(){Mv(1)}))||Pv?function(e){return!!Lv(e)&&((!Pv||"ArrayBuffer"!==Iv(e))&&(!Mv||Mv(e)))}:Mv,Fv=!o((function(){return Object.isExtensible(Object.preventExtensions({}))})),Nv=en,Dv=A,Vv=mr,Uv=H,Bv=ke,kv=Ot.f,zv=Jr,Gv=Ev,jv=wv,Xv=Fv,Hv=!1,Yv=He("meta"),Wv=0,Zv=function(e){kv(e,Yv,{value:{objectID:"O"+Wv++,weakData:{}}})},qv=xv.exports={enable:function(){qv.enable=function(){},Hv=!0;var e=zv.f,t=Dv([].splice),r={};r[Yv]=1,e(r).length&&(zv.f=function(r){for(var i=e(r),n=0,o=i.length;n<o;n++)if(i[n]===Yv){t(i,n,1);break}return i},Nv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Gv.f}))},fastKey:function(e,t){if(!Uv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Bv(e,Yv)){if(!jv(e))return"F";if(!t)return"E";Zv(e)}return e[Yv].objectID},getWeakData:function(e,t){if(!Bv(e,Yv)){if(!jv(e))return!0;if(!t)return!1;Zv(e)}return e[Yv].weakData},onFreeze:function(e){return Xv&&Hv&&jv(e)&&!Bv(e,Yv)&&Zv(e),e}};Vv[Yv]=!0;var Kv=l,Qv=wt,Jv=Ae,$v=Lu,ey=l,ty=wt,ry=me,iy=fc,ny=hi,oy=q,ay=sc,sy=ec,uy=function(e,t,r){var i,n;Qv(e);try{if(!(i=Jv(e,"return"))){if("throw"===t)throw r;return r}i=Kv(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return Qv(i),r},cy=TypeError,ly=function(e,t){this.stopped=e,this.result=t},fy=ly.prototype,hy=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=$v(t,l),v=function(e){return i&&uy(i,"normal",e),new ly(!0,e)},y=function(e){return f?(ty(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=sy(e)))throw cy(ry(e)+" is not iterable");if(iy(n)){for(o=0,a=ny(e);a>o;o++)if((s=y(e[o]))&&oy(fy,s))return s;return new ly(!1)}i=ay(e,n)}for(u=h?e.next:i.next;!(c=ey(u,i)).done;){try{s=y(c.value)}catch(e){uy(i,"throw",e)}if("object"==typeof s&&s&&oy(fy,s))return s}return new ly(!1)},py=en,dy=i,my=A,vy=Yi,yy=Qr,gy=xv.exports,Ty=hy,xy=Ma,Ey=G,Ay=M,Sy=H,by=o,_y=ho,Ry=cs,Cy=Jc,Oy=Cn,Ly=Lo,Iy=La,Py=Lu,My=Ma,wy=M,Fy=hy,Ny=Qf,Dy=Jf,Vy=Zc,Uy=a,By=xv.exports.fastKey,ky=Lr.set,zy=Lr.getterFor,Gy={getConstructor:function(e,t,r,i){var n=e((function(e,n){My(e,o),ky(e,{type:t,index:Oy(null),first:void 0,last:void 0,size:0}),Uy||(e.size=0),wy(n)||Fy(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=zy(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=By(t,!0),key:t,value:r,previous:i=o.last,next:void 0,removed:!1},o.first||(o.first=s),i&&(i.next=s),Uy?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},u=function(e,t){var r,i=a(e),n=By(t);if("F"!==n)return i.index[n];for(r=i.first;r;r=r.next)if(r.key===t)return r};return Iy(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,Uy?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),Uy?r.size--:t.size--}return!!i},forEach:function(e){for(var t,r=a(this),i=Py(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)}}),Iy(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)}}),Uy&&Ly(o,"size",{configurable:!0,get:function(){return a(this).size}}),n},setStrong:function(e,t,r){var i=t+" Iterator",n=zy(t),o=zy(i);Ny(e,t,(function(e,t){ky(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)?Dy("keys"===t?r.key:"values"===t?r.value:[r.key,r.value],!1):(e.target=void 0,Dy(void 0,!0))}),r?"entries":"values",!r,!0),Vy(t)}},jy=function(e,t,r){var i=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=i?"set":"add",a=dy[e],s=a&&a.prototype,u=a,c={},l=function(e){var t=my(s[e]);yy(s,e,"add"===e?function(e){return t(this,0===e?0:e),this}:"delete"===e?function(e){return!(n&&!Sy(e))&&t(this,0===e?0:e)}:"get"===e?function(e){return n&&!Sy(e)?void 0:t(this,0===e?0:e)}:"has"===e?function(e){return!(n&&!Sy(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(vy(e,!Ey(a)||!(n||s.forEach&&!by((function(){(new a).entries().next()})))))u=r.getConstructor(t,e,i,o),gy.enable();else if(vy(e,!0)){var f=new u,h=f[o](n?{}:-0,1)!==f,p=by((function(){f.has(1)})),d=_y((function(e){new a(e)})),m=!n&&by((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));d||((u=t((function(e,t){xy(e,s);var r=Cy(new a,e,u);return Ay(t)||Ty(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,py({global:!0,constructor:!0,forced:u!==a},c),Ry(u,e),n||r.setStrong(u,e,i),u};jy("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Gy);var Xy,Hy,Yy,Wy,Zy="process"===R(i.process),qy=TypeError,Ky=/(?:ipad|iphone|ipod).*applewebkit/i.test(K),Qy=i,Jy=Ap,$y=Lu,eg=G,tg=ke,rg=o,ig=pn,ng=md,og=vt,ag=function(e,t){if(e<t)throw qy("Not enough arguments");return e},sg=Ky,ug=Zy,cg=Qy.setImmediate,lg=Qy.clearImmediate,fg=Qy.process,hg=Qy.Dispatch,pg=Qy.Function,dg=Qy.MessageChannel,mg=Qy.String,vg=0,yg={},gg="onreadystatechange";rg((function(){Xy=Qy.location}));var Tg=function(e){if(tg(yg,e)){var t=yg[e];delete yg[e],t()}},xg=function(e){return function(){Tg(e)}},Eg=function(e){Tg(e.data)},Ag=function(e){Qy.postMessage(mg(e),Xy.protocol+"//"+Xy.host)};cg&&lg||(cg=function(e){ag(arguments.length,1);var t=eg(e)?e:pg(e),r=ng(arguments,1);return yg[++vg]=function(){Jy(t,void 0,r)},Hy(vg),vg},lg=function(e){delete yg[e]},ug?Hy=function(e){fg.nextTick(xg(e))}:hg&&hg.now?Hy=function(e){hg.now(xg(e))}:dg&&!sg?(Wy=(Yy=new dg).port2,Yy.port1.onmessage=Eg,Hy=$y(Wy.postMessage,Wy)):Qy.addEventListener&&eg(Qy.postMessage)&&!Qy.importScripts&&Xy&&"file:"!==Xy.protocol&&!rg(Ag)?(Hy=Ag,Qy.addEventListener("message",Eg,!1)):Hy=gg in og("script")?function(e){ig.appendChild(og("script"))[gg]=function(){ig.removeChild(this),Tg(e)}}:function(e){setTimeout(xg(e),0)});var Sg={set:cg,clear:lg},bg=function(){this.head=null,this.tail=null};bg.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 _g,Rg,Cg,Og,Lg,Ig=bg,Pg=/ipad|iphone|ipod/i.test(K)&&"undefined"!=typeof Pebble,Mg=/web0s(?!.*chrome)/i.test(K),wg=i,Fg=Lu,Ng=n.f,Dg=Sg.set,Vg=Ig,Ug=Ky,Bg=Pg,kg=Mg,zg=Zy,Gg=wg.MutationObserver||wg.WebKitMutationObserver,jg=wg.document,Xg=wg.process,Hg=wg.Promise,Yg=Ng(wg,"queueMicrotask"),Wg=Yg&&Yg.value;if(!Wg){var Zg=new Vg,qg=function(){var e,t;for(zg&&(e=Xg.domain)&&e.exit();t=Zg.get();)try{t()}catch(e){throw Zg.head&&_g(),e}e&&e.enter()};Ug||zg||kg||!Gg||!jg?!Bg&&Hg&&Hg.resolve?((Og=Hg.resolve(void 0)).constructor=Hg,Lg=Fg(Og.then,Og),_g=function(){Lg(qg)}):zg?_g=function(){Xg.nextTick(qg)}:(Dg=Fg(Dg,wg),_g=function(){Dg(qg)}):(Rg=!0,Cg=jg.createTextNode(""),new Gg(qg).observe(Cg,{characterData:!0}),_g=function(){Cg.data=Rg=!Rg}),Wg=function(e){Zg.head||_g(),Zg.add(e)}}var Kg=Wg,Qg=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Jg=i.Promise,$g="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,eT=!$g&&!Zy&&"object"==typeof window&&"object"==typeof document,tT=i,rT=Jg,iT=G,nT=Yi,oT=sr,aT=tt,sT=eT,uT=$g,cT=ie;rT&&rT.prototype;var lT=aT("species"),fT=!1,hT=iT(tT.PromiseRejectionEvent),pT=nT("Promise",(function(){var e=oT(rT),t=e!==String(rT);if(!t&&66===cT)return!0;if(!cT||cT<51||!/native code/.test(e)){var r=new rT((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[lT]=i,!(fT=r.then((function(){}))instanceof i))return!0}return!t&&(sT||uT)&&!hT})),dT={CONSTRUCTOR:pT,REJECTION_EVENT:hT,SUBCLASSING:fT},mT={},vT=Te,yT=TypeError,gT=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw yT("Bad Promise constructor");t=e,r=i})),this.resolve=vT(t),this.reject=vT(r)};mT.f=function(e){return new gT(e)};var TT,xT,ET,AT=en,ST=Zy,bT=i,_T=l,RT=Qr,CT=Uo,OT=cs,LT=Zc,IT=Te,PT=G,MT=H,wT=Ma,FT=Uh,NT=Sg.set,DT=Kg,VT=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},UT=Qg,BT=Ig,kT=Lr,zT=Jg,GT=mT,jT="Promise",XT=dT.CONSTRUCTOR,HT=dT.REJECTION_EVENT,YT=dT.SUBCLASSING,WT=kT.getterFor(jT),ZT=kT.set,qT=zT&&zT.prototype,KT=zT,QT=qT,JT=bT.TypeError,$T=bT.document,ex=bT.process,tx=GT.f,rx=tx,ix=!!($T&&$T.createEvent&&bT.dispatchEvent),nx="unhandledrejection",ox=function(e){var t;return!(!MT(e)||!PT(t=e.then))&&t},ax=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&&fx(t),t.rejection=1),!0===s?r=o:(l&&l.enter(),r=s(o),l&&(l.exit(),n=!0)),r===e.promise?c(JT("Promise-chain cycle")):(i=ox(r))?_T(i,r,u,c):u(r)):c(o)}catch(e){l&&!n&&l.exit(),c(e)}},sx=function(e,t){e.notified||(e.notified=!0,DT((function(){for(var r,i=e.reactions;r=i.get();)ax(r,e);e.notified=!1,t&&!e.rejection&&cx(e)})))},ux=function(e,t,r){var i,n;ix?((i=$T.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),bT.dispatchEvent(i)):i={promise:t,reason:r},!HT&&(n=bT["on"+e])?n(i):e===nx&&VT("Unhandled promise rejection",r)},cx=function(e){_T(NT,bT,(function(){var t,r=e.facade,i=e.value;if(lx(e)&&(t=UT((function(){ST?ex.emit("unhandledRejection",i,r):ux(nx,r,i)})),e.rejection=ST||lx(e)?2:1,t.error))throw t.value}))},lx=function(e){return 1!==e.rejection&&!e.parent},fx=function(e){_T(NT,bT,(function(){var t=e.facade;ST?ex.emit("rejectionHandled",t):ux("rejectionhandled",t,e.value)}))},hx=function(e,t,r){return function(i){e(t,i,r)}},px=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,sx(e,!0))},dx=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw JT("Promise can't be resolved itself");var i=ox(t);i?DT((function(){var r={done:!1};try{_T(i,t,hx(dx,r,e),hx(px,r,e))}catch(t){px(r,t,e)}})):(e.value=t,e.state=1,sx(e,!1))}catch(t){px({done:!1},t,e)}}};if(XT&&(QT=(KT=function(e){wT(this,QT),IT(e),_T(TT,this);var t=WT(this);try{e(hx(dx,t),hx(px,t))}catch(e){px(t,e)}}).prototype,(TT=function(e){ZT(this,{type:jT,done:!1,notified:!1,parent:!1,reactions:new BT,rejection:!1,state:0,value:void 0})}).prototype=RT(QT,"then",(function(e,t){var r=WT(this),i=tx(FT(this,KT));return r.parent=!0,i.ok=!PT(e)||e,i.fail=PT(t)&&t,i.domain=ST?ex.domain:void 0,0===r.state?r.reactions.add(i):DT((function(){ax(i,r)})),i.promise})),xT=function(){var e=new TT,t=WT(e);this.promise=e,this.resolve=hx(dx,t),this.reject=hx(px,t)},GT.f=tx=function(e){return e===KT||undefined===e?new xT(e):rx(e)},PT(zT)&&qT!==Object.prototype)){ET=qT.then,YT||RT(qT,"then",(function(e,t){var r=this;return new KT((function(e,t){_T(ET,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete qT.constructor}catch(e){}CT&&CT(qT,QT)}AT({global:!0,constructor:!0,wrap:!0,forced:XT},{Promise:KT}),OT(KT,jT,!1),LT(jT);var mx=Jg,vx=dT.CONSTRUCTOR||!ho((function(e){mx.all(e).then(void 0,(function(){}))})),yx=l,gx=Te,Tx=mT,xx=Qg,Ex=hy;en({target:"Promise",stat:!0,forced:vx},{all:function(e){var t=this,r=Tx.f(t),i=r.resolve,n=r.reject,o=xx((function(){var r=gx(t.resolve),o=[],a=0,s=1;Ex(e,(function(e){var u=a++,c=!1;s++,yx(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 Ax=en,Sx=dT.CONSTRUCTOR,bx=Jg,_x=Z,Rx=G,Cx=Qr,Ox=bx&&bx.prototype;if(Ax({target:"Promise",proto:!0,forced:Sx,real:!0},{catch:function(e){return this.then(void 0,e)}}),Rx(bx)){var Lx=_x("Promise").prototype.catch;Ox.catch!==Lx&&Cx(Ox,"catch",Lx,{unsafe:!0})}var Ix=l,Px=Te,Mx=mT,wx=Qg,Fx=hy;en({target:"Promise",stat:!0,forced:vx},{race:function(e){var t=this,r=Mx.f(t),i=r.reject,n=wx((function(){var n=Px(t.resolve);Fx(e,(function(e){Ix(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var Nx=l,Dx=mT;en({target:"Promise",stat:!0,forced:dT.CONSTRUCTOR},{reject:function(e){var t=Dx.f(this);return Nx(t.reject,void 0,e),t.promise}});var Vx=wt,Ux=H,Bx=mT,kx=en,zx=dT.CONSTRUCTOR,Gx=function(e,t){if(Vx(e),Ux(t)&&t.constructor===e)return t;var r=Bx.f(e);return(0,r.resolve)(t),r.promise};Z("Promise"),kx({target:"Promise",stat:!0,forced:zx},{resolve:function(e){return Gx(this,e)}});var jx,Xx,Hx=i,Yx=we,Wx=G,Zx=Yn,qx=Qr,Kx="USE_FUNCTION_CONSTRUCTOR",Qx=tt("asyncIterator"),Jx=Hx.AsyncIterator,$x=Yx.AsyncIteratorPrototype;if($x)jx=$x;else if(Wx(Jx))jx=Jx.prototype;else if(Yx[Kx]||Hx[Kx])try{Xx=Zx(Zx(Zx(Function("return async function*(){}()")()))),Zx(Xx)===Object.prototype&&(jx=Xx)}catch(e){}jx||(jx={}),Wx(jx[Qx])||qx(jx,Qx,(function(){return this}));var eE=l,tE=wt,rE=Cn,iE=Ae,nE=La,oE=Lr,aE=jx,sE=Jf,uE=Z("Promise"),cE="AsyncFromSyncIterator",lE=oE.set,fE=oE.getterFor(cE),hE=function(e,t,r){var i=e.done;uE.resolve(e.value).then((function(e){t(sE(e,i))}),r)},pE=function(e){e.type=cE,lE(this,e)};pE.prototype=nE(rE(aE),{next:function(){var e=fE(this);return new uE((function(t,r){var i=tE(eE(e.next,e.iterator));hE(i,t,r)}))},return:function(){var e=fE(this).iterator;return new uE((function(t,r){var i=iE(e,"return");if(void 0===i)return t(sE(void 0,!0));var n=tE(eE(i,e));hE(n,t,r)}))}});var dE=pE,mE=function(e){return{iterator:e,next:e.next,done:!1}},vE=l,yE=dE,gE=wt,TE=sc,xE=mE,EE=Ae,AE=tt("asyncIterator"),SE=i,bE=TypeError,_E=l,RE=Z,CE=Ae,OE=l,LE=Te,IE=wt,PE=H,ME=function(e){if(e>9007199254740991)throw bE("Maximum allowed index exceeded");return e},wE=Z,FE=mE,NE=function(e,t,r,i){try{var n=CE(e,"return");if(n)return RE("Promise").resolve(_E(n,e)).then((function(){t(r)}),(function(e){i(e)}))}catch(e){return i(e)}t(r)},DE=function(e){var t=0===e,r=1===e,i=2===e,n=3===e;return function(e,o,a){IE(e);var s=void 0!==o;!s&&t||LE(o);var u=FE(e),c=wE("Promise"),l=u.iterator,f=u.next,h=0;return new c((function(e,u){var p=function(e){NE(l,u,e,u)},d=function(){try{if(s)try{ME(h)}catch(e){p(e)}c.resolve(IE(OE(f,l))).then((function(f){try{if(IE(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():NE(l,e,!1,u);else if(t)try{a[h++]=o,d()}catch(e){p(e)}else o?NE(l,e,n||m,u):d()};PE(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()}))}},VE={toArray:DE(0),forEach:DE(1),every:DE(2),some:DE(3),find:DE(4)},UE=Lu,BE=A,kE=Ve,zE=ju,GE=function(e,t){var r=arguments.length<2?EE(e,AE):t;return r?gE(vE(r,e)):new yE(xE(TE(e)))},jE=sc,XE=mE,HE=ec,YE=Ae,WE=function(e){return SE[e].prototype},ZE=Z,qE=dE,KE=VE.toArray,QE=tt("asyncIterator"),JE=BE(WE("Array").values),$E=BE(JE([]).next),eA=function(){return new tA(this)},tA=function(e){this.iterator=JE(e)};tA.prototype.next=function(){return $E(this.iterator)};var rA=Z,iA=Wu,nA=function(e){var t=this,r=arguments.length,i=r>1?arguments[1]:void 0,n=r>2?arguments[2]:void 0;return new(ZE("Promise"))((function(r){var o=kE(e);void 0!==i&&(i=UE(i,n));var a=YE(o,QE),s=a?void 0:HE(o)||eA,u=zE(t)?new t:[],c=a?GE(o,a):new qE(XE(jE(o,s)));r(KE(c,i,u))}))},oA=wh,aA=xa.aTypedArrayConstructor;(0,xa.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(rA("Promise"))((function(r){iA(t),r(nA(e,i,n))})).then((function(e){return oA(aA(t),e)}))}),!0);var sA=jc.filterReject,uA=Hh,cA=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("filterOut",(function(e){var t=sA(cA(this),e,arguments.length>1?arguments[1]:void 0);return uA(this,t)}),!0);var lA=jc.filterReject,fA=Hh,hA=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("filterReject",(function(e){var t=lA(hA(this),e,arguments.length>1?arguments[1]:void 0);return fA(this,t)}),!0);var pA=Lu,dA=P,mA=Ve,vA=ht,yA=hi,gA=Cn,TA=wh,xA=Array,EA=A([].push),AA=function(e,t,r,i){for(var n,o,a,s=mA(e),u=dA(s),c=pA(t,r),l=gA(null),f=yA(u),h=0;f>h;h++)a=u[h],(o=vA(c(a,h,s)))in l?EA(l[o],a):l[o]=[a];if(i&&(n=i(s))!==xA)for(o in l)l[o]=TA(n,l[o]);return l},SA=Gh,bA=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("groupBy",(function(e){var t=arguments.length>1?arguments[1]:void 0;return AA(bA(this),e,t,SA)}),!0);var _A=A,RA=Map.prototype,CA={Map:Map,set:_A(RA.set),get:_A(RA.get),has:_A(RA.has),remove:_A(RA.delete),proto:RA},OA=l,LA=A,IA=function(e,t,r){for(var i,n,o=r?e:e.iterator,a=e.next;!(i=OA(a,o)).done;)if(void 0!==(n=t(i.value)))return n},PA=CA.Map,MA=CA.proto,wA=LA(MA.forEach),FA=LA(MA.entries),NA=FA(new PA).next,DA=Te,VA=M,UA=hi,BA=Ve,kA=function(e,t,r){return r?IA({iterator:FA(e),next:NA},(function(e){return t(e[1],e[0])})):wA(e,t)},zA=CA.Map,GA=CA.has,jA=CA.set,XA=A([].push),HA=wh,YA=function(e){var t,r,i,n=BA(this),o=UA(n),a=[],s=new zA,u=VA(e)?function(e){return e}:DA(e);for(t=0;t<o;t++)i=u(r=n[t]),GA(s,i)||jA(s,i,r);return kA(s,(function(e){XA(a,e)})),a},WA=xa.aTypedArray,ZA=xa.getTypedArrayConstructor,qA=xa.exportTypedArrayMethod,KA=A(YA);qA("uniqueBy",(function(e){return WA(this),HA(ZA(this),KA(this,e))}),!0);var QA=function(e,t){return QA=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])},QA(e,t)};function JA(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}QA(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var $A=function(){return $A=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},$A.apply(this,arguments)};function eS(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 tS(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 rS(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 iS(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 nS(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 oS=6,aS="tree",sS="editor",uS="none",cS=.017453292519943295,lS={"Filter not imported":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg","Item duration can't be less than 0":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"};function fS(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}function hS(e){var t=this,r=e.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var i=e.createQuery(),n=function(){return eS(t,void 0,void 0,(function(){return tS(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}}}var pS=[],dS={};function mS(){"function"==typeof WebGL2RenderingContext?yS(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(yS(WebGLRenderingContext),yS(WebGLRenderingContext.prototype)):pS.push("iOS16 lockdown mode, WebGL Constants not in global"),pS.length||"HALF_FLOAT"in dS||(dS.HALF_FLOAT=5131)}function vS(e){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name}function yS(e){for(var t in e)/^[A-Z_]/.test(t)&&(dS[t]=e[t])}pS.length||mS();var gS,TS,xS,ES,AS,SS,bS,_S,RS,CS,OS,LS,IS={},PS={};function MS(e,t,r){e in IS&&console.error("Filter ".concat(e," registered twice.")),IS[e]=t,PS[e]=r}function wS(e){Object.keys(e).forEach((function(t){var r=iS(e[t],2);MS(t,r[0],r[1])}))}function FS(e){var t=PS[e.name];if(!t)throw Error("Filter ".concat(e.name," not imported, see ").concat(lS["Filter not imported"]));return t(e)}function NS(e,t){var r=IS[e.name];if(!r)throw Error("Filter ".concat(e.name," not imported, see ").concat(lS["Filter not imported"]));var i=r(e,t);return i.passSplitOptions||(i.passSplitOptions={attachments:[{texture:{format:dS.RGBA}}]}),i}function DS(e,t){return e.includes(t)||e.push(t),e}function VS(e,t){var r=e.indexOf(t);return r>-1&&e.splice(r,1),e}function US(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 BS(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 kS(e,t){var r=[0,0,0,0];if(uR(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 zS(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=jS(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 GS(e){var t=[];if(e instanceof Array?e.forEach((function(e){var r=iS(e,5),i=r[0],n=r[1],o=r[2],a=r[3],s=r[4];t.push({stop:XS(i),color:[n,o,a,s]})})):Object.keys(e).forEach((function(r){var i=kS(e[r]);t.push({stop:XS(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 jS(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 XS(e){var t=/^(-)?([\d+.]+)%$/.exec(e);return t?+t[2]/100*(t[1]?-1:1):+e}function HS(){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}function YS(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function WS(){return YS()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function ZS(e){uR(e)&&(e=kS(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}function qS(e){var t=128,r={width:t,height:1,data:new Uint8Array(512)},i=r.data,n=GS(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=jS(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 KS(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++)JS(t,n,r);return t}return $S(t,r)}function QS(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&&JS(t,t.length-1,i),t)}function JS(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 $S(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=iS([t[c],t[u]],2),t[u]=o[0],t[c]=o[1]}return a=iS([t[u],t[i]],2),t[i]=a[0],t[u]=a[1],$S(t,r,i,u-1),$S(t,r,c+1,n),t}function eb(e,t){if(void 0===t&&(t="item doesn't exist"),null==e)throw new Error(t)}e.OrderType=void 0,(gS=e.OrderType||(e.OrderType={}))[gS.none=1]="none",gS[gS.ascending=2]="ascending",gS[gS.descending=3]="descending",function(e){e.S="S",e.APlus="A+",e.A="A",e.BPlus="B+",e.B="B"}(TS||(TS={})),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"}(xS||(xS={})),function(e){e[e.DOUBLE=1032]="DOUBLE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK"}(ES||(ES={})),function(e){e[e.NONE=0]="NONE",e[e.MASK=1]="MASK",e[e.OBSCURED=2]="OBSCURED",e[e.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(AS||(AS={})),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"}(SS||(SS={})),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"}(_S||(_S={})),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"}(RS||(RS={})),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"}(CS||(CS={})),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"}(OS||(OS={})),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"}(LS||(LS={}));var tb,rb,ib,nb,ob,ab,sb,ub;!function(e){e[e.portrait=1]="portrait",e[e.landscape=0]="landscape"}(tb||(tb={})),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"}(rb||(rb={})),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"}(ib||(ib={})),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"}(nb||(nb={})),function(e){e[e.destroy=0]="destroy",e[e.loop=5]="loop",e[e.freeze=4]="freeze"}(ob||(ob={})),function(e){e[e.destroyChildren=6]="destroyChildren"}(ab||(ab={})),function(e){e[e.none=0]="none",e[e.removeParticle=1]="removeParticle"}(sb||(sb={})),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"}(ub||(ub={}));var cb,lb,fb,hb,pb,db,mb,vb,yb;!function(e){e[e.box=2]="box",e[e.sphere=3]="sphere"}(cb||(cb={})),function(e){e.unlit="unlit",e.pbr="pbr",e.hair="hair"}(lb||(lb={})),function(e){e[e.opaque=100]="opaque",e[e.masked=101]="masked",e[e.translucent=102]="translucent",e[e.additive=103]="additive"}(fb||(fb={})),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"}(hb||(hb={})),function(e){e[e.display=0]="display",e[e.clip=1]="clip",e[e.ellipsis=2]="ellipsis"}(pb||(pb={})),function(e){e[e.top=0]="top",e[e.middle=1]="middle",e[e.bottom=2]="bottom"}(db||(db={})),function(e){e[e.left=0]="left",e[e.middle=1]="middle",e[e.right=2]="right"}(mb||(mb={})),function(e){e.normal="normal",e.bold="bold",e.lighter="lighter"}(vb||(vb={})),function(e){e.normal="normal",e.italic="italic",e.oblique="oblique"}(yb||(yb={}));var gb,Tb=Object.freeze({__proto__:null,get BezierKeyframeType(){return nb},get BlendingMode(){return xS},BloomFilterThresholdAvgColor:0,CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return tb},get CompositionEndBehavior(){return rb},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 yb},get InteractBehavior(){return RS},get InteractType(){return _S},get ItemEndBehavior(){return ob},get ItemType(){return CS},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return AS},get MaterialBlending(){return fb},get MaterialType(){return lb},get ModelBoundingType(){return cb},get ParentItemEndBehavior(){return ab},get ParticleInteractionBehavior(){return sb},get ParticleOrigin(){return LS},get PluginType(){return bS},get RenderLevel(){return TS},get RenderMode(){return OS},get RenderMode3D(){return hb},get ShapeArcMode(){return ub},get ShapeType(){return SS},get SideMode(){return ES},get TextAlignment(){return mb},get TextBaseline(){return db},get TextOverflow(){return pb},get TextWeight(){return vb},get ValueType(){return ib}}),xb=((gb={})[LS.PARTICLE_ORIGIN_CENTER]=[0,0],gb[LS.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],gb[LS.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],gb[LS.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],gb[LS.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],gb[LS.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],gb[LS.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],gb[LS.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],gb[LS.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],gb);function Eb(e,t,r){return e>r?r:e<t?t:e}function Ab(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function Sb(e,t){return e?[e[0]-.5,.5-e[1]]:t?xb[t]:[0,0]}var bb,_b,Rb=(bb=new Float32Array(1),_b=new Int32Array(bb.buffer),function(e){bb[0]=e;var t=_b[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)}),Cb=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]=Rb(e[r])}return e.prototype.set=function(e,t){for(var r=0;r<e.length;r++)this.data[r+t]=Rb(e[r])},e}(),Ob=Math.PI/180;function Lb(e,t){var r=iS(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 Ib(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function Pb(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 Mb(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 wb(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,T=c*d,x=l*d,E=f*h,A=f*p,S=f*d,b=i[0],_=i[1],R=i[2],C=(1-(g+x))*b,O=(v+S)*b,L=(y-A)*b,I=(v-S)*_,P=(1-(m+x))*_,M=(T+E)*_,w=(y+A)*R,F=(T-E)*R,N=(1-(m+g))*R;return e[0]=C,e[1]=O,e[2]=L,e[3]=0,e[4]=I,e[5]=P,e[6]=M,e[7]=0,e[8]=w,e[9]=F,e[10]=N,e[11]=0,e[12]=o*C+a*I+s*w-o+r[0],e[13]=o*O+a*P+s*F-a+r[1],e[14]=o*L+a*M+s*N-s+r[2],e[15]=1,e}function Fb(e,t){if(Mb(t))return Gb(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,T=r*u-n*a,x=r*c-o*a,E=i*u-n*s,A=i*c-o*s,S=n*c-o*u,b=l*m-f*d,_=l*v-h*d,R=l*y-p*d,C=f*v-h*m,O=f*y-p*m,L=h*y-p*v,I=g*L-T*O+x*C+E*R-A*_+S*b;if(!I){for(var P=0;P<16;P++)e[P]=NaN;return e}return I=1/I,e[0]=(s*L-u*O+c*C)*I,e[1]=(n*O-i*L-o*C)*I,e[2]=(m*S-v*A+y*E)*I,e[3]=(h*A-f*S-p*E)*I,e[4]=(u*R-a*L-c*_)*I,e[5]=(r*L-n*R+o*_)*I,e[6]=(v*x-d*S-y*T)*I,e[7]=(l*S-h*x+p*T)*I,e[8]=(a*O-s*R+c*b)*I,e[9]=(i*R-r*O-o*b)*I,e[10]=(d*A-m*x+y*g)*I,e[11]=(f*x-l*A-p*g)*I,e[12]=(s*_-a*C-u*b)*I,e[13]=(r*C-i*_+n*b)*I,e[14]=(m*T-d*E-v*g)*I,e[15]=(l*E-f*T+h*g)*I,e}function Nb(e,t,r){if(Mb(t))return Gb(e,r),e;if(Mb(r))return Gb(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],T=r[0],x=r[1],E=r[2],A=r[3];return e[0]=T*i+x*s+E*f+A*m,e[1]=T*n+x*u+E*h+A*v,e[2]=T*o+x*c+E*p+A*y,e[3]=T*a+x*l+E*d+A*g,T=r[4],x=r[5],E=r[6],A=r[7],e[4]=T*i+x*s+E*f+A*m,e[5]=T*n+x*u+E*h+A*v,e[6]=T*o+x*c+E*p+A*y,e[7]=T*a+x*l+E*d+A*g,T=r[8],x=r[9],E=r[10],A=r[11],e[8]=T*i+x*s+E*f+A*m,e[9]=T*n+x*u+E*h+A*v,e[10]=T*o+x*c+E*p+A*y,e[11]=T*a+x*l+E*d+A*g,T=r[12],x=r[13],E=r[14],A=r[15],e[12]=T*i+x*s+E*f+A*m,e[13]=T*n+x*u+E*h+A*v,e[14]=T*o+x*c+E*p+A*y,e[15]=T*a+x*l+E*d+A*g,e}function Db(e,t,r,i,n,o){var a,s=1/Math.tan(t*Ob/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 Vb=new Float32Array(9),Ub=[0,0,0,1];function Bb(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 kb(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];Vb[0]=n*p,Vb[1]=o*p,Vb[2]=a*p,Vb[3]=s*d,Vb[4]=u*d,Vb[5]=c*d,Vb[6]=l*m,Vb[7]=f*m,Vb[8]=h*m;var v=Vb[0]+Vb[4]+Vb[8],y=void 0;if(v>0)y=Math.sqrt(v+1),Ub[3]=.5*y,y=.5/y,Ub[0]=(Vb[5]-Vb[7])*y,Ub[1]=(Vb[6]-Vb[2])*y,Ub[2]=(Vb[1]-Vb[3])*y;else{var g=0;Vb[4]>Vb[0]&&(g=1),Vb[8]>Vb[3*g+g]&&(g=2);var T=(g+1)%3,x=(g+2)%3;y=Math.sqrt(Vb[3*g+g]-Vb[3*T+T]-Vb[3*x+x]+1),Ub[g]=.5*y,y=.5/y,Ub[3]=(Vb[3*T+x]-Vb[3*x+T])*y,Ub[T]=(Vb[3*T+g]+Vb[3*g+T])*y,Ub[x]=(Vb[3*x+g]+Vb[3*g+x])*y}r[0]=Ub[0],r[1]=Ub[1],r[2]=Ub[2],r[3]=Ub[3]}}function zb(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]),Bb(e)<0&&(i[0]=-i[0]),kb(e,t,r,i)}function Gb(e,t){for(var r=0;r<16;r++)e[r]=t[r];return e}var jb=Math.PI/180,Xb=180/Math.PI,Hb=Math.cos,Yb=Math.sin;function Wb(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]+r[i];return e}function Zb(e,t){for(var r=0,i=e.length;r<i;r++)e[r]=t;return e}var qb=Number.EPSILON||Math.pow(2,-32);function Kb(e){for(var t=0,r=e.length;t<r;t++)if(Math.abs(e[t])>qb)return!1;return!0}function Qb(e){return cR(e)?[e[0],e[1],e[2]]:[0,0,0]}function Jb(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 $b(e,t,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)e[n]=t[n+i];return e}function e_(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 t_(e,t){1===arguments.length&&(t=e,e=[]);var r=t,i=Math.hypot.apply(Math,nS([],iS(r),!1));if(0===i)return $b(e,r,r.length);for(var n=0;n<r.length;n++)e[n]=r[n]/i;return e}function r_(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]*r;return e}function i_(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]-r[i];return e}function n_(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 o_(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 a_(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 s_(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 u_(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 c_=[0,0,0,0,0,0,0,0,0];function l_(e,t){e||(e=c_);var r=Yb(t),i=Hb(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 f_(e,t){return function(e,t,r,i){var n=Hb(t*jb),o=Hb(r*jb),a=Hb(i*jb),s=Yb(t*jb),u=Yb(r*jb),c=Yb(i*jb);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 h_(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(Eb(-s,-1,1))*Xb,Math.abs(s)<.9999999?(e[0]=Math.atan2(u,c)*Xb,e[2]=Math.atan2(o,i)*Xb):(e[0]=0,e[2]=Math.atan2(-n,a)*Xb)}(e,t),e}var p_=Math.PI/180,d_=Math.cos,m_=Math.sin;function v_(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 y_(e,t,r,i){var n=d_(t*p_/2),o=d_(r*p_/2),a=d_(i*p_/2),s=m_(t*p_/2),u=m_(r*p_/2),c=m_(i*p_/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 g_(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 T_=[0,0,0];function x_(e,t,r){var i,n=null!==(i=r.position)&&void 0!==i?i:[0,0,0],o=[0,0,0];return s_(o,[e,t,0],r.getInverseViewProjectionMatrix()),i_(o,o,n),{center:n,direction:t_([],o)}}function E_(e,t,r,i,n){i_(T_,i,t);var o=o_(r,T_);if(o<0)return null;r_(T_,r,o),Wb(T_,t,T_);var a=n_(i,T_),s=n*n;return a>s?null:(r_(e,r,o-Math.sqrt(s-a)),Wb(e,e,t))}function A_(e,t,r,i,n){var o,a,s,u,c,l,f=iS(r,3),h=f[0],p=f[1],d=f[2],m=iS(t,3),v=m[0],y=m[1],g=m[2],T=i[0]-n[0]/2,x=i[0]+n[0]/2,E=i[1]-n[1]/2,A=i[1]+n[1]/2,S=i[2]-n[2]/2,b=i[2]+n[2]/2,_=1/h,R=1/p,C=1/d;return _>=0?(o=(T-v)*_,a=(x-v)*_):(o=(x-v)*_,a=(T-v)*_),R>=0?(s=(E-y)*R,u=(A-y)*R):(s=(A-y)*R,u=(E-y)*R),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),C>=0?(c=(S-g)*C,l=(b-g)*C):(c=(b-g)*C,l=(S-g)*C),o>l||c>a?null:((c>o||o!=o)&&(o=c),(l<a||a!=a)&&(a=l),a<0?null:(r_(e,t,o>=0?o:a),Wb(e,e,t))))}var S_=[0,0,0],b_=[0,0,0],__=[0,0,0],R_=[0,0,0];function C_(e,t,r){var i=iS(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 O_(e,t,r,i,n){var o,a,s,u,c,l=r;if(i_(S_,i[1],i[0]),i_(b_,i[2],i[0]),i_(R_,t,i[0]),a_(__,S_,b_),(a=o_(l,__))>0){if(n)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}return a_(b_,R_,b_),s=o_(l=r,b_),(s*=o)<0?null:(a_(S_,S_,R_),u=o_(l=r,S_),(u*=o)<0||s+u>a?null:(c=o_(R_,__),(c*=-o)<0?null:(r_(e,r,c/a),Wb(e,e,t))))}var L_=[0,0],I_=[0,0],P_=[0,0];var M_,w_=[];function F_(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],T=[c[0]-g[0],c[1]-g[1],c[2]-g[2]],x=v.asRotation,E=Jb(T,T,f_(w_,y.map((function(e){var t=v[e];return t?x?t.getValue(l):t.getIntegrateValue(0,i,n):0}))));c=Wb(c,g,E)}if(m.enabled){var A=m.asMovement;for(d=0;d<3;d++){var S=m[y[d]];S&&(c[d]+=A?S.getValue(l):S.getIntegrateValue(0,i,n))}}return c}var N_="not_implement",D_=function(){function e(e){this.onCreate(e)}return e.prototype.onCreate=function(e){throw Error(N_)},e.prototype.getIntegrateValue=function(e,t,r){throw Error(N_)},e.prototype.getIntegrateByTime=function(e,t){throw Error(N_)},e.prototype.getValue=function(e){throw Error(N_)},e.prototype.toUniform=function(e){throw Error(N_)},e.prototype.map=function(e){throw Error(N_)},e.prototype.scaleXCoord=function(e){return this},e}(),V_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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}(D_),U_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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}(D_),B_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t.prototype.onCreate=function(e){this.min=e[0],this.max=e[1]},t.prototype.getValue=function(e){return pR(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}(D_),k_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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}(D_),z_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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 K_(t,0,this.xCoord,this.min,this.max)-K_(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}(D_),G_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t.prototype.onCreate=function(e){this.stops=GS(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 jS(n.color,o.color,a,!0)}}return t[r].color.slice()},t}(D_),j_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t.getAllData=function(e,t){for(var r=new(t?Cb: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(cR(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 Q_(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?$_:J_,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}(D_),X_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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?K_:q_,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}(D_),H_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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=(Q_(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}(D_),Y_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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}(H_),W_=((M_={})[ib.RANDOM]=function(e){return e[0]instanceof Array?new k_(e):new B_(e)},M_[ib.CONSTANT]=function(e){return new V_(e)},M_[ib.CONSTANT_VEC2]=function(e){return new V_(e)},M_[ib.CONSTANT_VEC3]=function(e){return new V_(e)},M_[ib.CONSTANT_VEC4]=function(e){return new V_(e)},M_[ib.CURVE]=function(e){return new j_(e)},M_[ib.RGBA_COLOR]=function(e){return new V_(e)},M_[ib.COLORS]=function(e){return new U_(e.map((function(e){return kS(e,!1)})))},M_[ib.LINE]=function(e){return 2===e.length&&0===e[0][0]&&1===e[1][0]?new z_([e[0][1],e[1][1]]):new X_(e)},M_[ib.GRADIENT_COLOR]=function(e){return new G_(e)},M_[ib.LINEAR_PATH]=function(e){return new H_(e)},M_[ib.BEZIER_PATH]=function(e){return new Y_(e)},M_);function Z_(e){if(!e||!isNaN(+e))return new V_(e||0);if(e instanceof D_)return e;if(lR(W_[e[0]]))return W_[e[0]](e[1]);throw new Error("ValueType: ".concat(e[0]," is not support"))}function q_(e,t,r,i,n){var o=e-t;return(i+i+(n-i)*o/(r-t))*o/2}function K_(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 Q_(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 J_(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 $_(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 eR(e,t){if(t){var r=t[0],i=t[1];if(r===ib.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===ib.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 tR(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var rR,iR=[0,0,0],nR=[1,1,1],oR=[0,0,0],aR=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:nS([],iS(o.position),!1),rotation:nS([],iS(o.getRotation()),!1),scale:[u[0],u[1],u[2]]},n.path&&(this.basicTransform.path=Z_(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===ob.loop,gravity:Qb(n.gravity),gravityModifier:Z_(null!==(r=n.gravityOverLifetime)&&void 0!==r?r:0),direction:n.direction?t_([],n.direction):Qb(),endBehavior:s||0};var c=e.sizeOverLifetime;c&&(c.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Z_(c.x||1),this.sizeYOverLifetime=Z_(c.y||1),this.sizeZOverLifetime=Z_(c.z||1)):this.sizeXOverLifetime=Z_(c.size||1));var l=n.linearX||n.linearY||n.linearZ;l&&(this.linearVelOverLifetime={x:n.linearX&&Z_(n.linearX),y:n.linearY&&Z_(n.linearY),z:n.linearZ&&Z_(n.linearZ),asMovement:n.asMovement,enabled:!!l});var f=n.orbitalX||n.orbitalY||n.orbitalZ;f&&(this.orbitalVelOverLifetime={x:n.orbitalX&&Z_(n.orbitalX),y:n.orbitalY&&Z_(n.orbitalY),z:n.orbitalZ&&Z_(n.orbitalZ),center:Qb(n.orbCenter),asRotation:n.asRotation,enabled:!!f}),this.speedOverLifetime=n.speedOverLifetime&&Z_(n.speedOverLifetime);var h=e.rotationOverLifetime;if(h&&(this.rotationOverLifetime={asRotation:h.asRotation,separateAxes:h.separateAxes,z:Z_(h.z||0)},h.separateAxes)){var p=this.rotationOverLifetime;p.x=Z_(h.x||0),p.y=Z_(h.y||0)}this.gravityModifier=this.options.gravityModifier}return e.prototype.getVelocity=function(){return this.velocity||(this.velocity=r_([],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&&!Kb(this.options.gravity)||this.options.startSpeed&&!Kb(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=Zb(nR,1),a=Zb(iR,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=Wb(iR,f.rotation,a);l.transform.setRotation(y[0],y[1],y[2])}(this.willTranslate()||t)&&(h=F_(Zb(nR,0),this,n.gravity,s,u,f.position,this.getVelocity()));if(f.path&&(h||(h=$b(oR,f.position,3)),Wb(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 sR(){}function uR(e){return"string"==typeof e}e.DestroyOptions=void 0,(rR=e.DestroyOptions||(e.DestroyOptions={}))[rR.destroy=0]="destroy",rR[rR.keep=1]="keep",rR[rR.force=0]="force";var cR=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function lR(e){return"[object Function]"===Object.prototype.toString.call(e)}function fR(e){return"[object Object]"===Object.prototype.toString.call(e)}function hR(e){if(cR(e))return e.map(hR);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]=hR(e[n])}return t}return e}function pR(e,t){return e+Math.random()*(t-e)}function dR(){throw Error("destroyed item cannot be used again")}var mR=new Array(9).fill(0),vR=new Array(4).fill(0),yR=1,gR=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=Ib(),this.localMatrix=Ib(),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(yR++),e&&this.setTransform(e),t&&(this.parentTransform=t),void 0!==e.valid&&this.setValid(e.valid)}return e.getRotation=function(e,t){return g_(vR,t),h_(e,Lb(mR,vR))},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,y_(this.quat,e,t,r),g_(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,h_(this.rotation,Lb(mR,[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){v_(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){DS(this.children,e)},e.prototype.removeChild=function(e){VS(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&&(wb(this.localMatrix,this.quat,this.position,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):Mb(this.localMatrix)||(Pb(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?Nb(this.worldMatrix,t,e):Gb(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&&(zb(this.getWorldMatrix(),e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1),nS([],iS(this.worldTRSCache.scale),!1)},e.prototype.getWorldPosition=function(){return this.updateTRSCache(),nS([],iS(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&&$b(e,this.worldTRSCache.position,3),t&&$b(t,this.worldTRSCache.quat,4),r&&$b(r,this.worldTRSCache.scale,3)},e.prototype.cloneFromMatrix=function(e,t){t?(kb(e,this.position,this.quat,t),$b(this.scale,t,3)):zb(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:(Pb(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;zb(e,t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1}},e.prototype.dispatchValueChange=function(){this.children.forEach((function(e){e.parentMatrixDirty=!0}))},e}(),TR=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 gR($A({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(lS["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 CS.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 gR({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];y_(i,e,t,r),g_(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=iS(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=iS(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 xR(e,t){var r=e.type,i=e.pluginName;if(!i)switch(r){case CS.null:case CS.base:i="cal";break;case CS.sprite:i="sprite";break;case CS.particle:i="particle";break;case CS.interact:i="interact";break;case CS.camera:i="camera";break;case CS.filter:i="filter";break;case CS.text:i="text";break;case aS:i=aS;break;default:throw new Error("invalid vfx item type")}return t.pluginSystem.createPluginItem(i,e,t)}var ER={},AR=[],SR={};function bR(e,t,r,i){SR[e]=r,ER[e]=t,i&&DS(AR,e)}var _R,RR=function(){function e(e){var t={},r=[],i=function(e){var i=ER[e];r.includes(i)||(r.push(i),t[e]=i)};AR.forEach(i),e.forEach(i),this.plugins=Object.keys(t).map((function(e){var t=ER[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=SR[e];if(!i)throw new Error("plugin ".concat(e," no registered constructor"));var n=new i(t,r);if(!(n instanceof TR))throw new Error("plugin ".concat(e," invalid constructor type"));return n},e.prototype.processRawJSON=function(e,t){return eS(this,void 0,void 0,(function(){return tS(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 eS(this,void 0,void 0,(function(){var r,i,n,o,a;return tS(this,(function(s){for(r=[],i=this.plugins,n=0;n<i.length;n++)o=i[n],a=ER[o.name],e in a&&r.push(Promise.resolve(a[e].apply(a,nS([],iS(t),!1))));return[2,Promise.all(r)]}))}))},e.prototype.precompile=function(e,t,r){return eS(this,void 0,void 0,(function(){return tS(this,(function(i){return[2,this.callStatic("precompile",e,t,r)]}))}))},e.prototype.loadResources=function(e,t){return eS(this,void 0,void 0,(function(){return tS(this,(function(r){return[2,this.callStatic("prepareResource",e,t)]}))}))},e}(),CR=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}(),OR=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:$b([0,0,0],i,3),rotation:$b([0,0,0],n,3),near:Z_(a),far:Z_(s),fov:Z_(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&&Z_(f),x:Z_(p),y:Z_(m),z:Z_(y)}}if(t.rotationOverLifetime){var g=t.rotationOverLifetime,T=g.separateAxes,x=g.x,E=void 0===x?0:x,A=g.y,S=void 0===A?0:A,b=g.z,_=void 0===b?0:b;this.rotationOverLifetime={separateAxes:T,x:Z_(E),y:Z_(S),z:Z_(_)}}}return e.prototype.update=function(e){var t=[0,0,0,1],r=[0,0,0],i=[0,0,0];$b(r,this.options.position,3),$b(i,this.options.rotation,3);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(e=Eb(e,0,1),n&&(r[0]+=n.x.getValue(e),r[1]+=n.y.getValue(e),r[2]+=n.z.getValue(e),n.path&&Wb(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=gR.getRotation(i,t)},e}(),LR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t}(CR),IR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return CS.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 OR(this.transform,this.model)),this.controller},t}(TR);e.HitTestType=void 0,(_R=e.HitTestType||(e.HitTestType={}))[_R.triangle=1]="triangle",_R[_R.box=2]="box",_R[_R.sphere=3]="sphere",_R[_R.custom=4]="custom";var PR,MR,wR="click",FR="touchstart",NR="touchmove",DR="touchend",VR=RS,UR=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}};WS()&&(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=BR(s);t=u.x,r=u.y,n=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:r},a.dispatchEvent(FR,l(e,t,r))}},e[u]=function(e){if(i&&a.enabled){var n=BR(o(e));t=n.x,r=n.y,a.dispatchEvent(NR,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=BR(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);t=s.x,r=s.y,u<4&&a.dispatchEvent(wR,l(e,t,r)),a.dispatchEvent(DR,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]=[]),DS(r,t),function(){VS(r,t)}},e.prototype.removeEventListener=function(e,t){var r=this.handlers[e];r&&VS(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 BR(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 kR(e){switch(e){case xS.ALPHA:case xS.ADD:case xS.SUBTRACTION:case xS.STRONG_LIGHT:case xS.WEAK_LIGHT:return 1;case xS.SUPERPOSITION:return 2;case xS.BRIGHTNESS:return 3;case xS.MULTIPLY:return 0;default:return 1}}e.ShaderType=void 0,(PR=e.ShaderType||(e.ShaderType={}))[PR.vertex=0]="vertex",PR[PR.fragment=1]="fragment";var zR,GR,jR=((MR={})[e.ShaderType.vertex]={in:"attribute",out:"varying"},MR[e.ShaderType.fragment]={in:"varying"},MR);function XR(e,t,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),e&&(e.forEach((function(e){var t=iS(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=jR[r][e])&&void 0!==t?t:e}))),s=s.replace(l,"\n")}return s}function HR(e,t){switch(t){case void 0:case xS.ALPHA:e.blendFunction=[dS.ONE,dS.ONE_MINUS_SRC_ALPHA,dS.ONE,dS.ONE_MINUS_SRC_ALPHA];break;case xS.ADD:e.blendFunction=[dS.ONE,dS.ONE,dS.ONE,dS.ONE];break;case xS.SUBTRACTION:e.blendFunction=[dS.ONE,dS.ONE,dS.ZERO,dS.ONE],e.blendEquation=[dS.FUNC_REVERSE_SUBTRACT,dS.FUNC_REVERSE_SUBTRACT];break;case xS.SUPERPOSITION:e.blendFunction=[dS.ONE,dS.ONE,dS.ONE,dS.ONE];break;case xS.MULTIPLY:e.blendFunction=[dS.DST_COLOR,dS.ONE_MINUS_SRC_ALPHA,dS.DST_COLOR,dS.ONE_MINUS_SRC_ALPHA];break;case xS.BRIGHTNESS:e.blendFunction=[dS.ONE,dS.ONE_MINUS_SRC_ALPHA,dS.ONE,dS.ONE_MINUS_SRC_ALPHA];break;case xS.STRONG_LIGHT:e.blendFunction=[dS.DST_COLOR,dS.DST_ALPHA,dS.ZERO,dS.ONE];break;case xS.WEAK_LIGHT:e.blendFunction=[dS.DST_COLOR,dS.ZERO,dS.ZERO,dS.ONE];break;default:console.warn("blendMode ".concat(t," not in specification, please set blend params separately"))}}function YR(e,t){t===ES.DOUBLE?e.culling=!1:(e.culling=!0,e.frontFace=dS.CW,e.cullFace=t===ES.BACK?dS.BACK:dS.FRONT)}function WR(e,t){switch(t){case void 0:e.stencilTest=!1;break;case AS.MASK:e.stencilTest=!0,e.stencilFunc=[dS.ALWAYS,dS.ALWAYS],e.stencilOpZPass=[dS.REPLACE,dS.REPLACE];break;case AS.OBSCURED:e.stencilTest=!0,e.stencilFunc=[dS.EQUAL,dS.EQUAL];break;case AS.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[dS.NOTEQUAL,dS.NOTEQUAL];break;case AS.NONE:e.stencilTest=!1;break;default:console.warn("maskMode ".concat(t," not in specification, please set stencil params seperately"))}}e.TextureLoadAction=void 0,(zR=e.TextureLoadAction||(e.TextureLoadAction={}))[zR.whatever=0]="whatever",zR[zR.clear=2]="clear",e.TextureSourceType=void 0,(GR=e.TextureSourceType||(e.TextureSourceType={}))[GR.none=0]="none",GR[GR.data=1]="data",GR[GR.image=2]="image",GR[GR.compressed=3]="compressed",GR[GR.video=4]="video",GR[GR.canvas=5]="canvas",GR[GR.framebuffer=6]="framebuffer",GR[GR.mipmaps=7]="mipmaps";var ZR=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}(),qR=!1;function KR(e,t){return eS(this,void 0,void 0,(function(){return tS(this,(function(r){switch(r.label){case 0:return!qR&&t?[3,2]:[4,QR(e)];case 1:case 5:return[2,{image:r.sent(),url:e}];case 2:return r.trys.push([2,4,,6]),[4,QR(t)];case 3:return[2,{image:r.sent(),url:t}];case 4:return r.sent(),qR=!0,[4,QR(e)];case 6:return[2]}}))}))}function QR(e){return eS(this,void 0,void 0,(function(){var t,r;return tS(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 JR(e){return eS(this,void 0,void 0,(function(){return tS(this,(function(t){return[2,new Promise((function(t,r){(new ZR).downloadBinary(e,t,(function(t,i){r("Couldn't load bins ".concat(e,": status ").concat(t,", ").concat(i))}))}))]}))}))}function $R(e,t){return void 0===t&&(t={}),eS(this,void 0,void 0,(function(){var r;return tS(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()})),YS()&&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 eC(t,r,i){return void 0===i&&(i=[]),eS(this,void 0,void 0,(function(){var n,o,a,s,u,c,l;return tS(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 tC(e,r)})))})),[4,Promise.all(u)]);case 1:return c=f.sent(),l=i[a[0][0][1][0]].url,[2,$A($A({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 tC(e,r)})),[4,Promise.all(u)];case 3:return c=f.sent(),l=i[a[0][1][0]].url,[2,$A($A({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 tC(e,t){return eS(this,void 0,void 0,(function(){var r,i,n,o,a;return tS(this,(function(s){if(r=iS(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,QR(new Blob([new Uint8Array(a,n,o)]))]}))}))}var rC=1,iC=function(){function t(){this.destroyed=!1,this.id="Tex"+rC++}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?dS.TEXTURE_2D:r,n=t.format,o=void 0===n?dS.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),$A({minFilter:dS.NEAREST,magFilter:dS.NEAREST,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE,target:i,format:dS.RGBA,internalFormat:o,type:dS.UNSIGNED_BYTE},t)},t}();function nC(e,t,r,i){var n,o,a=t.length/r/i;return o=n=4===a||0===a?dS.RGBA:3===a?dS.RGB:2===a?dS.LUMINANCE_ALPHA:dS.LUMINANCE,iC.createWithData(e,{data:t,width:r,height:i},{type:dS.HALF_FLOAT,format:n,internalFormat:o,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE})}var oC="galacean-effects",aC="lookup_texture",sC="offscreen_canvas",uC={};function cC(e){return uC[e]}var lC=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:oC}):console.warn({content:"texture arrays not currently supported",type:oC}):console.warn({content:"only 2D textures currently supported",type:oC})}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 fC(t){var r=new lC(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?dS.TEXTURE_CUBE_MAP:dS.TEXTURE_2D,internalFormat:u,format:c,mipmaps:r.mipmaps(l)}}var hC,pC=function(){function t(){this.reloadPending={}}return t.prototype.reload=function(e){return eS(this,void 0,void 0,(function(){var t,r;return tS(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===dS.TEXTURE_CUBE_MAP?"object"==typeof o&&!!o:uR(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===dS.TEXTURE_CUBE_MAP?f.every((function(e){return"object"==typeof e&&e})):h.every((function(e){return uR(e)&&e.length>0}))}}return!1},t.prototype.loadSource=function(t,r){return eS(this,void 0,void 0,(function(){var i,n,o,a,s,u,c,l,f,h,p,d,m,v,y,g,T,x=this;return tS(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!==dS.TEXTURE_CUBE_MAP||i===e.TextureSourceType.mipmaps?[3,2]:[4,this.loadCubeMap(o)];case 1:return h=E.sent(),[2,$A($A({},r),{cube:h,target:dS.TEXTURE_CUBE_MAP,sourceType:e.TextureSourceType.image,sourceFrom:{type:e.TextureSourceType.image,map:$A({},o),target:dS.TEXTURE_CUBE_MAP}})];case 2:return i!==e.TextureSourceType.image?[3,4]:[4,QR(a)];case 3:return p=E.sent(),[2,$A($A({},r),{image:p,sourceType:e.TextureSourceType.image,sourceFrom:{type:i,url:a,target:dS.TEXTURE_2D}})];case 4:return i!==e.TextureSourceType.video?[3,6]:[4,$R(a)];case 5:return d=E.sent(),[2,$A($A({},r),{video:d,sourceType:e.TextureSourceType.video})];case 6:return i!==e.TextureSourceType.compressed?[3,8]:[4,JR(a)];case 7:return m=E.sent(),[2,$A($A($A({},fC(m)),r),{sourceFrom:{url:a,type:e.TextureSourceType.compressed}})];case 8:return i!==e.TextureSourceType.mipmaps?[3,17]:u?[4,JR(u)]:[3,13];case 9:return v=E.sent(),y=null!=n?n:dS.TEXTURE_2D,g=y===dS.TEXTURE_2D?c.slice():c.map((function(e){return e.slice()})),T=void 0,n!==dS.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(c.map((function(e){return x.loadMipmapImages(e,v)})))];case 10:return T=E.sent(),[3,12];case 11:T=this.loadMipmapImages(c,v),E.label=12;case 12:return[2,$A($A({},r),{mipmaps:T,target:y,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:e.TextureSourceType.mipmaps}})];case 13:return n!==dS.TEXTURE_2D&&n?[3,15]:[4,Promise.all(l.map((function(e){return QR(e)})))];case 14:return T=E.sent(),[2,$A($A({},r),{mipmaps:T,target:dS.TEXTURE_2D,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:l.slice(),target:dS.TEXTURE_2D}})];case 15:return n!==dS.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(f.map((function(e){return x.loadCubeMap(e)})))];case 16:return T=E.sent(),[2,$A($A({},r),{mipmaps:T,target:dS.TEXTURE_CUBE_MAP,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:f.map((function(e){return $A({},e)})),target:dS.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: ".concat(i))}}))}))},t.prototype.loadMipmapImages=function(e,t){return eS(this,void 0,void 0,(function(){return tS(this,(function(r){return[2,Promise.all(e.map((function(e){return QR(new Blob([new Uint8Array(t,e[0],e[1])]))})))]}))}))},t.prototype.loadCubeMap=function(e){return eS(this,void 0,void 0,(function(){return tS(this,(function(t){return[2,Promise.all(e.map((function(e){return QR(e)})))]}))}))},t}();function dC(){return hC||(hC=new pC),hC}var mC,vC=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 yC(e){return"object"==typeof e&&e&&void 0===e.length&&e instanceof iC}e.MaterialRenderType=void 0,(mC=e.MaterialRenderType||(e.MaterialRenderType={}))[mC.normal=0]="normal",mC[mC.transformFeedback=1]="transformFeedback";var gC,TC,xC=1,EC=function(){function t(t){this.props=t,this.destroyed=!1,this.initialized=!1;var r=t.name,i=void 0===r?"Material"+xC++: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=$A({},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}(),AC="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,(gC=e.ShaderCompileResultStatus||(e.ShaderCompileResultStatus={}))[gC.noShader=0]="noShader",gC[gC.success=1]="success",gC[gC.fail=2]="fail",gC[gC.compiling=3]="compiling",e.GLSLVersion=void 0,(TC=e.GLSLVersion||(e.GLSLVersion={})).GLSL1="100",TC.GLSL3="300 es";var SC=function(e){this.source=e},bC="effects-internal-copy",_C="effects-internal-copy-mesh",RC="\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}",CC="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(AC,"\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 OC(t,r){var i=2===t,n=i?"#version 300 es":"";return{name:bC,vertex:XR([],n+"\n"+RC,e.ShaderType.vertex,t),fragment:XR([],n+"\n"+CC,e.ShaderType.fragment,t),glslVersion:i?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:_C+ +r}}var LC,IC={format:dS.RGBA,type:dS.UNSIGNED_BYTE,minFilter:dS.LINEAR,magFilter:dS.LINEAR,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE},PC=Symbol("dispose"),MC=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(IC).forEach((function(e){var r,i=null!==(r=t[e])&&void 0!==r?r:IC[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;eb(l),c=iC.create(l,a),this.textureCache[u]=c,this.textureRef[u]=1,c[PC]=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[PC](),r.dispose=r[PC]),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[PC](),e.dispose=e[PC]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),wC=function(){function e(e){void 0===e&&(e={}),this.semantics=$A({},e)}return e.prototype.toObject=function(){return $A({},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 lR(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}(),FC=((LC={})[dS.FLOAT]=Float32Array.BYTES_PER_ELEMENT,LC[dS.INT]=Int32Array.BYTES_PER_ELEMENT,LC[dS.SHORT]=Int16Array.BYTES_PER_ELEMENT,LC[dS.BYTE]=Int8Array.BYTES_PER_ELEMENT,LC),NC=function(){function e(e){this.name=e}return e.prototype.initialize=function(){},e.prototype.flush=function(){},e}();function DC(e){return e===dS.INT?new Int32Array(0):e===dS.SHORT?new Int16Array(0):new Float32Array(0)}var VC,UC,BC=1,kC=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"+BC++,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}(),zC=1e3;e.RenderPassAttachmentStorageType=void 0,(VC=e.RenderPassAttachmentStorageType||(e.RenderPassAttachmentStorageType={}))[VC.none=0]="none",VC[VC.color=1]="color",VC[VC.stencil_8_opaque=2]="stencil_8_opaque",VC[VC.depth_16_opaque=3]="depth_16_opaque",VC[VC.depth_stencil_opaque=4]="depth_stencil_opaque",VC[VC.depth_16_texture=5]="depth_16_texture",VC[VC.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",e.TextureStoreAction=void 0,(UC=e.TextureStoreAction||(e.TextureStoreAction={}))[UC.store=0]="store",UC[UC.clear=2]="clear";var GC,jC=function(){function t(t,r){if(this.destroyed=!1,r){var i=r.texture,n=r.size;if(i instanceof iC)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?dS.RGBA:l,h=i.type,p=void 0===h?dS.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=iC.create(t,$A($A({},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,(GC=e.RenderPassDestroyAttachmentType||(e.RenderPassDestroyAttachmentType={}))[GC.force=0]="force",GC[GC.keep=1]="keep",GC[GC.keepExternal=2]="keepExternal",GC[GC.destroy=0]="destroy";var XC=1,HC=function(){function t(t,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+XC++: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=KS(d.slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||e.RenderPassAttachmentStorageType.none,this.clearAction=$A({},o),this.storeAction=$A({colorAction:e.TextureStoreAction.store,depthAction:e.TextureStoreAction.store,stencilAction:e.TextureStoreAction.store},u),this.semantics=new wC(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){QS(this.meshes,e,this.meshOrder)},t.prototype.removeMesh=function(e){VS(this.meshes,e)},t.prototype.setMeshes=function(e){var t;return this.meshes.length=0,(t=this.meshes).splice.apply(t,nS([0,0],iS(e),!1)),KS(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=iS(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 jC(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 jC(i.renderer.engine,$A({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=PO.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=dR}},t}(),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);}",WC="#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);}}",ZC="#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}",qC="#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",KC="#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}}",QC="#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}",JC="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);}",$C="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));}",eO="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",tO="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);}",rO="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.));}",iO="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.);}",nO="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);}",oO="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;}",aO="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",sO="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);}",uO="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);}",cO="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);}",lO="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);}",fO="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);}",hO=function(t){function r(r,i){var n=t.call(this,r,i)||this,o=n.renderer.engine,a=NC.create(o,{mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=EC.create(o,{shader:{vertex:aO,fragment:fO,glslVersion:e.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=kC.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}return JA(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}(HC),pO=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=NC.create(a,{name:s,mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:aO,fragment:"H"==i?uO:cO,glslVersion:e.GLSLVersion.GLSL1},l=EC.create(a,{name:s,shader:c});return l.blending=!1,l.depthTest=!1,l.culling=!1,o.screenMesh=kC.create(a,{name:s,geometry:u,material:l,priority:0}),o.priority=5e3,o}return JA(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",xO(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFrameBuffer().getColorTextures()[0])},r}(HC),dO=function(t){function r(e,r){var i=t.call(this,e,r)||this,n="PostProcess",o=i.renderer.engine,a=NC.create(o,{name:n,mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s={vertex:aO,fragment:lO},u=EC.create(o,{name:n,shader:s});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=kC.create(o,{name:n,geometry:a,material:u,priority:0}),i.priority=5e3,i}return JA(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",xO(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},r}(HC),mO=function(t){function r(r,i){var n=t.call(this,r,{})||this,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new jC(a);var s=NC.create(a,{name:o,mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=EC.create(a,{name:o,shader:{vertex:aO,fragment:sO,glslVersion:e.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=kC.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}return JA(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}(HC),vO={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,useToneMapping:1},yO="_effects_default_",gO=1,TO=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=$A($A({},vO),u)),this.globalUniforms=new AO;var h,p=[],d={};if(this.renderer=o,this.globalVolume){var m=this.globalVolume.useHDR?dS.HALF_FLOAT:dS.UNSIGNED_BYTE;p=[{texture:{format:dS.RGBA,type:m,magFilter:dS.LINEAR,minFilter:dS.LINEAR}}],h={storageType:e.RenderPassAttachmentStorageType.depth_stencil_opaque},d={colorAction:e.TextureLoadAction.clear,stencilAction:e.TextureLoadAction.clear,depthAction:e.TextureLoadAction.clear}}var v=[new HC(o,{name:yO,priority:zC,meshOrder:e.OrderType.ascending,depthStencilAttachment:h,attachments:p,clearAction:d})];if(this.setRenderPasses(v),this.globalVolume){var y=this.globalVolume.useBloom,g=new jC(f);if(y){var T=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],x=new Array(7),E=(m=this.globalVolume.useHDR?dS.HALF_FLOAT:dS.UNSIGNED_BYTE,new hO(o,{name:"BloomThresholdPass",attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]}));E.sceneTextureHandle=g,this.addRenderPass(E);for(var A=0;A<7;A++){x[A]=new jC(f);var S=new pO(o,"H",{name:"GaussianDownPassH"+A,viewport:T,attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]}),b=new pO(o,"V",{name:"GaussianDownPassV"+A,viewport:T,attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]});b.gaussianResult=x[A],this.addRenderPass(S),this.addRenderPass(b),T[2]/=2,T[3]/=2}T[2]*=4,T[3]*=4;for(A=0;A<6;A++){var _=new dO(o,{name:"GaussianUpPass"+A,viewport:T,attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]});_.gaussianDownSampleResult=x[5-A],this.addRenderPass(_),T[2]*=2,T[3]*=2}}var R=void 0;R=y?new mO(o,g):new mO(o),this.addRenderPass(R)}this.semantics=new wC(t.semantics),this.clearAction=l,this.name="RenderFrame".concat(gO++);var C=v[0],O={type:dS.UNSIGNED_BYTE,format:dS.RGBA,internalFormat:dS.RGBA,wrapS:dS.MIRRORED_REPEAT,wrapT:dS.MIRRORED_REPEAT,minFilter:dS.NEAREST,magFilter:dS.NEAREST};this.emptyTexture=iC.create(f,$A({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:e.TextureSourceType.data},O)),this.transparentTexture=iC.create(f,$A({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:e.TextureSourceType.data},O)),this.camera=i,this.keepColorBuffer=n,this.renderPassInfoMap.set(C,{listStart:0,listEnd:0,renderPass:C,intermedia:!1}),this.editorTransform=s,t.clearAction||this.resetClearActions(),this.passTextureCache=new MC(f);var L=f.gpuCapability,I=L.detail,P=OC(L.level,I.readableDepthStencilTextures&&I.writableFragDepth);null===(r=this.renderer.getShaderLibrary())||void 0===r||r.addShader(P)}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(yO);)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===bC;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}),VS(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=$A($A({},(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],VS(h,s);var d=f.get(s);f.delete(s);var m=2===this.renderer.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,v=new HC(this.renderer,{name:yO+p,priority:s.priority,attachments:[{texture:{sourceType:e.TextureSourceType.framebuffer,format:dS.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=[],T=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,nS([a+1,0],iS(g),!1)),T.splice(0,2));var x=this.resource.finalCopyRP;y.includes(x)||y.push(x);var E=g[g.length-1];E.initialize(this.renderer);var A=new HC(this.renderer,{name:yO+(p+1),priority:s.priority+1+((null===(n=r.prePasses)||void 0===n?void 0:n.length)||0),meshes:T,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,A),this.setRenderPasses(y),this.updateRenderInfo(E),this.updateRenderInfo(v),this.updateRenderInfo(A),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(yO)||!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===dS.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===bC?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?dS.LINEAR:dS.NEAREST,c=iC.create(r,{sourceType:e.TextureSourceType.framebuffer,format:dS.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=iC.create(r,{sourceType:e.TextureSourceType.framebuffer,format:dS.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 HC(this.renderer,{depthStencilAttachment:{storageType:f},attachments:[{texture:c}]}).initialize(this.renderer),p=new EO(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=bC,r=this.renderer.engine,i=NC.create(r,{name:t,mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=OC(r.gpuCapability.level,!!(null==e?void 0:e.depthTexture));this.renderer.getShaderLibrary().addShader(n);var o=EC.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=[dS.SRC_ALPHA,dS.ONE_MINUS_SRC_ALPHA,dS.SRC_ALPHA,dS.ONE_MINUS_SRC_ALPHA]),kC.create(r,{name:t,geometry:i,material:o,priority:0})},t.prototype.removeRenderPass=function(e){VS(this._renderPasses,e)},t}();function xO(e){return e?[e.getWidth(),e.getHeight()]:[0,0]}var EO=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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",xO(this.prePassTexture)),e.renderMeshes(this.meshes),this.storeAction&&e.clear(this.storeAction)},t}(HC),AO=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},SO=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}(),bO="function"==typeof WebGL2RenderingContext,_O=function(){function e(e){this.setupCapability(e)}return e.prototype.setupCapability=function(e){var t,r=bO&&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=RO(e,e.HALF_FLOAT)),i&&!s&&(s=RO(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:IO(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 RO(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 CO,OO,LO={NONE:0,PVRTC:1,ASTC:2};function IO(e){return e.getExtension("WEBGL_compressed_texture_astc")?LO.ASTC:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?LO.PVRTC:LO.NONE}e.FilterMode=void 0,(CO=e.FilterMode||(e.FilterMode={}))[CO.Nearest=0]="Nearest",CO[CO.Linear=1]="Linear",e.RenderTextureFormat=void 0,(OO=e.RenderTextureFormat||(e.RenderTextureFormat={}))[OO.RGBA32=0]="RGBA32",OO[OO.RGBAHalf=1]="RGBAHalf";var PO=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}(),MO=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}(),wO=1,FO=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=nS([],iS(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)===sS]],n=Z_(this.color).getValue(0),o=this.engine.gpuCapability.level,a={shader:{vertex:XR(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:XR(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=EC.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 NC.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:dS.LINES,maxVertex:4})},t.prototype.createMesh=function(e,t){return kC.create(this.engine,{name:"Interact_preview"+wO++,priority:0,worldMatrix:Ib(),geometry:e,material:t})},t}(),NO=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 JA(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return CS.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===_S.DRAG&&(o!==sS||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,DO(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=C_([0,0,0],.5,.5);return r.forEach((function(e){e.forEach((function(e){s_(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(eb(o),i===_S.CLICK&&(this.clickable=!0,n&&a===sS)){var s=e.getRendererOptions();this.previewContent=new FO(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(!DO(t,3)&&t){t.vx*=5,t.vy*=5,r.dragEvent=$A({},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=iS(n.dxRange,2);(d=Eb(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,T=iS(n.dyRange,2);(m=Eb(m,y=T[0],g=T[1]))!==y&&m!==g&&y!==g&&(null===(i=t.origin)||void 0===i||i.preventDefault())}this.composition.camera.position=[d,m,l]}},r}(TR);function DO(e,t){var r=1e-5*(t||1);return e&&Math.abs(e.vx||0)<r&&Math.abs(e.vy||0)<r}var VO=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.mesh=[],t}return JA(t,e),t.prototype.onCompositionItemLifeBegin=function(e,t){t instanceof NO&&t.previewContent&&this.addMesh(t.previewContent.mesh)},t.prototype.onCompositionItemRemoved=function(e,t){t instanceof NO&&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}(CR),UO=function(){};e.maxSpriteMeshItemCount=8,e.maxSpriteTextureCount=8;var BO=1,kO=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?dS.LINES:dS.TRIANGLES),o=this.createMaterial(t,2);this.wireframe=i,this.mesh=kC.create(e,{name:"MSprite"+BO++,priority:0,worldMatrix:Ib(),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++){(_=null==(m=t[d])?void 0:m.renderer.texture)&&DS(s,_),m.mesh=this}for(d=0;d<t.length;d++){var m,v=(_=null==(m=t[d])?void 0:m.renderer.texture)?s.indexOf(_):-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)},T={aPoint:0,index:0},x=function(e){var t=a[e];Object.keys(g).forEach((function(e){var r=g[e],i=t[e];r.set(i,T[e]),T[e]+=i.length}))};for(d=0;d<a.length;d++)x(d);var E=this.mesh,A=E.material,S=E.geometry,b=g.index;S.setIndexData(b),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 _=s[d];A.setTexture("uSampler"+d,_)}for(var R=t[0].emptyTexture,C=s.length;C<e.maxSpriteMeshItemCount;C++)A.setTexture("uSampler"+C,R);if(this.splitLayer){var O=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=iC.createWithData(e,{width:i,height:1,data:n},{name:"feather",format:dS.LUMINANCE,minFilter:dS.LINEAR,magFilter:dS.LINEAR,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE})}else r=iC.createWithData(e);return r}(this.engine,t[0].feather);A.setTexture("uFeatherSampler",O)}},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 NC.create(this.engine,{attributes:{aPoint:{size:4,offset:0,stride:oS*r,releasable:!0,type:dS.FLOAT,data:new Float32Array(0)},aIndex:{size:2,offset:4*r,stride:oS*r,dataSource:"aPoint",type:dS.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:HO(e,t,h.gpuCapability.level,null===(n=h.renderer)||void 0===n?void 0:n.env)};this.preMultiAlpha=kR(u),this.mtlSlotCount=t;var d=EC.create(h,p),m=$A({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&&HR(d,m.blendMode),d.blendFunction=m.blendFunction,WR(d,m.maskMode),YR(d,m.side);var v=f.uniformValues;if(v)try{for(var y=rS(Object.keys(v)),g=y.next();!g.done;g=y.next()){var T=g.value,x=v[T];x instanceof iC?d.setTexture(T,x):"number"==typeof x?d.setFloat(T,x):2===x.length?d.setVector2(T,x):4===x.length?d.setVector4(T,x):d.setMatrix(T,x)}}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=[],A=[],S=[],b=0;b<t;b++)E.push(Ib()),A.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",A),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=iS(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 T=0;T<y;T++){var x=4*(2*T+g),E=n?[0,0,1,1,r[0][4]]:r[2*T+g],A=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,b=((T+T+1)/y-1)/2,_=E[0],R=E[1],C=E[4]?E[3]:E[2],O=E[4]?E[2]:E[3],L=[p[0]/v+S,p[1]/y+b,p[2]/v+S,p[3]/y+b,p[4]/v+S,p[5]/y+b,p[6]/v+S,p[7]/y+b];d.push(L[0]*a,L[1]*s,A[0]*C+_,A[1]*O+R,t,0,L[2]*a,L[3]*s,A[2]*C+_,A[3]*O+R,t,0,L[4]*a,L[5]*s,A[4]*C+_,A[5]*O+R,t,0,L[6]*a,L[7]*s,A[6]*C+_,A[7]*O+R,t,0),this.lineMode?m.push(x,1+x,1+x,3+x,3+x,2+x,2+x,x):m.push(x,1+x,2+x,2+x,1+x,3+x)}return{index:m,aPoint:d}},t}();function zO(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)}function GO(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 jO(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===sS],["ADJUST_LAYER",!!r],["USE_BLEND",!c],["MAX_FRAG_TEX",e.maxSpriteTextureCount>=16?16:8]],h=l?YC:ZC.replace(/#pragma\s+FILTER_FRAG/,(null==r?void 0:r.fragment)||""),p=WC.replace(/#pragma\s+FILTER_VERT/,(null==r?void 0:r.vertex)||"vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}");return{fragment:XR(f,h,e.ShaderType.fragment,t),vertex:XR(f,p,e.ShaderType.vertex,t),glslVersion:1===t?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,marcos:f,shared:!0}}function XO(e,t){return e.filter?"".concat(e.filter.mesh.shaderCacheId,"_effects_filter"):"".concat(e.cachePrefix,"_effects_sprite_").concat(t)}function HO(e,t,r,i){var n=e.filter,o=e.wireframe,a=jO(r,null==n?void 0:n.mesh,{count:t,wireframe:o,env:i});return a.shared=!0,o||(a.cacheId=XO(e,t)),a}var YO="listIndex",WO=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(ZO(x=u[y]))l.push.apply(l,nS([],iS(this.removeMeshSplitsItem(d,x,s,u)),!1)),this.check();else{var g=d.indexOf(x);g>-1&&(d.splice(g,1),v.length=0,g>0&&(v=this.combineSplits(d,g-1,s),l.push.apply(l,nS([],iS(v),!1))),!v.length&&g<=d.length-1&&(v=this.combineSplits(d,g,s),l.push.apply(l,nS([],iS(v),!1))),this.check())}}var T=!1;for(y=0;y<c.length;y++)for(var x=c[y],E=this.addMeshSplitsItem(d,x,s),A=0;A<E.length;A++){var S=E[A];if(S.spriteMesh)throw new Error("no sprite mesh in neo split");var b=S.spriteMesh=new kO(this.engine,S.renderInfo,this.composition);f.push(b.mesh),b.setItems(S.items.map((function(e){return e.content}))),b.applyChange(),b.splitLayer&&(null===(t=m.layerToAdd)||void 0===t||t.push(b)),S.dirty=!1,this.check(),T=!0}if(T){var _,R=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=C.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)?VS(f,v):DS(h,v),s.splice(t+1,1),t--}}_=t},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=(I=s[y]).spriteMesh;if(0===I.items.length)throw new Error("split not combined");if(I.dirty){var L=I.indexStart;O.mesh.priority!==L&&(O.mesh.priority=L,p.push(O.mesh)),O.setItems(I.items.map((function(e){return e.content})))}O.applyChange(),I.dirty=!1}if(l.length)for(y=0;y<l.length;y++){var I,P=(b=(I=l[y]).spriteMesh).mesh;P.dispose({material:{textures:e.DestroyOptions.keep}}),h.push(P)}if(this.itemsToRemove.length=0,this.itemsToAdd.length=0,f.length+h.length+p.length){var M=this.meshes;return this.meshSplits.forEach((function(e,t){return M[t]=e.spriteMesh.mesh})),M.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)?VS(this.itemsToRemove,e):DS(this.itemsToAdd,e)},t.prototype.removeItem=function(e){this.items.includes(e)?ZO(e)?this.itemsToRemove.unshift(e):this.itemsToRemove.push(e):VS(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(US(e,t,YO),ZO(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(ZO(t)){if(o<=n.indexEnd){US(e,t,YO);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 US(e,t,YO),{value:[]};if(o<n.indexEnd){US(e,t,YO);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(US(e,t,YO),ZO(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,VS(e,t),0===a.items.length){if(VS(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(ZO(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(ZO(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===CS.sprite&&o.items.length<e.maxSpriteMeshItemCount&&h+o.textures.length<=e.maxSpriteTextureCount?(US(o.items,u,YO),DS(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 ZO(e){var t=e.type;return t===CS.sprite||t===CS.filter}var qO={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},KO=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="sprite",e}return JA(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[XO(qO,2)]){o.addShader(HO(qO,2,s,c)),o.addShader(HO(qO,e.maxSpriteMeshItemCount,s,c));var l=!1;null===(n=t[0])||void 0===n||n.items.forEach((function(e){e.type===CS.filter&&e.content.filter&&(l=!0,FS(e.content.filter).forEach((function(e){if(!e.isParticle){var t=jO(s,e,e);e.shaderCacheId&&(t.cacheId="".concat(e.shaderCacheId,"_effects_filter")),o.addShader(t)}})))})),l&&o.addShader(OC(s,!1)),u.writableFragDepth&&o.addShader(OC(s,!0))}return Promise.resolve()},r.prototype.onCompositionDestroyed=function(e){e.loaderData.spriteGroup.dispose()},r.prototype.onCompositionReset=function(e,t){var r=new WO(e);e.loaderData.spriteGroup=r,r.resetMeshSplits()},r.prototype.onCompositionItemLifeBegin=function(e,t){var r=e.loaderData.spriteGroup;t.type!==CS.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}(CR),QO=[0,0,0],JO=[1,1,1],$O=[0,0,0],eL=function(){function e(e,t){var r;this.active=!1,this.transform=t.transform;var i=this.transform.scale;this.basicTransform={position:nS([],iS(this.transform.position),!1),rotation:nS([],iS(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=Z_(s.path));var u=s.linearX||s.linearY||s.linearZ;u&&(this.linearVelOverLifetime={x:s.linearX&&Z_(s.linearX),y:s.linearY&&Z_(s.linearY),z:s.linearZ&&Z_(s.linearZ),asMovement:s.asMovement,enabled:!!u});var c=s.orbitalX||s.orbitalY||s.orbitalZ;c&&(this.orbitalVelOverLifetime={x:s.orbitalX&&Z_(s.orbitalX),y:s.orbitalY&&Z_(s.orbitalY),z:s.orbitalZ&&Z_(s.orbitalZ),center:Qb(s.orbCenter),asRotation:s.asRotation,enabled:!!c}),this.speedOverLifetime=s.speedOverLifetime&&Z_(s.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Z_(o.x||1),this.sizeYOverLifetime=Z_(o.y||1),this.sizeZOverLifetime=Z_(o.z||1)):this.sizeXOverLifetime=Z_(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:Z_(n.z||0)},n.separateAxes)){var l=this.rotationOverLifetime;l.x=Z_(n.x||0),l.y=Z_(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===ob.loop,endBehavior:t.endBehavior||0,gravity:Qb(s.gravity),gravityModifier:Z_(null!==(r=s.gravityOverLifetime)&&void 0!==r?r:0),direction:s.direction?t_([],s.direction):Qb()},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=r_([],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&&!Kb(this.options.gravity)||this.options.startSpeed&&!Kb(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=Zb(JO,1),n=Zb(QO,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=Wb(QO,this.basicTransform.rotation,n);l.transform.setRotation(v[0],v[1],v[2])}return(this.getWillTranslate()||t)&&F_(f=[0,0,0],this,this.options.gravity,s,u,this.basicTransform.position,this.velocity),this.basicTransform.path&&(f||(f=$b($O,this.basicTransform.position,3)),Wb(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}(),tL=[[0,0,1,1,void 0]],rL=[1,1,1,1],iL=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,T=i.transform.scale;h.options=$A($A({},h.options),{startColor:m.startColor||[1,1,1,1]}),h.interaction=p,h.renderer={renderMode:null!==(n=d.renderMode)&&void 0!==n?n:OS.BILLBOARD,blending:null!==(o=d.blending)&&void 0!==o?o:xS.ALPHA,texture:h.initTexture(d.texture,g),occlusion:!!d.occlusion,transparentOcclusion:!!d.transparentOcclusion||d.maskMode===AS.MASK,side:null!==(a=d.side)&&void 0!==a?a:ES.DOUBLE,shape:d.shape,mask:null!==(s=d.mask)&&void 0!==s?s:0,maskMode:null!==(u=d.maskMode)&&void 0!==u?u:AS.NONE,order:y};var x=Sb(d.anchor,d.particleOrigin);d.anchor||void 0===d.particleOrigin||Wb(h.basicTransform.position,h.basicTransform.position,[-x[0]*T[0],-x[1]*T[1],0]),h.transform.setAnchor(x[0]*T[0],x[1]*T[1],0);var E=t.colorOverLifetime;return E&&(h.opacityOverLifetime=Z_(null!==(c=E.opacity)&&void 0!==c?c:1),E.color&&E.color[0]===ib.GRADIENT_COLOR&&(h.colorOverLifetime=GS(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=Z_(t.filter.feather)),h.emptyTexture=g,h.splits=t.splits||tL,h.listIndex=i.listIndex||0,h.textureSheetAnimation=t.textureSheetAnimation,h.cachePrefix="-",h.parentId=i.parentId,h.reusable=i.reusable,h._renderInfo=GO(h),h}return JA(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=Zb(rL,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=zS(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 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 T=void 0,x=void 0;y?(T=1/f.row*m,x=1/f.col*v):(T=1/f.col*m,x=1/f.row*v);var E=void 0;if(f.animate){var A=Math.round(u*(h-1)),S=Math.floor(A/f.col),b=A-S*f.col;E=y?[T*S,x*(f.col-b)]:[T*b,x*(1+S)]}else E=[0,x];n.texOffset=[p+E[0],v+d-E[1],T,x]}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}(eL),nL=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return JA(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return CS.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=C_([0,0,0],i[0]/2,i[1]/2);return n.forEach((function(e){e.forEach((function(e){s_(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===ES.FRONT}}},r.prototype.getRenderData=function(){return this.content.getRenderData(this.content.time)},r.prototype.doCreateContent=function(e){var t=e.getRendererOptions().emptyTexture;return new iL(this.sprite,{emptyTexture:t},this)},r.prototype.createWireframeMesh=function(e,t){var r=new kO(this.composition.getEngine(),$A({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}(TR),oL=1,aL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return CS.filter},enumerable:!1,configurable:!0}),t.prototype.onConstructed=function(t){e.prototype.onConstructed.call(this,t),this.filterOptions=t.content.filter,this.cachePrefix="filter:"+oL++,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=rS(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=NS(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}(nL),sL=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,T=t.textureFlip,x=t.useSprite,E=t.name,A=t.filter,S=t.gravity,b=t.forceTarget,_=t.side,R=t.occlusion,C=t.anchor,O=t.blending,L=t.maskMode,I=t.mask,P=t.transparentOcclusion,M=t.listIndex,w=t.meshSlots,F=t.renderMode,N=void 0===F?0:F;t.matrix;var D,V,U=t.diffuse,B=void 0===U?iC.createWithData(s):U,k=s.gpuCapability.detail,z=k.halfFloatTexture,G=k.maxVertexUniforms,j=[["RENDER_MODE",+N],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",u===sS]],X=s.gpuCapability.level,H={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},Y={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},W=G>0,Z={},q=0,K=0;if(this.useSprite=x,W&&j.push(["ENABLE_VERTEX_TEXTURE",!0]),c&&(j.push(["SPEED_OVER_LIFETIME",!0]),K|=2,Z.uSpeedLifetimeValue=c.toUniform(H)),(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),A&&A.name!==uS){j.push(["USE_FILTER",!0]),K|=8;var Q=NS(A,r.composition);if(!Q.particle)throw new Error("particle filter ".concat(A.name," not implement"));D=Q.particle,Object.keys(null!==(n=D.uniforms)&&void 0!==n?n:{}).forEach((function(e){var t,r=null===(t=D.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(H)})),Object.keys(null!==(o=D.uniformValues)&&void 0!==o?o:{}).forEach((function(e){var t,r=null===(t=D.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 iC?l.color:iC.createWithData(s,qS(l.color))),(null==l?void 0:l.opacity)?Z.uOpacityOverLifetimeValue=l.opacity.toUniform(H):Z.uOpacityOverLifetimeValue=Z_(1).toUniform(H),["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(H),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(H),i=1,K|=1<<10+t,V=!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),V&&((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(H),(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(H)),(null==d?void 0:d.z)&&(Z.uRZByLifeTimeValue=d.z.toUniform(H),K|=32768,j.push(["ROT_Z_LIFETIME",1])),(null==d?void 0:d.x)&&(Z.uRXByLifeTimeValue=d.x.toUniform(H),K|=65536,j.push(["ROT_X_LIFETIME",1])),(null==d?void 0:d.y)&&(Z.uRYByLifeTimeValue=d.y.toUniform(H),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(H),b&&(j.push(["FINAL_TARGET",!0]),K|=1<<19,Z.uFinalTarget=new Float32Array(b.target||[0,0,0]),Z.uForceCurve=b.curve.toUniform(H)),z&&Y.max?(K|=1<<20,Z.uFCurveValueTexture=nC(s,j_.getAllData(Y,!0),Y.index,1)):Z.uFCurveValues=j_.getAllData(Y);var J=H.max+H.curves.length-32>G;if(2===X&&(H.max=-1,H.index=w?w[0]:cL(H.index),Y.index>0&&(Y.max=-1,Y.index=w?w[1]:cL(Y.index))),J&&z&&W){var $=nC(s,j_.getAllData(H,!0),H.index,1);Z.uVCurveValueTexture=$,q=1}else Z.uVCurveValues=j_.getAllData(H);var ee=["-p:",N,K,H.index,H.max,Y.index,Y.max].join("+");j.push(["VERT_CURVE_VALUE_COUNT",H.index],["FRAG_CURVE_VALUE_COUNT",Y.index],["VERT_MAX_KEY_FRAME_COUNT",H.max],["FRAG_MAX_KEY_FRAME_COUNT",Y.max]);var te=A?qC.replace(/#pragma\s+FILTER_FRAG/,D.fragment):qC,re="#define LOOKUP_TEXTURE_CURVE ".concat(q,"\n").concat(KC),ie=A?re.replace(/#pragma\s+FILTER_VERT/,D.vertex||"void filterMain(float t){}\n"):re,ne={fragment:XR(j,te,e.ShaderType.fragment,X),vertex:XR(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)};A&&(ne.cacheId+=A.name);var oe={shader:ne,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},ae=kR(O);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,+(!!R&&!P)]),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=EC.create(s,oe);se.blending=!0,se.depthTest=!0,se.depthMask=!!R,se.stencilRef=I?[I,I]:void 0,WR(se,L),HR(se,O),YR(se,_);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 iC)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=NC.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=kC.create(s,{name:"MParticle_".concat(E),priority:M,material:se,geometry:ce});this.anchor=C,this.mesh=le,this.geometry=le.firstGeometry(),this.forceTarget=b,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=T?[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=F_([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),gR.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,T=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],x=Math.random(),E=void 0;c&&(E=e.sprite);for(var A=0;A<4;A++){var S=2*A,b=3*A,_=4*A,R=12*A,C=8*A;u.aPos.set(l,R),u.aPos.set(y,R+3),u.aRot.set(f,C),u.aRot[C+3]=x,u.aRot.set(g,C+4),c&&u.aSprite.set(E,b);var O=e.uv||v;if(O){var L=c?1-d[S+1]:d[S+1];m[0]=O[0]+d[S]*O[2],m[1]=O[1]+L*O[3]}u.aOffset.set(m,_);for(var I=A+A,P=(T[I]-this.anchor[0])*p[0],M=(T[I+1]-this.anchor[1])*p[1],w=0;w<3;w++)u.aPos[R+6+w]=e.dirX[w]*P,u.aPos[R+9+w]=e.dirY[w]*M}var F=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(a){var N=BS(o.getIndexData(),6*i,s,6*r);N.set(F,6*t),o.setIndexData(N),this.maxParticleBufferCount=N.length/6}else o.setIndexSubData(6*t,F);Object.keys(u).forEach((function(e){var i=u[e],c=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(a){var l=BS(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}(),uL=[10,32,64,160];function cL(e){for(var t=0;t<uL.length;t++){var r=uL[t];if(r>e)return r}return e||uL[0]}function lL(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===sS]],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,eR(p,v));var T=u.textureSheetAnimation;T&&T.animate&&(l.push(["USE_SPRITE",!0]),g|=4);var x=void 0;if(u.filter&&u.filter.name!==uS){l.push(["USE_FILTER",!0]),g|=8;var E=FS(u.filter).find((function(e){return e.isParticle}));if(!E)throw Error("particle filter ".concat(u.filter.name," not implement"));x=E,null===(o=E.uniforms)||void 0===o||o.forEach((function(e){return eR(p,e)}))}var A=u.colorOverLifetime;A&&A.color&&(l.push(["COLOR_OVER_LIFETIME",!0]),g|=16);var S=A&&A.opacity;S&&eR(p,S);var b,_=u.positionOverLifetime;["x","y","z"].forEach((function(e,t){var r=0,i="linear"+e.toUpperCase(),n="orbital"+e.toUpperCase();(null==_?void 0:_[i])&&(eR(p,_[i]),r=1,g|=1<<7+t),l.push(["LINEAR_VEL_".concat(e.toUpperCase()),r]);var o=0;(null==_?void 0:_[n])&&(eR(p,_[n]),o=1,g|=1<<10+t,b=!0),l.push(["ORB_VEL_".concat(e.toUpperCase()),o])})),(null==_?void 0:_.asMovement)&&(l.push(["AS_LINEAR_MOVEMENT",!0]),g|=32),b&&(null==_?void 0:_.asRotation)&&(l.push(["AS_ORBITAL_MOVEMENT",!0]),g|=64);var R=u.sizeOverLifetime;eR(p,null==R?void 0:R.x),(null==R?void 0:R.separateAxes)&&(l.push(["SIZE_Y_BY_LIFE",1]),g|=16384,eR(p,null==R?void 0:R.y));var C=u.rotationOverLifetime;(null==C?void 0:C.z)&&(eR(p,null==C?void 0:C.z),g|=32768,l.push(["ROT_Z_LIFETIME",1])),(null==C?void 0:C.separateAxes)&&(C.x&&(eR(p,C.x),g|=65536,l.push(["ROT_X_LIFETIME",1])),C.y&&(eR(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),eR(p,null==_?void 0:_.gravityOverLifetime),(null==_?void 0:_.forceTarget)&&(l.push(["FINAL_TARGET",!0]),g|=1<<19,eR(p,_.forceCurve));var O=h.halfFloatTexture;O&&d.max&&(g|=1<<20);var L=h.maxVertexUniforms,I=p.max+p.curves.length-32>L;cC(aC)&&(I=!0),2===f&&(p.max=-1,d.index>0&&(d.max=-1)),I&&O&&m&&(y=1);var P=["-p:",c,g,p.index,p.max,d.index,d.max].join("+"),M={fragment:qC,vertex:"#define LOOKUP_TEXTURE_CURVE ".concat(y,"\n").concat(KC),shared:!0,cacheId:P,marcos:l,name:"particle#".concat(e.name)};return x&&(M.fragment=M.fragment.replace(/#pragma\s+FILTER_FRAG/,null!==(a=x.fragment)&&void 0!==a?a:""),M.vertex=M.vertex.replace(/#pragma\s+FILTER_VERT/,x.vertex||"void filterMain(float t){}\n"),M.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:M,vertex:p.index,fragment:d.index}}function fL(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 hL=function(e){this.content=e},pL=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 hL(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 hL(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}(),dL=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=mL(this.arc,this.arcMode,e)*cS,r=[Math.cos(t)*this.radius,Math.sin(t)*this.radius,0],i=o_([],r,Math.tan(this.angle*cS));return i[2]+=1,{position:o_(r,r,pR(0,1)),direction:t_(i,i)}},e}();function mL(e,t,r){if(t===ub.RANDOM)e=pR(0,e);else if(t===ub.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);e=e/r.total*i}else if(t===ub.BIDIRECTIONAL_CYCLE){var n=(i=r.index/(r.total+1))-Math.floor(i);e*=Math.floor(i)%2?1-n:n}else t===ub.UNIFORM_BURST&&(e=e*r.burstIndex/r.burstCount);return e}var vL,yL=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=mL(this.arc,this.arcMode,e)*cS,r=[Math.cos(t),Math.sin(t),0],i=this.radius;return{direction:r,position:r.map((function(e){return e*i}))}},e}(),gL=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:[pR(-this._d,this._d),pR(-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=mL(this.arc,this.arcMode,e)*cS,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}(),xL=function(){function e(e){this._d=e.width||1,this.arcMode=e.arcMode}return e.prototype.generate=function(e){var t=this.arcMode===ub.UNIFORM_BURST?e.burstIndex%e.burstCount/(e.burstCount-1):pR(0,1);return{direction:[0,1,0],position:[this._d*(t-.5),0,0]}},e}(),EL=[],AL=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=pR(0,2*Math.PI),n=mL(this.arc,this.arcMode,e)*cS,o=l_(EL,n),a=[Math.cos(i),Math.sin(i),0],s=[r+Math.cos(i)*t,0,Math.sin(i)*t];return{direction:Jb(a,a,o),position:Jb(s,s,o)}},e}(),SL=[],bL=function(){function e(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}return e.prototype.getHorizontalAngle=function(){return pR(-90,90)},e.prototype.generate=function(e){var t=mL(this.arc,this.arcMode,e)*cS,r=this.getHorizontalAngle()*cS,i=this.radius,n=[Math.cos(r),0,Math.sin(r)],o=Jb(n,n,l_(SL,t));return{position:o.map((function(e){return e*i})),direction:o}},e}(),_L=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t.prototype.getHorizontalAngle=function(){return pR(0,90)},t}(bL),RL=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=Eb(e.random||0,0,1)}return e.prototype.generate=function(e){var t=this.anchors,r=t.length/2-1,i=Math.floor(mL(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:t_(a,a)}},e}(),CL=function(){function e(){}return e.prototype.generate=function(){return{position:[0,0,0],direction:[0,0,0]}},e}(),OL=((vL={})[SS.NONE]=CL,vL[SS.CONE]=dL,vL[SS.SPHERE]=bL,vL[SS.HEMISPHERE]=_L,vL[SS.CIRCLE]=yL,vL[SS.DONUT]=AL,vL[SS.RECTANGLE]=gL,vL[SS.EDGE]=xL,vL[SS.RECTANGLE_EDGE]=TL,vL[SS.TEXTURE]=RL,vL);function LL(e){if(!e)return new CL;var t=$A({radius:1,arc:360,angle:0,arcMode:ub.RANDOM},e),r=e.type,i=OL[r];if(!i)throw Error("invalid shape:"+r);var n=new i(t);if(r!==SS.NONE){var o=e,a=o.alignSpeedDirection,s=o.upDirection,u=void 0===s?[0,0,1]:s;n.alignSpeedDirection=a,n.upDirection=t_(u)}return n}function IL(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=ZL(o,e[o],e[o+1],a);else for(o=r-i;o>=t;o-=i)a=ZL(o,e[o],e[o+1],a);return a&&GL(a,a.next)&&(qL(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||!GL(i,i.next)&&0!==zL(i.prev,i,i.next))i=i.next;else{if(qL(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(zL(t,r,i)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(BL(t.x,t.y,r.x,r.y,i.x,i.y,n.x,n.y)&&zL(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function wL(e,t,r,i){var n=e.prev,o=e,a=e.next;if(zL(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=VL(s,u,t,r,i),h=VL(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&&BL(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&zL(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==e.prev&&d!==e.next&&BL(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&zL(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=f;){if(p!==e.prev&&p!==e.next&&BL(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&zL(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=h;){if(d!==e.prev&&d!==e.next&&BL(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&zL(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function FL(e,t){return e.x-t.x}function NL(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&&BL(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=WL(t,e);PL(t,t.next),PL(r,r.next)}}function DL(e,t){return zL(e.prev,e,t.prev)<0&&zL(t.next,e,e.next)<0}function VL(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 UL(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 BL(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 kL(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&&jL(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)&&(zL(e.prev,e,t.prev)||zL(e,t.prev,t))||GL(e,t)&&zL(e.prev,e,e.next)>0&&zL(t.prev,t,t.next)>0)}function zL(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function GL(e,t){return e.x===t.x&&e.y===t.y}function jL(e,t,r,i){var n=HL(zL(e,t,r)),o=HL(zL(e,t,i)),a=HL(zL(r,i,e)),s=HL(zL(r,i,t));return n!==o&&a!==s||(!(0!==n||!XL(e,r,t))||(!(0!==o||!XL(e,i,t))||(!(0!==a||!XL(r,e,i))||!(0!==s||!XL(r,t,i)))))}function XL(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 zL(e.prev,e,e.next)<0?zL(e,t,e.next)>=0&&zL(e,e.prev,t)>=0:zL(e,t,e.prev)<0||zL(e,e.next,t)<0}function WL(e,t){var r=new KL(e.i,e.x,e.y),i=new KL(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 ZL(e,t,r,i){var n=new KL(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 qL(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 KL(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 QL=0;function JL(e,t,r,i){r=r||2,QL=i||0;var n,o,a,s,u,c,l,f=t&&t.length,h=f?t[0]*r:e.length,p=IL(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=IL(e,t[n]*i,n<o-1?t[n+1]*i:e.length,i,!1))===a.next&&(a.steiner=!0),s.push(UL(a));for(s.sort(FL),n=0;n<s.length;n++)NL(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 $L(p,d,r,n,o,l),d}function $L(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=VL(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?wL(e,i,n,o):ML(e))t.push(s.i/r+QL),t.push(e.i/r+QL),t.push(u.i/r+QL),qL(e),e=u.next,c=u.next;else if((e=u)===c){a?1===a?$L(e=eI(PL(e),t,r),t,r,i,n,o,2):2===a&&tI(e,t,r,i,n,o):$L(PL(e),t,r,i,n,o,1);break}}}function eI(e,t,r){var i=e;do{var n=i.prev,o=i.next.next;!GL(n,o)&&jL(n,i,i.next,o)&&YL(n,o)&&YL(o,n)&&(t.push(n.i/r+QL),t.push(i.i/r+QL),t.push(o.i/r+QL),qL(i),qL(i.next),i=e=o),i=i.next}while(i!==e);return PL(i)}function tI(e,t,r,i,n,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&kL(a,s)){var u=WL(a,s);return a=PL(a,a.next),u=PL(u,u.next),$L(a,t,r,i,n,o),void $L(u,t,r,i,n,o)}s=s.next}a=a.next}while(a!==e)}var rI=2;function iI(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+=(x=n[s]).length-1}var u,c=new Float32Array(a*oS),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],T=0===u?0:-Math.PI/2;for(s=0;s<n.length;s++)for(var x=n[s],E=o[s],A=o[s+1]||o[0],S=x,b=[0,0],_=0;_<S.length-1;_++){aI(b,S[_],E,A,E[4],E[5],A[2],A[3]),C(b[0],b[1])}var R=JL(Array.from(c),null,oS,f);return{aPoint:c,index:new Uint16Array(R)};function C(e,t){c[p++]=e/2,c[p++]=t/2,h?(g[0]=e,g[1]=t,oI(g,g,T),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+=rI}}function nI(e,t){for(var r=[],i=function(e){var t=[];return e.gs?e.gs.forEach((function(e){t.push({p:[ib.SHAPE_POINTS,e.p],s:[ib.SHAPE_SPLITS,e.s]})})):e.g?t.push({p:[ib.SHAPE_POINTS,e.g.p],s:[ib.SHAPE_SPLITS,e.g.s]}):t.push(e),t}(e),n=0,o=0,a=0,s=0;s<i.length;s++){n+=(h=iI(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 oI(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 aI(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 sI=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 D_?i:Z_(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}(),uI=[0,0,0],cI=[0,0,0],lI=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?Z_(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,T=t.minimumVertexDistance,x=t.lifetime,E=t.matrix,A=r.gpuCapability,S=A.detail,b=A.level,_=Math.max(t.pointCountPerTrail,2),R={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},C=S.maxVertexTextures>0,O=(null!==(i=r.renderer)&&void 0!==i?i:{}).env,L={},I=[["ENABLE_VERTEX_TEXTURE",C],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",O===sS]],P=a>64,M=0;n&&(I.push(["COLOR_OVER_LIFETIME",!0]),M|=1,L.uColorOverLifetime=iC.createWithData(r,qS(n))),o&&(I.push(["COLOR_OVER_TRAIL",!0]),M|=4,L.uColorOverTrail=iC.createWithData(r,qS(o))),P?(I.push(["ATTR_TRAIL_START",1]),M|=8):L.uTrailStart=new Float32Array(a),L.uOpacityOverLifetimeValue=u.toUniform(R);var w=c.toUniform(R);I.push(["VERT_CURVE_VALUE_COUNT",R.index],["VERT_MAX_KEY_FRAME_COUNT",R.max]),L.uVCurveValues=j_.getAllData(R);var F={shader:{vertex:XR(I,QC,e.ShaderType.vertex,b),fragment:XR(I,qC,e.ShaderType.fragment,b),marcos:I,glslVersion:1===b?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,shared:!0,name:"trail#".concat(l),cacheId:"-t:+".concat(M,"+").concat(R.index,"+").concat(R.max)},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},N=_*a*2,D=(_-1)*a,V=Float32Array.BYTES_PER_ELEMENT,U=12*V,B={attributes:{aColor:{size:4,stride:U,data:new Float32Array(12*N)},aSeed:{size:1,stride:U,offset:4*V,dataSource:"aColor"},aInfo:{size:3,stride:U,offset:5*V,dataSource:"aColor"},aPos:{size:4,stride:U,offset:8*V,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*D,name:"trail#".concat(l),bufferUsage:dS.DYNAMIC_DRAW};if(P)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*_,j=z*G,X=0;X<G;X++)k[j+X]=z}var H=kR(h),Y=EC.create(r,F);Y.blending=!0,Y.depthMask=f,Y.depthTest=!0,WR(Y,p),HR(Y,h);var W=this.mesh=kC.create(r,{name:"MTrail_".concat(l),material:Y,geometry:NC.create(r,B),priority:d}),Z=null!=y?y:iC.createWithData(r);Object.keys(L).map((function(e){var t=L[e];if(t instanceof iC)Y.setTexture(e,t);else if("uTrailStart"===e)Y.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]]),Y.setVector4Array(e,r)}else Y.setVector4(e,t)})),Y.setFloat("uTime",0),Y.setVector4("uWidthOverTrail",w),Y.setVector2("uTexOffset",[0,0]),Y.setVector4("uTextureMap",v),Y.setVector4("uParams",[0,_-1,0,0]),Y.setTexture("uMaskTex",Z),Y.setVector4("uColorParams",[y?1:0,+H,0,+(f&&!g)]),this.maxTrailCount=a,this.pointCountPerTrail=_,this.checkVertexDistance=T>0,this.minimumVertexDistance=Math.pow(T||.001,2),this.useAttributeTrailStart=P,this.lifetime=x,E&&(this.mesh.worldMatrix=E),this.geometry=W.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,uI);if(!(l&&this.checkVertexDistance&&n_(l,t)<this.minimumVertexDistance)){var f=e*n+s,h=dI(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],T=new Float32Array(24);if(T.set(g,0),T.set(d,4),T[7]=0,T.set(t,8),T[11]=.5*m,T.set(g,12),T.set(d,16),T[19]=1,T.set(t,20),T[23]=-.5*m,o.setAttributeSubData("aColor",24*f,T),u>=0){var x=this.getTrailPosition(e,c,cI),E=new Float32Array(dI(x,l,t)),A=6*(e*n+u);o.setAttributeSubData("aDir",A,E),o.setAttributeSubData("aDir",A+3,E);var S=e*n*2,b=new Uint16Array([2*u+S,2*u+1+S,2*s+S,2*s+S,2*u+1+S,2*s+1+S]),_=6*(e*a+(i-1)%a);o.setIndexSubData(_,b)}i=++this.trailCursors[e];var R=this.mesh.material,C=R.getVector4("uParams"),O=d[2];if(this.useAttributeTrailStart){for(var L=2*n,I=new Float32Array(L),P=0;P<L;P++)I[P]=O;o.setAttributeSubData("aTrailStart",e*I.length,I)}else{var M=R.getFloats("uTrailStart");null!=M&&(M[e]=O,R.setFloats("uTrailStart",M))}C&&(C[1]=Math.max(C[1],i-1)-Math.max(0,i-n),R.setVector4("uParams",C))}},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}(),fI=[0,0,0],hI=[0,0,0],pI=[0,0,0];function dI(e,t,r){var i=fI;return e||r?(e?r?(t_(hI,i_(hI,t,e)),t_(pI,i_(hI,r,t)),Wb(i,hI,pI)):i_(i,t,e):i_(i,r,t),t_(i,i)):[0,0,0]}var mI=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,T=r.duration||1,x=y.gravityOverLifetime,E=Qb(y.gravity),A=e.textureSheetAnimation,S=A?{animationDelay:Z_(A.animationDelay||0),animationDuration:Z_(A.animationDuration||1),cycles:Z_(A.cycles||1),animate:A.animate,col:A.col,row:A.row,total:A.total||A.col*A.row}:void 0,b=Ib(),_=!!(g&&g.turbulenceX||g.turbulenceY||g.turbulenceZ);_&&(h=[Z_(null!==(i=g.turbulenceX)&&void 0!==i?i:0),Z_(null!==(n=g.turbulenceY)&&void 0!==n?n:0),Z_(null!==(o=g.turbulenceZ)&&void 0!==o?o:0)]),this.name=f,this.shape=LL(g),this.emission={rateOverTime:Z_(e.emission.rateOverTime),burstOffsets:bI(null!==(a=e.emission.burstOffsets)&&void 0!==a?a:[]),bursts:(e.emission.bursts||[]).map((function(e){return new sI(e)}))},this.textureSheetAnimation=S;var R,C=e.renderer||{},O={},L=e.rotationOverLifetime;L&&(O.asRotation=!!L.asRotation,O.z=L.z?Z_(L.z):Z_(0),L.separateAxes&&(O.x=L.x&&Z_(L.x),O.y=L.y&&Z_(L.y))),y.forceTarget&&(R={target:y.target||[0,0,0],curve:Z_(y.forceCurve||[ib.LINE,[[0,0],[1,1]]])});var I={x:y.linearX&&Z_(y.linearX||0),y:y.linearY&&Z_(y.linearY||0),z:y.linearZ&&Z_(y.linearZ||0),asMovement:y.asMovement},P={x:y.orbitalX&&Z_(y.orbitalX),y:y.orbitalY&&Z_(y.orbitalY),z:y.orbitalZ&&Z_(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},M=e.sizeOverLifetime||{},w=e.colorOverLifetime,F=r.listIndex,N=m,D=(null==M?void 0:M.separateAxes)?{separateAxes:!0,x:Z_(M.x),y:Z_(M.y)}:{separateAxes:!1,x:Z_(("size"in M?M.size:M.x)||1)},V=Sb(C.anchor,C.particleOrigin);this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:Z_(v.startLifetime),startDelay:Z_(v.startDelay||0),startSpeed:Z_(y.startSpeed||0),startColor:Z_(v.startColor),endBehavior:l,duration:T,looping:l===ob.loop,maxCount:null!==(s=v.maxCount)&&void 0!==s?s:0,gravityModifier:Z_(x||0).scaleXCoord(T),gravity:E,start3DSize:!!v.start3DSize,startTurbulence:_,turbulence:h,speedOverLifetime:y.speedOverLifetime&&Z_(y.speedOverLifetime),linearVelOverLifetime:I,orbitalVelOverLifetime:P,forceTarget:R},v.startRotationZ&&(this.options.startRotation=Z_(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=Z_(v.startRotationX||0),this.options.startRotationY=Z_(v.startRotationY||0),this.options.startRotationZ=Z_(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=Z_(v.startSizeX),this.options.startSizeY=Z_(v.startSizeY)):(this.options.startSize=Z_(v.startSize),this.options.sizeAspect=Z_(v.sizeAspect||1));var U={listIndex:F,meshSlots:v.meshSlots,name:f,matrix:b,filter:e.filter,shaderCachePrefix:N,renderMode:C.renderMode||OS.BILLBOARD,side:C.side||ES.DOUBLE,gravity:E,duration:r.duration,blending:C.blending||xS.ALPHA,rotationOverLifetime:O,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:S,occlusion:!!C.occlusion,transparentOcclusion:!!C.transparentOcclusion,maxCount:v.maxCount,mask:C.mask,maskMode:null!==(u=C.maskMode)&&void 0!==u?u:AS.NONE,forceTarget:R,diffuse:C.texture,sizeOverLifetime:D,anchor:V};if(w){var B=w.color,k=w.opacity;U.colorOverLifetime={},k&&(U.colorOverLifetime.opacity=Z_(w.opacity)),B&&(B[0]===ib.GRADIENT_COLOR?U.colorOverLifetime.color=w.color[1]:B[0]===ib.RGBA_COLOR?U.colorOverLifetime.color=iC.createWithData(p,{data:new Uint8Array(B[1]),width:1,height:1}):B instanceof iC&&(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 H=z?S.row:S.col,Y=z?S.col:S.row,W=S.total||H*Y,Z=0,q=0;q<H;q++)for(var K=0;K<Y&&Z<W;K++,Z++)G.push([q*j[2]/H+j[0],K*j[3]/Y+j[1],j[2]/H,j[3]/Y]);else G.push(j);U.textureFlip=z,this.uvs=G,this.particleMesh=new sL(U,{composition:c});var Q=e.trails;if(Q){this.trails={lifetime:Z_(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:b,minimumVertexDistance:Q.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(Q.maxPointPerTrail)||32,blending:Q.blending,texture:Q.texture,opacityOverLifetime:Z_(Q.opacityOverLifetime||1),widthOverTrail:Z_(Q.widthOverTrail||1),order:F+(Q.orderOffset||0),shaderCachePrefix:N,lifetime:this.trails.lifetime,occlusion:!!Q.occlusion,transparentOcclusion:!!Q.transparentOcclusion,textureMap:Q.textureMap,mask:C.mask,maskMode:C.maskMode};Q.colorOverLifetime&&Q.colorOverLifetime[0]===ib.GRADIENT_COLOR&&(J.colorOverLifetime=Q.colorOverLifetime[1]),Q.colorOverTrail&&Q.colorOverTrail[0]===ib.GRADIENT_COLOR&&(J.colorOverTrail=Q.colorOverTrail[1]),this.trailMesh=new lI(J,p)}this.transform=r.transform;var $,ee=nS([],iS(this.transform.position),!1),te=nS([],iS(this.transform.rotation),!1),re=e.emitterTransform&&e.emitterTransform.path;re&&(re[0]===ib.CONSTANT_VEC3?Wb(ee,ee,re[1]):$=Z_(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=nS([],iS(r.position),!1);if(i){var o=this.options.duration;Wb(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=rS(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=rS(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 pL((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=iS(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),T=g,x=y/g,E=i,A=a.maxCount;this.updateEmitterTransform(f);for(var S=function(){var e=c.first;return r.emissionStopped||c.length===A&&e&&e.content[0]-s>f},b=0;b<T&&b<A&&!S();b++){(M=this.createPoint(v)).delay+=E+b*x,this.addParticle(M,A),this.lastEmitTime=f}for(var _=u.bursts,R=(null==_?void 0:_.length)-1,C=0;R>=0&&C<A&&!S();R--){var O=_[R],L=!O.disabled&&O.getGeneratorOptions(f,v);if(L){var I=u.burstOffsets[R],P=I&&I[L.cycleIndex]||[0,0,0];O.once&&this.removeBurst(R);for(b=0;b<L.count&&C<A&&!S();b++){var M;(M=this.initPoint(this.shape.generate({total:L.total,index:L.index,burstIndex:b,burstCount:L.count}))).delay+=E,C++,(t=M.transform).translate.apply(t,nS([],iS(P),!1)),this.addParticle(M,A)}}}}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=iS(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=!!E_(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){Wb(a,a,this.parentTransform.position);var f=this.trailMesh.getPointStartPos(e);f&&i_(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=F_([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=s_([],e.position,a),u=new gR({position:s,valid:!0}),c=e.direction;if(c=t_(vI,u_(vI,c,a)),r.startTurbulence&&r.turbulence){for(var l=0;l<3;l++)EI[l]=r.turbulence[l].getValue(i);var f=f_(SI,EI);c=t_(vI,Jb(c,c,f))}var h,p=TI,d=xI;n.alignSpeedDirection?($b(d,c,3),this.upDirectionWorld||(this.upDirectionWorld=u_([],null!==(t=n.upDirection)&&void 0!==t?t:[0,0,1],a)),p=t_(p,a_(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=AI)[0]=m.animationDelay.getValue(i),h[1]=m.animationDuration.getValue(i),h[2]=m.cycles.getValue(i));var v=gI;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,nS([],iS(v),!1));var y=r.startColor.getValue(i);3===y.length&&(y[3]=1);var g=yI;if(r.start3DSize)g[0]=r.startSizeX.getValue(i),g[1]=r.startSizeY.getValue(i);else{var T=r.startSize.getValue(i),x=r.sizeAspect.getValue(i);g[0]=T,g[1]=0===x?0:T/x}var E=[0,0,0];return o_(E,c,o),r.particleFollowParent||(this.transform.assignWorldTRS([],[],EI),e_(g,g,EI)),u.setScale(g[0],g[1],1),{size:g,vel:E,color:y,delay:r.startDelay.getValue(i),lifetime:r.startLifetime.getValue(i),uv:_I(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}(),vI=[0,0,0],yI=[0,0],gI=[0,0,0],TI=[0,0,0],xI=[0,0,0],EI=[0,0,0],AI=[0,0,0],SI=[];function bI(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 _I(e,t){var r=Math.floor(Math.random()*e.length),i=e[r];return t||e.splice(r,1),i}var RI=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return JA(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return CS.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 eb(this.particle),new mI(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)===sb.removeParticle,ray:e})}}},r}(TR),CI=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.meshes=[],e}return JA(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:[ib.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===CS.particle&&(h.push(e),function(e){if(e.type===CS.particle){var t=e.content;t.rotationOverLifetime||(t.rotationOverLifetime={});var r=t.rotationOverLifetime;r.z||(r.z=[ib.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=[ib.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,DS(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:[ib.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=lL(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 T=function(e,t,r,i,n){void 0===i&&(i="");var o=0,a=cC(aC)?1:0,s=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",a],["ENV_EDITOR",i===sS]],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),eR(u,e.opacityOverLifetime),eR(u,e.widthOverTrail),s.push(["VERT_CURVE_VALUE_COUNT",u.index],["VERT_MAX_KEY_FRAME_COUNT",u.max]),{vertex:QC,fragment:qC,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);T.vertex=XR(null!==(r=T.marcos)&&void 0!==r?r:[],T.vertex,e.ShaderType.vertex,u),T.fragment=XR(null!==(i=T.marcos)&&void 0!==i?i:[],T.fragment,e.ShaderType.fragment,u),T.glslVersion=2===u?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1,l.addShader(T)}})),p.forEach((function(t){var r,i;2===u?(fL(t,m,d),t.glslVersion=e.GLSLVersion.GLSL3):t.glslVersion=e.GLSLVersion.GLSL1,t.vertex=XR(null!==(r=t.marcos)&&void 0!==r?r:[],t.vertex,e.ShaderType.vertex,u),t.fragment=XR(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 RI&&this.add(t.content)},r.prototype.onCompositionItemRemoved=function(e,t){t instanceof RI&&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 DS(t.meshes,e)}))},r.prototype.remove=function(e,t){var r=this;e.meshes.forEach((function(e){VS(r.meshes,e),t.removeMeshFromDefaultRenderPass(e)}))},r}(CR);var OI,LI=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t}(CR),II=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._v_priority=1,t.childrenVisible=!0,t}return JA(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return CS.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 eL(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}(TR),PI=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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=iS(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=[],T=[],x=2,E=2;1===i.length&&(x=1,E=1);for(var A=0;A<x;A++)for(var S=0;S<E;S++){var b=4*(2*S+A),_=o?[0,0,1,1,i[0][4]]:i[2*S+A],R=_[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],C=((A+A+1)/x-1)/2,O=((S+S+1)/E-1)/2,L=_[0],I=_[1],P=_[4]?_[3]:_[2],M=_[4]?_[2]:_[3],w=[y[0]/x+C,y[1]/E+O,y[2]/x+C,y[3]/E+O,y[4]/x+C,y[5]/E+O,y[6]/x+C,y[7]/E+O];g.push(w[0]*u,w[1]*c,R[0]*P+L,R[1]*M+I,t,0,w[2]*u,w[3]*c,R[2]*P+L,R[3]*M+I,t,0,w[4]*u,w[5]*c,R[4]*P+L,R[5]*M+I,t,0,w[6]*u,w[7]*c,R[6]*P+L,R[7]*M+I,t,0),this.lineMode?T.push(b,1+b,1+b,3+b,3+b,2+b,2+b,b):T.push(b,1+b,2+b,2+b,1+b,3+b)}return{index:T,aPoint:g}},t}(kO),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!==yb.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},wI=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 cC(sC)?(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}(),FI=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];e.QTextWrapMode=void 0,(OI=e.QTextWrapMode||(e.QTextWrapMode={}))[OI.Default=0]="Default",OI[OI.Clip=1]="Clip",OI[OI.Ellipsis=2]="Ellipsis";var NI=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=wI.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)||FI.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 $A({},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=$A({},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=$A({},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 VI(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 UI(e,t,r,i,n){return eS(this,void 0,void 0,(function(){var o,a,s,u,c,l,f,h,p,d;return tS(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,QR(u).then(c)]:[2,BI(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)?VI(e,{responseType:"blob"}).then(kI,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,QR(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,QR("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 BI(e){return uR(e)?QR(e):Promise.resolve(e)}function kI(e){return new Promise((function(t,r){var i=new FileReader;i.readAsDataURL(e),i.onload=function(){t(i.result)},i.onerror=r}))}var zI=["serif","sans-serif","monospace","courier"],GI=800,jI=600,XI=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(cC(sC))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?DS(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 WI(t,r,i,n,o){var a;return eS(this,void 0,void 0,(function(){var s,u,c,l,f,h,p,d,m,v,y;return tS(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?uR(p)?[4,QR(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:yb.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 NI(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===pb.display?p.wrap=e.QTextWrapMode.Default:a.of===pb.clip?p.wrap=e.QTextWrapMode.Clip:a.of===pb.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===mb.left?p.textAlign="left":a.a===mb.middle?p.textAlign="center":a.a===mb.right&&(p.textAlign="right"),f.style===yb.normal?p.fontStyle="normal":f.style===yb.italic?p.fontStyle="italic":f.style===yb.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,$A($A({},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 ZI(e){return eS(this,void 0,void 0,(function(){var t,r,i;return tS(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 tS(this,(function(s){switch(s.label){case 0:return r=t[e].family,i=t[e].url,n=!1,zI.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 qI(e,t,r,i,n){return eS(this,void 0,void 0,(function(){var o,a,s;return tS(this,(function(u){switch(u.label){case 0:return o=$A($A({},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=XI.get(r.canvas))){var a=new DI(r.canvas,e,t,n,n,o);XI.set(r.canvas,a),i=a}}else{var s=HI.getCanvas();i=new DI(s,GI,jI,n,n,o)}return i}(GI,GI,o),void 0===t?[3,2]:[4,ZI(t)];case 1:u.sent(),u.label=2;case 2:return a.clearText(),"string"!=typeof e?[3,5]:[4,QR(e)];case 3:return s=u.sent(),[4,WI(a,s,t,r,o)];case 4:return u.sent(),[2,a.renderCanvas];case 5:return[4,WI(a,e,t,r,o)];case 6:return u.sent(),[2,a.renderCanvas]}}))}))}function KI(e,t,r,i,n){return eS(this,void 0,void 0,(function(){return tS(this,(function(o){return 2===t.v?[2,qI(e,t,r,{templateScale:null==i?void 0:i.templateScale,toData:!0},n)]:[2,UI(e,t,r,i,n)]}))}))}var QI=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?pb.display:a,u=e.textBaseline,c=void 0===u?db.top:u,l=e.textAlign,f=void 0===l?mb.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,T=void 0===g?y:g,x=y+d;this.autoWidth=v,this.maxTextWidth=h.length*x,this.width=o,this.height=i,this.letterSpace=d,this.overFlow=s,this.textBaseline=c,this.textAlign=f,this.lineHeight=T}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}(),JI=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 QI(o,a),n.text=o.text,n.mesh=new PI(n.engine,n.renderInfo,i.composition),n.mesh.setItems([n]),n.updateTexture(),n}return JA(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",iC.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:!0,magFilter:dS.LINEAR,minFilter:dS.LINEAR,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE})),this.isDirty=!1}},t.prototype.getFontDesc=function(){var e=this.textStyle,t="".concat((e.fontSize*e.fontScale).toString(),"px ");return zI.includes(e.fontFamily)?t+=e.fontFamily:t+='"'.concat(e.fontFamily,'"'),e.textWeight!==vb.normal&&(t="".concat(e.textWeight," ").concat(t)),e.fontStyle!==yb.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}(iL),$I=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return JA(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return CS.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=C_([0,0,0],i[0]/2,i[1]/2);return n.forEach((function(e){e.forEach((function(e){s_(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===ES.FRONT}}},r.prototype.getRenderData=function(){return this.content.getRenderData(this.content.time)},r.prototype.doCreateContent=function(e){var t=e.getRendererOptions().emptyTexture;return new JI(this.textContext,{emptyTexture:t},this)},r.prototype.createWireframeMesh=function(e,t){var r=new PI(this.composition.getEngine(),$A({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}(TR),eP=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 JA(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 $I&&t.content&&(this.addItems.includes(t)||(DS(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 $I&&r&&(DS(this.removeItems,r),this.addItems.includes(r)&&(null===(i=r.content)||void 0===i?void 0:i.mesh)&&(VS(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),VS(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}(CR);function tP(e,t,r){return function(e,t,r){var i=$A($A({},t.material.props),{shader:r}),n=t.material.clone(i);return n.blending=!1,n.depthTest=!1,n.culling=!1,kC.create(e,{geometry:t.geometry,material:n})}(e,t,jO(e.gpuCapability.level,{fragment:r.fragment},{ignoreBlend:!0}))}var rP=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 JA(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=iC.create(t.engine,{sourceType:e.TextureSourceType.framebuffer,minFilter:dS.LINEAR,magFilter:dS.LINEAR,name:this.type,internalFormat:dS.RGBA,format:dS.RGBA,type:dS.UNSIGNED_BYTE});this.mframeBuffer=PO.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",xO(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",xO(this.prePassTexture));var t=[this.meshes[0],tP(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}(HC),iP=function(e){function t(t,r,i){var n=e.call(this,t,r)||this;return i&&(n.preDefaultPassAttachment=i),n}return JA(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],this.preDefaultPassAttachment||(this.preDefaultPassAttachment=new jC(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",xO(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",xO(this.prePassTexture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(HC);function nP(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(oP(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 oP(e,t){return Math.exp(-e*e/(2*t*t))/Math.sqrt(2*Math.PI)/t}var aP=function(e){function t(t,r){return e.call(this,t,r)||this}return JA(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",xO(this.preDefaultPassAttachment.texture));var t=[tP(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},t}(HC),sP=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 JA(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",xO(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",xO(this.uBlurSource));var t=[tP(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},t}(HC),uP=function(e){function t(t,r,i){var n=e.call(this,t,r)||this;return n.preDefaultPassAttachment=i,n}return JA(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",xO(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",xO(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",xO(this.preDefaultPassAttachment.texture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(HC),cP=function(e){function t(t,r){return e.call(this,t,r)||this}return JA(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",xO(this.prePassTexture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.prePassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",xO(this.prePassTexture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(HC);function lP(e,t,r){for(var i=Z_(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 iC.createWithData(e,{width:n,height:1,data:o},{format:dS.LUMINANCE})}var fP=[1,1,1],hP=function(){function e(e,t){void 0===t&&(t={}),this.name=e,this.viewMatrix=Ib(),this.projectionMatrix=Ib(),this.viewProjectionMatrix=Ib(),this.inverseViewMatrix=Ib(),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?tb.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 nS([],iS(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 nS([],iS(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(),hR(this.viewMatrix)},e.prototype.getInverseViewMatrix=function(){return this.updateMatrix(),hR(this.inverseViewMatrix)},e.prototype.getProjectionMatrix=function(){return this.updateMatrix(),hR(this.projectionMatrix)},e.prototype.getInverseProjectionMatrix=function(){return this.updateMatrix(),hR(this.inverseProjectionMatrix)},e.prototype.getViewProjectionMatrix=function(){return this.updateMatrix(),hR(this.viewProjectionMatrix)},e.prototype.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=Fb([],this.viewProjectionMatrix)),hR(this.inverseViewProjectionMatrix)},e.prototype.getModelViewProjection=function(e,t){return Nb(e,this.viewProjectionMatrix,t)},e.prototype.getInverseVPRatio=function(e){var t=[0,0,0],r=s_(t,[0,0,e],this.getViewProjectionMatrix())[2];return s_(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&&y_(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;Db(this.projectionMatrix,t,r,i,n,o===tb.portrait),wb(this.inverseViewMatrix,this.getQuat(),a,fP),Fb(this.viewMatrix,this.inverseViewMatrix),Nb(this.viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.prototype.setRotationByQuat=function(e){this.options.rotation=gR.getRotation([],e)},e}();var pP,dP,mP,vP,yP,gP,TP,xP,EP,AP,SP,bP={lum:[function(t,r){var i=r.renderer,n=2===i.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,o=new iP(i,{name:"lumCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:n,magFilter:n}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:AC,uniformValues:{uFilterParams:[1,0,0,0]},materialStates:{blending:!1,depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}]},prePasses:[o],renderPassDelegate:{}}},function(){return[{fragment:AC}]}],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?dS.LINEAR:dS.NEAREST,f=new iP(c,{name:"alphaFrameCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{particle:{fragment:JC,uniformValues:{uTexRange:u}},mesh:{fragment:JC,shaderCacheId:"alpha-frame",materialStates:{blending:!1},uniformValues:{uTexRange:u}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[f]}}},function(){return[{fragment:JC,shaderCacheId:"alpha-frame"},{fragment:JC,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=[ib.CONSTANT_VEC3,n]);var a=Z_(o),s=new hP("camera_move"),u=[0,0,0],c=r.renderer,l=2===c.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,f=new iP(c,{name:"cameraCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{vertex:eO,fragment:AC,shaderCacheId:"camera-move",materialStates:{blending:!1,depthTest:!1,culling:!1},variables:{uMoveCameraViewPro:function(e){s.copy(r.camera);var t=a.getValue(e);return Wb(u,r.camera.position,[-t[0],-t[1],-t[2]]),s.position=u,s.getViewProjectionMatrix()}}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[f]}}},function(){return[{vertex:eO,fragment:AC,shaderCacheId:"camera-move"}]}],alphaMask:[function(t,r){var i=t,n=i.xOpacity,o=i.yOpacity,a=r.renderer.engine,s=r.renderer,u=lP(a,n),c=lP(a,o,!0),l=2===a.gpuCapability.level?dS.LINEAR:dS.NEAREST,f=new iP(s,{name:"alphaMaskCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:$C,shaderCacheId:"alpha-mask",materialStates:{blending:!1,depthTest:!1,culling:!1},uniformValues:{uAlphaXSample:u,uAlphaYSample:c}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[f]}}},function(){return[{fragment:$C,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=t_(s),h=[o[0],o[1],f[0],f[1]],p=Z_(u),d=Z_(c),m=Z_(l),v=2*Math.PI,y=r.renderer,g=2===y.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,T=new iP(y,{name:"distortionCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:g,magFilter:g}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{particle:{fragment:rO,vertex:iO,uniforms:{uPeriodValue:p,uMovementValue:d,uStrengthValue:m},uniformValues:{uWaveParams:h}},mesh:{shaderCacheId:"distortion",fragment:rO,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:dS.RGBA}}],prePasses:[T]}}},function(e){var t=e,r=t.period,i=t.waveMovement,n=t.strength;return[{fragment:rO,shaderCacheId:"distortion"},{fragment:rO,vertex:iO,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=nP({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=Ab(v),y=Ab(y));var g=[0,0,v,y],T=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:dS.RGBA,magFilter:dS.LINEAR,minFilter:dS.LINEAR,name:"gaussianV",width:v,height:y}),x=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:dS.RGBA,magFilter:dS.LINEAR,minFilter:dS.LINEAR,name:"gaussianH",width:v,height:y}),E=Z_(s),A=Z_(c),S=new jC(d),b=new aP(m,{name:"threshold",attachments:[{texture:T}],viewport:g,clearAction:{colorAction:e.TextureLoadAction.clear}});b.pluginSystem=r.pluginSystem,b.fragShader=oO,b.preDefaultPassAttachment=S;var _=new sP(m,"H",[p.step,0],r.pluginSystem,p.shader,{name:"gaussianH",viewport:g,attachments:[{texture:x}],clearAction:{colorAction:e.TextureLoadAction.clear}},T);_.preDefaultPassAttachment=S;var R=new sP(m,"V",[0,p.step],r.pluginSystem,p.shader,{name:"gaussianV",viewport:g,attachments:[{texture:T}]},x);R.preDefaultPassAttachment=S;var C=2===h?dS.LINEAR:dS.NEAREST,O=new uP(m,{name:"bloomCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:C,magFilter:C}}],clearAction:{colorAction:e.TextureLoadAction.clear}},S);return{mesh:{name:"bloom-".concat(p.step),fragment:nO,shaderCacheId:"bloom-".concat(p.step),variables:{uBloomParams:function(e){return[E.getValue(e),A.getValue(e),0,1]}},uniformValues:{uColorThreshold:[f[0]/255||1.1,f[1]/255||1.1,f[2]/255||1.1,0],uBloomBlur:T},materialStates:{blending:!1,culling:!1}},onItemRemoved:function(){T.dispose(),x.dispose()},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[b,_,R,O]}}},function(e){var t=e.radius,r=nP({radius:void 0===t?30:t});return[{fragment:nO,shaderCacheId:"bloom-".concat(r.step)},{fragment:oO,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=nP({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=Ab(h),f=Ab(f));var p=[0,0,f,h],d=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:dS.LINEAR,magFilter:dS.LINEAR,name:"gaussianV",width:f,height:h}),m=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:dS.LINEAR,magFilter:dS.LINEAR,name:"gaussianH",width:f,height:h}),v=new jC(o,{}),y=new rP(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 rP(a,"V",[c,0],r.pluginSystem,l,{name:"gaussianV",viewport:p,attachments:[{texture:d}],clearAction:{colorAction:e.TextureLoadAction.clear}});g.preDefaultPassAttachment=v;var T=2===n?dS.LINEAR:dS.NEAREST,x=new iP(a,{name:"gaussianCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:T,magFilter:T}}],clearAction:{colorAction:e.TextureLoadAction.clear}},v);return x.preDefaultPassAttachment=v,{mesh:{fragment:AC,shaderCacheId:"gaussian-".concat(c),uniformValues:{uTexSize:[f,h]},materialStates:{blending:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[y,g,x]}}},function(e){var t=nP({radius:e.radius});return[{fragment:AC,shaderCacheId:"gaussian-".concat(t.step)},{fragment:t.shader,ignoreBlend:!0}]}],delay:[function(t,r){var i=r.renderer,n=iC.create(i.engine,{sourceType:e.TextureSourceType.framebuffer}),o=[0,.96,0,0],a=2===i.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,s=new cP(i,{name:"delayCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:a,magFilter:a}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:tO,shaderCacheId:"delay",uniformValues:{uLastSource:n},variables:{uParams:function(){return o}},materialStates:{blending:!0,blendFunction:[dS.SRC_ALPHA,dS.ONE_MINUS_SRC_ALPHA,dS.SRC_ALPHA,dS.ONE_MINUS_SRC_ALPHA],depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:dS.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:tO,shaderCacheId:"delay"}]}]};
8
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ge={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math===Math&&e},i=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||t||Function("return this")(),n={},o=function(e){try{return!!e()}catch(e){return!0}},a=!o((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),s=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),u=s,c=Function.prototype.call,l=u?c.bind(c):function(){return c.apply(c,arguments)},f={},h={}.propertyIsEnumerable,p=Object.getOwnPropertyDescriptor,d=p&&!h.call({1:2},1);f.f=d?function(e){var t=p(this,e);return!!t&&t.enumerable}:h;var m,v,y=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},g=s,T=Function.prototype,x=T.call,E=g&&T.bind.bind(x,x),A=g?E:function(e){return function(){return x.apply(e,arguments)}},S=A,b=S({}.toString),_=S("".slice),R=function(e){return _(b(e),8,-1)},C=o,O=R,L=Object,I=A("".split),P=C((function(){return!L("z").propertyIsEnumerable(0)}))?function(e){return"String"===O(e)?I(e,""):L(e)}:L,M=function(e){return null==e},w=M,F=TypeError,N=function(e){if(w(e))throw F("Can't call method on "+e);return e},D=P,V=N,U=function(e){return D(V(e))},B="object"==typeof document&&document.all,k={all:B,IS_HTMLDDA:void 0===B&&void 0!==B},z=k.all,G=k.IS_HTMLDDA?function(e){return"function"==typeof e||e===z}:function(e){return"function"==typeof e},j=G,X=k.all,H=k.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:j(e)||e===X}:function(e){return"object"==typeof e?null!==e:j(e)},Y=i,W=G,Z=function(e,t){return arguments.length<2?(r=Y[e],W(r)?r:void 0):Y[e]&&Y[e][t];var r},q=A({}.isPrototypeOf),K="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Q=i,J=K,$=Q.process,ee=Q.Deno,te=$&&$.versions||ee&&ee.version,re=te&&te.v8;re&&(v=(m=re.split("."))[0]>0&&m[0]<4?1:+(m[0]+m[1])),!v&&J&&(!(m=J.match(/Edge\/(\d+)/))||m[1]>=74)&&(m=J.match(/Chrome\/(\d+)/))&&(v=+m[1]);var ie=v,ne=ie,oe=o,ae=i.String,se=!!Object.getOwnPropertySymbols&&!oe((function(){var e=Symbol("symbol detection");return!ae(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ne&&ne<41})),ue=se&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ce=Z,le=G,fe=q,he=Object,pe=ue?function(e){return"symbol"==typeof e}:function(e){var t=ce("Symbol");return le(t)&&fe(t.prototype,he(e))},de=String,me=function(e){try{return de(e)}catch(e){return"Object"}},ve=G,ye=me,ge=TypeError,Te=function(e){if(ve(e))return e;throw ge(ye(e)+" is not a function")},xe=Te,Ee=M,Ae=function(e,t){var r=e[t];return Ee(r)?void 0:xe(r)},Se=l,be=G,_e=H,Re=TypeError,Ce={exports:{}},Oe=i,Le=Object.defineProperty,Ie=function(e,t){try{Le(Oe,e,{value:t,configurable:!0,writable:!0})}catch(r){Oe[e]=t}return t},Pe=Ie,Me="__core-js_shared__",we=i[Me]||Pe(Me,{}),Fe=we;(Ce.exports=function(e,t){return Fe[e]||(Fe[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 Ne=N,De=Object,Ve=function(e){return De(Ne(e))},Ue=Ve,Be=A({}.hasOwnProperty),ke=Object.hasOwn||function(e,t){return Be(Ue(e),t)},ze=A,Ge=0,je=Math.random(),Xe=ze(1..toString),He=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Xe(++Ge+je,36)},Ye=i,We=Ce.exports,Ze=ke,qe=He,Ke=se,Qe=ue,Je=Ye.Symbol,$e=We("wks"),et=Qe?Je.for||Je:Je&&Je.withoutSetter||qe,tt=function(e){return Ze($e,e)||($e[e]=Ke&&Ze(Je,e)?Je[e]:et("Symbol."+e)),$e[e]},rt=l,it=H,nt=pe,ot=Ae,at=function(e,t){var r,i;if("string"===t&&be(r=e.toString)&&!_e(i=Se(r,e)))return i;if(be(r=e.valueOf)&&!_e(i=Se(r,e)))return i;if("string"!==t&&be(r=e.toString)&&!_e(i=Se(r,e)))return i;throw Re("Can't convert object to primitive value")},st=TypeError,ut=tt("toPrimitive"),ct=function(e,t){if(!it(e)||nt(e))return e;var r,i=ot(e,ut);if(i){if(void 0===t&&(t="default"),r=rt(i,e,t),!it(r)||nt(r))return r;throw st("Can't convert object to primitive value")}return void 0===t&&(t="number"),at(e,t)},lt=ct,ft=pe,ht=function(e){var t=lt(e,"string");return ft(t)?t:t+""},pt=H,dt=i.document,mt=pt(dt)&&pt(dt.createElement),vt=function(e){return mt?dt.createElement(e):{}},yt=vt,gt=!a&&!o((function(){return 7!==Object.defineProperty(yt("div"),"a",{get:function(){return 7}}).a})),Tt=a,xt=l,Et=f,At=y,St=U,bt=ht,_t=ke,Rt=gt,Ct=Object.getOwnPropertyDescriptor;n.f=Tt?Ct:function(e,t){if(e=St(e),t=bt(t),Rt)try{return Ct(e,t)}catch(e){}if(_t(e,t))return At(!xt(Et.f,e,t),e[t])};var Ot={},Lt=a&&o((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),It=H,Pt=String,Mt=TypeError,wt=function(e){if(It(e))return e;throw Mt(Pt(e)+" is not an object")},Ft=a,Nt=gt,Dt=Lt,Vt=wt,Ut=ht,Bt=TypeError,kt=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,Gt="enumerable",jt="configurable",Xt="writable";Ot.f=Ft?Dt?function(e,t,r){if(Vt(e),t=Ut(t),Vt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Xt in r&&!r[Xt]){var i=zt(e,t);i&&i[Xt]&&(e[t]=r.value,r={configurable:jt in r?r[jt]:i[jt],enumerable:Gt in r?r[Gt]:i[Gt],writable:!1})}return kt(e,t,r)}:kt:function(e,t,r){if(Vt(e),t=Ut(t),Vt(r),Nt)try{return kt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Bt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ht=Ot,Yt=y,Wt=a?function(e,t,r){return Ht.f(e,t,Yt(1,r))}:function(e,t,r){return e[t]=r,e},Zt={exports:{}},qt=a,Kt=ke,Qt=Function.prototype,Jt=qt&&Object.getOwnPropertyDescriptor,$t=Kt(Qt,"name"),er={EXISTS:$t,PROPER:$t&&"something"===function(){}.name,CONFIGURABLE:$t&&(!qt||qt&&Jt(Qt,"name").configurable)},tr=G,rr=we,ir=A(Function.toString);tr(rr.inspectSource)||(rr.inspectSource=function(e){return ir(e)});var nr,or,ar,sr=rr.inspectSource,ur=G,cr=i.WeakMap,lr=ur(cr)&&/native code/.test(String(cr)),fr=Ce.exports,hr=He,pr=fr("keys"),dr=function(e){return pr[e]||(pr[e]=hr(e))},mr={},vr=lr,yr=i,gr=H,Tr=Wt,xr=ke,Er=we,Ar=dr,Sr=mr,br="Object already initialized",_r=yr.TypeError,Rr=yr.WeakMap;if(vr||Er.state){var Cr=Er.state||(Er.state=new Rr);Cr.get=Cr.get,Cr.has=Cr.has,Cr.set=Cr.set,nr=function(e,t){if(Cr.has(e))throw _r(br);return t.facade=e,Cr.set(e,t),t},or=function(e){return Cr.get(e)||{}},ar=function(e){return Cr.has(e)}}else{var Or=Ar("state");Sr[Or]=!0,nr=function(e,t){if(xr(e,Or))throw _r(br);return t.facade=e,Tr(e,Or,t),t},or=function(e){return xr(e,Or)?e[Or]:{}},ar=function(e){return xr(e,Or)}}var Lr={set:nr,get:or,has:ar,enforce:function(e){return ar(e)?or(e):nr(e,{})},getterFor:function(e){return function(t){var r;if(!gr(t)||(r=or(t)).type!==e)throw _r("Incompatible receiver, "+e+" required");return r}}},Ir=A,Pr=o,Mr=G,wr=ke,Fr=a,Nr=er.CONFIGURABLE,Dr=sr,Vr=Lr.enforce,Ur=Lr.get,Br=String,kr=Object.defineProperty,zr=Ir("".slice),Gr=Ir("".replace),jr=Ir([].join),Xr=Fr&&!Pr((function(){return 8!==kr((function(){}),"length",{value:8}).length})),Hr=String(String).split("String"),Yr=Zt.exports=function(e,t,r){"Symbol("===zr(Br(t),0,7)&&(t="["+Gr(Br(t),/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!wr(e,"name")||Nr&&e.name!==t)&&(Fr?kr(e,"name",{value:t,configurable:!0}):e.name=t),Xr&&r&&wr(r,"arity")&&e.length!==r.arity&&kr(e,"length",{value:r.arity});try{r&&wr(r,"constructor")&&r.constructor?Fr&&kr(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var i=Vr(e);return wr(i,"source")||(i.source=jr(Hr,"string"==typeof t?t:"")),e};Function.prototype.toString=Yr((function(){return Mr(this)&&Ur(this).source||Dr(this)}),"toString");var Wr=G,Zr=Ot,qr=Zt.exports,Kr=Ie,Qr=function(e,t,r,i){i||(i={});var n=i.enumerable,o=void 0!==i.name?i.name:t;if(Wr(r)&&qr(r,o,i),i.global)n?e[t]=r:Kr(t,r);else{try{i.unsafe?e[t]&&(n=!0):delete e[t]}catch(e){}n?e[t]=r:Zr.f(e,t,{value:r,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return e},Jr={},$r=Math.ceil,ei=Math.floor,ti=Math.trunc||function(e){var t=+e;return(t>0?ei:$r)(t)},ri=ti,ii=function(e){var t=+e;return t!=t||0===t?0:ri(t)},ni=ii,oi=Math.max,ai=Math.min,si=function(e,t){var r=ni(e);return r<0?oi(r+t,0):ai(r,t)},ui=ii,ci=Math.min,li=function(e){return e>0?ci(ui(e),9007199254740991):0},fi=li,hi=function(e){return fi(e.length)},pi=U,di=si,mi=hi,vi=function(e){return function(t,r,i){var n,o=pi(t),a=mi(o),s=di(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}},yi={includes:vi(!0),indexOf:vi(!1)},gi=ke,Ti=U,xi=yi.indexOf,Ei=mr,Ai=A([].push),Si=function(e,t){var r,i=Ti(e),n=0,o=[];for(r in i)!gi(Ei,r)&&gi(i,r)&&Ai(o,r);for(;t.length>n;)gi(i,r=t[n++])&&(~xi(o,r)||Ai(o,r));return o},bi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],_i=Si,Ri=bi.concat("length","prototype");Jr.f=Object.getOwnPropertyNames||function(e){return _i(e,Ri)};var Ci={};Ci.f=Object.getOwnPropertySymbols;var Oi=Z,Li=Jr,Ii=Ci,Pi=wt,Mi=A([].concat),wi=Oi("Reflect","ownKeys")||function(e){var t=Li.f(Pi(e)),r=Ii.f;return r?Mi(t,r(e)):t},Fi=ke,Ni=wi,Di=n,Vi=Ot,Ui=o,Bi=G,ki=/#|\.prototype\./,zi=function(e,t){var r=ji[Gi(e)];return r===Hi||r!==Xi&&(Bi(t)?Ui(t):!!t)},Gi=zi.normalize=function(e){return String(e).replace(ki,".").toLowerCase()},ji=zi.data={},Xi=zi.NATIVE="N",Hi=zi.POLYFILL="P",Yi=zi,Wi=i,Zi=n.f,qi=Wt,Ki=Qr,Qi=Ie,Ji=function(e,t,r){for(var i=Ni(t),n=Vi.f,o=Di.f,a=0;a<i.length;a++){var s=i[a];Fi(e,s)||r&&Fi(r,s)||n(e,s,o(t,s))}},$i=Yi,en=function(e,t){var r,i,n,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?Wi:c?Wi[s]||Qi(s,{}):(Wi[s]||{}).prototype)for(i in t){if(o=t[i],n=e.dontCallGetSet?(a=Zi(r,i))&&a.value:r[i],!$i(u?i:s+(c?".":"#")+i,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;Ji(o,n)}(e.sham||n&&n.sham)&&qi(o,"sham",!0),Ki(r,i,o,e)}},tn={},rn=Si,nn=bi,on=Object.keys||function(e){return rn(e,nn)},an=a,sn=Lt,un=Ot,cn=wt,ln=U,fn=on;tn.f=an&&!sn?Object.defineProperties:function(e,t){cn(e);for(var r,i=ln(t),n=fn(t),o=n.length,a=0;o>a;)un.f(e,r=n[a++],i[r]);return e};var hn,pn=Z("document","documentElement"),dn=wt,mn=tn,vn=bi,yn=mr,gn=pn,Tn=vt,xn="prototype",En="script",An=dr("IE_PROTO"),Sn=function(){},bn=function(e){return"<"+En+">"+e+"</"+En+">"},_n=function(e){e.write(bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Rn=function(){try{hn=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Rn="undefined"!=typeof document?document.domain&&hn?_n(hn):(t=Tn("iframe"),r="java"+En+":",t.style.display="none",gn.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(bn("document.F=Object")),e.close(),e.F):_n(hn);for(var i=vn.length;i--;)delete Rn[xn][vn[i]];return Rn()};yn[An]=!0;var Cn=Object.create||function(e,t){var r;return null!==e?(Sn[xn]=dn(e),r=new Sn,Sn[xn]=null,r[An]=e):r=Rn(),void 0===t?r:mn.f(r,t)},On=tt,Ln=Cn,In=Ot.f,Pn=On("unscopables"),Mn=Array.prototype;void 0===Mn[Pn]&&In(Mn,Pn,{configurable:!0,value:Ln(null)});var wn=function(e){Mn[Pn][e]=!0},Fn=yi.includes,Nn=wn;en({target:"Array",proto:!0,forced:o((function(){return!Array(1).includes()}))},{includes:function(e){return Fn(this,e,arguments.length>1?arguments[1]:void 0)}}),Nn("includes");var Dn=i,Vn=A;(function(e,t){Vn(Dn[e].prototype[t])})("Array","includes");var Un=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Bn=ke,kn=G,zn=Ve,Gn=Un,jn=dr("IE_PROTO"),Xn=Object,Hn=Xn.prototype,Yn=Gn?Xn.getPrototypeOf:function(e){var t=zn(e);if(Bn(t,jn))return t[jn];var r=t.constructor;return kn(r)&&t instanceof r?r.prototype:t instanceof Xn?Hn:null},Wn=a,Zn=o,qn=A,Kn=Yn,Qn=on,Jn=U,$n=qn(f.f),eo=qn([].push),to=Wn&&Zn((function(){var e=Object.create(null);return e[2]=2,!$n(e,2)})),ro=function(e){return function(t){for(var r,i=Jn(t),n=Qn(i),o=to&&null===Kn(i),a=n.length,s=0,u=[];a>s;)r=n[s++],Wn&&!(o?r in i:$n(i,r))||eo(u,e?[r,i[r]]:i[r]);return u}},io={entries:ro(!0),values:ro(!1)},no=io.values;en({target:"Object",stat:!0},{values:function(e){return no(e)}});var oo=i;oo.Object.values;var ao=io.entries;en({target:"Object",stat:!0},{entries:function(e){return ao(e)}}),oo.Object.entries;var so={exports:{}},uo=tt("iterator"),co=!1;try{var lo=0,fo={next:function(){return{done:!!lo++}},return:function(){co=!0}};fo[uo]=function(){return this},Array.from(fo,(function(){throw 2}))}catch(e){}var ho=function(e,t){if(!t&&!co)return!1;var r=!1;try{var i={};i[uo]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},po="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,mo={};mo[tt("toStringTag")]="z";var vo,yo,go,To="[object z]"===String(mo),xo=To,Eo=G,Ao=R,So=tt("toStringTag"),bo=Object,_o="Arguments"===Ao(function(){return arguments}()),Ro=xo?Ao: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=bo(e),So))?r:_o?Ao(t):"Object"===(i=Ao(t))&&Eo(t.callee)?"Arguments":i},Co=Zt.exports,Oo=Ot,Lo=function(e,t,r){return r.get&&Co(r.get,t,{getter:!0}),r.set&&Co(r.set,t,{setter:!0}),Oo.f(e,t,r)},Io=A,Po=Te,Mo=G,wo=String,Fo=TypeError,No=function(e,t,r){try{return Io(Po(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},Do=wt,Vo=function(e){if("object"==typeof e||Mo(e))return e;throw Fo("Can't set "+wo(e)+" as a prototype")},Uo=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=No(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return Do(r),Vo(i),t?e(r,i):r.__proto__=i,r}}():void 0),Bo=po,ko=a,zo=i,Go=G,jo=H,Xo=ke,Ho=Ro,Yo=me,Wo=Wt,Zo=Qr,qo=Lo,Ko=q,Qo=Yn,Jo=Uo,$o=tt,ea=He,ta=Lr.enforce,ra=Lr.get,ia=zo.Int8Array,na=ia&&ia.prototype,oa=zo.Uint8ClampedArray,aa=oa&&oa.prototype,sa=ia&&Qo(ia),ua=na&&Qo(na),ca=Object.prototype,la=zo.TypeError,fa=$o("toStringTag"),ha=ea("TYPED_ARRAY_TAG"),pa="TypedArrayConstructor",da=Bo&&!!Jo&&"Opera"!==Ho(zo.opera),ma=!1,va={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},ya={BigInt64Array:8,BigUint64Array:8},ga=function(e){var t=Qo(e);if(jo(t)){var r=ra(t);return r&&Xo(r,pa)?r[pa]:ga(t)}},Ta=function(e){if(!jo(e))return!1;var t=Ho(e);return Xo(va,t)||Xo(ya,t)};for(vo in va)(go=(yo=zo[vo])&&yo.prototype)?ta(go)[pa]=yo:da=!1;for(vo in ya)(go=(yo=zo[vo])&&yo.prototype)&&(ta(go)[pa]=yo);if((!da||!Go(sa)||sa===Function.prototype)&&(sa=function(){throw la("Incorrect invocation")},da))for(vo in va)zo[vo]&&Jo(zo[vo],sa);if((!da||!ua||ua===ca)&&(ua=sa.prototype,da))for(vo in va)zo[vo]&&Jo(zo[vo].prototype,ua);if(da&&Qo(aa)!==ua&&Jo(aa,ua),ko&&!Xo(ua,fa))for(vo in ma=!0,qo(ua,fa,{configurable:!0,get:function(){return jo(this)?this[ha]:void 0}}),va)zo[vo]&&Wo(zo[vo],ha,vo);var xa={NATIVE_ARRAY_BUFFER_VIEWS:da,TYPED_ARRAY_TAG:ma&&ha,aTypedArray:function(e){if(Ta(e))return e;throw la("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Go(e)&&(!Jo||Ko(sa,e)))return e;throw la(Yo(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,i){if(ko){if(r)for(var n in va){var o=zo[n];if(o&&Xo(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}ua[e]&&!r||Zo(ua,e,r?t:da&&na[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,r){var i,n;if(ko){if(Jo){if(r)for(i in va)if((n=zo[i])&&Xo(n,e))try{delete n[e]}catch(e){}if(sa[e]&&!r)return;try{return Zo(sa,e,r?t:da&&sa[e]||t)}catch(e){}}for(i in va)!(n=zo[i])||n[e]&&!r||Zo(n,e,t)}},getTypedArrayConstructor:ga,isView:function(e){if(!jo(e))return!1;var t=Ho(e);return"DataView"===t||Xo(va,t)||Xo(ya,t)},isTypedArray:Ta,TypedArray:sa,TypedArrayPrototype:ua},Ea=i,Aa=o,Sa=ho,ba=xa.NATIVE_ARRAY_BUFFER_VIEWS,_a=Ea.ArrayBuffer,Ra=Ea.Int8Array,Ca=!ba||!Aa((function(){Ra(1)}))||!Aa((function(){new Ra(-1)}))||!Sa((function(e){new Ra,new Ra(null),new Ra(1.5),new Ra(e)}),!0)||Aa((function(){return 1!==new Ra(new _a(2),1,void 0).length})),Oa=Qr,La=function(e,t,r){for(var i in t)Oa(e,i,t[i],r);return e},Ia=q,Pa=TypeError,Ma=function(e,t){if(Ia(t,e))return e;throw Pa("Incorrect invocation")},wa=ii,Fa=li,Na=RangeError,Da=function(e){if(void 0===e)return 0;var t=wa(e),r=Fa(t);if(t!==r)throw Na("Wrong length or index");return r},Va=Math.sign||function(e){var t=+e;return 0===t||t!=t?t:t<0?-1:1},Ua=ti,Ba=Array,ka=Math.abs,za=Math.pow,Ga=Math.floor,ja=Math.log,Xa=Math.LN2,Ha=function(e){var t=Ua(e),r=ka(e-t);return r>.5||.5===r&&t%2!=0?t+Va(e):t},Ya={pack:function(e,t,r){var i,n,o,a=Ba(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,l=23===t?za(2,-24)-za(2,-77):0,f=e<0||0===e&&1/e<0?1:0,h=0;for((e=ka(e))!=e||e===1/0?(n=e!=e?1:0,i=u):(i=Ga(ja(e)/Xa),e*(o=za(2,-i))<1&&(i--,o*=2),(e+=i+c>=1?l/o:l*za(2,1-c))*o>=2&&(i++,o/=2),i+c>=u?(n=0,i=u):i+c>=1?(n=Ha((e*o-1)*za(2,t)),i+=c):(n=Ha(e*za(2,c-1)*za(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+=za(2,t),l-=a}return(c?-1:1)*r*za(2,l-t)}},Wa=Ve,Za=si,qa=hi,Ka=function(e){for(var t=Wa(this),r=qa(t),i=arguments.length,n=Za(i>1?arguments[1]:void 0,r),o=i>2?arguments[2]:void 0,a=void 0===o?r:Za(o,r);a>n;)t[n++]=e;return t},Qa=ht,Ja=Ot,$a=y,es=si,ts=hi,rs=function(e,t,r){var i=Qa(t);i in e?Ja.f(e,i,$a(0,r)):e[i]=r},is=Array,ns=Math.max,os=function(e,t,r){for(var i=ts(e),n=es(t,i),o=es(void 0===r?i:r,i),a=is(ns(o-n,0)),s=0;n<o;n++,s++)rs(a,s,e[n]);return a.length=s,a},as=Ot.f,ss=ke,us=tt("toStringTag"),cs=function(e,t,r){e&&!r&&(e=e.prototype),e&&!ss(e,us)&&as(e,us,{configurable:!0,value:t})},ls=i,fs=A,hs=a,ps=po,ds=er,ms=Wt,vs=Lo,ys=La,gs=o,Ts=Ma,xs=ii,Es=li,As=Da,Ss=Ya,bs=Yn,_s=Uo,Rs=Jr.f,Cs=Ka,Os=os,Ls=cs,Is=Lr,Ps=ds.PROPER,Ms=ds.CONFIGURABLE,ws="ArrayBuffer",Fs="DataView",Ns="prototype",Ds="Wrong index",Vs=Is.getterFor(ws),Us=Is.getterFor(Fs),Bs=Is.set,ks=ls[ws],zs=ks,Gs=zs&&zs[Ns],js=ls[Fs],Xs=js&&js[Ns],Hs=Object.prototype,Ys=ls.Array,Ws=ls.RangeError,Zs=fs(Cs),qs=fs([].reverse),Ks=Ss.pack,Qs=Ss.unpack,Js=function(e){return[255&e]},$s=function(e){return[255&e,e>>8&255]},eu=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},tu=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},ru=function(e){return Ks(e,23,4)},iu=function(e){return Ks(e,52,8)},nu=function(e,t,r){vs(e[Ns],t,{configurable:!0,get:function(){return r(this)[t]}})},ou=function(e,t,r,i){var n=Us(e),o=As(r),a=!!i;if(o+t>n.byteLength)throw Ws(Ds);var s=n.bytes,u=o+n.byteOffset,c=Os(s,u,u+t);return a?c:qs(c)},au=function(e,t,r,i,n,o){var a=Us(e),s=As(r),u=i(+n),c=!!o;if(s+t>a.byteLength)throw Ws(Ds);for(var l=a.bytes,f=s+a.byteOffset,h=0;h<t;h++)l[f+h]=u[c?h:t-h-1]};if(ps){var su=Ps&&ks.name!==ws;if(gs((function(){ks(1)}))&&gs((function(){new ks(-1)}))&&!gs((function(){return new ks,new ks(1.5),new ks(NaN),1!==ks.length||su&&!Ms})))su&&Ms&&ms(ks,"name",ws);else{(zs=function(e){return Ts(this,Gs),new ks(As(e))})[Ns]=Gs;for(var uu,cu=Rs(ks),lu=0;cu.length>lu;)(uu=cu[lu++])in zs||ms(zs,uu,ks[uu]);Gs.constructor=zs}_s&&bs(Xs)!==Hs&&_s(Xs,Hs);var fu=new js(new zs(2)),hu=fs(Xs.setInt8);fu.setInt8(0,2147483648),fu.setInt8(1,2147483649),!fu.getInt8(0)&&fu.getInt8(1)||ys(Xs,{setInt8:function(e,t){hu(this,e,t<<24>>24)},setUint8:function(e,t){hu(this,e,t<<24>>24)}},{unsafe:!0})}else Gs=(zs=function(e){Ts(this,Gs);var t=As(e);Bs(this,{type:ws,bytes:Zs(Ys(t),0),byteLength:t}),hs||(this.byteLength=t,this.detached=!1)})[Ns],Xs=(js=function(e,t,r){Ts(this,Xs),Ts(e,Gs);var i=Vs(e),n=i.byteLength,o=xs(t);if(o<0||o>n)throw Ws("Wrong offset");if(o+(r=void 0===r?n-o:Es(r))>n)throw Ws("Wrong length");Bs(this,{type:Fs,buffer:e,byteLength:r,byteOffset:o,bytes:i.bytes}),hs||(this.buffer=e,this.byteLength=r,this.byteOffset=o)})[Ns],hs&&(nu(zs,"byteLength",Vs),nu(js,"buffer",Us),nu(js,"byteLength",Us),nu(js,"byteOffset",Us)),ys(Xs,{getInt8:function(e){return ou(this,1,e)[0]<<24>>24},getUint8:function(e){return ou(this,1,e)[0]},getInt16:function(e){var t=ou(this,2,e,arguments.length>1&&arguments[1]);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=ou(this,2,e,arguments.length>1&&arguments[1]);return t[1]<<8|t[0]},getInt32:function(e){return tu(ou(this,4,e,arguments.length>1&&arguments[1]))},getUint32:function(e){return tu(ou(this,4,e,arguments.length>1&&arguments[1]))>>>0},getFloat32:function(e){return Qs(ou(this,4,e,arguments.length>1&&arguments[1]),23)},getFloat64:function(e){return Qs(ou(this,8,e,arguments.length>1&&arguments[1]),52)},setInt8:function(e,t){au(this,1,e,Js,t)},setUint8:function(e,t){au(this,1,e,Js,t)},setInt16:function(e,t){au(this,2,e,$s,t,arguments.length>2&&arguments[2])},setUint16:function(e,t){au(this,2,e,$s,t,arguments.length>2&&arguments[2])},setInt32:function(e,t){au(this,4,e,eu,t,arguments.length>2&&arguments[2])},setUint32:function(e,t){au(this,4,e,eu,t,arguments.length>2&&arguments[2])},setFloat32:function(e,t){au(this,4,e,ru,t,arguments.length>2&&arguments[2])},setFloat64:function(e,t){au(this,8,e,iu,t,arguments.length>2&&arguments[2])}});Ls(zs,ws),Ls(js,Fs);var pu={ArrayBuffer:zs,DataView:js},du=H,mu=Math.floor,vu=Number.isInteger||function(e){return!du(e)&&isFinite(e)&&mu(e)===e},yu=ii,gu=RangeError,Tu=function(e){var t=yu(e);if(t<0)throw gu("The argument can't be less than 0");return t},xu=RangeError,Eu=function(e,t){var r=Tu(e);if(r%t)throw xu("Wrong offset");return r},Au=Math.round,Su=R,bu=A,_u=function(e){if("Function"===Su(e))return bu(e)},Ru=Te,Cu=s,Ou=_u(_u.bind),Lu=function(e,t){return Ru(e),void 0===t?e:Cu?Ou(e,t):function(){return e.apply(t,arguments)}},Iu=A,Pu=o,Mu=G,wu=Ro,Fu=sr,Nu=function(){},Du=[],Vu=Z("Reflect","construct"),Uu=/^\s*(?:class|function)\b/,Bu=Iu(Uu.exec),ku=!Uu.exec(Nu),zu=function(e){if(!Mu(e))return!1;try{return Vu(Nu,Du,e),!0}catch(e){return!1}},Gu=function(e){if(!Mu(e))return!1;switch(wu(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ku||!!Bu(Uu,Fu(e))}catch(e){return!0}};Gu.sham=!0;var ju=!Vu||Pu((function(){var e;return zu(zu.call)||!zu(Object)||!zu((function(){e=!0}))||e}))?Gu:zu,Xu=ju,Hu=me,Yu=TypeError,Wu=function(e){if(Xu(e))return e;throw Yu(Hu(e)+" is not a constructor")},Zu={},qu=Ro,Ku=Ae,Qu=M,Ju=Zu,$u=tt("iterator"),ec=function(e){if(!Qu(e))return Ku(e,$u)||Ku(e,"@@iterator")||Ju[qu(e)]},tc=l,rc=Te,ic=wt,nc=me,oc=ec,ac=TypeError,sc=function(e,t){var r=arguments.length<2?oc(e):t;if(rc(r))return ic(tc(r,e));throw ac(nc(e)+" is not iterable")},uc=Zu,cc=tt("iterator"),lc=Array.prototype,fc=function(e){return void 0!==e&&(uc.Array===e||lc[cc]===e)},hc=Ro,pc=function(e){var t=hc(e);return"BigInt64Array"===t||"BigUint64Array"===t},dc=ct,mc=TypeError,vc=function(e){var t=dc(e,"number");if("number"==typeof t)throw mc("Can't convert number to bigint");return BigInt(t)},yc=Lu,gc=l,Tc=Wu,xc=Ve,Ec=hi,Ac=sc,Sc=ec,bc=fc,_c=pc,Rc=xa.aTypedArrayConstructor,Cc=vc,Oc=function(e){var t,r,i,n,o,a,s,u,c=Tc(this),l=xc(e),f=arguments.length,h=f>1?arguments[1]:void 0,p=void 0!==h,d=Sc(l);if(d&&!bc(d))for(u=(s=Ac(l,d)).next,l=[];!(a=gc(u,s)).done;)l.push(a.value);for(p&&f>2&&(h=yc(h,arguments[2])),r=Ec(l),i=new(Rc(c))(r),n=_c(i),t=0;r>t;t++)o=p?h(l[t],t):l[t],i[t]=n?Cc(o):+o;return i},Lc=R,Ic=Array.isArray||function(e){return"Array"===Lc(e)},Pc=ju,Mc=H,wc=tt("species"),Fc=Array,Nc=function(e){var t;return Ic(e)&&(t=e.constructor,(Pc(t)&&(t===Fc||Ic(t.prototype))||Mc(t)&&null===(t=t[wc]))&&(t=void 0)),void 0===t?Fc:t},Dc=Lu,Vc=P,Uc=Ve,Bc=hi,kc=function(e,t){return new(Nc(e))(0===t?0:t)},zc=A([].push),Gc=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=Uc(u),m=Vc(d),v=Dc(c,l),y=Bc(m),g=0,T=f||kc,x=t?T(u,y):r||a?T(u,0):void 0;y>g;g++)if((s||g in m)&&(p=v(h=m[g],g,d),e))if(t)x[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:zc(x,h)}else switch(e){case 4:return!1;case 7:zc(x,h)}return o?-1:i||n?n:x}},jc={forEach:Gc(0),map:Gc(1),filter:Gc(2),some:Gc(3),every:Gc(4),find:Gc(5),findIndex:Gc(6),filterReject:Gc(7)},Xc=Z,Hc=Lo,Yc=a,Wc=tt("species"),Zc=function(e){var t=Xc(e);Yc&&t&&!t[Wc]&&Hc(t,Wc,{configurable:!0,get:function(){return this}})},qc=G,Kc=H,Qc=Uo,Jc=function(e,t,r){var i,n;return Qc&&qc(i=t.constructor)&&i!==r&&Kc(n=i.prototype)&&n!==r.prototype&&Qc(e,n),e},$c=en,el=i,tl=l,rl=a,il=Ca,nl=xa,ol=pu,al=Ma,sl=y,ul=Wt,cl=vu,ll=li,fl=Da,hl=Eu,pl=function(e){var t=Au(e);return t<0?0:t>255?255:255&t},dl=ht,ml=ke,vl=Ro,yl=H,gl=pe,Tl=Cn,xl=q,El=Uo,Al=Jr.f,Sl=Oc,bl=jc.forEach,_l=Zc,Rl=Lo,Cl=Ot,Ol=n,Ll=Jc,Il=Lr.get,Pl=Lr.set,Ml=Lr.enforce,wl=Cl.f,Fl=Ol.f,Nl=el.RangeError,Dl=ol.ArrayBuffer,Vl=Dl.prototype,Ul=ol.DataView,Bl=nl.NATIVE_ARRAY_BUFFER_VIEWS,kl=nl.TYPED_ARRAY_TAG,zl=nl.TypedArray,Gl=nl.TypedArrayPrototype,jl=nl.aTypedArrayConstructor,Xl=nl.isTypedArray,Hl="BYTES_PER_ELEMENT",Yl="Wrong length",Wl=function(e,t){jl(e);for(var r=0,i=t.length,n=new e(i);i>r;)n[r]=t[r++];return n},Zl=function(e,t){Rl(e,t,{configurable:!0,get:function(){return Il(this)[t]}})},ql=function(e){var t;return xl(Vl,e)||"ArrayBuffer"===(t=vl(e))||"SharedArrayBuffer"===t},Kl=function(e,t){return Xl(e)&&!gl(t)&&t in e&&cl(+t)&&t>=0},Ql=function(e,t){return t=dl(t),Kl(e,t)?sl(2,e[t]):Fl(e,t)},Jl=function(e,t,r){return t=dl(t),!(Kl(e,t)&&yl(r)&&ml(r,"value"))||ml(r,"get")||ml(r,"set")||r.configurable||ml(r,"writable")&&!r.writable||ml(r,"enumerable")&&!r.enumerable?wl(e,t,r):(e[t]=r.value,e)};rl?(Bl||(Ol.f=Ql,Cl.f=Jl,Zl(Gl,"buffer"),Zl(Gl,"byteOffset"),Zl(Gl,"byteLength"),Zl(Gl,"length")),$c({target:"Object",stat:!0,forced:!Bl},{getOwnPropertyDescriptor:Ql,defineProperty:Jl}),so.exports=function(e,t,r){var i=e.match(/\d+/)[0]/8,n=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=el[n],u=s,c=u&&u.prototype,l={},f=function(e,t){wl(e,t,{get:function(){return function(e,t){var r=Il(e);return r.view[o](t*i+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=Il(e);o.view[a](t*i+o.byteOffset,r?pl(n):n,!0)}(this,t,e)},enumerable:!0})};Bl?il&&(u=t((function(e,t,r,n){return al(e,c),Ll(yl(t)?ql(t)?void 0!==n?new s(t,hl(r,i),n):void 0!==r?new s(t,hl(r,i)):new s(t):Xl(t)?Wl(u,t):tl(Sl,u,t):new s(fl(t)),e,u)})),El&&El(u,zl),bl(Al(s),(function(e){e in u||ul(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,n){al(e,c);var o,a,s,l=0,h=0;if(yl(t)){if(!ql(t))return Xl(t)?Wl(u,t):tl(Sl,u,t);o=t,h=hl(r,i);var p=t.byteLength;if(void 0===n){if(p%i)throw Nl(Yl);if((a=p-h)<0)throw Nl(Yl)}else if((a=ll(n)*i)+h>p)throw Nl(Yl);s=a/i}else s=fl(t),o=new Dl(a=s*i);for(Pl(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new Ul(o)});l<s;)f(e,l++)})),El&&El(u,zl),c=u.prototype=Tl(Gl)),c.constructor!==u&&ul(c,"constructor",u),Ml(c).TypedArrayConstructor=u,kl&&ul(c,kl,n);var h=u!==s;l[n]=u,$c({global:!0,constructor:!0,forced:h,sham:!Bl},l),Hl in u||ul(u,Hl,i),Hl in c||ul(c,Hl,i),_l(n)}):so.exports=function(){},(0,so.exports)("Int8",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}}),!0),(0,so.exports)("Int16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Uint16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Int32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Uint32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Float32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,so.exports)("Float64",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var $l=Ro,ef=To?{}.toString:function(){return"[object "+$l(this)+"]"};To||Qr(Object.prototype,"toString",ef,{unsafe:!0});var tf,rf,nf,of=Ro,af=String,sf=function(e){if("Symbol"===of(e))throw TypeError("Cannot convert a Symbol value to a string");return af(e)},uf=A,cf=ii,lf=sf,ff=N,hf=uf("".charAt),pf=uf("".charCodeAt),df=uf("".slice),mf=function(e){return function(t,r){var i,n,o=lf(ff(t)),a=cf(r),s=o.length;return a<0||a>=s?e?"":void 0:(i=pf(o,a))<55296||i>56319||a+1===s||(n=pf(o,a+1))<56320||n>57343?e?hf(o,a):i:e?df(o,a,a+2):n-56320+(i-55296<<10)+65536}},vf={codeAt:mf(!1),charAt:mf(!0)},yf=o,gf=G,Tf=H,xf=Yn,Ef=Qr,Af=tt("iterator"),Sf=!1;[].keys&&("next"in(nf=[].keys())?(rf=xf(xf(nf)))!==Object.prototype&&(tf=rf):Sf=!0);var bf=!Tf(tf)||yf((function(){var e={};return tf[Af].call(e)!==e}));bf&&(tf={}),gf(tf[Af])||Ef(tf,Af,(function(){return this}));var _f={IteratorPrototype:tf,BUGGY_SAFARI_ITERATORS:Sf},Rf=_f.IteratorPrototype,Cf=Cn,Of=y,Lf=cs,If=Zu,Pf=function(){return this},Mf=en,wf=l,Ff=G,Nf=function(e,t,r,i){var n=t+" Iterator";return e.prototype=Cf(Rf,{next:Of(+!i,r)}),Lf(e,n,!1),If[n]=Pf,e},Df=Yn,Vf=Uo,Uf=cs,Bf=Wt,kf=Qr,zf=Zu,Gf=er.PROPER,jf=er.CONFIGURABLE,Xf=_f.IteratorPrototype,Hf=_f.BUGGY_SAFARI_ITERATORS,Yf=tt("iterator"),Wf="keys",Zf="values",qf="entries",Kf=function(){return this},Qf=function(e,t,r,i,n,o,a){Nf(r,t,i);var s,u,c,l=function(e){if(e===n&&m)return m;if(!Hf&&e in p)return p[e];switch(e){case Wf:case Zf:case qf:return function(){return new r(this,e)}}return function(){return new r(this)}},f=t+" Iterator",h=!1,p=e.prototype,d=p[Yf]||p["@@iterator"]||n&&p[n],m=!Hf&&d||l(n),v="Array"===t&&p.entries||d;if(v&&(s=Df(v.call(new e)))!==Object.prototype&&s.next&&(Df(s)!==Xf&&(Vf?Vf(s,Xf):Ff(s[Yf])||kf(s,Yf,Kf)),Uf(s,f,!0)),Gf&&n===Zf&&d&&d.name!==Zf&&(jf?Bf(p,"name",Zf):(h=!0,m=function(){return wf(d,this)})),n)if(u={values:l(Zf),keys:o?m:l(Wf),entries:l(qf)},a)for(c in u)(Hf||h||!(c in p))&&kf(p,c,u[c]);else Mf({target:t,proto:!0,forced:Hf||h},u);return p[Yf]!==m&&kf(p,Yf,m,{name:n}),zf[t]=m,u},Jf=function(e,t){return{value:e,done:t}},$f=vf.charAt,eh=sf,th=Lr,rh=Qf,ih=Jf,nh="String Iterator",oh=th.set,ah=th.getterFor(nh);rh(String,"String",(function(e){oh(this,{type:nh,string:eh(e),index:0})}),(function(){var e,t=ah(this),r=t.string,i=t.index;return i>=r.length?ih(void 0,!0):(e=$f(r,i),t.index+=e.length,ih(e,!1))})),(0,xa.exportTypedArrayStaticMethod)("from",Oc,Ca);var sh=xa.aTypedArrayConstructor;(0,xa.exportTypedArrayStaticMethod)("of",(function(){for(var e=0,t=arguments.length,r=new(sh(this))(t);t>e;)r[e]=arguments[e++];return r}),Ca);var uh=hi,ch=ii,lh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("at",(function(e){var t=lh(this),r=uh(t),i=ch(e),n=i>=0?i:r+i;return n<0||n>=r?void 0:t[n]}));var fh=me,hh=TypeError,ph=Ve,dh=si,mh=hi,vh=function(e,t){if(!delete e[t])throw hh("Cannot delete property "+fh(t)+" of "+fh(e))},yh=Math.min,gh=[].copyWithin||function(e,t){var r=ph(this),i=mh(r),n=dh(e,i),o=dh(t,i),a=arguments.length>2?arguments[2]:void 0,s=yh((void 0===a?i:dh(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]:vh(r,n),n+=u,o+=u;return r},Th=xa,xh=A(gh),Eh=Th.aTypedArray;(0,Th.exportTypedArrayMethod)("copyWithin",(function(e,t){return xh(Eh(this),e,t,arguments.length>2?arguments[2]:void 0)}));var Ah=jc.every,Sh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("every",(function(e){return Ah(Sh(this),e,arguments.length>1?arguments[1]:void 0)}));var bh=Ka,_h=vc,Rh=Ro,Ch=l,Oh=o,Lh=xa.aTypedArray,Ih=xa.exportTypedArrayMethod,Ph=A("".slice);Ih("fill",(function(e){var t=arguments.length;Lh(this);var r="Big"===Ph(Rh(this),0,3)?_h(e):+e;return Ch(bh,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),Oh((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e})));var Mh=hi,wh=function(e,t){for(var r=0,i=Mh(t),n=new e(i);i>r;)n[r]=t[r++];return n},Fh=wt,Nh=Wu,Dh=M,Vh=tt("species"),Uh=function(e,t){var r,i=Fh(e).constructor;return void 0===i||Dh(r=Fh(i)[Vh])?t:Nh(r)},Bh=Uh,kh=xa.aTypedArrayConstructor,zh=xa.getTypedArrayConstructor,Gh=function(e){return kh(Bh(e,zh(e)))},jh=wh,Xh=Gh,Hh=function(e,t){return jh(Xh(e),t)},Yh=jc.filter,Wh=Hh,Zh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("filter",(function(e){var t=Yh(Zh(this),e,arguments.length>1?arguments[1]:void 0);return Wh(this,t)}));var qh=jc.find,Kh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("find",(function(e){return qh(Kh(this),e,arguments.length>1?arguments[1]:void 0)}));var Qh=jc.findIndex,Jh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("findIndex",(function(e){return Qh(Jh(this),e,arguments.length>1?arguments[1]:void 0)}));var $h=Lu,ep=P,tp=Ve,rp=hi,ip=function(e){var t=1===e;return function(r,i,n){for(var o,a=tp(r),s=ep(a),u=$h(i,n),c=rp(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}},np={findLast:ip(0),findLastIndex:ip(1)},op=np.findLast,ap=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("findLast",(function(e){return op(ap(this),e,arguments.length>1?arguments[1]:void 0)}));var sp=np.findLastIndex,up=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("findLastIndex",(function(e){return sp(up(this),e,arguments.length>1?arguments[1]:void 0)}));var cp=jc.forEach,lp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("forEach",(function(e){cp(lp(this),e,arguments.length>1?arguments[1]:void 0)}));var fp=yi.includes,hp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("includes",(function(e){return fp(hp(this),e,arguments.length>1?arguments[1]:void 0)}));var pp=yi.indexOf,dp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("indexOf",(function(e){return pp(dp(this),e,arguments.length>1?arguments[1]:void 0)}));var mp=xa.aTypedArray,vp=xa.exportTypedArrayMethod,yp=A([].join);vp("join",(function(e){return yp(mp(this),e)}));var gp=s,Tp=Function.prototype,xp=Tp.apply,Ep=Tp.call,Ap="object"==typeof Reflect&&Reflect.apply||(gp?Ep.bind(xp):function(){return Ep.apply(xp,arguments)}),Sp=o,bp=Ap,_p=U,Rp=ii,Cp=hi,Op=function(e,t){var r=[][e];return!!r&&Sp((function(){r.call(null,t||function(){return 1},1)}))},Lp=Math.min,Ip=[].lastIndexOf,Pp=!!Ip&&1/[1].lastIndexOf(1,-0)<0,Mp=Op("lastIndexOf"),wp=Pp||!Mp?function(e){if(Pp)return bp(Ip,this,arguments)||0;var t=_p(this),r=Cp(t),i=r-1;for(arguments.length>1&&(i=Lp(i,Rp(arguments[1]))),i<0&&(i=r+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:Ip,Fp=Ap,Np=wp,Dp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Fp(Np,Dp(this),t>1?[e,arguments[1]]:[e])}));var Vp=jc.map,Up=Gh,Bp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("map",(function(e){return Vp(Bp(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(Up(e))(t)}))}));var kp=Te,zp=Ve,Gp=P,jp=hi,Xp=TypeError,Hp=function(e){return function(t,r,i,n){kp(r);var o=zp(t),a=Gp(o),s=jp(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 Xp("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}},Yp={left:Hp(!1),right:Hp(!0)},Wp=Yp.left,Zp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return Wp(Zp(this),e,t,t>1?arguments[1]:void 0)}));var qp=Yp.right,Kp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return qp(Kp(this),e,t,t>1?arguments[1]:void 0)}));var Qp=xa.aTypedArray,Jp=xa.exportTypedArrayMethod,$p=Math.floor;Jp("reverse",(function(){for(var e,t=this,r=Qp(t).length,i=$p(r/2),n=0;n<i;)e=t[n],t[n++]=t[--r],t[r]=e;return t}));var ed=i,td=l,rd=xa,id=hi,nd=Eu,od=Ve,ad=o,sd=ed.RangeError,ud=ed.Int8Array,cd=ud&&ud.prototype,ld=cd&&cd.set,fd=rd.aTypedArray,hd=rd.exportTypedArrayMethod,pd=!ad((function(){var e=new Uint8ClampedArray(2);return td(ld,e,{length:1,0:3},1),3!==e[1]})),dd=pd&&rd.NATIVE_ARRAY_BUFFER_VIEWS&&ad((function(){var e=new ud(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));hd("set",(function(e){fd(this);var t=nd(arguments.length>1?arguments[1]:void 0,1),r=od(e);if(pd)return td(ld,this,r,t);var i=this.length,n=id(r),o=0;if(n+t>i)throw sd("Wrong length");for(;o<n;)this[t+o]=r[o++]}),!pd||dd);var md=A([].slice),vd=Gh,yd=md,gd=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("slice",(function(e,t){for(var r=yd(gd(this),e,t),i=vd(this),n=0,o=r.length,a=new i(o);o>n;)a[n]=r[n++];return a}),o((function(){new Int8Array(1).slice()})));var Td=jc.some,xd=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("some",(function(e){return Td(xd(this),e,arguments.length>1?arguments[1]:void 0)}));var Ed=os,Ad=Math.floor,Sd=function(e,t){var r=e.length,i=Ad(r/2);return r<8?bd(e,t):_d(e,Sd(Ed(e,0,i),t),Sd(Ed(e,i),t),t)},bd=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},_d=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},Rd=Sd,Cd=K.match(/firefox\/(\d+)/i),Od=!!Cd&&+Cd[1],Ld=/MSIE|Trident/.test(K),Id=K.match(/AppleWebKit\/(\d+)\./),Pd=!!Id&&+Id[1],Md=_u,wd=o,Fd=Te,Nd=Rd,Dd=Od,Vd=Ld,Ud=ie,Bd=Pd,kd=xa.aTypedArray,zd=xa.exportTypedArrayMethod,Gd=i.Uint16Array,jd=Gd&&Md(Gd.prototype.sort),Xd=!(!jd||wd((function(){jd(new Gd(2),null)}))&&wd((function(){jd(new Gd(2),{})}))),Hd=!!jd&&!wd((function(){if(Ud)return Ud<74;if(Dd)return Dd<67;if(Vd)return!0;if(Bd)return Bd<602;var e,t,r=new Gd(516),i=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,i[e]=e-2*t+3;for(jd(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==i[e])return!0}));zd("sort",(function(e){return void 0!==e&&Fd(e),Hd?jd(this,e):Nd(kd(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))}),!Hd||Xd);var Yd=li,Wd=si,Zd=Gh,qd=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("subarray",(function(e,t){var r=qd(this),i=r.length,n=Wd(e,i);return new(Zd(r))(r.buffer,r.byteOffset+n*r.BYTES_PER_ELEMENT,Yd((void 0===t?i:Wd(t,i))-n))}));var Kd=Ap,Qd=xa,Jd=o,$d=md,em=i.Int8Array,tm=Qd.aTypedArray,rm=Qd.exportTypedArrayMethod,im=[].toLocaleString,nm=!!em&&Jd((function(){im.call(new em(1))}));rm("toLocaleString",(function(){return Kd(im,nm?$d(tm(this)):tm(this),$d(arguments))}),Jd((function(){return[1,2].toLocaleString()!==new em([1,2]).toLocaleString()}))||!Jd((function(){em.prototype.toLocaleString.call([1,2])})));var om=xa.exportTypedArrayMethod,am=o,sm=A,um=i.Uint8Array,cm=um&&um.prototype||{},lm=[].toString,fm=sm([].join);am((function(){lm.call({})}))&&(lm=function(){return fm(this)});var hm=cm.toString!==lm;om("toString",lm,hm);var pm=hi,dm=function(e,t){for(var r=pm(e),i=new t(r),n=0;n<r;n++)i[n]=e[r-n-1];return i},mm=xa.aTypedArray,vm=xa.getTypedArrayConstructor;(0,xa.exportTypedArrayMethod)("toReversed",(function(){return dm(mm(this),vm(this))}));var ym=Te,gm=wh,Tm=xa.aTypedArray,xm=xa.getTypedArrayConstructor,Em=xa.exportTypedArrayMethod,Am=A(xa.TypedArrayPrototype.sort);Em("toSorted",(function(e){void 0!==e&&ym(e);var t=Tm(this),r=gm(xm(t),t);return Am(r,e)}));var Sm=hi,bm=ii,_m=RangeError,Rm=function(e,t,r,i){var n=Sm(e),o=bm(r),a=o<0?n+o:o;if(a>=n||a<0)throw _m("Incorrect index");for(var s=new t(n),u=0;u<n;u++)s[u]=u===a?i:e[u];return s},Cm=pc,Om=ii,Lm=vc,Im=xa.aTypedArray,Pm=xa.getTypedArrayConstructor,Mm=xa.exportTypedArrayMethod,wm=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(e){return 8===e}}();Mm("with",{with:function(e,t){var r=Im(this),i=Om(e),n=Cm(r)?Lm(t):+t;return Rm(r,Pm(r),i,n)}}.with,!wm);var Fm=U,Nm=wn,Dm=Zu,Vm=Lr,Um=Ot.f,Bm=Qf,km=Jf,zm=a,Gm="Array Iterator",jm=Vm.set,Xm=Vm.getterFor(Gm),Hm=Bm(Array,"Array",(function(e,t){jm(this,{type:Gm,target:Fm(e),index:0,kind:t})}),(function(){var e=Xm(this),t=e.target,r=e.kind,i=e.index++;if(!t||i>=t.length)return e.target=void 0,km(void 0,!0);switch(r){case"keys":return km(i,!1);case"values":return km(t[i],!1)}return km([i,t[i]],!1)}),"values"),Ym=Dm.Arguments=Dm.Array;if(Nm("keys"),Nm("values"),Nm("entries"),zm&&"values"!==Ym.name)try{Um(Ym,"name",{value:"values"})}catch(e){}var Wm=i,Zm=o,qm=A,Km=xa,Qm=Hm,Jm=tt("iterator"),$m=Wm.Uint8Array,ev=qm(Qm.values),tv=qm(Qm.keys),rv=qm(Qm.entries),iv=Km.aTypedArray,nv=Km.exportTypedArrayMethod,ov=$m&&$m.prototype,av=!Zm((function(){ov[Jm].call([1])})),sv=!!ov&&ov.values&&ov[Jm]===ov.values&&"values"===ov.values.name,uv=function(){return ev(iv(this))};nv("entries",(function(){return rv(iv(this))}),av),nv("keys",(function(){return tv(iv(this))}),av),nv("values",uv,av||!sv,{name:"values"}),nv(Jm,uv,av||!sv,{name:"values"});var cv=hi,lv=pc,fv=si,hv=vc,pv=ii,dv=o,mv=xa.aTypedArray,vv=xa.getTypedArrayConstructor,yv=xa.exportTypedArrayMethod,gv=Math.max,Tv=Math.min;yv("toSpliced",(function(e,t){var r,i,n,o,a,s,u,c=mv(this),l=vv(c),f=cv(c),h=fv(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=Tv(gv(pv(t),0),f-h),r=p-2){o=new l(r),n=lv(o);for(var m=2;m<p;m++)a=arguments[m],o[m-2]=n?hv(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}),!!dv((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 xv={exports:{}},Ev={},Av=R,Sv=U,bv=Jr.f,_v=os,Rv="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Ev.f=function(e){return Rv&&"Window"===Av(e)?function(e){try{return bv(e)}catch(e){return _v(Rv)}}(e):bv(Sv(e))};var Cv=o((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Ov=o,Lv=H,Iv=R,Pv=Cv,Mv=Object.isExtensible,wv=Ov((function(){Mv(1)}))||Pv?function(e){return!!Lv(e)&&((!Pv||"ArrayBuffer"!==Iv(e))&&(!Mv||Mv(e)))}:Mv,Fv=!o((function(){return Object.isExtensible(Object.preventExtensions({}))})),Nv=en,Dv=A,Vv=mr,Uv=H,Bv=ke,kv=Ot.f,zv=Jr,Gv=Ev,jv=wv,Xv=Fv,Hv=!1,Yv=He("meta"),Wv=0,Zv=function(e){kv(e,Yv,{value:{objectID:"O"+Wv++,weakData:{}}})},qv=xv.exports={enable:function(){qv.enable=function(){},Hv=!0;var e=zv.f,t=Dv([].splice),r={};r[Yv]=1,e(r).length&&(zv.f=function(r){for(var i=e(r),n=0,o=i.length;n<o;n++)if(i[n]===Yv){t(i,n,1);break}return i},Nv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Gv.f}))},fastKey:function(e,t){if(!Uv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Bv(e,Yv)){if(!jv(e))return"F";if(!t)return"E";Zv(e)}return e[Yv].objectID},getWeakData:function(e,t){if(!Bv(e,Yv)){if(!jv(e))return!0;if(!t)return!1;Zv(e)}return e[Yv].weakData},onFreeze:function(e){return Xv&&Hv&&jv(e)&&!Bv(e,Yv)&&Zv(e),e}};Vv[Yv]=!0;var Kv=l,Qv=wt,Jv=Ae,$v=Lu,ey=l,ty=wt,ry=me,iy=fc,ny=hi,oy=q,ay=sc,sy=ec,uy=function(e,t,r){var i,n;Qv(e);try{if(!(i=Jv(e,"return"))){if("throw"===t)throw r;return r}i=Kv(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return Qv(i),r},cy=TypeError,ly=function(e,t){this.stopped=e,this.result=t},fy=ly.prototype,hy=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=$v(t,l),v=function(e){return i&&uy(i,"normal",e),new ly(!0,e)},y=function(e){return f?(ty(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=sy(e)))throw cy(ry(e)+" is not iterable");if(iy(n)){for(o=0,a=ny(e);a>o;o++)if((s=y(e[o]))&&oy(fy,s))return s;return new ly(!1)}i=ay(e,n)}for(u=h?e.next:i.next;!(c=ey(u,i)).done;){try{s=y(c.value)}catch(e){uy(i,"throw",e)}if("object"==typeof s&&s&&oy(fy,s))return s}return new ly(!1)},py=en,dy=i,my=A,vy=Yi,yy=Qr,gy=xv.exports,Ty=hy,xy=Ma,Ey=G,Ay=M,Sy=H,by=o,_y=ho,Ry=cs,Cy=Jc,Oy=Cn,Ly=Lo,Iy=La,Py=Lu,My=Ma,wy=M,Fy=hy,Ny=Qf,Dy=Jf,Vy=Zc,Uy=a,By=xv.exports.fastKey,ky=Lr.set,zy=Lr.getterFor,Gy={getConstructor:function(e,t,r,i){var n=e((function(e,n){My(e,o),ky(e,{type:t,index:Oy(null),first:void 0,last:void 0,size:0}),Uy||(e.size=0),wy(n)||Fy(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=zy(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=By(t,!0),key:t,value:r,previous:i=o.last,next:void 0,removed:!1},o.first||(o.first=s),i&&(i.next=s),Uy?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},u=function(e,t){var r,i=a(e),n=By(t);if("F"!==n)return i.index[n];for(r=i.first;r;r=r.next)if(r.key===t)return r};return Iy(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,Uy?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),Uy?r.size--:t.size--}return!!i},forEach:function(e){for(var t,r=a(this),i=Py(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)}}),Iy(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)}}),Uy&&Ly(o,"size",{configurable:!0,get:function(){return a(this).size}}),n},setStrong:function(e,t,r){var i=t+" Iterator",n=zy(t),o=zy(i);Ny(e,t,(function(e,t){ky(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)?Dy("keys"===t?r.key:"values"===t?r.value:[r.key,r.value],!1):(e.target=void 0,Dy(void 0,!0))}),r?"entries":"values",!r,!0),Vy(t)}},jy=function(e,t,r){var i=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=i?"set":"add",a=dy[e],s=a&&a.prototype,u=a,c={},l=function(e){var t=my(s[e]);yy(s,e,"add"===e?function(e){return t(this,0===e?0:e),this}:"delete"===e?function(e){return!(n&&!Sy(e))&&t(this,0===e?0:e)}:"get"===e?function(e){return n&&!Sy(e)?void 0:t(this,0===e?0:e)}:"has"===e?function(e){return!(n&&!Sy(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(vy(e,!Ey(a)||!(n||s.forEach&&!by((function(){(new a).entries().next()})))))u=r.getConstructor(t,e,i,o),gy.enable();else if(vy(e,!0)){var f=new u,h=f[o](n?{}:-0,1)!==f,p=by((function(){f.has(1)})),d=_y((function(e){new a(e)})),m=!n&&by((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));d||((u=t((function(e,t){xy(e,s);var r=Cy(new a,e,u);return Ay(t)||Ty(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,py({global:!0,constructor:!0,forced:u!==a},c),Ry(u,e),n||r.setStrong(u,e,i),u};jy("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Gy);var Xy,Hy,Yy,Wy,Zy="process"===R(i.process),qy=TypeError,Ky=/(?:ipad|iphone|ipod).*applewebkit/i.test(K),Qy=i,Jy=Ap,$y=Lu,eg=G,tg=ke,rg=o,ig=pn,ng=md,og=vt,ag=function(e,t){if(e<t)throw qy("Not enough arguments");return e},sg=Ky,ug=Zy,cg=Qy.setImmediate,lg=Qy.clearImmediate,fg=Qy.process,hg=Qy.Dispatch,pg=Qy.Function,dg=Qy.MessageChannel,mg=Qy.String,vg=0,yg={},gg="onreadystatechange";rg((function(){Xy=Qy.location}));var Tg=function(e){if(tg(yg,e)){var t=yg[e];delete yg[e],t()}},xg=function(e){return function(){Tg(e)}},Eg=function(e){Tg(e.data)},Ag=function(e){Qy.postMessage(mg(e),Xy.protocol+"//"+Xy.host)};cg&&lg||(cg=function(e){ag(arguments.length,1);var t=eg(e)?e:pg(e),r=ng(arguments,1);return yg[++vg]=function(){Jy(t,void 0,r)},Hy(vg),vg},lg=function(e){delete yg[e]},ug?Hy=function(e){fg.nextTick(xg(e))}:hg&&hg.now?Hy=function(e){hg.now(xg(e))}:dg&&!sg?(Wy=(Yy=new dg).port2,Yy.port1.onmessage=Eg,Hy=$y(Wy.postMessage,Wy)):Qy.addEventListener&&eg(Qy.postMessage)&&!Qy.importScripts&&Xy&&"file:"!==Xy.protocol&&!rg(Ag)?(Hy=Ag,Qy.addEventListener("message",Eg,!1)):Hy=gg in og("script")?function(e){ig.appendChild(og("script"))[gg]=function(){ig.removeChild(this),Tg(e)}}:function(e){setTimeout(xg(e),0)});var Sg={set:cg,clear:lg},bg=function(){this.head=null,this.tail=null};bg.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 _g,Rg,Cg,Og,Lg,Ig=bg,Pg=/ipad|iphone|ipod/i.test(K)&&"undefined"!=typeof Pebble,Mg=/web0s(?!.*chrome)/i.test(K),wg=i,Fg=Lu,Ng=n.f,Dg=Sg.set,Vg=Ig,Ug=Ky,Bg=Pg,kg=Mg,zg=Zy,Gg=wg.MutationObserver||wg.WebKitMutationObserver,jg=wg.document,Xg=wg.process,Hg=wg.Promise,Yg=Ng(wg,"queueMicrotask"),Wg=Yg&&Yg.value;if(!Wg){var Zg=new Vg,qg=function(){var e,t;for(zg&&(e=Xg.domain)&&e.exit();t=Zg.get();)try{t()}catch(e){throw Zg.head&&_g(),e}e&&e.enter()};Ug||zg||kg||!Gg||!jg?!Bg&&Hg&&Hg.resolve?((Og=Hg.resolve(void 0)).constructor=Hg,Lg=Fg(Og.then,Og),_g=function(){Lg(qg)}):zg?_g=function(){Xg.nextTick(qg)}:(Dg=Fg(Dg,wg),_g=function(){Dg(qg)}):(Rg=!0,Cg=jg.createTextNode(""),new Gg(qg).observe(Cg,{characterData:!0}),_g=function(){Cg.data=Rg=!Rg}),Wg=function(e){Zg.head||_g(),Zg.add(e)}}var Kg=Wg,Qg=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Jg=i.Promise,$g="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,eT=!$g&&!Zy&&"object"==typeof window&&"object"==typeof document,tT=i,rT=Jg,iT=G,nT=Yi,oT=sr,aT=tt,sT=eT,uT=$g,cT=ie;rT&&rT.prototype;var lT=aT("species"),fT=!1,hT=iT(tT.PromiseRejectionEvent),pT=nT("Promise",(function(){var e=oT(rT),t=e!==String(rT);if(!t&&66===cT)return!0;if(!cT||cT<51||!/native code/.test(e)){var r=new rT((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[lT]=i,!(fT=r.then((function(){}))instanceof i))return!0}return!t&&(sT||uT)&&!hT})),dT={CONSTRUCTOR:pT,REJECTION_EVENT:hT,SUBCLASSING:fT},mT={},vT=Te,yT=TypeError,gT=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw yT("Bad Promise constructor");t=e,r=i})),this.resolve=vT(t),this.reject=vT(r)};mT.f=function(e){return new gT(e)};var TT,xT,ET,AT=en,ST=Zy,bT=i,_T=l,RT=Qr,CT=Uo,OT=cs,LT=Zc,IT=Te,PT=G,MT=H,wT=Ma,FT=Uh,NT=Sg.set,DT=Kg,VT=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},UT=Qg,BT=Ig,kT=Lr,zT=Jg,GT=mT,jT="Promise",XT=dT.CONSTRUCTOR,HT=dT.REJECTION_EVENT,YT=dT.SUBCLASSING,WT=kT.getterFor(jT),ZT=kT.set,qT=zT&&zT.prototype,KT=zT,QT=qT,JT=bT.TypeError,$T=bT.document,ex=bT.process,tx=GT.f,rx=tx,ix=!!($T&&$T.createEvent&&bT.dispatchEvent),nx="unhandledrejection",ox=function(e){var t;return!(!MT(e)||!PT(t=e.then))&&t},ax=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&&fx(t),t.rejection=1),!0===s?r=o:(l&&l.enter(),r=s(o),l&&(l.exit(),n=!0)),r===e.promise?c(JT("Promise-chain cycle")):(i=ox(r))?_T(i,r,u,c):u(r)):c(o)}catch(e){l&&!n&&l.exit(),c(e)}},sx=function(e,t){e.notified||(e.notified=!0,DT((function(){for(var r,i=e.reactions;r=i.get();)ax(r,e);e.notified=!1,t&&!e.rejection&&cx(e)})))},ux=function(e,t,r){var i,n;ix?((i=$T.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),bT.dispatchEvent(i)):i={promise:t,reason:r},!HT&&(n=bT["on"+e])?n(i):e===nx&&VT("Unhandled promise rejection",r)},cx=function(e){_T(NT,bT,(function(){var t,r=e.facade,i=e.value;if(lx(e)&&(t=UT((function(){ST?ex.emit("unhandledRejection",i,r):ux(nx,r,i)})),e.rejection=ST||lx(e)?2:1,t.error))throw t.value}))},lx=function(e){return 1!==e.rejection&&!e.parent},fx=function(e){_T(NT,bT,(function(){var t=e.facade;ST?ex.emit("rejectionHandled",t):ux("rejectionhandled",t,e.value)}))},hx=function(e,t,r){return function(i){e(t,i,r)}},px=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,sx(e,!0))},dx=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw JT("Promise can't be resolved itself");var i=ox(t);i?DT((function(){var r={done:!1};try{_T(i,t,hx(dx,r,e),hx(px,r,e))}catch(t){px(r,t,e)}})):(e.value=t,e.state=1,sx(e,!1))}catch(t){px({done:!1},t,e)}}};if(XT&&(QT=(KT=function(e){wT(this,QT),IT(e),_T(TT,this);var t=WT(this);try{e(hx(dx,t),hx(px,t))}catch(e){px(t,e)}}).prototype,(TT=function(e){ZT(this,{type:jT,done:!1,notified:!1,parent:!1,reactions:new BT,rejection:!1,state:0,value:void 0})}).prototype=RT(QT,"then",(function(e,t){var r=WT(this),i=tx(FT(this,KT));return r.parent=!0,i.ok=!PT(e)||e,i.fail=PT(t)&&t,i.domain=ST?ex.domain:void 0,0===r.state?r.reactions.add(i):DT((function(){ax(i,r)})),i.promise})),xT=function(){var e=new TT,t=WT(e);this.promise=e,this.resolve=hx(dx,t),this.reject=hx(px,t)},GT.f=tx=function(e){return e===KT||undefined===e?new xT(e):rx(e)},PT(zT)&&qT!==Object.prototype)){ET=qT.then,YT||RT(qT,"then",(function(e,t){var r=this;return new KT((function(e,t){_T(ET,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete qT.constructor}catch(e){}CT&&CT(qT,QT)}AT({global:!0,constructor:!0,wrap:!0,forced:XT},{Promise:KT}),OT(KT,jT,!1),LT(jT);var mx=Jg,vx=dT.CONSTRUCTOR||!ho((function(e){mx.all(e).then(void 0,(function(){}))})),yx=l,gx=Te,Tx=mT,xx=Qg,Ex=hy;en({target:"Promise",stat:!0,forced:vx},{all:function(e){var t=this,r=Tx.f(t),i=r.resolve,n=r.reject,o=xx((function(){var r=gx(t.resolve),o=[],a=0,s=1;Ex(e,(function(e){var u=a++,c=!1;s++,yx(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 Ax=en,Sx=dT.CONSTRUCTOR,bx=Jg,_x=Z,Rx=G,Cx=Qr,Ox=bx&&bx.prototype;if(Ax({target:"Promise",proto:!0,forced:Sx,real:!0},{catch:function(e){return this.then(void 0,e)}}),Rx(bx)){var Lx=_x("Promise").prototype.catch;Ox.catch!==Lx&&Cx(Ox,"catch",Lx,{unsafe:!0})}var Ix=l,Px=Te,Mx=mT,wx=Qg,Fx=hy;en({target:"Promise",stat:!0,forced:vx},{race:function(e){var t=this,r=Mx.f(t),i=r.reject,n=wx((function(){var n=Px(t.resolve);Fx(e,(function(e){Ix(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var Nx=l,Dx=mT;en({target:"Promise",stat:!0,forced:dT.CONSTRUCTOR},{reject:function(e){var t=Dx.f(this);return Nx(t.reject,void 0,e),t.promise}});var Vx=wt,Ux=H,Bx=mT,kx=en,zx=dT.CONSTRUCTOR,Gx=function(e,t){if(Vx(e),Ux(t)&&t.constructor===e)return t;var r=Bx.f(e);return(0,r.resolve)(t),r.promise};Z("Promise"),kx({target:"Promise",stat:!0,forced:zx},{resolve:function(e){return Gx(this,e)}});var jx,Xx,Hx=i,Yx=we,Wx=G,Zx=Yn,qx=Qr,Kx="USE_FUNCTION_CONSTRUCTOR",Qx=tt("asyncIterator"),Jx=Hx.AsyncIterator,$x=Yx.AsyncIteratorPrototype;if($x)jx=$x;else if(Wx(Jx))jx=Jx.prototype;else if(Yx[Kx]||Hx[Kx])try{Xx=Zx(Zx(Zx(Function("return async function*(){}()")()))),Zx(Xx)===Object.prototype&&(jx=Xx)}catch(e){}jx||(jx={}),Wx(jx[Qx])||qx(jx,Qx,(function(){return this}));var eE=l,tE=wt,rE=Cn,iE=Ae,nE=La,oE=Lr,aE=jx,sE=Jf,uE=Z("Promise"),cE="AsyncFromSyncIterator",lE=oE.set,fE=oE.getterFor(cE),hE=function(e,t,r){var i=e.done;uE.resolve(e.value).then((function(e){t(sE(e,i))}),r)},pE=function(e){e.type=cE,lE(this,e)};pE.prototype=nE(rE(aE),{next:function(){var e=fE(this);return new uE((function(t,r){var i=tE(eE(e.next,e.iterator));hE(i,t,r)}))},return:function(){var e=fE(this).iterator;return new uE((function(t,r){var i=iE(e,"return");if(void 0===i)return t(sE(void 0,!0));var n=tE(eE(i,e));hE(n,t,r)}))}});var dE=pE,mE=function(e){return{iterator:e,next:e.next,done:!1}},vE=l,yE=dE,gE=wt,TE=sc,xE=mE,EE=Ae,AE=tt("asyncIterator"),SE=i,bE=TypeError,_E=l,RE=Z,CE=Ae,OE=l,LE=Te,IE=wt,PE=H,ME=function(e){if(e>9007199254740991)throw bE("Maximum allowed index exceeded");return e},wE=Z,FE=mE,NE=function(e,t,r,i){try{var n=CE(e,"return");if(n)return RE("Promise").resolve(_E(n,e)).then((function(){t(r)}),(function(e){i(e)}))}catch(e){return i(e)}t(r)},DE=function(e){var t=0===e,r=1===e,i=2===e,n=3===e;return function(e,o,a){IE(e);var s=void 0!==o;!s&&t||LE(o);var u=FE(e),c=wE("Promise"),l=u.iterator,f=u.next,h=0;return new c((function(e,u){var p=function(e){NE(l,u,e,u)},d=function(){try{if(s)try{ME(h)}catch(e){p(e)}c.resolve(IE(OE(f,l))).then((function(f){try{if(IE(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():NE(l,e,!1,u);else if(t)try{a[h++]=o,d()}catch(e){p(e)}else o?NE(l,e,n||m,u):d()};PE(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()}))}},VE={toArray:DE(0),forEach:DE(1),every:DE(2),some:DE(3),find:DE(4)},UE=Lu,BE=A,kE=Ve,zE=ju,GE=function(e,t){var r=arguments.length<2?EE(e,AE):t;return r?gE(vE(r,e)):new yE(xE(TE(e)))},jE=sc,XE=mE,HE=ec,YE=Ae,WE=function(e){return SE[e].prototype},ZE=Z,qE=dE,KE=VE.toArray,QE=tt("asyncIterator"),JE=BE(WE("Array").values),$E=BE(JE([]).next),eA=function(){return new tA(this)},tA=function(e){this.iterator=JE(e)};tA.prototype.next=function(){return $E(this.iterator)};var rA=Z,iA=Wu,nA=function(e){var t=this,r=arguments.length,i=r>1?arguments[1]:void 0,n=r>2?arguments[2]:void 0;return new(ZE("Promise"))((function(r){var o=kE(e);void 0!==i&&(i=UE(i,n));var a=YE(o,QE),s=a?void 0:HE(o)||eA,u=zE(t)?new t:[],c=a?GE(o,a):new qE(XE(jE(o,s)));r(KE(c,i,u))}))},oA=wh,aA=xa.aTypedArrayConstructor;(0,xa.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(rA("Promise"))((function(r){iA(t),r(nA(e,i,n))})).then((function(e){return oA(aA(t),e)}))}),!0);var sA=jc.filterReject,uA=Hh,cA=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("filterOut",(function(e){var t=sA(cA(this),e,arguments.length>1?arguments[1]:void 0);return uA(this,t)}),!0);var lA=jc.filterReject,fA=Hh,hA=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("filterReject",(function(e){var t=lA(hA(this),e,arguments.length>1?arguments[1]:void 0);return fA(this,t)}),!0);var pA=Lu,dA=P,mA=Ve,vA=ht,yA=hi,gA=Cn,TA=wh,xA=Array,EA=A([].push),AA=function(e,t,r,i){for(var n,o,a,s=mA(e),u=dA(s),c=pA(t,r),l=gA(null),f=yA(u),h=0;f>h;h++)a=u[h],(o=vA(c(a,h,s)))in l?EA(l[o],a):l[o]=[a];if(i&&(n=i(s))!==xA)for(o in l)l[o]=TA(n,l[o]);return l},SA=Gh,bA=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("groupBy",(function(e){var t=arguments.length>1?arguments[1]:void 0;return AA(bA(this),e,t,SA)}),!0);var _A=A,RA=Map.prototype,CA={Map:Map,set:_A(RA.set),get:_A(RA.get),has:_A(RA.has),remove:_A(RA.delete),proto:RA},OA=l,LA=A,IA=function(e,t,r){for(var i,n,o=r?e:e.iterator,a=e.next;!(i=OA(a,o)).done;)if(void 0!==(n=t(i.value)))return n},PA=CA.Map,MA=CA.proto,wA=LA(MA.forEach),FA=LA(MA.entries),NA=FA(new PA).next,DA=Te,VA=M,UA=hi,BA=Ve,kA=function(e,t,r){return r?IA({iterator:FA(e),next:NA},(function(e){return t(e[1],e[0])})):wA(e,t)},zA=CA.Map,GA=CA.has,jA=CA.set,XA=A([].push),HA=wh,YA=function(e){var t,r,i,n=BA(this),o=UA(n),a=[],s=new zA,u=VA(e)?function(e){return e}:DA(e);for(t=0;t<o;t++)i=u(r=n[t]),GA(s,i)||jA(s,i,r);return kA(s,(function(e){XA(a,e)})),a},WA=xa.aTypedArray,ZA=xa.getTypedArrayConstructor,qA=xa.exportTypedArrayMethod,KA=A(YA);qA("uniqueBy",(function(e){return WA(this),HA(ZA(this),KA(this,e))}),!0);var QA=function(e,t){return QA=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])},QA(e,t)};function JA(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}QA(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var $A=function(){return $A=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},$A.apply(this,arguments)};function eS(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 tS(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 rS(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 iS(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 nS(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 oS=6,aS="tree",sS="editor",uS="none",cS=.017453292519943295,lS={"Filter not imported":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg","Item duration can't be less than 0":"https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg"};function fS(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}function hS(e){var t=this,r=e.getExtension("EXT_disjoint_timer_query_webgl2");if(r){var i=e.createQuery(),n=function(){return eS(t,void 0,void 0,(function(){return tS(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}}}var pS=[],dS={};function mS(){"function"==typeof WebGL2RenderingContext?yS(WebGL2RenderingContext):"undefined"!=typeof WebGLRenderingContext?(yS(WebGLRenderingContext),yS(WebGLRenderingContext.prototype)):pS.push("iOS16 lockdown mode, WebGL Constants not in global"),pS.length||"HALF_FLOAT"in dS||(dS.HALF_FLOAT=5131)}function vS(e){return"undefined"!=typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name}function yS(e){for(var t in e)/^[A-Z_]/.test(t)&&(dS[t]=e[t])}pS.length||mS();var gS,TS,xS,ES,AS,SS,bS,_S,RS,CS,OS,LS,IS={},PS={};function MS(e,t,r){e in IS&&console.error("Filter ".concat(e," registered twice.")),IS[e]=t,PS[e]=r}function wS(e){Object.keys(e).forEach((function(t){var r=iS(e[t],2);MS(t,r[0],r[1])}))}function FS(e){var t=PS[e.name];if(!t)throw Error("Filter ".concat(e.name," not imported, see ").concat(lS["Filter not imported"]));return t(e)}function NS(e,t){var r=IS[e.name];if(!r)throw Error("Filter ".concat(e.name," not imported, see ").concat(lS["Filter not imported"]));var i=r(e,t);return i.passSplitOptions||(i.passSplitOptions={attachments:[{texture:{format:dS.RGBA}}]}),i}function DS(e,t){return e.includes(t)||e.push(t),e}function VS(e,t){var r=e.indexOf(t);return r>-1&&e.splice(r,1),e}function US(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 BS(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 kS(e,t){var r=[0,0,0,0];if(uR(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 zS(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=jS(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 GS(e){var t=[];if(e instanceof Array?e.forEach((function(e){var r=iS(e,5),i=r[0],n=r[1],o=r[2],a=r[3],s=r[4];t.push({stop:XS(i),color:[n,o,a,s]})})):Object.keys(e).forEach((function(r){var i=kS(e[r]);t.push({stop:XS(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 jS(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 XS(e){var t=/^(-)?([\d+.]+)%$/.exec(e);return t?+t[2]/100*(t[1]?-1:1):+e}function HS(){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}function YS(){return/\b[Aa]ndroid\b/.test(navigator.userAgent)}function WS(){return YS()||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent)}function ZS(e){uR(e)&&(e=kS(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}function qS(e){var t=128,r={width:t,height:1,data:new Uint8Array(512)},i=r.data,n=GS(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=jS(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 KS(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++)JS(t,n,r);return t}return $S(t,r)}function QS(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&&JS(t,t.length-1,i),t)}function JS(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 $S(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=iS([t[c],t[u]],2),t[u]=o[0],t[c]=o[1]}return a=iS([t[u],t[i]],2),t[i]=a[0],t[u]=a[1],$S(t,r,i,u-1),$S(t,r,c+1,n),t}function eb(e,t){if(void 0===t&&(t="item doesn't exist"),null==e)throw new Error(t)}e.OrderType=void 0,(gS=e.OrderType||(e.OrderType={}))[gS.none=1]="none",gS[gS.ascending=2]="ascending",gS[gS.descending=3]="descending",function(e){e.S="S",e.APlus="A+",e.A="A",e.BPlus="B+",e.B="B"}(TS||(TS={})),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"}(xS||(xS={})),function(e){e[e.DOUBLE=1032]="DOUBLE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK"}(ES||(ES={})),function(e){e[e.NONE=0]="NONE",e[e.MASK=1]="MASK",e[e.OBSCURED=2]="OBSCURED",e[e.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(AS||(AS={})),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"}(SS||(SS={})),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"}(_S||(_S={})),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"}(RS||(RS={})),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"}(CS||(CS={})),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"}(OS||(OS={})),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"}(LS||(LS={}));var tb,rb,ib,nb,ob,ab,sb,ub;!function(e){e[e.portrait=1]="portrait",e[e.landscape=0]="landscape"}(tb||(tb={})),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"}(rb||(rb={})),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"}(ib||(ib={})),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"}(nb||(nb={})),function(e){e[e.destroy=0]="destroy",e[e.loop=5]="loop",e[e.freeze=4]="freeze"}(ob||(ob={})),function(e){e[e.destroyChildren=6]="destroyChildren"}(ab||(ab={})),function(e){e[e.none=0]="none",e[e.removeParticle=1]="removeParticle"}(sb||(sb={})),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"}(ub||(ub={}));var cb,lb,fb,hb,pb,db,mb,vb,yb;!function(e){e[e.box=2]="box",e[e.sphere=3]="sphere"}(cb||(cb={})),function(e){e.unlit="unlit",e.pbr="pbr",e.hair="hair"}(lb||(lb={})),function(e){e[e.opaque=100]="opaque",e[e.masked=101]="masked",e[e.translucent=102]="translucent",e[e.additive=103]="additive"}(fb||(fb={})),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"}(hb||(hb={})),function(e){e[e.display=0]="display",e[e.clip=1]="clip",e[e.ellipsis=2]="ellipsis"}(pb||(pb={})),function(e){e[e.top=0]="top",e[e.middle=1]="middle",e[e.bottom=2]="bottom"}(db||(db={})),function(e){e[e.left=0]="left",e[e.middle=1]="middle",e[e.right=2]="right"}(mb||(mb={})),function(e){e.normal="normal",e.bold="bold",e.lighter="lighter"}(vb||(vb={})),function(e){e.normal="normal",e.italic="italic",e.oblique="oblique"}(yb||(yb={}));var gb,Tb=Object.freeze({__proto__:null,get BezierKeyframeType(){return nb},get BlendingMode(){return xS},BloomFilterThresholdAvgColor:0,CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return tb},get CompositionEndBehavior(){return rb},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 yb},get InteractBehavior(){return RS},get InteractType(){return _S},get ItemEndBehavior(){return ob},get ItemType(){return CS},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return AS},get MaterialBlending(){return fb},get MaterialType(){return lb},get ModelBoundingType(){return cb},get ParentItemEndBehavior(){return ab},get ParticleInteractionBehavior(){return sb},get ParticleOrigin(){return LS},get PluginType(){return bS},get RenderLevel(){return TS},get RenderMode(){return OS},get RenderMode3D(){return hb},get ShapeArcMode(){return ub},get ShapeType(){return SS},get SideMode(){return ES},get TextAlignment(){return mb},get TextBaseline(){return db},get TextOverflow(){return pb},get TextWeight(){return vb},get ValueType(){return ib}}),xb=((gb={})[LS.PARTICLE_ORIGIN_CENTER]=[0,0],gb[LS.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],gb[LS.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],gb[LS.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],gb[LS.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],gb[LS.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],gb[LS.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],gb[LS.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],gb[LS.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],gb);function Eb(e,t,r){return e>r?r:e<t?t:e}function Ab(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function Sb(e,t){return e?[e[0]-.5,.5-e[1]]:t?xb[t]:[0,0]}var bb,_b,Rb=(bb=new Float32Array(1),_b=new Int32Array(bb.buffer),function(e){bb[0]=e;var t=_b[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)}),Cb=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]=Rb(e[r])}return e.prototype.set=function(e,t){for(var r=0;r<e.length;r++)this.data[r+t]=Rb(e[r])},e}(),Ob=Math.PI/180;function Lb(e,t){var r=iS(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 Ib(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function Pb(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 Mb(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 wb(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,T=c*d,x=l*d,E=f*h,A=f*p,S=f*d,b=i[0],_=i[1],R=i[2],C=(1-(g+x))*b,O=(v+S)*b,L=(y-A)*b,I=(v-S)*_,P=(1-(m+x))*_,M=(T+E)*_,w=(y+A)*R,F=(T-E)*R,N=(1-(m+g))*R;return e[0]=C,e[1]=O,e[2]=L,e[3]=0,e[4]=I,e[5]=P,e[6]=M,e[7]=0,e[8]=w,e[9]=F,e[10]=N,e[11]=0,e[12]=o*C+a*I+s*w-o+r[0],e[13]=o*O+a*P+s*F-a+r[1],e[14]=o*L+a*M+s*N-s+r[2],e[15]=1,e}function Fb(e,t){if(Mb(t))return Gb(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,T=r*u-n*a,x=r*c-o*a,E=i*u-n*s,A=i*c-o*s,S=n*c-o*u,b=l*m-f*d,_=l*v-h*d,R=l*y-p*d,C=f*v-h*m,O=f*y-p*m,L=h*y-p*v,I=g*L-T*O+x*C+E*R-A*_+S*b;if(!I){for(var P=0;P<16;P++)e[P]=NaN;return e}return I=1/I,e[0]=(s*L-u*O+c*C)*I,e[1]=(n*O-i*L-o*C)*I,e[2]=(m*S-v*A+y*E)*I,e[3]=(h*A-f*S-p*E)*I,e[4]=(u*R-a*L-c*_)*I,e[5]=(r*L-n*R+o*_)*I,e[6]=(v*x-d*S-y*T)*I,e[7]=(l*S-h*x+p*T)*I,e[8]=(a*O-s*R+c*b)*I,e[9]=(i*R-r*O-o*b)*I,e[10]=(d*A-m*x+y*g)*I,e[11]=(f*x-l*A-p*g)*I,e[12]=(s*_-a*C-u*b)*I,e[13]=(r*C-i*_+n*b)*I,e[14]=(m*T-d*E-v*g)*I,e[15]=(l*E-f*T+h*g)*I,e}function Nb(e,t,r){if(Mb(t))return Gb(e,r),e;if(Mb(r))return Gb(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],T=r[0],x=r[1],E=r[2],A=r[3];return e[0]=T*i+x*s+E*f+A*m,e[1]=T*n+x*u+E*h+A*v,e[2]=T*o+x*c+E*p+A*y,e[3]=T*a+x*l+E*d+A*g,T=r[4],x=r[5],E=r[6],A=r[7],e[4]=T*i+x*s+E*f+A*m,e[5]=T*n+x*u+E*h+A*v,e[6]=T*o+x*c+E*p+A*y,e[7]=T*a+x*l+E*d+A*g,T=r[8],x=r[9],E=r[10],A=r[11],e[8]=T*i+x*s+E*f+A*m,e[9]=T*n+x*u+E*h+A*v,e[10]=T*o+x*c+E*p+A*y,e[11]=T*a+x*l+E*d+A*g,T=r[12],x=r[13],E=r[14],A=r[15],e[12]=T*i+x*s+E*f+A*m,e[13]=T*n+x*u+E*h+A*v,e[14]=T*o+x*c+E*p+A*y,e[15]=T*a+x*l+E*d+A*g,e}function Db(e,t,r,i,n,o){var a,s=1/Math.tan(t*Ob/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 Vb=new Float32Array(9),Ub=[0,0,0,1];function Bb(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 kb(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];Vb[0]=n*p,Vb[1]=o*p,Vb[2]=a*p,Vb[3]=s*d,Vb[4]=u*d,Vb[5]=c*d,Vb[6]=l*m,Vb[7]=f*m,Vb[8]=h*m;var v=Vb[0]+Vb[4]+Vb[8],y=void 0;if(v>0)y=Math.sqrt(v+1),Ub[3]=.5*y,y=.5/y,Ub[0]=(Vb[5]-Vb[7])*y,Ub[1]=(Vb[6]-Vb[2])*y,Ub[2]=(Vb[1]-Vb[3])*y;else{var g=0;Vb[4]>Vb[0]&&(g=1),Vb[8]>Vb[3*g+g]&&(g=2);var T=(g+1)%3,x=(g+2)%3;y=Math.sqrt(Vb[3*g+g]-Vb[3*T+T]-Vb[3*x+x]+1),Ub[g]=.5*y,y=.5/y,Ub[3]=(Vb[3*T+x]-Vb[3*x+T])*y,Ub[T]=(Vb[3*T+g]+Vb[3*g+T])*y,Ub[x]=(Vb[3*x+g]+Vb[3*g+x])*y}r[0]=Ub[0],r[1]=Ub[1],r[2]=Ub[2],r[3]=Ub[3]}}function zb(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]),Bb(e)<0&&(i[0]=-i[0]),kb(e,t,r,i)}function Gb(e,t){for(var r=0;r<16;r++)e[r]=t[r];return e}var jb=Math.PI/180,Xb=180/Math.PI,Hb=Math.cos,Yb=Math.sin;function Wb(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]+r[i];return e}function Zb(e,t){for(var r=0,i=e.length;r<i;r++)e[r]=t;return e}var qb=Number.EPSILON||Math.pow(2,-32);function Kb(e){for(var t=0,r=e.length;t<r;t++)if(Math.abs(e[t])>qb)return!1;return!0}function Qb(e){return cR(e)?[e[0],e[1],e[2]]:[0,0,0]}function Jb(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 $b(e,t,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)e[n]=t[n+i];return e}function e_(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 t_(e,t){1===arguments.length&&(t=e,e=[]);var r=t,i=Math.hypot.apply(Math,nS([],iS(r),!1));if(0===i)return $b(e,r,r.length);for(var n=0;n<r.length;n++)e[n]=r[n]/i;return e}function r_(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]*r;return e}function i_(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]-r[i];return e}function n_(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 o_(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 a_(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 s_(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 u_(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 c_=[0,0,0,0,0,0,0,0,0];function l_(e,t){e||(e=c_);var r=Yb(t),i=Hb(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 f_(e,t){return function(e,t,r,i){var n=Hb(t*jb),o=Hb(r*jb),a=Hb(i*jb),s=Yb(t*jb),u=Yb(r*jb),c=Yb(i*jb);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 h_(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(Eb(-s,-1,1))*Xb,Math.abs(s)<.9999999?(e[0]=Math.atan2(u,c)*Xb,e[2]=Math.atan2(o,i)*Xb):(e[0]=0,e[2]=Math.atan2(-n,a)*Xb)}(e,t),e}var p_=Math.PI/180,d_=Math.cos,m_=Math.sin;function v_(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 y_(e,t,r,i){var n=d_(t*p_/2),o=d_(r*p_/2),a=d_(i*p_/2),s=m_(t*p_/2),u=m_(r*p_/2),c=m_(i*p_/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 g_(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 T_=[0,0,0];function x_(e,t,r){var i,n=null!==(i=r.position)&&void 0!==i?i:[0,0,0],o=[0,0,0];return s_(o,[e,t,0],r.getInverseViewProjectionMatrix()),i_(o,o,n),{center:n,direction:t_([],o)}}function E_(e,t,r,i,n){i_(T_,i,t);var o=o_(r,T_);if(o<0)return null;r_(T_,r,o),Wb(T_,t,T_);var a=n_(i,T_),s=n*n;return a>s?null:(r_(e,r,o-Math.sqrt(s-a)),Wb(e,e,t))}function A_(e,t,r,i,n){var o,a,s,u,c,l,f=iS(r,3),h=f[0],p=f[1],d=f[2],m=iS(t,3),v=m[0],y=m[1],g=m[2],T=i[0]-n[0]/2,x=i[0]+n[0]/2,E=i[1]-n[1]/2,A=i[1]+n[1]/2,S=i[2]-n[2]/2,b=i[2]+n[2]/2,_=1/h,R=1/p,C=1/d;return _>=0?(o=(T-v)*_,a=(x-v)*_):(o=(x-v)*_,a=(T-v)*_),R>=0?(s=(E-y)*R,u=(A-y)*R):(s=(A-y)*R,u=(E-y)*R),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),C>=0?(c=(S-g)*C,l=(b-g)*C):(c=(b-g)*C,l=(S-g)*C),o>l||c>a?null:((c>o||o!=o)&&(o=c),(l<a||a!=a)&&(a=l),a<0?null:(r_(e,t,o>=0?o:a),Wb(e,e,t))))}var S_=[0,0,0],b_=[0,0,0],__=[0,0,0],R_=[0,0,0];function C_(e,t,r){var i=iS(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 O_(e,t,r,i,n){var o,a,s,u,c,l=r;if(i_(S_,i[1],i[0]),i_(b_,i[2],i[0]),i_(R_,t,i[0]),a_(__,S_,b_),(a=o_(l,__))>0){if(n)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}return a_(b_,R_,b_),s=o_(l=r,b_),(s*=o)<0?null:(a_(S_,S_,R_),u=o_(l=r,S_),(u*=o)<0||s+u>a?null:(c=o_(R_,__),(c*=-o)<0?null:(r_(e,r,c/a),Wb(e,e,t))))}var L_=[0,0],I_=[0,0],P_=[0,0];var M_,w_=[];function F_(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],T=[c[0]-g[0],c[1]-g[1],c[2]-g[2]],x=v.asRotation,E=Jb(T,T,f_(w_,y.map((function(e){var t=v[e];return t?x?t.getValue(l):t.getIntegrateValue(0,i,n):0}))));c=Wb(c,g,E)}if(m.enabled){var A=m.asMovement;for(d=0;d<3;d++){var S=m[y[d]];S&&(c[d]+=A?S.getValue(l):S.getIntegrateValue(0,i,n))}}return c}var N_="not_implement",D_=function(){function e(e){this.onCreate(e)}return e.prototype.onCreate=function(e){throw Error(N_)},e.prototype.getIntegrateValue=function(e,t,r){throw Error(N_)},e.prototype.getIntegrateByTime=function(e,t){throw Error(N_)},e.prototype.getValue=function(e){throw Error(N_)},e.prototype.toUniform=function(e){throw Error(N_)},e.prototype.map=function(e){throw Error(N_)},e.prototype.scaleXCoord=function(e){return this},e}(),V_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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}(D_),U_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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}(D_),B_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t.prototype.onCreate=function(e){this.min=e[0],this.max=e[1]},t.prototype.getValue=function(e){return pR(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}(D_),k_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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}(D_),z_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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 K_(t,0,this.xCoord,this.min,this.max)-K_(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}(D_),G_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t.prototype.onCreate=function(e){this.stops=GS(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 jS(n.color,o.color,a,!0)}}return t[r].color.slice()},t}(D_),j_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t.getAllData=function(e,t){for(var r=new(t?Cb: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(cR(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 Q_(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?$_:J_,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}(D_),X_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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?K_:q_,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}(D_),H_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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=(Q_(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}(D_),Y_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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}(H_),W_=((M_={})[ib.RANDOM]=function(e){return e[0]instanceof Array?new k_(e):new B_(e)},M_[ib.CONSTANT]=function(e){return new V_(e)},M_[ib.CONSTANT_VEC2]=function(e){return new V_(e)},M_[ib.CONSTANT_VEC3]=function(e){return new V_(e)},M_[ib.CONSTANT_VEC4]=function(e){return new V_(e)},M_[ib.CURVE]=function(e){return new j_(e)},M_[ib.RGBA_COLOR]=function(e){return new V_(e)},M_[ib.COLORS]=function(e){return new U_(e.map((function(e){return kS(e,!1)})))},M_[ib.LINE]=function(e){return 2===e.length&&0===e[0][0]&&1===e[1][0]?new z_([e[0][1],e[1][1]]):new X_(e)},M_[ib.GRADIENT_COLOR]=function(e){return new G_(e)},M_[ib.LINEAR_PATH]=function(e){return new H_(e)},M_[ib.BEZIER_PATH]=function(e){return new Y_(e)},M_);function Z_(e){if(!e||!isNaN(+e))return new V_(e||0);if(e instanceof D_)return e;if(lR(W_[e[0]]))return W_[e[0]](e[1]);throw new Error("ValueType: ".concat(e[0]," is not support"))}function q_(e,t,r,i,n){var o=e-t;return(i+i+(n-i)*o/(r-t))*o/2}function K_(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 Q_(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 J_(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 $_(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 eR(e,t){if(t){var r=t[0],i=t[1];if(r===ib.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===ib.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 tR(){return{curves:[],index:0,max:0,lineSegCount:0,curveCount:0}}var rR,iR=[0,0,0],nR=[1,1,1],oR=[0,0,0],aR=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:nS([],iS(o.position),!1),rotation:nS([],iS(o.getRotation()),!1),scale:[u[0],u[1],u[2]]},n.path&&(this.basicTransform.path=Z_(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===ob.loop,gravity:Qb(n.gravity),gravityModifier:Z_(null!==(r=n.gravityOverLifetime)&&void 0!==r?r:0),direction:n.direction?t_([],n.direction):Qb(),endBehavior:s||0};var c=e.sizeOverLifetime;c&&(c.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Z_(c.x||1),this.sizeYOverLifetime=Z_(c.y||1),this.sizeZOverLifetime=Z_(c.z||1)):this.sizeXOverLifetime=Z_(c.size||1));var l=n.linearX||n.linearY||n.linearZ;l&&(this.linearVelOverLifetime={x:n.linearX&&Z_(n.linearX),y:n.linearY&&Z_(n.linearY),z:n.linearZ&&Z_(n.linearZ),asMovement:n.asMovement,enabled:!!l});var f=n.orbitalX||n.orbitalY||n.orbitalZ;f&&(this.orbitalVelOverLifetime={x:n.orbitalX&&Z_(n.orbitalX),y:n.orbitalY&&Z_(n.orbitalY),z:n.orbitalZ&&Z_(n.orbitalZ),center:Qb(n.orbCenter),asRotation:n.asRotation,enabled:!!f}),this.speedOverLifetime=n.speedOverLifetime&&Z_(n.speedOverLifetime);var h=e.rotationOverLifetime;if(h&&(this.rotationOverLifetime={asRotation:h.asRotation,separateAxes:h.separateAxes,z:Z_(h.z||0)},h.separateAxes)){var p=this.rotationOverLifetime;p.x=Z_(h.x||0),p.y=Z_(h.y||0)}this.gravityModifier=this.options.gravityModifier}return e.prototype.getVelocity=function(){return this.velocity||(this.velocity=r_([],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&&!Kb(this.options.gravity)||this.options.startSpeed&&!Kb(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=Zb(nR,1),a=Zb(iR,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=Wb(iR,f.rotation,a);l.transform.setRotation(y[0],y[1],y[2])}(this.willTranslate()||t)&&(h=F_(Zb(nR,0),this,n.gravity,s,u,f.position,this.getVelocity()));if(f.path&&(h||(h=$b(oR,f.position,3)),Wb(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 sR(){}function uR(e){return"string"==typeof e}e.DestroyOptions=void 0,(rR=e.DestroyOptions||(e.DestroyOptions={}))[rR.destroy=0]="destroy",rR[rR.keep=1]="keep",rR[rR.force=0]="force";var cR=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function lR(e){return"[object Function]"===Object.prototype.toString.call(e)}function fR(e){return"[object Object]"===Object.prototype.toString.call(e)}function hR(e){if(cR(e))return e.map(hR);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]=hR(e[n])}return t}return e}function pR(e,t){return e+Math.random()*(t-e)}function dR(){throw Error("destroyed item cannot be used again")}var mR=new Array(9).fill(0),vR=new Array(4).fill(0),yR=1,gR=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=Ib(),this.localMatrix=Ib(),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(yR++),e&&this.setTransform(e),t&&(this.parentTransform=t),void 0!==e.valid&&this.setValid(e.valid)}return e.getRotation=function(e,t){return g_(vR,t),h_(e,Lb(mR,vR))},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,y_(this.quat,e,t,r),g_(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,h_(this.rotation,Lb(mR,[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){v_(this.quat,this.quat,e),h_(this.rotation,Lb(mR,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){DS(this.children,e)},e.prototype.removeChild=function(e){VS(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&&(wb(this.localMatrix,this.quat,this.position,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):Mb(this.localMatrix)||(Pb(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?Nb(this.worldMatrix,t,e):Gb(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&&(zb(this.getWorldMatrix(),e.position,e.quat,e.scale),this.dirtyFlags.worldMatrix=!1),nS([],iS(this.worldTRSCache.scale),!1)},e.prototype.getWorldPosition=function(){return this.updateTRSCache(),nS([],iS(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&&$b(e,this.worldTRSCache.position,3),t&&$b(t,this.worldTRSCache.quat,4),r&&$b(r,this.worldTRSCache.scale,3)},e.prototype.cloneFromMatrix=function(e,t){t?(kb(e,this.position,this.quat,t),$b(this.scale,t,3)):zb(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:(Pb(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;zb(e,t.position,t.quat,t.scale),this.dirtyFlags.worldMatrix=!1}},e.prototype.dispatchValueChange=function(){this.children.forEach((function(e){e.parentMatrixDirty=!0}))},e}(),TR=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 gR($A({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(lS["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 CS.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 gR({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];y_(i,e,t,r),g_(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=iS(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=iS(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 xR(e,t){var r=e.type,i=e.pluginName;if(!i)switch(r){case CS.null:case CS.base:i="cal";break;case CS.sprite:i="sprite";break;case CS.particle:i="particle";break;case CS.interact:i="interact";break;case CS.camera:i="camera";break;case CS.filter:i="filter";break;case CS.text:i="text";break;case aS:i=aS;break;default:throw new Error("invalid vfx item type")}return t.pluginSystem.createPluginItem(i,e,t)}var ER={},AR=[],SR={};function bR(e,t,r,i){SR[e]=r,ER[e]=t,i&&DS(AR,e)}var _R=function(){function e(e){var t={},r=[],i=function(e){var i=ER[e];r.includes(i)||(r.push(i),t[e]=i)};AR.forEach(i),e.forEach(i),this.plugins=Object.keys(t).map((function(e){var t=ER[e];if(!t)throw new Error("plugin '".concat(e,"' not found.")+function(e){var t=RR[e];return t?"\nInstall Plugin: npm i ".concat(t,"@latest --save\nImport Plugin: import '").concat(t,"'"):""}(e));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=SR[e];if(!i)throw new Error("plugin ".concat(e," no registered constructor"));var n=new i(t,r);if(!(n instanceof TR))throw new Error("plugin ".concat(e," invalid constructor type"));return n},e.prototype.processRawJSON=function(e,t){return eS(this,void 0,void 0,(function(){return tS(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 eS(this,void 0,void 0,(function(){var r,i,n,o,a;return tS(this,(function(s){for(r=[],i=this.plugins,n=0;n<i.length;n++)o=i[n],a=ER[o.name],e in a&&r.push(Promise.resolve(a[e].apply(a,nS([],iS(t),!1))));return[2,Promise.all(r)]}))}))},e.prototype.precompile=function(e,t,r){return eS(this,void 0,void 0,(function(){return tS(this,(function(i){return[2,this.callStatic("precompile",e,t,r)]}))}))},e.prototype.loadResources=function(e,t){return eS(this,void 0,void 0,(function(){return tS(this,(function(r){return[2,this.callStatic("prepareResource",e,t)]}))}))},e}(),RR={"alipay-downgrade":"@galacean/effects-plugin-alipay-downgrade","editor-gizmo":"@galacean/effects-plugin-editor-gizmo",tree:"@galacean/effects-plugin-model",model:"@galacean/effects-plugin-model","orientation-transformer":"@galacean/effects-plugin-orientation-transformer",spine:"@galacean/effects-plugin-spine"};var CR,OR=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}(),LR=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:$b([0,0,0],i,3),rotation:$b([0,0,0],n,3),near:Z_(a),far:Z_(s),fov:Z_(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&&Z_(f),x:Z_(p),y:Z_(m),z:Z_(y)}}if(t.rotationOverLifetime){var g=t.rotationOverLifetime,T=g.separateAxes,x=g.x,E=void 0===x?0:x,A=g.y,S=void 0===A?0:A,b=g.z,_=void 0===b?0:b;this.rotationOverLifetime={separateAxes:T,x:Z_(E),y:Z_(S),z:Z_(_)}}}return e.prototype.update=function(e){var t=[0,0,0,1],r=[0,0,0],i=[0,0,0];$b(r,this.options.position,3),$b(i,this.options.rotation,3);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(e=Eb(e,0,1),n&&(r[0]+=n.x.getValue(e),r[1]+=n.y.getValue(e),r[2]+=n.z.getValue(e),n.path&&Wb(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=gR.getRotation(i,t)},e}(),IR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t}(OR),PR=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return CS.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 LR(this.transform,this.model)),this.controller},t}(TR);e.HitTestType=void 0,(CR=e.HitTestType||(e.HitTestType={}))[CR.triangle=1]="triangle",CR[CR.box=2]="box",CR[CR.sphere=3]="sphere",CR[CR.custom=4]="custom";var MR,wR,FR="click",NR="touchstart",DR="touchmove",VR="touchend",UR=RS,BR=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}};WS()&&(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=kR(s);t=u.x,r=u.y,n=i={clientX:s.clientX,clientY:s.clientY,ts:performance.now(),x:t,y:r},a.dispatchEvent(NR,l(e,t,r))}},e[u]=function(e){if(i&&a.enabled){var n=kR(o(e));t=n.x,r=n.y,a.dispatchEvent(DR,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=kR(n),u=Math.abs(i.clientX-n.clientX)+Math.abs(i.clientY-n.clientY);t=s.x,r=s.y,u<4&&a.dispatchEvent(FR,l(e,t,r)),a.dispatchEvent(VR,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]=[]),DS(r,t),function(){VS(r,t)}},e.prototype.removeEventListener=function(e,t){var r=this.handlers[e];r&&VS(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 kR(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 zR(e){switch(e){case xS.ALPHA:case xS.ADD:case xS.SUBTRACTION:case xS.STRONG_LIGHT:case xS.WEAK_LIGHT:return 1;case xS.SUPERPOSITION:return 2;case xS.BRIGHTNESS:return 3;case xS.MULTIPLY:return 0;default:return 1}}e.ShaderType=void 0,(MR=e.ShaderType||(e.ShaderType={}))[MR.vertex=0]="vertex",MR[MR.fragment=1]="fragment";var GR,jR,XR=((wR={})[e.ShaderType.vertex]={in:"attribute",out:"varying"},wR[e.ShaderType.fragment]={in:"varying"},wR);function HR(e,t,r,i){var n=[],o="";n.push("#define GE_RUNTIME"),e&&(e.forEach((function(e){var t=iS(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=XR[r][e])&&void 0!==t?t:e}))),s=s.replace(l,"\n")}return s}function YR(e,t){switch(t){case void 0:case xS.ALPHA:e.blendFunction=[dS.ONE,dS.ONE_MINUS_SRC_ALPHA,dS.ONE,dS.ONE_MINUS_SRC_ALPHA];break;case xS.ADD:e.blendFunction=[dS.ONE,dS.ONE,dS.ONE,dS.ONE];break;case xS.SUBTRACTION:e.blendFunction=[dS.ONE,dS.ONE,dS.ZERO,dS.ONE],e.blendEquation=[dS.FUNC_REVERSE_SUBTRACT,dS.FUNC_REVERSE_SUBTRACT];break;case xS.SUPERPOSITION:e.blendFunction=[dS.ONE,dS.ONE,dS.ONE,dS.ONE];break;case xS.MULTIPLY:e.blendFunction=[dS.DST_COLOR,dS.ONE_MINUS_SRC_ALPHA,dS.DST_COLOR,dS.ONE_MINUS_SRC_ALPHA];break;case xS.BRIGHTNESS:e.blendFunction=[dS.ONE,dS.ONE_MINUS_SRC_ALPHA,dS.ONE,dS.ONE_MINUS_SRC_ALPHA];break;case xS.STRONG_LIGHT:e.blendFunction=[dS.DST_COLOR,dS.DST_ALPHA,dS.ZERO,dS.ONE];break;case xS.WEAK_LIGHT:e.blendFunction=[dS.DST_COLOR,dS.ZERO,dS.ZERO,dS.ONE];break;default:console.warn("blendMode ".concat(t," not in specification, please set blend params separately"))}}function WR(e,t){t===ES.DOUBLE?e.culling=!1:(e.culling=!0,e.frontFace=dS.CW,e.cullFace=t===ES.BACK?dS.BACK:dS.FRONT)}function ZR(e,t){switch(t){case void 0:e.stencilTest=!1;break;case AS.MASK:e.stencilTest=!0,e.stencilFunc=[dS.ALWAYS,dS.ALWAYS],e.stencilOpZPass=[dS.REPLACE,dS.REPLACE];break;case AS.OBSCURED:e.stencilTest=!0,e.stencilFunc=[dS.EQUAL,dS.EQUAL];break;case AS.REVERSE_OBSCURED:e.stencilTest=!0,e.stencilFunc=[dS.NOTEQUAL,dS.NOTEQUAL];break;case AS.NONE:e.stencilTest=!1;break;default:console.warn("maskMode ".concat(t," not in specification, please set stencil params seperately"))}}e.TextureLoadAction=void 0,(GR=e.TextureLoadAction||(e.TextureLoadAction={}))[GR.whatever=0]="whatever",GR[GR.clear=2]="clear",e.TextureSourceType=void 0,(jR=e.TextureSourceType||(e.TextureSourceType={}))[jR.none=0]="none",jR[jR.data=1]="data",jR[jR.image=2]="image",jR[jR.compressed=3]="compressed",jR[jR.video=4]="video",jR[jR.canvas=5]="canvas",jR[jR.framebuffer=6]="framebuffer",jR[jR.mipmaps=7]="mipmaps";var qR=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}(),KR=!1;function QR(e,t){return eS(this,void 0,void 0,(function(){return tS(this,(function(r){switch(r.label){case 0:return!KR&&t?[3,2]:[4,JR(e)];case 1:case 5:return[2,{image:r.sent(),url:e}];case 2:return r.trys.push([2,4,,6]),[4,JR(t)];case 3:return[2,{image:r.sent(),url:t}];case 4:return r.sent(),KR=!0,[4,JR(e)];case 6:return[2]}}))}))}function JR(e){return eS(this,void 0,void 0,(function(){var t,r;return tS(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 $R(e){return eS(this,void 0,void 0,(function(){return tS(this,(function(t){return[2,new Promise((function(t,r){(new qR).downloadBinary(e,t,(function(t,i){r("Couldn't load bins ".concat(e,": status ").concat(t,", ").concat(i))}))}))]}))}))}function eC(e,t){return void 0===t&&(t={}),eS(this,void 0,void 0,(function(){var r;return tS(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()})),YS()&&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 tC(t,r,i){return void 0===i&&(i=[]),eS(this,void 0,void 0,(function(){var n,o,a,s,u,c,l;return tS(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 rC(e,r)})))})),[4,Promise.all(u)]);case 1:return c=f.sent(),l=i[a[0][0][1][0]].url,[2,$A($A({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 rC(e,r)})),[4,Promise.all(u)];case 3:return c=f.sent(),l=i[a[0][1][0]].url,[2,$A($A({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 rC(e,t){return eS(this,void 0,void 0,(function(){var r,i,n,o,a;return tS(this,(function(s){if(r=iS(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,JR(new Blob([new Uint8Array(a,n,o)]))]}))}))}var iC=1,nC=function(){function t(){this.destroyed=!1,this.id="Tex"+iC++}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?dS.TEXTURE_2D:r,n=t.format,o=void 0===n?dS.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),$A({minFilter:dS.NEAREST,magFilter:dS.NEAREST,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE,target:i,format:dS.RGBA,internalFormat:o,type:dS.UNSIGNED_BYTE},t)},t}();function oC(e,t,r,i){var n,o,a=t.length/r/i;return o=n=4===a||0===a?dS.RGBA:3===a?dS.RGB:2===a?dS.LUMINANCE_ALPHA:dS.LUMINANCE,nC.createWithData(e,{data:t,width:r,height:i},{type:dS.HALF_FLOAT,format:n,internalFormat:o,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE})}var aC="galacean-effects",sC="lookup_texture",uC="offscreen_canvas",cC={};function lC(e){return cC[e]}var fC=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:aC}):console.warn({content:"texture arrays not currently supported",type:aC}):console.warn({content:"only 2D textures currently supported",type:aC})}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 hC(t){var r=new fC(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?dS.TEXTURE_CUBE_MAP:dS.TEXTURE_2D,internalFormat:u,format:c,mipmaps:r.mipmaps(l)}}var pC,dC=function(){function t(){this.reloadPending={}}return t.prototype.reload=function(e){return eS(this,void 0,void 0,(function(){var t,r;return tS(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===dS.TEXTURE_CUBE_MAP?"object"==typeof o&&!!o:uR(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===dS.TEXTURE_CUBE_MAP?f.every((function(e){return"object"==typeof e&&e})):h.every((function(e){return uR(e)&&e.length>0}))}}return!1},t.prototype.loadSource=function(t,r){return eS(this,void 0,void 0,(function(){var i,n,o,a,s,u,c,l,f,h,p,d,m,v,y,g,T,x=this;return tS(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!==dS.TEXTURE_CUBE_MAP||i===e.TextureSourceType.mipmaps?[3,2]:[4,this.loadCubeMap(o)];case 1:return h=E.sent(),[2,$A($A({},r),{cube:h,target:dS.TEXTURE_CUBE_MAP,sourceType:e.TextureSourceType.image,sourceFrom:{type:e.TextureSourceType.image,map:$A({},o),target:dS.TEXTURE_CUBE_MAP}})];case 2:return i!==e.TextureSourceType.image?[3,4]:[4,JR(a)];case 3:return p=E.sent(),[2,$A($A({},r),{image:p,sourceType:e.TextureSourceType.image,sourceFrom:{type:i,url:a,target:dS.TEXTURE_2D}})];case 4:return i!==e.TextureSourceType.video?[3,6]:[4,eC(a)];case 5:return d=E.sent(),[2,$A($A({},r),{video:d,sourceType:e.TextureSourceType.video})];case 6:return i!==e.TextureSourceType.compressed?[3,8]:[4,$R(a)];case 7:return m=E.sent(),[2,$A($A($A({},hC(m)),r),{sourceFrom:{url:a,type:e.TextureSourceType.compressed}})];case 8:return i!==e.TextureSourceType.mipmaps?[3,17]:u?[4,$R(u)]:[3,13];case 9:return v=E.sent(),y=null!=n?n:dS.TEXTURE_2D,g=y===dS.TEXTURE_2D?c.slice():c.map((function(e){return e.slice()})),T=void 0,n!==dS.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(c.map((function(e){return x.loadMipmapImages(e,v)})))];case 10:return T=E.sent(),[3,12];case 11:T=this.loadMipmapImages(c,v),E.label=12;case 12:return[2,$A($A({},r),{mipmaps:T,target:y,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{bin:u,mipmaps:g,target:y,type:e.TextureSourceType.mipmaps}})];case 13:return n!==dS.TEXTURE_2D&&n?[3,15]:[4,Promise.all(l.map((function(e){return JR(e)})))];case 14:return T=E.sent(),[2,$A($A({},r),{mipmaps:T,target:dS.TEXTURE_2D,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{type:i,urls:l.slice(),target:dS.TEXTURE_2D}})];case 15:return n!==dS.TEXTURE_CUBE_MAP?[3,17]:[4,Promise.all(f.map((function(e){return x.loadCubeMap(e)})))];case 16:return T=E.sent(),[2,$A($A({},r),{mipmaps:T,target:dS.TEXTURE_CUBE_MAP,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{type:i,maps:f.map((function(e){return $A({},e)})),target:dS.TEXTURE_CUBE_MAP}})];case 17:throw new Error("Invalid resource type: ".concat(i))}}))}))},t.prototype.loadMipmapImages=function(e,t){return eS(this,void 0,void 0,(function(){return tS(this,(function(r){return[2,Promise.all(e.map((function(e){return JR(new Blob([new Uint8Array(t,e[0],e[1])]))})))]}))}))},t.prototype.loadCubeMap=function(e){return eS(this,void 0,void 0,(function(){return tS(this,(function(t){return[2,Promise.all(e.map((function(e){return JR(e)})))]}))}))},t}();function mC(){return pC||(pC=new dC),pC}var vC,yC=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 gC(e){return"object"==typeof e&&e&&void 0===e.length&&e instanceof nC}e.MaterialRenderType=void 0,(vC=e.MaterialRenderType||(e.MaterialRenderType={}))[vC.normal=0]="normal",vC[vC.transformFeedback=1]="transformFeedback";var TC,xC,EC=1,AC=function(){function t(t){this.props=t,this.destroyed=!1,this.initialized=!1;var r=t.name,i=void 0===r?"Material"+EC++: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=$A({},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}(),SC="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,(TC=e.ShaderCompileResultStatus||(e.ShaderCompileResultStatus={}))[TC.noShader=0]="noShader",TC[TC.success=1]="success",TC[TC.fail=2]="fail",TC[TC.compiling=3]="compiling",e.GLSLVersion=void 0,(xC=e.GLSLVersion||(e.GLSLVersion={})).GLSL1="100",xC.GLSL3="300 es";var bC=function(e){this.source=e},_C="effects-internal-copy",RC="effects-internal-copy-mesh",CC="\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}",OC="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(SC,"\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 LC(t,r){var i=2===t,n=i?"#version 300 es":"";return{name:_C,vertex:HR([],n+"\n"+CC,e.ShaderType.vertex,t),fragment:HR([],n+"\n"+OC,e.ShaderType.fragment,t),glslVersion:i?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:RC+ +r}}var IC,PC={format:dS.RGBA,type:dS.UNSIGNED_BYTE,minFilter:dS.LINEAR,magFilter:dS.LINEAR,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE},MC=Symbol("dispose"),wC=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(PC).forEach((function(e){var r,i=null!==(r=t[e])&&void 0!==r?r:PC[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;eb(l),c=nC.create(l,a),this.textureCache[u]=c,this.textureRef[u]=1,c[MC]=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[MC](),r.dispose=r[MC]),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[MC](),e.dispose=e[MC]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),FC=function(){function e(e){void 0===e&&(e={}),this.semantics=$A({},e)}return e.prototype.toObject=function(){return $A({},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 lR(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}(),NC=((IC={})[dS.FLOAT]=Float32Array.BYTES_PER_ELEMENT,IC[dS.INT]=Int32Array.BYTES_PER_ELEMENT,IC[dS.SHORT]=Int16Array.BYTES_PER_ELEMENT,IC[dS.BYTE]=Int8Array.BYTES_PER_ELEMENT,IC),DC=function(){function e(e){this.name=e}return e.prototype.initialize=function(){},e.prototype.flush=function(){},e}();function VC(e){return e===dS.INT?new Int32Array(0):e===dS.SHORT?new Int16Array(0):new Float32Array(0)}var UC,BC,kC=1,zC=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"+kC++,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}(),GC=1e3;e.RenderPassAttachmentStorageType=void 0,(UC=e.RenderPassAttachmentStorageType||(e.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",e.TextureStoreAction=void 0,(BC=e.TextureStoreAction||(e.TextureStoreAction={}))[BC.store=0]="store",BC[BC.clear=2]="clear";var jC,XC=function(){function t(t,r){if(this.destroyed=!1,r){var i=r.texture,n=r.size;if(i instanceof nC)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?dS.RGBA:l,h=i.type,p=void 0===h?dS.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=nC.create(t,$A($A({},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,(jC=e.RenderPassDestroyAttachmentType||(e.RenderPassDestroyAttachmentType={}))[jC.force=0]="force",jC[jC.keep=1]="keep",jC[jC.keepExternal=2]="keepExternal",jC[jC.destroy=0]="destroy";var HC=1,YC=function(){function t(t,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+HC++: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=KS(d.slice(),this.meshOrder),this.depthStencilType=(null==s?void 0:s.storageType)||e.RenderPassAttachmentStorageType.none,this.clearAction=$A({},o),this.storeAction=$A({colorAction:e.TextureStoreAction.store,depthAction:e.TextureStoreAction.store,stencilAction:e.TextureStoreAction.store},u),this.semantics=new FC(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){QS(this.meshes,e,this.meshOrder)},t.prototype.removeMesh=function(e){VS(this.meshes,e)},t.prototype.setMeshes=function(e){var t;return this.meshes.length=0,(t=this.meshes).splice.apply(t,nS([0,0],iS(e),!1)),KS(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=iS(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 XC(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 XC(i.renderer.engine,$A({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=MO.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=dR}},t}(),WC="#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);}",ZC="#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);}}",qC="#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}",KC="#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",QC="#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}}",JC="#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}",$C="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);}",eO="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));}",tO="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",rO="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);}",iO="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.));}",nO="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.);}",oO="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);}",aO="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;}",sO="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",uO="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);}",cO="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);}",lO="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);}",fO="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);}",hO="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);}",pO=function(t){function r(r,i){var n=t.call(this,r,i)||this,o=n.renderer.engine,a=DC.create(o,{mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s=AC.create(o,{shader:{vertex:sO,fragment:hO,glslVersion:e.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=zC.create(o,{geometry:a,material:s,priority:0}),n.priority=5e3,n}return JA(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}(YC),dO=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=DC.create(a,{name:s,mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),c={vertex:sO,fragment:"H"==i?cO:lO,glslVersion:e.GLSLVersion.GLSL1},l=AC.create(a,{name:s,shader:c});return l.blending=!1,l.depthTest=!1,l.culling=!1,o.screenMesh=zC.create(a,{name:s,geometry:u,material:l,priority:0}),o.priority=5e3,o}return JA(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",EO(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFrameBuffer().getColorTextures()[0])},r}(YC),mO=function(t){function r(e,r){var i=t.call(this,e,r)||this,n="PostProcess",o=i.renderer.engine,a=DC.create(o,{name:n,mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),s={vertex:sO,fragment:fO},u=AC.create(o,{name:n,shader:s});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=zC.create(o,{name:n,geometry:a,material:u,priority:0}),i.priority=5e3,i}return JA(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",EO(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},r}(YC),vO=function(t){function r(r,i){var n=t.call(this,r,{})||this,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new XC(a);var s=DC.create(a,{name:o,mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),u=AC.create(a,{name:o,shader:{vertex:sO,fragment:uO,glslVersion:e.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=zC.create(a,{name:o,geometry:s,material:u,priority:0}),n.priority=5e3,n}return JA(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}(YC),yO={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,useToneMapping:1},gO="_effects_default_",TO=1,xO=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=$A($A({},yO),u)),this.globalUniforms=new SO;var h,p=[],d={};if(this.renderer=o,this.globalVolume){var m=this.globalVolume.useHDR?dS.HALF_FLOAT:dS.UNSIGNED_BYTE;p=[{texture:{format:dS.RGBA,type:m,magFilter:dS.LINEAR,minFilter:dS.LINEAR}}],h={storageType:e.RenderPassAttachmentStorageType.depth_stencil_opaque},d={colorAction:e.TextureLoadAction.clear,stencilAction:e.TextureLoadAction.clear,depthAction:e.TextureLoadAction.clear}}var v=[new YC(o,{name:gO,priority:GC,meshOrder:e.OrderType.ascending,depthStencilAttachment:h,attachments:p,clearAction:d})];if(this.setRenderPasses(v),this.globalVolume){var y=this.globalVolume.useBloom,g=new XC(f);if(y){var T=[0,0,this.renderer.getWidth()/2,this.renderer.getHeight()/2],x=new Array(7),E=(m=this.globalVolume.useHDR?dS.HALF_FLOAT:dS.UNSIGNED_BYTE,new pO(o,{name:"BloomThresholdPass",attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]}));E.sceneTextureHandle=g,this.addRenderPass(E);for(var A=0;A<7;A++){x[A]=new XC(f);var S=new dO(o,"H",{name:"GaussianDownPassH"+A,viewport:T,attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]}),b=new dO(o,"V",{name:"GaussianDownPassV"+A,viewport:T,attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]});b.gaussianResult=x[A],this.addRenderPass(S),this.addRenderPass(b),T[2]/=2,T[3]/=2}T[2]*=4,T[3]*=4;for(A=0;A<6;A++){var _=new mO(o,{name:"GaussianUpPass"+A,viewport:T,attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]});_.gaussianDownSampleResult=x[5-A],this.addRenderPass(_),T[2]*=2,T[3]*=2}}var R=void 0;R=y?new vO(o,g):new vO(o),this.addRenderPass(R)}this.semantics=new FC(t.semantics),this.clearAction=l,this.name="RenderFrame".concat(TO++);var C=v[0],O={type:dS.UNSIGNED_BYTE,format:dS.RGBA,internalFormat:dS.RGBA,wrapS:dS.MIRRORED_REPEAT,wrapT:dS.MIRRORED_REPEAT,minFilter:dS.NEAREST,magFilter:dS.NEAREST};this.emptyTexture=nC.create(f,$A({data:{width:1,height:1,data:new Uint8Array([255,255,255,255])},sourceType:e.TextureSourceType.data},O)),this.transparentTexture=nC.create(f,$A({data:{width:1,height:1,data:new Uint8Array([0,0,0,0])},sourceType:e.TextureSourceType.data},O)),this.camera=i,this.keepColorBuffer=n,this.renderPassInfoMap.set(C,{listStart:0,listEnd:0,renderPass:C,intermedia:!1}),this.editorTransform=s,t.clearAction||this.resetClearActions(),this.passTextureCache=new wC(f);var L=f.gpuCapability,I=L.detail,P=LC(L.level,I.readableDepthStencilTextures&&I.writableFragDepth);null===(r=this.renderer.getShaderLibrary())||void 0===r||r.addShader(P)}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(gO);)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===_C;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}),VS(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=$A($A({},(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],VS(h,s);var d=f.get(s);f.delete(s);var m=2===this.renderer.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,v=new YC(this.renderer,{name:gO+p,priority:s.priority,attachments:[{texture:{sourceType:e.TextureSourceType.framebuffer,format:dS.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=[],T=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,nS([a+1,0],iS(g),!1)),T.splice(0,2));var x=this.resource.finalCopyRP;y.includes(x)||y.push(x);var E=g[g.length-1];E.initialize(this.renderer);var A=new YC(this.renderer,{name:gO+(p+1),priority:s.priority+1+((null===(n=r.prePasses)||void 0===n?void 0:n.length)||0),meshes:T,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,A),this.setRenderPasses(y),this.updateRenderInfo(E),this.updateRenderInfo(v),this.updateRenderInfo(A),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(gO)||!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===dS.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===_C?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?dS.LINEAR:dS.NEAREST,c=nC.create(r,{sourceType:e.TextureSourceType.framebuffer,format:dS.RGBA,name:"frame_a",minFilter:u,magFilter:u}),l=nC.create(r,{sourceType:e.TextureSourceType.framebuffer,format:dS.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 YC(this.renderer,{depthStencilAttachment:{storageType:f},attachments:[{texture:c}]}).initialize(this.renderer),p=new AO(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=_C,r=this.renderer.engine,i=DC.create(r,{name:t,mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),n=LC(r.gpuCapability.level,!!(null==e?void 0:e.depthTexture));this.renderer.getShaderLibrary().addShader(n);var o=AC.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=[dS.SRC_ALPHA,dS.ONE_MINUS_SRC_ALPHA,dS.SRC_ALPHA,dS.ONE_MINUS_SRC_ALPHA]),zC.create(r,{name:t,geometry:i,material:o,priority:0})},t.prototype.removeRenderPass=function(e){VS(this._renderPasses,e)},t}();function EO(e){return e?[e.getWidth(),e.getHeight()]:[0,0]}var AO=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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",EO(this.prePassTexture)),e.renderMeshes(this.meshes),this.storeAction&&e.clear(this.storeAction)},t}(YC),SO=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},bO=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}(),_O="function"==typeof WebGL2RenderingContext,RO=function(){function e(e){this.setupCapability(e)}return e.prototype.setupCapability=function(e){var t,r=_O&&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=CO(e,e.HALF_FLOAT)),i&&!s&&(s=CO(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:PO(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 CO(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 OO,LO,IO={NONE:0,PVRTC:1,ASTC:2};function PO(e){return e.getExtension("WEBGL_compressed_texture_astc")?IO.ASTC:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?IO.PVRTC:IO.NONE}e.FilterMode=void 0,(OO=e.FilterMode||(e.FilterMode={}))[OO.Nearest=0]="Nearest",OO[OO.Linear=1]="Linear",e.RenderTextureFormat=void 0,(LO=e.RenderTextureFormat||(e.RenderTextureFormat={}))[LO.RGBA32=0]="RGBA32",LO[LO.RGBAHalf=1]="RGBAHalf";var MO=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}(),wO=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}(),FO=1,NO=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=nS([],iS(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)===sS]],n=Z_(this.color).getValue(0),o=this.engine.gpuCapability.level,a={shader:{vertex:HR(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:HR(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=AC.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 DC.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:dS.LINES,maxVertex:4})},t.prototype.createMesh=function(e,t){return zC.create(this.engine,{name:"Interact_preview"+FO++,priority:0,worldMatrix:Ib(),geometry:e,material:t})},t}(),DO=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 JA(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return CS.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===_S.DRAG&&(o!==sS||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,VO(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=C_([0,0,0],.5,.5);return r.forEach((function(e){e.forEach((function(e){s_(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(eb(o),i===_S.CLICK&&(this.clickable=!0,n&&a===sS)){var s=e.getRendererOptions();this.previewContent=new NO(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(!VO(t,3)&&t){t.vx*=5,t.vy*=5,r.dragEvent=$A({},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=iS(n.dxRange,2);(d=Eb(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,T=iS(n.dyRange,2);(m=Eb(m,y=T[0],g=T[1]))!==y&&m!==g&&y!==g&&(null===(i=t.origin)||void 0===i||i.preventDefault())}this.composition.camera.position=[d,m,l]}},r}(TR);function VO(e,t){var r=1e-5*(t||1);return e&&Math.abs(e.vx||0)<r&&Math.abs(e.vy||0)<r}var UO=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.mesh=[],t}return JA(t,e),t.prototype.onCompositionItemLifeBegin=function(e,t){t instanceof DO&&t.previewContent&&this.addMesh(t.previewContent.mesh)},t.prototype.onCompositionItemRemoved=function(e,t){t instanceof DO&&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}(OR),BO=function(){};e.maxSpriteMeshItemCount=8,e.maxSpriteTextureCount=8;var kO=1,zO=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?dS.LINES:dS.TRIANGLES),o=this.createMaterial(t,2);this.wireframe=i,this.mesh=zC.create(e,{name:"MSprite"+kO++,priority:0,worldMatrix:Ib(),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++){(_=null==(m=t[d])?void 0:m.renderer.texture)&&DS(s,_),m.mesh=this}for(d=0;d<t.length;d++){var m,v=(_=null==(m=t[d])?void 0:m.renderer.texture)?s.indexOf(_):-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)},T={aPoint:0,index:0},x=function(e){var t=a[e];Object.keys(g).forEach((function(e){var r=g[e],i=t[e];r.set(i,T[e]),T[e]+=i.length}))};for(d=0;d<a.length;d++)x(d);var E=this.mesh,A=E.material,S=E.geometry,b=g.index;S.setIndexData(b),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 _=s[d];A.setTexture("uSampler"+d,_)}for(var R=t[0].emptyTexture,C=s.length;C<e.maxSpriteMeshItemCount;C++)A.setTexture("uSampler"+C,R);if(this.splitLayer){var O=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=nC.createWithData(e,{width:i,height:1,data:n},{name:"feather",format:dS.LUMINANCE,minFilter:dS.LINEAR,magFilter:dS.LINEAR,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE})}else r=nC.createWithData(e);return r}(this.engine,t[0].feather);A.setTexture("uFeatherSampler",O)}},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 DC.create(this.engine,{attributes:{aPoint:{size:4,offset:0,stride:oS*r,releasable:!0,type:dS.FLOAT,data:new Float32Array(0)},aIndex:{size:2,offset:4*r,stride:oS*r,dataSource:"aPoint",type:dS.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:YO(e,t,h.gpuCapability.level,null===(n=h.renderer)||void 0===n?void 0:n.env)};this.preMultiAlpha=zR(u),this.mtlSlotCount=t;var d=AC.create(h,p),m=$A({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&&YR(d,m.blendMode),d.blendFunction=m.blendFunction,ZR(d,m.maskMode),WR(d,m.side);var v=f.uniformValues;if(v)try{for(var y=rS(Object.keys(v)),g=y.next();!g.done;g=y.next()){var T=g.value,x=v[T];x instanceof nC?d.setTexture(T,x):"number"==typeof x?d.setFloat(T,x):2===x.length?d.setVector2(T,x):4===x.length?d.setVector4(T,x):d.setMatrix(T,x)}}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=[],A=[],S=[],b=0;b<t;b++)E.push(Ib()),A.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",A),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=iS(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 T=0;T<y;T++){var x=4*(2*T+g),E=n?[0,0,1,1,r[0][4]]:r[2*T+g],A=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,b=((T+T+1)/y-1)/2,_=E[0],R=E[1],C=E[4]?E[3]:E[2],O=E[4]?E[2]:E[3],L=[p[0]/v+S,p[1]/y+b,p[2]/v+S,p[3]/y+b,p[4]/v+S,p[5]/y+b,p[6]/v+S,p[7]/y+b];d.push(L[0]*a,L[1]*s,A[0]*C+_,A[1]*O+R,t,0,L[2]*a,L[3]*s,A[2]*C+_,A[3]*O+R,t,0,L[4]*a,L[5]*s,A[4]*C+_,A[5]*O+R,t,0,L[6]*a,L[7]*s,A[6]*C+_,A[7]*O+R,t,0),this.lineMode?m.push(x,1+x,1+x,3+x,3+x,2+x,2+x,x):m.push(x,1+x,2+x,2+x,1+x,3+x)}return{index:m,aPoint:d}},t}();function GO(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)}function jO(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 XO(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===sS],["ADJUST_LAYER",!!r],["USE_BLEND",!c],["MAX_FRAG_TEX",e.maxSpriteTextureCount>=16?16:8]],h=l?WC:qC.replace(/#pragma\s+FILTER_FRAG/,(null==r?void 0:r.fragment)||""),p=ZC.replace(/#pragma\s+FILTER_VERT/,(null==r?void 0:r.vertex)||"vec4 filterMain(float t,vec4 pos){return effects_MatrixVP * pos;}");return{fragment:HR(f,h,e.ShaderType.fragment,t),vertex:HR(f,p,e.ShaderType.vertex,t),glslVersion:1===t?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,marcos:f,shared:!0}}function HO(e,t){return e.filter?"".concat(e.filter.mesh.shaderCacheId,"_effects_filter"):"".concat(e.cachePrefix,"_effects_sprite_").concat(t)}function YO(e,t,r,i){var n=e.filter,o=e.wireframe,a=XO(r,null==n?void 0:n.mesh,{count:t,wireframe:o,env:i});return a.shared=!0,o||(a.cacheId=HO(e,t)),a}var WO="listIndex",ZO=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(qO(x=u[y]))l.push.apply(l,nS([],iS(this.removeMeshSplitsItem(d,x,s,u)),!1)),this.check();else{var g=d.indexOf(x);g>-1&&(d.splice(g,1),v.length=0,g>0&&(v=this.combineSplits(d,g-1,s),l.push.apply(l,nS([],iS(v),!1))),!v.length&&g<=d.length-1&&(v=this.combineSplits(d,g,s),l.push.apply(l,nS([],iS(v),!1))),this.check())}}var T=!1;for(y=0;y<c.length;y++)for(var x=c[y],E=this.addMeshSplitsItem(d,x,s),A=0;A<E.length;A++){var S=E[A];if(S.spriteMesh)throw new Error("no sprite mesh in neo split");var b=S.spriteMesh=new zO(this.engine,S.renderInfo,this.composition);f.push(b.mesh),b.setItems(S.items.map((function(e){return e.content}))),b.applyChange(),b.splitLayer&&(null===(t=m.layerToAdd)||void 0===t||t.push(b)),S.dirty=!1,this.check(),T=!0}if(T){var _,R=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=C.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)?VS(f,v):DS(h,v),s.splice(t+1,1),t--}}_=t},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=(I=s[y]).spriteMesh;if(0===I.items.length)throw new Error("split not combined");if(I.dirty){var L=I.indexStart;O.mesh.priority!==L&&(O.mesh.priority=L,p.push(O.mesh)),O.setItems(I.items.map((function(e){return e.content})))}O.applyChange(),I.dirty=!1}if(l.length)for(y=0;y<l.length;y++){var I,P=(b=(I=l[y]).spriteMesh).mesh;P.dispose({material:{textures:e.DestroyOptions.keep}}),h.push(P)}if(this.itemsToRemove.length=0,this.itemsToAdd.length=0,f.length+h.length+p.length){var M=this.meshes;return this.meshSplits.forEach((function(e,t){return M[t]=e.spriteMesh.mesh})),M.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)?VS(this.itemsToRemove,e):DS(this.itemsToAdd,e)},t.prototype.removeItem=function(e){this.items.includes(e)?qO(e)?this.itemsToRemove.unshift(e):this.itemsToRemove.push(e):VS(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(US(e,t,WO),qO(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(qO(t)){if(o<=n.indexEnd){US(e,t,WO);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 US(e,t,WO),{value:[]};if(o<n.indexEnd){US(e,t,WO);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(US(e,t,WO),qO(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,VS(e,t),0===a.items.length){if(VS(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(qO(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(qO(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===CS.sprite&&o.items.length<e.maxSpriteMeshItemCount&&h+o.textures.length<=e.maxSpriteTextureCount?(US(o.items,u,WO),DS(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 qO(e){var t=e.type;return t===CS.sprite||t===CS.filter}var KO={blending:0,cacheId:"-",mask:0,maskMode:0,occlusion:!1,side:0,cachePrefix:"-"},QO=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="sprite",e}return JA(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[HO(KO,2)]){o.addShader(YO(KO,2,s,c)),o.addShader(YO(KO,e.maxSpriteMeshItemCount,s,c));var l=!1;null===(n=t[0])||void 0===n||n.items.forEach((function(e){e.type===CS.filter&&e.content.filter&&(l=!0,FS(e.content.filter).forEach((function(e){if(!e.isParticle){var t=XO(s,e,e);e.shaderCacheId&&(t.cacheId="".concat(e.shaderCacheId,"_effects_filter")),o.addShader(t)}})))})),l&&o.addShader(LC(s,!1)),u.writableFragDepth&&o.addShader(LC(s,!0))}return Promise.resolve()},r.prototype.onCompositionDestroyed=function(e){e.loaderData.spriteGroup.dispose()},r.prototype.onCompositionReset=function(e,t){var r=new ZO(e);e.loaderData.spriteGroup=r,r.resetMeshSplits()},r.prototype.onCompositionItemLifeBegin=function(e,t){var r=e.loaderData.spriteGroup;t.type!==CS.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}(OR),JO=[0,0,0],$O=[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:nS([],iS(this.transform.position),!1),rotation:nS([],iS(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=Z_(s.path));var u=s.linearX||s.linearY||s.linearZ;u&&(this.linearVelOverLifetime={x:s.linearX&&Z_(s.linearX),y:s.linearY&&Z_(s.linearY),z:s.linearZ&&Z_(s.linearZ),asMovement:s.asMovement,enabled:!!u});var c=s.orbitalX||s.orbitalY||s.orbitalZ;c&&(this.orbitalVelOverLifetime={x:s.orbitalX&&Z_(s.orbitalX),y:s.orbitalY&&Z_(s.orbitalY),z:s.orbitalZ&&Z_(s.orbitalZ),center:Qb(s.orbCenter),asRotation:s.asRotation,enabled:!!c}),this.speedOverLifetime=s.speedOverLifetime&&Z_(s.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Z_(o.x||1),this.sizeYOverLifetime=Z_(o.y||1),this.sizeZOverLifetime=Z_(o.z||1)):this.sizeXOverLifetime=Z_(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:Z_(n.z||0)},n.separateAxes)){var l=this.rotationOverLifetime;l.x=Z_(n.x||0),l.y=Z_(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===ob.loop,endBehavior:t.endBehavior||0,gravity:Qb(s.gravity),gravityModifier:Z_(null!==(r=s.gravityOverLifetime)&&void 0!==r?r:0),direction:s.direction?t_([],s.direction):Qb()},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=r_([],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&&!Kb(this.options.gravity)||this.options.startSpeed&&!Kb(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=Zb($O,1),n=Zb(JO,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=Wb(JO,this.basicTransform.rotation,n);l.transform.setRotation(v[0],v[1],v[2])}return(this.getWillTranslate()||t)&&F_(f=[0,0,0],this,this.options.gravity,s,u,this.basicTransform.position,this.velocity),this.basicTransform.path&&(f||(f=$b(eL,this.basicTransform.position,3)),Wb(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,T=i.transform.scale;h.options=$A($A({},h.options),{startColor:m.startColor||[1,1,1,1]}),h.interaction=p,h.renderer={renderMode:null!==(n=d.renderMode)&&void 0!==n?n:OS.BILLBOARD,blending:null!==(o=d.blending)&&void 0!==o?o:xS.ALPHA,texture:h.initTexture(d.texture,g),occlusion:!!d.occlusion,transparentOcclusion:!!d.transparentOcclusion||d.maskMode===AS.MASK,side:null!==(a=d.side)&&void 0!==a?a:ES.DOUBLE,shape:d.shape,mask:null!==(s=d.mask)&&void 0!==s?s:0,maskMode:null!==(u=d.maskMode)&&void 0!==u?u:AS.NONE,order:y};var x=Sb(d.anchor,d.particleOrigin);d.anchor||void 0===d.particleOrigin||Wb(h.basicTransform.position,h.basicTransform.position,[-x[0]*T[0],-x[1]*T[1],0]),h.transform.setAnchor(x[0]*T[0],x[1]*T[1],0);var E=t.colorOverLifetime;return E&&(h.opacityOverLifetime=Z_(null!==(c=E.opacity)&&void 0!==c?c:1),E.color&&E.color[0]===ib.GRADIENT_COLOR&&(h.colorOverLifetime=GS(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=Z_(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=jO(h),h}return JA(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=Zb(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=zS(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 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 T=void 0,x=void 0;y?(T=1/f.row*m,x=1/f.col*v):(T=1/f.col*m,x=1/f.row*v);var E=void 0;if(f.animate){var A=Math.round(u*(h-1)),S=Math.floor(A/f.col),b=A-S*f.col;E=y?[T*S,x*(f.col-b)]:[T*b,x*(1+S)]}else E=[0,x];n.texOffset=[p+E[0],v+d-E[1],T,x]}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 JA(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return CS.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=C_([0,0,0],i[0]/2,i[1]/2);return n.forEach((function(e){e.forEach((function(e){s_(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===ES.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 zO(this.composition.getEngine(),$A({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}(TR),aL=1,sL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return CS.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=rS(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=NS(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,T=t.textureFlip,x=t.useSprite,E=t.name,A=t.filter,S=t.gravity,b=t.forceTarget,_=t.side,R=t.occlusion,C=t.anchor,O=t.blending,L=t.maskMode,I=t.mask,P=t.transparentOcclusion,M=t.listIndex,w=t.meshSlots,F=t.renderMode,N=void 0===F?0:F;t.matrix;var D,V,U=t.diffuse,B=void 0===U?nC.createWithData(s):U,k=s.gpuCapability.detail,z=k.halfFloatTexture,G=k.maxVertexUniforms,j=[["RENDER_MODE",+N],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",u===sS]],X=s.gpuCapability.level,H={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},Y={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},W=G>0,Z={},q=0,K=0;if(this.useSprite=x,W&&j.push(["ENABLE_VERTEX_TEXTURE",!0]),c&&(j.push(["SPEED_OVER_LIFETIME",!0]),K|=2,Z.uSpeedLifetimeValue=c.toUniform(H)),(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),A&&A.name!==uS){j.push(["USE_FILTER",!0]),K|=8;var Q=NS(A,r.composition);if(!Q.particle)throw new Error("particle filter ".concat(A.name," not implement"));D=Q.particle,Object.keys(null!==(n=D.uniforms)&&void 0!==n?n:{}).forEach((function(e){var t,r=null===(t=D.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(H)})),Object.keys(null!==(o=D.uniformValues)&&void 0!==o?o:{}).forEach((function(e){var t,r=null===(t=D.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 nC?l.color:nC.createWithData(s,qS(l.color))),(null==l?void 0:l.opacity)?Z.uOpacityOverLifetimeValue=l.opacity.toUniform(H):Z.uOpacityOverLifetimeValue=Z_(1).toUniform(H),["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(H),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(H),i=1,K|=1<<10+t,V=!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),V&&((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(H),(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(H)),(null==d?void 0:d.z)&&(Z.uRZByLifeTimeValue=d.z.toUniform(H),K|=32768,j.push(["ROT_Z_LIFETIME",1])),(null==d?void 0:d.x)&&(Z.uRXByLifeTimeValue=d.x.toUniform(H),K|=65536,j.push(["ROT_X_LIFETIME",1])),(null==d?void 0:d.y)&&(Z.uRYByLifeTimeValue=d.y.toUniform(H),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(H),b&&(j.push(["FINAL_TARGET",!0]),K|=1<<19,Z.uFinalTarget=new Float32Array(b.target||[0,0,0]),Z.uForceCurve=b.curve.toUniform(H)),z&&Y.max?(K|=1<<20,Z.uFCurveValueTexture=oC(s,j_.getAllData(Y,!0),Y.index,1)):Z.uFCurveValues=j_.getAllData(Y);var J=H.max+H.curves.length-32>G;if(2===X&&(H.max=-1,H.index=w?w[0]:lL(H.index),Y.index>0&&(Y.max=-1,Y.index=w?w[1]:lL(Y.index))),J&&z&&W){var $=oC(s,j_.getAllData(H,!0),H.index,1);Z.uVCurveValueTexture=$,q=1}else Z.uVCurveValues=j_.getAllData(H);var ee=["-p:",N,K,H.index,H.max,Y.index,Y.max].join("+");j.push(["VERT_CURVE_VALUE_COUNT",H.index],["FRAG_CURVE_VALUE_COUNT",Y.index],["VERT_MAX_KEY_FRAME_COUNT",H.max],["FRAG_MAX_KEY_FRAME_COUNT",Y.max]);var te=A?KC.replace(/#pragma\s+FILTER_FRAG/,D.fragment):KC,re="#define LOOKUP_TEXTURE_CURVE ".concat(q,"\n").concat(QC),ie=A?re.replace(/#pragma\s+FILTER_VERT/,D.vertex||"void filterMain(float t){}\n"):re,ne={fragment:HR(j,te,e.ShaderType.fragment,X),vertex:HR(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)};A&&(ne.cacheId+=A.name);var oe={shader:ne,uniformSemantics:{effects_MatrixV:"VIEW",effects_MatrixVP:"VIEWPROJECTION",uEditorTransform:"EDITOR_TRANSFORM",effects_ObjectToWorld:"MODEL"}},ae=zR(O);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,+(!!R&&!P)]),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=AC.create(s,oe);se.blending=!0,se.depthTest=!0,se.depthMask=!!R,se.stencilRef=I?[I,I]:void 0,ZR(se,L),YR(se,O),WR(se,_);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 nC)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=DC.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=zC.create(s,{name:"MParticle_".concat(E),priority:M,material:se,geometry:ce});this.anchor=C,this.mesh=le,this.geometry=le.firstGeometry(),this.forceTarget=b,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=T?[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=F_([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),gR.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,T=[-.5,.5,-.5,-.5,.5,.5,.5,-.5],x=Math.random(),E=void 0;c&&(E=e.sprite);for(var A=0;A<4;A++){var S=2*A,b=3*A,_=4*A,R=12*A,C=8*A;u.aPos.set(l,R),u.aPos.set(y,R+3),u.aRot.set(f,C),u.aRot[C+3]=x,u.aRot.set(g,C+4),c&&u.aSprite.set(E,b);var O=e.uv||v;if(O){var L=c?1-d[S+1]:d[S+1];m[0]=O[0]+d[S]*O[2],m[1]=O[1]+L*O[3]}u.aOffset.set(m,_);for(var I=A+A,P=(T[I]-this.anchor[0])*p[0],M=(T[I+1]-this.anchor[1])*p[1],w=0;w<3;w++)u.aPos[R+6+w]=e.dirX[w]*P,u.aPos[R+9+w]=e.dirY[w]*M}var F=new Uint16Array([0,1,2,2,1,3].map((function(e){return e+4*t})));if(a){var N=BS(o.getIndexData(),6*i,s,6*r);N.set(F,6*t),o.setIndexData(N),this.maxParticleBufferCount=N.length/6}else o.setIndexSubData(6*t,F);Object.keys(u).forEach((function(e){var i=u[e],c=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(a){var l=BS(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===sS]],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,eR(p,v));var T=u.textureSheetAnimation;T&&T.animate&&(l.push(["USE_SPRITE",!0]),g|=4);var x=void 0;if(u.filter&&u.filter.name!==uS){l.push(["USE_FILTER",!0]),g|=8;var E=FS(u.filter).find((function(e){return e.isParticle}));if(!E)throw Error("particle filter ".concat(u.filter.name," not implement"));x=E,null===(o=E.uniforms)||void 0===o||o.forEach((function(e){return eR(p,e)}))}var A=u.colorOverLifetime;A&&A.color&&(l.push(["COLOR_OVER_LIFETIME",!0]),g|=16);var S=A&&A.opacity;S&&eR(p,S);var b,_=u.positionOverLifetime;["x","y","z"].forEach((function(e,t){var r=0,i="linear"+e.toUpperCase(),n="orbital"+e.toUpperCase();(null==_?void 0:_[i])&&(eR(p,_[i]),r=1,g|=1<<7+t),l.push(["LINEAR_VEL_".concat(e.toUpperCase()),r]);var o=0;(null==_?void 0:_[n])&&(eR(p,_[n]),o=1,g|=1<<10+t,b=!0),l.push(["ORB_VEL_".concat(e.toUpperCase()),o])})),(null==_?void 0:_.asMovement)&&(l.push(["AS_LINEAR_MOVEMENT",!0]),g|=32),b&&(null==_?void 0:_.asRotation)&&(l.push(["AS_ORBITAL_MOVEMENT",!0]),g|=64);var R=u.sizeOverLifetime;eR(p,null==R?void 0:R.x),(null==R?void 0:R.separateAxes)&&(l.push(["SIZE_Y_BY_LIFE",1]),g|=16384,eR(p,null==R?void 0:R.y));var C=u.rotationOverLifetime;(null==C?void 0:C.z)&&(eR(p,null==C?void 0:C.z),g|=32768,l.push(["ROT_Z_LIFETIME",1])),(null==C?void 0:C.separateAxes)&&(C.x&&(eR(p,C.x),g|=65536,l.push(["ROT_X_LIFETIME",1])),C.y&&(eR(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),eR(p,null==_?void 0:_.gravityOverLifetime),(null==_?void 0:_.forceTarget)&&(l.push(["FINAL_TARGET",!0]),g|=1<<19,eR(p,_.forceCurve));var O=h.halfFloatTexture;O&&d.max&&(g|=1<<20);var L=h.maxVertexUniforms,I=p.max+p.curves.length-32>L;lC(sC)&&(I=!0),2===f&&(p.max=-1,d.index>0&&(d.max=-1)),I&&O&&m&&(y=1);var P=["-p:",c,g,p.index,p.max,d.index,d.max].join("+"),M={fragment:KC,vertex:"#define LOOKUP_TEXTURE_CURVE ".concat(y,"\n").concat(QC),shared:!0,cacheId:P,marcos:l,name:"particle#".concat(e.name)};return x&&(M.fragment=M.fragment.replace(/#pragma\s+FILTER_FRAG/,null!==(a=x.fragment)&&void 0!==a?a:""),M.vertex=M.vertex.replace(/#pragma\s+FILTER_VERT/,x.vertex||"void filterMain(float t){}\n"),M.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:M,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)*cS,r=[Math.cos(t)*this.radius,Math.sin(t)*this.radius,0],i=o_([],r,Math.tan(this.angle*cS));return i[2]+=1,{position:o_(r,r,pR(0,1)),direction:t_(i,i)}},e}();function vL(e,t,r){if(t===ub.RANDOM)e=pR(0,e);else if(t===ub.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);e=e/r.total*i}else if(t===ub.BIDIRECTIONAL_CYCLE){var n=(i=r.index/(r.total+1))-Math.floor(i);e*=Math.floor(i)%2?1-n:n}else t===ub.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)*cS,r=[Math.cos(t),Math.sin(t),0],i=this.radius;return{direction:r,position:r.map((function(e){return e*i}))}},e}(),TL=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:[pR(-this._d,this._d),pR(-this._h,this._h),0]}},e}(),xL=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)*cS,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===ub.UNIFORM_BURST?e.burstIndex%e.burstCount/(e.burstCount-1):pR(0,1);return{direction:[0,1,0],position:[this._d*(t-.5),0,0]}},e}(),AL=[],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=pR(0,2*Math.PI),n=vL(this.arc,this.arcMode,e)*cS,o=l_(AL,n),a=[Math.cos(i),Math.sin(i),0],s=[r+Math.cos(i)*t,0,Math.sin(i)*t];return{direction:Jb(a,a,o),position:Jb(s,s,o)}},e}(),bL=[],_L=function(){function e(e){var t=this;Object.keys(e).forEach((function(r){t[r]=e[r]}))}return e.prototype.getHorizontalAngle=function(){return pR(-90,90)},e.prototype.generate=function(e){var t=vL(this.arc,this.arcMode,e)*cS,r=this.getHorizontalAngle()*cS,i=this.radius,n=[Math.cos(r),0,Math.sin(r)],o=Jb(n,n,l_(bL,t));return{position:o.map((function(e){return e*i})),direction:o}},e}(),RL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t.prototype.getHorizontalAngle=function(){return pR(0,90)},t}(_L),CL=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=Eb(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:t_(a,a)}},e}(),OL=function(){function e(){}return e.prototype.generate=function(){return{position:[0,0,0],direction:[0,0,0]}},e}(),LL=((yL={})[SS.NONE]=OL,yL[SS.CONE]=mL,yL[SS.SPHERE]=_L,yL[SS.HEMISPHERE]=RL,yL[SS.CIRCLE]=gL,yL[SS.DONUT]=SL,yL[SS.RECTANGLE]=TL,yL[SS.EDGE]=EL,yL[SS.RECTANGLE_EDGE]=xL,yL[SS.TEXTURE]=CL,yL);function IL(e){if(!e)return new OL;var t=$A({radius:1,arc:360,angle:0,arcMode:ub.RANDOM},e),r=e.type,i=LL[r];if(!i)throw Error("invalid shape:"+r);var n=new i(t);if(r!==SS.NONE){var o=e,a=o.alignSpeedDirection,s=o.upDirection,u=void 0===s?[0,0,1]:s;n.alignSpeedDirection=a,n.upDirection=t_(u)}return n}function PL(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 ML(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 wL(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 FL(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 DL(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),WL(i,e)&&(u<h||u===h&&(i.x>r.x||i.x===r.x&&VL(r,i)))&&(r=i,h=u)),i=i.next}while(i!==c);return r}(e,t),t){var r=ZL(t,e);ML(t,t.next),ML(r,r.next)}}function VL(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)&&(WL(e,t)&&WL(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=YL(GL(e,t,r)),o=YL(GL(e,t,i)),a=YL(GL(r,i,e)),s=YL(GL(r,i,t));return n!==o&&a!==s||(!(0!==n||!HL(e,r,t))||(!(0!==o||!HL(e,i,t))||(!(0!==a||!HL(r,e,i))||!(0!==s||!HL(r,t,i)))))}function HL(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 YL(e){return e>0?1:e<0?-1:0}function WL(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=PL(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=PL(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++)DL(s[n],r),r=ML(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?FL(e,i,n,o):wL(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(ML(e),t,r),t,r,i,n,o,2):2===a&&rI(e,t,r,i,n,o):eI(ML(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)&&WL(n,o)&&WL(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 ML(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=ML(a,a.next),u=ML(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+=(x=n[s]).length-1}var u,c=new Float32Array(a*oS),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],T=0===u?0:-Math.PI/2;for(s=0;s<n.length;s++)for(var x=n[s],E=o[s],A=o[s+1]||o[0],S=x,b=[0,0],_=0;_<S.length-1;_++){sI(b,S[_],E,A,E[4],E[5],A[2],A[3]),C(b[0],b[1])}var R=$L(Array.from(c),null,oS,f);return{aPoint:c,index:new Uint16Array(R)};function C(e,t){c[p++]=e/2,c[p++]=t/2,h?(g[0]=e,g[1]=t,aI(g,g,T),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:[ib.SHAPE_POINTS,e.p],s:[ib.SHAPE_SPLITS,e.s]})})):e.g?t.push({p:[ib.SHAPE_POINTS,e.g.p],s:[ib.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 D_?i:Z_(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?Z_(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,T=t.minimumVertexDistance,x=t.lifetime,E=t.matrix,A=r.gpuCapability,S=A.detail,b=A.level,_=Math.max(t.pointCountPerTrail,2),R={curves:[],index:0,max:0,lineSegCount:0,curveCount:0},C=S.maxVertexTextures>0,O=(null!==(i=r.renderer)&&void 0!==i?i:{}).env,L={},I=[["ENABLE_VERTEX_TEXTURE",C],["LOOKUP_TEXTURE_CURVE",0],["ENV_EDITOR",O===sS]],P=a>64,M=0;n&&(I.push(["COLOR_OVER_LIFETIME",!0]),M|=1,L.uColorOverLifetime=nC.createWithData(r,qS(n))),o&&(I.push(["COLOR_OVER_TRAIL",!0]),M|=4,L.uColorOverTrail=nC.createWithData(r,qS(o))),P?(I.push(["ATTR_TRAIL_START",1]),M|=8):L.uTrailStart=new Float32Array(a),L.uOpacityOverLifetimeValue=u.toUniform(R);var w=c.toUniform(R);I.push(["VERT_CURVE_VALUE_COUNT",R.index],["VERT_MAX_KEY_FRAME_COUNT",R.max]),L.uVCurveValues=j_.getAllData(R);var F={shader:{vertex:HR(I,JC,e.ShaderType.vertex,b),fragment:HR(I,KC,e.ShaderType.fragment,b),marcos:I,glslVersion:1===b?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,shared:!0,name:"trail#".concat(l),cacheId:"-t:+".concat(M,"+").concat(R.index,"+").concat(R.max)},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},N=_*a*2,D=(_-1)*a,V=Float32Array.BYTES_PER_ELEMENT,U=12*V,B={attributes:{aColor:{size:4,stride:U,data:new Float32Array(12*N)},aSeed:{size:1,stride:U,offset:4*V,dataSource:"aColor"},aInfo:{size:3,stride:U,offset:5*V,dataSource:"aColor"},aPos:{size:4,stride:U,offset:8*V,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*D,name:"trail#".concat(l),bufferUsage:dS.DYNAMIC_DRAW};if(P)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*_,j=z*G,X=0;X<G;X++)k[j+X]=z}var H=zR(h),Y=AC.create(r,F);Y.blending=!0,Y.depthMask=f,Y.depthTest=!0,ZR(Y,p),YR(Y,h);var W=this.mesh=zC.create(r,{name:"MTrail_".concat(l),material:Y,geometry:DC.create(r,B),priority:d}),Z=null!=y?y:nC.createWithData(r);Object.keys(L).map((function(e){var t=L[e];if(t instanceof nC)Y.setTexture(e,t);else if("uTrailStart"===e)Y.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]]),Y.setVector4Array(e,r)}else Y.setVector4(e,t)})),Y.setFloat("uTime",0),Y.setVector4("uWidthOverTrail",w),Y.setVector2("uTexOffset",[0,0]),Y.setVector4("uTextureMap",v),Y.setVector4("uParams",[0,_-1,0,0]),Y.setTexture("uMaskTex",Z),Y.setVector4("uColorParams",[y?1:0,+H,0,+(f&&!g)]),this.maxTrailCount=a,this.pointCountPerTrail=_,this.checkVertexDistance=T>0,this.minimumVertexDistance=Math.pow(T||.001,2),this.useAttributeTrailStart=P,this.lifetime=x,E&&(this.mesh.worldMatrix=E),this.geometry=W.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&&n_(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],T=new Float32Array(24);if(T.set(g,0),T.set(d,4),T[7]=0,T.set(t,8),T[11]=.5*m,T.set(g,12),T.set(d,16),T[19]=1,T.set(t,20),T[23]=-.5*m,o.setAttributeSubData("aColor",24*f,T),u>=0){var x=this.getTrailPosition(e,c,lI),E=new Float32Array(mI(x,l,t)),A=6*(e*n+u);o.setAttributeSubData("aDir",A,E),o.setAttributeSubData("aDir",A+3,E);var S=e*n*2,b=new Uint16Array([2*u+S,2*u+1+S,2*s+S,2*s+S,2*u+1+S,2*s+1+S]),_=6*(e*a+(i-1)%a);o.setIndexSubData(_,b)}i=++this.trailCursors[e];var R=this.mesh.material,C=R.getVector4("uParams"),O=d[2];if(this.useAttributeTrailStart){for(var L=2*n,I=new Float32Array(L),P=0;P<L;P++)I[P]=O;o.setAttributeSubData("aTrailStart",e*I.length,I)}else{var M=R.getFloats("uTrailStart");null!=M&&(M[e]=O,R.setFloats("uTrailStart",M))}C&&(C[1]=Math.max(C[1],i-1)-Math.max(0,i-n),R.setVector4("uParams",C))}},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?(t_(pI,i_(pI,t,e)),t_(dI,i_(pI,r,t)),Wb(i,pI,dI)):i_(i,t,e):i_(i,r,t),t_(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,T=r.duration||1,x=y.gravityOverLifetime,E=Qb(y.gravity),A=e.textureSheetAnimation,S=A?{animationDelay:Z_(A.animationDelay||0),animationDuration:Z_(A.animationDuration||1),cycles:Z_(A.cycles||1),animate:A.animate,col:A.col,row:A.row,total:A.total||A.col*A.row}:void 0,b=Ib(),_=!!(g&&g.turbulenceX||g.turbulenceY||g.turbulenceZ);_&&(h=[Z_(null!==(i=g.turbulenceX)&&void 0!==i?i:0),Z_(null!==(n=g.turbulenceY)&&void 0!==n?n:0),Z_(null!==(o=g.turbulenceZ)&&void 0!==o?o:0)]),this.name=f,this.shape=IL(g),this.emission={rateOverTime:Z_(e.emission.rateOverTime),burstOffsets:_I(null!==(a=e.emission.burstOffsets)&&void 0!==a?a:[]),bursts:(e.emission.bursts||[]).map((function(e){return new uI(e)}))},this.textureSheetAnimation=S;var R,C=e.renderer||{},O={},L=e.rotationOverLifetime;L&&(O.asRotation=!!L.asRotation,O.z=L.z?Z_(L.z):Z_(0),L.separateAxes&&(O.x=L.x&&Z_(L.x),O.y=L.y&&Z_(L.y))),y.forceTarget&&(R={target:y.target||[0,0,0],curve:Z_(y.forceCurve||[ib.LINE,[[0,0],[1,1]]])});var I={x:y.linearX&&Z_(y.linearX||0),y:y.linearY&&Z_(y.linearY||0),z:y.linearZ&&Z_(y.linearZ||0),asMovement:y.asMovement},P={x:y.orbitalX&&Z_(y.orbitalX),y:y.orbitalY&&Z_(y.orbitalY),z:y.orbitalZ&&Z_(y.orbitalZ),center:y.orbCenter,asRotation:y.asRotation},M=e.sizeOverLifetime||{},w=e.colorOverLifetime,F=r.listIndex,N=m,D=(null==M?void 0:M.separateAxes)?{separateAxes:!0,x:Z_(M.x),y:Z_(M.y)}:{separateAxes:!1,x:Z_(("size"in M?M.size:M.x)||1)},V=Sb(C.anchor,C.particleOrigin);this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:Z_(v.startLifetime),startDelay:Z_(v.startDelay||0),startSpeed:Z_(y.startSpeed||0),startColor:Z_(v.startColor),endBehavior:l,duration:T,looping:l===ob.loop,maxCount:null!==(s=v.maxCount)&&void 0!==s?s:0,gravityModifier:Z_(x||0).scaleXCoord(T),gravity:E,start3DSize:!!v.start3DSize,startTurbulence:_,turbulence:h,speedOverLifetime:y.speedOverLifetime&&Z_(y.speedOverLifetime),linearVelOverLifetime:I,orbitalVelOverLifetime:P,forceTarget:R},v.startRotationZ&&(this.options.startRotation=Z_(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=Z_(v.startRotationX||0),this.options.startRotationY=Z_(v.startRotationY||0),this.options.startRotationZ=Z_(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=Z_(v.startSizeX),this.options.startSizeY=Z_(v.startSizeY)):(this.options.startSize=Z_(v.startSize),this.options.sizeAspect=Z_(v.sizeAspect||1));var U={listIndex:F,meshSlots:v.meshSlots,name:f,matrix:b,filter:e.filter,shaderCachePrefix:N,renderMode:C.renderMode||OS.BILLBOARD,side:C.side||ES.DOUBLE,gravity:E,duration:r.duration,blending:C.blending||xS.ALPHA,rotationOverLifetime:O,gravityModifier:this.options.gravityModifier,linearVelOverLifetime:this.options.linearVelOverLifetime,orbitalVelOverLifetime:this.options.orbitalVelOverLifetime,speedOverLifetime:this.options.speedOverLifetime,sprite:S,occlusion:!!C.occlusion,transparentOcclusion:!!C.transparentOcclusion,maxCount:v.maxCount,mask:C.mask,maskMode:null!==(u=C.maskMode)&&void 0!==u?u:AS.NONE,forceTarget:R,diffuse:C.texture,sizeOverLifetime:D,anchor:V};if(w){var B=w.color,k=w.opacity;U.colorOverLifetime={},k&&(U.colorOverLifetime.opacity=Z_(w.opacity)),B&&(B[0]===ib.GRADIENT_COLOR?U.colorOverLifetime.color=w.color[1]:B[0]===ib.RGBA_COLOR?U.colorOverLifetime.color=nC.createWithData(p,{data:new Uint8Array(B[1]),width:1,height:1}):B instanceof nC&&(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 H=z?S.row:S.col,Y=z?S.col:S.row,W=S.total||H*Y,Z=0,q=0;q<H;q++)for(var K=0;K<Y&&Z<W;K++,Z++)G.push([q*j[2]/H+j[0],K*j[3]/Y+j[1],j[2]/H,j[3]/Y]);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:Z_(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:b,minimumVertexDistance:Q.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(Q.maxPointPerTrail)||32,blending:Q.blending,texture:Q.texture,opacityOverLifetime:Z_(Q.opacityOverLifetime||1),widthOverTrail:Z_(Q.widthOverTrail||1),order:F+(Q.orderOffset||0),shaderCachePrefix:N,lifetime:this.trails.lifetime,occlusion:!!Q.occlusion,transparentOcclusion:!!Q.transparentOcclusion,textureMap:Q.textureMap,mask:C.mask,maskMode:C.maskMode};Q.colorOverLifetime&&Q.colorOverLifetime[0]===ib.GRADIENT_COLOR&&(J.colorOverLifetime=Q.colorOverLifetime[1]),Q.colorOverTrail&&Q.colorOverTrail[0]===ib.GRADIENT_COLOR&&(J.colorOverTrail=Q.colorOverTrail[1]),this.trailMesh=new fI(J,p)}this.transform=r.transform;var $,ee=nS([],iS(this.transform.position),!1),te=nS([],iS(this.transform.rotation),!1),re=e.emitterTransform&&e.emitterTransform.path;re&&(re[0]===ib.CONSTANT_VEC3?Wb(ee,ee,re[1]):$=Z_(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=nS([],iS(r.position),!1);if(i){var o=this.options.duration;Wb(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=rS(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=rS(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=iS(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),T=g,x=y/g,E=i,A=a.maxCount;this.updateEmitterTransform(f);for(var S=function(){var e=c.first;return r.emissionStopped||c.length===A&&e&&e.content[0]-s>f},b=0;b<T&&b<A&&!S();b++){(M=this.createPoint(v)).delay+=E+b*x,this.addParticle(M,A),this.lastEmitTime=f}for(var _=u.bursts,R=(null==_?void 0:_.length)-1,C=0;R>=0&&C<A&&!S();R--){var O=_[R],L=!O.disabled&&O.getGeneratorOptions(f,v);if(L){var I=u.burstOffsets[R],P=I&&I[L.cycleIndex]||[0,0,0];O.once&&this.removeBurst(R);for(b=0;b<L.count&&C<A&&!S();b++){var M;(M=this.initPoint(this.shape.generate({total:L.total,index:L.index,burstIndex:b,burstCount:L.count}))).delay+=E,C++,(t=M.transform).translate.apply(t,nS([],iS(P),!1)),this.addParticle(M,A)}}}}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=iS(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=!!E_(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){Wb(a,a,this.parentTransform.position);var f=this.trailMesh.getPointStartPos(e);f&&i_(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=F_([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=s_([],e.position,a),u=new gR({position:s,valid:!0}),c=e.direction;if(c=t_(yI,u_(yI,c,a)),r.startTurbulence&&r.turbulence){for(var l=0;l<3;l++)AI[l]=r.turbulence[l].getValue(i);var f=f_(bI,AI);c=t_(yI,Jb(c,c,f))}var h,p=xI,d=EI;n.alignSpeedDirection?($b(d,c,3),this.upDirectionWorld||(this.upDirectionWorld=u_([],null!==(t=n.upDirection)&&void 0!==t?t:[0,0,1],a)),p=t_(p,a_(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=TI;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,nS([],iS(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 T=r.startSize.getValue(i),x=r.sizeAspect.getValue(i);g[0]=T,g[1]=0===x?0:T/x}var E=[0,0,0];return o_(E,c,o),r.particleFollowParent||(this.transform.assignWorldTRS([],[],AI),e_(g,g,AI)),u.setScale(g[0],g[1],1),{size:g,vel:E,color:y,delay:r.startDelay.getValue(i),lifetime:r.startLifetime.getValue(i),uv:RI(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],TI=[0,0,0],xI=[0,0,0],EI=[0,0,0],AI=[0,0,0],SI=[0,0,0],bI=[];function _I(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 RI(e,t){var r=Math.floor(Math.random()*e.length),i=e[r];return t||e.splice(r,1),i}var CI=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return JA(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return CS.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 eb(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)===sb.removeParticle,ray:e})}}},r}(TR),OI=function(t){function r(){var e=null!==t&&t.apply(this,arguments)||this;return e.meshes=[],e}return JA(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:[ib.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===CS.particle&&(h.push(e),function(e){if(e.type===CS.particle){var t=e.content;t.rotationOverLifetime||(t.rotationOverLifetime={});var r=t.rotationOverLifetime;r.z||(r.z=[ib.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=[ib.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,DS(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:[ib.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 T=function(e,t,r,i,n){void 0===i&&(i="");var o=0,a=lC(sC)?1:0,s=[["ENABLE_VERTEX_TEXTURE",n.detail.maxVertexTextures>0],["LOOKUP_TEXTURE_CURVE",a],["ENV_EDITOR",i===sS]],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),eR(u,e.opacityOverLifetime),eR(u,e.widthOverTrail),s.push(["VERT_CURVE_VALUE_COUNT",u.index],["VERT_MAX_KEY_FRAME_COUNT",u.max]),{vertex:JC,fragment:KC,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);T.vertex=HR(null!==(r=T.marcos)&&void 0!==r?r:[],T.vertex,e.ShaderType.vertex,u),T.fragment=HR(null!==(i=T.marcos)&&void 0!==i?i:[],T.fragment,e.ShaderType.fragment,u),T.glslVersion=2===u?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1,l.addShader(T)}})),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=HR(null!==(r=t.marcos)&&void 0!==r?r:[],t.vertex,e.ShaderType.vertex,u),t.fragment=HR(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 CI&&this.add(t.content)},r.prototype.onCompositionItemRemoved=function(e,t){t instanceof CI&&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 DS(t.meshes,e)}))},r.prototype.remove=function(e,t){var r=this;e.meshes.forEach((function(e){VS(r.meshes,e),t.removeMeshFromDefaultRenderPass(e)}))},r}(OR);var LI,II=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t}(OR),PI=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._v_priority=1,t.childrenVisible=!0,t}return JA(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return CS.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}(TR),MI=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(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=iS(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=[],T=[],x=2,E=2;1===i.length&&(x=1,E=1);for(var A=0;A<x;A++)for(var S=0;S<E;S++){var b=4*(2*S+A),_=o?[0,0,1,1,i[0][4]]:i[2*S+A],R=_[4]?[0,0,1,0,0,1,1,1]:[0,1,0,0,1,1,1,0],C=((A+A+1)/x-1)/2,O=((S+S+1)/E-1)/2,L=_[0],I=_[1],P=_[4]?_[3]:_[2],M=_[4]?_[2]:_[3],w=[y[0]/x+C,y[1]/E+O,y[2]/x+C,y[3]/E+O,y[4]/x+C,y[5]/E+O,y[6]/x+C,y[7]/E+O];g.push(w[0]*u,w[1]*c,R[0]*P+L,R[1]*M+I,t,0,w[2]*u,w[3]*c,R[2]*P+L,R[3]*M+I,t,0,w[4]*u,w[5]*c,R[4]*P+L,R[5]*M+I,t,0,w[6]*u,w[7]*c,R[6]*P+L,R[7]*M+I,t,0),this.lineMode?T.push(b,1+b,1+b,3+b,3+b,2+b,2+b,b):T.push(b,1+b,2+b,2+b,1+b,3+b)}return{index:T,aPoint:g}},t}(zO),wI=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!==yb.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},FI=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 lC(uC)?(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 DI=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=FI.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 $A({},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=$A({},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=$A({},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}(),VI=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 eS(this,void 0,void 0,(function(){var o,a,s,u,c,l,f,h,p,d;return tS(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,JR(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,JR(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,JR("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 uR(e)?JR(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,HI=new Map,YI=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(lC(uC))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?DS(this.elements,e):e.remove()},e}());function WI(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 eS(this,void 0,void 0,(function(){var s,u,c,l,f,h,p,d,m,v,y;return tS(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=WI(i,n))&&p!==r.src?uR(p)?[4,JR(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:yb.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 DI(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===pb.display?p.wrap=e.QTextWrapMode.Default:a.of===pb.clip?p.wrap=e.QTextWrapMode.Clip:a.of===pb.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===mb.left?p.textAlign="left":a.a===mb.middle?p.textAlign="center":a.a===mb.right&&(p.textAlign="right"),f.style===yb.normal?p.fontStyle="normal":f.style===yb.italic?p.fontStyle="italic":f.style===yb.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,$A($A({},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 eS(this,void 0,void 0,(function(){var t,r,i;return tS(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 tS(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 eS(this,void 0,void 0,(function(){var o,a,s;return tS(this,(function(u){switch(u.label){case 0:return o=$A($A({},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=HI.get(r.canvas))){var a=new VI(r.canvas,e,t,n,n,o);HI.set(r.canvas,a),i=a}}else{var s=YI.getCanvas();i=new VI(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,JR(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 eS(this,void 0,void 0,(function(){return tS(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?pb.display:a,u=e.textBaseline,c=void 0===u?db.top:u,l=e.textAlign,f=void 0===l?mb.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,T=void 0===g?y:g,x=y+d;this.autoWidth=v,this.maxTextWidth=h.length*x,this.width=o,this.height=i,this.letterSpace=d,this.overFlow=s,this.textBaseline=c,this.textAlign=f,this.lineHeight=T}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=YI.getCanvas(),YI.saveCanvas(n.canvas),n.context=n.canvas.getContext("2d",{willReadFrequently:!0}),n.engine=i.composition.getEngine(),n.textStyle=new wI(o),n.textLayout=new JI(o,a),n.text=o.text,n.mesh=new MI(n.engine,n.renderInfo,i.composition),n.mesh.setItems([n]),n.updateTexture(),n}return JA(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",nC.createWithData(this.engine,{data:new Uint8Array(g.data),width:g.width,height:g.height},{flipY:!0,magFilter:dS.LINEAR,minFilter:dS.LINEAR,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.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!==vb.normal&&(t="".concat(e.textWeight," ").concat(t)),e.fontStyle!==yb.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),eP=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return JA(r,t),Object.defineProperty(r.prototype,"type",{get:function(){return CS.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=C_([0,0,0],i[0]/2,i[1]/2);return n.forEach((function(e){e.forEach((function(e){s_(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===ES.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 MI(this.composition.getEngine(),$A({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}(TR),tP=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 JA(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 eP&&t.content&&(this.addItems.includes(t)||(DS(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 eP&&r&&(DS(this.removeItems,r),this.addItems.includes(r)&&(null===(i=r.content)||void 0===i?void 0:i.mesh)&&(VS(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),VS(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}(OR);function rP(e,t,r){return function(e,t,r){var i=$A($A({},t.material.props),{shader:r}),n=t.material.clone(i);return n.blending=!1,n.depthTest=!1,n.culling=!1,zC.create(e,{geometry:t.geometry,material:n})}(e,t,XO(e.gpuCapability.level,{fragment:r.fragment},{ignoreBlend:!0}))}var iP=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 JA(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=nC.create(t.engine,{sourceType:e.TextureSourceType.framebuffer,minFilter:dS.LINEAR,magFilter:dS.LINEAR,name:this.type,internalFormat:dS.RGBA,format:dS.RGBA,type:dS.UNSIGNED_BYTE});this.mframeBuffer=MO.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",EO(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",EO(this.prePassTexture));var t=[this.meshes[0],rP(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}(YC),nP=function(e){function t(t,r,i){var n=e.call(this,t,r)||this;return i&&(n.preDefaultPassAttachment=i),n}return JA(t,e),t.prototype.configure=function(e){this.prePassTexture=e.getFrameBuffer().getColorTextures()[0],this.preDefaultPassAttachment||(this.preDefaultPassAttachment=new XC(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",EO(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",EO(this.prePassTexture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(YC);function oP(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(aP(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 aP(e,t){return Math.exp(-e*e/(2*t*t))/Math.sqrt(2*Math.PI)/t}var sP=function(e){function t(t,r){return e.call(this,t,r)||this}return JA(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",EO(this.preDefaultPassAttachment.texture));var t=[rP(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},t}(YC),uP=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 JA(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",EO(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",EO(this.uBlurSource));var t=[rP(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},t}(YC),cP=function(e){function t(t,r,i){var n=e.call(this,t,r)||this;return n.preDefaultPassAttachment=i,n}return JA(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",EO(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",EO(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",EO(this.preDefaultPassAttachment.texture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(YC),lP=function(e){function t(t,r){return e.call(this,t,r)||this}return JA(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",EO(this.prePassTexture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.prePassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",EO(this.prePassTexture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(YC);function fP(e,t,r){for(var i=Z_(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 nC.createWithData(e,{width:n,height:1,data:o},{format:dS.LUMINANCE})}var hP=[1,1,1],pP=function(){function e(e,t){void 0===t&&(t={}),this.name=e,this.viewMatrix=Ib(),this.projectionMatrix=Ib(),this.viewProjectionMatrix=Ib(),this.inverseViewMatrix=Ib(),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?tb.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 nS([],iS(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 nS([],iS(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(),hR(this.viewMatrix)},e.prototype.getInverseViewMatrix=function(){return this.updateMatrix(),hR(this.inverseViewMatrix)},e.prototype.getProjectionMatrix=function(){return this.updateMatrix(),hR(this.projectionMatrix)},e.prototype.getInverseProjectionMatrix=function(){return this.updateMatrix(),hR(this.inverseProjectionMatrix)},e.prototype.getViewProjectionMatrix=function(){return this.updateMatrix(),hR(this.viewProjectionMatrix)},e.prototype.getInverseViewProjectionMatrix=function(){return this.updateMatrix(),this.inverseViewProjectionMatrix||(this.inverseViewProjectionMatrix=Fb([],this.viewProjectionMatrix)),hR(this.inverseViewProjectionMatrix)},e.prototype.getModelViewProjection=function(e,t){return Nb(e,this.viewProjectionMatrix,t)},e.prototype.getInverseVPRatio=function(e){var t=[0,0,0],r=s_(t,[0,0,e],this.getViewProjectionMatrix())[2];return s_(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&&y_(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;Db(this.projectionMatrix,t,r,i,n,o===tb.portrait),wb(this.inverseViewMatrix,this.getQuat(),a,hP),Fb(this.viewMatrix,this.inverseViewMatrix),Nb(this.viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this.inverseViewProjectionMatrix=null,this.dirty=!1}},e.prototype.setRotationByQuat=function(e){this.options.rotation=gR.getRotation([],e)},e}();var dP,mP,vP,yP,gP,TP,xP,EP,AP,SP,bP,_P={lum:[function(t,r){var i=r.renderer,n=2===i.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,o=new nP(i,{name:"lumCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:n,magFilter:n}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:SC,uniformValues:{uFilterParams:[1,0,0,0]},materialStates:{blending:!1,depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}]},prePasses:[o],renderPassDelegate:{}}},function(){return[{fragment:SC}]}],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?dS.LINEAR:dS.NEAREST,f=new nP(c,{name:"alphaFrameCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{particle:{fragment:$C,uniformValues:{uTexRange:u}},mesh:{fragment:$C,shaderCacheId:"alpha-frame",materialStates:{blending:!1},uniformValues:{uTexRange:u}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[f]}}},function(){return[{fragment:$C,shaderCacheId:"alpha-frame"},{fragment:$C,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=[ib.CONSTANT_VEC3,n]);var a=Z_(o),s=new pP("camera_move"),u=[0,0,0],c=r.renderer,l=2===c.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,f=new nP(c,{name:"cameraCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{vertex:tO,fragment:SC,shaderCacheId:"camera-move",materialStates:{blending:!1,depthTest:!1,culling:!1},variables:{uMoveCameraViewPro:function(e){s.copy(r.camera);var t=a.getValue(e);return Wb(u,r.camera.position,[-t[0],-t[1],-t[2]]),s.position=u,s.getViewProjectionMatrix()}}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[f]}}},function(){return[{vertex:tO,fragment:SC,shaderCacheId:"camera-move"}]}],alphaMask:[function(t,r){var i=t,n=i.xOpacity,o=i.yOpacity,a=r.renderer.engine,s=r.renderer,u=fP(a,n),c=fP(a,o,!0),l=2===a.gpuCapability.level?dS.LINEAR:dS.NEAREST,f=new nP(s,{name:"alphaMaskCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:l,magFilter:l}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:eO,shaderCacheId:"alpha-mask",materialStates:{blending:!1,depthTest:!1,culling:!1},uniformValues:{uAlphaXSample:u,uAlphaYSample:c}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[f]}}},function(){return[{fragment:eO,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=t_(s),h=[o[0],o[1],f[0],f[1]],p=Z_(u),d=Z_(c),m=Z_(l),v=2*Math.PI,y=r.renderer,g=2===y.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,T=new nP(y,{name:"distortionCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:g,magFilter:g}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{particle:{fragment:iO,vertex:nO,uniforms:{uPeriodValue:p,uMovementValue:d,uStrengthValue:m},uniformValues:{uWaveParams:h}},mesh:{shaderCacheId:"distortion",fragment:iO,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:dS.RGBA}}],prePasses:[T]}}},function(e){var t=e,r=t.period,i=t.waveMovement,n=t.strength;return[{fragment:iO,shaderCacheId:"distortion"},{fragment:iO,vertex:nO,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=oP({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=Ab(v),y=Ab(y));var g=[0,0,v,y],T=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:dS.RGBA,magFilter:dS.LINEAR,minFilter:dS.LINEAR,name:"gaussianV",width:v,height:y}),x=r.renderFrame.passTextureCache.requestColorAttachmentTexture({format:dS.RGBA,magFilter:dS.LINEAR,minFilter:dS.LINEAR,name:"gaussianH",width:v,height:y}),E=Z_(s),A=Z_(c),S=new XC(d),b=new sP(m,{name:"threshold",attachments:[{texture:T}],viewport:g,clearAction:{colorAction:e.TextureLoadAction.clear}});b.pluginSystem=r.pluginSystem,b.fragShader=aO,b.preDefaultPassAttachment=S;var _=new uP(m,"H",[p.step,0],r.pluginSystem,p.shader,{name:"gaussianH",viewport:g,attachments:[{texture:x}],clearAction:{colorAction:e.TextureLoadAction.clear}},T);_.preDefaultPassAttachment=S;var R=new uP(m,"V",[0,p.step],r.pluginSystem,p.shader,{name:"gaussianV",viewport:g,attachments:[{texture:T}]},x);R.preDefaultPassAttachment=S;var C=2===h?dS.LINEAR:dS.NEAREST,O=new cP(m,{name:"bloomCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:C,magFilter:C}}],clearAction:{colorAction:e.TextureLoadAction.clear}},S);return{mesh:{name:"bloom-".concat(p.step),fragment:oO,shaderCacheId:"bloom-".concat(p.step),variables:{uBloomParams:function(e){return[E.getValue(e),A.getValue(e),0,1]}},uniformValues:{uColorThreshold:[f[0]/255||1.1,f[1]/255||1.1,f[2]/255||1.1,0],uBloomBlur:T},materialStates:{blending:!1,culling:!1}},onItemRemoved:function(){T.dispose(),x.dispose()},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[b,_,R,O]}}},function(e){var t=e.radius,r=oP({radius:void 0===t?30:t});return[{fragment:oO,shaderCacheId:"bloom-".concat(r.step)},{fragment:aO,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=oP({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=Ab(h),f=Ab(f));var p=[0,0,f,h],d=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:dS.LINEAR,magFilter:dS.LINEAR,name:"gaussianV",width:f,height:h}),m=r.renderFrame.passTextureCache.requestColorAttachmentTexture({minFilter:dS.LINEAR,magFilter:dS.LINEAR,name:"gaussianH",width:f,height:h}),v=new XC(o,{}),y=new iP(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 iP(a,"V",[c,0],r.pluginSystem,l,{name:"gaussianV",viewport:p,attachments:[{texture:d}],clearAction:{colorAction:e.TextureLoadAction.clear}});g.preDefaultPassAttachment=v;var T=2===n?dS.LINEAR:dS.NEAREST,x=new nP(a,{name:"gaussianCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:T,magFilter:T}}],clearAction:{colorAction:e.TextureLoadAction.clear}},v);return x.preDefaultPassAttachment=v,{mesh:{fragment:SC,shaderCacheId:"gaussian-".concat(c),uniformValues:{uTexSize:[f,h]},materialStates:{blending:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[y,g,x]}}},function(e){var t=oP({radius:e.radius});return[{fragment:SC,shaderCacheId:"gaussian-".concat(t.step)},{fragment:t.shader,ignoreBlend:!0}]}],delay:[function(t,r){var i=r.renderer,n=nC.create(i.engine,{sourceType:e.TextureSourceType.framebuffer}),o=[0,.96,0,0],a=2===i.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,s=new lP(i,{name:"delayCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:a,magFilter:a}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:rO,shaderCacheId:"delay",uniformValues:{uLastSource:n},variables:{uParams:function(){return o}},materialStates:{blending:!0,blendFunction:[dS.SRC_ALPHA,dS.ONE_MINUS_SRC_ALPHA,dS.SRC_ALPHA,dS.ONE_MINUS_SRC_ALPHA],depthTest:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:dS.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:rO,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"}(pP||(pP={})),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"}(dP||(dP={})),function(e){e[e.DOUBLE=1032]="DOUBLE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK"}(mP||(mP={})),function(e){e[e.NONE=0]="NONE",e[e.MASK=1]="MASK",e[e.OBSCURED=2]="OBSCURED",e[e.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(vP||(vP={})),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"}(yP||(yP={})),function(e){e[e.GYROSCOPE=0]="GYROSCOPE",e[e.SPINE=1]="SPINE"}(gP||(gP={})),function(e){e[e.CLICK=0]="CLICK",e[e.MESSAGE=1]="MESSAGE",e[e.DRAG=2]="DRAG"}(TP||(TP={})),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"}(xP||(xP={})),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"}(EP||(EP={})),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"}(AP||(AP={})),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"}(SP||(SP={}));var _P,RP,CP,OP,LP,IP,PP,MP,wP,FP,NP,DP,VP,UP,BP,kP,zP,GP=0;!function(e){e[e.portrait=1]="portrait",e[e.landscape=GP]="landscape"}(_P||(_P={})),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"}(RP||(RP={})),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"}(CP||(CP={})),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"}(OP||(OP={})),function(e){e[e.destroy=0]="destroy",e[e.loop=5]="loop",e[e.freeze=4]="freeze"}(LP||(LP={})),function(e){e[e.destroyChildren=6]="destroyChildren"}(IP||(IP={})),function(e){e[e.none=0]="none",e[e.removeParticle=1]="removeParticle"}(PP||(PP={})),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"}(MP||(MP={})),function(e){e[e.box=2]="box",e[e.sphere=3]="sphere"}(wP||(wP={})),function(e){e.unlit="unlit",e.pbr="pbr",e.hair="hair"}(FP||(FP={})),function(e){e[e.opaque=100]="opaque",e[e.masked=101]="masked",e[e.translucent=102]="translucent",e[e.additive=103]="additive"}(NP||(NP={})),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"}(DP||(DP={})),function(e){e[e.display=0]="display",e[e.clip=1]="clip",e[e.ellipsis=2]="ellipsis"}(VP||(VP={})),function(e){e[e.top=0]="top",e[e.middle=1]="middle",e[e.bottom=2]="bottom"}(UP||(UP={})),function(e){e[e.left=0]="left",e[e.middle=1]="middle",e[e.right=2]="right"}(BP||(BP={})),function(e){e.normal="normal",e.bold="bold",e.lighter="lighter"}(kP||(kP={})),function(e){e.normal="normal",e.italic="italic",e.oblique="oblique"}(zP||(zP={}));var jP=function(){return jP=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},jP.apply(this,arguments)};function XP(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 HP(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 YP(e,t){if(!e.includes(t))return e.push(t),!0}function WP(e,t,r){if(e)for(var i in e)Object.hasOwnProperty.call(e,i)&&t.call(r,e[i],i);return e}function ZP(e){if(Number.isFinite(e))return[CP.CONSTANT,e];if(e){if("lines"===e[0])return[CP.LINE,e[1]];if("curve"===e[0])return[CP.CURVE,e[1]];if("static"===e[0])return[CP.CONSTANT,e[1]]}}function qP(e,t){return Array.isArray(e)&&"random"===e[0]?[CP.CONSTANT,e[1][t]]:ZP(e)}function KP(e){return e&&"color"===e[0]?eM(e[1],!0):[1,1,1,1]}function QP(e,t){if(e){if("colors"===e[0])return[CP.COLORS,e[1].map((function(e){return eM(e,t)}))];if("gradient"===e[0])return $P(e[1],t);if("color"===e[0])return[CP.RGBA_COLOR,eM(e[1],t)]}}function JP(e){return e&&"random"===e[0]?[CP.RANDOM,e[1]]:ZP(e)}function $P(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=eM(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]})),[CP.GRADIENT_COLOR,r]}}function eM(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 tM(e,t){return Array.isArray(e)?("gradient"===e[0]||"color"===e[0])&&$P(e[1],t):$P(e,t)}function rM(e){if(e){if(3===e.length)return[CP.CONSTANT_VEC3,e];if("path"===e[0])return[CP.LINEAR_PATH,e[1]];if("bezier"===e[0])return[CP.BEZIER_PATH,e[1]]}}function iM(e){var t,r;try{for(var i=XP(Object.entries(e)),n=i.next();!n.done;n=i.next()){var o=HP(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 nM(e){var t,r;try{for(var i=XP(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 oM=Math.cos,aM=Math.sin,sM=Math.PI/180,uM=180/Math.PI;function cM(e){var t,r=e.options,i=e.transform,n={type:yP.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=jP(jP({},e.shape),{type:yP[o]}),e.shape.upDirection){var a=HP(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=JP(r.turbulenceX),n.turbulenceY=JP(r.turbulenceY),n.turbulenceZ=JP(r.turbulenceZ));var l=e.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(e){return iM(e)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(e){return iM(e)}))),l.rateOverTime&&(l.rateOverTime=JP(l.rateOverTime));var f={renderer:e.renderer,shape:n,splits:e.splits,emission:l,options:{startLifetime:JP(r.startLifetime),start3DSize:!!r.start3DSize,startSize:JP(r.startSize),startSizeX:JP(r.startSizeX),startSizeY:JP(r.startSizeY),sizeAspect:JP(r.sizeAspect),maxCount:r.maxCount,startDelay:JP(r.startDelay),startColor:QP(r.startColor,!0),startRotationZ:JP(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(f.options.startRotationX=JP(r.startRotationX),f.options.startRotationY=JP(r.startRotationY)),e.filter){var h={};WP(e.filter,(function(e,t){var r;h[t]=(r=e,Array.isArray(r)&&"string"==typeof r[0]&&(JP(r)||rM(r)||QP(r))||r)})),f.filter=h}i&&i.path&&(f.emitterTransform={path:rM(i.path)});var p=e.sizeOverLifetime;p&&(p.separateAxes?f.sizeOverLifetime={separateAxes:!0,x:JP(p.x),y:JP(p.y)}:f.sizeOverLifetime={size:JP(p.size)});var d=e.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?ZP(m):void 0,f.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:ZP(r.gravityModifier),startSpeed:JP(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:JP(d.linearX),linearY:JP(d.linearY),linearZ:JP(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:JP(d.orbitalX),orbitalY:JP(d.orbitalY),orbitalZ:JP(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:ZP(d.forceCurve)},nM(f.positionOverLifetime);var v=e.rotationOverLifetime;v&&(f.rotationOverLifetime={separateAxes:v.separateAxes,asRotation:v.asRotation,z:JP(v.separateAxes?v.z:v.angularVelocity)},v.separateAxes&&(f.rotationOverLifetime.y=ZP(v.y),f.rotationOverLifetime.x=ZP(v.x)));var y=e.colorOverLifetime;if(y){var g=f.colorOverLifetime={opacity:ZP(y.opacity)};y.color&&(g.color=tM(y.color))}var T=e.textureSheetAnimation;T&&(f.textureSheetAnimation={row:T.row,col:T.col,total:T.total,animate:T.animate,cycles:ZP(T.cycles),animationDelay:qP(T.animationDelay,0),animationDuration:qP(T.animationDuration,0)});var x=e.trails;x&&(f.trails={lifetime:JP(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:ZP(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&tM(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&tM(x.colorOverLifetime,!1),inheritParticleColor:x.inheritParticleColor,occlusion:x.occlusion,transparentOcclusion:x.transparentOcclusion,orderOffset:x.orderOffset,sizeAffectsLifetime:x.sizeAffectsLifetime,sizeAffectsWidth:x.sizeAffectsWidth,texture:x.texture,parentAffectsPosition:x.parentAffectsPosition,opacityOverLifetime:JP(x.opacityOverLifetime)}),f.trails&&nM(f.trails);var E=e.interaction;return E&&(f.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),f}function lM(e,t){var r,i=e.options,n=e.velocityOverLifetime||{},o={path:rM(null===(r=e.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:ZP(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:ZP(n.linearX),linearY:ZP(n.linearY),linearZ:ZP(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:ZP(n.orbitalX),orbitalY:ZP(n.orbitalY),orbitalZ:ZP(n.orbitalZ),speedOverLifetime:ZP(n.speedOverLifetime)};nM(o);var a={options:{startColor:KP(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=ZP(s.x),u.y=ZP(s.y),u.z=ZP(s.z)):u.z=ZP(s.angularVelocity)}var c=e.colorOverLifetime;if(c){var l=a.colorOverLifetime={opacity:ZP(c.opacity)};c.color&&(l.color=tM(c.color))}var f=e.sizeOverLifetime;return f&&(a.sizeOverLifetime={separateAxes:f.separateAxes,size:ZP(f.size),x:ZP(f.x),y:ZP(f.y),z:ZP(f.z)}),a}function fM(e,t){var r=lM(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 hM=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],pM=["path","position"];function dM(e){return e.compositions.forEach((function(e){e.items.forEach((function(e){e.type===EP.null&&e.endBehavior===LP.destroy&&(e.endBehavior=LP.freeze)}))})),e.version="2.1",e}var mM=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,vM=/^(\d+)\.(\d+)$/,yM=!1;function gM(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!==EP.mesh&&e.type!==EP.light||(e.endBehavior=1===e.endBehavior?LP.destroy:e.endBehavior)}))}))}(e),mM.test(e.version))return yM="0"===(null===(t=/^(\d+)/.exec(e.version))||void 0===t?void 0:t[0]),dM(function(e){var t,r;TM="1.0";var i=e.plugins||[];(null===(t=e.bins)||void 0===t?void 0:t.length)&&(TM="1.3");var n=(e.requires||[]).slice(),o=e.images.map((function(t,r){return xM(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:TM,playerVersion:null!==(r=e.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map((function(e){return EM(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=vM.exec(e.version))||void 0===r?void 0:r[1];if(i)return Number(i)<2?dM(e):e;throw Error("invalid json version "+e.version)}var TM="1.0";function xM(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 EM(e,t){var r;void 0===t&&(t={});var i={id:e.id+"",camera:Object.assign({clipMode:GP},e.camera),duration:e.duration,endBehavior:e.endBehavior,items:e.items.map((function(e){return _M(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 AM,SM=[0,0,0,1],bM=.5;function _M(e,t){var r,i,n;void 0===t&&(t={});var o,a,s,u,c,l,f=EP.base,h=e.endBehavior,p=NaN;if(e.content?(f=e.type||EP.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===EP.filter&&(TM<"1.1"&&(TM="1.1"),(s=fM(a,o)).filter=function(e){var t={};return WP(e,(function(e,r){hM.includes(r)?t[r]=ZP(e):pM.includes(r)?t[r]=rM(e):t[r]=e})),t}(a.filter))):e.particle?(f=EP.particle,o=y((a=e.particle).transform,yM,!0),s=cM(a)):e.sprite?(f=EP.sprite,s=fM(a=e.sprite,o=y(a.transform,!1,!0))):e.cal?(f=EP.null,s=lM(a=e.cal,o=y(a.transform,!1,!0))):e.ui?(f=EP.interact,o=y((a=e.ui).transform),s=function(e){var t,r=e.options;switch(r.type){case"click":t={type:TP.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&KP(r.previewColor),behavior:r.behavior||xP.NOTIFY};break;case"drag":t={type:TP.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":t={type:TP.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=EP.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:rM(null===(r=e.transform)||void 0===r?void 0:r.path),linearX:ZP(null==o?void 0:o.translateX),linearY:ZP(null==o?void 0:o.translateY),linearZ:ZP(null==o?void 0:o.translateZ)};nM(a),n.positionOverLifetime=a}var s=e.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:ZP(null==s?void 0:s.rotateX),y:ZP(null==s?void 0:s.rotateY),z:s.separateAxes?ZP(null==s?void 0:s.rotateZ):ZP(s.rotation)};nM(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]==bM&&d[1]==bM?delete s.renderer.anchor:t.requires&&YP(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]?LP.loop:LP.destroy:LP.loop:h||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||LP.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?(YP(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=SM,s=i.rotation[0],u=i.rotation[1],c=i.rotation[2],l=oM(s*sM/2),f=oM(u*sM/2),h=oM(c*sM/2),p=aM(s*sM/2),d=aM(u*sM/2),m=aM(c*sM/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,T=n*s+o*a,x=1-c-f;return e[1]=Math.asin(function(e,t,r){return e>r?r:e<t?t:e}(-g,-1,1))*uM,Math.abs(g)<.9999999?(e[0]=Math.atan2(T,x)*uM,e[2]=Math.atan2(v,d)*uM):(e[0]=0,e[2]=Math.atan2(-m,y)*uM),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 RM=((AM={})[TS.S]=[TS.S,TS.BPlus,TS.APlus],AM[TS.A]=[TS.A,TS.BPlus,TS.APlus],AM[TS.B]=[TS.B,TS.BPlus],AM);function CM(e,t){if(!e||!t)return!0;var r=RM[t];return!!r&&r.includes(e)}var OM=0,LM=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 iC?e:iC.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);OM=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=$A({},e.content);if(c&&(o.content=$A({},c),CM(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===AS.MASK?l.renderer.mask=++i:f!==AS.OBSCURED&&f!==AS.REVERSE_OBSCURED||(l.renderer.mask=i)}var h=l.splits&&!l.textureSheetAnimation&&l.splits[0];Number.isInteger(l.renderer.shape)?l.renderer.shape=nI(null===(n=t.jsonScene)||void 0===n?void 0:n.shapes[l.renderer.shape],h):l.renderer.shape&&fR(l.renderer.shape)&&(l.renderer.shape=nI(l.renderer.shape,h))}else o.content.renderer={order:0};l.trails&&(l.trails=t.changeTex(l.trails)),l.filter&&(l.filter=$A({},l.filter));var p=e.name,d=e.delay,m=void 0===d?0:d,v=e.id,y=e.parentId,g=e.duration,T=e.endBehavior,x=e.pluginName,E=e.pn,A=e.transform,S=e.refCount,b=t.jsonScene.plugins,_=void 0===b?[]:b;o.name=p,o.delay=m,o.id=v,y&&(o.parentId=y),o.refCount=S,o.duration=g,o.listIndex=OM++,o.endBehavior=T,x?o.pluginName=x:void 0!==E&&Number.isInteger(E)&&(o.pluginName=_[E]),A&&(o.transform=A),r.push(o)}}})),r},e.prototype.changeTex=function(e){var t=e.texture,r=$A({},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}();function IM(e){return fR(e)&&"jsonScene"in e}var PM=1,MM=function(){function t(e,t){void 0===e&&(e={}),void 0===t&&(t=new ZR),this.options=e,this.downloader=t,this.assets={},this.id=PM++,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 eS(this,void 0,void 0,(function(){var o,a,s,u,c,l,f,h,p,d,m,v=this;return tS(this,(function(y){return a="Load asset: ".concat(uR(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 eS(v,void 0,void 0,(function(){var r,i;return tS(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 eS(v,void 0,void 0,(function(){var i,n,h,p,m,v,y,g,T,x,E,A,S,b,_=this;return tS(this,(function(R){switch(R.label){case 0:return fR(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 _.loadJSON(e)}))];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,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 _.processBins(m)})),d("processImages",(function(){var e;return _.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 _.precompile(y,t,r)}))])];case 5:return T=iS.apply(void 0,[R.sent(),2]),x=T[0],E=T[1],[4,d("processFontURL",(function(){return _.processFontURL(g)}))];case 6:return R.sent(),[4,d("processTextures",(function(){return _.processTextures(E,x,h)}))];case 7:return A=R.sent(),S={jsonScene:h,images:E,textureOptions:A,bins:x,storage:{},pluginSystem:this.pluginSystem,renderLevel:this.options.renderLevel,totalTime:0,startTime:0,url:e},[4,d("processPlugins",(function(){return _.pluginSystem.loadResources(S,_.options)}))];case 8:return R.sent(),b=performance.now()-s,console.info({content:"".concat(a,": ").concat(b.toFixed(4),"ms, ").concat(u.join(" ")),type:oC}),window.clearTimeout(f),S.totalTime=b,S.startTime=s,[2,S]}}))}))},[2,Promise.race([p,m()])]}))}))},t.prototype.precompile=function(e,t,r){return eS(this,void 0,void 0,(function(){var i;return tS(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 eS(this,void 0,void 0,(function(){var t,r,i,n,o,a,s,u;return tS(this,(function(c){switch(c.label){case 0:return t=gM(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 RR(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];CM(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 eS(this,void 0,void 0,(function(){var t,r,i=this;return tS(this,(function(n){return t=this.options.renderLevel,r=e.map((function(r){if(r instanceof ArrayBuffer)return r;if(CM(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 eS(this,void 0,void 0,(function(){var r,i=this;return tS(this,(function(n){return e?(r=e.map((function(e){return eS(i,void 0,void 0,(function(){var r,i;return tS(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:oC}),[3,4];case 4:return[2]}}))}))})),[2,Promise.all(r)]):[2]}))}))},t.prototype.processImages=function(t,r,i){return eS(this,void 0,void 0,(function(){var n,o,a,s,u,c=this;return tS(this,(function(l){return n=this.options,o=n.useCompressedTexture,a=n.variables,s=this.baseUrl,u=t.map((function(t,n){return eS(c,void 0,void 0,(function(){var u,c,l,f,h,p,d,m,v,y,g,T,x,E,A,S,b,_,R;return tS(this,(function(C){switch(C.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,C.label=1;case 1:return C.trys.push([1,3,,5]),b={},[4,QR(d[0])];case 2:return b.image=C.sent(),b.url=d[0],p=b,[3,5];case 3:return C.sent(),_={},[4,QR(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,QR(d)]);case 7:R.image=C.sent(),R.url=d,p=R,C.label=8;case 8:return[3,11];case 9:return[4,KR(l,f)];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,KI(p.image,h,a,this.options,-1===t.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 t&&"video"===t.type)return y=t.loop,[2,$R(t.url,{loop:y})];if("compressed"in t&&o&&i){if(g=t.compressed,T=void 0,i===LO.ASTC?T=g.astc:i===LO.PVRTC&&(T=g.pvrtc),T)return x=new URL(T,s).href,this.assets[n]={url:x,type:e.TextureSourceType.compressed},[2,this.loadBins(x)]}else{if("sourceType"in t)return[2,t];if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof iC)return[2,t]}C.label=17;case 17:return[4,KR(l,f)];case 18:return E=C.sent(),A=E.url,S=E.image,this.assets[n]={url:A,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 eS(this,void 0,void 0,(function(){var o,a,s=this;return tS(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 iC)return n;if("mipmaps"in n)try{return eC(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 iC)return t.source;if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)return{image:t,sourceType:e.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:dS.LINEAR,magFilter:dS.LINEAR};if(t instanceof HTMLVideoElement)return{sourceType:e.TextureSourceType.video,video:t,minFilter:dS.LINEAR,magFilter:dS.LINEAR};if(t instanceof ArrayBuffer)return $A($A({},fC(t)),{sourceFrom:r});if("width"in t&&"height"in t&&"data"in t)return{sourceType:e.TextureSourceType.data,data:t,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE,minFilter:dS.NEAREST,magFilter:dS.NEAREST};throw new Error("Invalid texture options")}(u,s.assets[o]);return c.sourceType===e.TextureSourceType.compressed?c:$A($A({},c),n)}throw new Error("Invalid texture source: ".concat(a))})),[2,Promise.all(a)]}))}))},t.prototype.loadJSON=function(e){return eS(this,void 0,void 0,(function(){var t=this;return tS(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 eS(this,void 0,void 0,(function(){var t=this;return tS(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 wM,FM,NM=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 JA(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return CS.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=xR(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,nS([],iS(o),!1)))}else(r=i.itemTree).splice.apply(r,nS([i.itemTree.indexOf(n),1],iS(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,nS([],iS(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,nS([],iS(a.children),!1)),s.composition||DS(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(DS(this.itemsToRemove,e),e.type===aS||e.type===CS.null){var i=6===e.endBehavior,n=e.type===CS.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}(TR),DM=1,VM=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 LM(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,T=v.imgUsage,x=v.totalTime,E=v.renderLevel;eb(y);var A=new NM(y,this),S=!n&&T;this.transform=new gR({name:this.name}),A.transform=this.transform,this.globalVolume=y.globalVolume,this.width=d,this.height=m,this.renderOrder=u,this.id=DM++,this.renderer=c,this.texInfo=null!=S?S:{},this.event=p,this.statistic={loadTime:null!=x?x: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!==A.endBehavior,this.content=A,this.name=A.name,this.pluginSystem=g,this.pluginSystem.initializeComposition(this,t),this.camera=new hP(this.name,$A($A({},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}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.getDuration=function(){return this.content.duration},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 TO({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=iS(this.renderFrame.editorTransform,4),i=r[0],n=r[1];return x_((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=iS(this.renderFrame.editorTransform,4),u=s[0],c=s[1],l=x_((t-s[2])/u,(r-s[3])/c,this.camera),f=(null==n?void 0:n.stop)||sR,h=(null==n?void 0:n.skip)||sR,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 T=v.triangles,x=v.backfaceCulling,E=0;E<T.length;E++){var A=T[E];if(O_(g,l.center,l.direction,A,x),g.length){y=!0,o.push(g);break}}else if(v.type===e.HitTestType.box){var S=v.center,b=v.size;A_(g,l.center,l.direction,S,b),g.length&&(y=!0,o.push(g))}else if(v.type===e.HitTestType.sphere){S=v.center;var _=v.radius;E_(g,l.center,l.direction,S,_),g.length&&(y=!0,o.push(g))}else if(v.type===e.HitTestType.custom){var R=v.collect(l,[t,r]);R&&R.length>0&&(o.push.apply(o,nS([],iS(R),!1)),y=!0)}if(y){var C={id:m.id,name:m.name,position:o[o.length-1],parentId:m.parentId,hitPositions:o,behavior:v.behavior};if(a.push(C),f(C))return a}}}}return a},t.prototype.addInteractiveItem=function(e,t){var r;if(t===_S.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===_S.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=sR)})):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:oC})},this.handlePlayerPause=sR,this.dispose=sR,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 eS(this,void 0,void 0,(function(){return tS(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}(),UM=function(){function e(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[]}return e.prototype.addTexture=function(e){this.destroyed||DS(this.textures,e)},e.prototype.removeTexture=function(e){this.destroyed||VS(this.textures,e)},e.prototype.addMaterial=function(e){this.destroyed||DS(this.materials,e)},e.prototype.removeMaterial=function(e){this.destroyed||VS(this.materials,e)},e.prototype.addGeometry=function(e){this.destroyed||DS(this.geometries,e)},e.prototype.removeGeometry=function(e){this.destroyed||VS(this.geometries,e)},e.prototype.addMesh=function(e){this.destroyed||DS(this.meshes,e)},e.prototype.removeMesh=function(e){this.destroyed||VS(this.meshes,e)},e.prototype.addRenderPass=function(e){this.destroyed||DS(this.renderPasses,e)},e.prototype.removeRenderPass=function(e){this.destroyed||VS(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:oC}),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}(),BM=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=Eb(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}();bR("camera",LR,IR,!0),bR("sprite",KO,nL,!0),bR("particle",CI,RI,!0),bR("cal",LI,II,!0),bR("interact",VO,NO,!0),bR("filter",KO,aL,!0),bR("text",eP,$I,!0),wS(bP);var kM=((wM={})[dS.RGBA]=34842,wM[dS.RGB]=34843,wM[dS.ALPHA]=33325,wM[dS.RED]=33325,wM[dS.LUMINANCE_ALPHA]=33327,wM[dS.LUMINANCE]=33325,wM),zM=((FM={})[dS.RGBA]=34836,FM[dS.RGB]=34837,FM[dS.ALPHA]=33326,FM[dS.RED]=33326,FM[dS.LUMINANCE_ALPHA]=33328,FM[dS.LUMINANCE]=33326,FM),GM=function(t){function r(e,r){var i=t.call(this)||this;i.initialized=!1;var n=i.assembleOptions(r),o=n.sourceType,a=n.sourceFrom,s=n.name,u=void 0===s?"":s;return i.source=n,i.sourceType=o,i.sourceFrom=a,i.name=u,i.engine=e,i}return JA(r,t),r.prototype.bind=function(e){this.pipelineContext.bindTexture(this.target,this.textureBuffer,e)},r.prototype.initialize=function(){if(!this.initialized){var e=this.engine;e.addTexture(this);var t=e.getGLPipelineContext();this.pipelineContext=t;var r=t.gl,i=this.source,n=i.target,o=void 0===n?r.TEXTURE_2D:n,a=i.name;this.textureBuffer=r.createTexture(),this.textureBuffer&&ZM(this.textureBuffer,a),this.target=o,this.update(this.source),this.release(),this.initialized=!0}},r.prototype.clone=function(){var e=new r(this.engine,this.source);return e.sourceFrom=this.sourceFrom,e.sourceType=this.sourceType,e.width=this.width,e.height=this.height,e},r.prototype.release=function(){switch(this.source.sourceType){case e.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case e.TextureSourceType.data:delete this.source.data;break;case e.TextureSourceType.compressed:case e.TextureSourceType.mipmaps:delete this.source.mipmaps}},r.prototype.update=function(t){var r,i,n,o,a=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var s=this.target,u=this.source,c=this.pipelineContext.gl,l=this.engine.gpuCapability.detail,f=u.sourceType,h=u.data,p=u.cube,d=u.image,m=u.video,v=u.mipmaps,y=u.mipmaps,g=t.data,T=t.cube,x=t.generateMipmap,E=t.mipmaps,A=u,S=A.format,b=A.type,_=A.internalFormat,R=0,C=0;if(this.bind(f===e.TextureSourceType.video),b===dS.HALF_FLOAT?((b=l.halfFloatTexture)||console.error({content:"half float texture is not support",type:oC}),vS(c)&&_===S&&(S===dS.LUMINANCE&&(S=dS.RED),_=kM[S]),l.halfFloatLinear||(u.minFilter=u.magFilter=c.NEAREST,console.warn({content:"half float linear not support,change to NEAREST",type:oC}))):b===c.FLOAT&&((b=l.floatTexture)||console.error({content:"float texture is not support",type:oC}),vS(c)&&_===S&&(S===dS.LUMINANCE&&(S=dS.RED),_=zM[S]),l.floatLinear||(u.minFilter=c.NEAREST,u.magFilter=c.NEAREST,console.warn({content:"float linear not support,change to NEAREST",type:oC}))),void 0===u.premultiplyAlpha&&(u.premultiplyAlpha=!1),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha),void 0===u.flipY&&(u.flipY=!1),c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,u.flipY),f===e.TextureSourceType.framebuffer)g&&(R=null!==(n=g.width)&&void 0!==n?n:0,C=null!==(o=g.height)&&void 0!==o?o:0,R&&C&&(this.width!==R||this.height!==C)&&c.texImage2D(s,0,_,R,C,0,S,b,null));else if(f===e.TextureSourceType.data)s===c.TEXTURE_CUBE_MAP?T.forEach((function(e,t){var r=iS(a.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,_,S,b,e),2),i=r[0],n=r[1];R=Math.max(i,R),C=Math.max(n,C)})):(r=iS(this.texImage2DData(c,s,0,_,S,b,h),2),R=r[0],C=r[1]);else if(f===e.TextureSourceType.image||f===e.TextureSourceType.video){if(s===c.TEXTURE_CUBE_MAP)p.forEach((function(e,t){var r=iS(a.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,_,S,b,e),2),i=r[0],n=r[1];R=Math.max(i,R),C=Math.max(n,C)}));else if(s===c.TEXTURE_2D){var O=null!=d?d:m;i=iS(this.texImage2D(c,s,0,_,S,b,O),2),R=i[0],C=i[1]}x&&(jM(R)&&jM(C)||vS(c))&&c.generateMipmap(s)}else if(f===e.TextureSourceType.mipmaps){var L;s===c.TEXTURE_2D?v.forEach((function(e,t){var r;L="data"in e?a.texImage2DData(c,s,t,_,S,b,e):a.texImage2D(c,s,t,_,S,b,e),0===t&&(r=iS(L,2),R=r[0],C=r[1])})):s===c.TEXTURE_CUBE_MAP&&y.forEach((function(e,t){e.forEach((function(e,r){var i;L="data"in e?a.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,t,_,S,b,e):a.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,t,_,S,b,e),0===t&&(i=iS(L,2),R=i[0],C=i[1])}))}))}else f===e.TextureSourceType.compressed&&E&&(R=E[0].width,C=E[0].height,E.forEach((function(e,t){c.compressedTexImage2D(s,t,_,e.width,e.height,0,e.data)})));this.width=R,this.height=C,this.setTextureFilters(c,s,u)},r.prototype.setTextureFilters=function(e,t,r){var i=r.anisotropic,n=void 0===i?4:i,o=r.wrapS,a=void 0===o?e.CLAMP_TO_EDGE:o,s=r.wrapT,u=void 0===s?e.CLAMP_TO_EDGE:s,c=this.engine.gpuCapability;this.target===e.TEXTURE_2D&&c.setTextureAnisotropic(e,this.target,n);var l=vS(e)||jM(this.width)&&jM(this.height),f=r.minFilter?r.minFilter:e.NEAREST,h=r.magFilter?r.magFilter:e.NEAREST;e.texParameteri(t,e.TEXTURE_MIN_FILTER,f),e.texParameteri(t,e.TEXTURE_MAG_FILTER,h),e.texParameteri(t,e.TEXTURE_WRAP_S,l?a:e.CLAMP_TO_EDGE),e.texParameteri(t,e.TEXTURE_WRAP_T,l?u:e.CLAMP_TO_EDGE)},r.prototype.texImage2D=function(t,r,i,n,o,a,s){var u,c=this,l=this.source,f=l.sourceType,h=l.minFilter,p=l.magFilter;l.flipY;var d=l.wrapS,m=l.wrapT,v=null!==(u=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==u?u:2048,y=s;if(f!==e.TextureSourceType.video){var g=h!==t.NEAREST||p!==t.NEAREST||d!==t.CLAMP_TO_EDGE||m!==t.CLAMP_TO_EDGE;(g=g||s.width>v||s.height>v)&&setTimeout((function(){y=c.resizeImage(s)}))}t.texImage2D(r,i,n,o,a,y);var T=[y.width,y.height];if(f===e.TextureSourceType.video){var x=s;return[x.videoWidth,x.videoHeight]}return T},r.prototype.texImage2DData=function(e,t,r,i,n,o,a){var s=a.data,u=a.width,c=a.height,l=n===e.UNSIGNED_BYTE?new Uint8Array(s.buffer,s.byteOffset,s.byteLength/s.BYTES_PER_ELEMENT):s;return e.texImage2D(t,r,i,u,c,0,n,o,l),[u,c]},r.prototype.resizeImage=function(e,t,r){var i,n=null!==(i=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==i?i:2048;if(vS(this.pipelineContext.gl)&&e.width<n&&e.height<n)return e;var o=function(e,t,r,i){var n=e.width,o=e.height,a=Math.min(t,r||Ab(n)),s=Math.min(t,i||Ab(o));if(s!==o||a!==n){var u=HI.getCanvas(),c=u.getContext("2d");return u.width=a,u.height=s,null==c||c.drawImage(e,0,0,n,o,0,0,a,s),console.warn({content:"image resize from ".concat(n,"x").concat(o," to ").concat(a,"x").concat(s),type:oC}),u}}(e,n,t,r);return o||e},r.prototype.reloadData=function(){return eS(this,void 0,void 0,(function(){return tS(this,(function(e){switch(e.label){case 0:return this.offloaded?[4,dC().reload(this)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},r.prototype.offloadData=function(){if(this.initialized&&dC().canOffloadTexture(this.source.sourceFrom)){var e=this.target,t=this.pipelineContext.gl;if(t&&this.textureBuffer){var r=new Uint8Array([255]);if(this.bind(),e===t.TEXTURE_2D)t.texImage2D(e,0,t.LUMINANCE,1,1,0,t.LUMINANCE,t.UNSIGNED_BYTE,r);else if(e===t.TEXTURE_CUBE_MAP)for(var i=[t.TEXTURE_CUBE_MAP_NEGATIVE_X,t.TEXTURE_CUBE_MAP_NEGATIVE_Y,t.TEXTURE_CUBE_MAP_NEGATIVE_Z,t.TEXTURE_CUBE_MAP_POSITIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_Y,t.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<i.length;n++)t.texImage2D(i[n],0,t.LUMINANCE,1,1,0,t.LUMINANCE,t.UNSIGNED_BYTE,r);t.generateMipmap(e),this.width=1,this.height=1}this.offloaded=!0}},r.prototype.uploadCurrentVideoFrame=function(){return eS(this,void 0,void 0,(function(){var t;return tS(this,(function(r){switch(r.label){case 0:return this.source.sourceType===e.TextureSourceType.video&&this.source.video&&this.initialized?(t=this.source.video).paused?[4,t.play()]:[3,2]:[3,3];case 1:r.sent(),r.label=2;case 2:return this.update({video:this.source.video}),[2,!0];case 3:return[2,!1]}}))}))},r.prototype.updateSource=function(e){this.source=this.assembleOptions($A($A({},this.source),e)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},r.prototype.restore=function(){},r.prototype.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.source.sourceType===e.TextureSourceType.video&&this.source.video&&this.initialized&&(this.source.video.pause(),this.source.video.src="",this.source.video.load()),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){console.error({content:"this this texture has been destroyed",type:oC})},this.initialize=dR,void 0!==this.engine&&this.engine.removeTexture(this)},r}(iC);function jM(e){return 0==(e&e-1)&&0!==e}var XM,HM=function(){function e(e,t){this.engine=e,this.ready=!1,this.disposed=!1,this.gl=e.getGLPipelineContext().gl,this.vaoExt=e.gpuCapability.vaoExt,this.vao=this.createVertexArray(t)}return e.prototype.bind=function(){this.bindVertexArray(this.vao)},e.prototype.unbind=function(){this.bindVertexArray(null)},e.prototype.createVertexArray=function(e){var t=null;return vS(this.gl)&&(t=this.gl.createVertexArray()),!t&&this.vaoExt&&(t=this.vaoExt.createVertexArrayOES()),t&&ZM(t,e),t},e.prototype.bindVertexArray=function(e){var t;vS(this.gl)?this.gl.bindVertexArray(e):null===(t=this.vaoExt)||void 0===t||t.bindVertexArrayOES(e)},e.prototype.dispose=function(){var e;vS(this.gl)?this.gl.deleteVertexArray(this.vao):null===(e=this.vaoExt)||void 0===e||e.deleteVertexArrayOES(this.vao)},e}(),YM=1,WM=function(){function t(t){this.engine=t,this.textures=[],this.renderBuffers=[],this.frameBuffers=[],this.destroyed=!1;var r={width:1,height:1,data:new Uint8Array([255])},i=t.getGLPipelineContext(),n=i.gl;this.gl=n,this.pipelineContext=i,this.emptyTexture2D=new GM(t,{data:r,sourceType:e.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new GM(t,{target:n.TEXTURE_CUBE_MAP,cube:[r,r,r,r,r,r],sourceType:e.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+YM,YM++}return Object.defineProperty(t.prototype,"height",{get:function(){var e;return null===(e=this.gl)||void 0===e?void 0:e.drawingBufferHeight},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){var e;return null===(e=this.gl)||void 0===e?void 0:e.drawingBufferWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvas",{get:function(){return this.gl.canvas},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.copy2=function(e,t){var r=this.gl;if(r){this.sourceFbo||(this.sourceFbo=r.createFramebuffer()),this.targetFbo||(this.targetFbo=r.createFramebuffer());var i=this.pipelineContext,n=r.COLOR_ATTACHMENT0;i.bindFramebuffer(r.FRAMEBUFFER,this.sourceFbo),r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,e.textureBuffer,0),i.bindFramebuffer(r.FRAMEBUFFER,this.targetFbo),r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,t.textureBuffer,0),i.bindFramebuffer(r.READ_FRAMEBUFFER,this.sourceFbo),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.targetFbo);var o=e.getWidth()===e.getHeight()&&t.getWidth()==t.getHeight()?r.NEAREST:r.LINEAR;r.blitFramebuffer(0,0,e.getWidth(),e.getHeight(),0,0,t.getWidth(),t.getHeight(),r.COLOR_BUFFER_BIT,o),i.bindFramebuffer(r.FRAMEBUFFER,null),i.bindFramebuffer(r.READ_FRAMEBUFFER,null),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}},t.prototype.resetColorAttachments=function(e,t){e.bind(),e.resetColorTextures(t)},t.prototype.createGLRenderBuffer=function(e){var t=this.gl.createRenderbuffer();return t&&DS(this.renderBuffers,e),t},t.prototype.resize=function(e,t){var r=this.gl;(r&&r.drawingBufferWidth!==e||r.drawingBufferHeight!==t)&&(r.canvas.width=e,r.canvas.height=t,r.viewport(0,0,e,t),this.frameBuffers.forEach((function(r){var i=r.viewport;r.isCustomViewport||r.resize(i[0],i[1],e*r.viewportScale,t*r.viewportScale)})))},t.prototype.drawGeometry=function(e,t){if(this.gl){var r=e,i=t,n=i.shader.program;if(n){var o=n.setupAttributes(r),a=this.gl,s=r.indicesBuffer,u=r.drawStart,c=r.mode,l=r.drawCount;if(s){var f=s.type,h=s.elementCount;(l=isNaN(l)?h:l)>0&&a.drawElements(c,l,f,null!=u?u:0)}else l>0&&a.drawArrays(c,u,l);null==o||o.unbind()}else console.warn("Material "+i.name+" 的shader着色器程序未初始化。")}else console.warn("GLGPURenderer没有绑定gl对象, 无法绘制geometry")},t.prototype.createGLFrameBuffer=function(e,t){var r=this.gl.createFramebuffer();return r&&(DS(this.frameBuffers,e),ZM(r,t,t)),r},t.prototype.createVAO=function(e){return new HM(this.engine,e)},t.prototype.deleteGLTexture=function(e){e.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(e.textureBuffer),VS(this.textures,e),delete e.textureBuffer)},t.prototype.deleteGPUBuffer=function(e){e&&!this.destroyed&&(this.gl.deleteBuffer(e.glBuffer),delete e.glBuffer)},t.prototype.deleteGLFrameBuffer=function(e){e&&!this.destroyed&&(this.gl.deleteFramebuffer(e.fbo),VS(this.frameBuffers,e),delete e.fbo)},t.prototype.deleteGLRenderBuffer=function(e){e&&!this.destroyed&&(this.gl.deleteRenderbuffer(e.buffer),VS(this.renderBuffers,e),delete e.buffer)},t.prototype.deleteResource=function(){var e=this,t=this.gl;t&&(t.deleteFramebuffer(this.sourceFbo),t.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.frameBuffers.forEach((function(t){return e.deleteGLFrameBuffer(t)})),this.frameBuffers.length=0,this.renderBuffers.forEach((function(t){return e.deleteGLRenderBuffer(t)})),this.renderBuffers.length=0,this.textures.forEach((function(t){return e.deleteGLTexture(t)})),this.textures.length=0)},t.prototype.lost=function(e){console.error({content:"gl lost, destroy glRenderer by default",type:oC},e.target),this.deleteResource()},t.prototype.dispose=function(e){this.deleteResource();var t=this.gl;if(t&&e){var r=t.getExtension("WEBGL_lose_context");null==r||r.loseContext()}this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},t}();function ZM(e,t,r){void 0!==t&&(e.__SPECTOR_Metadata={name:t},e.__SPECTOR_Object_TAG?(e.__SPECTOR_Object_TAG.displayText=t,r&&(e.__SPECTOR_Object_TAG.id=r)):e.__SPECTOR_Object_TAG={displayText:t,id:""})}var qM,KM=function(){function e(e,t){this.pipelineContext=e,this.byteLength=0,this.destroyed=!1;var r=t.target,i=void 0===r?dS.ARRAY_BUFFER:r,n=t.type,o=void 0===n?dS.FLOAT:n,a=t.name,s=t.usage,u=void 0===s?dS.STATIC_DRAW:s,c=t.data,l=t.elementCount,f=function(e){var t,r;return null!==(r=null===(t=QM[e])||void 0===t?void 0:t.BYTES_PER_ELEMENT)&&void 0!==r?r:0}(o);this.target=i,this.type=o,this.usage=u,this.glBuffer=this.createGLBuffer(a),this.bytesPerElement=f,c?this.bufferData(c):l&&this.bufferData(f*l)}return Object.defineProperty(e.prototype,"elementCount",{get:function(){return this.byteLength/this.bytesPerElement},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.createGLBuffer=function(e){var t=this.pipelineContext.gl.createBuffer();return t&&ZM(t,e),t},e.prototype.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.prototype.bufferData=function(e){var t="number"==typeof e?e:e.byteLength;if(this.pipelineContext){this.byteLength=t;var r=this.pipelineContext.gl,i=this.target;r.bindBuffer(i,this.glBuffer),0===t?r.bufferData(i,1,this.usage):(r.bufferData(i,t,this.usage),"number"!=typeof e&&r.bufferSubData(i,0,e))}else this.byteLength=0},e.prototype.bufferSubData=function(e,t){if(this.pipelineContext){var r=this.pipelineContext.gl,i=this.target,n=e*this.bytesPerElement,o=n+t.byteLength;r.bindBuffer(i,this.glBuffer),o>this.byteLength&&(this.byteLength=o,r.bufferData(i,o,this.usage)),r.bufferSubData(i,n,t)}else this.byteLength=0},e.prototype.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.prototype.readSubData=function(e,t){return!!vS(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,e*this.bytesPerElement,t),!0)},e}(),QM=((XM={})[dS.INT]=Int32Array,XM[dS.FLOAT]=Float32Array,XM[dS.SHORT]=Int16Array,XM[dS.BYTE]=Int8Array,XM[dS.UNSIGNED_BYTE]=Uint8Array,XM[dS.UNSIGNED_INT]=Uint32Array,XM[dS.UNSIGNED_SHORT]=Uint16Array,XM);var JM=((qM={})[Uint8Array.BYTES_PER_ELEMENT]=dS.UNSIGNED_BYTE,qM[Uint16Array.BYTES_PER_ELEMENT]=dS.UNSIGNED_SHORT,qM[Uint32Array.BYTES_PER_ELEMENT]=dS.UNSIGNED_INT,qM),$M=1,ew=function(e){function t(t,r){var i=this,n=r.drawStart,o=void 0===n?0:n,a=r.drawCount,s=r.mode,u=r.indices,c=r.name,l=void 0===c?"effectsGeometry:".concat($M++):c,f=r.bufferUsage,h=void 0===f?dS.STATIC_DRAW:f;(i=e.call(this,l)||this).buffers={},i.vaos={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,i.engine=t;var p={},d=[],m={},v={},y={},g=h;return i.drawStart=o,i.drawCount=isNaN(+a)?NaN:a,i.mode=isNaN(s)?dS.TRIANGLES:s,Object.keys(r.attributes).forEach((function(e){var t=r.attributes[e],i=t.size,n=t.stride,o=t.offset,a=t.normalize,s=t,u=s.type,c=void 0===u?dS.FLOAT:u,l=s.releasable,f=t.data;if(!c||"dataSource"in t||f||(f=DC(c)),f){var h=f instanceof Float32Array?dS.FLOAT:dS.INT;p[e]={data:f,usage:g,target:dS.ARRAY_BUFFER,name:e},m[e]={size:i,stride:n,offset:o,type:null!=c?c:h,normalize:!!a,dataSource:e},y[e]=null!=l&&l,v[e]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var T=t.dataSource;T&&(m[e]={size:i,stride:n,offset:o,type:c,dataSource:T,normalize:!!a})}d.push(e)})),v.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},i.indices=null==u?void 0:u.data,i.indicesReleasable=!0===(null==u?void 0:u.releasable),i.bufferProps=p,i.attributes=m,i.attributesName=d,i.attributesReleasable=y,i.dirtyFlags=v,i.options=r,i}return JA(t,e),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isInitialized",{get:function(){return this.initialized},enumerable:!1,configurable:!0}),t.prototype.getOptions=function(){return $A({},this.options)},t.prototype.initialize=function(){var e=this;if(!this.initialized){var t=this.engine;eb(t),t.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(t){e.buffers[t]=new KM(r,e.bufferProps[t])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(r,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},t.prototype.getAttributeBuffer=function(e){if(this.initialized){var t=this.attributes[e].dataSource;return this.buffers[t]}},t.prototype.setAttributeData=function(e,t){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(e),i=this.attributes[e].dataSource;if(r){var n=r.usage,o=r.target;this.bufferProps[i]={data:t,usage:n,target:o,elementCount:t.length},this.dirtyFlags[i].discard=!0,this.dirtyFlags[i].dirty=!0}}},t.prototype.getAttributeData=function(e){if(null!=this.bufferProps){var t=this.getAttributeBufferOption(e);return t?t.data:void 0}},t.prototype.setAttributeSubData=function(e,t,r){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(e);if(i&&null!=i.data){var n=t,o=t+r.length;if(i.data.length<o){var a=new r.constructor(o);a.set(i.data),i.data=a,this.dirtyFlags[e].discard=!0}else if(!this.dirtyFlags[e].discard){var s=this.dirtyFlags[e];s.start=Math.min(s.start,n),s.end=Math.max(s.end,o-1)}i.data.set(r,n),this.dirtyFlags[e].dirty=!0}}},t.prototype.getIndexData=function(){return this.indices},t.prototype.setIndexData=function(e){(e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array)&&(this.indices=e,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},t.prototype.setIndexSubData=function(e,t){var r;if(this.indices){var i=e,n=e+t.length;if(this.indices.length<n){var o=new t.constructor(end);o.set(this.indices),this.indices=o,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var a=this.dirtyFlags.index;a.start=Math.min(a.start,i),a.end=Math.max(a.end,n-1)}null===(r=this.indices)||void 0===r||r.set(t,i),this.dirtyFlags.index.dirty=!0}},t.prototype.getAttributeStride=function(e){var t=this.attributes[e],r=t.stride,i=t.size,n=t.type;return r||i*FC[n]},t.prototype.getAttributeNames=function(){return this.attributesName},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.getAttributeBufferOption=function(e){var t=this.attributes[e];return t?this.bufferProps[t.dataSource]:void 0},t.prototype.createIndicesBuffer=function(e,t){var r=JM[t.BYTES_PER_ELEMENT],i={data:t,target:dS.ELEMENT_ARRAY_BUFFER,type:r,name:"".concat(this.name,"##index")};return new KM(e,i)},t.prototype.flush=function(){var e=this;if(this.initialized){var t=this.attributes,r=this.bufferProps,i=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var o,a,s=e.dirtyFlags[n];if("index"==n)o=e.indicesBuffer,a=i;else{var u=t[n].dataSource;o=e.buffers[u],a=r[u].data}if((s.dirty||s.discard)&&o&&a){if(s.discard)o.bufferData(a);else{var c=s.start*a.BYTES_PER_ELEMENT+a.byteOffset,l=s.end-s.start+1,f=new a.constructor(a.buffer,c,l);o.bufferSubData(s.start,f)}s.start=Number.POSITIVE_INFINITY,s.end=0,s.dirty=s.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(i){var n=e.attributesReleasable[i],o=t[i].dataSource;r[o]&&n&&(r[o].data=void 0)})),this.indicesReleasable}},t.prototype.dispose=function(){var e,t=this;this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized&&(Object.keys(this.buffers).forEach((function(e){t.buffers[e].dispose()})),this.buffers={},null===(e=this.indicesBuffer)||void 0===e||e.dispose(),Object.keys(this.vaos).forEach((function(e){var r;null===(r=t.vaos[e])||void 0===r||r.dispose(),t.vaos[e]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0)),this.destroyed=!0},t}(NC),tw=function(){function e(){this.reset()}return e.prototype.setBlendColor=function(e){var t=iS(e,4),r=t[0],i=t[1],n=t[2],o=t[3];this.blendColor[0]===r&&this.blendColor[1]===i&&this.blendColor[2]===n&&this.blendColor[3]===o||(this.blendColor[0]=r,this.blendColor[1]=i,this.blendColor[2]=n,this.blendColor[3]=o)},e.prototype.setBlending=function(e){this.blending!==e&&(this.blending=e)},e.prototype.setBlendFunctionParameters=function(e){var t=iS(e,4),r=t[0],i=t[1],n=t[2],o=t[3];this.blendFunctionParameters[0]===r&&this.blendFunctionParameters[1]===i&&this.blendFunctionParameters[2]===n&&this.blendFunctionParameters[3]===o||(this.blendFunctionParameters[0]=r,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=n,this.blendFunctionParameters[3]=o)},e.prototype.setBlendEquationParameters=function(e){var t=iS(e,2),r=t[0],i=t[1];this.blendEquationParameters[0]===r&&this.blendEquationParameters[1]===i||(this.blendEquationParameters[0]=r,this.blendEquationParameters[1]=i)},e.prototype.setDepthTest=function(e){this.depthTest!==e&&(this.depthTest=e)},e.prototype.setDepthMask=function(e){this.depthMask!==e&&(this.depthMask=e)},e.prototype.setDepthRange=function(e){this.depthRange[0]===e[0]&&this.depthRange[1]===e[1]||(this.depthRange[0]=e[0],this.depthRange[1]=e[1])},e.prototype.setDepthFunc=function(e){this.depthFunc!==e&&(this.depthFunc=e)},e.prototype.setPolygonOffsetFill=function(e){this.polygonOffsetFill!==e&&(this.polygonOffsetFill=e)},e.prototype.setPolygonOffset=function(e){this.polygonOffset[0]===e[0]&&this.polygonOffset[1]===e[1]||(this.polygonOffset[0]=e[0],this.polygonOffset[1]=e[1])},e.prototype.setSampleAlphaToCoverage=function(e){this.sampleAlphaToCoverage!==e&&(this.sampleAlphaToCoverage=e)},e.prototype.setColorMask=function(e){var t=iS(e,4),r=t[0],i=t[1],n=t[2],o=t[3];this.colorMask[0]===r&&this.colorMask[1]===i&&this.colorMask[2]===n&&this.colorMask[3]===o||(this.colorMask[0]=r,this.colorMask[1]=i,this.colorMask[2]=n,this.colorMask[3]=o)},e.prototype.setStencilTest=function(e){this.stencilTest!==e&&(this.stencilTest=e)},e.prototype.setStencilMask=function(e){this.stencilMask[0]===e[0]&&this.stencilMask[1]===e[1]||(this.stencilMask[0]=e[0],this.stencilMask[1]=e[1])},e.prototype.setStencilRef=function(e){this.stencilRef[0]===e[0]&&this.stencilRef[1]===e[1]||(this.stencilRef[0]=e[0],this.stencilRef[1]=e[1])},e.prototype.setStencilFunc=function(e){this.stencilFunc[0]===e[0]&&this.stencilFunc[1]===e[1]||(this.stencilFunc[0]=e[0],this.stencilFunc[1]=e[1])},e.prototype.setStencilOpFail=function(e){this.stencilOpFail[0]===e[0]&&this.stencilOpFail[1]===e[1]||(this.stencilOpFail[0]=e[0],this.stencilOpFail[1]=e[1])},e.prototype.setStencilOpZFail=function(e){this.stencilOpZFail[0]===e[0]&&this.stencilOpZFail[1]===e[1]||(this.stencilOpZFail[0]=e[0],this.stencilOpZFail[1]=e[1])},e.prototype.setStencilOpZPass=function(e){this.stencilOpZPass[0]===e[0]&&this.stencilOpZPass[1]===e[1]||(this.stencilOpZPass[0]=e[0],this.stencilOpZPass[1]=e[1])},e.prototype.setCulling=function(e){this.culling!==e&&(this.culling=e)},e.prototype.setFrontFace=function(e){this.frontFace!==e&&(this.frontFace=e)},e.prototype.setCullFace=function(e){this.cullFace!==e&&(this.cullFace=e)},e.prototype.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[dS.ONE,dS.ONE_MINUS_SRC_ALPHA,dS.ONE,dS.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[dS.FUNC_ADD,dS.FUNC_ADD],this.depthTest=!1,this.depthMask=!1,this.depthRange=[0,1],this.depthFunc=dS.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[dS.ALWAYS,dS.ALWAYS],this.stencilOpFail=[dS.KEEP,dS.KEEP],this.stencilOpZFail=[dS.KEEP,dS.KEEP],this.stencilOpZPass=[dS.KEEP,dS.KEEP],this.culling=!1,this.frontFace=dS.CW,this.cullFace=dS.FRONT},e.prototype.apply=function(e){if(e.toggle(dS.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),e.toggle(dS.BLEND,this.blending),e.toggle(dS.DEPTH_TEST,this.depthTest),e.toggle(dS.STENCIL_TEST,this.stencilTest),e.toggle(dS.CULL_FACE,this.culling),e.toggle(dS.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(e.stencilMaskSeparate(dS.BACK,this.stencilMask[1]),e.stencilMaskSeparate(dS.FRONT,this.stencilMask[0]),e.stencilFuncSeparate(dS.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),e.stencilFuncSeparate(dS.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),e.stencilOpSeparate(dS.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),e.stencilOpSeparate(dS.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var t=this,r=t.blendColor,i=t.blendEquationParameters,n=t.blendFunctionParameters;e.blendColor(r[0],r[1],r[2],r[3]),e.blendEquationSeparate(i[0],i[1]),e.blendFuncSeparate(n[0],n[1],n[2],n[3])}e.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(e.depthMask(this.depthMask),e.depthFunc(this.depthFunc),e.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(e.cullFace(this.cullFace),e.frontFace(this.frontFace)),this.polygonOffsetFill&&e.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},e}(),rw=function(t){function r(e,r){var i=t.call(this,r)||this;return i.floats={},i.ints={},i.vector2s={},i.vector3s={},i.vector4s={},i.matrices={},i.matrice3s={},i.textures={},i.floatArrays={},i.vector4Arrays={},i.matrixArrays={},i.samplers=[],i.uniforms=[],i.uniformDirtyFlag=!0,i.glMaterialState=new tw,i.engine=e,i}return JA(r,t),Object.defineProperty(r.prototype,"blending",{get:function(){return this.glMaterialState.blending},set:function(e){void 0!==e&&this.glMaterialState.setBlending(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendColor",{get:function(){return this.glMaterialState.blendColor},set:function(e){e&&this.glMaterialState.setBlendColor(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendFunction",{get:function(){return this.glMaterialState.blendFunctionParameters},set:function(e){e&&this.glMaterialState.setBlendFunctionParameters(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendEquation",{get:function(){return this.glMaterialState.blendEquationParameters},set:function(e){e&&this.glMaterialState.setBlendEquationParameters(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return this.glMaterialState.depthTest},set:function(e){void 0!==e&&this.glMaterialState.setDepthTest(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return this.glMaterialState.depthMask},set:function(e){void 0!==e&&this.glMaterialState.setDepthMask(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthRange",{get:function(){return this.glMaterialState.depthRange},set:function(e){e&&this.glMaterialState.setDepthRange(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthFunc",{get:function(){return this.glMaterialState.depthFunc},set:function(e){void 0!==e&&this.glMaterialState.setDepthFunc(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffsetFill",{get:function(){return this.glMaterialState.polygonOffsetFill},set:function(e){void 0!==e&&this.glMaterialState.setPolygonOffsetFill(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return this.glMaterialState.polygonOffset},set:function(e){e&&this.glMaterialState.setPolygonOffset(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sampleAlphaToCoverage",{get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(e){void 0!==e&&this.glMaterialState.setSampleAlphaToCoverage(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"colorMask",{get:function(){return this.glMaterialState.colorMask},set:function(e){e&&this.glMaterialState.setColorMask(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilTest",{get:function(){return this.glMaterialState.stencilTest},set:function(e){void 0!==e&&this.glMaterialState.setStencilTest(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilMask",{get:function(){return this.glMaterialState.stencilMask},set:function(e){e&&this.glMaterialState.setStencilMask(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilRef",{get:function(){return this.glMaterialState.stencilRef},set:function(e){e&&this.glMaterialState.setStencilRef(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilFunc",{get:function(){return this.glMaterialState.stencilFunc},set:function(e){e&&this.glMaterialState.setStencilFunc(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpFail",{get:function(){return this.glMaterialState.stencilOpFail},set:function(e){e&&this.glMaterialState.setStencilOpFail(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZFail",{get:function(){return this.glMaterialState.stencilOpZFail},set:function(e){e&&this.glMaterialState.setStencilOpZFail(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZPass",{get:function(){return this.glMaterialState.stencilOpZPass},set:function(e){e&&this.glMaterialState.setStencilOpZPass(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return this.glMaterialState.culling},set:function(e){void 0!==e&&this.glMaterialState.setCulling(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"frontFace",{get:function(){return this.glMaterialState.frontFace},set:function(e){void 0!==e&&this.glMaterialState.setFrontFace(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cullFace",{get:function(){return this.glMaterialState.cullFace},set:function(e){void 0!==e&&this.glMaterialState.setCullFace(e)},enumerable:!1,configurable:!0}),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.createMaterialStates=function(e){this.sampleAlphaToCoverage=!!e.sampleAlphaToCoverage,this.depthTest=e.depthTest,this.depthMask=e.depthMask,this.depthRange=e.depthRange,this.depthFunc=e.depthFunc,this.colorMask=e.colorMask,this.polygonOffset=e.polygonOffset,this.polygonOffsetFill=e.polygonOffsetFill,this.blending=e.blending,this.blendFunction=e.blendFunction,this.stencilTest=e.stencilTest},Object.defineProperty(r.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),r.prototype.initialize=function(){var e,t;if(!this.initialized){var r=this.engine;if(r.addMaterial(this),!this.shader){var i=r.getGLPipelineContext();this.shader=i.shaderLibrary.createShader(this.shaderSource)}this.shader.initialize(r);try{for(var n=rS(Object.values(this.textures)),o=n.next();!o.done;o=n.next()){o.value.initialize()}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.initialized=!0}},r.prototype.setupStates=function(e){this.glMaterialState.apply(e)},r.prototype.use=function(e,t){var r,i,n,o,a,s=e.engine.getGLPipelineContext();if(this.shader.program.bind(),this.setupStates(s),t){try{for(var u=rS(t.uniforms),c=u.next();!c.done;c=u.next())a=c.value,this.checkUniform(a)}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}try{for(var l=rS(t.samplers),f=l.next();!f.done;f=l.next())a=f.value,this.samplers.includes(a)||(this.samplers.push(a),this.uniformDirtyFlag=!0)}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}}if(this.uniformDirtyFlag&&(this.shader.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirtyFlag=!1),t){for(a in t.floats)this.shader.setFloat(a,t.floats[a]);for(a in t.ints)this.shader.setInt(a,t.ints[a]);for(a in t.matrices)this.shader.setMatrix(a,t.matrices[a])}for(a in this.textures)this.textures[a].textureBuffer||this.textures[a].initialize();for(a in this.floats)this.shader.setFloat(a,this.floats[a]);for(a in this.ints)this.shader.setInt(a,this.ints[a]);for(a in this.floatArrays)this.shader.setFloats(a,this.floatArrays[a]);for(a in this.textures)this.shader.setTexture(a,this.textures[a]);for(a in this.vector2s)this.shader.setVector2(a,this.vector2s[a]);for(a in this.vector3s)this.shader.setVector3(a,this.vector3s[a]);for(a in this.vector4s)this.shader.setVector4(a,this.vector4s[a]);for(a in this.matrices)this.shader.setMatrix(a,this.matrices[a]);for(a in this.matrice3s)this.shader.setMatrix3(a,this.matrice3s[a]);for(a in this.vector4Arrays)this.shader.setVector4Array(a,this.vector4Arrays[a]);for(a in this.matrixArrays)this.shader.setMatrixArray(a,this.matrixArrays[a])},r.prototype.getFloat=function(e){return this.floats[e]},r.prototype.setFloat=function(e,t){this.checkUniform(e),this.floats[e]=t},r.prototype.getInt=function(e){return this.ints[e]},r.prototype.setInt=function(e,t){this.checkUniform(e),this.ints[e]=t},r.prototype.getFloats=function(e){return this.floatArrays[e]},r.prototype.setFloats=function(e,t){this.checkUniform(e),this.floatArrays[e]=t},r.prototype.getVector2=function(e){return this.vector2s[e]},r.prototype.setVector2=function(e,t){this.checkUniform(e),this.vector2s[e]=t},r.prototype.getVector3=function(e){return this.vector3s[e]},r.prototype.setVector3=function(e,t){this.checkUniform(e),this.vector3s[e]=t},r.prototype.getVector4=function(e){return this.vector4s[e]},r.prototype.setVector4=function(e,t){this.checkUniform(e),this.vector4s[e]=t},r.prototype.getMatrix=function(e){return this.matrices[e]},r.prototype.setMatrix=function(e,t){this.checkUniform(e),this.matrices[e]=t},r.prototype.setMatrix3=function(e,t){this.checkUniform(e),this.matrice3s[e]=t},r.prototype.getVector4Array=function(e){return this.vector4Arrays[e]},r.prototype.setVector4Array=function(e,t){var r,i;this.checkUniform(e),this.vector4Arrays[e]=[];try{for(var n=rS(t),o=n.next();!o.done;o=n.next()){var a=o.value;this.vector4Arrays[e].push(a[0],a[1],a[2],a[3])}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},r.prototype.getMatrixArray=function(e){return this.matrixArrays[e]},r.prototype.setMatrixArray=function(e,t){var r,i;this.checkUniform(e),this.matrixArrays[e]=[];try{for(var n=rS(t),o=n.next();!o.done;o=n.next())for(var a=o.value,s=0;s<16;s++)this.matrixArrays[e].push(a[s])}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},r.prototype.setMatrixNumberArray=function(e,t){this.checkUniform(e),this.matrixArrays[e]=t},r.prototype.getTexture=function(e){return this.textures[e]},r.prototype.setTexture=function(e,t){this.samplers.includes(e)||(this.samplers.push(e),this.uniformDirtyFlag=!0),this.textures[e]=t},r.prototype.hasUniform=function(e){return this.uniforms.includes(e)||this.samplers.includes(e)},r.prototype.clone=function(e){var t=e||this.props,i=this.engine;eb(i);var n=new r(i,t);return n.glMaterialState=Object.assign(new tw,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirtyFlag=!0,n},r.prototype.cloneUniforms=function(e){var t,r=e;for(t in r.floats)this.setFloat(t,r.floats[t]);for(t in r.ints)this.setInt(t,r.ints[t]);for(t in r.floatArrays)this.setFloats(t,r.floatArrays[t]);for(t in r.textures)this.setTexture(t,r.textures[t]);for(t in r.vector2s)this.setVector2(t,r.vector2s[t]);for(t in r.vector3s)this.setVector3(t,r.vector3s[t]);for(t in r.vector4s)this.setVector4(t,r.vector4s[t]);for(t in r.matrices)this.setMatrix(t,r.matrices[t]);for(t in r.vector4Arrays){for(var i=[],n=0;n<r.vector4Arrays[t].length;n+=4)i.push([r.vector4Arrays[t][n],r.vector4Arrays[t][n+1],r.vector4Arrays[t][n+2],r.vector4Arrays[t][n+3]]);this.setVector4Array(t,i)}for(t in r.matrixArrays){var o=[];for(n=0;n<r.matrixArrays[t].length;n+=16){for(var a=Ib(),s=0;s<16;s++)a[s]=r.matrixArrays[t][n+s];o.push(a)}this.setMatrixArray(t,o)}},r.prototype.checkUniform=function(e){this.uniforms.includes(e)||(this.uniforms.push(e),this.uniformDirtyFlag=!0)},r.prototype.dispose=function(t){var r,i,n;if(!this.destroyed){if(null===(n=this.shader)||void 0===n||n.dispose(),(null==t?void 0:t.textures)!==e.DestroyOptions.keep)try{for(var o=rS(Object.values(this.textures)),a=o.next();!a.done;a=o.next()){a.value.dispose()}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=dR,this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMaterial(this),this.engine=void 0)}},r}(EC),iw=function(){function t(e){if(this.renderer=e,1===e.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(e);var t=this.copyRenderPass.meshes[0].material.shaderSource;e.pipelineContext.shaderLibrary.addShader(t)}}return t.prototype.resetColorAttachments=function(e,t){this.renderer&&e.resetColorAttachments(t)},t.prototype.copyTexture=function(t,r){this.renderer&&(t.initialize(),r.initialize(),r.updateSource({sourceType:e.TextureSourceType.framebuffer,data:{width:r.getWidth()||t.getWidth(),height:r.getHeight()||t.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(t,r):this.copy1(t,r))},t.prototype.copy2=function(e,t){var r,i=this.renderer.getFrameBuffer();null===(r=this.renderer)||void 0===r||r.glRenderer.copy2(e,t),this.renderer.setFrameBuffer(i)},t.prototype.copy1=function(e,t){var r=this.copyRenderPass;if(r){var i=this.renderer;if(i){var n=r.frameBuffer;n.viewport[2]=t.getWidth()||e.getWidth(),n.viewport[3]=t.getHeight()||e.getHeight(),i.glRenderer.resetColorAttachments(n,[t]),r.meshes[0].material.setTexture("uTex",e),i.renderRenderPass(r)}}},t.prototype.createCopyRenderPass=function(){var t="mri-copy-mesh",r={texture:{format:dS.RGBA}},i=this.renderer.engine,n=new ew(i,{name:t,mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=i.gpuCapability.level,a=new rw(i,{name:t,shader:{cacheId:"$mri-internal-copy",name:t,vertex:XR([],"\n precision highp float;\n attribute vec2 aPos;\n varying vec2 vTex;\n void main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n }\n ",e.ShaderType.vertex,o),fragment:XR([],"\n precision highp float;\n varying vec2 vTex;\n uniform sampler2D uTex;\n void main(){gl_FragColor = texture2D(uTex,vTex);}\n ",e.ShaderType.fragment,o),glslVersion:2===o?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1}});a.blending=!1,a.depthTest=!1,a.culling=!1;var s=new kC(i,{name:t,geometry:n,material:a,priority:0});return new nw(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:e.TextureLoadAction.whatever},attachments:[r],meshes:[s]})},t.prototype.dispose=function(){var e;this.renderer&&(null===(e=this.copyRenderPass)||void 0===e||e.dispose(),this.renderer=void 0)},t}(),nw=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t.prototype.configure=function(e){this.currentFrameBuffer=e.getFrameBuffer(),e.setFrameBuffer(this.frameBuffer)},t.prototype.execute=function(e){this.clearAction&&e.clear(this.clearAction),e.renderMeshes(this.meshes),this.storeAction&&e.clear(this.storeAction),e.setFrameBuffer(this.currentFrameBuffer)},t}(HC),ow=function(){function e(e,t,r){var i=this;void 0===t&&(t="webgl"),void 0===r&&(r={}),this.canvas=e,this.glType=t,this.restoreHandlers=[],this.lostHandlers=[],eb(e),this.gl=fS(e,t,r),this.contextLostListener=function(e){var t,r,n;try{for(var o=rS(i.lostHandlers),a=o.next();!a.done;a=o.next()){a.value.lost(e)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}null===(n=i.canvas)||void 0===n||n.removeEventListener("webglcontextlost",i.contextLostListener)},this.contextRestoredListener=function(e){var t,r,n;try{for(var o=rS(i.restoreHandlers),a=o.next();!a.done;a=o.next()){a.value.restore()}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}null===(n=i.canvas)||void 0===n||n.addEventListener("webglcontextlost",i.contextLostListener)},e.addEventListener("webglcontextlost",this.contextLostListener),e.addEventListener("webglcontextrestored",this.contextRestoredListener)}return e.prototype.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},e.prototype.addLostHandler=function(e){this.lostHandlers.push(e)},e.prototype.removeLostHandler=function(e){var t=this.lostHandlers.indexOf(e);t>-1&&this.lostHandlers.splice(t,1)},e.prototype.addRestoreHandler=function(e){this.restoreHandlers.push(e)},e.prototype.removeRestoreHandler=function(e){var t=this.restoreHandlers.indexOf(e);t>-1&&this.restoreHandlers.splice(t,1)},e}(),aw=function(e){function t(t,r){var i=e.call(this,t)||this;return i.initialized=!1,void 0!==r&&i.initialize(r),i}return JA(t,e),t.prototype.initialize=function(e){this.initialized||(this.initialized=!0,this.renderer=e,this.buffer=e.createGLRenderBuffer(this))},t.prototype.setSize=function(e,t){if(this.initialized){if(e!==this.size[0]||t!==this.size[1]){var r=this.renderer,i=r.gl;r.pipelineContext.bindRenderBuffer(i.RENDERBUFFER,this.buffer),e&&t?i.renderbufferStorage(i.RENDERBUFFER,this.format,this.size[0]=e,this.size[1]=t):console.error({content:"Invalid render buffer size: ".concat(e,"x").concat(t),type:oC})}}else console.error({content:"Can't set size for uninitialized render buffer",type:oC})},t.prototype.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderBuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=dR},t}(SO),sw=1,uw=function(t){function r(r,i){var n,o=t.call(this)||this;o.attachmentTextures=[],o.renderer=i,o.engine=i.engine;var a=r.depthStencilAttachment,s=r.viewport,u=r.isCustomViewport,c=r.viewportScale,l=void 0===c?1:c,f=r.storeAction,h=r.name,p=void 0===h?"GLFrameBuffer".concat(sw++):h;return o.depthStencilStorageType=null!==(n=null==a?void 0:a.storageType)&&void 0!==n?n:e.RenderPassAttachmentStorageType.none,o.viewport=s,o.isCustomViewport=!!u,o.viewportScale=l,o.name=p,o.storeAction=f,o.updateProps(r),o}return JA(r,t),Object.defineProperty(r.prototype,"stencilStorage",{get:function(){if(this.depthStencilStorageType!==e.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthStorage",{get:function(){if(this.depthStencilStorageType!==e.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderBuffer},enumerable:!1,configurable:!0}),r.prototype.getDepthTexture=function(){return this.depthTexture},r.prototype.getStencilTexture=function(){return this.stencilTexture},r.prototype.getColorTextures=function(){return this.colorTextures},r.prototype.updateAttachmentTextures=function(){var e=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(t){t.initialize(),DS(e.attachmentTextures,t.textureBuffer)})),this.stencilTexture&&DS(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&DS(this.attachmentTextures,this.depthTexture.textureBuffer)},r.prototype.updateProps=function(t){var r,i,n=this.renderer,o=this.engine.gpuCapability,a=null!==(r=t.depthStencilAttachment)&&void 0!==r?r:{storageType:e.RenderPassAttachmentStorageType.none},s=t.attachments.length>0;this.externalStorage=!1;var u=!0;if(t.attachments.length>1&&!o.detail.drawBuffers)throw Error("multiple color attachments not support");var c=null===(i=t.depthStencilAttachment)||void 0===i?void 0:i.texture,l=o.detail.readableDepthStencilTextures;if(this.colorTextures=t.attachments.slice(),!s&&a.storageType!==e.RenderPassAttachmentStorageType.none)throw Error("use depth stencil attachment without color attachments");s&&(this.fbo=n.glRenderer.createGLFrameBuffer(this,this.name));var f=a.storageType;if(f===e.RenderPassAttachmentStorageType.depth_stencil_opaque){if(a.storage){if(!(a.storage instanceof aw))throw Error("invalid depth stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new aw({format:dS.DEPTH_STENCIL,attachment:dS.DEPTH_STENCIL_ATTACHMENT,storageType:f},n.glRenderer);u=!1}else if(f===e.RenderPassAttachmentStorageType.depth_16_opaque)if(a.storage){if(!(a.storage instanceof aw))throw Error("invalid depth attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new aw({attachment:dS.DEPTH_ATTACHMENT,format:dS.DEPTH_COMPONENT16,storageType:f},n.glRenderer);else if(f===e.RenderPassAttachmentStorageType.stencil_8_opaque)if(a.storage){if(!(a.storage instanceof aw))throw Error("invalid stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new aw({attachment:dS.STENCIL_ATTACHMENT,format:dS.STENCIL_INDEX8,storageType:f},n.glRenderer);else if(f===e.RenderPassAttachmentStorageType.depth_16_texture){if(!l)throw Error("depth texture is not support in framebuffer");this.depthTexture=null!=c?c:new GM(this.engine,{sourceType:e.TextureSourceType.framebuffer,format:dS.DEPTH_COMPONENT,internalFormat:o.internalFormatDepth16,type:dS.UNSIGNED_SHORT,name:"".concat(this.name,"##depthTex")}),this.depthTexture.initialize()}else if(f===e.RenderPassAttachmentStorageType.depth_24_stencil_8_texture){if(!l)throw Error("depth stencil texture is not support in framebuffer");this.depthTexture=this.stencilTexture=null!=c?c:new GM(this.engine,{sourceType:e.TextureSourceType.framebuffer,format:dS.DEPTH_STENCIL,internalFormat:o.internalFormatDepth24_stencil8,type:o.UNSIGNED_INT_24_8,name:"".concat(this.name,"##dpthStclTex")}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},r.prototype.getStoreAttachments=function(t,r){var i=this.renderer.glRenderer.gl,n=this.colorTextures.length;if(t&&vS(i)&&n>0){var o=[];if(t.depthAction===e.TextureStoreAction.clear&&this.depthStorage&&DS(o,r?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===e.TextureStoreAction.clear&&this.stencilStorage&&DS(o,r?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===e.TextureStoreAction.clear)for(var a=0;a<n;a++)DS(o,i["COLOR_ATTACHMENT".concat(a)]);return o}},r.prototype.unbind=function(){var e=this.storeInvalidAttachments;if(null==e?void 0:e.length){var t=this.renderer.glRenderer.gl;t.invalidateFramebuffer(t.FRAMEBUFFER,e)}this.renderer.pipelineContext.bindSystemFramebuffer()},r.prototype.bind=function(){var e=this,t=this.renderer.glRenderer.gl,r=this.renderer.pipelineContext;if(this.fbo){var i=t.FRAMEBUFFER,n=iS(this.viewport,4),o=n[0],a=n[1],s=n[2],u=n[3];r.bindFramebuffer(i,this.fbo),r.viewport(o,a,s,u);var c=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(r.textureUnitDict).forEach((function(t){var i=r.textureUnitDict[t];i!==c&&i&&e.attachmentTextures.includes(i)&&(r.activeTexture(+t),e.renderer.glRenderer.emptyTexture2D.bind())}));for(var l=0;l<4;l++)r.activeTexture(t.TEXTURE0+l),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var f=this,h=f.depthStencilRenderBuffer,p=f.depthTexture,d=f.stencilTexture;if(r.activeTexture(t.TEXTURE0),h)h.setSize(s,u),t.framebufferRenderbuffer(i,h.attachment,t.RENDERBUFFER,h.buffer);else if(p){p.source.data={width:s,height:u},p.update({data:{width:s,height:u,data:new Uint16Array(0)}});var m=p&&d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTexture2D(i,m,t.TEXTURE_2D,p.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var v=t.checkFramebufferStatus(i);if(v!==t.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed, status: ".concat(v,", error: ").concat(t.getError()));this.ready=!0}}},r.prototype.resetColorTextures=function(e){var t,r,i=e,n=this.renderer.glRenderer.gl,o=this.engine.gpuCapability,a=this.viewport,s=[];if(i){try{for(var u=rS(i),c=u.next();!c.done;c=u.next()){c.value.initialize()}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}this.colorTextures=i.slice()}this.renderer.pipelineContext.activeTexture(n.TEXTURE0),this.colorTextures.forEach((function(e,t){var r={width:a[2],height:a[3],data:new Uint8Array(0)};e.update({data:r}),o.framebufferTexture2D(n,n.FRAMEBUFFER,t,n.TEXTURE_2D,e.textureBuffer),s.push(!0)})),o.drawBuffers(n,s),this.updateAttachmentTextures()},r.prototype.resize=function(e,t,r,i){var n=iS(this.viewport,4),o=n[0],a=n[1],s=n[2],u=n[3];o===e&&a===t&&s===r&&u===i||(this.viewport=[e,t,r,i],this.ready=!1,this.bind())},r.prototype.dispose=function(t){var r,i,n=this.renderer;if(n){n.glRenderer.deleteGLFrameBuffer(this),delete this.fbo;var o=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:e.RenderPassDestroyAttachmentType.force;(o===e.RenderPassDestroyAttachmentType.force||o===e.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)&&(null===(r=this.depthStencilRenderBuffer)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose()),this.renderer=this.stencilRenderBuffer=this.depthStencilRenderBuffer=null}},r}(PO);var cw,lw,fw=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0},hw=((cw={})[dS.FLOAT]=1,cw[dS.INT]=1,cw[dS.UNSIGNED_INT]=1,cw[dS.SHORT]=1,cw[dS.BOOL]=1,cw[dS.UNSIGNED_SHORT]=1,cw[dS.FLOAT_VEC2]=2,cw[dS.FLOAT_VEC3]=3,cw[dS.FLOAT_VEC4]=4,cw[dS.FLOAT_MAT2]=4,cw[dS.FLOAT_MAT3]=9,cw[dS.FLOAT_MAT4]=16,cw[dS.FLOAT_MAT2x3]=6,cw[dS.FLOAT_MAT2x4]=8,cw[dS.FLOAT_MAT4x3]=12,cw[dS.FLOAT_MAT4x2]=8,cw[dS.FLOAT_MAT3x4]=12,cw[dS.FLOAT_MAT3x2]=6,cw[dS.INT_VEC2]=2,cw[dS.INT_VEC3]=3,cw[dS.INT_VEC4]=4,cw[dS.UNSIGNED_INT_VEC2]=2,cw[dS.UNSIGNED_INT_VEC3]=3,cw[dS.UNSIGNED_INT_VEC4]=4,cw[dS.BOOL_VEC2]=2,cw[dS.BOOL_VEC3]=3,cw[dS.BOOL_VEC4]=4,cw),pw=yw(Float32Array),dw=yw(Int32Array),mw=yw(Uint8Array);function vw(e){return function(t,r,i,n){var o={start:r[1],dirty:!0};if(r[2]>1){var a=t;if(a.length){for(var s=n[1]||a.length,u=r[4]/e.BYTES_PER_ELEMENT,c=o.buffer=new e(s*u),l=n[0]||0,f=0;f<s;f++)c[f*u]=a[f+l];o.start+=l*u}}else o.buffer=new e([t]);return o}}function yw(e){return function(t,r,i,n){for(var o=r[8],a=r[2],s=r[5],u=1===a?o:r[4],c=s?u/s:1,l=u/e.BYTES_PER_ELEMENT/c,f=o/e.BYTES_PER_ELEMENT/l,h=hw[r[0]],p=h/c,d=(n[0]||0)*h,m=n[1]?c*n[1]:f,v=new e(l*m),y={start:r[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,T=0,x=d;g<m;g++){for(var E=0;E<p;E++)v[T+E]=t[x+E];T+=l,x+=p}return y}}function gw(e,t){for(var r=[],i=[],n=e.getProgramParameter(t,e.ACTIVE_UNIFORM_BLOCKS),o=function(n){var o=e.getActiveUniformBlockName(t,n),a={index:e.getUniformBlockIndex(t,o),usedByVertexShader:e.getActiveUniformBlockParameter(t,n,e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:e.getActiveUniformBlockParameter(t,n,e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:e.getActiveUniformBlockParameter(t,n,e.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:e.getActiveUniformBlockParameter(t,n,e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:o,id:""};a.used=a.usedByVertexShader||a.usedByFragmentShader,r[n]=a;for(var s=a.uniformIndices,u=[],c=0;c<s.length;c++){var l=e.getActiveUniform(t,s[c]).name.replace("[0]","");a.uniforms[l]=[0,0,0,0,0,0,0,c,0],u[c]=l,i.push(l)}[e.UNIFORM_TYPE,e.UNIFORM_OFFSET,e.UNIFORM_SIZE,e.UNIFORM_BLOCK_INDEX,e.UNIFORM_ARRAY_STRIDE,e.UNIFORM_MATRIX_STRIDE,e.UNIFORM_IS_ROW_MAJOR].forEach((function(r,i){e.getActiveUniforms(t,s,r).forEach((function(e,t){var r=u[t];a.uniforms[r][i]=+e}))}));for(c=0;c<u.length;c++){var f=a.uniforms[u[c]],h=a.uniforms[u[c+1]],p=h?h[1]:a.size;f[8]=p-f[1]}a.id=function(e){var t=e.name,r=e.size,i=e.uniforms,n=e.uniformIndices;return Object.keys(i).map((function(e){return"".concat(e,"[").concat(i[e].join(":"),"]")})).join("+"),fw("".concat(t,"+"),"".concat(r,"+"),"".concat(n.length,"+"))}(a)+""},a=0;a<n;++a)o(a);return{blockSpecs:r,blockUniformNames:i}}(lw={})[dS.FLOAT]=vw(Float32Array),lw[dS.INT]=vw(Int32Array),lw[dS.UNSIGNED_INT]=vw(Uint32Array),lw[dS.SHORT]=vw(Int16Array),lw[dS.BOOL]=vw(Uint8Array),lw[dS.UNSIGNED_SHORT]=vw(Uint16Array),lw[dS.FLOAT_VEC2]=pw,lw[dS.FLOAT_VEC3]=pw,lw[dS.FLOAT_VEC4]=pw,lw[dS.FLOAT_MAT2]=pw,lw[dS.FLOAT_MAT3]=pw,lw[dS.FLOAT_MAT4]=pw,lw[dS.FLOAT_MAT2x3]=pw,lw[dS.FLOAT_MAT2x4]=pw,lw[dS.FLOAT_MAT4x3]=pw,lw[dS.FLOAT_MAT4x2]=pw,lw[dS.FLOAT_MAT3x4]=pw,lw[dS.FLOAT_MAT3x2]=pw,lw[dS.INT_VEC2]=dw,lw[dS.INT_VEC3]=dw,lw[dS.INT_VEC4]=dw,lw[dS.UNSIGNED_INT_VEC2]=dw,lw[dS.UNSIGNED_INT_VEC3]=dw,lw[dS.UNSIGNED_INT_VEC4]=dw,lw[dS.BOOL_VEC2]=mw,lw[dS.BOOL_VEC3]=mw,lw[dS.BOOL_VEC4]=mw;var Tw=function(){function e(e,t,r,i){var n=this;this.engine=e,this.program=t,this.shared=r,this.id=i,this.uniformBlockMap={},this.pipelineContext=e.getGLPipelineContext();var o=this.pipelineContext.gl;if(this.pipelineContext.useProgram(t),this.attribInfoMap=this.createAttribMap(),vS(o)){var a=gw(o,t),s=a.blockSpecs;a.blockUniformNames,s.forEach((function(e){return n.uniformBlockMap[e.name]=e}))}this.pipelineContext.useProgram(null)}return e.prototype.bind=function(){this.pipelineContext.useProgram(this.program)},e.prototype.setupAttributes=function(e){var t,r,i=this,n=this.id,o=this.pipelineContext.gl;return e.vaos[n]?r=e.vaos[n]:((r=new HM(this.engine,"".concat(e.name,"-").concat(n)))||console.error("创建vao对象失败"),e.vaos[n]=r),r&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(t){var r=i.attribInfoMap[t],n=e.attributes[t];if(n){var a=e.buffers[n.dataSource];if(!a)throw Error("no buffer named ".concat(n.dataSource||t));a.bind(),o.enableVertexAttribArray(r.loc),o.vertexAttribPointer(r.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null===(t=e.indicesBuffer)||void 0===t||t.bind(),r&&(r.ready=!0)),r},e.prototype.createAttribMap=function(){for(var e=this.pipelineContext.gl,t=this.program,r={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var o=e.getActiveAttrib(t,n),a=o.name,s=o.type,u=o.size,c=e.getAttribLocation(t,a);r[a]={type:s,name:a,size:u,loc:c}}return r},e.prototype.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},e}(),xw=function(e){function t(t){var r=e.call(this,t)||this;return r.initialized=!1,r.uniformLocations={},r.samplerChannels={},r}return JA(t,e),t.prototype.initialize=function(e){this.initialized||e.getGLPipelineContext().shaderLibrary.compileShader(this)},t.prototype.setFloat=function(e,t){this.pipelineContext.setFloat(this.uniformLocations[e],t)},t.prototype.setInt=function(e,t){this.pipelineContext.setInt(this.uniformLocations[e],t)},t.prototype.setFloats=function(e,t){this.pipelineContext.setFloats(this.uniformLocations[e],t)},t.prototype.setTexture=function(e,t){this.pipelineContext.setTexture(this.uniformLocations[e],this.samplerChannels[e],t)},t.prototype.setVector2=function(e,t){this.pipelineContext.setVector2(this.uniformLocations[e],t)},t.prototype.setVector3=function(e,t){this.pipelineContext.setVector3(this.uniformLocations[e],t)},t.prototype.setVector4=function(e,t){this.pipelineContext.setVector4(this.uniformLocations[e],t)},t.prototype.setMatrix=function(e,t){this.pipelineContext.setMatrix(this.uniformLocations[e],t)},t.prototype.setMatrix3=function(e,t){this.pipelineContext.setMatrix3(this.uniformLocations[e],t)},t.prototype.setVector4Array=function(e,t){this.pipelineContext.setVector4Array(this.uniformLocations[e],t)},t.prototype.setMatrixArray=function(e,t){this.pipelineContext.setMatrixArray(this.uniformLocations[e],t)},t.prototype.fillShaderInformation=function(e,t){var r=t.slice();e=e.concat(r);for(var i,n=this.pipelineContext.getUniforms(this.program.program,e),o=0;o<e.length;o++)this.uniformLocations[e[o]]=n[o];for(i=0;i<r.length;i++){null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--)}for(i=0;i<r.length;i++){var a=r[i];this.samplerChannels[a]=i}},t.prototype.dispose=function(){var e;this.compileResult&&this.compileResult.shared||null===(e=this.program)||void 0===e||e.dispose()},t}(SC),Ew=0,Aw=function(){function t(e,t){this.engine=e,this.pipelineContext=t,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=e.gpuCapability.glAsyncCompileExt}return t.prototype.compileAllShaders=function(e){var t,r,i=this;if(this.shaderAllDone)e&&e([]);else{var n=[];try{for(var o=rS(Object.keys(this.cachedShaders)),a=o.next();!a.done;a=o.next()){var s=a.value;this.cachedShaders[s].initialized||n.push(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}e?n.length?Promise.all(n.map((function(e){return new Promise((function(t){return i.compileShader(i.cachedShaders[e],t)}))}))).then(e).catch((function(){return 0})):e([]):n.map((function(e){return i.compileShader(i.cachedShaders[e])})),this.shaderAllDone=!0}},t.prototype.addShader=function(t){var r=this.computeShaderCacheId(t);if(this.cachedShaders[r])return r;this.shaderAllDone=!1;var i=t.glslVersion===e.GLSLVersion.GLSL3?"#version 300 es\n":"",n=t.vertex?i+t.vertex:"",o=t.fragment?i+t.fragment:"",a=!1;return(t.shared||t.cacheId)&&(a=!0),this.cachedShaders[r]=new xw({vertex:n,fragment:o,name:t.name||r,shared:a}),this.cachedShaders[r].id=r,r},t.prototype.createShader=function(e){var t=this.addShader(e);return this.cachedShaders[t]},t.prototype.compileShader=function(t,r){var i=this,n=t.source,o=!1;(n.shared||n.cacheId)&&(o=!0);var a={vertex:n.vertex,fragment:n.fragment,name:n.name,shared:o},s=this.pipelineContext.gl,u={shared:a.shared,status:e.ShaderCompileResultStatus.compiling},c=this.createProgram(s,a.vertex,a.fragment,u),l=this.glAsyncCompileExt,f=performance.now(),h=function(r){u.status=e.ShaderCompileResultStatus.success,u.compileTime=performance.now()-f,t.program=r,t.initialized=!0,t.pipelineContext=i.pipelineContext,void 0!==i.programMap[t.id]&&console.warn("find duplicated shader id",t.id),i.programMap[t.id]=r},p=function(){var n=(!r||!l||l&&1==s.getProgramParameter(u.program,l.COMPLETION_STATUS_KHR))&&c();if(n){if(u.status!==e.ShaderCompileResultStatus.fail){ZM(n,a.name);var f=new Tw(i.engine,n,o,t.id);if(s.validateProgram(n),s.getProgramParameter(n,s.VALIDATE_STATUS))h(f);else{var d=s.getProgramInfoLog(n);(null==d?void 0:d.includes("the same texture"))?h(f):(u.status=e.ShaderCompileResultStatus.fail,u.error=d,console.error("compileProgramError: "+d,"\nvertex:\n",a.vertex,"\nfragment:\n",a.fragment),s.deleteProgram(n))}}r&&r(u)}else r&&requestAnimationFrame(p)};t.compileResult=u,p()},t.prototype.computeShaderCacheId=function(e){var t,r=e.vertex?e.vertex:"",i=e.fragment?e.fragment:"";return t=e.shared||e.cacheId?e.cacheId||"shared_".concat(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=0,i=0;i<arguments.length;i++)for(var n=e[i],o=0;o<n.length;o++)r=Math.imul(31,r)+n.charCodeAt(o)|0;return r}(r,i)):"instanced_"+Ew++,t},t.prototype.createProgram=function(t,r,i,n){var o=t.createProgram(),a=this.createGLShader(t,t.VERTEX_SHADER,r),s=this.createGLShader(t,t.FRAGMENT_SHADER,i);return o&&a&&s?(t.attachShader(o,a),t.attachShader(o,s),t.linkProgram(o),n.program=o,n.status=e.ShaderCompileResultStatus.compiling,function(){if(delete n.program,!t.getProgramParameter(o,t.LINK_STATUS)){var u=Sw(t,a,"vertex",r),c=Sw(t,s,"fragment",i);return n.status=e.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),c&&(n.error=c.error,n.status=c.status),o}return o}):(n.status=e.ShaderCompileResultStatus.fail,function(){return null})},t.prototype.createGLShader=function(e,t,r){var i=t===e.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=fw(null!=r?r:""),o=i.get(n);if(o)return o;var a=e.createShader(t);return a&&(e.shaderSource(a,r),e.compileShader(a),i.set(n,a)),a},t.prototype.deleteShader=function(e){var t=this.programMap[e];void 0!==t&&(t.dispose(),delete this.programMap[e]),void 0!==this.shaderResults[e]&&delete this.shaderResults[e]},t.prototype.restore=function(){},t.prototype.dispose=function(){if(Object.values(this.programMap).forEach((function(e){e.dispose()})),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},t}();function Sw(t,r,i,n){if(!t.getShaderParameter(r,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(r);return console.error("compile "+i+" error: "+o,(null!=n?n:"").split("\n").map((function(e,t){return"".concat(t+1," ").concat(e)})).join("\n")),{error:o,status:e.ShaderCompileResultStatus.fail}}}var bw=function(){function e(e,t){this.engine=e,this.gl=t,this.gl=t,this.shaderLibrary=new Aw(e,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}return e.prototype.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.prototype.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=dS.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderBuffer={}},e.prototype.toggle=function(e,t){t?this.enable(e):this.disable(e)},e.prototype.enable=function(e){!0!==this.glCapabilityCache[e]&&(this.glCapabilityCache[e]=!0,this.gl.enable(e))},e.prototype.disable=function(e){!1!==this.glCapabilityCache[e]&&(this.glCapabilityCache[e]=!1,this.gl.disable(e))},e.prototype.bindFramebuffer=function(e,t){this.currentFramebuffer[e]!==t&&(this.currentFramebuffer[e]=t,this.gl.bindFramebuffer(e,t))},e.prototype.bindRenderBuffer=function(e,t){this.currentRenderBuffer[e]!==t&&(this.currentRenderBuffer[e]=t,this.gl.bindRenderbuffer(e,t))},e.prototype.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.prototype.useProgram=function(e){this.set1("useProgram",e)},e.prototype.clear=function(e){this.gl.clear(e)},e.prototype.clearDepth=function(e){this.set1("clearDepth",e)},e.prototype.depthFunc=function(e){this.set1("depthFunc",e)},e.prototype.depthMask=function(e){this.set1("depthMask",e)},e.prototype.polygonOffset=function(e,t){this.set2("polygonOffset",e,t)},e.prototype.depthRange=function(e,t){this.set2("depthRange",e,t)},e.prototype.clearStencil=function(e){this.set1("clearStencil",e)},e.prototype.stencilMask=function(e){this.stencilMaskSeparate(this.gl.FRONT,e),this.stencilMaskSeparate(this.gl.BACK,e)},e.prototype.stencilFunc=function(e,t,r){this.stencilFuncSeparate(this.gl.FRONT,e,t,r),this.stencilFuncSeparate(this.gl.BACK,e,t,r)},e.prototype.stencilFuncSeparate=function(e,t,r,i){this.set4("stencilFuncSeparate",e,t,r,i)},e.prototype.stencilMaskSeparate=function(e,t){this.set2("stencilMaskSeparate",e,t)},e.prototype.stencilOp=function(e,t,r){this.stencilOpSeparate(this.gl.FRONT,e,t,r),this.stencilOpSeparate(this.gl.BACK,e,t,r)},e.prototype.stencilOpSeparate=function(e,t,r,i){this.set4("stencilOpSeparate",e,t,r,i)},e.prototype.cullFace=function(e){this.set1("cullFace",e)},e.prototype.frontFace=function(e){this.set1("frontFace",e)},e.prototype.clearColor=function(e,t,r,i){this.set4("clearColor",e,t,r,i)},e.prototype.colorMask=function(e,t,r,i){this.set4("colorMask",e,t,r,i)},e.prototype.blendColor=function(e,t,r,i){this.set4("blendColor",e,t,r,i)},e.prototype.blendFunc=function(e,t){this.blendFuncSeparate(e,t,e,t)},e.prototype.blendFuncSeparate=function(e,t,r,i){this.set4("blendFuncSeparate",e,t,r,i)},e.prototype.blendEquation=function(e){this.set1("blendEquation",e)},e.prototype.blendEquationSeparate=function(e,t){this.set2("blendEquationSeparate",e,t)},e.prototype.setPixelStorei=function(e,t){this.pixelStorei[e]!==t&&(this.pixelStorei[e]=t,this.gl.pixelStorei(e,t))},e.prototype.viewport=function(e,t,r,i){this.set4("viewport",e,t,r,i)},e.prototype.activeTexture=function(e){e=Math.min(e,this.maxTextureCount),this.activeTextureIndex!==e&&(this.activeTextureIndex=e,this.gl.activeTexture(e))},e.prototype.bindTexture=function(e,t,r){(this.currentTextureBinding!==t||r)&&(this.gl.bindTexture(e,t),this.currentTextureBinding=t),this.textureUnitDict[this.activeTextureIndex]=t},e.prototype.set1=function(e,t){this.glCapabilityCache[e]!==t&&(this.glCapabilityCache[e]=t,this.gl[e](t))},e.prototype.set2=function(e,t,r){var i=this.glCapabilityCache[e];i||(i=this.glCapabilityCache[e]={x:NaN,y:NaN}),i.x===t&&i.y===r||this.gl[e](i.x=t,i.y=r)},e.prototype.set3=function(e,t,r,i){var n=this.glCapabilityCache[e];n||(n=this.glCapabilityCache[e]={x:NaN,y:NaN,z:NaN}),n.x===t&&n.y===r&&n.z===i||this.gl[e](n.x=t,n.y=r,n.z=i)},e.prototype.set4=function(e,t,r,i,n){var o=this.glCapabilityCache[e];o||(o=this.glCapabilityCache[e]={x:NaN,y:NaN,z:NaN,w:NaN}),o.x===t&&o.y===r&&o.z===i&&o.w===n||this.gl[e](o.x=t,o.y=r,o.z=i,o.w=n)},e.prototype.get=function(e){return this.glCapabilityCache[e]},e.prototype.setFloat=function(e,t){e&&this.gl.uniform1f(e,t)},e.prototype.setInt=function(e,t){e&&this.gl.uniform1i(e,t)},e.prototype.setFloats=function(e,t){e&&this.gl.uniform1fv(e,t)},e.prototype.setVector2=function(e,t){this.setFloat2(e,t[0],t[1])},e.prototype.setVector3=function(e,t){this.setFloat3(e,t[0],t[1],t[2])},e.prototype.setVector4=function(e,t){this.setFloat4(e,t[0],t[1],t[2],t[3])},e.prototype.setVector4Array=function(e,t){e&&t.length%4==0&&this.gl.uniform4fv(e,t)},e.prototype.setMatrix=function(e,t){e&&16==t.length&&this.gl.uniformMatrix4fv(e,!1,t)},e.prototype.setMatrix3=function(e,t){e&&9==t.length&&this.gl.uniformMatrix3fv(e,!1,t)},e.prototype.setMatrixArray=function(e,t){e&&t.length%16==0&&this.gl.uniformMatrix4fv(e,!1,t)},e.prototype.setTexture=function(e,t,r){if(e){this.gl.activeTexture(this.gl.TEXTURE0+t);var i=r.target;this.gl.bindTexture(i,r.textureBuffer),this.gl.uniform1i(e,t)}},e.prototype.getUniforms=function(e,t){for(var r=[],i=0;i<t.length;i++)r.push(this.gl.getUniformLocation(e,t[i]));return r},e.prototype.setFloat4=function(e,t,r,i,n){e&&this.gl.uniform4f(e,t,r,i,n)},e.prototype.setFloat3=function(e,t,r,i){e&&this.gl.uniform3f(e,t,r,i)},e.prototype.setFloat2=function(e,t,r){e&&this.gl.uniform2f(e,t,r)},e}(),_w=function(e){function t(t){var r=e.call(this)||this;return r.gpuCapability=new _O(t),r}return JA(t,e),t.prototype.dispose=function(){this.isDestroyed||e.prototype.dispose.call(this)},t.prototype.getGLRenderer=function(){return this.renderer},t.prototype.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},t.prototype.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},t}(UM),Rw=function(t){function r(r,i,n){var o=t.call(this)||this;o.canvas=r,o.temporaryRTs={};var a=$A({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},n);o.context=new ow(r,i,a);var s=o.context.gl;return eb(s),o.engine=new _w(s),o.engine.renderer=o,o.pipelineContext=new bw(o.engine,s),o.glRenderer=new WM(o.engine),o.extension=new iw(o),o.renderingData={currentFrame:{}},o.frameBuffer=new uw({storeAction:{},viewport:[0,0,o.width,o.height],attachments:[new GM(o.engine,{sourceType:e.TextureSourceType.framebuffer,data:{width:o.width,height:o.height}})],depthStencilAttachment:{storageType:e.RenderPassAttachmentStorageType.none}},o),o}return JA(r,t),Object.defineProperty(r.prototype,"isDestroyed",{get:function(){var e=this.glRenderer;return!e||e.isDestroyed},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){var e;return(null===(e=this.glRenderer)||void 0===e?void 0:e.height)||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){var e;return(null===(e=this.glRenderer)||void 0===e?void 0:e.width)||0},enumerable:!1,configurable:!0}),r.prototype.renderRenderFrame=function(e){var t,r,i,n,o=e;o.resource&&o.resource.color_b.initialize(),o.emptyTexture.initialize(),o.transparentTexture.initialize();var a=o._renderPasses;if(this.isDestroyed)return console.error("renderer is destroyed",this);o.renderer.getShaderLibrary().compileAllShaders(),this.setFrameBuffer(null),this.clear(o.clearAction),this.renderingData.currentFrame=o,this.renderingData.currentCamera=o.camera,KS(a);try{for(var s=rS(a),u=s.next();!u.done;u=s.next()){var c=(h=u.value).delegate;c.willBeginRenderPass&&(null==c||c.willBeginRenderPass(h,this.renderingData)),this.renderRenderPass(h),c.didEndRenderPass&&(null==c||c.didEndRenderPass(h,this.renderingData))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}try{for(var l=rS(a),f=l.next();!f.done;f=l.next()){var h;(h=f.value).frameCleanup(this)}}catch(e){i={error:e}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(i)throw i.error}}},r.prototype.renderRenderPass=function(e){this.renderingData.currentPass=e,e.initialize(this),e.configure(this),e.execute(this)},r.prototype.renderMeshes=function(e){var t,r,i=this.renderingData.currentPass.delegate;try{for(var n=rS(e),o=n.next();!o.done;o=n.next()){var a=o.value;a.isDestroyed||(a.getVisible()||(a.material?(a.material.initialize(),a.geometry.initialize(),i.willRenderMesh&&i.willRenderMesh(a,this.renderingData),a.render(this),i.didiRenderMesh&&i.didiRenderMesh(a,this.renderingData)):console.warn("Mesh "+a.name+" 没有绑定材质。")))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},r.prototype.setGlobalFloat=function(e,t){this.checkGlobalUniform(e),this.renderingData.currentFrame.globalUniforms.floats[e]=t},r.prototype.setGlobalInt=function(e,t){this.checkGlobalUniform(e),this.renderingData.currentFrame.globalUniforms.ints[e]=t},r.prototype.setGlobalMatrix=function(e,t){this.checkGlobalUniform(e),this.renderingData.currentFrame.globalUniforms.matrices[e]=t},r.prototype.drawGeometry=function(e,t){this.glRenderer.drawGeometry(e,t)},r.prototype.setFrameBuffer=function(e){e?(this.frameBuffer=e,this.frameBuffer.bind(),this.setViewport(e.viewport[0],e.viewport[1],e.viewport[2],e.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.prototype.getFrameBuffer=function(){return this.frameBuffer},r.prototype.getTemporaryRT=function(t,r,i,n,o,a){if(this.temporaryRTs[t])return this.temporaryRTs[t];var s,u,c=e.RenderPassAttachmentStorageType.none;o===e.FilterMode.Linear?s=dS.LINEAR:o===e.FilterMode.Nearest&&(s=dS.NEAREST),a===e.RenderTextureFormat.RGBA32?u=dS.UNSIGNED_BYTE:a===e.RenderTextureFormat.RGBAHalf&&(u=dS.HALF_FLOAT),0===n?c=e.RenderPassAttachmentStorageType.none:16===n?c=e.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(c=e.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var l=new GM(this.engine,{sourceType:e.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:dS.RGBA,format:dS.RGBA,type:u}),f=new uw({name:t,storeAction:{},viewport:[0,0,r,i],viewportScale:1,isCustomViewport:!0,attachments:[l],depthStencilAttachment:{storageType:c}},this);return this.temporaryRTs[t]=f,f},r.prototype.setViewport=function(e,t,r,i){this.pipelineContext.viewport(e,t,r,i)},r.prototype.clear=function(t){var r=this.pipelineContext,i=0;if(t.colorAction===e.TextureLoadAction.clear){var n=t.clearColor;n&&r.clearColor(n[0],n[1],n[2],n[3]),r.colorMask(!0,!0,!0,!0),i=dS.COLOR_BUFFER_BIT}if(t.stencilAction===e.TextureLoadAction.clear&&(r.stencilMask(255),r.clearStencil(t.clearStencil||0),i|=dS.STENCIL_BUFFER_BIT),t.depthAction===e.TextureLoadAction.clear){var o=t.clearDepth;r.depthMask(!0),r.clearDepth(Number.isFinite(o)?o:1),i|=dS.DEPTH_BUFFER_BIT}i&&r.clear(i)},r.prototype.addLostHandler=function(e){this.context.addLostHandler(e)},r.prototype.addRestoreHandler=function(e){this.context.addRestoreHandler(e)},r.prototype.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.prototype.getWidth=function(){return this.width},r.prototype.getHeight=function(){return this.height},r.prototype.dispose=function(e){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null===(t=this.glRenderer)||void 0===t||t.dispose(e),this.canvas=null,this.engine.dispose()},r.prototype.lost=function(e){e.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(e)},r.prototype.restore=function(){var e=this.context.gl;if(!e)throw new Error("Can not restore automatically because losing gl context");this.engine=new _w(e),this.engine.renderer=this,this.pipelineContext=new bw(this.engine,e),this.glRenderer=new WM(this.engine),this.extension=new iw(this)},r.prototype.resize=function(e,t){var r=this.glRenderer;r&&(this.width===e&&this.height===t||r.resize(e,t))},r.prototype.checkGlobalUniform=function(e){var t=this.renderingData.currentFrame.globalUniforms;t.uniforms.includes(e)||t.uniforms.push(e)},r}(MO),Cw="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Ow="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Lw="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Iw="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Pw="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Mw="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg";var ww=new Map,Fw=!1,Nw=1,Dw=function(){function t(e){var t,r,i=this;this.compositions=[],this.displayScale=1,this.resumePending=!1,this.disposed=!1,this.speed=1,this.baseCompositionIndex=0,this.lost=function(e){var t,r;null===(t=i.ticker)||void 0===t||t.pause(),i.compositions.forEach((function(t){return t.lost(e)})),i.renderer.lost(e),null===(r=i.handleWebGLContextLost)||void 0===r||r.call(i,e),Uw(i,!1)},this.restore=function(){return eS(i,void 0,void 0,(function(){var e,t,r,i=this;return tS(this,(function(n){switch(n.label){case 0:return this.renderer.restore(),e=this,[4,Promise.all(this.compositions.map((function(e){return eS(i,void 0,void 0,(function(){var t,r,i,n,o,a,s,u,c,l,f,h;return tS(this,(function(p){switch(p.label){case 0:return t=e.time,r=e.url,i=e.speed,n=e.keepResource,o=e.reusable,a=e.renderOrder,s=e.transform,u=e.videoState,[4,this.loadScene(r)];case 1:(c=p.sent()).speed=i,c.reusable=o,c.keepResource=n,c.renderOrder=a,c.transform=s,l=0,p.label=2;case 2:return l<u.length?u[l]?((f=c.textures[l].source.video).currentTime=null!==(h=u[l])&&void 0!==h?h:0,[4,f.play()]):[3,4]:[3,5];case 3:p.sent(),p.label=4;case 4:return l++,[3,2];case 5:return c.content.start(),c.gotoAndPlay(t),[2,c]}}))}))})))];case 1:return e.compositions=n.sent(),null===(t=this.handleWebGLContextRestored)||void 0===t||t.call(this),null===(r=this.ticker)||void 0===r||r.resume(),[2]}}))}))},this.handleResume=function(){var e;null===(e=i.handlePlayableUpdate)||void 0===e||e.call(i,{player:i,playing:!0})},this.handleClick=function(e){var t=e.x,r=e.y;i.compositions.forEach((function(e){var n,o=e.hitTest(t,r);if(o.length)for(var a=0;a<o.length;a++){var s=o[a].behavior||RS.NOTIFY;if(s===RS.NOTIFY){var u=o[a],c=u.name,l=u.id,f=u.hitPositions;null===(n=i.handleItemClicked)||void 0===n||n.call(i,{name:c,player:i,composition:e.name,id:l,compositionId:e.id,hitPositions:f})}else s===RS.RESUME_PLAYER&&i.resume()}}))};var n=e.container,o=e.canvas,a=e.gl,s=e.fps,u=e.name,c=e.pixelRatio,l=e.manualRender,f=e.interactive,h=e.reportGPUTime,p=e.onMessageItem,d=e.onPausedByItem,m=e.onItemClicked,v=e.onPlayableUpdate,y=e.onRenderError,g=e.onWebGLContextLost,T=e.onWebGLContextRestored,x=e.renderFramework,E=e.env,A=void 0===E?"":E,S=e.notifyTouch;if(pS.length)throw new Error("Errors before player create: ".concat(pS.map((function(e,t){return"\n ".concat(t+1,": ").concat(e)}))));var b=null!==(r=null!==(t=e.renderOptions)&&void 0!==t?t:e)&&void 0!==r?r:{},_=b.willCaptureImage,R=b.premultiplyAlpha;if(!Fw&&"debug-disable"!==x){var C=YS()||function(){var e=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent);return!!e&&("13"===e[1]||"16"===e[1]&&"5"===e[2])}()?"webgl":"webgl2";if(x&&(C="webgl"===x?"webgl":"webgl2"),this.handleWebGLContextLost=g,this.handleWebGLContextRestored=T,this.reportGPUTime=h,this.handleItemClicked=m,this.handleMessageItem=p,this.handlePlayableUpdate=v,this.handleRenderError=y,this.handlePlayerPause=function(e){i.pause(),null==d||d({name:e.name,player:i})},this.pixelRatio=Number.isFinite(c)?c:HS(),this.offscreenMode=!0,this.env=A,o)this.canvas=o;else if(a){this.canvas=a.canvas;var O=a instanceof WebGLRenderingContext?"webgl":"webgl2";C!==O&&(console.error({content:"The gl context(".concat(O,") is inconsistent with renderFramework or default version(").concat(C,")"),type:oC}),C=O)}else Bw(n),this.canvas=document.createElement("canvas"),n.appendChild(this.canvas);ww.forEach((function(e){if(e.gpuCapability.type!==C)throw new Error("Initialize player with different webgl version: old=".concat(e.gpuCapability.type,", new=").concat(C))})),this.renderer=MO.create(this.canvas,C,{preserveDrawingBuffer:_,premultipliedAlpha:R}),this.renderer.env=A,this.renderer.addLostHandler({lost:this.lost}),this.renderer.addRestoreHandler({restore:this.restore}),this.gpuCapability=this.renderer.engine.gpuCapability,ww.forEach((function(e){e.gpuCapability.type!==i.gpuCapability.type&&console.warn({content:"Create player with different webgl version: old=".concat(e.gpuCapability.type,", new=").concat(i.gpuCapability.type),type:oC})})),l||(this.ticker=new BM(s),this.ticker.add(this.tick.bind(this))),this.event=new UR(this.canvas,!!S),this.event.bindListeners(),this.event.addEventListener(wR,this.handleClick),this.interactive=null!=f&&f,this.name=u||"".concat(Nw++),a||this.resize(),zO(this.gpuCapability.detail),this.container=this.canvas.parentElement,ww.set(this.canvas,this),function(){var e,t,r=[];try{for(var i=rS(ww.values()),n=i.next();!n.done;n=i.next()){var o=n.value;o.paused||r.push(o)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}r.length>1&&console.error({content:"Current running player count: ".concat(r.length,", see ").concat(Mw),type:oC},r)}(),Uw(this,!0)}}return t.prototype.setSpeed=function(e){isNaN(e)||(this.speed=e)},t.prototype.getSpeed=function(){return this.speed},t.prototype.getCompositionByName=function(e){return this.compositions.find((function(t){return t.name===e}))},t.prototype.getCompositions=function(){return this.compositions},Object.defineProperty(t.prototype,"hasPlayable",{get:function(){return this.compositions.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paused",{get:function(){var e;return null===(e=this.ticker)||void 0===e?void 0:e.getPaused()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"interactive",{get:function(){return this.event.enabled},set:function(e){this.event.enabled=e},enumerable:!1,configurable:!0}),t.prototype.loadScene=function(e,t){var r;return eS(this,void 0,void 0,(function(){var i,n,o=this;return tS(this,(function(a){switch(a.label){case 0:return n=this.baseCompositionIndex,cR(e)?(this.baseCompositionIndex+=e.length,[4,Promise.all(e.map((function(e,r){return eS(o,void 0,void 0,(function(){var i;return tS(this,(function(o){switch(o.label){case 0:return[4,this.createComposition(e,t)];case 1:return(i=o.sent()).setIndex(n+r),[2,i]}}))}))})))]):[3,2];case 1:return i=a.sent(),[3,4];case 2:return this.baseCompositionIndex+=1,[4,this.createComposition(e,t)];case 3:(i=a.sent()).setIndex(n),a.label=4;case 4:return null===(r=this.ticker)||void 0===r||r.start(),[2,i]}}))}))},t.prototype.createComposition=function(e,t){return void 0===t&&(t={}),eS(this,void 0,void 0,(function(){var r,i,n,o,a,s,u,c=this;return tS(this,(function(l){switch(l.label){case 0:return r=this.renderer,i=performance.now(),n=$A({autoplay:!0},t),Vw(e)?(a=e.scene,n=$A($A({},n),e.options||{})):a=e,this.assetManager?this.assetManager.updateOptions(n):this.assetManager=new MM(n),IM(a)?(o=a,[3,3]):[3,1];case 1:return[4,this.assetManager.loadScene(a,this.renderer,{env:this.env})];case 2:o=l.sent(),l.label=3;case 3:return s=new VM($A($A({},n),{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,handlePlayerPause:this.handlePlayerPause,handleMessageItem:this.handleMessageItem}),o),this.ticker&&s.renderLevel===TS.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),[4,new Promise((function(e){c.renderer.getShaderLibrary().compileAllShaders((function(){e(null)}))}))];case 4:return l.sent(),n.autoplay?(this.autoPlaying=!0,s.play()):s.pause(),u=performance.now()-i+s.statistic.loadTime,s.statistic.firstFrameTime=u,console.info({content:"first frame: [".concat(s.name,"]").concat(u.toFixed(4),"ms"),type:oC}),this.compositions.push(s),[2,s]}}))}))},t.prototype.play=function(){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.play()})),null===(e=this.ticker)||void 0===e||e.start()},t.prototype.gotoAndPlay=function(e){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.gotoAndPlay(e)})),this.ticker?this.ticker.start():this.doTick(0,!0)},t.prototype.gotoAndStop=function(e){var t,r;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(t){t.gotoAndStop(e)})),this.ticker&&!(null===(t=this.ticker)||void 0===t?void 0:t.getPaused())||this.doTick(0,!0),null===(r=this.handlePlayableUpdate)||void 0===r||r.call(this,{player:this,playing:!1})},t.prototype.playSequence=function(e){for(var t,r=function(t){var r=e[t],i=r.handleEnd;r.handleEnd=function(){null==i||i.call(r,r),e[t+1].play()}},i=0;i<e.length-1;i++)r(i);e[0].play(),null===(t=this.ticker)||void 0===t||t.start()},t.prototype.pause=function(e){var t,r;this.paused||(null===(t=this.ticker)||void 0===t||t.pause(),null===(r=this.handlePlayableUpdate)||void 0===r||r.call(this,{player:this,playing:!1}),e&&e.offloadTexture&&this.offloadTexture())},t.prototype.resume=function(){var e;return eS(this,void 0,void 0,(function(){return tS(this,(function(t){switch(t.label){case 0:return this.resumePending?[2]:this.paused?(this.resumePending=!0,[4,Promise.all(this.compositions.map((function(e){return e.reloadTexture()})))]):[3,2];case 1:t.sent(),this.resumePending=!1,this.handleResume(),t.label=2;case 2:return null===(e=this.ticker)||void 0===e||e.resume(),[2]}}))}))},t.prototype.tick=function(e){this.doTick(e,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},t.prototype.doTick=function(t,r){var i,n,o,a=this;t=Math.min(t,33)*this.speed;var s=!1,u=this.compositions,c=!1;if(u.sort((function(e,t){return e.getIndex()-t.getIndex()})),u.forEach((function(e,r){return e.textureOffloaded&&(c=!0,console.error({content:"Composition ".concat(e.name," texture offloaded, skip render."),type:oC})),e.isDestroyed?(delete u[r],void(s=!0)):(e.renderer&&e.update(t),e.isDestroyed?(delete u[r],void(s=!0)):void 0)})),s&&((u=u.filter((function(e){return e}))).map((function(e,t){return e.setIndex(t)})),this.compositions=u),this.baseCompositionIndex=u.length,c)return null===(i=this.handleRenderError)||void 0===i||i.call(this,new Error("play when texture offloaded")),null===(n=this.ticker)||void 0===n?void 0:n.pause();if(!this.paused||r){var l=this.gpuCapability.level,f=this.renderer.context.gl,h=2===l&&this.reportGPUTime?hS(f):void 0;if(null==h||h.begin(),this.compositions.length||r){this.renderer.setFrameBuffer(null),this.renderer.clear({stencilAction:e.TextureLoadAction.clear,clearStencil:0,depthAction:e.TextureLoadAction.clear,clearDepth:1,colorAction:e.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var p=0;p<u.length;p++)!u[p].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(u[p].renderFrame)}null==h||h.end(),null==h||h.getTime().then((function(e){var t;return null===(t=a.reportGPUTime)||void 0===t?void 0:t.call(a,null!=e?e:0)})).catch,this.autoPlaying&&(null===(o=this.handlePlayableUpdate)||void 0===o||o.call(this,{player:this,playing:!0}))}},t.prototype.resizeToAspect=function(e,t){void 0===t&&(t=1),e!==this.displayAspect&&(this.displayAspect=e),t!==this.displayScale&&(this.displayScale=t),this.resize()},t.prototype.resize=function(){var e,t,r,i,n,o=this.canvas.parentElement;if(o){var a=this.getTargetSize(o);t=a[0],r=a[1],i=a[2],n=a[3]}else t=i=this.canvas.width,r=n=this.canvas.height;var s=t/r;if(t&&r){var u=document.documentElement.clientWidth;i>2*u&&console.error({content:"DPI overflowed, width ".concat(i," is more than 2x document width ").concat(u,", see ").concat(Ow),type:oC});var c=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>c||n>c)&&(console.error({content:"Container size overflowed ".concat(i,"x").concat(n,", see ").concat(Cw),type:oC}),s>1?(i=Math.round(c),n=Math.round(c/s)):(n=Math.round(c),i=Math.round(c*s))),this.renderer.resize(i,n),this.canvas.style.width=t+"px",this.canvas.style.height=r+"px",console.debug("Resize player ".concat(this.name," [").concat(i,",").concat(n,",").concat(t,",").concat(r,"].")),null===(e=this.compositions)||void 0===e||e.forEach((function(e){e.camera.aspect=s}))}},t.prototype.clearCanvas=function(t){t?this.renderer.clear({stencilAction:e.TextureLoadAction.clear,clearStencil:0,depthAction:e.TextureLoadAction.clear,clearDepth:1,colorAction:e.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},t.prototype.destroyItem=function(e,t){},t.prototype.destroyCurrentCompositions=function(){this.compositions.forEach((function(e){return e.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},t.prototype.dispose=function(e){var t,r;console.debug("call player destroy: ".concat(this.name)),this.disposed||(ww.delete(this.canvas),this.pause(),null===(t=this.ticker)||void 0===t||t.stop(),null===(r=this.assetManager)||void 0===r||r.dispose(),this.compositions.forEach((function(e){return e.dispose()})),this.compositions.length=0,this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.event.dispose(),this.renderer.dispose(!e),Uw(this,!1),this.canvas instanceof HTMLCanvasElement&&!e&&this.renderer.context&&(HI.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove()),this.tick=zw,this.resize=zw,this.loadScene=Gw,this.play=Gw,this.resume=Gw,this.disposed=!0)},t.prototype.offloadTexture=function(){this.compositions.forEach((function(e){return e.offloadTexture()}))},t.prototype.getTargetSize=function(e){Bw(e);var t,r,i=this.displayAspect;i?e.clientWidth/e.clientHeight>i?t=(r=e.clientHeight*this.displayScale)*i:r=(t=e.clientWidth*this.displayScale)/i:(t=e.clientWidth,r=e.clientHeight);var n=this.pixelRatio,o=t,a=r;if(t=Math.round(t*n),(r=Math.round(r*n))<1||r<1){if(!this.offscreenMode)throw Error("Invalid container size ".concat(t,"x").concat(r,", see ").concat(Lw));t=r=o=a=1}return[o,a,t,r]},t}();function Vw(e){return fR(e)&&"scene"in e}function Uw(e,t){Object.values(ER).forEach((function(r){var i=t?r.onPlayerCreated:r.onPlayerDestroy;null==i||i(e)}))}function Bw(e){if(null==e)throw new Error("Container is not an HTMLElement, see ".concat(Iw))}var kw="Never use destroyed player again, see ".concat(Pw);function zw(){throw new Error(kw)}function Gw(){return Promise.reject(kw)}iC.create=function(e,t){return new GM(e,t)},iC.createWithData=function(t,r,i){void 0===r&&(r=ZS("#fff")),void 0===i&&(i={});var n=i,o=n.type,a=void 0===o?dS.UNSIGNED_BYTE:o,s=n.format,u=void 0===s?dS.RGBA:s,c=n.internalFormat,l=n.wrapS,f=void 0===l?dS.MIRRORED_REPEAT:l,h=n.wrapT,p=void 0===h?dS.MIRRORED_REPEAT:h,d=n.minFilter,m=void 0===d?dS.NEAREST:d,v=n.magFilter,y=void 0===v?dS.NEAREST:v,g=n.flipY,T=void 0!==g&&g;return new GM(t,{data:r,type:a,sourceType:e.TextureSourceType.data,format:u,internalFormat:c||u,wrapS:f,wrapT:p,minFilter:m,magFilter:y,flipY:T})},EC.create=function(e,t){return new rw(e,t)},NC.create=function(e,t){return new ew(e,t)},kC.create=function(e,t){return new kC(e,t)},SO.create=function(e){return new aw(e)},PO.create=function(e,t){return new uw(e,t)},MO.create=function(e,t,r){return new Rw(e,t,r)},UM.create=function(e){return new _w(e)};console.info({content:"[Galacean Effects Player] version: 1.0.0",type:oC}),e.AbstractPlugin=CR,e.AssetManager=MM,e.BYTES_TYPE_MAP=FC,e.BezierSegments=Y_,e.COMPRESSED_TEXTURE=LO,e.COPY_FRAGMENT_SHADER=CC,e.COPY_MESH_SHADER_ID=_C,e.COPY_VERTEX_SHADER=RC,e.CalculateItem=eL,e.CalculateLoader=LI,e.CalculateVFXItem=II,e.Camera=hP,e.CameraController=OR,e.CameraVFXItem=IR,e.CameraVFXItemLoader=LR,e.Composition=VM,e.CompositionSourceManager=LM,e.CurveValue=j_,e.DEFAULT_FONTS=zI,e.DEG2RAD=cS,e.Downloader=ZR,e.EFFECTS_COPY_MESH_NAME=bC,e.EVENT_TYPE_CLICK=wR,e.EVENT_TYPE_TOUCH_END=DR,e.EVENT_TYPE_TOUCH_MOVE=NR,e.EVENT_TYPE_TOUCH_START=FR,e.Engine=UM,e.EventSystem=UR,e.FILTER_NAME_NONE=uS,e.FilterSpriteVFXItem=aL,e.Float16ArrayWrapper=Cb,e.FrameBuffer=PO,e.GLEngine=_w,e.GLGeometry=ew,e.GLRenderer=Rw,e.GPUCapability=_O,e.Geometry=NC,e.GlobalUniforms=AO,e.GradientValue=G_,e.HELP_LINK=lS,e.InteractBehavior=VR,e.InteractItem=UO,e.InteractLoader=VO,e.InteractMesh=FO,e.InteractVFXItem=NO,e.KTXTexture=lC,e.LOG_TYPE=oC,e.LineSegments=X_,e.LinearValue=z_,e.Material=EC,e.MaterialDataBlock=vC,e.Mesh=kC,e.NumberEpsilon=qb,e.PLAYER_OPTIONS_ENV_EDITOR=sS,e.POST_PROCESS_SETTINGS="post_process_settings",e.ParticleLoader=CI,e.ParticleMesh=sL,e.ParticleSystem=mI,e.ParticleVFXItem=RI,e.PassTextureCache=MC,e.PathSegments=H_,e.Player=Dw,e.PluginSystem=RR,e.QCanvasViewer=DI,e.QText=NI,e.RENDER_PASS_NAME_PREFIX=yO,e.RENDER_PREFER_LOOKUP_TEXTURE=aC,e.RUNTIME_ENV="runtime_env",e.RandomSetValue=U_,e.RandomValue=B_,e.RandomVectorValue=k_,e.RenderBuffer=SO,e.RenderFrame=TO,e.RenderPass=HC,e.RenderPassPriorityNormal=zC,e.RenderPassPriorityPostprocess=3e3,e.RenderPassPriorityPrepare=0,e.RenderTargetHandle=jC,e.Renderer=MO,e.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",e.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",e.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",e.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",e.SPRITE_VERTEX_STRIDE=oS,e.SemanticMap=wC,e.Shader=SC,e.SpriteItem=iL,e.SpriteLoader=KO,e.SpriteMesh=kO,e.SpriteVFXItem=nL,e.StaticValue=V_,e.TEMPLATE_USE_OFFSCREEN_CANVAS=sC,e.TextItem=JI,e.TextLoader=eP,e.TextMesh=PI,e.TextVFXItem=$I,e.Texture=iC,e.TextureFactory=pC,e.Ticker=BM,e.TimelineComponent=aR,e.Transform=gR,e.VFXItem=TR,e.VFX_ITEM_TYPE_TREE=aS,e.ValueGetter=D_,e.addByOrder=QS,e.addItem=DS,e.addItemWithOrder=US,e.alphaFrameFrag=JC,e.alphaMaskFrag=$C,e.assertExist=eb,e.asserts=function(e,t){if(void 0===t&&(t="asserts failed"),!e)throw new Error(t)}
14
+ */!function(e){e.S="S",e.APlus="A+",e.A="A",e.BPlus="B+",e.B="B"}(dP||(dP={})),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"}(mP||(mP={})),function(e){e[e.DOUBLE=1032]="DOUBLE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK"}(vP||(vP={})),function(e){e[e.NONE=0]="NONE",e[e.MASK=1]="MASK",e[e.OBSCURED=2]="OBSCURED",e[e.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(yP||(yP={})),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"}(gP||(gP={})),function(e){e[e.GYROSCOPE=0]="GYROSCOPE",e[e.SPINE=1]="SPINE"}(TP||(TP={})),function(e){e[e.CLICK=0]="CLICK",e[e.MESSAGE=1]="MESSAGE",e[e.DRAG=2]="DRAG"}(xP||(xP={})),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"}(EP||(EP={})),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"}(AP||(AP={})),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"}(SP||(SP={})),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"}(bP||(bP={}));var RP,CP,OP,LP,IP,PP,MP,wP,FP,NP,DP,VP,UP,BP,kP,zP,GP,jP=0;!function(e){e[e.portrait=1]="portrait",e[e.landscape=jP]="landscape"}(RP||(RP={})),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"}(CP||(CP={})),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"}(OP||(OP={})),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"}(LP||(LP={})),function(e){e[e.destroy=0]="destroy",e[e.loop=5]="loop",e[e.freeze=4]="freeze"}(IP||(IP={})),function(e){e[e.destroyChildren=6]="destroyChildren"}(PP||(PP={})),function(e){e[e.none=0]="none",e[e.removeParticle=1]="removeParticle"}(MP||(MP={})),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"}(wP||(wP={})),function(e){e[e.box=2]="box",e[e.sphere=3]="sphere"}(FP||(FP={})),function(e){e.unlit="unlit",e.pbr="pbr",e.hair="hair"}(NP||(NP={})),function(e){e[e.opaque=100]="opaque",e[e.masked=101]="masked",e[e.translucent=102]="translucent",e[e.additive=103]="additive"}(DP||(DP={})),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"}(VP||(VP={})),function(e){e[e.display=0]="display",e[e.clip=1]="clip",e[e.ellipsis=2]="ellipsis"}(UP||(UP={})),function(e){e[e.top=0]="top",e[e.middle=1]="middle",e[e.bottom=2]="bottom"}(BP||(BP={})),function(e){e[e.left=0]="left",e[e.middle=1]="middle",e[e.right=2]="right"}(kP||(kP={})),function(e){e.normal="normal",e.bold="bold",e.lighter="lighter"}(zP||(zP={})),function(e){e.normal="normal",e.italic="italic",e.oblique="oblique"}(GP||(GP={}));var XP=function(){return XP=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},XP.apply(this,arguments)};function HP(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 YP(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 WP(e,t){if(!e.includes(t))return e.push(t),!0}function ZP(e,t,r){if(e)for(var i in e)Object.hasOwnProperty.call(e,i)&&t.call(r,e[i],i);return e}function qP(e){if(Number.isFinite(e))return[OP.CONSTANT,e];if(e){if("lines"===e[0])return[OP.LINE,e[1]];if("curve"===e[0])return[OP.CURVE,e[1]];if("static"===e[0])return[OP.CONSTANT,e[1]]}}function KP(e,t){return Array.isArray(e)&&"random"===e[0]?[OP.CONSTANT,e[1][t]]:qP(e)}function QP(e){return e&&"color"===e[0]?tM(e[1],!0):[1,1,1,1]}function JP(e,t){if(e){if("colors"===e[0])return[OP.COLORS,e[1].map((function(e){return tM(e,t)}))];if("gradient"===e[0])return eM(e[1],t);if("color"===e[0])return[OP.RGBA_COLOR,tM(e[1],t)]}}function $P(e){return e&&"random"===e[0]?[OP.RANDOM,e[1]]:qP(e)}function eM(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=tM(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]})),[OP.GRADIENT_COLOR,r]}}function tM(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 rM(e,t){return Array.isArray(e)?("gradient"===e[0]||"color"===e[0])&&eM(e[1],t):eM(e,t)}function iM(e){if(e){if(3===e.length)return[OP.CONSTANT_VEC3,e];if("path"===e[0])return[OP.LINEAR_PATH,e[1]];if("bezier"===e[0])return[OP.BEZIER_PATH,e[1]]}}function nM(e){var t,r;try{for(var i=HP(Object.entries(e)),n=i.next();!n.done;n=i.next()){var o=YP(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 oM(e){var t,r;try{for(var i=HP(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 aM=Math.cos,sM=Math.sin,uM=Math.PI/180,cM=180/Math.PI;function lM(e){var t,r=e.options,i=e.transform,n={type:gP.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=XP(XP({},e.shape),{type:gP[o]}),e.shape.upDirection){var a=YP(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=$P(r.turbulenceX),n.turbulenceY=$P(r.turbulenceY),n.turbulenceZ=$P(r.turbulenceZ));var l=e.emission;l.bursts&&l.bursts.length>0&&(l.bursts=l.bursts.map((function(e){return nM(e)}))),l.burstOffsets&&l.burstOffsets.length>0&&(l.burstOffsets=l.burstOffsets.map((function(e){return nM(e)}))),l.rateOverTime&&(l.rateOverTime=$P(l.rateOverTime));var f={renderer:e.renderer,shape:n,splits:e.splits,emission:l,options:{startLifetime:$P(r.startLifetime),start3DSize:!!r.start3DSize,startSize:$P(r.startSize),startSizeX:$P(r.startSizeX),startSizeY:$P(r.startSizeY),sizeAspect:$P(r.sizeAspect),maxCount:r.maxCount,startDelay:$P(r.startDelay),startColor:JP(r.startColor,!0),startRotationZ:$P(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(f.options.startRotationX=$P(r.startRotationX),f.options.startRotationY=$P(r.startRotationY)),e.filter){var h={};ZP(e.filter,(function(e,t){var r;h[t]=(r=e,Array.isArray(r)&&"string"==typeof r[0]&&($P(r)||iM(r)||JP(r))||r)})),f.filter=h}i&&i.path&&(f.emitterTransform={path:iM(i.path)});var p=e.sizeOverLifetime;p&&(p.separateAxes?f.sizeOverLifetime={separateAxes:!0,x:$P(p.x),y:$P(p.y)}:f.sizeOverLifetime={size:$P(p.size)});var d=e.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?qP(m):void 0,f.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:qP(r.gravityModifier),startSpeed:$P(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:$P(d.linearX),linearY:$P(d.linearY),linearZ:$P(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:$P(d.orbitalX),orbitalY:$P(d.orbitalY),orbitalZ:$P(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:qP(d.forceCurve)},oM(f.positionOverLifetime);var v=e.rotationOverLifetime;v&&(f.rotationOverLifetime={separateAxes:v.separateAxes,asRotation:v.asRotation,z:$P(v.separateAxes?v.z:v.angularVelocity)},v.separateAxes&&(f.rotationOverLifetime.y=qP(v.y),f.rotationOverLifetime.x=qP(v.x)));var y=e.colorOverLifetime;if(y){var g=f.colorOverLifetime={opacity:qP(y.opacity)};y.color&&(g.color=rM(y.color))}var T=e.textureSheetAnimation;T&&(f.textureSheetAnimation={row:T.row,col:T.col,total:T.total,animate:T.animate,cycles:qP(T.cycles),animationDelay:KP(T.animationDelay,0),animationDuration:KP(T.animationDuration,0)});var x=e.trails;x&&(f.trails={lifetime:$P(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:qP(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&rM(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&rM(x.colorOverLifetime,!1),inheritParticleColor:x.inheritParticleColor,occlusion:x.occlusion,transparentOcclusion:x.transparentOcclusion,orderOffset:x.orderOffset,sizeAffectsLifetime:x.sizeAffectsLifetime,sizeAffectsWidth:x.sizeAffectsWidth,texture:x.texture,parentAffectsPosition:x.parentAffectsPosition,opacityOverLifetime:$P(x.opacityOverLifetime)}),f.trails&&oM(f.trails);var E=e.interaction;return E&&(f.interaction={behavior:E.behavior,radius:E.radius,multiple:E.multiple}),f}function fM(e,t){var r,i=e.options,n=e.velocityOverLifetime||{},o={path:iM(null===(r=e.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:qP(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:qP(n.linearX),linearY:qP(n.linearY),linearZ:qP(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:qP(n.orbitalX),orbitalY:qP(n.orbitalY),orbitalZ:qP(n.orbitalZ),speedOverLifetime:qP(n.speedOverLifetime)};oM(o);var a={options:{startColor:QP(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=qP(s.x),u.y=qP(s.y),u.z=qP(s.z)):u.z=qP(s.angularVelocity)}var c=e.colorOverLifetime;if(c){var l=a.colorOverLifetime={opacity:qP(c.opacity)};c.color&&(l.color=rM(c.color))}var f=e.sizeOverLifetime;return f&&(a.sizeOverLifetime={separateAxes:f.separateAxes,size:qP(f.size),x:qP(f.x),y:qP(f.y),z:qP(f.z)}),a}function hM(e,t){var r=fM(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 pM=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],dM=["path","position"];function mM(e){return e.compositions.forEach((function(e){e.items.forEach((function(e){e.type===AP.null&&e.endBehavior===IP.destroy&&(e.endBehavior=IP.freeze)}))})),e.version="2.1",e}var vM=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,yM=/^(\d+)\.(\d+)$/,gM=!1;function TM(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!==AP.mesh&&e.type!==AP.light||(e.endBehavior=1===e.endBehavior?IP.destroy:e.endBehavior)}))}))}(e),vM.test(e.version))return gM="0"===(null===(t=/^(\d+)/.exec(e.version))||void 0===t?void 0:t[0]),mM(function(e){var t,r;xM="1.0";var i=e.plugins||[];(null===(t=e.bins)||void 0===t?void 0:t.length)&&(xM="1.3");var n=(e.requires||[]).slice(),o=e.images.map((function(t,r){return EM(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:xM,playerVersion:null!==(r=e.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map((function(e){return AM(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=yM.exec(e.version))||void 0===r?void 0:r[1];if(i)return Number(i)<2?mM(e):e;throw Error("invalid json version "+e.version)}var xM="1.0";function EM(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 AM(e,t){var r;void 0===t&&(t={});var i={id:e.id+"",camera:Object.assign({clipMode:jP},e.camera),duration:e.duration,endBehavior:e.endBehavior,items:e.items.map((function(e){return RM(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 SM,bM=[0,0,0,1],_M=.5;function RM(e,t){var r,i,n;void 0===t&&(t={});var o,a,s,u,c,l,f=AP.base,h=e.endBehavior,p=NaN;if(e.content?(f=e.type||AP.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===AP.filter&&(xM<"1.1"&&(xM="1.1"),(s=hM(a,o)).filter=function(e){var t={};return ZP(e,(function(e,r){pM.includes(r)?t[r]=qP(e):dM.includes(r)?t[r]=iM(e):t[r]=e})),t}(a.filter))):e.particle?(f=AP.particle,o=y((a=e.particle).transform,gM,!0),s=lM(a)):e.sprite?(f=AP.sprite,s=hM(a=e.sprite,o=y(a.transform,!1,!0))):e.cal?(f=AP.null,s=fM(a=e.cal,o=y(a.transform,!1,!0))):e.ui?(f=AP.interact,o=y((a=e.ui).transform),s=function(e){var t,r=e.options;switch(r.type){case"click":t={type:xP.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&QP(r.previewColor),behavior:r.behavior||EP.NOTIFY};break;case"drag":t={type:xP.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":t={type:xP.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=AP.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:iM(null===(r=e.transform)||void 0===r?void 0:r.path),linearX:qP(null==o?void 0:o.translateX),linearY:qP(null==o?void 0:o.translateY),linearZ:qP(null==o?void 0:o.translateZ)};oM(a),n.positionOverLifetime=a}var s=e.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:qP(null==s?void 0:s.rotateX),y:qP(null==s?void 0:s.rotateY),z:s.separateAxes?qP(null==s?void 0:s.rotateZ):qP(s.rotation)};oM(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]==_M&&d[1]==_M?delete s.renderer.anchor:t.requires&&WP(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]?IP.loop:IP.destroy:IP.loop:h||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||IP.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?(WP(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=bM,s=i.rotation[0],u=i.rotation[1],c=i.rotation[2],l=aM(s*uM/2),f=aM(u*uM/2),h=aM(c*uM/2),p=sM(s*uM/2),d=sM(u*uM/2),m=sM(c*uM/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,T=n*s+o*a,x=1-c-f;return e[1]=Math.asin(function(e,t,r){return e>r?r:e<t?t:e}(-g,-1,1))*cM,Math.abs(g)<.9999999?(e[0]=Math.atan2(T,x)*cM,e[2]=Math.atan2(v,d)*cM):(e[0]=0,e[2]=Math.atan2(-m,y)*cM),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 CM=((SM={})[TS.S]=[TS.S,TS.BPlus,TS.APlus],SM[TS.A]=[TS.A,TS.BPlus,TS.APlus],SM[TS.B]=[TS.B,TS.BPlus],SM);function OM(e,t){if(!e||!t)return!0;var r=CM[t];return!!r&&r.includes(e)}var LM=0,IM=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 nC?e:nC.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);LM=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=$A({},e.content);if(c&&(o.content=$A({},c),OM(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===AS.MASK?l.renderer.mask=++i:f!==AS.OBSCURED&&f!==AS.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&&fR(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=$A({},l.filter));var p=e.name,d=e.delay,m=void 0===d?0:d,v=e.id,y=e.parentId,g=e.duration,T=e.endBehavior,x=e.pluginName,E=e.pn,A=e.transform,S=e.refCount,b=t.jsonScene.plugins,_=void 0===b?[]:b;o.name=p,o.delay=m,o.id=v,y&&(o.parentId=y),o.refCount=S,o.duration=g,o.listIndex=LM++,o.endBehavior=T,x?o.pluginName=x:void 0!==E&&Number.isInteger(E)&&(o.pluginName=_[E]),A&&(o.transform=A),r.push(o)}}})),r},e.prototype.changeTex=function(e){var t=e.texture,r=$A({},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}();function PM(e){return fR(e)&&"jsonScene"in e}var MM=1,wM=function(){function t(e,t){void 0===e&&(e={}),void 0===t&&(t=new qR),this.options=e,this.downloader=t,this.assets={},this.id=MM++,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 eS(this,void 0,void 0,(function(){var o,a,s,u,c,l,f,h,p,d,m,v=this;return tS(this,(function(y){return a="Load asset: ".concat(uR(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 eS(v,void 0,void 0,(function(){var r,i;return tS(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 eS(v,void 0,void 0,(function(){var i,n,h,p,m,v,y,g,T,x,E,A,S,b,_=this;return tS(this,(function(R){switch(R.label){case 0:return fR(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 _.loadJSON(e)}))];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,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 _.processBins(m)})),d("processImages",(function(){var e;return _.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 _.precompile(y,t,r)}))])];case 5:return T=iS.apply(void 0,[R.sent(),2]),x=T[0],E=T[1],[4,d("processFontURL",(function(){return _.processFontURL(g)}))];case 6:return R.sent(),[4,d("processTextures",(function(){return _.processTextures(E,x,h)}))];case 7:return A=R.sent(),S={jsonScene:h,images:E,textureOptions:A,bins:x,storage:{},pluginSystem:this.pluginSystem,renderLevel:this.options.renderLevel,totalTime:0,startTime:0,url:e},[4,d("processPlugins",(function(){return _.pluginSystem.loadResources(S,_.options)}))];case 8:return R.sent(),b=performance.now()-s,console.info({content:"".concat(a,": ").concat(b.toFixed(4),"ms, ").concat(u.join(" ")),type:aC}),window.clearTimeout(f),S.totalTime=b,S.startTime=s,[2,S]}}))}))},[2,Promise.race([p,m()])]}))}))},t.prototype.precompile=function(e,t,r){return eS(this,void 0,void 0,(function(){var i;return tS(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 eS(this,void 0,void 0,(function(){var t,r,i,n,o,a,s,u;return tS(this,(function(c){switch(c.label){case 0:return t=TM(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 _R(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];OM(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 eS(this,void 0,void 0,(function(){var t,r,i=this;return tS(this,(function(n){return t=this.options.renderLevel,r=e.map((function(r){if(r instanceof ArrayBuffer)return r;if(OM(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 eS(this,void 0,void 0,(function(){var r,i=this;return tS(this,(function(n){return e?(r=e.map((function(e){return eS(i,void 0,void 0,(function(){var r,i;return tS(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:aC}),[3,4];case 4:return[2]}}))}))})),[2,Promise.all(r)]):[2]}))}))},t.prototype.processImages=function(t,r,i){return eS(this,void 0,void 0,(function(){var n,o,a,s,u,c=this;return tS(this,(function(l){return n=this.options,o=n.useCompressedTexture,a=n.variables,s=this.baseUrl,u=t.map((function(t,n){return eS(c,void 0,void 0,(function(){var u,c,l,f,h,p,d,m,v,y,g,T,x,E,A,S,b,_,R;return tS(this,(function(C){switch(C.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=WI(h,a))instanceof Array))return[3,6];m=h.background.name,C.label=1;case 1:return C.trys.push([1,3,,5]),b={},[4,JR(d[0])];case 2:return b.image=C.sent(),b.url=d[0],p=b,[3,5];case 3:return C.sent(),_={},[4,JR(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,JR(d)]);case 7:R.image=C.sent(),R.url=d,p=R,C.label=8;case 8:return[3,11];case 9:return[4,QR(l,f)];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,QI(p.image,h,a,this.options,-1===t.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 t&&"video"===t.type)return y=t.loop,[2,eC(t.url,{loop:y})];if("compressed"in t&&o&&i){if(g=t.compressed,T=void 0,i===IO.ASTC?T=g.astc:i===IO.PVRTC&&(T=g.pvrtc),T)return x=new URL(T,s).href,this.assets[n]={url:x,type:e.TextureSourceType.compressed},[2,this.loadBins(x)]}else{if("sourceType"in t)return[2,t];if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof nC)return[2,t]}C.label=17;case 17:return[4,QR(l,f)];case 18:return E=C.sent(),A=E.url,S=E.image,this.assets[n]={url:A,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 eS(this,void 0,void 0,(function(){var o,a,s=this;return tS(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 nC)return n;if("mipmaps"in n)try{return tC(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 nC)return t.source;if(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement)return{image:t,sourceType:e.TextureSourceType.image,sourceFrom:r,keepImageSource:!0,minFilter:dS.LINEAR,magFilter:dS.LINEAR};if(t instanceof HTMLVideoElement)return{sourceType:e.TextureSourceType.video,video:t,minFilter:dS.LINEAR,magFilter:dS.LINEAR};if(t instanceof ArrayBuffer)return $A($A({},hC(t)),{sourceFrom:r});if("width"in t&&"height"in t&&"data"in t)return{sourceType:e.TextureSourceType.data,data:t,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE,minFilter:dS.NEAREST,magFilter:dS.NEAREST};throw new Error("Invalid texture options")}(u,s.assets[o]);return c.sourceType===e.TextureSourceType.compressed?c:$A($A({},c),n)}throw new Error("Invalid texture source: ".concat(a))})),[2,Promise.all(a)]}))}))},t.prototype.loadJSON=function(e){return eS(this,void 0,void 0,(function(){var t=this;return tS(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 eS(this,void 0,void 0,(function(){var t=this;return tS(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 FM,NM,DM=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 JA(t,e),Object.defineProperty(t.prototype,"type",{get:function(){return CS.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=xR(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,nS([],iS(o),!1)))}else(r=i.itemTree).splice.apply(r,nS([i.itemTree.indexOf(n),1],iS(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,nS([],iS(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,nS([],iS(a.children),!1)),s.composition||DS(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(DS(this.itemsToRemove,e),e.type===aS||e.type===CS.null){var i=6===e.endBehavior,n=e.type===CS.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}(TR),VM=1,UM=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 IM(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,T=v.imgUsage,x=v.totalTime,E=v.renderLevel;eb(y);var A=new DM(y,this),S=!n&&T;this.transform=new gR({name:this.name}),A.transform=this.transform,this.globalVolume=y.globalVolume,this.width=d,this.height=m,this.renderOrder=u,this.id=VM++,this.renderer=c,this.texInfo=null!=S?S:{},this.event=p,this.statistic={loadTime:null!=x?x: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!==A.endBehavior,this.content=A,this.name=A.name,this.pluginSystem=g,this.pluginSystem.initializeComposition(this,t),this.camera=new pP(this.name,$A($A({},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}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.getDuration=function(){return this.content.duration},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 xO({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=iS(this.renderFrame.editorTransform,4),i=r[0],n=r[1];return x_((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=iS(this.renderFrame.editorTransform,4),u=s[0],c=s[1],l=x_((t-s[2])/u,(r-s[3])/c,this.camera),f=(null==n?void 0:n.stop)||sR,h=(null==n?void 0:n.skip)||sR,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 T=v.triangles,x=v.backfaceCulling,E=0;E<T.length;E++){var A=T[E];if(O_(g,l.center,l.direction,A,x),g.length){y=!0,o.push(g);break}}else if(v.type===e.HitTestType.box){var S=v.center,b=v.size;A_(g,l.center,l.direction,S,b),g.length&&(y=!0,o.push(g))}else if(v.type===e.HitTestType.sphere){S=v.center;var _=v.radius;E_(g,l.center,l.direction,S,_),g.length&&(y=!0,o.push(g))}else if(v.type===e.HitTestType.custom){var R=v.collect(l,[t,r]);R&&R.length>0&&(o.push.apply(o,nS([],iS(R),!1)),y=!0)}if(y){var C={id:m.id,name:m.name,position:o[o.length-1],parentId:m.parentId,hitPositions:o,behavior:v.behavior};if(a.push(C),f(C))return a}}}}return a},t.prototype.addInteractiveItem=function(e,t){var r;if(t===_S.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===_S.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=sR)})):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:aC})},this.handlePlayerPause=sR,this.dispose=sR,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 eS(this,void 0,void 0,(function(){return tS(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}(),BM=function(){function e(){this.destroyed=!1,this.textures=[],this.materials=[],this.geometries=[],this.meshes=[],this.renderPasses=[]}return e.prototype.addTexture=function(e){this.destroyed||DS(this.textures,e)},e.prototype.removeTexture=function(e){this.destroyed||VS(this.textures,e)},e.prototype.addMaterial=function(e){this.destroyed||DS(this.materials,e)},e.prototype.removeMaterial=function(e){this.destroyed||VS(this.materials,e)},e.prototype.addGeometry=function(e){this.destroyed||DS(this.geometries,e)},e.prototype.removeGeometry=function(e){this.destroyed||VS(this.geometries,e)},e.prototype.addMesh=function(e){this.destroyed||DS(this.meshes,e)},e.prototype.removeMesh=function(e){this.destroyed||VS(this.meshes,e)},e.prototype.addRenderPass=function(e){this.destroyed||DS(this.renderPasses,e)},e.prototype.removeRenderPass=function(e){this.destroyed||VS(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:aC}),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}(),kM=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=Eb(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}();bR("camera",IR,PR,!0),bR("sprite",QO,oL,!0),bR("particle",OI,CI,!0),bR("cal",II,PI,!0),bR("interact",UO,DO,!0),bR("filter",QO,sL,!0),bR("text",tP,eP,!0),wS(_P);var zM=((FM={})[dS.RGBA]=34842,FM[dS.RGB]=34843,FM[dS.ALPHA]=33325,FM[dS.RED]=33325,FM[dS.LUMINANCE_ALPHA]=33327,FM[dS.LUMINANCE]=33325,FM),GM=((NM={})[dS.RGBA]=34836,NM[dS.RGB]=34837,NM[dS.ALPHA]=33326,NM[dS.RED]=33326,NM[dS.LUMINANCE_ALPHA]=33328,NM[dS.LUMINANCE]=33326,NM),jM=function(t){function r(e,r){var i=t.call(this)||this;i.initialized=!1;var n=i.assembleOptions(r),o=n.sourceType,a=n.sourceFrom,s=n.name,u=void 0===s?"":s;return i.source=n,i.sourceType=o,i.sourceFrom=a,i.name=u,i.engine=e,i}return JA(r,t),r.prototype.bind=function(e){this.pipelineContext.bindTexture(this.target,this.textureBuffer,e)},r.prototype.initialize=function(){if(!this.initialized){var e=this.engine;e.addTexture(this);var t=e.getGLPipelineContext();this.pipelineContext=t;var r=t.gl,i=this.source,n=i.target,o=void 0===n?r.TEXTURE_2D:n,a=i.name;this.textureBuffer=r.createTexture(),this.textureBuffer&&qM(this.textureBuffer,a),this.target=o,this.update(this.source),this.release(),this.initialized=!0}},r.prototype.clone=function(){var e=new r(this.engine,this.source);return e.sourceFrom=this.sourceFrom,e.sourceType=this.sourceType,e.width=this.width,e.height=this.height,e},r.prototype.release=function(){switch(this.source.sourceType){case e.TextureSourceType.image:delete this.source.image,delete this.source.cube;break;case e.TextureSourceType.data:delete this.source.data;break;case e.TextureSourceType.compressed:case e.TextureSourceType.mipmaps:delete this.source.mipmaps}},r.prototype.update=function(t){var r,i,n,o,a=this;if(!this.pipelineContext||!this.textureBuffer)return this.width=0,void(this.height=0);var s=this.target,u=this.source,c=this.pipelineContext.gl,l=this.engine.gpuCapability.detail,f=u.sourceType,h=u.data,p=u.cube,d=u.image,m=u.video,v=u.mipmaps,y=u.mipmaps,g=t.data,T=t.cube,x=t.generateMipmap,E=t.mipmaps,A=u,S=A.format,b=A.type,_=A.internalFormat,R=0,C=0;if(this.bind(f===e.TextureSourceType.video),b===dS.HALF_FLOAT?((b=l.halfFloatTexture)||console.error({content:"half float texture is not support",type:aC}),vS(c)&&_===S&&(S===dS.LUMINANCE&&(S=dS.RED),_=zM[S]),l.halfFloatLinear||(u.minFilter=u.magFilter=c.NEAREST,console.warn({content:"half float linear not support,change to NEAREST",type:aC}))):b===c.FLOAT&&((b=l.floatTexture)||console.error({content:"float texture is not support",type:aC}),vS(c)&&_===S&&(S===dS.LUMINANCE&&(S=dS.RED),_=GM[S]),l.floatLinear||(u.minFilter=c.NEAREST,u.magFilter=c.NEAREST,console.warn({content:"float linear not support,change to NEAREST",type:aC}))),void 0===u.premultiplyAlpha&&(u.premultiplyAlpha=!1),c.pixelStorei(c.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha),void 0===u.flipY&&(u.flipY=!1),c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,u.flipY),f===e.TextureSourceType.framebuffer)g&&(R=null!==(n=g.width)&&void 0!==n?n:0,C=null!==(o=g.height)&&void 0!==o?o:0,R&&C&&(this.width!==R||this.height!==C)&&c.texImage2D(s,0,_,R,C,0,S,b,null));else if(f===e.TextureSourceType.data)s===c.TEXTURE_CUBE_MAP?T.forEach((function(e,t){var r=iS(a.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,_,S,b,e),2),i=r[0],n=r[1];R=Math.max(i,R),C=Math.max(n,C)})):(r=iS(this.texImage2DData(c,s,0,_,S,b,h),2),R=r[0],C=r[1]);else if(f===e.TextureSourceType.image||f===e.TextureSourceType.video){if(s===c.TEXTURE_CUBE_MAP)p.forEach((function(e,t){var r=iS(a.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,_,S,b,e),2),i=r[0],n=r[1];R=Math.max(i,R),C=Math.max(n,C)}));else if(s===c.TEXTURE_2D){var O=null!=d?d:m;i=iS(this.texImage2D(c,s,0,_,S,b,O),2),R=i[0],C=i[1]}x&&(XM(R)&&XM(C)||vS(c))&&c.generateMipmap(s)}else if(f===e.TextureSourceType.mipmaps){var L;s===c.TEXTURE_2D?v.forEach((function(e,t){var r;L="data"in e?a.texImage2DData(c,s,t,_,S,b,e):a.texImage2D(c,s,t,_,S,b,e),0===t&&(r=iS(L,2),R=r[0],C=r[1])})):s===c.TEXTURE_CUBE_MAP&&y.forEach((function(e,t){e.forEach((function(e,r){var i;L="data"in e?a.texImage2DData(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,t,_,S,b,e):a.texImage2D(c,c.TEXTURE_CUBE_MAP_POSITIVE_X+r,t,_,S,b,e),0===t&&(i=iS(L,2),R=i[0],C=i[1])}))}))}else f===e.TextureSourceType.compressed&&E&&(R=E[0].width,C=E[0].height,E.forEach((function(e,t){c.compressedTexImage2D(s,t,_,e.width,e.height,0,e.data)})));this.width=R,this.height=C,this.setTextureFilters(c,s,u)},r.prototype.setTextureFilters=function(e,t,r){var i=r.anisotropic,n=void 0===i?4:i,o=r.wrapS,a=void 0===o?e.CLAMP_TO_EDGE:o,s=r.wrapT,u=void 0===s?e.CLAMP_TO_EDGE:s,c=this.engine.gpuCapability;this.target===e.TEXTURE_2D&&c.setTextureAnisotropic(e,this.target,n);var l=vS(e)||XM(this.width)&&XM(this.height),f=r.minFilter?r.minFilter:e.NEAREST,h=r.magFilter?r.magFilter:e.NEAREST;e.texParameteri(t,e.TEXTURE_MIN_FILTER,f),e.texParameteri(t,e.TEXTURE_MAG_FILTER,h),e.texParameteri(t,e.TEXTURE_WRAP_S,l?a:e.CLAMP_TO_EDGE),e.texParameteri(t,e.TEXTURE_WRAP_T,l?u:e.CLAMP_TO_EDGE)},r.prototype.texImage2D=function(t,r,i,n,o,a,s){var u,c=this,l=this.source,f=l.sourceType,h=l.minFilter,p=l.magFilter;l.flipY;var d=l.wrapS,m=l.wrapT,v=null!==(u=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==u?u:2048,y=s;if(f!==e.TextureSourceType.video){var g=h!==t.NEAREST||p!==t.NEAREST||d!==t.CLAMP_TO_EDGE||m!==t.CLAMP_TO_EDGE;(g=g||s.width>v||s.height>v)&&setTimeout((function(){y=c.resizeImage(s)}))}t.texImage2D(r,i,n,o,a,y);var T=[y.width,y.height];if(f===e.TextureSourceType.video){var x=s;return[x.videoWidth,x.videoHeight]}return T},r.prototype.texImage2DData=function(e,t,r,i,n,o,a){var s=a.data,u=a.width,c=a.height,l=n===e.UNSIGNED_BYTE?new Uint8Array(s.buffer,s.byteOffset,s.byteLength/s.BYTES_PER_ELEMENT):s;return e.texImage2D(t,r,i,u,c,0,n,o,l),[u,c]},r.prototype.resizeImage=function(e,t,r){var i,n=null!==(i=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==i?i:2048;if(vS(this.pipelineContext.gl)&&e.width<n&&e.height<n)return e;var o=function(e,t,r,i){var n=e.width,o=e.height,a=Math.min(t,r||Ab(n)),s=Math.min(t,i||Ab(o));if(s!==o||a!==n){var u=YI.getCanvas(),c=u.getContext("2d");return u.width=a,u.height=s,null==c||c.drawImage(e,0,0,n,o,0,0,a,s),console.warn({content:"image resize from ".concat(n,"x").concat(o," to ").concat(a,"x").concat(s),type:aC}),u}}(e,n,t,r);return o||e},r.prototype.reloadData=function(){return eS(this,void 0,void 0,(function(){return tS(this,(function(e){switch(e.label){case 0:return this.offloaded?[4,mC().reload(this)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},r.prototype.offloadData=function(){if(this.initialized&&mC().canOffloadTexture(this.source.sourceFrom)){var e=this.target,t=this.pipelineContext.gl;if(t&&this.textureBuffer){var r=new Uint8Array([255]);if(this.bind(),e===t.TEXTURE_2D)t.texImage2D(e,0,t.LUMINANCE,1,1,0,t.LUMINANCE,t.UNSIGNED_BYTE,r);else if(e===t.TEXTURE_CUBE_MAP)for(var i=[t.TEXTURE_CUBE_MAP_NEGATIVE_X,t.TEXTURE_CUBE_MAP_NEGATIVE_Y,t.TEXTURE_CUBE_MAP_NEGATIVE_Z,t.TEXTURE_CUBE_MAP_POSITIVE_X,t.TEXTURE_CUBE_MAP_POSITIVE_Y,t.TEXTURE_CUBE_MAP_POSITIVE_Z],n=0;n<i.length;n++)t.texImage2D(i[n],0,t.LUMINANCE,1,1,0,t.LUMINANCE,t.UNSIGNED_BYTE,r);t.generateMipmap(e),this.width=1,this.height=1}this.offloaded=!0}},r.prototype.uploadCurrentVideoFrame=function(){return eS(this,void 0,void 0,(function(){var t;return tS(this,(function(r){switch(r.label){case 0:return this.source.sourceType===e.TextureSourceType.video&&this.source.video&&this.initialized?(t=this.source.video).paused?[4,t.play()]:[3,2]:[3,3];case 1:r.sent(),r.label=2;case 2:return this.update({video:this.source.video}),[2,!0];case 3:return[2,!1]}}))}))},r.prototype.updateSource=function(e){this.source=this.assembleOptions($A($A({},this.source),e)),this.sourceType=this.source.sourceType,this.sourceFrom=this.source.sourceFrom,this.update(this.source)},r.prototype.restore=function(){},r.prototype.dispose=function(){this.pipelineContext&&this.textureBuffer&&this.pipelineContext.gl.deleteTexture(this.textureBuffer),this.source.sourceType===e.TextureSourceType.video&&this.source.video&&this.initialized&&(this.source.video.pause(),this.source.video.src="",this.source.video.load()),this.width=0,this.height=0,this.textureBuffer=null,this.destroyed=!0,this.update=function(){console.error({content:"this this texture has been destroyed",type:aC})},this.initialize=dR,void 0!==this.engine&&this.engine.removeTexture(this)},r}(nC);function XM(e){return 0==(e&e-1)&&0!==e}var HM,YM=function(){function e(e,t){this.engine=e,this.ready=!1,this.disposed=!1,this.gl=e.getGLPipelineContext().gl,this.vaoExt=e.gpuCapability.vaoExt,this.vao=this.createVertexArray(t)}return e.prototype.bind=function(){this.bindVertexArray(this.vao)},e.prototype.unbind=function(){this.bindVertexArray(null)},e.prototype.createVertexArray=function(e){var t=null;return vS(this.gl)&&(t=this.gl.createVertexArray()),!t&&this.vaoExt&&(t=this.vaoExt.createVertexArrayOES()),t&&qM(t,e),t},e.prototype.bindVertexArray=function(e){var t;vS(this.gl)?this.gl.bindVertexArray(e):null===(t=this.vaoExt)||void 0===t||t.bindVertexArrayOES(e)},e.prototype.dispose=function(){var e;vS(this.gl)?this.gl.deleteVertexArray(this.vao):null===(e=this.vaoExt)||void 0===e||e.deleteVertexArrayOES(this.vao)},e}(),WM=1,ZM=function(){function t(t){this.engine=t,this.textures=[],this.renderBuffers=[],this.frameBuffers=[],this.destroyed=!1;var r={width:1,height:1,data:new Uint8Array([255])},i=t.getGLPipelineContext(),n=i.gl;this.gl=n,this.pipelineContext=i,this.emptyTexture2D=new jM(t,{data:r,sourceType:e.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new jM(t,{target:n.TEXTURE_CUBE_MAP,cube:[r,r,r,r,r,r],sourceType:e.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTextureCube.initialize(),this.name="GLGPURenderer"+WM,WM++}return Object.defineProperty(t.prototype,"height",{get:function(){var e;return null===(e=this.gl)||void 0===e?void 0:e.drawingBufferHeight},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){var e;return null===(e=this.gl)||void 0===e?void 0:e.drawingBufferWidth},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"canvas",{get:function(){return this.gl.canvas},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),t.prototype.copy2=function(e,t){var r=this.gl;if(r){this.sourceFbo||(this.sourceFbo=r.createFramebuffer()),this.targetFbo||(this.targetFbo=r.createFramebuffer());var i=this.pipelineContext,n=r.COLOR_ATTACHMENT0;i.bindFramebuffer(r.FRAMEBUFFER,this.sourceFbo),r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,e.textureBuffer,0),i.bindFramebuffer(r.FRAMEBUFFER,this.targetFbo),r.framebufferTexture2D(r.FRAMEBUFFER,n,r.TEXTURE_2D,t.textureBuffer,0),i.bindFramebuffer(r.READ_FRAMEBUFFER,this.sourceFbo),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.targetFbo);var o=e.getWidth()===e.getHeight()&&t.getWidth()==t.getHeight()?r.NEAREST:r.LINEAR;r.blitFramebuffer(0,0,e.getWidth(),e.getHeight(),0,0,t.getWidth(),t.getHeight(),r.COLOR_BUFFER_BIT,o),i.bindFramebuffer(r.FRAMEBUFFER,null),i.bindFramebuffer(r.READ_FRAMEBUFFER,null),i.bindFramebuffer(r.DRAW_FRAMEBUFFER,null)}},t.prototype.resetColorAttachments=function(e,t){e.bind(),e.resetColorTextures(t)},t.prototype.createGLRenderBuffer=function(e){var t=this.gl.createRenderbuffer();return t&&DS(this.renderBuffers,e),t},t.prototype.resize=function(e,t){var r=this.gl;(r&&r.drawingBufferWidth!==e||r.drawingBufferHeight!==t)&&(r.canvas.width=e,r.canvas.height=t,r.viewport(0,0,e,t),this.frameBuffers.forEach((function(r){var i=r.viewport;r.isCustomViewport||r.resize(i[0],i[1],e*r.viewportScale,t*r.viewportScale)})))},t.prototype.drawGeometry=function(e,t){if(this.gl){var r=e,i=t,n=i.shader.program;if(n){var o=n.setupAttributes(r),a=this.gl,s=r.indicesBuffer,u=r.drawStart,c=r.mode,l=r.drawCount;if(s){var f=s.type,h=s.elementCount;(l=isNaN(l)?h:l)>0&&a.drawElements(c,l,f,null!=u?u:0)}else l>0&&a.drawArrays(c,u,l);null==o||o.unbind()}else console.warn("Material "+i.name+" 的shader着色器程序未初始化。")}else console.warn("GLGPURenderer没有绑定gl对象, 无法绘制geometry")},t.prototype.createGLFrameBuffer=function(e,t){var r=this.gl.createFramebuffer();return r&&(DS(this.frameBuffers,e),qM(r,t,t)),r},t.prototype.createVAO=function(e){return new YM(this.engine,e)},t.prototype.deleteGLTexture=function(e){e.textureBuffer&&!this.destroyed&&(this.gl.deleteTexture(e.textureBuffer),VS(this.textures,e),delete e.textureBuffer)},t.prototype.deleteGPUBuffer=function(e){e&&!this.destroyed&&(this.gl.deleteBuffer(e.glBuffer),delete e.glBuffer)},t.prototype.deleteGLFrameBuffer=function(e){e&&!this.destroyed&&(this.gl.deleteFramebuffer(e.fbo),VS(this.frameBuffers,e),delete e.fbo)},t.prototype.deleteGLRenderBuffer=function(e){e&&!this.destroyed&&(this.gl.deleteRenderbuffer(e.buffer),VS(this.renderBuffers,e),delete e.buffer)},t.prototype.deleteResource=function(){var e=this,t=this.gl;t&&(t.deleteFramebuffer(this.sourceFbo),t.deleteFramebuffer(this.targetFbo),this.emptyTexture2D.dispose(),this.emptyTextureCube.dispose(),this.frameBuffers.forEach((function(t){return e.deleteGLFrameBuffer(t)})),this.frameBuffers.length=0,this.renderBuffers.forEach((function(t){return e.deleteGLRenderBuffer(t)})),this.renderBuffers.length=0,this.textures.forEach((function(t){return e.deleteGLTexture(t)})),this.textures.length=0)},t.prototype.lost=function(e){console.error({content:"gl lost, destroy glRenderer by default",type:aC},e.target),this.deleteResource()},t.prototype.dispose=function(e){this.deleteResource();var t=this.gl;if(t&&e){var r=t.getExtension("WEBGL_lose_context");null==r||r.loseContext()}this.emptyTexture2D=this.emptyTextureCube=this.pipelineContext=this.gpu=this.gl=null,this.destroyed=!0},t}();function qM(e,t,r){void 0!==t&&(e.__SPECTOR_Metadata={name:t},e.__SPECTOR_Object_TAG?(e.__SPECTOR_Object_TAG.displayText=t,r&&(e.__SPECTOR_Object_TAG.id=r)):e.__SPECTOR_Object_TAG={displayText:t,id:""})}var KM,QM=function(){function e(e,t){this.pipelineContext=e,this.byteLength=0,this.destroyed=!1;var r=t.target,i=void 0===r?dS.ARRAY_BUFFER:r,n=t.type,o=void 0===n?dS.FLOAT:n,a=t.name,s=t.usage,u=void 0===s?dS.STATIC_DRAW:s,c=t.data,l=t.elementCount,f=function(e){var t,r;return null!==(r=null===(t=JM[e])||void 0===t?void 0:t.BYTES_PER_ELEMENT)&&void 0!==r?r:0}(o);this.target=i,this.type=o,this.usage=u,this.glBuffer=this.createGLBuffer(a),this.bytesPerElement=f,c?this.bufferData(c):l&&this.bufferData(f*l)}return Object.defineProperty(e.prototype,"elementCount",{get:function(){return this.byteLength/this.bytesPerElement},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),e.prototype.createGLBuffer=function(e){var t=this.pipelineContext.gl.createBuffer();return t&&qM(t,e),t},e.prototype.bind=function(){this.pipelineContext.gl.bindBuffer(this.target,this.glBuffer)},e.prototype.bufferData=function(e){var t="number"==typeof e?e:e.byteLength;if(this.pipelineContext){this.byteLength=t;var r=this.pipelineContext.gl,i=this.target;r.bindBuffer(i,this.glBuffer),0===t?r.bufferData(i,1,this.usage):(r.bufferData(i,t,this.usage),"number"!=typeof e&&r.bufferSubData(i,0,e))}else this.byteLength=0},e.prototype.bufferSubData=function(e,t){if(this.pipelineContext){var r=this.pipelineContext.gl,i=this.target,n=e*this.bytesPerElement,o=n+t.byteLength;r.bindBuffer(i,this.glBuffer),o>this.byteLength&&(this.byteLength=o,r.bufferData(i,o,this.usage)),r.bufferSubData(i,n,t)}else this.byteLength=0},e.prototype.dispose=function(){this.pipelineContext.gl.deleteBuffer(this.glBuffer),this.glBuffer=null,this.destroyed=!0},e.prototype.readSubData=function(e,t){return!!vS(this.pipelineContext.gl)&&(this.pipelineContext.gl.getBufferSubData(this.target,e*this.bytesPerElement,t),!0)},e}(),JM=((HM={})[dS.INT]=Int32Array,HM[dS.FLOAT]=Float32Array,HM[dS.SHORT]=Int16Array,HM[dS.BYTE]=Int8Array,HM[dS.UNSIGNED_BYTE]=Uint8Array,HM[dS.UNSIGNED_INT]=Uint32Array,HM[dS.UNSIGNED_SHORT]=Uint16Array,HM);var $M=((KM={})[Uint8Array.BYTES_PER_ELEMENT]=dS.UNSIGNED_BYTE,KM[Uint16Array.BYTES_PER_ELEMENT]=dS.UNSIGNED_SHORT,KM[Uint32Array.BYTES_PER_ELEMENT]=dS.UNSIGNED_INT,KM),ew=1,tw=function(e){function t(t,r){var i=this,n=r.drawStart,o=void 0===n?0:n,a=r.drawCount,s=r.mode,u=r.indices,c=r.name,l=void 0===c?"effectsGeometry:".concat(ew++):c,f=r.bufferUsage,h=void 0===f?dS.STATIC_DRAW:f;(i=e.call(this,l)||this).buffers={},i.vaos={},i.initialized=!1,i.indicesReleasable=!1,i.attributesName=[],i.destroyed=!1,i.engine=t;var p={},d=[],m={},v={},y={},g=h;return i.drawStart=o,i.drawCount=isNaN(+a)?NaN:a,i.mode=isNaN(s)?dS.TRIANGLES:s,Object.keys(r.attributes).forEach((function(e){var t=r.attributes[e],i=t.size,n=t.stride,o=t.offset,a=t.normalize,s=t,u=s.type,c=void 0===u?dS.FLOAT:u,l=s.releasable,f=t.data;if(!c||"dataSource"in t||f||(f=VC(c)),f){var h=f instanceof Float32Array?dS.FLOAT:dS.INT;p[e]={data:f,usage:g,target:dS.ARRAY_BUFFER,name:e},m[e]={size:i,stride:n,offset:o,type:null!=c?c:h,normalize:!!a,dataSource:e},y[e]=null!=l&&l,v[e]={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0}}else{var T=t.dataSource;T&&(m[e]={size:i,stride:n,offset:o,type:c,dataSource:T,normalize:!!a})}d.push(e)})),v.index={dirty:!0,discard:!0,start:Number.POSITIVE_INFINITY,end:0},i.indices=null==u?void 0:u.data,i.indicesReleasable=!0===(null==u?void 0:u.releasable),i.bufferProps=p,i.attributes=m,i.attributesName=d,i.attributesReleasable=y,i.dirtyFlags=v,i.options=r,i}return JA(t,e),Object.defineProperty(t.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isInitialized",{get:function(){return this.initialized},enumerable:!1,configurable:!0}),t.prototype.getOptions=function(){return $A({},this.options)},t.prototype.initialize=function(){var e=this;if(!this.initialized){var t=this.engine;eb(t),t.addGeometry(this);var r=this.engine.getGLPipelineContext();Object.keys(this.bufferProps).forEach((function(t){e.buffers[t]=new QM(r,e.bufferProps[t])})),this.indices&&(this.indicesBuffer=this.createIndicesBuffer(r,this.indices)),this.initialized=!0,this.flush(),this.options=void 0}},t.prototype.getAttributeBuffer=function(e){if(this.initialized){var t=this.attributes[e].dataSource;return this.buffers[t]}},t.prototype.setAttributeData=function(e,t){if(null!=this.bufferProps){var r=this.getAttributeBufferOption(e),i=this.attributes[e].dataSource;if(r){var n=r.usage,o=r.target;this.bufferProps[i]={data:t,usage:n,target:o,elementCount:t.length},this.dirtyFlags[i].discard=!0,this.dirtyFlags[i].dirty=!0}}},t.prototype.getAttributeData=function(e){if(null!=this.bufferProps){var t=this.getAttributeBufferOption(e);return t?t.data:void 0}},t.prototype.setAttributeSubData=function(e,t,r){if(null!=this.bufferProps){var i=this.getAttributeBufferOption(e);if(i&&null!=i.data){var n=t,o=t+r.length;if(i.data.length<o){var a=new r.constructor(o);a.set(i.data),i.data=a,this.dirtyFlags[e].discard=!0}else if(!this.dirtyFlags[e].discard){var s=this.dirtyFlags[e];s.start=Math.min(s.start,n),s.end=Math.max(s.end,o-1)}i.data.set(r,n),this.dirtyFlags[e].dirty=!0}}},t.prototype.getIndexData=function(){return this.indices},t.prototype.setIndexData=function(e){(e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array)&&(this.indices=e,this.dirtyFlags.index.discard=!0,this.dirtyFlags.index.dirty=!0)},t.prototype.setIndexSubData=function(e,t){var r;if(this.indices){var i=e,n=e+t.length;if(this.indices.length<n){var o=new t.constructor(end);o.set(this.indices),this.indices=o,this.dirtyFlags.index.discard=!0}else if(!this.dirtyFlags.index.discard){var a=this.dirtyFlags.index;a.start=Math.min(a.start,i),a.end=Math.max(a.end,n-1)}null===(r=this.indices)||void 0===r||r.set(t,i),this.dirtyFlags.index.dirty=!0}},t.prototype.getAttributeStride=function(e){var t=this.attributes[e],r=t.stride,i=t.size,n=t.type;return r||i*NC[n]},t.prototype.getAttributeNames=function(){return this.attributesName},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.getAttributeBufferOption=function(e){var t=this.attributes[e];return t?this.bufferProps[t.dataSource]:void 0},t.prototype.createIndicesBuffer=function(e,t){var r=$M[t.BYTES_PER_ELEMENT],i={data:t,target:dS.ELEMENT_ARRAY_BUFFER,type:r,name:"".concat(this.name,"##index")};return new QM(e,i)},t.prototype.flush=function(){var e=this;if(this.initialized){var t=this.attributes,r=this.bufferProps,i=this.indices;Object.keys(this.dirtyFlags).forEach((function(n){var o,a,s=e.dirtyFlags[n];if("index"==n)o=e.indicesBuffer,a=i;else{var u=t[n].dataSource;o=e.buffers[u],a=r[u].data}if((s.dirty||s.discard)&&o&&a){if(s.discard)o.bufferData(a);else{var c=s.start*a.BYTES_PER_ELEMENT+a.byteOffset,l=s.end-s.start+1,f=new a.constructor(a.buffer,c,l);o.bufferSubData(s.start,f)}s.start=Number.POSITIVE_INFINITY,s.end=0,s.dirty=s.discard=!1}})),Object.keys(this.attributesReleasable).forEach((function(i){var n=e.attributesReleasable[i],o=t[i].dataSource;r[o]&&n&&(r[o].data=void 0)})),this.indicesReleasable}},t.prototype.dispose=function(){var e,t=this;this.drawStart=0,this.drawCount=NaN,this.bufferProps={},this.indices=void 0,this.attributes={},this.attributesName=[],this.options=void 0,this.initialized&&(Object.keys(this.buffers).forEach((function(e){t.buffers[e].dispose()})),this.buffers={},null===(e=this.indicesBuffer)||void 0===e||e.dispose(),Object.keys(this.vaos).forEach((function(e){var r;null===(r=t.vaos[e])||void 0===r||r.dispose(),t.vaos[e]=void 0})),this.indicesBuffer=void 0,void 0!==this.engine&&(this.engine.removeGeometry(this),this.engine=void 0)),this.destroyed=!0},t}(DC),rw=function(){function e(){this.reset()}return e.prototype.setBlendColor=function(e){var t=iS(e,4),r=t[0],i=t[1],n=t[2],o=t[3];this.blendColor[0]===r&&this.blendColor[1]===i&&this.blendColor[2]===n&&this.blendColor[3]===o||(this.blendColor[0]=r,this.blendColor[1]=i,this.blendColor[2]=n,this.blendColor[3]=o)},e.prototype.setBlending=function(e){this.blending!==e&&(this.blending=e)},e.prototype.setBlendFunctionParameters=function(e){var t=iS(e,4),r=t[0],i=t[1],n=t[2],o=t[3];this.blendFunctionParameters[0]===r&&this.blendFunctionParameters[1]===i&&this.blendFunctionParameters[2]===n&&this.blendFunctionParameters[3]===o||(this.blendFunctionParameters[0]=r,this.blendFunctionParameters[1]=i,this.blendFunctionParameters[2]=n,this.blendFunctionParameters[3]=o)},e.prototype.setBlendEquationParameters=function(e){var t=iS(e,2),r=t[0],i=t[1];this.blendEquationParameters[0]===r&&this.blendEquationParameters[1]===i||(this.blendEquationParameters[0]=r,this.blendEquationParameters[1]=i)},e.prototype.setDepthTest=function(e){this.depthTest!==e&&(this.depthTest=e)},e.prototype.setDepthMask=function(e){this.depthMask!==e&&(this.depthMask=e)},e.prototype.setDepthRange=function(e){this.depthRange[0]===e[0]&&this.depthRange[1]===e[1]||(this.depthRange[0]=e[0],this.depthRange[1]=e[1])},e.prototype.setDepthFunc=function(e){this.depthFunc!==e&&(this.depthFunc=e)},e.prototype.setPolygonOffsetFill=function(e){this.polygonOffsetFill!==e&&(this.polygonOffsetFill=e)},e.prototype.setPolygonOffset=function(e){this.polygonOffset[0]===e[0]&&this.polygonOffset[1]===e[1]||(this.polygonOffset[0]=e[0],this.polygonOffset[1]=e[1])},e.prototype.setSampleAlphaToCoverage=function(e){this.sampleAlphaToCoverage!==e&&(this.sampleAlphaToCoverage=e)},e.prototype.setColorMask=function(e){var t=iS(e,4),r=t[0],i=t[1],n=t[2],o=t[3];this.colorMask[0]===r&&this.colorMask[1]===i&&this.colorMask[2]===n&&this.colorMask[3]===o||(this.colorMask[0]=r,this.colorMask[1]=i,this.colorMask[2]=n,this.colorMask[3]=o)},e.prototype.setStencilTest=function(e){this.stencilTest!==e&&(this.stencilTest=e)},e.prototype.setStencilMask=function(e){this.stencilMask[0]===e[0]&&this.stencilMask[1]===e[1]||(this.stencilMask[0]=e[0],this.stencilMask[1]=e[1])},e.prototype.setStencilRef=function(e){this.stencilRef[0]===e[0]&&this.stencilRef[1]===e[1]||(this.stencilRef[0]=e[0],this.stencilRef[1]=e[1])},e.prototype.setStencilFunc=function(e){this.stencilFunc[0]===e[0]&&this.stencilFunc[1]===e[1]||(this.stencilFunc[0]=e[0],this.stencilFunc[1]=e[1])},e.prototype.setStencilOpFail=function(e){this.stencilOpFail[0]===e[0]&&this.stencilOpFail[1]===e[1]||(this.stencilOpFail[0]=e[0],this.stencilOpFail[1]=e[1])},e.prototype.setStencilOpZFail=function(e){this.stencilOpZFail[0]===e[0]&&this.stencilOpZFail[1]===e[1]||(this.stencilOpZFail[0]=e[0],this.stencilOpZFail[1]=e[1])},e.prototype.setStencilOpZPass=function(e){this.stencilOpZPass[0]===e[0]&&this.stencilOpZPass[1]===e[1]||(this.stencilOpZPass[0]=e[0],this.stencilOpZPass[1]=e[1])},e.prototype.setCulling=function(e){this.culling!==e&&(this.culling=e)},e.prototype.setFrontFace=function(e){this.frontFace!==e&&(this.frontFace=e)},e.prototype.setCullFace=function(e){this.cullFace!==e&&(this.cullFace=e)},e.prototype.reset=function(){this.blending=!1,this.blendColor=[0,0,0,0],this.blendFunctionParameters=[dS.ONE,dS.ONE_MINUS_SRC_ALPHA,dS.ONE,dS.ONE_MINUS_SRC_ALPHA],this.blendEquationParameters=[dS.FUNC_ADD,dS.FUNC_ADD],this.depthTest=!1,this.depthMask=!1,this.depthRange=[0,1],this.depthFunc=dS.LESS,this.polygonOffset=[0,0],this.polygonOffsetFill=!1,this.sampleAlphaToCoverage=!1,this.colorMask=[!0,!0,!0,!0],this.stencilTest=!1,this.stencilMask=[255,255],this.stencilRef=[0,0],this.stencilFunc=[dS.ALWAYS,dS.ALWAYS],this.stencilOpFail=[dS.KEEP,dS.KEEP],this.stencilOpZFail=[dS.KEEP,dS.KEEP],this.stencilOpZPass=[dS.KEEP,dS.KEEP],this.culling=!1,this.frontFace=dS.CW,this.cullFace=dS.FRONT},e.prototype.apply=function(e){if(e.toggle(dS.SAMPLE_ALPHA_TO_COVERAGE,this.sampleAlphaToCoverage),e.toggle(dS.BLEND,this.blending),e.toggle(dS.DEPTH_TEST,this.depthTest),e.toggle(dS.STENCIL_TEST,this.stencilTest),e.toggle(dS.CULL_FACE,this.culling),e.toggle(dS.POLYGON_OFFSET_FILL,this.polygonOffsetFill),this.stencilTest&&(e.stencilMaskSeparate(dS.BACK,this.stencilMask[1]),e.stencilMaskSeparate(dS.FRONT,this.stencilMask[0]),e.stencilFuncSeparate(dS.BACK,this.stencilFunc[0],this.stencilRef[0],this.stencilMask[0]),e.stencilFuncSeparate(dS.FRONT,this.stencilFunc[1],this.stencilRef[1],this.stencilMask[1]),e.stencilOpSeparate(dS.BACK,this.stencilOpFail[0],this.stencilOpZFail[0],this.stencilOpZPass[0]),e.stencilOpSeparate(dS.FRONT,this.stencilOpFail[1],this.stencilOpZFail[1],this.stencilOpZPass[1])),this.blending){var t=this,r=t.blendColor,i=t.blendEquationParameters,n=t.blendFunctionParameters;e.blendColor(r[0],r[1],r[2],r[3]),e.blendEquationSeparate(i[0],i[1]),e.blendFuncSeparate(n[0],n[1],n[2],n[3])}e.colorMask(this.colorMask[0],this.colorMask[1],this.colorMask[2],this.colorMask[3]),this.depthTest&&(e.depthMask(this.depthMask),e.depthFunc(this.depthFunc),e.depthRange(this.depthRange[0],this.depthRange[1])),this.culling&&(e.cullFace(this.cullFace),e.frontFace(this.frontFace)),this.polygonOffsetFill&&e.polygonOffset(this.polygonOffset[0],this.polygonOffset[1])},e}(),iw=function(t){function r(e,r){var i=t.call(this,r)||this;return i.floats={},i.ints={},i.vector2s={},i.vector3s={},i.vector4s={},i.matrices={},i.matrice3s={},i.textures={},i.floatArrays={},i.vector4Arrays={},i.matrixArrays={},i.samplers=[],i.uniforms=[],i.uniformDirtyFlag=!0,i.glMaterialState=new rw,i.engine=e,i}return JA(r,t),Object.defineProperty(r.prototype,"blending",{get:function(){return this.glMaterialState.blending},set:function(e){void 0!==e&&this.glMaterialState.setBlending(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendColor",{get:function(){return this.glMaterialState.blendColor},set:function(e){e&&this.glMaterialState.setBlendColor(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendFunction",{get:function(){return this.glMaterialState.blendFunctionParameters},set:function(e){e&&this.glMaterialState.setBlendFunctionParameters(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendEquation",{get:function(){return this.glMaterialState.blendEquationParameters},set:function(e){e&&this.glMaterialState.setBlendEquationParameters(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthTest",{get:function(){return this.glMaterialState.depthTest},set:function(e){void 0!==e&&this.glMaterialState.setDepthTest(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthMask",{get:function(){return this.glMaterialState.depthMask},set:function(e){void 0!==e&&this.glMaterialState.setDepthMask(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthRange",{get:function(){return this.glMaterialState.depthRange},set:function(e){e&&this.glMaterialState.setDepthRange(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthFunc",{get:function(){return this.glMaterialState.depthFunc},set:function(e){void 0!==e&&this.glMaterialState.setDepthFunc(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffsetFill",{get:function(){return this.glMaterialState.polygonOffsetFill},set:function(e){void 0!==e&&this.glMaterialState.setPolygonOffsetFill(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"polygonOffset",{get:function(){return this.glMaterialState.polygonOffset},set:function(e){e&&this.glMaterialState.setPolygonOffset(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sampleAlphaToCoverage",{get:function(){return this.glMaterialState.sampleAlphaToCoverage},set:function(e){void 0!==e&&this.glMaterialState.setSampleAlphaToCoverage(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"colorMask",{get:function(){return this.glMaterialState.colorMask},set:function(e){e&&this.glMaterialState.setColorMask(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilTest",{get:function(){return this.glMaterialState.stencilTest},set:function(e){void 0!==e&&this.glMaterialState.setStencilTest(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilMask",{get:function(){return this.glMaterialState.stencilMask},set:function(e){e&&this.glMaterialState.setStencilMask(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilRef",{get:function(){return this.glMaterialState.stencilRef},set:function(e){e&&this.glMaterialState.setStencilRef(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilFunc",{get:function(){return this.glMaterialState.stencilFunc},set:function(e){e&&this.glMaterialState.setStencilFunc(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpFail",{get:function(){return this.glMaterialState.stencilOpFail},set:function(e){e&&this.glMaterialState.setStencilOpFail(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZFail",{get:function(){return this.glMaterialState.stencilOpZFail},set:function(e){e&&this.glMaterialState.setStencilOpZFail(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"stencilOpZPass",{get:function(){return this.glMaterialState.stencilOpZPass},set:function(e){e&&this.glMaterialState.setStencilOpZPass(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"culling",{get:function(){return this.glMaterialState.culling},set:function(e){void 0!==e&&this.glMaterialState.setCulling(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"frontFace",{get:function(){return this.glMaterialState.frontFace},set:function(e){void 0!==e&&this.glMaterialState.setFrontFace(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"cullFace",{get:function(){return this.glMaterialState.cullFace},set:function(e){void 0!==e&&this.glMaterialState.setCullFace(e)},enumerable:!1,configurable:!0}),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.createMaterialStates=function(e){this.sampleAlphaToCoverage=!!e.sampleAlphaToCoverage,this.depthTest=e.depthTest,this.depthMask=e.depthMask,this.depthRange=e.depthRange,this.depthFunc=e.depthFunc,this.colorMask=e.colorMask,this.polygonOffset=e.polygonOffset,this.polygonOffsetFill=e.polygonOffsetFill,this.blending=e.blending,this.blendFunction=e.blendFunction,this.stencilTest=e.stencilTest},Object.defineProperty(r.prototype,"isDestroyed",{get:function(){return this.destroyed},enumerable:!1,configurable:!0}),r.prototype.initialize=function(){var e,t;if(!this.initialized){var r=this.engine;if(r.addMaterial(this),!this.shader){var i=r.getGLPipelineContext();this.shader=i.shaderLibrary.createShader(this.shaderSource)}this.shader.initialize(r);try{for(var n=rS(Object.values(this.textures)),o=n.next();!o.done;o=n.next()){o.value.initialize()}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.initialized=!0}},r.prototype.setupStates=function(e){this.glMaterialState.apply(e)},r.prototype.use=function(e,t){var r,i,n,o,a,s=e.engine.getGLPipelineContext();if(this.shader.program.bind(),this.setupStates(s),t){try{for(var u=rS(t.uniforms),c=u.next();!c.done;c=u.next())a=c.value,this.checkUniform(a)}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}try{for(var l=rS(t.samplers),f=l.next();!f.done;f=l.next())a=f.value,this.samplers.includes(a)||(this.samplers.push(a),this.uniformDirtyFlag=!0)}catch(e){n={error:e}}finally{try{f&&!f.done&&(o=l.return)&&o.call(l)}finally{if(n)throw n.error}}}if(this.uniformDirtyFlag&&(this.shader.fillShaderInformation(this.uniforms,this.samplers),this.uniformDirtyFlag=!1),t){for(a in t.floats)this.shader.setFloat(a,t.floats[a]);for(a in t.ints)this.shader.setInt(a,t.ints[a]);for(a in t.matrices)this.shader.setMatrix(a,t.matrices[a])}for(a in this.textures)this.textures[a].textureBuffer||this.textures[a].initialize();for(a in this.floats)this.shader.setFloat(a,this.floats[a]);for(a in this.ints)this.shader.setInt(a,this.ints[a]);for(a in this.floatArrays)this.shader.setFloats(a,this.floatArrays[a]);for(a in this.textures)this.shader.setTexture(a,this.textures[a]);for(a in this.vector2s)this.shader.setVector2(a,this.vector2s[a]);for(a in this.vector3s)this.shader.setVector3(a,this.vector3s[a]);for(a in this.vector4s)this.shader.setVector4(a,this.vector4s[a]);for(a in this.matrices)this.shader.setMatrix(a,this.matrices[a]);for(a in this.matrice3s)this.shader.setMatrix3(a,this.matrice3s[a]);for(a in this.vector4Arrays)this.shader.setVector4Array(a,this.vector4Arrays[a]);for(a in this.matrixArrays)this.shader.setMatrixArray(a,this.matrixArrays[a])},r.prototype.getFloat=function(e){return this.floats[e]},r.prototype.setFloat=function(e,t){this.checkUniform(e),this.floats[e]=t},r.prototype.getInt=function(e){return this.ints[e]},r.prototype.setInt=function(e,t){this.checkUniform(e),this.ints[e]=t},r.prototype.getFloats=function(e){return this.floatArrays[e]},r.prototype.setFloats=function(e,t){this.checkUniform(e),this.floatArrays[e]=t},r.prototype.getVector2=function(e){return this.vector2s[e]},r.prototype.setVector2=function(e,t){this.checkUniform(e),this.vector2s[e]=t},r.prototype.getVector3=function(e){return this.vector3s[e]},r.prototype.setVector3=function(e,t){this.checkUniform(e),this.vector3s[e]=t},r.prototype.getVector4=function(e){return this.vector4s[e]},r.prototype.setVector4=function(e,t){this.checkUniform(e),this.vector4s[e]=t},r.prototype.getMatrix=function(e){return this.matrices[e]},r.prototype.setMatrix=function(e,t){this.checkUniform(e),this.matrices[e]=t},r.prototype.setMatrix3=function(e,t){this.checkUniform(e),this.matrice3s[e]=t},r.prototype.getVector4Array=function(e){return this.vector4Arrays[e]},r.prototype.setVector4Array=function(e,t){var r,i;this.checkUniform(e),this.vector4Arrays[e]=[];try{for(var n=rS(t),o=n.next();!o.done;o=n.next()){var a=o.value;this.vector4Arrays[e].push(a[0],a[1],a[2],a[3])}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},r.prototype.getMatrixArray=function(e){return this.matrixArrays[e]},r.prototype.setMatrixArray=function(e,t){var r,i;this.checkUniform(e),this.matrixArrays[e]=[];try{for(var n=rS(t),o=n.next();!o.done;o=n.next())for(var a=o.value,s=0;s<16;s++)this.matrixArrays[e].push(a[s])}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}},r.prototype.setMatrixNumberArray=function(e,t){this.checkUniform(e),this.matrixArrays[e]=t},r.prototype.getTexture=function(e){return this.textures[e]},r.prototype.setTexture=function(e,t){this.samplers.includes(e)||(this.samplers.push(e),this.uniformDirtyFlag=!0),this.textures[e]=t},r.prototype.hasUniform=function(e){return this.uniforms.includes(e)||this.samplers.includes(e)},r.prototype.clone=function(e){var t=e||this.props,i=this.engine;eb(i);var n=new r(i,t);return n.glMaterialState=Object.assign(new rw,n.glMaterialState),n.floats=this.floats,n.ints=this.ints,n.vector2s=this.vector2s,n.vector3s=this.vector3s,n.vector4s=this.vector4s,n.matrices=this.matrices,n.textures=this.textures,n.floatArrays=this.floatArrays,n.vector4Arrays=this.vector4Arrays,n.matrixArrays=this.matrixArrays,n.samplers=this.samplers,n.uniforms=this.uniforms,n.uniformDirtyFlag=!0,n},r.prototype.cloneUniforms=function(e){var t,r=e;for(t in r.floats)this.setFloat(t,r.floats[t]);for(t in r.ints)this.setInt(t,r.ints[t]);for(t in r.floatArrays)this.setFloats(t,r.floatArrays[t]);for(t in r.textures)this.setTexture(t,r.textures[t]);for(t in r.vector2s)this.setVector2(t,r.vector2s[t]);for(t in r.vector3s)this.setVector3(t,r.vector3s[t]);for(t in r.vector4s)this.setVector4(t,r.vector4s[t]);for(t in r.matrices)this.setMatrix(t,r.matrices[t]);for(t in r.vector4Arrays){for(var i=[],n=0;n<r.vector4Arrays[t].length;n+=4)i.push([r.vector4Arrays[t][n],r.vector4Arrays[t][n+1],r.vector4Arrays[t][n+2],r.vector4Arrays[t][n+3]]);this.setVector4Array(t,i)}for(t in r.matrixArrays){var o=[];for(n=0;n<r.matrixArrays[t].length;n+=16){for(var a=Ib(),s=0;s<16;s++)a[s]=r.matrixArrays[t][n+s];o.push(a)}this.setMatrixArray(t,o)}},r.prototype.checkUniform=function(e){this.uniforms.includes(e)||(this.uniforms.push(e),this.uniformDirtyFlag=!0)},r.prototype.dispose=function(t){var r,i,n;if(!this.destroyed){if(null===(n=this.shader)||void 0===n||n.dispose(),(null==t?void 0:t.textures)!==e.DestroyOptions.keep)try{for(var o=rS(Object.values(this.textures)),a=o.next();!a.done;a=o.next()){a.value.dispose()}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}this.shaderSource=null,this.uniformSemantics={},this.floats={},this.ints={},this.vector2s={},this.vector3s={},this.vector4s={},this.matrices={},this.matrice3s={},this.textures={},this.floatArrays={},this.vector4Arrays={},this.matrixArrays={},this.samplers=[],this.uniforms=[],this.initialize=dR,this.destroyed=!0,void 0!==this.engine&&(this.engine.removeMaterial(this),this.engine=void 0)}},r}(AC),nw=function(){function t(e){if(this.renderer=e,1===e.engine.gpuCapability.level){this.copyRenderPass=this.createCopyRenderPass().initialize(e);var t=this.copyRenderPass.meshes[0].material.shaderSource;e.pipelineContext.shaderLibrary.addShader(t)}}return t.prototype.resetColorAttachments=function(e,t){this.renderer&&e.resetColorAttachments(t)},t.prototype.copyTexture=function(t,r){this.renderer&&(t.initialize(),r.initialize(),r.updateSource({sourceType:e.TextureSourceType.framebuffer,data:{width:r.getWidth()||t.getWidth(),height:r.getHeight()||t.getHeight()}}),2===this.renderer.engine.gpuCapability.level?this.copy2(t,r):this.copy1(t,r))},t.prototype.copy2=function(e,t){var r,i=this.renderer.getFrameBuffer();null===(r=this.renderer)||void 0===r||r.glRenderer.copy2(e,t),this.renderer.setFrameBuffer(i)},t.prototype.copy1=function(e,t){var r=this.copyRenderPass;if(r){var i=this.renderer;if(i){var n=r.frameBuffer;n.viewport[2]=t.getWidth()||e.getWidth(),n.viewport[3]=t.getHeight()||e.getHeight(),i.glRenderer.resetColorAttachments(n,[t]),r.meshes[0].material.setTexture("uTex",e),i.renderRenderPass(r)}}},t.prototype.createCopyRenderPass=function(){var t="mri-copy-mesh",r={texture:{format:dS.RGBA}},i=this.renderer.engine,n=new tw(i,{name:t,mode:dS.TRIANGLE_STRIP,attributes:{aPos:{type:dS.FLOAT,size:2,data:new Float32Array([-1,1,-1,-1,1,1,1,-1])}},drawCount:4}),o=i.gpuCapability.level,a=new iw(i,{name:t,shader:{cacheId:"$mri-internal-copy",name:t,vertex:HR([],"\n precision highp float;\n attribute vec2 aPos;\n varying vec2 vTex;\n void main(){\n gl_Position = vec4(aPos,0.,1.0);\n vTex = (aPos + vec2(1.))/2.;\n }\n ",e.ShaderType.vertex,o),fragment:HR([],"\n precision highp float;\n varying vec2 vTex;\n uniform sampler2D uTex;\n void main(){gl_FragColor = texture2D(uTex,vTex);}\n ",e.ShaderType.fragment,o),glslVersion:2===o?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1}});a.blending=!1,a.depthTest=!1,a.culling=!1;var s=new zC(i,{name:t,geometry:n,material:a,priority:0});return new ow(this.renderer,{name:"mri-copy-rp",clearAction:{colorAction:e.TextureLoadAction.whatever},attachments:[r],meshes:[s]})},t.prototype.dispose=function(){var e;this.renderer&&(null===(e=this.copyRenderPass)||void 0===e||e.dispose(),this.renderer=void 0)},t}(),ow=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t.prototype.configure=function(e){this.currentFrameBuffer=e.getFrameBuffer(),e.setFrameBuffer(this.frameBuffer)},t.prototype.execute=function(e){this.clearAction&&e.clear(this.clearAction),e.renderMeshes(this.meshes),this.storeAction&&e.clear(this.storeAction),e.setFrameBuffer(this.currentFrameBuffer)},t}(YC),aw=function(){function e(e,t,r){var i=this;void 0===t&&(t="webgl"),void 0===r&&(r={}),this.canvas=e,this.glType=t,this.restoreHandlers=[],this.lostHandlers=[],eb(e),this.gl=fS(e,t,r),this.contextLostListener=function(e){var t,r,n;try{for(var o=rS(i.lostHandlers),a=o.next();!a.done;a=o.next()){a.value.lost(e)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}null===(n=i.canvas)||void 0===n||n.removeEventListener("webglcontextlost",i.contextLostListener)},this.contextRestoredListener=function(e){var t,r,n;try{for(var o=rS(i.restoreHandlers),a=o.next();!a.done;a=o.next()){a.value.restore()}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}null===(n=i.canvas)||void 0===n||n.addEventListener("webglcontextlost",i.contextLostListener)},e.addEventListener("webglcontextlost",this.contextLostListener),e.addEventListener("webglcontextrestored",this.contextRestoredListener)}return e.prototype.dispose=function(){this.canvas&&(this.canvas.removeEventListener("webglcontextlost",this.contextLostListener),this.canvas.removeEventListener("webglcontextrestored",this.contextRestoredListener)),this.gl=null,this.canvas=null},e.prototype.addLostHandler=function(e){this.lostHandlers.push(e)},e.prototype.removeLostHandler=function(e){var t=this.lostHandlers.indexOf(e);t>-1&&this.lostHandlers.splice(t,1)},e.prototype.addRestoreHandler=function(e){this.restoreHandlers.push(e)},e.prototype.removeRestoreHandler=function(e){var t=this.restoreHandlers.indexOf(e);t>-1&&this.restoreHandlers.splice(t,1)},e}(),sw=function(e){function t(t,r){var i=e.call(this,t)||this;return i.initialized=!1,void 0!==r&&i.initialize(r),i}return JA(t,e),t.prototype.initialize=function(e){this.initialized||(this.initialized=!0,this.renderer=e,this.buffer=e.createGLRenderBuffer(this))},t.prototype.setSize=function(e,t){if(this.initialized){if(e!==this.size[0]||t!==this.size[1]){var r=this.renderer,i=r.gl;r.pipelineContext.bindRenderBuffer(i.RENDERBUFFER,this.buffer),e&&t?i.renderbufferStorage(i.RENDERBUFFER,this.format,this.size[0]=e,this.size[1]=t):console.error({content:"Invalid render buffer size: ".concat(e,"x").concat(t),type:aC})}}else console.error({content:"Can't set size for uninitialized render buffer",type:aC})},t.prototype.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderBuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=dR},t}(bO),uw=1,cw=function(t){function r(r,i){var n,o=t.call(this)||this;o.attachmentTextures=[],o.renderer=i,o.engine=i.engine;var a=r.depthStencilAttachment,s=r.viewport,u=r.isCustomViewport,c=r.viewportScale,l=void 0===c?1:c,f=r.storeAction,h=r.name,p=void 0===h?"GLFrameBuffer".concat(uw++):h;return o.depthStencilStorageType=null!==(n=null==a?void 0:a.storageType)&&void 0!==n?n:e.RenderPassAttachmentStorageType.none,o.viewport=s,o.isCustomViewport=!!u,o.viewportScale=l,o.name=p,o.storeAction=f,o.updateProps(r),o}return JA(r,t),Object.defineProperty(r.prototype,"stencilStorage",{get:function(){if(this.depthStencilStorageType!==e.RenderPassAttachmentStorageType.depth_16_opaque)return this.depthStencilRenderBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"depthStorage",{get:function(){if(this.depthStencilStorageType!==e.RenderPassAttachmentStorageType.stencil_8_opaque)return this.depthStencilRenderBuffer},enumerable:!1,configurable:!0}),r.prototype.getDepthTexture=function(){return this.depthTexture},r.prototype.getStencilTexture=function(){return this.stencilTexture},r.prototype.getColorTextures=function(){return this.colorTextures},r.prototype.updateAttachmentTextures=function(){var e=this;this.attachmentTextures.length=0,this.colorTextures.forEach((function(t){t.initialize(),DS(e.attachmentTextures,t.textureBuffer)})),this.stencilTexture&&DS(this.attachmentTextures,this.stencilTexture.textureBuffer),this.depthTexture&&DS(this.attachmentTextures,this.depthTexture.textureBuffer)},r.prototype.updateProps=function(t){var r,i,n=this.renderer,o=this.engine.gpuCapability,a=null!==(r=t.depthStencilAttachment)&&void 0!==r?r:{storageType:e.RenderPassAttachmentStorageType.none},s=t.attachments.length>0;this.externalStorage=!1;var u=!0;if(t.attachments.length>1&&!o.detail.drawBuffers)throw Error("multiple color attachments not support");var c=null===(i=t.depthStencilAttachment)||void 0===i?void 0:i.texture,l=o.detail.readableDepthStencilTextures;if(this.colorTextures=t.attachments.slice(),!s&&a.storageType!==e.RenderPassAttachmentStorageType.none)throw Error("use depth stencil attachment without color attachments");s&&(this.fbo=n.glRenderer.createGLFrameBuffer(this,this.name));var f=a.storageType;if(f===e.RenderPassAttachmentStorageType.depth_stencil_opaque){if(a.storage){if(!(a.storage instanceof sw))throw Error("invalid depth stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new sw({format:dS.DEPTH_STENCIL,attachment:dS.DEPTH_STENCIL_ATTACHMENT,storageType:f},n.glRenderer);u=!1}else if(f===e.RenderPassAttachmentStorageType.depth_16_opaque)if(a.storage){if(!(a.storage instanceof sw))throw Error("invalid depth attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new sw({attachment:dS.DEPTH_ATTACHMENT,format:dS.DEPTH_COMPONENT16,storageType:f},n.glRenderer);else if(f===e.RenderPassAttachmentStorageType.stencil_8_opaque)if(a.storage){if(!(a.storage instanceof sw))throw Error("invalid stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new sw({attachment:dS.STENCIL_ATTACHMENT,format:dS.STENCIL_INDEX8,storageType:f},n.glRenderer);else if(f===e.RenderPassAttachmentStorageType.depth_16_texture){if(!l)throw Error("depth texture is not support in framebuffer");this.depthTexture=null!=c?c:new jM(this.engine,{sourceType:e.TextureSourceType.framebuffer,format:dS.DEPTH_COMPONENT,internalFormat:o.internalFormatDepth16,type:dS.UNSIGNED_SHORT,name:"".concat(this.name,"##depthTex")}),this.depthTexture.initialize()}else if(f===e.RenderPassAttachmentStorageType.depth_24_stencil_8_texture){if(!l)throw Error("depth stencil texture is not support in framebuffer");this.depthTexture=this.stencilTexture=null!=c?c:new jM(this.engine,{sourceType:e.TextureSourceType.framebuffer,format:dS.DEPTH_STENCIL,internalFormat:o.internalFormatDepth24_stencil8,type:o.UNSIGNED_INT_24_8,name:"".concat(this.name,"##dpthStclTex")}),this.depthTexture.initialize(),u=!0}this.storeInvalidAttachments=this.getStoreAttachments(this.storeAction,u),this.updateAttachmentTextures()},r.prototype.getStoreAttachments=function(t,r){var i=this.renderer.glRenderer.gl,n=this.colorTextures.length;if(t&&vS(i)&&n>0){var o=[];if(t.depthAction===e.TextureStoreAction.clear&&this.depthStorage&&DS(o,r?i.DEPTH_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.stencilAction===e.TextureStoreAction.clear&&this.stencilStorage&&DS(o,r?i.STENCIL_ATTACHMENT:i.DEPTH_STENCIL_ATTACHMENT),t.colorAction===e.TextureStoreAction.clear)for(var a=0;a<n;a++)DS(o,i["COLOR_ATTACHMENT".concat(a)]);return o}},r.prototype.unbind=function(){var e=this.storeInvalidAttachments;if(null==e?void 0:e.length){var t=this.renderer.glRenderer.gl;t.invalidateFramebuffer(t.FRAMEBUFFER,e)}this.renderer.pipelineContext.bindSystemFramebuffer()},r.prototype.bind=function(){var e=this,t=this.renderer.glRenderer.gl,r=this.renderer.pipelineContext;if(this.fbo){var i=t.FRAMEBUFFER,n=iS(this.viewport,4),o=n[0],a=n[1],s=n[2],u=n[3];r.bindFramebuffer(i,this.fbo),r.viewport(o,a,s,u);var c=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(r.textureUnitDict).forEach((function(t){var i=r.textureUnitDict[t];i!==c&&i&&e.attachmentTextures.includes(i)&&(r.activeTexture(+t),e.renderer.glRenderer.emptyTexture2D.bind())}));for(var l=0;l<4;l++)r.activeTexture(t.TEXTURE0+l),this.renderer.glRenderer.emptyTexture2D.bind();if(!this.ready){var f=this,h=f.depthStencilRenderBuffer,p=f.depthTexture,d=f.stencilTexture;if(r.activeTexture(t.TEXTURE0),h)h.setSize(s,u),t.framebufferRenderbuffer(i,h.attachment,t.RENDERBUFFER,h.buffer);else if(p){p.source.data={width:s,height:u},p.update({data:{width:s,height:u,data:new Uint16Array(0)}});var m=p&&d?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.framebufferTexture2D(i,m,t.TEXTURE_2D,p.textureBuffer,0)}this.resetColorTextures(this.colorTextures);var v=t.checkFramebufferStatus(i);if(v!==t.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer failed, status: ".concat(v,", error: ").concat(t.getError()));this.ready=!0}}},r.prototype.resetColorTextures=function(e){var t,r,i=e,n=this.renderer.glRenderer.gl,o=this.engine.gpuCapability,a=this.viewport,s=[];if(i){try{for(var u=rS(i),c=u.next();!c.done;c=u.next()){c.value.initialize()}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}this.colorTextures=i.slice()}this.renderer.pipelineContext.activeTexture(n.TEXTURE0),this.colorTextures.forEach((function(e,t){var r={width:a[2],height:a[3],data:new Uint8Array(0)};e.update({data:r}),o.framebufferTexture2D(n,n.FRAMEBUFFER,t,n.TEXTURE_2D,e.textureBuffer),s.push(!0)})),o.drawBuffers(n,s),this.updateAttachmentTextures()},r.prototype.resize=function(e,t,r,i){var n=iS(this.viewport,4),o=n[0],a=n[1],s=n[2],u=n[3];o===e&&a===t&&s===r&&u===i||(this.viewport=[e,t,r,i],this.ready=!1,this.bind())},r.prototype.dispose=function(t){var r,i,n=this.renderer;if(n){n.glRenderer.deleteGLFrameBuffer(this),delete this.fbo;var o=(null==t?void 0:t.depthStencilAttachment)?t.depthStencilAttachment:e.RenderPassDestroyAttachmentType.force;(o===e.RenderPassDestroyAttachmentType.force||o===e.RenderPassDestroyAttachmentType.keepExternal&&!this.externalStorage)&&(null===(r=this.depthStencilRenderBuffer)||void 0===r||r.dispose(),null===(i=this.depthTexture)||void 0===i||i.dispose()),this.renderer=this.stencilRenderBuffer=this.depthStencilRenderBuffer=null}},r}(MO);var lw,fw,hw=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0},pw=((lw={})[dS.FLOAT]=1,lw[dS.INT]=1,lw[dS.UNSIGNED_INT]=1,lw[dS.SHORT]=1,lw[dS.BOOL]=1,lw[dS.UNSIGNED_SHORT]=1,lw[dS.FLOAT_VEC2]=2,lw[dS.FLOAT_VEC3]=3,lw[dS.FLOAT_VEC4]=4,lw[dS.FLOAT_MAT2]=4,lw[dS.FLOAT_MAT3]=9,lw[dS.FLOAT_MAT4]=16,lw[dS.FLOAT_MAT2x3]=6,lw[dS.FLOAT_MAT2x4]=8,lw[dS.FLOAT_MAT4x3]=12,lw[dS.FLOAT_MAT4x2]=8,lw[dS.FLOAT_MAT3x4]=12,lw[dS.FLOAT_MAT3x2]=6,lw[dS.INT_VEC2]=2,lw[dS.INT_VEC3]=3,lw[dS.INT_VEC4]=4,lw[dS.UNSIGNED_INT_VEC2]=2,lw[dS.UNSIGNED_INT_VEC3]=3,lw[dS.UNSIGNED_INT_VEC4]=4,lw[dS.BOOL_VEC2]=2,lw[dS.BOOL_VEC3]=3,lw[dS.BOOL_VEC4]=4,lw),dw=gw(Float32Array),mw=gw(Int32Array),vw=gw(Uint8Array);function yw(e){return function(t,r,i,n){var o={start:r[1],dirty:!0};if(r[2]>1){var a=t;if(a.length){for(var s=n[1]||a.length,u=r[4]/e.BYTES_PER_ELEMENT,c=o.buffer=new e(s*u),l=n[0]||0,f=0;f<s;f++)c[f*u]=a[f+l];o.start+=l*u}}else o.buffer=new e([t]);return o}}function gw(e){return function(t,r,i,n){for(var o=r[8],a=r[2],s=r[5],u=1===a?o:r[4],c=s?u/s:1,l=u/e.BYTES_PER_ELEMENT/c,f=o/e.BYTES_PER_ELEMENT/l,h=pw[r[0]],p=h/c,d=(n[0]||0)*h,m=n[1]?c*n[1]:f,v=new e(l*m),y={start:r[1]+u*(n[0]||0),dirty:!0,buffer:v},g=0,T=0,x=d;g<m;g++){for(var E=0;E<p;E++)v[T+E]=t[x+E];T+=l,x+=p}return y}}function Tw(e,t){for(var r=[],i=[],n=e.getProgramParameter(t,e.ACTIVE_UNIFORM_BLOCKS),o=function(n){var o=e.getActiveUniformBlockName(t,n),a={index:e.getUniformBlockIndex(t,o),usedByVertexShader:e.getActiveUniformBlockParameter(t,n,e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:e.getActiveUniformBlockParameter(t,n,e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:e.getActiveUniformBlockParameter(t,n,e.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:e.getActiveUniformBlockParameter(t,n,e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES),used:!1,uniforms:{},name:o,id:""};a.used=a.usedByVertexShader||a.usedByFragmentShader,r[n]=a;for(var s=a.uniformIndices,u=[],c=0;c<s.length;c++){var l=e.getActiveUniform(t,s[c]).name.replace("[0]","");a.uniforms[l]=[0,0,0,0,0,0,0,c,0],u[c]=l,i.push(l)}[e.UNIFORM_TYPE,e.UNIFORM_OFFSET,e.UNIFORM_SIZE,e.UNIFORM_BLOCK_INDEX,e.UNIFORM_ARRAY_STRIDE,e.UNIFORM_MATRIX_STRIDE,e.UNIFORM_IS_ROW_MAJOR].forEach((function(r,i){e.getActiveUniforms(t,s,r).forEach((function(e,t){var r=u[t];a.uniforms[r][i]=+e}))}));for(c=0;c<u.length;c++){var f=a.uniforms[u[c]],h=a.uniforms[u[c+1]],p=h?h[1]:a.size;f[8]=p-f[1]}a.id=function(e){var t=e.name,r=e.size,i=e.uniforms,n=e.uniformIndices;return Object.keys(i).map((function(e){return"".concat(e,"[").concat(i[e].join(":"),"]")})).join("+"),hw("".concat(t,"+"),"".concat(r,"+"),"".concat(n.length,"+"))}(a)+""},a=0;a<n;++a)o(a);return{blockSpecs:r,blockUniformNames:i}}(fw={})[dS.FLOAT]=yw(Float32Array),fw[dS.INT]=yw(Int32Array),fw[dS.UNSIGNED_INT]=yw(Uint32Array),fw[dS.SHORT]=yw(Int16Array),fw[dS.BOOL]=yw(Uint8Array),fw[dS.UNSIGNED_SHORT]=yw(Uint16Array),fw[dS.FLOAT_VEC2]=dw,fw[dS.FLOAT_VEC3]=dw,fw[dS.FLOAT_VEC4]=dw,fw[dS.FLOAT_MAT2]=dw,fw[dS.FLOAT_MAT3]=dw,fw[dS.FLOAT_MAT4]=dw,fw[dS.FLOAT_MAT2x3]=dw,fw[dS.FLOAT_MAT2x4]=dw,fw[dS.FLOAT_MAT4x3]=dw,fw[dS.FLOAT_MAT4x2]=dw,fw[dS.FLOAT_MAT3x4]=dw,fw[dS.FLOAT_MAT3x2]=dw,fw[dS.INT_VEC2]=mw,fw[dS.INT_VEC3]=mw,fw[dS.INT_VEC4]=mw,fw[dS.UNSIGNED_INT_VEC2]=mw,fw[dS.UNSIGNED_INT_VEC3]=mw,fw[dS.UNSIGNED_INT_VEC4]=mw,fw[dS.BOOL_VEC2]=vw,fw[dS.BOOL_VEC3]=vw,fw[dS.BOOL_VEC4]=vw;var xw=function(){function e(e,t,r,i){var n=this;this.engine=e,this.program=t,this.shared=r,this.id=i,this.uniformBlockMap={},this.pipelineContext=e.getGLPipelineContext();var o=this.pipelineContext.gl;if(this.pipelineContext.useProgram(t),this.attribInfoMap=this.createAttribMap(),vS(o)){var a=Tw(o,t),s=a.blockSpecs;a.blockUniformNames,s.forEach((function(e){return n.uniformBlockMap[e.name]=e}))}this.pipelineContext.useProgram(null)}return e.prototype.bind=function(){this.pipelineContext.useProgram(this.program)},e.prototype.setupAttributes=function(e){var t,r,i=this,n=this.id,o=this.pipelineContext.gl;return e.vaos[n]?r=e.vaos[n]:((r=new YM(this.engine,"".concat(e.name,"-").concat(n)))||console.error("创建vao对象失败"),e.vaos[n]=r),r&&(r.bind(),r.ready)||(Object.keys(this.attribInfoMap).forEach((function(t){var r=i.attribInfoMap[t],n=e.attributes[t];if(n){var a=e.buffers[n.dataSource];if(!a)throw Error("no buffer named ".concat(n.dataSource||t));a.bind(),o.enableVertexAttribArray(r.loc),o.vertexAttribPointer(r.loc,n.size,n.type,n.normalize,n.stride||0,n.offset||0)}})),null===(t=e.indicesBuffer)||void 0===t||t.bind(),r&&(r.ready=!0)),r},e.prototype.createAttribMap=function(){for(var e=this.pipelineContext.gl,t=this.program,r={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;n<i;n++){var o=e.getActiveAttrib(t,n),a=o.name,s=o.type,u=o.size,c=e.getAttribLocation(t,a);r[a]={type:s,name:a,size:u,loc:c}}return r},e.prototype.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},e}(),Ew=function(e){function t(t){var r=e.call(this,t)||this;return r.initialized=!1,r.uniformLocations={},r.samplerChannels={},r}return JA(t,e),t.prototype.initialize=function(e){this.initialized||e.getGLPipelineContext().shaderLibrary.compileShader(this)},t.prototype.setFloat=function(e,t){this.pipelineContext.setFloat(this.uniformLocations[e],t)},t.prototype.setInt=function(e,t){this.pipelineContext.setInt(this.uniformLocations[e],t)},t.prototype.setFloats=function(e,t){this.pipelineContext.setFloats(this.uniformLocations[e],t)},t.prototype.setTexture=function(e,t){this.pipelineContext.setTexture(this.uniformLocations[e],this.samplerChannels[e],t)},t.prototype.setVector2=function(e,t){this.pipelineContext.setVector2(this.uniformLocations[e],t)},t.prototype.setVector3=function(e,t){this.pipelineContext.setVector3(this.uniformLocations[e],t)},t.prototype.setVector4=function(e,t){this.pipelineContext.setVector4(this.uniformLocations[e],t)},t.prototype.setMatrix=function(e,t){this.pipelineContext.setMatrix(this.uniformLocations[e],t)},t.prototype.setMatrix3=function(e,t){this.pipelineContext.setMatrix3(this.uniformLocations[e],t)},t.prototype.setVector4Array=function(e,t){this.pipelineContext.setVector4Array(this.uniformLocations[e],t)},t.prototype.setMatrixArray=function(e,t){this.pipelineContext.setMatrixArray(this.uniformLocations[e],t)},t.prototype.fillShaderInformation=function(e,t){var r=t.slice();e=e.concat(r);for(var i,n=this.pipelineContext.getUniforms(this.program.program,e),o=0;o<e.length;o++)this.uniformLocations[e[o]]=n[o];for(i=0;i<r.length;i++){null==this.uniformLocations[r[i]]&&(r.splice(i,1),i--)}for(i=0;i<r.length;i++){var a=r[i];this.samplerChannels[a]=i}},t.prototype.dispose=function(){var e;this.compileResult&&this.compileResult.shared||null===(e=this.program)||void 0===e||e.dispose()},t}(bC),Aw=0,Sw=function(){function t(e,t){this.engine=e,this.pipelineContext=t,this.shaderResults={},this.programMap={},this.glVertShaderMap=new Map,this.glFragShaderMap=new Map,this.shaderAllDone=!1,this.cachedShaders={},this.glAsyncCompileExt=e.gpuCapability.glAsyncCompileExt}return t.prototype.compileAllShaders=function(e){var t,r,i=this;if(this.shaderAllDone)e&&e([]);else{var n=[];try{for(var o=rS(Object.keys(this.cachedShaders)),a=o.next();!a.done;a=o.next()){var s=a.value;this.cachedShaders[s].initialized||n.push(s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}e?n.length?Promise.all(n.map((function(e){return new Promise((function(t){return i.compileShader(i.cachedShaders[e],t)}))}))).then(e).catch((function(){return 0})):e([]):n.map((function(e){return i.compileShader(i.cachedShaders[e])})),this.shaderAllDone=!0}},t.prototype.addShader=function(t){var r=this.computeShaderCacheId(t);if(this.cachedShaders[r])return r;this.shaderAllDone=!1;var i=t.glslVersion===e.GLSLVersion.GLSL3?"#version 300 es\n":"",n=t.vertex?i+t.vertex:"",o=t.fragment?i+t.fragment:"",a=!1;return(t.shared||t.cacheId)&&(a=!0),this.cachedShaders[r]=new Ew({vertex:n,fragment:o,name:t.name||r,shared:a}),this.cachedShaders[r].id=r,r},t.prototype.createShader=function(e){var t=this.addShader(e);return this.cachedShaders[t]},t.prototype.compileShader=function(t,r){var i=this,n=t.source,o=!1;(n.shared||n.cacheId)&&(o=!0);var a={vertex:n.vertex,fragment:n.fragment,name:n.name,shared:o},s=this.pipelineContext.gl,u={shared:a.shared,status:e.ShaderCompileResultStatus.compiling},c=this.createProgram(s,a.vertex,a.fragment,u),l=this.glAsyncCompileExt,f=performance.now(),h=function(r){u.status=e.ShaderCompileResultStatus.success,u.compileTime=performance.now()-f,t.program=r,t.initialized=!0,t.pipelineContext=i.pipelineContext,void 0!==i.programMap[t.id]&&console.warn("find duplicated shader id",t.id),i.programMap[t.id]=r},p=function(){var n=(!r||!l||l&&1==s.getProgramParameter(u.program,l.COMPLETION_STATUS_KHR))&&c();if(n){if(u.status!==e.ShaderCompileResultStatus.fail){qM(n,a.name);var f=new xw(i.engine,n,o,t.id);if(s.validateProgram(n),s.getProgramParameter(n,s.VALIDATE_STATUS))h(f);else{var d=s.getProgramInfoLog(n);(null==d?void 0:d.includes("the same texture"))?h(f):(u.status=e.ShaderCompileResultStatus.fail,u.error=d,console.error("compileProgramError: "+d,"\nvertex:\n",a.vertex,"\nfragment:\n",a.fragment),s.deleteProgram(n))}}r&&r(u)}else r&&requestAnimationFrame(p)};t.compileResult=u,p()},t.prototype.computeShaderCacheId=function(e){var t,r=e.vertex?e.vertex:"",i=e.fragment?e.fragment:"";return t=e.shared||e.cacheId?e.cacheId||"shared_".concat(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=0,i=0;i<arguments.length;i++)for(var n=e[i],o=0;o<n.length;o++)r=Math.imul(31,r)+n.charCodeAt(o)|0;return r}(r,i)):"instanced_"+Aw++,t},t.prototype.createProgram=function(t,r,i,n){var o=t.createProgram(),a=this.createGLShader(t,t.VERTEX_SHADER,r),s=this.createGLShader(t,t.FRAGMENT_SHADER,i);return o&&a&&s?(t.attachShader(o,a),t.attachShader(o,s),t.linkProgram(o),n.program=o,n.status=e.ShaderCompileResultStatus.compiling,function(){if(delete n.program,!t.getProgramParameter(o,t.LINK_STATUS)){var u=bw(t,a,"vertex",r),c=bw(t,s,"fragment",i);return n.status=e.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),c&&(n.error=c.error,n.status=c.status),o}return o}):(n.status=e.ShaderCompileResultStatus.fail,function(){return null})},t.prototype.createGLShader=function(e,t,r){var i=t===e.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=hw(null!=r?r:""),o=i.get(n);if(o)return o;var a=e.createShader(t);return a&&(e.shaderSource(a,r),e.compileShader(a),i.set(n,a)),a},t.prototype.deleteShader=function(e){var t=this.programMap[e];void 0!==t&&(t.dispose(),delete this.programMap[e]),void 0!==this.shaderResults[e]&&delete this.shaderResults[e]},t.prototype.restore=function(){},t.prototype.dispose=function(){if(Object.values(this.programMap).forEach((function(e){e.dispose()})),this.programMap={},this.pipelineContext){var e=this.pipelineContext.gl;this.glFragShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap.forEach((function(t){e.deleteShader(t)})),this.glVertShaderMap=new Map,this.glFragShaderMap=new Map}},t}();function bw(t,r,i,n){if(!t.getShaderParameter(r,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(r);return console.error("compile "+i+" error: "+o,(null!=n?n:"").split("\n").map((function(e,t){return"".concat(t+1," ").concat(e)})).join("\n")),{error:o,status:e.ShaderCompileResultStatus.fail}}}var _w=function(){function e(e,t){this.engine=e,this.gl=t,this.gl=t,this.shaderLibrary=new Sw(e,this),this.maxTextureCount=this.gl.TEXTURE0+this.gl.getParameter(this.gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS)-1,this.reset()}return e.prototype.dispose=function(){this.shaderLibrary.dispose(),this.reset()},e.prototype.reset=function(){this.glCapabilityCache={},this.activeTextureIndex=dS.TEXTURE0,this.textureUnitDict={},this.currentFramebuffer={},this.pixelStorei={},this.currentRenderBuffer={}},e.prototype.toggle=function(e,t){t?this.enable(e):this.disable(e)},e.prototype.enable=function(e){!0!==this.glCapabilityCache[e]&&(this.glCapabilityCache[e]=!0,this.gl.enable(e))},e.prototype.disable=function(e){!1!==this.glCapabilityCache[e]&&(this.glCapabilityCache[e]=!1,this.gl.disable(e))},e.prototype.bindFramebuffer=function(e,t){this.currentFramebuffer[e]!==t&&(this.currentFramebuffer[e]=t,this.gl.bindFramebuffer(e,t))},e.prototype.bindRenderBuffer=function(e,t){this.currentRenderBuffer[e]!==t&&(this.currentRenderBuffer[e]=t,this.gl.bindRenderbuffer(e,t))},e.prototype.bindSystemFramebuffer=function(){this.bindFramebuffer(this.gl.FRAMEBUFFER,null)},e.prototype.useProgram=function(e){this.set1("useProgram",e)},e.prototype.clear=function(e){this.gl.clear(e)},e.prototype.clearDepth=function(e){this.set1("clearDepth",e)},e.prototype.depthFunc=function(e){this.set1("depthFunc",e)},e.prototype.depthMask=function(e){this.set1("depthMask",e)},e.prototype.polygonOffset=function(e,t){this.set2("polygonOffset",e,t)},e.prototype.depthRange=function(e,t){this.set2("depthRange",e,t)},e.prototype.clearStencil=function(e){this.set1("clearStencil",e)},e.prototype.stencilMask=function(e){this.stencilMaskSeparate(this.gl.FRONT,e),this.stencilMaskSeparate(this.gl.BACK,e)},e.prototype.stencilFunc=function(e,t,r){this.stencilFuncSeparate(this.gl.FRONT,e,t,r),this.stencilFuncSeparate(this.gl.BACK,e,t,r)},e.prototype.stencilFuncSeparate=function(e,t,r,i){this.set4("stencilFuncSeparate",e,t,r,i)},e.prototype.stencilMaskSeparate=function(e,t){this.set2("stencilMaskSeparate",e,t)},e.prototype.stencilOp=function(e,t,r){this.stencilOpSeparate(this.gl.FRONT,e,t,r),this.stencilOpSeparate(this.gl.BACK,e,t,r)},e.prototype.stencilOpSeparate=function(e,t,r,i){this.set4("stencilOpSeparate",e,t,r,i)},e.prototype.cullFace=function(e){this.set1("cullFace",e)},e.prototype.frontFace=function(e){this.set1("frontFace",e)},e.prototype.clearColor=function(e,t,r,i){this.set4("clearColor",e,t,r,i)},e.prototype.colorMask=function(e,t,r,i){this.set4("colorMask",e,t,r,i)},e.prototype.blendColor=function(e,t,r,i){this.set4("blendColor",e,t,r,i)},e.prototype.blendFunc=function(e,t){this.blendFuncSeparate(e,t,e,t)},e.prototype.blendFuncSeparate=function(e,t,r,i){this.set4("blendFuncSeparate",e,t,r,i)},e.prototype.blendEquation=function(e){this.set1("blendEquation",e)},e.prototype.blendEquationSeparate=function(e,t){this.set2("blendEquationSeparate",e,t)},e.prototype.setPixelStorei=function(e,t){this.pixelStorei[e]!==t&&(this.pixelStorei[e]=t,this.gl.pixelStorei(e,t))},e.prototype.viewport=function(e,t,r,i){this.set4("viewport",e,t,r,i)},e.prototype.activeTexture=function(e){e=Math.min(e,this.maxTextureCount),this.activeTextureIndex!==e&&(this.activeTextureIndex=e,this.gl.activeTexture(e))},e.prototype.bindTexture=function(e,t,r){(this.currentTextureBinding!==t||r)&&(this.gl.bindTexture(e,t),this.currentTextureBinding=t),this.textureUnitDict[this.activeTextureIndex]=t},e.prototype.set1=function(e,t){this.glCapabilityCache[e]!==t&&(this.glCapabilityCache[e]=t,this.gl[e](t))},e.prototype.set2=function(e,t,r){var i=this.glCapabilityCache[e];i||(i=this.glCapabilityCache[e]={x:NaN,y:NaN}),i.x===t&&i.y===r||this.gl[e](i.x=t,i.y=r)},e.prototype.set3=function(e,t,r,i){var n=this.glCapabilityCache[e];n||(n=this.glCapabilityCache[e]={x:NaN,y:NaN,z:NaN}),n.x===t&&n.y===r&&n.z===i||this.gl[e](n.x=t,n.y=r,n.z=i)},e.prototype.set4=function(e,t,r,i,n){var o=this.glCapabilityCache[e];o||(o=this.glCapabilityCache[e]={x:NaN,y:NaN,z:NaN,w:NaN}),o.x===t&&o.y===r&&o.z===i&&o.w===n||this.gl[e](o.x=t,o.y=r,o.z=i,o.w=n)},e.prototype.get=function(e){return this.glCapabilityCache[e]},e.prototype.setFloat=function(e,t){e&&this.gl.uniform1f(e,t)},e.prototype.setInt=function(e,t){e&&this.gl.uniform1i(e,t)},e.prototype.setFloats=function(e,t){e&&this.gl.uniform1fv(e,t)},e.prototype.setVector2=function(e,t){this.setFloat2(e,t[0],t[1])},e.prototype.setVector3=function(e,t){this.setFloat3(e,t[0],t[1],t[2])},e.prototype.setVector4=function(e,t){this.setFloat4(e,t[0],t[1],t[2],t[3])},e.prototype.setVector4Array=function(e,t){e&&t.length%4==0&&this.gl.uniform4fv(e,t)},e.prototype.setMatrix=function(e,t){e&&16==t.length&&this.gl.uniformMatrix4fv(e,!1,t)},e.prototype.setMatrix3=function(e,t){e&&9==t.length&&this.gl.uniformMatrix3fv(e,!1,t)},e.prototype.setMatrixArray=function(e,t){e&&t.length%16==0&&this.gl.uniformMatrix4fv(e,!1,t)},e.prototype.setTexture=function(e,t,r){if(e){this.gl.activeTexture(this.gl.TEXTURE0+t);var i=r.target;this.gl.bindTexture(i,r.textureBuffer),this.gl.uniform1i(e,t)}},e.prototype.getUniforms=function(e,t){for(var r=[],i=0;i<t.length;i++)r.push(this.gl.getUniformLocation(e,t[i]));return r},e.prototype.setFloat4=function(e,t,r,i,n){e&&this.gl.uniform4f(e,t,r,i,n)},e.prototype.setFloat3=function(e,t,r,i){e&&this.gl.uniform3f(e,t,r,i)},e.prototype.setFloat2=function(e,t,r){e&&this.gl.uniform2f(e,t,r)},e}(),Rw=function(e){function t(t){var r=e.call(this)||this;return r.gpuCapability=new RO(t),r}return JA(t,e),t.prototype.dispose=function(){this.isDestroyed||e.prototype.dispose.call(this)},t.prototype.getGLRenderer=function(){return this.renderer},t.prototype.getGLRendererInternal=function(){return this.getGLRenderer().glRenderer},t.prototype.getGLPipelineContext=function(){return this.getGLRenderer().pipelineContext},t}(BM),Cw=function(t){function r(r,i,n){var o=t.call(this)||this;o.canvas=r,o.temporaryRTs={};var a=$A({preserveDrawingBuffer:void 0,alpha:!0,stencil:!0,antialias:!0,depth:!0,premultipliedAlpha:!0},n);o.context=new aw(r,i,a);var s=o.context.gl;return eb(s),o.engine=new Rw(s),o.engine.renderer=o,o.pipelineContext=new _w(o.engine,s),o.glRenderer=new ZM(o.engine),o.extension=new nw(o),o.renderingData={currentFrame:{}},o.frameBuffer=new cw({storeAction:{},viewport:[0,0,o.width,o.height],attachments:[new jM(o.engine,{sourceType:e.TextureSourceType.framebuffer,data:{width:o.width,height:o.height}})],depthStencilAttachment:{storageType:e.RenderPassAttachmentStorageType.none}},o),o}return JA(r,t),Object.defineProperty(r.prototype,"isDestroyed",{get:function(){var e=this.glRenderer;return!e||e.isDestroyed},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){var e;return(null===(e=this.glRenderer)||void 0===e?void 0:e.height)||0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){var e;return(null===(e=this.glRenderer)||void 0===e?void 0:e.width)||0},enumerable:!1,configurable:!0}),r.prototype.renderRenderFrame=function(e){var t,r,i,n,o=e;o.resource&&o.resource.color_b.initialize(),o.emptyTexture.initialize(),o.transparentTexture.initialize();var a=o._renderPasses;if(this.isDestroyed)return console.error("renderer is destroyed",this);o.renderer.getShaderLibrary().compileAllShaders(),this.setFrameBuffer(null),this.clear(o.clearAction),this.renderingData.currentFrame=o,this.renderingData.currentCamera=o.camera,KS(a);try{for(var s=rS(a),u=s.next();!u.done;u=s.next()){var c=(h=u.value).delegate;c.willBeginRenderPass&&(null==c||c.willBeginRenderPass(h,this.renderingData)),this.renderRenderPass(h),c.didEndRenderPass&&(null==c||c.didEndRenderPass(h,this.renderingData))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}try{for(var l=rS(a),f=l.next();!f.done;f=l.next()){var h;(h=f.value).frameCleanup(this)}}catch(e){i={error:e}}finally{try{f&&!f.done&&(n=l.return)&&n.call(l)}finally{if(i)throw i.error}}},r.prototype.renderRenderPass=function(e){this.renderingData.currentPass=e,e.initialize(this),e.configure(this),e.execute(this)},r.prototype.renderMeshes=function(e){var t,r,i=this.renderingData.currentPass.delegate;try{for(var n=rS(e),o=n.next();!o.done;o=n.next()){var a=o.value;a.isDestroyed||(a.getVisible()||(a.material?(a.material.initialize(),a.geometry.initialize(),i.willRenderMesh&&i.willRenderMesh(a,this.renderingData),a.render(this),i.didiRenderMesh&&i.didiRenderMesh(a,this.renderingData)):console.warn("Mesh "+a.name+" 没有绑定材质。")))}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},r.prototype.setGlobalFloat=function(e,t){this.checkGlobalUniform(e),this.renderingData.currentFrame.globalUniforms.floats[e]=t},r.prototype.setGlobalInt=function(e,t){this.checkGlobalUniform(e),this.renderingData.currentFrame.globalUniforms.ints[e]=t},r.prototype.setGlobalMatrix=function(e,t){this.checkGlobalUniform(e),this.renderingData.currentFrame.globalUniforms.matrices[e]=t},r.prototype.drawGeometry=function(e,t){this.glRenderer.drawGeometry(e,t)},r.prototype.setFrameBuffer=function(e){e?(this.frameBuffer=e,this.frameBuffer.bind(),this.setViewport(e.viewport[0],e.viewport[1],e.viewport[2],e.viewport[3])):(this.pipelineContext.bindSystemFramebuffer(),this.setViewport(0,0,this.getWidth(),this.getHeight()))},r.prototype.getFrameBuffer=function(){return this.frameBuffer},r.prototype.getTemporaryRT=function(t,r,i,n,o,a){if(this.temporaryRTs[t])return this.temporaryRTs[t];var s,u,c=e.RenderPassAttachmentStorageType.none;o===e.FilterMode.Linear?s=dS.LINEAR:o===e.FilterMode.Nearest&&(s=dS.NEAREST),a===e.RenderTextureFormat.RGBA32?u=dS.UNSIGNED_BYTE:a===e.RenderTextureFormat.RGBAHalf&&(u=dS.HALF_FLOAT),0===n?c=e.RenderPassAttachmentStorageType.none:16===n?c=e.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(c=e.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var l=new jM(this.engine,{sourceType:e.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:dS.RGBA,format:dS.RGBA,type:u}),f=new cw({name:t,storeAction:{},viewport:[0,0,r,i],viewportScale:1,isCustomViewport:!0,attachments:[l],depthStencilAttachment:{storageType:c}},this);return this.temporaryRTs[t]=f,f},r.prototype.setViewport=function(e,t,r,i){this.pipelineContext.viewport(e,t,r,i)},r.prototype.clear=function(t){var r=this.pipelineContext,i=0;if(t.colorAction===e.TextureLoadAction.clear){var n=t.clearColor;n&&r.clearColor(n[0],n[1],n[2],n[3]),r.colorMask(!0,!0,!0,!0),i=dS.COLOR_BUFFER_BIT}if(t.stencilAction===e.TextureLoadAction.clear&&(r.stencilMask(255),r.clearStencil(t.clearStencil||0),i|=dS.STENCIL_BUFFER_BIT),t.depthAction===e.TextureLoadAction.clear){var o=t.clearDepth;r.depthMask(!0),r.clearDepth(Number.isFinite(o)?o:1),i|=dS.DEPTH_BUFFER_BIT}i&&r.clear(i)},r.prototype.addLostHandler=function(e){this.context.addLostHandler(e)},r.prototype.addRestoreHandler=function(e){this.context.addRestoreHandler(e)},r.prototype.getShaderLibrary=function(){return this.pipelineContext.shaderLibrary},r.prototype.getWidth=function(){return this.width},r.prototype.getHeight=function(){return this.height},r.prototype.dispose=function(e){var t;this.context.dispose(),this.extension.dispose(),this.pipelineContext.dispose(),null===(t=this.glRenderer)||void 0===t||t.dispose(e),this.canvas=null,this.engine.dispose()},r.prototype.lost=function(e){e.preventDefault(),this.pipelineContext.dispose(),this.extension.dispose(),this.glRenderer.lost(e)},r.prototype.restore=function(){var e=this.context.gl;if(!e)throw new Error("Can not restore automatically because losing gl context");this.engine=new Rw(e),this.engine.renderer=this,this.pipelineContext=new _w(this.engine,e),this.glRenderer=new ZM(this.engine),this.extension=new nw(this)},r.prototype.resize=function(e,t){var r=this.glRenderer;r&&(this.width===e&&this.height===t||r.resize(e,t))},r.prototype.checkGlobalUniform=function(e){var t=this.renderingData.currentFrame.globalUniforms;t.uniforms.includes(e)||t.uniforms.push(e)},r}(wO),Ow="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Lw="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Iw="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Pw="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",Mw="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg",ww="https://galacean.antgroup.com/effects/#/user/gasrv4ka5sacrwpg";var Fw=new Map,Nw=!1,Dw=1,Vw=function(){function t(e){var t,r,i=this;this.compositions=[],this.displayScale=1,this.resumePending=!1,this.disposed=!1,this.speed=1,this.baseCompositionIndex=0,this.lost=function(e){var t,r;null===(t=i.ticker)||void 0===t||t.pause(),i.compositions.forEach((function(t){return t.lost(e)})),i.renderer.lost(e),null===(r=i.handleWebGLContextLost)||void 0===r||r.call(i,e),Bw(i,!1)},this.restore=function(){return eS(i,void 0,void 0,(function(){var e,t,r,i=this;return tS(this,(function(n){switch(n.label){case 0:return this.renderer.restore(),e=this,[4,Promise.all(this.compositions.map((function(e){return eS(i,void 0,void 0,(function(){var t,r,i,n,o,a,s,u,c,l,f,h;return tS(this,(function(p){switch(p.label){case 0:return t=e.time,r=e.url,i=e.speed,n=e.keepResource,o=e.reusable,a=e.renderOrder,s=e.transform,u=e.videoState,[4,this.loadScene(r)];case 1:(c=p.sent()).speed=i,c.reusable=o,c.keepResource=n,c.renderOrder=a,c.transform=s,l=0,p.label=2;case 2:return l<u.length?u[l]?((f=c.textures[l].source.video).currentTime=null!==(h=u[l])&&void 0!==h?h:0,[4,f.play()]):[3,4]:[3,5];case 3:p.sent(),p.label=4;case 4:return l++,[3,2];case 5:return c.content.start(),c.gotoAndPlay(t),[2,c]}}))}))})))];case 1:return e.compositions=n.sent(),null===(t=this.handleWebGLContextRestored)||void 0===t||t.call(this),null===(r=this.ticker)||void 0===r||r.resume(),[2]}}))}))},this.handleResume=function(){var e;null===(e=i.handlePlayableUpdate)||void 0===e||e.call(i,{player:i,playing:!0})},this.handleClick=function(e){var t=e.x,r=e.y;i.compositions.forEach((function(e){var n,o=e.hitTest(t,r);if(o.length)for(var a=0;a<o.length;a++){var s=o[a].behavior||RS.NOTIFY;if(s===RS.NOTIFY){var u=o[a],c=u.name,l=u.id,f=u.hitPositions;null===(n=i.handleItemClicked)||void 0===n||n.call(i,{name:c,player:i,composition:e.name,id:l,compositionId:e.id,hitPositions:f})}else s===RS.RESUME_PLAYER&&i.resume()}}))};var n=e.container,o=e.canvas,a=e.gl,s=e.fps,u=e.name,c=e.pixelRatio,l=e.manualRender,f=e.interactive,h=e.reportGPUTime,p=e.onMessageItem,d=e.onPausedByItem,m=e.onItemClicked,v=e.onPlayableUpdate,y=e.onRenderError,g=e.onWebGLContextLost,T=e.onWebGLContextRestored,x=e.renderFramework,E=e.env,A=void 0===E?"":E,S=e.notifyTouch;if(pS.length)throw new Error("Errors before player create: ".concat(pS.map((function(e,t){return"\n ".concat(t+1,": ").concat(e)}))));var b=null!==(r=null!==(t=e.renderOptions)&&void 0!==t?t:e)&&void 0!==r?r:{},_=b.willCaptureImage,R=b.premultiplyAlpha;if(!Nw&&"debug-disable"!==x){var C=YS()||function(){var e=/iPhone OS (\d+)_(\d+)/.exec(navigator.userAgent);return!!e&&("13"===e[1]||"16"===e[1]&&"5"===e[2])}()?"webgl":"webgl2";if(x&&(C="webgl"===x?"webgl":"webgl2"),this.handleWebGLContextLost=g,this.handleWebGLContextRestored=T,this.reportGPUTime=h,this.handleItemClicked=m,this.handleMessageItem=p,this.handlePlayableUpdate=v,this.handleRenderError=y,this.handlePlayerPause=function(e){i.pause(),null==d||d({name:e.name,player:i})},this.pixelRatio=Number.isFinite(c)?c:HS(),this.offscreenMode=!0,this.env=A,o)this.canvas=o;else if(a){this.canvas=a.canvas;var O=a instanceof WebGLRenderingContext?"webgl":"webgl2";C!==O&&(console.error({content:"The gl context(".concat(O,") is inconsistent with renderFramework or default version(").concat(C,")"),type:aC}),C=O)}else kw(n),this.canvas=document.createElement("canvas"),n.appendChild(this.canvas);Fw.forEach((function(e){if(e.gpuCapability.type!==C)throw new Error("Initialize player with different webgl version: old=".concat(e.gpuCapability.type,", new=").concat(C))})),this.renderer=wO.create(this.canvas,C,{preserveDrawingBuffer:_,premultipliedAlpha:R}),this.renderer.env=A,this.renderer.addLostHandler({lost:this.lost}),this.renderer.addRestoreHandler({restore:this.restore}),this.gpuCapability=this.renderer.engine.gpuCapability,Fw.forEach((function(e){e.gpuCapability.type!==i.gpuCapability.type&&console.warn({content:"Create player with different webgl version: old=".concat(e.gpuCapability.type,", new=").concat(i.gpuCapability.type),type:aC})})),l||(this.ticker=new kM(s),this.ticker.add(this.tick.bind(this))),this.event=new BR(this.canvas,!!S),this.event.bindListeners(),this.event.addEventListener(FR,this.handleClick),this.interactive=null!=f&&f,this.name=u||"".concat(Dw++),a||this.resize(),GO(this.gpuCapability.detail),this.container=this.canvas.parentElement,Fw.set(this.canvas,this),function(){var e,t,r=[];try{for(var i=rS(Fw.values()),n=i.next();!n.done;n=i.next()){var o=n.value;o.paused||r.push(o)}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}r.length>1&&console.error({content:"Current running player count: ".concat(r.length,", see ").concat(ww),type:aC},r)}(),Bw(this,!0)}}return t.prototype.setSpeed=function(e){isNaN(e)||(this.speed=e)},t.prototype.getSpeed=function(){return this.speed},t.prototype.getCompositionByName=function(e){return this.compositions.find((function(t){return t.name===e}))},t.prototype.getCompositions=function(){return this.compositions},Object.defineProperty(t.prototype,"hasPlayable",{get:function(){return this.compositions.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"paused",{get:function(){var e;return null===(e=this.ticker)||void 0===e?void 0:e.getPaused()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"interactive",{get:function(){return this.event.enabled},set:function(e){this.event.enabled=e},enumerable:!1,configurable:!0}),t.prototype.loadScene=function(e,t){var r;return eS(this,void 0,void 0,(function(){var i,n,o=this;return tS(this,(function(a){switch(a.label){case 0:return n=this.baseCompositionIndex,cR(e)?(this.baseCompositionIndex+=e.length,[4,Promise.all(e.map((function(e,r){return eS(o,void 0,void 0,(function(){var i;return tS(this,(function(o){switch(o.label){case 0:return[4,this.createComposition(e,t)];case 1:return(i=o.sent()).setIndex(n+r),[2,i]}}))}))})))]):[3,2];case 1:return i=a.sent(),[3,4];case 2:return this.baseCompositionIndex+=1,[4,this.createComposition(e,t)];case 3:(i=a.sent()).setIndex(n),a.label=4;case 4:return null===(r=this.ticker)||void 0===r||r.start(),[2,i]}}))}))},t.prototype.createComposition=function(e,t){return void 0===t&&(t={}),eS(this,void 0,void 0,(function(){var r,i,n,o,a,s,u,c=this;return tS(this,(function(l){switch(l.label){case 0:return r=this.renderer,i=performance.now(),n=$A({autoplay:!0},t),Uw(e)?(a=e.scene,n=$A($A({},n),e.options||{})):a=e,this.assetManager?this.assetManager.updateOptions(n):this.assetManager=new wM(n),PM(a)?(o=a,[3,3]):[3,1];case 1:return[4,this.assetManager.loadScene(a,this.renderer,{env:this.env})];case 2:o=l.sent(),l.label=3;case 3:return s=new UM($A($A({},n),{renderer:r,width:r.getWidth(),height:r.getHeight(),event:this.event,handlePlayerPause:this.handlePlayerPause,handleMessageItem:this.handleMessageItem}),o),this.ticker&&s.renderLevel===TS.B&&this.ticker.setFPS(Math.min(this.ticker.getFPS(),30)),[4,new Promise((function(e){c.renderer.getShaderLibrary().compileAllShaders((function(){e(null)}))}))];case 4:return l.sent(),n.autoplay?(this.autoPlaying=!0,s.play()):s.pause(),u=performance.now()-i+s.statistic.loadTime,s.statistic.firstFrameTime=u,console.info({content:"first frame: [".concat(s.name,"]").concat(u.toFixed(4),"ms"),type:aC}),this.compositions.push(s),[2,s]}}))}))},t.prototype.play=function(){var e;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(e){e.play()})),null===(e=this.ticker)||void 0===e||e.start()},t.prototype.gotoAndPlay=function(e){this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!0,this.compositions.map((function(t){t.gotoAndPlay(e)})),this.ticker?this.ticker.start():this.doTick(0,!0)},t.prototype.gotoAndStop=function(e){var t,r;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.autoPlaying=!1,this.compositions.map((function(t){t.gotoAndStop(e)})),this.ticker&&!(null===(t=this.ticker)||void 0===t?void 0:t.getPaused())||this.doTick(0,!0),null===(r=this.handlePlayableUpdate)||void 0===r||r.call(this,{player:this,playing:!1})},t.prototype.playSequence=function(e){for(var t,r=function(t){var r=e[t],i=r.handleEnd;r.handleEnd=function(){null==i||i.call(r,r),e[t+1].play()}},i=0;i<e.length-1;i++)r(i);e[0].play(),null===(t=this.ticker)||void 0===t||t.start()},t.prototype.pause=function(e){var t,r;this.paused||(null===(t=this.ticker)||void 0===t||t.pause(),null===(r=this.handlePlayableUpdate)||void 0===r||r.call(this,{player:this,playing:!1}),e&&e.offloadTexture&&this.offloadTexture())},t.prototype.resume=function(){var e;return eS(this,void 0,void 0,(function(){return tS(this,(function(t){switch(t.label){case 0:return this.resumePending?[2]:this.paused?(this.resumePending=!0,[4,Promise.all(this.compositions.map((function(e){return e.reloadTexture()})))]):[3,2];case 1:t.sent(),this.resumePending=!1,this.handleResume(),t.label=2;case 2:return null===(e=this.ticker)||void 0===e||e.resume(),[2]}}))}))},t.prototype.tick=function(e){this.doTick(e,this.forceRenderNextFrame),this.forceRenderNextFrame=!1},t.prototype.doTick=function(t,r){var i,n,o,a=this;t=Math.min(t,33)*this.speed;var s=!1,u=this.compositions,c=!1;if(u.sort((function(e,t){return e.getIndex()-t.getIndex()})),u.forEach((function(e,r){return e.textureOffloaded&&(c=!0,console.error({content:"Composition ".concat(e.name," texture offloaded, skip render."),type:aC})),e.isDestroyed?(delete u[r],void(s=!0)):(e.renderer&&e.update(t),e.isDestroyed?(delete u[r],void(s=!0)):void 0)})),s&&((u=u.filter((function(e){return e}))).map((function(e,t){return e.setIndex(t)})),this.compositions=u),this.baseCompositionIndex=u.length,c)return null===(i=this.handleRenderError)||void 0===i||i.call(this,new Error("play when texture offloaded")),null===(n=this.ticker)||void 0===n?void 0:n.pause();if(!this.paused||r){var l=this.gpuCapability.level,f=this.renderer.context.gl,h=2===l&&this.reportGPUTime?hS(f):void 0;if(null==h||h.begin(),this.compositions.length||r){this.renderer.setFrameBuffer(null),this.renderer.clear({stencilAction:e.TextureLoadAction.clear,clearStencil:0,depthAction:e.TextureLoadAction.clear,clearDepth:1,colorAction:e.TextureLoadAction.clear,clearColor:[0,0,0,0]});for(var p=0;p<u.length;p++)!u[p].renderFrame.isDestroyed&&this.renderer.renderRenderFrame(u[p].renderFrame)}null==h||h.end(),null==h||h.getTime().then((function(e){var t;return null===(t=a.reportGPUTime)||void 0===t?void 0:t.call(a,null!=e?e:0)})).catch,this.autoPlaying&&(null===(o=this.handlePlayableUpdate)||void 0===o||o.call(this,{player:this,playing:!0}))}},t.prototype.resizeToAspect=function(e,t){void 0===t&&(t=1),e!==this.displayAspect&&(this.displayAspect=e),t!==this.displayScale&&(this.displayScale=t),this.resize()},t.prototype.resize=function(){var e,t,r,i,n,o=this.canvas.parentElement;if(o){var a=this.getTargetSize(o);t=a[0],r=a[1],i=a[2],n=a[3]}else t=i=this.canvas.width,r=n=this.canvas.height;var s=t/r;if(t&&r){var u=document.documentElement.clientWidth;i>2*u&&console.error({content:"DPI overflowed, width ".concat(i," is more than 2x document width ").concat(u,", see ").concat(Lw),type:aC});var c=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>c||n>c)&&(console.error({content:"Container size overflowed ".concat(i,"x").concat(n,", see ").concat(Ow),type:aC}),s>1?(i=Math.round(c),n=Math.round(c/s)):(n=Math.round(c),i=Math.round(c*s))),this.renderer.resize(i,n),this.canvas.style.width=t+"px",this.canvas.style.height=r+"px",console.debug("Resize player ".concat(this.name," [").concat(i,",").concat(n,",").concat(t,",").concat(r,"].")),null===(e=this.compositions)||void 0===e||e.forEach((function(e){e.camera.aspect=s}))}},t.prototype.clearCanvas=function(t){t?this.renderer.clear({stencilAction:e.TextureLoadAction.clear,clearStencil:0,depthAction:e.TextureLoadAction.clear,clearDepth:1,colorAction:e.TextureLoadAction.clear,clearColor:[0,0,0,0]}):this.forceRenderNextFrame=!0},t.prototype.destroyItem=function(e,t){},t.prototype.destroyCurrentCompositions=function(){this.compositions.forEach((function(e){return e.dispose()})),this.compositions.length=0,this.baseCompositionIndex=0},t.prototype.dispose=function(e){var t,r;if(console.debug("call player destroy: ".concat(this.name)),!this.disposed){Fw.delete(this.canvas),this.pause(),null===(t=this.ticker)||void 0===t||t.stop(),null===(r=this.assetManager)||void 0===r||r.dispose(),this.compositions.forEach((function(e){return e.dispose()})),this.compositions.length=0,this.renderer.context.removeLostHandler({lost:this.lost}),this.renderer.context.removeRestoreHandler({restore:this.restore}),this.event.dispose(),this.renderer.dispose(!e),Bw(this,!1),this.canvas instanceof HTMLCanvasElement&&!e&&this.renderer.context&&(YI.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove());var i,n=(i=this.name,"Never use destroyed player: ".concat(i," again, see ").concat(Mw)),o=function(){return function(e){throw new Error(e)}(n)},a=function(){return e=n,Promise.reject(e);var e};this.tick=o,this.resize=o,this.loadScene=a,this.play=a,this.resume=a,this.disposed=!0}},t.prototype.offloadTexture=function(){this.compositions.forEach((function(e){return e.offloadTexture()}))},t.prototype.getTargetSize=function(e){kw(e);var t,r,i=this.displayAspect;i?e.clientWidth/e.clientHeight>i?t=(r=e.clientHeight*this.displayScale)*i:r=(t=e.clientWidth*this.displayScale)/i:(t=e.clientWidth,r=e.clientHeight);var n=this.pixelRatio,o=t,a=r;if(t=Math.round(t*n),(r=Math.round(r*n))<1||r<1){if(!this.offscreenMode)throw Error("Invalid container size ".concat(t,"x").concat(r,", see ").concat(Iw));t=r=o=a=1}return[o,a,t,r]},t}();function Uw(e){return fR(e)&&"scene"in e}function Bw(e,t){Object.values(ER).forEach((function(r){var i=t?r.onPlayerCreated:r.onPlayerDestroy;null==i||i(e)}))}function kw(e){if(null==e)throw new Error("Container is not an HTMLElement, see ".concat(Pw))}nC.create=function(e,t){return new jM(e,t)},nC.createWithData=function(t,r,i){void 0===r&&(r=ZS("#fff")),void 0===i&&(i={});var n=i,o=n.type,a=void 0===o?dS.UNSIGNED_BYTE:o,s=n.format,u=void 0===s?dS.RGBA:s,c=n.internalFormat,l=n.wrapS,f=void 0===l?dS.MIRRORED_REPEAT:l,h=n.wrapT,p=void 0===h?dS.MIRRORED_REPEAT:h,d=n.minFilter,m=void 0===d?dS.NEAREST:d,v=n.magFilter,y=void 0===v?dS.NEAREST:v,g=n.flipY,T=void 0!==g&&g;return new jM(t,{data:r,type:a,sourceType:e.TextureSourceType.data,format:u,internalFormat:c||u,wrapS:f,wrapT:p,minFilter:m,magFilter:y,flipY:T})},AC.create=function(e,t){return new iw(e,t)},DC.create=function(e,t){return new tw(e,t)},zC.create=function(e,t){return new zC(e,t)},bO.create=function(e){return new sw(e)},MO.create=function(e,t){return new cw(e,t)},wO.create=function(e,t,r){return new Cw(e,t,r)},BM.create=function(e){return new Rw(e)};console.info({content:"[Galacean Effects Player] version: 1.0.1",type:aC}),e.AbstractPlugin=OR,e.AssetManager=wM,e.BYTES_TYPE_MAP=NC,e.BezierSegments=Y_,e.COMPRESSED_TEXTURE=IO,e.COPY_FRAGMENT_SHADER=OC,e.COPY_MESH_SHADER_ID=RC,e.COPY_VERTEX_SHADER=CC,e.CalculateItem=tL,e.CalculateLoader=II,e.CalculateVFXItem=PI,e.Camera=pP,e.CameraController=LR,e.CameraVFXItem=PR,e.CameraVFXItemLoader=IR,e.Composition=UM,e.CompositionSourceManager=IM,e.CurveValue=j_,e.DEFAULT_FONTS=GI,e.DEG2RAD=cS,e.Downloader=qR,e.EFFECTS_COPY_MESH_NAME=_C,e.EVENT_TYPE_CLICK=FR,e.EVENT_TYPE_TOUCH_END=VR,e.EVENT_TYPE_TOUCH_MOVE=DR,e.EVENT_TYPE_TOUCH_START=NR,e.Engine=BM,e.EventSystem=BR,e.FILTER_NAME_NONE=uS,e.FilterSpriteVFXItem=sL,e.Float16ArrayWrapper=Cb,e.FrameBuffer=MO,e.GLEngine=Rw,e.GLGeometry=tw,e.GLRenderer=Cw,e.GPUCapability=RO,e.Geometry=DC,e.GlobalUniforms=SO,e.GradientValue=G_,e.HELP_LINK=lS,e.InteractBehavior=UR,e.InteractItem=BO,e.InteractLoader=UO,e.InteractMesh=NO,e.InteractVFXItem=DO,e.KTXTexture=fC,e.LOG_TYPE=aC,e.LineSegments=X_,e.LinearValue=z_,e.Material=AC,e.MaterialDataBlock=yC,e.Mesh=zC,e.NumberEpsilon=qb,e.PLAYER_OPTIONS_ENV_EDITOR=sS,e.POST_PROCESS_SETTINGS="post_process_settings",e.ParticleLoader=OI,e.ParticleMesh=uL,e.ParticleSystem=vI,e.ParticleVFXItem=CI,e.PassTextureCache=wC,e.PathSegments=H_,e.Player=Vw,e.PluginSystem=_R,e.QCanvasViewer=VI,e.QText=DI,e.RENDER_PASS_NAME_PREFIX=gO,e.RENDER_PREFER_LOOKUP_TEXTURE=sC,e.RUNTIME_ENV="runtime_env",e.RandomSetValue=U_,e.RandomValue=B_,e.RandomVectorValue=k_,e.RenderBuffer=bO,e.RenderFrame=xO,e.RenderPass=YC,e.RenderPassPriorityNormal=GC,e.RenderPassPriorityPostprocess=3e3,e.RenderPassPriorityPrepare=0,e.RenderTargetHandle=XC,e.Renderer=wO,e.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_0="PRE_MAIN_COLOR_0",e.SEMANTIC_MAIN_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_MAIN_COLOR_SIZE_0",e.SEMANTIC_PRE_COLOR_ATTACHMENT_0="PRE_COLOR_0",e.SEMANTIC_PRE_COLOR_ATTACHMENT_SIZE_0="PRE_COLOR_SIZE_0",e.SPRITE_VERTEX_STRIDE=oS,e.SemanticMap=FC,e.Shader=bC,e.SpriteItem=nL,e.SpriteLoader=QO,e.SpriteMesh=zO,e.SpriteVFXItem=oL,e.StaticValue=V_,e.TEMPLATE_USE_OFFSCREEN_CANVAS=uC,e.TextItem=$I,e.TextLoader=tP,e.TextMesh=MI,e.TextVFXItem=eP,e.Texture=nC,e.TextureFactory=dC,e.Ticker=kM,e.TimelineComponent=aR,e.Transform=gR,e.VFXItem=TR,e.VFX_ITEM_TYPE_TREE=aS,e.ValueGetter=D_,e.addByOrder=QS,e.addItem=DS,e.addItemWithOrder=US,e.alphaFrameFrag=$C,e.alphaMaskFrag=eO,e.assertExist=eb,e.asserts=function(e,t){if(void 0===t&&(t="asserts failed"),!e)throw new Error(t)}
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=nO,e.bloomThresholdVert=oO,e.calculateTranslation=F_,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=eO,e.canvasPool=HI,e.clamp=Eb,e.colorGradingFrag=sO,e.colorStopsFromGradient=GS,e.colorToArr=kS,e.combineImageTemplate=KI,e.combineImageTemplate1=UI,e.combineImageTemplate1Async=function(e,t,r,i,n){return eS(this,void 0,void 0,(function(){return tS(this,(function(o){return console.warn("The combineImageTemplate1Async function is deprecated. Use combineImageTemplate1 instead."),[2,UI(e,t,r,i,n)]}))}))},e.combineImageTemplate2=qI,e.combineImageTemplate2Async=function(e,t,r,i,n){return eS(this,void 0,void 0,(function(){return tS(this,(function(o){return console.warn("The combineImageTemplate2Async function is deprecated. Use combineImageTemplate2 instead."),[2,qI(e,t,r,i,n)]}))}))},e.combineImageTemplateAsync=function(e,t,r,i,n){return eS(this,void 0,void 0,(function(){return tS(this,(function(o){return console.warn("The combineImageTemplateAsync function is deprecated. Use combineImageTemplate instead."),[2,KI(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=Sb,e.copyFrag=AC,e.createCopyShader=OC,e.createFilter=NS,e.createFilterShaders=FS,e.createGLContext=fS,e.createKeyFrameMeta=tR,e.createShaderWithMarcos=XR,e.createShape=LL,e.createVFXItem=xR,e.createValueGetter=Z_,e.deepClone=hR,e.defaultGlobalVolume=vO,e.defaultPlugins=AR,e.delayFrag=tO,e.deserializeMipmapTexture=eC,e.disableAllPlayer=function(e){Fw=!!e},e.distortionFrag=rO,e.distortionVert=iO,e.dotInTriangle=function(e,t,r){var i=iS(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]];i_(L_,c,s),i_(I_,u,s),i_(P_,t,s);var l=o_(L_,L_),f=o_(L_,I_),h=o_(L_,P_),p=o_(I_,I_),d=o_(I_,P_),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=JL,e.enlargeBuffer=BS,e.ensureVec3=Qb,e.filters=bP,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=uO,e.gaussianDownVFrag=cO,e.gaussianUpFrag=lO,e.generateEmptyTypedArray=DC,e.generateHalfFloatTexture=nC,e.getActivePlayers=function(){return Array.from(ww.values())},e.getBackgroundImage=YI,e.getColorFromGradientStops=zS,e.getConfig=cC,e.getDefaultTemplateCanvasPool=function(){return HI},e.getDefaultTextureFactory=dC,e.getGeometryByShape=nI,e.getGeometryTriangles=iI,e.getImageItemRenderInfo=GO,e.getKTXTextureOptions=fC,e.getKeyFrameMetaByRawValue=eR,e.getMat4TR=kb,e.getMat4TRS=zb,e.getParticleMeshShader=lL,e.getPixelRatio=HS,e.getPlayerByCanvas=function(e){return ww.get(e)},e.getPreMultiAlpha=kR,e.getStandardComposition=EM,e.getStandardImage=xM,e.getStandardItem=_M,e.getStandardJSON=gM,e.getTextureSize=xO,e.glContext=dS,e.gpuTimer=hS,e.imageDataFromColor=ZS,e.imageDataFromGradient=qS,e.initErrors=pS,e.initGLContext=mS,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=jS,e.intersectRayBox=A_,e.intersectRaySphere=E_,e.intersectRayTriangle=O_,e.isAndroid=YS,e.isArray=cR,e.isCanvasUsedByPlayer=function(e){return ww.has(e)},e.isFunction=lR,e.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},e.isIdentityMatrix=Mb,e.isObject=fR,e.isScene=IM,e.isSceneWithOptions=Vw,e.isSimulatorCellPhone=WS,e.isString=uR,e.isUniformStruct=yC,e.isUniformStructArray=function(e){return e&&void 0!==e.length&&yC(e[0])},e.isWebGL2=vS,e.isZeroVec=Kb,e.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",e.itemFrag=ZC,e.itemFrameFrag=YC,e.itemVert=WC,e.loadBinary=JR,e.loadBlob=function(e){return eS(this,void 0,void 0,(function(){return tS(this,(function(t){return[2,new Promise((function(t,r){(new ZR).downloadBlob(e,t,(function(t,i){r("Couldn't load blob ".concat(e,": status ").concat(t,", ").concat(i))}))}))]}))}))},e.loadImage=QR,e.loadVideo=$R,e.loadWebPOptional=KR,e.mat3FromQuat=Lb,e.mat3FromRotation=f_,e.mat3FromRotationZ=l_,e.mat4Clone=Gb,e.mat4Determinate=Bb,e.mat4ToIdentityMatrix=Pb,e.mat4create=Ib,e.mat4fromRotationTranslationScale=wb,e.mat4invert=Fb,e.mat4multiply=Nb,e.mat4perspective=Db,e.modifyMaxKeyframeShader=fL,e.nearestPowerOfTwo=Ab,e.noop=sR,e.parsePercent=XS,e.particleFrag=qC,e.particleOriginTranslateMap=xb,e.particleVert=KC,e.pluginLoaderMap=ER,e.quatFromRotation=y_,e.quatMultiply=v_,e.quatStar=g_,e.random=pR,e.registerFilter=MS,e.registerFilters=wS,e.registerPlugin=bR,e.removeItem=VS,e.requestAsync=VI,e.rotateByQuat=function(e,t,r){var i=r[0],n=r[1],o=r[2],a=r[3],s=[i,n,o],u=a_([],s,t),c=a_([],s,u);o_(c,c,2),o_(u,u,2*a),Wb(c,c,u),Wb(e,t,c)},e.rotateVec2=oI,e.rotationFromMat3=h_,e.screenMeshVert=aO,e.setBlendMode=HR,e.setConfig=function(e,t){return uC[e]=t},e.setDefaultTextureFactory=function(e){hC=e},e.setMaskMode=WR,e.setMaxSpriteMeshItemCount=function(t){e.maxSpriteMeshItemCount=t},e.setRayFromCamera=x_,e.setSideMode=YR,e.setSpriteMeshMaxFragmentTextures=function(t){e.maxSpriteTextureCount=t},e.setSpriteMeshMaxItemCountByGPU=zO,e.sortByOrder=KS,e.spec=Tb,e.spriteMeshShaderFromFilter=jO,e.spriteMeshShaderFromRenderInfo=HO,e.spriteMeshShaderIdFromRenderInfo=XO,e.thresholdFrag=fO,e.throwDestroyedError=dR,e.trailVert=QC,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=C_,e.unregisterPlugin=function(e){delete SR[e],delete ER[e],VS(AR,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=a_,e.vec3MulMat3=Jb,e.vec3MulMat4=s_,e.vec3RotateByMat4=u_,e.vecAdd=Wb,e.vecAssign=$b,e.vecDot=o_,e.vecFill=Zb,e.vecMinus=i_,e.vecMulCombine=e_,e.vecMulScalar=r_,e.vecNormalize=t_,e.vecSquareDistance=n_,e.version="1.0.0",Object.defineProperty(e,"__esModule",{value:!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=oO,e.bloomThresholdVert=aO,e.calculateTranslation=F_,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=tO,e.canvasPool=YI,e.clamp=Eb,e.colorGradingFrag=uO,e.colorStopsFromGradient=GS,e.colorToArr=kS,e.combineImageTemplate=QI,e.combineImageTemplate1=BI,e.combineImageTemplate1Async=function(e,t,r,i,n){return eS(this,void 0,void 0,(function(){return tS(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 eS(this,void 0,void 0,(function(){return tS(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 eS(this,void 0,void 0,(function(){return tS(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=Sb,e.copyFrag=SC,e.createCopyShader=LC,e.createFilter=NS,e.createFilterShaders=FS,e.createGLContext=fS,e.createKeyFrameMeta=tR,e.createShaderWithMarcos=HR,e.createShape=IL,e.createVFXItem=xR,e.createValueGetter=Z_,e.deepClone=hR,e.defaultGlobalVolume=yO,e.defaultPlugins=AR,e.delayFrag=rO,e.deserializeMipmapTexture=tC,e.disableAllPlayer=function(e){Nw=!!e},e.distortionFrag=iO,e.distortionVert=nO,e.dotInTriangle=function(e,t,r){var i=iS(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]];i_(L_,c,s),i_(I_,u,s),i_(P_,t,s);var l=o_(L_,L_),f=o_(L_,I_),h=o_(L_,P_),p=o_(I_,I_),d=o_(I_,P_),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=BS,e.ensureVec3=Qb,e.filters=_P,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=cO,e.gaussianDownVFrag=lO,e.gaussianUpFrag=fO,e.generateEmptyTypedArray=VC,e.generateHalfFloatTexture=oC,e.getActivePlayers=function(){return Array.from(Fw.values())},e.getBackgroundImage=WI,e.getColorFromGradientStops=zS,e.getConfig=lC,e.getDefaultTemplateCanvasPool=function(){return YI},e.getDefaultTextureFactory=mC,e.getGeometryByShape=oI,e.getGeometryTriangles=nI,e.getImageItemRenderInfo=jO,e.getKTXTextureOptions=hC,e.getKeyFrameMetaByRawValue=eR,e.getMat4TR=kb,e.getMat4TRS=zb,e.getParticleMeshShader=fL,e.getPixelRatio=HS,e.getPlayerByCanvas=function(e){return Fw.get(e)},e.getPreMultiAlpha=zR,e.getStandardComposition=AM,e.getStandardImage=EM,e.getStandardItem=RM,e.getStandardJSON=TM,e.getTextureSize=EO,e.glContext=dS,e.gpuTimer=hS,e.imageDataFromColor=ZS,e.imageDataFromGradient=qS,e.initErrors=pS,e.initGLContext=mS,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=jS,e.intersectRayBox=A_,e.intersectRaySphere=E_,e.intersectRayTriangle=O_,e.isAndroid=YS,e.isArray=cR,e.isCanvasUsedByPlayer=function(e){return Fw.has(e)},e.isFunction=lR,e.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},e.isIdentityMatrix=Mb,e.isObject=fR,e.isScene=PM,e.isSceneWithOptions=Uw,e.isSimulatorCellPhone=WS,e.isString=uR,e.isUniformStruct=gC,e.isUniformStructArray=function(e){return e&&void 0!==e.length&&gC(e[0])},e.isWebGL2=vS,e.isZeroVec=Kb,e.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",e.itemFrag=qC,e.itemFrameFrag=WC,e.itemVert=ZC,e.loadBinary=$R,e.loadBlob=function(e){return eS(this,void 0,void 0,(function(){return tS(this,(function(t){return[2,new Promise((function(t,r){(new qR).downloadBlob(e,t,(function(t,i){r("Couldn't load blob ".concat(e,": status ").concat(t,", ").concat(i))}))}))]}))}))},e.loadImage=JR,e.loadVideo=eC,e.loadWebPOptional=QR,e.mat3FromQuat=Lb,e.mat3FromRotation=f_,e.mat3FromRotationZ=l_,e.mat4Clone=Gb,e.mat4Determinate=Bb,e.mat4ToIdentityMatrix=Pb,e.mat4create=Ib,e.mat4fromRotationTranslationScale=wb,e.mat4invert=Fb,e.mat4multiply=Nb,e.mat4perspective=Db,e.modifyMaxKeyframeShader=hL,e.nearestPowerOfTwo=Ab,e.noop=sR,e.parsePercent=XS,e.particleFrag=KC,e.particleOriginTranslateMap=xb,e.particleVert=QC,e.pluginLoaderMap=ER,e.quatFromRotation=y_,e.quatMultiply=v_,e.quatStar=g_,e.random=pR,e.registerFilter=MS,e.registerFilters=wS,e.registerPlugin=bR,e.removeItem=VS,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=a_([],s,t),c=a_([],s,u);o_(c,c,2),o_(u,u,2*a),Wb(c,c,u),Wb(e,t,c)},e.rotateVec2=aI,e.rotationFromMat3=h_,e.screenMeshVert=sO,e.setBlendMode=YR,e.setConfig=function(e,t){return cC[e]=t},e.setDefaultTextureFactory=function(e){pC=e},e.setMaskMode=ZR,e.setMaxSpriteMeshItemCount=function(t){e.maxSpriteMeshItemCount=t},e.setRayFromCamera=x_,e.setSideMode=WR,e.setSpriteMeshMaxFragmentTextures=function(t){e.maxSpriteTextureCount=t},e.setSpriteMeshMaxItemCountByGPU=GO,e.sortByOrder=KS,e.spec=Tb,e.spriteMeshShaderFromFilter=XO,e.spriteMeshShaderFromRenderInfo=YO,e.spriteMeshShaderIdFromRenderInfo=HO,e.thresholdFrag=hO,e.throwDestroyedError=dR,e.trailVert=JC,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=C_,e.unregisterPlugin=function(e){delete SR[e],delete ER[e],VS(AR,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=a_,e.vec3MulMat3=Jb,e.vec3MulMat4=s_,e.vec3RotateByMat4=u_,e.vecAdd=Wb,e.vecAssign=$b,e.vecDot=o_,e.vecFill=Zb,e.vecMinus=i_,e.vecMulCombine=e_,e.vecMulScalar=r_,e.vecNormalize=t_,e.vecSquareDistance=n_,e.version="1.0.1",Object.defineProperty(e,"__esModule",{value:!0})}));
21
21
  //# sourceMappingURL=index.min.js.map