@galacean/effects 0.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ /*!
2
+ * Name: @galacean/effects
3
+ * Description: Galacean Effects runtime player for the web
4
+ * Author: Ant Group CO., Ltd.
5
+ * Contributors: 燃然,飂兮,十弦,云垣,茂安,意绮
6
+ * Version: v0.0.1-alpha.0
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,l=Function.prototype.call,c=u?l.bind(l):function(){return l.apply(l,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,_=S({}.toString),b=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,le=Z,ce=G,fe=q,he=Object,pe=ue?function(e){return"symbol"==typeof e}:function(e){var t=le("Symbol");return ce(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=c,_e=G,be=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=c,it=H,nt=pe,ot=Ae,at=function(e,t){var r,i;if("string"===t&&_e(r=e.toString)&&!be(i=Se(r,e)))return i;if(_e(r=e.valueOf)&&!be(i=Se(r,e)))return i;if("string"!==t&&_e(r=e.toString)&&!be(i=Se(r,e)))return i;throw Re("Can't convert object to primitive value")},st=TypeError,ut=tt("toPrimitive"),lt=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)},ct=lt,ft=pe,ht=function(e){var t=ct(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=c,Et=f,At=y,St=U,_t=ht,bt=ke,Rt=gt,Ct=Object.getOwnPropertyDescriptor;n.f=Tt?Ct:function(e,t){if(e=St(e),t=_t(t),Rt)try{return Ct(e,t)}catch(e){}if(bt(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,lr=i.WeakMap,cr=ur(lr)&&/native code/.test(String(lr)),fr=Ce.exports,hr=He,pr=fr("keys"),dr=function(e){return pr[e]||(pr[e]=hr(e))},mr={},vr=cr,yr=i,gr=H,Tr=Wt,xr=ke,Er=we,Ar=dr,Sr=mr,_r="Object already initialized",br=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 br(_r);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 br(_r);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 br("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,li=Math.min,ci=function(e){return e>0?li(ui(e),9007199254740991):0},fi=ci,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},_i=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],bi=Si,Ri=_i.concat("length","prototype");Jr.f=Object.getOwnPropertyNames||function(e){return bi(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,l=e.stat;if(r=u?Wi:l?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+(l?".":"#")+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=_i,on=Object.keys||function(e){return rn(e,nn)},an=a,sn=Lt,un=Ot,ln=wt,cn=U,fn=on;tn.f=an&&!sn?Object.defineProperties:function(e,t){ln(e);for(var r,i=cn(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=_i,yn=mr,gn=pn,Tn=vt,xn="prototype",En="script",An=dr("IE_PROTO"),Sn=function(){},_n=function(e){return"<"+En+">"+e+"</"+En+">"},bn=function(e){e.write(_n("")),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?bn(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(_n("document.F=Object")),e.close(),e.F):bn(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"),lo=!1;try{var co=0,fo={next:function(){return{done:!!co++}},return:function(){lo=!0}};fo[uo]=function(){return this},Array.from(fo,(function(){throw 2}))}catch(e){}var ho=function(e,t){if(!t&&!lo)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"),_o=Object,bo="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=_o(e),So))?r:bo?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),la=Object.prototype,ca=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 ca("Incorrect invocation")},da))for(vo in va)zo[vo]&&Jo(zo[vo],sa);if((!da||!ua||ua===la)&&(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 ca("Target is not a typed array")},aTypedArrayConstructor:function(e){if(Go(e)&&(!Jo||Ko(sa,e)))return e;throw ca(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,_a=xa.NATIVE_ARRAY_BUFFER_VIEWS,ba=Ea.ArrayBuffer,Ra=Ea.Int8Array,Ca=!_a||!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 ba(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=ci,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,l=u>>1,c=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+l>=1?c/o:c*za(2,1-l))*o>=2&&(i++,o/=2),i+l>=u?(n=0,i=u):i+l>=1?(n=Ha((e*o-1)*za(2,t)),i+=l):(n=Ha(e*za(2,l-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,l=e[u--],c=127&l;for(l>>=7;s>0;)c=256*c+e[u--],s-=8;for(r=c&(1<<-s)-1,c>>=-s,s+=t;s>0;)r=256*r+e[u--],s-=8;if(0===c)c=1-a;else{if(c===o)return r?NaN:l?-1/0:1/0;r+=za(2,t),c-=a}return(l?-1:1)*r*za(2,c-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"),ls=function(e,t,r){e&&!r&&(e=e.prototype),e&&!ss(e,us)&&as(e,us,{configurable:!0,value:t})},cs=i,fs=A,hs=a,ps=po,ds=er,ms=Wt,vs=Lo,ys=La,gs=o,Ts=Ma,xs=ii,Es=ci,As=Da,Ss=Ya,_s=Yn,bs=Uo,Rs=Jr.f,Cs=Ka,Os=os,Ls=ls,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=cs[ws],zs=ks,Gs=zs&&zs[Ns],js=cs[Fs],Xs=js&&js[Ns],Hs=Object.prototype,Ys=cs.Array,Ws=cs.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,l=Os(s,u,u+t);return a?l:qs(l)},au=function(e,t,r,i,n,o){var a=Us(e),s=As(r),u=i(+n),l=!!o;if(s+t>a.byteLength)throw Ws(Ds);for(var c=a.bytes,f=s+a.byteOffset,h=0;h<t;h++)c[f+h]=u[l?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,lu=Rs(ks),cu=0;lu.length>cu;)(uu=lu[cu++])in zs||ms(zs,uu,ks[uu]);Gs.constructor=zs}bs&&_s(Xs)!==Hs&&bs(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,_u=A,bu=function(e){if("Function"===Su(e))return _u(e)},Ru=Te,Cu=s,Ou=bu(bu.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"),el=function(e){if(!Qu(e))return Ku(e,$u)||Ku(e,"@@iterator")||Ju[qu(e)]},tl=c,rl=Te,il=wt,nl=me,ol=el,al=TypeError,sl=function(e,t){var r=arguments.length<2?ol(e):t;if(rl(r))return il(tl(r,e));throw al(nl(e)+" is not iterable")},ul=Zu,ll=tt("iterator"),cl=Array.prototype,fl=function(e){return void 0!==e&&(ul.Array===e||cl[ll]===e)},hl=Ro,pl=function(e){var t=hl(e);return"BigInt64Array"===t||"BigUint64Array"===t},dl=lt,ml=TypeError,vl=function(e){var t=dl(e,"number");if("number"==typeof t)throw ml("Can't convert number to bigint");return BigInt(t)},yl=Lu,gl=c,Tl=Wu,xl=Ve,El=hi,Al=sl,Sl=el,_l=fl,bl=pl,Rl=xa.aTypedArrayConstructor,Cl=vl,Ol=function(e){var t,r,i,n,o,a,s,u,l=Tl(this),c=xl(e),f=arguments.length,h=f>1?arguments[1]:void 0,p=void 0!==h,d=Sl(c);if(d&&!_l(d))for(u=(s=Al(c,d)).next,c=[];!(a=gl(u,s)).done;)c.push(a.value);for(p&&f>2&&(h=yl(h,arguments[2])),r=El(c),i=new(Rl(l))(r),n=bl(i),t=0;r>t;t++)o=p?h(c[t],t):c[t],i[t]=n?Cl(o):+o;return i},Ll=R,Il=Array.isArray||function(e){return"Array"===Ll(e)},Pl=ju,Ml=H,wl=tt("species"),Fl=Array,Nl=function(e){var t;return Il(e)&&(t=e.constructor,(Pl(t)&&(t===Fl||Il(t.prototype))||Ml(t)&&null===(t=t[wl]))&&(t=void 0)),void 0===t?Fl:t},Dl=Lu,Vl=P,Ul=Ve,Bl=hi,kl=function(e,t){return new(Nl(e))(0===t?0:t)},zl=A([].push),Gl=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,l,c,f){for(var h,p,d=Ul(u),m=Vl(d),v=Dl(l,c),y=Bl(m),g=0,T=f||kl,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:zl(x,h)}else switch(e){case 4:return!1;case 7:zl(x,h)}return o?-1:i||n?n:x}},jl={forEach:Gl(0),map:Gl(1),filter:Gl(2),some:Gl(3),every:Gl(4),find:Gl(5),findIndex:Gl(6),filterReject:Gl(7)},Xl=Z,Hl=Lo,Yl=a,Wl=tt("species"),Zl=function(e){var t=Xl(e);Yl&&t&&!t[Wl]&&Hl(t,Wl,{configurable:!0,get:function(){return this}})},ql=G,Kl=H,Ql=Uo,Jl=function(e,t,r){var i,n;return Ql&&ql(i=t.constructor)&&i!==r&&Kl(n=i.prototype)&&n!==r.prototype&&Ql(e,n),e},$l=en,ec=i,tc=c,rc=a,ic=Ca,nc=xa,oc=pu,ac=Ma,sc=y,uc=Wt,lc=vu,cc=ci,fc=Da,hc=Eu,pc=function(e){var t=Au(e);return t<0?0:t>255?255:255&t},dc=ht,mc=ke,vc=Ro,yc=H,gc=pe,Tc=Cn,xc=q,Ec=Uo,Ac=Jr.f,Sc=Ol,_c=jl.forEach,bc=Zl,Rc=Lo,Cc=Ot,Oc=n,Lc=Jl,Ic=Lr.get,Pc=Lr.set,Mc=Lr.enforce,wc=Cc.f,Fc=Oc.f,Nc=ec.RangeError,Dc=oc.ArrayBuffer,Vc=Dc.prototype,Uc=oc.DataView,Bc=nc.NATIVE_ARRAY_BUFFER_VIEWS,kc=nc.TYPED_ARRAY_TAG,zc=nc.TypedArray,Gc=nc.TypedArrayPrototype,jc=nc.aTypedArrayConstructor,Xc=nc.isTypedArray,Hc="BYTES_PER_ELEMENT",Yc="Wrong length",Wc=function(e,t){jc(e);for(var r=0,i=t.length,n=new e(i);i>r;)n[r]=t[r++];return n},Zc=function(e,t){Rc(e,t,{configurable:!0,get:function(){return Ic(this)[t]}})},qc=function(e){var t;return xc(Vc,e)||"ArrayBuffer"===(t=vc(e))||"SharedArrayBuffer"===t},Kc=function(e,t){return Xc(e)&&!gc(t)&&t in e&&lc(+t)&&t>=0},Qc=function(e,t){return t=dc(t),Kc(e,t)?sc(2,e[t]):Fc(e,t)},Jc=function(e,t,r){return t=dc(t),!(Kc(e,t)&&yc(r)&&mc(r,"value"))||mc(r,"get")||mc(r,"set")||r.configurable||mc(r,"writable")&&!r.writable||mc(r,"enumerable")&&!r.enumerable?wc(e,t,r):(e[t]=r.value,e)};rc?(Bc||(Oc.f=Qc,Cc.f=Jc,Zc(Gc,"buffer"),Zc(Gc,"byteOffset"),Zc(Gc,"byteLength"),Zc(Gc,"length")),$l({target:"Object",stat:!0,forced:!Bc},{getOwnPropertyDescriptor:Qc,defineProperty:Jc}),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=ec[n],u=s,l=u&&u.prototype,c={},f=function(e,t){wc(e,t,{get:function(){return function(e,t){var r=Ic(e);return r.view[o](t*i+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=Ic(e);o.view[a](t*i+o.byteOffset,r?pc(n):n,!0)}(this,t,e)},enumerable:!0})};Bc?ic&&(u=t((function(e,t,r,n){return ac(e,l),Lc(yc(t)?qc(t)?void 0!==n?new s(t,hc(r,i),n):void 0!==r?new s(t,hc(r,i)):new s(t):Xc(t)?Wc(u,t):tc(Sc,u,t):new s(fc(t)),e,u)})),Ec&&Ec(u,zc),_c(Ac(s),(function(e){e in u||uc(u,e,s[e])})),u.prototype=l):(u=t((function(e,t,r,n){ac(e,l);var o,a,s,c=0,h=0;if(yc(t)){if(!qc(t))return Xc(t)?Wc(u,t):tc(Sc,u,t);o=t,h=hc(r,i);var p=t.byteLength;if(void 0===n){if(p%i)throw Nc(Yc);if((a=p-h)<0)throw Nc(Yc)}else if((a=cc(n)*i)+h>p)throw Nc(Yc);s=a/i}else s=fc(t),o=new Dc(a=s*i);for(Pc(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new Uc(o)});c<s;)f(e,c++)})),Ec&&Ec(u,zc),l=u.prototype=Tc(Gc)),l.constructor!==u&&uc(l,"constructor",u),Mc(l).TypedArrayConstructor=u,kc&&uc(l,kc,n);var h=u!==s;c[n]=u,$l({global:!0,constructor:!0,forced:h,sham:!Bc},c),Hc in u||uc(u,Hc,i),Hc in l||uc(l,Hc,i),bc(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 $c=Ro,ef=To?{}.toString:function(){return"[object "+$c(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,lf=ii,cf=sf,ff=N,hf=uf("".charAt),pf=uf("".charCodeAt),df=uf("".slice),mf=function(e){return function(t,r){var i,n,o=cf(ff(t)),a=lf(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 _f=!Tf(tf)||yf((function(){var e={};return tf[Af].call(e)!==e}));_f&&(tf={}),gf(tf[Af])||Ef(tf,Af,(function(){return this}));var bf={IteratorPrototype:tf,BUGGY_SAFARI_ITERATORS:Sf},Rf=bf.IteratorPrototype,Cf=Cn,Of=y,Lf=ls,If=Zu,Pf=function(){return this},Mf=en,wf=c,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=ls,Bf=Wt,kf=Qr,zf=Zu,Gf=er.PROPER,jf=er.CONFIGURABLE,Xf=bf.IteratorPrototype,Hf=bf.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,l,c=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||c(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:c(Zf),keys:o?m:c(Wf),entries:c(qf)},a)for(l in u)(Hf||h||!(l in p))&&kf(p,l,u[l]);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",Ol,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,lh=ii,ch=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("at",(function(e){var t=ch(this),r=uh(t),i=lh(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=jl.every,Sh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("every",(function(e){return Ah(Sh(this),e,arguments.length>1?arguments[1]:void 0)}));var _h=Ka,bh=vl,Rh=Ro,Ch=c,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)?bh(e):+e;return Ch(_h,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=jl.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=jl.find,Kh=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("find",(function(e){return qh(Kh(this),e,arguments.length>1?arguments[1]:void 0)}));var Qh=jl.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),l=rp(s);l-- >0;)if(u(o=s[l],l,a))switch(e){case 0:return o;case 1:return l}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 lp=jl.forEach,cp=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("forEach",(function(e){lp(cp(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,_p=Ap,bp=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 _p(Ip,this,arguments)||0;var t=bp(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=jl.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,l=e?-1:1;if(i<2)for(;;){if(u in a){n=a[u],u+=l;break}if(u+=l,e?u<0:s<=u)throw Xp("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=l)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=c,rd=xa,id=hi,nd=Eu,od=Ve,ad=o,sd=ed.RangeError,ud=ed.Int8Array,ld=ud&&ud.prototype,cd=ld&&ld.set,fd=rd.aTypedArray,hd=rd.exportTypedArrayMethod,pd=!ad((function(){var e=new Uint8ClampedArray(2);return td(cd,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(cd,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=jl.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?_d(e,t):bd(e,Sd(Ed(e,0,i),t),Sd(Ed(e,i),t),t)},_d=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},bd=function(e,t,r,i){for(var n=t.length,o=r.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?i(t[a],r[s])<=0?t[a++]:r[s++]:a<n?t[a++]:r[s++];return e},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=bu,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=ci,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,lm=um&&um.prototype||{},cm=[].toString,fm=sm([].join);am((function(){cm.call({})}))&&(cm=function(){return fm(this)});var hm=lm.toString!==cm;om("toString",cm,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,_m=ii,bm=RangeError,Rm=function(e,t,r,i){var n=Sm(e),o=_m(r),a=o<0?n+o:o;if(a>=n||a<0)throw bm("Incorrect index");for(var s=new t(n),u=0;u<n;u++)s[u]=u===a?i:e[u];return s},Cm=pl,Om=ii,Lm=vl,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 lv=hi,cv=pl,fv=si,hv=vl,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,l=mv(this),c=vv(l),f=lv(l),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 c(r),n=cv(o);for(var m=2;m<p;m++)a=arguments[m],o[m-2]=n?hv(a):+a}for(u=new c(s=f+r-i);d<h;d++)u[d]=l[d];for(;d<h+r;d++)u[d]=o[d-h];for(;d<s;d++)u[d]=l[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,_v=Jr.f,bv=os,Rv="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Ev.f=function(e){return Rv&&"Window"===Av(e)?function(e){try{return _v(e)}catch(e){return bv(Rv)}}(e):_v(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=c,Qv=wt,Jv=Ae,$v=Lu,ey=c,ty=wt,ry=me,iy=fl,ny=hi,oy=q,ay=sl,sy=el,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},ly=TypeError,cy=function(e,t){this.stopped=e,this.result=t},fy=cy.prototype,hy=function(e,t,r){var i,n,o,a,s,u,l,c=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,c),v=function(e){return i&&uy(i,"normal",e),new cy(!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 ly(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 cy(!1)}i=ay(e,n)}for(u=h?e.next:i.next;!(l=ey(u,i)).done;){try{s=y(l.value)}catch(e){uy(i,"throw",e)}if("object"==typeof s&&s&&oy(fy,s))return s}return new cy(!1)},py=en,dy=i,my=A,vy=Yi,yy=Qr,gy=xv.exports,Ty=hy,xy=Ma,Ey=G,Ay=M,Sy=H,_y=o,by=ho,Ry=ls,Cy=Jl,Oy=Cn,Ly=Lo,Iy=La,Py=Lu,My=Ma,wy=M,Fy=hy,Ny=Qf,Dy=Jf,Vy=Zl,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,l={},c=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&&!_y((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=_y((function(){f.has(1)})),d=by((function(e){new a(e)})),m=!n&&_y((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)&&(c("delete"),c("has"),i&&c("get")),(m||h)&&c(o),n&&s.clear&&delete s.clear}return l[e]=u,py({global:!0,constructor:!0,forced:u!==a},l),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,lg=Qy.setImmediate,cg=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)};lg&&cg||(lg=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},cg=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:lg,clear:cg},_g=function(){this.head=null,this.tail=null};_g.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var bg,Rg,Cg,Og,Lg,Ig=_g,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&&bg(),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),bg=function(){Lg(qg)}):zg?bg=function(){Xg.nextTick(qg)}:(Dg=Fg(Dg,wg),bg=function(){Dg(qg)}):(Rg=!0,Cg=jg.createTextNode(""),new Gg(qg).observe(Cg,{characterData:!0}),bg=function(){Cg.data=Rg=!Rg}),Wg=function(e){Zg.head||bg(),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,lT=ie;rT&&rT.prototype;var cT=aT("species"),fT=!1,hT=iT(tT.PromiseRejectionEvent),pT=nT("Promise",(function(){var e=oT(rT),t=e!==String(rT);if(!t&&66===lT)return!0;if(!lT||lT<51||!/native code/.test(e)){var r=new rT((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[cT]=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,_T=i,bT=c,RT=Qr,CT=Uo,OT=ls,LT=Zl,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=_T.TypeError,$T=_T.document,ex=_T.process,tx=GT.f,rx=tx,ix=!!($T&&$T.createEvent&&_T.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,l=e.reject,c=e.domain;try{s?(a||(2===t.rejection&&fx(t),t.rejection=1),!0===s?r=o:(c&&c.enter(),r=s(o),c&&(c.exit(),n=!0)),r===e.promise?l(JT("Promise-chain cycle")):(i=ox(r))?bT(i,r,u,l):u(r)):l(o)}catch(e){c&&!n&&c.exit(),l(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&&lx(e)})))},ux=function(e,t,r){var i,n;ix?((i=$T.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),_T.dispatchEvent(i)):i={promise:t,reason:r},!HT&&(n=_T["on"+e])?n(i):e===nx&&VT("Unhandled promise rejection",r)},lx=function(e){bT(NT,_T,(function(){var t,r=e.facade,i=e.value;if(cx(e)&&(t=UT((function(){ST?ex.emit("unhandledRejection",i,r):ux(nx,r,i)})),e.rejection=ST||cx(e)?2:1,t.error))throw t.value}))},cx=function(e){return 1!==e.rejection&&!e.parent},fx=function(e){bT(NT,_T,(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{bT(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),bT(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){bT(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=c,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++,l=!1;s++,yx(r,t,e).then((function(e){l||(l=!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,_x=Jg,bx=Z,Rx=G,Cx=Qr,Ox=_x&&_x.prototype;if(Ax({target:"Promise",proto:!0,forced:Sx,real:!0},{catch:function(e){return this.then(void 0,e)}}),Rx(_x)){var Lx=bx("Promise").prototype.catch;Ox.catch!==Lx&&Cx(Ox,"catch",Lx,{unsafe:!0})}var Ix=c,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=c,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=c,tE=wt,rE=Cn,iE=Ae,nE=La,oE=Lr,aE=jx,sE=Jf,uE=Z("Promise"),lE="AsyncFromSyncIterator",cE=oE.set,fE=oE.getterFor(lE),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=lE,cE(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=c,yE=dE,gE=wt,TE=sl,xE=mE,EE=Ae,AE=tt("asyncIterator"),SE=i,_E=TypeError,bE=c,RE=Z,CE=Ae,OE=c,LE=Te,IE=wt,PE=H,ME=function(e){if(e>9007199254740991)throw _E("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(bE(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),l=wE("Promise"),c=u.iterator,f=u.next,h=0;return new l((function(e,u){var p=function(e){NE(c,u,e,u)},d=function(){try{if(s)try{ME(h)}catch(e){p(e)}l.resolve(IE(OE(f,c))).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(c,e,!1,u);else if(t)try{a[h++]=o,d()}catch(e){p(e)}else o?NE(c,e,n||m,u):d()};PE(v)?l.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=sl,XE=mE,HE=el,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:[],l=a?GE(o,a):new qE(XE(jE(o,s)));r(KE(l,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=jl.filterReject,uA=Hh,lA=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("filterOut",(function(e){var t=sA(lA(this),e,arguments.length>1?arguments[1]:void 0);return uA(this,t)}),!0);var cA=jl.filterReject,fA=Hh,hA=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("filterReject",(function(e){var t=cA(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),l=pA(t,r),c=gA(null),f=yA(u),h=0;f>h;h++)a=u[h],(o=vA(l(a,h,s)))in c?EA(c[o],a):c[o]=[a];if(i&&(n=i(s))!==xA)for(o in c)c[o]=TA(n,c[o]);return c},SA=Gh,_A=xa.aTypedArray;(0,xa.exportTypedArrayMethod)("groupBy",(function(e){var t=arguments.length>1?arguments[1]:void 0;return AA(_A(this),e,t,SA)}),!0);var bA=A,RA=Map.prototype,CA={Map:Map,set:bA(RA.set),get:bA(RA.get),has:bA(RA.has),remove:bA(RA.delete),proto:RA},OA=c,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",lS=.017453292519943295,cS={"Filter not imported":"https://yuque.antfin.com/huoxing/knaszl/qtnsf2g9ofigggor#n4Y1K","Item duration can't be less than 0":"https://yuque.antfin.com/huoxing/knaszl/wozlz0#vFPqF"};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,_S,bS,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(cS["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(cS["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,l=0;l<n.length&&(s=n[l],u=n[l+1],!(s.stop<=a&&u.stop>a));l++);var c=jS(s.color,u.color,(a-s.stop)/(u.stop-s.stop));i.set(c,4*o)}i.set(n[n.length-1].color,508)}return r}function 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,l=n;u<l;){if(r===e.OrderType.ascending){for(;t[l].priority>s.priority&&l>=u;)l--;for(;t[u].priority<=s.priority&&u<l;)u++}else{for(;t[l].priority<s.priority&&l>=u;)l--;for(;t[u].priority>=s.priority&&u<l;)u++}o=iS([t[l],t[u]],2),t[u]=o[0],t[l]=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,l+1,n),t}function e_(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"}(_S||(_S={})),function(e){e[e.CLICK=0]="CLICK",e[e.MESSAGE=1]="MESSAGE",e[e.DRAG=2]="DRAG"}(bS||(bS={})),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 t_,r_,i_,n_,o_,a_,s_,u_;!function(e){e[e.portrait=1]="portrait",e[e.landscape=0]="landscape"}(t_||(t_={})),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"}(r_||(r_={})),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"}(i_||(i_={})),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"}(n_||(n_={})),function(e){e[e.destroy=0]="destroy",e[e.loop=5]="loop",e[e.forward=4]="forward"}(o_||(o_={})),function(e){e[e.destroyChildren=6]="destroyChildren"}(a_||(a_={})),function(e){e[e.none=0]="none",e[e.removeParticle=1]="removeParticle"}(s_||(s_={})),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"}(u_||(u_={}));var l_,c_,f_,h_,p_,d_,m_,v_,y_;!function(e){e[e.box=2]="box",e[e.sphere=3]="sphere"}(l_||(l_={})),function(e){e.unlit="unlit",e.pbr="pbr",e.hair="hair"}(c_||(c_={})),function(e){e[e.opaque=100]="opaque",e[e.masked=101]="masked",e[e.translucent=102]="translucent",e[e.additive=103]="additive"}(f_||(f_={})),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"}(h_||(h_={})),function(e){e[e.display=0]="display",e[e.clip=1]="clip",e[e.ellipsis=2]="ellipsis"}(p_||(p_={})),function(e){e[e.top=0]="top",e[e.middle=1]="middle",e[e.bottom=2]="bottom"}(d_||(d_={})),function(e){e[e.left=0]="left",e[e.middle=1]="middle",e[e.right=2]="right"}(m_||(m_={})),function(e){e.normal="normal",e.bold="bold",e.lighter="lighter"}(v_||(v_={})),function(e){e.normal="normal",e.italic="italic",e.oblique="oblique"}(y_||(y_={}));var g_,T_=Object.freeze({__proto__:null,get BezierKeyframeType(){return n_},get BlendingMode(){return xS},BloomFilterThresholdAvgColor:0,CAMERA_CLIP_MODE_NORMAL:0,CAMERA_CLIP_MODE_VERTICAL:1,get CameraClipMode(){return t_},get CompositionEndBehavior(){return r_},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 y_},get InteractBehavior(){return RS},get InteractType(){return bS},get ItemEndBehavior(){return o_},get ItemType(){return CS},MESSAGE_ITEM_PHRASE_BEGIN:2,MESSAGE_ITEM_PHRASE_END:1,get MaskMode(){return AS},get MaterialBlending(){return f_},get MaterialType(){return c_},get ModelBoundingType(){return l_},get ParentItemEndBehavior(){return a_},get ParticleInteractionBehavior(){return s_},get ParticleOrigin(){return LS},get PluginType(){return _S},get RenderLevel(){return TS},get RenderMode(){return OS},get RenderMode3D(){return h_},get ShapeArcMode(){return u_},get ShapeType(){return SS},get SideMode(){return ES},get TextAlignment(){return m_},get TextBaseline(){return d_},get TextOverflow(){return p_},get TextWeight(){return v_},get ValueType(){return i_}}),x_=((g_={})[LS.PARTICLE_ORIGIN_CENTER]=[0,0],g_[LS.PARTICLE_ORIGIN_CENTER_BOTTOM]=[0,-.5],g_[LS.PARTICLE_ORIGIN_CENTER_TOP]=[0,.5],g_[LS.PARTICLE_ORIGIN_LEFT_TOP]=[-.5,.5],g_[LS.PARTICLE_ORIGIN_LEFT_CENTER]=[-.5,0],g_[LS.PARTICLE_ORIGIN_LEFT_BOTTOM]=[-.5,-.5],g_[LS.PARTICLE_ORIGIN_RIGHT_CENTER]=[.5,0],g_[LS.PARTICLE_ORIGIN_RIGHT_BOTTOM]=[.5,-.5],g_[LS.PARTICLE_ORIGIN_RIGHT_TOP]=[.5,.5],g_);function E_(e,t,r){return e>r?r:e<t?t:e}function A_(e){return Math.pow(2,Math.round(Math.log(e)/Math.LN2))}function S_(e,t){return e?[e[0]-.5,.5-e[1]]:t?x_[t]:[0,0]}var __,b_,R_=(__=new Float32Array(1),b_=new Int32Array(__.buffer),function(e){__[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)}),C_=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]=R_(e[r])}return e.prototype.set=function(e,t){for(var r=0;r<e.length;r++)this.data[r+t]=R_(e[r])},e}(),O_=Math.PI/180;function L_(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,l=o+o,c=i*s,f=n*s,h=n*u,p=o*s,d=o*u,m=o*l,v=a*s,y=a*u,g=a*l;return e[0]=1-h-m,e[3]=f-g,e[6]=p+y,e[1]=f+g,e[4]=1-c-m,e[7]=d-v,e[2]=p-y,e[5]=d+v,e[8]=1-c-h,e}function I_(){return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function P_(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 M_(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 w_(e,t,r,i,n){var o=n?-n[0]:0,a=n?-n[1]:0,s=n?-n[2]:0,u=t[0],l=t[1],c=t[2],f=t[3],h=u+u,p=l+l,d=c+c,m=u*h,v=u*p,y=u*d,g=l*p,T=l*d,x=c*d,E=f*h,A=f*p,S=f*d,_=i[0],b=i[1],R=i[2],C=(1-(g+x))*_,O=(v+S)*_,L=(y-A)*_,I=(v-S)*b,P=(1-(m+x))*b,M=(T+E)*b,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 F_(e,t){if(M_(t))return G_(e,t);var r=t[0],i=t[1],n=t[2],o=t[3],a=t[4],s=t[5],u=t[6],l=t[7],c=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*l-o*a,E=i*u-n*s,A=i*l-o*s,S=n*l-o*u,_=c*m-f*d,b=c*v-h*d,R=c*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*b+S*_;if(!I){for(var P=0;P<16;P++)e[P]=NaN;return e}return I=1/I,e[0]=(s*L-u*O+l*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-l*b)*I,e[5]=(r*L-n*R+o*b)*I,e[6]=(v*x-d*S-y*T)*I,e[7]=(c*S-h*x+p*T)*I,e[8]=(a*O-s*R+l*_)*I,e[9]=(i*R-r*O-o*_)*I,e[10]=(d*A-m*x+y*g)*I,e[11]=(f*x-c*A-p*g)*I,e[12]=(s*b-a*C-u*_)*I,e[13]=(r*C-i*b+n*_)*I,e[14]=(m*T-d*E-v*g)*I,e[15]=(c*E-f*T+h*g)*I,e}function N_(e,t,r){if(M_(t))return G_(e,r),e;if(M_(r))return G_(e,t),e;var i=t[0],n=t[1],o=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=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*l+E*p+A*y,e[3]=T*a+x*c+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*l+E*p+A*y,e[7]=T*a+x*c+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*l+E*p+A*y,e[11]=T*a+x*c+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*l+E*p+A*y,e[15]=T*a+x*c+E*d+A*g,e}function D_(e,t,r,i,n,o){var a,s=1/Math.tan(t*O_/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 V_=new Float32Array(9),U_=[0,0,0,1];function B_(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],l=e[8],c=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)*(c*v-h*d)+(t*u-n*o)*(c*m-f*d)+(r*s-i*a)*(l*v-h*p)-(r*u-n*a)*(l*m-f*p)+(i*u-n*s)*(l*d-c*p)}function k_(e,t,r,i){var n=e[0],o=e[1],a=e[2],s=e[4],u=e[5],l=e[6],c=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];V_[0]=n*p,V_[1]=o*p,V_[2]=a*p,V_[3]=s*d,V_[4]=u*d,V_[5]=l*d,V_[6]=c*m,V_[7]=f*m,V_[8]=h*m;var v=V_[0]+V_[4]+V_[8],y=void 0;if(v>0)y=Math.sqrt(v+1),U_[3]=.5*y,y=.5/y,U_[0]=(V_[5]-V_[7])*y,U_[1]=(V_[6]-V_[2])*y,U_[2]=(V_[1]-V_[3])*y;else{var g=0;V_[4]>V_[0]&&(g=1),V_[8]>V_[3*g+g]&&(g=2);var T=(g+1)%3,x=(g+2)%3;y=Math.sqrt(V_[3*g+g]-V_[3*T+T]-V_[3*x+x]+1),U_[g]=.5*y,y=.5/y,U_[3]=(V_[3*T+x]-V_[3*x+T])*y,U_[T]=(V_[3*T+g]+V_[3*g+T])*y,U_[x]=(V_[3*x+g]+V_[3*g+x])*y}r[0]=U_[0],r[1]=U_[1],r[2]=U_[2],r[3]=U_[3]}}function z_(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]),B_(e)<0&&(i[0]=-i[0]),k_(e,t,r,i)}function G_(e,t){for(var r=0;r<16;r++)e[r]=t[r];return e}var j_=Math.PI/180,X_=180/Math.PI,H_=Math.cos,Y_=Math.sin;function W_(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]+r[i];return e}function Z_(e,t){for(var r=0,i=e.length;r<i;r++)e[r]=t;return e}var q_=Number.EPSILON||Math.pow(2,-32);function K_(e){for(var t=0,r=e.length;t<r;t++)if(Math.abs(e[t])>q_)return!1;return!0}function Q_(e){return lR(e)?[e[0],e[1],e[2]]:[0,0,0]}function J_(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 $_(e,t,r,i){void 0===i&&(i=0);for(var n=0;n<r;n++)e[n]=t[n+i];return e}function eb(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 tb(e,t){1===arguments.length&&(t=e,e=[]);var r=t,i=Math.hypot.apply(Math,nS([],iS(r),!1));if(0===i)return $_(e,r,r.length);for(var n=0;n<r.length;n++)e[n]=r[n]/i;return e}function rb(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]*r;return e}function ib(e,t,r){for(var i=0,n=t.length;i<n;i++)e[i]=t[i]-r[i];return e}function nb(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 ob(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 ab(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 sb(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 ub(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 lb=[0,0,0,0,0,0,0,0,0];function cb(e,t){e||(e=lb);var r=Y_(t),i=H_(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 fb(e,t){return function(e,t,r,i){var n=H_(t*j_),o=H_(r*j_),a=H_(i*j_),s=Y_(t*j_),u=Y_(r*j_),l=Y_(i*j_);return e[0]=o*a,e[1]=o*l,e[2]=-u,e[3]=-n*l+s*u*a,e[4]=n*a+s*u*l,e[5]=s*o,e[6]=l*s+n*u*a,e[7]=-s*a+n*u*l,e[8]=n*o,e}(e,-t[0],-t[1],-t[2])}function hb(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],l=r[8];e[1]=Math.asin(E_(-s,-1,1))*X_,Math.abs(s)<.9999999?(e[0]=Math.atan2(u,l)*X_,e[2]=Math.atan2(o,i)*X_):(e[0]=0,e[2]=Math.atan2(-n,a)*X_)}(e,t),e}var pb=Math.PI/180,db=Math.cos,mb=Math.sin;function vb(e,t,r){var i=t[0],n=t[1],o=t[2],a=t[3],s=r[0],u=r[1],l=r[2],c=r[3];return e[0]=i*c+a*s+n*l-o*u,e[1]=n*c+a*u+o*s-i*l,e[2]=o*c+a*l+i*u-n*s,e[3]=a*c-i*s-n*u-o*l,e}function yb(e,t,r,i){var n=db(t*pb/2),o=db(r*pb/2),a=db(i*pb/2),s=mb(t*pb/2),u=mb(r*pb/2),l=mb(i*pb/2);e[0]=s*o*a-n*u*l,e[1]=n*u*a+s*o*l,e[2]=n*o*l-s*u*a,e[3]=n*o*a+s*u*l}function gb(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 Tb=[0,0,0];function xb(e,t,r){var i,n=null!==(i=r.position)&&void 0!==i?i:[0,0,0],o=[0,0,0];return sb(o,[e,t,0],r.getInverseViewProjectionMatrix()),ib(o,o,n),{center:n,direction:tb([],o)}}function Eb(e,t,r,i,n){ib(Tb,i,t);var o=ob(r,Tb);if(o<0)return null;rb(Tb,r,o),W_(Tb,t,Tb);var a=nb(i,Tb),s=n*n;return a>s?null:(rb(e,r,o-Math.sqrt(s-a)),W_(e,e,t))}function Ab(e,t,r,i,n){var o,a,s,u,l,c,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,_=i[2]+n[2]/2,b=1/h,R=1/p,C=1/d;return b>=0?(o=(T-v)*b,a=(x-v)*b):(o=(x-v)*b,a=(T-v)*b),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?(l=(S-g)*C,c=(_-g)*C):(l=(_-g)*C,c=(S-g)*C),o>c||l>a?null:((l>o||o!=o)&&(o=l),(c<a||a!=a)&&(a=c),a<0?null:(rb(e,t,o>=0?o:a),W_(e,e,t))))}var Sb=[0,0,0],_b=[0,0,0],bb=[0,0,0],Rb=[0,0,0];function Cb(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],l=[n+t,o+r,a];return[[s,[n-t,o-r,a],u],[s.slice(),u.slice(),l]]}function Ob(e,t,r,i,n){var o,a,s,u,l,c=r;if(ib(Sb,i[1],i[0]),ib(_b,i[2],i[0]),ib(Rb,t,i[0]),ab(bb,Sb,_b),(a=ob(c,bb))>0){if(n)return null;o=1}else{if(!(a<0))return null;o=-1,a=-a}return ab(_b,Rb,_b),s=ob(c=r,_b),(s*=o)<0?null:(ab(Sb,Sb,Rb),u=ob(c=r,Sb),(u*=o)<0||s+u>a?null:(l=ob(Rb,bb),(l*=-o)<0?null:(rb(e,r,l/a),W_(e,e,t))))}var Lb=[0,0],Ib=[0,0],Pb=[0,0];var Mb,wb=[];function Fb(e,t,r,i,n,o,a,s,u){var l=e,c=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++)l[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=[l[0]-g[0],l[1]-g[1],l[2]-g[2]],x=v.asRotation,E=J_(T,T,fb(wb,y.map((function(e){var t=v[e];return t?x?t.getValue(c):t.getIntegrateValue(0,i,n):0}))));l=W_(l,g,E)}if(m.enabled){var A=m.asMovement;for(d=0;d<3;d++){var S=m[y[d]];S&&(l[d]+=A?S.getValue(c):S.getIntegrateValue(0,i,n))}}return l}var Nb="not_implement",Db=function(){function e(e){this.onCreate(e)}return e.prototype.onCreate=function(e){throw Error(Nb)},e.prototype.getIntegrateValue=function(e,t,r){throw Error(Nb)},e.prototype.getIntegrateByTime=function(e,t){throw Error(Nb)},e.prototype.getValue=function(e){throw Error(Nb)},e.prototype.toUniform=function(e){throw Error(Nb)},e.prototype.map=function(e){throw Error(Nb)},e.prototype.scaleXCoord=function(e){return this},e}(),Vb=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}(Db),Ub=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}(Db),Bb=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}(Db),kb=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}(Db),zb=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 Kb(t,0,this.xCoord,this.min,this.max)-Kb(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}(Db),Gb=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}(Db),jb=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?C_: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(lR(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,l=void 0===u?0:u;return t=Math.min(t,o),r=Math.max(r,o),[n,o,s,l]}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],l=o[s+1];if(e>u[0]&&e<=l[0])return Qb(e,u,l)*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?$b:Jb,a=0;a<n;a++){var s=r[a],u=r[a+1],l=s[0],c=u[0];if(e>l&&e<=c)return i+o(e,s,u);i+=o(c,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}(Db),Xb=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),l=n[1];return l+u*(o[1]-l)}}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?Kb:qb,a=0;a<n;a++){var s=r[a],u=r[a+1],l=s[0],c=u[0];if(e>l&&e<=c)return i+o(e,l,c,s[1],u[1]);i+=o(c,l,c,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}(Db),Hb=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=(Qb(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}(Db),Yb=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,l=3*t*s*s,c=3*t*t*s,f=t*t*t,h=0;h<r.length;h++)a[h]=u*r[h]+l*n[h]+c*o[h]+f*i[h];return a},t}(Hb),Wb=((Mb={})[i_.RANDOM]=function(e){return e[0]instanceof Array?new kb(e):new Bb(e)},Mb[i_.CONSTANT]=function(e){return new Vb(e)},Mb[i_.CONSTANT_VEC2]=function(e){return new Vb(e)},Mb[i_.CONSTANT_VEC3]=function(e){return new Vb(e)},Mb[i_.CONSTANT_VEC4]=function(e){return new Vb(e)},Mb[i_.CURVE]=function(e){return new jb(e)},Mb[i_.RGBA_COLOR]=function(e){return new Vb(e)},Mb[i_.COLORS]=function(e){return new Ub(e.map((function(e){return kS(e,!1)})))},Mb[i_.LINE]=function(e){return 2===e.length&&0===e[0][0]&&1===e[1][0]?new zb([e[0][1],e[1][1]]):new Xb(e)},Mb[i_.GRADIENT_COLOR]=function(e){return new Gb(e)},Mb[i_.LINEAR_PATH]=function(e){return new Hb(e)},Mb[i_.BEZIER_PATH]=function(e){return new Yb(e)},Mb);function Zb(e){if(!e||!isNaN(+e))return new Vb(e||0);if(e instanceof Db)return e;if(cR(Wb[e[0]]))return Wb[e[0]](e[1]);throw new Error("ValueType: ".concat(e[0]," is not support"))}function qb(e,t,r,i,n){var o=e-t;return(i+i+(n-i)*o/(r-t))*o/2}function Kb(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 Qb(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,l=u-2*s+a,c=u-s,f=-2*u+3*s;return(2*u-3*s+1)*t[1]+l*n+c*o+f*r[1]}function Jb(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],l=a-e,c=l*l,f=c*l;return(n+o+2*s-2*u)*f*l/(4*i*i*i)+(2*n+o+3*s-3*u)*f/(3*i*i)+n*c/2/i-s*l}function $b(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],l=a-e,c=l*l,f=c*l,h=i*i,p=h*i;return(-30*p*s*(a+e)*l+10*h*n*(a+2*e)*c+5*i*(a+3*e)*(2*n+o+3*s-3*u)*f+3*(a+4*e)*(n+o+2*s-2*u)*f*l)/60/p}function eR(e,t){if(t){var r=t[0],i=t[1];if(r===i_.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===i_.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=Zb(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===o_.loop,gravity:Q_(n.gravity),gravityModifier:Zb(null!==(r=n.gravityOverLifetime)&&void 0!==r?r:0),direction:n.direction?tb([],n.direction):Q_(),endBehavior:s||0};var l=e.sizeOverLifetime;l&&(l.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Zb(l.x||1),this.sizeYOverLifetime=Zb(l.y||1),this.sizeZOverLifetime=Zb(l.z||1)):this.sizeXOverLifetime=Zb(l.size||1));var c=n.linearX||n.linearY||n.linearZ;c&&(this.linearVelOverLifetime={x:n.linearX&&Zb(n.linearX),y:n.linearY&&Zb(n.linearY),z:n.linearZ&&Zb(n.linearZ),asMovement:n.asMovement,enabled:!!c});var f=n.orbitalX||n.orbitalY||n.orbitalZ;f&&(this.orbitalVelOverLifetime={x:n.orbitalX&&Zb(n.orbitalX),y:n.orbitalY&&Zb(n.orbitalY),z:n.orbitalZ&&Zb(n.orbitalZ),center:Q_(n.orbCenter),asRotation:n.asRotation,enabled:!!f}),this.speedOverLifetime=n.speedOverLifetime&&Zb(n.speedOverLifetime);var h=e.rotationOverLifetime;if(h&&(this.rotationOverLifetime={asRotation:h.asRotation,separateAxes:h.separateAxes,z:Zb(h.z||0)},h.separateAxes)){var p=this.rotationOverLifetime;p.x=Zb(h.x||0),p.y=Zb(h.y||0)}this.gravityModifier=this.options.gravityModifier}return e.prototype.getVelocity=function(){return this.velocity||(this.velocity=rb([],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&&!K_(this.options.gravity)||this.options.startSpeed&&!K_(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=Z_(nR,1),a=Z_(iR,0),s=e<0?e:Math.max(e,0),u=n.duration,l=s/u,c={life:l,transform:this.transform,startSize:this.basicTransform.scale},f=this.basicTransform;l=l<0?0:l>1?1:l,this.sizeXOverLifetime&&(o[0]=this.sizeXOverLifetime.getValue(l),this.sizeSeparateAxes?(o[1]=this.sizeYOverLifetime.getValue(l),o[2]=this.sizeZOverLifetime.getValue(l)):o[2]=o[1]=o[0],r=!0),(r||t)&&c.transform.setScale(o[0],o[1],o[2]);var h,p=this.rotationOverLifetime;if(p){var d=function(e){return p.asRotation?e.getValue(l):e.getIntegrateValue(0,l,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=W_(iR,f.rotation,a);c.transform.setRotation(y[0],y[1],y[2])}(this.willTranslate()||t)&&(h=Fb(Z_(nR,0),this,n.gravity,s,u,f.position,this.getVelocity()));if(f.path&&(h||(h=$_(oR,f.position,3)),W_(h,h,f.path.getValue(l))),h&&c.transform.setPosition(h[0],h[1],h[2]),c.startSize){var g=c.transform.scale;c.transform.setScale(g[0]*c.startSize[0],g[1]*c.startSize[1],g[2]*c.startSize[2])}return c},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 lR=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function cR(e){return"[object Function]"===Object.prototype.toString.call(e)}function fR(e){return"[object Object]"===Object.prototype.toString.call(e)}function hR(e){if(lR(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=I_(),this.localMatrix=I_(),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 gb(vR,t),hb(e,L_(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,yb(this.quat,e,t,r),gb(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,hb(this.rotation,L_(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){vb(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 l=t?-1:1;this.setRotation(n[0]*l,n[1]*l,n[2]*l)}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&&(w_(this.localMatrix,this.quat,this.position,this.scale,this.anchor),this.dirtyFlags.localMatrix=!0),this.dirtyFlags.localData=!1):M_(this.localMatrix)||(P_(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?N_(this.worldMatrix,t,e):G_(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&&(z_(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&&$_(e,this.worldTRSCache.position,3),t&&$_(t,this.worldTRSCache.quat,4),r&&$_(r,this.worldTRSCache.scale,3)},e.prototype.cloneFromMatrix=function(e,t){t?(k_(e,this.position,this.quat,t),$_(this.scale,t,3)):z_(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:(P_(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;z_(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,l=void 0===u?0:u,c=e.duration,f=void 0===c?0:c,h=t.rootTransform;if(this.composition=t,this.id=r,this.name=i,this.delay=n,this.transform=new gR($A({name:this.name},s),h),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=l,this.onConstructed(e),f<=0)throw Error("Item duration can't be less than 0, see ".concat(cS["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.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=this.timeInms+=e;this.time+=e/1e3;var n=i-this.delayInms;if(this.delaying&&n>=0&&(this.delaying=!1,this.transform.setValid(!0),this.createContent(),this.onLifetimeBegin(this.composition,this.content),this.composition.itemLifetimeEvent(this,!0)),!this.delaying){var o=this.endBehavior,a=n/this.durInms,s=this.isEnded(n),u=!0;if(this.transform.setValid(!0),s)if(u=!1,this.callEnd||(this.callEnd=!0,this.composition.itemLifetimeEvent(this,!1),this.onEnd()),2!==o&&5!==o){if(this.ended=!0,this.transform.setValid(!1),1===o||3===o?null===(r=(t=this.composition).handlePlayerPause)||void 0===r||r.call(t,this):4===o&&(this.transform.setValid(!0),u=!0,a=1),this.reusable)0===o&&this.setVisible(!1);else{if(0===o||3===o||6===o)return this.dispose();1===o&&(this.endBehavior=2)}a=Math.min(a,1)}else u=!0,5===o&&(this.ended=!0,a%=1);else this.callEnd&&this.reusable&&(this.setVisible(!0),this.callEnd=!1);this.lifetime=a,u&&this.onItemUpdate(e,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.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.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.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 _R(e,t,r,i){SR[e]=r,ER[e]=t,i&&DS(AR,e)}var bR,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,l=o.clipMode;if(this.clipMode=l,this.options={position:$_([0,0,0],i,3),rotation:$_([0,0,0],n,3),near:Zb(a),far:Zb(s),fov:Zb(u)},t.positionOverLifetime){var c=t.positionOverLifetime,f=c.path,h=c.linearX,p=void 0===h?0:h,d=c.linearY,m=void 0===d?0:d,v=c.linearZ,y=void 0===v?0:v;this.translateOverLifetime={path:f&&Zb(f),x:Zb(p),y:Zb(m),z:Zb(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,_=g.z,b=void 0===_?0:_;this.rotationOverLifetime={separateAxes:T,x:Zb(E),y:Zb(S),z:Zb(b)}}}return e.prototype.update=function(e){var t=[0,0,0,1],r=[0,0,0],i=[0,0,0];$_(r,this.options.position,3),$_(i,this.options.rotation,3);var n=this.translateOverLifetime,o=this.rotationOverLifetime;if(e=E_(e,0,1),n&&(r[0]+=n.x.getValue(e),r[1]+=n.y.getValue(e),r[2]+=n.z.getValue(e),n.path&&W_(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,(bR=e.HitTestType||(e.HitTestType={}))[bR.triangle=1]="triangle",bR[bR.box=2]="box",bR[bR.sphere=3]="sphere",bR[bR.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",l="mouseup",c=function(e,t,r,i,o){void 0===i&&(i=0),void 0===o&&(o=0);var s=a.target,u=s.width,l=s.height,c=performance.now(),f=0,h=0;if(n){var p=c-n.ts;f=(i-n.dx)/p||0,h=(o-n.dy)/p||0,n={dx:i,dy:o,ts:c}}return{x:t,y:r,vx:f,vy:h,dx:i,dy:o,ts:c,width:u,height:l,origin:e}};WS()&&(o=function(e){var t=e,r=t.touches,i=t.changedTouches;return r[0]||i[0]},s="touchstart",u="touchmove",l="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,c(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,c(e,t,r,t-i.x,r-i.y))}},e[l]=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,c(e,t,r)),a.dispatchEvent(DR,c(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)?/),l=u?u[0]:"";if(l&&l.includes("300")){var c=new RegExp("".concat(l),"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(c,"\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,l,c;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 l=f.sent(),c=i[a[0][0][1][0]].url,[2,$A($A({keepImageSource:!1},t),{mipmaps:l,sourceFrom:{target:s,bin:c,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 l=f.sent(),c=i[a[0][1][0]].url,[2,$A($A({keepImageSource:!1},t),{mipmaps:l,sourceType:e.TextureSourceType.mipmaps,sourceFrom:{target:s,bin:c,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=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("number of faces expected"+t+", but found "+this.numberOfFaces):console.warn("texture arrays not currently supported"):console.warn("only 2D textures currently supported")}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 l=new Uint8Array(this.arrayBuffer,this.baseOffset+r+4,s);t.push({data:l,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 aC(t){var r=new oC(t,1),i=r.numberOfMipmapLevels,n=r.pixelWidth,o=r.pixelHeight,a=r.glType,s=r.numberOfFaces,u=r.glInternalFormat,l=r.glFormat,c=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:l,mipmaps:r.mipmaps(c)}}var sC,uC=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,l=s.mipmaps,c=t,f=(n=c.target,c.maps),h=t.urls;return u?l.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,l,c,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,l=s.mipmaps,c=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({},aC(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?l.slice():l.map((function(e){return e.slice()})),T=void 0,n!==dS.TEXTURE_CUBE_MAP?[3,11]:[4,Promise.all(l.map((function(e){return x.loadMipmapImages(e,v)})))];case 10:return T=E.sent(),[3,12];case 11:T=this.loadMipmapImages(l,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(c.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:c.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 lC(){return sC||(sC=new uC),sC}var cC,fC=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 hC(e){return"object"==typeof e&&e&&void 0===e.length&&e instanceof iC}e.MaterialRenderType=void 0,(cC=e.MaterialRenderType||(e.MaterialRenderType={}))[cC.normal=0]="normal",cC[cC.transformFeedback=1]="transformFeedback";var pC,dC,mC=1,vC=function(){function t(t){this.props=t,this.destroyed=!1,this.initialized=!1;var r=t.name,i=void 0===r?"Material"+mC++: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}(),yC="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,(pC=e.ShaderCompileResultStatus||(e.ShaderCompileResultStatus={}))[pC.noShader=0]="noShader",pC[pC.success=1]="success",pC[pC.fail=2]="fail",pC[pC.compiling=3]="compiling",e.GLSLVersion=void 0,(dC=e.GLSLVersion||(e.GLSLVersion={})).GLSL1="100",dC.GLSL3="300 es";var gC=function(e){this.source=e},TC="effects-internal-copy",xC="effects-internal-copy-mesh",EC="\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}",AC="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(yC,"\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 SC(t,r){var i=2===t,n=i?"#version 300 es":"";return{name:TC,vertex:XR([],n+"\n"+EC,e.ShaderType.vertex,t),fragment:XR([],n+"\n"+AC,e.ShaderType.fragment,t),glslVersion:i?e.GLSLVersion.GLSL3:e.GLSLVersion.GLSL1,marcos:[["WEBGL2",!!i],["DEPTH_TEXTURE",!!r]],cacheId:xC+ +r}}var _C,bC={format:dS.RGBA,type:dS.UNSIGNED_BYTE,minFilter:dS.LINEAR,magFilter:dS.LINEAR,wrapS:dS.CLAMP_TO_EDGE,wrapT:dS.CLAMP_TO_EDGE},RC=Symbol("dispose"),CC=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(bC).forEach((function(e){var r,i=null!==(r=t[e])&&void 0!==r?r:bC[e];a[e]=i,s.push(e,i)}));var u=s.join(":"),l=this.textureCache[u];if(l)this.textureRef[u]++;else{var c=this.engine;e_(c),l=iC.create(c,a),this.textureCache[u]=l,this.textureRef[u]=1,l[RC]=l.dispose,l.dispose=function(){return r.removeTexture(u)}}return l},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[RC](),r.dispose=r[RC]),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[RC](),e.dispose=e[RC]})),this.textureCache={},this.textureRef={},this.engine=void 0},t}(),OC=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 cR(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}(),LC=((_C={})[dS.FLOAT]=Float32Array.BYTES_PER_ELEMENT,_C[dS.INT]=Int32Array.BYTES_PER_ELEMENT,_C[dS.SHORT]=Int16Array.BYTES_PER_ELEMENT,_C[dS.BYTE]=Int8Array.BYTES_PER_ELEMENT,_C),IC=function(){function e(e){this.name=e}return e.prototype.initialize=function(){},e.prototype.flush=function(){},e}();function PC(e){return e===dS.INT?new Int32Array(0):e===dS.SHORT?new Int16Array(0):new Float32Array(0)}var MC="lookup_texture",wC="offscreen_canvas",FC={};function NC(e){return FC[e]}var DC,VC,UC=1,BC=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,l=void 0===u?[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]:u;this.id="Mesh"+UC++,this.name=o,this.geometry=i,this.material=r,this.priority=s,this.worldMatrix=l}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}(),kC=1e3;e.RenderPassAttachmentStorageType=void 0,(DC=e.RenderPassAttachmentStorageType||(e.RenderPassAttachmentStorageType={}))[DC.none=0]="none",DC[DC.color=1]="color",DC[DC.stencil_8_opaque=2]="stencil_8_opaque",DC[DC.depth_16_opaque=3]="depth_16_opaque",DC[DC.depth_stencil_opaque=4]="depth_stencil_opaque",DC[DC.depth_16_texture=5]="depth_16_texture",DC[DC.depth_24_stencil_8_texture=6]="depth_24_stencil_8_texture",e.TextureStoreAction=void 0,(VC=e.TextureStoreAction||(e.TextureStoreAction={}))[VC.store=0]="store",VC[VC.clear=2]="clear";var zC,GC=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,l=i.internalFormat,c=i.format,f=void 0===c?dS.RGBA:c,h=i.type,p=void 0===h?dS.UNSIGNED_BYTE:h;this.externalTexture=!1,this.textureOptions={size:n,format:f,type:p,internalFormat:l||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,(zC=e.RenderPassDestroyAttachmentType||(e.RenderPassDestroyAttachmentType={}))[zC.force=0]="force",zC[zC.keep=1]="keep",zC[zC.keepExternal=2]="keepExternal",zC[zC.destroy=0]="destroy";var jC=1,XC=function(){function t(t,r){this.attachments=[],this.destroyed=!1,this.initialized=!1;var i=r.name,n=void 0===i?"RenderPass_"+jC++:i,o=r.clearAction,a=r.semantics,s=r.depthStencilAttachment,u=r.storeAction,l=r.priority,c=void 0===l?0:l,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=c,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 OC(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 GC(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]],l=this.name;if(null===(r=o.attachments)||void 0===r?void 0:r.length){var c=o.attachments.map((function(e,t){var r;return new GC(i.renderer.engine,$A({size:u,name:(null===(r=e.texture)||void 0===r?void 0:r.name)||"".concat(l,"##color_").concat(t)},e))}));this.attachments=c;var f=IO.create({storeAction:this.storeAction,name:l,viewport:s,viewportScale:this.viewportScale,isCustomViewport:this.isCustomViewport,attachments:c.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}(),HC="#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);}",YC="#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);}}",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;}\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}",ZC="#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}}",KC="#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}",QC="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);}",JC="uniform sampler2D uAlphaXSample;uniform sampler2D uAlphaYSample;vec4 filterMain(vec2 texCoord,sampler2D source){vec4 color=texture2D(source,texCoord);float x=texture2D(uAlphaXSample,vec2(vFeatherCoord.x,0.)).r;float y=texture2D(uAlphaYSample,vec2(vFeatherCoord.y,0.)).r;return vec4(color.rgb,color.a*min(x,y));}",$C="uniform mat4 uMoveCameraViewPro;vec4 filterMain(float p,vec4 pos){return uMoveCameraViewPro*pos;}",eO="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);}",tO="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.));}",rO="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.);}",iO="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);}",nO="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;}",oO="precision highp float;attribute vec2 aPos;varying vec2 uv;void main(){gl_Position=vec4(aPos,0.,1.0);uv=(aPos+vec2(1.0))/2.;}",aO="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);}",sO="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);}",uO="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);}",cO="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);}",fO=function(t){function r(r,i){var n=t.call(this,r,i)||this,o=n.renderer.engine,a=IC.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=vC.create(o,{shader:{vertex:oO,fragment:cO,glslVersion:e.GLSLVersion.GLSL1}});return s.blending=!1,s.depthTest=!1,s.culling=!1,n.screenMesh=BC.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}(XC),hO=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=IC.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}),l={vertex:oO,fragment:"H"==i?sO:uO,glslVersion:e.GLSLVersion.GLSL1},c=vC.create(a,{name:s,shader:l});return c.blending=!1,c.depthTest=!1,c.culling=!1,o.screenMesh=BC.create(a,{name:s,geometry:u,material:c,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",TO(this.mainTexture)),t.renderMeshes([this.screenMesh]),"V"===this.type&&(this.gaussianResult.texture=t.getFrameBuffer().getColorTextures()[0])},r}(XC),pO=function(t){function r(e,r){var i=t.call(this,e,r)||this,n="PostProcess",o=i.renderer.engine,a=IC.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:oO,fragment:lO},u=vC.create(o,{name:n,shader:s});return u.blending=!1,u.depthTest=!1,u.culling=!1,i.screenMesh=BC.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",TO(this.gaussianDownSampleResult.texture)),t.renderMeshes([this.screenMesh])},r}(XC),dO=function(t){function r(r,i){var n=t.call(this,r,{})||this,o="PostProcess",a=n.renderer.engine;n.sceneTextureHandle=i||new GC(a);var s=IC.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=vC.create(a,{name:o,shader:{vertex:oO,fragment:aO,glslVersion:e.GLSLVersion.GLSL1}});return u.blending=!1,u.depthTest=!1,u.culling=!1,n.screenMesh=BC.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}(XC),mO={useHDR:!1,usePostProcessing:!1,useBloom:1,threshold:1,bloomIntensity:1,brightness:1,saturation:1,contrast:1,useToneMapping:1},vO="_effects_default_",yO=1,gO=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,l=t.clearAction,c=void 0===l?{colorAction:e.TextureLoadAction.whatever,stencilAction:e.TextureLoadAction.clear,depthAction:e.TextureLoadAction.whatever}:l,f=o.engine;u&&(this.globalVolume=$A($A({},mO),u)),this.globalUniforms=new EO;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 XC(o,{name:vO,priority:kC,meshOrder:e.OrderType.ascending,depthStencilAttachment:h,attachments:p,clearAction:d})];if(this.setRenderPasses(v),this.globalVolume){var y=this.globalVolume.useBloom,g=new GC(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 fO(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 GC(f);var S=new hO(o,"H",{name:"GaussianDownPassH"+A,viewport:T,attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]}),_=new hO(o,"V",{name:"GaussianDownPassV"+A,viewport:T,attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]});_.gaussianResult=x[A],this.addRenderPass(S),this.addRenderPass(_),T[2]/=2,T[3]/=2}T[2]*=4,T[3]*=4;for(A=0;A<6;A++){var b=new pO(o,{name:"GaussianUpPass"+A,viewport:T,attachments:[{texture:{format:dS.RGBA,type:m,minFilter:dS.LINEAR,magFilter:dS.LINEAR}}]});b.gaussianDownSampleResult=x[5-A],this.addRenderPass(b),T[2]*=2,T[3]*=2}}var R=void 0;R=y?new dO(o,g):new dO(o),this.addRenderPass(R)}this.semantics=new OC(t.semantics),this.clearAction=c,this.name="RenderFrame".concat(yO++);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 CC(f);var L=f.gpuCapability,I=L.detail,P=SC(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,l=t[u];u>=0&&!l.name.includes(vO);)l=t[--u];return this.addToRenderPass(l,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 l=a[u],c=s.get(l);if(c&&(c.listStart<=t.priority&&c.listEnd>=t.priority)){var f=l.meshes.indexOf(t);if(-1===f)return;var h=1===f&&l.meshes[0].name===TC;if(l.removeMesh(t),h){var p=a[u+1],d=l.meshes;c.intermedia||null===(r=c.preRenderPass)||void 0===r||r.resetColorAttachments([]);for(var m=1;m<d.length;m++)null===(i=c.preRenderPass)||void 0===i||i.addMesh(d[m]);var v=null===(n=l.attachments[0])||void 0===n?void 0:n.texture,y=v===this.resource.color_a||v===this.resource.color_b;l.dispose({meshes:e.DestroyOptions.keep,colorAttachment:y?e.RenderPassDestroyAttachmentType.keep:e.RenderPassDestroyAttachmentType.destroy,depthStencilAttachment:e.RenderPassDestroyAttachmentType.keep}),VS(a,l),this.removeRenderPass(l),s.delete(l),p&&this.updateRenderInfo(p),c.preRenderPass&&this.updateRenderInfo(c.preRenderPass),c.prePasses&&c.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),l=s.meshes.slice(0,u),c=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 XC(this.renderer,{name:vO+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:l,meshOrder:e.OrderType.ascending});c.unshift(this.createCopyMesh());var y=this.renderPasses;y[a]=v;var g=[],T=c.slice();r.prePasses&&(r.prePasses.forEach((function(e,t){e.priority=s.priority+1+t,e.setMeshes(c),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 XC(this.renderer,{name:vO+(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 l=e[u],c=null===(r=l.attachments[0])||void 0===r?void 0:r.texture;if(c&&n===c){var f=c===a?s:a;l.resetColorAttachments([f])}(c=null===(i=l.attachments[0])||void 0===i?void 0:i.texture)&&(n=c)}},t.prototype.findMeshRenderPassIndex=function(e){var t=-1;return this.renderPasses.every((function(r,i){return!r.name.startsWith(vO)||!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===TC?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,l=iC.create(r,{sourceType:e.TextureSourceType.framebuffer,format:dS.RGBA,name:"frame_a",minFilter:u,magFilter:u}),c=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 XC(this.renderer,{depthStencilAttachment:{storageType:f},attachments:[{texture:l}]}).initialize(this.renderer),p=new xO(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:c,finalCopyRP:p,depthStencil:h.depthAttachment,resRP:h}}},t.prototype.createCopyMesh=function(e){var t=TC,r=this.renderer.engine,i=IC.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=SC(r.gpuCapability.level,!!(null==e?void 0:e.depthTexture));this.renderer.getShaderLibrary().addShader(n);var o=vC.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]),BC.create(r,{name:t,geometry:i,material:o,priority:0})},t.prototype.removeRenderPass=function(e){VS(this._renderPasses,e)},t}();function TO(e){return e?[e.getWidth(),e.getHeight()]:[0,0]}var xO=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",TO(this.prePassTexture)),e.renderMeshes(this.meshes),this.storeAction&&e.clear(this.storeAction)},t}(XC),EO=function(){this.floats={},this.ints={},this.matrices={},this.samplers=[],this.uniforms=[]},AO=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}(),SO="function"==typeof WebGL2RenderingContext,_O=function(){function e(e){this.setupCapability(e)}return e.prototype.setupCapability=function(e){var t,r=SO&&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=bO(e,e.HALF_FLOAT)),i&&!s&&(s=bO(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,l=i?WebGL2RenderingContext.HALF_FLOAT:(null===(t=e.getExtension("OES_texture_half_float"))||void 0===t?void 0:t.HALF_FLOAT_OES)||0,c={floatTexture:u,halfFloatTexture:l,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"):l>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:LO(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=c,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 bO(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 RO,CO,OO={NONE:0,PVRTC:1,ASTC:2};function LO(e){return e.getExtension("WEBGL_compressed_texture_astc")?OO.ASTC:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc")?OO.PVRTC:OO.NONE}e.FilterMode=void 0,(RO=e.FilterMode||(e.FilterMode={}))[RO.Nearest=0]="Nearest",RO[RO.Linear=1]="Linear",e.RenderTextureFormat=void 0,(CO=e.RenderTextureFormat||(e.RenderTextureFormat={}))[CO.RGBA32=0]="RGBA32",CO[CO.RGBAHalf=1]="RGBAHalf";var IO=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}(),PO=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}(),MO=1,wO=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=Zb(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=vC.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 IC.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 BC.create(this.engine,{name:"Interact_preview"+MO++,priority:0,worldMatrix:I_(),geometry:e,material:t})},t}(),FO=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===bS.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,NO(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=Cb([0,0,0],.5,.5);return r.forEach((function(e){e.forEach((function(e){sb(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(e_(o),i===bS.CLICK&&(this.clickable=!0,n&&a===sS)){var s=e.getRendererOptions();this.previewContent=new wO(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(!NO(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,l=t.dx*t.width/t.height,c=a[2],f=Math.tan(s*Math.PI/180/2)*Math.abs(c),h=u*f,p=l*f,d=a[0]-p,m=a[1]-h;if(n.dxRange){var v=iS(n.dxRange,2);(d=E_(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=E_(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,c]}},r}(TR);function NO(e,t){var r=1e-5*(t||1);return e&&Math.abs(e.vx||0)<r&&Math.abs(e.vy||0)<r}var DO=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 FO&&t.previewContent&&this.addMesh(t.previewContent.mesh)},t.prototype.onCompositionItemRemoved=function(e,t){t instanceof FO&&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),VO=function(){};e.maxSpriteMeshItemCount=8,e.maxSpriteTextureCount=8;var UO=1,BO=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=BC.create(e,{name:"MSprite"+UO++,priority:0,worldMatrix:I_(),geometry:n,material:o})}return t.prototype.setItems=function(t){var r,i,n,o,a=[],s=[],u=2,l=0,c=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++){(b=null==(m=t[d])?void 0:m.renderer.texture)&&DS(s,b),m.mesh=this}for(d=0;d<t.length;d++){var m,v=(b=null==(m=t[d])?void 0:m.renderer.texture)?s.indexOf(b):-1,y=this.getItemInitData(m,d,f,v);l+=y.aPoint.length,c+=y.index.length,a.push(y),f+=y.aPoint.length/6,this.updateItem(m,!0)}var g={aPoint:new Float32Array(l),index:new Uint16Array(c)},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,_=g.index;S.setIndexData(_),S.setAttributeData("aPoint",g.aPoint),S.setDrawCount(c),this.mesh.setVisible(!S.getDrawCount()),this.mesh.priority=t[0].listIndex;for(d=0;d<s.length;d++){var b=s[d];A.setTexture("uSampler"+d,b)}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,l=s+4,c=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]];o.transform.assignWorldTRS(h,d,p);for(var v=0;v<4;v++)a[u+v]=h[v],a[c+v]=d[v],a[l+v]=p[v],a[f+v]=m[v];if(p[2]=o.life,a[l+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[l+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,l=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++)l[a]=r+s[a];return{aPoint:n.aPoint,index:l}},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 IC.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,l=e.maskMode,c=e.mask,f=(null==o?void 0:o.mesh)||{},h=this.engine,p={shader:XO(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=vC.create(h,p),m=$A({side:a,blending:!0,blendMode:u,mask:c,maskMode:l,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=[],_=0;_<t;_++)E.push(I_()),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,l=u.index,c=u.aPoint,f=new Float32Array(c),h=0;h<f.length;h+=6)f[h]*=a,f[h+1]*=s;return{index:l,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,_=((T+T+1)/y-1)/2,b=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+_,p[2]/v+S,p[3]/y+_,p[4]/v+S,p[5]/y+_,p[6]/v+S,p[7]/y+_];d.push(L[0]*a,L[1]*s,A[0]*C+b,A[1]*O+R,t,0,L[2]*a,L[3]*s,A[2]*C+b,A[3]*O+R,t,0,L[4]*a,L[5]*s,A[4]*C+b,A[5]*O+R,t,0,L[6]*a,L[7]*s,A[6]*C+b,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 kO(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 zO(e){var t,r=e.renderer,i=e.filter,n=r.blending,o=r.side,a=r.occlusion,s=r.mask,u=r.maskMode,l=r.order,c=+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(c,"+").concat(l,"+").concat(u,".").concat(s)}}function GO(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,l=n.ignoreBlend,c=n.wireframe,f=[["MAX_ITEM_COUNT",a],["PRE_MULTIPLY_ALPHA",!1],["ENV_EDITOR",u===sS],["ADJUST_LAYER",!!r],["USE_BLEND",!l],["MAX_FRAG_TEX",e.maxSpriteTextureCount>=16?16:8]],h=c?HC:WC.replace(/#pragma\s+FILTER_FRAG/,(null==r?void 0:r.fragment)||""),p=YC.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 jO(e,t){return e.filter?"".concat(e.filter.mesh.shaderCacheId,"_effects_filter"):"".concat(e.cachePrefix,"_effects_sprite_").concat(t)}function XO(e,t,r,i){var n=e.filter,o=e.wireframe,a=GO(r,null==n?void 0:n.mesh,{count:t,wireframe:o,env:i});return a.shared=!0,o||(a.cacheId=jO(e,t)),a}var HO="listIndex",YO=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,l=this.itemsToAdd,c=[],f=[],h=[],p=[],d=this.items,m={layerToAdd:[]},v=[],y=0;y<u.length;y++){if(WO(x=u[y]))c.push.apply(c,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),c.push.apply(c,nS([],iS(v),!1))),!v.length&&g<=d.length-1&&(v=this.combineSplits(d,g,s),c.push.apply(c,nS([],iS(v),!1))),this.check())}}var T=!1;for(y=0;y<l.length;y++)for(var x=l[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 _=S.spriteMesh=new BO(this.engine,S.renderInfo,this.composition);f.push(_.mesh),_.setItems(S.items.map((function(e){return e.content}))),_.applyChange(),_.splitLayer&&(null===(t=m.layerToAdd)||void 0===t||t.push(_)),S.dirty=!1,this.check(),T=!0}if(T){var b,R=function(t){var u=s[t],l=s[t+1];if(l.cacheId===u.cacheId&&!(null===(r=l.spriteMesh)||void 0===r?void 0:r.splitLayer)&&!(null===(i=u.spriteMesh)||void 0===i?void 0:i.splitLayer)&&u.items.length+l.items.length<=e.maxSpriteMeshItemCount){var c=u.items[0],p=l.items[l.items.length-1],m=C.getMeshSplits(d,d.indexOf(c),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=l.spriteMesh)||void 0===a?void 0:a.mesh;u.spriteMesh&&u.spriteMesh.mesh&&(u.spriteMesh.mesh.priority=l.indexEnd),f.includes(v)?VS(f,v):DS(h,v),s.splice(t+1,1),t--}}b=t},C=this;for(y=0;y<s.length-1;y++)R(y),y=b}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(c.length)for(y=0;y<c.length;y++){var I,P=(_=(I=c[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)?WO(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,HO),WO(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(WO(t)){if(o<=n.indexEnd){US(e,t,HO);var s=e.indexOf(t),u=Math.min(s,e.indexOf(n.items[0])),l=Math.max(s,e.indexOf(n.items[n.items.length-1])),c=a.getMeshSplits(e,u,l),f=c.findIndex((function(e){return e.items.includes(t)}));if(2===c.length)return r.splice(i+f,0,c[f]),Object.keys(c[1-f]).forEach((function(e){n[e]=c[1-f][e]})),{value:[c[f]]};if(3===c.length){if(Object.keys(c[0]).forEach((function(e){n[e]=c[0][e]})),r.splice(i+1,0,c[1],c[2]),1!==f)throw Error("neo split not in middle");return{value:[c[1],c[2]]}}if(1!==c.length)throw Error("invalid splits 1");return Object.keys(c[0]).forEach((function(e){n[e]=c[0][e]})),{value:[]}}}else{if(o<n.indexStart||o===n.indexEnd)return US(e,t,HO),{value:[]};if(o<n.indexEnd){US(e,t,HO);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,HO),WO(t)){var l=r[r.length-1],c=this.getMeshSplits(e,e.indexOf(l.items[0]),e.indexOf(t));if(Object.keys(c[0]).forEach((function(e){l[e]=c[0][e]})),2===c.length)return r.push(c[1]),[c[1]];if(1!==c.length)throw Error("invalid splits 3")}return[]},t.prototype.removeMeshSplitsItem=function(e,t,r,i){for(var n,o,a=null,s=-1,u=[],l=0;l<r.length;l++){var c=r[l];if(c.indexStart<=t.listIndex&&c.indexEnd>=t.listIndex){a=c,s=l;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(WO(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 l=e.indexOf(s.items[0]),c=e.indexOf(u.items[u.items.length-1]);if(Number.isInteger(l)&&Number.isInteger(c)){var f=this.getMeshSplits(e,l,c);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.contentVisible&&!(u.lifetime<0))if(WO(u)){var l=u.createContent().renderInfo.cacheId,c=u.content.renderer.texture,f=!0;if(o){var h=o.textures.includes(c)?0:1;o.cacheId===l&&u.type===CS.sprite&&o.items.length<e.maxSpriteMeshItemCount&&h+o.textures.length<=e.maxSpriteTextureCount?(US(o.items,u,HO),DS(o.textures,c),f=!1):a.push(o)}f&&(o={indexStart:u.listIndex,cacheId:l,renderInfo:u.content.renderInfo,items:[u],textures:[c]})}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 WO(e){var t=e.type;return t===CS.sprite||t===CS.filter}var ZO={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,l=(null!=i?i:{}).env;if(!o.shaderResults[jO(ZO,2)]){o.addShader(XO(ZO,2,s,l)),o.addShader(XO(ZO,e.maxSpriteMeshItemCount,s,l));var c=!1;null===(n=t[0])||void 0===n||n.items.forEach((function(e){e.type===CS.filter&&e.content.filter&&(c=!0,FS(e.content.filter).forEach((function(e){if(!e.isParticle){var t=GO(s,e,e);e.shaderCacheId&&(t.cacheId="".concat(e.shaderCacheId,"_effects_filter")),o.addShader(t)}})))})),c&&o.addShader(SC(s,!1)),u.writableFragDepth&&o.addShader(SC(s,!0))}return Promise.resolve()},r.prototype.onCompositionDestroyed=function(e){e.loaderData.spriteGroup.dispose()},r.prototype.onCompositionReset=function(e,t){var r=new YO(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),KO=[0,0,0],QO=[1,1,1],JO=[0,0,0],$O=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=Zb(s.path));var u=s.linearX||s.linearY||s.linearZ;u&&(this.linearVelOverLifetime={x:s.linearX&&Zb(s.linearX),y:s.linearY&&Zb(s.linearY),z:s.linearZ&&Zb(s.linearZ),asMovement:s.asMovement,enabled:!!u});var l=s.orbitalX||s.orbitalY||s.orbitalZ;l&&(this.orbitalVelOverLifetime={x:s.orbitalX&&Zb(s.orbitalX),y:s.orbitalY&&Zb(s.orbitalY),z:s.orbitalZ&&Zb(s.orbitalZ),center:Q_(s.orbCenter),asRotation:s.asRotation,enabled:!!l}),this.speedOverLifetime=s.speedOverLifetime&&Zb(s.speedOverLifetime)}if(o&&(o.separateAxes?(this.sizeSeparateAxes=!0,this.sizeXOverLifetime=Zb(o.x||1),this.sizeYOverLifetime=Zb(o.y||1),this.sizeZOverLifetime=Zb(o.z||1)):this.sizeXOverLifetime=Zb(o.size||1)),n&&(this.rotationOverLifetime={asRotation:n.asRotation,separateAxes:n.separateAxes,z:Zb(n.z||0)},n.separateAxes)){var c=this.rotationOverLifetime;c.x=Zb(n.x||0),c.y=Zb(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===o_.loop,endBehavior:t.endBehavior||0,gravity:Q_(s.gravity),gravityModifier:Zb(null!==(r=s.gravityOverLifetime)&&void 0!==r?r:0),direction:s.direction?tb([],s.direction):Q_()},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},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"velocity",{get:function(){return this._velocity||(this._velocity=rb([],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&&!K_(this.options.gravity)||this.options.startSpeed&&!K_(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=Z_(QO,1),n=Z_(KO,0),o=!1,a=!1,s=e<0?e:Math.max(e,0),u=r.duration,l=s/u,c={life:l,transform:this.transform};l=l<0?0:l>1?1:l,this.sizeXOverLifetime&&(i[0]=this.sizeXOverLifetime.getValue(l),this.sizeSeparateAxes?(i[1]=this.sizeYOverLifetime.getValue(l),i[2]=this.sizeZOverLifetime.getValue(l)):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(l):e.getIntegrateValue(0,l,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=W_(KO,this.basicTransform.rotation,n);c.transform.setRotation(v[0],v[1],v[2])}return(this.getWillTranslate()||t)&&Fb(f=[0,0,0],this,this.options.gravity,s,u,this.basicTransform.position,this.velocity),this.basicTransform.path&&(f||(f=$_(JO,this.basicTransform.position,3)),W_(f,f,this.basicTransform.path.getValue(l))),f&&this.transform.setPosition(f[0],f[1],f[2]),c.active=this.active,c},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}(),eL=[[0,0,1,1,void 0]],tL=[1,1,1,1],rL=function(e){function t(t,r,i){var n,o,a,s,u,l,c,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=S_(d.anchor,d.particleOrigin);d.anchor||void 0===d.particleOrigin||W_(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=Zb(null!==(l=E.opacity)&&void 0!==l?l:1),E.color&&E.color[0]===i_.GRADIENT_COLOR&&(h.colorOverLifetime=GS(E.color[1]))),(null===(c=t.filter)||void 0===c?void 0:c.feather)&&1!==(null===(f=t.filter)||void 0===f?void 0:f.feather)&&(h.feather=Zb(t.filter.feather)),h.emptyTexture=g,h.splits=t.splits||eL,h.listIndex=i.listIndex||0,h.textureSheetAnimation=t.textureSheetAnimation,h.cachePrefix="-",h.parentId=i.parentId,h.reusable=i.reusable,h._renderInfo=zO(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.getRenderData=function(t,r){var i,n=e.prototype.getRenderData.call(this,t,r),o=Z_(tL,1),a=t<0?t:Math.max(t,0),s=this.options.duration,u=a/s<0?0:a/s>1?1:a/s,l=this.opacityOverLifetime,c=this.colorOverLifetime;c&&(o=zS(c,u,!0),i=!0),l&&(o[3]*=l.getValue(u),i=!0),(i||r)&&(n.color=eb(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),_=A-S*f.col;E=y?[T*S,x*(f.col-_)]:[T*_,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}($O),iL=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.getBoundingBox=function(){var t=this.content;if(t&&this.transform){var r=this.transform.getWorldMatrix(),i=t.startSize,n=Cb([0,0,0],i[0]/2,i[1]/2);return n.forEach((function(e){e.forEach((function(e){sb(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 rL(this.sprite,{emptyTexture:t},this)},r.prototype.createWireframeMesh=function(e,t){var r=new BO(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),nL=1,oL=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:"+nL++,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 l=this.filter.mesh.variables;if(l){var c=u.mesh.material;try{for(var f=rS(Object.keys(l)),h=f.next();!h.done;h=f.next()){var p=h.value,d=l[p](r);d.length>4?c.setMatrix(p,d):c.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}(iL),aL=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,l=t.speedOverLifetime,c=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,_=t.forceTarget,b=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]),l&&(j.push(["SPEED_OVER_LIFETIME",!0]),K|=2,Z.uSpeedLifetimeValue=l.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==c?void 0:c.color)&&(j.push(["COLOR_OVER_LIFETIME",!0]),K|=16,Z.uColorOverLifetime=c.color instanceof iC?c.color:iC.createWithData(s,qS(c.color))),(null==c?void 0:c.opacity)?Z.uOpacityOverLifetimeValue=c.opacity.toUniform(H):Z.uOpacityOverLifetimeValue=Zb(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),_&&(j.push(["FINAL_TARGET",!0]),K|=1<<19,Z.uFinalTarget=new Float32Array(_.target||[0,0,0]),Z.uForceCurve=_.curve.toUniform(H)),z&&Y.max?(K|=1<<20,Z.uFCurveValueTexture=nC(s,jb.getAllData(Y,!0),Y.index,1)):Z.uFCurveValues=jb.getAllData(Y);var J=H.max+H.curves.length-32>G;if(2===X&&(H.max=-1,H.index=w?w[0]:uL(H.index),Y.index>0&&(Y.max=-1,Y.index=w?w[1]:uL(Y.index))),J&&z&&W){var $=nC(s,jb.getAllData(H,!0),H.index,1);Z.uVCurveValueTexture=$,q=1}else Z.uVCurveValues=jb.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?ZC.replace(/#pragma\s+FILTER_FRAG/,D.fragment):ZC,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: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=vC.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,b);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 le=IC.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))),ce=BC.create(s,{name:"MParticle_".concat(E),priority:M,material:se,geometry:le});this.anchor=C,this.mesh=ce,this.geometry=ce.firstGeometry(),this.forceTarget=_,this.sizeOverLifetime=p,this.speedOverLifetime=l,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=Fb([0,0,0],this,s.getVector4("uAcceleration").slice(0,3),o,a,i,i,r,r+3);if(this.forceTarget){var l=s.getVector3("uFinalTarget"),c=this.forceTarget.curve.getValue(o/a),f=1-c;u[0]=u[0]*f+l[0]*c,u[1]=u[1]*f+l[1]*c,u[2]=u[2]*f+l[2]*c}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)},l=this.useSprite;l&&(u.aSprite=new Float32Array(12));var c=[0,0,0],f=[0,0,0],h=[0,0,0,1],p=[1,1,1];e.transform.assignWorldTRS(c,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;l&&(E=e.sprite);for(var A=0;A<4;A++){var S=2*A,_=3*A,b=4*A,R=12*A,C=8*A;u.aPos.set(c,R),u.aPos.set(y,R+3),u.aRot.set(f,C),u.aRot[C+3]=x,u.aRot.set(g,C+4),l&&u.aSprite.set(E,_);var O=e.uv||v;if(O){var L=l?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,b);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],l=o.getAttributeStride(e)/Float32Array.BYTES_PER_ELEMENT;if(a){var c=BS(o.getAttributeData(e),n*l,s,4*r*l);c.set(i,i.length*t),o.setAttributeData(e,c)}else o.setAttributeSubData(e,i.length*t,i)})),this.particleCount=Math.max(i,this.particleCount),o.setDrawCount(6*this.particleCount)}},t}(),sL=[10,32,64,160];function uL(e){for(var t=0;t<sL.length;t++){var r=sL[t];if(r>e)return r}return e||sL[0]}function lL(e,t,r){var i,n,o,a,s;void 0===t&&(t="");var u=e.content,l=+((null===(i=u.renderer)||void 0===i?void 0:i.renderMode)||0),c=[["RENDER_MODE",l],["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&&c.push(["ENABLE_VERTEX_TEXTURE",!0]),v&&(c.push(["SPEED_OVER_LIFETIME",!0]),g|=2,eR(p,v));var T=u.textureSheetAnimation;T&&T.animate&&(c.push(["USE_SPRITE",!0]),g|=4);var x=void 0;if(u.filter&&u.filter.name!==uS){c.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&&(c.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==b?void 0:b[i])&&(eR(p,b[i]),r=1,g|=1<<7+t),c.push(["LINEAR_VEL_".concat(e.toUpperCase()),r]);var o=0;(null==b?void 0:b[n])&&(eR(p,b[n]),o=1,g|=1<<10+t,_=!0),c.push(["ORB_VEL_".concat(e.toUpperCase()),o])})),(null==b?void 0:b.asMovement)&&(c.push(["AS_LINEAR_MOVEMENT",!0]),g|=32),_&&(null==b?void 0:b.asRotation)&&(c.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)&&(c.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,c.push(["ROT_Z_LIFETIME",1])),(null==C?void 0:C.separateAxes)&&(C.x&&(eR(p,C.x),g|=65536,c.push(["ROT_X_LIFETIME",1])),C.y&&(eR(p,C.y),g|=1<<17,c.push(["ROT_Y_LIFETIME",1]))),(null==C?void 0:C.asRotation)&&(c.push(["ROT_LIFETIME_AS_MOVEMENT",1]),g|=1<<18),eR(p,null==b?void 0:b.gravityOverLifetime),(null==b?void 0:b.forceTarget)&&(c.push(["FINAL_TARGET",!0]),g|=1<<19,eR(p,b.forceCurve));var O=h.halfFloatTexture;O&&d.max&&(g|=1<<20);var L=h.maxVertexUniforms,I=p.max+p.curves.length-32>L;NC(MC)&&(I=!0),2===f&&(p.max=-1,d.index>0&&(d.max=-1)),I&&O&&m&&(y=1);var P=["-p:",l,g,p.index,p.max,d.index,d.max].join("+"),M={fragment:ZC,vertex:"#define LOOKUP_TEXTURE_CURVE ".concat(y,"\n").concat(qC),shared:!0,cacheId:P,marcos:c,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)),c.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 cL(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 fL=function(e){this.content=e},hL=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 fL(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 fL(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}(),pL=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=dL(this.arc,this.arcMode,e)*lS,r=[Math.cos(t)*this.radius,Math.sin(t)*this.radius,0],i=ob([],r,Math.tan(this.angle*lS));return i[2]+=1,{position:ob(r,r,pR(0,1)),direction:tb(i,i)}},e}();function dL(e,t,r){if(t===u_.RANDOM)e=pR(0,e);else if(t===u_.UNIDIRECTIONAL_CYCLE){var i=r.index%(r.total+1);e=e/r.total*i}else if(t===u_.BIDIRECTIONAL_CYCLE){var n=(i=r.index/(r.total+1))-Math.floor(i);e*=Math.floor(i)%2?1-n:n}else t===u_.UNIFORM_BURST&&(e=e*r.burstIndex/r.burstCount);return e}var mL,vL=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=dL(this.arc,this.arcMode,e)*lS,r=[Math.cos(t),Math.sin(t),0],i=this.radius;return{direction:r,position:r.map((function(e){return e*i}))}},e}(),yL=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}(),gL=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=dL(this.arc,this.arcMode,e)*lS,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}(),TL=function(){function e(e){this._d=e.width||1,this.arcMode=e.arcMode}return e.prototype.generate=function(e){var t=this.arcMode===u_.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}(),xL=[],EL=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=dL(this.arc,this.arcMode,e)*lS,o=cb(xL,n),a=[Math.cos(i),Math.sin(i),0],s=[r+Math.cos(i)*t,0,Math.sin(i)*t];return{direction:J_(a,a,o),position:J_(s,s,o)}},e}(),AL=[],SL=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=dL(this.arc,this.arcMode,e)*lS,r=this.getHorizontalAngle()*lS,i=this.radius,n=[Math.cos(r),0,Math.sin(r)],o=J_(n,n,cb(AL,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}(SL),bL=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=E_(e.random||0,0,1)}return e.prototype.generate=function(e){var t=this.anchors,r=t.length/2-1,i=Math.floor(dL(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:tb(a,a)}},e}(),RL=function(){function e(){}return e.prototype.generate=function(){return{position:[0,0,0],direction:[0,0,0]}},e}(),CL=((mL={})[SS.NONE]=RL,mL[SS.CONE]=pL,mL[SS.SPHERE]=SL,mL[SS.HEMISPHERE]=_L,mL[SS.CIRCLE]=vL,mL[SS.DONUT]=EL,mL[SS.RECTANGLE]=yL,mL[SS.EDGE]=TL,mL[SS.RECTANGLE_EDGE]=gL,mL[SS.TEXTURE]=bL,mL);function OL(e){if(!e)return new RL;var t=$A({radius:1,arc:360,angle:0,arcMode:u_.RANDOM},e),r=e.type,i=CL[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=tb(u)}return n}function LL(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=WL(o,e[o],e[o+1],a);else for(o=r-i;o>=t;o-=i)a=WL(o,e[o],e[o+1],a);return a&&zL(a,a.next)&&(ZL(a),a=a.next),a}function IL(e,t){if(!e)return e;t||(t=e);var r,i=e;do{if(r=!1,i.steiner||!zL(i,i.next)&&0!==kL(i.prev,i,i.next))i=i.next;else{if(ZL(i),(i=t=i.prev)===i.next)break;r=!0}}while(r||i!==t);return t}function PL(e){var t=e.prev,r=e,i=e.next;if(kL(t,r,i)>=0)return!1;for(var n=e.next.next;n!==e.prev;){if(UL(t.x,t.y,r.x,r.y,i.x,i.y,n.x,n.y)&&kL(n.prev,n,n.next)>=0)return!1;n=n.next}return!0}function ML(e,t,r,i){var n=e.prev,o=e,a=e.next;if(kL(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,l=n.x>o.x?n.x>a.x?n.x:a.x:o.x>a.x?o.x:a.x,c=n.y>o.y?n.y>a.y?n.y:a.y:o.y>a.y?o.y:a.y,f=DL(s,u,t,r,i),h=DL(l,c,t,r,i),p=e.prevZ,d=e.nextZ;p&&p.z>=f&&d&&d.z<=h;){if(p!==e.prev&&p!==e.next&&UL(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&kL(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==e.prev&&d!==e.next&&UL(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&kL(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=f;){if(p!==e.prev&&p!==e.next&&UL(n.x,n.y,o.x,o.y,a.x,a.y,p.x,p.y)&&kL(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=h;){if(d!==e.prev&&d!==e.next&&UL(n.x,n.y,o.x,o.y,a.x,a.y,d.x,d.y)&&kL(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function wL(e,t){return e.x-t.x}function FL(e,t){if(t=function(e,t){var r,i=t,n=e.x,o=e.y,a=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var s=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=n&&s>a){if(a=s,s===n){if(o===i.y)return i;if(o===i.next.y)return i.next}r=i.x<i.next.x?i:i.next}}i=i.next}while(i!==t);if(!r)return null;if(n===a)return r;var u,l=r,c=r.x,f=r.y,h=1/0;i=r;do{n>=i.x&&i.x>=c&&n!==i.x&&UL(o<f?n:a,o,c,f,o<f?a:n,o,i.x,i.y)&&(u=Math.abs(o-i.y)/(n-i.x),HL(i,e)&&(u<h||u===h&&(i.x>r.x||i.x===r.x&&NL(r,i)))&&(r=i,h=u)),i=i.next}while(i!==l);return r}(e,t),t){var r=YL(t,e);IL(t,t.next),IL(r,r.next)}}function NL(e,t){return kL(e.prev,e,t.prev)<0&&kL(t.next,e,e.next)<0}function DL(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 VL(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 UL(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 BL(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&&GL(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(HL(e,t)&&HL(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)&&(kL(e.prev,e,t.prev)||kL(e,t.prev,t))||zL(e,t)&&kL(e.prev,e,e.next)>0&&kL(t.prev,t,t.next)>0)}function kL(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function zL(e,t){return e.x===t.x&&e.y===t.y}function GL(e,t,r,i){var n=XL(kL(e,t,r)),o=XL(kL(e,t,i)),a=XL(kL(r,i,e)),s=XL(kL(r,i,t));return n!==o&&a!==s||(!(0!==n||!jL(e,r,t))||(!(0!==o||!jL(e,i,t))||(!(0!==a||!jL(r,e,i))||!(0!==s||!jL(r,t,i)))))}function jL(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 XL(e){return e>0?1:e<0?-1:0}function HL(e,t){return kL(e.prev,e,e.next)<0?kL(e,t,e.next)>=0&&kL(e,e.prev,t)>=0:kL(e,t,e.prev)<0||kL(e,e.next,t)<0}function YL(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 WL(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 ZL(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 KL=0;function QL(e,t,r,i){r=r||2,KL=i||0;var n,o,a,s,u,l,c,f=t&&t.length,h=f?t[0]*r:e.length,p=LL(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=LL(e,t[n]*i,n<o-1?t[n+1]*i:e.length,i,!1))===a.next&&(a.steiner=!0),s.push(VL(a));for(s.sort(wL),n=0;n<s.length;n++)FL(s[n],r),r=IL(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),(l=e[m+1])<o&&(o=l),u>a&&(a=u),l>s&&(s=l);c=0!==(c=Math.max(a-n,s-o))?1/c:0}return JL(p,d,r,n,o,c),d}function JL(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=DL(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,l=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,i=r,s=0,t=0;t<l&&(s++,i=i.nextZ);t++);for(u=l;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,l*=2}while(a>1)}(n)}(e,i,n,o);for(var s,u,l=e;e.prev!==e.next;)if(s=e.prev,u=e.next,o?ML(e,i,n,o):PL(e))t.push(s.i/r+KL),t.push(e.i/r+KL),t.push(u.i/r+KL),ZL(e),e=u.next,l=u.next;else if((e=u)===l){a?1===a?JL(e=$L(IL(e),t,r),t,r,i,n,o,2):2===a&&eI(e,t,r,i,n,o):JL(IL(e),t,r,i,n,o,1);break}}}function $L(e,t,r){var i=e;do{var n=i.prev,o=i.next.next;!zL(n,o)&&GL(n,i,i.next,o)&&HL(n,o)&&HL(o,n)&&(t.push(n.i/r+KL),t.push(i.i/r+KL),t.push(o.i/r+KL),ZL(i),ZL(i.next),i=e=o),i=i.next}while(i!==e);return IL(i)}function eI(e,t,r,i,n,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&BL(a,s)){var u=YL(a,s);return a=IL(a,a.next),u=IL(u,u.next),JL(a,t,r,i,n,o),void JL(u,t,r,i,n,o)}s=s.next}a=a.next}while(a!==e)}var tI=2;function rI(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,l=new Float32Array(a*oS),c=t.indexBase,f=void 0===c?0:c,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,_=[0,0],b=0;b<S.length-1;b++){oI(_,S[b],E,A,E[4],E[5],A[2],A[3]),C(_[0],_[1])}var R=QL(Array.from(l),null,oS,f);return{aPoint:l,index:new Uint16Array(R)};function C(e,t){l[p++]=e/2,l[p++]=t/2,h?(g[0]=e,g[1]=t,nI(g,g,T),l[p++]=d+(g[0]+1)/2*v,l[p++]=m+(g[1]+1)/2*y):(l[p++]=(e+1)/2,l[p++]=(t+1)/2),p+=tI}}function iI(e,t){for(var r=[],i=function(e){var t=[];return e.gs?e.gs.forEach((function(e){t.push({p:[i_.SHAPE_POINTS,e.p],s:[i_.SHAPE_SPLITS,e.s]})})):e.g?t.push({p:[i_.SHAPE_POINTS,e.g.p],s:[i_.SHAPE_SPLITS,e.g.s]}):t.push(e),t}(e),n=0,o=0,a=0,s=0;s<i.length;s++){n+=(h=rI(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),l=new Uint16Array(a),c=(s=0,0),f=0;s<r[s];s++){var h=r[s];u.set(h.aPoint,c),c+=h.aPoint.length,l.set(h.index,f),f+=h.index.length}return{aPoint:u,index:l}}function nI(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 oI(e,t,r,i,n,o,a,s){var u=1-t,l=u*u*u,c=3*t*u*u,f=3*t*t*u,h=t*t*t;return e[0]=l*r[0]+c*n+f*a+h*i[0],e[1]=l*r[1]+c*o+f*s+h*i[1],e}var aI=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 Db?i:Zb(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}(),sI=[0,0,0],uI=[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?Zb(1):s,l=t.widthOverTrail,c=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,_=A.level,b=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=l.toUniform(R);I.push(["VERT_CURVE_VALUE_COUNT",R.index],["VERT_MAX_KEY_FRAME_COUNT",R.max]),L.uVCurveValues=jb.getAllData(R);var F={shader:{vertex:XR(I,KC,e.ShaderType.vertex,_),fragment:XR(I,ZC,e.ShaderType.fragment,_),marcos:I,glslVersion:1===_?e.GLSLVersion.GLSL1:e.GLSLVersion.GLSL3,shared:!0,name:"trail#".concat(c),cacheId:"-t:+".concat(M,"+").concat(R.index,"+").concat(R.max)},uniformSemantics:{effects_MatrixVP:"VIEWPROJECTION",effects_MatrixInvV:"VIEWINVERSE",effects_ObjectToWorld:"MODEL",uEditorTransform:"EDITOR_TRANSFORM"}},N=b*a*2,D=(b-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(c),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*b,j=z*G,X=0;X<G;X++)k[j+X]=z}var H=kR(h),Y=vC.create(r,F);Y.blending=!0,Y.depthMask=f,Y.depthTest=!0,WR(Y,p),HR(Y,h);var W=this.mesh=BC.create(r,{name:"MTrail_".concat(c),material:Y,geometry:IC.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,b-1,0,0]),Y.setTexture("uMaskTex",Z),Y.setVector4("uColorParams",[y?1:0,+H,0,+(f&&!g)]),this.maxTrailCount=a,this.pointCountPerTrail=b,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,l=(i-2)%n,c=this.getTrailPosition(e,u,sI);if(!(c&&this.checkVertexDistance&&nb(c,t)<this.minimumVertexDistance)){var f=e*n+s,h=pI(c,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,l,uI),E=new Float32Array(pI(x,c,t)),A=6*(e*n+u);o.setAttributeSubData("aDir",A,E),o.setAttributeSubData("aDir",A+3,E);var S=e*n*2,_=new Uint16Array([2*u+S,2*u+1+S,2*s+S,2*s+S,2*u+1+S,2*s+1+S]),b=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}(),cI=[0,0,0],fI=[0,0,0],hI=[0,0,0];function pI(e,t,r){var i=cI;return e||r?(e?r?(tb(fI,ib(fI,t,e)),tb(hI,ib(fI,r,t)),W_(i,fI,hI)):ib(i,t,e):ib(i,r,t),tb(i,i)):[0,0,0]}var dI=function(){function e(e,t,r){var i,n,o,a,s,u,l=r.composition,c=r.endBehavior,f=r.name;if(l){var h,p=l.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=Q_(y.gravity),A=e.textureSheetAnimation,S=A?{animationDelay:Zb(A.animationDelay||0),animationDuration:Zb(A.animationDuration||1),cycles:Zb(A.cycles||1),animate:A.animate,col:A.col,row:A.row,total:A.total||A.col*A.row}:void 0,_=I_(),b=!!(g&&g.turbulenceX||g.turbulenceY||g.turbulenceZ);b&&(h=[Zb(null!==(i=g.turbulenceX)&&void 0!==i?i:0),Zb(null!==(n=g.turbulenceY)&&void 0!==n?n:0),Zb(null!==(o=g.turbulenceZ)&&void 0!==o?o:0)]),this.name=f,this.shape=OL(g),this.emission={rateOverTime:Zb(e.emission.rateOverTime),burstOffsets:SI(null!==(a=e.emission.burstOffsets)&&void 0!==a?a:[]),bursts:(e.emission.bursts||[]).map((function(e){return new aI(e)}))},this.textureSheetAnimation=S;var R,C=e.renderer||{},O={},L=e.rotationOverLifetime;L&&(O.asRotation=!!L.asRotation,O.z=L.z?Zb(L.z):Zb(0),L.separateAxes&&(O.x=L.x&&Zb(L.x),O.y=L.y&&Zb(L.y))),y.forceTarget&&(R={target:y.target||[0,0,0],curve:Zb(y.forceCurve||[i_.LINE,[[0,0],[1,1]]])});var I={x:y.linearX&&Zb(y.linearX||0),y:y.linearY&&Zb(y.linearY||0),z:y.linearZ&&Zb(y.linearZ||0),asMovement:y.asMovement},P={x:y.orbitalX&&Zb(y.orbitalX),y:y.orbitalY&&Zb(y.orbitalY),z:y.orbitalZ&&Zb(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:Zb(M.x),y:Zb(M.y)}:{separateAxes:!1,x:Zb(("size"in M?M.size:M.x)||1)},V=S_(C.anchor,C.particleOrigin);this.options={particleFollowParent:!!v.particleFollowParent,startLifetime:Zb(v.startLifetime),startDelay:Zb(v.startDelay||0),startSpeed:Zb(y.startSpeed||0),startColor:Zb(v.startColor),endBehavior:c,duration:T,looping:c===o_.loop,maxCount:null!==(s=v.maxCount)&&void 0!==s?s:0,gravityModifier:Zb(x||0).scaleXCoord(T),gravity:E,start3DSize:!!v.start3DSize,startTurbulence:b,turbulence:h,speedOverLifetime:y.speedOverLifetime&&Zb(y.speedOverLifetime),linearVelOverLifetime:I,orbitalVelOverLifetime:P,forceTarget:R},v.startRotationZ&&(this.options.startRotation=Zb(v.startRotationZ||0)),(v.startRotationX||v.startRotationY)&&(this.options.start3DRotation=!0,this.options.startRotationX=Zb(v.startRotationX||0),this.options.startRotationY=Zb(v.startRotationY||0),this.options.startRotationZ=Zb(v.startRotationZ||0)),v.start3DSize?(this.options.startSizeX=Zb(v.startSizeX),this.options.startSizeY=Zb(v.startSizeY)):(this.options.startSize=Zb(v.startSize),this.options.sizeAspect=Zb(v.sizeAspect||1));var U={listIndex:F,meshSlots:v.meshSlots,name:f,matrix:_,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=Zb(w.opacity)),B&&(B[0]===i_.GRADIENT_COLOR?U.colorOverLifetime.color=w.color[1]:B[0]===i_.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 aL(U,{composition:l});var Q=e.trails;if(Q){this.trails={lifetime:Zb(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:_,minimumVertexDistance:Q.minimumVertexDistance||.02,maxTrailCount:v.maxCount,pointCountPerTrail:Math.round(Q.maxPointPerTrail)||32,blending:Q.blending,texture:Q.texture,opacityOverLifetime:Zb(Q.opacityOverLifetime||1),widthOverTrail:Zb(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]===i_.GRADIENT_COLOR&&(J.colorOverLifetime=Q.colorOverLifetime[1]),Q.colorOverTrail&&Q.colorOverTrail[0]===i_.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]===i_.CONSTANT_VEC3?W_(ee,ee,re[1]):$=Zb(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;W_(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.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)),l=u.next();!l.done;l=u.next()){s=l.value;n.push(s)}}catch(e){r={error:e}}finally{try{l&&!l.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 hL((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 l=this.particleLink,c=(i-s)/a.duration,f=this.timePassed,h=!1,p=function(){r.trails&&!h&&(h=!0,l.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,c,a,o)})))};if(this.ended){if(!a.looping)if(this.reusable);else if(0===a.endBehavior){var d=l.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=l.first;return r.emissionStopped||l.length===A&&e&&e.content[0]-s>f},_=0;_<T&&_<A&&!S();_++){(M=this.createPoint(v)).delay+=E+_*x,this.addParticle(M,A),this.lastEmitTime=f}for(var b=u.bursts,R=(null==b?void 0:b.length)-1,C=0;R>=0&&C<A&&!S();R--){var O=b[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(_=0;_<L.count&&C<A&&!S();_++){var M;(M=this.initPoint(this.shape.generate({total:L.total,index:L.index,burstIndex:_,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 l=this.getPointPosition(u);r.push({center:l,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],l=s[1];s[2];var c=s[3];if(!(u>this.timePassed))break;var f=this.getPointPosition(c),h=e.ray,p=!1;h&&(p=!!Eb(o,h.center,h.direction,f,e.radius)),p&&(e.removeParticle&&(r.removePoint(l),this.clearPointTrail(l),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(),l=1,c=n.lifetime.getValue(t);if(n.sizeAffectsWidth&&(l*=u[0]),n.sizeAffectsLifetime&&(c*=u[0]),n.parentAffectsPosition&&this.parentTransform){W_(a,a,this.parentTransform.position);var f=this.trailMesh.getPointStartPos(e);f&&ib(a,a,f)}this.trailMesh.addPoint(e,a,{color:s,lifetime:c,size:l,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],l=this.lastUpdate-n;t.assignWorldTRS(u);var c=Fb([0,0,0],this.options,a,l,i,u,r);if(s){var f=s.target||[0,0,0],h=s.curve.getValue(l/i),p=1-h;c[0]=c[0]*p+f[0]*h,c[1]=c[1]*p+f[1]*h,c[2]=c[2]*p+f[2]*h}return c},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=sb([],e.position,a),u=new gR({position:s,valid:!0}),l=e.direction;if(l=tb(mI,ub(mI,l,a)),r.startTurbulence&&r.turbulence){for(var c=0;c<3;c++)xI[c]=r.turbulence[c].getValue(i);var f=fb(AI,xI);l=tb(mI,J_(l,l,f))}var h,p=gI,d=TI;n.alignSpeedDirection?($_(d,l,3),this.upDirectionWorld||(this.upDirectionWorld=ub([],null!==(t=n.upDirection)&&void 0!==t?t:[0,0,1],a)),p=tb(p,ab(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=EI)[0]=m.animationDelay.getValue(i),h[1]=m.animationDuration.getValue(i),h[2]=m.cycles.getValue(i));var v=yI;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=vI;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 ob(E,l,o),r.particleFollowParent||(this.transform.assignWorldTRS([],[],xI),eb(g,g,xI)),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}(),mI=[0,0,0],vI=[0,0],yI=[0,0,0],gI=[0,0,0],TI=[0,0,0],xI=[0,0,0],EI=[0,0,0],AI=[];function SI(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 bI=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.stopParticleEmission=function(){this.content&&(this.content.emissionStopped=!0)},r.prototype.resumeParticleEmission=function(){this.content&&(this.content.emissionStopped=!1)},r.prototype.doCreateContent=function(e){return e_(this.particle),new dI(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)===s_.removeParticle,ray:e})}}},r}(TR),RI=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:[i_.RGBA_COLOR,[255,255,255,255]]},positionOverLifetime:{speedOverLifetime:1},sizeOverLifetime:{x:1,y:1}},s=r.engine.gpuCapability,u=s.level,l=(null!=i?i:{}).env,c=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=[i_.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=[i_.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:[i_.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,l,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=NC(MC)?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:KC,fragment:ZC,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,l,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,c.addShader(T)}})),p.forEach((function(t){var r,i;2===u?(cL(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),c.addShader(t)})),2===u&&h.forEach((function(e){e.content.options.meshSlots=[m,d]})),Promise.resolve()},r.prototype.onCompositionItemLifeBegin=function(e,t){t instanceof bI&&this.add(t.content)},r.prototype.onCompositionItemRemoved=function(e,t){t instanceof bI&&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 CI,OI=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return JA(t,e),t}(CR),LI=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.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 $O(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),II=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],l=s[1];if(n.shape){for(var c=n.shape,f=c.index,h=c.aPoint,p=new Float32Array(h),d=0;d<p.length;d+=6)p[d]*=u,p[d+1]*=l;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 _=4*(2*S+A),b=o?[0,0,1,1,i[0][4]]:i[2*S+A],R=b[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=b[0],I=b[1],P=b[4]?b[3]:b[2],M=b[4]?b[2]:b[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]*l,R[0]*P+L,R[1]*M+I,t,0,w[2]*u,w[3]*l,R[2]*P+L,R[3]*M+I,t,0,w[4]*u,w[5]*l,R[4]*P+L,R[5]*M+I,t,0,w[6]*u,w[7]*l,R[6]*P+L,R[7]*M+I,t,0),this.lineMode?T.push(_,1+_,1+_,3+_,3+_,2+_,2+_,_):T.push(_,1+_,2+_,2+_,1+_,3+_)}return{index:T,aPoint:g}},t}(BO),PI=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,l=e.fontSize,c=void 0===l?40:l,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=c,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!==y_.normal&&(this.fontOffset+=this.fontSize*Math.tan(.20943951))},MI=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 l=n.getImageData(0,0,a,u).data,c=l.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!==l[p+m]){d=!0;break}if(d)break;p+=f}for(r.ascent=s-h,p=c-f,d=!1,h=u;h>s;--h){for(m=0;m<f;m+=4)if(255!==l[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 NC(wC)?(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}(),wI=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];e.QTextWrapMode=void 0,(CI=e.QTextWrapMode||(e.QTextWrapMode={}))[CI.Default=0]="Default",CI[CI.Clip=1]="Clip",CI[CI.Ellipsis=2]="Ellipsis";var FI=function(){function t(t,r){var i,n,o,a,s,u,l,c,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!==(l=r.fontSize)&&void 0!==l?l:48,this.wrap=null!==(c=r.wrap)&&void 0!==c?c: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=MI.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)||wI.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)),l=u;this.wrap===e.QTextWrapMode.Ellipsis&&0===(l=this.replaceCharWithEllipsis(t,u,r)).length&&0!==i.length&&this.addEllipsisToChars(t,l,r),this.drawCharsFromLeft(t,l)},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),l={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(l),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}(),NI=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 DI(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 VI(e,t,r,i,n){return eS(this,void 0,void 0,(function(){var o,a,s,u,l,c,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],l=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(l)]:[2,UI(e).then(l)]):(c=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)?DI(e,{responseType:"blob"}).then(BI,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*c,'px"')).replace('height="'.concat(t.height,'px"'),'height="'.concat(t.height*c,'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*c,d.height=f.height*c,[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)*c,(t.y||0)*c,t.width*c/t.backgroundWidth*f.width,t.height*c/t.backgroundHeight*f.height),e(d)}))]}}))}))}function UI(e){return uR(e)?QR(e):Promise.resolve(e)}function BI(e){return new Promise((function(t,r){var i=new FileReader;i.readAsDataURL(e),i.onload=function(){t(i.result)},i.onerror=r}))}var kI=["serif","sans-serif","monospace","courier"],zI=800,GI=600,jI=new Map,XI=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(NC(wC))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 HI(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 YI(t,r,i,n,o){var a;return eS(this,void 0,void 0,(function(){var s,u,l,c,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,l=s,c=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,l*=r.height/i.height),(p=HI(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:c=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,l=a.x,c=a.y,f={weight:400,family:"serif",size:48,style:y_.normal};void 0!==a.f&&(f=n[a.f]);var h=a.n;h&&r&&r.hasOwnProperty(h)&&(u="".concat(r[h]));var p=new FI(u,{left:l,top:c,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===p_.display?p.wrap=e.QTextWrapMode.Default:a.of===p_.clip?p.wrap=e.QTextWrapMode.Clip:a.of===p_.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===m_.left?p.textAlign="left":a.a===m_.middle?p.textAlign="center":a.a===m_.right&&(p.textAlign="right"),f.style===y_.normal?p.fontStyle="normal":f.style===y_.italic?p.fontStyle="italic":f.style===y_.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:l})),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,l),t.background=c,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 WI(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,kI.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 ZI(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=jI.get(r.canvas))){var a=new NI(r.canvas,e,t,n,n,o);jI.set(r.canvas,a),i=a}}else{var s=XI.getCanvas();i=new NI(s,zI,GI,n,n,o)}return i}(zI,zI,o),void 0===t?[3,2]:[4,WI(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,YI(a,s,t,r,o)];case 4:return u.sent(),[2,a.renderCanvas];case 5:return[4,YI(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,ZI(e,t,r,{templateScale:null==i?void 0:i.templateScale,toData:!0},n)]:[2,VI(e,t,r,i,n)]}))}))}var KI=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?p_.display:a,u=e.textBaseline,l=void 0===u?d_.top:u,c=e.textAlign,f=void 0===c?m_.left:c,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=l,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}(),QI=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=XI.getCanvas(),XI.saveCanvas(n.canvas),n.context=n.canvas.getContext("2d",{willReadFrequently:!0}),n.engine=i.composition.getEngine(),n.textStyle=new PI(o),n.textLayout=new KI(o,a),n.text=o.text,n.mesh=new II(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=r.fontSize*n,s=i.lineHeight*n;this.char=this.text.split(""),this.canvas.width=o,this.canvas.height=i.height*n,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 u=[],l=(s-a)/3,c=0,f=i.getOffsetY(r)+l,h=[],p=[],d=0;d<this.char.length;d++){var m=this.char[d],v=t.measureText(m);((c+=i.letterSpace*n)+v.width>o&&d>0||"\n"===m)&&(u.push({y:f,width:c,chars:h,charOffsetX:p}),c=0,f+=s,h=[],p=[]),"\n"!==m&&(h.push(m),p.push(c),c+=v.width)}u.push({y:f,width:c,chars:h,charOffsetX:p}),u.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 y=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,y,{flipY:!0,magFilter:dS.LINEAR,minFilter:dS.LINEAR,wrapS:dS.REPEAT,wrapT:dS.REPEAT})),this.isDirty=!1}},t.prototype.getFontDesc=function(){var e=this.textStyle,t="".concat((e.fontSize*e.fontScale).toString(),"px ");return kI.includes(e.fontFamily)?t+=e.fontFamily:t+='"'.concat(e.fontFamily,'"'),e.textWeight!==v_.normal&&(t="".concat(e.textWeight," ").concat(t)),e.fontStyle!==y_.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}(rL),JI=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=Cb([0,0,0],i[0]/2,i[1]/2);return n.forEach((function(e){e.forEach((function(e){sb(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 QI(this.textContext,{emptyTexture:t},this)},r.prototype.createWireframeMesh=function(e,t){var r=new II(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),$I=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||t.keepResource?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 JI&&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 JI&&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 eP(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,BC.create(e,{geometry:t.geometry,material:n})}(e,t,GO(e.gpuCapability.level,{fragment:r.fragment},{ignoreBlend:!0}))}var tP=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=IO.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",TO(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",TO(this.prePassTexture));var t=[this.meshes[0],eP(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}(XC),rP=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 GC(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",TO(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",TO(this.prePassTexture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(XC);function iP(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(nP(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 nP(e,t){return Math.exp(-e*e/(2*t*t))/Math.sqrt(2*Math.PI)/t}var oP=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",TO(this.preDefaultPassAttachment.texture));var t=[eP(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},t}(XC),aP=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",TO(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",TO(this.uBlurSource));var t=[eP(e.engine,this.meshes[1],{fragment:this.fragShader})];e.renderMeshes(t)},t}(XC),sP=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",TO(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",TO(this.prePassTexture)),this.meshes[1].material.setVector2("uTexSize",TO(this.preDefaultPassAttachment.texture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(XC),uP=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",TO(this.prePassTexture)),this.meshes[1].material.setTexture("uFilterSource",this.prePassTexture),this.meshes[1].material.setTexture("uSamplerPre",this.prePassTexture),this.meshes[1].material.setVector2("uFilterSourceSize",TO(this.prePassTexture));var t=[this.meshes[0],this.meshes[1]];e.renderMeshes(t)},t}(XC);function lP(e,t,r){for(var i=Zb(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 cP=[1,1,1],fP=function(){function e(e,t){void 0===t&&(t={}),this.name=e,this.viewMatrix=I_(),this.projectionMatrix=I_(),this.viewProjectionMatrix=I_(),this.inverseViewMatrix=I_(),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,l=void 0===u?1:u,c=t.clipMode,f=void 0===c?t_.portrait:c,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:l,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=F_([],this.viewProjectionMatrix)),hR(this.inverseViewProjectionMatrix)},e.prototype.getModelViewProjection=function(e,t){return N_(e,this.viewProjectionMatrix,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&&yb(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;D_(this.projectionMatrix,t,r,i,n,o===t_.portrait),w_(this.inverseViewMatrix,this.getQuat(),a,cP),F_(this.viewMatrix,this.inverseViewMatrix),N_(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 hP,pP,dP,mP,vP,yP,gP,TP,xP,EP,AP,SP={lum:[function(t,r){var i=r.renderer,n=2===i.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,o=new rP(i,{name:"lumCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:n,magFilter:n}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:yC,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:yC}]}],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]],l=r.renderer,c=2===l.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,f=new rP(l,{name:"alphaFrameCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:c,magFilter:c}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{particle:{fragment:QC,uniformValues:{uTexRange:u}},mesh:{fragment:QC,shaderCacheId:"alpha-frame",materialStates:{blending:!1},uniformValues:{uTexRange:u}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[f]}}},function(){return[{fragment:QC,shaderCacheId:"alpha-frame"},{fragment:QC,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=[i_.CONSTANT_VEC3,n]);var a=Zb(o),s=new fP("camera_move"),u=[0,0,0],l=r.renderer,c=2===l.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,f=new rP(l,{name:"cameraCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:c,magFilter:c}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{vertex:$C,fragment:yC,shaderCacheId:"camera-move",materialStates:{blending:!1,depthTest:!1,culling:!1},variables:{uMoveCameraViewPro:function(e){s.copy(r.camera);var t=a.getValue(e);return W_(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:$C,fragment:yC,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),l=lP(a,o,!0),c=2===a.gpuCapability.level?dS.LINEAR:dS.NEAREST,f=new rP(s,{name:"alphaMaskCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:c,magFilter:c}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:JC,shaderCacheId:"alpha-mask",materialStates:{blending:!1,depthTest:!1,culling:!1},uniformValues:{uAlphaXSample:u,uAlphaYSample:l}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[f]}}},function(){return[{fragment:JC,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,l=i.waveMovement,c=i.strength,f=tb(s),h=[o[0],o[1],f[0],f[1]],p=Zb(u),d=Zb(l),m=Zb(c),v=2*Math.PI,y=r.renderer,g=2===y.engine.gpuCapability.level?dS.LINEAR:dS.NEAREST,T=new rP(y,{name:"distortionCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:g,magFilter:g}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{particle:{fragment:tO,vertex:rO,uniforms:{uPeriodValue:p,uMovementValue:d,uStrengthValue:m},uniformValues:{uWaveParams:h}},mesh:{shaderCacheId:"distortion",fragment:tO,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:tO,shaderCacheId:"distortion"},{fragment:tO,vertex:rO,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,l=void 0===u?1:u,c=i.colorThreshold,f=void 0===c?[255,255,255]:c,h=r.getEngine().gpuCapability.level,p=iP({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=A_(v),y=A_(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=Zb(s),A=Zb(l),S=new GC(d),_=new oP(m,{name:"threshold",attachments:[{texture:T}],viewport:g,clearAction:{colorAction:e.TextureLoadAction.clear}});_.pluginSystem=r.pluginSystem,_.fragShader=nO,_.preDefaultPassAttachment=S;var b=new aP(m,"H",[p.step,0],r.pluginSystem,p.shader,{name:"gaussianH",viewport:g,attachments:[{texture:x}],clearAction:{colorAction:e.TextureLoadAction.clear}},T);b.preDefaultPassAttachment=S;var R=new aP(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 sP(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:iO,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=iP({radius:void 0===t?30:t});return[{fragment:iO,shaderCacheId:"bloom-".concat(r.step)},{fragment:nO,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=iP({radius:i}),u=s.downSample,l=s.step,c=s.shader,f=Math.round(r.width/u),h=Math.round(r.height/u);1===n&&(h=A_(h),f=A_(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 GC(o,{}),y=new tP(a,"H",[0,l],r.pluginSystem,c,{name:"gaussianH",viewport:p,attachments:[{texture:m}],clearAction:{colorAction:e.TextureLoadAction.clear}});y.preDefaultPassAttachment=v;var g=new tP(a,"V",[l,0],r.pluginSystem,c,{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 rP(a,{name:"gaussianCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:T,magFilter:T}}],clearAction:{colorAction:e.TextureLoadAction.clear}},v);return x.preDefaultPassAttachment=v,{mesh:{fragment:yC,shaderCacheId:"gaussian-".concat(l),uniformValues:{uTexSize:[f,h]},materialStates:{blending:!1,culling:!1}},passSplitOptions:{attachments:[{texture:{format:dS.RGBA}}],prePasses:[y,g,x]}}},function(e){var t=iP({radius:e.radius});return[{fragment:yC,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 uP(i,{name:"delayCopyPass",attachments:[{texture:{format:dS.RGBA,minFilter:a,magFilter:a}}],clearAction:{colorAction:e.TextureLoadAction.clear}});return{mesh:{fragment:eO,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:eO,shaderCacheId:"delay"}]}]};
9
+ /*!
10
+ * Name: @galacean/effects-specification
11
+ * Description: Galacean Effects JSON Specification
12
+ * Author: Ant Group CO., Ltd.
13
+ * Version: v0.0.1
14
+ */!function(e){e.S="S",e.APlus="A+",e.A="A",e.BPlus="B+",e.B="B"}(hP||(hP={})),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"}(pP||(pP={})),function(e){e[e.DOUBLE=1032]="DOUBLE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK"}(dP||(dP={})),function(e){e[e.NONE=0]="NONE",e[e.MASK=1]="MASK",e[e.OBSCURED=2]="OBSCURED",e[e.REVERSE_OBSCURED=3]="REVERSE_OBSCURED"}(mP||(mP={})),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"}(vP||(vP={})),function(e){e[e.GYROSCOPE=0]="GYROSCOPE",e[e.SPINE=1]="SPINE"}(yP||(yP={})),function(e){e[e.CLICK=0]="CLICK",e[e.MESSAGE=1]="MESSAGE",e[e.DRAG=2]="DRAG"}(gP||(gP={})),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"}(TP||(TP={})),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"}(xP||(xP={})),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"}(EP||(EP={})),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"}(AP||(AP={}));var _P,bP,RP,CP,OP,LP,IP,PP,MP,wP,FP,NP,DP,VP,UP,BP,kP,zP=0;!function(e){e[e.portrait=1]="portrait",e[e.landscape=zP]="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"}(bP||(bP={})),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"}(RP||(RP={})),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"}(CP||(CP={})),function(e){e[e.destroy=0]="destroy",e[e.loop=5]="loop",e[e.forward=4]="forward"}(OP||(OP={})),function(e){e[e.destroyChildren=6]="destroyChildren"}(LP||(LP={})),function(e){e[e.none=0]="none",e[e.removeParticle=1]="removeParticle"}(IP||(IP={})),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"}(PP||(PP={})),function(e){e[e.box=2]="box",e[e.sphere=3]="sphere"}(MP||(MP={})),function(e){e.unlit="unlit",e.pbr="pbr",e.hair="hair"}(wP||(wP={})),function(e){e[e.opaque=100]="opaque",e[e.masked=101]="masked",e[e.translucent=102]="translucent",e[e.additive=103]="additive"}(FP||(FP={})),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"}(NP||(NP={})),function(e){e[e.display=0]="display",e[e.clip=1]="clip",e[e.ellipsis=2]="ellipsis"}(DP||(DP={})),function(e){e[e.top=0]="top",e[e.middle=1]="middle",e[e.bottom=2]="bottom"}(VP||(VP={})),function(e){e[e.left=0]="left",e[e.middle=1]="middle",e[e.right=2]="right"}(UP||(UP={})),function(e){e.normal="normal",e.bold="bold",e.lighter="lighter"}(BP||(BP={})),function(e){e.normal="normal",e.italic="italic",e.oblique="oblique"}(kP||(kP={}));var GP=function(){return GP=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},GP.apply(this,arguments)};function jP(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 XP(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 HP(e,t){if(!e.includes(t))return e.push(t),!0}function YP(e,t,r){if(e)for(var i in e)Object.hasOwnProperty.call(e,i)&&t.call(r,e[i],i);return e}function WP(e){if(Number.isFinite(e))return[RP.CONSTANT,e];if(e){if("lines"===e[0])return[RP.LINE,e[1]];if("curve"===e[0])return[RP.CURVE,e[1]];if("static"===e[0])return[RP.CONSTANT,e[1]]}}function ZP(e,t){return Array.isArray(e)&&"random"===e[0]?[RP.CONSTANT,e[1][t]]:WP(e)}function qP(e){return e&&"color"===e[0]?$P(e[1],!0):[1,1,1,1]}function KP(e,t){if(e){if("colors"===e[0])return[RP.COLORS,e[1].map((function(e){return $P(e,t)}))];if("gradient"===e[0])return JP(e[1],t);if("color"===e[0])return[RP.RGBA_COLOR,$P(e[1],t)]}}function QP(e){return e&&"random"===e[0]?[RP.RANDOM,e[1]]:WP(e)}function JP(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=$P(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]})),[RP.GRADIENT_COLOR,r]}}function $P(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 eM(e,t){return Array.isArray(e)?("gradient"===e[0]||"color"===e[0])&&JP(e[1],t):JP(e,t)}function tM(e){if(e){if(3===e.length)return[RP.CONSTANT_VEC3,e];if("path"===e[0])return[RP.LINEAR_PATH,e[1]];if("bezier"===e[0])return[RP.BEZIER_PATH,e[1]]}}function rM(e){var t,r;try{for(var i=jP(Object.entries(e)),n=i.next();!n.done;n=i.next()){var o=XP(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 iM(e){var t,r;try{for(var i=jP(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}var nM=Math.cos,oM=Math.sin,aM=Math.PI/180,sM=180/Math.PI;function uM(e){var t,r=e.options,i=e.transform,n={type:vP.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=GP(GP({},e.shape),{type:vP[o]}),e.shape.upDirection){var a=XP(e.shape.upDirection,3),s=a[0],u=a[1],l=a[2];0===s&&0===u&&0===l&&delete n.upDirection}}r.startTurbulence&&(n.turbulenceX=QP(r.turbulenceX),n.turbulenceY=QP(r.turbulenceY),n.turbulenceZ=QP(r.turbulenceZ));var c=e.emission;c.bursts&&c.bursts.length>0&&(c.bursts=c.bursts.map((function(e){return rM(e)}))),c.burstOffsets&&c.burstOffsets.length>0&&(c.burstOffsets=c.burstOffsets.map((function(e){return rM(e)}))),c.rateOverTime&&(c.rateOverTime=QP(c.rateOverTime));var f={renderer:e.renderer,shape:n,splits:e.splits,emission:c,options:{startLifetime:QP(r.startLifetime),start3DSize:!!r.start3DSize,startSize:QP(r.startSize),startSizeX:QP(r.startSizeX),startSizeY:QP(r.startSizeY),sizeAspect:QP(r.sizeAspect),maxCount:r.maxCount,startDelay:QP(r.startDelay),startColor:KP(r.startColor,!0),startRotationZ:QP(r.startRotation||r.startRotationZ),particleFollowParent:r.particleFollowParent}};if(r.start3DRotation&&(f.options.startRotationX=QP(r.startRotationX),f.options.startRotationY=QP(r.startRotationY)),e.filter){var h={};YP(e.filter,(function(e,t){var r;h[t]=(r=e,Array.isArray(r)&&"string"==typeof r[0]&&(QP(r)||tM(r)||KP(r))||r)})),f.filter=h}i&&i.path&&(f.emitterTransform={path:tM(i.path)});var p=e.sizeOverLifetime;p&&(p.separateAxes?f.sizeOverLifetime={separateAxes:!0,x:QP(p.x),y:QP(p.y)}:f.sizeOverLifetime={size:QP(p.size)});var d=e.velocityOverLifetime||{},m=d.speedOverLifetime;m=m?WP(m):void 0,f.positionOverLifetime={gravity:r.gravity,gravityOverLifetime:WP(r.gravityModifier),startSpeed:QP(r.startSpeed),speedOverLifetime:m,asMovement:d.asMovement,linearX:QP(d.linearX),linearY:QP(d.linearY),linearZ:QP(d.linearZ),asRotation:d.asRotation,orbCenter:d.orbCenter,orbitalX:QP(d.orbitalX),orbitalY:QP(d.orbitalY),orbitalZ:QP(d.orbitalZ),forceTarget:d.forceTarget,target:d.target,forceCurve:WP(d.forceCurve)},iM(f.positionOverLifetime);var v=e.rotationOverLifetime;v&&(f.rotationOverLifetime={separateAxes:v.separateAxes,asRotation:v.asRotation,z:QP(v.separateAxes?v.z:v.angularVelocity)},v.separateAxes&&(f.rotationOverLifetime.y=WP(v.y),f.rotationOverLifetime.x=WP(v.x)));var y=e.colorOverLifetime;if(y){var g=f.colorOverLifetime={opacity:WP(y.opacity)};y.color&&(g.color=eM(y.color))}var T=e.textureSheetAnimation;T&&(f.textureSheetAnimation={row:T.row,col:T.col,total:T.total,animate:T.animate,cycles:WP(T.cycles),animationDelay:ZP(T.animationDelay,0),animationDuration:ZP(T.animationDuration,0)});var x=e.trails;x&&(f.trails={lifetime:QP(x.lifetime),dieWithParticles:x.dieWithParticles,maxPointPerTrail:x.maxPointPerTrail,minimumVertexDistance:x.minimumVertexDistance,widthOverTrail:WP(x.widthOverTrail),colorOverTrail:x.colorOverTrail&&eM(x.colorOverTrail,!1),blending:x.blending,colorOverLifetime:x.colorOverLifetime&&eM(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:QP(x.opacityOverLifetime)}),f.trails&&iM(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:tM(null===(r=e.transform)||void 0===r?void 0:r.path),gravity:i.gravity,gravityOverLifetime:WP(i.gravityModifier),direction:i.direction,startSpeed:i.startSpeed,asMovement:n.asMovement,linearX:WP(n.linearX),linearY:WP(n.linearY),linearZ:WP(n.linearZ),asRotation:n.asRotation,orbCenter:n.orbCenter,orbitalX:WP(n.orbitalX),orbitalY:WP(n.orbitalY),orbitalZ:WP(n.orbitalZ),speedOverLifetime:WP(n.speedOverLifetime)};iM(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=WP(s.x),u.y=WP(s.y),u.z=WP(s.z)):u.z=WP(s.angularVelocity)}var l=e.colorOverLifetime;if(l){var c=a.colorOverLifetime={opacity:WP(l.opacity)};l.color&&(c.color=eM(l.color))}var f=e.sizeOverLifetime;return f&&(a.sizeOverLifetime={separateAxes:f.separateAxes,size:WP(f.size),x:WP(f.x),y:WP(f.y),z:WP(f.z)}),a}function cM(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 fM=["strength","bloomAddon","colorAddon","period","waveMovement","colorThreshold","xOpacity","yOpacity","feather"],hM=["path","position"];function pM(e){return e.compositions.forEach((function(e){e.items.forEach((function(e){e.type===xP.null&&e.endBehavior===OP.destroy&&(e.endBehavior=OP.forward)}))})),e.version="2.1",e}var dM=/^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/,mM=/^(\d+)\.(\d+)$/,vM=!1;function yM(e){var t,r;if(!e||"object"!=typeof e)throw Error("expect a json object");if(dM.test(e.version))return vM="0"===(null===(t=/^(\d+)/.exec(e.version))||void 0===t?void 0:t[0]),pM(function(e){var t,r;gM="1.0";var i=e.plugins||[];(null===(t=e.bins)||void 0===t?void 0:t.length)&&(gM="1.3");var n=(e.requires||[]).slice(),o=e.images.map((function(t,r){return TM(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:gM,playerVersion:null!==(r=e.playerVersion)&&void 0!==r?r:{web:"",native:""},compositionId:e.compositionId+"",compositions:e.compositions.map((function(e){return xM(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=mM.exec(e.version))||void 0===r?void 0:r[1];if(i)return Number(i)<2?pM(e):e;throw Error("invalid json version "+e.version)}var gM="1.0";function TM(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 xM(e,t){var r;void 0===t&&(t={});var i={id:e.id+"",camera:Object.assign({clipMode:zP},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 EM,AM=[0,0,0,1],SM=.5;function _M(e,t){var r,i,n;void 0===t&&(t={});var o,a,s,u,l,c,f=xP.base,h=e.endBehavior,p=NaN;if(e.content?(f=e.type||xP.plugin,c=e.pn,l=e.pluginName,s=e.content,a=e.content,isNaN(c)&&!l&&(l=s.options.type),e.duration&&(p=e.duration),o=e.transform||y(a.transform),f===xP.filter&&(gM<"1.1"&&(gM="1.1"),(s=cM(a,o)).filter=function(e){var t={};return YP(e,(function(e,r){fM.includes(r)?t[r]=WP(e):hM.includes(r)?t[r]=tM(e):t[r]=e})),t}(a.filter))):e.particle?(f=xP.particle,o=y((a=e.particle).transform,vM,!0),s=uM(a)):e.sprite?(f=xP.sprite,s=cM(a=e.sprite,o=y(a.transform,!1,!0))):e.cal?(f=xP.null,s=lM(a=e.cal,o=y(a.transform,!1,!0))):e.ui?(f=xP.interact,o=y((a=e.ui).transform),s=function(e){var t,r=e.options;switch(r.type){case"click":t={type:gP.CLICK,showPreview:r.showPreview,previewColor:r.previewColor&&qP(r.previewColor),behavior:r.behavior||TP.NOTIFY};break;case"drag":t={type:gP.DRAG,enableInEditor:!!r.enableInEditor,dxRange:r.dxRange,dyRange:r.dyRange,target:r.target};break;case"message":t={type:gP.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=xP.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:tM(null===(r=e.transform)||void 0===r?void 0:r.path),linearX:WP(null==o?void 0:o.translateX),linearY:WP(null==o?void 0:o.translateY),linearZ:WP(null==o?void 0:o.translateZ)};iM(a),n.positionOverLifetime=a}var s=e.rotationOverLifetime;if(s){var u={separateAxes:s.separateAxes,x:WP(null==s?void 0:s.rotateX),y:WP(null==s?void 0:s.rotateY),z:s.separateAxes?WP(null==s?void 0:s.rotateZ):WP(s.rotation)};iM(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]==SM&&d[1]==SM?delete s.renderer.anchor:t.requires&&HP(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]?OP.loop:OP.destroy:OP.loop:h||(null===(n=null==a?void 0:a.options)||void 0===n?void 0:n.endBehavior)||OP.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 l?t.plugins?(HP(t.plugins,l),v.pn=t.plugins.indexOf(l)):v.pluginName=l:Number.isInteger(c)&&(v.pn=c),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=AM,s=i.rotation[0],u=i.rotation[1],l=i.rotation[2],c=nM(s*aM/2),f=nM(u*aM/2),h=nM(l*aM/2),p=oM(s*aM/2),d=oM(u*aM/2),m=oM(l*aM/2),a[0]=p*f*h+c*d*m,a[1]=c*d*h-p*f*m,a[2]=c*f*m+p*d*h,a[3]=c*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,l=r*a,c=i*a,f=i*s,h=n*u,p=o*u,d=1-f-h,m=c-p,v=c+p,y=1-l-h,g=n*a-o*s,T=n*s+o*a,x=1-l-f;return e[1]=Math.asin(function(e,t,r){return e>r?r:e<t?t:e}(-g,-1,1))*sM,Math.abs(g)<.9999999?(e[0]=Math.atan2(T,x)*sM,e[2]=Math.atan2(v,d)*sM):(e[0]=0,e[2]=Math.atan2(-m,y)*sM),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,l,c,f,h,p,d,m;return{}}}var bM=((EM={})[TS.S]=[TS.S,TS.BPlus,TS.APlus],EM[TS.A]=[TS.A,TS.BPlus,TS.APlus],EM[TS.B]=[TS.B,TS.BPlus],EM);function RM(e,t){if(!e||!t)return!0;var r=bM[t];return!!r&&r.includes(e)}var CM=0,OM=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,l=r.compositionId;if(!n)throw new Error("scene.textures expected");var c=n.map((function(e){return e&&(e instanceof iC?e:iC.create(t,e))}));e.textureOptions=c;var f=s.find((function(e){return e.id===l}));if(null==c||c.forEach((function(e){return null==e?void 0:e.initialize()})),!f)throw new Error("Invalid composition id: "+l);CM=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=c,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,l=this.assembleItems();return{id:t,duration:r,name:i,endBehavior:isNaN(n)?1:n,items:l,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 l=$A({},e.content);if(l&&(o.content=$A({},l),RM(s,t.renderLevel))){var c=o.content;if(o.type=u,c.renderer){if(c.renderer=t.changeTex(c.renderer),!c.renderer.mask){var f=c.renderer.maskMode;f===AS.MASK?c.renderer.mask=++i:f!==AS.OBSCURED&&f!==AS.REVERSE_OBSCURED||(c.renderer.mask=i)}var h=c.splits&&!c.textureSheetAnimation&&c.splits[0];Number.isInteger(c.renderer.shape)?c.renderer.shape=iI(null===(n=t.jsonScene)||void 0===n?void 0:n.shapes[c.renderer.shape],h):c.renderer.shape&&fR(c.renderer.shape)&&(c.renderer.shape=iI(c.renderer.shape,h))}else o.content.renderer={order:0};c.trails&&(c.trails=t.changeTex(c.trails)),c.filter&&(c.filter=$A({},c.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,_=t.jsonScene.plugins,b=void 0===_?[]:_;o.name=p,o.delay=m,o.id=v,y&&(o.parentId=y),o.refCount=S,o.duration=g,o.listIndex=CM++,o.endBehavior=T,x?o.pluginName=x:void 0!==E&&Number.isInteger(E)&&(o.pluginName=b[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 LM(e){return fR(e)&&"jsonScene"in e}var IM=1,PM=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=IM++,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,l,c,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=[],l=null==t?void 0:t.engine.gpuCapability,c=null!==(n=null===(i=null==l?void 0:l.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 b.loadJSON(e)}))];case 2:o=R.sent(),R.label=3;case 3:return[4,d("processJSON",(function(){return b.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 b.processBins(m)})),d("processImages",(function(){var e;return b.processImages(v,n,null!==(e=null==l?void 0:l.detail.compressedTexture)&&void 0!==e?e:0)})),d("".concat(c?"async":"sync"," compile"),(function(){return b.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 b.processFontURL(g)}))];case 6:return R.sent(),[4,d("processTextures",(function(){return b.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 b.pluginSystem.loadResources(S,b.options)}))];case 8:return R.sent(),_=performance.now()-s,console.debug("".concat(a,": ").concat(_.toFixed(4),"ms, ").concat(u.join(" "))),window.clearTimeout(f),S.totalTime=_,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(l){switch(l.label){case 0:return t=yM(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 l.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];RM(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(RM(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("Invalid fonts source: ".concat(e.fontURL)),[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,l=this;return tS(this,(function(c){return n=this.options,o=n.useCompressedTexture,a=n.variables,s=this.baseUrl,u=t.map((function(t,n){return eS(l,void 0,void 0,(function(){var u,l,c,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,l=t.webp,c=new URL(u,s).href,f=l&&new URL(l,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=HI(h,a))instanceof Array))return[3,6];m=h.background.name,C.label=1;case 1:return C.trys.push([1,3,,5]),_={},[4,QR(d[0])];case 2:return _.image=C.sent(),_.url=d[0],p=_,[3,5];case 3:return C.sent(),b={},[4,QR(d[1])];case 4:return b.image=C.sent(),b.url=d[1],p=b,[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(c,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(c));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===OO.ASTC?T=g.astc:i===OO.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(c,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 l=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({},aC(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 l.sourceType===e.TextureSourceType.compressed?l:$A($A({},l),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 MM=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.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),wM=1,FM=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.keepResource,n=e.reusable,o=void 0!==n&&n,a=e.baseRenderOrder,s=void 0===a?0:a,u=e.renderer,l=e.handlePlayerPause,c=e.handleMessageItem,f=e.handleEnd,h=e.event,p=e.width,d=e.height;this.compositionSourceManager=new OM(t,u.engine),t.jsonScene.imgUsage=void 0,i||(t.textures=void 0,t.consumed=!0);var m=this.compositionSourceManager,v=m.sourceContent,y=m.pluginSystem,g=m.imgUsage,T=m.totalTime,x=m.renderLevel;e_(v);var E=new MM(v,this),A=!o&&g;this.globalVolume=v.globalVolume,this.width=p,this.height=d,this.renderOrder=s,this.id=wM++,this.renderer=u,this.texInfo=null!=A?A:{},this.event=h,this.statistic={loadTime:null!=T?T:0,loadStart:null!==(r=t.startTime)&&void 0!==r?r:0,firstFrameTime:0},this.reusable=o,this.renderLevel=x,this.handlePlayerPause=l,this.handleMessageItem=c,this.handleEnd=f,this.rootTransform=new gR,E.transform=this.rootTransform,this.autoRefTex=!i&&A&&5!==E.endBehavior,this.content=E,this.name=E.name,this.rootTransform.name=this.name,this.pluginSystem=y,this.pluginSystem.initializeComposition(this,t),this.camera=new fP(this.name,$A($A({},null==v?void 0:v.camera),{aspect:p/d})),this.url=t.url,this.assigned=!0,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.restart=function(){this.content.reset(),this.prepareRender(),this.reset(),this.rootTransform.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.play=function(){this.paused&&this.resume(),this.content.start()},t.prototype.pause=function(){this.paused=!0},t.prototype.resume=function(){this.paused=!1},t.prototype.gotoAndPlay=function(e){},t.prototype.gotoAndPause=function(e){},t.prototype.start=function(){this.content.start()},t.prototype.createRenderFrame=function(){this.renderFrame=new gO({camera:this.camera,renderer:this.renderer,keepColorBuffer:this.keepColorBuffer,globalVolume:this.globalVolume}),this.renderFrame.cachedTextures=this.textures},t.prototype.setTime=function(e){},t.prototype.forwardTime=function(e){var t=Math.round(1e3*e);if(t){for(var r=t<0,i=Math.abs(t),n=r?-15:15;i>15;i-=15)this.update(n);if(i>0){n=r?-i:i;this.update(n)}}},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(){var e=this.content,t=e.ended,r=e.endBehavior;return t&&(!r||3===r)},t.prototype.update=function(e){if(this.assigned&&!this.paused){this.shouldRestart()&&this.restart();var t=this.content.getUpdateTime(e*this.speed);this.updateVideo(),this.content.onUpdate(t),this.loaderData.spriteGroup.onUpdate(t),this.updateCamera(),this.shouldDispose()?this.dispose():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 xb((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],l=s[1],c=xb((t-s[2])/u,(r-s[3])/l,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(Ob(g,c.center,c.direction,A,x),g.length){y=!0,o.push(g);break}}else if(v.type===e.HitTestType.box){var S=v.center,_=v.size;Ab(g,c.center,c.direction,S,_),g.length&&(y=!0,o.push(g))}else if(v.type===e.HitTestType.sphere){S=v.center;var b=v.radius;Eb(g,c.center,c.direction,S,b),g.length&&(y=!0,o.push(g))}else if(v.type===e.HitTestType.custom){var R=v.collect(c,[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===bS.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===bS.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("Update disposed composition: ".concat(r.name,"."))},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.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}();var NM,DM,VM=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("Release GPU memory: ".concat(e.join(", "))),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}(),UM=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=E_(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}();_R("camera",LR,IR,!0),_R("sprite",qO,iL,!0),_R("particle",RI,bI,!0),_R("cal",OI,LI,!0),_R("interact",DO,FO,!0),_R("filter",qO,oL,!0),_R("text",$I,JI,!0),wS(SP);var BM=((NM={})[dS.RGBA]=34842,NM[dS.RGB]=34843,NM[dS.ALPHA]=33325,NM[dS.RED]=33325,NM[dS.LUMINANCE_ALPHA]=33327,NM[dS.LUMINANCE]=33325,NM),kM=((DM={})[dS.RGBA]=34836,DM[dS.RGB]=34837,DM[dS.ALPHA]=33326,DM[dS.RED]=33326,DM[dS.LUMINANCE_ALPHA]=33328,DM[dS.LUMINANCE]=33326,DM),zM=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&&WM(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,l=this.pipelineContext.gl,c=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,_=A.type,b=A.internalFormat,R=0,C=0;if(this.bind(f===e.TextureSourceType.video),_===dS.HALF_FLOAT?((_=c.halfFloatTexture)||console.error("half float texture is not support"),vS(l)&&b===S&&(S===dS.LUMINANCE&&(S=dS.RED),b=BM[S]),c.halfFloatLinear||(u.minFilter=u.magFilter=l.NEAREST,console.warn("half float linear not support,change to NEAREST"))):_===l.FLOAT&&((_=c.floatTexture)||console.error("float texture is not support"),vS(l)&&b===S&&(S===dS.LUMINANCE&&(S=dS.RED),b=kM[S]),c.floatLinear||(u.minFilter=l.NEAREST,u.magFilter=l.NEAREST,console.warn("float linear not support,change to NEAREST"))),void 0===u.premultiplyAlpha&&(u.premultiplyAlpha=!1),l.pixelStorei(l.UNPACK_PREMULTIPLY_ALPHA_WEBGL,u.premultiplyAlpha),void 0===u.flipY&&(u.flipY=!1),l.pixelStorei(l.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)&&l.texImage2D(s,0,b,R,C,0,S,_,null));else if(f===e.TextureSourceType.data)s===l.TEXTURE_CUBE_MAP?T.forEach((function(e,t){var r=iS(a.texImage2DData(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,b,S,_,e),2),i=r[0],n=r[1];R=Math.max(i,R),C=Math.max(n,C)})):(r=iS(this.texImage2DData(l,s,0,b,S,_,h),2),R=r[0],C=r[1]);else if(f===e.TextureSourceType.image||f===e.TextureSourceType.video){if(s===l.TEXTURE_CUBE_MAP)p.forEach((function(e,t){var r=iS(a.texImage2D(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,b,S,_,e),2),i=r[0],n=r[1];R=Math.max(i,R),C=Math.max(n,C)}));else if(s===l.TEXTURE_2D){var O=null!=d?d:m;i=iS(this.texImage2D(l,s,0,b,S,_,O),2),R=i[0],C=i[1]}x&&(GM(R)&&GM(C)||vS(l))&&l.generateMipmap(s)}else if(f===e.TextureSourceType.mipmaps){var L;s===l.TEXTURE_2D?v.forEach((function(e,t){var r;L="data"in e?a.texImage2DData(l,s,t,b,S,_,e):a.texImage2D(l,s,t,b,S,_,e),0===t&&(r=iS(L,2),R=r[0],C=r[1])})):s===l.TEXTURE_CUBE_MAP&&y.forEach((function(e,t){e.forEach((function(e,r){var i;L="data"in e?a.texImage2DData(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+r,t,b,S,_,e):a.texImage2D(l,l.TEXTURE_CUBE_MAP_POSITIVE_X+r,t,b,S,_,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){l.compressedTexImage2D(s,t,b,e.width,e.height,0,e.data)})));this.width=R,this.height=C,this.setTextureFilters(l,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,l=this.engine.gpuCapability;this.target===e.TEXTURE_2D&&l.setTextureAnisotropic(e,this.target,n);var c=vS(e)||GM(this.width)&&GM(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,c?a:e.CLAMP_TO_EDGE),e.texParameteri(t,e.TEXTURE_WRAP_T,c?u:e.CLAMP_TO_EDGE)},r.prototype.texImage2D=function(t,r,i,n,o,a,s){var u,l=this.source,c=l.sourceType,f=l.minFilter,h=l.magFilter;l.flipY;var p=l.wrapS,d=l.wrapT,m=null!==(u=this.engine.gpuCapability.detail.maxTextureSize)&&void 0!==u?u:2048,v=s;if(c!==e.TextureSourceType.video){var y=f!==t.NEAREST||h!==t.NEAREST||p!==t.CLAMP_TO_EDGE||d!==t.CLAMP_TO_EDGE;(y=y||s.width>m||s.height>m)&&(v=this.resizeImage(s))}t.texImage2D(r,i,n,o,a,v);var g=[v.width,v.height];if(c===e.TextureSourceType.video){var T=s;return[T.videoWidth,T.videoHeight]}return g},r.prototype.texImage2DData=function(e,t,r,i,n,o,a){var s=a.data,u=a.width,l=a.height,c=n===e.UNSIGNED_BYTE?new Uint8Array(s.buffer,s.byteOffset,s.byteLength/s.BYTES_PER_ELEMENT):s;return e.texImage2D(t,r,i,u,l,0,n,o,c),[u,l]},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||A_(n)),s=Math.min(t,i||A_(o));if(s!==o||a!==n){var u=document.createElement("canvas"),l=u.getContext("2d");return u.width=a,u.height=s,null==l||l.drawImage(e,0,0,n,o,0,0,a,s),console.warn("image resize from ".concat(n,"x").concat(o," to ").concat(a,"x").concat(s)),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,lC().reload(this)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},r.prototype.offloadData=function(){if(this.initialized&&lC().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("this this texture has been destroyed")},this.initialize=dR,void 0!==this.engine&&this.engine.removeTexture(this)},r}(iC);function GM(e){return 0==(e&e-1)&&0!==e}var jM,XM=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&&WM(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}(),HM=1,YM=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 zM(t,{data:r,sourceType:e.TextureSourceType.data,format:n.LUMINANCE,internalFormat:n.LUMINANCE,type:n.UNSIGNED_BYTE}),this.emptyTexture2D.initialize(),this.emptyTextureCube=new zM(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"+HM,HM++}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,l=r.mode,c=r.drawCount;if(s){var f=s.type,h=s.elementCount;(c=isNaN(c)?h:c)>0&&a.drawElements(l,c,f,null!=u?u:0)}else c>0&&a.drawArrays(l,u,c);null==o||o.unbind()}else console.warn("Material "+i.name+" 的shader着色器程序未初始化。")}else console.warn("GLGPURenderer没有绑定gl对象, 无法绘制geometry")},t.prototype.createGLFrameBuffer=function(e,t){var r=this.gl.createFramebuffer();return r&&(DS(this.frameBuffers,e),WM(r,t,t)),r},t.prototype.createVAO=function(e){return new XM(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("gl lost, destroy glRenderer by default",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 WM(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 ZM,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,l=t.data,c=t.elementCount,f=function(e){var t,r;return null!==(r=null===(t=KM[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,l?this.bufferData(l):c&&this.bufferData(f*c)}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&&WM(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}(),KM=((jM={})[dS.INT]=Int32Array,jM[dS.FLOAT]=Float32Array,jM[dS.SHORT]=Int16Array,jM[dS.BYTE]=Int8Array,jM[dS.UNSIGNED_BYTE]=Uint8Array,jM[dS.UNSIGNED_INT]=Uint32Array,jM[dS.UNSIGNED_SHORT]=Uint16Array,jM);var QM=((ZM={})[Uint8Array.BYTES_PER_ELEMENT]=dS.UNSIGNED_BYTE,ZM[Uint16Array.BYTES_PER_ELEMENT]=dS.UNSIGNED_SHORT,ZM[Uint32Array.BYTES_PER_ELEMENT]=dS.UNSIGNED_INT,ZM),JM=1,$M=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,l=r.name,c=void 0===l?"effectsGeometry:".concat(JM++):l,f=r.bufferUsage,h=void 0===f?dS.STATIC_DRAW:f;(i=e.call(this,c)||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,l=void 0===u?dS.FLOAT:u,c=s.releasable,f=t.data;if(!l||"dataSource"in t||f||(f=PC(l)),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!=l?l:h,normalize:!!a,dataSource:e},y[e]=null!=c&&c,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:l,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;e_(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*LC[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=QM[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 l=s.start*a.BYTES_PER_ELEMENT+a.byteOffset,c=s.end-s.start+1,f=new a.constructor(a.buffer,l,c);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}(IC),ew=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}(),tw=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 ew,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),l=u.next();!l.done;l=u.next())a=l.value,this.checkUniform(a)}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}try{for(var c=rS(t.samplers),f=c.next();!f.done;f=c.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=c.return)&&o.call(c)}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]||(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]||(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;e_(i);var n=new r(i,t);return n.glMaterialState=Object.assign(new ew,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=I_(),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}(vC),rw=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 $M(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 tw(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 BC(i,{name:t,geometry:n,material:a,priority:0});return new iw(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}(),iw=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}(XC),nw=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=[],e_(e),this.gl=fS(e,t,r),this.contextLostListener=function(e){var t,r;try{for(var n=rS(i.lostHandlers),o=n.next();!o.done;o=n.next()){o.value.lost(e)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},this.contextRestoredListener=function(e){var t,r;try{for(var n=rS(i.restoreHandlers),o=n.next();!o.done;o=n.next()){o.value.restore()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}},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}(),ow=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("Invalid render buffer size: ".concat(e,"x").concat(t))}}else console.error("Can't set size for uninitialized render buffer")},t.prototype.dispose=function(){this.renderer&&(this.renderer.deleteGLRenderBuffer(this),this.renderer=null,this.buffer=null),this.destroyed=!0,this.initialize=dR},t}(AO),aw=1,sw=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,l=r.viewportScale,c=void 0===l?1:l,f=r.storeAction,h=r.name,p=void 0===h?"GLFrameBuffer".concat(aw++):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=c,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 l=null===(i=t.depthStencilAttachment)||void 0===i?void 0:i.texture,c=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 ow))throw Error("invalid depth stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new ow({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 ow))throw Error("invalid depth attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new ow({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 ow))throw Error("invalid stencil attachment storage");this.depthStencilRenderBuffer=a.storage,this.externalStorage=!0}else this.depthStencilRenderBuffer=new ow({attachment:dS.STENCIL_ATTACHMENT,format:dS.STENCIL_INDEX8,storageType:f},n.glRenderer);else if(f===e.RenderPassAttachmentStorageType.depth_16_texture){if(!c)throw Error("depth texture is not support in framebuffer");this.depthTexture=null!=l?l:new zM(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(!c)throw Error("depth stencil texture is not support in framebuffer");this.depthTexture=this.stencilTexture=null!=l?l:new zM(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 l=this.renderer.glRenderer.emptyTexture2D.textureBuffer;Object.keys(r.textureUnitDict).forEach((function(t){var i=r.textureUnitDict[t];i!==l&&i&&e.attachmentTextures.includes(i)&&(r.activeTexture(+t),e.renderer.glRenderer.emptyTexture2D.bind())}));for(var c=0;c<4;c++)r.activeTexture(t.TEXTURE0+c),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),l=u.next();!l.done;l=u.next()){l.value.initialize()}}catch(e){t={error:e}}finally{try{l&&!l.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}(IO);var uw,lw,cw=function(e){for(var t=5381,r=e.length;r;)t=33*t^e.charCodeAt(--r);return t>>>0},fw=((uw={})[dS.FLOAT]=1,uw[dS.INT]=1,uw[dS.UNSIGNED_INT]=1,uw[dS.SHORT]=1,uw[dS.BOOL]=1,uw[dS.UNSIGNED_SHORT]=1,uw[dS.FLOAT_VEC2]=2,uw[dS.FLOAT_VEC3]=3,uw[dS.FLOAT_VEC4]=4,uw[dS.FLOAT_MAT2]=4,uw[dS.FLOAT_MAT3]=9,uw[dS.FLOAT_MAT4]=16,uw[dS.FLOAT_MAT2x3]=6,uw[dS.FLOAT_MAT2x4]=8,uw[dS.FLOAT_MAT4x3]=12,uw[dS.FLOAT_MAT4x2]=8,uw[dS.FLOAT_MAT3x4]=12,uw[dS.FLOAT_MAT3x2]=6,uw[dS.INT_VEC2]=2,uw[dS.INT_VEC3]=3,uw[dS.INT_VEC4]=4,uw[dS.UNSIGNED_INT_VEC2]=2,uw[dS.UNSIGNED_INT_VEC3]=3,uw[dS.UNSIGNED_INT_VEC4]=4,uw[dS.BOOL_VEC2]=2,uw[dS.BOOL_VEC3]=3,uw[dS.BOOL_VEC4]=4,uw),hw=vw(Float32Array),pw=vw(Int32Array),dw=vw(Uint8Array);function mw(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,l=o.buffer=new e(s*u),c=n[0]||0,f=0;f<s;f++)l[f*u]=a[f+c];o.start+=c*u}}else o.buffer=new e([t]);return o}}function vw(e){return function(t,r,i,n){for(var o=r[8],a=r[2],s=r[5],u=1===a?o:r[4],l=s?u/s:1,c=u/e.BYTES_PER_ELEMENT/l,f=o/e.BYTES_PER_ELEMENT/c,h=fw[r[0]],p=h/l,d=(n[0]||0)*h,m=n[1]?l*n[1]:f,v=new e(c*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+=c,x+=p}return y}}function yw(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=[],l=0;l<s.length;l++){var c=e.getActiveUniform(t,s[l]).name.replace("[0]","");a.uniforms[c]=[0,0,0,0,0,0,0,l,0],u[l]=c,i.push(c)}[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(l=0;l<u.length;l++){var f=a.uniforms[u[l]],h=a.uniforms[u[l+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("+"),cw("".concat(t,"+"),"".concat(r,"+"),"".concat(n.length,"+"))}(a)+""},a=0;a<n;++a)o(a);return{blockSpecs:r,blockUniformNames:i}}(lw={})[dS.FLOAT]=mw(Float32Array),lw[dS.INT]=mw(Int32Array),lw[dS.UNSIGNED_INT]=mw(Uint32Array),lw[dS.SHORT]=mw(Int16Array),lw[dS.BOOL]=mw(Uint8Array),lw[dS.UNSIGNED_SHORT]=mw(Uint16Array),lw[dS.FLOAT_VEC2]=hw,lw[dS.FLOAT_VEC3]=hw,lw[dS.FLOAT_VEC4]=hw,lw[dS.FLOAT_MAT2]=hw,lw[dS.FLOAT_MAT3]=hw,lw[dS.FLOAT_MAT4]=hw,lw[dS.FLOAT_MAT2x3]=hw,lw[dS.FLOAT_MAT2x4]=hw,lw[dS.FLOAT_MAT4x3]=hw,lw[dS.FLOAT_MAT4x2]=hw,lw[dS.FLOAT_MAT3x4]=hw,lw[dS.FLOAT_MAT3x2]=hw,lw[dS.INT_VEC2]=pw,lw[dS.INT_VEC3]=pw,lw[dS.INT_VEC4]=pw,lw[dS.UNSIGNED_INT_VEC2]=pw,lw[dS.UNSIGNED_INT_VEC3]=pw,lw[dS.UNSIGNED_INT_VEC4]=pw,lw[dS.BOOL_VEC2]=dw,lw[dS.BOOL_VEC3]=dw,lw[dS.BOOL_VEC4]=dw;var gw=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=yw(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 XM(this.engine,"".concat(e.name,"-").concat(n)))||console.warn("创建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,l=e.getAttribLocation(t,a);r[a]={type:s,name:a,size:u,loc:l}}return r},e.prototype.dispose=function(){this.pipelineContext&&(this.pipelineContext.gl.deleteProgram(this.program),this.pipelineContext=null)},e}(),Tw=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}(gC),xw=0,Ew=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 Tw({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},l=this.createProgram(s,a.vertex,a.fragment,u),c=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||!c||c&&1==s.getProgramParameter(u.program,c.COMPLETION_STATUS_KHR))&&l();if(n){if(u.status!==e.ShaderCompileResultStatus.fail){WM(n,a.name);var f=new gw(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_"+xw++,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=Aw(t,a,"vertex",r),l=Aw(t,s,"fragment",i);return n.status=e.ShaderCompileResultStatus.fail,u&&(n.error=u.error,n.status=u.status),l&&(n.error=l.error,n.status=l.status),o}return o}):(n.status=e.ShaderCompileResultStatus.fail,function(){return null})},t.prototype.createGLShader=function(e,t,r){var i=t===e.VERTEX_SHADER?this.glVertShaderMap:this.glFragShaderMap,n=cw(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 Aw(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 Sw=function(){function e(e,t){this.engine=e,this.gl=t,this.gl=t,this.shaderLibrary=new Ew(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}(VM),bw=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 nw(r,i,a);var s=o.context.gl;return e_(s),o.engine=new _w(s),o.engine.renderer=o,o.pipelineContext=new Sw(o.engine,s),o.glRenderer=new YM(o.engine),o.extension=new rw(o),o.renderingData={currentFrame:{}},o.frameBuffer=new sw({storeAction:{},viewport:[0,0,o.width,o.height],attachments:[new zM(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 l=(h=u.value).delegate;l.willBeginRenderPass&&(null==l||l.willBeginRenderPass(h,this.renderingData)),this.renderRenderPass(h),l.didEndRenderPass&&(null==l||l.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 c=rS(a),f=c.next();!f.done;f=c.next()){var h;(h=f.value).frameCleanup(this)}}catch(e){i={error:e}}finally{try{f&&!f.done&&(n=c.return)&&n.call(c)}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,l=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?l=e.RenderPassAttachmentStorageType.none:16===n?l=e.RenderPassAttachmentStorageType.depth_16_opaque:24===n&&(l=e.RenderPassAttachmentStorageType.depth_24_stencil_8_texture);var c=new zM(this.engine,{sourceType:e.TextureSourceType.framebuffer,minFilter:s,magFilter:s,internalFormat:dS.RGBA,format:dS.RGBA,type:u}),f=new sw({name:t,storeAction:{},viewport:[0,0,r,i],viewportScale:1,isCustomViewport:!0,attachments:[c],depthStencilAttachment:{storageType:l}},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 Sw(this.engine,e),this.glRenderer=new YM(this.engine),this.extension=new rw(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}(PO),Rw="https://yuque.antfin.com/huoxing/knaszl/qtnsf2g9ofigggor#MvjnY",Cw="https://yuque.antfin.com/huoxing/knaszl/qtnsf2g9ofigggor#ulfNT",Ow="https://yuque.antfin.com/huoxing/knaszl/qtnsf2g9ofigggor#lLlSW",Lw="https://yuque.antfin.com/huoxing/knaszl/qtnsf2g9ofigggor#WZaWg",Iw="https://yuque.antfin.com/huoxing/knaszl/qtnsf2g9ofigggor#YSWQr",Pw="https://yuque.antfin.com/huoxing/knaszl/qtnsf2g9ofigggor#IzodZ";var Mw=new Map,ww=!1,Fw=1,Nw=function(){function t(e){var t,r,i=this;this.compositions=[],this.displayScale=1,this.resumePending=!1,this.disposed=!1,this.speed=1,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),Vw(i,!1)},this.restore=function(){return eS(i,void 0,void 0,(function(){var e,t,r=this;return tS(this,(function(i){switch(i.label){case 0:return this.renderer.restore(),e=this,[4,Promise.all(this.compositions.map((function(e){return eS(r,void 0,void 0,(function(){var t,r,i,n,o,a,s,u,l,c,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.rootTransform,u=e.videoState,[4,this.loadScene(r)];case 1:(l=p.sent()).speed=i,l.reusable=o,l.keepResource=n,l.renderOrder=a,l.rootTransform=s,c=0,p.label=2;case 2:return c<u.length?u[c]?((f=l.textures[c].source.video).currentTime=null!==(h=u[c])&&void 0!==h?h:0,[4,f.play()]):[3,4]:[3,5];case 3:p.sent(),p.label=4;case 4:return c++,[3,2];case 5:return l.start(),l.forwardTime(t),[2,l]}}))}))})))];case 1:return e.compositions=i.sent(),null===(t=this.handleWebGLContextRestored)||void 0===t||t.call(this),this.ticker.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],l=u.name,c=u.id,f=u.hitPositions;null===(n=i.handleItemClicked)||void 0===n||n.call(i,{name:l,player:i,composition:e.name,id:c,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,l=e.pixelRatio,c=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 _=null!==(r=null!==(t=e.renderOptions)&&void 0!==t?t:e)&&void 0!==r?r:{},b=_.willCaptureImage,R=_.premultiplyAlpha;if(!ww&&"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(l)?l: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("The gl context(".concat(O,") is inconsistent with renderFramework or default version(").concat(C,")")),C=O)}else Uw(n),this.canvas=document.createElement("canvas"),n.appendChild(this.canvas);Mw.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=PO.create(this.canvas,C,{preserveDrawingBuffer:b,premultipliedAlpha:R}),this.renderer.env=A,this.renderer.addLostHandler({lost:this.lost}),this.renderer.addRestoreHandler({restore:this.restore}),this.gpuCapability=this.renderer.engine.gpuCapability,Mw.forEach((function(e){e.gpuCapability.type!==i.gpuCapability.type&&console.warn("Create player with different webgl version: old=".concat(e.gpuCapability.type,", new=").concat(i.gpuCapability.type))})),c||(this.ticker=new UM(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(Fw++),a||this.resize(),kO(this.gpuCapability.detail),this.container=this.canvas.parentElement,Mw.set(this.canvas,this),function(){var e,t,r=[];try{for(var i=rS(Mw.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("Current running player count: ".concat(r.length,", see ").concat(Pw),r)}(),Vw(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=this;return tS(this,(function(o){switch(o.label){case 0:return lR(e)?[4,Promise.all(e.map((function(e,r){return eS(n,void 0,void 0,(function(){var i;return tS(this,(function(n){switch(n.label){case 0:return[4,this.createComposition(e,t)];case 1:return(i=n.sent()).setIndex(r),[2,i]}}))}))})))]:[3,2];case 1:return i=o.sent(),[3,4];case 2:return[4,this.createComposition(e,t)];case 3:i=o.sent(),o.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,l=this;return tS(this,(function(c){switch(c.label){case 0:return r=this.renderer,i=performance.now(),n=t,Dw(e)?(a=e.scene,n=$A($A({autoplay:!0},t),e.options||{})):a=e,this.assetManager?this.assetManager.updateOptions(n):this.assetManager=new PM(n),LM(a)?(o=a,[3,3]):[3,1];case 1:return[4,this.assetManager.loadScene(a,this.renderer,{env:this.env})];case 2:o=c.sent(),c.label=3;case 3:return s=new FM($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){l.renderer.getShaderLibrary().compileAllShaders((function(){e(null)}))}))];case 4:return c.sent(),!1!==n.autoplay?s.play():s.pause(),u=performance.now()-i+s.statistic.loadTime,s.statistic.firstFrameTime=u,console.info("first frame:[".concat(s.name,"]").concat(u.toFixed(1),"ms")),this.compositions.push(s),[2,s]}}))}))},t.prototype.play=function(){this.gotoAndPlay(0)},t.prototype.gotoAndPlay=function(e){var t;this.offscreenMode&&(this.resize(),this.offscreenMode=!1),this.compositions.map((function(t){t.play(),t.forwardTime(e)})),null===(t=this.ticker)||void 0===t||t.start()},t.prototype.gotoAndStop=function(e){this.gotoAndPlay(e),this.ticker.pause(),this.doTick(0,!0)},t.prototype.playSequence=function(e){for(var t=function(t){var r=e[t],i=r.handleEnd;r.handleEnd=function(){null==i||i.call(r,r),e[t+1].play()}},r=0;r<e.length-1;r++)t(r);e[0].play(),this.ticker.start()},t.prototype.pause=function(e){var t,r;if(!this.paused)return 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(),!0},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,l=!1;if(u.sort((function(e,t){return e.renderOrder-t.renderOrder})),u.forEach((function(e,r){return e.textureOffloaded&&(l=!0,console.error("Composition ".concat(e.name," texture offloaded, skip render."))),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})),this.compositions=u),l)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 c=this.gpuCapability.level,f=this.renderer.context.gl,h=2===c&&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.forwardingTime||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("DPI overflowed, width ".concat(i," is more than 2x document width ").concat(u,", see ").concat(Cw));var l=this.env?this.gpuCapability.detail.maxTextureSize:2048;(i>l||n>l)&&(console.error("Container size overflowed ".concat(i,"x").concat(n,", see ").concat(Rw)),s>1?(i=Math.round(l),n=Math.round(l/s)):(n=Math.round(l),i=Math.round(l*s))),this.renderer.resize(i,n),this.canvas.style.width=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.config=function(e){var t="string"==typeof e.compositionName;if("speed"in e){var r=+(e.speed||1);if(t){var i=this.compositions.find((function(t){return t.name===e.compositionName}));i&&(i.speed=r)}else this.compositions.forEach((function(e){return e.speed=r}))}},t.prototype.forwardCompositionTime=function(e,t){t&&(this.forwardingTime=!0,e.forwardTime(t),this.forwardingTime=!1)},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.dispose=function(e){var t,r;console.debug("call player destroy: ".concat(this.name)),this.disposed||(Mw.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),Vw(this,!1),this.canvas instanceof HTMLCanvasElement&&!e&&this.renderer.context&&(XI.dispose(),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas),this.canvas.remove()),this.tick=kw,this.resize=kw,this.loadScene=zw,this.play=zw,this.resume=zw,this.disposed=!0)},t.prototype.renderFrame=function(e){var t=this;this.compositions.forEach((function(r){return t.forwardCompositionTime(r,e.currentTime)})),this.doTick(0,!0),e.pauseOnFirstFrame?this.pause():this.resume().catch(console.error)},t.prototype.offloadTexture=function(){this.compositions.forEach((function(e){return e.offloadTexture()}))},t.prototype.getTargetSize=function(e){Uw(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(Ow));t=r=o=a=1}return[o,a,t,r]},t}();function Dw(e){return fR(e)&&"scene"in e}function Vw(e,t){Object.values(ER).forEach((function(r){var i=t?r.onPlayerCreated:r.onPlayerDestroy;null==i||i(e)}))}function Uw(e){if(null==e)throw new Error("Container is not an HTMLElement, see ".concat(Lw))}var Bw="Never use destroyed player again, see ".concat(Iw);function kw(){throw new Error(Bw)}function zw(){return Promise.reject(Bw)}iC.create=function(e,t){return new zM(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,l=n.internalFormat,c=n.wrapS,f=void 0===c?dS.MIRRORED_REPEAT:c,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 zM(t,{data:r,type:a,sourceType:e.TextureSourceType.data,format:u,internalFormat:l||u,wrapS:f,wrapT:p,minFilter:m,magFilter:y,flipY:T})},vC.create=function(e,t){return new tw(e,t)},IC.create=function(e,t){return new $M(e,t)},BC.create=function(e,t){return new BC(e,t)},AO.create=function(e){return new ow(e)},IO.create=function(e,t){return new sw(e,t)},PO.create=function(e,t,r){return new bw(e,t,r)},VM.create=function(e){return new _w(e)};console.info("[Galacean Effects Player] version: 0.0.1-alpha.0"),e.AbstractPlugin=CR,e.AssetManager=PM,e.BYTES_TYPE_MAP=LC,e.BezierSegments=Yb,e.COMPRESSED_TEXTURE=OO,e.COPY_FRAGMENT_SHADER=AC,e.COPY_MESH_SHADER_ID=xC,e.COPY_VERTEX_SHADER=EC,e.CalculateItem=$O,e.CalculateLoader=OI,e.CalculateVFXItem=LI,e.Camera=fP,e.CameraController=OR,e.CameraVFXItem=IR,e.CameraVFXItemLoader=LR,e.Composition=FM,e.CompositionSourceManager=OM,e.CurveValue=jb,e.DEFAULT_FONTS=kI,e.DEG2RAD=lS,e.Downloader=ZR,e.EFFECTS_COPY_MESH_NAME=TC,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=VM,e.EventSystem=UR,e.FILTER_NAME_NONE=uS,e.FilterSpriteVFXItem=oL,e.Float16ArrayWrapper=C_,e.FrameBuffer=IO,e.GLEngine=_w,e.GLGeometry=$M,e.GLRenderer=bw,e.GPUCapability=_O,e.Geometry=IC,e.GlobalUniforms=EO,e.GradientValue=Gb,e.HELP_LINK=cS,e.InteractBehavior=VR,e.InteractItem=VO,e.InteractLoader=DO,e.InteractMesh=wO,e.InteractVFXItem=FO,e.KTXTexture=oC,e.LineSegments=Xb,e.LinearValue=zb,e.Material=vC,e.MaterialDataBlock=fC,e.Mesh=BC,e.NumberEpsilon=q_,e.PLAYER_OPTIONS_ENV_EDITOR=sS,e.POST_PROCESS_SETTINGS="post_process_settings",e.ParticleLoader=RI,e.ParticleMesh=aL,e.ParticleSystem=dI,e.ParticleVFXItem=bI,e.PassTextureCache=CC,e.PathSegments=Hb,e.Player=Nw,e.PluginSystem=RR,e.QCanvasViewer=NI,e.QText=FI,e.RENDER_PASS_NAME_PREFIX=vO,e.RENDER_PREFER_LOOKUP_TEXTURE=MC,e.RUNTIME_ENV="runtime_env",e.RandomSetValue=Ub,e.RandomValue=Bb,e.RandomVectorValue=kb,e.RenderBuffer=AO,e.RenderFrame=gO,e.RenderPass=XC,e.RenderPassPriorityNormal=kC,e.RenderPassPriorityPostprocess=3e3,e.RenderPassPriorityPrepare=0,e.RenderTargetHandle=GC,e.Renderer=PO,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=OC,e.Shader=gC,e.SpriteItem=rL,e.SpriteLoader=qO,e.SpriteMesh=BO,e.SpriteVFXItem=iL,e.StaticValue=Vb,e.TEMPLATE_USE_OFFSCREEN_CANVAS=wC,e.TextItem=QI,e.TextLoader=$I,e.TextMesh=II,e.TextVFXItem=JI,e.Texture=iC,e.TextureFactory=uC,e.Ticker=UM,e.TimelineComponent=aR,e.Transform=gR,e.VFXItem=TR,e.VFX_ITEM_TYPE_TREE=aS,e.ValueGetter=Db,e.addByOrder=QS,e.addItem=DS,e.addItemWithOrder=US,e.alphaFrameFrag=QC,e.alphaMaskFrag=JC,e.assertExist=e_,e.asserts=function(e,t){if(void 0===t&&(t="asserts failed"),!e)throw new Error(t)}
15
+ /*!
16
+ * Name: @galacean/effects-specification
17
+ * Description: Galacean Effects JSON Specification
18
+ * Author: Ant Group CO., Ltd.
19
+ * Version: v0.0.1
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=iO,e.bloomThresholdVert=nO,e.calculateTranslation=Fb,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=$C,e.canvasPool=XI,e.clamp=E_,e.colorGradingFrag=aO,e.colorStopsFromGradient=GS,e.colorToArr=kS,e.combineImageTemplate=qI,e.combineImageTemplate1=VI,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,VI(e,t,r,i,n)]}))}))},e.combineImageTemplate2=ZI,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,ZI(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=S_,e.copyFrag=yC,e.createCopyShader=SC,e.createFilter=NS,e.createFilterShaders=FS,e.createGLContext=fS,e.createKeyFrameMeta=tR,e.createShaderWithMarcos=XR,e.createShape=OL,e.createVFXItem=xR,e.createValueGetter=Zb,e.deepClone=hR,e.defaultGlobalVolume=mO,e.defaultPlugins=AR,e.delayFrag=eO,e.deserializeMipmapTexture=eC,e.disableAllPlayer=function(e){ww=!!e},e.distortionFrag=tO,e.distortionVert=rO,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]],l=[a[0],a[1]];ib(Lb,l,s),ib(Ib,u,s),ib(Pb,t,s);var c=ob(Lb,Lb),f=ob(Lb,Ib),h=ob(Lb,Pb),p=ob(Ib,Ib),d=ob(Ib,Pb),m=c*p-f*f;if(0===m)return!1;var v=1/m,y=(p*h-f*d)*v,g=(c*d-f*h)*v;return 1-y-g>=0&&g>=0&&1-y<=1},e.earcut=QL,e.enlargeBuffer=BS,e.ensureVec3=Q_,e.filters=SP,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=sO,e.gaussianDownVFrag=uO,e.gaussianUpFrag=lO,e.generateEmptyTypedArray=PC,e.generateHalfFloatTexture=nC,e.getActivePlayers=function(){return Array.from(Mw.values())},e.getBackgroundImage=HI,e.getColorFromGradientStops=zS,e.getComposition=function(e,t){return e.find((function(e){return e.id===t}))},e.getConfig=NC,e.getDefaultTemplateCanvasPool=function(){return XI},e.getDefaultTextureFactory=lC,e.getGeometryByShape=iI,e.getGeometryTriangles=rI,e.getImageItemRenderInfo=zO,e.getKTXTextureOptions=aC,e.getKeyFrameMetaByRawValue=eR,e.getMat4TR=k_,e.getMat4TRS=z_,e.getParticleMeshShader=lL,e.getPixelRatio=HS,e.getPlayerByCanvas=function(e){return Mw.get(e)},e.getPreMultiAlpha=kR,e.getStandardComposition=xM,e.getStandardImage=TM,e.getStandardItem=_M,e.getStandardJSON=yM,e.getTextureSize=TO,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=Ab,e.intersectRaySphere=Eb,e.intersectRayTriangle=Ob,e.isAndroid=YS,e.isArray=lR,e.isCanvasUsedByPlayer=function(e){return Mw.has(e)},e.isFunction=cR,e.isIOS=function(){return!!navigator.platform&&/iPad|iPhone|iPod/.test(navigator.platform)},e.isIdentityMatrix=M_,e.isObject=fR,e.isScene=LM,e.isSceneWithOptions=Dw,e.isSimulatorCellPhone=WS,e.isString=uR,e.isUniformStruct=hC,e.isUniformStructArray=function(e){return e&&void 0!==e.length&&hC(e[0])},e.isWebGL2=vS,e.isZeroVec=K_,e.itemDefine="uniform mat4 uMainData[MAX_ITEM_COUNT];uniform vec4 uTexParams[MAX_ITEM_COUNT];uniform vec4 uTexOffset[MAX_ITEM_COUNT];",e.itemFrag=WC,e.itemFrameFrag=HC,e.itemVert=YC,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=L_,e.mat3FromRotation=fb,e.mat3FromRotationZ=cb,e.mat4Clone=G_,e.mat4Determinate=B_,e.mat4ToIdentityMatrix=P_,e.mat4create=I_,e.mat4fromRotationTranslationScale=w_,e.mat4invert=F_,e.mat4multiply=N_,e.mat4perspective=D_,e.modifyMaxKeyframeShader=cL,e.nearestPowerOfTwo=A_,e.noop=sR,e.parsePercent=XS,e.particleFrag=ZC,e.particleOriginTranslateMap=x_,e.particleVert=qC,e.pluginLoaderMap=ER,e.quatFromRotation=yb,e.quatMultiply=vb,e.quatStar=gb,e.random=pR,e.registerFilter=MS,e.registerFilters=wS,e.registerPlugin=_R,e.removeItem=VS,e.requestAsync=DI,e.rotateByQuat=function(e,t,r){var i=r[0],n=r[1],o=r[2],a=r[3],s=[i,n,o],u=ab([],s,t),l=ab([],s,u);ob(l,l,2),ob(u,u,2*a),W_(l,l,u),W_(e,t,l)},e.rotateVec2=nI,e.rotationFromMat3=hb,e.screenMeshVert=oO,e.setBlendMode=HR,e.setConfig=function(e,t){return FC[e]=t},e.setDefaultTextureFactory=function(e){sC=e},e.setMaskMode=WR,e.setMaxSpriteMeshItemCount=function(t){e.maxSpriteMeshItemCount=t},e.setRayFromCamera=xb,e.setSideMode=YR,e.setSpriteMeshMaxFragmentTextures=function(t){e.maxSpriteTextureCount=t},e.setSpriteMeshMaxItemCountByGPU=kO,e.sortByOrder=KS,e.spec=T_,e.spriteMeshShaderFromFilter=GO,e.spriteMeshShaderFromRenderInfo=XO,e.spriteMeshShaderIdFromRenderInfo=jO,e.thresholdFrag=cO,e.throwDestroyedError=dR,e.trailVert=KC,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=Cb,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=ab,e.vec3MulMat3=J_,e.vec3MulMat4=sb,e.vec3RotateByMat4=ub,e.vecAdd=W_,e.vecAssign=$_,e.vecDot=ob,e.vecFill=Z_,e.vecMinus=ib,e.vecMulCombine=eb,e.vecMulScalar=rb,e.vecNormalize=tb,e.vecSquareDistance=nb,e.version="0.0.1-alpha.0",Object.defineProperty(e,"__esModule",{value:!0})}));
21
+ //# sourceMappingURL=index.min.js.map