@netless/app-slide 0.0.35 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var f0=Object.defineProperty,m0=Object.defineProperties;var g0=Object.getOwnPropertyDescriptors;var Vg=Object.getOwnPropertySymbols;var v0=Object.prototype.hasOwnProperty,_0=Object.prototype.propertyIsEnumerable;var Wg=(N,w,S)=>w in N?f0(N,w,{enumerable:!0,configurable:!0,writable:!0,value:S}):N[w]=S,dp=(N,w)=>{for(var S in w||(w={}))v0.call(w,S)&&Wg(N,S,w[S]);if(Vg)for(var S of Vg(w))_0.call(w,S)&&Wg(N,S,w[S]);return N},Xg=(N,w)=>m0(N,g0(w));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";const qg="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",y0=qg.length,Yg=Array(20),hm=()=>{for(let N=0;N<20;N++)Yg[N]=qg.charAt(Math.random()*y0);return Yg.join("")};class Xm{constructor(){this.disposers=new Map}add(w,S=hm()){return this.flush(S),this.disposers.set(S,w()),S}addDisposer(w,S=hm()){return this.flush(S),this.disposers.set(S,w),S}addEventListener(w,S,W,pt,lt=hm()){return this.add(()=>(w.addEventListener(S,W,pt),()=>w.removeEventListener(S,W,pt)),lt),lt}setTimeout(w,S,W=hm()){return this.add(()=>{const pt=window.setTimeout(()=>{this.remove(W),w()},S);return()=>window.clearTimeout(pt)},W)}setInterval(w,S,W=hm()){return this.add(()=>{const pt=window.setInterval(w,S);return()=>window.clearInterval(pt)},W)}remove(w){const S=this.disposers.get(w);return this.disposers.delete(w),S}flush(w){const S=this.remove(w);if(S)try{S()}catch(W){console.error(W)}}flushAll(){this.disposers.forEach(w=>{try{w()}catch(S){console.error(S)}}),this.disposers.clear()}}function x0(N){return N!=null&&typeof N=="object"&&!Array.isArray(N)}function b0(N,w){let S=N.getAttributes();if(S||(N.setAttributes(w),S=N.getAttributes()),!S)throw new Error("[NetlessAppMonaco] No attributes");return x0(w)&&Object.keys(w).forEach(W=>{Object.prototype.hasOwnProperty.call(S,W)||N.updateAttributes([W],w[W])}),S}var bo=function(N){var w={};function S(W){if(w[W])return w[W].exports;var pt=w[W]={i:W,l:!1,exports:{}};return N[W].call(pt.exports,pt,pt.exports,S),pt.l=!0,pt.exports}return S.m=N,S.c=w,S.d=function(W,pt,lt){S.o(W,pt)||Object.defineProperty(W,pt,{enumerable:!0,get:lt})},S.r=function(W){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})},S.t=function(W,pt){if(1&pt&&(W=S(W)),8&pt||4&pt&&typeof W=="object"&&W&&W.__esModule)return W;var lt=Object.create(null);if(S.r(lt),Object.defineProperty(lt,"default",{enumerable:!0,value:W}),2&pt&&typeof W!="string")for(var J in W)S.d(lt,J,function(X){return W[X]}.bind(null,J));return lt},S.n=function(W){var pt=W&&W.__esModule?function(){return W.default}:function(){return W};return S.d(pt,"a",pt),pt},S.o=function(W,pt){return Object.prototype.hasOwnProperty.call(W,pt)},S.p="",S(S.s=34)}([function(N,w,S){var W=Object.prototype.hasOwnProperty,pt="~";function lt(){}function J($,ut,kt){this.fn=$,this.context=ut,this.once=kt||!1}function X($,ut,kt,Gt,zt){if(typeof kt!="function")throw new TypeError("The listener must be a function");var L=new J(kt,Gt||$,zt),k=pt?pt+ut:ut;return $._events[k]?$._events[k].fn?$._events[k]=[$._events[k],L]:$._events[k].push(L):($._events[k]=L,$._eventsCount++),$}function ct($,ut){--$._eventsCount==0?$._events=new lt:delete $._events[ut]}function tt(){this._events=new lt,this._eventsCount=0}Object.create&&(lt.prototype=Object.create(null),new lt().__proto__||(pt=!1)),tt.prototype.eventNames=function(){var $,ut,kt=[];if(this._eventsCount===0)return kt;for(ut in $=this._events)W.call($,ut)&&kt.push(pt?ut.slice(1):ut);return Object.getOwnPropertySymbols?kt.concat(Object.getOwnPropertySymbols($)):kt},tt.prototype.listeners=function($){var ut=pt?pt+$:$,kt=this._events[ut];if(!kt)return[];if(kt.fn)return[kt.fn];for(var Gt=0,zt=kt.length,L=new Array(zt);Gt<zt;Gt++)L[Gt]=kt[Gt].fn;return L},tt.prototype.listenerCount=function($){var ut=pt?pt+$:$,kt=this._events[ut];return kt?kt.fn?1:kt.length:0},tt.prototype.emit=function($,ut,kt,Gt,zt,L){var k=pt?pt+$:$;if(!this._events[k])return!1;var Y,ht,B=this._events[k],Q=arguments.length;if(B.fn){switch(B.once&&this.removeListener($,B.fn,void 0,!0),Q){case 1:return B.fn.call(B.context),!0;case 2:return B.fn.call(B.context,ut),!0;case 3:return B.fn.call(B.context,ut,kt),!0;case 4:return B.fn.call(B.context,ut,kt,Gt),!0;case 5:return B.fn.call(B.context,ut,kt,Gt,zt),!0;case 6:return B.fn.call(B.context,ut,kt,Gt,zt,L),!0}for(ht=1,Y=new Array(Q-1);ht<Q;ht++)Y[ht-1]=arguments[ht];B.fn.apply(B.context,Y)}else{var et,ft=B.length;for(ht=0;ht<ft;ht++)switch(B[ht].once&&this.removeListener($,B[ht].fn,void 0,!0),Q){case 1:B[ht].fn.call(B[ht].context);break;case 2:B[ht].fn.call(B[ht].context,ut);break;case 3:B[ht].fn.call(B[ht].context,ut,kt);break;case 4:B[ht].fn.call(B[ht].context,ut,kt,Gt);break;default:if(!Y)for(et=1,Y=new Array(Q-1);et<Q;et++)Y[et-1]=arguments[et];B[ht].fn.apply(B[ht].context,Y)}}return!0},tt.prototype.on=function($,ut,kt){return X(this,$,ut,kt,!1)},tt.prototype.once=function($,ut,kt){return X(this,$,ut,kt,!0)},tt.prototype.removeListener=function($,ut,kt,Gt){var zt=pt?pt+$:$;if(!this._events[zt])return this;if(!ut)return ct(this,zt),this;var L=this._events[zt];if(L.fn)L.fn!==ut||Gt&&!L.once||kt&&L.context!==kt||ct(this,zt);else{for(var k=0,Y=[],ht=L.length;k<ht;k++)(L[k].fn!==ut||Gt&&!L[k].once||kt&&L[k].context!==kt)&&Y.push(L[k]);Y.length?this._events[zt]=Y.length===1?Y[0]:Y:ct(this,zt)}return this},tt.prototype.removeAllListeners=function($){var ut;return $?(ut=pt?pt+$:$,this._events[ut]&&ct(this,ut)):(this._events=new lt,this._eventsCount=0),this},tt.prototype.off=tt.prototype.removeListener,tt.prototype.addListener=tt.prototype.on,tt.prefixed=pt,tt.EventEmitter=tt,N.exports=tt},function(N,w,S){(function(W,pt){var lt;/**
1
+ "use strict";var f0=Object.defineProperty,m0=Object.defineProperties;var g0=Object.getOwnPropertyDescriptors;var Vg=Object.getOwnPropertySymbols;var v0=Object.prototype.hasOwnProperty,_0=Object.prototype.propertyIsEnumerable;var Wg=(N,w,S)=>w in N?f0(N,w,{enumerable:!0,configurable:!0,writable:!0,value:S}):N[w]=S,dp=(N,w)=>{for(var S in w||(w={}))v0.call(w,S)&&Wg(N,S,w[S]);if(Vg)for(var S of Vg(w))_0.call(w,S)&&Wg(N,S,w[S]);return N},Xg=(N,w)=>m0(N,g0(w));Object.defineProperty(exports,"__esModule",{value:!0});exports[Symbol.toStringTag]="Module";const qg="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",y0=qg.length,Yg=Array(20),hm=()=>{for(let N=0;N<20;N++)Yg[N]=qg.charAt(Math.random()*y0);return Yg.join("")};class cm{constructor(){this.disposers=new Map}add(w,S=hm()){return this.flush(S),this.disposers.set(S,w()),S}addDisposer(w,S=hm()){return this.flush(S),this.disposers.set(S,w),S}addEventListener(w,S,W,pt,lt=hm()){return this.add(()=>(w.addEventListener(S,W,pt),()=>w.removeEventListener(S,W,pt)),lt),lt}setTimeout(w,S,W=hm()){return this.add(()=>{const pt=window.setTimeout(()=>{this.remove(W),w()},S);return()=>window.clearTimeout(pt)},W)}setInterval(w,S,W=hm()){return this.add(()=>{const pt=window.setInterval(w,S);return()=>window.clearInterval(pt)},W)}remove(w){const S=this.disposers.get(w);return this.disposers.delete(w),S}flush(w){const S=this.remove(w);if(S)try{S()}catch(W){console.error(W)}}flushAll(){this.disposers.forEach(w=>{try{w()}catch(S){console.error(S)}}),this.disposers.clear()}}function x0(N){return N!=null&&typeof N=="object"&&!Array.isArray(N)}function b0(N,w){let S=N.getAttributes();if(S||(N.setAttributes(w),S=N.getAttributes()),!S)throw new Error("[NetlessAppMonaco] No attributes");return x0(w)&&Object.keys(w).forEach(W=>{Object.prototype.hasOwnProperty.call(S,W)||N.updateAttributes([W],w[W])}),S}var bo=function(N){var w={};function S(W){if(w[W])return w[W].exports;var pt=w[W]={i:W,l:!1,exports:{}};return N[W].call(pt.exports,pt,pt.exports,S),pt.l=!0,pt.exports}return S.m=N,S.c=w,S.d=function(W,pt,lt){S.o(W,pt)||Object.defineProperty(W,pt,{enumerable:!0,get:lt})},S.r=function(W){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(W,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(W,"__esModule",{value:!0})},S.t=function(W,pt){if(1&pt&&(W=S(W)),8&pt||4&pt&&typeof W=="object"&&W&&W.__esModule)return W;var lt=Object.create(null);if(S.r(lt),Object.defineProperty(lt,"default",{enumerable:!0,value:W}),2&pt&&typeof W!="string")for(var J in W)S.d(lt,J,function(X){return W[X]}.bind(null,J));return lt},S.n=function(W){var pt=W&&W.__esModule?function(){return W.default}:function(){return W};return S.d(pt,"a",pt),pt},S.o=function(W,pt){return Object.prototype.hasOwnProperty.call(W,pt)},S.p="",S(S.s=34)}([function(N,w,S){var W=Object.prototype.hasOwnProperty,pt="~";function lt(){}function J($,ut,kt){this.fn=$,this.context=ut,this.once=kt||!1}function X($,ut,kt,Gt,zt){if(typeof kt!="function")throw new TypeError("The listener must be a function");var L=new J(kt,Gt||$,zt),k=pt?pt+ut:ut;return $._events[k]?$._events[k].fn?$._events[k]=[$._events[k],L]:$._events[k].push(L):($._events[k]=L,$._eventsCount++),$}function ct($,ut){--$._eventsCount==0?$._events=new lt:delete $._events[ut]}function tt(){this._events=new lt,this._eventsCount=0}Object.create&&(lt.prototype=Object.create(null),new lt().__proto__||(pt=!1)),tt.prototype.eventNames=function(){var $,ut,kt=[];if(this._eventsCount===0)return kt;for(ut in $=this._events)W.call($,ut)&&kt.push(pt?ut.slice(1):ut);return Object.getOwnPropertySymbols?kt.concat(Object.getOwnPropertySymbols($)):kt},tt.prototype.listeners=function($){var ut=pt?pt+$:$,kt=this._events[ut];if(!kt)return[];if(kt.fn)return[kt.fn];for(var Gt=0,zt=kt.length,L=new Array(zt);Gt<zt;Gt++)L[Gt]=kt[Gt].fn;return L},tt.prototype.listenerCount=function($){var ut=pt?pt+$:$,kt=this._events[ut];return kt?kt.fn?1:kt.length:0},tt.prototype.emit=function($,ut,kt,Gt,zt,L){var k=pt?pt+$:$;if(!this._events[k])return!1;var Y,ht,B=this._events[k],Q=arguments.length;if(B.fn){switch(B.once&&this.removeListener($,B.fn,void 0,!0),Q){case 1:return B.fn.call(B.context),!0;case 2:return B.fn.call(B.context,ut),!0;case 3:return B.fn.call(B.context,ut,kt),!0;case 4:return B.fn.call(B.context,ut,kt,Gt),!0;case 5:return B.fn.call(B.context,ut,kt,Gt,zt),!0;case 6:return B.fn.call(B.context,ut,kt,Gt,zt,L),!0}for(ht=1,Y=new Array(Q-1);ht<Q;ht++)Y[ht-1]=arguments[ht];B.fn.apply(B.context,Y)}else{var et,ft=B.length;for(ht=0;ht<ft;ht++)switch(B[ht].once&&this.removeListener($,B[ht].fn,void 0,!0),Q){case 1:B[ht].fn.call(B[ht].context);break;case 2:B[ht].fn.call(B[ht].context,ut);break;case 3:B[ht].fn.call(B[ht].context,ut,kt);break;case 4:B[ht].fn.call(B[ht].context,ut,kt,Gt);break;default:if(!Y)for(et=1,Y=new Array(Q-1);et<Q;et++)Y[et-1]=arguments[et];B[ht].fn.apply(B[ht].context,Y)}}return!0},tt.prototype.on=function($,ut,kt){return X(this,$,ut,kt,!1)},tt.prototype.once=function($,ut,kt){return X(this,$,ut,kt,!0)},tt.prototype.removeListener=function($,ut,kt,Gt){var zt=pt?pt+$:$;if(!this._events[zt])return this;if(!ut)return ct(this,zt),this;var L=this._events[zt];if(L.fn)L.fn!==ut||Gt&&!L.once||kt&&L.context!==kt||ct(this,zt);else{for(var k=0,Y=[],ht=L.length;k<ht;k++)(L[k].fn!==ut||Gt&&!L[k].once||kt&&L[k].context!==kt)&&Y.push(L[k]);Y.length?this._events[zt]=Y.length===1?Y[0]:Y:ct(this,zt)}return this},tt.prototype.removeAllListeners=function($){var ut;return $?(ut=pt?pt+$:$,this._events[ut]&&ct(this,ut)):(this._events=new lt,this._eventsCount=0),this},tt.prototype.off=tt.prototype.removeListener,tt.prototype.addListener=tt.prototype.on,tt.prefixed=pt,tt.EventEmitter=tt,N.exports=tt},function(N,w,S){(function(W,pt){var lt;/**
2
2
  * @license
3
3
  * Lodash <https://lodash.com/>
4
4
  * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
@@ -24,7 +24,7 @@ __p += '`),mn&&(De+=`' +
24
24
  function print() { __p += __j.call(arguments, '') }
25
25
  `:`;
26
26
  `)+De+`return __p
27
- }`;var ve=Jd(function(){return Jn(Lt,ln+"return "+De).apply(void 0,qt)});if(ve.source=De,Fc(ve))throw ve;return ve},st.times=function(c,g){if((c=or(c))<1||c>9007199254740991)return[];var E=4294967295,F=to(c,4294967295);c-=4294967295;for(var q=Cl(F,g=Rn(g));++E<c;)g(E);return q},st.toFinite=fs,st.toInteger=or,st.toLength=qd,st.toLower=function(c){return zr(c).toLowerCase()},st.toNumber=As,st.toSafeInteger=function(c){return c?Go(or(c),-9007199254740991,9007199254740991):c===0?c:0},st.toString=zr,st.toUpper=function(c){return zr(c).toUpperCase()},st.trim=function(c,g,E){if((c=zr(c))&&(E||g===void 0))return pc(c);if(!c||!(g=wi(g)))return c;var F=Zo(c),q=Zo(g);return Wi(F,yd(F,q),Ri(F,q)+1).join("")},st.trimEnd=function(c,g,E){if((c=zr(c))&&(E||g===void 0))return c.slice(0,vp(c)+1);if(!c||!(g=wi(g)))return c;var F=Zo(c);return Wi(F,0,Ri(F,Zo(g))+1).join("")},st.trimStart=function(c,g,E){if((c=zr(c))&&(E||g===void 0))return c.replace(br,"");if(!c||!(g=wi(g)))return c;var F=Zo(c);return Wi(F,yd(F,Zo(g))).join("")},st.truncate=function(c,g){var E=30,F="...";if(si(g)){var q="separator"in g?g.separator:q;E="length"in g?or(g.length):E,F="omission"in g?wi(g.omission):F}var dt=(c=zr(c)).length;if(Ia(c)){var Mt=Zo(c);dt=Mt.length}if(E>=dt)return c;var Lt=E-Il(F);if(Lt<1)return F;var qt=Mt?Wi(Mt,0,Lt).join(""):c.slice(0,Lt);if(q===void 0)return qt+F;if(Mt&&(Lt+=qt.length-Lt),Uc(q)){if(c.slice(Lt).search(q)){var Ee,me=qt;for(q.global||(q=ys(q.source,zr(ao.exec(q))+"g")),q.lastIndex=0;Ee=q.exec(me);)var De=Ee.index;qt=qt.slice(0,De===void 0?Lt:De)}}else if(c.indexOf(wi(q),Lt)!=Lt){var gn=qt.lastIndexOf(q);gn>-1&&(qt=qt.slice(0,gn))}return qt+F},st.unescape=function(c){return(c=zr(c))&&Ke.test(c)?c.replace(ke,Wr):c},st.uniqueId=function(c){var g=++gf;return zr(c)+g},st.upperCase=Yd,st.upperFirst=Gh,st.each=Ph,st.eachRight=kp,st.first=Fd,Fu(st,($c={},eo(st,function(c,g){pr.call(st.prototype,g)||($c[g]=c)}),$c),{chain:!1}),st.VERSION="4.17.21",uo(["bind","bindKey","curry","curryRight","partial","partialRight"],function(c){st[c].placeholder=st}),uo(["drop","take"],function(c,g){tr.prototype[c]=function(E){E=E===void 0?1:xi(or(E),0);var F=this.__filtered__&&!g?new tr(this):this.clone();return F.__filtered__?F.__takeCount__=to(E,F.__takeCount__):F.__views__.push({size:to(E,4294967295),type:c+(F.__dir__<0?"Right":"")}),F},tr.prototype[c+"Right"]=function(E){return this.reverse()[c](E).reverse()}}),uo(["filter","map","takeWhile"],function(c,g){var E=g+1,F=E==1||E==3;tr.prototype[c]=function(q){var dt=this.clone();return dt.__iteratees__.push({iteratee:Rn(q,3),type:E}),dt.__filtered__=dt.__filtered__||F,dt}}),uo(["head","last"],function(c,g){var E="take"+(g?"Right":"");tr.prototype[c]=function(){return this[E](1).value()[0]}}),uo(["initial","tail"],function(c,g){var E="drop"+(g?"":"Right");tr.prototype[c]=function(){return this.__filtered__?new tr(this):this[E](1)}}),tr.prototype.compact=function(){return this.filter(no)},tr.prototype.find=function(c){return this.filter(c).head()},tr.prototype.findLast=function(c){return this.reverse().find(c)},tr.prototype.invokeMap=fr(function(c,g){return typeof c=="function"?new tr(this):this.map(function(E){return gh(E,c,g)})}),tr.prototype.reject=function(c){return this.filter(Lh(Rn(c)))},tr.prototype.slice=function(c,g){c=or(c);var E=this;return E.__filtered__&&(c>0||g<0)?new tr(E):(c<0?E=E.takeRight(-c):c&&(E=E.drop(c)),g!==void 0&&(E=(g=or(g))<0?E.dropRight(-g):E.take(g-c)),E)},tr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},tr.prototype.toArray=function(){return this.take(4294967295)},eo(tr.prototype,function(c,g){var E=/^(?:filter|find|map|reject)|While$/.test(g),F=/^(?:head|last)$/.test(g),q=st[F?"take"+(g=="last"?"Right":""):g],dt=F||/^find/.test(g);q&&(st.prototype[g]=function(){var Mt=this.__wrapped__,Lt=F?[1]:arguments,qt=Mt instanceof tr,Ee=Lt[0],me=qt||ir(Mt),De=function(Un){var mn=q.apply(st,Pa([Un],Lt));return F&&gn?mn[0]:mn};me&&E&&typeof Ee=="function"&&Ee.length!=1&&(qt=me=!1);var gn=this.__chain__,ln=!!this.__actions__.length,An=dt&&!gn,ve=qt&&!ln;if(!dt&&me){Mt=ve?Mt:new tr(this);var Xe=c.apply(Mt,Lt);return Xe.__actions__.push({func:Lc,args:[De],thisArg:void 0}),new co(Xe,gn)}return An&&ve?c.apply(this,Lt):(Xe=this.thru(De),An?F?Xe.value()[0]:Xe.value():Xe)})}),uo(["pop","push","shift","sort","splice","unshift"],function(c){var g=mu[c],E=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",F=/^(?:pop|shift)$/.test(c);st.prototype[c]=function(){var q=arguments;if(F&&!this.__chain__){var dt=this.value();return g.apply(ir(dt)?dt:[],q)}return this[E](function(Mt){return g.apply(ir(Mt)?Mt:[],q)})}}),eo(tr.prototype,function(c,g){var E=st[g];if(E){var F=E.name+"";pr.call(ia,F)||(ia[F]=[]),ia[F].push({name:g,func:E})}}),ia[pl(void 0,2).name]=[{name:"wrapper",func:void 0}],tr.prototype.clone=function(){var c=new tr(this.__wrapped__);return c.__actions__=qi(this.__actions__),c.__dir__=this.__dir__,c.__filtered__=this.__filtered__,c.__iteratees__=qi(this.__iteratees__),c.__takeCount__=this.__takeCount__,c.__views__=qi(this.__views__),c},tr.prototype.reverse=function(){if(this.__filtered__){var c=new tr(this);c.__dir__=-1,c.__filtered__=!0}else(c=this.clone()).__dir__*=-1;return c},tr.prototype.value=function(){var c=this.__wrapped__.value(),g=this.__dir__,E=ir(c),F=g<0,q=E?c.length:0,dt=function(lr,In,jn){for(var Ei=-1,xo=jn.length;++Ei<xo;){var Ls=jn[Ei],ki=Ls.size;switch(Ls.type){case"drop":lr+=ki;break;case"dropRight":In-=ki;break;case"take":In=to(In,lr+ki);break;case"takeRight":lr=xi(lr,In-ki)}}return{start:lr,end:In}}(0,q,this.__views__),Mt=dt.start,Lt=dt.end,qt=Lt-Mt,Ee=F?Lt:Mt-1,me=this.__iteratees__,De=me.length,gn=0,ln=to(qt,this.__takeCount__);if(!E||!F&&q==qt&&ln==qt)return bu(c,this.__actions__);var An=[];t:for(;qt--&&gn<ln;){for(var ve=-1,Xe=c[Ee+=g];++ve<De;){var Un=me[ve],mn=Un.iteratee,Yn=Un.type,wn=mn(Xe);if(Yn==2)Xe=wn;else if(!wn){if(Yn==1)continue t;break t}}An[gn++]=Xe}return An},st.prototype.at=Np,st.prototype.chain=function(){return Hd(this)},st.prototype.commit=function(){return new co(this.value(),this.__chain__)},st.prototype.next=function(){this.__values__===void 0&&(this.__values__=Nh(this.value()));var c=this.__index__>=this.__values__.length;return{done:c,value:c?void 0:this.__values__[this.__index__++]}},st.prototype.plant=function(c){for(var g,E=this;E instanceof Ba;){var F=ql(E);F.__index__=0,F.__values__=void 0,g?q.__wrapped__=F:g=F;var q=F;E=E.__wrapped__}return q.__wrapped__=c,g},st.prototype.reverse=function(){var c=this.__wrapped__;if(c instanceof tr){var g=c;return this.__actions__.length&&(g=new tr(this)),(g=g.reverse()).__actions__.push({func:Lc,args:[Ud],thisArg:void 0}),new co(g,this.__chain__)}return this.thru(Ud)},st.prototype.toJSON=st.prototype.valueOf=st.prototype.value=function(){return bu(this.__wrapped__,this.__actions__)},st.prototype.first=st.prototype.head,uh&&(st.prototype[uh]=function(){return this}),st}();Er._=Bs,(lt=function(){return Bs}.call(w,S,w,pt))===void 0||(pt.exports=lt)}).call(this)}).call(this,S(4),S(11)(N))},function(N,w,S){var W;(function(pt){function lt(B,Q){var et=(65535&B)+(65535&Q);return(B>>16)+(Q>>16)+(et>>16)<<16|65535&et}function J(B,Q,et,ft,ae,Oe){return lt((ne=lt(lt(Q,B),lt(ft,Oe)))<<(bt=ae)|ne>>>32-bt,et);var ne,bt}function X(B,Q,et,ft,ae,Oe,ne){return J(Q&et|~Q&ft,B,Q,ae,Oe,ne)}function ct(B,Q,et,ft,ae,Oe,ne){return J(Q&ft|et&~ft,B,Q,ae,Oe,ne)}function tt(B,Q,et,ft,ae,Oe,ne){return J(Q^et^ft,B,Q,ae,Oe,ne)}function $(B,Q,et,ft,ae,Oe,ne){return J(et^(Q|~ft),B,Q,ae,Oe,ne)}function ut(B,Q){var et,ft,ae,Oe,ne;B[Q>>5]|=128<<Q%32,B[14+(Q+64>>>9<<4)]=Q;var bt=1732584193,Jt=-271733879,Kt=-1732584194,rt=271733878;for(et=0;et<B.length;et+=16)ft=bt,ae=Jt,Oe=Kt,ne=rt,bt=X(bt,Jt,Kt,rt,B[et],7,-680876936),rt=X(rt,bt,Jt,Kt,B[et+1],12,-389564586),Kt=X(Kt,rt,bt,Jt,B[et+2],17,606105819),Jt=X(Jt,Kt,rt,bt,B[et+3],22,-1044525330),bt=X(bt,Jt,Kt,rt,B[et+4],7,-176418897),rt=X(rt,bt,Jt,Kt,B[et+5],12,1200080426),Kt=X(Kt,rt,bt,Jt,B[et+6],17,-1473231341),Jt=X(Jt,Kt,rt,bt,B[et+7],22,-45705983),bt=X(bt,Jt,Kt,rt,B[et+8],7,1770035416),rt=X(rt,bt,Jt,Kt,B[et+9],12,-1958414417),Kt=X(Kt,rt,bt,Jt,B[et+10],17,-42063),Jt=X(Jt,Kt,rt,bt,B[et+11],22,-1990404162),bt=X(bt,Jt,Kt,rt,B[et+12],7,1804603682),rt=X(rt,bt,Jt,Kt,B[et+13],12,-40341101),Kt=X(Kt,rt,bt,Jt,B[et+14],17,-1502002290),bt=ct(bt,Jt=X(Jt,Kt,rt,bt,B[et+15],22,1236535329),Kt,rt,B[et+1],5,-165796510),rt=ct(rt,bt,Jt,Kt,B[et+6],9,-1069501632),Kt=ct(Kt,rt,bt,Jt,B[et+11],14,643717713),Jt=ct(Jt,Kt,rt,bt,B[et],20,-373897302),bt=ct(bt,Jt,Kt,rt,B[et+5],5,-701558691),rt=ct(rt,bt,Jt,Kt,B[et+10],9,38016083),Kt=ct(Kt,rt,bt,Jt,B[et+15],14,-660478335),Jt=ct(Jt,Kt,rt,bt,B[et+4],20,-405537848),bt=ct(bt,Jt,Kt,rt,B[et+9],5,568446438),rt=ct(rt,bt,Jt,Kt,B[et+14],9,-1019803690),Kt=ct(Kt,rt,bt,Jt,B[et+3],14,-187363961),Jt=ct(Jt,Kt,rt,bt,B[et+8],20,1163531501),bt=ct(bt,Jt,Kt,rt,B[et+13],5,-1444681467),rt=ct(rt,bt,Jt,Kt,B[et+2],9,-51403784),Kt=ct(Kt,rt,bt,Jt,B[et+7],14,1735328473),bt=tt(bt,Jt=ct(Jt,Kt,rt,bt,B[et+12],20,-1926607734),Kt,rt,B[et+5],4,-378558),rt=tt(rt,bt,Jt,Kt,B[et+8],11,-2022574463),Kt=tt(Kt,rt,bt,Jt,B[et+11],16,1839030562),Jt=tt(Jt,Kt,rt,bt,B[et+14],23,-35309556),bt=tt(bt,Jt,Kt,rt,B[et+1],4,-1530992060),rt=tt(rt,bt,Jt,Kt,B[et+4],11,1272893353),Kt=tt(Kt,rt,bt,Jt,B[et+7],16,-155497632),Jt=tt(Jt,Kt,rt,bt,B[et+10],23,-1094730640),bt=tt(bt,Jt,Kt,rt,B[et+13],4,681279174),rt=tt(rt,bt,Jt,Kt,B[et],11,-358537222),Kt=tt(Kt,rt,bt,Jt,B[et+3],16,-722521979),Jt=tt(Jt,Kt,rt,bt,B[et+6],23,76029189),bt=tt(bt,Jt,Kt,rt,B[et+9],4,-640364487),rt=tt(rt,bt,Jt,Kt,B[et+12],11,-421815835),Kt=tt(Kt,rt,bt,Jt,B[et+15],16,530742520),bt=$(bt,Jt=tt(Jt,Kt,rt,bt,B[et+2],23,-995338651),Kt,rt,B[et],6,-198630844),rt=$(rt,bt,Jt,Kt,B[et+7],10,1126891415),Kt=$(Kt,rt,bt,Jt,B[et+14],15,-1416354905),Jt=$(Jt,Kt,rt,bt,B[et+5],21,-57434055),bt=$(bt,Jt,Kt,rt,B[et+12],6,1700485571),rt=$(rt,bt,Jt,Kt,B[et+3],10,-1894986606),Kt=$(Kt,rt,bt,Jt,B[et+10],15,-1051523),Jt=$(Jt,Kt,rt,bt,B[et+1],21,-2054922799),bt=$(bt,Jt,Kt,rt,B[et+8],6,1873313359),rt=$(rt,bt,Jt,Kt,B[et+15],10,-30611744),Kt=$(Kt,rt,bt,Jt,B[et+6],15,-1560198380),Jt=$(Jt,Kt,rt,bt,B[et+13],21,1309151649),bt=$(bt,Jt,Kt,rt,B[et+4],6,-145523070),rt=$(rt,bt,Jt,Kt,B[et+11],10,-1120210379),Kt=$(Kt,rt,bt,Jt,B[et+2],15,718787259),Jt=$(Jt,Kt,rt,bt,B[et+9],21,-343485551),bt=lt(bt,ft),Jt=lt(Jt,ae),Kt=lt(Kt,Oe),rt=lt(rt,ne);return[bt,Jt,Kt,rt]}function kt(B){var Q,et="",ft=32*B.length;for(Q=0;Q<ft;Q+=8)et+=String.fromCharCode(B[Q>>5]>>>Q%32&255);return et}function Gt(B){var Q,et=[];for(et[(B.length>>2)-1]=void 0,Q=0;Q<et.length;Q+=1)et[Q]=0;var ft=8*B.length;for(Q=0;Q<ft;Q+=8)et[Q>>5]|=(255&B.charCodeAt(Q/8))<<Q%32;return et}function zt(B){var Q,et,ft="";for(et=0;et<B.length;et+=1)Q=B.charCodeAt(et),ft+="0123456789abcdef".charAt(Q>>>4&15)+"0123456789abcdef".charAt(15&Q);return ft}function L(B){return unescape(encodeURIComponent(B))}function k(B){return function(Q){return kt(ut(Gt(Q),8*Q.length))}(L(B))}function Y(B,Q){return function(et,ft){var ae,Oe,ne=Gt(et),bt=[],Jt=[];for(bt[15]=Jt[15]=void 0,ne.length>16&&(ne=ut(ne,8*et.length)),ae=0;ae<16;ae+=1)bt[ae]=909522486^ne[ae],Jt[ae]=1549556828^ne[ae];return Oe=ut(bt.concat(Gt(ft)),512+8*ft.length),kt(ut(Jt.concat(Oe),640))}(L(B),L(Q))}function ht(B,Q,et){return Q?et?Y(Q,B):zt(Y(Q,B)):et?k(B):zt(k(B))}(W=function(){return ht}.call(w,S,w,N))===void 0||(N.exports=W)})()},function(N,w,S){Object.defineProperty(w,"__esModule",{value:!0});var W=function(){function ct(tt,$){for(var ut=0;ut<$.length;ut++){var kt=$[ut];kt.enumerable=kt.enumerable||!1,kt.configurable=!0,"value"in kt&&(kt.writable=!0),Object.defineProperty(tt,kt.key,kt)}}return function(tt,$,ut){return $&&ct(tt.prototype,$),ut&&ct(tt,ut),tt}}();function pt(ct,tt){if(!(ct instanceof tt))throw new TypeError("Cannot call a class as a function")}var lt=function(){function ct(tt,$,ut){$===void 0&&($=!1),pt(this,ct),this._fn=tt,this._once=$,this._thisArg=ut,this._next=this._prev=this._owner=null}return W(ct,[{key:"detach",value:function(){return this._owner!==null&&(this._owner.detach(this),!0)}}]),ct}();function J(ct,tt){return ct._head?(ct._tail._next=tt,tt._prev=ct._tail,ct._tail=tt):(ct._head=tt,ct._tail=tt),tt._owner=ct,tt}var X=function(){function ct(){pt(this,ct),this._head=this._tail=void 0}return W(ct,[{key:"handlers",value:function(){var tt=!(arguments.length<=0||arguments[0]===void 0)&&arguments[0],$=this._head;if(tt)return!!$;for(var ut=[];$;)ut.push($),$=$._next;return ut}},{key:"has",value:function(tt){if(!(tt instanceof lt))throw new Error("MiniSignal#has(): First arg must be a MiniSignalBinding object.");return tt._owner===this}},{key:"dispatch",value:function(){var tt=this._head;if(!tt)return!1;for(;tt;)tt._once&&this.detach(tt),tt._fn.apply(tt._thisArg,arguments),tt=tt._next;return!0}},{key:"add",value:function(tt){var $=arguments.length<=1||arguments[1]===void 0?null:arguments[1];if(typeof tt!="function")throw new Error("MiniSignal#add(): First arg must be a Function.");return J(this,new lt(tt,!1,$))}},{key:"once",value:function(tt){var $=arguments.length<=1||arguments[1]===void 0?null:arguments[1];if(typeof tt!="function")throw new Error("MiniSignal#once(): First arg must be a Function.");return J(this,new lt(tt,!0,$))}},{key:"detach",value:function(tt){if(!(tt instanceof lt))throw new Error("MiniSignal#detach(): First arg must be a MiniSignalBinding object.");return tt._owner!==this||(tt._prev&&(tt._prev._next=tt._next),tt._next&&(tt._next._prev=tt._prev),tt===this._head?(this._head=tt._next,tt._next===null&&(this._tail=null)):tt===this._tail&&(this._tail=tt._prev,this._tail._next=null),tt._owner=null),this}},{key:"detachAll",value:function(){var tt=this._head;if(!tt)return this;for(this._head=this._tail=null;tt;)tt._owner=null,tt=tt._next;return this}}]),ct}();X.MiniSignalBinding=lt,w.default=X,N.exports=w.default},function(N,w){var S;S=function(){return this}();try{S=S||new Function("return this")()}catch{typeof window=="object"&&(S=window)}N.exports=S},function(N,w,S){S.r(w),S.d(w,"ACESFilmicToneMapping",function(){return $i}),S.d(w,"AddEquation",function(){return ne}),S.d(w,"AddOperation",function(){return hr}),S.d(w,"AdditiveAnimationBlendMode",function(){return xd}),S.d(w,"AdditiveBlending",function(){return et}),S.d(w,"AlphaFormat",function(){return Dn}),S.d(w,"AlwaysDepth",function(){return Wn}),S.d(w,"AlwaysStencilFunc",function(){return Li}),S.d(w,"AmbientLight",function(){return uf}),S.d(w,"AmbientLightProbe",function(){return re}),S.d(w,"AnimationClip",function(){return sd}),S.d(w,"AnimationLoader",function(){return ag}),S.d(w,"AnimationMixer",function(){return ac}),S.d(w,"AnimationObjectGroup",function(){return rm}),S.d(w,"AnimationUtils",function(){return di}),S.d(w,"ArcCurve",function(){return In}),S.d(w,"ArrayCamera",function(){return zr}),S.d(w,"ArrowHelper",function(){return Nt}),S.d(w,"Audio",function(){return tm}),S.d(w,"AudioAnalyser",function(){return Nm}),S.d(w,"AudioContext",function(){return cf}),S.d(w,"AudioListener",function(){return Qf}),S.d(w,"AudioLoader",function(){return Lm}),S.d(w,"AxesHelper",function(){return ue}),S.d(w,"AxisHelper",function(){return r0}),S.d(w,"BackSide",function(){return L}),S.d(w,"BasicDepthPacking",function(){return Jn}),S.d(w,"BasicShadowMap",function(){return $}),S.d(w,"BinaryTextureLoader",function(){return l0}),S.d(w,"Bone",function(){return no}),S.d(w,"BooleanKeyframeTrack",function(){return Kh}),S.d(w,"BoundingBoxHelper",function(){return i0}),S.d(w,"Box2",function(){return pd}),S.d(w,"Box3",function(){return To}),S.d(w,"Box3Helper",function(){return _t}),S.d(w,"BoxBufferGeometry",function(){return ha}),S.d(w,"BoxGeometry",function(){return ha}),S.d(w,"BoxHelper",function(){return K}),S.d(w,"BufferAttribute",function(){return Kn}),S.d(w,"BufferGeometry",function(){return zn}),S.d(w,"BufferGeometryLoader",function(){return up}),S.d(w,"ByteType",function(){return gs}),S.d(w,"Cache",function(){return ec}),S.d(w,"Camera",function(){return jl}),S.d(w,"CameraHelper",function(){return j}),S.d(w,"CanvasRenderer",function(){return h0}),S.d(w,"CanvasTexture",function(){return qt}),S.d(w,"CatmullRomCurve3",function(){return Zs}),S.d(w,"CineonToneMapping",function(){return On}),S.d(w,"CircleBufferGeometry",function(){return me}),S.d(w,"CircleGeometry",function(){return me}),S.d(w,"ClampToEdgeWrapping",function(){return St}),S.d(w,"Clock",function(){return Zf}),S.d(w,"Color",function(){return pn}),S.d(w,"ColorKeyframeTrack",function(){return of}),S.d(w,"CompressedTexture",function(){return Lt}),S.d(w,"CompressedTextureLoader",function(){return Mm}),S.d(w,"ConeBufferGeometry",function(){return gn}),S.d(w,"ConeGeometry",function(){return gn}),S.d(w,"CubeCamera",function(){return Ec}),S.d(w,"CubeReflectionMapping",function(){return I}),S.d(w,"CubeRefractionMapping",function(){return z}),S.d(w,"CubeTexture",function(){return Vl}),S.d(w,"CubeTextureLoader",function(){return Uf}),S.d(w,"CubeUVReflectionMapping",function(){return nt}),S.d(w,"CubeUVRefractionMapping",function(){return it}),S.d(w,"CubicBezierCurve",function(){return va}),S.d(w,"CubicBezierCurve3",function(){return _a}),S.d(w,"CubicInterpolant",function(){return Hu}),S.d(w,"CullFaceBack",function(){return X}),S.d(w,"CullFaceFront",function(){return ct}),S.d(w,"CullFaceFrontBack",function(){return tt}),S.d(w,"CullFaceNone",function(){return J}),S.d(w,"Curve",function(){return wn}),S.d(w,"CurvePath",function(){return Cm}),S.d(w,"CustomBlending",function(){return Oe}),S.d(w,"CustomToneMapping",function(){return Pi}),S.d(w,"CylinderBufferGeometry",function(){return De}),S.d(w,"CylinderGeometry",function(){return De}),S.d(w,"Cylindrical",function(){return fg}),S.d(w,"DataTexture",function(){return Is}),S.d(w,"DataTexture2DArray",function(){return Wa}),S.d(w,"DataTexture3D",function(){return Wl}),S.d(w,"DataTextureLoader",function(){return Am}),S.d(w,"DataUtils",function(){return Je}),S.d(w,"DecrementStencilOp",function(){return sl}),S.d(w,"DecrementWrapStencilOp",function(){return ah}),S.d(w,"DefaultLoadingManager",function(){return nc}),S.d(w,"DepthFormat",function(){return dn}),S.d(w,"DepthStencilFormat",function(){return rr}),S.d(w,"DepthTexture",function(){return Ee}),S.d(w,"DirectionalLight",function(){return Wu}),S.d(w,"DirectionalLightHelper",function(){return b}),S.d(w,"DiscreteInterpolant",function(){return rf}),S.d(w,"DodecahedronBufferGeometry",function(){return An}),S.d(w,"DodecahedronGeometry",function(){return An}),S.d(w,"DoubleSide",function(){return k}),S.d(w,"DstAlphaFactor",function(){return Ye}),S.d(w,"DstColorFactor",function(){return Hn}),S.d(w,"DynamicBufferAttribute",function(){return qv}),S.d(w,"DynamicCopyUsage",function(){return uh}),S.d(w,"DynamicDrawUsage",function(){return al}),S.d(w,"DynamicReadUsage",function(){return wd}),S.d(w,"EdgesGeometry",function(){return Yn}),S.d(w,"EdgesHelper",function(){return o0}),S.d(w,"EllipseCurve",function(){return lr}),S.d(w,"EqualDepth",function(){return Ur}),S.d(w,"EqualStencilFunc",function(){return lh}),S.d(w,"EquirectangularReflectionMapping",function(){return H}),S.d(w,"EquirectangularRefractionMapping",function(){return at}),S.d(w,"Euler",function(){return aa}),S.d(w,"EventDispatcher",function(){return Fa}),S.d(w,"ExtrudeBufferGeometry",function(){return Ka}),S.d(w,"ExtrudeGeometry",function(){return Ka}),S.d(w,"FaceColors",function(){return zm}),S.d(w,"FileLoader",function(){return ba}),S.d(w,"FlatShading",function(){return Y}),S.d(w,"Float16BufferAttribute",function(){return bu}),S.d(w,"Float32Attribute",function(){return e0}),S.d(w,"Float32BufferAttribute",function(){return xn}),S.d(w,"Float64Attribute",function(){return n0}),S.d(w,"Float64BufferAttribute",function(){return Sc}),S.d(w,"FloatType",function(){return ee}),S.d(w,"Fog",function(){return tu}),S.d(w,"FogExp2",function(){return Ql}),S.d(w,"Font",function(){return oo}),S.d(w,"FontLoader",function(){return qf}),S.d(w,"FrontSide",function(){return zt}),S.d(w,"Frustum",function(){return ja}),S.d(w,"GLBufferAttribute",function(){return Um}),S.d(w,"GLSL1",function(){return Na}),S.d(w,"GLSL3",function(){return Td}),S.d(w,"GammaEncoding",function(){return Yt}),S.d(w,"GreaterDepth",function(){return qr}),S.d(w,"GreaterEqualDepth",function(){return Rr}),S.d(w,"GreaterEqualStencilFunc",function(){return Ll}),S.d(w,"GreaterStencilFunc",function(){return xp}),S.d(w,"GridHelper",function(){return s}),S.d(w,"Group",function(){return vl}),S.d(w,"HalfFloatType",function(){return Ft}),S.d(w,"HemisphereLight",function(){return sf}),S.d(w,"HemisphereLightHelper",function(){return r}),S.d(w,"HemisphereLightProbe",function(){return el}),S.d(w,"IcosahedronBufferGeometry",function(){return Uu}),S.d(w,"IcosahedronGeometry",function(){return Uu}),S.d(w,"ImageBitmapLoader",function(){return su}),S.d(w,"ImageLoader",function(){return op}),S.d(w,"ImageUtils",function(){return xs}),S.d(w,"ImmediateRenderObject",function(){return Ea}),S.d(w,"IncrementStencilOp",function(){return _p}),S.d(w,"IncrementWrapStencilOp",function(){return sh}),S.d(w,"InstancedBufferAttribute",function(){return hf}),S.d(w,"InstancedBufferGeometry",function(){return lp}),S.d(w,"InstancedInterleavedBuffer",function(){return im}),S.d(w,"InstancedMesh",function(){return qc}),S.d(w,"Int16Attribute",function(){return $v}),S.d(w,"Int16BufferAttribute",function(){return Lr}),S.d(w,"Int32Attribute",function(){return Qv}),S.d(w,"Int32BufferAttribute",function(){return Rd}),S.d(w,"Int8Attribute",function(){return Yv}),S.d(w,"Int8BufferAttribute",function(){return wc}),S.d(w,"IntType",function(){return Qu}),S.d(w,"InterleavedBuffer",function(){return _l}),S.d(w,"InterleavedBufferAttribute",function(){return ri}),S.d(w,"Interpolant",function(){return Js}),S.d(w,"InterpolateDiscrete",function(){return Rl}),S.d(w,"InterpolateLinear",function(){return Ii}),S.d(w,"InterpolateSmooth",function(){return Ia}),S.d(w,"InvertStencilOp",function(){return pr}),S.d(w,"JSONLoader",function(){return c0}),S.d(w,"KeepStencilOp",function(){return So}),S.d(w,"KeyframeTrack",function(){return Vo}),S.d(w,"LOD",function(){return Gh}),S.d(w,"LatheBufferGeometry",function(){return td}),S.d(w,"LatheGeometry",function(){return td}),S.d(w,"Layers",function(){return ul}),S.d(w,"LensFlare",function(){return p0}),S.d(w,"LessDepth",function(){return vn}),S.d(w,"LessEqualDepth",function(){return Pr}),S.d(w,"LessEqualStencilFunc",function(){return yp}),S.d(w,"LessStencilFunc",function(){return fc}),S.d(w,"Light",function(){return wa}),S.d(w,"LightProbe",function(){return ap}),S.d(w,"Line",function(){return Ya}),S.d(w,"Line3",function(){return Ta}),S.d(w,"LineBasicMaterial",function(){return ro}),S.d(w,"LineCurve",function(){return Bu}),S.d(w,"LineCurve3",function(){return Qd}),S.d(w,"LineDashedMaterial",function(){return Bf}),S.d(w,"LineLoop",function(){return nu}),S.d(w,"LinePieces",function(){return md}),S.d(w,"LineSegments",function(){return io}),S.d(w,"LineStrip",function(){return lc}),S.d(w,"LinearEncoding",function(){return Wr}),S.d(w,"LinearFilter",function(){return Qe}),S.d(w,"LinearInterpolant",function(){return nf}),S.d(w,"LinearMipMapLinearFilter",function(){return Ks}),S.d(w,"LinearMipMapNearestFilter",function(){return vi}),S.d(w,"LinearMipmapLinearFilter",function(){return Yr}),S.d(w,"LinearMipmapNearestFilter",function(){return Qn}),S.d(w,"LinearToneMapping",function(){return Jr}),S.d(w,"Loader",function(){return Wo}),S.d(w,"LoaderUtils",function(){return oc}),S.d(w,"LoadingManager",function(){return ya}),S.d(w,"LogLuvEncoding",function(){return Qt}),S.d(w,"LoopOnce",function(){return Ri}),S.d(w,"LoopPingPong",function(){return gp}),S.d(w,"LoopRepeat",function(){return vs}),S.d(w,"LuminanceAlphaFormat",function(){return gr}),S.d(w,"LuminanceFormat",function(){return mr}),S.d(w,"MOUSE",function(){return pt}),S.d(w,"Material",function(){return Ni}),S.d(w,"MaterialLoader",function(){return ld}),S.d(w,"Math",function(){return wp}),S.d(w,"MathUtils",function(){return wp}),S.d(w,"Matrix3",function(){return ji}),S.d(w,"Matrix4",function(){return En}),S.d(w,"MaxEquation",function(){return rt}),S.d(w,"Mesh",function(){return Bi}),S.d(w,"MeshBasicMaterial",function(){return Fi}),S.d(w,"MeshDepthMaterial",function(){return Nh}),S.d(w,"MeshDistanceMaterial",function(){return fs}),S.d(w,"MeshFaceMaterial",function(){return Vm}),S.d(w,"MeshLambertMaterial",function(){return Gu}),S.d(w,"MeshMatcapMaterial",function(){return ef}),S.d(w,"MeshNormalMaterial",function(){return Ff}),S.d(w,"MeshPhongMaterial",function(){return Df}),S.d(w,"MeshPhysicalMaterial",function(){return Of}),S.d(w,"MeshStandardMaterial",function(){return ip}),S.d(w,"MeshToonMaterial",function(){return Nf}),S.d(w,"MinEquation",function(){return Kt}),S.d(w,"MirroredRepeatWrapping",function(){return Ct}),S.d(w,"MixOperation",function(){return gi}),S.d(w,"MultiMaterial",function(){return Uv}),S.d(w,"MultiplyBlending",function(){return ae}),S.d(w,"MultiplyOperation",function(){return br}),S.d(w,"NearestFilter",function(){return wt}),S.d(w,"NearestMipMapLinearFilter",function(){return an}),S.d(w,"NearestMipMapNearestFilter",function(){return Bt}),S.d(w,"NearestMipmapLinearFilter",function(){return Le}),S.d(w,"NearestMipmapNearestFilter",function(){return Vt}),S.d(w,"NeverDepth",function(){return Bn}),S.d(w,"NeverStencilFunc",function(){return gf}),S.d(w,"NoBlending",function(){return B}),S.d(w,"NoColors",function(){return ff}),S.d(w,"NoToneMapping",function(){return Or}),S.d(w,"NormalAnimationBlendMode",function(){return Oa}),S.d(w,"NormalBlending",function(){return Q}),S.d(w,"NotEqualDepth",function(){return yr}),S.d(w,"NotEqualStencilFunc",function(){return qn}),S.d(w,"NumberKeyframeTrack",function(){return Qh}),S.d(w,"Object3D",function(){return ar}),S.d(w,"ObjectLoader",function(){return lg}),S.d(w,"ObjectSpaceNormalMap",function(){return ys}),S.d(w,"OctahedronBufferGeometry",function(){return Yh}),S.d(w,"OctahedronGeometry",function(){return Yh}),S.d(w,"OneFactor",function(){return Wt}),S.d(w,"OneMinusDstAlphaFactor",function(){return ke}),S.d(w,"OneMinusDstColorFactor",function(){return Ke}),S.d(w,"OneMinusSrcAlphaFactor",function(){return fe}),S.d(w,"OneMinusSrcColorFactor",function(){return Xt}),S.d(w,"OrthographicCamera",function(){return sp}),S.d(w,"PCFShadowMap",function(){return ut}),S.d(w,"PCFSoftShadowMap",function(){return kt}),S.d(w,"PMREMGenerator",function(){return jr}),S.d(w,"ParametricBufferGeometry",function(){return rp}),S.d(w,"ParametricGeometry",function(){return rp}),S.d(w,"Particle",function(){return Hv}),S.d(w,"ParticleBasicMaterial",function(){return Vv}),S.d(w,"ParticleSystem",function(){return zv}),S.d(w,"ParticleSystemMaterial",function(){return Wv}),S.d(w,"Path",function(){return rc}),S.d(w,"PerspectiveCamera",function(){return Yi}),S.d(w,"Plane",function(){return Ko}),S.d(w,"PlaneBufferGeometry",function(){return pa}),S.d(w,"PlaneGeometry",function(){return pa}),S.d(w,"PlaneHelper",function(){return Tt}),S.d(w,"PointCloud",function(){return Gv}),S.d(w,"PointCloudMaterial",function(){return jv}),S.d(w,"PointLight",function(){return Wf}),S.d(w,"PointLightHelper",function(){return gg}),S.d(w,"Points",function(){return q}),S.d(w,"PointsMaterial",function(){return xl}),S.d(w,"PolarGridHelper",function(){return u}),S.d(w,"PolyhedronBufferGeometry",function(){return ln}),S.d(w,"PolyhedronGeometry",function(){return ln}),S.d(w,"PositionalAudio",function(){return cg}),S.d(w,"PropertyBinding",function(){return Br}),S.d(w,"PropertyMixer",function(){return ud}),S.d(w,"QuadraticBezierCurve",function(){return ru}),S.d(w,"QuadraticBezierCurve3",function(){return zh}),S.d(w,"Quaternion",function(){return Oi}),S.d(w,"QuaternionKeyframeTrack",function(){return tc}),S.d(w,"QuaternionLinearInterpolant",function(){return kf}),S.d(w,"REVISION",function(){return W}),S.d(w,"RGBADepthPacking",function(){return is}),S.d(w,"RGBAFormat",function(){return Tn}),S.d(w,"RGBAIntegerFormat",function(){return $r}),S.d(w,"RGBA_ASTC_10x10_Format",function(){return oi}),S.d(w,"RGBA_ASTC_10x5_Format",function(){return Pa}),S.d(w,"RGBA_ASTC_10x6_Format",function(){return El}),S.d(w,"RGBA_ASTC_10x8_Format",function(){return dc}),S.d(w,"RGBA_ASTC_12x10_Format",function(){return Ml}),S.d(w,"RGBA_ASTC_12x12_Format",function(){return yi}),S.d(w,"RGBA_ASTC_4x4_Format",function(){return _d}),S.d(w,"RGBA_ASTC_5x4_Format",function(){return uo}),S.d(w,"RGBA_ASTC_5x5_Format",function(){return _i}),S.d(w,"RGBA_ASTC_6x5_Format",function(){return fu}),S.d(w,"RGBA_ASTC_6x6_Format",function(){return Ca}),S.d(w,"RGBA_ASTC_8x5_Format",function(){return nh}),S.d(w,"RGBA_ASTC_8x6_Format",function(){return dr}),S.d(w,"RGBA_ASTC_8x8_Format",function(){return ti}),S.d(w,"RGBA_BPTC_Format",function(){return Fs}),S.d(w,"RGBA_ETC2_EAC_Format",function(){return Do}),S.d(w,"RGBA_PVRTC_2BPPV1_Format",function(){return th}),S.d(w,"RGBA_PVRTC_4BPPV1_Format",function(){return du}),S.d(w,"RGBA_S3TC_DXT1_Format",function(){return cu}),S.d(w,"RGBA_S3TC_DXT3_Format",function(){return Ki}),S.d(w,"RGBA_S3TC_DXT5_Format",function(){return Qr}),S.d(w,"RGBDEncoding",function(){return Mr}),S.d(w,"RGBEEncoding",function(){return _e}),S.d(w,"RGBEFormat",function(){return hn}),S.d(w,"RGBFormat",function(){return yn}),S.d(w,"RGBIntegerFormat",function(){return Er}),S.d(w,"RGBM16Encoding",function(){return Xn}),S.d(w,"RGBM7Encoding",function(){return tn}),S.d(w,"RGB_ETC1_Format",function(){return pu}),S.d(w,"RGB_ETC2_Format",function(){return eh}),S.d(w,"RGB_PVRTC_2BPPV1_Format",function(){return cc}),S.d(w,"RGB_PVRTC_4BPPV1_Format",function(){return hc}),S.d(w,"RGB_S3TC_DXT1_Format",function(){return ns}),S.d(w,"RGFormat",function(){return Gr}),S.d(w,"RGIntegerFormat",function(){return ii}),S.d(w,"RawShaderMaterial",function(){return $h}),S.d(w,"Ray",function(){return ka}),S.d(w,"Raycaster",function(){return dg}),S.d(w,"RectAreaLight",function(){return ic}),S.d(w,"RedFormat",function(){return ui}),S.d(w,"RedIntegerFormat",function(){return Zn}),S.d(w,"ReinhardToneMapping",function(){return Oo}),S.d(w,"RepeatWrapping",function(){return yt}),S.d(w,"ReplaceStencilOp",function(){return mu}),S.d(w,"ReverseSubtractEquation",function(){return Jt}),S.d(w,"RingBufferGeometry",function(){return ed}),S.d(w,"RingGeometry",function(){return ed}),S.d(w,"SRGB8_ALPHA8_ASTC_10x10_Format",function(){return hi}),S.d(w,"SRGB8_ALPHA8_ASTC_10x5_Format",function(){return Cl}),S.d(w,"SRGB8_ALPHA8_ASTC_10x6_Format",function(){return pc}),S.d(w,"SRGB8_ALPHA8_ASTC_10x8_Format",function(){return wo}),S.d(w,"SRGB8_ALPHA8_ASTC_12x10_Format",function(){return Pl}),S.d(w,"SRGB8_ALPHA8_ASTC_12x12_Format",function(){return yd}),S.d(w,"SRGB8_ALPHA8_ASTC_4x4_Format",function(){return rs}),S.d(w,"SRGB8_ALPHA8_ASTC_5x4_Format",function(){return ol}),S.d(w,"SRGB8_ALPHA8_ASTC_5x5_Format",function(){return Ra}),S.d(w,"SRGB8_ALPHA8_ASTC_6x5_Format",function(){return rh}),S.d(w,"SRGB8_ALPHA8_ASTC_6x6_Format",function(){return ih}),S.d(w,"SRGB8_ALPHA8_ASTC_8x5_Format",function(){return Al}),S.d(w,"SRGB8_ALPHA8_ASTC_8x6_Format",function(){return ei}),S.d(w,"SRGB8_ALPHA8_ASTC_8x8_Format",function(){return oh}),S.d(w,"Scene",function(){return Fh}),S.d(w,"SceneUtils",function(){return d0}),S.d(w,"ShaderChunk",function(){return vr}),S.d(w,"ShaderLib",function(){return _o}),S.d(w,"ShaderMaterial",function(){return vo}),S.d(w,"ShadowMaterial",function(){return Lf}),S.d(w,"Shape",function(){return ju}),S.d(w,"ShapeBufferGeometry",function(){return Zh}),S.d(w,"ShapeGeometry",function(){return Zh}),S.d(w,"ShapePath",function(){return au}),S.d(w,"ShapeUtils",function(){return Os}),S.d(w,"ShortType",function(){return Qs}),S.d(w,"Skeleton",function(){return Fu}),S.d(w,"SkeletonHelper",function(){return om}),S.d(w,"SkinnedMesh",function(){return jc}),S.d(w,"SmoothShading",function(){return ht}),S.d(w,"Sphere",function(){return bs}),S.d(w,"SphereBufferGeometry",function(){return Jh}),S.d(w,"SphereGeometry",function(){return Jh}),S.d(w,"Spherical",function(){return pg}),S.d(w,"SphericalHarmonics3",function(){return Re}),S.d(w,"SplineCurve",function(){return iu}),S.d(w,"SpotLight",function(){return ad}),S.d(w,"SpotLightHelper",function(){return mg}),S.d(w,"Sprite",function(){return Du}),S.d(w,"SpriteMaterial",function(){return yo}),S.d(w,"SrcAlphaFactor",function(){return le}),S.d(w,"SrcAlphaSaturateFactor",function(){return Ln}),S.d(w,"SrcColorFactor",function(){return te}),S.d(w,"StaticCopyUsage",function(){return Sd}),S.d(w,"StaticDrawUsage",function(){return Da}),S.d(w,"StaticReadUsage",function(){return Qi}),S.d(w,"StereoCamera",function(){return ug}),S.d(w,"StreamCopyUsage",function(){return Ol}),S.d(w,"StreamDrawUsage",function(){return mc}),S.d(w,"StreamReadUsage",function(){return gc}),S.d(w,"StringKeyframeTrack",function(){return Qa}),S.d(w,"SubtractEquation",function(){return bt}),S.d(w,"SubtractiveBlending",function(){return ft}),S.d(w,"TOUCH",function(){return lt}),S.d(w,"TangentSpaceNormalMap",function(){return Hr}),S.d(w,"TetrahedronBufferGeometry",function(){return nd}),S.d(w,"TetrahedronGeometry",function(){return nd}),S.d(w,"TextBufferGeometry",function(){return tf}),S.d(w,"TextGeometry",function(){return tf}),S.d(w,"Texture",function(){return ni}),S.d(w,"TextureLoader",function(){return Gf}),S.d(w,"TorusBufferGeometry",function(){return rd}),S.d(w,"TorusGeometry",function(){return rd}),S.d(w,"TorusKnotBufferGeometry",function(){return id}),S.d(w,"TorusKnotGeometry",function(){return id}),S.d(w,"Triangle",function(){return bi}),S.d(w,"TriangleFanDrawMode",function(){return vp}),S.d(w,"TriangleStripDrawMode",function(){return Zo}),S.d(w,"TrianglesDrawMode",function(){return Il}),S.d(w,"TubeBufferGeometry",function(){return od}),S.d(w,"TubeGeometry",function(){return od}),S.d(w,"UVMapping",function(){return ao}),S.d(w,"Uint16Attribute",function(){return Kv}),S.d(w,"Uint16BufferAttribute",function(){return er}),S.d(w,"Uint32Attribute",function(){return t0}),S.d(w,"Uint32BufferAttribute",function(){return fo}),S.d(w,"Uint8Attribute",function(){return Zv}),S.d(w,"Uint8BufferAttribute",function(){return Pd}),S.d(w,"Uint8ClampedAttribute",function(){return Jv}),S.d(w,"Uint8ClampedBufferAttribute",function(){return wi}),S.d(w,"Uniform",function(){return cd}),S.d(w,"UniformsLib",function(){return Ze}),S.d(w,"UniformsUtils",function(){return Od}),S.d(w,"UnsignedByteType",function(){return lo}),S.d(w,"UnsignedInt248Type",function(){return un}),S.d(w,"UnsignedIntType",function(){return Yo}),S.d(w,"UnsignedShort4444Type",function(){return Se}),S.d(w,"UnsignedShort5551Type",function(){return Ge}),S.d(w,"UnsignedShort565Type",function(){return Ve}),S.d(w,"UnsignedShortType",function(){return Aa}),S.d(w,"VSMShadowMap",function(){return Gt}),S.d(w,"Vector2",function(){return He}),S.d(w,"Vector3",function(){return gt}),S.d(w,"Vector4",function(){return Ir}),S.d(w,"VectorKeyframeTrack",function(){return zu}),S.d(w,"Vertex",function(){return Xv}),S.d(w,"VertexColors",function(){return jm}),S.d(w,"VideoTexture",function(){return Mt}),S.d(w,"WebGL1Renderer",function(){return qp}),S.d(w,"WebGLCubeRenderTarget",function(){return ds}),S.d(w,"WebGLMultipleRenderTargets",function(){return ia}),S.d(w,"WebGLMultisampleRenderTarget",function(){return vc}),S.d(w,"WebGLRenderTarget",function(){return Fo}),S.d(w,"WebGLRenderTargetCube",function(){return u0}),S.d(w,"WebGLRenderer",function(){return Fr}),S.d(w,"WebGLUtils",function(){return Gc}),S.d(w,"WireframeGeometry",function(){return If}),S.d(w,"WireframeHelper",function(){return s0}),S.d(w,"WrapAroundEnding",function(){return _s}),S.d(w,"XHRLoader",function(){return a0}),S.d(w,"ZeroCurvatureEnding",function(){return ta}),S.d(w,"ZeroFactor",function(){return Ut}),S.d(w,"ZeroSlopeEnding",function(){return La}),S.d(w,"ZeroStencilOp",function(){return bd}),S.d(w,"sRGBEncoding",function(){return Bs});/**
27
+ }`;var ve=Jd(function(){return Jn(Lt,ln+"return "+De).apply(void 0,qt)});if(ve.source=De,Fc(ve))throw ve;return ve},st.times=function(c,g){if((c=or(c))<1||c>9007199254740991)return[];var E=4294967295,F=to(c,4294967295);c-=4294967295;for(var q=Cl(F,g=Rn(g));++E<c;)g(E);return q},st.toFinite=fs,st.toInteger=or,st.toLength=qd,st.toLower=function(c){return zr(c).toLowerCase()},st.toNumber=As,st.toSafeInteger=function(c){return c?Go(or(c),-9007199254740991,9007199254740991):c===0?c:0},st.toString=zr,st.toUpper=function(c){return zr(c).toUpperCase()},st.trim=function(c,g,E){if((c=zr(c))&&(E||g===void 0))return pc(c);if(!c||!(g=wi(g)))return c;var F=Zo(c),q=Zo(g);return Wi(F,yd(F,q),Ri(F,q)+1).join("")},st.trimEnd=function(c,g,E){if((c=zr(c))&&(E||g===void 0))return c.slice(0,vp(c)+1);if(!c||!(g=wi(g)))return c;var F=Zo(c);return Wi(F,0,Ri(F,Zo(g))+1).join("")},st.trimStart=function(c,g,E){if((c=zr(c))&&(E||g===void 0))return c.replace(br,"");if(!c||!(g=wi(g)))return c;var F=Zo(c);return Wi(F,yd(F,Zo(g))).join("")},st.truncate=function(c,g){var E=30,F="...";if(si(g)){var q="separator"in g?g.separator:q;E="length"in g?or(g.length):E,F="omission"in g?wi(g.omission):F}var dt=(c=zr(c)).length;if(Ia(c)){var Mt=Zo(c);dt=Mt.length}if(E>=dt)return c;var Lt=E-Il(F);if(Lt<1)return F;var qt=Mt?Wi(Mt,0,Lt).join(""):c.slice(0,Lt);if(q===void 0)return qt+F;if(Mt&&(Lt+=qt.length-Lt),Uc(q)){if(c.slice(Lt).search(q)){var Ee,me=qt;for(q.global||(q=ys(q.source,zr(ao.exec(q))+"g")),q.lastIndex=0;Ee=q.exec(me);)var De=Ee.index;qt=qt.slice(0,De===void 0?Lt:De)}}else if(c.indexOf(wi(q),Lt)!=Lt){var gn=qt.lastIndexOf(q);gn>-1&&(qt=qt.slice(0,gn))}return qt+F},st.unescape=function(c){return(c=zr(c))&&Ke.test(c)?c.replace(ke,Wr):c},st.uniqueId=function(c){var g=++gf;return zr(c)+g},st.upperCase=Yd,st.upperFirst=Gh,st.each=Ph,st.eachRight=kp,st.first=Fd,Fu(st,($c={},eo(st,function(c,g){pr.call(st.prototype,g)||($c[g]=c)}),$c),{chain:!1}),st.VERSION="4.17.21",uo(["bind","bindKey","curry","curryRight","partial","partialRight"],function(c){st[c].placeholder=st}),uo(["drop","take"],function(c,g){tr.prototype[c]=function(E){E=E===void 0?1:xi(or(E),0);var F=this.__filtered__&&!g?new tr(this):this.clone();return F.__filtered__?F.__takeCount__=to(E,F.__takeCount__):F.__views__.push({size:to(E,4294967295),type:c+(F.__dir__<0?"Right":"")}),F},tr.prototype[c+"Right"]=function(E){return this.reverse()[c](E).reverse()}}),uo(["filter","map","takeWhile"],function(c,g){var E=g+1,F=E==1||E==3;tr.prototype[c]=function(q){var dt=this.clone();return dt.__iteratees__.push({iteratee:Rn(q,3),type:E}),dt.__filtered__=dt.__filtered__||F,dt}}),uo(["head","last"],function(c,g){var E="take"+(g?"Right":"");tr.prototype[c]=function(){return this[E](1).value()[0]}}),uo(["initial","tail"],function(c,g){var E="drop"+(g?"":"Right");tr.prototype[c]=function(){return this.__filtered__?new tr(this):this[E](1)}}),tr.prototype.compact=function(){return this.filter(no)},tr.prototype.find=function(c){return this.filter(c).head()},tr.prototype.findLast=function(c){return this.reverse().find(c)},tr.prototype.invokeMap=fr(function(c,g){return typeof c=="function"?new tr(this):this.map(function(E){return gh(E,c,g)})}),tr.prototype.reject=function(c){return this.filter(Lh(Rn(c)))},tr.prototype.slice=function(c,g){c=or(c);var E=this;return E.__filtered__&&(c>0||g<0)?new tr(E):(c<0?E=E.takeRight(-c):c&&(E=E.drop(c)),g!==void 0&&(E=(g=or(g))<0?E.dropRight(-g):E.take(g-c)),E)},tr.prototype.takeRightWhile=function(c){return this.reverse().takeWhile(c).reverse()},tr.prototype.toArray=function(){return this.take(4294967295)},eo(tr.prototype,function(c,g){var E=/^(?:filter|find|map|reject)|While$/.test(g),F=/^(?:head|last)$/.test(g),q=st[F?"take"+(g=="last"?"Right":""):g],dt=F||/^find/.test(g);q&&(st.prototype[g]=function(){var Mt=this.__wrapped__,Lt=F?[1]:arguments,qt=Mt instanceof tr,Ee=Lt[0],me=qt||ir(Mt),De=function(Un){var mn=q.apply(st,Pa([Un],Lt));return F&&gn?mn[0]:mn};me&&E&&typeof Ee=="function"&&Ee.length!=1&&(qt=me=!1);var gn=this.__chain__,ln=!!this.__actions__.length,An=dt&&!gn,ve=qt&&!ln;if(!dt&&me){Mt=ve?Mt:new tr(this);var Xe=c.apply(Mt,Lt);return Xe.__actions__.push({func:Lc,args:[De],thisArg:void 0}),new co(Xe,gn)}return An&&ve?c.apply(this,Lt):(Xe=this.thru(De),An?F?Xe.value()[0]:Xe.value():Xe)})}),uo(["pop","push","shift","sort","splice","unshift"],function(c){var g=mu[c],E=/^(?:push|sort|unshift)$/.test(c)?"tap":"thru",F=/^(?:pop|shift)$/.test(c);st.prototype[c]=function(){var q=arguments;if(F&&!this.__chain__){var dt=this.value();return g.apply(ir(dt)?dt:[],q)}return this[E](function(Mt){return g.apply(ir(Mt)?Mt:[],q)})}}),eo(tr.prototype,function(c,g){var E=st[g];if(E){var F=E.name+"";pr.call(ia,F)||(ia[F]=[]),ia[F].push({name:g,func:E})}}),ia[pl(void 0,2).name]=[{name:"wrapper",func:void 0}],tr.prototype.clone=function(){var c=new tr(this.__wrapped__);return c.__actions__=qi(this.__actions__),c.__dir__=this.__dir__,c.__filtered__=this.__filtered__,c.__iteratees__=qi(this.__iteratees__),c.__takeCount__=this.__takeCount__,c.__views__=qi(this.__views__),c},tr.prototype.reverse=function(){if(this.__filtered__){var c=new tr(this);c.__dir__=-1,c.__filtered__=!0}else(c=this.clone()).__dir__*=-1;return c},tr.prototype.value=function(){var c=this.__wrapped__.value(),g=this.__dir__,E=ir(c),F=g<0,q=E?c.length:0,dt=function(lr,In,jn){for(var Ei=-1,xo=jn.length;++Ei<xo;){var Ls=jn[Ei],ki=Ls.size;switch(Ls.type){case"drop":lr+=ki;break;case"dropRight":In-=ki;break;case"take":In=to(In,lr+ki);break;case"takeRight":lr=xi(lr,In-ki)}}return{start:lr,end:In}}(0,q,this.__views__),Mt=dt.start,Lt=dt.end,qt=Lt-Mt,Ee=F?Lt:Mt-1,me=this.__iteratees__,De=me.length,gn=0,ln=to(qt,this.__takeCount__);if(!E||!F&&q==qt&&ln==qt)return bu(c,this.__actions__);var An=[];t:for(;qt--&&gn<ln;){for(var ve=-1,Xe=c[Ee+=g];++ve<De;){var Un=me[ve],mn=Un.iteratee,Yn=Un.type,wn=mn(Xe);if(Yn==2)Xe=wn;else if(!wn){if(Yn==1)continue t;break t}}An[gn++]=Xe}return An},st.prototype.at=Np,st.prototype.chain=function(){return Hd(this)},st.prototype.commit=function(){return new co(this.value(),this.__chain__)},st.prototype.next=function(){this.__values__===void 0&&(this.__values__=Nh(this.value()));var c=this.__index__>=this.__values__.length;return{done:c,value:c?void 0:this.__values__[this.__index__++]}},st.prototype.plant=function(c){for(var g,E=this;E instanceof Ba;){var F=ql(E);F.__index__=0,F.__values__=void 0,g?q.__wrapped__=F:g=F;var q=F;E=E.__wrapped__}return q.__wrapped__=c,g},st.prototype.reverse=function(){var c=this.__wrapped__;if(c instanceof tr){var g=c;return this.__actions__.length&&(g=new tr(this)),(g=g.reverse()).__actions__.push({func:Lc,args:[Ud],thisArg:void 0}),new co(g,this.__chain__)}return this.thru(Ud)},st.prototype.toJSON=st.prototype.valueOf=st.prototype.value=function(){return bu(this.__wrapped__,this.__actions__)},st.prototype.first=st.prototype.head,uh&&(st.prototype[uh]=function(){return this}),st}();Er._=Bs,(lt=function(){return Bs}.call(w,S,w,pt))===void 0||(pt.exports=lt)}).call(this)}).call(this,S(4),S(11)(N))},function(N,w,S){var W;(function(pt){function lt(B,Q){var et=(65535&B)+(65535&Q);return(B>>16)+(Q>>16)+(et>>16)<<16|65535&et}function J(B,Q,et,ft,ae,Oe){return lt((ne=lt(lt(Q,B),lt(ft,Oe)))<<(bt=ae)|ne>>>32-bt,et);var ne,bt}function X(B,Q,et,ft,ae,Oe,ne){return J(Q&et|~Q&ft,B,Q,ae,Oe,ne)}function ct(B,Q,et,ft,ae,Oe,ne){return J(Q&ft|et&~ft,B,Q,ae,Oe,ne)}function tt(B,Q,et,ft,ae,Oe,ne){return J(Q^et^ft,B,Q,ae,Oe,ne)}function $(B,Q,et,ft,ae,Oe,ne){return J(et^(Q|~ft),B,Q,ae,Oe,ne)}function ut(B,Q){var et,ft,ae,Oe,ne;B[Q>>5]|=128<<Q%32,B[14+(Q+64>>>9<<4)]=Q;var bt=1732584193,Jt=-271733879,Kt=-1732584194,rt=271733878;for(et=0;et<B.length;et+=16)ft=bt,ae=Jt,Oe=Kt,ne=rt,bt=X(bt,Jt,Kt,rt,B[et],7,-680876936),rt=X(rt,bt,Jt,Kt,B[et+1],12,-389564586),Kt=X(Kt,rt,bt,Jt,B[et+2],17,606105819),Jt=X(Jt,Kt,rt,bt,B[et+3],22,-1044525330),bt=X(bt,Jt,Kt,rt,B[et+4],7,-176418897),rt=X(rt,bt,Jt,Kt,B[et+5],12,1200080426),Kt=X(Kt,rt,bt,Jt,B[et+6],17,-1473231341),Jt=X(Jt,Kt,rt,bt,B[et+7],22,-45705983),bt=X(bt,Jt,Kt,rt,B[et+8],7,1770035416),rt=X(rt,bt,Jt,Kt,B[et+9],12,-1958414417),Kt=X(Kt,rt,bt,Jt,B[et+10],17,-42063),Jt=X(Jt,Kt,rt,bt,B[et+11],22,-1990404162),bt=X(bt,Jt,Kt,rt,B[et+12],7,1804603682),rt=X(rt,bt,Jt,Kt,B[et+13],12,-40341101),Kt=X(Kt,rt,bt,Jt,B[et+14],17,-1502002290),bt=ct(bt,Jt=X(Jt,Kt,rt,bt,B[et+15],22,1236535329),Kt,rt,B[et+1],5,-165796510),rt=ct(rt,bt,Jt,Kt,B[et+6],9,-1069501632),Kt=ct(Kt,rt,bt,Jt,B[et+11],14,643717713),Jt=ct(Jt,Kt,rt,bt,B[et],20,-373897302),bt=ct(bt,Jt,Kt,rt,B[et+5],5,-701558691),rt=ct(rt,bt,Jt,Kt,B[et+10],9,38016083),Kt=ct(Kt,rt,bt,Jt,B[et+15],14,-660478335),Jt=ct(Jt,Kt,rt,bt,B[et+4],20,-405537848),bt=ct(bt,Jt,Kt,rt,B[et+9],5,568446438),rt=ct(rt,bt,Jt,Kt,B[et+14],9,-1019803690),Kt=ct(Kt,rt,bt,Jt,B[et+3],14,-187363961),Jt=ct(Jt,Kt,rt,bt,B[et+8],20,1163531501),bt=ct(bt,Jt,Kt,rt,B[et+13],5,-1444681467),rt=ct(rt,bt,Jt,Kt,B[et+2],9,-51403784),Kt=ct(Kt,rt,bt,Jt,B[et+7],14,1735328473),bt=tt(bt,Jt=ct(Jt,Kt,rt,bt,B[et+12],20,-1926607734),Kt,rt,B[et+5],4,-378558),rt=tt(rt,bt,Jt,Kt,B[et+8],11,-2022574463),Kt=tt(Kt,rt,bt,Jt,B[et+11],16,1839030562),Jt=tt(Jt,Kt,rt,bt,B[et+14],23,-35309556),bt=tt(bt,Jt,Kt,rt,B[et+1],4,-1530992060),rt=tt(rt,bt,Jt,Kt,B[et+4],11,1272893353),Kt=tt(Kt,rt,bt,Jt,B[et+7],16,-155497632),Jt=tt(Jt,Kt,rt,bt,B[et+10],23,-1094730640),bt=tt(bt,Jt,Kt,rt,B[et+13],4,681279174),rt=tt(rt,bt,Jt,Kt,B[et],11,-358537222),Kt=tt(Kt,rt,bt,Jt,B[et+3],16,-722521979),Jt=tt(Jt,Kt,rt,bt,B[et+6],23,76029189),bt=tt(bt,Jt,Kt,rt,B[et+9],4,-640364487),rt=tt(rt,bt,Jt,Kt,B[et+12],11,-421815835),Kt=tt(Kt,rt,bt,Jt,B[et+15],16,530742520),bt=$(bt,Jt=tt(Jt,Kt,rt,bt,B[et+2],23,-995338651),Kt,rt,B[et],6,-198630844),rt=$(rt,bt,Jt,Kt,B[et+7],10,1126891415),Kt=$(Kt,rt,bt,Jt,B[et+14],15,-1416354905),Jt=$(Jt,Kt,rt,bt,B[et+5],21,-57434055),bt=$(bt,Jt,Kt,rt,B[et+12],6,1700485571),rt=$(rt,bt,Jt,Kt,B[et+3],10,-1894986606),Kt=$(Kt,rt,bt,Jt,B[et+10],15,-1051523),Jt=$(Jt,Kt,rt,bt,B[et+1],21,-2054922799),bt=$(bt,Jt,Kt,rt,B[et+8],6,1873313359),rt=$(rt,bt,Jt,Kt,B[et+15],10,-30611744),Kt=$(Kt,rt,bt,Jt,B[et+6],15,-1560198380),Jt=$(Jt,Kt,rt,bt,B[et+13],21,1309151649),bt=$(bt,Jt,Kt,rt,B[et+4],6,-145523070),rt=$(rt,bt,Jt,Kt,B[et+11],10,-1120210379),Kt=$(Kt,rt,bt,Jt,B[et+2],15,718787259),Jt=$(Jt,Kt,rt,bt,B[et+9],21,-343485551),bt=lt(bt,ft),Jt=lt(Jt,ae),Kt=lt(Kt,Oe),rt=lt(rt,ne);return[bt,Jt,Kt,rt]}function kt(B){var Q,et="",ft=32*B.length;for(Q=0;Q<ft;Q+=8)et+=String.fromCharCode(B[Q>>5]>>>Q%32&255);return et}function Gt(B){var Q,et=[];for(et[(B.length>>2)-1]=void 0,Q=0;Q<et.length;Q+=1)et[Q]=0;var ft=8*B.length;for(Q=0;Q<ft;Q+=8)et[Q>>5]|=(255&B.charCodeAt(Q/8))<<Q%32;return et}function zt(B){var Q,et,ft="";for(et=0;et<B.length;et+=1)Q=B.charCodeAt(et),ft+="0123456789abcdef".charAt(Q>>>4&15)+"0123456789abcdef".charAt(15&Q);return ft}function L(B){return unescape(encodeURIComponent(B))}function k(B){return function(Q){return kt(ut(Gt(Q),8*Q.length))}(L(B))}function Y(B,Q){return function(et,ft){var ae,Oe,ne=Gt(et),bt=[],Jt=[];for(bt[15]=Jt[15]=void 0,ne.length>16&&(ne=ut(ne,8*et.length)),ae=0;ae<16;ae+=1)bt[ae]=909522486^ne[ae],Jt[ae]=1549556828^ne[ae];return Oe=ut(bt.concat(Gt(ft)),512+8*ft.length),kt(ut(Jt.concat(Oe),640))}(L(B),L(Q))}function ht(B,Q,et){return Q?et?Y(Q,B):zt(Y(Q,B)):et?k(B):zt(k(B))}(W=function(){return ht}.call(w,S,w,N))===void 0||(N.exports=W)})()},function(N,w,S){Object.defineProperty(w,"__esModule",{value:!0});var W=function(){function ct(tt,$){for(var ut=0;ut<$.length;ut++){var kt=$[ut];kt.enumerable=kt.enumerable||!1,kt.configurable=!0,"value"in kt&&(kt.writable=!0),Object.defineProperty(tt,kt.key,kt)}}return function(tt,$,ut){return $&&ct(tt.prototype,$),ut&&ct(tt,ut),tt}}();function pt(ct,tt){if(!(ct instanceof tt))throw new TypeError("Cannot call a class as a function")}var lt=function(){function ct(tt,$,ut){$===void 0&&($=!1),pt(this,ct),this._fn=tt,this._once=$,this._thisArg=ut,this._next=this._prev=this._owner=null}return W(ct,[{key:"detach",value:function(){return this._owner!==null&&(this._owner.detach(this),!0)}}]),ct}();function J(ct,tt){return ct._head?(ct._tail._next=tt,tt._prev=ct._tail,ct._tail=tt):(ct._head=tt,ct._tail=tt),tt._owner=ct,tt}var X=function(){function ct(){pt(this,ct),this._head=this._tail=void 0}return W(ct,[{key:"handlers",value:function(){var tt=!(arguments.length<=0||arguments[0]===void 0)&&arguments[0],$=this._head;if(tt)return!!$;for(var ut=[];$;)ut.push($),$=$._next;return ut}},{key:"has",value:function(tt){if(!(tt instanceof lt))throw new Error("MiniSignal#has(): First arg must be a MiniSignalBinding object.");return tt._owner===this}},{key:"dispatch",value:function(){var tt=this._head;if(!tt)return!1;for(;tt;)tt._once&&this.detach(tt),tt._fn.apply(tt._thisArg,arguments),tt=tt._next;return!0}},{key:"add",value:function(tt){var $=arguments.length<=1||arguments[1]===void 0?null:arguments[1];if(typeof tt!="function")throw new Error("MiniSignal#add(): First arg must be a Function.");return J(this,new lt(tt,!1,$))}},{key:"once",value:function(tt){var $=arguments.length<=1||arguments[1]===void 0?null:arguments[1];if(typeof tt!="function")throw new Error("MiniSignal#once(): First arg must be a Function.");return J(this,new lt(tt,!0,$))}},{key:"detach",value:function(tt){if(!(tt instanceof lt))throw new Error("MiniSignal#detach(): First arg must be a MiniSignalBinding object.");return tt._owner!==this||(tt._prev&&(tt._prev._next=tt._next),tt._next&&(tt._next._prev=tt._prev),tt===this._head?(this._head=tt._next,tt._next===null&&(this._tail=null)):tt===this._tail&&(this._tail=tt._prev,this._tail._next=null),tt._owner=null),this}},{key:"detachAll",value:function(){var tt=this._head;if(!tt)return this;for(this._head=this._tail=null;tt;)tt._owner=null,tt=tt._next;return this}}]),ct}();X.MiniSignalBinding=lt,w.default=X,N.exports=w.default},function(N,w){var S;S=function(){return this}();try{S=S||new Function("return this")()}catch{typeof window=="object"&&(S=window)}N.exports=S},function(N,w,S){S.r(w),S.d(w,"ACESFilmicToneMapping",function(){return $i}),S.d(w,"AddEquation",function(){return ne}),S.d(w,"AddOperation",function(){return hr}),S.d(w,"AdditiveAnimationBlendMode",function(){return xd}),S.d(w,"AdditiveBlending",function(){return et}),S.d(w,"AlphaFormat",function(){return Dn}),S.d(w,"AlwaysDepth",function(){return Wn}),S.d(w,"AlwaysStencilFunc",function(){return Li}),S.d(w,"AmbientLight",function(){return uf}),S.d(w,"AmbientLightProbe",function(){return re}),S.d(w,"AnimationClip",function(){return sd}),S.d(w,"AnimationLoader",function(){return ag}),S.d(w,"AnimationMixer",function(){return ac}),S.d(w,"AnimationObjectGroup",function(){return rm}),S.d(w,"AnimationUtils",function(){return di}),S.d(w,"ArcCurve",function(){return In}),S.d(w,"ArrayCamera",function(){return zr}),S.d(w,"ArrowHelper",function(){return Nt}),S.d(w,"Audio",function(){return tm}),S.d(w,"AudioAnalyser",function(){return Fm}),S.d(w,"AudioContext",function(){return cf}),S.d(w,"AudioListener",function(){return Qf}),S.d(w,"AudioLoader",function(){return Om}),S.d(w,"AxesHelper",function(){return ue}),S.d(w,"AxisHelper",function(){return r0}),S.d(w,"BackSide",function(){return L}),S.d(w,"BasicDepthPacking",function(){return Jn}),S.d(w,"BasicShadowMap",function(){return $}),S.d(w,"BinaryTextureLoader",function(){return l0}),S.d(w,"Bone",function(){return no}),S.d(w,"BooleanKeyframeTrack",function(){return Kh}),S.d(w,"BoundingBoxHelper",function(){return i0}),S.d(w,"Box2",function(){return pd}),S.d(w,"Box3",function(){return To}),S.d(w,"Box3Helper",function(){return _t}),S.d(w,"BoxBufferGeometry",function(){return ha}),S.d(w,"BoxGeometry",function(){return ha}),S.d(w,"BoxHelper",function(){return K}),S.d(w,"BufferAttribute",function(){return Kn}),S.d(w,"BufferGeometry",function(){return zn}),S.d(w,"BufferGeometryLoader",function(){return up}),S.d(w,"ByteType",function(){return gs}),S.d(w,"Cache",function(){return ec}),S.d(w,"Camera",function(){return jl}),S.d(w,"CameraHelper",function(){return j}),S.d(w,"CanvasRenderer",function(){return h0}),S.d(w,"CanvasTexture",function(){return qt}),S.d(w,"CatmullRomCurve3",function(){return Zs}),S.d(w,"CineonToneMapping",function(){return On}),S.d(w,"CircleBufferGeometry",function(){return me}),S.d(w,"CircleGeometry",function(){return me}),S.d(w,"ClampToEdgeWrapping",function(){return St}),S.d(w,"Clock",function(){return Zf}),S.d(w,"Color",function(){return pn}),S.d(w,"ColorKeyframeTrack",function(){return of}),S.d(w,"CompressedTexture",function(){return Lt}),S.d(w,"CompressedTextureLoader",function(){return Am}),S.d(w,"ConeBufferGeometry",function(){return gn}),S.d(w,"ConeGeometry",function(){return gn}),S.d(w,"CubeCamera",function(){return Ec}),S.d(w,"CubeReflectionMapping",function(){return I}),S.d(w,"CubeRefractionMapping",function(){return z}),S.d(w,"CubeTexture",function(){return Vl}),S.d(w,"CubeTextureLoader",function(){return Uf}),S.d(w,"CubeUVReflectionMapping",function(){return nt}),S.d(w,"CubeUVRefractionMapping",function(){return it}),S.d(w,"CubicBezierCurve",function(){return va}),S.d(w,"CubicBezierCurve3",function(){return _a}),S.d(w,"CubicInterpolant",function(){return Hu}),S.d(w,"CullFaceBack",function(){return X}),S.d(w,"CullFaceFront",function(){return ct}),S.d(w,"CullFaceFrontBack",function(){return tt}),S.d(w,"CullFaceNone",function(){return J}),S.d(w,"Curve",function(){return wn}),S.d(w,"CurvePath",function(){return Pm}),S.d(w,"CustomBlending",function(){return Oe}),S.d(w,"CustomToneMapping",function(){return Pi}),S.d(w,"CylinderBufferGeometry",function(){return De}),S.d(w,"CylinderGeometry",function(){return De}),S.d(w,"Cylindrical",function(){return fg}),S.d(w,"DataTexture",function(){return Is}),S.d(w,"DataTexture2DArray",function(){return Wa}),S.d(w,"DataTexture3D",function(){return Wl}),S.d(w,"DataTextureLoader",function(){return Cm}),S.d(w,"DataUtils",function(){return Je}),S.d(w,"DecrementStencilOp",function(){return sl}),S.d(w,"DecrementWrapStencilOp",function(){return ah}),S.d(w,"DefaultLoadingManager",function(){return nc}),S.d(w,"DepthFormat",function(){return dn}),S.d(w,"DepthStencilFormat",function(){return rr}),S.d(w,"DepthTexture",function(){return Ee}),S.d(w,"DirectionalLight",function(){return Wu}),S.d(w,"DirectionalLightHelper",function(){return b}),S.d(w,"DiscreteInterpolant",function(){return rf}),S.d(w,"DodecahedronBufferGeometry",function(){return An}),S.d(w,"DodecahedronGeometry",function(){return An}),S.d(w,"DoubleSide",function(){return k}),S.d(w,"DstAlphaFactor",function(){return Ye}),S.d(w,"DstColorFactor",function(){return Hn}),S.d(w,"DynamicBufferAttribute",function(){return qv}),S.d(w,"DynamicCopyUsage",function(){return uh}),S.d(w,"DynamicDrawUsage",function(){return al}),S.d(w,"DynamicReadUsage",function(){return wd}),S.d(w,"EdgesGeometry",function(){return Yn}),S.d(w,"EdgesHelper",function(){return o0}),S.d(w,"EllipseCurve",function(){return lr}),S.d(w,"EqualDepth",function(){return Ur}),S.d(w,"EqualStencilFunc",function(){return lh}),S.d(w,"EquirectangularReflectionMapping",function(){return H}),S.d(w,"EquirectangularRefractionMapping",function(){return at}),S.d(w,"Euler",function(){return aa}),S.d(w,"EventDispatcher",function(){return Fa}),S.d(w,"ExtrudeBufferGeometry",function(){return Ka}),S.d(w,"ExtrudeGeometry",function(){return Ka}),S.d(w,"FaceColors",function(){return jm}),S.d(w,"FileLoader",function(){return ba}),S.d(w,"FlatShading",function(){return Y}),S.d(w,"Float16BufferAttribute",function(){return bu}),S.d(w,"Float32Attribute",function(){return e0}),S.d(w,"Float32BufferAttribute",function(){return xn}),S.d(w,"Float64Attribute",function(){return n0}),S.d(w,"Float64BufferAttribute",function(){return Sc}),S.d(w,"FloatType",function(){return ee}),S.d(w,"Fog",function(){return tu}),S.d(w,"FogExp2",function(){return Ql}),S.d(w,"Font",function(){return oo}),S.d(w,"FontLoader",function(){return qf}),S.d(w,"FrontSide",function(){return zt}),S.d(w,"Frustum",function(){return ja}),S.d(w,"GLBufferAttribute",function(){return Gm}),S.d(w,"GLSL1",function(){return Na}),S.d(w,"GLSL3",function(){return Td}),S.d(w,"GammaEncoding",function(){return Yt}),S.d(w,"GreaterDepth",function(){return qr}),S.d(w,"GreaterEqualDepth",function(){return Rr}),S.d(w,"GreaterEqualStencilFunc",function(){return Ll}),S.d(w,"GreaterStencilFunc",function(){return xp}),S.d(w,"GridHelper",function(){return s}),S.d(w,"Group",function(){return vl}),S.d(w,"HalfFloatType",function(){return Ft}),S.d(w,"HemisphereLight",function(){return sf}),S.d(w,"HemisphereLightHelper",function(){return r}),S.d(w,"HemisphereLightProbe",function(){return el}),S.d(w,"IcosahedronBufferGeometry",function(){return Uu}),S.d(w,"IcosahedronGeometry",function(){return Uu}),S.d(w,"ImageBitmapLoader",function(){return su}),S.d(w,"ImageLoader",function(){return op}),S.d(w,"ImageUtils",function(){return xs}),S.d(w,"ImmediateRenderObject",function(){return Ea}),S.d(w,"IncrementStencilOp",function(){return _p}),S.d(w,"IncrementWrapStencilOp",function(){return sh}),S.d(w,"InstancedBufferAttribute",function(){return hf}),S.d(w,"InstancedBufferGeometry",function(){return lp}),S.d(w,"InstancedInterleavedBuffer",function(){return im}),S.d(w,"InstancedMesh",function(){return qc}),S.d(w,"Int16Attribute",function(){return $v}),S.d(w,"Int16BufferAttribute",function(){return Lr}),S.d(w,"Int32Attribute",function(){return Qv}),S.d(w,"Int32BufferAttribute",function(){return Rd}),S.d(w,"Int8Attribute",function(){return Yv}),S.d(w,"Int8BufferAttribute",function(){return wc}),S.d(w,"IntType",function(){return Qu}),S.d(w,"InterleavedBuffer",function(){return _l}),S.d(w,"InterleavedBufferAttribute",function(){return ri}),S.d(w,"Interpolant",function(){return Js}),S.d(w,"InterpolateDiscrete",function(){return Rl}),S.d(w,"InterpolateLinear",function(){return Ii}),S.d(w,"InterpolateSmooth",function(){return Ia}),S.d(w,"InvertStencilOp",function(){return pr}),S.d(w,"JSONLoader",function(){return c0}),S.d(w,"KeepStencilOp",function(){return So}),S.d(w,"KeyframeTrack",function(){return Vo}),S.d(w,"LOD",function(){return Gh}),S.d(w,"LatheBufferGeometry",function(){return td}),S.d(w,"LatheGeometry",function(){return td}),S.d(w,"Layers",function(){return ul}),S.d(w,"LensFlare",function(){return p0}),S.d(w,"LessDepth",function(){return vn}),S.d(w,"LessEqualDepth",function(){return Pr}),S.d(w,"LessEqualStencilFunc",function(){return yp}),S.d(w,"LessStencilFunc",function(){return fc}),S.d(w,"Light",function(){return wa}),S.d(w,"LightProbe",function(){return ap}),S.d(w,"Line",function(){return Ya}),S.d(w,"Line3",function(){return Ta}),S.d(w,"LineBasicMaterial",function(){return ro}),S.d(w,"LineCurve",function(){return Bu}),S.d(w,"LineCurve3",function(){return Qd}),S.d(w,"LineDashedMaterial",function(){return Bf}),S.d(w,"LineLoop",function(){return nu}),S.d(w,"LinePieces",function(){return md}),S.d(w,"LineSegments",function(){return io}),S.d(w,"LineStrip",function(){return lc}),S.d(w,"LinearEncoding",function(){return Wr}),S.d(w,"LinearFilter",function(){return Qe}),S.d(w,"LinearInterpolant",function(){return nf}),S.d(w,"LinearMipMapLinearFilter",function(){return Ks}),S.d(w,"LinearMipMapNearestFilter",function(){return vi}),S.d(w,"LinearMipmapLinearFilter",function(){return Yr}),S.d(w,"LinearMipmapNearestFilter",function(){return Qn}),S.d(w,"LinearToneMapping",function(){return Jr}),S.d(w,"Loader",function(){return Wo}),S.d(w,"LoaderUtils",function(){return oc}),S.d(w,"LoadingManager",function(){return ya}),S.d(w,"LogLuvEncoding",function(){return Qt}),S.d(w,"LoopOnce",function(){return Ri}),S.d(w,"LoopPingPong",function(){return gp}),S.d(w,"LoopRepeat",function(){return vs}),S.d(w,"LuminanceAlphaFormat",function(){return gr}),S.d(w,"LuminanceFormat",function(){return mr}),S.d(w,"MOUSE",function(){return pt}),S.d(w,"Material",function(){return Ni}),S.d(w,"MaterialLoader",function(){return ld}),S.d(w,"Math",function(){return wp}),S.d(w,"MathUtils",function(){return wp}),S.d(w,"Matrix3",function(){return ji}),S.d(w,"Matrix4",function(){return En}),S.d(w,"MaxEquation",function(){return rt}),S.d(w,"Mesh",function(){return Bi}),S.d(w,"MeshBasicMaterial",function(){return Fi}),S.d(w,"MeshDepthMaterial",function(){return Nh}),S.d(w,"MeshDistanceMaterial",function(){return fs}),S.d(w,"MeshFaceMaterial",function(){return Wm}),S.d(w,"MeshLambertMaterial",function(){return Gu}),S.d(w,"MeshMatcapMaterial",function(){return ef}),S.d(w,"MeshNormalMaterial",function(){return Ff}),S.d(w,"MeshPhongMaterial",function(){return Df}),S.d(w,"MeshPhysicalMaterial",function(){return Of}),S.d(w,"MeshStandardMaterial",function(){return ip}),S.d(w,"MeshToonMaterial",function(){return Nf}),S.d(w,"MinEquation",function(){return Kt}),S.d(w,"MirroredRepeatWrapping",function(){return Ct}),S.d(w,"MixOperation",function(){return gi}),S.d(w,"MultiMaterial",function(){return Uv}),S.d(w,"MultiplyBlending",function(){return ae}),S.d(w,"MultiplyOperation",function(){return br}),S.d(w,"NearestFilter",function(){return wt}),S.d(w,"NearestMipMapLinearFilter",function(){return an}),S.d(w,"NearestMipMapNearestFilter",function(){return Bt}),S.d(w,"NearestMipmapLinearFilter",function(){return Le}),S.d(w,"NearestMipmapNearestFilter",function(){return Vt}),S.d(w,"NeverDepth",function(){return Bn}),S.d(w,"NeverStencilFunc",function(){return gf}),S.d(w,"NoBlending",function(){return B}),S.d(w,"NoColors",function(){return ff}),S.d(w,"NoToneMapping",function(){return Or}),S.d(w,"NormalAnimationBlendMode",function(){return Oa}),S.d(w,"NormalBlending",function(){return Q}),S.d(w,"NotEqualDepth",function(){return yr}),S.d(w,"NotEqualStencilFunc",function(){return qn}),S.d(w,"NumberKeyframeTrack",function(){return Qh}),S.d(w,"Object3D",function(){return ar}),S.d(w,"ObjectLoader",function(){return lg}),S.d(w,"ObjectSpaceNormalMap",function(){return ys}),S.d(w,"OctahedronBufferGeometry",function(){return Yh}),S.d(w,"OctahedronGeometry",function(){return Yh}),S.d(w,"OneFactor",function(){return Wt}),S.d(w,"OneMinusDstAlphaFactor",function(){return ke}),S.d(w,"OneMinusDstColorFactor",function(){return Ke}),S.d(w,"OneMinusSrcAlphaFactor",function(){return fe}),S.d(w,"OneMinusSrcColorFactor",function(){return Xt}),S.d(w,"OrthographicCamera",function(){return sp}),S.d(w,"PCFShadowMap",function(){return ut}),S.d(w,"PCFSoftShadowMap",function(){return kt}),S.d(w,"PMREMGenerator",function(){return jr}),S.d(w,"ParametricBufferGeometry",function(){return rp}),S.d(w,"ParametricGeometry",function(){return rp}),S.d(w,"Particle",function(){return Hv}),S.d(w,"ParticleBasicMaterial",function(){return Vv}),S.d(w,"ParticleSystem",function(){return zv}),S.d(w,"ParticleSystemMaterial",function(){return Wv}),S.d(w,"Path",function(){return rc}),S.d(w,"PerspectiveCamera",function(){return Yi}),S.d(w,"Plane",function(){return Ko}),S.d(w,"PlaneBufferGeometry",function(){return pa}),S.d(w,"PlaneGeometry",function(){return pa}),S.d(w,"PlaneHelper",function(){return Tt}),S.d(w,"PointCloud",function(){return Gv}),S.d(w,"PointCloudMaterial",function(){return jv}),S.d(w,"PointLight",function(){return Wf}),S.d(w,"PointLightHelper",function(){return gg}),S.d(w,"Points",function(){return q}),S.d(w,"PointsMaterial",function(){return xl}),S.d(w,"PolarGridHelper",function(){return u}),S.d(w,"PolyhedronBufferGeometry",function(){return ln}),S.d(w,"PolyhedronGeometry",function(){return ln}),S.d(w,"PositionalAudio",function(){return cg}),S.d(w,"PropertyBinding",function(){return Br}),S.d(w,"PropertyMixer",function(){return ud}),S.d(w,"QuadraticBezierCurve",function(){return ru}),S.d(w,"QuadraticBezierCurve3",function(){return zh}),S.d(w,"Quaternion",function(){return Oi}),S.d(w,"QuaternionKeyframeTrack",function(){return tc}),S.d(w,"QuaternionLinearInterpolant",function(){return kf}),S.d(w,"REVISION",function(){return W}),S.d(w,"RGBADepthPacking",function(){return is}),S.d(w,"RGBAFormat",function(){return Tn}),S.d(w,"RGBAIntegerFormat",function(){return $r}),S.d(w,"RGBA_ASTC_10x10_Format",function(){return oi}),S.d(w,"RGBA_ASTC_10x5_Format",function(){return Pa}),S.d(w,"RGBA_ASTC_10x6_Format",function(){return El}),S.d(w,"RGBA_ASTC_10x8_Format",function(){return dc}),S.d(w,"RGBA_ASTC_12x10_Format",function(){return Ml}),S.d(w,"RGBA_ASTC_12x12_Format",function(){return yi}),S.d(w,"RGBA_ASTC_4x4_Format",function(){return _d}),S.d(w,"RGBA_ASTC_5x4_Format",function(){return uo}),S.d(w,"RGBA_ASTC_5x5_Format",function(){return _i}),S.d(w,"RGBA_ASTC_6x5_Format",function(){return fu}),S.d(w,"RGBA_ASTC_6x6_Format",function(){return Ca}),S.d(w,"RGBA_ASTC_8x5_Format",function(){return nh}),S.d(w,"RGBA_ASTC_8x6_Format",function(){return dr}),S.d(w,"RGBA_ASTC_8x8_Format",function(){return ti}),S.d(w,"RGBA_BPTC_Format",function(){return Fs}),S.d(w,"RGBA_ETC2_EAC_Format",function(){return Do}),S.d(w,"RGBA_PVRTC_2BPPV1_Format",function(){return th}),S.d(w,"RGBA_PVRTC_4BPPV1_Format",function(){return du}),S.d(w,"RGBA_S3TC_DXT1_Format",function(){return cu}),S.d(w,"RGBA_S3TC_DXT3_Format",function(){return Ki}),S.d(w,"RGBA_S3TC_DXT5_Format",function(){return Qr}),S.d(w,"RGBDEncoding",function(){return Mr}),S.d(w,"RGBEEncoding",function(){return _e}),S.d(w,"RGBEFormat",function(){return hn}),S.d(w,"RGBFormat",function(){return yn}),S.d(w,"RGBIntegerFormat",function(){return Er}),S.d(w,"RGBM16Encoding",function(){return Xn}),S.d(w,"RGBM7Encoding",function(){return tn}),S.d(w,"RGB_ETC1_Format",function(){return pu}),S.d(w,"RGB_ETC2_Format",function(){return eh}),S.d(w,"RGB_PVRTC_2BPPV1_Format",function(){return cc}),S.d(w,"RGB_PVRTC_4BPPV1_Format",function(){return hc}),S.d(w,"RGB_S3TC_DXT1_Format",function(){return ns}),S.d(w,"RGFormat",function(){return Gr}),S.d(w,"RGIntegerFormat",function(){return ii}),S.d(w,"RawShaderMaterial",function(){return $h}),S.d(w,"Ray",function(){return ka}),S.d(w,"Raycaster",function(){return dg}),S.d(w,"RectAreaLight",function(){return ic}),S.d(w,"RedFormat",function(){return ui}),S.d(w,"RedIntegerFormat",function(){return Zn}),S.d(w,"ReinhardToneMapping",function(){return Oo}),S.d(w,"RepeatWrapping",function(){return yt}),S.d(w,"ReplaceStencilOp",function(){return mu}),S.d(w,"ReverseSubtractEquation",function(){return Jt}),S.d(w,"RingBufferGeometry",function(){return ed}),S.d(w,"RingGeometry",function(){return ed}),S.d(w,"SRGB8_ALPHA8_ASTC_10x10_Format",function(){return hi}),S.d(w,"SRGB8_ALPHA8_ASTC_10x5_Format",function(){return Cl}),S.d(w,"SRGB8_ALPHA8_ASTC_10x6_Format",function(){return pc}),S.d(w,"SRGB8_ALPHA8_ASTC_10x8_Format",function(){return wo}),S.d(w,"SRGB8_ALPHA8_ASTC_12x10_Format",function(){return Pl}),S.d(w,"SRGB8_ALPHA8_ASTC_12x12_Format",function(){return yd}),S.d(w,"SRGB8_ALPHA8_ASTC_4x4_Format",function(){return rs}),S.d(w,"SRGB8_ALPHA8_ASTC_5x4_Format",function(){return ol}),S.d(w,"SRGB8_ALPHA8_ASTC_5x5_Format",function(){return Ra}),S.d(w,"SRGB8_ALPHA8_ASTC_6x5_Format",function(){return rh}),S.d(w,"SRGB8_ALPHA8_ASTC_6x6_Format",function(){return ih}),S.d(w,"SRGB8_ALPHA8_ASTC_8x5_Format",function(){return Al}),S.d(w,"SRGB8_ALPHA8_ASTC_8x6_Format",function(){return ei}),S.d(w,"SRGB8_ALPHA8_ASTC_8x8_Format",function(){return oh}),S.d(w,"Scene",function(){return Fh}),S.d(w,"SceneUtils",function(){return d0}),S.d(w,"ShaderChunk",function(){return vr}),S.d(w,"ShaderLib",function(){return _o}),S.d(w,"ShaderMaterial",function(){return vo}),S.d(w,"ShadowMaterial",function(){return Lf}),S.d(w,"Shape",function(){return ju}),S.d(w,"ShapeBufferGeometry",function(){return Zh}),S.d(w,"ShapeGeometry",function(){return Zh}),S.d(w,"ShapePath",function(){return au}),S.d(w,"ShapeUtils",function(){return Os}),S.d(w,"ShortType",function(){return Qs}),S.d(w,"Skeleton",function(){return Fu}),S.d(w,"SkeletonHelper",function(){return om}),S.d(w,"SkinnedMesh",function(){return jc}),S.d(w,"SmoothShading",function(){return ht}),S.d(w,"Sphere",function(){return bs}),S.d(w,"SphereBufferGeometry",function(){return Jh}),S.d(w,"SphereGeometry",function(){return Jh}),S.d(w,"Spherical",function(){return pg}),S.d(w,"SphericalHarmonics3",function(){return Re}),S.d(w,"SplineCurve",function(){return iu}),S.d(w,"SpotLight",function(){return ad}),S.d(w,"SpotLightHelper",function(){return mg}),S.d(w,"Sprite",function(){return Du}),S.d(w,"SpriteMaterial",function(){return yo}),S.d(w,"SrcAlphaFactor",function(){return le}),S.d(w,"SrcAlphaSaturateFactor",function(){return Ln}),S.d(w,"SrcColorFactor",function(){return te}),S.d(w,"StaticCopyUsage",function(){return Sd}),S.d(w,"StaticDrawUsage",function(){return Da}),S.d(w,"StaticReadUsage",function(){return Qi}),S.d(w,"StereoCamera",function(){return ug}),S.d(w,"StreamCopyUsage",function(){return Ol}),S.d(w,"StreamDrawUsage",function(){return mc}),S.d(w,"StreamReadUsage",function(){return gc}),S.d(w,"StringKeyframeTrack",function(){return Qa}),S.d(w,"SubtractEquation",function(){return bt}),S.d(w,"SubtractiveBlending",function(){return ft}),S.d(w,"TOUCH",function(){return lt}),S.d(w,"TangentSpaceNormalMap",function(){return Hr}),S.d(w,"TetrahedronBufferGeometry",function(){return nd}),S.d(w,"TetrahedronGeometry",function(){return nd}),S.d(w,"TextBufferGeometry",function(){return tf}),S.d(w,"TextGeometry",function(){return tf}),S.d(w,"Texture",function(){return ni}),S.d(w,"TextureLoader",function(){return Gf}),S.d(w,"TorusBufferGeometry",function(){return rd}),S.d(w,"TorusGeometry",function(){return rd}),S.d(w,"TorusKnotBufferGeometry",function(){return id}),S.d(w,"TorusKnotGeometry",function(){return id}),S.d(w,"Triangle",function(){return bi}),S.d(w,"TriangleFanDrawMode",function(){return vp}),S.d(w,"TriangleStripDrawMode",function(){return Zo}),S.d(w,"TrianglesDrawMode",function(){return Il}),S.d(w,"TubeBufferGeometry",function(){return od}),S.d(w,"TubeGeometry",function(){return od}),S.d(w,"UVMapping",function(){return ao}),S.d(w,"Uint16Attribute",function(){return Kv}),S.d(w,"Uint16BufferAttribute",function(){return er}),S.d(w,"Uint32Attribute",function(){return t0}),S.d(w,"Uint32BufferAttribute",function(){return fo}),S.d(w,"Uint8Attribute",function(){return Zv}),S.d(w,"Uint8BufferAttribute",function(){return Pd}),S.d(w,"Uint8ClampedAttribute",function(){return Jv}),S.d(w,"Uint8ClampedBufferAttribute",function(){return wi}),S.d(w,"Uniform",function(){return cd}),S.d(w,"UniformsLib",function(){return Ze}),S.d(w,"UniformsUtils",function(){return Od}),S.d(w,"UnsignedByteType",function(){return lo}),S.d(w,"UnsignedInt248Type",function(){return un}),S.d(w,"UnsignedIntType",function(){return Yo}),S.d(w,"UnsignedShort4444Type",function(){return Se}),S.d(w,"UnsignedShort5551Type",function(){return Ge}),S.d(w,"UnsignedShort565Type",function(){return Ve}),S.d(w,"UnsignedShortType",function(){return Aa}),S.d(w,"VSMShadowMap",function(){return Gt}),S.d(w,"Vector2",function(){return He}),S.d(w,"Vector3",function(){return gt}),S.d(w,"Vector4",function(){return Ir}),S.d(w,"VectorKeyframeTrack",function(){return zu}),S.d(w,"Vertex",function(){return Xv}),S.d(w,"VertexColors",function(){return Vm}),S.d(w,"VideoTexture",function(){return Mt}),S.d(w,"WebGL1Renderer",function(){return qp}),S.d(w,"WebGLCubeRenderTarget",function(){return ds}),S.d(w,"WebGLMultipleRenderTargets",function(){return ia}),S.d(w,"WebGLMultisampleRenderTarget",function(){return vc}),S.d(w,"WebGLRenderTarget",function(){return Fo}),S.d(w,"WebGLRenderTargetCube",function(){return u0}),S.d(w,"WebGLRenderer",function(){return Fr}),S.d(w,"WebGLUtils",function(){return Gc}),S.d(w,"WireframeGeometry",function(){return If}),S.d(w,"WireframeHelper",function(){return s0}),S.d(w,"WrapAroundEnding",function(){return _s}),S.d(w,"XHRLoader",function(){return a0}),S.d(w,"ZeroCurvatureEnding",function(){return ta}),S.d(w,"ZeroFactor",function(){return Ut}),S.d(w,"ZeroSlopeEnding",function(){return La}),S.d(w,"ZeroStencilOp",function(){return bd}),S.d(w,"sRGBEncoding",function(){return Bs});/**
28
28
  * @license
29
29
  * Copyright 2010-2021 Three.js Authors
30
30
  * SPDX-License-Identifier: MIT
@@ -2919,8 +2919,8 @@ void main() {
2919
2919
  squared_mean = squared_mean * HALF_SAMPLE_RATE;
2920
2920
  float std_dev = sqrt( squared_mean - mean * mean );
2921
2921
  gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
2922
- }`}),R=A.clone();R.defines.HORIZONTAL_PASS=1;const O=new zn;O.setAttribute("position",new Kn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const U=new Bi(O,A),D=this;function Z(Pt,Et){const Ot=t.update(U);A.uniforms.shadow_pass.value=Pt.map.texture,A.uniforms.resolution.value=Pt.mapSize,A.uniforms.radius.value=Pt.radius,m.setRenderTarget(Pt.mapPass),m.clear(),m.renderBufferDirect(Et,null,Ot,A,U,null),R.uniforms.shadow_pass.value=Pt.mapPass.texture,R.uniforms.resolution.value=Pt.mapSize,R.uniforms.radius.value=Pt.radius,m.setRenderTarget(Pt.map),m.clear(),m.renderBufferDirect(Et,null,Ot,R,U,null)}function ot(Pt){const Et=Pt<<0;let Ot=v[Et];return Ot===void 0&&(Ot=new Nh({depthPacking:is,morphTargets:Pt}),v[Et]=Ot),Ot}function vt(Pt){const Et=Pt<<0;let Ot=_[Et];return Ot===void 0&&(Ot=new fs({morphTargets:Pt}),_[Et]=Ot),Ot}function mt(Pt,Et,Ot,Ie,ye,xe,ge){let Ht=null,ce=ot,We=Pt.customDepthMaterial;if(Ie.isPointLight===!0&&(ce=vt,We=Pt.customDistanceMaterial),We===void 0){let je=!1;Ot.morphTargets===!0&&(je=Et.morphAttributes&&Et.morphAttributes.position&&Et.morphAttributes.position.length>0),Ht=ce(je)}else Ht=We;if(m.localClippingEnabled&&Ot.clipShadows===!0&&Ot.clippingPlanes.length!==0){const je=Ht.uuid,ze=Ot.uuid;let fn=x[je];fn===void 0&&(fn={},x[je]=fn);let _n=fn[ze];_n===void 0&&(_n=Ht.clone(),fn[ze]=_n),Ht=_n}return Ht.visible=Ot.visible,Ht.wireframe=Ot.wireframe,Ht.side=ge===Gt?Ot.shadowSide!==null?Ot.shadowSide:Ot.side:Ot.shadowSide!==null?Ot.shadowSide:C[Ot.side],Ht.clipShadows=Ot.clipShadows,Ht.clippingPlanes=Ot.clippingPlanes,Ht.clipIntersection=Ot.clipIntersection,Ht.wireframeLinewidth=Ot.wireframeLinewidth,Ht.linewidth=Ot.linewidth,Ie.isPointLight===!0&&Ht.isMeshDistanceMaterial===!0&&(Ht.referencePosition.setFromMatrixPosition(Ie.matrixWorld),Ht.nearDistance=ye,Ht.farDistance=xe),Ht}function At(Pt,Et,Ot,Ie,ye){if(Pt.visible===!1)return;if(Pt.layers.test(Et.layers)&&(Pt.isMesh||Pt.isLine||Pt.isPoints)&&(Pt.castShadow||Pt.receiveShadow&&ye===Gt)&&(!Pt.frustumCulled||a.intersectsObject(Pt))){Pt.modelViewMatrix.multiplyMatrices(Ot.matrixWorldInverse,Pt.matrixWorld);const ge=t.update(Pt),Ht=Pt.material;if(Array.isArray(Ht)){const ce=ge.groups;for(let We=0,je=ce.length;We<je;We++){const ze=ce[We],fn=Ht[ze.materialIndex];if(fn&&fn.visible){const _n=mt(Pt,ge,fn,Ie,Ot.near,Ot.far,ye);m.renderBufferDirect(Ot,null,ge,_n,Pt,ze)}}}else if(Ht.visible){const ce=mt(Pt,ge,Ht,Ie,Ot.near,Ot.far,ye);m.renderBufferDirect(Ot,null,ge,ce,Pt,null)}}const xe=Pt.children;for(let ge=0,Ht=xe.length;ge<Ht;ge++)At(xe[ge],Et,Ot,Ie,ye)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ut,this.render=function(Pt,Et,Ot){if(D.enabled===!1||D.autoUpdate===!1&&D.needsUpdate===!1||Pt.length===0)return;const Ie=m.getRenderTarget(),ye=m.getActiveCubeFace(),xe=m.getActiveMipmapLevel(),ge=m.state;ge.setBlending(B),ge.buffers.color.setClear(1,1,1,1),ge.buffers.depth.setTest(!0),ge.setScissorTest(!1);for(let Ht=0,ce=Pt.length;Ht<ce;Ht++){const We=Pt[Ht],je=We.shadow;if(je===void 0){console.warn("THREE.WebGLShadowMap:",We,"has no shadow.");continue}if(je.autoUpdate===!1&&je.needsUpdate===!1)continue;l.copy(je.mapSize);const ze=je.getFrameExtents();if(l.multiply(ze),d.copy(je.mapSize),(l.x>M||l.y>M)&&(l.x>M&&(d.x=Math.floor(M/ze.x),l.x=d.x*ze.x,je.mapSize.x=d.x),l.y>M&&(d.y=Math.floor(M/ze.y),l.y=d.y*ze.y,je.mapSize.y=d.y)),je.map===null&&!je.isPointLightShadow&&this.type===Gt){const _n={minFilter:Qe,magFilter:Qe,format:Tn};je.map=new Fo(l.x,l.y,_n),je.map.texture.name=We.name+".shadowMap",je.mapPass=new Fo(l.x,l.y,_n),je.camera.updateProjectionMatrix()}if(je.map===null){const _n={minFilter:wt,magFilter:wt,format:Tn};je.map=new Fo(l.x,l.y,_n),je.map.texture.name=We.name+".shadowMap",je.camera.updateProjectionMatrix()}m.setRenderTarget(je.map),m.clear();const fn=je.getViewportCount();for(let _n=0;_n<fn;_n++){const Mn=je.getViewport(_n);p.set(d.x*Mn.x,d.y*Mn.y,d.x*Mn.z,d.y*Mn.w),ge.viewport(p),je.updateMatrices(We,_n),a=je.getFrustum(),At(Et,Ot,je.camera,We,this.type)}je.isPointLightShadow||this.type!==Gt||Z(je,Ot),je.needsUpdate=!1}D.needsUpdate=!1,m.setRenderTarget(Ie,ye,xe)}}function qd(m,t,i){const a=i.isWebGL2,l=new function(){let xt=!1;const Zt=new Ir;let Te=null;const Pe=new Ir(0,0,0,0);return{setMask:function(we){Te===we||xt||(m.colorMask(we,we,we,we),Te=we)},setLocked:function(we){xt=we},setClear:function(we,bn,Gn,Fn,_r){_r===!0&&(we*=Fn,bn*=Fn,Gn*=Fn),Zt.set(we,bn,Gn,Fn),Pe.equals(Zt)===!1&&(m.clearColor(we,bn,Gn,Fn),Pe.copy(Zt))},reset:function(){xt=!1,Te=null,Pe.set(-1,0,0,0)}}},d=new function(){let xt=!1,Zt=null,Te=null,Pe=null;return{setTest:function(we){we?Sn(2929):Rt(2929)},setMask:function(we){Zt===we||xt||(m.depthMask(we),Zt=we)},setFunc:function(we){if(Te!==we){if(we)switch(we){case Bn:m.depthFunc(512);break;case Wn:m.depthFunc(519);break;case vn:m.depthFunc(513);break;case Pr:m.depthFunc(515);break;case Ur:m.depthFunc(514);break;case Rr:m.depthFunc(518);break;case qr:m.depthFunc(516);break;case yr:m.depthFunc(517);break;default:m.depthFunc(515)}else m.depthFunc(515);Te=we}},setLocked:function(we){xt=we},setClear:function(we){Pe!==we&&(m.clearDepth(we),Pe=we)},reset:function(){xt=!1,Zt=null,Te=null,Pe=null}}},p=new function(){let xt=!1,Zt=null,Te=null,Pe=null,we=null,bn=null,Gn=null,Fn=null,_r=null;return{setTest:function(Tr){xt||(Tr?Sn(2960):Rt(2960))},setMask:function(Tr){Zt===Tr||xt||(m.stencilMask(Tr),Zt=Tr)},setFunc:function(Tr,Xo,fi){Te===Tr&&Pe===Xo&&we===fi||(m.stencilFunc(Tr,Xo,fi),Te=Tr,Pe=Xo,we=fi)},setOp:function(Tr,Xo,fi){bn===Tr&&Gn===Xo&&Fn===fi||(m.stencilOp(Tr,Xo,fi),bn=Tr,Gn=Xo,Fn=fi)},setLocked:function(Tr){xt=Tr},setClear:function(Tr){_r!==Tr&&(m.clearStencil(Tr),_r=Tr)},reset:function(){xt=!1,Zt=null,Te=null,Pe=null,we=null,bn=null,Gn=null,Fn=null,_r=null}}};let v={},_=null,x={},M=null,C=!1,A=null,R=null,O=null,U=null,D=null,Z=null,ot=null,vt=!1,mt=null,At=null,Pt=null,Et=null,Ot=null;const Ie=m.getParameter(35661);let ye=!1,xe=0;const ge=m.getParameter(7938);ge.indexOf("WebGL")!==-1?(xe=parseFloat(/^WebGL (\d)/.exec(ge)[1]),ye=xe>=1):ge.indexOf("OpenGL ES")!==-1&&(xe=parseFloat(/^OpenGL ES (\d)/.exec(ge)[1]),ye=xe>=2);let Ht=null,ce={};const We=m.getParameter(3088),je=m.getParameter(2978),ze=new Ir().fromArray(We),fn=new Ir().fromArray(je);function _n(xt,Zt,Te){const Pe=new Uint8Array(4),we=m.createTexture();m.bindTexture(xt,we),m.texParameteri(xt,10241,9728),m.texParameteri(xt,10240,9728);for(let bn=0;bn<Te;bn++)m.texImage2D(Zt+bn,0,6408,1,1,0,6408,5121,Pe);return we}const Mn={};function Sn(xt){v[xt]!==!0&&(m.enable(xt),v[xt]=!0)}function Rt(xt){v[xt]!==!1&&(m.disable(xt),v[xt]=!1)}Mn[3553]=_n(3553,3553,1),Mn[34067]=_n(34067,34069,6),l.setClear(0,0,0,1),d.setClear(1),p.setClear(0),Sn(2929),d.setFunc(Pr),pe(!1),rn(X),Sn(2884),Be(B);const Dt={[ne]:32774,[bt]:32778,[Jt]:32779};if(a)Dt[Kt]=32775,Dt[rt]=32776;else{const xt=t.get("EXT_blend_minmax");xt!==null&&(Dt[Kt]=xt.MIN_EXT,Dt[rt]=xt.MAX_EXT)}const Fe={[Ut]:0,[Wt]:1,[te]:768,[le]:770,[Ln]:776,[Hn]:774,[Ye]:772,[Xt]:769,[fe]:771,[Ke]:775,[ke]:773};function Be(xt,Zt,Te,Pe,we,bn,Gn,Fn){if(xt!==B){if(C===!1&&(Sn(3042),C=!0),xt===Oe)we=we||Zt,bn=bn||Te,Gn=Gn||Pe,Zt===R&&we===D||(m.blendEquationSeparate(Dt[Zt],Dt[we]),R=Zt,D=we),Te===O&&Pe===U&&bn===Z&&Gn===ot||(m.blendFuncSeparate(Fe[Te],Fe[Pe],Fe[bn],Fe[Gn]),O=Te,U=Pe,Z=bn,ot=Gn),A=xt,vt=null;else if(xt!==A||Fn!==vt){if(R===ne&&D===ne||(m.blendEquation(32774),R=ne,D=ne),Fn)switch(xt){case Q:m.blendFuncSeparate(1,771,1,771);break;case et:m.blendFunc(1,1);break;case ft:m.blendFuncSeparate(0,0,769,771);break;case ae:m.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",xt)}else switch(xt){case Q:m.blendFuncSeparate(770,771,1,771);break;case et:m.blendFunc(770,1);break;case ft:m.blendFunc(0,769);break;case ae:m.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",xt)}O=null,U=null,Z=null,ot=null,A=xt,vt=Fn}}else C===!0&&(Rt(3042),C=!1)}function pe(xt){mt!==xt&&(xt?m.frontFace(2304):m.frontFace(2305),mt=xt)}function rn(xt){xt!==J?(Sn(2884),xt!==At&&(xt===X?m.cullFace(1029):xt===ct?m.cullFace(1028):m.cullFace(1032))):Rt(2884),At=xt}function sn(xt,Zt,Te){xt?(Sn(32823),Et===Zt&&Ot===Te||(m.polygonOffset(Zt,Te),Et=Zt,Ot=Te)):Rt(32823)}function be(xt){xt===void 0&&(xt=33984+Ie-1),Ht!==xt&&(m.activeTexture(xt),Ht=xt)}return{buffers:{color:l,depth:d,stencil:p},enable:Sn,disable:Rt,bindFramebuffer:function(xt,Zt){return Zt===null&&_!==null&&(Zt=_),x[xt]!==Zt&&(m.bindFramebuffer(xt,Zt),x[xt]=Zt,a&&(xt===36009&&(x[36160]=Zt),xt===36160&&(x[36009]=Zt)),!0)},bindXRFramebuffer:function(xt){xt!==_&&(m.bindFramebuffer(36160,xt),_=xt)},useProgram:function(xt){return M!==xt&&(m.useProgram(xt),M=xt,!0)},setBlending:Be,setMaterial:function(xt,Zt){xt.side===k?Rt(2884):Sn(2884);let Te=xt.side===L;Zt&&(Te=!Te),pe(Te),xt.blending===Q&&xt.transparent===!1?Be(B):Be(xt.blending,xt.blendEquation,xt.blendSrc,xt.blendDst,xt.blendEquationAlpha,xt.blendSrcAlpha,xt.blendDstAlpha,xt.premultipliedAlpha),d.setFunc(xt.depthFunc),d.setTest(xt.depthTest),d.setMask(xt.depthWrite),l.setMask(xt.colorWrite);const Pe=xt.stencilWrite;p.setTest(Pe),Pe&&(p.setMask(xt.stencilWriteMask),p.setFunc(xt.stencilFunc,xt.stencilRef,xt.stencilFuncMask),p.setOp(xt.stencilFail,xt.stencilZFail,xt.stencilZPass)),sn(xt.polygonOffset,xt.polygonOffsetFactor,xt.polygonOffsetUnits),xt.alphaToCoverage===!0?Sn(32926):Rt(32926)},setFlipSided:pe,setCullFace:rn,setLineWidth:function(xt){xt!==Pt&&(ye&&m.lineWidth(xt),Pt=xt)},setPolygonOffset:sn,setScissorTest:function(xt){xt?Sn(3089):Rt(3089)},activeTexture:be,bindTexture:function(xt,Zt){Ht===null&&be();let Te=ce[Ht];Te===void 0&&(Te={type:void 0,texture:void 0},ce[Ht]=Te),Te.type===xt&&Te.texture===Zt||(m.bindTexture(xt,Zt||Mn[xt]),Te.type=xt,Te.texture=Zt)},unbindTexture:function(){const xt=ce[Ht];xt!==void 0&&xt.type!==void 0&&(m.bindTexture(xt.type,null),xt.type=void 0,xt.texture=void 0)},compressedTexImage2D:function(){try{m.compressedTexImage2D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},texImage2D:function(){try{m.texImage2D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},texImage3D:function(){try{m.texImage3D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},scissor:function(xt){ze.equals(xt)===!1&&(m.scissor(xt.x,xt.y,xt.z,xt.w),ze.copy(xt))},viewport:function(xt){fn.equals(xt)===!1&&(m.viewport(xt.x,xt.y,xt.z,xt.w),fn.copy(xt))},reset:function(){m.disable(3042),m.disable(2884),m.disable(2929),m.disable(32823),m.disable(3089),m.disable(2960),m.disable(32926),m.blendEquation(32774),m.blendFunc(1,0),m.blendFuncSeparate(1,0,1,0),m.colorMask(!0,!0,!0,!0),m.clearColor(0,0,0,0),m.depthMask(!0),m.depthFunc(513),m.clearDepth(1),m.stencilMask(4294967295),m.stencilFunc(519,0,4294967295),m.stencilOp(7680,7680,7680),m.clearStencil(0),m.cullFace(1029),m.frontFace(2305),m.polygonOffset(0,0),m.activeTexture(33984),m.bindFramebuffer(36160,null),a===!0&&(m.bindFramebuffer(36009,null),m.bindFramebuffer(36008,null)),m.useProgram(null),m.lineWidth(1),m.scissor(0,0,m.canvas.width,m.canvas.height),m.viewport(0,0,m.canvas.width,m.canvas.height),v={},Ht=null,ce={},_=null,x={},M=null,C=!1,A=null,R=null,O=null,U=null,D=null,Z=null,ot=null,vt=!1,mt=null,At=null,Pt=null,Et=null,Ot=null,ze.set(0,0,m.canvas.width,m.canvas.height),fn.set(0,0,m.canvas.width,m.canvas.height),l.reset(),d.reset(),p.reset()}}}function As(m,t,i,a,l,d,p){const v=l.isWebGL2,_=l.maxTextures,x=l.maxCubemapSize,M=l.maxTextureSize,C=l.maxSamples,A=new WeakMap;let R,O=!1;try{O=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function U(Rt,Dt){return O?new OffscreenCanvas(Rt,Dt):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function D(Rt,Dt,Fe,Be){let pe=1;if((Rt.width>Be||Rt.height>Be)&&(pe=Be/Math.max(Rt.width,Rt.height)),pe<1||Dt===!0){if(typeof HTMLImageElement!="undefined"&&Rt instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&Rt instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&Rt instanceof ImageBitmap){const rn=Dt?bp:Math.floor,sn=rn(pe*Rt.width),be=rn(pe*Rt.height);R===void 0&&(R=U(sn,be));const xt=Fe?U(sn,be):R;return xt.width=sn,xt.height=be,xt.getContext("2d").drawImage(Rt,0,0,sn,be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Rt.width+"x"+Rt.height+") to ("+sn+"x"+be+")."),xt}return"data"in Rt&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Rt.width+"x"+Rt.height+")."),Rt}return Rt}function Z(Rt){return xi(Rt.width)&&xi(Rt.height)}function ot(Rt,Dt){return Rt.generateMipmaps&&Dt&&Rt.minFilter!==wt&&Rt.minFilter!==Qe}function vt(Rt,Dt,Fe,Be,pe=1){m.generateMipmap(Rt),a.get(Dt).__maxMipLevel=Math.log2(Math.max(Fe,Be,pe))}function mt(Rt,Dt,Fe){if(v===!1)return Dt;if(Rt!==null){if(m[Rt]!==void 0)return m[Rt];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Rt+"'")}let Be=Dt;return Dt===6403&&(Fe===5126&&(Be=33326),Fe===5131&&(Be=33325),Fe===5121&&(Be=33321)),Dt===6407&&(Fe===5126&&(Be=34837),Fe===5131&&(Be=34843),Fe===5121&&(Be=32849)),Dt===6408&&(Fe===5126&&(Be=34836),Fe===5131&&(Be=34842),Fe===5121&&(Be=32856)),Be!==33325&&Be!==33326&&Be!==34842&&Be!==34836||t.get("EXT_color_buffer_float"),Be}function At(Rt){return Rt===wt||Rt===Vt||Rt===Le?9728:9729}function Pt(Rt){const Dt=Rt.target;Dt.removeEventListener("dispose",Pt),function(Fe){const Be=a.get(Fe);Be.__webglInit!==void 0&&(m.deleteTexture(Be.__webglTexture),a.remove(Fe))}(Dt),Dt.isVideoTexture&&A.delete(Dt),p.memory.textures--}function Et(Rt){const Dt=Rt.target;Dt.removeEventListener("dispose",Et),function(Fe){const Be=Fe.texture,pe=a.get(Fe),rn=a.get(Be);if(!!Fe){if(rn.__webglTexture!==void 0&&(m.deleteTexture(rn.__webglTexture),p.memory.textures--),Fe.depthTexture&&Fe.depthTexture.dispose(),Fe.isWebGLCubeRenderTarget)for(let sn=0;sn<6;sn++)m.deleteFramebuffer(pe.__webglFramebuffer[sn]),pe.__webglDepthbuffer&&m.deleteRenderbuffer(pe.__webglDepthbuffer[sn]);else m.deleteFramebuffer(pe.__webglFramebuffer),pe.__webglDepthbuffer&&m.deleteRenderbuffer(pe.__webglDepthbuffer),pe.__webglMultisampledFramebuffer&&m.deleteFramebuffer(pe.__webglMultisampledFramebuffer),pe.__webglColorRenderbuffer&&m.deleteRenderbuffer(pe.__webglColorRenderbuffer),pe.__webglDepthRenderbuffer&&m.deleteRenderbuffer(pe.__webglDepthRenderbuffer);if(Fe.isWebGLMultipleRenderTargets)for(let sn=0,be=Be.length;sn<be;sn++){const xt=a.get(Be[sn]);xt.__webglTexture&&(m.deleteTexture(xt.__webglTexture),p.memory.textures--),a.remove(Be[sn])}a.remove(Be),a.remove(Fe)}}(Dt)}let Ot=0;function Ie(Rt,Dt){const Fe=a.get(Rt);if(Rt.isVideoTexture&&function(Be){const pe=p.render.frame;A.get(Be)!==pe&&(A.set(Be,pe),Be.update())}(Rt),Rt.version>0&&Fe.__version!==Rt.version){const Be=Rt.image;if(Be===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(Be.complete!==!1)return void We(Fe,Rt,Dt);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+Dt),i.bindTexture(3553,Fe.__webglTexture)}function ye(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?function(Be,pe,rn){if(pe.image.length!==6)return;ce(Be,pe),i.activeTexture(33984+rn),i.bindTexture(34067,Be.__webglTexture),m.pixelStorei(37440,pe.flipY),m.pixelStorei(37441,pe.premultiplyAlpha),m.pixelStorei(3317,pe.unpackAlignment),m.pixelStorei(37443,0);const sn=pe&&(pe.isCompressedTexture||pe.image[0].isCompressedTexture),be=pe.image[0]&&pe.image[0].isDataTexture,xt=[];for(let Fn=0;Fn<6;Fn++)xt[Fn]=sn||be?be?pe.image[Fn].image:pe.image[Fn]:D(pe.image[Fn],!1,!0,x);const Zt=xt[0],Te=Z(Zt)||v,Pe=d.convert(pe.format),we=d.convert(pe.type),bn=mt(pe.internalFormat,Pe,we);let Gn;if(Ht(34067,pe,Te),sn){for(let Fn=0;Fn<6;Fn++){Gn=xt[Fn].mipmaps;for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r];pe.format!==Tn&&pe.format!==yn?Pe!==null?i.compressedTexImage2D(34069+Fn,_r,bn,Tr.width,Tr.height,0,Tr.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+Fn,_r,bn,Tr.width,Tr.height,0,Pe,we,Tr.data)}}Be.__maxMipLevel=Gn.length-1}else{Gn=pe.mipmaps;for(let Fn=0;Fn<6;Fn++)if(be){i.texImage2D(34069+Fn,0,bn,xt[Fn].width,xt[Fn].height,0,Pe,we,xt[Fn].data);for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r].image[Fn].image;i.texImage2D(34069+Fn,_r+1,bn,Tr.width,Tr.height,0,Pe,we,Tr.data)}}else{i.texImage2D(34069+Fn,0,bn,Pe,we,xt[Fn]);for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r];i.texImage2D(34069+Fn,_r+1,bn,Pe,we,Tr.image[Fn])}}Be.__maxMipLevel=Gn.length}ot(pe,Te)&&vt(34067,pe,Zt.width,Zt.height),Be.__version=pe.version,pe.onUpdate&&pe.onUpdate(pe)}(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(34067,Fe.__webglTexture))}const xe={[yt]:10497,[St]:33071,[Ct]:33648},ge={[wt]:9728,[Vt]:9984,[Le]:9986,[Qe]:9729,[Qn]:9985,[Yr]:9987};function Ht(Rt,Dt,Fe){if(Fe?(m.texParameteri(Rt,10242,xe[Dt.wrapS]),m.texParameteri(Rt,10243,xe[Dt.wrapT]),Rt!==32879&&Rt!==35866||m.texParameteri(Rt,32882,xe[Dt.wrapR]),m.texParameteri(Rt,10240,ge[Dt.magFilter]),m.texParameteri(Rt,10241,ge[Dt.minFilter])):(m.texParameteri(Rt,10242,33071),m.texParameteri(Rt,10243,33071),Rt!==32879&&Rt!==35866||m.texParameteri(Rt,32882,33071),Dt.wrapS===St&&Dt.wrapT===St||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),m.texParameteri(Rt,10240,At(Dt.magFilter)),m.texParameteri(Rt,10241,At(Dt.minFilter)),Dt.minFilter!==wt&&Dt.minFilter!==Qe&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),t.has("EXT_texture_filter_anisotropic")===!0){const Be=t.get("EXT_texture_filter_anisotropic");if(Dt.type===ee&&t.has("OES_texture_float_linear")===!1||v===!1&&Dt.type===Ft&&t.has("OES_texture_half_float_linear")===!1)return;(Dt.anisotropy>1||a.get(Dt).__currentAnisotropy)&&(m.texParameterf(Rt,Be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Dt.anisotropy,l.getMaxAnisotropy())),a.get(Dt).__currentAnisotropy=Dt.anisotropy)}}function ce(Rt,Dt){Rt.__webglInit===void 0&&(Rt.__webglInit=!0,Dt.addEventListener("dispose",Pt),Rt.__webglTexture=m.createTexture(),p.memory.textures++)}function We(Rt,Dt,Fe){let Be=3553;Dt.isDataTexture2DArray&&(Be=35866),Dt.isDataTexture3D&&(Be=32879),ce(Rt,Dt),i.activeTexture(33984+Fe),i.bindTexture(Be,Rt.__webglTexture),m.pixelStorei(37440,Dt.flipY),m.pixelStorei(37441,Dt.premultiplyAlpha),m.pixelStorei(3317,Dt.unpackAlignment),m.pixelStorei(37443,0);const pe=function(we){return!v&&(we.wrapS!==St||we.wrapT!==St||we.minFilter!==wt&&we.minFilter!==Qe)}(Dt)&&Z(Dt.image)===!1,rn=D(Dt.image,pe,!1,M),sn=Z(rn)||v,be=d.convert(Dt.format);let xt,Zt=d.convert(Dt.type),Te=mt(Dt.internalFormat,be,Zt);Ht(Be,Dt,sn);const Pe=Dt.mipmaps;if(Dt.isDepthTexture)Te=6402,v?Te=Dt.type===ee?36012:Dt.type===Yo?33190:Dt.type===un?35056:33189:Dt.type===ee&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),Dt.format===dn&&Te===6402&&Dt.type!==Aa&&Dt.type!==Yo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),Dt.type=Aa,Zt=d.convert(Dt.type)),Dt.format===rr&&Te===6402&&(Te=34041,Dt.type!==un&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),Dt.type=un,Zt=d.convert(Dt.type))),i.texImage2D(3553,0,Te,rn.width,rn.height,0,be,Zt,null);else if(Dt.isDataTexture)if(Pe.length>0&&sn){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],i.texImage2D(3553,we,Te,xt.width,xt.height,0,be,Zt,xt.data);Dt.generateMipmaps=!1,Rt.__maxMipLevel=Pe.length-1}else i.texImage2D(3553,0,Te,rn.width,rn.height,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Dt.isCompressedTexture){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],Dt.format!==Tn&&Dt.format!==yn?be!==null?i.compressedTexImage2D(3553,we,Te,xt.width,xt.height,0,xt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,we,Te,xt.width,xt.height,0,be,Zt,xt.data);Rt.__maxMipLevel=Pe.length-1}else if(Dt.isDataTexture2DArray)i.texImage3D(35866,0,Te,rn.width,rn.height,rn.depth,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Dt.isDataTexture3D)i.texImage3D(32879,0,Te,rn.width,rn.height,rn.depth,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Pe.length>0&&sn){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],i.texImage2D(3553,we,Te,be,Zt,xt);Dt.generateMipmaps=!1,Rt.__maxMipLevel=Pe.length-1}else i.texImage2D(3553,0,Te,be,Zt,rn),Rt.__maxMipLevel=0;ot(Dt,sn)&&vt(Be,Dt,rn.width,rn.height),Rt.__version=Dt.version,Dt.onUpdate&&Dt.onUpdate(Dt)}function je(Rt,Dt,Fe,Be,pe){const rn=d.convert(Fe.format),sn=d.convert(Fe.type),be=mt(Fe.internalFormat,rn,sn);pe===32879||pe===35866?i.texImage3D(pe,0,be,Dt.width,Dt.height,Dt.depth,0,rn,sn,null):i.texImage2D(pe,0,be,Dt.width,Dt.height,0,rn,sn,null),i.bindFramebuffer(36160,Rt),m.framebufferTexture2D(36160,Be,pe,a.get(Fe).__webglTexture,0),i.bindFramebuffer(36160,null)}function ze(Rt,Dt,Fe){if(m.bindRenderbuffer(36161,Rt),Dt.depthBuffer&&!Dt.stencilBuffer){let Be=33189;if(Fe){const pe=Dt.depthTexture;pe&&pe.isDepthTexture&&(pe.type===ee?Be=36012:pe.type===Yo&&(Be=33190));const rn=_n(Dt);m.renderbufferStorageMultisample(36161,rn,Be,Dt.width,Dt.height)}else m.renderbufferStorage(36161,Be,Dt.width,Dt.height);m.framebufferRenderbuffer(36160,36096,36161,Rt)}else if(Dt.depthBuffer&&Dt.stencilBuffer){if(Fe){const Be=_n(Dt);m.renderbufferStorageMultisample(36161,Be,35056,Dt.width,Dt.height)}else m.renderbufferStorage(36161,34041,Dt.width,Dt.height);m.framebufferRenderbuffer(36160,33306,36161,Rt)}else{const Be=Dt.isWebGLMultipleRenderTargets===!0?Dt.texture[0]:Dt.texture,pe=d.convert(Be.format),rn=d.convert(Be.type),sn=mt(Be.internalFormat,pe,rn);if(Fe){const be=_n(Dt);m.renderbufferStorageMultisample(36161,be,sn,Dt.width,Dt.height)}else m.renderbufferStorage(36161,sn,Dt.width,Dt.height)}m.bindRenderbuffer(36161,null)}function fn(Rt){const Dt=a.get(Rt),Fe=Rt.isWebGLCubeRenderTarget===!0;if(Rt.depthTexture){if(Fe)throw new Error("target.depthTexture not supported in Cube render targets");(function(Be,pe){if(pe&&pe.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,Be),!pe.depthTexture||!pe.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");a.get(pe.depthTexture).__webglTexture&&pe.depthTexture.image.width===pe.width&&pe.depthTexture.image.height===pe.height||(pe.depthTexture.image.width=pe.width,pe.depthTexture.image.height=pe.height,pe.depthTexture.needsUpdate=!0),Ie(pe.depthTexture,0);const rn=a.get(pe.depthTexture).__webglTexture;if(pe.depthTexture.format===dn)m.framebufferTexture2D(36160,36096,3553,rn,0);else{if(pe.depthTexture.format!==rr)throw new Error("Unknown depthTexture format");m.framebufferTexture2D(36160,33306,3553,rn,0)}})(Dt.__webglFramebuffer,Rt)}else if(Fe){Dt.__webglDepthbuffer=[];for(let Be=0;Be<6;Be++)i.bindFramebuffer(36160,Dt.__webglFramebuffer[Be]),Dt.__webglDepthbuffer[Be]=m.createRenderbuffer(),ze(Dt.__webglDepthbuffer[Be],Rt,!1)}else i.bindFramebuffer(36160,Dt.__webglFramebuffer),Dt.__webglDepthbuffer=m.createRenderbuffer(),ze(Dt.__webglDepthbuffer,Rt,!1);i.bindFramebuffer(36160,null)}function _n(Rt){return v&&Rt.isWebGLMultisampleRenderTarget?Math.min(C,Rt.samples):0}let Mn=!1,Sn=!1;this.allocateTextureUnit=function(){const Rt=Ot;return Rt>=_&&console.warn("THREE.WebGLTextures: Trying to use "+Rt+" texture units while this GPU supports only "+_),Ot+=1,Rt},this.resetTextureUnits=function(){Ot=0},this.setTexture2D=Ie,this.setTexture2DArray=function(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?We(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(35866,Fe.__webglTexture))},this.setTexture3D=function(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?We(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(32879,Fe.__webglTexture))},this.setTextureCube=ye,this.setupRenderTarget=function(Rt){const Dt=Rt.texture,Fe=a.get(Rt),Be=a.get(Dt);Rt.addEventListener("dispose",Et),Rt.isWebGLMultipleRenderTargets!==!0&&(Be.__webglTexture=m.createTexture(),Be.__version=Dt.version,p.memory.textures++);const pe=Rt.isWebGLCubeRenderTarget===!0,rn=Rt.isWebGLMultipleRenderTargets===!0,sn=Rt.isWebGLMultisampleRenderTarget===!0,be=Dt.isDataTexture3D||Dt.isDataTexture2DArray,xt=Z(Rt)||v;if(!v||Dt.format!==yn||Dt.type!==ee&&Dt.type!==Ft||(Dt.format=Tn,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),pe){Fe.__webglFramebuffer=[];for(let Zt=0;Zt<6;Zt++)Fe.__webglFramebuffer[Zt]=m.createFramebuffer()}else if(Fe.__webglFramebuffer=m.createFramebuffer(),rn)if(l.drawBuffers){const Zt=Rt.texture;for(let Te=0,Pe=Zt.length;Te<Pe;Te++){const we=a.get(Zt[Te]);we.__webglTexture===void 0&&(we.__webglTexture=m.createTexture(),p.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(sn)if(v){Fe.__webglMultisampledFramebuffer=m.createFramebuffer(),Fe.__webglColorRenderbuffer=m.createRenderbuffer(),m.bindRenderbuffer(36161,Fe.__webglColorRenderbuffer);const Zt=d.convert(Dt.format),Te=d.convert(Dt.type),Pe=mt(Dt.internalFormat,Zt,Te),we=_n(Rt);m.renderbufferStorageMultisample(36161,we,Pe,Rt.width,Rt.height),i.bindFramebuffer(36160,Fe.__webglMultisampledFramebuffer),m.framebufferRenderbuffer(36160,36064,36161,Fe.__webglColorRenderbuffer),m.bindRenderbuffer(36161,null),Rt.depthBuffer&&(Fe.__webglDepthRenderbuffer=m.createRenderbuffer(),ze(Fe.__webglDepthRenderbuffer,Rt,!0)),i.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(pe){i.bindTexture(34067,Be.__webglTexture),Ht(34067,Dt,xt);for(let Zt=0;Zt<6;Zt++)je(Fe.__webglFramebuffer[Zt],Rt,Dt,36064,34069+Zt);ot(Dt,xt)&&vt(34067,Dt,Rt.width,Rt.height),i.bindTexture(34067,null)}else if(rn){const Zt=Rt.texture;for(let Te=0,Pe=Zt.length;Te<Pe;Te++){const we=Zt[Te],bn=a.get(we);i.bindTexture(3553,bn.__webglTexture),Ht(3553,we,xt),je(Fe.__webglFramebuffer,Rt,we,36064+Te,3553),ot(we,xt)&&vt(3553,we,Rt.width,Rt.height)}i.bindTexture(3553,null)}else{let Zt=3553;be&&(v?Zt=Dt.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),i.bindTexture(Zt,Be.__webglTexture),Ht(Zt,Dt,xt),je(Fe.__webglFramebuffer,Rt,Dt,36064,Zt),ot(Dt,xt)&&vt(Zt,Dt,Rt.width,Rt.height,Rt.depth),i.bindTexture(Zt,null)}Rt.depthBuffer&&fn(Rt)},this.updateRenderTargetMipmap=function(Rt){const Dt=Z(Rt)||v,Fe=Rt.isWebGLMultipleRenderTargets===!0?Rt.texture:[Rt.texture];for(let Be=0,pe=Fe.length;Be<pe;Be++){const rn=Fe[Be];if(ot(rn,Dt)){const sn=Rt.isWebGLCubeRenderTarget?34067:3553,be=a.get(rn).__webglTexture;i.bindTexture(sn,be),vt(sn,rn,Rt.width,Rt.height),i.bindTexture(sn,null)}}},this.updateMultisampleRenderTarget=function(Rt){if(Rt.isWebGLMultisampleRenderTarget)if(v){const Dt=Rt.width,Fe=Rt.height;let Be=16384;Rt.depthBuffer&&(Be|=256),Rt.stencilBuffer&&(Be|=1024);const pe=a.get(Rt);i.bindFramebuffer(36008,pe.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,pe.__webglFramebuffer),m.blitFramebuffer(0,0,Dt,Fe,0,0,Dt,Fe,Be,9728),i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,pe.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(Rt,Dt){Rt&&Rt.isWebGLRenderTarget&&(Mn===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Mn=!0),Rt=Rt.texture),Ie(Rt,Dt)},this.safeSetTextureCube=function(Rt,Dt){Rt&&Rt.isWebGLCubeRenderTarget&&(Sn===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Sn=!0),Rt=Rt.texture),ye(Rt,Dt)}}function Gc(m,t,i){const a=i.isWebGL2;return{convert:function(l){let d;if(l===lo)return 5121;if(l===Se)return 32819;if(l===Ge)return 32820;if(l===Ve)return 33635;if(l===gs)return 5120;if(l===Qs)return 5122;if(l===Aa)return 5123;if(l===Qu)return 5124;if(l===Yo)return 5125;if(l===ee)return 5126;if(l===Ft)return a?5131:(d=t.get("OES_texture_half_float"),d!==null?d.HALF_FLOAT_OES:null);if(l===Dn)return 6406;if(l===yn)return 6407;if(l===Tn)return 6408;if(l===mr)return 6409;if(l===gr)return 6410;if(l===dn)return 6402;if(l===rr)return 34041;if(l===ui)return 6403;if(l===Zn)return 36244;if(l===Gr)return 33319;if(l===ii)return 33320;if(l===Er)return 36248;if(l===$r)return 36249;if(l===ns||l===cu||l===Ki||l===Qr){if(d=t.get("WEBGL_compressed_texture_s3tc"),d===null)return null;if(l===ns)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(l===cu)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(l===Ki)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(l===Qr)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(l===hc||l===cc||l===du||l===th){if(d=t.get("WEBGL_compressed_texture_pvrtc"),d===null)return null;if(l===hc)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(l===cc)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(l===du)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(l===th)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(l===pu)return d=t.get("WEBGL_compressed_texture_etc1"),d!==null?d.COMPRESSED_RGB_ETC1_WEBGL:null;if((l===eh||l===Do)&&(d=t.get("WEBGL_compressed_texture_etc"),d!==null)){if(l===eh)return d.COMPRESSED_RGB8_ETC2;if(l===Do)return d.COMPRESSED_RGBA8_ETC2_EAC}return l===_d||l===uo||l===_i||l===fu||l===Ca||l===nh||l===dr||l===ti||l===Pa||l===El||l===dc||l===oi||l===Ml||l===yi||l===rs||l===ol||l===Ra||l===rh||l===ih||l===Al||l===ei||l===oh||l===Cl||l===pc||l===wo||l===hi||l===Pl||l===yd?(d=t.get("WEBGL_compressed_texture_astc"),d!==null?l:null):l===Fs?(d=t.get("EXT_texture_compression_bptc"),d!==null?l:null):l===un?a?34042:(d=t.get("WEBGL_depth_texture"),d!==null?d.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class zr extends Yi{constructor(t=[]){super(),this.cameras=t}}zr.prototype.isArrayCamera=!0;class vl extends ar{constructor(){super(),this.type="Group"}}vl.prototype.isGroup=!0;const Wp={type:"move"};class Kl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new vl,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new vl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new gt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new gt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new vl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new gt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new gt),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,i,a){let l=null,d=null,p=null;const v=this._targetRay,_=this._grip,x=this._hand;if(t&&i.session.visibilityState!=="visible-blurred")if(v!==null&&(l=i.getPose(t.targetRaySpace,a),l!==null&&(v.matrix.fromArray(l.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),l.linearVelocity?(v.hasLinearVelocity=!0,v.linearVelocity.copy(l.linearVelocity)):v.hasLinearVelocity=!1,l.angularVelocity?(v.hasAngularVelocity=!0,v.angularVelocity.copy(l.angularVelocity)):v.hasAngularVelocity=!1,this.dispatchEvent(Wp))),x&&t.hand){p=!0;for(const U of t.hand.values()){const D=i.getJointPose(U,a);if(x.joints[U.jointName]===void 0){const ot=new vl;ot.matrixAutoUpdate=!1,ot.visible=!1,x.joints[U.jointName]=ot,x.add(ot)}const Z=x.joints[U.jointName];D!==null&&(Z.matrix.fromArray(D.transform.matrix),Z.matrix.decompose(Z.position,Z.rotation,Z.scale),Z.jointRadius=D.radius),Z.visible=D!==null}const M=x.joints["index-finger-tip"],C=x.joints["thumb-tip"],A=M.position.distanceTo(C.position),R=.02,O=.005;x.inputState.pinching&&A>R+O?(x.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!x.inputState.pinching&&A<=R-O&&(x.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else _!==null&&t.gripSpace&&(d=i.getPose(t.gripSpace,a),d!==null&&(_.matrix.fromArray(d.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),d.linearVelocity?(_.hasLinearVelocity=!0,_.linearVelocity.copy(d.linearVelocity)):_.hasLinearVelocity=!1,d.angularVelocity?(_.hasAngularVelocity=!0,_.angularVelocity.copy(d.angularVelocity)):_.hasAngularVelocity=!1));return v!==null&&(v.visible=l!==null),_!==null&&(_.visible=d!==null),x!==null&&(x.visible=p!==null),this}}class Pf extends Fa{constructor(t,i){super();const a=this,l=t.state;let d=null,p=1,v=null,_="local-floor",x=null,M=null,C=null,A=null;const R=[],O=new Map,U=new Yi;U.layers.enable(1),U.viewport=new Ir;const D=new Yi;D.layers.enable(2),D.viewport=new Ir;const Z=[U,D],ot=new zr;ot.layers.enable(1),ot.layers.enable(2);let vt=null,mt=null;function At(Ht){const ce=O.get(Ht.inputSource);ce&&ce.dispatchEvent({type:Ht.type,data:Ht.inputSource})}function Pt(){O.forEach(function(Ht,ce){Ht.disconnect(ce)}),O.clear(),vt=null,mt=null,l.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),ge.stop(),a.isPresenting=!1,a.dispatchEvent({type:"sessionend"})}function Et(Ht){const ce=d.inputSources;for(let We=0;We<R.length;We++)O.set(ce[We],R[We]);for(let We=0;We<Ht.removed.length;We++){const je=Ht.removed[We],ze=O.get(je);ze&&(ze.dispatchEvent({type:"disconnected",data:je}),O.delete(je))}for(let We=0;We<Ht.added.length;We++){const je=Ht.added[We],ze=O.get(je);ze&&ze.dispatchEvent({type:"connected",data:je})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new Kl,R[Ht]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new Kl,R[Ht]=ce),ce.getGripSpace()},this.getHand=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new Kl,R[Ht]=ce),ce.getHandSpace()},this.setFramebufferScaleFactor=function(Ht){p=Ht,a.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ht){_=Ht,a.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return v},this.getSession=function(){return d},this.setSession=async function(Ht){if(d=Ht,d!==null){d.addEventListener("select",At),d.addEventListener("selectstart",At),d.addEventListener("selectend",At),d.addEventListener("squeeze",At),d.addEventListener("squeezestart",At),d.addEventListener("squeezeend",At),d.addEventListener("end",Pt),d.addEventListener("inputsourceschange",Et);const ce=i.getContextAttributes();if(ce.xrCompatible!==!0&&await i.makeXRCompatible(),d.renderState.layers===void 0){const We={antialias:ce.antialias,alpha:ce.alpha,depth:ce.depth,stencil:ce.stencil,framebufferScaleFactor:p},je=new XRWebGLLayer(d,i,We);d.updateRenderState({baseLayer:je})}else{let We=0;ce.depth&&(We=ce.stencil?34041:6402);const je={colorFormat:ce.alpha?6408:6407,depthFormat:We,scaleFactor:p};M=new XRWebGLBinding(d,i),A=M.createProjectionLayer(je),C=i.createFramebuffer(),d.updateRenderState({layers:[A]})}v=await d.requestReferenceSpace(_),ge.setContext(d),ge.start(),a.isPresenting=!0,a.dispatchEvent({type:"sessionstart"})}};const Ot=new gt,Ie=new gt;function ye(Ht,ce){ce===null?Ht.matrixWorld.copy(Ht.matrix):Ht.matrixWorld.multiplyMatrices(ce.matrixWorld,Ht.matrix),Ht.matrixWorldInverse.copy(Ht.matrixWorld).invert()}this.updateCamera=function(Ht){if(d===null)return;ot.near=D.near=U.near=Ht.near,ot.far=D.far=U.far=Ht.far,vt===ot.near&&mt===ot.far||(d.updateRenderState({depthNear:ot.near,depthFar:ot.far}),vt=ot.near,mt=ot.far);const ce=Ht.parent,We=ot.cameras;ye(ot,ce);for(let ze=0;ze<We.length;ze++)ye(We[ze],ce);ot.matrixWorld.decompose(ot.position,ot.quaternion,ot.scale),Ht.position.copy(ot.position),Ht.quaternion.copy(ot.quaternion),Ht.scale.copy(ot.scale),Ht.matrix.copy(ot.matrix),Ht.matrixWorld.copy(ot.matrixWorld);const je=Ht.children;for(let ze=0,fn=je.length;ze<fn;ze++)je[ze].updateMatrixWorld(!0);We.length===2?function(ze,fn,_n){Ot.setFromMatrixPosition(fn.matrixWorld),Ie.setFromMatrixPosition(_n.matrixWorld);const Mn=Ot.distanceTo(Ie),Sn=fn.projectionMatrix.elements,Rt=_n.projectionMatrix.elements,Dt=Sn[14]/(Sn[10]-1),Fe=Sn[14]/(Sn[10]+1),Be=(Sn[9]+1)/Sn[5],pe=(Sn[9]-1)/Sn[5],rn=(Sn[8]-1)/Sn[0],sn=(Rt[8]+1)/Rt[0],be=Dt*rn,xt=Dt*sn,Zt=Mn/(-rn+sn),Te=Zt*-rn;fn.matrixWorld.decompose(ze.position,ze.quaternion,ze.scale),ze.translateX(Te),ze.translateZ(Zt),ze.matrixWorld.compose(ze.position,ze.quaternion,ze.scale),ze.matrixWorldInverse.copy(ze.matrixWorld).invert();const Pe=Dt+Zt,we=Fe+Zt,bn=be-Te,Gn=xt+(Mn-Te),Fn=Be*Fe/we*Pe,_r=pe*Fe/we*Pe;ze.projectionMatrix.makePerspective(bn,Gn,Fn,_r,Pe,we)}(ot,U,D):ot.projectionMatrix.copy(U.projectionMatrix)},this.getCamera=function(){return ot};let xe=null;const ge=new Eh;ge.setAnimationLoop(function(Ht,ce){if(x=ce.getViewerPose(v),x!==null){const je=x.views,ze=d.renderState.baseLayer;d.renderState.layers===void 0&&l.bindXRFramebuffer(ze.framebuffer);let fn=!1;je.length!==ot.cameras.length&&(ot.cameras.length=0,fn=!0);for(let _n=0;_n<je.length;_n++){const Mn=je[_n];let Sn=null;if(d.renderState.layers===void 0)Sn=ze.getViewport(Mn);else{const Dt=M.getViewSubImage(A,Mn);l.bindXRFramebuffer(C),i.framebufferTexture2D(36160,36064,3553,Dt.colorTexture,0),Dt.depthStencilTexture!==void 0&&i.framebufferTexture2D(36160,36096,3553,Dt.depthStencilTexture,0),Sn=Dt.viewport}const Rt=Z[_n];Rt.matrix.fromArray(Mn.transform.matrix),Rt.projectionMatrix.fromArray(Mn.projectionMatrix),Rt.viewport.set(Sn.x,Sn.y,Sn.width,Sn.height),_n===0&&ot.matrix.copy(Rt.matrix),fn===!0&&ot.cameras.push(Rt)}}const We=d.inputSources;for(let je=0;je<R.length;je++){const ze=R[je],fn=We[je];ze.update(fn,ce,v)}xe&&xe(Ht,ce)}),this.setAnimationLoop=function(Ht){xe=Ht},this.dispose=function(){}}}function Xp(m){function t(a,l){a.opacity.value=l.opacity,l.color&&a.diffuse.value.copy(l.color),l.emissive&&a.emissive.value.copy(l.emissive).multiplyScalar(l.emissiveIntensity),l.map&&(a.map.value=l.map),l.alphaMap&&(a.alphaMap.value=l.alphaMap),l.specularMap&&(a.specularMap.value=l.specularMap);const d=m.get(l).envMap;if(d){a.envMap.value=d,a.flipEnvMap.value=d.isCubeTexture&&d._needsFlipEnvMap?-1:1,a.reflectivity.value=l.reflectivity,a.refractionRatio.value=l.refractionRatio;const _=m.get(d).__maxMipLevel;_!==void 0&&(a.maxMipLevel.value=_)}let p,v;l.lightMap&&(a.lightMap.value=l.lightMap,a.lightMapIntensity.value=l.lightMapIntensity),l.aoMap&&(a.aoMap.value=l.aoMap,a.aoMapIntensity.value=l.aoMapIntensity),l.map?p=l.map:l.specularMap?p=l.specularMap:l.displacementMap?p=l.displacementMap:l.normalMap?p=l.normalMap:l.bumpMap?p=l.bumpMap:l.roughnessMap?p=l.roughnessMap:l.metalnessMap?p=l.metalnessMap:l.alphaMap?p=l.alphaMap:l.emissiveMap?p=l.emissiveMap:l.clearcoatMap?p=l.clearcoatMap:l.clearcoatNormalMap?p=l.clearcoatNormalMap:l.clearcoatRoughnessMap&&(p=l.clearcoatRoughnessMap),p!==void 0&&(p.isWebGLRenderTarget&&(p=p.texture),p.matrixAutoUpdate===!0&&p.updateMatrix(),a.uvTransform.value.copy(p.matrix)),l.aoMap?v=l.aoMap:l.lightMap&&(v=l.lightMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),a.uv2Transform.value.copy(v.matrix))}function i(a,l){a.roughness.value=l.roughness,a.metalness.value=l.metalness,l.roughnessMap&&(a.roughnessMap.value=l.roughnessMap),l.metalnessMap&&(a.metalnessMap.value=l.metalnessMap),l.emissiveMap&&(a.emissiveMap.value=l.emissiveMap),l.bumpMap&&(a.bumpMap.value=l.bumpMap,a.bumpScale.value=l.bumpScale,l.side===L&&(a.bumpScale.value*=-1)),l.normalMap&&(a.normalMap.value=l.normalMap,a.normalScale.value.copy(l.normalScale),l.side===L&&a.normalScale.value.negate()),l.displacementMap&&(a.displacementMap.value=l.displacementMap,a.displacementScale.value=l.displacementScale,a.displacementBias.value=l.displacementBias),m.get(l).envMap&&(a.envMapIntensity.value=l.envMapIntensity)}return{refreshFogUniforms:function(a,l){a.fogColor.value.copy(l.color),l.isFog?(a.fogNear.value=l.near,a.fogFar.value=l.far):l.isFogExp2&&(a.fogDensity.value=l.density)},refreshMaterialUniforms:function(a,l,d,p,v){l.isMeshBasicMaterial?t(a,l):l.isMeshLambertMaterial?(t(a,l),function(_,x){x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap)}(a,l)):l.isMeshToonMaterial?(t(a,l),function(_,x){x.gradientMap&&(_.gradientMap.value=x.gradientMap),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshPhongMaterial?(t(a,l),function(_,x){_.specular.value.copy(x.specular),_.shininess.value=Math.max(x.shininess,1e-4),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshStandardMaterial?(t(a,l),l.isMeshPhysicalMaterial?function(_,x,M){i(_,x),_.reflectivity.value=x.reflectivity,_.clearcoat.value=x.clearcoat,_.clearcoatRoughness.value=x.clearcoatRoughness,x.sheen&&_.sheen.value.copy(x.sheen),x.clearcoatMap&&(_.clearcoatMap.value=x.clearcoatMap),x.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap),x.clearcoatNormalMap&&(_.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),_.clearcoatNormalMap.value=x.clearcoatNormalMap,x.side===L&&_.clearcoatNormalScale.value.negate()),_.transmission.value=x.transmission,x.transmissionMap&&(_.transmissionMap.value=x.transmissionMap),x.transmission>0&&(_.transmissionSamplerMap.value=M.texture,_.transmissionSamplerSize.value.set(M.width,M.height)),_.thickness.value=x.thickness,x.thicknessMap&&(_.thicknessMap.value=x.thicknessMap),_.attenuationDistance.value=x.attenuationDistance,_.attenuationColor.value.copy(x.attenuationColor)}(a,l,v):i(a,l)):l.isMeshMatcapMaterial?(t(a,l),function(_,x){x.matcap&&(_.matcap.value=x.matcap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshDepthMaterial?(t(a,l),function(_,x){x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshDistanceMaterial?(t(a,l),function(_,x){x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias),_.referencePosition.value.copy(x.referencePosition),_.nearDistance.value=x.nearDistance,_.farDistance.value=x.farDistance}(a,l)):l.isMeshNormalMaterial?(t(a,l),function(_,x){x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isLineBasicMaterial?(function(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity}(a,l),l.isLineDashedMaterial&&function(_,x){_.dashSize.value=x.dashSize,_.totalSize.value=x.dashSize+x.gapSize,_.scale.value=x.scale}(a,l)):l.isPointsMaterial?function(_,x,M,C){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.size.value=x.size*M,_.scale.value=.5*C,x.map&&(_.map.value=x.map),x.alphaMap&&(_.alphaMap.value=x.alphaMap);let A;x.map?A=x.map:x.alphaMap&&(A=x.alphaMap),A!==void 0&&(A.matrixAutoUpdate===!0&&A.updateMatrix(),_.uvTransform.value.copy(A.matrix))}(a,l,d,p):l.isSpriteMaterial?function(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.rotation.value=x.rotation,x.map&&(_.map.value=x.map),x.alphaMap&&(_.alphaMap.value=x.alphaMap);let M;x.map?M=x.map:x.alphaMap&&(M=x.alphaMap),M!==void 0&&(M.matrixAutoUpdate===!0&&M.updateMatrix(),_.uvTransform.value.copy(M.matrix))}(a,l):l.isShadowMaterial?(a.color.value.copy(l.color),a.opacity.value=l.opacity):l.isShaderMaterial&&(l.uniformsNeedUpdate=!1)}}}function Fr(m={}){const t=m.canvas!==void 0?m.canvas:function(){const It=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return It.style.display="block",It}(),i=m.context!==void 0?m.context:null,a=m.alpha!==void 0&&m.alpha,l=m.depth===void 0||m.depth,d=m.stencil===void 0||m.stencil,p=m.antialias!==void 0&&m.antialias,v=m.premultipliedAlpha===void 0||m.premultipliedAlpha,_=m.preserveDrawingBuffer!==void 0&&m.preserveDrawingBuffer,x=m.powerPreference!==void 0?m.powerPreference:"default",M=m.failIfMajorPerformanceCaveat!==void 0&&m.failIfMajorPerformanceCaveat;let C=null,A=null;const R=[],O=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Wr,this.physicallyCorrectLights=!1,this.toneMapping=Or,this.toneMappingExposure=1;const U=this;let D=!1,Z=0,ot=0,vt=null,mt=-1,At=null;const Pt=new Ir,Et=new Ir;let Ot=null,Ie=t.width,ye=t.height,xe=1,ge=null,Ht=null;const ce=new Ir(0,0,Ie,ye),We=new Ir(0,0,Ie,ye);let je=!1;const ze=[],fn=new ja;let _n=!1,Mn=!1,Sn=null;const Rt=new En,Dt=new gt,Fe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Be(){return vt===null?xe:1}let pe,rn,sn,be,xt,Zt,Te,Pe,we,bn,Gn,Fn,_r,Tr,Xo,fi,uu,sm,am,lm,$s,Ma,qe=i;function Dg(It,Me){for(let se=0;se<It.length;se++){const Ce=It[se],en=t.getContext(Ce,Me);if(en!==null)return en}return null}try{const It={alpha:a,depth:l,stencil:d,antialias:p,premultipliedAlpha:v,preserveDrawingBuffer:_,powerPreference:x,failIfMajorPerformanceCaveat:M};if(t.addEventListener("webglcontextlost",Fg,!1),t.addEventListener("webglcontextrestored",Bg,!1),qe===null){const Me=["webgl2","webgl","experimental-webgl"];if(U.isWebGL1Renderer===!0&&Me.shift(),qe=Dg(Me,It),qe===null)throw Dg(Me)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}qe.getShaderPrecisionFormat===void 0&&(qe.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(It){throw console.error("THREE.WebGLRenderer: "+It.message),It}function Ng(){pe=new Mp(qe),rn=new Gi(qe,pe,m),pe.init(rn),$s=new Gc(qe,pe,rn),sn=new qd(qe,pe,rn),ze[0]=1029,be=new Cp(qe),xt=new ci,Zt=new As(qe,pe,sn,xt,rn,$s,be),Te=new ml(U),Pe=new Va(qe,rn),Ma=new vf(qe,pe,Pe,rn),we=new Ah(qe,Pe,be,Ma),bn=new Pc(qe,we,Pe,be),sm=new Cc(qe),Xo=new Mc(xt),Gn=new si(U,Te,pe,rn,Ma,Xo),Fn=new Xp(xt),_r=new Uc(xt),Tr=new Xd(pe,rn),uu=new Mh(U,Te,sn,bn,v),fi=new or(U,bn,rn),am=new fa(qe,pe,be,rn),lm=new Ap(qe,pe,be,rn),be.programs=Gn.programs,U.capabilities=rn,U.extensions=pe,U.properties=xt,U.renderLists=_r,U.shadowMap=fi,U.state=sn,U.info=be}Ng();const nl=new Pf(U,qe);function Fg(It){It.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function Bg(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const It=be.autoReset,Me=fi.enabled,se=fi.autoUpdate,Ce=fi.needsUpdate,en=fi.type;Ng(),be.autoReset=It,fi.enabled=Me,fi.autoUpdate=se,fi.needsUpdate=Ce,fi.type=en}function kg(It){const Me=It.target;Me.removeEventListener("dispose",kg),function(se){(function(Ce){const en=xt.get(Ce).programs;en!==void 0&&en.forEach(function(Xr){Gn.releaseProgram(Xr)})})(se),xt.remove(se)}(Me)}this.xr=nl,this.getContext=function(){return qe},this.getContextAttributes=function(){return qe.getContextAttributes()},this.forceContextLoss=function(){const It=pe.get("WEBGL_lose_context");It&&It.loseContext()},this.forceContextRestore=function(){const It=pe.get("WEBGL_lose_context");It&&It.restoreContext()},this.getPixelRatio=function(){return xe},this.setPixelRatio=function(It){It!==void 0&&(xe=It,this.setSize(Ie,ye,!1))},this.getSize=function(It){return It.set(Ie,ye)},this.setSize=function(It,Me,se){nl.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Ie=It,ye=Me,t.width=Math.floor(It*xe),t.height=Math.floor(Me*xe),se!==!1&&(t.style.width=It+"px",t.style.height=Me+"px"),this.setViewport(0,0,It,Me))},this.getDrawingBufferSize=function(It){return It.set(Ie*xe,ye*xe).floor()},this.setDrawingBufferSize=function(It,Me,se){Ie=It,ye=Me,xe=se,t.width=Math.floor(It*se),t.height=Math.floor(Me*se),this.setViewport(0,0,It,Me)},this.getCurrentViewport=function(It){return It.copy(Pt)},this.getViewport=function(It){return It.copy(ce)},this.setViewport=function(It,Me,se,Ce){It.isVector4?ce.set(It.x,It.y,It.z,It.w):ce.set(It,Me,se,Ce),sn.viewport(Pt.copy(ce).multiplyScalar(xe).floor())},this.getScissor=function(It){return It.copy(We)},this.setScissor=function(It,Me,se,Ce){It.isVector4?We.set(It.x,It.y,It.z,It.w):We.set(It,Me,se,Ce),sn.scissor(Et.copy(We).multiplyScalar(xe).floor())},this.getScissorTest=function(){return je},this.setScissorTest=function(It){sn.setScissorTest(je=It)},this.setOpaqueSort=function(It){ge=It},this.setTransparentSort=function(It){Ht=It},this.getClearColor=function(It){return It.copy(uu.getClearColor())},this.setClearColor=function(){uu.setClearColor.apply(uu,arguments)},this.getClearAlpha=function(){return uu.getClearAlpha()},this.setClearAlpha=function(){uu.setClearAlpha.apply(uu,arguments)},this.clear=function(It,Me,se){let Ce=0;(It===void 0||It)&&(Ce|=16384),(Me===void 0||Me)&&(Ce|=256),(se===void 0||se)&&(Ce|=1024),qe.clear(Ce)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Fg,!1),t.removeEventListener("webglcontextrestored",Bg,!1),_r.dispose(),Tr.dispose(),xt.dispose(),Te.dispose(),bn.dispose(),Ma.dispose(),nl.dispose(),nl.removeEventListener("sessionstart",Ug),nl.removeEventListener("sessionend",Gg),Sn&&(Sn.dispose(),Sn=null),cp.stop()},this.renderBufferImmediate=function(It,Me){Ma.initAttributes();const se=xt.get(It);It.hasPositions&&!se.position&&(se.position=qe.createBuffer()),It.hasNormals&&!se.normal&&(se.normal=qe.createBuffer()),It.hasUvs&&!se.uv&&(se.uv=qe.createBuffer()),It.hasColors&&!se.color&&(se.color=qe.createBuffer());const Ce=Me.getAttributes();It.hasPositions&&(qe.bindBuffer(34962,se.position),qe.bufferData(34962,It.positionArray,35048),Ma.enableAttribute(Ce.position),qe.vertexAttribPointer(Ce.position,3,5126,!1,0,0)),It.hasNormals&&(qe.bindBuffer(34962,se.normal),qe.bufferData(34962,It.normalArray,35048),Ma.enableAttribute(Ce.normal),qe.vertexAttribPointer(Ce.normal,3,5126,!1,0,0)),It.hasUvs&&(qe.bindBuffer(34962,se.uv),qe.bufferData(34962,It.uvArray,35048),Ma.enableAttribute(Ce.uv),qe.vertexAttribPointer(Ce.uv,2,5126,!1,0,0)),It.hasColors&&(qe.bindBuffer(34962,se.color),qe.bufferData(34962,It.colorArray,35048),Ma.enableAttribute(Ce.color),qe.vertexAttribPointer(Ce.color,3,5126,!1,0,0)),Ma.disableUnusedAttributes(),qe.drawArrays(4,0,It.count),It.count=0},this.renderBufferDirect=function(It,Me,se,Ce,en,Xr){Me===null&&(Me=Fe);const cr=en.isMesh&&en.matrixWorld.determinant()<0,cn=jg(It,Me,Ce,en);sn.setMaterial(Ce,cr);let Cr=se.index;const Vn=se.attributes.position;if(Cr===null){if(Vn===void 0||Vn.count===0)return}else if(Cr.count===0)return;let Vr,sr=1;Ce.wireframe===!0&&(Cr=we.getWireframeAttribute(se),sr=2),(Ce.morphTargets||Ce.morphNormals)&&sm.update(en,se,Ce,cn),Ma.setup(en,Ce,cn,se,Cr);let kr=am;Cr!==null&&(Vr=Pe.get(Cr),kr=lm,kr.setIndex(Vr));const Lo=Cr!==null?Cr.count:Vn.count,Ci=se.drawRange.start*sr,hu=se.drawRange.count*sr,mi=Xr!==null?Xr.start*sr:0,Ju=Xr!==null?Xr.count*sr:1/0,qo=Math.max(Ci,mi),rl=Math.min(Lo,Ci+hu,mi+Ju)-1,Ns=Math.max(0,rl-qo+1);if(Ns!==0){if(en.isMesh)Ce.wireframe===!0?(sn.setLineWidth(Ce.wireframeLinewidth*Be()),kr.setMode(1)):kr.setMode(4);else if(en.isLine){let um=Ce.linewidth;um===void 0&&(um=1),sn.setLineWidth(um*Be()),en.isLineSegments?kr.setMode(1):en.isLineLoop?kr.setMode(2):kr.setMode(3)}else en.isPoints?kr.setMode(0):en.isSprite&&kr.setMode(4);if(en.isInstancedMesh)kr.renderInstances(qo,Ns,en.count);else if(se.isInstancedBufferGeometry){const um=Math.min(se.instanceCount,se._maxInstanceCount);kr.renderInstances(qo,Ns,um)}else kr.render(qo,Ns)}},this.compile=function(It,Me){A=Tr.get(It),A.init(),It.traverseVisible(function(se){se.isLight&&se.layers.test(Me.layers)&&(A.pushLight(se),se.castShadow&&A.pushShadow(se))}),A.setupLights(),It.traverse(function(se){const Ce=se.material;if(Ce)if(Array.isArray(Ce))for(let en=0;en<Ce.length;en++)_g(Ce[en],It,se);else _g(Ce,It,se)})};let vg=null;function Ug(){cp.stop()}function Gg(){cp.start()}const cp=new Eh;function Wm(It,Me,se){const Ce=Me.isScene===!0?Me.overrideMaterial:null;for(let en=0,Xr=It.length;en<Xr;en++){const cr=It[en],cn=cr.object,Cr=cr.geometry,Vn=Ce===null?cr.material:Ce,Vr=cr.group;if(se.isArrayCamera){const sr=se.cameras;for(let kr=0,Lo=sr.length;kr<Lo;kr++){const Ci=sr[kr];cn.layers.test(Ci.layers)&&(sn.viewport(Pt.copy(Ci.viewport)),A.setupLightsView(Ci),Hg(cn,Me,Ci,Cr,Vn,Vr))}}else Hg(cn,Me,se,Cr,Vn,Vr)}}function Hg(It,Me,se,Ce,en,Xr){if(It.onBeforeRender(U,Me,se,Ce,en,Xr),It.modelViewMatrix.multiplyMatrices(se.matrixWorldInverse,It.matrixWorld),It.normalMatrix.getNormalMatrix(It.modelViewMatrix),It.isImmediateRenderObject){const cr=jg(se,Me,en,It);sn.setMaterial(en),Ma.reset(),function(cn,Cr){cn.render(function(Vn){U.renderBufferImmediate(Vn,Cr)})}(It,cr)}else en.transparent===!0&&en.side===k?(en.side=L,en.needsUpdate=!0,U.renderBufferDirect(se,Me,Ce,en,It,Xr),en.side=zt,en.needsUpdate=!0,U.renderBufferDirect(se,Me,Ce,en,It,Xr),en.side=k):U.renderBufferDirect(se,Me,Ce,en,It,Xr);It.onAfterRender(U,Me,se,Ce,en,Xr)}function _g(It,Me,se){Me.isScene!==!0&&(Me=Fe);const Ce=xt.get(It),en=A.state.lights,Xr=A.state.shadowsArray,cr=en.state.version,cn=Gn.getParameters(It,en.state,Xr,Me,se),Cr=Gn.getProgramCacheKey(cn);let Vn=Ce.programs;Ce.environment=It.isMeshStandardMaterial?Me.environment:null,Ce.fog=Me.fog,Ce.envMap=Te.get(It.envMap||Ce.environment),Vn===void 0&&(It.addEventListener("dispose",kg),Vn=new Map,Ce.programs=Vn);let Vr=Vn.get(Cr);if(Vr!==void 0){if(Ce.currentProgram===Vr&&Ce.lightsStateVersion===cr)return zg(It,cn),Vr}else cn.uniforms=Gn.getUniforms(It),It.onBuild(cn,U),It.onBeforeCompile(cn,U),Vr=Gn.acquireProgram(cn,Cr),Vn.set(Cr,Vr),Ce.uniforms=cn.uniforms;const sr=Ce.uniforms;(It.isShaderMaterial||It.isRawShaderMaterial)&&It.clipping!==!0||(sr.clippingPlanes=Xo.uniform),zg(It,cn),Ce.needsLights=function(Ci){return Ci.isMeshLambertMaterial||Ci.isMeshToonMaterial||Ci.isMeshPhongMaterial||Ci.isMeshStandardMaterial||Ci.isShadowMaterial||Ci.isShaderMaterial&&Ci.lights===!0}(It),Ce.lightsStateVersion=cr,Ce.needsLights&&(sr.ambientLightColor.value=en.state.ambient,sr.lightProbe.value=en.state.probe,sr.directionalLights.value=en.state.directional,sr.directionalLightShadows.value=en.state.directionalShadow,sr.spotLights.value=en.state.spot,sr.spotLightShadows.value=en.state.spotShadow,sr.rectAreaLights.value=en.state.rectArea,sr.ltc_1.value=en.state.rectAreaLTC1,sr.ltc_2.value=en.state.rectAreaLTC2,sr.pointLights.value=en.state.point,sr.pointLightShadows.value=en.state.pointShadow,sr.hemisphereLights.value=en.state.hemi,sr.directionalShadowMap.value=en.state.directionalShadowMap,sr.directionalShadowMatrix.value=en.state.directionalShadowMatrix,sr.spotShadowMap.value=en.state.spotShadowMap,sr.spotShadowMatrix.value=en.state.spotShadowMatrix,sr.pointShadowMap.value=en.state.pointShadowMap,sr.pointShadowMatrix.value=en.state.pointShadowMatrix);const kr=Vr.getUniforms(),Lo=ma.seqWithValue(kr.seq,sr);return Ce.currentProgram=Vr,Ce.uniformsList=Lo,Vr}function zg(It,Me){const se=xt.get(It);se.outputEncoding=Me.outputEncoding,se.instancing=Me.instancing,se.skinning=Me.skinning,se.numClippingPlanes=Me.numClippingPlanes,se.numIntersection=Me.numClipIntersection,se.vertexAlphas=Me.vertexAlphas}function jg(It,Me,se,Ce){Me.isScene!==!0&&(Me=Fe),Zt.resetTextureUnits();const en=Me.fog,Xr=se.isMeshStandardMaterial?Me.environment:null,cr=vt===null?U.outputEncoding:vt.texture.encoding,cn=Te.get(se.envMap||Xr),Cr=se.vertexColors===!0&&Ce.geometry&&Ce.geometry.attributes.color&&Ce.geometry.attributes.color.itemSize===4,Vn=xt.get(se),Vr=A.state.lights;if(_n===!0&&(Mn===!0||It!==At)){const Ns=It===At&&se.id===mt;Xo.setState(se,It,Ns)}let sr=!1;se.version===Vn.__version?Vn.needsLights&&Vn.lightsStateVersion!==Vr.state.version||Vn.outputEncoding!==cr||Ce.isInstancedMesh&&Vn.instancing===!1?sr=!0:Ce.isInstancedMesh||Vn.instancing!==!0?Ce.isSkinnedMesh&&Vn.skinning===!1?sr=!0:Ce.isSkinnedMesh||Vn.skinning!==!0?Vn.envMap!==cn||se.fog&&Vn.fog!==en?sr=!0:Vn.numClippingPlanes===void 0||Vn.numClippingPlanes===Xo.numPlanes&&Vn.numIntersection===Xo.numIntersection?Vn.vertexAlphas!==Cr&&(sr=!0):sr=!0:sr=!0:sr=!0:(sr=!0,Vn.__version=se.version);let kr=Vn.currentProgram;sr===!0&&(kr=_g(se,Me,Ce));let Lo=!1,Ci=!1,hu=!1;const mi=kr.getUniforms(),Ju=Vn.uniforms;if(sn.useProgram(kr.program)&&(Lo=!0,Ci=!0,hu=!0),se.id!==mt&&(mt=se.id,Ci=!0),Lo||At!==It){if(mi.setValue(qe,"projectionMatrix",It.projectionMatrix),rn.logarithmicDepthBuffer&&mi.setValue(qe,"logDepthBufFC",2/(Math.log(It.far+1)/Math.LN2)),At!==It&&(At=It,Ci=!0,hu=!0),se.isShaderMaterial||se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshStandardMaterial||se.envMap){const Ns=mi.map.cameraPosition;Ns!==void 0&&Ns.setValue(qe,Dt.setFromMatrixPosition(It.matrixWorld))}(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&mi.setValue(qe,"isOrthographic",It.isOrthographicCamera===!0),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial||se.isShadowMaterial||Ce.isSkinnedMesh)&&mi.setValue(qe,"viewMatrix",It.matrixWorldInverse)}if(Ce.isSkinnedMesh){mi.setOptional(qe,Ce,"bindMatrix"),mi.setOptional(qe,Ce,"bindMatrixInverse");const Ns=Ce.skeleton;Ns&&(rn.floatVertexTextures?(Ns.boneTexture===null&&Ns.computeBoneTexture(),mi.setValue(qe,"boneTexture",Ns.boneTexture,Zt),mi.setValue(qe,"boneTextureSize",Ns.boneTextureSize)):mi.setOptional(qe,Ns,"boneMatrices"))}var qo,rl;return(Ci||Vn.receiveShadow!==Ce.receiveShadow)&&(Vn.receiveShadow=Ce.receiveShadow,mi.setValue(qe,"receiveShadow",Ce.receiveShadow)),Ci&&(mi.setValue(qe,"toneMappingExposure",U.toneMappingExposure),Vn.needsLights&&(rl=hu,(qo=Ju).ambientLightColor.needsUpdate=rl,qo.lightProbe.needsUpdate=rl,qo.directionalLights.needsUpdate=rl,qo.directionalLightShadows.needsUpdate=rl,qo.pointLights.needsUpdate=rl,qo.pointLightShadows.needsUpdate=rl,qo.spotLights.needsUpdate=rl,qo.spotLightShadows.needsUpdate=rl,qo.rectAreaLights.needsUpdate=rl,qo.hemisphereLights.needsUpdate=rl),en&&se.fog&&Fn.refreshFogUniforms(Ju,en),Fn.refreshMaterialUniforms(Ju,se,xe,ye,Sn),ma.upload(qe,Vn.uniformsList,Ju,Zt)),se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(ma.upload(qe,Vn.uniformsList,Ju,Zt),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&mi.setValue(qe,"center",Ce.center),mi.setValue(qe,"modelViewMatrix",Ce.modelViewMatrix),mi.setValue(qe,"normalMatrix",Ce.normalMatrix),mi.setValue(qe,"modelMatrix",Ce.matrixWorld),kr}cp.setAnimationLoop(function(It){vg&&vg(It)}),typeof window!="undefined"&&cp.setContext(window),this.setAnimationLoop=function(It){vg=It,nl.setAnimationLoop(It),It===null?cp.stop():cp.start()},nl.addEventListener("sessionstart",Ug),nl.addEventListener("sessionend",Gg),this.render=function(It,Me){if(Me!==void 0&&Me.isCamera!==!0)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(D===!0)return;It.autoUpdate===!0&&It.updateMatrixWorld(),Me.parent===null&&Me.updateMatrixWorld(),nl.enabled===!0&&nl.isPresenting===!0&&(nl.cameraAutoUpdate===!0&&nl.updateCamera(Me),Me=nl.getCamera()),It.isScene===!0&&It.onBeforeRender(U,It,Me,vt),A=Tr.get(It,O.length),A.init(),O.push(A),Rt.multiplyMatrices(Me.projectionMatrix,Me.matrixWorldInverse),fn.setFromProjectionMatrix(Rt),Mn=this.localClippingEnabled,_n=Xo.init(this.clippingPlanes,Mn,Me),C=_r.get(It,R.length),C.init(),R.push(C),function cr(cn,Cr,Vn,Vr){if(cn.visible===!1)return;if(cn.layers.test(Cr.layers)){if(cn.isGroup)Vn=cn.renderOrder;else if(cn.isLOD)cn.autoUpdate===!0&&cn.update(Cr);else if(cn.isLight)A.pushLight(cn),cn.castShadow&&A.pushShadow(cn);else if(cn.isSprite){if(!cn.frustumCulled||fn.intersectsSprite(cn)){Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt);const kr=bn.update(cn),Lo=cn.material;Lo.visible&&C.push(cn,kr,Lo,Vn,Dt.z,null)}}else if(cn.isImmediateRenderObject)Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt),C.push(cn,null,cn.material,Vn,Dt.z,null);else if((cn.isMesh||cn.isLine||cn.isPoints)&&(cn.isSkinnedMesh&&cn.skeleton.frame!==be.render.frame&&(cn.skeleton.update(),cn.skeleton.frame=be.render.frame),!cn.frustumCulled||fn.intersectsObject(cn))){Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt);const kr=bn.update(cn),Lo=cn.material;if(Array.isArray(Lo)){const Ci=kr.groups;for(let hu=0,mi=Ci.length;hu<mi;hu++){const Ju=Ci[hu],qo=Lo[Ju.materialIndex];qo&&qo.visible&&C.push(cn,kr,qo,Vn,Dt.z,Ju)}}else Lo.visible&&C.push(cn,kr,Lo,Vn,Dt.z,null)}}const sr=cn.children;for(let kr=0,Lo=sr.length;kr<Lo;kr++)cr(sr[kr],Cr,Vn,Vr)}(It,Me,0,U.sortObjects),C.finish(),U.sortObjects===!0&&C.sort(ge,Ht),_n===!0&&Xo.beginShadows();const se=A.state.shadowsArray;fi.render(se,It,Me),A.setupLights(),A.setupLightsView(Me),_n===!0&&Xo.endShadows(),this.info.autoReset===!0&&this.info.reset(),uu.render(C,It);const Ce=C.opaque,en=C.transmissive,Xr=C.transparent;Ce.length>0&&Wm(Ce,It,Me),en.length>0&&function(cr,cn,Cr,Vn){if(Sn===null){const kr=p===!0&&rn.isWebGL2===!0;Sn=new(kr?vc:Fo)(1024,1024,{generateMipmaps:!0,type:$s.convert(Ft)!==null?Ft:lo,minFilter:Yr,magFilter:wt,wrapS:St,wrapT:St})}const Vr=U.getRenderTarget();U.setRenderTarget(Sn),U.clear();const sr=U.toneMapping;U.toneMapping=Or,Wm(cr,Cr,Vn),U.toneMapping=sr,Zt.updateMultisampleRenderTarget(Sn),Zt.updateRenderTargetMipmap(Sn),U.setRenderTarget(Vr),Wm(cn,Cr,Vn)}(Ce,en,It,Me),Xr.length>0&&Wm(Xr,It,Me),vt!==null&&(Zt.updateMultisampleRenderTarget(vt),Zt.updateRenderTargetMipmap(vt)),It.isScene===!0&&It.onAfterRender(U,It,Me),sn.buffers.depth.setTest(!0),sn.buffers.depth.setMask(!0),sn.buffers.color.setMask(!0),sn.setPolygonOffset(!1),Ma.resetDefaultState(),mt=-1,At=null,O.pop(),A=O.length>0?O[O.length-1]:null,R.pop(),C=R.length>0?R[R.length-1]:null},this.getActiveCubeFace=function(){return Z},this.getActiveMipmapLevel=function(){return ot},this.getRenderTarget=function(){return vt},this.setRenderTarget=function(It,Me=0,se=0){vt=It,Z=Me,ot=se,It&&xt.get(It).__webglFramebuffer===void 0&&Zt.setupRenderTarget(It);let Ce=null,en=!1,Xr=!1;if(It){const cr=It.texture;(cr.isDataTexture3D||cr.isDataTexture2DArray)&&(Xr=!0);const cn=xt.get(It).__webglFramebuffer;It.isWebGLCubeRenderTarget?(Ce=cn[Me],en=!0):Ce=It.isWebGLMultisampleRenderTarget?xt.get(It).__webglMultisampledFramebuffer:cn,Pt.copy(It.viewport),Et.copy(It.scissor),Ot=It.scissorTest}else Pt.copy(ce).multiplyScalar(xe).floor(),Et.copy(We).multiplyScalar(xe).floor(),Ot=je;if(sn.bindFramebuffer(36160,Ce)&&rn.drawBuffers){let cr=!1;if(It)if(It.isWebGLMultipleRenderTargets){const cn=It.texture;if(ze.length!==cn.length||ze[0]!==36064){for(let Cr=0,Vn=cn.length;Cr<Vn;Cr++)ze[Cr]=36064+Cr;ze.length=cn.length,cr=!0}}else ze.length===1&&ze[0]===36064||(ze[0]=36064,ze.length=1,cr=!0);else ze.length===1&&ze[0]===1029||(ze[0]=1029,ze.length=1,cr=!0);cr&&(rn.isWebGL2?qe.drawBuffers(ze):pe.get("WEBGL_draw_buffers").drawBuffersWEBGL(ze))}if(sn.viewport(Pt),sn.scissor(Et),sn.setScissorTest(Ot),en){const cr=xt.get(It.texture);qe.framebufferTexture2D(36160,36064,34069+Me,cr.__webglTexture,se)}else if(Xr){const cr=xt.get(It.texture),cn=Me||0;qe.framebufferTextureLayer(36160,36064,cr.__webglTexture,se||0,cn)}},this.readRenderTargetPixels=function(It,Me,se,Ce,en,Xr,cr){if(!It||!It.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let cn=xt.get(It).__webglFramebuffer;if(It.isWebGLCubeRenderTarget&&cr!==void 0&&(cn=cn[cr]),cn){sn.bindFramebuffer(36160,cn);try{const Cr=It.texture,Vn=Cr.format,Vr=Cr.type;if(Vn!==Tn&&$s.convert(Vn)!==qe.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const sr=Vr===Ft&&(pe.has("EXT_color_buffer_half_float")||rn.isWebGL2&&pe.has("EXT_color_buffer_float"));if(!(Vr===lo||$s.convert(Vr)===qe.getParameter(35738)||Vr===ee&&(rn.isWebGL2||pe.has("OES_texture_float")||pe.has("WEBGL_color_buffer_float"))||sr))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");qe.checkFramebufferStatus(36160)===36053?Me>=0&&Me<=It.width-Ce&&se>=0&&se<=It.height-en&&qe.readPixels(Me,se,Ce,en,$s.convert(Vn),$s.convert(Vr),Xr):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const Cr=vt!==null?xt.get(vt).__webglFramebuffer:null;sn.bindFramebuffer(36160,Cr)}}},this.copyFramebufferToTexture=function(It,Me,se=0){const Ce=Math.pow(2,-se),en=Math.floor(Me.image.width*Ce),Xr=Math.floor(Me.image.height*Ce);let cr=$s.convert(Me.format);rn.isWebGL2&&(cr===6407&&(cr=32849),cr===6408&&(cr=32856)),Zt.setTexture2D(Me,0),qe.copyTexImage2D(3553,se,cr,It.x,It.y,en,Xr,0),sn.unbindTexture()},this.copyTextureToTexture=function(It,Me,se,Ce=0){const en=Me.image.width,Xr=Me.image.height,cr=$s.convert(se.format),cn=$s.convert(se.type);Zt.setTexture2D(se,0),qe.pixelStorei(37440,se.flipY),qe.pixelStorei(37441,se.premultiplyAlpha),qe.pixelStorei(3317,se.unpackAlignment),Me.isDataTexture?qe.texSubImage2D(3553,Ce,It.x,It.y,en,Xr,cr,cn,Me.image.data):Me.isCompressedTexture?qe.compressedTexSubImage2D(3553,Ce,It.x,It.y,Me.mipmaps[0].width,Me.mipmaps[0].height,cr,Me.mipmaps[0].data):qe.texSubImage2D(3553,Ce,It.x,It.y,cr,cn,Me.image),Ce===0&&se.generateMipmaps&&qe.generateMipmap(3553),sn.unbindTexture()},this.copyTextureToTexture3D=function(It,Me,se,Ce,en=0){if(U.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const Xr=It.max.x-It.min.x+1,cr=It.max.y-It.min.y+1,cn=It.max.z-It.min.z+1,Cr=$s.convert(Ce.format),Vn=$s.convert(Ce.type);let Vr;if(Ce.isDataTexture3D)Zt.setTexture3D(Ce,0),Vr=32879;else{if(!Ce.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Zt.setTexture2DArray(Ce,0),Vr=35866}qe.pixelStorei(37440,Ce.flipY),qe.pixelStorei(37441,Ce.premultiplyAlpha),qe.pixelStorei(3317,Ce.unpackAlignment);const sr=qe.getParameter(3314),kr=qe.getParameter(32878),Lo=qe.getParameter(3316),Ci=qe.getParameter(3315),hu=qe.getParameter(32877),mi=se.isCompressedTexture?se.mipmaps[0]:se.image;qe.pixelStorei(3314,mi.width),qe.pixelStorei(32878,mi.height),qe.pixelStorei(3316,It.min.x),qe.pixelStorei(3315,It.min.y),qe.pixelStorei(32877,It.min.z),se.isDataTexture||se.isDataTexture3D?qe.texSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,Vn,mi.data):se.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),qe.compressedTexSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,mi.data)):qe.texSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,Vn,mi),qe.pixelStorei(3314,sr),qe.pixelStorei(32878,kr),qe.pixelStorei(3316,Lo),qe.pixelStorei(3315,Ci),qe.pixelStorei(32877,hu),en===0&&Ce.generateMipmaps&&qe.generateMipmap(Vr),sn.unbindTexture()},this.initTexture=function(It){Zt.setTexture2D(It,0),sn.unbindTexture()},this.resetState=function(){Z=0,ot=0,vt=null,sn.reset(),Ma.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class qp extends Fr{}qp.prototype.isWebGL1Renderer=!0;class Ql{constructor(t,i=25e-5){this.name="",this.color=new pn(t),this.density=i}clone(){return new Ql(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Ql.prototype.isFogExp2=!0;class tu{constructor(t,i=1,a=1e3){this.name="",this.color=new pn(t),this.near=i,this.far=a}clone(){return new tu(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}tu.prototype.isFog=!0;class Fh extends ar{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,i){return super.copy(t,i),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const i=super.toJSON(t);return this.fog!==null&&(i.object.fog=this.fog.toJSON()),i}}Fh.prototype.isScene=!0;class _l{constructor(t,i){this.array=t,this.stride=i,this.count=t!==void 0?t.length/i:0,this.usage=Da,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=No()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,i,a){t*=this.stride,a*=i.stride;for(let l=0,d=this.stride;l<d;l++)this.array[t+l]=i.array[a+l];return this}set(t,i=0){return this.array.set(t,i),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=No()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const i=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),a=new this.constructor(i,this.stride);return a.setUsage(this.usage),a}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=No()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}_l.prototype.isInterleavedBuffer=!0;const ai=new gt;class ri{constructor(t,i,a,l=!1){this.name="",this.data=t,this.itemSize=i,this.offset=a,this.normalized=l===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let i=0,a=this.data.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.applyMatrix4(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}applyNormalMatrix(t){for(let i=0,a=this.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.applyNormalMatrix(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}transformDirection(t){for(let i=0,a=this.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.transformDirection(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}setX(t,i){return this.data.array[t*this.data.stride+this.offset]=i,this}setY(t,i){return this.data.array[t*this.data.stride+this.offset+1]=i,this}setZ(t,i){return this.data.array[t*this.data.stride+this.offset+2]=i,this}setW(t,i){return this.data.array[t*this.data.stride+this.offset+3]=i,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,i,a){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this}setXYZ(t,i,a,l){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this.data.array[t+2]=l,this}setXYZW(t,i,a,l,d){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this.data.array[t+2]=l,this.data.array[t+3]=d,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const i=[];for(let a=0;a<this.count;a++){const l=a*this.data.stride+this.offset;for(let d=0;d<this.itemSize;d++)i.push(this.data.array[l+d])}return new Kn(new this.array.constructor(i),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new ri(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const i=[];for(let a=0;a<this.count;a++){const l=a*this.data.stride+this.offset;for(let d=0;d<this.itemSize;d++)i.push(this.data.array[l+d])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:i,normalized:this.normalized}}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}ri.prototype.isInterleavedBufferAttribute=!0;class yo extends Ni{constructor(t){super(),this.type="SpriteMaterial",this.color=new pn(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let eu;yo.prototype.isSpriteMaterial=!0;const Ru=new gt,Iu=new gt,jo=new gt,Cs=new He,ms=new He,Bh=new En,Ps=new gt,yl=new gt,Lu=new gt,Rs=new He,Hc=new He,Ou=new He;class Du extends ar{constructor(t){if(super(),this.type="Sprite",eu===void 0){eu=new zn;const i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),a=new _l(i,5);eu.setIndex([0,1,2,0,2,3]),eu.setAttribute("position",new ri(a,3,0,!1)),eu.setAttribute("uv",new ri(a,2,3,!1))}this.geometry=eu,this.material=t!==void 0?t:new yo,this.center=new He(.5,.5)}raycast(t,i){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Iu.setFromMatrixScale(this.matrixWorld),Bh.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),jo.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Iu.multiplyScalar(-jo.z);const a=this.material.rotation;let l,d;a!==0&&(d=Math.cos(a),l=Math.sin(a));const p=this.center;kh(Ps.set(-.5,-.5,0),jo,p,Iu,l,d),kh(yl.set(.5,-.5,0),jo,p,Iu,l,d),kh(Lu.set(.5,.5,0),jo,p,Iu,l,d),Rs.set(0,0),Hc.set(1,0),Ou.set(1,1);let v=t.ray.intersectTriangle(Ps,yl,Lu,!1,Ru);if(v===null&&(kh(yl.set(-.5,.5,0),jo,p,Iu,l,d),Hc.set(0,1),v=t.ray.intersectTriangle(Ps,Lu,yl,!1,Ru),v===null))return;const _=t.ray.origin.distanceTo(Ru);_<t.near||_>t.far||i.push({distance:_,point:Ru.clone(),uv:bi.getUV(Ru,Ps,yl,Lu,Rs,Hc,Ou,new He),face:null,object:this})}copy(t){return super.copy(t),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function kh(m,t,i,a,l,d){Cs.subVectors(m,i).addScalar(.5).multiply(a),l!==void 0?(ms.x=d*Cs.x-l*Cs.y,ms.y=l*Cs.x+d*Cs.y):ms.copy(Cs),m.copy(t),m.x+=ms.x,m.y+=ms.y,m.applyMatrix4(Bh)}Du.prototype.isSprite=!0;const Uh=new gt,Yd=new gt;class Gh extends ar{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const i=t.levels;for(let a=0,l=i.length;a<l;a++){const d=i[a];this.addLevel(d.object.clone(),d.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,i=0){i=Math.abs(i);const a=this.levels;let l;for(l=0;l<a.length&&!(i<a[l].distance);l++);return a.splice(l,0,{distance:i,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const i=this.levels;if(i.length>0){let a,l;for(a=1,l=i.length;a<l&&!(t<i[a].distance);a++);return i[a-1].object}return null}raycast(t,i){if(this.levels.length>0){Uh.setFromMatrixPosition(this.matrixWorld);const a=t.ray.origin.distanceTo(Uh);this.getObjectForDistance(a).raycast(t,i)}}update(t){const i=this.levels;if(i.length>1){Uh.setFromMatrixPosition(t.matrixWorld),Yd.setFromMatrixPosition(this.matrixWorld);const a=Uh.distanceTo(Yd)/t.zoom;let l,d;for(i[0].object.visible=!0,l=1,d=i.length;l<d&&a>=i[l].distance;l++)i[l-1].object.visible=!1,i[l].object.visible=!0;for(this._currentLevel=l-1;l<d;l++)i[l].object.visible=!1}}toJSON(t){const i=super.toJSON(t);this.autoUpdate===!1&&(i.object.autoUpdate=!1),i.object.levels=[];const a=this.levels;for(let l=0,d=a.length;l<d;l++){const p=a[l];i.object.levels.push({object:p.object.uuid,distance:p.distance})}return i}}const Zd=new gt,Jd=new Ir,Nu=new Ir,$d=new gt,zc=new En;class jc extends Bi{constructor(t,i){super(t,i),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new En,this.bindMatrixInverse=new En}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,i){this.skeleton=t,i===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),i=this.matrixWorld),this.bindMatrix.copy(i),this.bindMatrixInverse.copy(i).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Ir,i=this.geometry.attributes.skinWeight;for(let a=0,l=i.count;a<l;a++){t.x=i.getX(a),t.y=i.getY(a),t.z=i.getZ(a),t.w=i.getW(a);const d=1/t.manhattanLength();d!==1/0?t.multiplyScalar(d):t.set(1,0,0,0),i.setXYZW(a,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,i){const a=this.skeleton,l=this.geometry;Jd.fromBufferAttribute(l.attributes.skinIndex,t),Nu.fromBufferAttribute(l.attributes.skinWeight,t),Zd.fromBufferAttribute(l.attributes.position,t).applyMatrix4(this.bindMatrix),i.set(0,0,0);for(let d=0;d<4;d++){const p=Nu.getComponent(d);if(p!==0){const v=Jd.getComponent(d);zc.multiplyMatrices(a.bones[v].matrixWorld,a.boneInverses[v]),i.addScaledVector($d.copy(Zd).applyMatrix4(zc),p)}}return i.applyMatrix4(this.bindMatrixInverse)}}jc.prototype.isSkinnedMesh=!0;class no extends ar{constructor(){super(),this.type="Bone"}}no.prototype.isBone=!0;class Is extends ni{constructor(t=null,i=1,a=1,l,d,p,v,_,x=wt,M=wt,C,A){super(null,p,v,_,x,M,l,d,C,A),this.image={data:t,width:i,height:a},this.magFilter=x,this.minFilter=M,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Is.prototype.isDataTexture=!0;const Vc=new En,Yp=new En;class Fu{constructor(t=[],i=[]){this.uuid=No(),this.bones=t.slice(0),this.boneInverses=i,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,i=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),i.length===0)this.calculateInverses();else if(t.length!==i.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let a=0,l=this.bones.length;a<l;a++)this.boneInverses.push(new En)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,i=this.bones.length;t<i;t++){const a=new En;this.bones[t]&&a.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(a)}}pose(){for(let t=0,i=this.bones.length;t<i;t++){const a=this.bones[t];a&&a.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,i=this.bones.length;t<i;t++){const a=this.bones[t];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}update(){const t=this.bones,i=this.boneInverses,a=this.boneMatrices,l=this.boneTexture;for(let d=0,p=t.length;d<p;d++){const v=t[d]?t[d].matrixWorld:Yp;Vc.multiplyMatrices(v,i[d]),Vc.toArray(a,16*d)}l!==null&&(l.needsUpdate=!0)}clone(){return new Fu(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=to(t),t=Math.max(t,4);const i=new Float32Array(t*t*4);i.set(this.boneMatrices);const a=new Is(i,t,t,Tn,ee);return this.boneMatrices=i,this.boneTexture=a,this.boneTextureSize=t,this}getBoneByName(t){for(let i=0,a=this.bones.length;i<a;i++){const l=this.bones[i];if(l.name===t)return l}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,i){this.uuid=t.uuid;for(let a=0,l=t.bones.length;a<l;a++){const d=t.bones[a];let p=i[d];p===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",d),p=new no),this.bones.push(p),this.boneInverses.push(new En().fromArray(t.boneInverses[a]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const i=this.bones,a=this.boneInverses;for(let l=0,d=i.length;l<d;l++){const p=i[l];t.bones.push(p.uuid);const v=a[l];t.boneInverses.push(v.toArray())}return t}}const Wc=new En,Zp=new En,Xc=[],Hh=new Bi;class qc extends Bi{constructor(t,i,a){super(t,i),this.instanceMatrix=new Kn(new Float32Array(16*a),16),this.instanceColor=null,this.count=a,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,i){i.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,i){i.fromArray(this.instanceMatrix.array,16*t)}raycast(t,i){const a=this.matrixWorld,l=this.count;if(Hh.geometry=this.geometry,Hh.material=this.material,Hh.material!==void 0)for(let d=0;d<l;d++){this.getMatrixAt(d,Wc),Zp.multiplyMatrices(a,Wc),Hh.matrixWorld=Zp,Hh.raycast(t,Xc);for(let p=0,v=Xc.length;p<v;p++){const _=Xc[p];_.instanceId=d,_.object=this,i.push(_)}Xc.length=0}}setColorAt(t,i){this.instanceColor===null&&(this.instanceColor=new Kn(new Float32Array(3*this.count),3)),i.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,i){i.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}qc.prototype.isInstancedMesh=!0;class ro extends Ni{constructor(t){super(),this.type="LineBasicMaterial",this.color=new pn(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this}}ro.prototype.isLineBasicMaterial=!0;const Jp=new gt,Yc=new gt,Zc=new En,Kd=new ka,Jc=new bs;class Ya extends ar{constructor(t=new zn,i=new ro){super(),this.type="Line",this.geometry=t,this.material=i,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(t.index===null){const i=t.attributes.position,a=[0];for(let l=1,d=i.count;l<d;l++)Jp.fromBufferAttribute(i,l-1),Yc.fromBufferAttribute(i,l),a[l]=a[l-1],a[l]+=Jp.distanceTo(Yc);t.setAttribute("lineDistance",new xn(a,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,i){const a=this.geometry,l=this.matrixWorld,d=t.params.Line.threshold,p=a.drawRange;if(a.boundingSphere===null&&a.computeBoundingSphere(),Jc.copy(a.boundingSphere),Jc.applyMatrix4(l),Jc.radius+=d,t.ray.intersectsSphere(Jc)===!1)return;Zc.copy(l).invert(),Kd.copy(t.ray).applyMatrix4(Zc);const v=d/((this.scale.x+this.scale.y+this.scale.z)/3),_=v*v,x=new gt,M=new gt,C=new gt,A=new gt,R=this.isLineSegments?2:1;if(a.isBufferGeometry){const O=a.index,U=a.attributes.position;if(O!==null)for(let D=Math.max(0,p.start),Z=Math.min(O.count,p.start+p.count)-1;D<Z;D+=R){const ot=O.getX(D),vt=O.getX(D+1);if(x.fromBufferAttribute(U,ot),M.fromBufferAttribute(U,vt),Kd.distanceSqToSegment(x,M,A,C)>_)continue;A.applyMatrix4(this.matrixWorld);const mt=t.ray.origin.distanceTo(A);mt<t.near||mt>t.far||i.push({distance:mt,point:C.clone().applyMatrix4(this.matrixWorld),index:D,face:null,faceIndex:null,object:this})}else for(let D=Math.max(0,p.start),Z=Math.min(U.count,p.start+p.count)-1;D<Z;D+=R){if(x.fromBufferAttribute(U,D),M.fromBufferAttribute(U,D+1),Kd.distanceSqToSegment(x,M,A,C)>_)continue;A.applyMatrix4(this.matrixWorld);const ot=t.ray.origin.distanceTo(A);ot<t.near||ot>t.far||i.push({distance:ot,point:C.clone().applyMatrix4(this.matrixWorld),index:D,face:null,faceIndex:null,object:this})}}else a.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const i=t.morphAttributes,a=Object.keys(i);if(a.length>0){const l=i[a[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let d=0,p=l.length;d<p;d++){const v=l[d].name||String(d);this.morphTargetInfluences.push(0),this.morphTargetDictionary[v]=d}}}}else{const i=t.morphTargets;i!==void 0&&i.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Ya.prototype.isLine=!0;const $p=new gt,$c=new gt;class io extends Ya{constructor(t,i){super(t,i),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(t.index===null){const i=t.attributes.position,a=[];for(let l=0,d=i.count;l<d;l+=2)$p.fromBufferAttribute(i,l),$c.fromBufferAttribute(i,l+1),a[l]=l===0?0:a[l-1],a[l+1]=a[l]+$p.distanceTo($c);t.setAttribute("lineDistance",new xn(a,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}io.prototype.isLineSegments=!0;class nu extends Ya{constructor(t,i){super(t,i),this.type="LineLoop"}}nu.prototype.isLineLoop=!0;class xl extends Ni{constructor(t){super(),this.type="PointsMaterial",this.color=new pn(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this}}xl.prototype.isPointsMaterial=!0;const c=new En,g=new ka,E=new bs,F=new gt;class q extends ar{constructor(t=new zn,i=new xl){super(),this.type="Points",this.geometry=t,this.material=i,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,i){const a=this.geometry,l=this.matrixWorld,d=t.params.Points.threshold,p=a.drawRange;if(a.boundingSphere===null&&a.computeBoundingSphere(),E.copy(a.boundingSphere),E.applyMatrix4(l),E.radius+=d,t.ray.intersectsSphere(E)===!1)return;c.copy(l).invert(),g.copy(t.ray).applyMatrix4(c);const v=d/((this.scale.x+this.scale.y+this.scale.z)/3),_=v*v;if(a.isBufferGeometry){const x=a.index,M=a.attributes.position;if(x!==null)for(let C=Math.max(0,p.start),A=Math.min(x.count,p.start+p.count);C<A;C++){const R=x.getX(C);F.fromBufferAttribute(M,R),dt(F,R,_,l,t,i,this)}else for(let C=Math.max(0,p.start),A=Math.min(M.count,p.start+p.count);C<A;C++)F.fromBufferAttribute(M,C),dt(F,C,_,l,t,i,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const i=t.morphAttributes,a=Object.keys(i);if(a.length>0){const l=i[a[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let d=0,p=l.length;d<p;d++){const v=l[d].name||String(d);this.morphTargetInfluences.push(0),this.morphTargetDictionary[v]=d}}}}else{const i=t.morphTargets;i!==void 0&&i.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function dt(m,t,i,a,l,d,p){const v=g.distanceSqToPoint(m);if(v<i){const _=new gt;g.closestPointToPoint(m,_),_.applyMatrix4(a);const x=l.ray.origin.distanceTo(_);if(x<l.near||x>l.far)return;d.push({distance:x,distanceToRay:Math.sqrt(v),point:_,index:t,face:null,object:p})}}q.prototype.isPoints=!0;class Mt extends ni{constructor(t,i,a,l,d,p,v,_,x){super(t,i,a,l,d,p,v,_,x),this.format=v!==void 0?v:yn,this.minFilter=p!==void 0?p:Qe,this.magFilter=d!==void 0?d:Qe,this.generateMipmaps=!1;const M=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function C(){M.needsUpdate=!0,t.requestVideoFrameCallback(C)})}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!("requestVideoFrameCallback"in t)&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Mt.prototype.isVideoTexture=!0;class Lt extends ni{constructor(t,i,a,l,d,p,v,_,x,M,C,A){super(null,p,v,_,x,M,l,d,C,A),this.image={width:i,height:a},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}Lt.prototype.isCompressedTexture=!0;class qt extends ni{constructor(t,i,a,l,d,p,v,_,x){super(t,i,a,l,d,p,v,_,x),this.needsUpdate=!0}}qt.prototype.isCanvasTexture=!0;class Ee extends ni{constructor(t,i,a,l,d,p,v,_,x,M){if((M=M!==void 0?M:dn)!==dn&&M!==rr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");a===void 0&&M===dn&&(a=Aa),a===void 0&&M===rr&&(a=un),super(null,l,d,p,v,_,M,a,x),this.image={width:t,height:i},this.magFilter=v!==void 0?v:wt,this.minFilter=_!==void 0?_:wt,this.flipY=!1,this.generateMipmaps=!1}}Ee.prototype.isDepthTexture=!0;class me extends zn{constructor(t=1,i=8,a=0,l=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:i,thetaStart:a,thetaLength:l},i=Math.max(3,i);const d=[],p=[],v=[],_=[],x=new gt,M=new He;p.push(0,0,0),v.push(0,0,1),_.push(.5,.5);for(let C=0,A=3;C<=i;C++,A+=3){const R=a+C/i*l;x.x=t*Math.cos(R),x.y=t*Math.sin(R),p.push(x.x,x.y,x.z),v.push(0,0,1),M.x=(p[A]/t+1)/2,M.y=(p[A+1]/t+1)/2,_.push(M.x,M.y)}for(let C=1;C<=i;C++)d.push(C,C+1,0);this.setIndex(d),this.setAttribute("position",new xn(p,3)),this.setAttribute("normal",new xn(v,3)),this.setAttribute("uv",new xn(_,2))}static fromJSON(t){return new me(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class De extends zn{constructor(t=1,i=1,a=1,l=8,d=1,p=!1,v=0,_=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:i,height:a,radialSegments:l,heightSegments:d,openEnded:p,thetaStart:v,thetaLength:_};const x=this;l=Math.floor(l),d=Math.floor(d);const M=[],C=[],A=[],R=[];let O=0;const U=[],D=a/2;let Z=0;function ot(vt){const mt=O,At=new He,Pt=new gt;let Et=0;const Ot=vt===!0?t:i,Ie=vt===!0?1:-1;for(let xe=1;xe<=l;xe++)C.push(0,D*Ie,0),A.push(0,Ie,0),R.push(.5,.5),O++;const ye=O;for(let xe=0;xe<=l;xe++){const ge=xe/l*_+v,Ht=Math.cos(ge),ce=Math.sin(ge);Pt.x=Ot*ce,Pt.y=D*Ie,Pt.z=Ot*Ht,C.push(Pt.x,Pt.y,Pt.z),A.push(0,Ie,0),At.x=.5*Ht+.5,At.y=.5*ce*Ie+.5,R.push(At.x,At.y),O++}for(let xe=0;xe<l;xe++){const ge=mt+xe,Ht=ye+xe;vt===!0?M.push(Ht,Ht+1,ge):M.push(Ht+1,Ht,ge),Et+=3}x.addGroup(Z,Et,vt===!0?1:2),Z+=Et}(function(){const vt=new gt,mt=new gt;let At=0;const Pt=(i-t)/a;for(let Et=0;Et<=d;Et++){const Ot=[],Ie=Et/d,ye=Ie*(i-t)+t;for(let xe=0;xe<=l;xe++){const ge=xe/l,Ht=ge*_+v,ce=Math.sin(Ht),We=Math.cos(Ht);mt.x=ye*ce,mt.y=-Ie*a+D,mt.z=ye*We,C.push(mt.x,mt.y,mt.z),vt.set(ce,Pt,We).normalize(),A.push(vt.x,vt.y,vt.z),R.push(ge,1-Ie),Ot.push(O++)}U.push(Ot)}for(let Et=0;Et<l;Et++)for(let Ot=0;Ot<d;Ot++){const Ie=U[Ot][Et],ye=U[Ot+1][Et],xe=U[Ot+1][Et+1],ge=U[Ot][Et+1];M.push(Ie,ye,ge),M.push(ye,xe,ge),At+=6}x.addGroup(Z,At,0),Z+=At})(),p===!1&&(t>0&&ot(!0),i>0&&ot(!1)),this.setIndex(M),this.setAttribute("position",new xn(C,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(R,2))}static fromJSON(t){return new De(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class gn extends De{constructor(t=1,i=1,a=8,l=1,d=!1,p=0,v=2*Math.PI){super(0,t,i,a,l,d,p,v),this.type="ConeGeometry",this.parameters={radius:t,height:i,radialSegments:a,heightSegments:l,openEnded:d,thetaStart:p,thetaLength:v}}static fromJSON(t){return new gn(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ln extends zn{constructor(t,i,a=1,l=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:i,radius:a,detail:l};const d=[],p=[];function v(A,R,O,U){const D=U+1,Z=[];for(let ot=0;ot<=D;ot++){Z[ot]=[];const vt=A.clone().lerp(O,ot/D),mt=R.clone().lerp(O,ot/D),At=D-ot;for(let Pt=0;Pt<=At;Pt++)Z[ot][Pt]=Pt===0&&ot===D?vt:vt.clone().lerp(mt,Pt/At)}for(let ot=0;ot<D;ot++)for(let vt=0;vt<2*(D-ot)-1;vt++){const mt=Math.floor(vt/2);vt%2==0?(_(Z[ot][mt+1]),_(Z[ot+1][mt]),_(Z[ot][mt])):(_(Z[ot][mt+1]),_(Z[ot+1][mt+1]),_(Z[ot+1][mt]))}}function _(A){d.push(A.x,A.y,A.z)}function x(A,R){const O=3*A;R.x=t[O+0],R.y=t[O+1],R.z=t[O+2]}function M(A,R,O,U){U<0&&A.x===1&&(p[R]=A.x-1),O.x===0&&O.z===0&&(p[R]=U/2/Math.PI+.5)}function C(A){return Math.atan2(A.z,-A.x)}(function(A){const R=new gt,O=new gt,U=new gt;for(let D=0;D<i.length;D+=3)x(i[D+0],R),x(i[D+1],O),x(i[D+2],U),v(R,O,U,A)})(l),function(A){const R=new gt;for(let O=0;O<d.length;O+=3)R.x=d[O+0],R.y=d[O+1],R.z=d[O+2],R.normalize().multiplyScalar(A),d[O+0]=R.x,d[O+1]=R.y,d[O+2]=R.z}(a),function(){const A=new gt;for(let O=0;O<d.length;O+=3){A.x=d[O+0],A.y=d[O+1],A.z=d[O+2];const U=C(A)/2/Math.PI+.5,D=(R=A,Math.atan2(-R.y,Math.sqrt(R.x*R.x+R.z*R.z))/Math.PI+.5);p.push(U,1-D)}var R;(function(){const O=new gt,U=new gt,D=new gt,Z=new gt,ot=new He,vt=new He,mt=new He;for(let At=0,Pt=0;At<d.length;At+=9,Pt+=6){O.set(d[At+0],d[At+1],d[At+2]),U.set(d[At+3],d[At+4],d[At+5]),D.set(d[At+6],d[At+7],d[At+8]),ot.set(p[Pt+0],p[Pt+1]),vt.set(p[Pt+2],p[Pt+3]),mt.set(p[Pt+4],p[Pt+5]),Z.copy(O).add(U).add(D).divideScalar(3);const Et=C(Z);M(ot,Pt+0,O,Et),M(vt,Pt+2,U,Et),M(mt,Pt+4,D,Et)}})(),function(){for(let O=0;O<p.length;O+=6){const U=p[O+0],D=p[O+2],Z=p[O+4],ot=Math.max(U,D,Z),vt=Math.min(U,D,Z);ot>.9&&vt<.1&&(U<.2&&(p[O+0]+=1),D<.2&&(p[O+2]+=1),Z<.2&&(p[O+4]+=1))}}()}(),this.setAttribute("position",new xn(d,3)),this.setAttribute("normal",new xn(d.slice(),3)),this.setAttribute("uv",new xn(p,2)),l===0?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new ln(t.vertices,t.indices,t.radius,t.details)}}class An extends ln{constructor(t=1,i=0){const a=(1+Math.sqrt(5))/2,l=1/a;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-l,-a,0,-l,a,0,l,-a,0,l,a,-l,-a,0,-l,a,0,l,-a,0,l,a,0,-a,0,-l,a,0,-l,-a,0,l,a,0,l],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,i),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new An(t.radius,t.detail)}}const ve=new gt,Xe=new gt,Un=new gt,mn=new bi;class Yn extends zn{constructor(t,i){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:i},i=i!==void 0?i:1,t.isGeometry===!0)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const a=Math.pow(10,4),l=Math.cos(ea*i),d=t.getIndex(),p=t.getAttribute("position"),v=d?d.count:p.count,_=[0,0,0],x=["a","b","c"],M=new Array(3),C={},A=[];for(let R=0;R<v;R+=3){d?(_[0]=d.getX(R),_[1]=d.getX(R+1),_[2]=d.getX(R+2)):(_[0]=R,_[1]=R+1,_[2]=R+2);const{a:O,b:U,c:D}=mn;if(O.fromBufferAttribute(p,_[0]),U.fromBufferAttribute(p,_[1]),D.fromBufferAttribute(p,_[2]),mn.getNormal(Un),M[0]=`${Math.round(O.x*a)},${Math.round(O.y*a)},${Math.round(O.z*a)}`,M[1]=`${Math.round(U.x*a)},${Math.round(U.y*a)},${Math.round(U.z*a)}`,M[2]=`${Math.round(D.x*a)},${Math.round(D.y*a)},${Math.round(D.z*a)}`,M[0]!==M[1]&&M[1]!==M[2]&&M[2]!==M[0])for(let Z=0;Z<3;Z++){const ot=(Z+1)%3,vt=M[Z],mt=M[ot],At=mn[x[Z]],Pt=mn[x[ot]],Et=`${vt}_${mt}`,Ot=`${mt}_${vt}`;Ot in C&&C[Ot]?(Un.dot(C[Ot].normal)<=l&&(A.push(At.x,At.y,At.z),A.push(Pt.x,Pt.y,Pt.z)),C[Ot]=null):Et in C||(C[Et]={index0:_[Z],index1:_[ot],normal:Un.clone()})}}for(const R in C)if(C[R]){const{index0:O,index1:U}=C[R];ve.fromBufferAttribute(p,O),Xe.fromBufferAttribute(p,U),A.push(ve.x,ve.y,ve.z),A.push(Xe.x,Xe.y,Xe.z)}this.setAttribute("position",new xn(A,3))}}class wn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,i){const a=this.getUtoTmapping(t);return this.getPoint(a,i)}getPoints(t=5){const i=[];for(let a=0;a<=t;a++)i.push(this.getPoint(a/t));return i}getSpacedPoints(t=5){const i=[];for(let a=0;a<=t;a++)i.push(this.getPointAt(a/t));return i}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const i=[];let a,l=this.getPoint(0),d=0;i.push(0);for(let p=1;p<=t;p++)a=this.getPoint(p/t),d+=a.distanceTo(l),i.push(d),l=a;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,i){const a=this.getLengths();let l=0;const d=a.length;let p;p=i||t*a[d-1];let v,_=0,x=d-1;for(;_<=x;)if(l=Math.floor(_+(x-_)/2),v=a[l]-p,v<0)_=l+1;else{if(!(v>0)){x=l;break}x=l-1}if(l=x,a[l]===p)return l/(d-1);const M=a[l];return(l+(p-M)/(a[l+1]-M))/(d-1)}getTangent(t,i){let a=t-1e-4,l=t+1e-4;a<0&&(a=0),l>1&&(l=1);const d=this.getPoint(a),p=this.getPoint(l),v=i||(d.isVector2?new He:new gt);return v.copy(p).sub(d).normalize(),v}getTangentAt(t,i){const a=this.getUtoTmapping(t);return this.getTangent(a,i)}computeFrenetFrames(t,i){const a=new gt,l=[],d=[],p=[],v=new gt,_=new En;for(let R=0;R<=t;R++){const O=R/t;l[R]=this.getTangentAt(O,new gt),l[R].normalize()}d[0]=new gt,p[0]=new gt;let x=Number.MAX_VALUE;const M=Math.abs(l[0].x),C=Math.abs(l[0].y),A=Math.abs(l[0].z);M<=x&&(x=M,a.set(1,0,0)),C<=x&&(x=C,a.set(0,1,0)),A<=x&&a.set(0,0,1),v.crossVectors(l[0],a).normalize(),d[0].crossVectors(l[0],v),p[0].crossVectors(l[0],d[0]);for(let R=1;R<=t;R++){if(d[R]=d[R-1].clone(),p[R]=p[R-1].clone(),v.crossVectors(l[R-1],l[R]),v.length()>Number.EPSILON){v.normalize();const O=Math.acos(zi(l[R-1].dot(l[R]),-1,1));d[R].applyMatrix4(_.makeRotationAxis(v,O))}p[R].crossVectors(l[R],d[R])}if(i===!0){let R=Math.acos(zi(d[0].dot(d[t]),-1,1));R/=t,l[0].dot(v.crossVectors(d[0],d[t]))>0&&(R=-R);for(let O=1;O<=t;O++)d[O].applyMatrix4(_.makeRotationAxis(l[O],R*O)),p[O].crossVectors(l[O],d[O])}return{tangents:l,normals:d,binormals:p}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class lr extends wn{constructor(t=0,i=0,a=1,l=1,d=0,p=2*Math.PI,v=!1,_=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=i,this.xRadius=a,this.yRadius=l,this.aStartAngle=d,this.aEndAngle=p,this.aClockwise=v,this.aRotation=_}getPoint(t,i){const a=i||new He,l=2*Math.PI;let d=this.aEndAngle-this.aStartAngle;const p=Math.abs(d)<Number.EPSILON;for(;d<0;)d+=l;for(;d>l;)d-=l;d<Number.EPSILON&&(d=p?0:l),this.aClockwise!==!0||p||(d===l?d=-l:d-=l);const v=this.aStartAngle+t*d;let _=this.aX+this.xRadius*Math.cos(v),x=this.aY+this.yRadius*Math.sin(v);if(this.aRotation!==0){const M=Math.cos(this.aRotation),C=Math.sin(this.aRotation),A=_-this.aX,R=x-this.aY;_=A*M-R*C+this.aX,x=A*C+R*M+this.aY}return a.set(_,x)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}lr.prototype.isEllipseCurve=!0;class In extends lr{constructor(t,i,a,l,d,p){super(t,i,a,a,l,d,p),this.type="ArcCurve"}}function jn(){let m=0,t=0,i=0,a=0;function l(d,p,v,_){m=d,t=v,i=-3*d+3*p-2*v-_,a=2*d-2*p+v+_}return{initCatmullRom:function(d,p,v,_,x){l(p,v,x*(v-d),x*(_-p))},initNonuniformCatmullRom:function(d,p,v,_,x,M,C){let A=(p-d)/x-(v-d)/(x+M)+(v-p)/M,R=(v-p)/M-(_-p)/(M+C)+(_-v)/C;A*=M,R*=M,l(p,v,A,R)},calc:function(d){const p=d*d;return m+t*d+i*p+a*(p*d)}}}In.prototype.isArcCurve=!0;const Ei=new gt,xo=new jn,Ls=new jn,ki=new jn;class Zs extends wn{constructor(t=[],i=!1,a="centripetal",l=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=i,this.curveType=a,this.tension=l}getPoint(t,i=new gt){const a=i,l=this.points,d=l.length,p=(d-(this.closed?0:1))*t;let v,_,x=Math.floor(p),M=p-x;this.closed?x+=x>0?0:(Math.floor(Math.abs(x)/d)+1)*d:M===0&&x===d-1&&(x=d-2,M=1),this.closed||x>0?v=l[(x-1)%d]:(Ei.subVectors(l[0],l[1]).add(l[0]),v=Ei);const C=l[x%d],A=l[(x+1)%d];if(this.closed||x+2<d?_=l[(x+2)%d]:(Ei.subVectors(l[d-1],l[d-2]).add(l[d-1]),_=Ei),this.curveType==="centripetal"||this.curveType==="chordal"){const R=this.curveType==="chordal"?.5:.25;let O=Math.pow(v.distanceToSquared(C),R),U=Math.pow(C.distanceToSquared(A),R),D=Math.pow(A.distanceToSquared(_),R);U<1e-4&&(U=1),O<1e-4&&(O=U),D<1e-4&&(D=U),xo.initNonuniformCatmullRom(v.x,C.x,A.x,_.x,O,U,D),Ls.initNonuniformCatmullRom(v.y,C.y,A.y,_.y,O,U,D),ki.initNonuniformCatmullRom(v.z,C.z,A.z,_.z,O,U,D)}else this.curveType==="catmullrom"&&(xo.initCatmullRom(v.x,C.x,A.x,_.x,this.tension),Ls.initCatmullRom(v.y,C.y,A.y,_.y,this.tension),ki.initCatmullRom(v.z,C.z,A.z,_.z,this.tension));return a.set(xo.calc(M),Ls.calc(M),ki.calc(M)),a}copy(t){super.copy(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(l.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let i=0,a=this.points.length;i<a;i++){const l=this.points[i];t.points.push(l.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(new gt().fromArray(l))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Za(m,t,i,a,l){const d=.5*(a-t),p=.5*(l-i),v=m*m;return(2*i-2*a+d+p)*(m*v)+(-3*i+3*a-2*d-p)*v+d*m+i}function Ja(m,t,i,a){return function(l,d){const p=1-l;return p*p*d}(m,t)+function(l,d){return 2*(1-l)*l*d}(m,i)+function(l,d){return l*l*d}(m,a)}function bl(m,t,i,a,l){return function(d,p){const v=1-d;return v*v*v*p}(m,t)+function(d,p){const v=1-d;return 3*v*v*d*p}(m,i)+function(d,p){return 3*(1-d)*d*d*p}(m,a)+function(d,p){return d*d*d*p}(m,l)}Zs.prototype.isCatmullRomCurve3=!0;class va extends wn{constructor(t=new He,i=new He,a=new He,l=new He){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=i,this.v2=a,this.v3=l}getPoint(t,i=new He){const a=i,l=this.v0,d=this.v1,p=this.v2,v=this.v3;return a.set(bl(t,l.x,d.x,p.x,v.x),bl(t,l.y,d.y,p.y,v.y)),a}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}va.prototype.isCubicBezierCurve=!0;class _a extends wn{constructor(t=new gt,i=new gt,a=new gt,l=new gt){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=i,this.v2=a,this.v3=l}getPoint(t,i=new gt){const a=i,l=this.v0,d=this.v1,p=this.v2,v=this.v3;return a.set(bl(t,l.x,d.x,p.x,v.x),bl(t,l.y,d.y,p.y,v.y),bl(t,l.z,d.z,p.z,v.z)),a}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}_a.prototype.isCubicBezierCurve3=!0;class Bu extends wn{constructor(t=new He,i=new He){super(),this.type="LineCurve",this.v1=t,this.v2=i}getPoint(t,i=new He){const a=i;return t===1?a.copy(this.v2):(a.copy(this.v2).sub(this.v1),a.multiplyScalar(t).add(this.v1)),a}getPointAt(t,i){return this.getPoint(t,i)}getTangent(t,i){const a=i||new He;return a.copy(this.v2).sub(this.v1).normalize(),a}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Bu.prototype.isLineCurve=!0;class Qd extends wn{constructor(t=new gt,i=new gt){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=i}getPoint(t,i=new gt){const a=i;return t===1?a.copy(this.v2):(a.copy(this.v2).sub(this.v1),a.multiplyScalar(t).add(this.v1)),a}getPointAt(t,i){return this.getPoint(t,i)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ru extends wn{constructor(t=new He,i=new He,a=new He){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=i,this.v2=a}getPoint(t,i=new He){const a=i,l=this.v0,d=this.v1,p=this.v2;return a.set(Ja(t,l.x,d.x,p.x),Ja(t,l.y,d.y,p.y)),a}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}ru.prototype.isQuadraticBezierCurve=!0;class zh extends wn{constructor(t=new gt,i=new gt,a=new gt){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=i,this.v2=a}getPoint(t,i=new gt){const a=i,l=this.v0,d=this.v1,p=this.v2;return a.set(Ja(t,l.x,d.x,p.x),Ja(t,l.y,d.y,p.y),Ja(t,l.z,d.z,p.z)),a}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}zh.prototype.isQuadraticBezierCurve3=!0;class iu extends wn{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,i=new He){const a=i,l=this.points,d=(l.length-1)*t,p=Math.floor(d),v=d-p,_=l[p===0?p:p-1],x=l[p],M=l[p>l.length-2?l.length-1:p+1],C=l[p>l.length-3?l.length-1:p+2];return a.set(Za(v,_.x,x.x,M.x,C.x),Za(v,_.y,x.y,M.y,C.y)),a}copy(t){super.copy(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(l.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let i=0,a=this.points.length;i<a;i++){const l=this.points[i];t.points.push(l.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(new He().fromArray(l))}return this}}iu.prototype.isSplineCurve=!0;var $a=Object.freeze({__proto__:null,ArcCurve:In,CatmullRomCurve3:Zs,CubicBezierCurve:va,CubicBezierCurve3:_a,EllipseCurve:lr,LineCurve:Bu,LineCurve3:Qd,QuadraticBezierCurve:ru,QuadraticBezierCurve3:zh,SplineCurve:iu});const Kp=function(m,t,i=2){const a=t&&t.length,l=a?t[0]*i:m.length;let d=jh(m,0,l,i,!0);const p=[];if(!d||d.next===d.prev)return p;let v,_,x,M,C,A,R;if(a&&(d=function(O,U,D,Z){const ot=[];let vt,mt,At,Pt,Et;for(vt=0,mt=U.length;vt<mt;vt++)At=U[vt]*Z,Pt=vt<mt-1?U[vt+1]*Z:O.length,Et=jh(O,At,Pt,Z,!1),Et===Et.next&&(Et.steiner=!0),ot.push(Qc(Et));for(ot.sort(ts),vt=0;vt<ot.length;vt++)Rf(ot[vt],D),D=Po(D,D.next);return D}(m,t,d,i)),m.length>80*i){v=x=m[0],_=M=m[1];for(let O=i;O<l;O+=i)C=m[O],A=m[O+1],C<v&&(v=C),A<_&&(_=A),C>x&&(x=C),A>M&&(M=A);R=Math.max(x-v,M-_),R=R!==0?1/R:0}return Kc(d,p,i,v,_,R),p};function jh(m,t,i,a,l){let d,p;if(l===function(v,_,x,M){let C=0;for(let A=_,R=x-M;A<x;A+=M)C+=(v[R]-v[A])*(v[A+1]+v[R+1]),R=A;return C}(m,t,i,a)>0)for(d=t;d<i;d+=a)p=bm(d,m[d],m[d+1],p);else for(d=i-a;d>=t;d-=a)p=bm(d,m[d],m[d+1],p);return p&&Ro(p,p.next)&&(np(p),p=p.next),p}function Po(m,t){if(!m)return m;t||(t=m);let i,a=m;do if(i=!1,a.steiner||!Ro(a,a.next)&&Mi(a.prev,a,a.next)!==0)a=a.next;else{if(np(a),a=t=a.prev,a===a.next)break;i=!0}while(i||a!==t);return t}function Kc(m,t,i,a,l,d,p){if(!m)return;!p&&d&&function(M,C,A,R){let O=M;do O.z===null&&(O.z=Vh(O.x,O.y,C,A,R)),O.prevZ=O.prev,O.nextZ=O.next,O=O.next;while(O!==M);O.prevZ.nextZ=null,O.prevZ=null,function(U){let D,Z,ot,vt,mt,At,Pt,Et,Ot=1;do{for(Z=U,U=null,mt=null,At=0;Z;){for(At++,ot=Z,Pt=0,D=0;D<Ot&&(Pt++,ot=ot.nextZ,ot);D++);for(Et=Ot;Pt>0||Et>0&&ot;)Pt!==0&&(Et===0||!ot||Z.z<=ot.z)?(vt=Z,Z=Z.nextZ,Pt--):(vt=ot,ot=ot.nextZ,Et--),mt?mt.nextZ=vt:U=vt,vt.prevZ=mt,mt=vt;Z=ot}mt.nextZ=null,Ot*=2}while(At>1)}(O)}(m,a,l,d);let v,_,x=m;for(;m.prev!==m.next;)if(v=m.prev,_=m.next,d?rg(m,a,l,d):ng(m))t.push(v.i/i),t.push(m.i/i),t.push(_.i/i),np(m),m=_.next,x=_.next;else if((m=_)===x){p?p===1?Kc(m=ym(Po(m),t,i),t,i,a,l,d,2):p===2&&ig(m,t,i,a,l,d):Kc(Po(m),t,i,a,l,d,1);break}}function ng(m){const t=m.prev,i=m,a=m.next;if(Mi(t,i,a)>=0)return!1;let l=m.next.next;for(;l!==m.prev;){if(Wh(t.x,t.y,i.x,i.y,a.x,a.y,l.x,l.y)&&Mi(l.prev,l,l.next)>=0)return!1;l=l.next}return!0}function rg(m,t,i,a){const l=m.prev,d=m,p=m.next;if(Mi(l,d,p)>=0)return!1;const v=l.x<d.x?l.x<p.x?l.x:p.x:d.x<p.x?d.x:p.x,_=l.y<d.y?l.y<p.y?l.y:p.y:d.y<p.y?d.y:p.y,x=l.x>d.x?l.x>p.x?l.x:p.x:d.x>p.x?d.x:p.x,M=l.y>d.y?l.y>p.y?l.y:p.y:d.y>p.y?d.y:p.y,C=Vh(v,_,t,i,a),A=Vh(x,M,t,i,a);let R=m.prevZ,O=m.nextZ;for(;R&&R.z>=C&&O&&O.z<=A;){if(R!==m.prev&&R!==m.next&&Wh(l.x,l.y,d.x,d.y,p.x,p.y,R.x,R.y)&&Mi(R.prev,R,R.next)>=0||(R=R.prevZ,O!==m.prev&&O!==m.next&&Wh(l.x,l.y,d.x,d.y,p.x,p.y,O.x,O.y)&&Mi(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;R&&R.z>=C;){if(R!==m.prev&&R!==m.next&&Wh(l.x,l.y,d.x,d.y,p.x,p.y,R.x,R.y)&&Mi(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;O&&O.z<=A;){if(O!==m.prev&&O!==m.next&&Wh(l.x,l.y,d.x,d.y,p.x,p.y,O.x,O.y)&&Mi(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function ym(m,t,i){let a=m;do{const l=a.prev,d=a.next.next;!Ro(l,d)&&tp(l,a,a.next,d)&&qh(l,d)&&qh(d,l)&&(t.push(l.i/i),t.push(a.i/i),t.push(d.i/i),np(a),np(a.next),a=m=d),a=a.next}while(a!==m);return Po(a)}function ig(m,t,i,a,l,d){let p=m;do{let v=p.next.next;for(;v!==p.prev;){if(p.i!==v.i&&xm(p,v)){let _=Qp(p,v);return p=Po(p,p.next),_=Po(_,_.next),Kc(p,t,i,a,l,d),void Kc(_,t,i,a,l,d)}v=v.next}p=p.next}while(p!==m)}function ts(m,t){return m.x-t.x}function Rf(m,t){if(t=function(i,a){let l=a;const d=i.x,p=i.y;let v,_=-1/0;do{if(p<=l.y&&p>=l.next.y&&l.next.y!==l.y){const O=l.x+(p-l.y)*(l.next.x-l.x)/(l.next.y-l.y);if(O<=d&&O>_){if(_=O,O===d){if(p===l.y)return l;if(p===l.next.y)return l.next}v=l.x<l.next.x?l:l.next}}l=l.next}while(l!==a);if(!v)return null;if(d===_)return v;const x=v,M=v.x,C=v.y;let A,R=1/0;l=v;do d>=l.x&&l.x>=M&&d!==l.x&&Wh(p<C?d:_,p,M,C,p<C?_:d,p,l.x,l.y)&&(A=Math.abs(p-l.y)/(d-l.x),qh(l,i)&&(A<R||A===R&&(l.x>v.x||l.x===v.x&&og(v,l)))&&(v=l,R=A)),l=l.next;while(l!==x);return v}(m,t)){const i=Qp(t,m);Po(t,t.next),Po(i,i.next)}}function og(m,t){return Mi(m.prev,m,t.prev)<0&&Mi(t.next,m,m.next)<0}function Vh(m,t,i,a,l){return(m=1431655765&((m=858993459&((m=252645135&((m=16711935&((m=32767*(m-i)*l)|m<<8))|m<<4))|m<<2))|m<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-a)*l)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Qc(m){let t=m,i=m;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==m);return i}function Wh(m,t,i,a,l,d,p,v){return(l-p)*(t-v)-(m-p)*(d-v)>=0&&(m-p)*(a-v)-(i-p)*(t-v)>=0&&(i-p)*(d-v)-(l-p)*(a-v)>=0}function xm(m,t){return m.next.i!==t.i&&m.prev.i!==t.i&&!function(i,a){let l=i;do{if(l.i!==i.i&&l.next.i!==i.i&&l.i!==a.i&&l.next.i!==a.i&&tp(l,l.next,i,a))return!0;l=l.next}while(l!==i);return!1}(m,t)&&(qh(m,t)&&qh(t,m)&&function(i,a){let l=i,d=!1;const p=(i.x+a.x)/2,v=(i.y+a.y)/2;do l.y>v!=l.next.y>v&&l.next.y!==l.y&&p<(l.next.x-l.x)*(v-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==i);return d}(m,t)&&(Mi(m.prev,m,t.prev)||Mi(m,t.prev,t))||Ro(m,t)&&Mi(m.prev,m,m.next)>0&&Mi(t.prev,t,t.next)>0)}function Mi(m,t,i){return(t.y-m.y)*(i.x-t.x)-(t.x-m.x)*(i.y-t.y)}function Ro(m,t){return m.x===t.x&&m.y===t.y}function tp(m,t,i,a){const l=Xh(Mi(m,t,i)),d=Xh(Mi(m,t,a)),p=Xh(Mi(i,a,m)),v=Xh(Mi(i,a,t));return l!==d&&p!==v||!(l!==0||!ep(m,i,t))||!(d!==0||!ep(m,a,t))||!(p!==0||!ep(i,m,a))||!(v!==0||!ep(i,t,a))}function ep(m,t,i){return t.x<=Math.max(m.x,i.x)&&t.x>=Math.min(m.x,i.x)&&t.y<=Math.max(m.y,i.y)&&t.y>=Math.min(m.y,i.y)}function Xh(m){return m>0?1:m<0?-1:0}function qh(m,t){return Mi(m.prev,m,m.next)<0?Mi(m,t,m.next)>=0&&Mi(m,m.prev,t)>=0:Mi(m,t,m.prev)<0||Mi(m,m.next,t)<0}function Qp(m,t){const i=new ku(m.i,m.x,m.y),a=new ku(t.i,t.x,t.y),l=m.next,d=t.prev;return m.next=t,t.prev=m,i.next=l,l.prev=i,a.next=i,i.prev=a,d.next=a,a.prev=d,a}function bm(m,t,i,a){const l=new ku(m,t,i);return a?(l.next=a.next,l.prev=a,a.next.prev=l,a.next=l):(l.prev=l,l.next=l),l}function np(m){m.next.prev=m.prev,m.prev.next=m.next,m.prevZ&&(m.prevZ.nextZ=m.nextZ),m.nextZ&&(m.nextZ.prevZ=m.prevZ)}function ku(m,t,i){this.i=m,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Os{static area(t){const i=t.length;let a=0;for(let l=i-1,d=0;d<i;l=d++)a+=t[l].x*t[d].y-t[d].x*t[l].y;return .5*a}static isClockWise(t){return Os.area(t)<0}static triangulateShape(t,i){const a=[],l=[],d=[];wm(t),Sm(a,t);let p=t.length;i.forEach(wm);for(let _=0;_<i.length;_++)l.push(p),p+=i[_].length,Sm(a,i[_]);const v=Kp(a,l);for(let _=0;_<v.length;_+=3)d.push(v.slice(_,_+3));return d}}function wm(m){const t=m.length;t>2&&m[t-1].equals(m[0])&&m.pop()}function Sm(m,t){for(let i=0;i<t.length;i++)m.push(t[i].x),m.push(t[i].y)}class Ka extends zn{constructor(t,i){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:i},t=Array.isArray(t)?t:[t];const a=this,l=[],d=[];for(let v=0,_=t.length;v<_;v++)p(t[v]);function p(v){const _=[],x=i.curveSegments!==void 0?i.curveSegments:12,M=i.steps!==void 0?i.steps:1;let C=i.depth!==void 0?i.depth:100,A=i.bevelEnabled===void 0||i.bevelEnabled,R=i.bevelThickness!==void 0?i.bevelThickness:6,O=i.bevelSize!==void 0?i.bevelSize:R-2,U=i.bevelOffset!==void 0?i.bevelOffset:0,D=i.bevelSegments!==void 0?i.bevelSegments:3;const Z=i.extrudePath,ot=i.UVGenerator!==void 0?i.UVGenerator:Tm;i.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),C=i.amount);let vt,mt,At,Pt,Et,Ot=!1;Z&&(vt=Z.getSpacedPoints(M),Ot=!0,A=!1,mt=Z.computeFrenetFrames(M,!1),At=new gt,Pt=new gt,Et=new gt),A||(D=0,R=0,O=0,U=0);const Ie=v.extractPoints(x);let ye=Ie.shape;const xe=Ie.holes;if(!Os.isClockWise(ye)){ye=ye.reverse();for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];Os.isClockWise(Zt)&&(xe[be]=Zt.reverse())}}const ge=Os.triangulateShape(ye,xe),Ht=ye;for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];ye=ye.concat(Zt)}function ce(be,xt,Zt){return xt||console.error("THREE.ExtrudeGeometry: vec does not exist"),xt.clone().multiplyScalar(Zt).add(be)}const We=ye.length,je=ge.length;function ze(be,xt,Zt){let Te,Pe,we;const bn=be.x-xt.x,Gn=be.y-xt.y,Fn=Zt.x-be.x,_r=Zt.y-be.y,Tr=bn*bn+Gn*Gn,Xo=bn*_r-Gn*Fn;if(Math.abs(Xo)>Number.EPSILON){const fi=Math.sqrt(Tr),uu=Math.sqrt(Fn*Fn+_r*_r),sm=xt.x-Gn/fi,am=xt.y+bn/fi,lm=((Zt.x-_r/uu-sm)*_r-(Zt.y+Fn/uu-am)*Fn)/(bn*_r-Gn*Fn);Te=sm+bn*lm-be.x,Pe=am+Gn*lm-be.y;const $s=Te*Te+Pe*Pe;if($s<=2)return new He(Te,Pe);we=Math.sqrt($s/2)}else{let fi=!1;bn>Number.EPSILON?Fn>Number.EPSILON&&(fi=!0):bn<-Number.EPSILON?Fn<-Number.EPSILON&&(fi=!0):Math.sign(Gn)===Math.sign(_r)&&(fi=!0),fi?(Te=-Gn,Pe=bn,we=Math.sqrt(Tr)):(Te=bn,Pe=Gn,we=Math.sqrt(Tr/2))}return new He(Te/we,Pe/we)}const fn=[];for(let be=0,xt=Ht.length,Zt=xt-1,Te=be+1;be<xt;be++,Zt++,Te++)Zt===xt&&(Zt=0),Te===xt&&(Te=0),fn[be]=ze(Ht[be],Ht[Zt],Ht[Te]);const _n=[];let Mn,Sn=fn.concat();for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];Mn=[];for(let Te=0,Pe=Zt.length,we=Pe-1,bn=Te+1;Te<Pe;Te++,we++,bn++)we===Pe&&(we=0),bn===Pe&&(bn=0),Mn[Te]=ze(Zt[Te],Zt[we],Zt[bn]);_n.push(Mn),Sn=Sn.concat(Mn)}for(let be=0;be<D;be++){const xt=be/D,Zt=R*Math.cos(xt*Math.PI/2),Te=O*Math.sin(xt*Math.PI/2)+U;for(let Pe=0,we=Ht.length;Pe<we;Pe++){const bn=ce(Ht[Pe],fn[Pe],Te);Fe(bn.x,bn.y,-Zt)}for(let Pe=0,we=xe.length;Pe<we;Pe++){const bn=xe[Pe];Mn=_n[Pe];for(let Gn=0,Fn=bn.length;Gn<Fn;Gn++){const _r=ce(bn[Gn],Mn[Gn],Te);Fe(_r.x,_r.y,-Zt)}}}const Rt=O+U;for(let be=0;be<We;be++){const xt=A?ce(ye[be],Sn[be],Rt):ye[be];Ot?(Pt.copy(mt.normals[0]).multiplyScalar(xt.x),At.copy(mt.binormals[0]).multiplyScalar(xt.y),Et.copy(vt[0]).add(Pt).add(At),Fe(Et.x,Et.y,Et.z)):Fe(xt.x,xt.y,0)}for(let be=1;be<=M;be++)for(let xt=0;xt<We;xt++){const Zt=A?ce(ye[xt],Sn[xt],Rt):ye[xt];Ot?(Pt.copy(mt.normals[be]).multiplyScalar(Zt.x),At.copy(mt.binormals[be]).multiplyScalar(Zt.y),Et.copy(vt[be]).add(Pt).add(At),Fe(Et.x,Et.y,Et.z)):Fe(Zt.x,Zt.y,C/M*be)}for(let be=D-1;be>=0;be--){const xt=be/D,Zt=R*Math.cos(xt*Math.PI/2),Te=O*Math.sin(xt*Math.PI/2)+U;for(let Pe=0,we=Ht.length;Pe<we;Pe++){const bn=ce(Ht[Pe],fn[Pe],Te);Fe(bn.x,bn.y,C+Zt)}for(let Pe=0,we=xe.length;Pe<we;Pe++){const bn=xe[Pe];Mn=_n[Pe];for(let Gn=0,Fn=bn.length;Gn<Fn;Gn++){const _r=ce(bn[Gn],Mn[Gn],Te);Ot?Fe(_r.x,_r.y+vt[M-1].y,vt[M-1].x+Zt):Fe(_r.x,_r.y,C+Zt)}}}function Dt(be,xt){let Zt=be.length;for(;--Zt>=0;){const Te=Zt;let Pe=Zt-1;Pe<0&&(Pe=be.length-1);for(let we=0,bn=M+2*D;we<bn;we++){const Gn=We*we,Fn=We*(we+1);pe(xt+Te+Gn,xt+Pe+Gn,xt+Pe+Fn,xt+Te+Fn)}}}function Fe(be,xt,Zt){_.push(be),_.push(xt),_.push(Zt)}function Be(be,xt,Zt){rn(be),rn(xt),rn(Zt);const Te=l.length/3,Pe=ot.generateTopUV(a,l,Te-3,Te-2,Te-1);sn(Pe[0]),sn(Pe[1]),sn(Pe[2])}function pe(be,xt,Zt,Te){rn(be),rn(xt),rn(Te),rn(xt),rn(Zt),rn(Te);const Pe=l.length/3,we=ot.generateSideWallUV(a,l,Pe-6,Pe-3,Pe-2,Pe-1);sn(we[0]),sn(we[1]),sn(we[3]),sn(we[1]),sn(we[2]),sn(we[3])}function rn(be){l.push(_[3*be+0]),l.push(_[3*be+1]),l.push(_[3*be+2])}function sn(be){d.push(be.x),d.push(be.y)}(function(){const be=l.length/3;if(A){let xt=0,Zt=We*xt;for(let Te=0;Te<je;Te++){const Pe=ge[Te];Be(Pe[2]+Zt,Pe[1]+Zt,Pe[0]+Zt)}xt=M+2*D,Zt=We*xt;for(let Te=0;Te<je;Te++){const Pe=ge[Te];Be(Pe[0]+Zt,Pe[1]+Zt,Pe[2]+Zt)}}else{for(let xt=0;xt<je;xt++){const Zt=ge[xt];Be(Zt[2],Zt[1],Zt[0])}for(let xt=0;xt<je;xt++){const Zt=ge[xt];Be(Zt[0]+We*M,Zt[1]+We*M,Zt[2]+We*M)}}a.addGroup(be,l.length/3-be,0)})(),function(){const be=l.length/3;let xt=0;Dt(Ht,xt),xt+=Ht.length;for(let Zt=0,Te=xe.length;Zt<Te;Zt++){const Pe=xe[Zt];Dt(Pe,xt),xt+=Pe.length}a.addGroup(be,l.length/3-be,1)}()}this.setAttribute("position",new xn(l,3)),this.setAttribute("uv",new xn(d,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(i,a,l){if(l.shapes=[],Array.isArray(i))for(let d=0,p=i.length;d<p;d++){const v=i[d];l.shapes.push(v.uuid)}else l.shapes.push(i.uuid);return a.extrudePath!==void 0&&(l.options.extrudePath=a.extrudePath.toJSON()),l}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,i){const a=[];for(let d=0,p=t.shapes.length;d<p;d++){const v=i[t.shapes[d]];a.push(v)}const l=t.options.extrudePath;return l!==void 0&&(t.options.extrudePath=new $a[l.type]().fromJSON(l)),new Ka(a,t.options)}}const Tm={generateTopUV:function(m,t,i,a,l){const d=t[3*i],p=t[3*i+1],v=t[3*a],_=t[3*a+1],x=t[3*l],M=t[3*l+1];return[new He(d,p),new He(v,_),new He(x,M)]},generateSideWallUV:function(m,t,i,a,l,d){const p=t[3*i],v=t[3*i+1],_=t[3*i+2],x=t[3*a],M=t[3*a+1],C=t[3*a+2],A=t[3*l],R=t[3*l+1],O=t[3*l+2],U=t[3*d],D=t[3*d+1],Z=t[3*d+2];return Math.abs(v-M)<Math.abs(p-x)?[new He(p,1-_),new He(x,1-C),new He(A,1-O),new He(U,1-Z)]:[new He(v,1-_),new He(M,1-C),new He(R,1-O),new He(D,1-Z)]}};class Uu extends ln{constructor(t=1,i=0){const a=(1+Math.sqrt(5))/2;super([-1,a,0,1,a,0,-1,-a,0,1,-a,0,0,-1,a,0,1,a,0,-1,-a,0,1,-a,a,0,-1,a,0,1,-a,0,-1,-a,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,i),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new Uu(t.radius,t.detail)}}class td extends zn{constructor(t,i=12,a=0,l=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:i,phiStart:a,phiLength:l},i=Math.floor(i),l=zi(l,0,2*Math.PI);const d=[],p=[],v=[],_=1/i,x=new gt,M=new He;for(let C=0;C<=i;C++){const A=a+C*_*l,R=Math.sin(A),O=Math.cos(A);for(let U=0;U<=t.length-1;U++)x.x=t[U].x*R,x.y=t[U].y,x.z=t[U].x*O,p.push(x.x,x.y,x.z),M.x=C/i,M.y=U/(t.length-1),v.push(M.x,M.y)}for(let C=0;C<i;C++)for(let A=0;A<t.length-1;A++){const R=A+C*t.length,O=R,U=R+t.length,D=R+t.length+1,Z=R+1;d.push(O,U,Z),d.push(U,D,Z)}if(this.setIndex(d),this.setAttribute("position",new xn(p,3)),this.setAttribute("uv",new xn(v,2)),this.computeVertexNormals(),l===2*Math.PI){const C=this.attributes.normal.array,A=new gt,R=new gt,O=new gt,U=i*t.length*3;for(let D=0,Z=0;D<t.length;D++,Z+=3)A.x=C[Z+0],A.y=C[Z+1],A.z=C[Z+2],R.x=C[U+Z+0],R.y=C[U+Z+1],R.z=C[U+Z+2],O.addVectors(A,R).normalize(),C[Z+0]=C[U+Z+0]=O.x,C[Z+1]=C[U+Z+1]=O.y,C[Z+2]=C[U+Z+2]=O.z}}static fromJSON(t){return new td(t.points,t.segments,t.phiStart,t.phiLength)}}class Yh extends ln{constructor(t=1,i=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,i),this.type="OctahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new Yh(t.radius,t.detail)}}class rp extends zn{constructor(t,i,a){super(),this.type="ParametricGeometry",this.parameters={func:t,slices:i,stacks:a};const l=[],d=[],p=[],v=[],_=1e-5,x=new gt,M=new gt,C=new gt,A=new gt,R=new gt;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const O=i+1;for(let U=0;U<=a;U++){const D=U/a;for(let Z=0;Z<=i;Z++){const ot=Z/i;t(ot,D,M),d.push(M.x,M.y,M.z),ot-_>=0?(t(ot-_,D,C),A.subVectors(M,C)):(t(ot+_,D,C),A.subVectors(C,M)),D-_>=0?(t(ot,D-_,C),R.subVectors(M,C)):(t(ot,D+_,C),R.subVectors(C,M)),x.crossVectors(A,R).normalize(),p.push(x.x,x.y,x.z),v.push(ot,D)}}for(let U=0;U<a;U++)for(let D=0;D<i;D++){const Z=U*O+D,ot=U*O+D+1,vt=(U+1)*O+D+1,mt=(U+1)*O+D;l.push(Z,ot,mt),l.push(ot,vt,mt)}this.setIndex(l),this.setAttribute("position",new xn(d,3)),this.setAttribute("normal",new xn(p,3)),this.setAttribute("uv",new xn(v,2))}}class ed extends zn{constructor(t=.5,i=1,a=8,l=1,d=0,p=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:i,thetaSegments:a,phiSegments:l,thetaStart:d,thetaLength:p},a=Math.max(3,a);const v=[],_=[],x=[],M=[];let C=t;const A=(i-t)/(l=Math.max(1,l)),R=new gt,O=new He;for(let U=0;U<=l;U++){for(let D=0;D<=a;D++){const Z=d+D/a*p;R.x=C*Math.cos(Z),R.y=C*Math.sin(Z),_.push(R.x,R.y,R.z),x.push(0,0,1),O.x=(R.x/i+1)/2,O.y=(R.y/i+1)/2,M.push(O.x,O.y)}C+=A}for(let U=0;U<l;U++){const D=U*(a+1);for(let Z=0;Z<a;Z++){const ot=Z+D,vt=ot,mt=ot+a+1,At=ot+a+2,Pt=ot+1;v.push(vt,mt,Pt),v.push(mt,At,Pt)}}this.setIndex(v),this.setAttribute("position",new xn(_,3)),this.setAttribute("normal",new xn(x,3)),this.setAttribute("uv",new xn(M,2))}static fromJSON(t){return new ed(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Zh extends zn{constructor(t,i=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:i};const a=[],l=[],d=[],p=[];let v=0,_=0;if(Array.isArray(t)===!1)x(t);else for(let M=0;M<t.length;M++)x(t[M]),this.addGroup(v,_,M),v+=_,_=0;function x(M){const C=l.length/3,A=M.extractPoints(i);let R=A.shape;const O=A.holes;Os.isClockWise(R)===!1&&(R=R.reverse());for(let D=0,Z=O.length;D<Z;D++){const ot=O[D];Os.isClockWise(ot)===!0&&(O[D]=ot.reverse())}const U=Os.triangulateShape(R,O);for(let D=0,Z=O.length;D<Z;D++){const ot=O[D];R=R.concat(ot)}for(let D=0,Z=R.length;D<Z;D++){const ot=R[D];l.push(ot.x,ot.y,0),d.push(0,0,1),p.push(ot.x,ot.y)}for(let D=0,Z=U.length;D<Z;D++){const ot=U[D],vt=ot[0]+C,mt=ot[1]+C,At=ot[2]+C;a.push(vt,mt,At),_+=3}}this.setIndex(a),this.setAttribute("position",new xn(l,3)),this.setAttribute("normal",new xn(d,3)),this.setAttribute("uv",new xn(p,2))}toJSON(){const t=super.toJSON();return function(i,a){if(a.shapes=[],Array.isArray(i))for(let l=0,d=i.length;l<d;l++){const p=i[l];a.shapes.push(p.uuid)}else a.shapes.push(i.uuid);return a}(this.parameters.shapes,t)}static fromJSON(t,i){const a=[];for(let l=0,d=t.shapes.length;l<d;l++){const p=i[t.shapes[l]];a.push(p)}return new Zh(a,t.curveSegments)}}class Jh extends zn{constructor(t=1,i=8,a=6,l=0,d=2*Math.PI,p=0,v=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:i,heightSegments:a,phiStart:l,phiLength:d,thetaStart:p,thetaLength:v},i=Math.max(3,Math.floor(i)),a=Math.max(2,Math.floor(a));const _=Math.min(p+v,Math.PI);let x=0;const M=[],C=new gt,A=new gt,R=[],O=[],U=[],D=[];for(let Z=0;Z<=a;Z++){const ot=[],vt=Z/a;let mt=0;Z==0&&p==0?mt=.5/i:Z==a&&_==Math.PI&&(mt=-.5/i);for(let At=0;At<=i;At++){const Pt=At/i;C.x=-t*Math.cos(l+Pt*d)*Math.sin(p+vt*v),C.y=t*Math.cos(p+vt*v),C.z=t*Math.sin(l+Pt*d)*Math.sin(p+vt*v),O.push(C.x,C.y,C.z),A.copy(C).normalize(),U.push(A.x,A.y,A.z),D.push(Pt+mt,1-vt),ot.push(x++)}M.push(ot)}for(let Z=0;Z<a;Z++)for(let ot=0;ot<i;ot++){const vt=M[Z][ot+1],mt=M[Z][ot],At=M[Z+1][ot],Pt=M[Z+1][ot+1];(Z!==0||p>0)&&R.push(vt,mt,Pt),(Z!==a-1||_<Math.PI)&&R.push(mt,At,Pt)}this.setIndex(R),this.setAttribute("position",new xn(O,3)),this.setAttribute("normal",new xn(U,3)),this.setAttribute("uv",new xn(D,2))}static fromJSON(t){return new Jh(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class nd extends ln{constructor(t=1,i=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,i),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new nd(t.radius,t.detail)}}class tf extends Ka{constructor(t,i={}){const a=i.font;if(!a||!a.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new zn;const l=a.generateShapes(t,i.size);i.depth=i.height!==void 0?i.height:50,i.bevelThickness===void 0&&(i.bevelThickness=10),i.bevelSize===void 0&&(i.bevelSize=8),i.bevelEnabled===void 0&&(i.bevelEnabled=!1),super(l,i),this.type="TextGeometry"}}class rd extends zn{constructor(t=1,i=.4,a=8,l=6,d=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:i,radialSegments:a,tubularSegments:l,arc:d},a=Math.floor(a),l=Math.floor(l);const p=[],v=[],_=[],x=[],M=new gt,C=new gt,A=new gt;for(let R=0;R<=a;R++)for(let O=0;O<=l;O++){const U=O/l*d,D=R/a*Math.PI*2;C.x=(t+i*Math.cos(D))*Math.cos(U),C.y=(t+i*Math.cos(D))*Math.sin(U),C.z=i*Math.sin(D),v.push(C.x,C.y,C.z),M.x=t*Math.cos(U),M.y=t*Math.sin(U),A.subVectors(C,M).normalize(),_.push(A.x,A.y,A.z),x.push(O/l),x.push(R/a)}for(let R=1;R<=a;R++)for(let O=1;O<=l;O++){const U=(l+1)*R+O-1,D=(l+1)*(R-1)+O-1,Z=(l+1)*(R-1)+O,ot=(l+1)*R+O;p.push(U,D,ot),p.push(D,Z,ot)}this.setIndex(p),this.setAttribute("position",new xn(v,3)),this.setAttribute("normal",new xn(_,3)),this.setAttribute("uv",new xn(x,2))}static fromJSON(t){return new rd(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class id extends zn{constructor(t=1,i=.4,a=64,l=8,d=2,p=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:i,tubularSegments:a,radialSegments:l,p:d,q:p},a=Math.floor(a),l=Math.floor(l);const v=[],_=[],x=[],M=[],C=new gt,A=new gt,R=new gt,O=new gt,U=new gt,D=new gt,Z=new gt;for(let vt=0;vt<=a;++vt){const mt=vt/a*d*Math.PI*2;ot(mt,d,p,t,R),ot(mt+.01,d,p,t,O),D.subVectors(O,R),Z.addVectors(O,R),U.crossVectors(D,Z),Z.crossVectors(U,D),U.normalize(),Z.normalize();for(let At=0;At<=l;++At){const Pt=At/l*Math.PI*2,Et=-i*Math.cos(Pt),Ot=i*Math.sin(Pt);C.x=R.x+(Et*Z.x+Ot*U.x),C.y=R.y+(Et*Z.y+Ot*U.y),C.z=R.z+(Et*Z.z+Ot*U.z),_.push(C.x,C.y,C.z),A.subVectors(C,R).normalize(),x.push(A.x,A.y,A.z),M.push(vt/a),M.push(At/l)}}for(let vt=1;vt<=a;vt++)for(let mt=1;mt<=l;mt++){const At=(l+1)*(vt-1)+(mt-1),Pt=(l+1)*vt+(mt-1),Et=(l+1)*vt+mt,Ot=(l+1)*(vt-1)+mt;v.push(At,Pt,Ot),v.push(Pt,Et,Ot)}function ot(vt,mt,At,Pt,Et){const Ot=Math.cos(vt),Ie=Math.sin(vt),ye=At/mt*vt,xe=Math.cos(ye);Et.x=Pt*(2+xe)*.5*Ot,Et.y=Pt*(2+xe)*Ie*.5,Et.z=Pt*Math.sin(ye)*.5}this.setIndex(v),this.setAttribute("position",new xn(_,3)),this.setAttribute("normal",new xn(x,3)),this.setAttribute("uv",new xn(M,2))}static fromJSON(t){return new id(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class od extends zn{constructor(t,i=64,a=1,l=8,d=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:i,radius:a,radialSegments:l,closed:d};const p=t.computeFrenetFrames(i,d);this.tangents=p.tangents,this.normals=p.normals,this.binormals=p.binormals;const v=new gt,_=new gt,x=new He;let M=new gt;const C=[],A=[],R=[],O=[];function U(D){M=t.getPointAt(D/i,M);const Z=p.normals[D],ot=p.binormals[D];for(let vt=0;vt<=l;vt++){const mt=vt/l*Math.PI*2,At=Math.sin(mt),Pt=-Math.cos(mt);_.x=Pt*Z.x+At*ot.x,_.y=Pt*Z.y+At*ot.y,_.z=Pt*Z.z+At*ot.z,_.normalize(),A.push(_.x,_.y,_.z),v.x=M.x+a*_.x,v.y=M.y+a*_.y,v.z=M.z+a*_.z,C.push(v.x,v.y,v.z)}}(function(){for(let D=0;D<i;D++)U(D);U(d===!1?i:0),function(){for(let D=0;D<=i;D++)for(let Z=0;Z<=l;Z++)x.x=D/i,x.y=Z/l,R.push(x.x,x.y)}(),function(){for(let D=1;D<=i;D++)for(let Z=1;Z<=l;Z++){const ot=(l+1)*(D-1)+(Z-1),vt=(l+1)*D+(Z-1),mt=(l+1)*D+Z,At=(l+1)*(D-1)+Z;O.push(ot,vt,At),O.push(vt,mt,At)}}()})(),this.setIndex(O),this.setAttribute("position",new xn(C,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(R,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new od(new $a[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class If extends zn{constructor(t){if(super(),this.type="WireframeGeometry",t.isGeometry===!0)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const i=[],a=[0,0],l={},d=new gt;if(t.index!==null){const p=t.attributes.position,v=t.index;let _=t.groups;_.length===0&&(_=[{start:0,count:v.count,materialIndex:0}]);for(let x=0,M=_.length;x<M;++x){const C=_[x],A=C.start;for(let R=A,O=A+C.count;R<O;R+=3)for(let U=0;U<3;U++){const D=v.getX(R+U),Z=v.getX(R+(U+1)%3);a[0]=Math.min(D,Z),a[1]=Math.max(D,Z);const ot=a[0]+","+a[1];l[ot]===void 0&&(l[ot]={index1:a[0],index2:a[1]})}}for(const x in l){const M=l[x];d.fromBufferAttribute(p,M.index1),i.push(d.x,d.y,d.z),d.fromBufferAttribute(p,M.index2),i.push(d.x,d.y,d.z)}}else{const p=t.attributes.position;for(let v=0,_=p.count/3;v<_;v++)for(let x=0;x<3;x++){const M=3*v+x;d.fromBufferAttribute(p,M),i.push(d.x,d.y,d.z);const C=3*v+(x+1)%3;d.fromBufferAttribute(p,C),i.push(d.x,d.y,d.z)}}this.setAttribute("position",new xn(i,3))}}var Em=Object.freeze({__proto__:null,BoxGeometry:ha,BoxBufferGeometry:ha,CircleGeometry:me,CircleBufferGeometry:me,ConeGeometry:gn,ConeBufferGeometry:gn,CylinderGeometry:De,CylinderBufferGeometry:De,DodecahedronGeometry:An,DodecahedronBufferGeometry:An,EdgesGeometry:Yn,ExtrudeGeometry:Ka,ExtrudeBufferGeometry:Ka,IcosahedronGeometry:Uu,IcosahedronBufferGeometry:Uu,LatheGeometry:td,LatheBufferGeometry:td,OctahedronGeometry:Yh,OctahedronBufferGeometry:Yh,ParametricGeometry:rp,ParametricBufferGeometry:rp,PlaneGeometry:pa,PlaneBufferGeometry:pa,PolyhedronGeometry:ln,PolyhedronBufferGeometry:ln,RingGeometry:ed,RingBufferGeometry:ed,ShapeGeometry:Zh,ShapeBufferGeometry:Zh,SphereGeometry:Jh,SphereBufferGeometry:Jh,TetrahedronGeometry:nd,TetrahedronBufferGeometry:nd,TextGeometry:tf,TextBufferGeometry:tf,TorusGeometry:rd,TorusBufferGeometry:rd,TorusKnotGeometry:id,TorusKnotBufferGeometry:id,TubeGeometry:od,TubeBufferGeometry:od,WireframeGeometry:If});class Lf extends Ni{constructor(t){super(),this.type="ShadowMaterial",this.color=new pn(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}Lf.prototype.isShadowMaterial=!0;class $h extends vo{constructor(t){super(t),this.type="RawShaderMaterial"}}$h.prototype.isRawShaderMaterial=!0;class ip extends Ni{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new pn(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this}}ip.prototype.isMeshStandardMaterial=!0;class Of extends ip{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new He(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(i){this.reflectivity=zi(2.5*(i-1)/(i+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new pn(1,1,1),this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new pn).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this}}Of.prototype.isMeshPhysicalMaterial=!0;class Df extends Ni{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new pn(16777215),this.specular=new pn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Df.prototype.isMeshPhongMaterial=!0;class Nf extends Ni{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new pn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Nf.prototype.isMeshToonMaterial=!0;class Ff extends Ni{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Ff.prototype.isMeshNormalMaterial=!0;class Gu extends Ni{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new pn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Gu.prototype.isMeshLambertMaterial=!0;class ef extends Ni{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new pn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}ef.prototype.isMeshMatcapMaterial=!0;class Bf extends ro{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Bf.prototype.isLineDashedMaterial=!0;var Pn=Object.freeze({__proto__:null,ShadowMaterial:Lf,SpriteMaterial:yo,RawShaderMaterial:$h,ShaderMaterial:vo,PointsMaterial:xl,MeshPhysicalMaterial:Of,MeshStandardMaterial:ip,MeshPhongMaterial:Df,MeshToonMaterial:Nf,MeshNormalMaterial:Ff,MeshLambertMaterial:Gu,MeshDepthMaterial:Nh,MeshDistanceMaterial:fs,MeshBasicMaterial:Fi,MeshMatcapMaterial:ef,LineDashedMaterial:Bf,LineBasicMaterial:ro,Material:Ni});const di={arraySlice:function(m,t,i){return di.isTypedArray(m)?new m.constructor(m.subarray(t,i!==void 0?i:m.length)):m.slice(t,i)},convertArray:function(m,t,i){return!m||!i&&m.constructor===t?m:typeof t.BYTES_PER_ELEMENT=="number"?new t(m):Array.prototype.slice.call(m)},isTypedArray:function(m){return ArrayBuffer.isView(m)&&!(m instanceof DataView)},getKeyframeOrder:function(m){const t=m.length,i=new Array(t);for(let a=0;a!==t;++a)i[a]=a;return i.sort(function(a,l){return m[a]-m[l]}),i},sortedArray:function(m,t,i){const a=m.length,l=new m.constructor(a);for(let d=0,p=0;p!==a;++d){const v=i[d]*t;for(let _=0;_!==t;++_)l[p++]=m[v+_]}return l},flattenJSON:function(m,t,i,a){let l=1,d=m[0];for(;d!==void 0&&d[a]===void 0;)d=m[l++];if(d===void 0)return;let p=d[a];if(p!==void 0)if(Array.isArray(p))do p=d[a],p!==void 0&&(t.push(d.time),i.push.apply(i,p)),d=m[l++];while(d!==void 0);else if(p.toArray!==void 0)do p=d[a],p!==void 0&&(t.push(d.time),p.toArray(i,i.length)),d=m[l++];while(d!==void 0);else do p=d[a],p!==void 0&&(t.push(d.time),i.push(p)),d=m[l++];while(d!==void 0)},subclip:function(m,t,i,a,l=30){const d=m.clone();d.name=t;const p=[];for(let _=0;_<d.tracks.length;++_){const x=d.tracks[_],M=x.getValueSize(),C=[],A=[];for(let R=0;R<x.times.length;++R){const O=x.times[R]*l;if(!(O<i||O>=a)){C.push(x.times[R]);for(let U=0;U<M;++U)A.push(x.values[R*M+U])}}C.length!==0&&(x.times=di.convertArray(C,x.times.constructor),x.values=di.convertArray(A,x.values.constructor),p.push(x))}d.tracks=p;let v=1/0;for(let _=0;_<d.tracks.length;++_)v>d.tracks[_].times[0]&&(v=d.tracks[_].times[0]);for(let _=0;_<d.tracks.length;++_)d.tracks[_].shift(-1*v);return d.resetDuration(),d},makeClipAdditive:function(m,t=0,i=m,a=30){a<=0&&(a=30);const l=i.tracks.length,d=t/a;for(let p=0;p<l;++p){const v=i.tracks[p],_=v.ValueTypeName;if(_==="bool"||_==="string")continue;const x=m.tracks.find(function(Z){return Z.name===v.name&&Z.ValueTypeName===_});if(x===void 0)continue;let M=0;const C=v.getValueSize();v.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(M=C/3);let A=0;const R=x.getValueSize();x.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(A=R/3);const O=v.times.length-1;let U;if(d<=v.times[0]){const Z=M,ot=C-M;U=di.arraySlice(v.values,Z,ot)}else if(d>=v.times[O]){const Z=O*C+M,ot=Z+C-M;U=di.arraySlice(v.values,Z,ot)}else{const Z=v.createInterpolant(),ot=M,vt=C-M;Z.evaluate(d),U=di.arraySlice(Z.resultBuffer,ot,vt)}_==="quaternion"&&new Oi().fromArray(U).normalize().conjugate().toArray(U);const D=x.times.length;for(let Z=0;Z<D;++Z){const ot=Z*R+A;if(_==="quaternion")Oi.multiplyQuaternionsFlat(x.values,ot,U,0,x.values,ot);else{const vt=R-2*A;for(let mt=0;mt<vt;++mt)x.values[ot+mt]-=U[mt]}}}return m.blendMode=xd,m}};class Js{constructor(t,i,a,l){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=l!==void 0?l:new i.constructor(a),this.sampleValues=i,this.valueSize=a,this.settings=null,this.DefaultSettings_={}}evaluate(t){const i=this.parameterPositions;let a=this._cachedIndex,l=i[a],d=i[a-1];t:{e:{let p;n:{r:if(!(t<l)){for(let v=a+2;;){if(l===void 0){if(t<d)break r;return a=i.length,this._cachedIndex=a,this.afterEnd_(a-1,t,d)}if(a===v)break;if(d=l,l=i[++a],t<l)break e}p=i.length;break n}if(t>=d)break t;{const v=i[1];t<v&&(a=2,d=v);for(let _=a-2;;){if(d===void 0)return this._cachedIndex=0,this.beforeStart_(0,t,l);if(a===_)break;if(l=d,d=i[--a-1],t>=d)break e}p=a,a=0}}for(;a<p;){const v=a+p>>>1;t<i[v]?p=v:a=v+1}if(l=i[a],d=i[a-1],d===void 0)return this._cachedIndex=0,this.beforeStart_(0,t,l);if(l===void 0)return a=i.length,this._cachedIndex=a,this.afterEnd_(a-1,d,t)}this._cachedIndex=a,this.intervalChanged_(a,d,l)}return this.interpolate_(a,d,t,l)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const i=this.resultBuffer,a=this.sampleValues,l=this.valueSize,d=t*l;for(let p=0;p!==l;++p)i[p]=a[d+p];return i}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Js.prototype.beforeStart_=Js.prototype.copySampleValue_,Js.prototype.afterEnd_=Js.prototype.copySampleValue_;class Hu extends Js{constructor(t,i,a,l){super(t,i,a,l),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ta,endingEnd:ta}}intervalChanged_(t,i,a){const l=this.parameterPositions;let d=t-2,p=t+1,v=l[d],_=l[p];if(v===void 0)switch(this.getSettings_().endingStart){case La:d=t,v=2*i-a;break;case _s:d=l.length-2,v=i+l[d]-l[d+1];break;default:d=t,v=a}if(_===void 0)switch(this.getSettings_().endingEnd){case La:p=t,_=2*a-i;break;case _s:p=1,_=a+l[1]-l[0];break;default:p=t-1,_=i}const x=.5*(a-i),M=this.valueSize;this._weightPrev=x/(i-v),this._weightNext=x/(_-a),this._offsetPrev=d*M,this._offsetNext=p*M}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=t*v,x=_-v,M=this._offsetPrev,C=this._offsetNext,A=this._weightPrev,R=this._weightNext,O=(a-i)/(l-i),U=O*O,D=U*O,Z=-A*D+2*A*U-A*O,ot=(1+A)*D+(-1.5-2*A)*U+(-.5+A)*O+1,vt=(-1-R)*D+(1.5+R)*U+.5*O,mt=R*D-R*U;for(let At=0;At!==v;++At)d[At]=Z*p[M+At]+ot*p[x+At]+vt*p[_+At]+mt*p[C+At];return d}}class nf extends Js{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=t*v,x=_-v,M=(a-i)/(l-i),C=1-M;for(let A=0;A!==v;++A)d[A]=p[x+A]*C+p[_+A]*M;return d}}class rf extends Js{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t){return this.copySampleValue_(t-1)}}class Vo{constructor(t,i,a,l){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(i===void 0||i.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=di.convertArray(i,this.TimeBufferType),this.values=di.convertArray(a,this.ValueBufferType),this.setInterpolation(l||this.DefaultInterpolation)}static toJSON(t){const i=t.constructor;let a;if(i.toJSON!==this.toJSON)a=i.toJSON(t);else{a={name:t.name,times:di.convertArray(t.times,Array),values:di.convertArray(t.values,Array)};const l=t.getInterpolation();l!==t.DefaultInterpolation&&(a.interpolation=l)}return a.type=t.ValueTypeName,a}InterpolantFactoryMethodDiscrete(t){return new rf(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new nf(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Hu(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let i;switch(t){case Rl:i=this.InterpolantFactoryMethodDiscrete;break;case Ii:i=this.InterpolantFactoryMethodLinear;break;case Ia:i=this.InterpolantFactoryMethodSmooth}if(i===void 0){const a="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0){if(t===this.DefaultInterpolation)throw new Error(a);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",a),this}return this.createInterpolant=i,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Rl;case this.InterpolantFactoryMethodLinear:return Ii;case this.InterpolantFactoryMethodSmooth:return Ia}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){const i=this.times;for(let a=0,l=i.length;a!==l;++a)i[a]+=t}return this}scale(t){if(t!==1){const i=this.times;for(let a=0,l=i.length;a!==l;++a)i[a]*=t}return this}trim(t,i){const a=this.times,l=a.length;let d=0,p=l-1;for(;d!==l&&a[d]<t;)++d;for(;p!==-1&&a[p]>i;)--p;if(++p,d!==0||p!==l){d>=p&&(p=Math.max(p,1),d=p-1);const v=this.getValueSize();this.times=di.arraySlice(a,d,p),this.values=di.arraySlice(this.values,d*v,p*v)}return this}validate(){let t=!0;const i=this.getValueSize();i-Math.floor(i)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const a=this.times,l=this.values,d=a.length;d===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let p=null;for(let v=0;v!==d;v++){const _=a[v];if(typeof _=="number"&&isNaN(_)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,v,_),t=!1;break}if(p!==null&&p>_){console.error("THREE.KeyframeTrack: Out of order keys.",this,v,_,p),t=!1;break}p=_}if(l!==void 0&&di.isTypedArray(l))for(let v=0,_=l.length;v!==_;++v){const x=l[v];if(isNaN(x)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,v,x),t=!1;break}}return t}optimize(){const t=di.arraySlice(this.times),i=di.arraySlice(this.values),a=this.getValueSize(),l=this.getInterpolation()===Ia,d=t.length-1;let p=1;for(let v=1;v<d;++v){let _=!1;const x=t[v];if(x!==t[v+1]&&(v!==1||x!==t[0]))if(l)_=!0;else{const M=v*a,C=M-a,A=M+a;for(let R=0;R!==a;++R){const O=i[M+R];if(O!==i[C+R]||O!==i[A+R]){_=!0;break}}}if(_){if(v!==p){t[p]=t[v];const M=v*a,C=p*a;for(let A=0;A!==a;++A)i[C+A]=i[M+A]}++p}}if(d>0){t[p]=t[d];for(let v=d*a,_=p*a,x=0;x!==a;++x)i[_+x]=i[v+x];++p}return p!==t.length?(this.times=di.arraySlice(t,0,p),this.values=di.arraySlice(i,0,p*a)):(this.times=t,this.values=i),this}clone(){const t=di.arraySlice(this.times,0),i=di.arraySlice(this.values,0),a=new this.constructor(this.name,t,i);return a.createInterpolant=this.createInterpolant,a}}Vo.prototype.TimeBufferType=Float32Array,Vo.prototype.ValueBufferType=Float32Array,Vo.prototype.DefaultInterpolation=Ii;class Kh extends Vo{}Kh.prototype.ValueTypeName="bool",Kh.prototype.ValueBufferType=Array,Kh.prototype.DefaultInterpolation=Rl,Kh.prototype.InterpolantFactoryMethodLinear=void 0,Kh.prototype.InterpolantFactoryMethodSmooth=void 0;class of extends Vo{}of.prototype.ValueTypeName="color";class Qh extends Vo{}Qh.prototype.ValueTypeName="number";class kf extends Js{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=(a-i)/(l-i);let x=t*v;for(let M=x+v;x!==M;x+=4)Oi.slerpFlat(d,0,p,x-v,p,x,_);return d}}class tc extends Vo{InterpolantFactoryMethodLinear(t){return new kf(this.times,this.values,this.getValueSize(),t)}}tc.prototype.ValueTypeName="quaternion",tc.prototype.DefaultInterpolation=Ii,tc.prototype.InterpolantFactoryMethodSmooth=void 0;class Qa extends Vo{}Qa.prototype.ValueTypeName="string",Qa.prototype.ValueBufferType=Array,Qa.prototype.DefaultInterpolation=Rl,Qa.prototype.InterpolantFactoryMethodLinear=void 0,Qa.prototype.InterpolantFactoryMethodSmooth=void 0;class zu extends Vo{}zu.prototype.ValueTypeName="vector";class sd{constructor(t,i=-1,a,l=Oa){this.name=t,this.tracks=a,this.duration=i,this.blendMode=l,this.uuid=No(),this.duration<0&&this.resetDuration()}static parse(t){const i=[],a=t.tracks,l=1/(t.fps||1);for(let p=0,v=a.length;p!==v;++p)i.push(sg(a[p]).scale(l));const d=new this(t.name,t.duration,i,t.blendMode);return d.uuid=t.uuid,d}static toJSON(t){const i=[],a=t.tracks,l={name:t.name,duration:t.duration,tracks:i,uuid:t.uuid,blendMode:t.blendMode};for(let d=0,p=a.length;d!==p;++d)i.push(Vo.toJSON(a[d]));return l}static CreateFromMorphTargetSequence(t,i,a,l){const d=i.length,p=[];for(let v=0;v<d;v++){let _=[],x=[];_.push((v+d-1)%d,v,(v+1)%d),x.push(0,1,0);const M=di.getKeyframeOrder(_);_=di.sortedArray(_,1,M),x=di.sortedArray(x,1,M),l||_[0]!==0||(_.push(d),x.push(x[0])),p.push(new Qh(".morphTargetInfluences["+i[v].name+"]",_,x).scale(1/a))}return new this(t,-1,p)}static findByName(t,i){let a=t;if(!Array.isArray(t)){const l=t;a=l.geometry&&l.geometry.animations||l.animations}for(let l=0;l<a.length;l++)if(a[l].name===i)return a[l];return null}static CreateClipsFromMorphTargetSequences(t,i,a){const l={},d=/^([\w-]*?)([\d]+)$/;for(let v=0,_=t.length;v<_;v++){const x=t[v],M=x.name.match(d);if(M&&M.length>1){const C=M[1];let A=l[C];A||(l[C]=A=[]),A.push(x)}}const p=[];for(const v in l)p.push(this.CreateFromMorphTargetSequence(v,l[v],i,a));return p}static parseAnimation(t,i){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const a=function(M,C,A,R,O){if(A.length!==0){const U=[],D=[];di.flattenJSON(A,U,D,R),U.length!==0&&O.push(new M(C,U,D))}},l=[],d=t.name||"default",p=t.fps||30,v=t.blendMode;let _=t.length||-1;const x=t.hierarchy||[];for(let M=0;M<x.length;M++){const C=x[M].keys;if(C&&C.length!==0)if(C[0].morphTargets){const A={};let R;for(R=0;R<C.length;R++)if(C[R].morphTargets)for(let O=0;O<C[R].morphTargets.length;O++)A[C[R].morphTargets[O]]=-1;for(const O in A){const U=[],D=[];for(let Z=0;Z!==C[R].morphTargets.length;++Z){const ot=C[R];U.push(ot.time),D.push(ot.morphTarget===O?1:0)}l.push(new Qh(".morphTargetInfluence["+O+"]",U,D))}_=A.length*(p||1)}else{const A=".bones["+i[M].name+"]";a(zu,A+".position",C,"pos",l),a(tc,A+".quaternion",C,"rot",l),a(zu,A+".scale",C,"scl",l)}}return l.length===0?null:new this(d,_,l,v)}resetDuration(){let t=0;for(let i=0,a=this.tracks.length;i!==a;++i){const l=this.tracks[i];t=Math.max(t,l.times[l.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let i=0;i<this.tracks.length;i++)t=t&&this.tracks[i].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let i=0;i<this.tracks.length;i++)t.push(this.tracks[i].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function sg(m){if(m.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Qh;case"vector":case"vector2":case"vector3":case"vector4":return zu;case"color":return of;case"quaternion":return tc;case"bool":case"boolean":return Kh;case"string":return Qa}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}(m.type);if(m.times===void 0){const i=[],a=[];di.flattenJSON(m.keys,i,a,"value"),m.times=i,m.values=a}return t.parse!==void 0?t.parse(m):new t(m.name,m.times,m.values,m.interpolation)}const ec={enabled:!1,files:{},add:function(m,t){this.enabled!==!1&&(this.files[m]=t)},get:function(m){if(this.enabled!==!1)return this.files[m]},remove:function(m){delete this.files[m]},clear:function(){this.files={}}};class ya{constructor(t,i,a){const l=this;let d=!1,p=0,v=0,_;const x=[];this.onStart=void 0,this.onLoad=t,this.onProgress=i,this.onError=a,this.itemStart=function(M){v++,d===!1&&l.onStart!==void 0&&l.onStart(M,p,v),d=!0},this.itemEnd=function(M){p++,l.onProgress!==void 0&&l.onProgress(M,p,v),p===v&&(d=!1,l.onLoad!==void 0&&l.onLoad())},this.itemError=function(M){l.onError!==void 0&&l.onError(M)},this.resolveURL=function(M){return _?_(M):M},this.setURLModifier=function(M){return _=M,this},this.addHandler=function(M,C){return x.push(M,C),this},this.removeHandler=function(M){const C=x.indexOf(M);return C!==-1&&x.splice(C,2),this},this.getHandler=function(M){for(let C=0,A=x.length;C<A;C+=2){const R=x[C],O=x[C+1];if(R.global&&(R.lastIndex=0),R.test(M))return O}return null}}}const nc=new ya;class Wo{constructor(t){this.manager=t!==void 0?t:nc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,i){const a=this;return new Promise(function(l,d){a.load(t,l,i,d)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const xa={};class ba extends Wo{constructor(t){super(t)}load(t,i,a,l){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=ec.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;if(xa[t]!==void 0)return void xa[t].push({onLoad:i,onProgress:a,onError:l});const v=t.match(/^data:(.*?)(;base64)?,(.*)$/);let _;if(v){const x=v[1],M=!!v[2];let C=v[3];C=decodeURIComponent(C),M&&(C=atob(C));try{let A;const R=(this.responseType||"").toLowerCase();switch(R){case"arraybuffer":case"blob":const O=new Uint8Array(C.length);for(let D=0;D<C.length;D++)O[D]=C.charCodeAt(D);A=R==="blob"?new Blob([O.buffer],{type:x}):O.buffer;break;case"document":A=new DOMParser().parseFromString(C,x);break;case"json":A=JSON.parse(C);break;default:A=C}setTimeout(function(){i&&i(A),d.manager.itemEnd(t)},0)}catch(A){setTimeout(function(){l&&l(A),d.manager.itemError(t),d.manager.itemEnd(t)},0)}}else{xa[t]=[],xa[t].push({onLoad:i,onProgress:a,onError:l}),_=new XMLHttpRequest,_.open("GET",t,!0),_.addEventListener("load",function(x){const M=this.response,C=xa[t];if(delete xa[t],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),ec.add(t,M);for(let A=0,R=C.length;A<R;A++){const O=C[A];O.onLoad&&O.onLoad(M)}d.manager.itemEnd(t)}else{for(let A=0,R=C.length;A<R;A++){const O=C[A];O.onError&&O.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)}},!1),_.addEventListener("progress",function(x){const M=xa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onProgress&&R.onProgress(x)}},!1),_.addEventListener("error",function(x){const M=xa[t];delete xa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onError&&R.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)},!1),_.addEventListener("abort",function(x){const M=xa[t];delete xa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onError&&R.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)},!1),this.responseType!==void 0&&(_.responseType=this.responseType),this.withCredentials!==void 0&&(_.withCredentials=this.withCredentials),_.overrideMimeType&&_.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(const x in this.requestHeader)_.setRequestHeader(x,this.requestHeader[x]);_.send(null)}return d.manager.itemStart(t),_}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class ag extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new ba(this.manager);p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(this.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i=[];for(let a=0;a<t.length;a++){const l=sd.parse(t[a]);i.push(l)}return i}}class Mm extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=[],v=new Lt,_=new ba(this.manager);_.setPath(this.path),_.setResponseType("arraybuffer"),_.setRequestHeader(this.requestHeader),_.setWithCredentials(d.withCredentials);let x=0;function M(C){_.load(t[C],function(A){const R=d.parse(A,!0);p[C]={width:R.width,height:R.height,format:R.format,mipmaps:R.mipmaps},x+=1,x===6&&(R.mipmapCount===1&&(v.minFilter=Qe),v.image=p,v.format=R.format,v.needsUpdate=!0,i&&i(v))},a,l)}if(Array.isArray(t))for(let C=0,A=t.length;C<A;++C)M(C);else _.load(t,function(C){const A=d.parse(C,!0);if(A.isCubemap){const R=A.mipmaps.length/A.mipmapCount;for(let O=0;O<R;O++){p[O]={mipmaps:[]};for(let U=0;U<A.mipmapCount;U++)p[O].mipmaps.push(A.mipmaps[O*A.mipmapCount+U]),p[O].format=A.format,p[O].width=A.width,p[O].height=A.height}v.image=p}else v.image.width=A.width,v.image.height=A.height,v.mipmaps=A.mipmaps;A.mipmapCount===1&&(v.minFilter=Qe),v.format=A.format,v.needsUpdate=!0,i&&i(v)},a,l);return v}}class op extends Wo{constructor(t){super(t)}load(t,i,a,l){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=ec.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;const v=document.createElementNS("http://www.w3.org/1999/xhtml","img");function _(){v.removeEventListener("load",_,!1),v.removeEventListener("error",x,!1),ec.add(t,this),i&&i(this),d.manager.itemEnd(t)}function x(M){v.removeEventListener("load",_,!1),v.removeEventListener("error",x,!1),l&&l(M),d.manager.itemError(t),d.manager.itemEnd(t)}return v.addEventListener("load",_,!1),v.addEventListener("error",x,!1),t.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(v.crossOrigin=this.crossOrigin),d.manager.itemStart(t),v.src=t,v}}class Uf extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=new Vl,p=new op(this.manager);p.setCrossOrigin(this.crossOrigin),p.setPath(this.path);let v=0;function _(x){p.load(t[x],function(M){d.images[x]=M,v++,v===6&&(d.needsUpdate=!0,i&&i(d))},void 0,l)}for(let x=0;x<t.length;++x)_(x);return d}}class Am extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new Is,v=new ba(this.manager);return v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(d.withCredentials),v.load(t,function(_){const x=d.parse(_);x&&(x.image!==void 0?p.image=x.image:x.data!==void 0&&(p.image.width=x.width,p.image.height=x.height,p.image.data=x.data),p.wrapS=x.wrapS!==void 0?x.wrapS:St,p.wrapT=x.wrapT!==void 0?x.wrapT:St,p.magFilter=x.magFilter!==void 0?x.magFilter:Qe,p.minFilter=x.minFilter!==void 0?x.minFilter:Qe,p.anisotropy=x.anisotropy!==void 0?x.anisotropy:1,x.encoding!==void 0&&(p.encoding=x.encoding),x.flipY!==void 0&&(p.flipY=x.flipY),x.format!==void 0&&(p.format=x.format),x.type!==void 0&&(p.type=x.type),x.mipmaps!==void 0&&(p.mipmaps=x.mipmaps,p.minFilter=Yr),x.mipmapCount===1&&(p.minFilter=Qe),x.generateMipmaps!==void 0&&(p.generateMipmaps=x.generateMipmaps),p.needsUpdate=!0,i&&i(p,x))},a,l),p}}class Gf extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=new ni,p=new op(this.manager);return p.setCrossOrigin(this.crossOrigin),p.setPath(this.path),p.load(t,function(v){d.image=v;const _=t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0;d.format=_?yn:Tn,d.needsUpdate=!0,i!==void 0&&i(d)},a,l),d}}class Cm extends wn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),i=this.curves[this.curves.length-1].getPoint(1);t.equals(i)||this.curves.push(new Bu(i,t))}getPoint(t){const i=t*this.getLength(),a=this.getCurveLengths();let l=0;for(;l<a.length;){if(a[l]>=i){const d=a[l]-i,p=this.curves[l],v=p.getLength(),_=v===0?0:1-d/v;return p.getPointAt(_)}l++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let i=0;for(let a=0,l=this.curves.length;a<l;a++)i+=this.curves[a].getLength(),t.push(i);return this.cacheLengths=t,t}getSpacedPoints(t=40){const i=[];for(let a=0;a<=t;a++)i.push(this.getPoint(a/t));return this.autoClose&&i.push(i[0]),i}getPoints(t=12){const i=[];let a;for(let l=0,d=this.curves;l<d.length;l++){const p=d[l],v=p&&p.isEllipseCurve?2*t:p&&(p.isLineCurve||p.isLineCurve3)?1:p&&p.isSplineCurve?t*p.points.length:t,_=p.getPoints(v);for(let x=0;x<_.length;x++){const M=_[x];a&&a.equals(M)||(i.push(M),a=M)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let i=0,a=t.curves.length;i<a;i++){const l=t.curves[i];this.curves.push(l.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let i=0,a=this.curves.length;i<a;i++){const l=this.curves[i];t.curves.push(l.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let i=0,a=t.curves.length;i<a;i++){const l=t.curves[i];this.curves.push(new $a[l.type]().fromJSON(l))}return this}}class rc extends Cm{constructor(t){super(),this.type="Path",this.currentPoint=new He,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let i=1,a=t.length;i<a;i++)this.lineTo(t[i].x,t[i].y);return this}moveTo(t,i){return this.currentPoint.set(t,i),this}lineTo(t,i){const a=new Bu(this.currentPoint.clone(),new He(t,i));return this.curves.push(a),this.currentPoint.set(t,i),this}quadraticCurveTo(t,i,a,l){const d=new ru(this.currentPoint.clone(),new He(t,i),new He(a,l));return this.curves.push(d),this.currentPoint.set(a,l),this}bezierCurveTo(t,i,a,l,d,p){const v=new va(this.currentPoint.clone(),new He(t,i),new He(a,l),new He(d,p));return this.curves.push(v),this.currentPoint.set(d,p),this}splineThru(t){const i=[this.currentPoint.clone()].concat(t),a=new iu(i);return this.curves.push(a),this.currentPoint.copy(t[t.length-1]),this}arc(t,i,a,l,d,p){const v=this.currentPoint.x,_=this.currentPoint.y;return this.absarc(t+v,i+_,a,l,d,p),this}absarc(t,i,a,l,d,p){return this.absellipse(t,i,a,a,l,d,p),this}ellipse(t,i,a,l,d,p,v,_){const x=this.currentPoint.x,M=this.currentPoint.y;return this.absellipse(t+x,i+M,a,l,d,p,v,_),this}absellipse(t,i,a,l,d,p,v,_){const x=new lr(t,i,a,l,d,p,v,_);if(this.curves.length>0){const C=x.getPoint(0);C.equals(this.currentPoint)||this.lineTo(C.x,C.y)}this.curves.push(x);const M=x.getPoint(1);return this.currentPoint.copy(M),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class ju extends rc{constructor(t){super(t),this.uuid=No(),this.type="Shape",this.holes=[]}getPointsHoles(t){const i=[];for(let a=0,l=this.holes.length;a<l;a++)i[a]=this.holes[a].getPoints(t);return i}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let i=0,a=t.holes.length;i<a;i++){const l=t.holes[i];this.holes.push(l.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let i=0,a=this.holes.length;i<a;i++){const l=this.holes[i];t.holes.push(l.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let i=0,a=t.holes.length;i<a;i++){const l=t.holes[i];this.holes.push(new rc().fromJSON(l))}return this}}class wa extends ar{constructor(t,i=1){super(),this.type="Light",this.color=new pn(t),this.intensity=i}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const i=super.toJSON(t);return i.object.color=this.color.getHex(),i.object.intensity=this.intensity,this.groundColor!==void 0&&(i.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(i.object.distance=this.distance),this.angle!==void 0&&(i.object.angle=this.angle),this.decay!==void 0&&(i.object.decay=this.decay),this.penumbra!==void 0&&(i.object.penumbra=this.penumbra),this.shadow!==void 0&&(i.object.shadow=this.shadow.toJSON()),i}}wa.prototype.isLight=!0;class sf extends wa{constructor(t,i,a){super(t,a),this.type="HemisphereLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.groundColor=new pn(i)}copy(t){return wa.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}sf.prototype.isHemisphereLight=!0;const af=new En,lf=new gt,Hf=new gt;class zf{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new He(512,512),this.map=null,this.mapPass=null,this.matrix=new En,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ja,this._frameExtents=new He(1,1),this._viewportCount=1,this._viewports=[new Ir(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const i=this.camera,a=this.matrix;lf.setFromMatrixPosition(t.matrixWorld),i.position.copy(lf),Hf.setFromMatrixPosition(t.target.matrixWorld),i.lookAt(Hf),i.updateMatrixWorld(),af.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(af),a.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),a.multiply(i.projectionMatrix),a.multiply(i.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),this.mapSize.x===512&&this.mapSize.y===512||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Pm extends zf{constructor(){super(new Yi(50,1,.5,500)),this.focus=1}updateMatrices(t){const i=this.camera,a=2*na*t.angle*this.focus,l=this.mapSize.width/this.mapSize.height,d=t.distance||i.far;a===i.fov&&l===i.aspect&&d===i.far||(i.fov=a,i.aspect=l,i.far=d,i.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}Pm.prototype.isSpotLightShadow=!0;class ad extends wa{constructor(t,i,a=0,l=Math.PI/3,d=0,p=1){super(t,i),this.type="SpotLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.target=new ar,this.distance=a,this.angle=l,this.penumbra=d,this.decay=p,this.shadow=new Pm}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}ad.prototype.isSpotLight=!0;const jf=new En,Vu=new gt,Vf=new gt;class Rm extends zf{constructor(){super(new Yi(90,1,.5,500)),this._frameExtents=new He(4,2),this._viewportCount=6,this._viewports=[new Ir(2,1,1,1),new Ir(0,1,1,1),new Ir(3,1,1,1),new Ir(1,1,1,1),new Ir(3,0,1,1),new Ir(1,0,1,1)],this._cubeDirections=[new gt(1,0,0),new gt(-1,0,0),new gt(0,0,1),new gt(0,0,-1),new gt(0,1,0),new gt(0,-1,0)],this._cubeUps=[new gt(0,1,0),new gt(0,1,0),new gt(0,1,0),new gt(0,1,0),new gt(0,0,1),new gt(0,0,-1)]}updateMatrices(t,i=0){const a=this.camera,l=this.matrix,d=t.distance||a.far;d!==a.far&&(a.far=d,a.updateProjectionMatrix()),Vu.setFromMatrixPosition(t.matrixWorld),a.position.copy(Vu),Vf.copy(a.position),Vf.add(this._cubeDirections[i]),a.up.copy(this._cubeUps[i]),a.lookAt(Vf),a.updateMatrixWorld(),l.makeTranslation(-Vu.x,-Vu.y,-Vu.z),jf.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jf)}}Rm.prototype.isPointLightShadow=!0;class Wf extends wa{constructor(t,i,a=0,l=1){super(t,i),this.type="PointLight",this.distance=a,this.decay=l,this.shadow=new Rm}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}Wf.prototype.isPointLight=!0;class sp extends jl{constructor(t=-1,i=1,a=1,l=-1,d=.1,p=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=i,this.top=a,this.bottom=l,this.near=d,this.far=p,this.updateProjectionMatrix()}copy(t,i){return super.copy(t,i),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,i,a,l,d,p){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=i,this.view.offsetX=a,this.view.offsetY=l,this.view.width=d,this.view.height=p,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),i=(this.top-this.bottom)/(2*this.zoom),a=(this.right+this.left)/2,l=(this.top+this.bottom)/2;let d=a-t,p=a+t,v=l+i,_=l-i;if(this.view!==null&&this.view.enabled){const x=(this.right-this.left)/this.view.fullWidth/this.zoom,M=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d+=x*this.view.offsetX,p=d+x*this.view.width,v-=M*this.view.offsetY,_=v-M*this.view.height}this.projectionMatrix.makeOrthographic(d,p,v,_,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const i=super.toJSON(t);return i.object.zoom=this.zoom,i.object.left=this.left,i.object.right=this.right,i.object.top=this.top,i.object.bottom=this.bottom,i.object.near=this.near,i.object.far=this.far,this.view!==null&&(i.object.view=Object.assign({},this.view)),i}}sp.prototype.isOrthographicCamera=!0;class Im extends zf{constructor(){super(new sp(-5,5,5,-5,.5,500))}}Im.prototype.isDirectionalLightShadow=!0;class Wu extends wa{constructor(t,i){super(t,i),this.type="DirectionalLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.target=new ar,this.shadow=new Im}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Wu.prototype.isDirectionalLight=!0;class uf extends wa{constructor(t,i){super(t,i),this.type="AmbientLight"}}uf.prototype.isAmbientLight=!0;class ic extends wa{constructor(t,i,a=10,l=10){super(t,i),this.type="RectAreaLight",this.width=a,this.height=l}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const i=super.toJSON(t);return i.object.width=this.width,i.object.height=this.height,i}}ic.prototype.isRectAreaLight=!0;class Re{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new gt)}set(t){for(let i=0;i<9;i++)this.coefficients[i].copy(t[i]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,i){const a=t.x,l=t.y,d=t.z,p=this.coefficients;return i.copy(p[0]).multiplyScalar(.282095),i.addScaledVector(p[1],.488603*l),i.addScaledVector(p[2],.488603*d),i.addScaledVector(p[3],.488603*a),i.addScaledVector(p[4],a*l*1.092548),i.addScaledVector(p[5],l*d*1.092548),i.addScaledVector(p[6],.315392*(3*d*d-1)),i.addScaledVector(p[7],a*d*1.092548),i.addScaledVector(p[8],.546274*(a*a-l*l)),i}getIrradianceAt(t,i){const a=t.x,l=t.y,d=t.z,p=this.coefficients;return i.copy(p[0]).multiplyScalar(.886227),i.addScaledVector(p[1],1.023328*l),i.addScaledVector(p[2],1.023328*d),i.addScaledVector(p[3],1.023328*a),i.addScaledVector(p[4],.858086*a*l),i.addScaledVector(p[5],.858086*l*d),i.addScaledVector(p[6],.743125*d*d-.247708),i.addScaledVector(p[7],.858086*a*d),i.addScaledVector(p[8],.429043*(a*a-l*l)),i}add(t){for(let i=0;i<9;i++)this.coefficients[i].add(t.coefficients[i]);return this}addScaledSH(t,i){for(let a=0;a<9;a++)this.coefficients[a].addScaledVector(t.coefficients[a],i);return this}scale(t){for(let i=0;i<9;i++)this.coefficients[i].multiplyScalar(t);return this}lerp(t,i){for(let a=0;a<9;a++)this.coefficients[a].lerp(t.coefficients[a],i);return this}equals(t){for(let i=0;i<9;i++)if(!this.coefficients[i].equals(t.coefficients[i]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,i=0){const a=this.coefficients;for(let l=0;l<9;l++)a[l].fromArray(t,i+3*l);return this}toArray(t=[],i=0){const a=this.coefficients;for(let l=0;l<9;l++)a[l].toArray(t,i+3*l);return t}static getBasisAt(t,i){const a=t.x,l=t.y,d=t.z;i[0]=.282095,i[1]=.488603*l,i[2]=.488603*d,i[3]=.488603*a,i[4]=1.092548*a*l,i[5]=1.092548*l*d,i[6]=.315392*(3*d*d-1),i[7]=1.092548*a*d,i[8]=.546274*(a*a-l*l)}}Re.prototype.isSphericalHarmonics3=!0;class ap extends wa{constructor(t=new Re,i=1){super(void 0,i),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const i=super.toJSON(t);return i.object.sh=this.sh.toArray(),i}}ap.prototype.isLightProbe=!0;class ld extends Wo{constructor(t){super(t),this.textures={}}load(t,i,a,l){const d=this,p=new ba(d.manager);p.setPath(d.path),p.setRequestHeader(d.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i=this.textures;function a(d){return i[d]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",d),i[d]}const l=new Pn[t.type];if(t.uuid!==void 0&&(l.uuid=t.uuid),t.name!==void 0&&(l.name=t.name),t.color!==void 0&&l.color!==void 0&&l.color.setHex(t.color),t.roughness!==void 0&&(l.roughness=t.roughness),t.metalness!==void 0&&(l.metalness=t.metalness),t.sheen!==void 0&&(l.sheen=new pn().setHex(t.sheen)),t.emissive!==void 0&&l.emissive!==void 0&&l.emissive.setHex(t.emissive),t.specular!==void 0&&l.specular!==void 0&&l.specular.setHex(t.specular),t.shininess!==void 0&&(l.shininess=t.shininess),t.clearcoat!==void 0&&(l.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(l.clearcoatRoughness=t.clearcoatRoughness),t.transmission!==void 0&&(l.transmission=t.transmission),t.thickness!==void 0&&(l.thickness=t.thickness),t.attenuationDistance!==void 0&&(l.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&l.attenuationColor!==void 0&&l.attenuationColor.setHex(t.attenuationColor),t.fog!==void 0&&(l.fog=t.fog),t.flatShading!==void 0&&(l.flatShading=t.flatShading),t.blending!==void 0&&(l.blending=t.blending),t.combine!==void 0&&(l.combine=t.combine),t.side!==void 0&&(l.side=t.side),t.shadowSide!==void 0&&(l.shadowSide=t.shadowSide),t.opacity!==void 0&&(l.opacity=t.opacity),t.transparent!==void 0&&(l.transparent=t.transparent),t.alphaTest!==void 0&&(l.alphaTest=t.alphaTest),t.depthTest!==void 0&&(l.depthTest=t.depthTest),t.depthWrite!==void 0&&(l.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(l.colorWrite=t.colorWrite),t.stencilWrite!==void 0&&(l.stencilWrite=t.stencilWrite),t.stencilWriteMask!==void 0&&(l.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(l.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(l.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(l.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(l.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(l.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(l.stencilZPass=t.stencilZPass),t.wireframe!==void 0&&(l.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(l.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(l.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(l.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(l.rotation=t.rotation),t.linewidth!==1&&(l.linewidth=t.linewidth),t.dashSize!==void 0&&(l.dashSize=t.dashSize),t.gapSize!==void 0&&(l.gapSize=t.gapSize),t.scale!==void 0&&(l.scale=t.scale),t.polygonOffset!==void 0&&(l.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(l.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(l.polygonOffsetUnits=t.polygonOffsetUnits),t.morphTargets!==void 0&&(l.morphTargets=t.morphTargets),t.morphNormals!==void 0&&(l.morphNormals=t.morphNormals),t.dithering!==void 0&&(l.dithering=t.dithering),t.alphaToCoverage!==void 0&&(l.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(l.premultipliedAlpha=t.premultipliedAlpha),t.vertexTangents!==void 0&&(l.vertexTangents=t.vertexTangents),t.visible!==void 0&&(l.visible=t.visible),t.toneMapped!==void 0&&(l.toneMapped=t.toneMapped),t.userData!==void 0&&(l.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?l.vertexColors=t.vertexColors>0:l.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const d in t.uniforms){const p=t.uniforms[d];switch(l.uniforms[d]={},p.type){case"t":l.uniforms[d].value=a(p.value);break;case"c":l.uniforms[d].value=new pn().setHex(p.value);break;case"v2":l.uniforms[d].value=new He().fromArray(p.value);break;case"v3":l.uniforms[d].value=new gt().fromArray(p.value);break;case"v4":l.uniforms[d].value=new Ir().fromArray(p.value);break;case"m3":l.uniforms[d].value=new ji().fromArray(p.value);break;case"m4":l.uniforms[d].value=new En().fromArray(p.value);break;default:l.uniforms[d].value=p.value}}if(t.defines!==void 0&&(l.defines=t.defines),t.vertexShader!==void 0&&(l.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(l.fragmentShader=t.fragmentShader),t.extensions!==void 0)for(const d in t.extensions)l.extensions[d]=t.extensions[d];if(t.shading!==void 0&&(l.flatShading=t.shading===1),t.size!==void 0&&(l.size=t.size),t.sizeAttenuation!==void 0&&(l.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(l.map=a(t.map)),t.matcap!==void 0&&(l.matcap=a(t.matcap)),t.alphaMap!==void 0&&(l.alphaMap=a(t.alphaMap)),t.bumpMap!==void 0&&(l.bumpMap=a(t.bumpMap)),t.bumpScale!==void 0&&(l.bumpScale=t.bumpScale),t.normalMap!==void 0&&(l.normalMap=a(t.normalMap)),t.normalMapType!==void 0&&(l.normalMapType=t.normalMapType),t.normalScale!==void 0){let d=t.normalScale;Array.isArray(d)===!1&&(d=[d,d]),l.normalScale=new He().fromArray(d)}return t.displacementMap!==void 0&&(l.displacementMap=a(t.displacementMap)),t.displacementScale!==void 0&&(l.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(l.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(l.roughnessMap=a(t.roughnessMap)),t.metalnessMap!==void 0&&(l.metalnessMap=a(t.metalnessMap)),t.emissiveMap!==void 0&&(l.emissiveMap=a(t.emissiveMap)),t.emissiveIntensity!==void 0&&(l.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(l.specularMap=a(t.specularMap)),t.envMap!==void 0&&(l.envMap=a(t.envMap)),t.envMapIntensity!==void 0&&(l.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(l.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(l.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(l.lightMap=a(t.lightMap)),t.lightMapIntensity!==void 0&&(l.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(l.aoMap=a(t.aoMap)),t.aoMapIntensity!==void 0&&(l.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(l.gradientMap=a(t.gradientMap)),t.clearcoatMap!==void 0&&(l.clearcoatMap=a(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(l.clearcoatRoughnessMap=a(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(l.clearcoatNormalMap=a(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(l.clearcoatNormalScale=new He().fromArray(t.clearcoatNormalScale)),t.transmissionMap!==void 0&&(l.transmissionMap=a(t.transmissionMap)),t.thicknessMap!==void 0&&(l.thicknessMap=a(t.thicknessMap)),l}setTextures(t){return this.textures=t,this}}class oc{static decodeText(t){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(t);let i="";for(let a=0,l=t.length;a<l;a++)i+=String.fromCharCode(t[a]);try{return decodeURIComponent(escape(i))}catch{return i}}static extractUrlBase(t){const i=t.lastIndexOf("/");return i===-1?"./":t.substr(0,i+1)}}class lp extends zn{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}lp.prototype.isInstancedBufferGeometry=!0;class hf extends Kn{constructor(t,i,a,l=1){typeof a=="number"&&(l=a,a=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,i,a),this.meshPerAttribute=l}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}hf.prototype.isInstancedBufferAttribute=!0;class up extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new ba(d.manager);p.setPath(d.path),p.setRequestHeader(d.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i={},a={};function l(C,A){if(i[A]!==void 0)return i[A];const R=C.interleavedBuffers[A],O=function(Z,ot){if(a[ot]!==void 0)return a[ot];const vt=Z.arrayBuffers[ot],mt=new Uint32Array(vt).buffer;return a[ot]=mt,mt}(C,R.buffer),U=Si(R.type,O),D=new _l(U,R.stride);return D.uuid=R.uuid,i[A]=D,D}const d=t.isInstancedBufferGeometry?new lp:new zn,p=t.data.index;if(p!==void 0){const C=Si(p.type,p.array);d.setIndex(new Kn(C,1))}const v=t.data.attributes;for(const C in v){const A=v[C];let R;if(A.isInterleavedBufferAttribute){const O=l(t.data,A.data);R=new ri(O,A.itemSize,A.offset,A.normalized)}else{const O=Si(A.type,A.array);R=new(A.isInstancedBufferAttribute?hf:Kn)(O,A.itemSize,A.normalized)}A.name!==void 0&&(R.name=A.name),A.usage!==void 0&&R.setUsage(A.usage),A.updateRange!==void 0&&(R.updateRange.offset=A.updateRange.offset,R.updateRange.count=A.updateRange.count),d.setAttribute(C,R)}const _=t.data.morphAttributes;if(_)for(const C in _){const A=_[C],R=[];for(let O=0,U=A.length;O<U;O++){const D=A[O];let Z;if(D.isInterleavedBufferAttribute){const ot=l(t.data,D.data);Z=new ri(ot,D.itemSize,D.offset,D.normalized)}else{const ot=Si(D.type,D.array);Z=new Kn(ot,D.itemSize,D.normalized)}D.name!==void 0&&(Z.name=D.name),R.push(Z)}d.morphAttributes[C]=R}t.data.morphTargetsRelative&&(d.morphTargetsRelative=!0);const x=t.data.groups||t.data.drawcalls||t.data.offsets;if(x!==void 0)for(let C=0,A=x.length;C!==A;++C){const R=x[C];d.addGroup(R.start,R.count,R.materialIndex)}const M=t.data.boundingSphere;if(M!==void 0){const C=new gt;M.center!==void 0&&C.fromArray(M.center),d.boundingSphere=new bs(C,M.radius)}return t.name&&(d.name=t.name),t.userData&&(d.userData=t.userData),d}}class lg extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=this.path===""?oc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||p;const v=new ba(this.manager);v.setPath(this.path),v.setRequestHeader(this.requestHeader),v.setWithCredentials(this.withCredentials),v.load(t,function(_){let x=null;try{x=JSON.parse(_)}catch(C){return l!==void 0&&l(C),void console.error("THREE:ObjectLoader: Can't parse "+t+".",C.message)}const M=x.metadata;M!==void 0&&M.type!==void 0&&M.type.toLowerCase()!=="geometry"?d.parse(x,i):console.error("THREE.ObjectLoader: Can't load "+t)},a,l)}async loadAsync(t,i){const a=this.path===""?oc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;const l=new ba(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials);const d=await l.loadAsync(t,i),p=JSON.parse(d),v=p.metadata;if(v===void 0||v.type===void 0||v.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(p)}parse(t,i){const a=this.parseAnimations(t.animations),l=this.parseShapes(t.shapes),d=this.parseGeometries(t.geometries,l),p=this.parseImages(t.images,function(){i!==void 0&&i(x)}),v=this.parseTextures(t.textures,p),_=this.parseMaterials(t.materials,v),x=this.parseObject(t.object,d,_,v,a),M=this.parseSkeletons(t.skeletons,x);if(this.bindSkeletons(x,M),i!==void 0){let C=!1;for(const A in p)if(p[A]instanceof HTMLImageElement){C=!0;break}C===!1&&i(x)}return x}async parseAsync(t){const i=this.parseAnimations(t.animations),a=this.parseShapes(t.shapes),l=this.parseGeometries(t.geometries,a),d=await this.parseImagesAsync(t.images),p=this.parseTextures(t.textures,d),v=this.parseMaterials(t.materials,p),_=this.parseObject(t.object,l,v,p,i),x=this.parseSkeletons(t.skeletons,_);return this.bindSkeletons(_,x),_}parseShapes(t){const i={};if(t!==void 0)for(let a=0,l=t.length;a<l;a++){const d=new ju().fromJSON(t[a]);i[d.uuid]=d}return i}parseSkeletons(t,i){const a={},l={};if(i.traverse(function(d){d.isBone&&(l[d.uuid]=d)}),t!==void 0)for(let d=0,p=t.length;d<p;d++){const v=new Fu().fromJSON(t[d],l);a[v.uuid]=v}return a}parseGeometries(t,i){const a={};if(t!==void 0){const l=new up;for(let d=0,p=t.length;d<p;d++){let v;const _=t[d];switch(_.type){case"BufferGeometry":case"InstancedBufferGeometry":v=l.parse(_);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:_.type in Em?v=Em[_.type].fromJSON(_,i):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${_.type}"`)}v.uuid=_.uuid,_.name!==void 0&&(v.name=_.name),v.isBufferGeometry===!0&&_.userData!==void 0&&(v.userData=_.userData),a[_.uuid]=v}}return a}parseMaterials(t,i){const a={},l={};if(t!==void 0){const d=new ld;d.setTextures(i);for(let p=0,v=t.length;p<v;p++){const _=t[p];if(_.type==="MultiMaterial"){const x=[];for(let M=0;M<_.materials.length;M++){const C=_.materials[M];a[C.uuid]===void 0&&(a[C.uuid]=d.parse(C)),x.push(a[C.uuid])}l[_.uuid]=x}else a[_.uuid]===void 0&&(a[_.uuid]=d.parse(_)),l[_.uuid]=a[_.uuid]}}return l}parseAnimations(t){const i={};if(t!==void 0)for(let a=0;a<t.length;a++){const l=t[a],d=sd.parse(l);i[d.uuid]=d}return i}parseImages(t,i){const a=this,l={};let d;function p(v){if(typeof v=="string"){const _=v;return function(x){return a.manager.itemStart(x),d.load(x,function(){a.manager.itemEnd(x)},void 0,function(){a.manager.itemError(x),a.manager.itemEnd(x)})}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(_)?_:a.resourcePath+_)}return v.data?{data:Si(v.type,v.data),width:v.width,height:v.height}:null}if(t!==void 0&&t.length>0){const v=new ya(i);d=new op(v),d.setCrossOrigin(this.crossOrigin);for(let _=0,x=t.length;_<x;_++){const M=t[_],C=M.url;if(Array.isArray(C)){l[M.uuid]=[];for(let A=0,R=C.length;A<R;A++){const O=p(C[A]);O!==null&&(O instanceof HTMLImageElement?l[M.uuid].push(O):l[M.uuid].push(new Is(O.data,O.width,O.height)))}}else{const A=p(M.url);A!==null&&(l[M.uuid]=A)}}}return l}async parseImagesAsync(t){const i=this,a={};let l;async function d(p){if(typeof p=="string"){const v=p,_=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(v)?v:i.resourcePath+v;return await l.loadAsync(_)}return p.data?{data:Si(p.type,p.data),width:p.width,height:p.height}:null}if(t!==void 0&&t.length>0){l=new op(this.manager),l.setCrossOrigin(this.crossOrigin);for(let p=0,v=t.length;p<v;p++){const _=t[p],x=_.url;if(Array.isArray(x)){a[_.uuid]=[];for(let M=0,C=x.length;M<C;M++){const A=x[M],R=await d(A);R!==null&&(R instanceof HTMLImageElement?a[_.uuid].push(R):a[_.uuid].push(new Is(R.data,R.width,R.height)))}}else{const M=await d(_.url);M!==null&&(a[_.uuid]=M)}}}return a}parseTextures(t,i){function a(d,p){return typeof d=="number"?d:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",d),p[d])}const l={};if(t!==void 0)for(let d=0,p=t.length;d<p;d++){const v=t[d];let _;v.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',v.uuid),i[v.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",v.image);const x=i[v.image];Array.isArray(x)?(_=new Vl(x),x.length===6&&(_.needsUpdate=!0)):(_=x&&x.data?new Is(x.data,x.width,x.height):new ni(x),x&&(_.needsUpdate=!0)),_.uuid=v.uuid,v.name!==void 0&&(_.name=v.name),v.mapping!==void 0&&(_.mapping=a(v.mapping,tl)),v.offset!==void 0&&_.offset.fromArray(v.offset),v.repeat!==void 0&&_.repeat.fromArray(v.repeat),v.center!==void 0&&_.center.fromArray(v.center),v.rotation!==void 0&&(_.rotation=v.rotation),v.wrap!==void 0&&(_.wrapS=a(v.wrap[0],Sa),_.wrapT=a(v.wrap[1],Sa)),v.format!==void 0&&(_.format=v.format),v.type!==void 0&&(_.type=v.type),v.encoding!==void 0&&(_.encoding=v.encoding),v.minFilter!==void 0&&(_.minFilter=a(v.minFilter,ou)),v.magFilter!==void 0&&(_.magFilter=a(v.magFilter,ou)),v.anisotropy!==void 0&&(_.anisotropy=v.anisotropy),v.flipY!==void 0&&(_.flipY=v.flipY),v.premultiplyAlpha!==void 0&&(_.premultiplyAlpha=v.premultiplyAlpha),v.unpackAlignment!==void 0&&(_.unpackAlignment=v.unpackAlignment),l[v.uuid]=_}return l}parseObject(t,i,a,l,d){let p,v,_;function x(A){return i[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",A),i[A]}function M(A){if(A!==void 0){if(Array.isArray(A)){const R=[];for(let O=0,U=A.length;O<U;O++){const D=A[O];a[D]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",D),R.push(a[D])}return R}return a[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",A),a[A]}}function C(A){return l[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",A),l[A]}switch(t.type){case"Scene":p=new Fh,t.background!==void 0&&(Number.isInteger(t.background)?p.background=new pn(t.background):p.background=C(t.background)),t.environment!==void 0&&(p.environment=C(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?p.fog=new tu(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(p.fog=new Ql(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":p=new Yi(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(p.focus=t.focus),t.zoom!==void 0&&(p.zoom=t.zoom),t.filmGauge!==void 0&&(p.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(p.filmOffset=t.filmOffset),t.view!==void 0&&(p.view=Object.assign({},t.view));break;case"OrthographicCamera":p=new sp(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(p.zoom=t.zoom),t.view!==void 0&&(p.view=Object.assign({},t.view));break;case"AmbientLight":p=new uf(t.color,t.intensity);break;case"DirectionalLight":p=new Wu(t.color,t.intensity);break;case"PointLight":p=new Wf(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":p=new ic(t.color,t.intensity,t.width,t.height);break;case"SpotLight":p=new ad(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":p=new sf(t.color,t.groundColor,t.intensity);break;case"LightProbe":p=new ap().fromJSON(t);break;case"SkinnedMesh":v=x(t.geometry),_=M(t.material),p=new jc(v,_),t.bindMode!==void 0&&(p.bindMode=t.bindMode),t.bindMatrix!==void 0&&p.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(p.skeleton=t.skeleton);break;case"Mesh":v=x(t.geometry),_=M(t.material),p=new Bi(v,_);break;case"InstancedMesh":v=x(t.geometry),_=M(t.material);const A=t.count,R=t.instanceMatrix,O=t.instanceColor;p=new qc(v,_,A),p.instanceMatrix=new Kn(new Float32Array(R.array),16),O!==void 0&&(p.instanceColor=new Kn(new Float32Array(O.array),O.itemSize));break;case"LOD":p=new Gh;break;case"Line":p=new Ya(x(t.geometry),M(t.material));break;case"LineLoop":p=new nu(x(t.geometry),M(t.material));break;case"LineSegments":p=new io(x(t.geometry),M(t.material));break;case"PointCloud":case"Points":p=new q(x(t.geometry),M(t.material));break;case"Sprite":p=new Du(M(t.material));break;case"Group":p=new vl;break;case"Bone":p=new no;break;default:p=new ar}if(p.uuid=t.uuid,t.name!==void 0&&(p.name=t.name),t.matrix!==void 0?(p.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(p.matrixAutoUpdate=t.matrixAutoUpdate),p.matrixAutoUpdate&&p.matrix.decompose(p.position,p.quaternion,p.scale)):(t.position!==void 0&&p.position.fromArray(t.position),t.rotation!==void 0&&p.rotation.fromArray(t.rotation),t.quaternion!==void 0&&p.quaternion.fromArray(t.quaternion),t.scale!==void 0&&p.scale.fromArray(t.scale)),t.castShadow!==void 0&&(p.castShadow=t.castShadow),t.receiveShadow!==void 0&&(p.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.bias!==void 0&&(p.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(p.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(p.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&p.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(p.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(p.visible=t.visible),t.frustumCulled!==void 0&&(p.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(p.renderOrder=t.renderOrder),t.userData!==void 0&&(p.userData=t.userData),t.layers!==void 0&&(p.layers.mask=t.layers),t.children!==void 0){const A=t.children;for(let R=0;R<A.length;R++)p.add(this.parseObject(A[R],i,a,l,d))}if(t.animations!==void 0){const A=t.animations;for(let R=0;R<A.length;R++){const O=A[R];p.animations.push(d[O])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(p.autoUpdate=t.autoUpdate);const A=t.levels;for(let R=0;R<A.length;R++){const O=A[R],U=p.getObjectByProperty("uuid",O.object);U!==void 0&&p.addLevel(U,O.distance)}}return p}bindSkeletons(t,i){Object.keys(i).length!==0&&t.traverse(function(a){if(a.isSkinnedMesh===!0&&a.skeleton!==void 0){const l=i[a.skeleton];l===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",a.skeleton):a.bind(l,a.bindMatrix)}})}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}const tl={UVMapping:ao,CubeReflectionMapping:I,CubeRefractionMapping:z,EquirectangularReflectionMapping:H,EquirectangularRefractionMapping:at,CubeUVReflectionMapping:nt,CubeUVRefractionMapping:it},Sa={RepeatWrapping:yt,ClampToEdgeWrapping:St,MirroredRepeatWrapping:Ct},ou={NearestFilter:wt,NearestMipmapNearestFilter:Vt,NearestMipmapLinearFilter:Le,LinearFilter:Qe,LinearMipmapNearestFilter:Qn,LinearMipmapLinearFilter:Yr};class su extends Wo{constructor(t){super(t),typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,i,a,l){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=ec.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;const v={};v.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",v.headers=this.requestHeader,fetch(t,v).then(function(_){return _.blob()}).then(function(_){return createImageBitmap(_,Object.assign(d.options,{colorSpaceConversion:"none"}))}).then(function(_){ec.add(t,_),i&&i(_),d.manager.itemEnd(t)}).catch(function(_){l&&l(_),d.manager.itemError(t),d.manager.itemEnd(t)}),d.manager.itemStart(t)}}su.prototype.isImageBitmapLoader=!0;class au{constructor(){this.type="ShapePath",this.color=new pn,this.subPaths=[],this.currentPath=null}moveTo(t,i){return this.currentPath=new rc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,i),this}lineTo(t,i){return this.currentPath.lineTo(t,i),this}quadraticCurveTo(t,i,a,l){return this.currentPath.quadraticCurveTo(t,i,a,l),this}bezierCurveTo(t,i,a,l,d,p){return this.currentPath.bezierCurveTo(t,i,a,l,d,p),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,i){function a(ot){const vt=[];for(let mt=0,At=ot.length;mt<At;mt++){const Pt=ot[mt],Et=new ju;Et.curves=Pt.curves,vt.push(Et)}return vt}function l(ot,vt){const mt=vt.length;let At=!1;for(let Pt=mt-1,Et=0;Et<mt;Pt=Et++){let Ot=vt[Pt],Ie=vt[Et],ye=Ie.x-Ot.x,xe=Ie.y-Ot.y;if(Math.abs(xe)>Number.EPSILON){if(xe<0&&(Ot=vt[Et],ye=-ye,Ie=vt[Pt],xe=-xe),ot.y<Ot.y||ot.y>Ie.y)continue;if(ot.y===Ot.y){if(ot.x===Ot.x)return!0}else{const ge=xe*(ot.x-Ot.x)-ye*(ot.y-Ot.y);if(ge===0)return!0;if(ge<0)continue;At=!At}}else{if(ot.y!==Ot.y)continue;if(Ie.x<=ot.x&&ot.x<=Ot.x||Ot.x<=ot.x&&ot.x<=Ie.x)return!0}}return At}const d=Os.isClockWise,p=this.subPaths;if(p.length===0)return[];if(i===!0)return a(p);let v,_,x;const M=[];if(p.length===1)return _=p[0],x=new ju,x.curves=_.curves,M.push(x),M;let C=!d(p[0].getPoints());C=t?!C:C;const A=[],R=[];let O,U,D=[],Z=0;R[Z]=void 0,D[Z]=[];for(let ot=0,vt=p.length;ot<vt;ot++)_=p[ot],O=_.getPoints(),v=d(O),v=t?!v:v,v?(!C&&R[Z]&&Z++,R[Z]={s:new ju,p:O},R[Z].s.curves=_.curves,C&&Z++,D[Z]=[]):D[Z].push({h:_,p:O[0]});if(!R[0])return a(p);if(R.length>1){let ot=!1;const vt=[];for(let mt=0,At=R.length;mt<At;mt++)A[mt]=[];for(let mt=0,At=R.length;mt<At;mt++){const Pt=D[mt];for(let Et=0;Et<Pt.length;Et++){const Ot=Pt[Et];let Ie=!0;for(let ye=0;ye<R.length;ye++)l(Ot.p,R[ye].p)&&(mt!==ye&&vt.push({froms:mt,tos:ye,hole:Et}),Ie?(Ie=!1,A[ye].push(Ot)):ot=!0);Ie&&A[mt].push(Ot)}}vt.length>0&&(ot||(D=A))}for(let ot=0,vt=R.length;ot<vt;ot++){x=R[ot].s,M.push(x),U=D[ot];for(let mt=0,At=U.length;mt<At;mt++)x.holes.push(U[mt].h)}return M}}class oo{constructor(t){this.type="Font",this.data=t}generateShapes(t,i=100){const a=[],l=function(d,p,v){const _=Array.from(d),x=p/v.resolution,M=(v.boundingBox.yMax-v.boundingBox.yMin+v.underlineThickness)*x,C=[];let A=0,R=0;for(let O=0;O<_.length;O++){const U=_[O];if(U===`
2923
- `)A=0,R-=M;else{const D=Xf(U,x,A,R,v);A+=D.offsetX,C.push(D.path)}}return C}(t,i,this.data);for(let d=0,p=l.length;d<p;d++)Array.prototype.push.apply(a,l[d].toShapes());return a}}function Xf(m,t,i,a,l){const d=l.glyphs[m]||l.glyphs["?"];if(!d)return void console.error('THREE.Font: character "'+m+'" does not exists in font family '+l.familyName+".");const p=new au;let v,_,x,M,C,A,R,O;if(d.o){const U=d._cachedOutline||(d._cachedOutline=d.o.split(" "));for(let D=0,Z=U.length;D<Z;)switch(U[D++]){case"m":v=U[D++]*t+i,_=U[D++]*t+a,p.moveTo(v,_);break;case"l":v=U[D++]*t+i,_=U[D++]*t+a,p.lineTo(v,_);break;case"q":x=U[D++]*t+i,M=U[D++]*t+a,C=U[D++]*t+i,A=U[D++]*t+a,p.quadraticCurveTo(C,A,x,M);break;case"b":x=U[D++]*t+i,M=U[D++]*t+a,C=U[D++]*t+i,A=U[D++]*t+a,R=U[D++]*t+i,O=U[D++]*t+a,p.bezierCurveTo(C,A,R,O,x,M)}}return{offsetX:d.ha*t,path:p}}oo.prototype.isFont=!0;class qf extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new ba(this.manager);p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){let _;try{_=JSON.parse(v)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),_=JSON.parse(v.substring(65,v.length-2))}const x=d.parse(_);i&&i(x)},a,l)}parse(t){return new oo(t)}}let wl;const cf={getContext:function(){return wl===void 0&&(wl=new(window.AudioContext||window.webkitAudioContext)),wl},setContext:function(m){wl=m}};class Lm extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new ba(this.manager);p.setResponseType("arraybuffer"),p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(this.withCredentials),p.load(t,function(v){try{const _=v.slice(0);cf.getContext().decodeAudioData(_,function(x){i(x)})}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}}class el extends ap{constructor(t,i,a=1){super(void 0,a);const l=new pn().set(t),d=new pn().set(i),p=new gt(l.r,l.g,l.b),v=new gt(d.r,d.g,d.b),_=Math.sqrt(Math.PI),x=_*Math.sqrt(.75);this.sh.coefficients[0].copy(p).add(v).multiplyScalar(_),this.sh.coefficients[1].copy(p).sub(v).multiplyScalar(x)}}el.prototype.isHemisphereLightProbe=!0;class re extends ap{constructor(t,i=1){super(void 0,i);const a=new pn().set(t);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}}re.prototype.isAmbientLightProbe=!0;const Yf=new En,Om=new En;class ug{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Yi,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Yi,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const i=this._cache;if(i.focus!==t.focus||i.fov!==t.fov||i.aspect!==t.aspect*this.aspect||i.near!==t.near||i.far!==t.far||i.zoom!==t.zoom||i.eyeSep!==this.eyeSep){i.focus=t.focus,i.fov=t.fov,i.aspect=t.aspect*this.aspect,i.near=t.near,i.far=t.far,i.zoom=t.zoom,i.eyeSep=this.eyeSep;const a=t.projectionMatrix.clone(),l=i.eyeSep/2,d=l*i.near/i.focus,p=i.near*Math.tan(ea*i.fov*.5)/i.zoom;let v,_;Om.elements[12]=-l,Yf.elements[12]=l,v=-p*i.aspect+d,_=p*i.aspect+d,a.elements[0]=2*i.near/(_-v),a.elements[8]=(_+v)/(_-v),this.cameraL.projectionMatrix.copy(a),v=-p*i.aspect-d,_=p*i.aspect-d,a.elements[0]=2*i.near/(_-v),a.elements[8]=(_+v)/(_-v),this.cameraR.projectionMatrix.copy(a)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Om),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Yf)}}class Zf{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Jf(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const i=Jf();t=(i-this.oldTime)/1e3,this.oldTime=i,this.elapsedTime+=t}return t}}function Jf(){return(typeof performance=="undefined"?Date:performance).now()}const Sl=new gt,$f=new Oi,Kf=new gt,Xu=new gt;class Qf extends ar{constructor(){super(),this.type="AudioListener",this.context=cf.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Zf}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const i=this.context.listener,a=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Sl,$f,Kf),Xu.set(0,0,-1).applyQuaternion($f),i.positionX){const l=this.context.currentTime+this.timeDelta;i.positionX.linearRampToValueAtTime(Sl.x,l),i.positionY.linearRampToValueAtTime(Sl.y,l),i.positionZ.linearRampToValueAtTime(Sl.z,l),i.forwardX.linearRampToValueAtTime(Xu.x,l),i.forwardY.linearRampToValueAtTime(Xu.y,l),i.forwardZ.linearRampToValueAtTime(Xu.z,l),i.upX.linearRampToValueAtTime(a.x,l),i.upY.linearRampToValueAtTime(a.y,l),i.upZ.linearRampToValueAtTime(a.z,l)}else i.setPosition(Sl.x,Sl.y,Sl.z),i.setOrientation(Xu.x,Xu.y,Xu.z,a.x,a.y,a.z)}}class tm extends ar{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");if(this.hasPlaybackControl===!1)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const i=this.context.createBufferSource();return i.buffer=this.buffer,i.loop=this.loop,i.loopStart=this.loopStart,i.loopEnd=this.loopEnd,i.onended=this.onEnded.bind(this),i.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=i,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl!==!1)return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(this.hasPlaybackControl!==!1)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,i=this.filters.length;t<i;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,i=this.filters.length;t<i;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),this._connected===!0?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(this.hasPlaybackControl!==!1)return this.playbackRate=t,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(this.hasPlaybackControl!==!1)return this.loop=t,this.isPlaying===!0&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}const qu=new gt,Dm=new Oi,hg=new gt,sc=new gt;class cg extends tm{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,i,a){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=i,this.panner.coneOuterGain=a,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(qu,Dm,hg),sc.set(0,0,1).applyQuaternion(Dm);const i=this.panner;if(i.positionX){const a=this.context.currentTime+this.listener.timeDelta;i.positionX.linearRampToValueAtTime(qu.x,a),i.positionY.linearRampToValueAtTime(qu.y,a),i.positionZ.linearRampToValueAtTime(qu.z,a),i.orientationX.linearRampToValueAtTime(sc.x,a),i.orientationY.linearRampToValueAtTime(sc.y,a),i.orientationZ.linearRampToValueAtTime(sc.z,a)}else i.setPosition(qu.x,qu.y,qu.z),i.setOrientation(sc.x,sc.y,sc.z)}}class Nm{constructor(t,i=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=i,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const i=this.getFrequencyData();for(let a=0;a<i.length;a++)t+=i[a];return t/i.length}}class ud{constructor(t,i,a){let l,d,p;switch(this.binding=t,this.valueSize=a,i){case"quaternion":l=this._slerp,d=this._slerpAdditive,p=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*a),this._workIndex=5;break;case"string":case"bool":l=this._select,d=this._select,p=this._setAdditiveIdentityOther,this.buffer=new Array(5*a);break;default:l=this._lerp,d=this._lerpAdditive,p=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*a)}this._mixBufferRegion=l,this._mixBufferRegionAdditive=d,this._setIdentity=p,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,i){const a=this.buffer,l=this.valueSize,d=t*l+l;let p=this.cumulativeWeight;if(p===0){for(let v=0;v!==l;++v)a[d+v]=a[v];p=i}else{p+=i;const v=i/p;this._mixBufferRegion(a,d,0,v,l)}this.cumulativeWeight=p}accumulateAdditive(t){const i=this.buffer,a=this.valueSize,l=a*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(i,l,0,t,a),this.cumulativeWeightAdditive+=t}apply(t){const i=this.valueSize,a=this.buffer,l=t*i+i,d=this.cumulativeWeight,p=this.cumulativeWeightAdditive,v=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,d<1){const _=i*this._origIndex;this._mixBufferRegion(a,l,_,1-d,i)}p>0&&this._mixBufferRegionAdditive(a,l,this._addIndex*i,1,i);for(let _=i,x=i+i;_!==x;++_)if(a[_]!==a[_+i]){v.setValue(a,l);break}}saveOriginalState(){const t=this.binding,i=this.buffer,a=this.valueSize,l=a*this._origIndex;t.getValue(i,l);for(let d=a,p=l;d!==p;++d)i[d]=i[l+d%a];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,i=t+this.valueSize;for(let a=t;a<i;a++)this.buffer[a]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,i=this._addIndex*this.valueSize;for(let a=0;a<this.valueSize;a++)this.buffer[i+a]=this.buffer[t+a]}_select(t,i,a,l,d){if(l>=.5)for(let p=0;p!==d;++p)t[i+p]=t[a+p]}_slerp(t,i,a,l){Oi.slerpFlat(t,i,t,i,t,a,l)}_slerpAdditive(t,i,a,l,d){const p=this._workIndex*d;Oi.multiplyQuaternionsFlat(t,p,t,i,t,a),Oi.slerpFlat(t,i,t,i,t,p,l)}_lerp(t,i,a,l,d){const p=1-l;for(let v=0;v!==d;++v){const _=i+v;t[_]=t[_]*p+t[a+v]*l}}_lerpAdditive(t,i,a,l,d){for(let p=0;p!==d;++p){const v=i+p;t[v]=t[v]+t[a+p]*l}}}const df=new RegExp("[\\[\\]\\.:\\/]","g"),Fm="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",hd=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),em=/(WCOD+)?/.source.replace("WCOD",Fm),Bm=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),li=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),nm=new RegExp("^"+hd+em+Bm+li+"$"),km=["material","materials","bones"];class Br{constructor(t,i,a){this.path=i,this.parsedPath=a||Br.parseTrackName(i),this.node=Br.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,i,a){return t&&t.isAnimationObjectGroup?new Br.Composite(t,i,a):new Br(t,i,a)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(df,"")}static parseTrackName(t){const i=nm.exec(t);if(!i)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const a={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]},l=a.nodeName&&a.nodeName.lastIndexOf(".");if(l!==void 0&&l!==-1){const d=a.nodeName.substring(l+1);km.indexOf(d)!==-1&&(a.nodeName=a.nodeName.substring(0,l),a.objectName=d)}if(a.propertyName===null||a.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return a}static findNode(t,i){if(!i||i===""||i==="."||i===-1||i===t.name||i===t.uuid)return t;if(t.skeleton){const a=t.skeleton.getBoneByName(i);if(a!==void 0)return a}if(t.children){const a=function(d){for(let p=0;p<d.length;p++){const v=d[p];if(v.name===i||v.uuid===i)return v;const _=a(v.children);if(_)return _}return null},l=a(t.children);if(l)return l}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,i){t[i]=this.node[this.propertyName]}_getValue_array(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)t[i++]=a[l]}_getValue_arrayElement(t,i){t[i]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,i){this.resolvedProperty.toArray(t,i)}_setValue_direct(t,i){this.targetObject[this.propertyName]=t[i]}_setValue_direct_setNeedsUpdate(t,i){this.targetObject[this.propertyName]=t[i],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,i){this.targetObject[this.propertyName]=t[i],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)a[l]=t[i++]}_setValue_array_setNeedsUpdate(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)a[l]=t[i++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)a[l]=t[i++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,i){this.resolvedProperty[this.propertyIndex]=t[i]}_setValue_arrayElement_setNeedsUpdate(t,i){this.resolvedProperty[this.propertyIndex]=t[i],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,i){this.resolvedProperty[this.propertyIndex]=t[i],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,i){this.resolvedProperty.fromArray(t,i)}_setValue_fromArray_setNeedsUpdate(t,i){this.resolvedProperty.fromArray(t,i),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,i){this.resolvedProperty.fromArray(t,i),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,i){this.bind(),this.getValue(t,i)}_setValue_unbound(t,i){this.bind(),this.setValue(t,i)}bind(){let t=this.node;const i=this.parsedPath,a=i.objectName,l=i.propertyName;let d=i.propertyIndex;if(t||(t=Br.findNode(this.rootNode,i.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(a){let x=i.objectIndex;switch(a){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let M=0;M<t.length;M++)if(t[M].name===x){x=M;break}break;default:if(t[a]===void 0)return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[a]}if(x!==void 0){if(t[x]===void 0)return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[x]}}const p=t[l];if(p===void 0){const x=i.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+x+"."+l+" but it wasn't found.",t)}let v=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?v=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(v=this.Versioning.MatrixWorldNeedsUpdate);let _=this.BindingType.Direct;if(d!==void 0){if(l==="morphTargetInfluences"){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);t.morphTargetDictionary[d]!==void 0&&(d=t.morphTargetDictionary[d])}_=this.BindingType.ArrayElement,this.resolvedProperty=p,this.propertyIndex=d}else p.fromArray!==void 0&&p.toArray!==void 0?(_=this.BindingType.HasFromToArray,this.resolvedProperty=p):Array.isArray(p)?(_=this.BindingType.EntireArray,this.resolvedProperty=p):this.propertyName=l;this.getValue=this.GetterByBindingType[_],this.setValue=this.SetterByBindingTypeAndVersioning[_][v]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Br.Composite=class{constructor(m,t,i){const a=i||Br.parseTrackName(t);this._targetGroup=m,this._bindings=m.subscribe_(t,a)}getValue(m,t){this.bind();const i=this._targetGroup.nCachedObjects_,a=this._bindings[i];a!==void 0&&a.getValue(m,t)}setValue(m,t){const i=this._bindings;for(let a=this._targetGroup.nCachedObjects_,l=i.length;a!==l;++a)i[a].setValue(m,t)}bind(){const m=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=m.length;t!==i;++t)m[t].bind()}unbind(){const m=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=m.length;t!==i;++t)m[t].unbind()}},Br.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Br.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Br.prototype.GetterByBindingType=[Br.prototype._getValue_direct,Br.prototype._getValue_array,Br.prototype._getValue_arrayElement,Br.prototype._getValue_toArray],Br.prototype.SetterByBindingTypeAndVersioning=[[Br.prototype._setValue_direct,Br.prototype._setValue_direct_setNeedsUpdate,Br.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Br.prototype._setValue_array,Br.prototype._setValue_array_setNeedsUpdate,Br.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Br.prototype._setValue_arrayElement,Br.prototype._setValue_arrayElement_setNeedsUpdate,Br.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Br.prototype._setValue_fromArray,Br.prototype._setValue_fromArray_setNeedsUpdate,Br.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class rm{constructor(){this.uuid=No(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let a=0,l=arguments.length;a!==l;++a)t[arguments[a].uuid]=a;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}add(){const t=this._objects,i=this._indicesByUUID,a=this._paths,l=this._parsedPaths,d=this._bindings,p=d.length;let v,_=t.length,x=this.nCachedObjects_;for(let M=0,C=arguments.length;M!==C;++M){const A=arguments[M],R=A.uuid;let O=i[R];if(O===void 0){O=_++,i[R]=O,t.push(A);for(let U=0,D=p;U!==D;++U)d[U].push(new Br(A,a[U],l[U]))}else if(O<x){v=t[O];const U=--x,D=t[U];i[D.uuid]=O,t[O]=D,i[R]=U,t[U]=A;for(let Z=0,ot=p;Z!==ot;++Z){const vt=d[Z],mt=vt[U];let At=vt[O];vt[O]=mt,At===void 0&&(At=new Br(A,a[Z],l[Z])),vt[U]=At}}else t[O]!==v&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=x}remove(){const t=this._objects,i=this._indicesByUUID,a=this._bindings,l=a.length;let d=this.nCachedObjects_;for(let p=0,v=arguments.length;p!==v;++p){const _=arguments[p],x=_.uuid,M=i[x];if(M!==void 0&&M>=d){const C=d++,A=t[C];i[A.uuid]=M,t[M]=A,i[x]=C,t[C]=_;for(let R=0,O=l;R!==O;++R){const U=a[R],D=U[C],Z=U[M];U[M]=D,U[C]=Z}}}this.nCachedObjects_=d}uncache(){const t=this._objects,i=this._indicesByUUID,a=this._bindings,l=a.length;let d=this.nCachedObjects_,p=t.length;for(let v=0,_=arguments.length;v!==_;++v){const x=arguments[v].uuid,M=i[x];if(M!==void 0)if(delete i[x],M<d){const C=--d,A=t[C],R=--p,O=t[R];i[A.uuid]=M,t[M]=A,i[O.uuid]=C,t[C]=O,t.pop();for(let U=0,D=l;U!==D;++U){const Z=a[U],ot=Z[C],vt=Z[R];Z[M]=ot,Z[C]=vt,Z.pop()}}else{const C=--p,A=t[C];C>0&&(i[A.uuid]=M),t[M]=A,t.pop();for(let R=0,O=l;R!==O;++R){const U=a[R];U[M]=U[C],U.pop()}}}this.nCachedObjects_=d}subscribe_(t,i){const a=this._bindingsIndicesByPath;let l=a[t];const d=this._bindings;if(l!==void 0)return d[l];const p=this._paths,v=this._parsedPaths,_=this._objects,x=_.length,M=this.nCachedObjects_,C=new Array(x);l=d.length,a[t]=l,p.push(t),v.push(i),d.push(C);for(let A=M,R=_.length;A!==R;++A){const O=_[A];C[A]=new Br(O,t,i)}return C}unsubscribe_(t){const i=this._bindingsIndicesByPath,a=i[t];if(a!==void 0){const l=this._paths,d=this._parsedPaths,p=this._bindings,v=p.length-1,_=p[v];i[t[v]]=a,p[a]=_,p.pop(),d[a]=d[v],d.pop(),l[a]=l[v],l.pop()}}}rm.prototype.isAnimationObjectGroup=!0;class hp{constructor(t,i,a=null,l=i.blendMode){this._mixer=t,this._clip=i,this._localRoot=a,this.blendMode=l;const d=i.tracks,p=d.length,v=new Array(p),_={endingStart:ta,endingEnd:ta};for(let x=0;x!==p;++x){const M=d[x].createInterpolant(null);v[x]=M,M.settings=_}this._interpolantSettings=_,this._interpolants=v,this._propertyBindings=new Array(p),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=vs,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,i){return this.loop=t,this.repetitions=i,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,i,a){if(t.fadeOut(i),this.fadeIn(i),a){const l=this._clip.duration,d=t._clip.duration,p=d/l,v=l/d;t.warp(1,p,i),this.warp(v,1,i)}return this}crossFadeTo(t,i,a){return t.crossFadeFrom(this,i,a)}stopFading(){const t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,i,a){const l=this._mixer,d=l.time,p=this.timeScale;let v=this._timeScaleInterpolant;v===null&&(v=l._lendControlInterpolant(),this._timeScaleInterpolant=v);const _=v.parameterPositions,x=v.sampleValues;return _[0]=d,_[1]=d+a,x[0]=t/p,x[1]=i/p,this}stopWarping(){const t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,i,a,l){if(!this.enabled)return void this._updateWeight(t);const d=this._startTime;if(d!==null){const _=(t-d)*a;if(_<0||a===0)return;this._startTime=null,i=a*_}i*=this._updateTimeScale(t);const p=this._updateTime(i),v=this._updateWeight(t);if(v>0){const _=this._interpolants,x=this._propertyBindings;switch(this.blendMode){case xd:for(let M=0,C=_.length;M!==C;++M)_[M].evaluate(p),x[M].accumulateAdditive(v);break;case Oa:default:for(let M=0,C=_.length;M!==C;++M)_[M].evaluate(p),x[M].accumulate(l,v)}}}_updateWeight(t){let i=0;if(this.enabled){i=this.weight;const a=this._weightInterpolant;if(a!==null){const l=a.evaluate(t)[0];i*=l,t>a.parameterPositions[1]&&(this.stopFading(),l===0&&(this.enabled=!1))}}return this._effectiveWeight=i,i}_updateTimeScale(t){let i=0;if(!this.paused){i=this.timeScale;const a=this._timeScaleInterpolant;a!==null&&(i*=a.evaluate(t)[0],t>a.parameterPositions[1]&&(this.stopWarping(),i===0?this.paused=!0:this.timeScale=i))}return this._effectiveTimeScale=i,i}_updateTime(t){const i=this._clip.duration,a=this.loop;let l=this.time+t,d=this._loopCount;const p=a===gp;if(t===0)return d===-1?l:p&&(1&d)==1?i-l:l;if(a===Ri){d===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(l>=i)l=i;else{if(!(l<0)){this.time=l;break t}l=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=l,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(d===-1&&(t>=0?(d=0,this._setEndings(!0,this.repetitions===0,p)):this._setEndings(this.repetitions===0,!0,p)),l>=i||l<0){const v=Math.floor(l/i);l-=i*v,d+=Math.abs(v);const _=this.repetitions-d;if(_<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,l=t>0?i:0,this.time=l,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(_===1){const x=t<0;this._setEndings(x,!x,p)}else this._setEndings(!1,!1,p);this._loopCount=d,this.time=l,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:v})}}else this.time=l;if(p&&(1&d)==1)return i-l}return l}_setEndings(t,i,a){const l=this._interpolantSettings;a?(l.endingStart=La,l.endingEnd=La):(l.endingStart=t?this.zeroSlopeAtStart?La:ta:_s,l.endingEnd=i?this.zeroSlopeAtEnd?La:ta:_s)}_scheduleFading(t,i,a){const l=this._mixer,d=l.time;let p=this._weightInterpolant;p===null&&(p=l._lendControlInterpolant(),this._weightInterpolant=p);const v=p.parameterPositions,_=p.sampleValues;return v[0]=d,_[0]=i,v[1]=d+t,_[1]=a,this}}class ac extends Fa{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,i){const a=t._localRoot||this._root,l=t._clip.tracks,d=l.length,p=t._propertyBindings,v=t._interpolants,_=a.uuid,x=this._bindingsByRootAndName;let M=x[_];M===void 0&&(M={},x[_]=M);for(let C=0;C!==d;++C){const A=l[C],R=A.name;let O=M[R];if(O!==void 0)p[C]=O;else{if(O=p[C],O!==void 0){O._cacheIndex===null&&(++O.referenceCount,this._addInactiveBinding(O,_,R));continue}const U=i&&i._propertyBindings[C].binding.parsedPath;O=new ud(Br.create(a,R,U),A.ValueTypeName,A.getValueSize()),++O.referenceCount,this._addInactiveBinding(O,_,R),p[C]=O}v[C].resultBuffer=O.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){const a=(t._localRoot||this._root).uuid,l=t._clip.uuid,d=this._actionsByClip[l];this._bindAction(t,d&&d.knownActions[0]),this._addInactiveAction(t,l,a)}const i=t._propertyBindings;for(let a=0,l=i.length;a!==l;++a){const d=i[a];d.useCount++==0&&(this._lendBinding(d),d.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const i=t._propertyBindings;for(let a=0,l=i.length;a!==l;++a){const d=i[a];--d.useCount==0&&(d.restoreOriginalState(),this._takeBackBinding(d))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const i=t._cacheIndex;return i!==null&&i<this._nActiveActions}_addInactiveAction(t,i,a){const l=this._actions,d=this._actionsByClip;let p=d[i];if(p===void 0)p={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,d[i]=p;else{const v=p.knownActions;t._byClipCacheIndex=v.length,v.push(t)}t._cacheIndex=l.length,l.push(t),p.actionByRoot[a]=t}_removeInactiveAction(t){const i=this._actions,a=i[i.length-1],l=t._cacheIndex;a._cacheIndex=l,i[l]=a,i.pop(),t._cacheIndex=null;const d=t._clip.uuid,p=this._actionsByClip,v=p[d],_=v.knownActions,x=_[_.length-1],M=t._byClipCacheIndex;x._byClipCacheIndex=M,_[M]=x,_.pop(),t._byClipCacheIndex=null,delete v.actionByRoot[(t._localRoot||this._root).uuid],_.length===0&&delete p[d],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const i=t._propertyBindings;for(let a=0,l=i.length;a!==l;++a){const d=i[a];--d.referenceCount==0&&this._removeInactiveBinding(d)}}_lendAction(t){const i=this._actions,a=t._cacheIndex,l=this._nActiveActions++,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_takeBackAction(t){const i=this._actions,a=t._cacheIndex,l=--this._nActiveActions,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_addInactiveBinding(t,i,a){const l=this._bindingsByRootAndName,d=this._bindings;let p=l[i];p===void 0&&(p={},l[i]=p),p[a]=t,t._cacheIndex=d.length,d.push(t)}_removeInactiveBinding(t){const i=this._bindings,a=t.binding,l=a.rootNode.uuid,d=a.path,p=this._bindingsByRootAndName,v=p[l],_=i[i.length-1],x=t._cacheIndex;_._cacheIndex=x,i[x]=_,i.pop(),delete v[d],Object.keys(v).length===0&&delete p[l]}_lendBinding(t){const i=this._bindings,a=t._cacheIndex,l=this._nActiveBindings++,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_takeBackBinding(t){const i=this._bindings,a=t._cacheIndex,l=--this._nActiveBindings,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_lendControlInterpolant(){const t=this._controlInterpolants,i=this._nActiveControlInterpolants++;let a=t[i];return a===void 0&&(a=new nf(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),a.__cacheIndex=i,t[i]=a),a}_takeBackControlInterpolant(t){const i=this._controlInterpolants,a=t.__cacheIndex,l=--this._nActiveControlInterpolants,d=i[l];t.__cacheIndex=l,i[l]=t,d.__cacheIndex=a,i[a]=d}clipAction(t,i,a){const l=i||this._root,d=l.uuid;let p=typeof t=="string"?sd.findByName(l,t):t;const v=p!==null?p.uuid:t,_=this._actionsByClip[v];let x=null;if(a===void 0&&(a=p!==null?p.blendMode:Oa),_!==void 0){const C=_.actionByRoot[d];if(C!==void 0&&C.blendMode===a)return C;x=_.knownActions[0],p===null&&(p=x._clip)}if(p===null)return null;const M=new hp(this,p,i,a);return this._bindAction(M,x),this._addInactiveAction(M,v,d),M}existingAction(t,i){const a=i||this._root,l=a.uuid,d=typeof t=="string"?sd.findByName(a,t):t,p=d?d.uuid:t,v=this._actionsByClip[p];return v!==void 0&&v.actionByRoot[l]||null}stopAllAction(){const t=this._actions;for(let i=this._nActiveActions-1;i>=0;--i)t[i].stop();return this}update(t){t*=this.timeScale;const i=this._actions,a=this._nActiveActions,l=this.time+=t,d=Math.sign(t),p=this._accuIndex^=1;for(let x=0;x!==a;++x)i[x]._update(l,t,d,p);const v=this._bindings,_=this._nActiveBindings;for(let x=0;x!==_;++x)v[x].apply(p);return this}setTime(t){this.time=0;for(let i=0;i<this._actions.length;i++)this._actions[i].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const i=this._actions,a=t.uuid,l=this._actionsByClip,d=l[a];if(d!==void 0){const p=d.knownActions;for(let v=0,_=p.length;v!==_;++v){const x=p[v];this._deactivateAction(x);const M=x._cacheIndex,C=i[i.length-1];x._cacheIndex=null,x._byClipCacheIndex=null,C._cacheIndex=M,i[M]=C,i.pop(),this._removeInactiveBindingsForAction(x)}delete l[a]}}uncacheRoot(t){const i=t.uuid,a=this._actionsByClip;for(const d in a){const p=a[d].actionByRoot[i];p!==void 0&&(this._deactivateAction(p),this._removeInactiveAction(p))}const l=this._bindingsByRootAndName[i];if(l!==void 0)for(const d in l){const p=l[d];p.restoreOriginalState(),this._removeInactiveBinding(p)}}uncacheAction(t,i){const a=this.existingAction(t,i);a!==null&&(this._deactivateAction(a),this._removeInactiveAction(a))}}ac.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class cd{constructor(t){typeof t=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new cd(this.value.clone===void 0?this.value:this.value.clone())}}class im extends _l{constructor(t,i,a=1){super(t,i),this.meshPerAttribute=a}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const i=super.clone(t);return i.meshPerAttribute=this.meshPerAttribute,i}toJSON(t){const i=super.toJSON(t);return i.isInstancedInterleavedBuffer=!0,i.meshPerAttribute=this.meshPerAttribute,i}}im.prototype.isInstancedInterleavedBuffer=!0;class Um{constructor(t,i,a,l,d){this.buffer=t,this.type=i,this.itemSize=a,this.elementSize=l,this.count=d,this.version=0}set needsUpdate(t){t===!0&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,i){return this.type=t,this.elementSize=i,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}Um.prototype.isGLBufferAttribute=!0;class dg{constructor(t,i,a=0,l=1/0){this.ray=new ka(t,i),this.near=a,this.far=l,this.camera=null,this.layers=new ul,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,i){this.ray.set(t,i)}setFromCamera(t,i){i&&i.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(i.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(i).sub(this.ray.origin).normalize(),this.camera=i):i&&i.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(i.near+i.far)/(i.near-i.far)).unproject(i),this.ray.direction.set(0,0,-1).transformDirection(i.matrixWorld),this.camera=i):console.error("THREE.Raycaster: Unsupported camera type: "+i.type)}intersectObject(t,i=!1,a=[]){return dd(t,this,a,i),a.sort(pf),a}intersectObjects(t,i=!1,a=[]){for(let l=0,d=t.length;l<d;l++)dd(t[l],this,a,i);return a.sort(pf),a}}function pf(m,t){return m.distance-t.distance}function dd(m,t,i,a){if(m.layers.test(t.layers)&&m.raycast(t,i),a===!0){const l=m.children;for(let d=0,p=l.length;d<p;d++)dd(l[d],t,i,!0)}}class pg{constructor(t=1,i=0,a=0){return this.radius=t,this.phi=i,this.theta=a,this}set(t,i,a){return this.radius=t,this.phi=i,this.theta=a,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,i,a){return this.radius=Math.sqrt(t*t+i*i+a*a),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,a),this.phi=Math.acos(zi(i/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class fg{constructor(t=1,i=0,a=0){return this.radius=t,this.theta=i,this.y=a,this}set(t,i,a){return this.radius=t,this.theta=i,this.y=a,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,i,a){return this.radius=Math.sqrt(t*t+a*a),this.theta=Math.atan2(t,a),this.y=i,this}clone(){return new this.constructor().copy(this)}}const Gm=new He;class pd{constructor(t=new He(1/0,1/0),i=new He(-1/0,-1/0)){this.min=t,this.max=i}set(t,i){return this.min.copy(t),this.max.copy(i),this}setFromPoints(t){this.makeEmpty();for(let i=0,a=t.length;i<a;i++)this.expandByPoint(t[i]);return this}setFromCenterAndSize(t,i){const a=Gm.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(a),this.max.copy(t).add(a),this}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,i){return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,i){return i.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Gm.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}pd.prototype.isBox2=!0;const Hm=new gt,Yu=new gt;class Ta{constructor(t=new gt,i=new gt){this.start=t,this.end=i}set(t,i){return this.start.copy(t),this.end.copy(i),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,i){return this.delta(i).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,i){Hm.subVectors(t,this.start),Yu.subVectors(this.end,this.start);const a=Yu.dot(Yu);let l=Yu.dot(Hm)/a;return i&&(l=zi(l,0,1)),l}closestPointToPoint(t,i,a){const l=this.closestPointToPointParameter(t,i);return this.delta(a).multiplyScalar(l).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class Ea extends ar{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}Ea.prototype.isImmediateRenderObject=!0;const Zu=new gt;class mg extends ar{constructor(t,i){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;const a=new zn,l=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let p=0,v=1,_=32;p<_;p++,v++){const x=p/_*Math.PI*2,M=v/_*Math.PI*2;l.push(Math.cos(x),Math.sin(x),1,Math.cos(M),Math.sin(M),1)}a.setAttribute("position",new xn(l,3));const d=new ro({fog:!1,toneMapped:!1});this.cone=new io(a,d),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const t=this.light.distance?this.light.distance:1e3,i=t*Math.tan(this.light.angle);this.cone.scale.set(i,i,t),Zu.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Zu),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const lu=new gt,fd=new En,Ds=new En;class om extends io{constructor(t){const i=function _(x){const M=[];x&&x.isBone&&M.push(x);for(let C=0;C<x.children.length;C++)M.push.apply(M,_(x.children[C]));return M}(t),a=new zn,l=[],d=[],p=new pn(0,0,1),v=new pn(0,1,0);for(let _=0;_<i.length;_++){const x=i[_];x.parent&&x.parent.isBone&&(l.push(0,0,0),l.push(0,0,0),d.push(p.r,p.g,p.b),d.push(v.r,v.g,v.b))}a.setAttribute("position",new xn(l,3)),a.setAttribute("color",new xn(d,3)),super(a,new ro({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=i,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const i=this.bones,a=this.geometry,l=a.getAttribute("position");Ds.copy(this.root.matrixWorld).invert();for(let d=0,p=0;d<i.length;d++){const v=i[d];v.parent&&v.parent.isBone&&(fd.multiplyMatrices(Ds,v.matrixWorld),lu.setFromMatrixPosition(fd),l.setXYZ(p,lu.x,lu.y,lu.z),fd.multiplyMatrices(Ds,v.parent.matrixWorld),lu.setFromMatrixPosition(fd),l.setXYZ(p+1,lu.x,lu.y,lu.z),p+=2)}a.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}class gg extends Bi{constructor(t,i,a){super(new Jh(i,4,2),new Fi({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=a,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const o=new gt,n=new pn,e=new pn;class r extends ar{constructor(t,i,a){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=a;const l=new Yh(i);l.rotateY(.5*Math.PI),this.material=new Fi({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const d=l.getAttribute("position"),p=new Float32Array(3*d.count);l.setAttribute("color",new Kn(p,3)),this.add(new Bi(l,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const i=t.geometry.getAttribute("color");n.copy(this.light.color),e.copy(this.light.groundColor);for(let a=0,l=i.count;a<l;a++){const d=a<l/2?n:e;i.setXYZ(a,d.r,d.g,d.b)}i.needsUpdate=!0}t.lookAt(o.setFromMatrixPosition(this.light.matrixWorld).negate())}}class s extends io{constructor(t=10,i=10,a=4473924,l=8947848){a=new pn(a),l=new pn(l);const d=i/2,p=t/i,v=t/2,_=[],x=[];for(let C=0,A=0,R=-v;C<=i;C++,R+=p){_.push(-v,0,R,v,0,R),_.push(R,0,-v,R,0,v);const O=C===d?a:l;O.toArray(x,A),A+=3,O.toArray(x,A),A+=3,O.toArray(x,A),A+=3,O.toArray(x,A),A+=3}const M=new zn;M.setAttribute("position",new xn(_,3)),M.setAttribute("color",new xn(x,3)),super(M,new ro({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}class u extends io{constructor(t=10,i=16,a=8,l=64,d=4473924,p=8947848){d=new pn(d),p=new pn(p);const v=[],_=[];for(let M=0;M<=i;M++){const C=M/i*(2*Math.PI),A=Math.sin(C)*t,R=Math.cos(C)*t;v.push(0,0,0),v.push(A,0,R);const O=1&M?d:p;_.push(O.r,O.g,O.b),_.push(O.r,O.g,O.b)}for(let M=0;M<=a;M++){const C=1&M?d:p,A=t-t/a*M;for(let R=0;R<l;R++){let O=R/l*(2*Math.PI),U=Math.sin(O)*A,D=Math.cos(O)*A;v.push(U,0,D),_.push(C.r,C.g,C.b),O=(R+1)/l*(2*Math.PI),U=Math.sin(O)*A,D=Math.cos(O)*A,v.push(U,0,D),_.push(C.r,C.g,C.b)}}const x=new zn;x.setAttribute("position",new xn(v,3)),x.setAttribute("color",new xn(_,3)),super(x,new ro({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}const h=new gt,f=new gt,y=new gt;class b extends ar{constructor(t,i,a){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=a,i===void 0&&(i=1);let l=new zn;l.setAttribute("position",new xn([-i,i,0,i,i,0,i,-i,0,-i,-i,0,-i,i,0],3));const d=new ro({fog:!1,toneMapped:!1});this.lightPlane=new Ya(l,d),this.add(this.lightPlane),l=new zn,l.setAttribute("position",new xn([0,0,0,0,0,1],3)),this.targetLine=new Ya(l,d),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){h.setFromMatrixPosition(this.light.matrixWorld),f.setFromMatrixPosition(this.light.target.matrixWorld),y.subVectors(f,h),this.lightPlane.lookAt(f),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(f),this.targetLine.scale.z=y.length()}}const T=new gt,P=new jl;class j extends io{constructor(t){const i=new zn,a=new ro({color:16777215,vertexColors:!0,toneMapped:!1}),l=[],d=[],p={},v=new pn(16755200),_=new pn(16711680),x=new pn(43775),M=new pn(16777215),C=new pn(3355443);function A(O,U,D){R(O,D),R(U,D)}function R(O,U){l.push(0,0,0),d.push(U.r,U.g,U.b),p[O]===void 0&&(p[O]=[]),p[O].push(l.length/3-1)}A("n1","n2",v),A("n2","n4",v),A("n4","n3",v),A("n3","n1",v),A("f1","f2",v),A("f2","f4",v),A("f4","f3",v),A("f3","f1",v),A("n1","f1",v),A("n2","f2",v),A("n3","f3",v),A("n4","f4",v),A("p","n1",_),A("p","n2",_),A("p","n3",_),A("p","n4",_),A("u1","u2",x),A("u2","u3",x),A("u3","u1",x),A("c","t",M),A("p","c",C),A("cn1","cn2",C),A("cn3","cn4",C),A("cf1","cf2",C),A("cf3","cf4",C),i.setAttribute("position",new xn(l,3)),i.setAttribute("color",new xn(d,3)),super(i,a),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=p,this.update()}update(){const t=this.geometry,i=this.pointMap;P.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),G("c",i,t,P,0,0,-1),G("t",i,t,P,0,0,1),G("n1",i,t,P,-1,-1,-1),G("n2",i,t,P,1,-1,-1),G("n3",i,t,P,-1,1,-1),G("n4",i,t,P,1,1,-1),G("f1",i,t,P,-1,-1,1),G("f2",i,t,P,1,-1,1),G("f3",i,t,P,-1,1,1),G("f4",i,t,P,1,1,1),G("u1",i,t,P,.7,1.1,-1),G("u2",i,t,P,-.7,1.1,-1),G("u3",i,t,P,0,2,-1),G("cf1",i,t,P,-1,0,1),G("cf2",i,t,P,1,0,1),G("cf3",i,t,P,0,-1,1),G("cf4",i,t,P,0,1,1),G("cn1",i,t,P,-1,0,-1),G("cn2",i,t,P,1,0,-1),G("cn3",i,t,P,0,-1,-1),G("cn4",i,t,P,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function G(m,t,i,a,l,d,p){T.set(l,d,p).unproject(a);const v=t[m];if(v!==void 0){const _=i.getAttribute("position");for(let x=0,M=v.length;x<M;x++)_.setXYZ(v[x],T.x,T.y,T.z)}}const V=new To;class K extends io{constructor(t,i=16776960){const a=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),l=new Float32Array(24),d=new zn;d.setIndex(new Kn(a,1)),d.setAttribute("position",new Kn(l,3)),super(d,new ro({color:i,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(t!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&V.setFromObject(this.object),V.isEmpty())return;const i=V.min,a=V.max,l=this.geometry.attributes.position,d=l.array;d[0]=a.x,d[1]=a.y,d[2]=a.z,d[3]=i.x,d[4]=a.y,d[5]=a.z,d[6]=i.x,d[7]=i.y,d[8]=a.z,d[9]=a.x,d[10]=i.y,d[11]=a.z,d[12]=a.x,d[13]=a.y,d[14]=i.z,d[15]=i.x,d[16]=a.y,d[17]=i.z,d[18]=i.x,d[19]=i.y,d[20]=i.z,d[21]=a.x,d[22]=i.y,d[23]=i.z,l.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return io.prototype.copy.call(this,t),this.object=t.object,this}}class _t extends io{constructor(t,i=16776960){const a=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),l=new zn;l.setIndex(new Kn(a,1)),l.setAttribute("position",new xn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(l,new ro({color:i,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const i=this.box;i.isEmpty()||(i.getCenter(this.position),i.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}}class Tt extends Ya{constructor(t,i=1,a=16776960){const l=a,d=new zn;d.setAttribute("position",new xn([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),d.computeBoundingSphere(),super(d,new ro({color:l,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=i;const p=new zn;p.setAttribute("position",new xn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),p.computeBoundingSphere(),this.add(new Bi(p,new Fi({color:l,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let i=-this.plane.constant;Math.abs(i)<1e-8&&(i=1e-8),this.scale.set(.5*this.size,.5*this.size,i),this.children[0].material.side=i<0?L:zt,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}}const jt=new gt;let de,Ne;class Nt extends ar{constructor(t=new gt(0,0,1),i=new gt(0,0,0),a=1,l=16776960,d=.2*a,p=.2*d){super(),this.type="ArrowHelper",de===void 0&&(de=new zn,de.setAttribute("position",new xn([0,0,0,0,1,0],3)),Ne=new De(0,.5,1,5,1),Ne.translate(0,-.5,0)),this.position.copy(i),this.line=new Ya(de,new ro({color:l,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Bi(Ne,new Fi({color:l,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(a,d,p)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{jt.set(t.z,0,-t.x).normalize();const i=Math.acos(t.y);this.quaternion.setFromAxisAngle(jt,i)}}setLength(t,i=.2*t,a=.2*i){this.line.scale.set(1,Math.max(1e-4,t-i),1),this.line.updateMatrix(),this.cone.scale.set(a,i,a),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}class ue extends io{constructor(t=1){const i=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],a=new zn;a.setAttribute("position",new xn(i,3)),a.setAttribute("color",new xn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(a,new ro({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,i,a){const l=new pn,d=this.geometry.attributes.color.array;return l.set(t),l.toArray(d,0),l.toArray(d,3),l.set(i),l.toArray(d,6),l.toArray(d,9),l.set(a),l.toArray(d,12),l.toArray(d,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}const $t=new Float32Array(1),ie=new Int32Array($t.buffer);class Je{static toHalfFloat(t){$t[0]=t;const i=ie[0];let a=i>>16&32768,l=i>>12&2047;const d=i>>23&255;return d<103?a:d>142?(a|=31744,a|=(d==255?0:1)&&8388607&i,a):d<113?(l|=2048,a|=(l>>114-d)+(l>>113-d&1),a):(a|=d-112<<10|l>>1,a+=1&l,a)}}const he=Math.pow(2,8),oe=[.125,.215,.35,.446,.526,.582],Ae=5+oe.length,nn={[Wr]:0,[Bs]:1,[_e]:2,[tn]:3,[Xn]:4,[Mr]:5,[Yt]:6},on=new Fi({side:L,depthWrite:!1,depthTest:!1}),$n=new Bi(new ha,on),nr=new sp,{_lodPlanes:$e,_sizeLods:Ue,_sigmas:Cn}=Ai(),kn=new pn;let wr=null;const Ar=(1+Math.sqrt(5))/2,Dr=1/Ar,pi=[new gt(1,1,1),new gt(-1,1,1),new gt(1,1,-1),new gt(-1,1,-1),new gt(0,Ar,Dr),new gt(0,Ar,-Dr),new gt(Dr,0,Ar),new gt(-Dr,0,Ar),new gt(Ar,Dr,0),new gt(-Ar,Dr,0)];function Ji(m){const t=Math.max(m.r,m.g,m.b),i=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);return m.multiplyScalar(Math.pow(2,-i)),(i+128)/255}class jr{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(i){const a=new Float32Array(i),l=new gt(0,1,0);return new $h({name:"SphericalGaussianBlur",defines:{n:i},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:a},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:l},inputEncoding:{value:nn[Wr]},outputEncoding:{value:nn[Wr]}},vertexShader:ur(),fragmentShader:`
2922
+ }`}),R=A.clone();R.defines.HORIZONTAL_PASS=1;const O=new zn;O.setAttribute("position",new Kn(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const U=new Bi(O,A),D=this;function Z(Pt,Et){const Ot=t.update(U);A.uniforms.shadow_pass.value=Pt.map.texture,A.uniforms.resolution.value=Pt.mapSize,A.uniforms.radius.value=Pt.radius,m.setRenderTarget(Pt.mapPass),m.clear(),m.renderBufferDirect(Et,null,Ot,A,U,null),R.uniforms.shadow_pass.value=Pt.mapPass.texture,R.uniforms.resolution.value=Pt.mapSize,R.uniforms.radius.value=Pt.radius,m.setRenderTarget(Pt.map),m.clear(),m.renderBufferDirect(Et,null,Ot,R,U,null)}function ot(Pt){const Et=Pt<<0;let Ot=v[Et];return Ot===void 0&&(Ot=new Nh({depthPacking:is,morphTargets:Pt}),v[Et]=Ot),Ot}function vt(Pt){const Et=Pt<<0;let Ot=_[Et];return Ot===void 0&&(Ot=new fs({morphTargets:Pt}),_[Et]=Ot),Ot}function mt(Pt,Et,Ot,Ie,ye,xe,ge){let Ht=null,ce=ot,We=Pt.customDepthMaterial;if(Ie.isPointLight===!0&&(ce=vt,We=Pt.customDistanceMaterial),We===void 0){let je=!1;Ot.morphTargets===!0&&(je=Et.morphAttributes&&Et.morphAttributes.position&&Et.morphAttributes.position.length>0),Ht=ce(je)}else Ht=We;if(m.localClippingEnabled&&Ot.clipShadows===!0&&Ot.clippingPlanes.length!==0){const je=Ht.uuid,ze=Ot.uuid;let fn=x[je];fn===void 0&&(fn={},x[je]=fn);let _n=fn[ze];_n===void 0&&(_n=Ht.clone(),fn[ze]=_n),Ht=_n}return Ht.visible=Ot.visible,Ht.wireframe=Ot.wireframe,Ht.side=ge===Gt?Ot.shadowSide!==null?Ot.shadowSide:Ot.side:Ot.shadowSide!==null?Ot.shadowSide:C[Ot.side],Ht.clipShadows=Ot.clipShadows,Ht.clippingPlanes=Ot.clippingPlanes,Ht.clipIntersection=Ot.clipIntersection,Ht.wireframeLinewidth=Ot.wireframeLinewidth,Ht.linewidth=Ot.linewidth,Ie.isPointLight===!0&&Ht.isMeshDistanceMaterial===!0&&(Ht.referencePosition.setFromMatrixPosition(Ie.matrixWorld),Ht.nearDistance=ye,Ht.farDistance=xe),Ht}function At(Pt,Et,Ot,Ie,ye){if(Pt.visible===!1)return;if(Pt.layers.test(Et.layers)&&(Pt.isMesh||Pt.isLine||Pt.isPoints)&&(Pt.castShadow||Pt.receiveShadow&&ye===Gt)&&(!Pt.frustumCulled||a.intersectsObject(Pt))){Pt.modelViewMatrix.multiplyMatrices(Ot.matrixWorldInverse,Pt.matrixWorld);const ge=t.update(Pt),Ht=Pt.material;if(Array.isArray(Ht)){const ce=ge.groups;for(let We=0,je=ce.length;We<je;We++){const ze=ce[We],fn=Ht[ze.materialIndex];if(fn&&fn.visible){const _n=mt(Pt,ge,fn,Ie,Ot.near,Ot.far,ye);m.renderBufferDirect(Ot,null,ge,_n,Pt,ze)}}}else if(Ht.visible){const ce=mt(Pt,ge,Ht,Ie,Ot.near,Ot.far,ye);m.renderBufferDirect(Ot,null,ge,ce,Pt,null)}}const xe=Pt.children;for(let ge=0,Ht=xe.length;ge<Ht;ge++)At(xe[ge],Et,Ot,Ie,ye)}this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ut,this.render=function(Pt,Et,Ot){if(D.enabled===!1||D.autoUpdate===!1&&D.needsUpdate===!1||Pt.length===0)return;const Ie=m.getRenderTarget(),ye=m.getActiveCubeFace(),xe=m.getActiveMipmapLevel(),ge=m.state;ge.setBlending(B),ge.buffers.color.setClear(1,1,1,1),ge.buffers.depth.setTest(!0),ge.setScissorTest(!1);for(let Ht=0,ce=Pt.length;Ht<ce;Ht++){const We=Pt[Ht],je=We.shadow;if(je===void 0){console.warn("THREE.WebGLShadowMap:",We,"has no shadow.");continue}if(je.autoUpdate===!1&&je.needsUpdate===!1)continue;l.copy(je.mapSize);const ze=je.getFrameExtents();if(l.multiply(ze),d.copy(je.mapSize),(l.x>M||l.y>M)&&(l.x>M&&(d.x=Math.floor(M/ze.x),l.x=d.x*ze.x,je.mapSize.x=d.x),l.y>M&&(d.y=Math.floor(M/ze.y),l.y=d.y*ze.y,je.mapSize.y=d.y)),je.map===null&&!je.isPointLightShadow&&this.type===Gt){const _n={minFilter:Qe,magFilter:Qe,format:Tn};je.map=new Fo(l.x,l.y,_n),je.map.texture.name=We.name+".shadowMap",je.mapPass=new Fo(l.x,l.y,_n),je.camera.updateProjectionMatrix()}if(je.map===null){const _n={minFilter:wt,magFilter:wt,format:Tn};je.map=new Fo(l.x,l.y,_n),je.map.texture.name=We.name+".shadowMap",je.camera.updateProjectionMatrix()}m.setRenderTarget(je.map),m.clear();const fn=je.getViewportCount();for(let _n=0;_n<fn;_n++){const Mn=je.getViewport(_n);p.set(d.x*Mn.x,d.y*Mn.y,d.x*Mn.z,d.y*Mn.w),ge.viewport(p),je.updateMatrices(We,_n),a=je.getFrustum(),At(Et,Ot,je.camera,We,this.type)}je.isPointLightShadow||this.type!==Gt||Z(je,Ot),je.needsUpdate=!1}D.needsUpdate=!1,m.setRenderTarget(Ie,ye,xe)}}function qd(m,t,i){const a=i.isWebGL2,l=new function(){let xt=!1;const Zt=new Ir;let Te=null;const Pe=new Ir(0,0,0,0);return{setMask:function(we){Te===we||xt||(m.colorMask(we,we,we,we),Te=we)},setLocked:function(we){xt=we},setClear:function(we,bn,Gn,Fn,_r){_r===!0&&(we*=Fn,bn*=Fn,Gn*=Fn),Zt.set(we,bn,Gn,Fn),Pe.equals(Zt)===!1&&(m.clearColor(we,bn,Gn,Fn),Pe.copy(Zt))},reset:function(){xt=!1,Te=null,Pe.set(-1,0,0,0)}}},d=new function(){let xt=!1,Zt=null,Te=null,Pe=null;return{setTest:function(we){we?Sn(2929):Rt(2929)},setMask:function(we){Zt===we||xt||(m.depthMask(we),Zt=we)},setFunc:function(we){if(Te!==we){if(we)switch(we){case Bn:m.depthFunc(512);break;case Wn:m.depthFunc(519);break;case vn:m.depthFunc(513);break;case Pr:m.depthFunc(515);break;case Ur:m.depthFunc(514);break;case Rr:m.depthFunc(518);break;case qr:m.depthFunc(516);break;case yr:m.depthFunc(517);break;default:m.depthFunc(515)}else m.depthFunc(515);Te=we}},setLocked:function(we){xt=we},setClear:function(we){Pe!==we&&(m.clearDepth(we),Pe=we)},reset:function(){xt=!1,Zt=null,Te=null,Pe=null}}},p=new function(){let xt=!1,Zt=null,Te=null,Pe=null,we=null,bn=null,Gn=null,Fn=null,_r=null;return{setTest:function(Tr){xt||(Tr?Sn(2960):Rt(2960))},setMask:function(Tr){Zt===Tr||xt||(m.stencilMask(Tr),Zt=Tr)},setFunc:function(Tr,Xo,fi){Te===Tr&&Pe===Xo&&we===fi||(m.stencilFunc(Tr,Xo,fi),Te=Tr,Pe=Xo,we=fi)},setOp:function(Tr,Xo,fi){bn===Tr&&Gn===Xo&&Fn===fi||(m.stencilOp(Tr,Xo,fi),bn=Tr,Gn=Xo,Fn=fi)},setLocked:function(Tr){xt=Tr},setClear:function(Tr){_r!==Tr&&(m.clearStencil(Tr),_r=Tr)},reset:function(){xt=!1,Zt=null,Te=null,Pe=null,we=null,bn=null,Gn=null,Fn=null,_r=null}}};let v={},_=null,x={},M=null,C=!1,A=null,R=null,O=null,U=null,D=null,Z=null,ot=null,vt=!1,mt=null,At=null,Pt=null,Et=null,Ot=null;const Ie=m.getParameter(35661);let ye=!1,xe=0;const ge=m.getParameter(7938);ge.indexOf("WebGL")!==-1?(xe=parseFloat(/^WebGL (\d)/.exec(ge)[1]),ye=xe>=1):ge.indexOf("OpenGL ES")!==-1&&(xe=parseFloat(/^OpenGL ES (\d)/.exec(ge)[1]),ye=xe>=2);let Ht=null,ce={};const We=m.getParameter(3088),je=m.getParameter(2978),ze=new Ir().fromArray(We),fn=new Ir().fromArray(je);function _n(xt,Zt,Te){const Pe=new Uint8Array(4),we=m.createTexture();m.bindTexture(xt,we),m.texParameteri(xt,10241,9728),m.texParameteri(xt,10240,9728);for(let bn=0;bn<Te;bn++)m.texImage2D(Zt+bn,0,6408,1,1,0,6408,5121,Pe);return we}const Mn={};function Sn(xt){v[xt]!==!0&&(m.enable(xt),v[xt]=!0)}function Rt(xt){v[xt]!==!1&&(m.disable(xt),v[xt]=!1)}Mn[3553]=_n(3553,3553,1),Mn[34067]=_n(34067,34069,6),l.setClear(0,0,0,1),d.setClear(1),p.setClear(0),Sn(2929),d.setFunc(Pr),pe(!1),rn(X),Sn(2884),Be(B);const Dt={[ne]:32774,[bt]:32778,[Jt]:32779};if(a)Dt[Kt]=32775,Dt[rt]=32776;else{const xt=t.get("EXT_blend_minmax");xt!==null&&(Dt[Kt]=xt.MIN_EXT,Dt[rt]=xt.MAX_EXT)}const Fe={[Ut]:0,[Wt]:1,[te]:768,[le]:770,[Ln]:776,[Hn]:774,[Ye]:772,[Xt]:769,[fe]:771,[Ke]:775,[ke]:773};function Be(xt,Zt,Te,Pe,we,bn,Gn,Fn){if(xt!==B){if(C===!1&&(Sn(3042),C=!0),xt===Oe)we=we||Zt,bn=bn||Te,Gn=Gn||Pe,Zt===R&&we===D||(m.blendEquationSeparate(Dt[Zt],Dt[we]),R=Zt,D=we),Te===O&&Pe===U&&bn===Z&&Gn===ot||(m.blendFuncSeparate(Fe[Te],Fe[Pe],Fe[bn],Fe[Gn]),O=Te,U=Pe,Z=bn,ot=Gn),A=xt,vt=null;else if(xt!==A||Fn!==vt){if(R===ne&&D===ne||(m.blendEquation(32774),R=ne,D=ne),Fn)switch(xt){case Q:m.blendFuncSeparate(1,771,1,771);break;case et:m.blendFunc(1,1);break;case ft:m.blendFuncSeparate(0,0,769,771);break;case ae:m.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",xt)}else switch(xt){case Q:m.blendFuncSeparate(770,771,1,771);break;case et:m.blendFunc(770,1);break;case ft:m.blendFunc(0,769);break;case ae:m.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",xt)}O=null,U=null,Z=null,ot=null,A=xt,vt=Fn}}else C===!0&&(Rt(3042),C=!1)}function pe(xt){mt!==xt&&(xt?m.frontFace(2304):m.frontFace(2305),mt=xt)}function rn(xt){xt!==J?(Sn(2884),xt!==At&&(xt===X?m.cullFace(1029):xt===ct?m.cullFace(1028):m.cullFace(1032))):Rt(2884),At=xt}function sn(xt,Zt,Te){xt?(Sn(32823),Et===Zt&&Ot===Te||(m.polygonOffset(Zt,Te),Et=Zt,Ot=Te)):Rt(32823)}function be(xt){xt===void 0&&(xt=33984+Ie-1),Ht!==xt&&(m.activeTexture(xt),Ht=xt)}return{buffers:{color:l,depth:d,stencil:p},enable:Sn,disable:Rt,bindFramebuffer:function(xt,Zt){return Zt===null&&_!==null&&(Zt=_),x[xt]!==Zt&&(m.bindFramebuffer(xt,Zt),x[xt]=Zt,a&&(xt===36009&&(x[36160]=Zt),xt===36160&&(x[36009]=Zt)),!0)},bindXRFramebuffer:function(xt){xt!==_&&(m.bindFramebuffer(36160,xt),_=xt)},useProgram:function(xt){return M!==xt&&(m.useProgram(xt),M=xt,!0)},setBlending:Be,setMaterial:function(xt,Zt){xt.side===k?Rt(2884):Sn(2884);let Te=xt.side===L;Zt&&(Te=!Te),pe(Te),xt.blending===Q&&xt.transparent===!1?Be(B):Be(xt.blending,xt.blendEquation,xt.blendSrc,xt.blendDst,xt.blendEquationAlpha,xt.blendSrcAlpha,xt.blendDstAlpha,xt.premultipliedAlpha),d.setFunc(xt.depthFunc),d.setTest(xt.depthTest),d.setMask(xt.depthWrite),l.setMask(xt.colorWrite);const Pe=xt.stencilWrite;p.setTest(Pe),Pe&&(p.setMask(xt.stencilWriteMask),p.setFunc(xt.stencilFunc,xt.stencilRef,xt.stencilFuncMask),p.setOp(xt.stencilFail,xt.stencilZFail,xt.stencilZPass)),sn(xt.polygonOffset,xt.polygonOffsetFactor,xt.polygonOffsetUnits),xt.alphaToCoverage===!0?Sn(32926):Rt(32926)},setFlipSided:pe,setCullFace:rn,setLineWidth:function(xt){xt!==Pt&&(ye&&m.lineWidth(xt),Pt=xt)},setPolygonOffset:sn,setScissorTest:function(xt){xt?Sn(3089):Rt(3089)},activeTexture:be,bindTexture:function(xt,Zt){Ht===null&&be();let Te=ce[Ht];Te===void 0&&(Te={type:void 0,texture:void 0},ce[Ht]=Te),Te.type===xt&&Te.texture===Zt||(m.bindTexture(xt,Zt||Mn[xt]),Te.type=xt,Te.texture=Zt)},unbindTexture:function(){const xt=ce[Ht];xt!==void 0&&xt.type!==void 0&&(m.bindTexture(xt.type,null),xt.type=void 0,xt.texture=void 0)},compressedTexImage2D:function(){try{m.compressedTexImage2D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},texImage2D:function(){try{m.texImage2D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},texImage3D:function(){try{m.texImage3D.apply(m,arguments)}catch(xt){console.error("THREE.WebGLState:",xt)}},scissor:function(xt){ze.equals(xt)===!1&&(m.scissor(xt.x,xt.y,xt.z,xt.w),ze.copy(xt))},viewport:function(xt){fn.equals(xt)===!1&&(m.viewport(xt.x,xt.y,xt.z,xt.w),fn.copy(xt))},reset:function(){m.disable(3042),m.disable(2884),m.disable(2929),m.disable(32823),m.disable(3089),m.disable(2960),m.disable(32926),m.blendEquation(32774),m.blendFunc(1,0),m.blendFuncSeparate(1,0,1,0),m.colorMask(!0,!0,!0,!0),m.clearColor(0,0,0,0),m.depthMask(!0),m.depthFunc(513),m.clearDepth(1),m.stencilMask(4294967295),m.stencilFunc(519,0,4294967295),m.stencilOp(7680,7680,7680),m.clearStencil(0),m.cullFace(1029),m.frontFace(2305),m.polygonOffset(0,0),m.activeTexture(33984),m.bindFramebuffer(36160,null),a===!0&&(m.bindFramebuffer(36009,null),m.bindFramebuffer(36008,null)),m.useProgram(null),m.lineWidth(1),m.scissor(0,0,m.canvas.width,m.canvas.height),m.viewport(0,0,m.canvas.width,m.canvas.height),v={},Ht=null,ce={},_=null,x={},M=null,C=!1,A=null,R=null,O=null,U=null,D=null,Z=null,ot=null,vt=!1,mt=null,At=null,Pt=null,Et=null,Ot=null,ze.set(0,0,m.canvas.width,m.canvas.height),fn.set(0,0,m.canvas.width,m.canvas.height),l.reset(),d.reset(),p.reset()}}}function As(m,t,i,a,l,d,p){const v=l.isWebGL2,_=l.maxTextures,x=l.maxCubemapSize,M=l.maxTextureSize,C=l.maxSamples,A=new WeakMap;let R,O=!1;try{O=typeof OffscreenCanvas!="undefined"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function U(Rt,Dt){return O?new OffscreenCanvas(Rt,Dt):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function D(Rt,Dt,Fe,Be){let pe=1;if((Rt.width>Be||Rt.height>Be)&&(pe=Be/Math.max(Rt.width,Rt.height)),pe<1||Dt===!0){if(typeof HTMLImageElement!="undefined"&&Rt instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&Rt instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&Rt instanceof ImageBitmap){const rn=Dt?bp:Math.floor,sn=rn(pe*Rt.width),be=rn(pe*Rt.height);R===void 0&&(R=U(sn,be));const xt=Fe?U(sn,be):R;return xt.width=sn,xt.height=be,xt.getContext("2d").drawImage(Rt,0,0,sn,be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Rt.width+"x"+Rt.height+") to ("+sn+"x"+be+")."),xt}return"data"in Rt&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Rt.width+"x"+Rt.height+")."),Rt}return Rt}function Z(Rt){return xi(Rt.width)&&xi(Rt.height)}function ot(Rt,Dt){return Rt.generateMipmaps&&Dt&&Rt.minFilter!==wt&&Rt.minFilter!==Qe}function vt(Rt,Dt,Fe,Be,pe=1){m.generateMipmap(Rt),a.get(Dt).__maxMipLevel=Math.log2(Math.max(Fe,Be,pe))}function mt(Rt,Dt,Fe){if(v===!1)return Dt;if(Rt!==null){if(m[Rt]!==void 0)return m[Rt];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Rt+"'")}let Be=Dt;return Dt===6403&&(Fe===5126&&(Be=33326),Fe===5131&&(Be=33325),Fe===5121&&(Be=33321)),Dt===6407&&(Fe===5126&&(Be=34837),Fe===5131&&(Be=34843),Fe===5121&&(Be=32849)),Dt===6408&&(Fe===5126&&(Be=34836),Fe===5131&&(Be=34842),Fe===5121&&(Be=32856)),Be!==33325&&Be!==33326&&Be!==34842&&Be!==34836||t.get("EXT_color_buffer_float"),Be}function At(Rt){return Rt===wt||Rt===Vt||Rt===Le?9728:9729}function Pt(Rt){const Dt=Rt.target;Dt.removeEventListener("dispose",Pt),function(Fe){const Be=a.get(Fe);Be.__webglInit!==void 0&&(m.deleteTexture(Be.__webglTexture),a.remove(Fe))}(Dt),Dt.isVideoTexture&&A.delete(Dt),p.memory.textures--}function Et(Rt){const Dt=Rt.target;Dt.removeEventListener("dispose",Et),function(Fe){const Be=Fe.texture,pe=a.get(Fe),rn=a.get(Be);if(!!Fe){if(rn.__webglTexture!==void 0&&(m.deleteTexture(rn.__webglTexture),p.memory.textures--),Fe.depthTexture&&Fe.depthTexture.dispose(),Fe.isWebGLCubeRenderTarget)for(let sn=0;sn<6;sn++)m.deleteFramebuffer(pe.__webglFramebuffer[sn]),pe.__webglDepthbuffer&&m.deleteRenderbuffer(pe.__webglDepthbuffer[sn]);else m.deleteFramebuffer(pe.__webglFramebuffer),pe.__webglDepthbuffer&&m.deleteRenderbuffer(pe.__webglDepthbuffer),pe.__webglMultisampledFramebuffer&&m.deleteFramebuffer(pe.__webglMultisampledFramebuffer),pe.__webglColorRenderbuffer&&m.deleteRenderbuffer(pe.__webglColorRenderbuffer),pe.__webglDepthRenderbuffer&&m.deleteRenderbuffer(pe.__webglDepthRenderbuffer);if(Fe.isWebGLMultipleRenderTargets)for(let sn=0,be=Be.length;sn<be;sn++){const xt=a.get(Be[sn]);xt.__webglTexture&&(m.deleteTexture(xt.__webglTexture),p.memory.textures--),a.remove(Be[sn])}a.remove(Be),a.remove(Fe)}}(Dt)}let Ot=0;function Ie(Rt,Dt){const Fe=a.get(Rt);if(Rt.isVideoTexture&&function(Be){const pe=p.render.frame;A.get(Be)!==pe&&(A.set(Be,pe),Be.update())}(Rt),Rt.version>0&&Fe.__version!==Rt.version){const Be=Rt.image;if(Be===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(Be.complete!==!1)return void We(Fe,Rt,Dt);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}i.activeTexture(33984+Dt),i.bindTexture(3553,Fe.__webglTexture)}function ye(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?function(Be,pe,rn){if(pe.image.length!==6)return;ce(Be,pe),i.activeTexture(33984+rn),i.bindTexture(34067,Be.__webglTexture),m.pixelStorei(37440,pe.flipY),m.pixelStorei(37441,pe.premultiplyAlpha),m.pixelStorei(3317,pe.unpackAlignment),m.pixelStorei(37443,0);const sn=pe&&(pe.isCompressedTexture||pe.image[0].isCompressedTexture),be=pe.image[0]&&pe.image[0].isDataTexture,xt=[];for(let Fn=0;Fn<6;Fn++)xt[Fn]=sn||be?be?pe.image[Fn].image:pe.image[Fn]:D(pe.image[Fn],!1,!0,x);const Zt=xt[0],Te=Z(Zt)||v,Pe=d.convert(pe.format),we=d.convert(pe.type),bn=mt(pe.internalFormat,Pe,we);let Gn;if(Ht(34067,pe,Te),sn){for(let Fn=0;Fn<6;Fn++){Gn=xt[Fn].mipmaps;for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r];pe.format!==Tn&&pe.format!==yn?Pe!==null?i.compressedTexImage2D(34069+Fn,_r,bn,Tr.width,Tr.height,0,Tr.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):i.texImage2D(34069+Fn,_r,bn,Tr.width,Tr.height,0,Pe,we,Tr.data)}}Be.__maxMipLevel=Gn.length-1}else{Gn=pe.mipmaps;for(let Fn=0;Fn<6;Fn++)if(be){i.texImage2D(34069+Fn,0,bn,xt[Fn].width,xt[Fn].height,0,Pe,we,xt[Fn].data);for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r].image[Fn].image;i.texImage2D(34069+Fn,_r+1,bn,Tr.width,Tr.height,0,Pe,we,Tr.data)}}else{i.texImage2D(34069+Fn,0,bn,Pe,we,xt[Fn]);for(let _r=0;_r<Gn.length;_r++){const Tr=Gn[_r];i.texImage2D(34069+Fn,_r+1,bn,Pe,we,Tr.image[Fn])}}Be.__maxMipLevel=Gn.length}ot(pe,Te)&&vt(34067,pe,Zt.width,Zt.height),Be.__version=pe.version,pe.onUpdate&&pe.onUpdate(pe)}(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(34067,Fe.__webglTexture))}const xe={[yt]:10497,[St]:33071,[Ct]:33648},ge={[wt]:9728,[Vt]:9984,[Le]:9986,[Qe]:9729,[Qn]:9985,[Yr]:9987};function Ht(Rt,Dt,Fe){if(Fe?(m.texParameteri(Rt,10242,xe[Dt.wrapS]),m.texParameteri(Rt,10243,xe[Dt.wrapT]),Rt!==32879&&Rt!==35866||m.texParameteri(Rt,32882,xe[Dt.wrapR]),m.texParameteri(Rt,10240,ge[Dt.magFilter]),m.texParameteri(Rt,10241,ge[Dt.minFilter])):(m.texParameteri(Rt,10242,33071),m.texParameteri(Rt,10243,33071),Rt!==32879&&Rt!==35866||m.texParameteri(Rt,32882,33071),Dt.wrapS===St&&Dt.wrapT===St||console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),m.texParameteri(Rt,10240,At(Dt.magFilter)),m.texParameteri(Rt,10241,At(Dt.minFilter)),Dt.minFilter!==wt&&Dt.minFilter!==Qe&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),t.has("EXT_texture_filter_anisotropic")===!0){const Be=t.get("EXT_texture_filter_anisotropic");if(Dt.type===ee&&t.has("OES_texture_float_linear")===!1||v===!1&&Dt.type===Ft&&t.has("OES_texture_half_float_linear")===!1)return;(Dt.anisotropy>1||a.get(Dt).__currentAnisotropy)&&(m.texParameterf(Rt,Be.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(Dt.anisotropy,l.getMaxAnisotropy())),a.get(Dt).__currentAnisotropy=Dt.anisotropy)}}function ce(Rt,Dt){Rt.__webglInit===void 0&&(Rt.__webglInit=!0,Dt.addEventListener("dispose",Pt),Rt.__webglTexture=m.createTexture(),p.memory.textures++)}function We(Rt,Dt,Fe){let Be=3553;Dt.isDataTexture2DArray&&(Be=35866),Dt.isDataTexture3D&&(Be=32879),ce(Rt,Dt),i.activeTexture(33984+Fe),i.bindTexture(Be,Rt.__webglTexture),m.pixelStorei(37440,Dt.flipY),m.pixelStorei(37441,Dt.premultiplyAlpha),m.pixelStorei(3317,Dt.unpackAlignment),m.pixelStorei(37443,0);const pe=function(we){return!v&&(we.wrapS!==St||we.wrapT!==St||we.minFilter!==wt&&we.minFilter!==Qe)}(Dt)&&Z(Dt.image)===!1,rn=D(Dt.image,pe,!1,M),sn=Z(rn)||v,be=d.convert(Dt.format);let xt,Zt=d.convert(Dt.type),Te=mt(Dt.internalFormat,be,Zt);Ht(Be,Dt,sn);const Pe=Dt.mipmaps;if(Dt.isDepthTexture)Te=6402,v?Te=Dt.type===ee?36012:Dt.type===Yo?33190:Dt.type===un?35056:33189:Dt.type===ee&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),Dt.format===dn&&Te===6402&&Dt.type!==Aa&&Dt.type!==Yo&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),Dt.type=Aa,Zt=d.convert(Dt.type)),Dt.format===rr&&Te===6402&&(Te=34041,Dt.type!==un&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),Dt.type=un,Zt=d.convert(Dt.type))),i.texImage2D(3553,0,Te,rn.width,rn.height,0,be,Zt,null);else if(Dt.isDataTexture)if(Pe.length>0&&sn){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],i.texImage2D(3553,we,Te,xt.width,xt.height,0,be,Zt,xt.data);Dt.generateMipmaps=!1,Rt.__maxMipLevel=Pe.length-1}else i.texImage2D(3553,0,Te,rn.width,rn.height,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Dt.isCompressedTexture){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],Dt.format!==Tn&&Dt.format!==yn?be!==null?i.compressedTexImage2D(3553,we,Te,xt.width,xt.height,0,xt.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):i.texImage2D(3553,we,Te,xt.width,xt.height,0,be,Zt,xt.data);Rt.__maxMipLevel=Pe.length-1}else if(Dt.isDataTexture2DArray)i.texImage3D(35866,0,Te,rn.width,rn.height,rn.depth,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Dt.isDataTexture3D)i.texImage3D(32879,0,Te,rn.width,rn.height,rn.depth,0,be,Zt,rn.data),Rt.__maxMipLevel=0;else if(Pe.length>0&&sn){for(let we=0,bn=Pe.length;we<bn;we++)xt=Pe[we],i.texImage2D(3553,we,Te,be,Zt,xt);Dt.generateMipmaps=!1,Rt.__maxMipLevel=Pe.length-1}else i.texImage2D(3553,0,Te,be,Zt,rn),Rt.__maxMipLevel=0;ot(Dt,sn)&&vt(Be,Dt,rn.width,rn.height),Rt.__version=Dt.version,Dt.onUpdate&&Dt.onUpdate(Dt)}function je(Rt,Dt,Fe,Be,pe){const rn=d.convert(Fe.format),sn=d.convert(Fe.type),be=mt(Fe.internalFormat,rn,sn);pe===32879||pe===35866?i.texImage3D(pe,0,be,Dt.width,Dt.height,Dt.depth,0,rn,sn,null):i.texImage2D(pe,0,be,Dt.width,Dt.height,0,rn,sn,null),i.bindFramebuffer(36160,Rt),m.framebufferTexture2D(36160,Be,pe,a.get(Fe).__webglTexture,0),i.bindFramebuffer(36160,null)}function ze(Rt,Dt,Fe){if(m.bindRenderbuffer(36161,Rt),Dt.depthBuffer&&!Dt.stencilBuffer){let Be=33189;if(Fe){const pe=Dt.depthTexture;pe&&pe.isDepthTexture&&(pe.type===ee?Be=36012:pe.type===Yo&&(Be=33190));const rn=_n(Dt);m.renderbufferStorageMultisample(36161,rn,Be,Dt.width,Dt.height)}else m.renderbufferStorage(36161,Be,Dt.width,Dt.height);m.framebufferRenderbuffer(36160,36096,36161,Rt)}else if(Dt.depthBuffer&&Dt.stencilBuffer){if(Fe){const Be=_n(Dt);m.renderbufferStorageMultisample(36161,Be,35056,Dt.width,Dt.height)}else m.renderbufferStorage(36161,34041,Dt.width,Dt.height);m.framebufferRenderbuffer(36160,33306,36161,Rt)}else{const Be=Dt.isWebGLMultipleRenderTargets===!0?Dt.texture[0]:Dt.texture,pe=d.convert(Be.format),rn=d.convert(Be.type),sn=mt(Be.internalFormat,pe,rn);if(Fe){const be=_n(Dt);m.renderbufferStorageMultisample(36161,be,sn,Dt.width,Dt.height)}else m.renderbufferStorage(36161,sn,Dt.width,Dt.height)}m.bindRenderbuffer(36161,null)}function fn(Rt){const Dt=a.get(Rt),Fe=Rt.isWebGLCubeRenderTarget===!0;if(Rt.depthTexture){if(Fe)throw new Error("target.depthTexture not supported in Cube render targets");(function(Be,pe){if(pe&&pe.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(i.bindFramebuffer(36160,Be),!pe.depthTexture||!pe.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");a.get(pe.depthTexture).__webglTexture&&pe.depthTexture.image.width===pe.width&&pe.depthTexture.image.height===pe.height||(pe.depthTexture.image.width=pe.width,pe.depthTexture.image.height=pe.height,pe.depthTexture.needsUpdate=!0),Ie(pe.depthTexture,0);const rn=a.get(pe.depthTexture).__webglTexture;if(pe.depthTexture.format===dn)m.framebufferTexture2D(36160,36096,3553,rn,0);else{if(pe.depthTexture.format!==rr)throw new Error("Unknown depthTexture format");m.framebufferTexture2D(36160,33306,3553,rn,0)}})(Dt.__webglFramebuffer,Rt)}else if(Fe){Dt.__webglDepthbuffer=[];for(let Be=0;Be<6;Be++)i.bindFramebuffer(36160,Dt.__webglFramebuffer[Be]),Dt.__webglDepthbuffer[Be]=m.createRenderbuffer(),ze(Dt.__webglDepthbuffer[Be],Rt,!1)}else i.bindFramebuffer(36160,Dt.__webglFramebuffer),Dt.__webglDepthbuffer=m.createRenderbuffer(),ze(Dt.__webglDepthbuffer,Rt,!1);i.bindFramebuffer(36160,null)}function _n(Rt){return v&&Rt.isWebGLMultisampleRenderTarget?Math.min(C,Rt.samples):0}let Mn=!1,Sn=!1;this.allocateTextureUnit=function(){const Rt=Ot;return Rt>=_&&console.warn("THREE.WebGLTextures: Trying to use "+Rt+" texture units while this GPU supports only "+_),Ot+=1,Rt},this.resetTextureUnits=function(){Ot=0},this.setTexture2D=Ie,this.setTexture2DArray=function(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?We(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(35866,Fe.__webglTexture))},this.setTexture3D=function(Rt,Dt){const Fe=a.get(Rt);Rt.version>0&&Fe.__version!==Rt.version?We(Fe,Rt,Dt):(i.activeTexture(33984+Dt),i.bindTexture(32879,Fe.__webglTexture))},this.setTextureCube=ye,this.setupRenderTarget=function(Rt){const Dt=Rt.texture,Fe=a.get(Rt),Be=a.get(Dt);Rt.addEventListener("dispose",Et),Rt.isWebGLMultipleRenderTargets!==!0&&(Be.__webglTexture=m.createTexture(),Be.__version=Dt.version,p.memory.textures++);const pe=Rt.isWebGLCubeRenderTarget===!0,rn=Rt.isWebGLMultipleRenderTargets===!0,sn=Rt.isWebGLMultisampleRenderTarget===!0,be=Dt.isDataTexture3D||Dt.isDataTexture2DArray,xt=Z(Rt)||v;if(!v||Dt.format!==yn||Dt.type!==ee&&Dt.type!==Ft||(Dt.format=Tn,console.warn("THREE.WebGLRenderer: Rendering to textures with RGB format is not supported. Using RGBA format instead.")),pe){Fe.__webglFramebuffer=[];for(let Zt=0;Zt<6;Zt++)Fe.__webglFramebuffer[Zt]=m.createFramebuffer()}else if(Fe.__webglFramebuffer=m.createFramebuffer(),rn)if(l.drawBuffers){const Zt=Rt.texture;for(let Te=0,Pe=Zt.length;Te<Pe;Te++){const we=a.get(Zt[Te]);we.__webglTexture===void 0&&(we.__webglTexture=m.createTexture(),p.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.");else if(sn)if(v){Fe.__webglMultisampledFramebuffer=m.createFramebuffer(),Fe.__webglColorRenderbuffer=m.createRenderbuffer(),m.bindRenderbuffer(36161,Fe.__webglColorRenderbuffer);const Zt=d.convert(Dt.format),Te=d.convert(Dt.type),Pe=mt(Dt.internalFormat,Zt,Te),we=_n(Rt);m.renderbufferStorageMultisample(36161,we,Pe,Rt.width,Rt.height),i.bindFramebuffer(36160,Fe.__webglMultisampledFramebuffer),m.framebufferRenderbuffer(36160,36064,36161,Fe.__webglColorRenderbuffer),m.bindRenderbuffer(36161,null),Rt.depthBuffer&&(Fe.__webglDepthRenderbuffer=m.createRenderbuffer(),ze(Fe.__webglDepthRenderbuffer,Rt,!0)),i.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(pe){i.bindTexture(34067,Be.__webglTexture),Ht(34067,Dt,xt);for(let Zt=0;Zt<6;Zt++)je(Fe.__webglFramebuffer[Zt],Rt,Dt,36064,34069+Zt);ot(Dt,xt)&&vt(34067,Dt,Rt.width,Rt.height),i.bindTexture(34067,null)}else if(rn){const Zt=Rt.texture;for(let Te=0,Pe=Zt.length;Te<Pe;Te++){const we=Zt[Te],bn=a.get(we);i.bindTexture(3553,bn.__webglTexture),Ht(3553,we,xt),je(Fe.__webglFramebuffer,Rt,we,36064+Te,3553),ot(we,xt)&&vt(3553,we,Rt.width,Rt.height)}i.bindTexture(3553,null)}else{let Zt=3553;be&&(v?Zt=Dt.isDataTexture3D?32879:35866:console.warn("THREE.DataTexture3D and THREE.DataTexture2DArray only supported with WebGL2.")),i.bindTexture(Zt,Be.__webglTexture),Ht(Zt,Dt,xt),je(Fe.__webglFramebuffer,Rt,Dt,36064,Zt),ot(Dt,xt)&&vt(Zt,Dt,Rt.width,Rt.height,Rt.depth),i.bindTexture(Zt,null)}Rt.depthBuffer&&fn(Rt)},this.updateRenderTargetMipmap=function(Rt){const Dt=Z(Rt)||v,Fe=Rt.isWebGLMultipleRenderTargets===!0?Rt.texture:[Rt.texture];for(let Be=0,pe=Fe.length;Be<pe;Be++){const rn=Fe[Be];if(ot(rn,Dt)){const sn=Rt.isWebGLCubeRenderTarget?34067:3553,be=a.get(rn).__webglTexture;i.bindTexture(sn,be),vt(sn,rn,Rt.width,Rt.height),i.bindTexture(sn,null)}}},this.updateMultisampleRenderTarget=function(Rt){if(Rt.isWebGLMultisampleRenderTarget)if(v){const Dt=Rt.width,Fe=Rt.height;let Be=16384;Rt.depthBuffer&&(Be|=256),Rt.stencilBuffer&&(Be|=1024);const pe=a.get(Rt);i.bindFramebuffer(36008,pe.__webglMultisampledFramebuffer),i.bindFramebuffer(36009,pe.__webglFramebuffer),m.blitFramebuffer(0,0,Dt,Fe,0,0,Dt,Fe,Be,9728),i.bindFramebuffer(36008,null),i.bindFramebuffer(36009,pe.__webglMultisampledFramebuffer)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")},this.safeSetTexture2D=function(Rt,Dt){Rt&&Rt.isWebGLRenderTarget&&(Mn===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),Mn=!0),Rt=Rt.texture),Ie(Rt,Dt)},this.safeSetTextureCube=function(Rt,Dt){Rt&&Rt.isWebGLCubeRenderTarget&&(Sn===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),Sn=!0),Rt=Rt.texture),ye(Rt,Dt)}}function Gc(m,t,i){const a=i.isWebGL2;return{convert:function(l){let d;if(l===lo)return 5121;if(l===Se)return 32819;if(l===Ge)return 32820;if(l===Ve)return 33635;if(l===gs)return 5120;if(l===Qs)return 5122;if(l===Aa)return 5123;if(l===Qu)return 5124;if(l===Yo)return 5125;if(l===ee)return 5126;if(l===Ft)return a?5131:(d=t.get("OES_texture_half_float"),d!==null?d.HALF_FLOAT_OES:null);if(l===Dn)return 6406;if(l===yn)return 6407;if(l===Tn)return 6408;if(l===mr)return 6409;if(l===gr)return 6410;if(l===dn)return 6402;if(l===rr)return 34041;if(l===ui)return 6403;if(l===Zn)return 36244;if(l===Gr)return 33319;if(l===ii)return 33320;if(l===Er)return 36248;if(l===$r)return 36249;if(l===ns||l===cu||l===Ki||l===Qr){if(d=t.get("WEBGL_compressed_texture_s3tc"),d===null)return null;if(l===ns)return d.COMPRESSED_RGB_S3TC_DXT1_EXT;if(l===cu)return d.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(l===Ki)return d.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(l===Qr)return d.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(l===hc||l===cc||l===du||l===th){if(d=t.get("WEBGL_compressed_texture_pvrtc"),d===null)return null;if(l===hc)return d.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(l===cc)return d.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(l===du)return d.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(l===th)return d.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(l===pu)return d=t.get("WEBGL_compressed_texture_etc1"),d!==null?d.COMPRESSED_RGB_ETC1_WEBGL:null;if((l===eh||l===Do)&&(d=t.get("WEBGL_compressed_texture_etc"),d!==null)){if(l===eh)return d.COMPRESSED_RGB8_ETC2;if(l===Do)return d.COMPRESSED_RGBA8_ETC2_EAC}return l===_d||l===uo||l===_i||l===fu||l===Ca||l===nh||l===dr||l===ti||l===Pa||l===El||l===dc||l===oi||l===Ml||l===yi||l===rs||l===ol||l===Ra||l===rh||l===ih||l===Al||l===ei||l===oh||l===Cl||l===pc||l===wo||l===hi||l===Pl||l===yd?(d=t.get("WEBGL_compressed_texture_astc"),d!==null?l:null):l===Fs?(d=t.get("EXT_texture_compression_bptc"),d!==null?l:null):l===un?a?34042:(d=t.get("WEBGL_depth_texture"),d!==null?d.UNSIGNED_INT_24_8_WEBGL:null):void 0}}}class zr extends Yi{constructor(t=[]){super(),this.cameras=t}}zr.prototype.isArrayCamera=!0;class vl extends ar{constructor(){super(),this.type="Group"}}vl.prototype.isGroup=!0;const Wp={type:"move"};class Kl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new vl,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new vl,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new gt,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new gt),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new vl,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new gt,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new gt),this._grip}dispatchEvent(t){return this._targetRay!==null&&this._targetRay.dispatchEvent(t),this._grip!==null&&this._grip.dispatchEvent(t),this._hand!==null&&this._hand.dispatchEvent(t),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(t,i,a){let l=null,d=null,p=null;const v=this._targetRay,_=this._grip,x=this._hand;if(t&&i.session.visibilityState!=="visible-blurred")if(v!==null&&(l=i.getPose(t.targetRaySpace,a),l!==null&&(v.matrix.fromArray(l.transform.matrix),v.matrix.decompose(v.position,v.rotation,v.scale),l.linearVelocity?(v.hasLinearVelocity=!0,v.linearVelocity.copy(l.linearVelocity)):v.hasLinearVelocity=!1,l.angularVelocity?(v.hasAngularVelocity=!0,v.angularVelocity.copy(l.angularVelocity)):v.hasAngularVelocity=!1,this.dispatchEvent(Wp))),x&&t.hand){p=!0;for(const U of t.hand.values()){const D=i.getJointPose(U,a);if(x.joints[U.jointName]===void 0){const ot=new vl;ot.matrixAutoUpdate=!1,ot.visible=!1,x.joints[U.jointName]=ot,x.add(ot)}const Z=x.joints[U.jointName];D!==null&&(Z.matrix.fromArray(D.transform.matrix),Z.matrix.decompose(Z.position,Z.rotation,Z.scale),Z.jointRadius=D.radius),Z.visible=D!==null}const M=x.joints["index-finger-tip"],C=x.joints["thumb-tip"],A=M.position.distanceTo(C.position),R=.02,O=.005;x.inputState.pinching&&A>R+O?(x.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!x.inputState.pinching&&A<=R-O&&(x.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else _!==null&&t.gripSpace&&(d=i.getPose(t.gripSpace,a),d!==null&&(_.matrix.fromArray(d.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),d.linearVelocity?(_.hasLinearVelocity=!0,_.linearVelocity.copy(d.linearVelocity)):_.hasLinearVelocity=!1,d.angularVelocity?(_.hasAngularVelocity=!0,_.angularVelocity.copy(d.angularVelocity)):_.hasAngularVelocity=!1));return v!==null&&(v.visible=l!==null),_!==null&&(_.visible=d!==null),x!==null&&(x.visible=p!==null),this}}class Pf extends Fa{constructor(t,i){super();const a=this,l=t.state;let d=null,p=1,v=null,_="local-floor",x=null,M=null,C=null,A=null;const R=[],O=new Map,U=new Yi;U.layers.enable(1),U.viewport=new Ir;const D=new Yi;D.layers.enable(2),D.viewport=new Ir;const Z=[U,D],ot=new zr;ot.layers.enable(1),ot.layers.enable(2);let vt=null,mt=null;function At(Ht){const ce=O.get(Ht.inputSource);ce&&ce.dispatchEvent({type:Ht.type,data:Ht.inputSource})}function Pt(){O.forEach(function(Ht,ce){Ht.disconnect(ce)}),O.clear(),vt=null,mt=null,l.bindXRFramebuffer(null),t.setRenderTarget(t.getRenderTarget()),ge.stop(),a.isPresenting=!1,a.dispatchEvent({type:"sessionend"})}function Et(Ht){const ce=d.inputSources;for(let We=0;We<R.length;We++)O.set(ce[We],R[We]);for(let We=0;We<Ht.removed.length;We++){const je=Ht.removed[We],ze=O.get(je);ze&&(ze.dispatchEvent({type:"disconnected",data:je}),O.delete(je))}for(let We=0;We<Ht.added.length;We++){const je=Ht.added[We],ze=O.get(je);ze&&ze.dispatchEvent({type:"connected",data:je})}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new Kl,R[Ht]=ce),ce.getTargetRaySpace()},this.getControllerGrip=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new Kl,R[Ht]=ce),ce.getGripSpace()},this.getHand=function(Ht){let ce=R[Ht];return ce===void 0&&(ce=new Kl,R[Ht]=ce),ce.getHandSpace()},this.setFramebufferScaleFactor=function(Ht){p=Ht,a.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(Ht){_=Ht,a.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return v},this.getSession=function(){return d},this.setSession=async function(Ht){if(d=Ht,d!==null){d.addEventListener("select",At),d.addEventListener("selectstart",At),d.addEventListener("selectend",At),d.addEventListener("squeeze",At),d.addEventListener("squeezestart",At),d.addEventListener("squeezeend",At),d.addEventListener("end",Pt),d.addEventListener("inputsourceschange",Et);const ce=i.getContextAttributes();if(ce.xrCompatible!==!0&&await i.makeXRCompatible(),d.renderState.layers===void 0){const We={antialias:ce.antialias,alpha:ce.alpha,depth:ce.depth,stencil:ce.stencil,framebufferScaleFactor:p},je=new XRWebGLLayer(d,i,We);d.updateRenderState({baseLayer:je})}else{let We=0;ce.depth&&(We=ce.stencil?34041:6402);const je={colorFormat:ce.alpha?6408:6407,depthFormat:We,scaleFactor:p};M=new XRWebGLBinding(d,i),A=M.createProjectionLayer(je),C=i.createFramebuffer(),d.updateRenderState({layers:[A]})}v=await d.requestReferenceSpace(_),ge.setContext(d),ge.start(),a.isPresenting=!0,a.dispatchEvent({type:"sessionstart"})}};const Ot=new gt,Ie=new gt;function ye(Ht,ce){ce===null?Ht.matrixWorld.copy(Ht.matrix):Ht.matrixWorld.multiplyMatrices(ce.matrixWorld,Ht.matrix),Ht.matrixWorldInverse.copy(Ht.matrixWorld).invert()}this.updateCamera=function(Ht){if(d===null)return;ot.near=D.near=U.near=Ht.near,ot.far=D.far=U.far=Ht.far,vt===ot.near&&mt===ot.far||(d.updateRenderState({depthNear:ot.near,depthFar:ot.far}),vt=ot.near,mt=ot.far);const ce=Ht.parent,We=ot.cameras;ye(ot,ce);for(let ze=0;ze<We.length;ze++)ye(We[ze],ce);ot.matrixWorld.decompose(ot.position,ot.quaternion,ot.scale),Ht.position.copy(ot.position),Ht.quaternion.copy(ot.quaternion),Ht.scale.copy(ot.scale),Ht.matrix.copy(ot.matrix),Ht.matrixWorld.copy(ot.matrixWorld);const je=Ht.children;for(let ze=0,fn=je.length;ze<fn;ze++)je[ze].updateMatrixWorld(!0);We.length===2?function(ze,fn,_n){Ot.setFromMatrixPosition(fn.matrixWorld),Ie.setFromMatrixPosition(_n.matrixWorld);const Mn=Ot.distanceTo(Ie),Sn=fn.projectionMatrix.elements,Rt=_n.projectionMatrix.elements,Dt=Sn[14]/(Sn[10]-1),Fe=Sn[14]/(Sn[10]+1),Be=(Sn[9]+1)/Sn[5],pe=(Sn[9]-1)/Sn[5],rn=(Sn[8]-1)/Sn[0],sn=(Rt[8]+1)/Rt[0],be=Dt*rn,xt=Dt*sn,Zt=Mn/(-rn+sn),Te=Zt*-rn;fn.matrixWorld.decompose(ze.position,ze.quaternion,ze.scale),ze.translateX(Te),ze.translateZ(Zt),ze.matrixWorld.compose(ze.position,ze.quaternion,ze.scale),ze.matrixWorldInverse.copy(ze.matrixWorld).invert();const Pe=Dt+Zt,we=Fe+Zt,bn=be-Te,Gn=xt+(Mn-Te),Fn=Be*Fe/we*Pe,_r=pe*Fe/we*Pe;ze.projectionMatrix.makePerspective(bn,Gn,Fn,_r,Pe,we)}(ot,U,D):ot.projectionMatrix.copy(U.projectionMatrix)},this.getCamera=function(){return ot};let xe=null;const ge=new Eh;ge.setAnimationLoop(function(Ht,ce){if(x=ce.getViewerPose(v),x!==null){const je=x.views,ze=d.renderState.baseLayer;d.renderState.layers===void 0&&l.bindXRFramebuffer(ze.framebuffer);let fn=!1;je.length!==ot.cameras.length&&(ot.cameras.length=0,fn=!0);for(let _n=0;_n<je.length;_n++){const Mn=je[_n];let Sn=null;if(d.renderState.layers===void 0)Sn=ze.getViewport(Mn);else{const Dt=M.getViewSubImage(A,Mn);l.bindXRFramebuffer(C),i.framebufferTexture2D(36160,36064,3553,Dt.colorTexture,0),Dt.depthStencilTexture!==void 0&&i.framebufferTexture2D(36160,36096,3553,Dt.depthStencilTexture,0),Sn=Dt.viewport}const Rt=Z[_n];Rt.matrix.fromArray(Mn.transform.matrix),Rt.projectionMatrix.fromArray(Mn.projectionMatrix),Rt.viewport.set(Sn.x,Sn.y,Sn.width,Sn.height),_n===0&&ot.matrix.copy(Rt.matrix),fn===!0&&ot.cameras.push(Rt)}}const We=d.inputSources;for(let je=0;je<R.length;je++){const ze=R[je],fn=We[je];ze.update(fn,ce,v)}xe&&xe(Ht,ce)}),this.setAnimationLoop=function(Ht){xe=Ht},this.dispose=function(){}}}function Xp(m){function t(a,l){a.opacity.value=l.opacity,l.color&&a.diffuse.value.copy(l.color),l.emissive&&a.emissive.value.copy(l.emissive).multiplyScalar(l.emissiveIntensity),l.map&&(a.map.value=l.map),l.alphaMap&&(a.alphaMap.value=l.alphaMap),l.specularMap&&(a.specularMap.value=l.specularMap);const d=m.get(l).envMap;if(d){a.envMap.value=d,a.flipEnvMap.value=d.isCubeTexture&&d._needsFlipEnvMap?-1:1,a.reflectivity.value=l.reflectivity,a.refractionRatio.value=l.refractionRatio;const _=m.get(d).__maxMipLevel;_!==void 0&&(a.maxMipLevel.value=_)}let p,v;l.lightMap&&(a.lightMap.value=l.lightMap,a.lightMapIntensity.value=l.lightMapIntensity),l.aoMap&&(a.aoMap.value=l.aoMap,a.aoMapIntensity.value=l.aoMapIntensity),l.map?p=l.map:l.specularMap?p=l.specularMap:l.displacementMap?p=l.displacementMap:l.normalMap?p=l.normalMap:l.bumpMap?p=l.bumpMap:l.roughnessMap?p=l.roughnessMap:l.metalnessMap?p=l.metalnessMap:l.alphaMap?p=l.alphaMap:l.emissiveMap?p=l.emissiveMap:l.clearcoatMap?p=l.clearcoatMap:l.clearcoatNormalMap?p=l.clearcoatNormalMap:l.clearcoatRoughnessMap&&(p=l.clearcoatRoughnessMap),p!==void 0&&(p.isWebGLRenderTarget&&(p=p.texture),p.matrixAutoUpdate===!0&&p.updateMatrix(),a.uvTransform.value.copy(p.matrix)),l.aoMap?v=l.aoMap:l.lightMap&&(v=l.lightMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),a.uv2Transform.value.copy(v.matrix))}function i(a,l){a.roughness.value=l.roughness,a.metalness.value=l.metalness,l.roughnessMap&&(a.roughnessMap.value=l.roughnessMap),l.metalnessMap&&(a.metalnessMap.value=l.metalnessMap),l.emissiveMap&&(a.emissiveMap.value=l.emissiveMap),l.bumpMap&&(a.bumpMap.value=l.bumpMap,a.bumpScale.value=l.bumpScale,l.side===L&&(a.bumpScale.value*=-1)),l.normalMap&&(a.normalMap.value=l.normalMap,a.normalScale.value.copy(l.normalScale),l.side===L&&a.normalScale.value.negate()),l.displacementMap&&(a.displacementMap.value=l.displacementMap,a.displacementScale.value=l.displacementScale,a.displacementBias.value=l.displacementBias),m.get(l).envMap&&(a.envMapIntensity.value=l.envMapIntensity)}return{refreshFogUniforms:function(a,l){a.fogColor.value.copy(l.color),l.isFog?(a.fogNear.value=l.near,a.fogFar.value=l.far):l.isFogExp2&&(a.fogDensity.value=l.density)},refreshMaterialUniforms:function(a,l,d,p,v){l.isMeshBasicMaterial?t(a,l):l.isMeshLambertMaterial?(t(a,l),function(_,x){x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap)}(a,l)):l.isMeshToonMaterial?(t(a,l),function(_,x){x.gradientMap&&(_.gradientMap.value=x.gradientMap),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshPhongMaterial?(t(a,l),function(_,x){_.specular.value.copy(x.specular),_.shininess.value=Math.max(x.shininess,1e-4),x.emissiveMap&&(_.emissiveMap.value=x.emissiveMap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshStandardMaterial?(t(a,l),l.isMeshPhysicalMaterial?function(_,x,M){i(_,x),_.reflectivity.value=x.reflectivity,_.clearcoat.value=x.clearcoat,_.clearcoatRoughness.value=x.clearcoatRoughness,x.sheen&&_.sheen.value.copy(x.sheen),x.clearcoatMap&&(_.clearcoatMap.value=x.clearcoatMap),x.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=x.clearcoatRoughnessMap),x.clearcoatNormalMap&&(_.clearcoatNormalScale.value.copy(x.clearcoatNormalScale),_.clearcoatNormalMap.value=x.clearcoatNormalMap,x.side===L&&_.clearcoatNormalScale.value.negate()),_.transmission.value=x.transmission,x.transmissionMap&&(_.transmissionMap.value=x.transmissionMap),x.transmission>0&&(_.transmissionSamplerMap.value=M.texture,_.transmissionSamplerSize.value.set(M.width,M.height)),_.thickness.value=x.thickness,x.thicknessMap&&(_.thicknessMap.value=x.thicknessMap),_.attenuationDistance.value=x.attenuationDistance,_.attenuationColor.value.copy(x.attenuationColor)}(a,l,v):i(a,l)):l.isMeshMatcapMaterial?(t(a,l),function(_,x){x.matcap&&(_.matcap.value=x.matcap),x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshDepthMaterial?(t(a,l),function(_,x){x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isMeshDistanceMaterial?(t(a,l),function(_,x){x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias),_.referencePosition.value.copy(x.referencePosition),_.nearDistance.value=x.nearDistance,_.farDistance.value=x.farDistance}(a,l)):l.isMeshNormalMaterial?(t(a,l),function(_,x){x.bumpMap&&(_.bumpMap.value=x.bumpMap,_.bumpScale.value=x.bumpScale,x.side===L&&(_.bumpScale.value*=-1)),x.normalMap&&(_.normalMap.value=x.normalMap,_.normalScale.value.copy(x.normalScale),x.side===L&&_.normalScale.value.negate()),x.displacementMap&&(_.displacementMap.value=x.displacementMap,_.displacementScale.value=x.displacementScale,_.displacementBias.value=x.displacementBias)}(a,l)):l.isLineBasicMaterial?(function(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity}(a,l),l.isLineDashedMaterial&&function(_,x){_.dashSize.value=x.dashSize,_.totalSize.value=x.dashSize+x.gapSize,_.scale.value=x.scale}(a,l)):l.isPointsMaterial?function(_,x,M,C){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.size.value=x.size*M,_.scale.value=.5*C,x.map&&(_.map.value=x.map),x.alphaMap&&(_.alphaMap.value=x.alphaMap);let A;x.map?A=x.map:x.alphaMap&&(A=x.alphaMap),A!==void 0&&(A.matrixAutoUpdate===!0&&A.updateMatrix(),_.uvTransform.value.copy(A.matrix))}(a,l,d,p):l.isSpriteMaterial?function(_,x){_.diffuse.value.copy(x.color),_.opacity.value=x.opacity,_.rotation.value=x.rotation,x.map&&(_.map.value=x.map),x.alphaMap&&(_.alphaMap.value=x.alphaMap);let M;x.map?M=x.map:x.alphaMap&&(M=x.alphaMap),M!==void 0&&(M.matrixAutoUpdate===!0&&M.updateMatrix(),_.uvTransform.value.copy(M.matrix))}(a,l):l.isShadowMaterial?(a.color.value.copy(l.color),a.opacity.value=l.opacity):l.isShaderMaterial&&(l.uniformsNeedUpdate=!1)}}}function Fr(m={}){const t=m.canvas!==void 0?m.canvas:function(){const It=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");return It.style.display="block",It}(),i=m.context!==void 0?m.context:null,a=m.alpha!==void 0&&m.alpha,l=m.depth===void 0||m.depth,d=m.stencil===void 0||m.stencil,p=m.antialias!==void 0&&m.antialias,v=m.premultipliedAlpha===void 0||m.premultipliedAlpha,_=m.preserveDrawingBuffer!==void 0&&m.preserveDrawingBuffer,x=m.powerPreference!==void 0?m.powerPreference:"default",M=m.failIfMajorPerformanceCaveat!==void 0&&m.failIfMajorPerformanceCaveat;let C=null,A=null;const R=[],O=[];this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.outputEncoding=Wr,this.physicallyCorrectLights=!1,this.toneMapping=Or,this.toneMappingExposure=1;const U=this;let D=!1,Z=0,ot=0,vt=null,mt=-1,At=null;const Pt=new Ir,Et=new Ir;let Ot=null,Ie=t.width,ye=t.height,xe=1,ge=null,Ht=null;const ce=new Ir(0,0,Ie,ye),We=new Ir(0,0,Ie,ye);let je=!1;const ze=[],fn=new ja;let _n=!1,Mn=!1,Sn=null;const Rt=new En,Dt=new gt,Fe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Be(){return vt===null?xe:1}let pe,rn,sn,be,xt,Zt,Te,Pe,we,bn,Gn,Fn,_r,Tr,Xo,fi,uu,sm,am,lm,$s,Ma,qe=i;function Dg(It,Me){for(let se=0;se<It.length;se++){const Ce=It[se],en=t.getContext(Ce,Me);if(en!==null)return en}return null}try{const It={alpha:a,depth:l,stencil:d,antialias:p,premultipliedAlpha:v,preserveDrawingBuffer:_,powerPreference:x,failIfMajorPerformanceCaveat:M};if(t.addEventListener("webglcontextlost",Fg,!1),t.addEventListener("webglcontextrestored",Bg,!1),qe===null){const Me=["webgl2","webgl","experimental-webgl"];if(U.isWebGL1Renderer===!0&&Me.shift(),qe=Dg(Me,It),qe===null)throw Dg(Me)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}qe.getShaderPrecisionFormat===void 0&&(qe.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(It){throw console.error("THREE.WebGLRenderer: "+It.message),It}function Ng(){pe=new Mp(qe),rn=new Gi(qe,pe,m),pe.init(rn),$s=new Gc(qe,pe,rn),sn=new qd(qe,pe,rn),ze[0]=1029,be=new Cp(qe),xt=new ci,Zt=new As(qe,pe,sn,xt,rn,$s,be),Te=new ml(U),Pe=new Va(qe,rn),Ma=new vf(qe,pe,Pe,rn),we=new Ah(qe,Pe,be,Ma),bn=new Pc(qe,we,Pe,be),sm=new Cc(qe),Xo=new Mc(xt),Gn=new si(U,Te,pe,rn,Ma,Xo),Fn=new Xp(xt),_r=new Uc(xt),Tr=new Xd(pe,rn),uu=new Mh(U,Te,sn,bn,v),fi=new or(U,bn,rn),am=new fa(qe,pe,be,rn),lm=new Ap(qe,pe,be,rn),be.programs=Gn.programs,U.capabilities=rn,U.extensions=pe,U.properties=xt,U.renderLists=_r,U.shadowMap=fi,U.state=sn,U.info=be}Ng();const nl=new Pf(U,qe);function Fg(It){It.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),D=!0}function Bg(){console.log("THREE.WebGLRenderer: Context Restored."),D=!1;const It=be.autoReset,Me=fi.enabled,se=fi.autoUpdate,Ce=fi.needsUpdate,en=fi.type;Ng(),be.autoReset=It,fi.enabled=Me,fi.autoUpdate=se,fi.needsUpdate=Ce,fi.type=en}function kg(It){const Me=It.target;Me.removeEventListener("dispose",kg),function(se){(function(Ce){const en=xt.get(Ce).programs;en!==void 0&&en.forEach(function(Xr){Gn.releaseProgram(Xr)})})(se),xt.remove(se)}(Me)}this.xr=nl,this.getContext=function(){return qe},this.getContextAttributes=function(){return qe.getContextAttributes()},this.forceContextLoss=function(){const It=pe.get("WEBGL_lose_context");It&&It.loseContext()},this.forceContextRestore=function(){const It=pe.get("WEBGL_lose_context");It&&It.restoreContext()},this.getPixelRatio=function(){return xe},this.setPixelRatio=function(It){It!==void 0&&(xe=It,this.setSize(Ie,ye,!1))},this.getSize=function(It){return It.set(Ie,ye)},this.setSize=function(It,Me,se){nl.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(Ie=It,ye=Me,t.width=Math.floor(It*xe),t.height=Math.floor(Me*xe),se!==!1&&(t.style.width=It+"px",t.style.height=Me+"px"),this.setViewport(0,0,It,Me))},this.getDrawingBufferSize=function(It){return It.set(Ie*xe,ye*xe).floor()},this.setDrawingBufferSize=function(It,Me,se){Ie=It,ye=Me,xe=se,t.width=Math.floor(It*se),t.height=Math.floor(Me*se),this.setViewport(0,0,It,Me)},this.getCurrentViewport=function(It){return It.copy(Pt)},this.getViewport=function(It){return It.copy(ce)},this.setViewport=function(It,Me,se,Ce){It.isVector4?ce.set(It.x,It.y,It.z,It.w):ce.set(It,Me,se,Ce),sn.viewport(Pt.copy(ce).multiplyScalar(xe).floor())},this.getScissor=function(It){return It.copy(We)},this.setScissor=function(It,Me,se,Ce){It.isVector4?We.set(It.x,It.y,It.z,It.w):We.set(It,Me,se,Ce),sn.scissor(Et.copy(We).multiplyScalar(xe).floor())},this.getScissorTest=function(){return je},this.setScissorTest=function(It){sn.setScissorTest(je=It)},this.setOpaqueSort=function(It){ge=It},this.setTransparentSort=function(It){Ht=It},this.getClearColor=function(It){return It.copy(uu.getClearColor())},this.setClearColor=function(){uu.setClearColor.apply(uu,arguments)},this.getClearAlpha=function(){return uu.getClearAlpha()},this.setClearAlpha=function(){uu.setClearAlpha.apply(uu,arguments)},this.clear=function(It,Me,se){let Ce=0;(It===void 0||It)&&(Ce|=16384),(Me===void 0||Me)&&(Ce|=256),(se===void 0||se)&&(Ce|=1024),qe.clear(Ce)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Fg,!1),t.removeEventListener("webglcontextrestored",Bg,!1),_r.dispose(),Tr.dispose(),xt.dispose(),Te.dispose(),bn.dispose(),Ma.dispose(),nl.dispose(),nl.removeEventListener("sessionstart",Ug),nl.removeEventListener("sessionend",Gg),Sn&&(Sn.dispose(),Sn=null),cp.stop()},this.renderBufferImmediate=function(It,Me){Ma.initAttributes();const se=xt.get(It);It.hasPositions&&!se.position&&(se.position=qe.createBuffer()),It.hasNormals&&!se.normal&&(se.normal=qe.createBuffer()),It.hasUvs&&!se.uv&&(se.uv=qe.createBuffer()),It.hasColors&&!se.color&&(se.color=qe.createBuffer());const Ce=Me.getAttributes();It.hasPositions&&(qe.bindBuffer(34962,se.position),qe.bufferData(34962,It.positionArray,35048),Ma.enableAttribute(Ce.position),qe.vertexAttribPointer(Ce.position,3,5126,!1,0,0)),It.hasNormals&&(qe.bindBuffer(34962,se.normal),qe.bufferData(34962,It.normalArray,35048),Ma.enableAttribute(Ce.normal),qe.vertexAttribPointer(Ce.normal,3,5126,!1,0,0)),It.hasUvs&&(qe.bindBuffer(34962,se.uv),qe.bufferData(34962,It.uvArray,35048),Ma.enableAttribute(Ce.uv),qe.vertexAttribPointer(Ce.uv,2,5126,!1,0,0)),It.hasColors&&(qe.bindBuffer(34962,se.color),qe.bufferData(34962,It.colorArray,35048),Ma.enableAttribute(Ce.color),qe.vertexAttribPointer(Ce.color,3,5126,!1,0,0)),Ma.disableUnusedAttributes(),qe.drawArrays(4,0,It.count),It.count=0},this.renderBufferDirect=function(It,Me,se,Ce,en,Xr){Me===null&&(Me=Fe);const cr=en.isMesh&&en.matrixWorld.determinant()<0,cn=jg(It,Me,Ce,en);sn.setMaterial(Ce,cr);let Cr=se.index;const Vn=se.attributes.position;if(Cr===null){if(Vn===void 0||Vn.count===0)return}else if(Cr.count===0)return;let Vr,sr=1;Ce.wireframe===!0&&(Cr=we.getWireframeAttribute(se),sr=2),(Ce.morphTargets||Ce.morphNormals)&&sm.update(en,se,Ce,cn),Ma.setup(en,Ce,cn,se,Cr);let kr=am;Cr!==null&&(Vr=Pe.get(Cr),kr=lm,kr.setIndex(Vr));const Lo=Cr!==null?Cr.count:Vn.count,Ci=se.drawRange.start*sr,hu=se.drawRange.count*sr,mi=Xr!==null?Xr.start*sr:0,Ju=Xr!==null?Xr.count*sr:1/0,qo=Math.max(Ci,mi),rl=Math.min(Lo,Ci+hu,mi+Ju)-1,Ns=Math.max(0,rl-qo+1);if(Ns!==0){if(en.isMesh)Ce.wireframe===!0?(sn.setLineWidth(Ce.wireframeLinewidth*Be()),kr.setMode(1)):kr.setMode(4);else if(en.isLine){let um=Ce.linewidth;um===void 0&&(um=1),sn.setLineWidth(um*Be()),en.isLineSegments?kr.setMode(1):en.isLineLoop?kr.setMode(2):kr.setMode(3)}else en.isPoints?kr.setMode(0):en.isSprite&&kr.setMode(4);if(en.isInstancedMesh)kr.renderInstances(qo,Ns,en.count);else if(se.isInstancedBufferGeometry){const um=Math.min(se.instanceCount,se._maxInstanceCount);kr.renderInstances(qo,Ns,um)}else kr.render(qo,Ns)}},this.compile=function(It,Me){A=Tr.get(It),A.init(),It.traverseVisible(function(se){se.isLight&&se.layers.test(Me.layers)&&(A.pushLight(se),se.castShadow&&A.pushShadow(se))}),A.setupLights(),It.traverse(function(se){const Ce=se.material;if(Ce)if(Array.isArray(Ce))for(let en=0;en<Ce.length;en++)_g(Ce[en],It,se);else _g(Ce,It,se)})};let vg=null;function Ug(){cp.stop()}function Gg(){cp.start()}const cp=new Eh;function Xm(It,Me,se){const Ce=Me.isScene===!0?Me.overrideMaterial:null;for(let en=0,Xr=It.length;en<Xr;en++){const cr=It[en],cn=cr.object,Cr=cr.geometry,Vn=Ce===null?cr.material:Ce,Vr=cr.group;if(se.isArrayCamera){const sr=se.cameras;for(let kr=0,Lo=sr.length;kr<Lo;kr++){const Ci=sr[kr];cn.layers.test(Ci.layers)&&(sn.viewport(Pt.copy(Ci.viewport)),A.setupLightsView(Ci),Hg(cn,Me,Ci,Cr,Vn,Vr))}}else Hg(cn,Me,se,Cr,Vn,Vr)}}function Hg(It,Me,se,Ce,en,Xr){if(It.onBeforeRender(U,Me,se,Ce,en,Xr),It.modelViewMatrix.multiplyMatrices(se.matrixWorldInverse,It.matrixWorld),It.normalMatrix.getNormalMatrix(It.modelViewMatrix),It.isImmediateRenderObject){const cr=jg(se,Me,en,It);sn.setMaterial(en),Ma.reset(),function(cn,Cr){cn.render(function(Vn){U.renderBufferImmediate(Vn,Cr)})}(It,cr)}else en.transparent===!0&&en.side===k?(en.side=L,en.needsUpdate=!0,U.renderBufferDirect(se,Me,Ce,en,It,Xr),en.side=zt,en.needsUpdate=!0,U.renderBufferDirect(se,Me,Ce,en,It,Xr),en.side=k):U.renderBufferDirect(se,Me,Ce,en,It,Xr);It.onAfterRender(U,Me,se,Ce,en,Xr)}function _g(It,Me,se){Me.isScene!==!0&&(Me=Fe);const Ce=xt.get(It),en=A.state.lights,Xr=A.state.shadowsArray,cr=en.state.version,cn=Gn.getParameters(It,en.state,Xr,Me,se),Cr=Gn.getProgramCacheKey(cn);let Vn=Ce.programs;Ce.environment=It.isMeshStandardMaterial?Me.environment:null,Ce.fog=Me.fog,Ce.envMap=Te.get(It.envMap||Ce.environment),Vn===void 0&&(It.addEventListener("dispose",kg),Vn=new Map,Ce.programs=Vn);let Vr=Vn.get(Cr);if(Vr!==void 0){if(Ce.currentProgram===Vr&&Ce.lightsStateVersion===cr)return zg(It,cn),Vr}else cn.uniforms=Gn.getUniforms(It),It.onBuild(cn,U),It.onBeforeCompile(cn,U),Vr=Gn.acquireProgram(cn,Cr),Vn.set(Cr,Vr),Ce.uniforms=cn.uniforms;const sr=Ce.uniforms;(It.isShaderMaterial||It.isRawShaderMaterial)&&It.clipping!==!0||(sr.clippingPlanes=Xo.uniform),zg(It,cn),Ce.needsLights=function(Ci){return Ci.isMeshLambertMaterial||Ci.isMeshToonMaterial||Ci.isMeshPhongMaterial||Ci.isMeshStandardMaterial||Ci.isShadowMaterial||Ci.isShaderMaterial&&Ci.lights===!0}(It),Ce.lightsStateVersion=cr,Ce.needsLights&&(sr.ambientLightColor.value=en.state.ambient,sr.lightProbe.value=en.state.probe,sr.directionalLights.value=en.state.directional,sr.directionalLightShadows.value=en.state.directionalShadow,sr.spotLights.value=en.state.spot,sr.spotLightShadows.value=en.state.spotShadow,sr.rectAreaLights.value=en.state.rectArea,sr.ltc_1.value=en.state.rectAreaLTC1,sr.ltc_2.value=en.state.rectAreaLTC2,sr.pointLights.value=en.state.point,sr.pointLightShadows.value=en.state.pointShadow,sr.hemisphereLights.value=en.state.hemi,sr.directionalShadowMap.value=en.state.directionalShadowMap,sr.directionalShadowMatrix.value=en.state.directionalShadowMatrix,sr.spotShadowMap.value=en.state.spotShadowMap,sr.spotShadowMatrix.value=en.state.spotShadowMatrix,sr.pointShadowMap.value=en.state.pointShadowMap,sr.pointShadowMatrix.value=en.state.pointShadowMatrix);const kr=Vr.getUniforms(),Lo=ma.seqWithValue(kr.seq,sr);return Ce.currentProgram=Vr,Ce.uniformsList=Lo,Vr}function zg(It,Me){const se=xt.get(It);se.outputEncoding=Me.outputEncoding,se.instancing=Me.instancing,se.skinning=Me.skinning,se.numClippingPlanes=Me.numClippingPlanes,se.numIntersection=Me.numClipIntersection,se.vertexAlphas=Me.vertexAlphas}function jg(It,Me,se,Ce){Me.isScene!==!0&&(Me=Fe),Zt.resetTextureUnits();const en=Me.fog,Xr=se.isMeshStandardMaterial?Me.environment:null,cr=vt===null?U.outputEncoding:vt.texture.encoding,cn=Te.get(se.envMap||Xr),Cr=se.vertexColors===!0&&Ce.geometry&&Ce.geometry.attributes.color&&Ce.geometry.attributes.color.itemSize===4,Vn=xt.get(se),Vr=A.state.lights;if(_n===!0&&(Mn===!0||It!==At)){const Ns=It===At&&se.id===mt;Xo.setState(se,It,Ns)}let sr=!1;se.version===Vn.__version?Vn.needsLights&&Vn.lightsStateVersion!==Vr.state.version||Vn.outputEncoding!==cr||Ce.isInstancedMesh&&Vn.instancing===!1?sr=!0:Ce.isInstancedMesh||Vn.instancing!==!0?Ce.isSkinnedMesh&&Vn.skinning===!1?sr=!0:Ce.isSkinnedMesh||Vn.skinning!==!0?Vn.envMap!==cn||se.fog&&Vn.fog!==en?sr=!0:Vn.numClippingPlanes===void 0||Vn.numClippingPlanes===Xo.numPlanes&&Vn.numIntersection===Xo.numIntersection?Vn.vertexAlphas!==Cr&&(sr=!0):sr=!0:sr=!0:sr=!0:(sr=!0,Vn.__version=se.version);let kr=Vn.currentProgram;sr===!0&&(kr=_g(se,Me,Ce));let Lo=!1,Ci=!1,hu=!1;const mi=kr.getUniforms(),Ju=Vn.uniforms;if(sn.useProgram(kr.program)&&(Lo=!0,Ci=!0,hu=!0),se.id!==mt&&(mt=se.id,Ci=!0),Lo||At!==It){if(mi.setValue(qe,"projectionMatrix",It.projectionMatrix),rn.logarithmicDepthBuffer&&mi.setValue(qe,"logDepthBufFC",2/(Math.log(It.far+1)/Math.LN2)),At!==It&&(At=It,Ci=!0,hu=!0),se.isShaderMaterial||se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshStandardMaterial||se.envMap){const Ns=mi.map.cameraPosition;Ns!==void 0&&Ns.setValue(qe,Dt.setFromMatrixPosition(It.matrixWorld))}(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial)&&mi.setValue(qe,"isOrthographic",It.isOrthographicCamera===!0),(se.isMeshPhongMaterial||se.isMeshToonMaterial||se.isMeshLambertMaterial||se.isMeshBasicMaterial||se.isMeshStandardMaterial||se.isShaderMaterial||se.isShadowMaterial||Ce.isSkinnedMesh)&&mi.setValue(qe,"viewMatrix",It.matrixWorldInverse)}if(Ce.isSkinnedMesh){mi.setOptional(qe,Ce,"bindMatrix"),mi.setOptional(qe,Ce,"bindMatrixInverse");const Ns=Ce.skeleton;Ns&&(rn.floatVertexTextures?(Ns.boneTexture===null&&Ns.computeBoneTexture(),mi.setValue(qe,"boneTexture",Ns.boneTexture,Zt),mi.setValue(qe,"boneTextureSize",Ns.boneTextureSize)):mi.setOptional(qe,Ns,"boneMatrices"))}var qo,rl;return(Ci||Vn.receiveShadow!==Ce.receiveShadow)&&(Vn.receiveShadow=Ce.receiveShadow,mi.setValue(qe,"receiveShadow",Ce.receiveShadow)),Ci&&(mi.setValue(qe,"toneMappingExposure",U.toneMappingExposure),Vn.needsLights&&(rl=hu,(qo=Ju).ambientLightColor.needsUpdate=rl,qo.lightProbe.needsUpdate=rl,qo.directionalLights.needsUpdate=rl,qo.directionalLightShadows.needsUpdate=rl,qo.pointLights.needsUpdate=rl,qo.pointLightShadows.needsUpdate=rl,qo.spotLights.needsUpdate=rl,qo.spotLightShadows.needsUpdate=rl,qo.rectAreaLights.needsUpdate=rl,qo.hemisphereLights.needsUpdate=rl),en&&se.fog&&Fn.refreshFogUniforms(Ju,en),Fn.refreshMaterialUniforms(Ju,se,xe,ye,Sn),ma.upload(qe,Vn.uniformsList,Ju,Zt)),se.isShaderMaterial&&se.uniformsNeedUpdate===!0&&(ma.upload(qe,Vn.uniformsList,Ju,Zt),se.uniformsNeedUpdate=!1),se.isSpriteMaterial&&mi.setValue(qe,"center",Ce.center),mi.setValue(qe,"modelViewMatrix",Ce.modelViewMatrix),mi.setValue(qe,"normalMatrix",Ce.normalMatrix),mi.setValue(qe,"modelMatrix",Ce.matrixWorld),kr}cp.setAnimationLoop(function(It){vg&&vg(It)}),typeof window!="undefined"&&cp.setContext(window),this.setAnimationLoop=function(It){vg=It,nl.setAnimationLoop(It),It===null?cp.stop():cp.start()},nl.addEventListener("sessionstart",Ug),nl.addEventListener("sessionend",Gg),this.render=function(It,Me){if(Me!==void 0&&Me.isCamera!==!0)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(D===!0)return;It.autoUpdate===!0&&It.updateMatrixWorld(),Me.parent===null&&Me.updateMatrixWorld(),nl.enabled===!0&&nl.isPresenting===!0&&(nl.cameraAutoUpdate===!0&&nl.updateCamera(Me),Me=nl.getCamera()),It.isScene===!0&&It.onBeforeRender(U,It,Me,vt),A=Tr.get(It,O.length),A.init(),O.push(A),Rt.multiplyMatrices(Me.projectionMatrix,Me.matrixWorldInverse),fn.setFromProjectionMatrix(Rt),Mn=this.localClippingEnabled,_n=Xo.init(this.clippingPlanes,Mn,Me),C=_r.get(It,R.length),C.init(),R.push(C),function cr(cn,Cr,Vn,Vr){if(cn.visible===!1)return;if(cn.layers.test(Cr.layers)){if(cn.isGroup)Vn=cn.renderOrder;else if(cn.isLOD)cn.autoUpdate===!0&&cn.update(Cr);else if(cn.isLight)A.pushLight(cn),cn.castShadow&&A.pushShadow(cn);else if(cn.isSprite){if(!cn.frustumCulled||fn.intersectsSprite(cn)){Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt);const kr=bn.update(cn),Lo=cn.material;Lo.visible&&C.push(cn,kr,Lo,Vn,Dt.z,null)}}else if(cn.isImmediateRenderObject)Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt),C.push(cn,null,cn.material,Vn,Dt.z,null);else if((cn.isMesh||cn.isLine||cn.isPoints)&&(cn.isSkinnedMesh&&cn.skeleton.frame!==be.render.frame&&(cn.skeleton.update(),cn.skeleton.frame=be.render.frame),!cn.frustumCulled||fn.intersectsObject(cn))){Vr&&Dt.setFromMatrixPosition(cn.matrixWorld).applyMatrix4(Rt);const kr=bn.update(cn),Lo=cn.material;if(Array.isArray(Lo)){const Ci=kr.groups;for(let hu=0,mi=Ci.length;hu<mi;hu++){const Ju=Ci[hu],qo=Lo[Ju.materialIndex];qo&&qo.visible&&C.push(cn,kr,qo,Vn,Dt.z,Ju)}}else Lo.visible&&C.push(cn,kr,Lo,Vn,Dt.z,null)}}const sr=cn.children;for(let kr=0,Lo=sr.length;kr<Lo;kr++)cr(sr[kr],Cr,Vn,Vr)}(It,Me,0,U.sortObjects),C.finish(),U.sortObjects===!0&&C.sort(ge,Ht),_n===!0&&Xo.beginShadows();const se=A.state.shadowsArray;fi.render(se,It,Me),A.setupLights(),A.setupLightsView(Me),_n===!0&&Xo.endShadows(),this.info.autoReset===!0&&this.info.reset(),uu.render(C,It);const Ce=C.opaque,en=C.transmissive,Xr=C.transparent;Ce.length>0&&Xm(Ce,It,Me),en.length>0&&function(cr,cn,Cr,Vn){if(Sn===null){const kr=p===!0&&rn.isWebGL2===!0;Sn=new(kr?vc:Fo)(1024,1024,{generateMipmaps:!0,type:$s.convert(Ft)!==null?Ft:lo,minFilter:Yr,magFilter:wt,wrapS:St,wrapT:St})}const Vr=U.getRenderTarget();U.setRenderTarget(Sn),U.clear();const sr=U.toneMapping;U.toneMapping=Or,Xm(cr,Cr,Vn),U.toneMapping=sr,Zt.updateMultisampleRenderTarget(Sn),Zt.updateRenderTargetMipmap(Sn),U.setRenderTarget(Vr),Xm(cn,Cr,Vn)}(Ce,en,It,Me),Xr.length>0&&Xm(Xr,It,Me),vt!==null&&(Zt.updateMultisampleRenderTarget(vt),Zt.updateRenderTargetMipmap(vt)),It.isScene===!0&&It.onAfterRender(U,It,Me),sn.buffers.depth.setTest(!0),sn.buffers.depth.setMask(!0),sn.buffers.color.setMask(!0),sn.setPolygonOffset(!1),Ma.resetDefaultState(),mt=-1,At=null,O.pop(),A=O.length>0?O[O.length-1]:null,R.pop(),C=R.length>0?R[R.length-1]:null},this.getActiveCubeFace=function(){return Z},this.getActiveMipmapLevel=function(){return ot},this.getRenderTarget=function(){return vt},this.setRenderTarget=function(It,Me=0,se=0){vt=It,Z=Me,ot=se,It&&xt.get(It).__webglFramebuffer===void 0&&Zt.setupRenderTarget(It);let Ce=null,en=!1,Xr=!1;if(It){const cr=It.texture;(cr.isDataTexture3D||cr.isDataTexture2DArray)&&(Xr=!0);const cn=xt.get(It).__webglFramebuffer;It.isWebGLCubeRenderTarget?(Ce=cn[Me],en=!0):Ce=It.isWebGLMultisampleRenderTarget?xt.get(It).__webglMultisampledFramebuffer:cn,Pt.copy(It.viewport),Et.copy(It.scissor),Ot=It.scissorTest}else Pt.copy(ce).multiplyScalar(xe).floor(),Et.copy(We).multiplyScalar(xe).floor(),Ot=je;if(sn.bindFramebuffer(36160,Ce)&&rn.drawBuffers){let cr=!1;if(It)if(It.isWebGLMultipleRenderTargets){const cn=It.texture;if(ze.length!==cn.length||ze[0]!==36064){for(let Cr=0,Vn=cn.length;Cr<Vn;Cr++)ze[Cr]=36064+Cr;ze.length=cn.length,cr=!0}}else ze.length===1&&ze[0]===36064||(ze[0]=36064,ze.length=1,cr=!0);else ze.length===1&&ze[0]===1029||(ze[0]=1029,ze.length=1,cr=!0);cr&&(rn.isWebGL2?qe.drawBuffers(ze):pe.get("WEBGL_draw_buffers").drawBuffersWEBGL(ze))}if(sn.viewport(Pt),sn.scissor(Et),sn.setScissorTest(Ot),en){const cr=xt.get(It.texture);qe.framebufferTexture2D(36160,36064,34069+Me,cr.__webglTexture,se)}else if(Xr){const cr=xt.get(It.texture),cn=Me||0;qe.framebufferTextureLayer(36160,36064,cr.__webglTexture,se||0,cn)}},this.readRenderTargetPixels=function(It,Me,se,Ce,en,Xr,cr){if(!It||!It.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let cn=xt.get(It).__webglFramebuffer;if(It.isWebGLCubeRenderTarget&&cr!==void 0&&(cn=cn[cr]),cn){sn.bindFramebuffer(36160,cn);try{const Cr=It.texture,Vn=Cr.format,Vr=Cr.type;if(Vn!==Tn&&$s.convert(Vn)!==qe.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");const sr=Vr===Ft&&(pe.has("EXT_color_buffer_half_float")||rn.isWebGL2&&pe.has("EXT_color_buffer_float"));if(!(Vr===lo||$s.convert(Vr)===qe.getParameter(35738)||Vr===ee&&(rn.isWebGL2||pe.has("OES_texture_float")||pe.has("WEBGL_color_buffer_float"))||sr))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");qe.checkFramebufferStatus(36160)===36053?Me>=0&&Me<=It.width-Ce&&se>=0&&se<=It.height-en&&qe.readPixels(Me,se,Ce,en,$s.convert(Vn),$s.convert(Vr),Xr):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{const Cr=vt!==null?xt.get(vt).__webglFramebuffer:null;sn.bindFramebuffer(36160,Cr)}}},this.copyFramebufferToTexture=function(It,Me,se=0){const Ce=Math.pow(2,-se),en=Math.floor(Me.image.width*Ce),Xr=Math.floor(Me.image.height*Ce);let cr=$s.convert(Me.format);rn.isWebGL2&&(cr===6407&&(cr=32849),cr===6408&&(cr=32856)),Zt.setTexture2D(Me,0),qe.copyTexImage2D(3553,se,cr,It.x,It.y,en,Xr,0),sn.unbindTexture()},this.copyTextureToTexture=function(It,Me,se,Ce=0){const en=Me.image.width,Xr=Me.image.height,cr=$s.convert(se.format),cn=$s.convert(se.type);Zt.setTexture2D(se,0),qe.pixelStorei(37440,se.flipY),qe.pixelStorei(37441,se.premultiplyAlpha),qe.pixelStorei(3317,se.unpackAlignment),Me.isDataTexture?qe.texSubImage2D(3553,Ce,It.x,It.y,en,Xr,cr,cn,Me.image.data):Me.isCompressedTexture?qe.compressedTexSubImage2D(3553,Ce,It.x,It.y,Me.mipmaps[0].width,Me.mipmaps[0].height,cr,Me.mipmaps[0].data):qe.texSubImage2D(3553,Ce,It.x,It.y,cr,cn,Me.image),Ce===0&&se.generateMipmaps&&qe.generateMipmap(3553),sn.unbindTexture()},this.copyTextureToTexture3D=function(It,Me,se,Ce,en=0){if(U.isWebGL1Renderer)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");const Xr=It.max.x-It.min.x+1,cr=It.max.y-It.min.y+1,cn=It.max.z-It.min.z+1,Cr=$s.convert(Ce.format),Vn=$s.convert(Ce.type);let Vr;if(Ce.isDataTexture3D)Zt.setTexture3D(Ce,0),Vr=32879;else{if(!Ce.isDataTexture2DArray)return void console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");Zt.setTexture2DArray(Ce,0),Vr=35866}qe.pixelStorei(37440,Ce.flipY),qe.pixelStorei(37441,Ce.premultiplyAlpha),qe.pixelStorei(3317,Ce.unpackAlignment);const sr=qe.getParameter(3314),kr=qe.getParameter(32878),Lo=qe.getParameter(3316),Ci=qe.getParameter(3315),hu=qe.getParameter(32877),mi=se.isCompressedTexture?se.mipmaps[0]:se.image;qe.pixelStorei(3314,mi.width),qe.pixelStorei(32878,mi.height),qe.pixelStorei(3316,It.min.x),qe.pixelStorei(3315,It.min.y),qe.pixelStorei(32877,It.min.z),se.isDataTexture||se.isDataTexture3D?qe.texSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,Vn,mi.data):se.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),qe.compressedTexSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,mi.data)):qe.texSubImage3D(Vr,en,Me.x,Me.y,Me.z,Xr,cr,cn,Cr,Vn,mi),qe.pixelStorei(3314,sr),qe.pixelStorei(32878,kr),qe.pixelStorei(3316,Lo),qe.pixelStorei(3315,Ci),qe.pixelStorei(32877,hu),en===0&&Ce.generateMipmaps&&qe.generateMipmap(Vr),sn.unbindTexture()},this.initTexture=function(It){Zt.setTexture2D(It,0),sn.unbindTexture()},this.resetState=function(){Z=0,ot=0,vt=null,sn.reset(),Ma.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class qp extends Fr{}qp.prototype.isWebGL1Renderer=!0;class Ql{constructor(t,i=25e-5){this.name="",this.color=new pn(t),this.density=i}clone(){return new Ql(this.color,this.density)}toJSON(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}Ql.prototype.isFogExp2=!0;class tu{constructor(t,i=1,a=1e3){this.name="",this.color=new pn(t),this.near=i,this.far=a}clone(){return new tu(this.color,this.near,this.far)}toJSON(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}tu.prototype.isFog=!0;class Fh extends ar{constructor(){super(),this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,i){return super.copy(t,i),t.background!==null&&(this.background=t.background.clone()),t.environment!==null&&(this.environment=t.environment.clone()),t.fog!==null&&(this.fog=t.fog.clone()),t.overrideMaterial!==null&&(this.overrideMaterial=t.overrideMaterial.clone()),this.autoUpdate=t.autoUpdate,this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const i=super.toJSON(t);return this.fog!==null&&(i.object.fog=this.fog.toJSON()),i}}Fh.prototype.isScene=!0;class _l{constructor(t,i){this.array=t,this.stride=i,this.count=t!==void 0?t.length/i:0,this.usage=Da,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=No()}onUploadCallback(){}set needsUpdate(t){t===!0&&this.version++}setUsage(t){return this.usage=t,this}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,i,a){t*=this.stride,a*=i.stride;for(let l=0,d=this.stride;l<d;l++)this.array[t+l]=i.array[a+l];return this}set(t,i=0){return this.array.set(t,i),this}clone(t){t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=No()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const i=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),a=new this.constructor(i,this.stride);return a.setUsage(this.usage),a}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return t.arrayBuffers===void 0&&(t.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=No()),t.arrayBuffers[this.array.buffer._uuid]===void 0&&(t.arrayBuffers[this.array.buffer._uuid]=Array.prototype.slice.call(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}_l.prototype.isInterleavedBuffer=!0;const ai=new gt;class ri{constructor(t,i,a,l=!1){this.name="",this.data=t,this.itemSize=i,this.offset=a,this.normalized=l===!0}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let i=0,a=this.data.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.applyMatrix4(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}applyNormalMatrix(t){for(let i=0,a=this.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.applyNormalMatrix(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}transformDirection(t){for(let i=0,a=this.count;i<a;i++)ai.x=this.getX(i),ai.y=this.getY(i),ai.z=this.getZ(i),ai.transformDirection(t),this.setXYZ(i,ai.x,ai.y,ai.z);return this}setX(t,i){return this.data.array[t*this.data.stride+this.offset]=i,this}setY(t,i){return this.data.array[t*this.data.stride+this.offset+1]=i,this}setZ(t,i){return this.data.array[t*this.data.stride+this.offset+2]=i,this}setW(t,i){return this.data.array[t*this.data.stride+this.offset+3]=i,this}getX(t){return this.data.array[t*this.data.stride+this.offset]}getY(t){return this.data.array[t*this.data.stride+this.offset+1]}getZ(t){return this.data.array[t*this.data.stride+this.offset+2]}getW(t){return this.data.array[t*this.data.stride+this.offset+3]}setXY(t,i,a){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this}setXYZ(t,i,a,l){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this.data.array[t+2]=l,this}setXYZW(t,i,a,l,d){return t=t*this.data.stride+this.offset,this.data.array[t+0]=i,this.data.array[t+1]=a,this.data.array[t+2]=l,this.data.array[t+3]=d,this}clone(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.");const i=[];for(let a=0;a<this.count;a++){const l=a*this.data.stride+this.offset;for(let d=0;d<this.itemSize;d++)i.push(this.data.array[l+d])}return new Kn(new this.array.constructor(i),this.itemSize,this.normalized)}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new ri(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(t===void 0){console.log("THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.");const i=[];for(let a=0;a<this.count;a++){const l=a*this.data.stride+this.offset;for(let d=0;d<this.itemSize;d++)i.push(this.data.array[l+d])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:i,normalized:this.normalized}}return t.interleavedBuffers===void 0&&(t.interleavedBuffers={}),t.interleavedBuffers[this.data.uuid]===void 0&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}ri.prototype.isInterleavedBufferAttribute=!0;class yo extends Ni{constructor(t){super(),this.type="SpriteMaterial",this.color=new pn(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.rotation=t.rotation,this.sizeAttenuation=t.sizeAttenuation,this}}let eu;yo.prototype.isSpriteMaterial=!0;const Ru=new gt,Iu=new gt,jo=new gt,Cs=new He,ms=new He,Bh=new En,Ps=new gt,yl=new gt,Lu=new gt,Rs=new He,Hc=new He,Ou=new He;class Du extends ar{constructor(t){if(super(),this.type="Sprite",eu===void 0){eu=new zn;const i=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),a=new _l(i,5);eu.setIndex([0,1,2,0,2,3]),eu.setAttribute("position",new ri(a,3,0,!1)),eu.setAttribute("uv",new ri(a,2,3,!1))}this.geometry=eu,this.material=t!==void 0?t:new yo,this.center=new He(.5,.5)}raycast(t,i){t.camera===null&&console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),Iu.setFromMatrixScale(this.matrixWorld),Bh.copy(t.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(t.camera.matrixWorldInverse,this.matrixWorld),jo.setFromMatrixPosition(this.modelViewMatrix),t.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&Iu.multiplyScalar(-jo.z);const a=this.material.rotation;let l,d;a!==0&&(d=Math.cos(a),l=Math.sin(a));const p=this.center;kh(Ps.set(-.5,-.5,0),jo,p,Iu,l,d),kh(yl.set(.5,-.5,0),jo,p,Iu,l,d),kh(Lu.set(.5,.5,0),jo,p,Iu,l,d),Rs.set(0,0),Hc.set(1,0),Ou.set(1,1);let v=t.ray.intersectTriangle(Ps,yl,Lu,!1,Ru);if(v===null&&(kh(yl.set(-.5,.5,0),jo,p,Iu,l,d),Hc.set(0,1),v=t.ray.intersectTriangle(Ps,Lu,yl,!1,Ru),v===null))return;const _=t.ray.origin.distanceTo(Ru);_<t.near||_>t.far||i.push({distance:_,point:Ru.clone(),uv:bi.getUV(Ru,Ps,yl,Lu,Rs,Hc,Ou,new He),face:null,object:this})}copy(t){return super.copy(t),t.center!==void 0&&this.center.copy(t.center),this.material=t.material,this}}function kh(m,t,i,a,l,d){Cs.subVectors(m,i).addScalar(.5).multiply(a),l!==void 0?(ms.x=d*Cs.x-l*Cs.y,ms.y=l*Cs.x+d*Cs.y):ms.copy(Cs),m.copy(t),m.x+=ms.x,m.y+=ms.y,m.applyMatrix4(Bh)}Du.prototype.isSprite=!0;const Uh=new gt,Yd=new gt;class Gh extends ar{constructor(){super(),this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]},isLOD:{value:!0}}),this.autoUpdate=!0}copy(t){super.copy(t,!1);const i=t.levels;for(let a=0,l=i.length;a<l;a++){const d=i[a];this.addLevel(d.object.clone(),d.distance)}return this.autoUpdate=t.autoUpdate,this}addLevel(t,i=0){i=Math.abs(i);const a=this.levels;let l;for(l=0;l<a.length&&!(i<a[l].distance);l++);return a.splice(l,0,{distance:i,object:t}),this.add(t),this}getCurrentLevel(){return this._currentLevel}getObjectForDistance(t){const i=this.levels;if(i.length>0){let a,l;for(a=1,l=i.length;a<l&&!(t<i[a].distance);a++);return i[a-1].object}return null}raycast(t,i){if(this.levels.length>0){Uh.setFromMatrixPosition(this.matrixWorld);const a=t.ray.origin.distanceTo(Uh);this.getObjectForDistance(a).raycast(t,i)}}update(t){const i=this.levels;if(i.length>1){Uh.setFromMatrixPosition(t.matrixWorld),Yd.setFromMatrixPosition(this.matrixWorld);const a=Uh.distanceTo(Yd)/t.zoom;let l,d;for(i[0].object.visible=!0,l=1,d=i.length;l<d&&a>=i[l].distance;l++)i[l-1].object.visible=!1,i[l].object.visible=!0;for(this._currentLevel=l-1;l<d;l++)i[l].object.visible=!1}}toJSON(t){const i=super.toJSON(t);this.autoUpdate===!1&&(i.object.autoUpdate=!1),i.object.levels=[];const a=this.levels;for(let l=0,d=a.length;l<d;l++){const p=a[l];i.object.levels.push({object:p.object.uuid,distance:p.distance})}return i}}const Zd=new gt,Jd=new Ir,Nu=new Ir,$d=new gt,zc=new En;class jc extends Bi{constructor(t,i){super(t,i),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new En,this.bindMatrixInverse=new En}copy(t){return super.copy(t),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,this}bind(t,i){this.skeleton=t,i===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),i=this.matrixWorld),this.bindMatrix.copy(i),this.bindMatrixInverse.copy(i).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new Ir,i=this.geometry.attributes.skinWeight;for(let a=0,l=i.count;a<l;a++){t.x=i.getX(a),t.y=i.getY(a),t.z=i.getZ(a),t.w=i.getW(a);const d=1/t.manhattanLength();d!==1/0?t.multiplyScalar(d):t.set(1,0,0,0),i.setXYZW(a,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode==="attached"?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode==="detached"?this.bindMatrixInverse.copy(this.bindMatrix).invert():console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(t,i){const a=this.skeleton,l=this.geometry;Jd.fromBufferAttribute(l.attributes.skinIndex,t),Nu.fromBufferAttribute(l.attributes.skinWeight,t),Zd.fromBufferAttribute(l.attributes.position,t).applyMatrix4(this.bindMatrix),i.set(0,0,0);for(let d=0;d<4;d++){const p=Nu.getComponent(d);if(p!==0){const v=Jd.getComponent(d);zc.multiplyMatrices(a.bones[v].matrixWorld,a.boneInverses[v]),i.addScaledVector($d.copy(Zd).applyMatrix4(zc),p)}}return i.applyMatrix4(this.bindMatrixInverse)}}jc.prototype.isSkinnedMesh=!0;class no extends ar{constructor(){super(),this.type="Bone"}}no.prototype.isBone=!0;class Is extends ni{constructor(t=null,i=1,a=1,l,d,p,v,_,x=wt,M=wt,C,A){super(null,p,v,_,x,M,l,d,C,A),this.image={data:t,width:i,height:a},this.magFilter=x,this.minFilter=M,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}}Is.prototype.isDataTexture=!0;const Vc=new En,Yp=new En;class Fu{constructor(t=[],i=[]){this.uuid=No(),this.bones=t.slice(0),this.boneInverses=i,this.boneMatrices=null,this.boneTexture=null,this.boneTextureSize=0,this.frame=-1,this.init()}init(){const t=this.bones,i=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),i.length===0)this.calculateInverses();else if(t.length!==i.length){console.warn("THREE.Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let a=0,l=this.bones.length;a<l;a++)this.boneInverses.push(new En)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,i=this.bones.length;t<i;t++){const a=new En;this.bones[t]&&a.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(a)}}pose(){for(let t=0,i=this.bones.length;t<i;t++){const a=this.bones[t];a&&a.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,i=this.bones.length;t<i;t++){const a=this.bones[t];a&&(a.parent&&a.parent.isBone?(a.matrix.copy(a.parent.matrixWorld).invert(),a.matrix.multiply(a.matrixWorld)):a.matrix.copy(a.matrixWorld),a.matrix.decompose(a.position,a.quaternion,a.scale))}}update(){const t=this.bones,i=this.boneInverses,a=this.boneMatrices,l=this.boneTexture;for(let d=0,p=t.length;d<p;d++){const v=t[d]?t[d].matrixWorld:Yp;Vc.multiplyMatrices(v,i[d]),Vc.toArray(a,16*d)}l!==null&&(l.needsUpdate=!0)}clone(){return new Fu(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=to(t),t=Math.max(t,4);const i=new Float32Array(t*t*4);i.set(this.boneMatrices);const a=new Is(i,t,t,Tn,ee);return this.boneMatrices=i,this.boneTexture=a,this.boneTextureSize=t,this}getBoneByName(t){for(let i=0,a=this.bones.length;i<a;i++){const l=this.bones[i];if(l.name===t)return l}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,i){this.uuid=t.uuid;for(let a=0,l=t.bones.length;a<l;a++){const d=t.bones[a];let p=i[d];p===void 0&&(console.warn("THREE.Skeleton: No bone found with UUID:",d),p=new no),this.bones.push(p),this.boneInverses.push(new En().fromArray(t.boneInverses[a]))}return this.init(),this}toJSON(){const t={metadata:{version:4.5,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const i=this.bones,a=this.boneInverses;for(let l=0,d=i.length;l<d;l++){const p=i[l];t.bones.push(p.uuid);const v=a[l];t.boneInverses.push(v.toArray())}return t}}const Wc=new En,Zp=new En,Xc=[],Hh=new Bi;class qc extends Bi{constructor(t,i,a){super(t,i),this.instanceMatrix=new Kn(new Float32Array(16*a),16),this.instanceColor=null,this.count=a,this.frustumCulled=!1}copy(t){return super.copy(t),this.instanceMatrix.copy(t.instanceMatrix),t.instanceColor!==null&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,this}getColorAt(t,i){i.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,i){i.fromArray(this.instanceMatrix.array,16*t)}raycast(t,i){const a=this.matrixWorld,l=this.count;if(Hh.geometry=this.geometry,Hh.material=this.material,Hh.material!==void 0)for(let d=0;d<l;d++){this.getMatrixAt(d,Wc),Zp.multiplyMatrices(a,Wc),Hh.matrixWorld=Zp,Hh.raycast(t,Xc);for(let p=0,v=Xc.length;p<v;p++){const _=Xc[p];_.instanceId=d,_.object=this,i.push(_)}Xc.length=0}}setColorAt(t,i){this.instanceColor===null&&(this.instanceColor=new Kn(new Float32Array(3*this.count),3)),i.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,i){i.toArray(this.instanceMatrix.array,16*t)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"})}}qc.prototype.isInstancedMesh=!0;class ro extends Ni{constructor(t){super(),this.type="LineBasicMaterial",this.color=new pn(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.morphTargets=t.morphTargets,this}}ro.prototype.isLineBasicMaterial=!0;const Jp=new gt,Yc=new gt,Zc=new En,Kd=new ka,Jc=new bs;class Ya extends ar{constructor(t=new zn,i=new ro){super(),this.type="Line",this.geometry=t,this.material=i,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(t.index===null){const i=t.attributes.position,a=[0];for(let l=1,d=i.count;l<d;l++)Jp.fromBufferAttribute(i,l-1),Yc.fromBufferAttribute(i,l),a[l]=a[l-1],a[l]+=Jp.distanceTo(Yc);t.setAttribute("lineDistance",new xn(a,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.Line.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}raycast(t,i){const a=this.geometry,l=this.matrixWorld,d=t.params.Line.threshold,p=a.drawRange;if(a.boundingSphere===null&&a.computeBoundingSphere(),Jc.copy(a.boundingSphere),Jc.applyMatrix4(l),Jc.radius+=d,t.ray.intersectsSphere(Jc)===!1)return;Zc.copy(l).invert(),Kd.copy(t.ray).applyMatrix4(Zc);const v=d/((this.scale.x+this.scale.y+this.scale.z)/3),_=v*v,x=new gt,M=new gt,C=new gt,A=new gt,R=this.isLineSegments?2:1;if(a.isBufferGeometry){const O=a.index,U=a.attributes.position;if(O!==null)for(let D=Math.max(0,p.start),Z=Math.min(O.count,p.start+p.count)-1;D<Z;D+=R){const ot=O.getX(D),vt=O.getX(D+1);if(x.fromBufferAttribute(U,ot),M.fromBufferAttribute(U,vt),Kd.distanceSqToSegment(x,M,A,C)>_)continue;A.applyMatrix4(this.matrixWorld);const mt=t.ray.origin.distanceTo(A);mt<t.near||mt>t.far||i.push({distance:mt,point:C.clone().applyMatrix4(this.matrixWorld),index:D,face:null,faceIndex:null,object:this})}else for(let D=Math.max(0,p.start),Z=Math.min(U.count,p.start+p.count)-1;D<Z;D+=R){if(x.fromBufferAttribute(U,D),M.fromBufferAttribute(U,D+1),Kd.distanceSqToSegment(x,M,A,C)>_)continue;A.applyMatrix4(this.matrixWorld);const ot=t.ray.origin.distanceTo(A);ot<t.near||ot>t.far||i.push({distance:ot,point:C.clone().applyMatrix4(this.matrixWorld),index:D,face:null,faceIndex:null,object:this})}}else a.isGeometry&&console.error("THREE.Line.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const i=t.morphAttributes,a=Object.keys(i);if(a.length>0){const l=i[a[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let d=0,p=l.length;d<p;d++){const v=l[d].name||String(d);this.morphTargetInfluences.push(0),this.morphTargetDictionary[v]=d}}}}else{const i=t.morphTargets;i!==void 0&&i.length>0&&console.error("THREE.Line.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}Ya.prototype.isLine=!0;const $p=new gt,$c=new gt;class io extends Ya{constructor(t,i){super(t,i),this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(t.isBufferGeometry)if(t.index===null){const i=t.attributes.position,a=[];for(let l=0,d=i.count;l<d;l+=2)$p.fromBufferAttribute(i,l),$c.fromBufferAttribute(i,l+1),a[l]=l===0?0:a[l-1],a[l+1]=a[l]+$p.distanceTo($c);t.setAttribute("lineDistance",new xn(a,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else t.isGeometry&&console.error("THREE.LineSegments.computeLineDistances() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");return this}}io.prototype.isLineSegments=!0;class nu extends Ya{constructor(t,i){super(t,i),this.type="LineLoop"}}nu.prototype.isLineLoop=!0;class xl extends Ni{constructor(t){super(),this.type="PointsMaterial",this.color=new pn(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.morphTargets=t.morphTargets,this}}xl.prototype.isPointsMaterial=!0;const c=new En,g=new ka,E=new bs,F=new gt;class q extends ar{constructor(t=new zn,i=new xl){super(),this.type="Points",this.geometry=t,this.material=i,this.updateMorphTargets()}copy(t){return super.copy(t),this.material=t.material,this.geometry=t.geometry,this}raycast(t,i){const a=this.geometry,l=this.matrixWorld,d=t.params.Points.threshold,p=a.drawRange;if(a.boundingSphere===null&&a.computeBoundingSphere(),E.copy(a.boundingSphere),E.applyMatrix4(l),E.radius+=d,t.ray.intersectsSphere(E)===!1)return;c.copy(l).invert(),g.copy(t.ray).applyMatrix4(c);const v=d/((this.scale.x+this.scale.y+this.scale.z)/3),_=v*v;if(a.isBufferGeometry){const x=a.index,M=a.attributes.position;if(x!==null)for(let C=Math.max(0,p.start),A=Math.min(x.count,p.start+p.count);C<A;C++){const R=x.getX(C);F.fromBufferAttribute(M,R),dt(F,R,_,l,t,i,this)}else for(let C=Math.max(0,p.start),A=Math.min(M.count,p.start+p.count);C<A;C++)F.fromBufferAttribute(M,C),dt(F,C,_,l,t,i,this)}else console.error("THREE.Points.raycast() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}updateMorphTargets(){const t=this.geometry;if(t.isBufferGeometry){const i=t.morphAttributes,a=Object.keys(i);if(a.length>0){const l=i[a[0]];if(l!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let d=0,p=l.length;d<p;d++){const v=l[d].name||String(d);this.morphTargetInfluences.push(0),this.morphTargetDictionary[v]=d}}}}else{const i=t.morphTargets;i!==void 0&&i.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}}}function dt(m,t,i,a,l,d,p){const v=g.distanceSqToPoint(m);if(v<i){const _=new gt;g.closestPointToPoint(m,_),_.applyMatrix4(a);const x=l.ray.origin.distanceTo(_);if(x<l.near||x>l.far)return;d.push({distance:x,distanceToRay:Math.sqrt(v),point:_,index:t,face:null,object:p})}}q.prototype.isPoints=!0;class Mt extends ni{constructor(t,i,a,l,d,p,v,_,x){super(t,i,a,l,d,p,v,_,x),this.format=v!==void 0?v:yn,this.minFilter=p!==void 0?p:Qe,this.magFilter=d!==void 0?d:Qe,this.generateMipmaps=!1;const M=this;"requestVideoFrameCallback"in t&&t.requestVideoFrameCallback(function C(){M.needsUpdate=!0,t.requestVideoFrameCallback(C)})}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!("requestVideoFrameCallback"in t)&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}Mt.prototype.isVideoTexture=!0;class Lt extends ni{constructor(t,i,a,l,d,p,v,_,x,M,C,A){super(null,p,v,_,x,M,l,d,C,A),this.image={width:i,height:a},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}Lt.prototype.isCompressedTexture=!0;class qt extends ni{constructor(t,i,a,l,d,p,v,_,x){super(t,i,a,l,d,p,v,_,x),this.needsUpdate=!0}}qt.prototype.isCanvasTexture=!0;class Ee extends ni{constructor(t,i,a,l,d,p,v,_,x,M){if((M=M!==void 0?M:dn)!==dn&&M!==rr)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");a===void 0&&M===dn&&(a=Aa),a===void 0&&M===rr&&(a=un),super(null,l,d,p,v,_,M,a,x),this.image={width:t,height:i},this.magFilter=v!==void 0?v:wt,this.minFilter=_!==void 0?_:wt,this.flipY=!1,this.generateMipmaps=!1}}Ee.prototype.isDepthTexture=!0;class me extends zn{constructor(t=1,i=8,a=0,l=2*Math.PI){super(),this.type="CircleGeometry",this.parameters={radius:t,segments:i,thetaStart:a,thetaLength:l},i=Math.max(3,i);const d=[],p=[],v=[],_=[],x=new gt,M=new He;p.push(0,0,0),v.push(0,0,1),_.push(.5,.5);for(let C=0,A=3;C<=i;C++,A+=3){const R=a+C/i*l;x.x=t*Math.cos(R),x.y=t*Math.sin(R),p.push(x.x,x.y,x.z),v.push(0,0,1),M.x=(p[A]/t+1)/2,M.y=(p[A+1]/t+1)/2,_.push(M.x,M.y)}for(let C=1;C<=i;C++)d.push(C,C+1,0);this.setIndex(d),this.setAttribute("position",new xn(p,3)),this.setAttribute("normal",new xn(v,3)),this.setAttribute("uv",new xn(_,2))}static fromJSON(t){return new me(t.radius,t.segments,t.thetaStart,t.thetaLength)}}class De extends zn{constructor(t=1,i=1,a=1,l=8,d=1,p=!1,v=0,_=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:t,radiusBottom:i,height:a,radialSegments:l,heightSegments:d,openEnded:p,thetaStart:v,thetaLength:_};const x=this;l=Math.floor(l),d=Math.floor(d);const M=[],C=[],A=[],R=[];let O=0;const U=[],D=a/2;let Z=0;function ot(vt){const mt=O,At=new He,Pt=new gt;let Et=0;const Ot=vt===!0?t:i,Ie=vt===!0?1:-1;for(let xe=1;xe<=l;xe++)C.push(0,D*Ie,0),A.push(0,Ie,0),R.push(.5,.5),O++;const ye=O;for(let xe=0;xe<=l;xe++){const ge=xe/l*_+v,Ht=Math.cos(ge),ce=Math.sin(ge);Pt.x=Ot*ce,Pt.y=D*Ie,Pt.z=Ot*Ht,C.push(Pt.x,Pt.y,Pt.z),A.push(0,Ie,0),At.x=.5*Ht+.5,At.y=.5*ce*Ie+.5,R.push(At.x,At.y),O++}for(let xe=0;xe<l;xe++){const ge=mt+xe,Ht=ye+xe;vt===!0?M.push(Ht,Ht+1,ge):M.push(Ht+1,Ht,ge),Et+=3}x.addGroup(Z,Et,vt===!0?1:2),Z+=Et}(function(){const vt=new gt,mt=new gt;let At=0;const Pt=(i-t)/a;for(let Et=0;Et<=d;Et++){const Ot=[],Ie=Et/d,ye=Ie*(i-t)+t;for(let xe=0;xe<=l;xe++){const ge=xe/l,Ht=ge*_+v,ce=Math.sin(Ht),We=Math.cos(Ht);mt.x=ye*ce,mt.y=-Ie*a+D,mt.z=ye*We,C.push(mt.x,mt.y,mt.z),vt.set(ce,Pt,We).normalize(),A.push(vt.x,vt.y,vt.z),R.push(ge,1-Ie),Ot.push(O++)}U.push(Ot)}for(let Et=0;Et<l;Et++)for(let Ot=0;Ot<d;Ot++){const Ie=U[Ot][Et],ye=U[Ot+1][Et],xe=U[Ot+1][Et+1],ge=U[Ot][Et+1];M.push(Ie,ye,ge),M.push(ye,xe,ge),At+=6}x.addGroup(Z,At,0),Z+=At})(),p===!1&&(t>0&&ot(!0),i>0&&ot(!1)),this.setIndex(M),this.setAttribute("position",new xn(C,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(R,2))}static fromJSON(t){return new De(t.radiusTop,t.radiusBottom,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class gn extends De{constructor(t=1,i=1,a=8,l=1,d=!1,p=0,v=2*Math.PI){super(0,t,i,a,l,d,p,v),this.type="ConeGeometry",this.parameters={radius:t,height:i,radialSegments:a,heightSegments:l,openEnded:d,thetaStart:p,thetaLength:v}}static fromJSON(t){return new gn(t.radius,t.height,t.radialSegments,t.heightSegments,t.openEnded,t.thetaStart,t.thetaLength)}}class ln extends zn{constructor(t,i,a=1,l=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:t,indices:i,radius:a,detail:l};const d=[],p=[];function v(A,R,O,U){const D=U+1,Z=[];for(let ot=0;ot<=D;ot++){Z[ot]=[];const vt=A.clone().lerp(O,ot/D),mt=R.clone().lerp(O,ot/D),At=D-ot;for(let Pt=0;Pt<=At;Pt++)Z[ot][Pt]=Pt===0&&ot===D?vt:vt.clone().lerp(mt,Pt/At)}for(let ot=0;ot<D;ot++)for(let vt=0;vt<2*(D-ot)-1;vt++){const mt=Math.floor(vt/2);vt%2==0?(_(Z[ot][mt+1]),_(Z[ot+1][mt]),_(Z[ot][mt])):(_(Z[ot][mt+1]),_(Z[ot+1][mt+1]),_(Z[ot+1][mt]))}}function _(A){d.push(A.x,A.y,A.z)}function x(A,R){const O=3*A;R.x=t[O+0],R.y=t[O+1],R.z=t[O+2]}function M(A,R,O,U){U<0&&A.x===1&&(p[R]=A.x-1),O.x===0&&O.z===0&&(p[R]=U/2/Math.PI+.5)}function C(A){return Math.atan2(A.z,-A.x)}(function(A){const R=new gt,O=new gt,U=new gt;for(let D=0;D<i.length;D+=3)x(i[D+0],R),x(i[D+1],O),x(i[D+2],U),v(R,O,U,A)})(l),function(A){const R=new gt;for(let O=0;O<d.length;O+=3)R.x=d[O+0],R.y=d[O+1],R.z=d[O+2],R.normalize().multiplyScalar(A),d[O+0]=R.x,d[O+1]=R.y,d[O+2]=R.z}(a),function(){const A=new gt;for(let O=0;O<d.length;O+=3){A.x=d[O+0],A.y=d[O+1],A.z=d[O+2];const U=C(A)/2/Math.PI+.5,D=(R=A,Math.atan2(-R.y,Math.sqrt(R.x*R.x+R.z*R.z))/Math.PI+.5);p.push(U,1-D)}var R;(function(){const O=new gt,U=new gt,D=new gt,Z=new gt,ot=new He,vt=new He,mt=new He;for(let At=0,Pt=0;At<d.length;At+=9,Pt+=6){O.set(d[At+0],d[At+1],d[At+2]),U.set(d[At+3],d[At+4],d[At+5]),D.set(d[At+6],d[At+7],d[At+8]),ot.set(p[Pt+0],p[Pt+1]),vt.set(p[Pt+2],p[Pt+3]),mt.set(p[Pt+4],p[Pt+5]),Z.copy(O).add(U).add(D).divideScalar(3);const Et=C(Z);M(ot,Pt+0,O,Et),M(vt,Pt+2,U,Et),M(mt,Pt+4,D,Et)}})(),function(){for(let O=0;O<p.length;O+=6){const U=p[O+0],D=p[O+2],Z=p[O+4],ot=Math.max(U,D,Z),vt=Math.min(U,D,Z);ot>.9&&vt<.1&&(U<.2&&(p[O+0]+=1),D<.2&&(p[O+2]+=1),Z<.2&&(p[O+4]+=1))}}()}(),this.setAttribute("position",new xn(d,3)),this.setAttribute("normal",new xn(d.slice(),3)),this.setAttribute("uv",new xn(p,2)),l===0?this.computeVertexNormals():this.normalizeNormals()}static fromJSON(t){return new ln(t.vertices,t.indices,t.radius,t.details)}}class An extends ln{constructor(t=1,i=0){const a=(1+Math.sqrt(5))/2,l=1/a;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-l,-a,0,-l,a,0,l,-a,0,l,a,-l,-a,0,-l,a,0,l,-a,0,l,a,0,-a,0,-l,a,0,-l,-a,0,l,a,0,l],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],t,i),this.type="DodecahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new An(t.radius,t.detail)}}const ve=new gt,Xe=new gt,Un=new gt,mn=new bi;class Yn extends zn{constructor(t,i){if(super(),this.type="EdgesGeometry",this.parameters={thresholdAngle:i},i=i!==void 0?i:1,t.isGeometry===!0)return void console.error("THREE.EdgesGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const a=Math.pow(10,4),l=Math.cos(ea*i),d=t.getIndex(),p=t.getAttribute("position"),v=d?d.count:p.count,_=[0,0,0],x=["a","b","c"],M=new Array(3),C={},A=[];for(let R=0;R<v;R+=3){d?(_[0]=d.getX(R),_[1]=d.getX(R+1),_[2]=d.getX(R+2)):(_[0]=R,_[1]=R+1,_[2]=R+2);const{a:O,b:U,c:D}=mn;if(O.fromBufferAttribute(p,_[0]),U.fromBufferAttribute(p,_[1]),D.fromBufferAttribute(p,_[2]),mn.getNormal(Un),M[0]=`${Math.round(O.x*a)},${Math.round(O.y*a)},${Math.round(O.z*a)}`,M[1]=`${Math.round(U.x*a)},${Math.round(U.y*a)},${Math.round(U.z*a)}`,M[2]=`${Math.round(D.x*a)},${Math.round(D.y*a)},${Math.round(D.z*a)}`,M[0]!==M[1]&&M[1]!==M[2]&&M[2]!==M[0])for(let Z=0;Z<3;Z++){const ot=(Z+1)%3,vt=M[Z],mt=M[ot],At=mn[x[Z]],Pt=mn[x[ot]],Et=`${vt}_${mt}`,Ot=`${mt}_${vt}`;Ot in C&&C[Ot]?(Un.dot(C[Ot].normal)<=l&&(A.push(At.x,At.y,At.z),A.push(Pt.x,Pt.y,Pt.z)),C[Ot]=null):Et in C||(C[Et]={index0:_[Z],index1:_[ot],normal:Un.clone()})}}for(const R in C)if(C[R]){const{index0:O,index1:U}=C[R];ve.fromBufferAttribute(p,O),Xe.fromBufferAttribute(p,U),A.push(ve.x,ve.y,ve.z),A.push(Xe.x,Xe.y,Xe.z)}this.setAttribute("position",new xn(A,3))}}class wn{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(t,i){const a=this.getUtoTmapping(t);return this.getPoint(a,i)}getPoints(t=5){const i=[];for(let a=0;a<=t;a++)i.push(this.getPoint(a/t));return i}getSpacedPoints(t=5){const i=[];for(let a=0;a<=t;a++)i.push(this.getPointAt(a/t));return i}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const i=[];let a,l=this.getPoint(0),d=0;i.push(0);for(let p=1;p<=t;p++)a=this.getPoint(p/t),d+=a.distanceTo(l),i.push(d),l=a;return this.cacheArcLengths=i,i}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,i){const a=this.getLengths();let l=0;const d=a.length;let p;p=i||t*a[d-1];let v,_=0,x=d-1;for(;_<=x;)if(l=Math.floor(_+(x-_)/2),v=a[l]-p,v<0)_=l+1;else{if(!(v>0)){x=l;break}x=l-1}if(l=x,a[l]===p)return l/(d-1);const M=a[l];return(l+(p-M)/(a[l+1]-M))/(d-1)}getTangent(t,i){let a=t-1e-4,l=t+1e-4;a<0&&(a=0),l>1&&(l=1);const d=this.getPoint(a),p=this.getPoint(l),v=i||(d.isVector2?new He:new gt);return v.copy(p).sub(d).normalize(),v}getTangentAt(t,i){const a=this.getUtoTmapping(t);return this.getTangent(a,i)}computeFrenetFrames(t,i){const a=new gt,l=[],d=[],p=[],v=new gt,_=new En;for(let R=0;R<=t;R++){const O=R/t;l[R]=this.getTangentAt(O,new gt),l[R].normalize()}d[0]=new gt,p[0]=new gt;let x=Number.MAX_VALUE;const M=Math.abs(l[0].x),C=Math.abs(l[0].y),A=Math.abs(l[0].z);M<=x&&(x=M,a.set(1,0,0)),C<=x&&(x=C,a.set(0,1,0)),A<=x&&a.set(0,0,1),v.crossVectors(l[0],a).normalize(),d[0].crossVectors(l[0],v),p[0].crossVectors(l[0],d[0]);for(let R=1;R<=t;R++){if(d[R]=d[R-1].clone(),p[R]=p[R-1].clone(),v.crossVectors(l[R-1],l[R]),v.length()>Number.EPSILON){v.normalize();const O=Math.acos(zi(l[R-1].dot(l[R]),-1,1));d[R].applyMatrix4(_.makeRotationAxis(v,O))}p[R].crossVectors(l[R],d[R])}if(i===!0){let R=Math.acos(zi(d[0].dot(d[t]),-1,1));R/=t,l[0].dot(v.crossVectors(d[0],d[t]))>0&&(R=-R);for(let O=1;O<=t;O++)d[O].applyMatrix4(_.makeRotationAxis(l[O],R*O)),p[O].crossVectors(l[O],d[O])}return{tangents:l,normals:d,binormals:p}}clone(){return new this.constructor().copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class lr extends wn{constructor(t=0,i=0,a=1,l=1,d=0,p=2*Math.PI,v=!1,_=0){super(),this.type="EllipseCurve",this.aX=t,this.aY=i,this.xRadius=a,this.yRadius=l,this.aStartAngle=d,this.aEndAngle=p,this.aClockwise=v,this.aRotation=_}getPoint(t,i){const a=i||new He,l=2*Math.PI;let d=this.aEndAngle-this.aStartAngle;const p=Math.abs(d)<Number.EPSILON;for(;d<0;)d+=l;for(;d>l;)d-=l;d<Number.EPSILON&&(d=p?0:l),this.aClockwise!==!0||p||(d===l?d=-l:d-=l);const v=this.aStartAngle+t*d;let _=this.aX+this.xRadius*Math.cos(v),x=this.aY+this.yRadius*Math.sin(v);if(this.aRotation!==0){const M=Math.cos(this.aRotation),C=Math.sin(this.aRotation),A=_-this.aX,R=x-this.aY;_=A*M-R*C+this.aX,x=A*C+R*M+this.aY}return a.set(_,x)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}lr.prototype.isEllipseCurve=!0;class In extends lr{constructor(t,i,a,l,d,p){super(t,i,a,a,l,d,p),this.type="ArcCurve"}}function jn(){let m=0,t=0,i=0,a=0;function l(d,p,v,_){m=d,t=v,i=-3*d+3*p-2*v-_,a=2*d-2*p+v+_}return{initCatmullRom:function(d,p,v,_,x){l(p,v,x*(v-d),x*(_-p))},initNonuniformCatmullRom:function(d,p,v,_,x,M,C){let A=(p-d)/x-(v-d)/(x+M)+(v-p)/M,R=(v-p)/M-(_-p)/(M+C)+(_-v)/C;A*=M,R*=M,l(p,v,A,R)},calc:function(d){const p=d*d;return m+t*d+i*p+a*(p*d)}}}In.prototype.isArcCurve=!0;const Ei=new gt,xo=new jn,Ls=new jn,ki=new jn;class Zs extends wn{constructor(t=[],i=!1,a="centripetal",l=.5){super(),this.type="CatmullRomCurve3",this.points=t,this.closed=i,this.curveType=a,this.tension=l}getPoint(t,i=new gt){const a=i,l=this.points,d=l.length,p=(d-(this.closed?0:1))*t;let v,_,x=Math.floor(p),M=p-x;this.closed?x+=x>0?0:(Math.floor(Math.abs(x)/d)+1)*d:M===0&&x===d-1&&(x=d-2,M=1),this.closed||x>0?v=l[(x-1)%d]:(Ei.subVectors(l[0],l[1]).add(l[0]),v=Ei);const C=l[x%d],A=l[(x+1)%d];if(this.closed||x+2<d?_=l[(x+2)%d]:(Ei.subVectors(l[d-1],l[d-2]).add(l[d-1]),_=Ei),this.curveType==="centripetal"||this.curveType==="chordal"){const R=this.curveType==="chordal"?.5:.25;let O=Math.pow(v.distanceToSquared(C),R),U=Math.pow(C.distanceToSquared(A),R),D=Math.pow(A.distanceToSquared(_),R);U<1e-4&&(U=1),O<1e-4&&(O=U),D<1e-4&&(D=U),xo.initNonuniformCatmullRom(v.x,C.x,A.x,_.x,O,U,D),Ls.initNonuniformCatmullRom(v.y,C.y,A.y,_.y,O,U,D),ki.initNonuniformCatmullRom(v.z,C.z,A.z,_.z,O,U,D)}else this.curveType==="catmullrom"&&(xo.initCatmullRom(v.x,C.x,A.x,_.x,this.tension),Ls.initCatmullRom(v.y,C.y,A.y,_.y,this.tension),ki.initCatmullRom(v.z,C.z,A.z,_.z,this.tension));return a.set(xo.calc(M),Ls.calc(M),ki.calc(M)),a}copy(t){super.copy(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(l.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let i=0,a=this.points.length;i<a;i++){const l=this.points[i];t.points.push(l.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(new gt().fromArray(l))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}}function Za(m,t,i,a,l){const d=.5*(a-t),p=.5*(l-i),v=m*m;return(2*i-2*a+d+p)*(m*v)+(-3*i+3*a-2*d-p)*v+d*m+i}function Ja(m,t,i,a){return function(l,d){const p=1-l;return p*p*d}(m,t)+function(l,d){return 2*(1-l)*l*d}(m,i)+function(l,d){return l*l*d}(m,a)}function bl(m,t,i,a,l){return function(d,p){const v=1-d;return v*v*v*p}(m,t)+function(d,p){const v=1-d;return 3*v*v*d*p}(m,i)+function(d,p){return 3*(1-d)*d*d*p}(m,a)+function(d,p){return d*d*d*p}(m,l)}Zs.prototype.isCatmullRomCurve3=!0;class va extends wn{constructor(t=new He,i=new He,a=new He,l=new He){super(),this.type="CubicBezierCurve",this.v0=t,this.v1=i,this.v2=a,this.v3=l}getPoint(t,i=new He){const a=i,l=this.v0,d=this.v1,p=this.v2,v=this.v3;return a.set(bl(t,l.x,d.x,p.x,v.x),bl(t,l.y,d.y,p.y,v.y)),a}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}va.prototype.isCubicBezierCurve=!0;class _a extends wn{constructor(t=new gt,i=new gt,a=new gt,l=new gt){super(),this.type="CubicBezierCurve3",this.v0=t,this.v1=i,this.v2=a,this.v3=l}getPoint(t,i=new gt){const a=i,l=this.v0,d=this.v1,p=this.v2,v=this.v3;return a.set(bl(t,l.x,d.x,p.x,v.x),bl(t,l.y,d.y,p.y,v.y),bl(t,l.z,d.z,p.z,v.z)),a}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}_a.prototype.isCubicBezierCurve3=!0;class Bu extends wn{constructor(t=new He,i=new He){super(),this.type="LineCurve",this.v1=t,this.v2=i}getPoint(t,i=new He){const a=i;return t===1?a.copy(this.v2):(a.copy(this.v2).sub(this.v1),a.multiplyScalar(t).add(this.v1)),a}getPointAt(t,i){return this.getPoint(t,i)}getTangent(t,i){const a=i||new He;return a.copy(this.v2).sub(this.v1).normalize(),a}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}Bu.prototype.isLineCurve=!0;class Qd extends wn{constructor(t=new gt,i=new gt){super(),this.type="LineCurve3",this.isLineCurve3=!0,this.v1=t,this.v2=i}getPoint(t,i=new gt){const a=i;return t===1?a.copy(this.v2):(a.copy(this.v2).sub(this.v1),a.multiplyScalar(t).add(this.v1)),a}getPointAt(t,i){return this.getPoint(t,i)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class ru extends wn{constructor(t=new He,i=new He,a=new He){super(),this.type="QuadraticBezierCurve",this.v0=t,this.v1=i,this.v2=a}getPoint(t,i=new He){const a=i,l=this.v0,d=this.v1,p=this.v2;return a.set(Ja(t,l.x,d.x,p.x),Ja(t,l.y,d.y,p.y)),a}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}ru.prototype.isQuadraticBezierCurve=!0;class zh extends wn{constructor(t=new gt,i=new gt,a=new gt){super(),this.type="QuadraticBezierCurve3",this.v0=t,this.v1=i,this.v2=a}getPoint(t,i=new gt){const a=i,l=this.v0,d=this.v1,p=this.v2;return a.set(Ja(t,l.x,d.x,p.x),Ja(t,l.y,d.y,p.y),Ja(t,l.z,d.z,p.z)),a}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}zh.prototype.isQuadraticBezierCurve3=!0;class iu extends wn{constructor(t=[]){super(),this.type="SplineCurve",this.points=t}getPoint(t,i=new He){const a=i,l=this.points,d=(l.length-1)*t,p=Math.floor(d),v=d-p,_=l[p===0?p:p-1],x=l[p],M=l[p>l.length-2?l.length-1:p+1],C=l[p>l.length-3?l.length-1:p+2];return a.set(Za(v,_.x,x.x,M.x,C.x),Za(v,_.y,x.y,M.y,C.y)),a}copy(t){super.copy(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(l.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let i=0,a=this.points.length;i<a;i++){const l=this.points[i];t.points.push(l.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let i=0,a=t.points.length;i<a;i++){const l=t.points[i];this.points.push(new He().fromArray(l))}return this}}iu.prototype.isSplineCurve=!0;var $a=Object.freeze({__proto__:null,ArcCurve:In,CatmullRomCurve3:Zs,CubicBezierCurve:va,CubicBezierCurve3:_a,EllipseCurve:lr,LineCurve:Bu,LineCurve3:Qd,QuadraticBezierCurve:ru,QuadraticBezierCurve3:zh,SplineCurve:iu});const Kp=function(m,t,i=2){const a=t&&t.length,l=a?t[0]*i:m.length;let d=jh(m,0,l,i,!0);const p=[];if(!d||d.next===d.prev)return p;let v,_,x,M,C,A,R;if(a&&(d=function(O,U,D,Z){const ot=[];let vt,mt,At,Pt,Et;for(vt=0,mt=U.length;vt<mt;vt++)At=U[vt]*Z,Pt=vt<mt-1?U[vt+1]*Z:O.length,Et=jh(O,At,Pt,Z,!1),Et===Et.next&&(Et.steiner=!0),ot.push(Qc(Et));for(ot.sort(ts),vt=0;vt<ot.length;vt++)Rf(ot[vt],D),D=Po(D,D.next);return D}(m,t,d,i)),m.length>80*i){v=x=m[0],_=M=m[1];for(let O=i;O<l;O+=i)C=m[O],A=m[O+1],C<v&&(v=C),A<_&&(_=A),C>x&&(x=C),A>M&&(M=A);R=Math.max(x-v,M-_),R=R!==0?1/R:0}return Kc(d,p,i,v,_,R),p};function jh(m,t,i,a,l){let d,p;if(l===function(v,_,x,M){let C=0;for(let A=_,R=x-M;A<x;A+=M)C+=(v[R]-v[A])*(v[A+1]+v[R+1]),R=A;return C}(m,t,i,a)>0)for(d=t;d<i;d+=a)p=wm(d,m[d],m[d+1],p);else for(d=i-a;d>=t;d-=a)p=wm(d,m[d],m[d+1],p);return p&&Ro(p,p.next)&&(np(p),p=p.next),p}function Po(m,t){if(!m)return m;t||(t=m);let i,a=m;do if(i=!1,a.steiner||!Ro(a,a.next)&&Mi(a.prev,a,a.next)!==0)a=a.next;else{if(np(a),a=t=a.prev,a===a.next)break;i=!0}while(i||a!==t);return t}function Kc(m,t,i,a,l,d,p){if(!m)return;!p&&d&&function(M,C,A,R){let O=M;do O.z===null&&(O.z=Vh(O.x,O.y,C,A,R)),O.prevZ=O.prev,O.nextZ=O.next,O=O.next;while(O!==M);O.prevZ.nextZ=null,O.prevZ=null,function(U){let D,Z,ot,vt,mt,At,Pt,Et,Ot=1;do{for(Z=U,U=null,mt=null,At=0;Z;){for(At++,ot=Z,Pt=0,D=0;D<Ot&&(Pt++,ot=ot.nextZ,ot);D++);for(Et=Ot;Pt>0||Et>0&&ot;)Pt!==0&&(Et===0||!ot||Z.z<=ot.z)?(vt=Z,Z=Z.nextZ,Pt--):(vt=ot,ot=ot.nextZ,Et--),mt?mt.nextZ=vt:U=vt,vt.prevZ=mt,mt=vt;Z=ot}mt.nextZ=null,Ot*=2}while(At>1)}(O)}(m,a,l,d);let v,_,x=m;for(;m.prev!==m.next;)if(v=m.prev,_=m.next,d?rg(m,a,l,d):ng(m))t.push(v.i/i),t.push(m.i/i),t.push(_.i/i),np(m),m=_.next,x=_.next;else if((m=_)===x){p?p===1?Kc(m=xm(Po(m),t,i),t,i,a,l,d,2):p===2&&ig(m,t,i,a,l,d):Kc(Po(m),t,i,a,l,d,1);break}}function ng(m){const t=m.prev,i=m,a=m.next;if(Mi(t,i,a)>=0)return!1;let l=m.next.next;for(;l!==m.prev;){if(Wh(t.x,t.y,i.x,i.y,a.x,a.y,l.x,l.y)&&Mi(l.prev,l,l.next)>=0)return!1;l=l.next}return!0}function rg(m,t,i,a){const l=m.prev,d=m,p=m.next;if(Mi(l,d,p)>=0)return!1;const v=l.x<d.x?l.x<p.x?l.x:p.x:d.x<p.x?d.x:p.x,_=l.y<d.y?l.y<p.y?l.y:p.y:d.y<p.y?d.y:p.y,x=l.x>d.x?l.x>p.x?l.x:p.x:d.x>p.x?d.x:p.x,M=l.y>d.y?l.y>p.y?l.y:p.y:d.y>p.y?d.y:p.y,C=Vh(v,_,t,i,a),A=Vh(x,M,t,i,a);let R=m.prevZ,O=m.nextZ;for(;R&&R.z>=C&&O&&O.z<=A;){if(R!==m.prev&&R!==m.next&&Wh(l.x,l.y,d.x,d.y,p.x,p.y,R.x,R.y)&&Mi(R.prev,R,R.next)>=0||(R=R.prevZ,O!==m.prev&&O!==m.next&&Wh(l.x,l.y,d.x,d.y,p.x,p.y,O.x,O.y)&&Mi(O.prev,O,O.next)>=0))return!1;O=O.nextZ}for(;R&&R.z>=C;){if(R!==m.prev&&R!==m.next&&Wh(l.x,l.y,d.x,d.y,p.x,p.y,R.x,R.y)&&Mi(R.prev,R,R.next)>=0)return!1;R=R.prevZ}for(;O&&O.z<=A;){if(O!==m.prev&&O!==m.next&&Wh(l.x,l.y,d.x,d.y,p.x,p.y,O.x,O.y)&&Mi(O.prev,O,O.next)>=0)return!1;O=O.nextZ}return!0}function xm(m,t,i){let a=m;do{const l=a.prev,d=a.next.next;!Ro(l,d)&&tp(l,a,a.next,d)&&qh(l,d)&&qh(d,l)&&(t.push(l.i/i),t.push(a.i/i),t.push(d.i/i),np(a),np(a.next),a=m=d),a=a.next}while(a!==m);return Po(a)}function ig(m,t,i,a,l,d){let p=m;do{let v=p.next.next;for(;v!==p.prev;){if(p.i!==v.i&&bm(p,v)){let _=Qp(p,v);return p=Po(p,p.next),_=Po(_,_.next),Kc(p,t,i,a,l,d),void Kc(_,t,i,a,l,d)}v=v.next}p=p.next}while(p!==m)}function ts(m,t){return m.x-t.x}function Rf(m,t){if(t=function(i,a){let l=a;const d=i.x,p=i.y;let v,_=-1/0;do{if(p<=l.y&&p>=l.next.y&&l.next.y!==l.y){const O=l.x+(p-l.y)*(l.next.x-l.x)/(l.next.y-l.y);if(O<=d&&O>_){if(_=O,O===d){if(p===l.y)return l;if(p===l.next.y)return l.next}v=l.x<l.next.x?l:l.next}}l=l.next}while(l!==a);if(!v)return null;if(d===_)return v;const x=v,M=v.x,C=v.y;let A,R=1/0;l=v;do d>=l.x&&l.x>=M&&d!==l.x&&Wh(p<C?d:_,p,M,C,p<C?_:d,p,l.x,l.y)&&(A=Math.abs(p-l.y)/(d-l.x),qh(l,i)&&(A<R||A===R&&(l.x>v.x||l.x===v.x&&og(v,l)))&&(v=l,R=A)),l=l.next;while(l!==x);return v}(m,t)){const i=Qp(t,m);Po(t,t.next),Po(i,i.next)}}function og(m,t){return Mi(m.prev,m,t.prev)<0&&Mi(t.next,m,m.next)<0}function Vh(m,t,i,a,l){return(m=1431655765&((m=858993459&((m=252645135&((m=16711935&((m=32767*(m-i)*l)|m<<8))|m<<4))|m<<2))|m<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-a)*l)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Qc(m){let t=m,i=m;do(t.x<i.x||t.x===i.x&&t.y<i.y)&&(i=t),t=t.next;while(t!==m);return i}function Wh(m,t,i,a,l,d,p,v){return(l-p)*(t-v)-(m-p)*(d-v)>=0&&(m-p)*(a-v)-(i-p)*(t-v)>=0&&(i-p)*(d-v)-(l-p)*(a-v)>=0}function bm(m,t){return m.next.i!==t.i&&m.prev.i!==t.i&&!function(i,a){let l=i;do{if(l.i!==i.i&&l.next.i!==i.i&&l.i!==a.i&&l.next.i!==a.i&&tp(l,l.next,i,a))return!0;l=l.next}while(l!==i);return!1}(m,t)&&(qh(m,t)&&qh(t,m)&&function(i,a){let l=i,d=!1;const p=(i.x+a.x)/2,v=(i.y+a.y)/2;do l.y>v!=l.next.y>v&&l.next.y!==l.y&&p<(l.next.x-l.x)*(v-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==i);return d}(m,t)&&(Mi(m.prev,m,t.prev)||Mi(m,t.prev,t))||Ro(m,t)&&Mi(m.prev,m,m.next)>0&&Mi(t.prev,t,t.next)>0)}function Mi(m,t,i){return(t.y-m.y)*(i.x-t.x)-(t.x-m.x)*(i.y-t.y)}function Ro(m,t){return m.x===t.x&&m.y===t.y}function tp(m,t,i,a){const l=Xh(Mi(m,t,i)),d=Xh(Mi(m,t,a)),p=Xh(Mi(i,a,m)),v=Xh(Mi(i,a,t));return l!==d&&p!==v||!(l!==0||!ep(m,i,t))||!(d!==0||!ep(m,a,t))||!(p!==0||!ep(i,m,a))||!(v!==0||!ep(i,t,a))}function ep(m,t,i){return t.x<=Math.max(m.x,i.x)&&t.x>=Math.min(m.x,i.x)&&t.y<=Math.max(m.y,i.y)&&t.y>=Math.min(m.y,i.y)}function Xh(m){return m>0?1:m<0?-1:0}function qh(m,t){return Mi(m.prev,m,m.next)<0?Mi(m,t,m.next)>=0&&Mi(m,m.prev,t)>=0:Mi(m,t,m.prev)<0||Mi(m,m.next,t)<0}function Qp(m,t){const i=new ku(m.i,m.x,m.y),a=new ku(t.i,t.x,t.y),l=m.next,d=t.prev;return m.next=t,t.prev=m,i.next=l,l.prev=i,a.next=i,i.prev=a,d.next=a,a.prev=d,a}function wm(m,t,i,a){const l=new ku(m,t,i);return a?(l.next=a.next,l.prev=a,a.next.prev=l,a.next=l):(l.prev=l,l.next=l),l}function np(m){m.next.prev=m.prev,m.prev.next=m.next,m.prevZ&&(m.prevZ.nextZ=m.nextZ),m.nextZ&&(m.nextZ.prevZ=m.prevZ)}function ku(m,t,i){this.i=m,this.x=t,this.y=i,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}class Os{static area(t){const i=t.length;let a=0;for(let l=i-1,d=0;d<i;l=d++)a+=t[l].x*t[d].y-t[d].x*t[l].y;return .5*a}static isClockWise(t){return Os.area(t)<0}static triangulateShape(t,i){const a=[],l=[],d=[];Sm(t),Tm(a,t);let p=t.length;i.forEach(Sm);for(let _=0;_<i.length;_++)l.push(p),p+=i[_].length,Tm(a,i[_]);const v=Kp(a,l);for(let _=0;_<v.length;_+=3)d.push(v.slice(_,_+3));return d}}function Sm(m){const t=m.length;t>2&&m[t-1].equals(m[0])&&m.pop()}function Tm(m,t){for(let i=0;i<t.length;i++)m.push(t[i].x),m.push(t[i].y)}class Ka extends zn{constructor(t,i){super(),this.type="ExtrudeGeometry",this.parameters={shapes:t,options:i},t=Array.isArray(t)?t:[t];const a=this,l=[],d=[];for(let v=0,_=t.length;v<_;v++)p(t[v]);function p(v){const _=[],x=i.curveSegments!==void 0?i.curveSegments:12,M=i.steps!==void 0?i.steps:1;let C=i.depth!==void 0?i.depth:100,A=i.bevelEnabled===void 0||i.bevelEnabled,R=i.bevelThickness!==void 0?i.bevelThickness:6,O=i.bevelSize!==void 0?i.bevelSize:R-2,U=i.bevelOffset!==void 0?i.bevelOffset:0,D=i.bevelSegments!==void 0?i.bevelSegments:3;const Z=i.extrudePath,ot=i.UVGenerator!==void 0?i.UVGenerator:Em;i.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),C=i.amount);let vt,mt,At,Pt,Et,Ot=!1;Z&&(vt=Z.getSpacedPoints(M),Ot=!0,A=!1,mt=Z.computeFrenetFrames(M,!1),At=new gt,Pt=new gt,Et=new gt),A||(D=0,R=0,O=0,U=0);const Ie=v.extractPoints(x);let ye=Ie.shape;const xe=Ie.holes;if(!Os.isClockWise(ye)){ye=ye.reverse();for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];Os.isClockWise(Zt)&&(xe[be]=Zt.reverse())}}const ge=Os.triangulateShape(ye,xe),Ht=ye;for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];ye=ye.concat(Zt)}function ce(be,xt,Zt){return xt||console.error("THREE.ExtrudeGeometry: vec does not exist"),xt.clone().multiplyScalar(Zt).add(be)}const We=ye.length,je=ge.length;function ze(be,xt,Zt){let Te,Pe,we;const bn=be.x-xt.x,Gn=be.y-xt.y,Fn=Zt.x-be.x,_r=Zt.y-be.y,Tr=bn*bn+Gn*Gn,Xo=bn*_r-Gn*Fn;if(Math.abs(Xo)>Number.EPSILON){const fi=Math.sqrt(Tr),uu=Math.sqrt(Fn*Fn+_r*_r),sm=xt.x-Gn/fi,am=xt.y+bn/fi,lm=((Zt.x-_r/uu-sm)*_r-(Zt.y+Fn/uu-am)*Fn)/(bn*_r-Gn*Fn);Te=sm+bn*lm-be.x,Pe=am+Gn*lm-be.y;const $s=Te*Te+Pe*Pe;if($s<=2)return new He(Te,Pe);we=Math.sqrt($s/2)}else{let fi=!1;bn>Number.EPSILON?Fn>Number.EPSILON&&(fi=!0):bn<-Number.EPSILON?Fn<-Number.EPSILON&&(fi=!0):Math.sign(Gn)===Math.sign(_r)&&(fi=!0),fi?(Te=-Gn,Pe=bn,we=Math.sqrt(Tr)):(Te=bn,Pe=Gn,we=Math.sqrt(Tr/2))}return new He(Te/we,Pe/we)}const fn=[];for(let be=0,xt=Ht.length,Zt=xt-1,Te=be+1;be<xt;be++,Zt++,Te++)Zt===xt&&(Zt=0),Te===xt&&(Te=0),fn[be]=ze(Ht[be],Ht[Zt],Ht[Te]);const _n=[];let Mn,Sn=fn.concat();for(let be=0,xt=xe.length;be<xt;be++){const Zt=xe[be];Mn=[];for(let Te=0,Pe=Zt.length,we=Pe-1,bn=Te+1;Te<Pe;Te++,we++,bn++)we===Pe&&(we=0),bn===Pe&&(bn=0),Mn[Te]=ze(Zt[Te],Zt[we],Zt[bn]);_n.push(Mn),Sn=Sn.concat(Mn)}for(let be=0;be<D;be++){const xt=be/D,Zt=R*Math.cos(xt*Math.PI/2),Te=O*Math.sin(xt*Math.PI/2)+U;for(let Pe=0,we=Ht.length;Pe<we;Pe++){const bn=ce(Ht[Pe],fn[Pe],Te);Fe(bn.x,bn.y,-Zt)}for(let Pe=0,we=xe.length;Pe<we;Pe++){const bn=xe[Pe];Mn=_n[Pe];for(let Gn=0,Fn=bn.length;Gn<Fn;Gn++){const _r=ce(bn[Gn],Mn[Gn],Te);Fe(_r.x,_r.y,-Zt)}}}const Rt=O+U;for(let be=0;be<We;be++){const xt=A?ce(ye[be],Sn[be],Rt):ye[be];Ot?(Pt.copy(mt.normals[0]).multiplyScalar(xt.x),At.copy(mt.binormals[0]).multiplyScalar(xt.y),Et.copy(vt[0]).add(Pt).add(At),Fe(Et.x,Et.y,Et.z)):Fe(xt.x,xt.y,0)}for(let be=1;be<=M;be++)for(let xt=0;xt<We;xt++){const Zt=A?ce(ye[xt],Sn[xt],Rt):ye[xt];Ot?(Pt.copy(mt.normals[be]).multiplyScalar(Zt.x),At.copy(mt.binormals[be]).multiplyScalar(Zt.y),Et.copy(vt[be]).add(Pt).add(At),Fe(Et.x,Et.y,Et.z)):Fe(Zt.x,Zt.y,C/M*be)}for(let be=D-1;be>=0;be--){const xt=be/D,Zt=R*Math.cos(xt*Math.PI/2),Te=O*Math.sin(xt*Math.PI/2)+U;for(let Pe=0,we=Ht.length;Pe<we;Pe++){const bn=ce(Ht[Pe],fn[Pe],Te);Fe(bn.x,bn.y,C+Zt)}for(let Pe=0,we=xe.length;Pe<we;Pe++){const bn=xe[Pe];Mn=_n[Pe];for(let Gn=0,Fn=bn.length;Gn<Fn;Gn++){const _r=ce(bn[Gn],Mn[Gn],Te);Ot?Fe(_r.x,_r.y+vt[M-1].y,vt[M-1].x+Zt):Fe(_r.x,_r.y,C+Zt)}}}function Dt(be,xt){let Zt=be.length;for(;--Zt>=0;){const Te=Zt;let Pe=Zt-1;Pe<0&&(Pe=be.length-1);for(let we=0,bn=M+2*D;we<bn;we++){const Gn=We*we,Fn=We*(we+1);pe(xt+Te+Gn,xt+Pe+Gn,xt+Pe+Fn,xt+Te+Fn)}}}function Fe(be,xt,Zt){_.push(be),_.push(xt),_.push(Zt)}function Be(be,xt,Zt){rn(be),rn(xt),rn(Zt);const Te=l.length/3,Pe=ot.generateTopUV(a,l,Te-3,Te-2,Te-1);sn(Pe[0]),sn(Pe[1]),sn(Pe[2])}function pe(be,xt,Zt,Te){rn(be),rn(xt),rn(Te),rn(xt),rn(Zt),rn(Te);const Pe=l.length/3,we=ot.generateSideWallUV(a,l,Pe-6,Pe-3,Pe-2,Pe-1);sn(we[0]),sn(we[1]),sn(we[3]),sn(we[1]),sn(we[2]),sn(we[3])}function rn(be){l.push(_[3*be+0]),l.push(_[3*be+1]),l.push(_[3*be+2])}function sn(be){d.push(be.x),d.push(be.y)}(function(){const be=l.length/3;if(A){let xt=0,Zt=We*xt;for(let Te=0;Te<je;Te++){const Pe=ge[Te];Be(Pe[2]+Zt,Pe[1]+Zt,Pe[0]+Zt)}xt=M+2*D,Zt=We*xt;for(let Te=0;Te<je;Te++){const Pe=ge[Te];Be(Pe[0]+Zt,Pe[1]+Zt,Pe[2]+Zt)}}else{for(let xt=0;xt<je;xt++){const Zt=ge[xt];Be(Zt[2],Zt[1],Zt[0])}for(let xt=0;xt<je;xt++){const Zt=ge[xt];Be(Zt[0]+We*M,Zt[1]+We*M,Zt[2]+We*M)}}a.addGroup(be,l.length/3-be,0)})(),function(){const be=l.length/3;let xt=0;Dt(Ht,xt),xt+=Ht.length;for(let Zt=0,Te=xe.length;Zt<Te;Zt++){const Pe=xe[Zt];Dt(Pe,xt),xt+=Pe.length}a.addGroup(be,l.length/3-be,1)}()}this.setAttribute("position",new xn(l,3)),this.setAttribute("uv",new xn(d,2)),this.computeVertexNormals()}toJSON(){const t=super.toJSON();return function(i,a,l){if(l.shapes=[],Array.isArray(i))for(let d=0,p=i.length;d<p;d++){const v=i[d];l.shapes.push(v.uuid)}else l.shapes.push(i.uuid);return a.extrudePath!==void 0&&(l.options.extrudePath=a.extrudePath.toJSON()),l}(this.parameters.shapes,this.parameters.options,t)}static fromJSON(t,i){const a=[];for(let d=0,p=t.shapes.length;d<p;d++){const v=i[t.shapes[d]];a.push(v)}const l=t.options.extrudePath;return l!==void 0&&(t.options.extrudePath=new $a[l.type]().fromJSON(l)),new Ka(a,t.options)}}const Em={generateTopUV:function(m,t,i,a,l){const d=t[3*i],p=t[3*i+1],v=t[3*a],_=t[3*a+1],x=t[3*l],M=t[3*l+1];return[new He(d,p),new He(v,_),new He(x,M)]},generateSideWallUV:function(m,t,i,a,l,d){const p=t[3*i],v=t[3*i+1],_=t[3*i+2],x=t[3*a],M=t[3*a+1],C=t[3*a+2],A=t[3*l],R=t[3*l+1],O=t[3*l+2],U=t[3*d],D=t[3*d+1],Z=t[3*d+2];return Math.abs(v-M)<Math.abs(p-x)?[new He(p,1-_),new He(x,1-C),new He(A,1-O),new He(U,1-Z)]:[new He(v,1-_),new He(M,1-C),new He(R,1-O),new He(D,1-Z)]}};class Uu extends ln{constructor(t=1,i=0){const a=(1+Math.sqrt(5))/2;super([-1,a,0,1,a,0,-1,-a,0,1,-a,0,0,-1,a,0,1,a,0,-1,-a,0,1,-a,a,0,-1,a,0,1,-a,0,-1,-a,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],t,i),this.type="IcosahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new Uu(t.radius,t.detail)}}class td extends zn{constructor(t,i=12,a=0,l=2*Math.PI){super(),this.type="LatheGeometry",this.parameters={points:t,segments:i,phiStart:a,phiLength:l},i=Math.floor(i),l=zi(l,0,2*Math.PI);const d=[],p=[],v=[],_=1/i,x=new gt,M=new He;for(let C=0;C<=i;C++){const A=a+C*_*l,R=Math.sin(A),O=Math.cos(A);for(let U=0;U<=t.length-1;U++)x.x=t[U].x*R,x.y=t[U].y,x.z=t[U].x*O,p.push(x.x,x.y,x.z),M.x=C/i,M.y=U/(t.length-1),v.push(M.x,M.y)}for(let C=0;C<i;C++)for(let A=0;A<t.length-1;A++){const R=A+C*t.length,O=R,U=R+t.length,D=R+t.length+1,Z=R+1;d.push(O,U,Z),d.push(U,D,Z)}if(this.setIndex(d),this.setAttribute("position",new xn(p,3)),this.setAttribute("uv",new xn(v,2)),this.computeVertexNormals(),l===2*Math.PI){const C=this.attributes.normal.array,A=new gt,R=new gt,O=new gt,U=i*t.length*3;for(let D=0,Z=0;D<t.length;D++,Z+=3)A.x=C[Z+0],A.y=C[Z+1],A.z=C[Z+2],R.x=C[U+Z+0],R.y=C[U+Z+1],R.z=C[U+Z+2],O.addVectors(A,R).normalize(),C[Z+0]=C[U+Z+0]=O.x,C[Z+1]=C[U+Z+1]=O.y,C[Z+2]=C[U+Z+2]=O.z}}static fromJSON(t){return new td(t.points,t.segments,t.phiStart,t.phiLength)}}class Yh extends ln{constructor(t=1,i=0){super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],t,i),this.type="OctahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new Yh(t.radius,t.detail)}}class rp extends zn{constructor(t,i,a){super(),this.type="ParametricGeometry",this.parameters={func:t,slices:i,stacks:a};const l=[],d=[],p=[],v=[],_=1e-5,x=new gt,M=new gt,C=new gt,A=new gt,R=new gt;t.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");const O=i+1;for(let U=0;U<=a;U++){const D=U/a;for(let Z=0;Z<=i;Z++){const ot=Z/i;t(ot,D,M),d.push(M.x,M.y,M.z),ot-_>=0?(t(ot-_,D,C),A.subVectors(M,C)):(t(ot+_,D,C),A.subVectors(C,M)),D-_>=0?(t(ot,D-_,C),R.subVectors(M,C)):(t(ot,D+_,C),R.subVectors(C,M)),x.crossVectors(A,R).normalize(),p.push(x.x,x.y,x.z),v.push(ot,D)}}for(let U=0;U<a;U++)for(let D=0;D<i;D++){const Z=U*O+D,ot=U*O+D+1,vt=(U+1)*O+D+1,mt=(U+1)*O+D;l.push(Z,ot,mt),l.push(ot,vt,mt)}this.setIndex(l),this.setAttribute("position",new xn(d,3)),this.setAttribute("normal",new xn(p,3)),this.setAttribute("uv",new xn(v,2))}}class ed extends zn{constructor(t=.5,i=1,a=8,l=1,d=0,p=2*Math.PI){super(),this.type="RingGeometry",this.parameters={innerRadius:t,outerRadius:i,thetaSegments:a,phiSegments:l,thetaStart:d,thetaLength:p},a=Math.max(3,a);const v=[],_=[],x=[],M=[];let C=t;const A=(i-t)/(l=Math.max(1,l)),R=new gt,O=new He;for(let U=0;U<=l;U++){for(let D=0;D<=a;D++){const Z=d+D/a*p;R.x=C*Math.cos(Z),R.y=C*Math.sin(Z),_.push(R.x,R.y,R.z),x.push(0,0,1),O.x=(R.x/i+1)/2,O.y=(R.y/i+1)/2,M.push(O.x,O.y)}C+=A}for(let U=0;U<l;U++){const D=U*(a+1);for(let Z=0;Z<a;Z++){const ot=Z+D,vt=ot,mt=ot+a+1,At=ot+a+2,Pt=ot+1;v.push(vt,mt,Pt),v.push(mt,At,Pt)}}this.setIndex(v),this.setAttribute("position",new xn(_,3)),this.setAttribute("normal",new xn(x,3)),this.setAttribute("uv",new xn(M,2))}static fromJSON(t){return new ed(t.innerRadius,t.outerRadius,t.thetaSegments,t.phiSegments,t.thetaStart,t.thetaLength)}}class Zh extends zn{constructor(t,i=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:i};const a=[],l=[],d=[],p=[];let v=0,_=0;if(Array.isArray(t)===!1)x(t);else for(let M=0;M<t.length;M++)x(t[M]),this.addGroup(v,_,M),v+=_,_=0;function x(M){const C=l.length/3,A=M.extractPoints(i);let R=A.shape;const O=A.holes;Os.isClockWise(R)===!1&&(R=R.reverse());for(let D=0,Z=O.length;D<Z;D++){const ot=O[D];Os.isClockWise(ot)===!0&&(O[D]=ot.reverse())}const U=Os.triangulateShape(R,O);for(let D=0,Z=O.length;D<Z;D++){const ot=O[D];R=R.concat(ot)}for(let D=0,Z=R.length;D<Z;D++){const ot=R[D];l.push(ot.x,ot.y,0),d.push(0,0,1),p.push(ot.x,ot.y)}for(let D=0,Z=U.length;D<Z;D++){const ot=U[D],vt=ot[0]+C,mt=ot[1]+C,At=ot[2]+C;a.push(vt,mt,At),_+=3}}this.setIndex(a),this.setAttribute("position",new xn(l,3)),this.setAttribute("normal",new xn(d,3)),this.setAttribute("uv",new xn(p,2))}toJSON(){const t=super.toJSON();return function(i,a){if(a.shapes=[],Array.isArray(i))for(let l=0,d=i.length;l<d;l++){const p=i[l];a.shapes.push(p.uuid)}else a.shapes.push(i.uuid);return a}(this.parameters.shapes,t)}static fromJSON(t,i){const a=[];for(let l=0,d=t.shapes.length;l<d;l++){const p=i[t.shapes[l]];a.push(p)}return new Zh(a,t.curveSegments)}}class Jh extends zn{constructor(t=1,i=8,a=6,l=0,d=2*Math.PI,p=0,v=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:i,heightSegments:a,phiStart:l,phiLength:d,thetaStart:p,thetaLength:v},i=Math.max(3,Math.floor(i)),a=Math.max(2,Math.floor(a));const _=Math.min(p+v,Math.PI);let x=0;const M=[],C=new gt,A=new gt,R=[],O=[],U=[],D=[];for(let Z=0;Z<=a;Z++){const ot=[],vt=Z/a;let mt=0;Z==0&&p==0?mt=.5/i:Z==a&&_==Math.PI&&(mt=-.5/i);for(let At=0;At<=i;At++){const Pt=At/i;C.x=-t*Math.cos(l+Pt*d)*Math.sin(p+vt*v),C.y=t*Math.cos(p+vt*v),C.z=t*Math.sin(l+Pt*d)*Math.sin(p+vt*v),O.push(C.x,C.y,C.z),A.copy(C).normalize(),U.push(A.x,A.y,A.z),D.push(Pt+mt,1-vt),ot.push(x++)}M.push(ot)}for(let Z=0;Z<a;Z++)for(let ot=0;ot<i;ot++){const vt=M[Z][ot+1],mt=M[Z][ot],At=M[Z+1][ot],Pt=M[Z+1][ot+1];(Z!==0||p>0)&&R.push(vt,mt,Pt),(Z!==a-1||_<Math.PI)&&R.push(mt,At,Pt)}this.setIndex(R),this.setAttribute("position",new xn(O,3)),this.setAttribute("normal",new xn(U,3)),this.setAttribute("uv",new xn(D,2))}static fromJSON(t){return new Jh(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}class nd extends ln{constructor(t=1,i=0){super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],t,i),this.type="TetrahedronGeometry",this.parameters={radius:t,detail:i}}static fromJSON(t){return new nd(t.radius,t.detail)}}class tf extends Ka{constructor(t,i={}){const a=i.font;if(!a||!a.isFont)return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new zn;const l=a.generateShapes(t,i.size);i.depth=i.height!==void 0?i.height:50,i.bevelThickness===void 0&&(i.bevelThickness=10),i.bevelSize===void 0&&(i.bevelSize=8),i.bevelEnabled===void 0&&(i.bevelEnabled=!1),super(l,i),this.type="TextGeometry"}}class rd extends zn{constructor(t=1,i=.4,a=8,l=6,d=2*Math.PI){super(),this.type="TorusGeometry",this.parameters={radius:t,tube:i,radialSegments:a,tubularSegments:l,arc:d},a=Math.floor(a),l=Math.floor(l);const p=[],v=[],_=[],x=[],M=new gt,C=new gt,A=new gt;for(let R=0;R<=a;R++)for(let O=0;O<=l;O++){const U=O/l*d,D=R/a*Math.PI*2;C.x=(t+i*Math.cos(D))*Math.cos(U),C.y=(t+i*Math.cos(D))*Math.sin(U),C.z=i*Math.sin(D),v.push(C.x,C.y,C.z),M.x=t*Math.cos(U),M.y=t*Math.sin(U),A.subVectors(C,M).normalize(),_.push(A.x,A.y,A.z),x.push(O/l),x.push(R/a)}for(let R=1;R<=a;R++)for(let O=1;O<=l;O++){const U=(l+1)*R+O-1,D=(l+1)*(R-1)+O-1,Z=(l+1)*(R-1)+O,ot=(l+1)*R+O;p.push(U,D,ot),p.push(D,Z,ot)}this.setIndex(p),this.setAttribute("position",new xn(v,3)),this.setAttribute("normal",new xn(_,3)),this.setAttribute("uv",new xn(x,2))}static fromJSON(t){return new rd(t.radius,t.tube,t.radialSegments,t.tubularSegments,t.arc)}}class id extends zn{constructor(t=1,i=.4,a=64,l=8,d=2,p=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:t,tube:i,tubularSegments:a,radialSegments:l,p:d,q:p},a=Math.floor(a),l=Math.floor(l);const v=[],_=[],x=[],M=[],C=new gt,A=new gt,R=new gt,O=new gt,U=new gt,D=new gt,Z=new gt;for(let vt=0;vt<=a;++vt){const mt=vt/a*d*Math.PI*2;ot(mt,d,p,t,R),ot(mt+.01,d,p,t,O),D.subVectors(O,R),Z.addVectors(O,R),U.crossVectors(D,Z),Z.crossVectors(U,D),U.normalize(),Z.normalize();for(let At=0;At<=l;++At){const Pt=At/l*Math.PI*2,Et=-i*Math.cos(Pt),Ot=i*Math.sin(Pt);C.x=R.x+(Et*Z.x+Ot*U.x),C.y=R.y+(Et*Z.y+Ot*U.y),C.z=R.z+(Et*Z.z+Ot*U.z),_.push(C.x,C.y,C.z),A.subVectors(C,R).normalize(),x.push(A.x,A.y,A.z),M.push(vt/a),M.push(At/l)}}for(let vt=1;vt<=a;vt++)for(let mt=1;mt<=l;mt++){const At=(l+1)*(vt-1)+(mt-1),Pt=(l+1)*vt+(mt-1),Et=(l+1)*vt+mt,Ot=(l+1)*(vt-1)+mt;v.push(At,Pt,Ot),v.push(Pt,Et,Ot)}function ot(vt,mt,At,Pt,Et){const Ot=Math.cos(vt),Ie=Math.sin(vt),ye=At/mt*vt,xe=Math.cos(ye);Et.x=Pt*(2+xe)*.5*Ot,Et.y=Pt*(2+xe)*Ie*.5,Et.z=Pt*Math.sin(ye)*.5}this.setIndex(v),this.setAttribute("position",new xn(_,3)),this.setAttribute("normal",new xn(x,3)),this.setAttribute("uv",new xn(M,2))}static fromJSON(t){return new id(t.radius,t.tube,t.tubularSegments,t.radialSegments,t.p,t.q)}}class od extends zn{constructor(t,i=64,a=1,l=8,d=!1){super(),this.type="TubeGeometry",this.parameters={path:t,tubularSegments:i,radius:a,radialSegments:l,closed:d};const p=t.computeFrenetFrames(i,d);this.tangents=p.tangents,this.normals=p.normals,this.binormals=p.binormals;const v=new gt,_=new gt,x=new He;let M=new gt;const C=[],A=[],R=[],O=[];function U(D){M=t.getPointAt(D/i,M);const Z=p.normals[D],ot=p.binormals[D];for(let vt=0;vt<=l;vt++){const mt=vt/l*Math.PI*2,At=Math.sin(mt),Pt=-Math.cos(mt);_.x=Pt*Z.x+At*ot.x,_.y=Pt*Z.y+At*ot.y,_.z=Pt*Z.z+At*ot.z,_.normalize(),A.push(_.x,_.y,_.z),v.x=M.x+a*_.x,v.y=M.y+a*_.y,v.z=M.z+a*_.z,C.push(v.x,v.y,v.z)}}(function(){for(let D=0;D<i;D++)U(D);U(d===!1?i:0),function(){for(let D=0;D<=i;D++)for(let Z=0;Z<=l;Z++)x.x=D/i,x.y=Z/l,R.push(x.x,x.y)}(),function(){for(let D=1;D<=i;D++)for(let Z=1;Z<=l;Z++){const ot=(l+1)*(D-1)+(Z-1),vt=(l+1)*D+(Z-1),mt=(l+1)*D+Z,At=(l+1)*(D-1)+Z;O.push(ot,vt,At),O.push(vt,mt,At)}}()})(),this.setIndex(O),this.setAttribute("position",new xn(C,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(R,2))}toJSON(){const t=super.toJSON();return t.path=this.parameters.path.toJSON(),t}static fromJSON(t){return new od(new $a[t.path.type]().fromJSON(t.path),t.tubularSegments,t.radius,t.radialSegments,t.closed)}}class If extends zn{constructor(t){if(super(),this.type="WireframeGeometry",t.isGeometry===!0)return void console.error("THREE.WireframeGeometry no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.");const i=[],a=[0,0],l={},d=new gt;if(t.index!==null){const p=t.attributes.position,v=t.index;let _=t.groups;_.length===0&&(_=[{start:0,count:v.count,materialIndex:0}]);for(let x=0,M=_.length;x<M;++x){const C=_[x],A=C.start;for(let R=A,O=A+C.count;R<O;R+=3)for(let U=0;U<3;U++){const D=v.getX(R+U),Z=v.getX(R+(U+1)%3);a[0]=Math.min(D,Z),a[1]=Math.max(D,Z);const ot=a[0]+","+a[1];l[ot]===void 0&&(l[ot]={index1:a[0],index2:a[1]})}}for(const x in l){const M=l[x];d.fromBufferAttribute(p,M.index1),i.push(d.x,d.y,d.z),d.fromBufferAttribute(p,M.index2),i.push(d.x,d.y,d.z)}}else{const p=t.attributes.position;for(let v=0,_=p.count/3;v<_;v++)for(let x=0;x<3;x++){const M=3*v+x;d.fromBufferAttribute(p,M),i.push(d.x,d.y,d.z);const C=3*v+(x+1)%3;d.fromBufferAttribute(p,C),i.push(d.x,d.y,d.z)}}this.setAttribute("position",new xn(i,3))}}var Mm=Object.freeze({__proto__:null,BoxGeometry:ha,BoxBufferGeometry:ha,CircleGeometry:me,CircleBufferGeometry:me,ConeGeometry:gn,ConeBufferGeometry:gn,CylinderGeometry:De,CylinderBufferGeometry:De,DodecahedronGeometry:An,DodecahedronBufferGeometry:An,EdgesGeometry:Yn,ExtrudeGeometry:Ka,ExtrudeBufferGeometry:Ka,IcosahedronGeometry:Uu,IcosahedronBufferGeometry:Uu,LatheGeometry:td,LatheBufferGeometry:td,OctahedronGeometry:Yh,OctahedronBufferGeometry:Yh,ParametricGeometry:rp,ParametricBufferGeometry:rp,PlaneGeometry:pa,PlaneBufferGeometry:pa,PolyhedronGeometry:ln,PolyhedronBufferGeometry:ln,RingGeometry:ed,RingBufferGeometry:ed,ShapeGeometry:Zh,ShapeBufferGeometry:Zh,SphereGeometry:Jh,SphereBufferGeometry:Jh,TetrahedronGeometry:nd,TetrahedronBufferGeometry:nd,TextGeometry:tf,TextBufferGeometry:tf,TorusGeometry:rd,TorusBufferGeometry:rd,TorusKnotGeometry:id,TorusKnotBufferGeometry:id,TubeGeometry:od,TubeBufferGeometry:od,WireframeGeometry:If});class Lf extends Ni{constructor(t){super(),this.type="ShadowMaterial",this.color=new pn(0),this.transparent=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this}}Lf.prototype.isShadowMaterial=!0;class $h extends vo{constructor(t){super(t),this.type="RawShaderMaterial"}}$h.prototype.isRawShaderMaterial=!0;class ip extends Ni{constructor(t){super(),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new pn(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.vertexTangents=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapIntensity=t.envMapIntensity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this.vertexTangents=t.vertexTangents,this}}ip.prototype.isMeshStandardMaterial=!0;class Of extends ip{constructor(t){super(),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.clearcoat=0,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new He(1,1),this.clearcoatNormalMap=null,this.reflectivity=.5,Object.defineProperty(this,"ior",{get:function(){return(1+.4*this.reflectivity)/(1-.4*this.reflectivity)},set:function(i){this.reflectivity=zi(2.5*(i-1)/(i+1),0,1)}}),this.sheen=null,this.transmission=0,this.transmissionMap=null,this.thickness=.01,this.thicknessMap=null,this.attenuationDistance=0,this.attenuationColor=new pn(1,1,1),this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.reflectivity=t.reflectivity,t.sheen?this.sheen=(this.sheen||new pn).copy(t.sheen):this.sheen=null,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this}}Of.prototype.isMeshPhysicalMaterial=!0;class Df extends Ni{constructor(t){super(),this.type="MeshPhongMaterial",this.color=new pn(16777215),this.specular=new pn(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.specular.copy(t.specular),this.shininess=t.shininess,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Df.prototype.isMeshPhongMaterial=!0;class Nf extends Ni{constructor(t){super(),this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new pn(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.gradientMap=t.gradientMap,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Nf.prototype.isMeshToonMaterial=!0;class Ff extends Ni{constructor(t){super(),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}Ff.prototype.isMeshNormalMaterial=!0;class Gu extends Ni{constructor(t){super(),this.type="MeshLambertMaterial",this.color=new pn(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new pn(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=br,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.morphTargets=!1,this.morphNormals=!1,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this}}Gu.prototype.isMeshLambertMaterial=!0;class ef extends Ni{constructor(t){super(),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new pn(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Hr,this.normalScale=new He(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.morphTargets=!1,this.morphNormals=!1,this.flatShading=!1,this.setValues(t)}copy(t){return super.copy(t),this.defines={MATCAP:""},this.color.copy(t.color),this.matcap=t.matcap,this.map=t.map,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.alphaMap=t.alphaMap,this.morphTargets=t.morphTargets,this.morphNormals=t.morphNormals,this.flatShading=t.flatShading,this}}ef.prototype.isMeshMatcapMaterial=!0;class Bf extends ro{constructor(t){super(),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(t)}copy(t){return super.copy(t),this.scale=t.scale,this.dashSize=t.dashSize,this.gapSize=t.gapSize,this}}Bf.prototype.isLineDashedMaterial=!0;var Pn=Object.freeze({__proto__:null,ShadowMaterial:Lf,SpriteMaterial:yo,RawShaderMaterial:$h,ShaderMaterial:vo,PointsMaterial:xl,MeshPhysicalMaterial:Of,MeshStandardMaterial:ip,MeshPhongMaterial:Df,MeshToonMaterial:Nf,MeshNormalMaterial:Ff,MeshLambertMaterial:Gu,MeshDepthMaterial:Nh,MeshDistanceMaterial:fs,MeshBasicMaterial:Fi,MeshMatcapMaterial:ef,LineDashedMaterial:Bf,LineBasicMaterial:ro,Material:Ni});const di={arraySlice:function(m,t,i){return di.isTypedArray(m)?new m.constructor(m.subarray(t,i!==void 0?i:m.length)):m.slice(t,i)},convertArray:function(m,t,i){return!m||!i&&m.constructor===t?m:typeof t.BYTES_PER_ELEMENT=="number"?new t(m):Array.prototype.slice.call(m)},isTypedArray:function(m){return ArrayBuffer.isView(m)&&!(m instanceof DataView)},getKeyframeOrder:function(m){const t=m.length,i=new Array(t);for(let a=0;a!==t;++a)i[a]=a;return i.sort(function(a,l){return m[a]-m[l]}),i},sortedArray:function(m,t,i){const a=m.length,l=new m.constructor(a);for(let d=0,p=0;p!==a;++d){const v=i[d]*t;for(let _=0;_!==t;++_)l[p++]=m[v+_]}return l},flattenJSON:function(m,t,i,a){let l=1,d=m[0];for(;d!==void 0&&d[a]===void 0;)d=m[l++];if(d===void 0)return;let p=d[a];if(p!==void 0)if(Array.isArray(p))do p=d[a],p!==void 0&&(t.push(d.time),i.push.apply(i,p)),d=m[l++];while(d!==void 0);else if(p.toArray!==void 0)do p=d[a],p!==void 0&&(t.push(d.time),p.toArray(i,i.length)),d=m[l++];while(d!==void 0);else do p=d[a],p!==void 0&&(t.push(d.time),i.push(p)),d=m[l++];while(d!==void 0)},subclip:function(m,t,i,a,l=30){const d=m.clone();d.name=t;const p=[];for(let _=0;_<d.tracks.length;++_){const x=d.tracks[_],M=x.getValueSize(),C=[],A=[];for(let R=0;R<x.times.length;++R){const O=x.times[R]*l;if(!(O<i||O>=a)){C.push(x.times[R]);for(let U=0;U<M;++U)A.push(x.values[R*M+U])}}C.length!==0&&(x.times=di.convertArray(C,x.times.constructor),x.values=di.convertArray(A,x.values.constructor),p.push(x))}d.tracks=p;let v=1/0;for(let _=0;_<d.tracks.length;++_)v>d.tracks[_].times[0]&&(v=d.tracks[_].times[0]);for(let _=0;_<d.tracks.length;++_)d.tracks[_].shift(-1*v);return d.resetDuration(),d},makeClipAdditive:function(m,t=0,i=m,a=30){a<=0&&(a=30);const l=i.tracks.length,d=t/a;for(let p=0;p<l;++p){const v=i.tracks[p],_=v.ValueTypeName;if(_==="bool"||_==="string")continue;const x=m.tracks.find(function(Z){return Z.name===v.name&&Z.ValueTypeName===_});if(x===void 0)continue;let M=0;const C=v.getValueSize();v.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(M=C/3);let A=0;const R=x.getValueSize();x.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(A=R/3);const O=v.times.length-1;let U;if(d<=v.times[0]){const Z=M,ot=C-M;U=di.arraySlice(v.values,Z,ot)}else if(d>=v.times[O]){const Z=O*C+M,ot=Z+C-M;U=di.arraySlice(v.values,Z,ot)}else{const Z=v.createInterpolant(),ot=M,vt=C-M;Z.evaluate(d),U=di.arraySlice(Z.resultBuffer,ot,vt)}_==="quaternion"&&new Oi().fromArray(U).normalize().conjugate().toArray(U);const D=x.times.length;for(let Z=0;Z<D;++Z){const ot=Z*R+A;if(_==="quaternion")Oi.multiplyQuaternionsFlat(x.values,ot,U,0,x.values,ot);else{const vt=R-2*A;for(let mt=0;mt<vt;++mt)x.values[ot+mt]-=U[mt]}}}return m.blendMode=xd,m}};class Js{constructor(t,i,a,l){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=l!==void 0?l:new i.constructor(a),this.sampleValues=i,this.valueSize=a,this.settings=null,this.DefaultSettings_={}}evaluate(t){const i=this.parameterPositions;let a=this._cachedIndex,l=i[a],d=i[a-1];t:{e:{let p;n:{r:if(!(t<l)){for(let v=a+2;;){if(l===void 0){if(t<d)break r;return a=i.length,this._cachedIndex=a,this.afterEnd_(a-1,t,d)}if(a===v)break;if(d=l,l=i[++a],t<l)break e}p=i.length;break n}if(t>=d)break t;{const v=i[1];t<v&&(a=2,d=v);for(let _=a-2;;){if(d===void 0)return this._cachedIndex=0,this.beforeStart_(0,t,l);if(a===_)break;if(l=d,d=i[--a-1],t>=d)break e}p=a,a=0}}for(;a<p;){const v=a+p>>>1;t<i[v]?p=v:a=v+1}if(l=i[a],d=i[a-1],d===void 0)return this._cachedIndex=0,this.beforeStart_(0,t,l);if(l===void 0)return a=i.length,this._cachedIndex=a,this.afterEnd_(a-1,d,t)}this._cachedIndex=a,this.intervalChanged_(a,d,l)}return this.interpolate_(a,d,t,l)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const i=this.resultBuffer,a=this.sampleValues,l=this.valueSize,d=t*l;for(let p=0;p!==l;++p)i[p]=a[d+p];return i}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}Js.prototype.beforeStart_=Js.prototype.copySampleValue_,Js.prototype.afterEnd_=Js.prototype.copySampleValue_;class Hu extends Js{constructor(t,i,a,l){super(t,i,a,l),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:ta,endingEnd:ta}}intervalChanged_(t,i,a){const l=this.parameterPositions;let d=t-2,p=t+1,v=l[d],_=l[p];if(v===void 0)switch(this.getSettings_().endingStart){case La:d=t,v=2*i-a;break;case _s:d=l.length-2,v=i+l[d]-l[d+1];break;default:d=t,v=a}if(_===void 0)switch(this.getSettings_().endingEnd){case La:p=t,_=2*a-i;break;case _s:p=1,_=a+l[1]-l[0];break;default:p=t-1,_=i}const x=.5*(a-i),M=this.valueSize;this._weightPrev=x/(i-v),this._weightNext=x/(_-a),this._offsetPrev=d*M,this._offsetNext=p*M}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=t*v,x=_-v,M=this._offsetPrev,C=this._offsetNext,A=this._weightPrev,R=this._weightNext,O=(a-i)/(l-i),U=O*O,D=U*O,Z=-A*D+2*A*U-A*O,ot=(1+A)*D+(-1.5-2*A)*U+(-.5+A)*O+1,vt=(-1-R)*D+(1.5+R)*U+.5*O,mt=R*D-R*U;for(let At=0;At!==v;++At)d[At]=Z*p[M+At]+ot*p[x+At]+vt*p[_+At]+mt*p[C+At];return d}}class nf extends Js{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=t*v,x=_-v,M=(a-i)/(l-i),C=1-M;for(let A=0;A!==v;++A)d[A]=p[x+A]*C+p[_+A]*M;return d}}class rf extends Js{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t){return this.copySampleValue_(t-1)}}class Vo{constructor(t,i,a,l){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(i===void 0||i.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=di.convertArray(i,this.TimeBufferType),this.values=di.convertArray(a,this.ValueBufferType),this.setInterpolation(l||this.DefaultInterpolation)}static toJSON(t){const i=t.constructor;let a;if(i.toJSON!==this.toJSON)a=i.toJSON(t);else{a={name:t.name,times:di.convertArray(t.times,Array),values:di.convertArray(t.values,Array)};const l=t.getInterpolation();l!==t.DefaultInterpolation&&(a.interpolation=l)}return a.type=t.ValueTypeName,a}InterpolantFactoryMethodDiscrete(t){return new rf(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new nf(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Hu(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let i;switch(t){case Rl:i=this.InterpolantFactoryMethodDiscrete;break;case Ii:i=this.InterpolantFactoryMethodLinear;break;case Ia:i=this.InterpolantFactoryMethodSmooth}if(i===void 0){const a="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0){if(t===this.DefaultInterpolation)throw new Error(a);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",a),this}return this.createInterpolant=i,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Rl;case this.InterpolantFactoryMethodLinear:return Ii;case this.InterpolantFactoryMethodSmooth:return Ia}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){const i=this.times;for(let a=0,l=i.length;a!==l;++a)i[a]+=t}return this}scale(t){if(t!==1){const i=this.times;for(let a=0,l=i.length;a!==l;++a)i[a]*=t}return this}trim(t,i){const a=this.times,l=a.length;let d=0,p=l-1;for(;d!==l&&a[d]<t;)++d;for(;p!==-1&&a[p]>i;)--p;if(++p,d!==0||p!==l){d>=p&&(p=Math.max(p,1),d=p-1);const v=this.getValueSize();this.times=di.arraySlice(a,d,p),this.values=di.arraySlice(this.values,d*v,p*v)}return this}validate(){let t=!0;const i=this.getValueSize();i-Math.floor(i)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const a=this.times,l=this.values,d=a.length;d===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let p=null;for(let v=0;v!==d;v++){const _=a[v];if(typeof _=="number"&&isNaN(_)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,v,_),t=!1;break}if(p!==null&&p>_){console.error("THREE.KeyframeTrack: Out of order keys.",this,v,_,p),t=!1;break}p=_}if(l!==void 0&&di.isTypedArray(l))for(let v=0,_=l.length;v!==_;++v){const x=l[v];if(isNaN(x)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,v,x),t=!1;break}}return t}optimize(){const t=di.arraySlice(this.times),i=di.arraySlice(this.values),a=this.getValueSize(),l=this.getInterpolation()===Ia,d=t.length-1;let p=1;for(let v=1;v<d;++v){let _=!1;const x=t[v];if(x!==t[v+1]&&(v!==1||x!==t[0]))if(l)_=!0;else{const M=v*a,C=M-a,A=M+a;for(let R=0;R!==a;++R){const O=i[M+R];if(O!==i[C+R]||O!==i[A+R]){_=!0;break}}}if(_){if(v!==p){t[p]=t[v];const M=v*a,C=p*a;for(let A=0;A!==a;++A)i[C+A]=i[M+A]}++p}}if(d>0){t[p]=t[d];for(let v=d*a,_=p*a,x=0;x!==a;++x)i[_+x]=i[v+x];++p}return p!==t.length?(this.times=di.arraySlice(t,0,p),this.values=di.arraySlice(i,0,p*a)):(this.times=t,this.values=i),this}clone(){const t=di.arraySlice(this.times,0),i=di.arraySlice(this.values,0),a=new this.constructor(this.name,t,i);return a.createInterpolant=this.createInterpolant,a}}Vo.prototype.TimeBufferType=Float32Array,Vo.prototype.ValueBufferType=Float32Array,Vo.prototype.DefaultInterpolation=Ii;class Kh extends Vo{}Kh.prototype.ValueTypeName="bool",Kh.prototype.ValueBufferType=Array,Kh.prototype.DefaultInterpolation=Rl,Kh.prototype.InterpolantFactoryMethodLinear=void 0,Kh.prototype.InterpolantFactoryMethodSmooth=void 0;class of extends Vo{}of.prototype.ValueTypeName="color";class Qh extends Vo{}Qh.prototype.ValueTypeName="number";class kf extends Js{constructor(t,i,a,l){super(t,i,a,l)}interpolate_(t,i,a,l){const d=this.resultBuffer,p=this.sampleValues,v=this.valueSize,_=(a-i)/(l-i);let x=t*v;for(let M=x+v;x!==M;x+=4)Oi.slerpFlat(d,0,p,x-v,p,x,_);return d}}class tc extends Vo{InterpolantFactoryMethodLinear(t){return new kf(this.times,this.values,this.getValueSize(),t)}}tc.prototype.ValueTypeName="quaternion",tc.prototype.DefaultInterpolation=Ii,tc.prototype.InterpolantFactoryMethodSmooth=void 0;class Qa extends Vo{}Qa.prototype.ValueTypeName="string",Qa.prototype.ValueBufferType=Array,Qa.prototype.DefaultInterpolation=Rl,Qa.prototype.InterpolantFactoryMethodLinear=void 0,Qa.prototype.InterpolantFactoryMethodSmooth=void 0;class zu extends Vo{}zu.prototype.ValueTypeName="vector";class sd{constructor(t,i=-1,a,l=Oa){this.name=t,this.tracks=a,this.duration=i,this.blendMode=l,this.uuid=No(),this.duration<0&&this.resetDuration()}static parse(t){const i=[],a=t.tracks,l=1/(t.fps||1);for(let p=0,v=a.length;p!==v;++p)i.push(sg(a[p]).scale(l));const d=new this(t.name,t.duration,i,t.blendMode);return d.uuid=t.uuid,d}static toJSON(t){const i=[],a=t.tracks,l={name:t.name,duration:t.duration,tracks:i,uuid:t.uuid,blendMode:t.blendMode};for(let d=0,p=a.length;d!==p;++d)i.push(Vo.toJSON(a[d]));return l}static CreateFromMorphTargetSequence(t,i,a,l){const d=i.length,p=[];for(let v=0;v<d;v++){let _=[],x=[];_.push((v+d-1)%d,v,(v+1)%d),x.push(0,1,0);const M=di.getKeyframeOrder(_);_=di.sortedArray(_,1,M),x=di.sortedArray(x,1,M),l||_[0]!==0||(_.push(d),x.push(x[0])),p.push(new Qh(".morphTargetInfluences["+i[v].name+"]",_,x).scale(1/a))}return new this(t,-1,p)}static findByName(t,i){let a=t;if(!Array.isArray(t)){const l=t;a=l.geometry&&l.geometry.animations||l.animations}for(let l=0;l<a.length;l++)if(a[l].name===i)return a[l];return null}static CreateClipsFromMorphTargetSequences(t,i,a){const l={},d=/^([\w-]*?)([\d]+)$/;for(let v=0,_=t.length;v<_;v++){const x=t[v],M=x.name.match(d);if(M&&M.length>1){const C=M[1];let A=l[C];A||(l[C]=A=[]),A.push(x)}}const p=[];for(const v in l)p.push(this.CreateFromMorphTargetSequence(v,l[v],i,a));return p}static parseAnimation(t,i){if(!t)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const a=function(M,C,A,R,O){if(A.length!==0){const U=[],D=[];di.flattenJSON(A,U,D,R),U.length!==0&&O.push(new M(C,U,D))}},l=[],d=t.name||"default",p=t.fps||30,v=t.blendMode;let _=t.length||-1;const x=t.hierarchy||[];for(let M=0;M<x.length;M++){const C=x[M].keys;if(C&&C.length!==0)if(C[0].morphTargets){const A={};let R;for(R=0;R<C.length;R++)if(C[R].morphTargets)for(let O=0;O<C[R].morphTargets.length;O++)A[C[R].morphTargets[O]]=-1;for(const O in A){const U=[],D=[];for(let Z=0;Z!==C[R].morphTargets.length;++Z){const ot=C[R];U.push(ot.time),D.push(ot.morphTarget===O?1:0)}l.push(new Qh(".morphTargetInfluence["+O+"]",U,D))}_=A.length*(p||1)}else{const A=".bones["+i[M].name+"]";a(zu,A+".position",C,"pos",l),a(tc,A+".quaternion",C,"rot",l),a(zu,A+".scale",C,"scl",l)}}return l.length===0?null:new this(d,_,l,v)}resetDuration(){let t=0;for(let i=0,a=this.tracks.length;i!==a;++i){const l=this.tracks[i];t=Math.max(t,l.times[l.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let i=0;i<this.tracks.length;i++)t=t&&this.tracks[i].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let i=0;i<this.tracks.length;i++)t.push(this.tracks[i].clone());return new this.constructor(this.name,this.duration,t,this.blendMode)}toJSON(){return this.constructor.toJSON(this)}}function sg(m){if(m.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const t=function(i){switch(i.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return Qh;case"vector":case"vector2":case"vector3":case"vector4":return zu;case"color":return of;case"quaternion":return tc;case"bool":case"boolean":return Kh;case"string":return Qa}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+i)}(m.type);if(m.times===void 0){const i=[],a=[];di.flattenJSON(m.keys,i,a,"value"),m.times=i,m.values=a}return t.parse!==void 0?t.parse(m):new t(m.name,m.times,m.values,m.interpolation)}const ec={enabled:!1,files:{},add:function(m,t){this.enabled!==!1&&(this.files[m]=t)},get:function(m){if(this.enabled!==!1)return this.files[m]},remove:function(m){delete this.files[m]},clear:function(){this.files={}}};class ya{constructor(t,i,a){const l=this;let d=!1,p=0,v=0,_;const x=[];this.onStart=void 0,this.onLoad=t,this.onProgress=i,this.onError=a,this.itemStart=function(M){v++,d===!1&&l.onStart!==void 0&&l.onStart(M,p,v),d=!0},this.itemEnd=function(M){p++,l.onProgress!==void 0&&l.onProgress(M,p,v),p===v&&(d=!1,l.onLoad!==void 0&&l.onLoad())},this.itemError=function(M){l.onError!==void 0&&l.onError(M)},this.resolveURL=function(M){return _?_(M):M},this.setURLModifier=function(M){return _=M,this},this.addHandler=function(M,C){return x.push(M,C),this},this.removeHandler=function(M){const C=x.indexOf(M);return C!==-1&&x.splice(C,2),this},this.getHandler=function(M){for(let C=0,A=x.length;C<A;C+=2){const R=x[C],O=x[C+1];if(R.global&&(R.lastIndex=0),R.test(M))return O}return null}}}const nc=new ya;class Wo{constructor(t){this.manager=t!==void 0?t:nc,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,i){const a=this;return new Promise(function(l,d){a.load(t,l,i,d)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}}const xa={};class ba extends Wo{constructor(t){super(t)}load(t,i,a,l){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=ec.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;if(xa[t]!==void 0)return void xa[t].push({onLoad:i,onProgress:a,onError:l});const v=t.match(/^data:(.*?)(;base64)?,(.*)$/);let _;if(v){const x=v[1],M=!!v[2];let C=v[3];C=decodeURIComponent(C),M&&(C=atob(C));try{let A;const R=(this.responseType||"").toLowerCase();switch(R){case"arraybuffer":case"blob":const O=new Uint8Array(C.length);for(let D=0;D<C.length;D++)O[D]=C.charCodeAt(D);A=R==="blob"?new Blob([O.buffer],{type:x}):O.buffer;break;case"document":A=new DOMParser().parseFromString(C,x);break;case"json":A=JSON.parse(C);break;default:A=C}setTimeout(function(){i&&i(A),d.manager.itemEnd(t)},0)}catch(A){setTimeout(function(){l&&l(A),d.manager.itemError(t),d.manager.itemEnd(t)},0)}}else{xa[t]=[],xa[t].push({onLoad:i,onProgress:a,onError:l}),_=new XMLHttpRequest,_.open("GET",t,!0),_.addEventListener("load",function(x){const M=this.response,C=xa[t];if(delete xa[t],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),ec.add(t,M);for(let A=0,R=C.length;A<R;A++){const O=C[A];O.onLoad&&O.onLoad(M)}d.manager.itemEnd(t)}else{for(let A=0,R=C.length;A<R;A++){const O=C[A];O.onError&&O.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)}},!1),_.addEventListener("progress",function(x){const M=xa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onProgress&&R.onProgress(x)}},!1),_.addEventListener("error",function(x){const M=xa[t];delete xa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onError&&R.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)},!1),_.addEventListener("abort",function(x){const M=xa[t];delete xa[t];for(let C=0,A=M.length;C<A;C++){const R=M[C];R.onError&&R.onError(x)}d.manager.itemError(t),d.manager.itemEnd(t)},!1),this.responseType!==void 0&&(_.responseType=this.responseType),this.withCredentials!==void 0&&(_.withCredentials=this.withCredentials),_.overrideMimeType&&_.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(const x in this.requestHeader)_.setRequestHeader(x,this.requestHeader[x]);_.send(null)}return d.manager.itemStart(t),_}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}}class ag extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new ba(this.manager);p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(this.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i=[];for(let a=0;a<t.length;a++){const l=sd.parse(t[a]);i.push(l)}return i}}class Am extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=[],v=new Lt,_=new ba(this.manager);_.setPath(this.path),_.setResponseType("arraybuffer"),_.setRequestHeader(this.requestHeader),_.setWithCredentials(d.withCredentials);let x=0;function M(C){_.load(t[C],function(A){const R=d.parse(A,!0);p[C]={width:R.width,height:R.height,format:R.format,mipmaps:R.mipmaps},x+=1,x===6&&(R.mipmapCount===1&&(v.minFilter=Qe),v.image=p,v.format=R.format,v.needsUpdate=!0,i&&i(v))},a,l)}if(Array.isArray(t))for(let C=0,A=t.length;C<A;++C)M(C);else _.load(t,function(C){const A=d.parse(C,!0);if(A.isCubemap){const R=A.mipmaps.length/A.mipmapCount;for(let O=0;O<R;O++){p[O]={mipmaps:[]};for(let U=0;U<A.mipmapCount;U++)p[O].mipmaps.push(A.mipmaps[O*A.mipmapCount+U]),p[O].format=A.format,p[O].width=A.width,p[O].height=A.height}v.image=p}else v.image.width=A.width,v.image.height=A.height,v.mipmaps=A.mipmaps;A.mipmapCount===1&&(v.minFilter=Qe),v.format=A.format,v.needsUpdate=!0,i&&i(v)},a,l);return v}}class op extends Wo{constructor(t){super(t)}load(t,i,a,l){this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=ec.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;const v=document.createElementNS("http://www.w3.org/1999/xhtml","img");function _(){v.removeEventListener("load",_,!1),v.removeEventListener("error",x,!1),ec.add(t,this),i&&i(this),d.manager.itemEnd(t)}function x(M){v.removeEventListener("load",_,!1),v.removeEventListener("error",x,!1),l&&l(M),d.manager.itemError(t),d.manager.itemEnd(t)}return v.addEventListener("load",_,!1),v.addEventListener("error",x,!1),t.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(v.crossOrigin=this.crossOrigin),d.manager.itemStart(t),v.src=t,v}}class Uf extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=new Vl,p=new op(this.manager);p.setCrossOrigin(this.crossOrigin),p.setPath(this.path);let v=0;function _(x){p.load(t[x],function(M){d.images[x]=M,v++,v===6&&(d.needsUpdate=!0,i&&i(d))},void 0,l)}for(let x=0;x<t.length;++x)_(x);return d}}class Cm extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new Is,v=new ba(this.manager);return v.setResponseType("arraybuffer"),v.setRequestHeader(this.requestHeader),v.setPath(this.path),v.setWithCredentials(d.withCredentials),v.load(t,function(_){const x=d.parse(_);x&&(x.image!==void 0?p.image=x.image:x.data!==void 0&&(p.image.width=x.width,p.image.height=x.height,p.image.data=x.data),p.wrapS=x.wrapS!==void 0?x.wrapS:St,p.wrapT=x.wrapT!==void 0?x.wrapT:St,p.magFilter=x.magFilter!==void 0?x.magFilter:Qe,p.minFilter=x.minFilter!==void 0?x.minFilter:Qe,p.anisotropy=x.anisotropy!==void 0?x.anisotropy:1,x.encoding!==void 0&&(p.encoding=x.encoding),x.flipY!==void 0&&(p.flipY=x.flipY),x.format!==void 0&&(p.format=x.format),x.type!==void 0&&(p.type=x.type),x.mipmaps!==void 0&&(p.mipmaps=x.mipmaps,p.minFilter=Yr),x.mipmapCount===1&&(p.minFilter=Qe),x.generateMipmaps!==void 0&&(p.generateMipmaps=x.generateMipmaps),p.needsUpdate=!0,i&&i(p,x))},a,l),p}}class Gf extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=new ni,p=new op(this.manager);return p.setCrossOrigin(this.crossOrigin),p.setPath(this.path),p.load(t,function(v){d.image=v;const _=t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0;d.format=_?yn:Tn,d.needsUpdate=!0,i!==void 0&&i(d)},a,l),d}}class Pm extends wn{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),i=this.curves[this.curves.length-1].getPoint(1);t.equals(i)||this.curves.push(new Bu(i,t))}getPoint(t){const i=t*this.getLength(),a=this.getCurveLengths();let l=0;for(;l<a.length;){if(a[l]>=i){const d=a[l]-i,p=this.curves[l],v=p.getLength(),_=v===0?0:1-d/v;return p.getPointAt(_)}l++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let i=0;for(let a=0,l=this.curves.length;a<l;a++)i+=this.curves[a].getLength(),t.push(i);return this.cacheLengths=t,t}getSpacedPoints(t=40){const i=[];for(let a=0;a<=t;a++)i.push(this.getPoint(a/t));return this.autoClose&&i.push(i[0]),i}getPoints(t=12){const i=[];let a;for(let l=0,d=this.curves;l<d.length;l++){const p=d[l],v=p&&p.isEllipseCurve?2*t:p&&(p.isLineCurve||p.isLineCurve3)?1:p&&p.isSplineCurve?t*p.points.length:t,_=p.getPoints(v);for(let x=0;x<_.length;x++){const M=_[x];a&&a.equals(M)||(i.push(M),a=M)}}return this.autoClose&&i.length>1&&!i[i.length-1].equals(i[0])&&i.push(i[0]),i}copy(t){super.copy(t),this.curves=[];for(let i=0,a=t.curves.length;i<a;i++){const l=t.curves[i];this.curves.push(l.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let i=0,a=this.curves.length;i<a;i++){const l=this.curves[i];t.curves.push(l.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let i=0,a=t.curves.length;i<a;i++){const l=t.curves[i];this.curves.push(new $a[l.type]().fromJSON(l))}return this}}class rc extends Pm{constructor(t){super(),this.type="Path",this.currentPoint=new He,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let i=1,a=t.length;i<a;i++)this.lineTo(t[i].x,t[i].y);return this}moveTo(t,i){return this.currentPoint.set(t,i),this}lineTo(t,i){const a=new Bu(this.currentPoint.clone(),new He(t,i));return this.curves.push(a),this.currentPoint.set(t,i),this}quadraticCurveTo(t,i,a,l){const d=new ru(this.currentPoint.clone(),new He(t,i),new He(a,l));return this.curves.push(d),this.currentPoint.set(a,l),this}bezierCurveTo(t,i,a,l,d,p){const v=new va(this.currentPoint.clone(),new He(t,i),new He(a,l),new He(d,p));return this.curves.push(v),this.currentPoint.set(d,p),this}splineThru(t){const i=[this.currentPoint.clone()].concat(t),a=new iu(i);return this.curves.push(a),this.currentPoint.copy(t[t.length-1]),this}arc(t,i,a,l,d,p){const v=this.currentPoint.x,_=this.currentPoint.y;return this.absarc(t+v,i+_,a,l,d,p),this}absarc(t,i,a,l,d,p){return this.absellipse(t,i,a,a,l,d,p),this}ellipse(t,i,a,l,d,p,v,_){const x=this.currentPoint.x,M=this.currentPoint.y;return this.absellipse(t+x,i+M,a,l,d,p,v,_),this}absellipse(t,i,a,l,d,p,v,_){const x=new lr(t,i,a,l,d,p,v,_);if(this.curves.length>0){const C=x.getPoint(0);C.equals(this.currentPoint)||this.lineTo(C.x,C.y)}this.curves.push(x);const M=x.getPoint(1);return this.currentPoint.copy(M),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class ju extends rc{constructor(t){super(t),this.uuid=No(),this.type="Shape",this.holes=[]}getPointsHoles(t){const i=[];for(let a=0,l=this.holes.length;a<l;a++)i[a]=this.holes[a].getPoints(t);return i}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let i=0,a=t.holes.length;i<a;i++){const l=t.holes[i];this.holes.push(l.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let i=0,a=this.holes.length;i<a;i++){const l=this.holes[i];t.holes.push(l.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let i=0,a=t.holes.length;i<a;i++){const l=t.holes[i];this.holes.push(new rc().fromJSON(l))}return this}}class wa extends ar{constructor(t,i=1){super(),this.type="Light",this.color=new pn(t),this.intensity=i}dispose(){}copy(t){return super.copy(t),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const i=super.toJSON(t);return i.object.color=this.color.getHex(),i.object.intensity=this.intensity,this.groundColor!==void 0&&(i.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(i.object.distance=this.distance),this.angle!==void 0&&(i.object.angle=this.angle),this.decay!==void 0&&(i.object.decay=this.decay),this.penumbra!==void 0&&(i.object.penumbra=this.penumbra),this.shadow!==void 0&&(i.object.shadow=this.shadow.toJSON()),i}}wa.prototype.isLight=!0;class sf extends wa{constructor(t,i,a){super(t,a),this.type="HemisphereLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.groundColor=new pn(i)}copy(t){return wa.prototype.copy.call(this,t),this.groundColor.copy(t.groundColor),this}}sf.prototype.isHemisphereLight=!0;const af=new En,lf=new gt,Hf=new gt;class zf{constructor(t){this.camera=t,this.bias=0,this.normalBias=0,this.radius=1,this.mapSize=new He(512,512),this.map=null,this.mapPass=null,this.matrix=new En,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new ja,this._frameExtents=new He(1,1),this._viewportCount=1,this._viewports=[new Ir(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const i=this.camera,a=this.matrix;lf.setFromMatrixPosition(t.matrixWorld),i.position.copy(lf),Hf.setFromMatrixPosition(t.target.matrixWorld),i.lookAt(Hf),i.updateMatrixWorld(),af.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(af),a.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),a.multiply(i.projectionMatrix),a.multiply(i.matrixWorldInverse)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.bias=t.bias,this.radius=t.radius,this.mapSize.copy(t.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const t={};return this.bias!==0&&(t.bias=this.bias),this.normalBias!==0&&(t.normalBias=this.normalBias),this.radius!==1&&(t.radius=this.radius),this.mapSize.x===512&&this.mapSize.y===512||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}class Rm extends zf{constructor(){super(new Yi(50,1,.5,500)),this.focus=1}updateMatrices(t){const i=this.camera,a=2*na*t.angle*this.focus,l=this.mapSize.width/this.mapSize.height,d=t.distance||i.far;a===i.fov&&l===i.aspect&&d===i.far||(i.fov=a,i.aspect=l,i.far=d,i.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}Rm.prototype.isSpotLightShadow=!0;class ad extends wa{constructor(t,i,a=0,l=Math.PI/3,d=0,p=1){super(t,i),this.type="SpotLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.target=new ar,this.distance=a,this.angle=l,this.penumbra=d,this.decay=p,this.shadow=new Rm}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}ad.prototype.isSpotLight=!0;const jf=new En,Vu=new gt,Vf=new gt;class Im extends zf{constructor(){super(new Yi(90,1,.5,500)),this._frameExtents=new He(4,2),this._viewportCount=6,this._viewports=[new Ir(2,1,1,1),new Ir(0,1,1,1),new Ir(3,1,1,1),new Ir(1,1,1,1),new Ir(3,0,1,1),new Ir(1,0,1,1)],this._cubeDirections=[new gt(1,0,0),new gt(-1,0,0),new gt(0,0,1),new gt(0,0,-1),new gt(0,1,0),new gt(0,-1,0)],this._cubeUps=[new gt(0,1,0),new gt(0,1,0),new gt(0,1,0),new gt(0,1,0),new gt(0,0,1),new gt(0,0,-1)]}updateMatrices(t,i=0){const a=this.camera,l=this.matrix,d=t.distance||a.far;d!==a.far&&(a.far=d,a.updateProjectionMatrix()),Vu.setFromMatrixPosition(t.matrixWorld),a.position.copy(Vu),Vf.copy(a.position),Vf.add(this._cubeDirections[i]),a.up.copy(this._cubeUps[i]),a.lookAt(Vf),a.updateMatrixWorld(),l.makeTranslation(-Vu.x,-Vu.y,-Vu.z),jf.multiplyMatrices(a.projectionMatrix,a.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jf)}}Im.prototype.isPointLightShadow=!0;class Wf extends wa{constructor(t,i,a=0,l=1){super(t,i),this.type="PointLight",this.distance=a,this.decay=l,this.shadow=new Im}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}}Wf.prototype.isPointLight=!0;class sp extends jl{constructor(t=-1,i=1,a=1,l=-1,d=.1,p=2e3){super(),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=i,this.top=a,this.bottom=l,this.near=d,this.far=p,this.updateProjectionMatrix()}copy(t,i){return super.copy(t,i),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=t.view===null?null:Object.assign({},t.view),this}setViewOffset(t,i,a,l,d,p){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=i,this.view.offsetX=a,this.view.offsetY=l,this.view.width=d,this.view.height=p,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),i=(this.top-this.bottom)/(2*this.zoom),a=(this.right+this.left)/2,l=(this.top+this.bottom)/2;let d=a-t,p=a+t,v=l+i,_=l-i;if(this.view!==null&&this.view.enabled){const x=(this.right-this.left)/this.view.fullWidth/this.zoom,M=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d+=x*this.view.offsetX,p=d+x*this.view.width,v-=M*this.view.offsetY,_=v-M*this.view.height}this.projectionMatrix.makeOrthographic(d,p,v,_,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const i=super.toJSON(t);return i.object.zoom=this.zoom,i.object.left=this.left,i.object.right=this.right,i.object.top=this.top,i.object.bottom=this.bottom,i.object.near=this.near,i.object.far=this.far,this.view!==null&&(i.object.view=Object.assign({},this.view)),i}}sp.prototype.isOrthographicCamera=!0;class Lm extends zf{constructor(){super(new sp(-5,5,5,-5,.5,500))}}Lm.prototype.isDirectionalLightShadow=!0;class Wu extends wa{constructor(t,i){super(t,i),this.type="DirectionalLight",this.position.copy(ar.DefaultUp),this.updateMatrix(),this.target=new ar,this.shadow=new Lm}dispose(){this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}}Wu.prototype.isDirectionalLight=!0;class uf extends wa{constructor(t,i){super(t,i),this.type="AmbientLight"}}uf.prototype.isAmbientLight=!0;class ic extends wa{constructor(t,i,a=10,l=10){super(t,i),this.type="RectAreaLight",this.width=a,this.height=l}copy(t){return super.copy(t),this.width=t.width,this.height=t.height,this}toJSON(t){const i=super.toJSON(t);return i.object.width=this.width,i.object.height=this.height,i}}ic.prototype.isRectAreaLight=!0;class Re{constructor(){this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new gt)}set(t){for(let i=0;i<9;i++)this.coefficients[i].copy(t[i]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,i){const a=t.x,l=t.y,d=t.z,p=this.coefficients;return i.copy(p[0]).multiplyScalar(.282095),i.addScaledVector(p[1],.488603*l),i.addScaledVector(p[2],.488603*d),i.addScaledVector(p[3],.488603*a),i.addScaledVector(p[4],a*l*1.092548),i.addScaledVector(p[5],l*d*1.092548),i.addScaledVector(p[6],.315392*(3*d*d-1)),i.addScaledVector(p[7],a*d*1.092548),i.addScaledVector(p[8],.546274*(a*a-l*l)),i}getIrradianceAt(t,i){const a=t.x,l=t.y,d=t.z,p=this.coefficients;return i.copy(p[0]).multiplyScalar(.886227),i.addScaledVector(p[1],1.023328*l),i.addScaledVector(p[2],1.023328*d),i.addScaledVector(p[3],1.023328*a),i.addScaledVector(p[4],.858086*a*l),i.addScaledVector(p[5],.858086*l*d),i.addScaledVector(p[6],.743125*d*d-.247708),i.addScaledVector(p[7],.858086*a*d),i.addScaledVector(p[8],.429043*(a*a-l*l)),i}add(t){for(let i=0;i<9;i++)this.coefficients[i].add(t.coefficients[i]);return this}addScaledSH(t,i){for(let a=0;a<9;a++)this.coefficients[a].addScaledVector(t.coefficients[a],i);return this}scale(t){for(let i=0;i<9;i++)this.coefficients[i].multiplyScalar(t);return this}lerp(t,i){for(let a=0;a<9;a++)this.coefficients[a].lerp(t.coefficients[a],i);return this}equals(t){for(let i=0;i<9;i++)if(!this.coefficients[i].equals(t.coefficients[i]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(t,i=0){const a=this.coefficients;for(let l=0;l<9;l++)a[l].fromArray(t,i+3*l);return this}toArray(t=[],i=0){const a=this.coefficients;for(let l=0;l<9;l++)a[l].toArray(t,i+3*l);return t}static getBasisAt(t,i){const a=t.x,l=t.y,d=t.z;i[0]=.282095,i[1]=.488603*l,i[2]=.488603*d,i[3]=.488603*a,i[4]=1.092548*a*l,i[5]=1.092548*l*d,i[6]=.315392*(3*d*d-1),i[7]=1.092548*a*d,i[8]=.546274*(a*a-l*l)}}Re.prototype.isSphericalHarmonics3=!0;class ap extends wa{constructor(t=new Re,i=1){super(void 0,i),this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}fromJSON(t){return this.intensity=t.intensity,this.sh.fromArray(t.sh),this}toJSON(t){const i=super.toJSON(t);return i.object.sh=this.sh.toArray(),i}}ap.prototype.isLightProbe=!0;class ld extends Wo{constructor(t){super(t),this.textures={}}load(t,i,a,l){const d=this,p=new ba(d.manager);p.setPath(d.path),p.setRequestHeader(d.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i=this.textures;function a(d){return i[d]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",d),i[d]}const l=new Pn[t.type];if(t.uuid!==void 0&&(l.uuid=t.uuid),t.name!==void 0&&(l.name=t.name),t.color!==void 0&&l.color!==void 0&&l.color.setHex(t.color),t.roughness!==void 0&&(l.roughness=t.roughness),t.metalness!==void 0&&(l.metalness=t.metalness),t.sheen!==void 0&&(l.sheen=new pn().setHex(t.sheen)),t.emissive!==void 0&&l.emissive!==void 0&&l.emissive.setHex(t.emissive),t.specular!==void 0&&l.specular!==void 0&&l.specular.setHex(t.specular),t.shininess!==void 0&&(l.shininess=t.shininess),t.clearcoat!==void 0&&(l.clearcoat=t.clearcoat),t.clearcoatRoughness!==void 0&&(l.clearcoatRoughness=t.clearcoatRoughness),t.transmission!==void 0&&(l.transmission=t.transmission),t.thickness!==void 0&&(l.thickness=t.thickness),t.attenuationDistance!==void 0&&(l.attenuationDistance=t.attenuationDistance),t.attenuationColor!==void 0&&l.attenuationColor!==void 0&&l.attenuationColor.setHex(t.attenuationColor),t.fog!==void 0&&(l.fog=t.fog),t.flatShading!==void 0&&(l.flatShading=t.flatShading),t.blending!==void 0&&(l.blending=t.blending),t.combine!==void 0&&(l.combine=t.combine),t.side!==void 0&&(l.side=t.side),t.shadowSide!==void 0&&(l.shadowSide=t.shadowSide),t.opacity!==void 0&&(l.opacity=t.opacity),t.transparent!==void 0&&(l.transparent=t.transparent),t.alphaTest!==void 0&&(l.alphaTest=t.alphaTest),t.depthTest!==void 0&&(l.depthTest=t.depthTest),t.depthWrite!==void 0&&(l.depthWrite=t.depthWrite),t.colorWrite!==void 0&&(l.colorWrite=t.colorWrite),t.stencilWrite!==void 0&&(l.stencilWrite=t.stencilWrite),t.stencilWriteMask!==void 0&&(l.stencilWriteMask=t.stencilWriteMask),t.stencilFunc!==void 0&&(l.stencilFunc=t.stencilFunc),t.stencilRef!==void 0&&(l.stencilRef=t.stencilRef),t.stencilFuncMask!==void 0&&(l.stencilFuncMask=t.stencilFuncMask),t.stencilFail!==void 0&&(l.stencilFail=t.stencilFail),t.stencilZFail!==void 0&&(l.stencilZFail=t.stencilZFail),t.stencilZPass!==void 0&&(l.stencilZPass=t.stencilZPass),t.wireframe!==void 0&&(l.wireframe=t.wireframe),t.wireframeLinewidth!==void 0&&(l.wireframeLinewidth=t.wireframeLinewidth),t.wireframeLinecap!==void 0&&(l.wireframeLinecap=t.wireframeLinecap),t.wireframeLinejoin!==void 0&&(l.wireframeLinejoin=t.wireframeLinejoin),t.rotation!==void 0&&(l.rotation=t.rotation),t.linewidth!==1&&(l.linewidth=t.linewidth),t.dashSize!==void 0&&(l.dashSize=t.dashSize),t.gapSize!==void 0&&(l.gapSize=t.gapSize),t.scale!==void 0&&(l.scale=t.scale),t.polygonOffset!==void 0&&(l.polygonOffset=t.polygonOffset),t.polygonOffsetFactor!==void 0&&(l.polygonOffsetFactor=t.polygonOffsetFactor),t.polygonOffsetUnits!==void 0&&(l.polygonOffsetUnits=t.polygonOffsetUnits),t.morphTargets!==void 0&&(l.morphTargets=t.morphTargets),t.morphNormals!==void 0&&(l.morphNormals=t.morphNormals),t.dithering!==void 0&&(l.dithering=t.dithering),t.alphaToCoverage!==void 0&&(l.alphaToCoverage=t.alphaToCoverage),t.premultipliedAlpha!==void 0&&(l.premultipliedAlpha=t.premultipliedAlpha),t.vertexTangents!==void 0&&(l.vertexTangents=t.vertexTangents),t.visible!==void 0&&(l.visible=t.visible),t.toneMapped!==void 0&&(l.toneMapped=t.toneMapped),t.userData!==void 0&&(l.userData=t.userData),t.vertexColors!==void 0&&(typeof t.vertexColors=="number"?l.vertexColors=t.vertexColors>0:l.vertexColors=t.vertexColors),t.uniforms!==void 0)for(const d in t.uniforms){const p=t.uniforms[d];switch(l.uniforms[d]={},p.type){case"t":l.uniforms[d].value=a(p.value);break;case"c":l.uniforms[d].value=new pn().setHex(p.value);break;case"v2":l.uniforms[d].value=new He().fromArray(p.value);break;case"v3":l.uniforms[d].value=new gt().fromArray(p.value);break;case"v4":l.uniforms[d].value=new Ir().fromArray(p.value);break;case"m3":l.uniforms[d].value=new ji().fromArray(p.value);break;case"m4":l.uniforms[d].value=new En().fromArray(p.value);break;default:l.uniforms[d].value=p.value}}if(t.defines!==void 0&&(l.defines=t.defines),t.vertexShader!==void 0&&(l.vertexShader=t.vertexShader),t.fragmentShader!==void 0&&(l.fragmentShader=t.fragmentShader),t.extensions!==void 0)for(const d in t.extensions)l.extensions[d]=t.extensions[d];if(t.shading!==void 0&&(l.flatShading=t.shading===1),t.size!==void 0&&(l.size=t.size),t.sizeAttenuation!==void 0&&(l.sizeAttenuation=t.sizeAttenuation),t.map!==void 0&&(l.map=a(t.map)),t.matcap!==void 0&&(l.matcap=a(t.matcap)),t.alphaMap!==void 0&&(l.alphaMap=a(t.alphaMap)),t.bumpMap!==void 0&&(l.bumpMap=a(t.bumpMap)),t.bumpScale!==void 0&&(l.bumpScale=t.bumpScale),t.normalMap!==void 0&&(l.normalMap=a(t.normalMap)),t.normalMapType!==void 0&&(l.normalMapType=t.normalMapType),t.normalScale!==void 0){let d=t.normalScale;Array.isArray(d)===!1&&(d=[d,d]),l.normalScale=new He().fromArray(d)}return t.displacementMap!==void 0&&(l.displacementMap=a(t.displacementMap)),t.displacementScale!==void 0&&(l.displacementScale=t.displacementScale),t.displacementBias!==void 0&&(l.displacementBias=t.displacementBias),t.roughnessMap!==void 0&&(l.roughnessMap=a(t.roughnessMap)),t.metalnessMap!==void 0&&(l.metalnessMap=a(t.metalnessMap)),t.emissiveMap!==void 0&&(l.emissiveMap=a(t.emissiveMap)),t.emissiveIntensity!==void 0&&(l.emissiveIntensity=t.emissiveIntensity),t.specularMap!==void 0&&(l.specularMap=a(t.specularMap)),t.envMap!==void 0&&(l.envMap=a(t.envMap)),t.envMapIntensity!==void 0&&(l.envMapIntensity=t.envMapIntensity),t.reflectivity!==void 0&&(l.reflectivity=t.reflectivity),t.refractionRatio!==void 0&&(l.refractionRatio=t.refractionRatio),t.lightMap!==void 0&&(l.lightMap=a(t.lightMap)),t.lightMapIntensity!==void 0&&(l.lightMapIntensity=t.lightMapIntensity),t.aoMap!==void 0&&(l.aoMap=a(t.aoMap)),t.aoMapIntensity!==void 0&&(l.aoMapIntensity=t.aoMapIntensity),t.gradientMap!==void 0&&(l.gradientMap=a(t.gradientMap)),t.clearcoatMap!==void 0&&(l.clearcoatMap=a(t.clearcoatMap)),t.clearcoatRoughnessMap!==void 0&&(l.clearcoatRoughnessMap=a(t.clearcoatRoughnessMap)),t.clearcoatNormalMap!==void 0&&(l.clearcoatNormalMap=a(t.clearcoatNormalMap)),t.clearcoatNormalScale!==void 0&&(l.clearcoatNormalScale=new He().fromArray(t.clearcoatNormalScale)),t.transmissionMap!==void 0&&(l.transmissionMap=a(t.transmissionMap)),t.thicknessMap!==void 0&&(l.thicknessMap=a(t.thicknessMap)),l}setTextures(t){return this.textures=t,this}}class oc{static decodeText(t){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(t);let i="";for(let a=0,l=t.length;a<l;a++)i+=String.fromCharCode(t[a]);try{return decodeURIComponent(escape(i))}catch{return i}}static extractUrlBase(t){const i=t.lastIndexOf("/");return i===-1?"./":t.substr(0,i+1)}}class lp extends zn{constructor(){super(),this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(t){return super.copy(t),this.instanceCount=t.instanceCount,this}clone(){return new this.constructor().copy(this)}toJSON(){const t=super.toJSON(this);return t.instanceCount=this.instanceCount,t.isInstancedBufferGeometry=!0,t}}lp.prototype.isInstancedBufferGeometry=!0;class hf extends Kn{constructor(t,i,a,l=1){typeof a=="number"&&(l=a,a=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),super(t,i,a),this.meshPerAttribute=l}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}hf.prototype.isInstancedBufferAttribute=!0;class up extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new ba(d.manager);p.setPath(d.path),p.setRequestHeader(d.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){try{i(d.parse(JSON.parse(v)))}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}parse(t){const i={},a={};function l(C,A){if(i[A]!==void 0)return i[A];const R=C.interleavedBuffers[A],O=function(Z,ot){if(a[ot]!==void 0)return a[ot];const vt=Z.arrayBuffers[ot],mt=new Uint32Array(vt).buffer;return a[ot]=mt,mt}(C,R.buffer),U=Si(R.type,O),D=new _l(U,R.stride);return D.uuid=R.uuid,i[A]=D,D}const d=t.isInstancedBufferGeometry?new lp:new zn,p=t.data.index;if(p!==void 0){const C=Si(p.type,p.array);d.setIndex(new Kn(C,1))}const v=t.data.attributes;for(const C in v){const A=v[C];let R;if(A.isInterleavedBufferAttribute){const O=l(t.data,A.data);R=new ri(O,A.itemSize,A.offset,A.normalized)}else{const O=Si(A.type,A.array);R=new(A.isInstancedBufferAttribute?hf:Kn)(O,A.itemSize,A.normalized)}A.name!==void 0&&(R.name=A.name),A.usage!==void 0&&R.setUsage(A.usage),A.updateRange!==void 0&&(R.updateRange.offset=A.updateRange.offset,R.updateRange.count=A.updateRange.count),d.setAttribute(C,R)}const _=t.data.morphAttributes;if(_)for(const C in _){const A=_[C],R=[];for(let O=0,U=A.length;O<U;O++){const D=A[O];let Z;if(D.isInterleavedBufferAttribute){const ot=l(t.data,D.data);Z=new ri(ot,D.itemSize,D.offset,D.normalized)}else{const ot=Si(D.type,D.array);Z=new Kn(ot,D.itemSize,D.normalized)}D.name!==void 0&&(Z.name=D.name),R.push(Z)}d.morphAttributes[C]=R}t.data.morphTargetsRelative&&(d.morphTargetsRelative=!0);const x=t.data.groups||t.data.drawcalls||t.data.offsets;if(x!==void 0)for(let C=0,A=x.length;C!==A;++C){const R=x[C];d.addGroup(R.start,R.count,R.materialIndex)}const M=t.data.boundingSphere;if(M!==void 0){const C=new gt;M.center!==void 0&&C.fromArray(M.center),d.boundingSphere=new bs(C,M.radius)}return t.name&&(d.name=t.name),t.userData&&(d.userData=t.userData),d}}class lg extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=this.path===""?oc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||p;const v=new ba(this.manager);v.setPath(this.path),v.setRequestHeader(this.requestHeader),v.setWithCredentials(this.withCredentials),v.load(t,function(_){let x=null;try{x=JSON.parse(_)}catch(C){return l!==void 0&&l(C),void console.error("THREE:ObjectLoader: Can't parse "+t+".",C.message)}const M=x.metadata;M!==void 0&&M.type!==void 0&&M.type.toLowerCase()!=="geometry"?d.parse(x,i):console.error("THREE.ObjectLoader: Can't load "+t)},a,l)}async loadAsync(t,i){const a=this.path===""?oc.extractUrlBase(t):this.path;this.resourcePath=this.resourcePath||a;const l=new ba(this.manager);l.setPath(this.path),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials);const d=await l.loadAsync(t,i),p=JSON.parse(d),v=p.metadata;if(v===void 0||v.type===void 0||v.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+t);return await this.parseAsync(p)}parse(t,i){const a=this.parseAnimations(t.animations),l=this.parseShapes(t.shapes),d=this.parseGeometries(t.geometries,l),p=this.parseImages(t.images,function(){i!==void 0&&i(x)}),v=this.parseTextures(t.textures,p),_=this.parseMaterials(t.materials,v),x=this.parseObject(t.object,d,_,v,a),M=this.parseSkeletons(t.skeletons,x);if(this.bindSkeletons(x,M),i!==void 0){let C=!1;for(const A in p)if(p[A]instanceof HTMLImageElement){C=!0;break}C===!1&&i(x)}return x}async parseAsync(t){const i=this.parseAnimations(t.animations),a=this.parseShapes(t.shapes),l=this.parseGeometries(t.geometries,a),d=await this.parseImagesAsync(t.images),p=this.parseTextures(t.textures,d),v=this.parseMaterials(t.materials,p),_=this.parseObject(t.object,l,v,p,i),x=this.parseSkeletons(t.skeletons,_);return this.bindSkeletons(_,x),_}parseShapes(t){const i={};if(t!==void 0)for(let a=0,l=t.length;a<l;a++){const d=new ju().fromJSON(t[a]);i[d.uuid]=d}return i}parseSkeletons(t,i){const a={},l={};if(i.traverse(function(d){d.isBone&&(l[d.uuid]=d)}),t!==void 0)for(let d=0,p=t.length;d<p;d++){const v=new Fu().fromJSON(t[d],l);a[v.uuid]=v}return a}parseGeometries(t,i){const a={};if(t!==void 0){const l=new up;for(let d=0,p=t.length;d<p;d++){let v;const _=t[d];switch(_.type){case"BufferGeometry":case"InstancedBufferGeometry":v=l.parse(_);break;case"Geometry":console.error("THREE.ObjectLoader: The legacy Geometry type is no longer supported.");break;default:_.type in Mm?v=Mm[_.type].fromJSON(_,i):console.warn(`THREE.ObjectLoader: Unsupported geometry type "${_.type}"`)}v.uuid=_.uuid,_.name!==void 0&&(v.name=_.name),v.isBufferGeometry===!0&&_.userData!==void 0&&(v.userData=_.userData),a[_.uuid]=v}}return a}parseMaterials(t,i){const a={},l={};if(t!==void 0){const d=new ld;d.setTextures(i);for(let p=0,v=t.length;p<v;p++){const _=t[p];if(_.type==="MultiMaterial"){const x=[];for(let M=0;M<_.materials.length;M++){const C=_.materials[M];a[C.uuid]===void 0&&(a[C.uuid]=d.parse(C)),x.push(a[C.uuid])}l[_.uuid]=x}else a[_.uuid]===void 0&&(a[_.uuid]=d.parse(_)),l[_.uuid]=a[_.uuid]}}return l}parseAnimations(t){const i={};if(t!==void 0)for(let a=0;a<t.length;a++){const l=t[a],d=sd.parse(l);i[d.uuid]=d}return i}parseImages(t,i){const a=this,l={};let d;function p(v){if(typeof v=="string"){const _=v;return function(x){return a.manager.itemStart(x),d.load(x,function(){a.manager.itemEnd(x)},void 0,function(){a.manager.itemError(x),a.manager.itemEnd(x)})}(/^(\/\/)|([a-z]+:(\/\/)?)/i.test(_)?_:a.resourcePath+_)}return v.data?{data:Si(v.type,v.data),width:v.width,height:v.height}:null}if(t!==void 0&&t.length>0){const v=new ya(i);d=new op(v),d.setCrossOrigin(this.crossOrigin);for(let _=0,x=t.length;_<x;_++){const M=t[_],C=M.url;if(Array.isArray(C)){l[M.uuid]=[];for(let A=0,R=C.length;A<R;A++){const O=p(C[A]);O!==null&&(O instanceof HTMLImageElement?l[M.uuid].push(O):l[M.uuid].push(new Is(O.data,O.width,O.height)))}}else{const A=p(M.url);A!==null&&(l[M.uuid]=A)}}}return l}async parseImagesAsync(t){const i=this,a={};let l;async function d(p){if(typeof p=="string"){const v=p,_=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(v)?v:i.resourcePath+v;return await l.loadAsync(_)}return p.data?{data:Si(p.type,p.data),width:p.width,height:p.height}:null}if(t!==void 0&&t.length>0){l=new op(this.manager),l.setCrossOrigin(this.crossOrigin);for(let p=0,v=t.length;p<v;p++){const _=t[p],x=_.url;if(Array.isArray(x)){a[_.uuid]=[];for(let M=0,C=x.length;M<C;M++){const A=x[M],R=await d(A);R!==null&&(R instanceof HTMLImageElement?a[_.uuid].push(R):a[_.uuid].push(new Is(R.data,R.width,R.height)))}}else{const M=await d(_.url);M!==null&&(a[_.uuid]=M)}}}return a}parseTextures(t,i){function a(d,p){return typeof d=="number"?d:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",d),p[d])}const l={};if(t!==void 0)for(let d=0,p=t.length;d<p;d++){const v=t[d];let _;v.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',v.uuid),i[v.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",v.image);const x=i[v.image];Array.isArray(x)?(_=new Vl(x),x.length===6&&(_.needsUpdate=!0)):(_=x&&x.data?new Is(x.data,x.width,x.height):new ni(x),x&&(_.needsUpdate=!0)),_.uuid=v.uuid,v.name!==void 0&&(_.name=v.name),v.mapping!==void 0&&(_.mapping=a(v.mapping,tl)),v.offset!==void 0&&_.offset.fromArray(v.offset),v.repeat!==void 0&&_.repeat.fromArray(v.repeat),v.center!==void 0&&_.center.fromArray(v.center),v.rotation!==void 0&&(_.rotation=v.rotation),v.wrap!==void 0&&(_.wrapS=a(v.wrap[0],Sa),_.wrapT=a(v.wrap[1],Sa)),v.format!==void 0&&(_.format=v.format),v.type!==void 0&&(_.type=v.type),v.encoding!==void 0&&(_.encoding=v.encoding),v.minFilter!==void 0&&(_.minFilter=a(v.minFilter,ou)),v.magFilter!==void 0&&(_.magFilter=a(v.magFilter,ou)),v.anisotropy!==void 0&&(_.anisotropy=v.anisotropy),v.flipY!==void 0&&(_.flipY=v.flipY),v.premultiplyAlpha!==void 0&&(_.premultiplyAlpha=v.premultiplyAlpha),v.unpackAlignment!==void 0&&(_.unpackAlignment=v.unpackAlignment),l[v.uuid]=_}return l}parseObject(t,i,a,l,d){let p,v,_;function x(A){return i[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",A),i[A]}function M(A){if(A!==void 0){if(Array.isArray(A)){const R=[];for(let O=0,U=A.length;O<U;O++){const D=A[O];a[D]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",D),R.push(a[D])}return R}return a[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",A),a[A]}}function C(A){return l[A]===void 0&&console.warn("THREE.ObjectLoader: Undefined texture",A),l[A]}switch(t.type){case"Scene":p=new Fh,t.background!==void 0&&(Number.isInteger(t.background)?p.background=new pn(t.background):p.background=C(t.background)),t.environment!==void 0&&(p.environment=C(t.environment)),t.fog!==void 0&&(t.fog.type==="Fog"?p.fog=new tu(t.fog.color,t.fog.near,t.fog.far):t.fog.type==="FogExp2"&&(p.fog=new Ql(t.fog.color,t.fog.density)));break;case"PerspectiveCamera":p=new Yi(t.fov,t.aspect,t.near,t.far),t.focus!==void 0&&(p.focus=t.focus),t.zoom!==void 0&&(p.zoom=t.zoom),t.filmGauge!==void 0&&(p.filmGauge=t.filmGauge),t.filmOffset!==void 0&&(p.filmOffset=t.filmOffset),t.view!==void 0&&(p.view=Object.assign({},t.view));break;case"OrthographicCamera":p=new sp(t.left,t.right,t.top,t.bottom,t.near,t.far),t.zoom!==void 0&&(p.zoom=t.zoom),t.view!==void 0&&(p.view=Object.assign({},t.view));break;case"AmbientLight":p=new uf(t.color,t.intensity);break;case"DirectionalLight":p=new Wu(t.color,t.intensity);break;case"PointLight":p=new Wf(t.color,t.intensity,t.distance,t.decay);break;case"RectAreaLight":p=new ic(t.color,t.intensity,t.width,t.height);break;case"SpotLight":p=new ad(t.color,t.intensity,t.distance,t.angle,t.penumbra,t.decay);break;case"HemisphereLight":p=new sf(t.color,t.groundColor,t.intensity);break;case"LightProbe":p=new ap().fromJSON(t);break;case"SkinnedMesh":v=x(t.geometry),_=M(t.material),p=new jc(v,_),t.bindMode!==void 0&&(p.bindMode=t.bindMode),t.bindMatrix!==void 0&&p.bindMatrix.fromArray(t.bindMatrix),t.skeleton!==void 0&&(p.skeleton=t.skeleton);break;case"Mesh":v=x(t.geometry),_=M(t.material),p=new Bi(v,_);break;case"InstancedMesh":v=x(t.geometry),_=M(t.material);const A=t.count,R=t.instanceMatrix,O=t.instanceColor;p=new qc(v,_,A),p.instanceMatrix=new Kn(new Float32Array(R.array),16),O!==void 0&&(p.instanceColor=new Kn(new Float32Array(O.array),O.itemSize));break;case"LOD":p=new Gh;break;case"Line":p=new Ya(x(t.geometry),M(t.material));break;case"LineLoop":p=new nu(x(t.geometry),M(t.material));break;case"LineSegments":p=new io(x(t.geometry),M(t.material));break;case"PointCloud":case"Points":p=new q(x(t.geometry),M(t.material));break;case"Sprite":p=new Du(M(t.material));break;case"Group":p=new vl;break;case"Bone":p=new no;break;default:p=new ar}if(p.uuid=t.uuid,t.name!==void 0&&(p.name=t.name),t.matrix!==void 0?(p.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(p.matrixAutoUpdate=t.matrixAutoUpdate),p.matrixAutoUpdate&&p.matrix.decompose(p.position,p.quaternion,p.scale)):(t.position!==void 0&&p.position.fromArray(t.position),t.rotation!==void 0&&p.rotation.fromArray(t.rotation),t.quaternion!==void 0&&p.quaternion.fromArray(t.quaternion),t.scale!==void 0&&p.scale.fromArray(t.scale)),t.castShadow!==void 0&&(p.castShadow=t.castShadow),t.receiveShadow!==void 0&&(p.receiveShadow=t.receiveShadow),t.shadow&&(t.shadow.bias!==void 0&&(p.shadow.bias=t.shadow.bias),t.shadow.normalBias!==void 0&&(p.shadow.normalBias=t.shadow.normalBias),t.shadow.radius!==void 0&&(p.shadow.radius=t.shadow.radius),t.shadow.mapSize!==void 0&&p.shadow.mapSize.fromArray(t.shadow.mapSize),t.shadow.camera!==void 0&&(p.shadow.camera=this.parseObject(t.shadow.camera))),t.visible!==void 0&&(p.visible=t.visible),t.frustumCulled!==void 0&&(p.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(p.renderOrder=t.renderOrder),t.userData!==void 0&&(p.userData=t.userData),t.layers!==void 0&&(p.layers.mask=t.layers),t.children!==void 0){const A=t.children;for(let R=0;R<A.length;R++)p.add(this.parseObject(A[R],i,a,l,d))}if(t.animations!==void 0){const A=t.animations;for(let R=0;R<A.length;R++){const O=A[R];p.animations.push(d[O])}}if(t.type==="LOD"){t.autoUpdate!==void 0&&(p.autoUpdate=t.autoUpdate);const A=t.levels;for(let R=0;R<A.length;R++){const O=A[R],U=p.getObjectByProperty("uuid",O.object);U!==void 0&&p.addLevel(U,O.distance)}}return p}bindSkeletons(t,i){Object.keys(i).length!==0&&t.traverse(function(a){if(a.isSkinnedMesh===!0&&a.skeleton!==void 0){const l=i[a.skeleton];l===void 0?console.warn("THREE.ObjectLoader: No skeleton found with UUID:",a.skeleton):a.bind(l,a.bindMatrix)}})}setTexturePath(t){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(t)}}const tl={UVMapping:ao,CubeReflectionMapping:I,CubeRefractionMapping:z,EquirectangularReflectionMapping:H,EquirectangularRefractionMapping:at,CubeUVReflectionMapping:nt,CubeUVRefractionMapping:it},Sa={RepeatWrapping:yt,ClampToEdgeWrapping:St,MirroredRepeatWrapping:Ct},ou={NearestFilter:wt,NearestMipmapNearestFilter:Vt,NearestMipmapLinearFilter:Le,LinearFilter:Qe,LinearMipmapNearestFilter:Qn,LinearMipmapLinearFilter:Yr};class su extends Wo{constructor(t){super(t),typeof createImageBitmap=="undefined"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch=="undefined"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(t){return this.options=t,this}load(t,i,a,l){t===void 0&&(t=""),this.path!==void 0&&(t=this.path+t),t=this.manager.resolveURL(t);const d=this,p=ec.get(t);if(p!==void 0)return d.manager.itemStart(t),setTimeout(function(){i&&i(p),d.manager.itemEnd(t)},0),p;const v={};v.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",v.headers=this.requestHeader,fetch(t,v).then(function(_){return _.blob()}).then(function(_){return createImageBitmap(_,Object.assign(d.options,{colorSpaceConversion:"none"}))}).then(function(_){ec.add(t,_),i&&i(_),d.manager.itemEnd(t)}).catch(function(_){l&&l(_),d.manager.itemError(t),d.manager.itemEnd(t)}),d.manager.itemStart(t)}}su.prototype.isImageBitmapLoader=!0;class au{constructor(){this.type="ShapePath",this.color=new pn,this.subPaths=[],this.currentPath=null}moveTo(t,i){return this.currentPath=new rc,this.subPaths.push(this.currentPath),this.currentPath.moveTo(t,i),this}lineTo(t,i){return this.currentPath.lineTo(t,i),this}quadraticCurveTo(t,i,a,l){return this.currentPath.quadraticCurveTo(t,i,a,l),this}bezierCurveTo(t,i,a,l,d,p){return this.currentPath.bezierCurveTo(t,i,a,l,d,p),this}splineThru(t){return this.currentPath.splineThru(t),this}toShapes(t,i){function a(ot){const vt=[];for(let mt=0,At=ot.length;mt<At;mt++){const Pt=ot[mt],Et=new ju;Et.curves=Pt.curves,vt.push(Et)}return vt}function l(ot,vt){const mt=vt.length;let At=!1;for(let Pt=mt-1,Et=0;Et<mt;Pt=Et++){let Ot=vt[Pt],Ie=vt[Et],ye=Ie.x-Ot.x,xe=Ie.y-Ot.y;if(Math.abs(xe)>Number.EPSILON){if(xe<0&&(Ot=vt[Et],ye=-ye,Ie=vt[Pt],xe=-xe),ot.y<Ot.y||ot.y>Ie.y)continue;if(ot.y===Ot.y){if(ot.x===Ot.x)return!0}else{const ge=xe*(ot.x-Ot.x)-ye*(ot.y-Ot.y);if(ge===0)return!0;if(ge<0)continue;At=!At}}else{if(ot.y!==Ot.y)continue;if(Ie.x<=ot.x&&ot.x<=Ot.x||Ot.x<=ot.x&&ot.x<=Ie.x)return!0}}return At}const d=Os.isClockWise,p=this.subPaths;if(p.length===0)return[];if(i===!0)return a(p);let v,_,x;const M=[];if(p.length===1)return _=p[0],x=new ju,x.curves=_.curves,M.push(x),M;let C=!d(p[0].getPoints());C=t?!C:C;const A=[],R=[];let O,U,D=[],Z=0;R[Z]=void 0,D[Z]=[];for(let ot=0,vt=p.length;ot<vt;ot++)_=p[ot],O=_.getPoints(),v=d(O),v=t?!v:v,v?(!C&&R[Z]&&Z++,R[Z]={s:new ju,p:O},R[Z].s.curves=_.curves,C&&Z++,D[Z]=[]):D[Z].push({h:_,p:O[0]});if(!R[0])return a(p);if(R.length>1){let ot=!1;const vt=[];for(let mt=0,At=R.length;mt<At;mt++)A[mt]=[];for(let mt=0,At=R.length;mt<At;mt++){const Pt=D[mt];for(let Et=0;Et<Pt.length;Et++){const Ot=Pt[Et];let Ie=!0;for(let ye=0;ye<R.length;ye++)l(Ot.p,R[ye].p)&&(mt!==ye&&vt.push({froms:mt,tos:ye,hole:Et}),Ie?(Ie=!1,A[ye].push(Ot)):ot=!0);Ie&&A[mt].push(Ot)}}vt.length>0&&(ot||(D=A))}for(let ot=0,vt=R.length;ot<vt;ot++){x=R[ot].s,M.push(x),U=D[ot];for(let mt=0,At=U.length;mt<At;mt++)x.holes.push(U[mt].h)}return M}}class oo{constructor(t){this.type="Font",this.data=t}generateShapes(t,i=100){const a=[],l=function(d,p,v){const _=Array.from(d),x=p/v.resolution,M=(v.boundingBox.yMax-v.boundingBox.yMin+v.underlineThickness)*x,C=[];let A=0,R=0;for(let O=0;O<_.length;O++){const U=_[O];if(U===`
2923
+ `)A=0,R-=M;else{const D=Xf(U,x,A,R,v);A+=D.offsetX,C.push(D.path)}}return C}(t,i,this.data);for(let d=0,p=l.length;d<p;d++)Array.prototype.push.apply(a,l[d].toShapes());return a}}function Xf(m,t,i,a,l){const d=l.glyphs[m]||l.glyphs["?"];if(!d)return void console.error('THREE.Font: character "'+m+'" does not exists in font family '+l.familyName+".");const p=new au;let v,_,x,M,C,A,R,O;if(d.o){const U=d._cachedOutline||(d._cachedOutline=d.o.split(" "));for(let D=0,Z=U.length;D<Z;)switch(U[D++]){case"m":v=U[D++]*t+i,_=U[D++]*t+a,p.moveTo(v,_);break;case"l":v=U[D++]*t+i,_=U[D++]*t+a,p.lineTo(v,_);break;case"q":x=U[D++]*t+i,M=U[D++]*t+a,C=U[D++]*t+i,A=U[D++]*t+a,p.quadraticCurveTo(C,A,x,M);break;case"b":x=U[D++]*t+i,M=U[D++]*t+a,C=U[D++]*t+i,A=U[D++]*t+a,R=U[D++]*t+i,O=U[D++]*t+a,p.bezierCurveTo(C,A,R,O,x,M)}}return{offsetX:d.ha*t,path:p}}oo.prototype.isFont=!0;class qf extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new ba(this.manager);p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(d.withCredentials),p.load(t,function(v){let _;try{_=JSON.parse(v)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),_=JSON.parse(v.substring(65,v.length-2))}const x=d.parse(_);i&&i(x)},a,l)}parse(t){return new oo(t)}}let wl;const cf={getContext:function(){return wl===void 0&&(wl=new(window.AudioContext||window.webkitAudioContext)),wl},setContext:function(m){wl=m}};class Om extends Wo{constructor(t){super(t)}load(t,i,a,l){const d=this,p=new ba(this.manager);p.setResponseType("arraybuffer"),p.setPath(this.path),p.setRequestHeader(this.requestHeader),p.setWithCredentials(this.withCredentials),p.load(t,function(v){try{const _=v.slice(0);cf.getContext().decodeAudioData(_,function(x){i(x)})}catch(_){l?l(_):console.error(_),d.manager.itemError(t)}},a,l)}}class el extends ap{constructor(t,i,a=1){super(void 0,a);const l=new pn().set(t),d=new pn().set(i),p=new gt(l.r,l.g,l.b),v=new gt(d.r,d.g,d.b),_=Math.sqrt(Math.PI),x=_*Math.sqrt(.75);this.sh.coefficients[0].copy(p).add(v).multiplyScalar(_),this.sh.coefficients[1].copy(p).sub(v).multiplyScalar(x)}}el.prototype.isHemisphereLightProbe=!0;class re extends ap{constructor(t,i=1){super(void 0,i);const a=new pn().set(t);this.sh.coefficients[0].set(a.r,a.g,a.b).multiplyScalar(2*Math.sqrt(Math.PI))}}re.prototype.isAmbientLightProbe=!0;const Yf=new En,Dm=new En;class ug{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new Yi,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new Yi,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(t){const i=this._cache;if(i.focus!==t.focus||i.fov!==t.fov||i.aspect!==t.aspect*this.aspect||i.near!==t.near||i.far!==t.far||i.zoom!==t.zoom||i.eyeSep!==this.eyeSep){i.focus=t.focus,i.fov=t.fov,i.aspect=t.aspect*this.aspect,i.near=t.near,i.far=t.far,i.zoom=t.zoom,i.eyeSep=this.eyeSep;const a=t.projectionMatrix.clone(),l=i.eyeSep/2,d=l*i.near/i.focus,p=i.near*Math.tan(ea*i.fov*.5)/i.zoom;let v,_;Dm.elements[12]=-l,Yf.elements[12]=l,v=-p*i.aspect+d,_=p*i.aspect+d,a.elements[0]=2*i.near/(_-v),a.elements[8]=(_+v)/(_-v),this.cameraL.projectionMatrix.copy(a),v=-p*i.aspect-d,_=p*i.aspect-d,a.elements[0]=2*i.near/(_-v),a.elements[8]=(_+v)/(_-v),this.cameraR.projectionMatrix.copy(a)}this.cameraL.matrixWorld.copy(t.matrixWorld).multiply(Dm),this.cameraR.matrixWorld.copy(t.matrixWorld).multiply(Yf)}}class Zf{constructor(t=!0){this.autoStart=t,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=Jf(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let t=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const i=Jf();t=(i-this.oldTime)/1e3,this.oldTime=i,this.elapsedTime+=t}return t}}function Jf(){return(typeof performance=="undefined"?Date:performance).now()}const Sl=new gt,$f=new Oi,Kf=new gt,Xu=new gt;class Qf extends ar{constructor(){super(),this.type="AudioListener",this.context=cf.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new Zf}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(t){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=t,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}updateMatrixWorld(t){super.updateMatrixWorld(t);const i=this.context.listener,a=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(Sl,$f,Kf),Xu.set(0,0,-1).applyQuaternion($f),i.positionX){const l=this.context.currentTime+this.timeDelta;i.positionX.linearRampToValueAtTime(Sl.x,l),i.positionY.linearRampToValueAtTime(Sl.y,l),i.positionZ.linearRampToValueAtTime(Sl.z,l),i.forwardX.linearRampToValueAtTime(Xu.x,l),i.forwardY.linearRampToValueAtTime(Xu.y,l),i.forwardZ.linearRampToValueAtTime(Xu.z,l),i.upX.linearRampToValueAtTime(a.x,l),i.upY.linearRampToValueAtTime(a.y,l),i.upZ.linearRampToValueAtTime(a.z,l)}else i.setPosition(Sl.x,Sl.y,Sl.z),i.setOrientation(Xu.x,Xu.y,Xu.z,a.x,a.y,a.z)}}class tm extends ar{constructor(t){super(),this.type="Audio",this.listener=t,this.context=t.context,this.gain=this.context.createGain(),this.gain.connect(t.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(t){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=t,this.connect(),this}setMediaElementSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(t),this.connect(),this}setMediaStreamSource(t){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(t),this.connect(),this}setBuffer(t){return this.buffer=t,this.sourceType="buffer",this.autoplay&&this.play(),this}play(t=0){if(this.isPlaying===!0)return void console.warn("THREE.Audio: Audio is already playing.");if(this.hasPlaybackControl===!1)return void console.warn("THREE.Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+t;const i=this.context.createBufferSource();return i.buffer=this.buffer,i.loop=this.loop,i.loopStart=this.loopStart,i.loopEnd=this.loopEnd,i.onended=this.onEnded.bind(this),i.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=i,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl!==!1)return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;console.warn("THREE.Audio: this Audio has no playback control.")}stop(){if(this.hasPlaybackControl!==!1)return this._progress=0,this.source.stop(),this.source.onended=null,this.isPlaying=!1,this;console.warn("THREE.Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let t=1,i=this.filters.length;t<i;t++)this.filters[t-1].connect(this.filters[t]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let t=1,i=this.filters.length;t<i;t++)this.filters[t-1].disconnect(this.filters[t]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}getFilters(){return this.filters}setFilters(t){return t||(t=[]),this._connected===!0?(this.disconnect(),this.filters=t.slice(),this.connect()):this.filters=t.slice(),this}setDetune(t){if(this.detune=t,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(t){return this.setFilters(t?[t]:[])}setPlaybackRate(t){if(this.hasPlaybackControl!==!1)return this.playbackRate=t,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this;console.warn("THREE.Audio: this Audio has no playback control.")}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(t){if(this.hasPlaybackControl!==!1)return this.loop=t,this.isPlaying===!0&&(this.source.loop=this.loop),this;console.warn("THREE.Audio: this Audio has no playback control.")}setLoopStart(t){return this.loopStart=t,this}setLoopEnd(t){return this.loopEnd=t,this}getVolume(){return this.gain.gain.value}setVolume(t){return this.gain.gain.setTargetAtTime(t,this.context.currentTime,.01),this}}const qu=new gt,Nm=new Oi,hg=new gt,sc=new gt;class cg extends tm{constructor(t){super(t),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(t){return this.panner.refDistance=t,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(t){return this.panner.rolloffFactor=t,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(t){return this.panner.distanceModel=t,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(t){return this.panner.maxDistance=t,this}setDirectionalCone(t,i,a){return this.panner.coneInnerAngle=t,this.panner.coneOuterAngle=i,this.panner.coneOuterGain=a,this}updateMatrixWorld(t){if(super.updateMatrixWorld(t),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(qu,Nm,hg),sc.set(0,0,1).applyQuaternion(Nm);const i=this.panner;if(i.positionX){const a=this.context.currentTime+this.listener.timeDelta;i.positionX.linearRampToValueAtTime(qu.x,a),i.positionY.linearRampToValueAtTime(qu.y,a),i.positionZ.linearRampToValueAtTime(qu.z,a),i.orientationX.linearRampToValueAtTime(sc.x,a),i.orientationY.linearRampToValueAtTime(sc.y,a),i.orientationZ.linearRampToValueAtTime(sc.z,a)}else i.setPosition(qu.x,qu.y,qu.z),i.setOrientation(sc.x,sc.y,sc.z)}}class Fm{constructor(t,i=2048){this.analyser=t.context.createAnalyser(),this.analyser.fftSize=i,this.data=new Uint8Array(this.analyser.frequencyBinCount),t.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let t=0;const i=this.getFrequencyData();for(let a=0;a<i.length;a++)t+=i[a];return t/i.length}}class ud{constructor(t,i,a){let l,d,p;switch(this.binding=t,this.valueSize=a,i){case"quaternion":l=this._slerp,d=this._slerpAdditive,p=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*a),this._workIndex=5;break;case"string":case"bool":l=this._select,d=this._select,p=this._setAdditiveIdentityOther,this.buffer=new Array(5*a);break;default:l=this._lerp,d=this._lerpAdditive,p=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*a)}this._mixBufferRegion=l,this._mixBufferRegionAdditive=d,this._setIdentity=p,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,i){const a=this.buffer,l=this.valueSize,d=t*l+l;let p=this.cumulativeWeight;if(p===0){for(let v=0;v!==l;++v)a[d+v]=a[v];p=i}else{p+=i;const v=i/p;this._mixBufferRegion(a,d,0,v,l)}this.cumulativeWeight=p}accumulateAdditive(t){const i=this.buffer,a=this.valueSize,l=a*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(i,l,0,t,a),this.cumulativeWeightAdditive+=t}apply(t){const i=this.valueSize,a=this.buffer,l=t*i+i,d=this.cumulativeWeight,p=this.cumulativeWeightAdditive,v=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,d<1){const _=i*this._origIndex;this._mixBufferRegion(a,l,_,1-d,i)}p>0&&this._mixBufferRegionAdditive(a,l,this._addIndex*i,1,i);for(let _=i,x=i+i;_!==x;++_)if(a[_]!==a[_+i]){v.setValue(a,l);break}}saveOriginalState(){const t=this.binding,i=this.buffer,a=this.valueSize,l=a*this._origIndex;t.getValue(i,l);for(let d=a,p=l;d!==p;++d)i[d]=i[l+d%a];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,i=t+this.valueSize;for(let a=t;a<i;a++)this.buffer[a]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,i=this._addIndex*this.valueSize;for(let a=0;a<this.valueSize;a++)this.buffer[i+a]=this.buffer[t+a]}_select(t,i,a,l,d){if(l>=.5)for(let p=0;p!==d;++p)t[i+p]=t[a+p]}_slerp(t,i,a,l){Oi.slerpFlat(t,i,t,i,t,a,l)}_slerpAdditive(t,i,a,l,d){const p=this._workIndex*d;Oi.multiplyQuaternionsFlat(t,p,t,i,t,a),Oi.slerpFlat(t,i,t,i,t,p,l)}_lerp(t,i,a,l,d){const p=1-l;for(let v=0;v!==d;++v){const _=i+v;t[_]=t[_]*p+t[a+v]*l}}_lerpAdditive(t,i,a,l,d){for(let p=0;p!==d;++p){const v=i+p;t[v]=t[v]+t[a+p]*l}}}const df=new RegExp("[\\[\\]\\.:\\/]","g"),Bm="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",hd=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),em=/(WCOD+)?/.source.replace("WCOD",Bm),km=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),li=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),nm=new RegExp("^"+hd+em+km+li+"$"),Um=["material","materials","bones"];class Br{constructor(t,i,a){this.path=i,this.parsedPath=a||Br.parseTrackName(i),this.node=Br.findNode(t,this.parsedPath.nodeName)||t,this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,i,a){return t&&t.isAnimationObjectGroup?new Br.Composite(t,i,a):new Br(t,i,a)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(df,"")}static parseTrackName(t){const i=nm.exec(t);if(!i)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const a={nodeName:i[2],objectName:i[3],objectIndex:i[4],propertyName:i[5],propertyIndex:i[6]},l=a.nodeName&&a.nodeName.lastIndexOf(".");if(l!==void 0&&l!==-1){const d=a.nodeName.substring(l+1);Um.indexOf(d)!==-1&&(a.nodeName=a.nodeName.substring(0,l),a.objectName=d)}if(a.propertyName===null||a.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return a}static findNode(t,i){if(!i||i===""||i==="."||i===-1||i===t.name||i===t.uuid)return t;if(t.skeleton){const a=t.skeleton.getBoneByName(i);if(a!==void 0)return a}if(t.children){const a=function(d){for(let p=0;p<d.length;p++){const v=d[p];if(v.name===i||v.uuid===i)return v;const _=a(v.children);if(_)return _}return null},l=a(t.children);if(l)return l}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,i){t[i]=this.node[this.propertyName]}_getValue_array(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)t[i++]=a[l]}_getValue_arrayElement(t,i){t[i]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,i){this.resolvedProperty.toArray(t,i)}_setValue_direct(t,i){this.targetObject[this.propertyName]=t[i]}_setValue_direct_setNeedsUpdate(t,i){this.targetObject[this.propertyName]=t[i],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,i){this.targetObject[this.propertyName]=t[i],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)a[l]=t[i++]}_setValue_array_setNeedsUpdate(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)a[l]=t[i++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,i){const a=this.resolvedProperty;for(let l=0,d=a.length;l!==d;++l)a[l]=t[i++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,i){this.resolvedProperty[this.propertyIndex]=t[i]}_setValue_arrayElement_setNeedsUpdate(t,i){this.resolvedProperty[this.propertyIndex]=t[i],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,i){this.resolvedProperty[this.propertyIndex]=t[i],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,i){this.resolvedProperty.fromArray(t,i)}_setValue_fromArray_setNeedsUpdate(t,i){this.resolvedProperty.fromArray(t,i),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,i){this.resolvedProperty.fromArray(t,i),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,i){this.bind(),this.getValue(t,i)}_setValue_unbound(t,i){this.bind(),this.setValue(t,i)}bind(){let t=this.node;const i=this.parsedPath,a=i.objectName,l=i.propertyName;let d=i.propertyIndex;if(t||(t=Br.findNode(this.rootNode,i.nodeName)||this.rootNode,this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");if(a){let x=i.objectIndex;switch(a){case"materials":if(!t.material)return void console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let M=0;M<t.length;M++)if(t[M].name===x){x=M;break}break;default:if(t[a]===void 0)return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[a]}if(x!==void 0){if(t[x]===void 0)return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[x]}}const p=t[l];if(p===void 0){const x=i.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+x+"."+l+" but it wasn't found.",t)}let v=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?v=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(v=this.Versioning.MatrixWorldNeedsUpdate);let _=this.BindingType.Direct;if(d!==void 0){if(l==="morphTargetInfluences"){if(!t.geometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.isBufferGeometry)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences on THREE.Geometry. Use THREE.BufferGeometry instead.",this);if(!t.geometry.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);t.morphTargetDictionary[d]!==void 0&&(d=t.morphTargetDictionary[d])}_=this.BindingType.ArrayElement,this.resolvedProperty=p,this.propertyIndex=d}else p.fromArray!==void 0&&p.toArray!==void 0?(_=this.BindingType.HasFromToArray,this.resolvedProperty=p):Array.isArray(p)?(_=this.BindingType.EntireArray,this.resolvedProperty=p):this.propertyName=l;this.getValue=this.GetterByBindingType[_],this.setValue=this.SetterByBindingTypeAndVersioning[_][v]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Br.Composite=class{constructor(m,t,i){const a=i||Br.parseTrackName(t);this._targetGroup=m,this._bindings=m.subscribe_(t,a)}getValue(m,t){this.bind();const i=this._targetGroup.nCachedObjects_,a=this._bindings[i];a!==void 0&&a.getValue(m,t)}setValue(m,t){const i=this._bindings;for(let a=this._targetGroup.nCachedObjects_,l=i.length;a!==l;++a)i[a].setValue(m,t)}bind(){const m=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=m.length;t!==i;++t)m[t].bind()}unbind(){const m=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=m.length;t!==i;++t)m[t].unbind()}},Br.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Br.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Br.prototype.GetterByBindingType=[Br.prototype._getValue_direct,Br.prototype._getValue_array,Br.prototype._getValue_arrayElement,Br.prototype._getValue_toArray],Br.prototype.SetterByBindingTypeAndVersioning=[[Br.prototype._setValue_direct,Br.prototype._setValue_direct_setNeedsUpdate,Br.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Br.prototype._setValue_array,Br.prototype._setValue_array_setNeedsUpdate,Br.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Br.prototype._setValue_arrayElement,Br.prototype._setValue_arrayElement_setNeedsUpdate,Br.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Br.prototype._setValue_fromArray,Br.prototype._setValue_fromArray_setNeedsUpdate,Br.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class rm{constructor(){this.uuid=No(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const t={};this._indicesByUUID=t;for(let a=0,l=arguments.length;a!==l;++a)t[arguments[a].uuid]=a;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}add(){const t=this._objects,i=this._indicesByUUID,a=this._paths,l=this._parsedPaths,d=this._bindings,p=d.length;let v,_=t.length,x=this.nCachedObjects_;for(let M=0,C=arguments.length;M!==C;++M){const A=arguments[M],R=A.uuid;let O=i[R];if(O===void 0){O=_++,i[R]=O,t.push(A);for(let U=0,D=p;U!==D;++U)d[U].push(new Br(A,a[U],l[U]))}else if(O<x){v=t[O];const U=--x,D=t[U];i[D.uuid]=O,t[O]=D,i[R]=U,t[U]=A;for(let Z=0,ot=p;Z!==ot;++Z){const vt=d[Z],mt=vt[U];let At=vt[O];vt[O]=mt,At===void 0&&(At=new Br(A,a[Z],l[Z])),vt[U]=At}}else t[O]!==v&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=x}remove(){const t=this._objects,i=this._indicesByUUID,a=this._bindings,l=a.length;let d=this.nCachedObjects_;for(let p=0,v=arguments.length;p!==v;++p){const _=arguments[p],x=_.uuid,M=i[x];if(M!==void 0&&M>=d){const C=d++,A=t[C];i[A.uuid]=M,t[M]=A,i[x]=C,t[C]=_;for(let R=0,O=l;R!==O;++R){const U=a[R],D=U[C],Z=U[M];U[M]=D,U[C]=Z}}}this.nCachedObjects_=d}uncache(){const t=this._objects,i=this._indicesByUUID,a=this._bindings,l=a.length;let d=this.nCachedObjects_,p=t.length;for(let v=0,_=arguments.length;v!==_;++v){const x=arguments[v].uuid,M=i[x];if(M!==void 0)if(delete i[x],M<d){const C=--d,A=t[C],R=--p,O=t[R];i[A.uuid]=M,t[M]=A,i[O.uuid]=C,t[C]=O,t.pop();for(let U=0,D=l;U!==D;++U){const Z=a[U],ot=Z[C],vt=Z[R];Z[M]=ot,Z[C]=vt,Z.pop()}}else{const C=--p,A=t[C];C>0&&(i[A.uuid]=M),t[M]=A,t.pop();for(let R=0,O=l;R!==O;++R){const U=a[R];U[M]=U[C],U.pop()}}}this.nCachedObjects_=d}subscribe_(t,i){const a=this._bindingsIndicesByPath;let l=a[t];const d=this._bindings;if(l!==void 0)return d[l];const p=this._paths,v=this._parsedPaths,_=this._objects,x=_.length,M=this.nCachedObjects_,C=new Array(x);l=d.length,a[t]=l,p.push(t),v.push(i),d.push(C);for(let A=M,R=_.length;A!==R;++A){const O=_[A];C[A]=new Br(O,t,i)}return C}unsubscribe_(t){const i=this._bindingsIndicesByPath,a=i[t];if(a!==void 0){const l=this._paths,d=this._parsedPaths,p=this._bindings,v=p.length-1,_=p[v];i[t[v]]=a,p[a]=_,p.pop(),d[a]=d[v],d.pop(),l[a]=l[v],l.pop()}}}rm.prototype.isAnimationObjectGroup=!0;class hp{constructor(t,i,a=null,l=i.blendMode){this._mixer=t,this._clip=i,this._localRoot=a,this.blendMode=l;const d=i.tracks,p=d.length,v=new Array(p),_={endingStart:ta,endingEnd:ta};for(let x=0;x!==p;++x){const M=d[x].createInterpolant(null);v[x]=M,M.settings=_}this._interpolantSettings=_,this._interpolants=v,this._propertyBindings=new Array(p),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=vs,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,i){return this.loop=t,this.repetitions=i,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,i,a){if(t.fadeOut(i),this.fadeIn(i),a){const l=this._clip.duration,d=t._clip.duration,p=d/l,v=l/d;t.warp(1,p,i),this.warp(v,1,i)}return this}crossFadeTo(t,i,a){return t.crossFadeFrom(this,i,a)}stopFading(){const t=this._weightInterpolant;return t!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,i,a){const l=this._mixer,d=l.time,p=this.timeScale;let v=this._timeScaleInterpolant;v===null&&(v=l._lendControlInterpolant(),this._timeScaleInterpolant=v);const _=v.parameterPositions,x=v.sampleValues;return _[0]=d,_[1]=d+a,x[0]=t/p,x[1]=i/p,this}stopWarping(){const t=this._timeScaleInterpolant;return t!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,i,a,l){if(!this.enabled)return void this._updateWeight(t);const d=this._startTime;if(d!==null){const _=(t-d)*a;if(_<0||a===0)return;this._startTime=null,i=a*_}i*=this._updateTimeScale(t);const p=this._updateTime(i),v=this._updateWeight(t);if(v>0){const _=this._interpolants,x=this._propertyBindings;switch(this.blendMode){case xd:for(let M=0,C=_.length;M!==C;++M)_[M].evaluate(p),x[M].accumulateAdditive(v);break;case Oa:default:for(let M=0,C=_.length;M!==C;++M)_[M].evaluate(p),x[M].accumulate(l,v)}}}_updateWeight(t){let i=0;if(this.enabled){i=this.weight;const a=this._weightInterpolant;if(a!==null){const l=a.evaluate(t)[0];i*=l,t>a.parameterPositions[1]&&(this.stopFading(),l===0&&(this.enabled=!1))}}return this._effectiveWeight=i,i}_updateTimeScale(t){let i=0;if(!this.paused){i=this.timeScale;const a=this._timeScaleInterpolant;a!==null&&(i*=a.evaluate(t)[0],t>a.parameterPositions[1]&&(this.stopWarping(),i===0?this.paused=!0:this.timeScale=i))}return this._effectiveTimeScale=i,i}_updateTime(t){const i=this._clip.duration,a=this.loop;let l=this.time+t,d=this._loopCount;const p=a===gp;if(t===0)return d===-1?l:p&&(1&d)==1?i-l:l;if(a===Ri){d===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(l>=i)l=i;else{if(!(l<0)){this.time=l;break t}l=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=l,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(d===-1&&(t>=0?(d=0,this._setEndings(!0,this.repetitions===0,p)):this._setEndings(this.repetitions===0,!0,p)),l>=i||l<0){const v=Math.floor(l/i);l-=i*v,d+=Math.abs(v);const _=this.repetitions-d;if(_<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,l=t>0?i:0,this.time=l,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(_===1){const x=t<0;this._setEndings(x,!x,p)}else this._setEndings(!1,!1,p);this._loopCount=d,this.time=l,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:v})}}else this.time=l;if(p&&(1&d)==1)return i-l}return l}_setEndings(t,i,a){const l=this._interpolantSettings;a?(l.endingStart=La,l.endingEnd=La):(l.endingStart=t?this.zeroSlopeAtStart?La:ta:_s,l.endingEnd=i?this.zeroSlopeAtEnd?La:ta:_s)}_scheduleFading(t,i,a){const l=this._mixer,d=l.time;let p=this._weightInterpolant;p===null&&(p=l._lendControlInterpolant(),this._weightInterpolant=p);const v=p.parameterPositions,_=p.sampleValues;return v[0]=d,_[0]=i,v[1]=d+t,_[1]=a,this}}class ac extends Fa{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(t,i){const a=t._localRoot||this._root,l=t._clip.tracks,d=l.length,p=t._propertyBindings,v=t._interpolants,_=a.uuid,x=this._bindingsByRootAndName;let M=x[_];M===void 0&&(M={},x[_]=M);for(let C=0;C!==d;++C){const A=l[C],R=A.name;let O=M[R];if(O!==void 0)p[C]=O;else{if(O=p[C],O!==void 0){O._cacheIndex===null&&(++O.referenceCount,this._addInactiveBinding(O,_,R));continue}const U=i&&i._propertyBindings[C].binding.parsedPath;O=new ud(Br.create(a,R,U),A.ValueTypeName,A.getValueSize()),++O.referenceCount,this._addInactiveBinding(O,_,R),p[C]=O}v[C].resultBuffer=O.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(t._cacheIndex===null){const a=(t._localRoot||this._root).uuid,l=t._clip.uuid,d=this._actionsByClip[l];this._bindAction(t,d&&d.knownActions[0]),this._addInactiveAction(t,l,a)}const i=t._propertyBindings;for(let a=0,l=i.length;a!==l;++a){const d=i[a];d.useCount++==0&&(this._lendBinding(d),d.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const i=t._propertyBindings;for(let a=0,l=i.length;a!==l;++a){const d=i[a];--d.useCount==0&&(d.restoreOriginalState(),this._takeBackBinding(d))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const i=t._cacheIndex;return i!==null&&i<this._nActiveActions}_addInactiveAction(t,i,a){const l=this._actions,d=this._actionsByClip;let p=d[i];if(p===void 0)p={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,d[i]=p;else{const v=p.knownActions;t._byClipCacheIndex=v.length,v.push(t)}t._cacheIndex=l.length,l.push(t),p.actionByRoot[a]=t}_removeInactiveAction(t){const i=this._actions,a=i[i.length-1],l=t._cacheIndex;a._cacheIndex=l,i[l]=a,i.pop(),t._cacheIndex=null;const d=t._clip.uuid,p=this._actionsByClip,v=p[d],_=v.knownActions,x=_[_.length-1],M=t._byClipCacheIndex;x._byClipCacheIndex=M,_[M]=x,_.pop(),t._byClipCacheIndex=null,delete v.actionByRoot[(t._localRoot||this._root).uuid],_.length===0&&delete p[d],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const i=t._propertyBindings;for(let a=0,l=i.length;a!==l;++a){const d=i[a];--d.referenceCount==0&&this._removeInactiveBinding(d)}}_lendAction(t){const i=this._actions,a=t._cacheIndex,l=this._nActiveActions++,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_takeBackAction(t){const i=this._actions,a=t._cacheIndex,l=--this._nActiveActions,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_addInactiveBinding(t,i,a){const l=this._bindingsByRootAndName,d=this._bindings;let p=l[i];p===void 0&&(p={},l[i]=p),p[a]=t,t._cacheIndex=d.length,d.push(t)}_removeInactiveBinding(t){const i=this._bindings,a=t.binding,l=a.rootNode.uuid,d=a.path,p=this._bindingsByRootAndName,v=p[l],_=i[i.length-1],x=t._cacheIndex;_._cacheIndex=x,i[x]=_,i.pop(),delete v[d],Object.keys(v).length===0&&delete p[l]}_lendBinding(t){const i=this._bindings,a=t._cacheIndex,l=this._nActiveBindings++,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_takeBackBinding(t){const i=this._bindings,a=t._cacheIndex,l=--this._nActiveBindings,d=i[l];t._cacheIndex=l,i[l]=t,d._cacheIndex=a,i[a]=d}_lendControlInterpolant(){const t=this._controlInterpolants,i=this._nActiveControlInterpolants++;let a=t[i];return a===void 0&&(a=new nf(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),a.__cacheIndex=i,t[i]=a),a}_takeBackControlInterpolant(t){const i=this._controlInterpolants,a=t.__cacheIndex,l=--this._nActiveControlInterpolants,d=i[l];t.__cacheIndex=l,i[l]=t,d.__cacheIndex=a,i[a]=d}clipAction(t,i,a){const l=i||this._root,d=l.uuid;let p=typeof t=="string"?sd.findByName(l,t):t;const v=p!==null?p.uuid:t,_=this._actionsByClip[v];let x=null;if(a===void 0&&(a=p!==null?p.blendMode:Oa),_!==void 0){const C=_.actionByRoot[d];if(C!==void 0&&C.blendMode===a)return C;x=_.knownActions[0],p===null&&(p=x._clip)}if(p===null)return null;const M=new hp(this,p,i,a);return this._bindAction(M,x),this._addInactiveAction(M,v,d),M}existingAction(t,i){const a=i||this._root,l=a.uuid,d=typeof t=="string"?sd.findByName(a,t):t,p=d?d.uuid:t,v=this._actionsByClip[p];return v!==void 0&&v.actionByRoot[l]||null}stopAllAction(){const t=this._actions;for(let i=this._nActiveActions-1;i>=0;--i)t[i].stop();return this}update(t){t*=this.timeScale;const i=this._actions,a=this._nActiveActions,l=this.time+=t,d=Math.sign(t),p=this._accuIndex^=1;for(let x=0;x!==a;++x)i[x]._update(l,t,d,p);const v=this._bindings,_=this._nActiveBindings;for(let x=0;x!==_;++x)v[x].apply(p);return this}setTime(t){this.time=0;for(let i=0;i<this._actions.length;i++)this._actions[i].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const i=this._actions,a=t.uuid,l=this._actionsByClip,d=l[a];if(d!==void 0){const p=d.knownActions;for(let v=0,_=p.length;v!==_;++v){const x=p[v];this._deactivateAction(x);const M=x._cacheIndex,C=i[i.length-1];x._cacheIndex=null,x._byClipCacheIndex=null,C._cacheIndex=M,i[M]=C,i.pop(),this._removeInactiveBindingsForAction(x)}delete l[a]}}uncacheRoot(t){const i=t.uuid,a=this._actionsByClip;for(const d in a){const p=a[d].actionByRoot[i];p!==void 0&&(this._deactivateAction(p),this._removeInactiveAction(p))}const l=this._bindingsByRootAndName[i];if(l!==void 0)for(const d in l){const p=l[d];p.restoreOriginalState(),this._removeInactiveBinding(p)}}uncacheAction(t,i){const a=this.existingAction(t,i);a!==null&&(this._deactivateAction(a),this._removeInactiveAction(a))}}ac.prototype._controlInterpolantsResultBuffer=new Float32Array(1);class cd{constructor(t){typeof t=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),t=arguments[1]),this.value=t}clone(){return new cd(this.value.clone===void 0?this.value:this.value.clone())}}class im extends _l{constructor(t,i,a=1){super(t,i),this.meshPerAttribute=a}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}clone(t){const i=super.clone(t);return i.meshPerAttribute=this.meshPerAttribute,i}toJSON(t){const i=super.toJSON(t);return i.isInstancedInterleavedBuffer=!0,i.meshPerAttribute=this.meshPerAttribute,i}}im.prototype.isInstancedInterleavedBuffer=!0;class Gm{constructor(t,i,a,l,d){this.buffer=t,this.type=i,this.itemSize=a,this.elementSize=l,this.count=d,this.version=0}set needsUpdate(t){t===!0&&this.version++}setBuffer(t){return this.buffer=t,this}setType(t,i){return this.type=t,this.elementSize=i,this}setItemSize(t){return this.itemSize=t,this}setCount(t){return this.count=t,this}}Gm.prototype.isGLBufferAttribute=!0;class dg{constructor(t,i,a=0,l=1/0){this.ray=new ka(t,i),this.near=a,this.far=l,this.camera=null,this.layers=new ul,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,i){this.ray.set(t,i)}setFromCamera(t,i){i&&i.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(i.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(i).sub(this.ray.origin).normalize(),this.camera=i):i&&i.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(i.near+i.far)/(i.near-i.far)).unproject(i),this.ray.direction.set(0,0,-1).transformDirection(i.matrixWorld),this.camera=i):console.error("THREE.Raycaster: Unsupported camera type: "+i.type)}intersectObject(t,i=!1,a=[]){return dd(t,this,a,i),a.sort(pf),a}intersectObjects(t,i=!1,a=[]){for(let l=0,d=t.length;l<d;l++)dd(t[l],this,a,i);return a.sort(pf),a}}function pf(m,t){return m.distance-t.distance}function dd(m,t,i,a){if(m.layers.test(t.layers)&&m.raycast(t,i),a===!0){const l=m.children;for(let d=0,p=l.length;d<p;d++)dd(l[d],t,i,!0)}}class pg{constructor(t=1,i=0,a=0){return this.radius=t,this.phi=i,this.theta=a,this}set(t,i,a){return this.radius=t,this.phi=i,this.theta=a,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){return this.phi=Math.max(1e-6,Math.min(Math.PI-1e-6,this.phi)),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,i,a){return this.radius=Math.sqrt(t*t+i*i+a*a),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,a),this.phi=Math.acos(zi(i/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class fg{constructor(t=1,i=0,a=0){return this.radius=t,this.theta=i,this.y=a,this}set(t,i,a){return this.radius=t,this.theta=i,this.y=a,this}copy(t){return this.radius=t.radius,this.theta=t.theta,this.y=t.y,this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,i,a){return this.radius=Math.sqrt(t*t+a*a),this.theta=Math.atan2(t,a),this.y=i,this}clone(){return new this.constructor().copy(this)}}const Hm=new He;class pd{constructor(t=new He(1/0,1/0),i=new He(-1/0,-1/0)){this.min=t,this.max=i}set(t,i){return this.min.copy(t),this.max.copy(i),this}setFromPoints(t){this.makeEmpty();for(let i=0,a=t.length;i<a;i++)this.expandByPoint(t[i]);return this}setFromCenterAndSize(t,i){const a=Hm.copy(i).multiplyScalar(.5);return this.min.copy(t).sub(a),this.max.copy(t).add(a),this}clone(){return new this.constructor().copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(t){return this.isEmpty()?t.set(0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}containsPoint(t){return!(t.x<this.min.x||t.x>this.max.x||t.y<this.min.y||t.y>this.max.y)}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y}getParameter(t,i){return i.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(t){return!(t.max.x<this.min.x||t.min.x>this.max.x||t.max.y<this.min.y||t.min.y>this.max.y)}clampPoint(t,i){return i.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return Hm.copy(t).clamp(this.min,this.max).sub(t).length()}intersect(t){return this.min.max(t.min),this.max.min(t.max),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}}pd.prototype.isBox2=!0;const zm=new gt,Yu=new gt;class Ta{constructor(t=new gt,i=new gt){this.start=t,this.end=i}set(t,i){return this.start.copy(t),this.end.copy(i),this}copy(t){return this.start.copy(t.start),this.end.copy(t.end),this}getCenter(t){return t.addVectors(this.start,this.end).multiplyScalar(.5)}delta(t){return t.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(t,i){return this.delta(i).multiplyScalar(t).add(this.start)}closestPointToPointParameter(t,i){zm.subVectors(t,this.start),Yu.subVectors(this.end,this.start);const a=Yu.dot(Yu);let l=Yu.dot(zm)/a;return i&&(l=zi(l,0,1)),l}closestPointToPoint(t,i,a){const l=this.closestPointToPointParameter(t,i);return this.delta(a).multiplyScalar(l).add(this.start)}applyMatrix4(t){return this.start.applyMatrix4(t),this.end.applyMatrix4(t),this}equals(t){return t.start.equals(this.start)&&t.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}class Ea extends ar{constructor(t){super(),this.material=t,this.render=function(){},this.hasPositions=!1,this.hasNormals=!1,this.hasColors=!1,this.hasUvs=!1,this.positionArray=null,this.normalArray=null,this.colorArray=null,this.uvArray=null,this.count=0}}Ea.prototype.isImmediateRenderObject=!0;const Zu=new gt;class mg extends ar{constructor(t,i){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=i;const a=new zn,l=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let p=0,v=1,_=32;p<_;p++,v++){const x=p/_*Math.PI*2,M=v/_*Math.PI*2;l.push(Math.cos(x),Math.sin(x),1,Math.cos(M),Math.sin(M),1)}a.setAttribute("position",new xn(l,3));const d=new ro({fog:!1,toneMapped:!1});this.cone=new io(a,d),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateMatrixWorld();const t=this.light.distance?this.light.distance:1e3,i=t*Math.tan(this.light.angle);this.cone.scale.set(i,i,t),Zu.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(Zu),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const lu=new gt,fd=new En,Ds=new En;class om extends io{constructor(t){const i=function _(x){const M=[];x&&x.isBone&&M.push(x);for(let C=0;C<x.children.length;C++)M.push.apply(M,_(x.children[C]));return M}(t),a=new zn,l=[],d=[],p=new pn(0,0,1),v=new pn(0,1,0);for(let _=0;_<i.length;_++){const x=i[_];x.parent&&x.parent.isBone&&(l.push(0,0,0),l.push(0,0,0),d.push(p.r,p.g,p.b),d.push(v.r,v.g,v.b))}a.setAttribute("position",new xn(l,3)),a.setAttribute("color",new xn(d,3)),super(a,new ro({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0})),this.type="SkeletonHelper",this.isSkeletonHelper=!0,this.root=t,this.bones=i,this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1}updateMatrixWorld(t){const i=this.bones,a=this.geometry,l=a.getAttribute("position");Ds.copy(this.root.matrixWorld).invert();for(let d=0,p=0;d<i.length;d++){const v=i[d];v.parent&&v.parent.isBone&&(fd.multiplyMatrices(Ds,v.matrixWorld),lu.setFromMatrixPosition(fd),l.setXYZ(p,lu.x,lu.y,lu.z),fd.multiplyMatrices(Ds,v.parent.matrixWorld),lu.setFromMatrixPosition(fd),l.setXYZ(p+1,lu.x,lu.y,lu.z),p+=2)}a.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(t)}}class gg extends Bi{constructor(t,i,a){super(new Jh(i,4,2),new Fi({wireframe:!0,fog:!1,toneMapped:!1})),this.light=t,this.light.updateMatrixWorld(),this.color=a,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const o=new gt,n=new pn,e=new pn;class r extends ar{constructor(t,i,a){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=a;const l=new Yh(i);l.rotateY(.5*Math.PI),this.material=new Fi({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const d=l.getAttribute("position"),p=new Float32Array(3*d.count);l.setAttribute("color",new Kn(p,3)),this.add(new Bi(l,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const t=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const i=t.geometry.getAttribute("color");n.copy(this.light.color),e.copy(this.light.groundColor);for(let a=0,l=i.count;a<l;a++){const d=a<l/2?n:e;i.setXYZ(a,d.r,d.g,d.b)}i.needsUpdate=!0}t.lookAt(o.setFromMatrixPosition(this.light.matrixWorld).negate())}}class s extends io{constructor(t=10,i=10,a=4473924,l=8947848){a=new pn(a),l=new pn(l);const d=i/2,p=t/i,v=t/2,_=[],x=[];for(let C=0,A=0,R=-v;C<=i;C++,R+=p){_.push(-v,0,R,v,0,R),_.push(R,0,-v,R,0,v);const O=C===d?a:l;O.toArray(x,A),A+=3,O.toArray(x,A),A+=3,O.toArray(x,A),A+=3,O.toArray(x,A),A+=3}const M=new zn;M.setAttribute("position",new xn(_,3)),M.setAttribute("color",new xn(x,3)),super(M,new ro({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}}class u extends io{constructor(t=10,i=16,a=8,l=64,d=4473924,p=8947848){d=new pn(d),p=new pn(p);const v=[],_=[];for(let M=0;M<=i;M++){const C=M/i*(2*Math.PI),A=Math.sin(C)*t,R=Math.cos(C)*t;v.push(0,0,0),v.push(A,0,R);const O=1&M?d:p;_.push(O.r,O.g,O.b),_.push(O.r,O.g,O.b)}for(let M=0;M<=a;M++){const C=1&M?d:p,A=t-t/a*M;for(let R=0;R<l;R++){let O=R/l*(2*Math.PI),U=Math.sin(O)*A,D=Math.cos(O)*A;v.push(U,0,D),_.push(C.r,C.g,C.b),O=(R+1)/l*(2*Math.PI),U=Math.sin(O)*A,D=Math.cos(O)*A,v.push(U,0,D),_.push(C.r,C.g,C.b)}}const x=new zn;x.setAttribute("position",new xn(v,3)),x.setAttribute("color",new xn(_,3)),super(x,new ro({vertexColors:!0,toneMapped:!1})),this.type="PolarGridHelper"}}const h=new gt,f=new gt,y=new gt;class b extends ar{constructor(t,i,a){super(),this.light=t,this.light.updateMatrixWorld(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.color=a,i===void 0&&(i=1);let l=new zn;l.setAttribute("position",new xn([-i,i,0,i,i,0,i,-i,0,-i,-i,0,-i,i,0],3));const d=new ro({fog:!1,toneMapped:!1});this.lightPlane=new Ya(l,d),this.add(this.lightPlane),l=new zn,l.setAttribute("position",new xn([0,0,0,0,0,1],3)),this.targetLine=new Ya(l,d),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){h.setFromMatrixPosition(this.light.matrixWorld),f.setFromMatrixPosition(this.light.target.matrixWorld),y.subVectors(f,h),this.lightPlane.lookAt(f),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(f),this.targetLine.scale.z=y.length()}}const T=new gt,P=new jl;class j extends io{constructor(t){const i=new zn,a=new ro({color:16777215,vertexColors:!0,toneMapped:!1}),l=[],d=[],p={},v=new pn(16755200),_=new pn(16711680),x=new pn(43775),M=new pn(16777215),C=new pn(3355443);function A(O,U,D){R(O,D),R(U,D)}function R(O,U){l.push(0,0,0),d.push(U.r,U.g,U.b),p[O]===void 0&&(p[O]=[]),p[O].push(l.length/3-1)}A("n1","n2",v),A("n2","n4",v),A("n4","n3",v),A("n3","n1",v),A("f1","f2",v),A("f2","f4",v),A("f4","f3",v),A("f3","f1",v),A("n1","f1",v),A("n2","f2",v),A("n3","f3",v),A("n4","f4",v),A("p","n1",_),A("p","n2",_),A("p","n3",_),A("p","n4",_),A("u1","u2",x),A("u2","u3",x),A("u3","u1",x),A("c","t",M),A("p","c",C),A("cn1","cn2",C),A("cn3","cn4",C),A("cf1","cf2",C),A("cf3","cf4",C),i.setAttribute("position",new xn(l,3)),i.setAttribute("color",new xn(d,3)),super(i,a),this.type="CameraHelper",this.camera=t,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=t.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=p,this.update()}update(){const t=this.geometry,i=this.pointMap;P.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),G("c",i,t,P,0,0,-1),G("t",i,t,P,0,0,1),G("n1",i,t,P,-1,-1,-1),G("n2",i,t,P,1,-1,-1),G("n3",i,t,P,-1,1,-1),G("n4",i,t,P,1,1,-1),G("f1",i,t,P,-1,-1,1),G("f2",i,t,P,1,-1,1),G("f3",i,t,P,-1,1,1),G("f4",i,t,P,1,1,1),G("u1",i,t,P,.7,1.1,-1),G("u2",i,t,P,-.7,1.1,-1),G("u3",i,t,P,0,2,-1),G("cf1",i,t,P,-1,0,1),G("cf2",i,t,P,1,0,1),G("cf3",i,t,P,0,-1,1),G("cf4",i,t,P,0,1,1),G("cn1",i,t,P,-1,0,-1),G("cn2",i,t,P,1,0,-1),G("cn3",i,t,P,0,-1,-1),G("cn4",i,t,P,0,1,-1),t.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function G(m,t,i,a,l,d,p){T.set(l,d,p).unproject(a);const v=t[m];if(v!==void 0){const _=i.getAttribute("position");for(let x=0,M=v.length;x<M;x++)_.setXYZ(v[x],T.x,T.y,T.z)}}const V=new To;class K extends io{constructor(t,i=16776960){const a=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),l=new Float32Array(24),d=new zn;d.setIndex(new Kn(a,1)),d.setAttribute("position",new Kn(l,3)),super(d,new ro({color:i,toneMapped:!1})),this.object=t,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(t){if(t!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&V.setFromObject(this.object),V.isEmpty())return;const i=V.min,a=V.max,l=this.geometry.attributes.position,d=l.array;d[0]=a.x,d[1]=a.y,d[2]=a.z,d[3]=i.x,d[4]=a.y,d[5]=a.z,d[6]=i.x,d[7]=i.y,d[8]=a.z,d[9]=a.x,d[10]=i.y,d[11]=a.z,d[12]=a.x,d[13]=a.y,d[14]=i.z,d[15]=i.x,d[16]=a.y,d[17]=i.z,d[18]=i.x,d[19]=i.y,d[20]=i.z,d[21]=a.x,d[22]=i.y,d[23]=i.z,l.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(t){return this.object=t,this.update(),this}copy(t){return io.prototype.copy.call(this,t),this.object=t.object,this}}class _t extends io{constructor(t,i=16776960){const a=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),l=new zn;l.setIndex(new Kn(a,1)),l.setAttribute("position",new xn([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(l,new ro({color:i,toneMapped:!1})),this.box=t,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(t){const i=this.box;i.isEmpty()||(i.getCenter(this.position),i.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(t))}}class Tt extends Ya{constructor(t,i=1,a=16776960){const l=a,d=new zn;d.setAttribute("position",new xn([1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],3)),d.computeBoundingSphere(),super(d,new ro({color:l,toneMapped:!1})),this.type="PlaneHelper",this.plane=t,this.size=i;const p=new zn;p.setAttribute("position",new xn([1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],3)),p.computeBoundingSphere(),this.add(new Bi(p,new Fi({color:l,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(t){let i=-this.plane.constant;Math.abs(i)<1e-8&&(i=1e-8),this.scale.set(.5*this.size,.5*this.size,i),this.children[0].material.side=i<0?L:zt,this.lookAt(this.plane.normal),super.updateMatrixWorld(t)}}const jt=new gt;let de,Ne;class Nt extends ar{constructor(t=new gt(0,0,1),i=new gt(0,0,0),a=1,l=16776960,d=.2*a,p=.2*d){super(),this.type="ArrowHelper",de===void 0&&(de=new zn,de.setAttribute("position",new xn([0,0,0,0,1,0],3)),Ne=new De(0,.5,1,5,1),Ne.translate(0,-.5,0)),this.position.copy(i),this.line=new Ya(de,new ro({color:l,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Bi(Ne,new Fi({color:l,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(t),this.setLength(a,d,p)}setDirection(t){if(t.y>.99999)this.quaternion.set(0,0,0,1);else if(t.y<-.99999)this.quaternion.set(1,0,0,0);else{jt.set(t.z,0,-t.x).normalize();const i=Math.acos(t.y);this.quaternion.setFromAxisAngle(jt,i)}}setLength(t,i=.2*t,a=.2*i){this.line.scale.set(1,Math.max(1e-4,t-i),1),this.line.updateMatrix(),this.cone.scale.set(a,i,a),this.cone.position.y=t,this.cone.updateMatrix()}setColor(t){this.line.material.color.set(t),this.cone.material.color.set(t)}copy(t){return super.copy(t,!1),this.line.copy(t.line),this.cone.copy(t.cone),this}}class ue extends io{constructor(t=1){const i=[0,0,0,t,0,0,0,0,0,0,t,0,0,0,0,0,0,t],a=new zn;a.setAttribute("position",new xn(i,3)),a.setAttribute("color",new xn([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3)),super(a,new ro({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(t,i,a){const l=new pn,d=this.geometry.attributes.color.array;return l.set(t),l.toArray(d,0),l.toArray(d,3),l.set(i),l.toArray(d,6),l.toArray(d,9),l.set(a),l.toArray(d,12),l.toArray(d,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}const $t=new Float32Array(1),ie=new Int32Array($t.buffer);class Je{static toHalfFloat(t){$t[0]=t;const i=ie[0];let a=i>>16&32768,l=i>>12&2047;const d=i>>23&255;return d<103?a:d>142?(a|=31744,a|=(d==255?0:1)&&8388607&i,a):d<113?(l|=2048,a|=(l>>114-d)+(l>>113-d&1),a):(a|=d-112<<10|l>>1,a+=1&l,a)}}const he=Math.pow(2,8),oe=[.125,.215,.35,.446,.526,.582],Ae=5+oe.length,nn={[Wr]:0,[Bs]:1,[_e]:2,[tn]:3,[Xn]:4,[Mr]:5,[Yt]:6},on=new Fi({side:L,depthWrite:!1,depthTest:!1}),$n=new Bi(new ha,on),nr=new sp,{_lodPlanes:$e,_sizeLods:Ue,_sigmas:Cn}=Ai(),kn=new pn;let wr=null;const Ar=(1+Math.sqrt(5))/2,Dr=1/Ar,pi=[new gt(1,1,1),new gt(-1,1,1),new gt(1,1,-1),new gt(-1,1,-1),new gt(0,Ar,Dr),new gt(0,Ar,-Dr),new gt(Dr,0,Ar),new gt(-Dr,0,Ar),new gt(Ar,Dr,0),new gt(-Ar,Dr,0)];function Ji(m){const t=Math.max(m.r,m.g,m.b),i=Math.min(Math.max(Math.ceil(Math.log2(t)),-128),127);return m.multiplyScalar(Math.pow(2,-i)),(i+128)/255}class jr{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._blurMaterial=function(i){const a=new Float32Array(i),l=new gt(0,1,0);return new $h({name:"SphericalGaussianBlur",defines:{n:i},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:a},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:l},inputEncoding:{value:nn[Wr]},outputEncoding:{value:nn[Wr]}},vertexShader:ur(),fragmentShader:`
2924
2924
 
2925
2925
  precision mediump float;
2926
2926
  precision mediump int;
@@ -3177,7 +3177,7 @@ void main() {
3177
3177
  return inputTexelToLinear( color );
3178
3178
 
3179
3179
  }
3180
- `}const lc=0,md=1,ff=0,zm=1,jm=2;function Vm(m){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),m}function Uv(m=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),m.isMultiMaterial=!0,m.materials=m,m.clone=function(){return m.slice()},m}function Gv(m,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new q(m,t)}function Hv(m){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Du(m)}function zv(m,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new q(m,t)}function jv(m){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new xl(m)}function Vv(m){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new xl(m)}function Wv(m){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new xl(m)}function Xv(m,t,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new gt(m,t,i)}function qv(m,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Kn(m,t).setUsage(al)}function Yv(m,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new wc(m,t)}function Zv(m,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Pd(m,t)}function Jv(m,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new wi(m,t)}function $v(m,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Lr(m,t)}function Kv(m,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new er(m,t)}function Qv(m,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Rd(m,t)}function t0(m,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new fo(m,t)}function e0(m,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new xn(m,t)}function n0(m,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Sc(m,t)}function r0(m){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new ue(m)}function i0(m,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new K(m,t)}function o0(m,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new io(new Yn(m.geometry),new ro({color:t!==void 0?t:16777215}))}function s0(m,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new io(new If(m.geometry),new ro({color:t!==void 0?t:16777215}))}function a0(m){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new ba(m)}function l0(m){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Am(m)}function u0(m,t,i){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new ds(m,i)}function h0(){console.error("THREE.CanvasRenderer has been removed")}function c0(){console.error("THREE.JSONLoader has been removed.")}wn.create=function(m,t){return console.log("THREE.Curve.create() has been deprecated"),m.prototype=Object.create(wn.prototype),m.prototype.constructor=m,m.prototype.getPoint=t,m},rc.prototype.fromPoints=function(m){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(m)},s.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},om.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Wo.prototype.extractUrlBase=function(m){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),oc.extractUrlBase(m)},Wo.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},pd.prototype.center=function(m){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(m)},pd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},pd.prototype.isIntersectionBox=function(m){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(m)},pd.prototype.size=function(m){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(m)},To.prototype.center=function(m){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(m)},To.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},To.prototype.isIntersectionBox=function(m){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(m)},To.prototype.isIntersectionSphere=function(m){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(m)},To.prototype.size=function(m){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(m)},bs.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ja.prototype.setFromMatrix=function(m){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(m)},Ta.prototype.center=function(m){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(m)},ji.prototype.flattenToArrayOffset=function(m,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(m,t)},ji.prototype.multiplyVector3=function(m){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),m.applyMatrix3(this)},ji.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},ji.prototype.applyToBufferAttribute=function(m){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),m.applyMatrix3(this)},ji.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},ji.prototype.getInverse=function(m){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(m).invert()},En.prototype.extractPosition=function(m){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(m)},En.prototype.flattenToArrayOffset=function(m,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(m,t)},En.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new gt().setFromMatrixColumn(this,3)},En.prototype.setRotationFromQuaternion=function(m){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(m)},En.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},En.prototype.multiplyVector3=function(m){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),m.applyMatrix4(this)},En.prototype.multiplyVector4=function(m){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),m.applyMatrix4(this)},En.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},En.prototype.rotateAxis=function(m){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),m.transformDirection(this)},En.prototype.crossVector=function(m){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),m.applyMatrix4(this)},En.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},En.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},En.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},En.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},En.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},En.prototype.applyToBufferAttribute=function(m){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),m.applyMatrix4(this)},En.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},En.prototype.makeFrustum=function(m,t,i,a,l,d){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(m,t,a,i,l,d)},En.prototype.getInverse=function(m){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(m).invert()},Ko.prototype.isIntersectionLine=function(m){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(m)},Oi.prototype.multiplyVector3=function(m){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),m.applyQuaternion(this)},Oi.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},ka.prototype.isIntersectionBox=function(m){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(m)},ka.prototype.isIntersectionPlane=function(m){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(m)},ka.prototype.isIntersectionSphere=function(m){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(m)},bi.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},bi.prototype.barycoordFromPoint=function(m,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(m,t)},bi.prototype.midpoint=function(m){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(m)},bi.prototypenormal=function(m){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(m)},bi.prototype.plane=function(m){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(m)},bi.barycoordFromPoint=function(m,t,i,a,l){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),bi.getBarycoord(m,t,i,a,l)},bi.normal=function(m,t,i,a){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),bi.getNormal(m,t,i,a)},ju.prototype.extractAllPoints=function(m){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(m)},ju.prototype.extrude=function(m){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ka(this,m)},ju.prototype.makeGeometry=function(m){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Zh(this,m)},He.prototype.fromAttribute=function(m,t,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(m,t,i)},He.prototype.distanceToManhattan=function(m){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(m)},He.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},gt.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},gt.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},gt.prototype.getPositionFromMatrix=function(m){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(m)},gt.prototype.getScaleFromMatrix=function(m){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(m)},gt.prototype.getColumnFromMatrix=function(m,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,m)},gt.prototype.applyProjection=function(m){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(m)},gt.prototype.fromAttribute=function(m,t,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(m,t,i)},gt.prototype.distanceToManhattan=function(m){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(m)},gt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Ir.prototype.fromAttribute=function(m,t,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(m,t,i)},Ir.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ar.prototype.getChildByName=function(m){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(m)},ar.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},ar.prototype.translate=function(m,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,m)},ar.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},ar.prototype.applyMatrix=function(m){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(m)},Object.defineProperties(ar.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(m){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=m}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Bi.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Bi.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Il},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),jc.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Yi.prototype.setLens=function(m,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),t!==void 0&&(this.filmGauge=t),this.setFocalLength(m)},Object.defineProperties(wa.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(m){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=m}},shadowCameraLeft:{set:function(m){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=m}},shadowCameraRight:{set:function(m){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=m}},shadowCameraTop:{set:function(m){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=m}},shadowCameraBottom:{set:function(m){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=m}},shadowCameraNear:{set:function(m){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=m}},shadowCameraFar:{set:function(m){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=m}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(m){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=m}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(m){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=m}},shadowMapHeight:{set:function(m){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=m}}}),Object.defineProperties(Kn.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===al},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(al)}}}),Kn.prototype.setDynamic=function(m){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(m===!0?al:Da),this},Kn.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Kn.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},zn.prototype.addIndex=function(m){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(m)},zn.prototype.addAttribute=function(m,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?m==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(m,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(m,new Kn(arguments[1],arguments[2])))},zn.prototype.addDrawCall=function(m,t,i){i!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(m,t)},zn.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},zn.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},zn.prototype.removeAttribute=function(m){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(m)},zn.prototype.applyMatrix=function(m){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(m)},Object.defineProperties(zn.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),_l.prototype.setDynamic=function(m){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(m===!0?al:Da),this},_l.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Ka.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Ka.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Ka.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},Fh.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},cd.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Ni.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new pn}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(m){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=m===Y}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(m){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=m}}}),Object.defineProperties(vo.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(m){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=m}}}),Fr.prototype.clearTarget=function(m,t,i,a){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(m),this.clear(t,i,a)},Fr.prototype.animate=function(m){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(m)},Fr.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Fr.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Fr.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Fr.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Fr.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Fr.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Fr.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Fr.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Fr.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Fr.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Fr.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Fr.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Fr.prototype.enableScissorTest=function(m){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(m)},Fr.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Fr.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Fr.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Fr.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Fr.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Fr.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Fr.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Fr.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Fr.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Fr.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Fr.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(m){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=m}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(m){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=m}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(m){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=m===!0?Bs:Wr}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(or.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(Fo.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(m){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=m}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(m){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=m}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(m){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=m}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(m){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=m}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(m){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=m}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(m){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=m}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(m){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=m}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(m){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=m}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(m){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=m}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(m){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=m}}}),tm.prototype.load=function(m){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const t=this;return new Lm().load(m,function(i){t.setBuffer(i)}),this},Nm.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Ec.prototype.updateCubeMap=function(m,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(m,t)},Ec.prototype.clear=function(m,t,i,a){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(m,t,i,a)},xs.crossOrigin=void 0,xs.loadTexture=function(m,t,i,a){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const l=new Gf;l.setCrossOrigin(this.crossOrigin);const d=l.load(m,i,void 0,a);return t&&(d.mapping=t),d},xs.loadTextureCube=function(m,t,i,a){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const l=new Uf;l.setCrossOrigin(this.crossOrigin);const d=l.load(m,i,void 0,a);return t&&(d.mapping=t),d},xs.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},xs.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const d0={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function p0(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:W}})),typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=W)},function(N,w,S){var W=S(28),pt=S(29);function lt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}w.parse=B,w.resolve=function(Q,et){return B(Q,!1,!0).resolve(et)},w.resolveObject=function(Q,et){return Q?B(Q,!1,!0).resolveObject(et):et},w.format=function(Q){return pt.isString(Q)&&(Q=B(Q)),Q instanceof lt?Q.format():lt.prototype.format.call(Q)},w.Url=lt;var J=/^([a-z0-9.+-]+:)/i,X=/:[0-9]*$/,ct=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,tt=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
3180
+ `}const lc=0,md=1,ff=0,jm=1,Vm=2;function Wm(m){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),m}function Uv(m=[]){return console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),m.isMultiMaterial=!0,m.materials=m,m.clone=function(){return m.slice()},m}function Gv(m,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new q(m,t)}function Hv(m){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Du(m)}function zv(m,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new q(m,t)}function jv(m){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new xl(m)}function Vv(m){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new xl(m)}function Wv(m){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new xl(m)}function Xv(m,t,i){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new gt(m,t,i)}function qv(m,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setUsage( THREE.DynamicDrawUsage ) instead."),new Kn(m,t).setUsage(al)}function Yv(m,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new wc(m,t)}function Zv(m,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Pd(m,t)}function Jv(m,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new wi(m,t)}function $v(m,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Lr(m,t)}function Kv(m,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new er(m,t)}function Qv(m,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Rd(m,t)}function t0(m,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new fo(m,t)}function e0(m,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new xn(m,t)}function n0(m,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Sc(m,t)}function r0(m){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new ue(m)}function i0(m,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new K(m,t)}function o0(m,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new io(new Yn(m.geometry),new ro({color:t!==void 0?t:16777215}))}function s0(m,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new io(new If(m.geometry),new ro({color:t!==void 0?t:16777215}))}function a0(m){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new ba(m)}function l0(m){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new Cm(m)}function u0(m,t,i){return console.warn("THREE.WebGLRenderTargetCube( width, height, options ) is now WebGLCubeRenderTarget( size, options )."),new ds(m,i)}function h0(){console.error("THREE.CanvasRenderer has been removed")}function c0(){console.error("THREE.JSONLoader has been removed.")}wn.create=function(m,t){return console.log("THREE.Curve.create() has been deprecated"),m.prototype=Object.create(wn.prototype),m.prototype.constructor=m,m.prototype.getPoint=t,m},rc.prototype.fromPoints=function(m){return console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(m)},s.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")},om.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")},Wo.prototype.extractUrlBase=function(m){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),oc.extractUrlBase(m)},Wo.Handlers={add:function(){console.error("THREE.Loader: Handlers.add() has been removed. Use LoadingManager.addHandler() instead.")},get:function(){console.error("THREE.Loader: Handlers.get() has been removed. Use LoadingManager.getHandler() instead.")}},pd.prototype.center=function(m){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(m)},pd.prototype.empty=function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},pd.prototype.isIntersectionBox=function(m){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(m)},pd.prototype.size=function(m){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(m)},To.prototype.center=function(m){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(m)},To.prototype.empty=function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},To.prototype.isIntersectionBox=function(m){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(m)},To.prototype.isIntersectionSphere=function(m){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(m)},To.prototype.size=function(m){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(m)},bs.prototype.empty=function(){return console.warn("THREE.Sphere: .empty() has been renamed to .isEmpty()."),this.isEmpty()},ja.prototype.setFromMatrix=function(m){return console.warn("THREE.Frustum: .setFromMatrix() has been renamed to .setFromProjectionMatrix()."),this.setFromProjectionMatrix(m)},Ta.prototype.center=function(m){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(m)},ji.prototype.flattenToArrayOffset=function(m,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(m,t)},ji.prototype.multiplyVector3=function(m){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),m.applyMatrix3(this)},ji.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},ji.prototype.applyToBufferAttribute=function(m){return console.warn("THREE.Matrix3: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix3( matrix ) instead."),m.applyMatrix3(this)},ji.prototype.applyToVector3Array=function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")},ji.prototype.getInverse=function(m){return console.warn("THREE.Matrix3: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(m).invert()},En.prototype.extractPosition=function(m){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(m)},En.prototype.flattenToArrayOffset=function(m,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(m,t)},En.prototype.getPosition=function(){return console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),new gt().setFromMatrixColumn(this,3)},En.prototype.setRotationFromQuaternion=function(m){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(m)},En.prototype.multiplyToArray=function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},En.prototype.multiplyVector3=function(m){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),m.applyMatrix4(this)},En.prototype.multiplyVector4=function(m){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),m.applyMatrix4(this)},En.prototype.multiplyVector3Array=function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},En.prototype.rotateAxis=function(m){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),m.transformDirection(this)},En.prototype.crossVector=function(m){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),m.applyMatrix4(this)},En.prototype.translate=function(){console.error("THREE.Matrix4: .translate() has been removed.")},En.prototype.rotateX=function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},En.prototype.rotateY=function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},En.prototype.rotateZ=function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},En.prototype.rotateByAxis=function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},En.prototype.applyToBufferAttribute=function(m){return console.warn("THREE.Matrix4: .applyToBufferAttribute() has been removed. Use attribute.applyMatrix4( matrix ) instead."),m.applyMatrix4(this)},En.prototype.applyToVector3Array=function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},En.prototype.makeFrustum=function(m,t,i,a,l,d){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(m,t,a,i,l,d)},En.prototype.getInverse=function(m){return console.warn("THREE.Matrix4: .getInverse() has been removed. Use matrixInv.copy( matrix ).invert(); instead."),this.copy(m).invert()},Ko.prototype.isIntersectionLine=function(m){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(m)},Oi.prototype.multiplyVector3=function(m){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),m.applyQuaternion(this)},Oi.prototype.inverse=function(){return console.warn("THREE.Quaternion: .inverse() has been renamed to invert()."),this.invert()},ka.prototype.isIntersectionBox=function(m){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(m)},ka.prototype.isIntersectionPlane=function(m){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(m)},ka.prototype.isIntersectionSphere=function(m){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(m)},bi.prototype.area=function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},bi.prototype.barycoordFromPoint=function(m,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(m,t)},bi.prototype.midpoint=function(m){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(m)},bi.prototypenormal=function(m){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(m)},bi.prototype.plane=function(m){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(m)},bi.barycoordFromPoint=function(m,t,i,a,l){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),bi.getBarycoord(m,t,i,a,l)},bi.normal=function(m,t,i,a){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),bi.getNormal(m,t,i,a)},ju.prototype.extractAllPoints=function(m){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(m)},ju.prototype.extrude=function(m){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new Ka(this,m)},ju.prototype.makeGeometry=function(m){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new Zh(this,m)},He.prototype.fromAttribute=function(m,t,i){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(m,t,i)},He.prototype.distanceToManhattan=function(m){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(m)},He.prototype.lengthManhattan=function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},gt.prototype.setEulerFromRotationMatrix=function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},gt.prototype.setEulerFromQuaternion=function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},gt.prototype.getPositionFromMatrix=function(m){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(m)},gt.prototype.getScaleFromMatrix=function(m){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(m)},gt.prototype.getColumnFromMatrix=function(m,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,m)},gt.prototype.applyProjection=function(m){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(m)},gt.prototype.fromAttribute=function(m,t,i){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(m,t,i)},gt.prototype.distanceToManhattan=function(m){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(m)},gt.prototype.lengthManhattan=function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},Ir.prototype.fromAttribute=function(m,t,i){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(m,t,i)},Ir.prototype.lengthManhattan=function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()},ar.prototype.getChildByName=function(m){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(m)},ar.prototype.renderDepth=function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},ar.prototype.translate=function(m,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,m)},ar.prototype.getWorldRotation=function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")},ar.prototype.applyMatrix=function(m){return console.warn("THREE.Object3D: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(m)},Object.defineProperties(ar.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(m){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=m}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}}),Bi.prototype.setDrawMode=function(){console.error("THREE.Mesh: .setDrawMode() has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")},Object.defineProperties(Bi.prototype,{drawMode:{get:function(){return console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode."),Il},set:function(){console.error("THREE.Mesh: .drawMode has been removed. The renderer now always assumes THREE.TrianglesDrawMode. Transform your geometry via BufferGeometryUtils.toTrianglesDrawMode() if necessary.")}}}),jc.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")},Yi.prototype.setLens=function(m,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),t!==void 0&&(this.filmGauge=t),this.setFocalLength(m)},Object.defineProperties(wa.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(m){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=m}},shadowCameraLeft:{set:function(m){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=m}},shadowCameraRight:{set:function(m){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=m}},shadowCameraTop:{set:function(m){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=m}},shadowCameraBottom:{set:function(m){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=m}},shadowCameraNear:{set:function(m){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=m}},shadowCameraFar:{set:function(m){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=m}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(m){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=m}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(m){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=m}},shadowMapHeight:{set:function(m){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=m}}}),Object.defineProperties(Kn.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},dynamic:{get:function(){return console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.usage===al},set:function(){console.warn("THREE.BufferAttribute: .dynamic has been deprecated. Use .usage instead."),this.setUsage(al)}}}),Kn.prototype.setDynamic=function(m){return console.warn("THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(m===!0?al:Da),this},Kn.prototype.copyIndicesArray=function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")},Kn.prototype.setArray=function(){console.error("THREE.BufferAttribute: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},zn.prototype.addIndex=function(m){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(m)},zn.prototype.addAttribute=function(m,t){return console.warn("THREE.BufferGeometry: .addAttribute() has been renamed to .setAttribute()."),t&&t.isBufferAttribute||t&&t.isInterleavedBufferAttribute?m==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):this.setAttribute(m,t):(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.setAttribute(m,new Kn(arguments[1],arguments[2])))},zn.prototype.addDrawCall=function(m,t,i){i!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(m,t)},zn.prototype.clearDrawCalls=function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},zn.prototype.computeOffsets=function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")},zn.prototype.removeAttribute=function(m){return console.warn("THREE.BufferGeometry: .removeAttribute() has been renamed to .deleteAttribute()."),this.deleteAttribute(m)},zn.prototype.applyMatrix=function(m){return console.warn("THREE.BufferGeometry: .applyMatrix() has been renamed to .applyMatrix4()."),this.applyMatrix4(m)},Object.defineProperties(zn.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}}),_l.prototype.setDynamic=function(m){return console.warn("THREE.InterleavedBuffer: .setDynamic() has been deprecated. Use .setUsage() instead."),this.setUsage(m===!0?al:Da),this},_l.prototype.setArray=function(){console.error("THREE.InterleavedBuffer: .setArray has been removed. Use BufferGeometry .setAttribute to replace/resize attribute buffers")},Ka.prototype.getArrays=function(){console.error("THREE.ExtrudeGeometry: .getArrays() has been removed.")},Ka.prototype.addShapeList=function(){console.error("THREE.ExtrudeGeometry: .addShapeList() has been removed.")},Ka.prototype.addShape=function(){console.error("THREE.ExtrudeGeometry: .addShape() has been removed.")},Fh.prototype.dispose=function(){console.error("THREE.Scene: .dispose() has been removed.")},cd.prototype.onUpdate=function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this},Object.defineProperties(Ni.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new pn}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(m){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=m===Y}},stencilMask:{get:function(){return console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask},set:function(m){console.warn("THREE."+this.type+": .stencilMask has been removed. Use .stencilFuncMask instead."),this.stencilFuncMask=m}}}),Object.defineProperties(vo.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(m){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=m}}}),Fr.prototype.clearTarget=function(m,t,i,a){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(m),this.clear(t,i,a)},Fr.prototype.animate=function(m){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(m)},Fr.prototype.getCurrentRenderTarget=function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},Fr.prototype.getMaxAnisotropy=function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},Fr.prototype.getPrecision=function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},Fr.prototype.resetGLState=function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},Fr.prototype.supportsFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},Fr.prototype.supportsHalfFloatTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},Fr.prototype.supportsStandardDerivatives=function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},Fr.prototype.supportsCompressedTextureS3TC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},Fr.prototype.supportsCompressedTexturePVRTC=function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},Fr.prototype.supportsBlendMinMax=function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},Fr.prototype.supportsVertexTextures=function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},Fr.prototype.supportsInstancedArrays=function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},Fr.prototype.enableScissorTest=function(m){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(m)},Fr.prototype.initMaterial=function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},Fr.prototype.addPrePlugin=function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},Fr.prototype.addPostPlugin=function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},Fr.prototype.updateShadowMap=function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},Fr.prototype.setFaceCulling=function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},Fr.prototype.allocTextureUnit=function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},Fr.prototype.setTexture=function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},Fr.prototype.setTexture2D=function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},Fr.prototype.setTextureCube=function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},Fr.prototype.getActiveMipMapLevel=function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()},Object.defineProperties(Fr.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(m){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=m}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(m){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=m}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}},vr:{get:function(){return console.warn("THREE.WebGLRenderer: .vr has been renamed to .xr"),this.xr}},gammaInput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead."),!1},set:function(){console.warn("THREE.WebGLRenderer: .gammaInput has been removed. Set the encoding for textures via Texture.encoding instead.")}},gammaOutput:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),!1},set:function(m){console.warn("THREE.WebGLRenderer: .gammaOutput has been removed. Set WebGLRenderer.outputEncoding instead."),this.outputEncoding=m===!0?Bs:Wr}},toneMappingWhitePoint:{get:function(){return console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed."),1},set:function(){console.warn("THREE.WebGLRenderer: .toneMappingWhitePoint has been removed.")}}}),Object.defineProperties(or.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}}),Object.defineProperties(Fo.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(m){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=m}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(m){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=m}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(m){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=m}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(m){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=m}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(m){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=m}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(m){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=m}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(m){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=m}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(m){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=m}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(m){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=m}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(m){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=m}}}),tm.prototype.load=function(m){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");const t=this;return new Om().load(m,function(i){t.setBuffer(i)}),this},Fm.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()},Ec.prototype.updateCubeMap=function(m,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(m,t)},Ec.prototype.clear=function(m,t,i,a){return console.warn("THREE.CubeCamera: .clear() is now .renderTarget.clear()."),this.renderTarget.clear(m,t,i,a)},xs.crossOrigin=void 0,xs.loadTexture=function(m,t,i,a){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");const l=new Gf;l.setCrossOrigin(this.crossOrigin);const d=l.load(m,i,void 0,a);return t&&(d.mapping=t),d},xs.loadTextureCube=function(m,t,i,a){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");const l=new Uf;l.setCrossOrigin(this.crossOrigin);const d=l.load(m,i,void 0,a);return t&&(d.mapping=t),d},xs.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")},xs.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};const d0={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/jsm/utils/SceneUtils.js")}};function p0(){console.error("THREE.LensFlare has been moved to /examples/jsm/objects/Lensflare.js")}typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:W}})),typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=W)},function(N,w,S){var W=S(28),pt=S(29);function lt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}w.parse=B,w.resolve=function(Q,et){return B(Q,!1,!0).resolve(et)},w.resolveObject=function(Q,et){return Q?B(Q,!1,!0).resolveObject(et):et},w.format=function(Q){return pt.isString(Q)&&(Q=B(Q)),Q instanceof lt?Q.format():lt.prototype.format.call(Q)},w.Url=lt;var J=/^([a-z0-9.+-]+:)/i,X=/:[0-9]*$/,ct=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,tt=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",`
3181
3181
  `," "]),$=["'"].concat(tt),ut=["%","/","?",";","#"].concat($),kt=["/","?","#"],Gt=/^[+a-z0-9A-Z_-]{0,63}$/,zt=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,L={javascript:!0,"javascript:":!0},k={javascript:!0,"javascript:":!0},Y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},ht=S(30);function B(Q,et,ft){if(Q&&pt.isObject(Q)&&Q instanceof lt)return Q;var ae=new lt;return ae.parse(Q,et,ft),ae}lt.prototype.parse=function(Q,et,ft){if(!pt.isString(Q))throw new TypeError("Parameter 'url' must be a string, not "+typeof Q);var ae=Q.indexOf("?"),Oe=ae!==-1&&ae<Q.indexOf("#")?"?":"#",ne=Q.split(Oe);ne[0]=ne[0].replace(/\\/g,"/");var bt=Q=ne.join(Oe);if(bt=bt.trim(),!ft&&Q.split("#").length===1){var Jt=ct.exec(bt);if(Jt)return this.path=bt,this.href=bt,this.pathname=Jt[1],Jt[2]?(this.search=Jt[2],this.query=et?ht.parse(this.search.substr(1)):this.search.substr(1)):et&&(this.search="",this.query={}),this}var Kt=J.exec(bt);if(Kt){var rt=(Kt=Kt[0]).toLowerCase();this.protocol=rt,bt=bt.substr(Kt.length)}if(ft||Kt||bt.match(/^\/\/[^@\/]+@[^@\/]+/)){var Ut=bt.substr(0,2)==="//";!Ut||Kt&&k[Kt]||(bt=bt.substr(2),this.slashes=!0)}if(!k[Kt]&&(Ut||Kt&&!Y[Kt])){for(var Wt,te,Xt=-1,le=0;le<kt.length;le++)(fe=bt.indexOf(kt[le]))!==-1&&(Xt===-1||fe<Xt)&&(Xt=fe);for((te=Xt===-1?bt.lastIndexOf("@"):bt.lastIndexOf("@",Xt))!==-1&&(Wt=bt.slice(0,te),bt=bt.slice(te+1),this.auth=decodeURIComponent(Wt)),Xt=-1,le=0;le<ut.length;le++){var fe;(fe=bt.indexOf(ut[le]))!==-1&&(Xt===-1||fe<Xt)&&(Xt=fe)}Xt===-1&&(Xt=bt.length),this.host=bt.slice(0,Xt),bt=bt.slice(Xt),this.parseHost(),this.hostname=this.hostname||"";var Ye=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!Ye)for(var ke=this.hostname.split(/\./),Hn=(le=0,ke.length);le<Hn;le++){var Ke=ke[le];if(Ke&&!Ke.match(Gt)){for(var Ln="",Bn=0,Wn=Ke.length;Bn<Wn;Bn++)Ke.charCodeAt(Bn)>127?Ln+="x":Ln+=Ke[Bn];if(!Ln.match(Gt)){var vn=ke.slice(0,le),Pr=ke.slice(le+1),Ur=Ke.match(zt);Ur&&(vn.push(Ur[1]),Pr.unshift(Ur[2])),Pr.length&&(bt="/"+Pr.join(".")+bt),this.hostname=vn.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),Ye||(this.hostname=W.toASCII(this.hostname));var Rr=this.port?":"+this.port:"",qr=this.hostname||"";this.host=qr+Rr,this.href+=this.host,Ye&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),bt[0]!=="/"&&(bt="/"+bt))}if(!L[rt])for(le=0,Hn=$.length;le<Hn;le++){var yr=$[le];if(bt.indexOf(yr)!==-1){var br=encodeURIComponent(yr);br===yr&&(br=escape(yr)),bt=bt.split(yr).join(br)}}var gi=bt.indexOf("#");gi!==-1&&(this.hash=bt.substr(gi),bt=bt.slice(0,gi));var hr=bt.indexOf("?");if(hr!==-1?(this.search=bt.substr(hr),this.query=bt.substr(hr+1),et&&(this.query=ht.parse(this.query)),bt=bt.slice(0,hr)):et&&(this.search="",this.query={}),bt&&(this.pathname=bt),Y[rt]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){Rr=this.pathname||"";var Or=this.search||"";this.path=Rr+Or}return this.href=this.format(),this},lt.prototype.format=function(){var Q=this.auth||"";Q&&(Q=(Q=encodeURIComponent(Q)).replace(/%3A/i,":"),Q+="@");var et=this.protocol||"",ft=this.pathname||"",ae=this.hash||"",Oe=!1,ne="";this.host?Oe=Q+this.host:this.hostname&&(Oe=Q+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(Oe+=":"+this.port)),this.query&&pt.isObject(this.query)&&Object.keys(this.query).length&&(ne=ht.stringify(this.query));var bt=this.search||ne&&"?"+ne||"";return et&&et.substr(-1)!==":"&&(et+=":"),this.slashes||(!et||Y[et])&&Oe!==!1?(Oe="//"+(Oe||""),ft&&ft.charAt(0)!=="/"&&(ft="/"+ft)):Oe||(Oe=""),ae&&ae.charAt(0)!=="#"&&(ae="#"+ae),bt&&bt.charAt(0)!=="?"&&(bt="?"+bt),et+Oe+(ft=ft.replace(/[?#]/g,function(Jt){return encodeURIComponent(Jt)}))+(bt=bt.replace("#","%23"))+ae},lt.prototype.resolve=function(Q){return this.resolveObject(B(Q,!1,!0)).format()},lt.prototype.resolveObject=function(Q){if(pt.isString(Q)){var et=new lt;et.parse(Q,!1,!0),Q=et}for(var ft=new lt,ae=Object.keys(this),Oe=0;Oe<ae.length;Oe++){var ne=ae[Oe];ft[ne]=this[ne]}if(ft.hash=Q.hash,Q.href==="")return ft.href=ft.format(),ft;if(Q.slashes&&!Q.protocol){for(var bt=Object.keys(Q),Jt=0;Jt<bt.length;Jt++){var Kt=bt[Jt];Kt!=="protocol"&&(ft[Kt]=Q[Kt])}return Y[ft.protocol]&&ft.hostname&&!ft.pathname&&(ft.path=ft.pathname="/"),ft.href=ft.format(),ft}if(Q.protocol&&Q.protocol!==ft.protocol){if(!Y[Q.protocol]){for(var rt=Object.keys(Q),Ut=0;Ut<rt.length;Ut++){var Wt=rt[Ut];ft[Wt]=Q[Wt]}return ft.href=ft.format(),ft}if(ft.protocol=Q.protocol,Q.host||k[Q.protocol])ft.pathname=Q.pathname;else{for(var te=(Q.pathname||"").split("/");te.length&&!(Q.host=te.shift()););Q.host||(Q.host=""),Q.hostname||(Q.hostname=""),te[0]!==""&&te.unshift(""),te.length<2&&te.unshift(""),ft.pathname=te.join("/")}if(ft.search=Q.search,ft.query=Q.query,ft.host=Q.host||"",ft.auth=Q.auth,ft.hostname=Q.hostname||Q.host,ft.port=Q.port,ft.pathname||ft.search){var Xt=ft.pathname||"",le=ft.search||"";ft.path=Xt+le}return ft.slashes=ft.slashes||Q.slashes,ft.href=ft.format(),ft}var fe=ft.pathname&&ft.pathname.charAt(0)==="/",Ye=Q.host||Q.pathname&&Q.pathname.charAt(0)==="/",ke=Ye||fe||ft.host&&Q.pathname,Hn=ke,Ke=ft.pathname&&ft.pathname.split("/")||[],Ln=(te=Q.pathname&&Q.pathname.split("/")||[],ft.protocol&&!Y[ft.protocol]);if(Ln&&(ft.hostname="",ft.port=null,ft.host&&(Ke[0]===""?Ke[0]=ft.host:Ke.unshift(ft.host)),ft.host="",Q.protocol&&(Q.hostname=null,Q.port=null,Q.host&&(te[0]===""?te[0]=Q.host:te.unshift(Q.host)),Q.host=null),ke=ke&&(te[0]===""||Ke[0]==="")),Ye)ft.host=Q.host||Q.host===""?Q.host:ft.host,ft.hostname=Q.hostname||Q.hostname===""?Q.hostname:ft.hostname,ft.search=Q.search,ft.query=Q.query,Ke=te;else if(te.length)Ke||(Ke=[]),Ke.pop(),Ke=Ke.concat(te),ft.search=Q.search,ft.query=Q.query;else if(!pt.isNullOrUndefined(Q.search))return Ln&&(ft.hostname=ft.host=Ke.shift(),(Ur=!!(ft.host&&ft.host.indexOf("@")>0)&&ft.host.split("@"))&&(ft.auth=Ur.shift(),ft.host=ft.hostname=Ur.shift())),ft.search=Q.search,ft.query=Q.query,pt.isNull(ft.pathname)&&pt.isNull(ft.search)||(ft.path=(ft.pathname?ft.pathname:"")+(ft.search?ft.search:"")),ft.href=ft.format(),ft;if(!Ke.length)return ft.pathname=null,ft.search?ft.path="/"+ft.search:ft.path=null,ft.href=ft.format(),ft;for(var Bn=Ke.slice(-1)[0],Wn=(ft.host||Q.host||Ke.length>1)&&(Bn==="."||Bn==="..")||Bn==="",vn=0,Pr=Ke.length;Pr>=0;Pr--)(Bn=Ke[Pr])==="."?Ke.splice(Pr,1):Bn===".."?(Ke.splice(Pr,1),vn++):vn&&(Ke.splice(Pr,1),vn--);if(!ke&&!Hn)for(;vn--;vn)Ke.unshift("..");!ke||Ke[0]===""||Ke[0]&&Ke[0].charAt(0)==="/"||Ke.unshift(""),Wn&&Ke.join("/").substr(-1)!=="/"&&Ke.push("");var Ur,Rr=Ke[0]===""||Ke[0]&&Ke[0].charAt(0)==="/";return Ln&&(ft.hostname=ft.host=Rr?"":Ke.length?Ke.shift():"",(Ur=!!(ft.host&&ft.host.indexOf("@")>0)&&ft.host.split("@"))&&(ft.auth=Ur.shift(),ft.host=ft.hostname=Ur.shift())),(ke=ke||ft.host&&Ke.length)&&!Rr&&Ke.unshift(""),Ke.length?ft.pathname=Ke.join("/"):(ft.pathname=null,ft.path=null),pt.isNull(ft.pathname)&&pt.isNull(ft.search)||(ft.path=(ft.pathname?ft.pathname:"")+(ft.search?ft.search:"")),ft.auth=Q.auth||ft.auth,ft.slashes=ft.slashes||Q.slashes,ft.href=ft.format(),ft},lt.prototype.parseHost=function(){var Q=this.host,et=X.exec(Q);et&&((et=et[0])!==":"&&(this.port=et.substr(1)),Q=Q.substr(0,Q.length-et.length)),Q&&(this.hostname=Q)}},function(N,w,S){(function(W){N.exports=function pt(lt,J,X){function ct(ut,kt){if(!J[ut]){if(!lt[ut]){if(tt)return tt(ut,!0);var Gt=new Error("Cannot find module '"+ut+"'");throw Gt.code="MODULE_NOT_FOUND",Gt}var zt=J[ut]={exports:{}};lt[ut][0].call(zt.exports,function(L){var k=lt[ut][1][L];return ct(k||L)},zt,zt.exports,pt,lt,J,X)}return J[ut].exports}for(var tt=!1,$=0;$<X.length;$++)ct(X[$]);return ct}({1:[function(pt,lt,J){(function(X){var ct,tt,$=X.MutationObserver||X.WebKitMutationObserver;if($){var ut=0,kt=new $(k),Gt=X.document.createTextNode("");kt.observe(Gt,{characterData:!0}),ct=function(){Gt.data=ut=++ut%2}}else if(X.setImmediate||X.MessageChannel===void 0)ct="document"in X&&"onreadystatechange"in X.document.createElement("script")?function(){var Y=X.document.createElement("script");Y.onreadystatechange=function(){k(),Y.onreadystatechange=null,Y.parentNode.removeChild(Y),Y=null},X.document.documentElement.appendChild(Y)}:function(){setTimeout(k,0)};else{var zt=new X.MessageChannel;zt.port1.onmessage=k,ct=function(){zt.port2.postMessage(0)}}var L=[];function k(){var Y,ht;tt=!0;for(var B=L.length;B;){for(ht=L,L=[],Y=-1;++Y<B;)ht[Y]();B=L.length}tt=!1}lt.exports=function(Y){L.push(Y)!==1||tt||ct()}}).call(this,W!==void 0?W:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(pt,lt,J){var X=pt(1);function ct(){}var tt={},$=["REJECTED"],ut=["FULFILLED"],kt=["PENDING"];function Gt(B){if(typeof B!="function")throw new TypeError("resolver must be a function");this.state=kt,this.queue=[],this.outcome=void 0,B!==ct&&Y(this,B)}function zt(B,Q,et){this.promise=B,typeof Q=="function"&&(this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled),typeof et=="function"&&(this.onRejected=et,this.callRejected=this.otherCallRejected)}function L(B,Q,et){X(function(){var ft;try{ft=Q(et)}catch(ae){return tt.reject(B,ae)}ft===B?tt.reject(B,new TypeError("Cannot resolve promise with itself")):tt.resolve(B,ft)})}function k(B){var Q=B&&B.then;if(B&&(typeof B=="object"||typeof B=="function")&&typeof Q=="function")return function(){Q.apply(B,arguments)}}function Y(B,Q){var et=!1;function ft(ne){et||(et=!0,tt.reject(B,ne))}function ae(ne){et||(et=!0,tt.resolve(B,ne))}var Oe=ht(function(){Q(ae,ft)});Oe.status==="error"&&ft(Oe.value)}function ht(B,Q){var et={};try{et.value=B(Q),et.status="success"}catch(ft){et.status="error",et.value=ft}return et}lt.exports=Gt,Gt.prototype.catch=function(B){return this.then(null,B)},Gt.prototype.then=function(B,Q){if(typeof B!="function"&&this.state===ut||typeof Q!="function"&&this.state===$)return this;var et=new this.constructor(ct);return this.state!==kt?L(et,this.state===ut?B:Q,this.outcome):this.queue.push(new zt(et,B,Q)),et},zt.prototype.callFulfilled=function(B){tt.resolve(this.promise,B)},zt.prototype.otherCallFulfilled=function(B){L(this.promise,this.onFulfilled,B)},zt.prototype.callRejected=function(B){tt.reject(this.promise,B)},zt.prototype.otherCallRejected=function(B){L(this.promise,this.onRejected,B)},tt.resolve=function(B,Q){var et=ht(k,Q);if(et.status==="error")return tt.reject(B,et.value);var ft=et.value;if(ft)Y(B,ft);else{B.state=ut,B.outcome=Q;for(var ae=-1,Oe=B.queue.length;++ae<Oe;)B.queue[ae].callFulfilled(Q)}return B},tt.reject=function(B,Q){B.state=$,B.outcome=Q;for(var et=-1,ft=B.queue.length;++et<ft;)B.queue[et].callRejected(Q);return B},Gt.resolve=function(B){return B instanceof this?B:tt.resolve(new this(ct),B)},Gt.reject=function(B){var Q=new this(ct);return tt.reject(Q,B)},Gt.all=function(B){var Q=this;if(Object.prototype.toString.call(B)!=="[object Array]")return this.reject(new TypeError("must be an array"));var et=B.length,ft=!1;if(!et)return this.resolve([]);for(var ae=new Array(et),Oe=0,ne=-1,bt=new this(ct);++ne<et;)Jt(B[ne],ne);return bt;function Jt(Kt,rt){Q.resolve(Kt).then(function(Ut){ae[rt]=Ut,++Oe!==et||ft||(ft=!0,tt.resolve(bt,ae))},function(Ut){ft||(ft=!0,tt.reject(bt,Ut))})}},Gt.race=function(B){var Q=this;if(Object.prototype.toString.call(B)!=="[object Array]")return this.reject(new TypeError("must be an array"));var et=B.length,ft=!1;if(!et)return this.resolve([]);for(var ae,Oe=-1,ne=new this(ct);++Oe<et;)ae=B[Oe],Q.resolve(ae).then(function(bt){ft||(ft=!0,tt.resolve(ne,bt))},function(bt){ft||(ft=!0,tt.reject(ne,bt))});return ne}},{1:1}],3:[function(pt,lt,J){(function(X){typeof X.Promise!="function"&&(X.Promise=pt(2))}).call(this,W!==void 0?W:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(pt,lt,J){var X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(I){return typeof I}:function(I){return I&&typeof Symbol=="function"&&I.constructor===Symbol&&I!==Symbol.prototype?"symbol":typeof I},ct=function(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch{return}}();function tt(I,z){I=I||[],z=z||{};try{return new Blob(I,z)}catch(nt){if(nt.name!=="TypeError")throw nt;for(var H=new(typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder),at=0;at<I.length;at+=1)H.append(I[at]);return H.getBlob(z.type)}}typeof Promise=="undefined"&&pt(3);var $=Promise;function ut(I,z){z&&I.then(function(H){z(null,H)},function(H){z(H)})}function kt(I,z,H){typeof z=="function"&&I.then(z),typeof H=="function"&&I.catch(H)}function Gt(I){return typeof I!="string"&&(console.warn(I+" used as a key, but it is not a string."),I=String(I)),I}function zt(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var L=void 0,k={},Y=Object.prototype.toString;function ht(I){return typeof L=="boolean"?$.resolve(L):function(z){return new $(function(H){var at=z.transaction("local-forage-detect-blob-support","readwrite"),nt=tt([""]);at.objectStore("local-forage-detect-blob-support").put(nt,"key"),at.onabort=function(it){it.preventDefault(),it.stopPropagation(),H(!1)},at.oncomplete=function(){var it=navigator.userAgent.match(/Chrome\/(\d+)/),yt=navigator.userAgent.match(/Edge\//);H(yt||!it||parseInt(it[1],10)>=43)}}).catch(function(){return!1})}(I).then(function(z){return L=z})}function B(I){var z=k[I.name],H={};H.promise=new $(function(at,nt){H.resolve=at,H.reject=nt}),z.deferredOperations.push(H),z.dbReady?z.dbReady=z.dbReady.then(function(){return H.promise}):z.dbReady=H.promise}function Q(I){var z=k[I.name].deferredOperations.pop();if(z)return z.resolve(),z.promise}function et(I,z){var H=k[I.name].deferredOperations.pop();if(H)return H.reject(z),H.promise}function ft(I,z){return new $(function(H,at){if(k[I.name]=k[I.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},I.db){if(!z)return H(I.db);B(I),I.db.close()}var nt=[I.name];z&&nt.push(I.version);var it=ct.open.apply(ct,nt);z&&(it.onupgradeneeded=function(yt){var St=it.result;try{St.createObjectStore(I.storeName),yt.oldVersion<=1&&St.createObjectStore("local-forage-detect-blob-support")}catch(Ct){if(Ct.name!=="ConstraintError")throw Ct;console.warn('The database "'+I.name+'" has been upgraded from version '+yt.oldVersion+" to version "+yt.newVersion+', but the storage "'+I.storeName+'" already exists.')}}),it.onerror=function(yt){yt.preventDefault(),at(it.error)},it.onsuccess=function(){var yt=it.result;yt.onversionchange=function(St){St.target.close()},H(yt),Q(I)}})}function ae(I){return ft(I,!1)}function Oe(I){return ft(I,!0)}function ne(I,z){if(!I.db)return!0;var H=!I.db.objectStoreNames.contains(I.storeName),at=I.version<I.db.version,nt=I.version>I.db.version;if(at&&(I.version!==z&&console.warn('The database "'+I.name+`" can't be downgraded from version `+I.db.version+" to version "+I.version+"."),I.version=I.db.version),nt||H){if(H){var it=I.db.version+1;it>I.version&&(I.version=it)}return!0}return!1}function bt(I){return tt([function(z){for(var H=z.length,at=new ArrayBuffer(H),nt=new Uint8Array(at),it=0;it<H;it++)nt[it]=z.charCodeAt(it);return at}(atob(I.data))],{type:I.type})}function Jt(I){return I&&I.__local_forage_encoded_blob}function Kt(I){var z=this,H=z._initReady().then(function(){var at=k[z._dbInfo.name];if(at&&at.dbReady)return at.dbReady});return kt(H,I,I),H}function rt(I,z,H,at){at===void 0&&(at=1);try{var nt=I.db.transaction(I.storeName,z);H(null,nt)}catch(it){if(at>0&&(!I.db||it.name==="InvalidStateError"||it.name==="NotFoundError"))return $.resolve().then(function(){if(!I.db||it.name==="NotFoundError"&&!I.db.objectStoreNames.contains(I.storeName)&&I.version<=I.db.version)return I.db&&(I.version=I.db.version+1),Oe(I)}).then(function(){return function(yt){B(yt);for(var St=k[yt.name],Ct=St.forages,wt=0;wt<Ct.length;wt++){var Vt=Ct[wt];Vt._dbInfo.db&&(Vt._dbInfo.db.close(),Vt._dbInfo.db=null)}return yt.db=null,ae(yt).then(function(Bt){return yt.db=Bt,ne(yt)?Oe(yt):Bt}).then(function(Bt){yt.db=St.db=Bt;for(var Le=0;Le<Ct.length;Le++)Ct[Le]._dbInfo.db=Bt}).catch(function(Bt){throw et(yt,Bt),Bt})}(I).then(function(){rt(I,z,H,at-1)})}).catch(H);H(it)}}var Ut={_driver:"asyncStorage",_initStorage:function(I){var z=this,H={db:null};if(I)for(var at in I)H[at]=I[at];var nt=k[H.name];nt||(nt={forages:[],db:null,dbReady:null,deferredOperations:[]},k[H.name]=nt),nt.forages.push(z),z._initReady||(z._initReady=z.ready,z.ready=Kt);var it=[];function yt(){return $.resolve()}for(var St=0;St<nt.forages.length;St++){var Ct=nt.forages[St];Ct!==z&&it.push(Ct._initReady().catch(yt))}var wt=nt.forages.slice(0);return $.all(it).then(function(){return H.db=nt.db,ae(H)}).then(function(Vt){return H.db=Vt,ne(H,z._defaultConfig.version)?Oe(H):Vt}).then(function(Vt){H.db=nt.db=Vt,z._dbInfo=H;for(var Bt=0;Bt<wt.length;Bt++){var Le=wt[Bt];Le!==z&&(Le._dbInfo.db=H.db,Le._dbInfo.version=H.version)}})},_support:function(){try{if(!ct||!ct.open)return!1;var I=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),z=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!I||z)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch{return!1}}(),iterate:function(I,z){var H=this,at=new $(function(nt,it){H.ready().then(function(){rt(H._dbInfo,"readonly",function(yt,St){if(yt)return it(yt);try{var Ct=St.objectStore(H._dbInfo.storeName).openCursor(),wt=1;Ct.onsuccess=function(){var Vt=Ct.result;if(Vt){var Bt=Vt.value;Jt(Bt)&&(Bt=bt(Bt));var Le=I(Bt,Vt.key,wt++);Le!==void 0?nt(Le):Vt.continue()}else nt()},Ct.onerror=function(){it(Ct.error)}}catch(Vt){it(Vt)}})}).catch(it)});return ut(at,z),at},getItem:function(I,z){var H=this;I=Gt(I);var at=new $(function(nt,it){H.ready().then(function(){rt(H._dbInfo,"readonly",function(yt,St){if(yt)return it(yt);try{var Ct=St.objectStore(H._dbInfo.storeName).get(I);Ct.onsuccess=function(){var wt=Ct.result;wt===void 0&&(wt=null),Jt(wt)&&(wt=bt(wt)),nt(wt)},Ct.onerror=function(){it(Ct.error)}}catch(wt){it(wt)}})}).catch(it)});return ut(at,z),at},setItem:function(I,z,H){var at=this;I=Gt(I);var nt=new $(function(it,yt){var St;at.ready().then(function(){return St=at._dbInfo,Y.call(z)==="[object Blob]"?ht(St.db).then(function(Ct){return Ct?z:(wt=z,new $(function(Vt,Bt){var Le=new FileReader;Le.onerror=Bt,Le.onloadend=function(an){var Qe=btoa(an.target.result||"");Vt({__local_forage_encoded_blob:!0,data:Qe,type:wt.type})},Le.readAsBinaryString(wt)}));var wt}):z}).then(function(Ct){rt(at._dbInfo,"readwrite",function(wt,Vt){if(wt)return yt(wt);try{var Bt=Vt.objectStore(at._dbInfo.storeName);Ct===null&&(Ct=void 0);var Le=Bt.put(Ct,I);Vt.oncomplete=function(){Ct===void 0&&(Ct=null),it(Ct)},Vt.onabort=Vt.onerror=function(){var an=Le.error?Le.error:Le.transaction.error;yt(an)}}catch(an){yt(an)}})}).catch(yt)});return ut(nt,H),nt},removeItem:function(I,z){var H=this;I=Gt(I);var at=new $(function(nt,it){H.ready().then(function(){rt(H._dbInfo,"readwrite",function(yt,St){if(yt)return it(yt);try{var Ct=St.objectStore(H._dbInfo.storeName).delete(I);St.oncomplete=function(){nt()},St.onerror=function(){it(Ct.error)},St.onabort=function(){var wt=Ct.error?Ct.error:Ct.transaction.error;it(wt)}}catch(wt){it(wt)}})}).catch(it)});return ut(at,z),at},clear:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){rt(z._dbInfo,"readwrite",function(it,yt){if(it)return nt(it);try{var St=yt.objectStore(z._dbInfo.storeName).clear();yt.oncomplete=function(){at()},yt.onabort=yt.onerror=function(){var Ct=St.error?St.error:St.transaction.error;nt(Ct)}}catch(Ct){nt(Ct)}})}).catch(nt)});return ut(H,I),H},length:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){rt(z._dbInfo,"readonly",function(it,yt){if(it)return nt(it);try{var St=yt.objectStore(z._dbInfo.storeName).count();St.onsuccess=function(){at(St.result)},St.onerror=function(){nt(St.error)}}catch(Ct){nt(Ct)}})}).catch(nt)});return ut(H,I),H},key:function(I,z){var H=this,at=new $(function(nt,it){I<0?nt(null):H.ready().then(function(){rt(H._dbInfo,"readonly",function(yt,St){if(yt)return it(yt);try{var Ct=St.objectStore(H._dbInfo.storeName),wt=!1,Vt=Ct.openKeyCursor();Vt.onsuccess=function(){var Bt=Vt.result;Bt?I===0||wt?nt(Bt.key):(wt=!0,Bt.advance(I)):nt(null)},Vt.onerror=function(){it(Vt.error)}}catch(Bt){it(Bt)}})}).catch(it)});return ut(at,z),at},keys:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){rt(z._dbInfo,"readonly",function(it,yt){if(it)return nt(it);try{var St=yt.objectStore(z._dbInfo.storeName).openKeyCursor(),Ct=[];St.onsuccess=function(){var wt=St.result;wt?(Ct.push(wt.key),wt.continue()):at(Ct)},St.onerror=function(){nt(St.error)}}catch(wt){nt(wt)}})}).catch(nt)});return ut(H,I),H},dropInstance:function(I,z){z=zt.apply(this,arguments);var H=this.config();(I=typeof I!="function"&&I||{}).name||(I.name=I.name||H.name,I.storeName=I.storeName||H.storeName);var at,nt=this;if(I.name){var it=I.name===H.name&&nt._dbInfo.db,yt=it?$.resolve(nt._dbInfo.db):ae(I).then(function(St){var Ct=k[I.name],wt=Ct.forages;Ct.db=St;for(var Vt=0;Vt<wt.length;Vt++)wt[Vt]._dbInfo.db=St;return St});at=I.storeName?yt.then(function(St){if(St.objectStoreNames.contains(I.storeName)){var Ct=St.version+1;B(I);var wt=k[I.name],Vt=wt.forages;St.close();for(var Bt=0;Bt<Vt.length;Bt++){var Le=Vt[Bt];Le._dbInfo.db=null,Le._dbInfo.version=Ct}return new $(function(an,Qe){var Qn=ct.open(I.name,Ct);Qn.onerror=function(vi){Qn.result.close(),Qe(vi)},Qn.onupgradeneeded=function(){Qn.result.deleteObjectStore(I.storeName)},Qn.onsuccess=function(){var vi=Qn.result;vi.close(),an(vi)}}).then(function(an){wt.db=an;for(var Qe=0;Qe<Vt.length;Qe++){var Qn=Vt[Qe];Qn._dbInfo.db=an,Q(Qn._dbInfo)}}).catch(function(an){throw(et(I,an)||$.resolve()).catch(function(){}),an})}}):yt.then(function(St){B(I);var Ct=k[I.name],wt=Ct.forages;St.close();for(var Vt=0;Vt<wt.length;Vt++)wt[Vt]._dbInfo.db=null;return new $(function(Bt,Le){var an=ct.deleteDatabase(I.name);an.onerror=function(){var Qe=an.result;Qe&&Qe.close(),Le(an.error)},an.onblocked=function(){console.warn('dropInstance blocked for database "'+I.name+'" until all open connections are closed')},an.onsuccess=function(){var Qe=an.result;Qe&&Qe.close(),Bt(Qe)}}).then(function(Bt){Ct.db=Bt;for(var Le=0;Le<wt.length;Le++)Q(wt[Le]._dbInfo)}).catch(function(Bt){throw(et(I,Bt)||$.resolve()).catch(function(){}),Bt})})}else at=$.reject("Invalid arguments");return ut(at,z),at}},Wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",te=/^~~local_forage_type~([^~]+)~/,Xt="__lfsc__:".length,le=Xt+"arbf".length,fe=Object.prototype.toString;function Ye(I){var z,H,at,nt,it,yt=.75*I.length,St=I.length,Ct=0;I[I.length-1]==="="&&(yt--,I[I.length-2]==="="&&yt--);var wt=new ArrayBuffer(yt),Vt=new Uint8Array(wt);for(z=0;z<St;z+=4)H=Wt.indexOf(I[z]),at=Wt.indexOf(I[z+1]),nt=Wt.indexOf(I[z+2]),it=Wt.indexOf(I[z+3]),Vt[Ct++]=H<<2|at>>4,Vt[Ct++]=(15&at)<<4|nt>>2,Vt[Ct++]=(3&nt)<<6|63&it;return wt}function ke(I){var z,H=new Uint8Array(I),at="";for(z=0;z<H.length;z+=3)at+=Wt[H[z]>>2],at+=Wt[(3&H[z])<<4|H[z+1]>>4],at+=Wt[(15&H[z+1])<<2|H[z+2]>>6],at+=Wt[63&H[z+2]];return H.length%3==2?at=at.substring(0,at.length-1)+"=":H.length%3==1&&(at=at.substring(0,at.length-2)+"=="),at}var Hn={serialize:function(I,z){var H="";if(I&&(H=fe.call(I)),I&&(H==="[object ArrayBuffer]"||I.buffer&&fe.call(I.buffer)==="[object ArrayBuffer]")){var at,nt="__lfsc__:";I instanceof ArrayBuffer?(at=I,nt+="arbf"):(at=I.buffer,H==="[object Int8Array]"?nt+="si08":H==="[object Uint8Array]"?nt+="ui08":H==="[object Uint8ClampedArray]"?nt+="uic8":H==="[object Int16Array]"?nt+="si16":H==="[object Uint16Array]"?nt+="ur16":H==="[object Int32Array]"?nt+="si32":H==="[object Uint32Array]"?nt+="ui32":H==="[object Float32Array]"?nt+="fl32":H==="[object Float64Array]"?nt+="fl64":z(new Error("Failed to get type for BinaryArray"))),z(nt+ke(at))}else if(H==="[object Blob]"){var it=new FileReader;it.onload=function(){var yt="~~local_forage_type~"+I.type+"~"+ke(this.result);z("__lfsc__:blob"+yt)},it.readAsArrayBuffer(I)}else try{z(JSON.stringify(I))}catch(yt){console.error("Couldn't convert value into a JSON string: ",I),z(null,yt)}},deserialize:function(I){if(I.substring(0,Xt)!=="__lfsc__:")return JSON.parse(I);var z,H=I.substring(le),at=I.substring(Xt,le);if(at==="blob"&&te.test(H)){var nt=H.match(te);z=nt[1],H=H.substring(nt[0].length)}var it=Ye(H);switch(at){case"arbf":return it;case"blob":return tt([it],{type:z});case"si08":return new Int8Array(it);case"ui08":return new Uint8Array(it);case"uic8":return new Uint8ClampedArray(it);case"si16":return new Int16Array(it);case"ur16":return new Uint16Array(it);case"si32":return new Int32Array(it);case"ui32":return new Uint32Array(it);case"fl32":return new Float32Array(it);case"fl64":return new Float64Array(it);default:throw new Error("Unkown type: "+at)}},stringToBuffer:Ye,bufferToString:ke};function Ke(I,z,H,at){I.executeSql("CREATE TABLE IF NOT EXISTS "+z.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],H,at)}function Ln(I,z,H,at,nt,it){I.executeSql(H,at,nt,function(yt,St){St.code===St.SYNTAX_ERR?yt.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[z.storeName],function(Ct,wt){wt.rows.length?it(Ct,St):Ke(Ct,z,function(){Ct.executeSql(H,at,nt,it)},it)},it):it(yt,St)},it)}function Bn(I,z,H,at){var nt=this;I=Gt(I);var it=new $(function(yt,St){nt.ready().then(function(){z===void 0&&(z=null);var Ct=z,wt=nt._dbInfo;wt.serializer.serialize(z,function(Vt,Bt){Bt?St(Bt):wt.db.transaction(function(Le){Ln(Le,wt,"INSERT OR REPLACE INTO "+wt.storeName+" (key, value) VALUES (?, ?)",[I,Vt],function(){yt(Ct)},function(an,Qe){St(Qe)})},function(Le){if(Le.code===Le.QUOTA_ERR){if(at>0)return void yt(Bn.apply(nt,[I,Ct,H,at-1]));St(Le)}})})}).catch(St)});return ut(it,H),it}function Wn(I){return new $(function(z,H){I.transaction(function(at){at.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(nt,it){for(var yt=[],St=0;St<it.rows.length;St++)yt.push(it.rows.item(St).name);z({db:I,storeNames:yt})},function(nt,it){H(it)})},function(at){H(at)})})}var vn={_driver:"webSQLStorage",_initStorage:function(I){var z=this,H={db:null};if(I)for(var at in I)H[at]=typeof I[at]!="string"?I[at].toString():I[at];var nt=new $(function(it,yt){try{H.db=openDatabase(H.name,String(H.version),H.description,H.size)}catch(St){return yt(St)}H.db.transaction(function(St){Ke(St,H,function(){z._dbInfo=H,it()},function(Ct,wt){yt(wt)})},yt)});return H.serializer=Hn,nt},_support:typeof openDatabase=="function",iterate:function(I,z){var H=this,at=new $(function(nt,it){H.ready().then(function(){var yt=H._dbInfo;yt.db.transaction(function(St){Ln(St,yt,"SELECT * FROM "+yt.storeName,[],function(Ct,wt){for(var Vt=wt.rows,Bt=Vt.length,Le=0;Le<Bt;Le++){var an=Vt.item(Le),Qe=an.value;if(Qe&&(Qe=yt.serializer.deserialize(Qe)),(Qe=I(Qe,an.key,Le+1))!==void 0)return void nt(Qe)}nt()},function(Ct,wt){it(wt)})})}).catch(it)});return ut(at,z),at},getItem:function(I,z){var H=this;I=Gt(I);var at=new $(function(nt,it){H.ready().then(function(){var yt=H._dbInfo;yt.db.transaction(function(St){Ln(St,yt,"SELECT * FROM "+yt.storeName+" WHERE key = ? LIMIT 1",[I],function(Ct,wt){var Vt=wt.rows.length?wt.rows.item(0).value:null;Vt&&(Vt=yt.serializer.deserialize(Vt)),nt(Vt)},function(Ct,wt){it(wt)})})}).catch(it)});return ut(at,z),at},setItem:function(I,z,H){return Bn.apply(this,[I,z,H,1])},removeItem:function(I,z){var H=this;I=Gt(I);var at=new $(function(nt,it){H.ready().then(function(){var yt=H._dbInfo;yt.db.transaction(function(St){Ln(St,yt,"DELETE FROM "+yt.storeName+" WHERE key = ?",[I],function(){nt()},function(Ct,wt){it(wt)})})}).catch(it)});return ut(at,z),at},clear:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){var it=z._dbInfo;it.db.transaction(function(yt){Ln(yt,it,"DELETE FROM "+it.storeName,[],function(){at()},function(St,Ct){nt(Ct)})})}).catch(nt)});return ut(H,I),H},length:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){var it=z._dbInfo;it.db.transaction(function(yt){Ln(yt,it,"SELECT COUNT(key) as c FROM "+it.storeName,[],function(St,Ct){var wt=Ct.rows.item(0).c;at(wt)},function(St,Ct){nt(Ct)})})}).catch(nt)});return ut(H,I),H},key:function(I,z){var H=this,at=new $(function(nt,it){H.ready().then(function(){var yt=H._dbInfo;yt.db.transaction(function(St){Ln(St,yt,"SELECT key FROM "+yt.storeName+" WHERE id = ? LIMIT 1",[I+1],function(Ct,wt){var Vt=wt.rows.length?wt.rows.item(0).key:null;nt(Vt)},function(Ct,wt){it(wt)})})}).catch(it)});return ut(at,z),at},keys:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){var it=z._dbInfo;it.db.transaction(function(yt){Ln(yt,it,"SELECT key FROM "+it.storeName,[],function(St,Ct){for(var wt=[],Vt=0;Vt<Ct.rows.length;Vt++)wt.push(Ct.rows.item(Vt).key);at(wt)},function(St,Ct){nt(Ct)})})}).catch(nt)});return ut(H,I),H},dropInstance:function(I,z){z=zt.apply(this,arguments);var H=this.config();(I=typeof I!="function"&&I||{}).name||(I.name=I.name||H.name,I.storeName=I.storeName||H.storeName);var at,nt=this;return ut(at=I.name?new $(function(it){var yt;yt=I.name===H.name?nt._dbInfo.db:openDatabase(I.name,"","",0),I.storeName?it({db:yt,storeNames:[I.storeName]}):it(Wn(yt))}).then(function(it){return new $(function(yt,St){it.db.transaction(function(Ct){function wt(an){return new $(function(Qe,Qn){Ct.executeSql("DROP TABLE IF EXISTS "+an,[],function(){Qe()},function(vi,Yr){Qn(Yr)})})}for(var Vt=[],Bt=0,Le=it.storeNames.length;Bt<Le;Bt++)Vt.push(wt(it.storeNames[Bt]));$.all(Vt).then(function(){yt()}).catch(function(an){St(an)})},function(Ct){St(Ct)})})}):$.reject("Invalid arguments"),z),at}};function Pr(I,z){var H=I.name+"/";return I.storeName!==z.storeName&&(H+=I.storeName+"/"),H}function Ur(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch{return!0}}()||localStorage.length>0}var Rr={_driver:"localStorageWrapper",_initStorage:function(I){var z={};if(I)for(var H in I)z[H]=I[H];return z.keyPrefix=Pr(I,this._defaultConfig),Ur()?(this._dbInfo=z,z.serializer=Hn,$.resolve()):$.reject()},_support:function(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:function(I,z){var H=this,at=H.ready().then(function(){for(var nt=H._dbInfo,it=nt.keyPrefix,yt=it.length,St=localStorage.length,Ct=1,wt=0;wt<St;wt++){var Vt=localStorage.key(wt);if(Vt.indexOf(it)===0){var Bt=localStorage.getItem(Vt);if(Bt&&(Bt=nt.serializer.deserialize(Bt)),(Bt=I(Bt,Vt.substring(yt),Ct++))!==void 0)return Bt}}});return ut(at,z),at},getItem:function(I,z){var H=this;I=Gt(I);var at=H.ready().then(function(){var nt=H._dbInfo,it=localStorage.getItem(nt.keyPrefix+I);return it&&(it=nt.serializer.deserialize(it)),it});return ut(at,z),at},setItem:function(I,z,H){var at=this;I=Gt(I);var nt=at.ready().then(function(){z===void 0&&(z=null);var it=z;return new $(function(yt,St){var Ct=at._dbInfo;Ct.serializer.serialize(z,function(wt,Vt){if(Vt)St(Vt);else try{localStorage.setItem(Ct.keyPrefix+I,wt),yt(it)}catch(Bt){Bt.name!=="QuotaExceededError"&&Bt.name!=="NS_ERROR_DOM_QUOTA_REACHED"||St(Bt),St(Bt)}})})});return ut(nt,H),nt},removeItem:function(I,z){var H=this;I=Gt(I);var at=H.ready().then(function(){var nt=H._dbInfo;localStorage.removeItem(nt.keyPrefix+I)});return ut(at,z),at},clear:function(I){var z=this,H=z.ready().then(function(){for(var at=z._dbInfo.keyPrefix,nt=localStorage.length-1;nt>=0;nt--){var it=localStorage.key(nt);it.indexOf(at)===0&&localStorage.removeItem(it)}});return ut(H,I),H},length:function(I){var z=this.keys().then(function(H){return H.length});return ut(z,I),z},key:function(I,z){var H=this,at=H.ready().then(function(){var nt,it=H._dbInfo;try{nt=localStorage.key(I)}catch{nt=null}return nt&&(nt=nt.substring(it.keyPrefix.length)),nt});return ut(at,z),at},keys:function(I){var z=this,H=z.ready().then(function(){for(var at=z._dbInfo,nt=localStorage.length,it=[],yt=0;yt<nt;yt++){var St=localStorage.key(yt);St.indexOf(at.keyPrefix)===0&&it.push(St.substring(at.keyPrefix.length))}return it});return ut(H,I),H},dropInstance:function(I,z){if(z=zt.apply(this,arguments),!(I=typeof I!="function"&&I||{}).name){var H=this.config();I.name=I.name||H.name,I.storeName=I.storeName||H.storeName}var at,nt=this;return ut(at=I.name?new $(function(it){I.storeName?it(Pr(I,nt._defaultConfig)):it(I.name+"/")}).then(function(it){for(var yt=localStorage.length-1;yt>=0;yt--){var St=localStorage.key(yt);St.indexOf(it)===0&&localStorage.removeItem(St)}}):$.reject("Invalid arguments"),z),at}},qr=function(I,z){for(var H,at,nt=I.length,it=0;it<nt;){if((H=I[it])===(at=z)||typeof H=="number"&&typeof at=="number"&&isNaN(H)&&isNaN(at))return!0;it++}return!1},yr=Array.isArray||function(I){return Object.prototype.toString.call(I)==="[object Array]"},br={},gi={},hr={INDEXEDDB:Ut,WEBSQL:vn,LOCALSTORAGE:Rr},Or=[hr.INDEXEDDB._driver,hr.WEBSQL._driver,hr.LOCALSTORAGE._driver],Jr=["dropInstance"],Oo=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Jr),On={description:"",driver:Or.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function $i(I,z){I[z]=function(){var H=arguments;return I.ready().then(function(){return I[z].apply(I,H)})}}function Pi(){for(var I=1;I<arguments.length;I++){var z=arguments[I];if(z)for(var H in z)z.hasOwnProperty(H)&&(yr(z[H])?arguments[0][H]=z[H].slice():arguments[0][H]=z[H])}return arguments[0]}var ao=new(function(){function I(z){for(var H in function(it,yt){if(!(it instanceof yt))throw new TypeError("Cannot call a class as a function")}(this,I),hr)if(hr.hasOwnProperty(H)){var at=hr[H],nt=at._driver;this[H]=nt,br[nt]||this.defineDriver(at)}this._defaultConfig=Pi({},On),this._config=Pi({},this._defaultConfig,z),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return I.prototype.config=function(z){if((z===void 0?"undefined":X(z))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var H in z){if(H==="storeName"&&(z[H]=z[H].replace(/\W/g,"_")),H==="version"&&typeof z[H]!="number")return new Error("Database version must be a number.");this._config[H]=z[H]}return!("driver"in z)||!z.driver||this.setDriver(this._config.driver)}return typeof z=="string"?this._config[z]:this._config},I.prototype.defineDriver=function(z,H,at){var nt=new $(function(it,yt){try{var St=z._driver,Ct=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!z._driver)return void yt(Ct);for(var wt=Oo.concat("_initStorage"),Vt=0,Bt=wt.length;Vt<Bt;Vt++){var Le=wt[Vt];if((!qr(Jr,Le)||z[Le])&&typeof z[Le]!="function")return void yt(Ct)}(function(){for(var Qe=function(Ks){return function(){var lo=new Error("Method "+Ks+" is not implemented by the current driver"),gs=$.reject(lo);return ut(gs,arguments[arguments.length-1]),gs}},Qn=0,vi=Jr.length;Qn<vi;Qn++){var Yr=Jr[Qn];z[Yr]||(z[Yr]=Qe(Yr))}})();var an=function(Qe){br[St]&&console.info("Redefining LocalForage driver: "+St),br[St]=z,gi[St]=Qe,it()};"_support"in z?z._support&&typeof z._support=="function"?z._support().then(an,yt):an(!!z._support):an(!0)}catch(Qe){yt(Qe)}});return kt(nt,H,at),nt},I.prototype.driver=function(){return this._driver||null},I.prototype.getDriver=function(z,H,at){var nt=br[z]?$.resolve(br[z]):$.reject(new Error("Driver not found."));return kt(nt,H,at),nt},I.prototype.getSerializer=function(z){var H=$.resolve(Hn);return kt(H,z),H},I.prototype.ready=function(z){var H=this,at=H._driverSet.then(function(){return H._ready===null&&(H._ready=H._initDriver()),H._ready});return kt(at,z,z),at},I.prototype.setDriver=function(z,H,at){var nt=this;yr(z)||(z=[z]);var it=this._getSupportedDrivers(z);function yt(){nt._config.driver=nt.driver()}function St(wt){return nt._extend(wt),yt(),nt._ready=nt._initStorage(nt._config),nt._ready}var Ct=this._driverSet!==null?this._driverSet.catch(function(){return $.resolve()}):$.resolve();return this._driverSet=Ct.then(function(){var wt=it[0];return nt._dbInfo=null,nt._ready=null,nt.getDriver(wt).then(function(Vt){nt._driver=Vt._driver,yt(),nt._wrapLibraryMethodsWithReady(),nt._initDriver=function(Bt){return function(){var Le=0;return function an(){for(;Le<Bt.length;){var Qe=Bt[Le];return Le++,nt._dbInfo=null,nt._ready=null,nt.getDriver(Qe).then(St).catch(an)}yt();var Qn=new Error("No available storage method found.");return nt._driverSet=$.reject(Qn),nt._driverSet}()}}(it)})}).catch(function(){yt();var wt=new Error("No available storage method found.");return nt._driverSet=$.reject(wt),nt._driverSet}),kt(this._driverSet,H,at),this._driverSet},I.prototype.supports=function(z){return!!gi[z]},I.prototype._extend=function(z){Pi(this,z)},I.prototype._getSupportedDrivers=function(z){for(var H=[],at=0,nt=z.length;at<nt;at++){var it=z[at];this.supports(it)&&H.push(it)}return H},I.prototype._wrapLibraryMethodsWithReady=function(){for(var z=0,H=Oo.length;z<H;z++)$i(this,Oo[z])},I.prototype.createInstance=function(z){return new I(z)},I}());lt.exports=ao},{3:3}]},{},[4])(4)}).call(this,S(4))},function(N,w,S){N.exports=function(W,pt){if(W){pt=pt||{};for(var lt={key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}},J=lt.parser[pt.strictMode?"strict":"loose"].exec(W),X={},ct=14;ct--;)X[lt.key[ct]]=J[ct]||"";return X[lt.q.name]={},X[lt.key[12]].replace(lt.q.parser,function(tt,$,ut){$&&(X[lt.q.name][$]=ut)}),X}}},function(N,w,S){var W=S(33);N.exports=function(pt,lt){lt=lt||{};var J=new W,X=lt.inPlace||!1,ct=pt.map(function($){return X?$:{width:$.width,height:$.height,item:$}});ct=ct.sort(function($,ut){return ut.width*ut.height-$.width*$.height}),J.fit(ct);var tt={width:ct.reduce(function($,ut){return Math.max($,ut.x+ut.width)},0),height:ct.reduce(function($,ut){return Math.max($,ut.y+ut.height)},0)};return X||(tt.items=ct),tt}},function(N,w,S){(function(W){N.exports=function pt(lt,J,X){function ct(ut,kt){if(!J[ut]){if(!lt[ut]){if(tt)return tt(ut,!0);var Gt=new Error("Cannot find module '"+ut+"'");throw Gt.code="MODULE_NOT_FOUND",Gt}var zt=J[ut]={exports:{}};lt[ut][0].call(zt.exports,function(L){var k=lt[ut][1][L];return ct(k||L)},zt,zt.exports,pt,lt,J,X)}return J[ut].exports}for(var tt=!1,$=0;$<X.length;$++)ct(X[$]);return ct}({1:[function(pt,lt,J){(function(X){var ct,tt,$=X.MutationObserver||X.WebKitMutationObserver;if($){var ut=0,kt=new $(k),Gt=X.document.createTextNode("");kt.observe(Gt,{characterData:!0}),ct=function(){Gt.data=ut=++ut%2}}else if(X.setImmediate||X.MessageChannel===void 0)ct="document"in X&&"onreadystatechange"in X.document.createElement("script")?function(){var Y=X.document.createElement("script");Y.onreadystatechange=function(){k(),Y.onreadystatechange=null,Y.parentNode.removeChild(Y),Y=null},X.document.documentElement.appendChild(Y)}:function(){setTimeout(k,0)};else{var zt=new X.MessageChannel;zt.port1.onmessage=k,ct=function(){zt.port2.postMessage(0)}}var L=[];function k(){var Y,ht;tt=!0;for(var B=L.length;B;){for(ht=L,L=[],Y=-1;++Y<B;)ht[Y]();B=L.length}tt=!1}lt.exports=function(Y){L.push(Y)!==1||tt||ct()}}).call(this,W!==void 0?W:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(pt,lt,J){var X=pt(1);function ct(){}var tt={},$=["REJECTED"],ut=["FULFILLED"],kt=["PENDING"];function Gt(B){if(typeof B!="function")throw new TypeError("resolver must be a function");this.state=kt,this.queue=[],this.outcome=void 0,B!==ct&&Y(this,B)}function zt(B,Q,et){this.promise=B,typeof Q=="function"&&(this.onFulfilled=Q,this.callFulfilled=this.otherCallFulfilled),typeof et=="function"&&(this.onRejected=et,this.callRejected=this.otherCallRejected)}function L(B,Q,et){X(function(){var ft;try{ft=Q(et)}catch(ae){return tt.reject(B,ae)}ft===B?tt.reject(B,new TypeError("Cannot resolve promise with itself")):tt.resolve(B,ft)})}function k(B){var Q=B&&B.then;if(B&&(typeof B=="object"||typeof B=="function")&&typeof Q=="function")return function(){Q.apply(B,arguments)}}function Y(B,Q){var et=!1;function ft(ne){et||(et=!0,tt.reject(B,ne))}function ae(ne){et||(et=!0,tt.resolve(B,ne))}var Oe=ht(function(){Q(ae,ft)});Oe.status==="error"&&ft(Oe.value)}function ht(B,Q){var et={};try{et.value=B(Q),et.status="success"}catch(ft){et.status="error",et.value=ft}return et}lt.exports=Gt,Gt.prototype.catch=function(B){return this.then(null,B)},Gt.prototype.then=function(B,Q){if(typeof B!="function"&&this.state===ut||typeof Q!="function"&&this.state===$)return this;var et=new this.constructor(ct);return this.state!==kt?L(et,this.state===ut?B:Q,this.outcome):this.queue.push(new zt(et,B,Q)),et},zt.prototype.callFulfilled=function(B){tt.resolve(this.promise,B)},zt.prototype.otherCallFulfilled=function(B){L(this.promise,this.onFulfilled,B)},zt.prototype.callRejected=function(B){tt.reject(this.promise,B)},zt.prototype.otherCallRejected=function(B){L(this.promise,this.onRejected,B)},tt.resolve=function(B,Q){var et=ht(k,Q);if(et.status==="error")return tt.reject(B,et.value);var ft=et.value;if(ft)Y(B,ft);else{B.state=ut,B.outcome=Q;for(var ae=-1,Oe=B.queue.length;++ae<Oe;)B.queue[ae].callFulfilled(Q)}return B},tt.reject=function(B,Q){B.state=$,B.outcome=Q;for(var et=-1,ft=B.queue.length;++et<ft;)B.queue[et].callRejected(Q);return B},Gt.resolve=function(B){return B instanceof this?B:tt.resolve(new this(ct),B)},Gt.reject=function(B){var Q=new this(ct);return tt.reject(Q,B)},Gt.all=function(B){var Q=this;if(Object.prototype.toString.call(B)!=="[object Array]")return this.reject(new TypeError("must be an array"));var et=B.length,ft=!1;if(!et)return this.resolve([]);for(var ae=new Array(et),Oe=0,ne=-1,bt=new this(ct);++ne<et;)Jt(B[ne],ne);return bt;function Jt(Kt,rt){Q.resolve(Kt).then(function(Ut){ae[rt]=Ut,++Oe!==et||ft||(ft=!0,tt.resolve(bt,ae))},function(Ut){ft||(ft=!0,tt.reject(bt,Ut))})}},Gt.race=function(B){var Q=this;if(Object.prototype.toString.call(B)!=="[object Array]")return this.reject(new TypeError("must be an array"));var et=B.length,ft=!1;if(!et)return this.resolve([]);for(var ae,Oe=-1,ne=new this(ct);++Oe<et;)ae=B[Oe],Q.resolve(ae).then(function(bt){ft||(ft=!0,tt.resolve(ne,bt))},function(bt){ft||(ft=!0,tt.reject(ne,bt))});return ne}},{1:1}],3:[function(pt,lt,J){(function(X){typeof X.Promise!="function"&&(X.Promise=pt(2))}).call(this,W!==void 0?W:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(pt,lt,J){var X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(I){return typeof I}:function(I){return I&&typeof Symbol=="function"&&I.constructor===Symbol&&I!==Symbol.prototype?"symbol":typeof I},ct=function(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch{return}}();function tt(I,z){I=I||[],z=z||{};try{return new Blob(I,z)}catch(nt){if(nt.name!=="TypeError")throw nt;for(var H=new(typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder),at=0;at<I.length;at+=1)H.append(I[at]);return H.getBlob(z.type)}}typeof Promise=="undefined"&&pt(3);var $=Promise;function ut(I,z){z&&I.then(function(H){z(null,H)},function(H){z(H)})}function kt(I,z,H){typeof z=="function"&&I.then(z),typeof H=="function"&&I.catch(H)}function Gt(I){return typeof I!="string"&&(console.warn(I+" used as a key, but it is not a string."),I=String(I)),I}function zt(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var L=void 0,k={},Y=Object.prototype.toString;function ht(I){return typeof L=="boolean"?$.resolve(L):function(z){return new $(function(H){var at=z.transaction("local-forage-detect-blob-support","readwrite"),nt=tt([""]);at.objectStore("local-forage-detect-blob-support").put(nt,"key"),at.onabort=function(it){it.preventDefault(),it.stopPropagation(),H(!1)},at.oncomplete=function(){var it=navigator.userAgent.match(/Chrome\/(\d+)/),yt=navigator.userAgent.match(/Edge\//);H(yt||!it||parseInt(it[1],10)>=43)}}).catch(function(){return!1})}(I).then(function(z){return L=z})}function B(I){var z=k[I.name],H={};H.promise=new $(function(at,nt){H.resolve=at,H.reject=nt}),z.deferredOperations.push(H),z.dbReady?z.dbReady=z.dbReady.then(function(){return H.promise}):z.dbReady=H.promise}function Q(I){var z=k[I.name].deferredOperations.pop();if(z)return z.resolve(),z.promise}function et(I,z){var H=k[I.name].deferredOperations.pop();if(H)return H.reject(z),H.promise}function ft(I,z){return new $(function(H,at){if(k[I.name]=k[I.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},I.db){if(!z)return H(I.db);B(I),I.db.close()}var nt=[I.name];z&&nt.push(I.version);var it=ct.open.apply(ct,nt);z&&(it.onupgradeneeded=function(yt){var St=it.result;try{St.createObjectStore(I.storeName),yt.oldVersion<=1&&St.createObjectStore("local-forage-detect-blob-support")}catch(Ct){if(Ct.name!=="ConstraintError")throw Ct;console.warn('The database "'+I.name+'" has been upgraded from version '+yt.oldVersion+" to version "+yt.newVersion+', but the storage "'+I.storeName+'" already exists.')}}),it.onerror=function(yt){yt.preventDefault(),at(it.error)},it.onsuccess=function(){H(it.result),Q(I)}})}function ae(I){return ft(I,!1)}function Oe(I){return ft(I,!0)}function ne(I,z){if(!I.db)return!0;var H=!I.db.objectStoreNames.contains(I.storeName),at=I.version<I.db.version,nt=I.version>I.db.version;if(at&&(I.version!==z&&console.warn('The database "'+I.name+`" can't be downgraded from version `+I.db.version+" to version "+I.version+"."),I.version=I.db.version),nt||H){if(H){var it=I.db.version+1;it>I.version&&(I.version=it)}return!0}return!1}function bt(I){return tt([function(z){for(var H=z.length,at=new ArrayBuffer(H),nt=new Uint8Array(at),it=0;it<H;it++)nt[it]=z.charCodeAt(it);return at}(atob(I.data))],{type:I.type})}function Jt(I){return I&&I.__local_forage_encoded_blob}function Kt(I){var z=this,H=z._initReady().then(function(){var at=k[z._dbInfo.name];if(at&&at.dbReady)return at.dbReady});return kt(H,I,I),H}function rt(I,z,H,at){at===void 0&&(at=1);try{var nt=I.db.transaction(I.storeName,z);H(null,nt)}catch(it){if(at>0&&(!I.db||it.name==="InvalidStateError"||it.name==="NotFoundError"))return $.resolve().then(function(){if(!I.db||it.name==="NotFoundError"&&!I.db.objectStoreNames.contains(I.storeName)&&I.version<=I.db.version)return I.db&&(I.version=I.db.version+1),Oe(I)}).then(function(){return function(yt){B(yt);for(var St=k[yt.name],Ct=St.forages,wt=0;wt<Ct.length;wt++){var Vt=Ct[wt];Vt._dbInfo.db&&(Vt._dbInfo.db.close(),Vt._dbInfo.db=null)}return yt.db=null,ae(yt).then(function(Bt){return yt.db=Bt,ne(yt)?Oe(yt):Bt}).then(function(Bt){yt.db=St.db=Bt;for(var Le=0;Le<Ct.length;Le++)Ct[Le]._dbInfo.db=Bt}).catch(function(Bt){throw et(yt,Bt),Bt})}(I).then(function(){rt(I,z,H,at-1)})}).catch(H);H(it)}}var Ut={_driver:"asyncStorage",_initStorage:function(I){var z=this,H={db:null};if(I)for(var at in I)H[at]=I[at];var nt=k[H.name];nt||(nt={forages:[],db:null,dbReady:null,deferredOperations:[]},k[H.name]=nt),nt.forages.push(z),z._initReady||(z._initReady=z.ready,z.ready=Kt);var it=[];function yt(){return $.resolve()}for(var St=0;St<nt.forages.length;St++){var Ct=nt.forages[St];Ct!==z&&it.push(Ct._initReady().catch(yt))}var wt=nt.forages.slice(0);return $.all(it).then(function(){return H.db=nt.db,ae(H)}).then(function(Vt){return H.db=Vt,ne(H,z._defaultConfig.version)?Oe(H):Vt}).then(function(Vt){H.db=nt.db=Vt,z._dbInfo=H;for(var Bt=0;Bt<wt.length;Bt++){var Le=wt[Bt];Le!==z&&(Le._dbInfo.db=H.db,Le._dbInfo.version=H.version)}})},_support:function(){try{if(!ct||!ct.open)return!1;var I=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),z=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!I||z)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch{return!1}}(),iterate:function(I,z){var H=this,at=new $(function(nt,it){H.ready().then(function(){rt(H._dbInfo,"readonly",function(yt,St){if(yt)return it(yt);try{var Ct=St.objectStore(H._dbInfo.storeName).openCursor(),wt=1;Ct.onsuccess=function(){var Vt=Ct.result;if(Vt){var Bt=Vt.value;Jt(Bt)&&(Bt=bt(Bt));var Le=I(Bt,Vt.key,wt++);Le!==void 0?nt(Le):Vt.continue()}else nt()},Ct.onerror=function(){it(Ct.error)}}catch(Vt){it(Vt)}})}).catch(it)});return ut(at,z),at},getItem:function(I,z){var H=this;I=Gt(I);var at=new $(function(nt,it){H.ready().then(function(){rt(H._dbInfo,"readonly",function(yt,St){if(yt)return it(yt);try{var Ct=St.objectStore(H._dbInfo.storeName).get(I);Ct.onsuccess=function(){var wt=Ct.result;wt===void 0&&(wt=null),Jt(wt)&&(wt=bt(wt)),nt(wt)},Ct.onerror=function(){it(Ct.error)}}catch(wt){it(wt)}})}).catch(it)});return ut(at,z),at},setItem:function(I,z,H){var at=this;I=Gt(I);var nt=new $(function(it,yt){var St;at.ready().then(function(){return St=at._dbInfo,Y.call(z)==="[object Blob]"?ht(St.db).then(function(Ct){return Ct?z:(wt=z,new $(function(Vt,Bt){var Le=new FileReader;Le.onerror=Bt,Le.onloadend=function(an){var Qe=btoa(an.target.result||"");Vt({__local_forage_encoded_blob:!0,data:Qe,type:wt.type})},Le.readAsBinaryString(wt)}));var wt}):z}).then(function(Ct){rt(at._dbInfo,"readwrite",function(wt,Vt){if(wt)return yt(wt);try{var Bt=Vt.objectStore(at._dbInfo.storeName);Ct===null&&(Ct=void 0);var Le=Bt.put(Ct,I);Vt.oncomplete=function(){Ct===void 0&&(Ct=null),it(Ct)},Vt.onabort=Vt.onerror=function(){var an=Le.error?Le.error:Le.transaction.error;yt(an)}}catch(an){yt(an)}})}).catch(yt)});return ut(nt,H),nt},removeItem:function(I,z){var H=this;I=Gt(I);var at=new $(function(nt,it){H.ready().then(function(){rt(H._dbInfo,"readwrite",function(yt,St){if(yt)return it(yt);try{var Ct=St.objectStore(H._dbInfo.storeName).delete(I);St.oncomplete=function(){nt()},St.onerror=function(){it(Ct.error)},St.onabort=function(){var wt=Ct.error?Ct.error:Ct.transaction.error;it(wt)}}catch(wt){it(wt)}})}).catch(it)});return ut(at,z),at},clear:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){rt(z._dbInfo,"readwrite",function(it,yt){if(it)return nt(it);try{var St=yt.objectStore(z._dbInfo.storeName).clear();yt.oncomplete=function(){at()},yt.onabort=yt.onerror=function(){var Ct=St.error?St.error:St.transaction.error;nt(Ct)}}catch(Ct){nt(Ct)}})}).catch(nt)});return ut(H,I),H},length:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){rt(z._dbInfo,"readonly",function(it,yt){if(it)return nt(it);try{var St=yt.objectStore(z._dbInfo.storeName).count();St.onsuccess=function(){at(St.result)},St.onerror=function(){nt(St.error)}}catch(Ct){nt(Ct)}})}).catch(nt)});return ut(H,I),H},key:function(I,z){var H=this,at=new $(function(nt,it){I<0?nt(null):H.ready().then(function(){rt(H._dbInfo,"readonly",function(yt,St){if(yt)return it(yt);try{var Ct=St.objectStore(H._dbInfo.storeName),wt=!1,Vt=Ct.openKeyCursor();Vt.onsuccess=function(){var Bt=Vt.result;Bt?I===0||wt?nt(Bt.key):(wt=!0,Bt.advance(I)):nt(null)},Vt.onerror=function(){it(Vt.error)}}catch(Bt){it(Bt)}})}).catch(it)});return ut(at,z),at},keys:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){rt(z._dbInfo,"readonly",function(it,yt){if(it)return nt(it);try{var St=yt.objectStore(z._dbInfo.storeName).openKeyCursor(),Ct=[];St.onsuccess=function(){var wt=St.result;wt?(Ct.push(wt.key),wt.continue()):at(Ct)},St.onerror=function(){nt(St.error)}}catch(wt){nt(wt)}})}).catch(nt)});return ut(H,I),H},dropInstance:function(I,z){z=zt.apply(this,arguments);var H=this.config();(I=typeof I!="function"&&I||{}).name||(I.name=I.name||H.name,I.storeName=I.storeName||H.storeName);var at,nt=this;if(I.name){var it=I.name===H.name&&nt._dbInfo.db,yt=it?$.resolve(nt._dbInfo.db):ae(I).then(function(St){var Ct=k[I.name],wt=Ct.forages;Ct.db=St;for(var Vt=0;Vt<wt.length;Vt++)wt[Vt]._dbInfo.db=St;return St});at=I.storeName?yt.then(function(St){if(St.objectStoreNames.contains(I.storeName)){var Ct=St.version+1;B(I);var wt=k[I.name],Vt=wt.forages;St.close();for(var Bt=0;Bt<Vt.length;Bt++){var Le=Vt[Bt];Le._dbInfo.db=null,Le._dbInfo.version=Ct}return new $(function(an,Qe){var Qn=ct.open(I.name,Ct);Qn.onerror=function(vi){Qn.result.close(),Qe(vi)},Qn.onupgradeneeded=function(){Qn.result.deleteObjectStore(I.storeName)},Qn.onsuccess=function(){var vi=Qn.result;vi.close(),an(vi)}}).then(function(an){wt.db=an;for(var Qe=0;Qe<Vt.length;Qe++){var Qn=Vt[Qe];Qn._dbInfo.db=an,Q(Qn._dbInfo)}}).catch(function(an){throw(et(I,an)||$.resolve()).catch(function(){}),an})}}):yt.then(function(St){B(I);var Ct=k[I.name],wt=Ct.forages;St.close();for(var Vt=0;Vt<wt.length;Vt++)wt[Vt]._dbInfo.db=null;return new $(function(Bt,Le){var an=ct.deleteDatabase(I.name);an.onerror=an.onblocked=function(Qe){var Qn=an.result;Qn&&Qn.close(),Le(Qe)},an.onsuccess=function(){var Qe=an.result;Qe&&Qe.close(),Bt(Qe)}}).then(function(Bt){Ct.db=Bt;for(var Le=0;Le<wt.length;Le++)Q(wt[Le]._dbInfo)}).catch(function(Bt){throw(et(I,Bt)||$.resolve()).catch(function(){}),Bt})})}else at=$.reject("Invalid arguments");return ut(at,z),at}},Wt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",te=/^~~local_forage_type~([^~]+)~/,Xt="__lfsc__:".length,le=Xt+"arbf".length,fe=Object.prototype.toString;function Ye(I){var z,H,at,nt,it,yt=.75*I.length,St=I.length,Ct=0;I[I.length-1]==="="&&(yt--,I[I.length-2]==="="&&yt--);var wt=new ArrayBuffer(yt),Vt=new Uint8Array(wt);for(z=0;z<St;z+=4)H=Wt.indexOf(I[z]),at=Wt.indexOf(I[z+1]),nt=Wt.indexOf(I[z+2]),it=Wt.indexOf(I[z+3]),Vt[Ct++]=H<<2|at>>4,Vt[Ct++]=(15&at)<<4|nt>>2,Vt[Ct++]=(3&nt)<<6|63&it;return wt}function ke(I){var z,H=new Uint8Array(I),at="";for(z=0;z<H.length;z+=3)at+=Wt[H[z]>>2],at+=Wt[(3&H[z])<<4|H[z+1]>>4],at+=Wt[(15&H[z+1])<<2|H[z+2]>>6],at+=Wt[63&H[z+2]];return H.length%3==2?at=at.substring(0,at.length-1)+"=":H.length%3==1&&(at=at.substring(0,at.length-2)+"=="),at}var Hn={serialize:function(I,z){var H="";if(I&&(H=fe.call(I)),I&&(H==="[object ArrayBuffer]"||I.buffer&&fe.call(I.buffer)==="[object ArrayBuffer]")){var at,nt="__lfsc__:";I instanceof ArrayBuffer?(at=I,nt+="arbf"):(at=I.buffer,H==="[object Int8Array]"?nt+="si08":H==="[object Uint8Array]"?nt+="ui08":H==="[object Uint8ClampedArray]"?nt+="uic8":H==="[object Int16Array]"?nt+="si16":H==="[object Uint16Array]"?nt+="ur16":H==="[object Int32Array]"?nt+="si32":H==="[object Uint32Array]"?nt+="ui32":H==="[object Float32Array]"?nt+="fl32":H==="[object Float64Array]"?nt+="fl64":z(new Error("Failed to get type for BinaryArray"))),z(nt+ke(at))}else if(H==="[object Blob]"){var it=new FileReader;it.onload=function(){var yt="~~local_forage_type~"+I.type+"~"+ke(this.result);z("__lfsc__:blob"+yt)},it.readAsArrayBuffer(I)}else try{z(JSON.stringify(I))}catch(yt){console.error("Couldn't convert value into a JSON string: ",I),z(null,yt)}},deserialize:function(I){if(I.substring(0,Xt)!=="__lfsc__:")return JSON.parse(I);var z,H=I.substring(le),at=I.substring(Xt,le);if(at==="blob"&&te.test(H)){var nt=H.match(te);z=nt[1],H=H.substring(nt[0].length)}var it=Ye(H);switch(at){case"arbf":return it;case"blob":return tt([it],{type:z});case"si08":return new Int8Array(it);case"ui08":return new Uint8Array(it);case"uic8":return new Uint8ClampedArray(it);case"si16":return new Int16Array(it);case"ur16":return new Uint16Array(it);case"si32":return new Int32Array(it);case"ui32":return new Uint32Array(it);case"fl32":return new Float32Array(it);case"fl64":return new Float64Array(it);default:throw new Error("Unkown type: "+at)}},stringToBuffer:Ye,bufferToString:ke};function Ke(I,z,H,at){I.executeSql("CREATE TABLE IF NOT EXISTS "+z.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],H,at)}function Ln(I,z,H,at,nt,it){I.executeSql(H,at,nt,function(yt,St){St.code===St.SYNTAX_ERR?yt.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[z.storeName],function(Ct,wt){wt.rows.length?it(Ct,St):Ke(Ct,z,function(){Ct.executeSql(H,at,nt,it)},it)},it):it(yt,St)},it)}function Bn(I,z,H,at){var nt=this;I=Gt(I);var it=new $(function(yt,St){nt.ready().then(function(){z===void 0&&(z=null);var Ct=z,wt=nt._dbInfo;wt.serializer.serialize(z,function(Vt,Bt){Bt?St(Bt):wt.db.transaction(function(Le){Ln(Le,wt,"INSERT OR REPLACE INTO "+wt.storeName+" (key, value) VALUES (?, ?)",[I,Vt],function(){yt(Ct)},function(an,Qe){St(Qe)})},function(Le){if(Le.code===Le.QUOTA_ERR){if(at>0)return void yt(Bn.apply(nt,[I,Ct,H,at-1]));St(Le)}})})}).catch(St)});return ut(it,H),it}function Wn(I){return new $(function(z,H){I.transaction(function(at){at.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(nt,it){for(var yt=[],St=0;St<it.rows.length;St++)yt.push(it.rows.item(St).name);z({db:I,storeNames:yt})},function(nt,it){H(it)})},function(at){H(at)})})}var vn={_driver:"webSQLStorage",_initStorage:function(I){var z=this,H={db:null};if(I)for(var at in I)H[at]=typeof I[at]!="string"?I[at].toString():I[at];var nt=new $(function(it,yt){try{H.db=openDatabase(H.name,String(H.version),H.description,H.size)}catch(St){return yt(St)}H.db.transaction(function(St){Ke(St,H,function(){z._dbInfo=H,it()},function(Ct,wt){yt(wt)})},yt)});return H.serializer=Hn,nt},_support:typeof openDatabase=="function",iterate:function(I,z){var H=this,at=new $(function(nt,it){H.ready().then(function(){var yt=H._dbInfo;yt.db.transaction(function(St){Ln(St,yt,"SELECT * FROM "+yt.storeName,[],function(Ct,wt){for(var Vt=wt.rows,Bt=Vt.length,Le=0;Le<Bt;Le++){var an=Vt.item(Le),Qe=an.value;if(Qe&&(Qe=yt.serializer.deserialize(Qe)),(Qe=I(Qe,an.key,Le+1))!==void 0)return void nt(Qe)}nt()},function(Ct,wt){it(wt)})})}).catch(it)});return ut(at,z),at},getItem:function(I,z){var H=this;I=Gt(I);var at=new $(function(nt,it){H.ready().then(function(){var yt=H._dbInfo;yt.db.transaction(function(St){Ln(St,yt,"SELECT * FROM "+yt.storeName+" WHERE key = ? LIMIT 1",[I],function(Ct,wt){var Vt=wt.rows.length?wt.rows.item(0).value:null;Vt&&(Vt=yt.serializer.deserialize(Vt)),nt(Vt)},function(Ct,wt){it(wt)})})}).catch(it)});return ut(at,z),at},setItem:function(I,z,H){return Bn.apply(this,[I,z,H,1])},removeItem:function(I,z){var H=this;I=Gt(I);var at=new $(function(nt,it){H.ready().then(function(){var yt=H._dbInfo;yt.db.transaction(function(St){Ln(St,yt,"DELETE FROM "+yt.storeName+" WHERE key = ?",[I],function(){nt()},function(Ct,wt){it(wt)})})}).catch(it)});return ut(at,z),at},clear:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){var it=z._dbInfo;it.db.transaction(function(yt){Ln(yt,it,"DELETE FROM "+it.storeName,[],function(){at()},function(St,Ct){nt(Ct)})})}).catch(nt)});return ut(H,I),H},length:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){var it=z._dbInfo;it.db.transaction(function(yt){Ln(yt,it,"SELECT COUNT(key) as c FROM "+it.storeName,[],function(St,Ct){var wt=Ct.rows.item(0).c;at(wt)},function(St,Ct){nt(Ct)})})}).catch(nt)});return ut(H,I),H},key:function(I,z){var H=this,at=new $(function(nt,it){H.ready().then(function(){var yt=H._dbInfo;yt.db.transaction(function(St){Ln(St,yt,"SELECT key FROM "+yt.storeName+" WHERE id = ? LIMIT 1",[I+1],function(Ct,wt){var Vt=wt.rows.length?wt.rows.item(0).key:null;nt(Vt)},function(Ct,wt){it(wt)})})}).catch(it)});return ut(at,z),at},keys:function(I){var z=this,H=new $(function(at,nt){z.ready().then(function(){var it=z._dbInfo;it.db.transaction(function(yt){Ln(yt,it,"SELECT key FROM "+it.storeName,[],function(St,Ct){for(var wt=[],Vt=0;Vt<Ct.rows.length;Vt++)wt.push(Ct.rows.item(Vt).key);at(wt)},function(St,Ct){nt(Ct)})})}).catch(nt)});return ut(H,I),H},dropInstance:function(I,z){z=zt.apply(this,arguments);var H=this.config();(I=typeof I!="function"&&I||{}).name||(I.name=I.name||H.name,I.storeName=I.storeName||H.storeName);var at,nt=this;return ut(at=I.name?new $(function(it){var yt;yt=I.name===H.name?nt._dbInfo.db:openDatabase(I.name,"","",0),I.storeName?it({db:yt,storeNames:[I.storeName]}):it(Wn(yt))}).then(function(it){return new $(function(yt,St){it.db.transaction(function(Ct){function wt(an){return new $(function(Qe,Qn){Ct.executeSql("DROP TABLE IF EXISTS "+an,[],function(){Qe()},function(vi,Yr){Qn(Yr)})})}for(var Vt=[],Bt=0,Le=it.storeNames.length;Bt<Le;Bt++)Vt.push(wt(it.storeNames[Bt]));$.all(Vt).then(function(){yt()}).catch(function(an){St(an)})},function(Ct){St(Ct)})})}):$.reject("Invalid arguments"),z),at}};function Pr(I,z){var H=I.name+"/";return I.storeName!==z.storeName&&(H+=I.storeName+"/"),H}function Ur(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch{return!0}}()||localStorage.length>0}var Rr={_driver:"localStorageWrapper",_initStorage:function(I){var z={};if(I)for(var H in I)z[H]=I[H];return z.keyPrefix=Pr(I,this._defaultConfig),Ur()?(this._dbInfo=z,z.serializer=Hn,$.resolve()):$.reject()},_support:function(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}(),iterate:function(I,z){var H=this,at=H.ready().then(function(){for(var nt=H._dbInfo,it=nt.keyPrefix,yt=it.length,St=localStorage.length,Ct=1,wt=0;wt<St;wt++){var Vt=localStorage.key(wt);if(Vt.indexOf(it)===0){var Bt=localStorage.getItem(Vt);if(Bt&&(Bt=nt.serializer.deserialize(Bt)),(Bt=I(Bt,Vt.substring(yt),Ct++))!==void 0)return Bt}}});return ut(at,z),at},getItem:function(I,z){var H=this;I=Gt(I);var at=H.ready().then(function(){var nt=H._dbInfo,it=localStorage.getItem(nt.keyPrefix+I);return it&&(it=nt.serializer.deserialize(it)),it});return ut(at,z),at},setItem:function(I,z,H){var at=this;I=Gt(I);var nt=at.ready().then(function(){z===void 0&&(z=null);var it=z;return new $(function(yt,St){var Ct=at._dbInfo;Ct.serializer.serialize(z,function(wt,Vt){if(Vt)St(Vt);else try{localStorage.setItem(Ct.keyPrefix+I,wt),yt(it)}catch(Bt){Bt.name!=="QuotaExceededError"&&Bt.name!=="NS_ERROR_DOM_QUOTA_REACHED"||St(Bt),St(Bt)}})})});return ut(nt,H),nt},removeItem:function(I,z){var H=this;I=Gt(I);var at=H.ready().then(function(){var nt=H._dbInfo;localStorage.removeItem(nt.keyPrefix+I)});return ut(at,z),at},clear:function(I){var z=this,H=z.ready().then(function(){for(var at=z._dbInfo.keyPrefix,nt=localStorage.length-1;nt>=0;nt--){var it=localStorage.key(nt);it.indexOf(at)===0&&localStorage.removeItem(it)}});return ut(H,I),H},length:function(I){var z=this.keys().then(function(H){return H.length});return ut(z,I),z},key:function(I,z){var H=this,at=H.ready().then(function(){var nt,it=H._dbInfo;try{nt=localStorage.key(I)}catch{nt=null}return nt&&(nt=nt.substring(it.keyPrefix.length)),nt});return ut(at,z),at},keys:function(I){var z=this,H=z.ready().then(function(){for(var at=z._dbInfo,nt=localStorage.length,it=[],yt=0;yt<nt;yt++){var St=localStorage.key(yt);St.indexOf(at.keyPrefix)===0&&it.push(St.substring(at.keyPrefix.length))}return it});return ut(H,I),H},dropInstance:function(I,z){if(z=zt.apply(this,arguments),!(I=typeof I!="function"&&I||{}).name){var H=this.config();I.name=I.name||H.name,I.storeName=I.storeName||H.storeName}var at,nt=this;return ut(at=I.name?new $(function(it){I.storeName?it(Pr(I,nt._defaultConfig)):it(I.name+"/")}).then(function(it){for(var yt=localStorage.length-1;yt>=0;yt--){var St=localStorage.key(yt);St.indexOf(it)===0&&localStorage.removeItem(St)}}):$.reject("Invalid arguments"),z),at}},qr=function(I,z){for(var H,at,nt=I.length,it=0;it<nt;){if((H=I[it])===(at=z)||typeof H=="number"&&typeof at=="number"&&isNaN(H)&&isNaN(at))return!0;it++}return!1},yr=Array.isArray||function(I){return Object.prototype.toString.call(I)==="[object Array]"},br={},gi={},hr={INDEXEDDB:Ut,WEBSQL:vn,LOCALSTORAGE:Rr},Or=[hr.INDEXEDDB._driver,hr.WEBSQL._driver,hr.LOCALSTORAGE._driver],Jr=["dropInstance"],Oo=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Jr),On={description:"",driver:Or.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function $i(I,z){I[z]=function(){var H=arguments;return I.ready().then(function(){return I[z].apply(I,H)})}}function Pi(){for(var I=1;I<arguments.length;I++){var z=arguments[I];if(z)for(var H in z)z.hasOwnProperty(H)&&(yr(z[H])?arguments[0][H]=z[H].slice():arguments[0][H]=z[H])}return arguments[0]}var ao=new(function(){function I(z){for(var H in function(it,yt){if(!(it instanceof yt))throw new TypeError("Cannot call a class as a function")}(this,I),hr)if(hr.hasOwnProperty(H)){var at=hr[H],nt=at._driver;this[H]=nt,br[nt]||this.defineDriver(at)}this._defaultConfig=Pi({},On),this._config=Pi({},this._defaultConfig,z),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return I.prototype.config=function(z){if((z===void 0?"undefined":X(z))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var H in z){if(H==="storeName"&&(z[H]=z[H].replace(/\W/g,"_")),H==="version"&&typeof z[H]!="number")return new Error("Database version must be a number.");this._config[H]=z[H]}return!("driver"in z)||!z.driver||this.setDriver(this._config.driver)}return typeof z=="string"?this._config[z]:this._config},I.prototype.defineDriver=function(z,H,at){var nt=new $(function(it,yt){try{var St=z._driver,Ct=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!z._driver)return void yt(Ct);for(var wt=Oo.concat("_initStorage"),Vt=0,Bt=wt.length;Vt<Bt;Vt++){var Le=wt[Vt];if((!qr(Jr,Le)||z[Le])&&typeof z[Le]!="function")return void yt(Ct)}(function(){for(var Qe=function(Ks){return function(){var lo=new Error("Method "+Ks+" is not implemented by the current driver"),gs=$.reject(lo);return ut(gs,arguments[arguments.length-1]),gs}},Qn=0,vi=Jr.length;Qn<vi;Qn++){var Yr=Jr[Qn];z[Yr]||(z[Yr]=Qe(Yr))}})();var an=function(Qe){br[St]&&console.info("Redefining LocalForage driver: "+St),br[St]=z,gi[St]=Qe,it()};"_support"in z?z._support&&typeof z._support=="function"?z._support().then(an,yt):an(!!z._support):an(!0)}catch(Qe){yt(Qe)}});return kt(nt,H,at),nt},I.prototype.driver=function(){return this._driver||null},I.prototype.getDriver=function(z,H,at){var nt=br[z]?$.resolve(br[z]):$.reject(new Error("Driver not found."));return kt(nt,H,at),nt},I.prototype.getSerializer=function(z){var H=$.resolve(Hn);return kt(H,z),H},I.prototype.ready=function(z){var H=this,at=H._driverSet.then(function(){return H._ready===null&&(H._ready=H._initDriver()),H._ready});return kt(at,z,z),at},I.prototype.setDriver=function(z,H,at){var nt=this;yr(z)||(z=[z]);var it=this._getSupportedDrivers(z);function yt(){nt._config.driver=nt.driver()}function St(wt){return nt._extend(wt),yt(),nt._ready=nt._initStorage(nt._config),nt._ready}var Ct=this._driverSet!==null?this._driverSet.catch(function(){return $.resolve()}):$.resolve();return this._driverSet=Ct.then(function(){var wt=it[0];return nt._dbInfo=null,nt._ready=null,nt.getDriver(wt).then(function(Vt){nt._driver=Vt._driver,yt(),nt._wrapLibraryMethodsWithReady(),nt._initDriver=function(Bt){return function(){var Le=0;return function an(){for(;Le<Bt.length;){var Qe=Bt[Le];return Le++,nt._dbInfo=null,nt._ready=null,nt.getDriver(Qe).then(St).catch(an)}yt();var Qn=new Error("No available storage method found.");return nt._driverSet=$.reject(Qn),nt._driverSet}()}}(it)})}).catch(function(){yt();var wt=new Error("No available storage method found.");return nt._driverSet=$.reject(wt),nt._driverSet}),kt(this._driverSet,H,at),this._driverSet},I.prototype.supports=function(z){return!!gi[z]},I.prototype._extend=function(z){Pi(this,z)},I.prototype._getSupportedDrivers=function(z){for(var H=[],at=0,nt=z.length;at<nt;at++){var it=z[at];this.supports(it)&&H.push(it)}return H},I.prototype._wrapLibraryMethodsWithReady=function(){for(var z=0,H=Oo.length;z<H;z++)$i(this,Oo[z])},I.prototype.createInstance=function(z){return new I(z)},I}());lt.exports=ao},{3:3}]},{},[4])(4)}).call(this,S(4))},function(N,w){N.exports=function(S){return S.webpackPolyfill||(S.deprecate=function(){},S.paths=[],S.children||(S.children=[]),Object.defineProperty(S,"loaded",{enumerable:!0,get:function(){return S.l}}),Object.defineProperty(S,"id",{enumerable:!0,get:function(){return S.i}}),S.webpackPolyfill=1),S}},function(N,w,S){var W=Object.prototype.hasOwnProperty,pt="~";function lt(){}function J($,ut,kt){this.fn=$,this.context=ut,this.once=kt||!1}function X($,ut,kt,Gt,zt){if(typeof kt!="function")throw new TypeError("The listener must be a function");var L=new J(kt,Gt||$,zt),k=pt?pt+ut:ut;return $._events[k]?$._events[k].fn?$._events[k]=[$._events[k],L]:$._events[k].push(L):($._events[k]=L,$._eventsCount++),$}function ct($,ut){--$._eventsCount==0?$._events=new lt:delete $._events[ut]}function tt(){this._events=new lt,this._eventsCount=0}Object.create&&(lt.prototype=Object.create(null),new lt().__proto__||(pt=!1)),tt.prototype.eventNames=function(){var $,ut,kt=[];if(this._eventsCount===0)return kt;for(ut in $=this._events)W.call($,ut)&&kt.push(pt?ut.slice(1):ut);return Object.getOwnPropertySymbols?kt.concat(Object.getOwnPropertySymbols($)):kt},tt.prototype.listeners=function($){var ut=pt?pt+$:$,kt=this._events[ut];if(!kt)return[];if(kt.fn)return[kt.fn];for(var Gt=0,zt=kt.length,L=new Array(zt);Gt<zt;Gt++)L[Gt]=kt[Gt].fn;return L},tt.prototype.listenerCount=function($){var ut=pt?pt+$:$,kt=this._events[ut];return kt?kt.fn?1:kt.length:0},tt.prototype.emit=function($,ut,kt,Gt,zt,L){var k=pt?pt+$:$;if(!this._events[k])return!1;var Y,ht,B=this._events[k],Q=arguments.length;if(B.fn){switch(B.once&&this.removeListener($,B.fn,void 0,!0),Q){case 1:return B.fn.call(B.context),!0;case 2:return B.fn.call(B.context,ut),!0;case 3:return B.fn.call(B.context,ut,kt),!0;case 4:return B.fn.call(B.context,ut,kt,Gt),!0;case 5:return B.fn.call(B.context,ut,kt,Gt,zt),!0;case 6:return B.fn.call(B.context,ut,kt,Gt,zt,L),!0}for(ht=1,Y=new Array(Q-1);ht<Q;ht++)Y[ht-1]=arguments[ht];B.fn.apply(B.context,Y)}else{var et,ft=B.length;for(ht=0;ht<ft;ht++)switch(B[ht].once&&this.removeListener($,B[ht].fn,void 0,!0),Q){case 1:B[ht].fn.call(B[ht].context);break;case 2:B[ht].fn.call(B[ht].context,ut);break;case 3:B[ht].fn.call(B[ht].context,ut,kt);break;case 4:B[ht].fn.call(B[ht].context,ut,kt,Gt);break;default:if(!Y)for(et=1,Y=new Array(Q-1);et<Q;et++)Y[et-1]=arguments[et];B[ht].fn.apply(B[ht].context,Y)}}return!0},tt.prototype.on=function($,ut,kt){return X(this,$,ut,kt,!1)},tt.prototype.once=function($,ut,kt){return X(this,$,ut,kt,!0)},tt.prototype.removeListener=function($,ut,kt,Gt){var zt=pt?pt+$:$;if(!this._events[zt])return this;if(!ut)return ct(this,zt),this;var L=this._events[zt];if(L.fn)L.fn!==ut||Gt&&!L.once||kt&&L.context!==kt||ct(this,zt);else{for(var k=0,Y=[],ht=L.length;k<ht;k++)(L[k].fn!==ut||Gt&&!L[k].once||kt&&L[k].context!==kt)&&Y.push(L[k]);Y.length?this._events[zt]=Y.length===1?Y[0]:Y:ct(this,zt)}return this},tt.prototype.removeAllListeners=function($){var ut;return $?(ut=pt?pt+$:$,this._events[ut]&&ct(this,ut)):(this._events=new lt,this._eventsCount=0),this},tt.prototype.off=tt.prototype.removeListener,tt.prototype.addListener=tt.prototype.on,tt.prefixed=pt,tt.EventEmitter=tt,N.exports=tt},function(N,w,S){function W(rt,Ut,Wt){Wt=Wt||2;var te,Xt,le,fe,Ye,ke,Hn,Ke=Ut&&Ut.length,Ln=Ke?Ut[0]*Wt:rt.length,Bn=pt(rt,0,Ln,Wt,!0),Wn=[];if(!Bn||Bn.next===Bn.prev)return Wn;if(Ke&&(Bn=function(Pr,Ur,Rr,qr){var yr,br,gi,hr,Or,Jr=[];for(yr=0,br=Ur.length;yr<br;yr++)gi=Ur[yr]*qr,hr=yr<br-1?Ur[yr+1]*qr:Pr.length,(Or=pt(Pr,gi,hr,qr,!1))===Or.next&&(Or.steiner=!0),Jr.push(L(Or));for(Jr.sort(ut),yr=0;yr<Jr.length;yr++)Rr=lt(Rr=kt(Jr[yr],Rr),Rr.next);return Rr}(rt,Ut,Bn,Wt)),rt.length>80*Wt){te=le=rt[0],Xt=fe=rt[1];for(var vn=Wt;vn<Ln;vn+=Wt)(Ye=rt[vn])<te&&(te=Ye),(ke=rt[vn+1])<Xt&&(Xt=ke),Ye>le&&(le=Ye),ke>fe&&(fe=ke);Hn=(Hn=Math.max(le-te,fe-Xt))!==0?1/Hn:0}return J(Bn,Wn,Wt,te,Xt,Hn),Wn}function pt(rt,Ut,Wt,te,Xt){var le,fe;if(Xt===Kt(rt,Ut,Wt,te)>0)for(le=Ut;le<Wt;le+=te)fe=ne(le,rt[le],rt[le+1],fe);else for(le=Wt-te;le>=Ut;le-=te)fe=ne(le,rt[le],rt[le+1],fe);return fe&&B(fe,fe.next)&&(bt(fe),fe=fe.next),fe}function lt(rt,Ut){if(!rt)return rt;Ut||(Ut=rt);var Wt,te=rt;do if(Wt=!1,te.steiner||!B(te,te.next)&&ht(te.prev,te,te.next)!==0)te=te.next;else{if(bt(te),(te=Ut=te.prev)===te.next)break;Wt=!0}while(Wt||te!==Ut);return Ut}function J(rt,Ut,Wt,te,Xt,le,fe){if(rt){!fe&&le&&function(Ke,Ln,Bn,Wn){var vn=Ke;do vn.z===null&&(vn.z=zt(vn.x,vn.y,Ln,Bn,Wn)),vn.prevZ=vn.prev,vn.nextZ=vn.next,vn=vn.next;while(vn!==Ke);vn.prevZ.nextZ=null,vn.prevZ=null,function(Pr){var Ur,Rr,qr,yr,br,gi,hr,Or,Jr=1;do{for(Rr=Pr,Pr=null,br=null,gi=0;Rr;){for(gi++,qr=Rr,hr=0,Ur=0;Ur<Jr&&(hr++,qr=qr.nextZ);Ur++);for(Or=Jr;hr>0||Or>0&&qr;)hr!==0&&(Or===0||!qr||Rr.z<=qr.z)?(yr=Rr,Rr=Rr.nextZ,hr--):(yr=qr,qr=qr.nextZ,Or--),br?br.nextZ=yr:Pr=yr,yr.prevZ=br,br=yr;Rr=qr}br.nextZ=null,Jr*=2}while(gi>1)}(vn)}(rt,te,Xt,le);for(var Ye,ke,Hn=rt;rt.prev!==rt.next;)if(Ye=rt.prev,ke=rt.next,le?ct(rt,te,Xt,le):X(rt))Ut.push(Ye.i/Wt),Ut.push(rt.i/Wt),Ut.push(ke.i/Wt),bt(rt),rt=ke.next,Hn=ke.next;else if((rt=ke)===Hn){fe?fe===1?J(rt=tt(lt(rt),Ut,Wt),Ut,Wt,te,Xt,le,2):fe===2&&$(rt,Ut,Wt,te,Xt,le):J(lt(rt),Ut,Wt,te,Xt,le,1);break}}}function X(rt){var Ut=rt.prev,Wt=rt,te=rt.next;if(ht(Ut,Wt,te)>=0)return!1;for(var Xt=rt.next.next;Xt!==rt.prev;){if(k(Ut.x,Ut.y,Wt.x,Wt.y,te.x,te.y,Xt.x,Xt.y)&&ht(Xt.prev,Xt,Xt.next)>=0)return!1;Xt=Xt.next}return!0}function ct(rt,Ut,Wt,te){var Xt=rt.prev,le=rt,fe=rt.next;if(ht(Xt,le,fe)>=0)return!1;for(var Ye=Xt.x<le.x?Xt.x<fe.x?Xt.x:fe.x:le.x<fe.x?le.x:fe.x,ke=Xt.y<le.y?Xt.y<fe.y?Xt.y:fe.y:le.y<fe.y?le.y:fe.y,Hn=Xt.x>le.x?Xt.x>fe.x?Xt.x:fe.x:le.x>fe.x?le.x:fe.x,Ke=Xt.y>le.y?Xt.y>fe.y?Xt.y:fe.y:le.y>fe.y?le.y:fe.y,Ln=zt(Ye,ke,Ut,Wt,te),Bn=zt(Hn,Ke,Ut,Wt,te),Wn=rt.prevZ,vn=rt.nextZ;Wn&&Wn.z>=Ln&&vn&&vn.z<=Bn;){if(Wn!==rt.prev&&Wn!==rt.next&&k(Xt.x,Xt.y,le.x,le.y,fe.x,fe.y,Wn.x,Wn.y)&&ht(Wn.prev,Wn,Wn.next)>=0||(Wn=Wn.prevZ,vn!==rt.prev&&vn!==rt.next&&k(Xt.x,Xt.y,le.x,le.y,fe.x,fe.y,vn.x,vn.y)&&ht(vn.prev,vn,vn.next)>=0))return!1;vn=vn.nextZ}for(;Wn&&Wn.z>=Ln;){if(Wn!==rt.prev&&Wn!==rt.next&&k(Xt.x,Xt.y,le.x,le.y,fe.x,fe.y,Wn.x,Wn.y)&&ht(Wn.prev,Wn,Wn.next)>=0)return!1;Wn=Wn.prevZ}for(;vn&&vn.z<=Bn;){if(vn!==rt.prev&&vn!==rt.next&&k(Xt.x,Xt.y,le.x,le.y,fe.x,fe.y,vn.x,vn.y)&&ht(vn.prev,vn,vn.next)>=0)return!1;vn=vn.nextZ}return!0}function tt(rt,Ut,Wt){var te=rt;do{var Xt=te.prev,le=te.next.next;!B(Xt,le)&&Q(Xt,te,te.next,le)&&ae(Xt,le)&&ae(le,Xt)&&(Ut.push(Xt.i/Wt),Ut.push(te.i/Wt),Ut.push(le.i/Wt),bt(te),bt(te.next),te=rt=le),te=te.next}while(te!==rt);return lt(te)}function $(rt,Ut,Wt,te,Xt,le){var fe=rt;do{for(var Ye=fe.next.next;Ye!==fe.prev;){if(fe.i!==Ye.i&&Y(fe,Ye)){var ke=Oe(fe,Ye);return fe=lt(fe,fe.next),ke=lt(ke,ke.next),J(fe,Ut,Wt,te,Xt,le),void J(ke,Ut,Wt,te,Xt,le)}Ye=Ye.next}fe=fe.next}while(fe!==rt)}function ut(rt,Ut){return rt.x-Ut.x}function kt(rt,Ut){var Wt=function(le,fe){var Ye,ke=fe,Hn=le.x,Ke=le.y,Ln=-1/0;do{if(Ke<=ke.y&&Ke>=ke.next.y&&ke.next.y!==ke.y){var Bn=ke.x+(Ke-ke.y)*(ke.next.x-ke.x)/(ke.next.y-ke.y);if(Bn<=Hn&&Bn>Ln){if(Ln=Bn,Bn===Hn){if(Ke===ke.y)return ke;if(Ke===ke.next.y)return ke.next}Ye=ke.x<ke.next.x?ke:ke.next}}ke=ke.next}while(ke!==fe);if(!Ye)return null;if(Hn===Ln)return Ye;var Wn,vn=Ye,Pr=Ye.x,Ur=Ye.y,Rr=1/0;ke=Ye;do Hn>=ke.x&&ke.x>=Pr&&Hn!==ke.x&&k(Ke<Ur?Hn:Ln,Ke,Pr,Ur,Ke<Ur?Ln:Hn,Ke,ke.x,ke.y)&&(Wn=Math.abs(Ke-ke.y)/(Hn-ke.x),ae(ke,le)&&(Wn<Rr||Wn===Rr&&(ke.x>Ye.x||ke.x===Ye.x&&Gt(Ye,ke)))&&(Ye=ke,Rr=Wn)),ke=ke.next;while(ke!==vn);return Ye}(rt,Ut);if(!Wt)return Ut;var te=Oe(Wt,rt),Xt=lt(Wt,Wt.next);return lt(te,te.next),Ut===Wt?Xt:Ut}function Gt(rt,Ut){return ht(rt.prev,rt,Ut.prev)<0&&ht(Ut.next,rt,rt.next)<0}function zt(rt,Ut,Wt,te,Xt){return(rt=1431655765&((rt=858993459&((rt=252645135&((rt=16711935&((rt=32767*(rt-Wt)*Xt)|rt<<8))|rt<<4))|rt<<2))|rt<<1))|(Ut=1431655765&((Ut=858993459&((Ut=252645135&((Ut=16711935&((Ut=32767*(Ut-te)*Xt)|Ut<<8))|Ut<<4))|Ut<<2))|Ut<<1))<<1}function L(rt){var Ut=rt,Wt=rt;do(Ut.x<Wt.x||Ut.x===Wt.x&&Ut.y<Wt.y)&&(Wt=Ut),Ut=Ut.next;while(Ut!==rt);return Wt}function k(rt,Ut,Wt,te,Xt,le,fe,Ye){return(Xt-fe)*(Ut-Ye)-(rt-fe)*(le-Ye)>=0&&(rt-fe)*(te-Ye)-(Wt-fe)*(Ut-Ye)>=0&&(Wt-fe)*(le-Ye)-(Xt-fe)*(te-Ye)>=0}function Y(rt,Ut){return rt.next.i!==Ut.i&&rt.prev.i!==Ut.i&&!function(Wt,te){var Xt=Wt;do{if(Xt.i!==Wt.i&&Xt.next.i!==Wt.i&&Xt.i!==te.i&&Xt.next.i!==te.i&&Q(Xt,Xt.next,Wt,te))return!0;Xt=Xt.next}while(Xt!==Wt);return!1}(rt,Ut)&&(ae(rt,Ut)&&ae(Ut,rt)&&function(Wt,te){var Xt=Wt,le=!1,fe=(Wt.x+te.x)/2,Ye=(Wt.y+te.y)/2;do Xt.y>Ye!=Xt.next.y>Ye&&Xt.next.y!==Xt.y&&fe<(Xt.next.x-Xt.x)*(Ye-Xt.y)/(Xt.next.y-Xt.y)+Xt.x&&(le=!le),Xt=Xt.next;while(Xt!==Wt);return le}(rt,Ut)&&(ht(rt.prev,rt,Ut.prev)||ht(rt,Ut.prev,Ut))||B(rt,Ut)&&ht(rt.prev,rt,rt.next)>0&&ht(Ut.prev,Ut,Ut.next)>0)}function ht(rt,Ut,Wt){return(Ut.y-rt.y)*(Wt.x-Ut.x)-(Ut.x-rt.x)*(Wt.y-Ut.y)}function B(rt,Ut){return rt.x===Ut.x&&rt.y===Ut.y}function Q(rt,Ut,Wt,te){var Xt=ft(ht(rt,Ut,Wt)),le=ft(ht(rt,Ut,te)),fe=ft(ht(Wt,te,rt)),Ye=ft(ht(Wt,te,Ut));return Xt!==le&&fe!==Ye||!(Xt!==0||!et(rt,Wt,Ut))||!(le!==0||!et(rt,te,Ut))||!(fe!==0||!et(Wt,rt,te))||!(Ye!==0||!et(Wt,Ut,te))}function et(rt,Ut,Wt){return Ut.x<=Math.max(rt.x,Wt.x)&&Ut.x>=Math.min(rt.x,Wt.x)&&Ut.y<=Math.max(rt.y,Wt.y)&&Ut.y>=Math.min(rt.y,Wt.y)}function ft(rt){return rt>0?1:rt<0?-1:0}function ae(rt,Ut){return ht(rt.prev,rt,rt.next)<0?ht(rt,Ut,rt.next)>=0&&ht(rt,rt.prev,Ut)>=0:ht(rt,Ut,rt.prev)<0||ht(rt,rt.next,Ut)<0}function Oe(rt,Ut){var Wt=new Jt(rt.i,rt.x,rt.y),te=new Jt(Ut.i,Ut.x,Ut.y),Xt=rt.next,le=Ut.prev;return rt.next=Ut,Ut.prev=rt,Wt.next=Xt,Xt.prev=Wt,te.next=Wt,Wt.prev=te,le.next=te,te.prev=le,te}function ne(rt,Ut,Wt,te){var Xt=new Jt(rt,Ut,Wt);return te?(Xt.next=te.next,Xt.prev=te,te.next.prev=Xt,te.next=Xt):(Xt.prev=Xt,Xt.next=Xt),Xt}function bt(rt){rt.next.prev=rt.prev,rt.prev.next=rt.next,rt.prevZ&&(rt.prevZ.nextZ=rt.nextZ),rt.nextZ&&(rt.nextZ.prevZ=rt.prevZ)}function Jt(rt,Ut,Wt){this.i=rt,this.x=Ut,this.y=Wt,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Kt(rt,Ut,Wt,te){for(var Xt=0,le=Ut,fe=Wt-te;le<Wt;le+=te)Xt+=(rt[fe]-rt[le])*(rt[le+1]+rt[fe+1]),fe=le;return Xt}N.exports=W,N.exports.default=W,W.deviation=function(rt,Ut,Wt,te){var Xt=Ut&&Ut.length,le=Xt?Ut[0]*Wt:rt.length,fe=Math.abs(Kt(rt,0,le,Wt));if(Xt)for(var Ye=0,ke=Ut.length;Ye<ke;Ye++){var Hn=Ut[Ye]*Wt,Ke=Ye<ke-1?Ut[Ye+1]*Wt:rt.length;fe-=Math.abs(Kt(rt,Hn,Ke,Wt))}var Ln=0;for(Ye=0;Ye<te.length;Ye+=3){var Bn=te[Ye]*Wt,Wn=te[Ye+1]*Wt,vn=te[Ye+2]*Wt;Ln+=Math.abs((rt[Bn]-rt[vn])*(rt[Wn+1]-rt[Bn+1])-(rt[Bn]-rt[Wn])*(rt[vn+1]-rt[Bn+1]))}return fe===0&&Ln===0?0:Math.abs((Ln-fe)/fe)},W.flatten=function(rt){for(var Ut=rt[0][0].length,Wt={vertices:[],holes:[],dimensions:Ut},te=0,Xt=0;Xt<rt.length;Xt++){for(var le=0;le<rt[Xt].length;le++)for(var fe=0;fe<Ut;fe++)Wt.vertices.push(rt[Xt][le][fe]);Xt>0&&(te+=rt[Xt-1].length,Wt.holes.push(te))}return Wt}},function(N,w,S){N.exports=function(W){var pt={};function lt(J){if(pt[J])return pt[J].exports;var X=pt[J]={i:J,l:!1,exports:{}};return W[J].call(X.exports,X,X.exports,lt),X.l=!0,X.exports}return lt.m=W,lt.c=pt,lt.d=function(J,X,ct){lt.o(J,X)||Object.defineProperty(J,X,{enumerable:!0,get:ct})},lt.r=function(J){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(J,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(J,"__esModule",{value:!0})},lt.t=function(J,X){if(1&X&&(J=lt(J)),8&X||4&X&&typeof J=="object"&&J&&J.__esModule)return J;var ct=Object.create(null);if(lt.r(ct),Object.defineProperty(ct,"default",{enumerable:!0,value:J}),2&X&&typeof J!="string")for(var tt in J)lt.d(ct,tt,function($){return J[$]}.bind(null,tt));return ct},lt.n=function(J){var X=J&&J.__esModule?function(){return J.default}:function(){return J};return lt.d(X,"a",X),X},lt.o=function(J,X){return Object.prototype.hasOwnProperty.call(J,X)},lt.p="",lt(lt.s=34)}([function(W,pt){W.exports=S(5)},function(W,pt){W.exports=`varying vec2 vUv;
3182
3182
  void main() {
3183
3183
  vUv = uv;
@@ -5476,7 +5476,7 @@ void main(void)
5476
5476
  `),u)||this)._colorDirty=!1,s.uvMatrix=new Nl(e),s.batchable=r.program===void 0,s.pluginName=r.pluginName,s.tint=r.tint,s.alpha=r.alpha,s}return zd(n,o),Object.defineProperty(n.prototype,"texture",{get:function(){return this.uniforms.uSampler},set:function(e){this.uniforms.uSampler!==e&&(this.uniforms.uSampler=e,this.uvMatrix.texture=e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"alpha",{get:function(){return this._alpha},set:function(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"tint",{get:function(){return this._tint},set:function(e){e!==this._tint&&(this._tint=e,this._tintRGB=(e>>16)+(65280&e)+((255&e)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),n.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var e=this.texture.baseTexture;yn(this._tint,this._alpha,this.uniforms.uColor,e.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},n}(ko),Rh=function(o){function n(e,r,s){var u=o.call(this)||this,h=new Qi(e),f=new Qi(r,!0),y=new Qi(s,!0,!0);return u.addAttribute("aVertexPosition",h,2,!1,I.FLOAT).addAttribute("aTextureCoord",f,2,!1,I.FLOAT).addIndex(y),u._updateId=-1,u}return zd(n,o),Object.defineProperty(n.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),n}(Na),Oc=function(o,n){return(Oc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)r.hasOwnProperty(s)&&(e[s]=r[s])})(o,n)},Jl=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[]},Dc=function(){function o(){}return o.test=function(n){return typeof n=="string"&&n.indexOf("info face=")===0},o.parse=function(n){var e=n.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[]};for(var s in e){var u=e[s].match(/^[a-z]+/gm)[0],h=e[s].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),f={};for(var y in h){var b=h[y].split("="),T=b[0],P=b[1].replace(/"/gm,""),j=parseFloat(P),G=isNaN(j)?P:j;f[T]=G}r[u].push(f)}var V=new Jl;return r.info.forEach(function(K){return V.info.push({face:K.face,size:parseInt(K.size,10)})}),r.common.forEach(function(K){return V.common.push({lineHeight:parseInt(K.lineHeight,10)})}),r.page.forEach(function(K){return V.page.push({id:parseInt(K.id,10),file:K.file})}),r.char.forEach(function(K){return V.char.push({id:parseInt(K.id,10),page:parseInt(K.page,10),x:parseInt(K.x,10),y:parseInt(K.y,10),width:parseInt(K.width,10),height:parseInt(K.height,10),xoffset:parseInt(K.xoffset,10),yoffset:parseInt(K.yoffset,10),xadvance:parseInt(K.xadvance,10)})}),r.kerning.forEach(function(K){return V.kerning.push({first:parseInt(K.first,10),second:parseInt(K.second,10),amount:parseInt(K.amount,10)})}),V},o}(),Ih=function(){function o(){}return o.test=function(n){return n instanceof XMLDocument&&n.getElementsByTagName("page").length&&n.getElementsByTagName("info")[0].getAttribute("face")!==null},o.parse=function(n){for(var e=new Jl,r=n.getElementsByTagName("info"),s=n.getElementsByTagName("common"),u=n.getElementsByTagName("page"),h=n.getElementsByTagName("char"),f=n.getElementsByTagName("kerning"),y=0;y<r.length;y++)e.info.push({face:r[y].getAttribute("face"),size:parseInt(r[y].getAttribute("size"),10)});for(y=0;y<s.length;y++)e.common.push({lineHeight:parseInt(s[y].getAttribute("lineHeight"),10)});for(y=0;y<u.length;y++)e.page.push({id:parseInt(u[y].getAttribute("id"),10)||0,file:u[y].getAttribute("file")});for(y=0;y<h.length;y++){var b=h[y];e.char.push({id:parseInt(b.getAttribute("id"),10),page:parseInt(b.getAttribute("page"),10)||0,x:parseInt(b.getAttribute("x"),10),y:parseInt(b.getAttribute("y"),10),width:parseInt(b.getAttribute("width"),10),height:parseInt(b.getAttribute("height"),10),xoffset:parseInt(b.getAttribute("xoffset"),10),yoffset:parseInt(b.getAttribute("yoffset"),10),xadvance:parseInt(b.getAttribute("xadvance"),10)})}for(y=0;y<f.length;y++)e.kerning.push({first:parseInt(f[y].getAttribute("first"),10),second:parseInt(f[y].getAttribute("second"),10),amount:parseInt(f[y].getAttribute("amount"),10)});return e},o}(),Cf=function(){function o(){}return o.test=function(n){if(typeof n=="string"&&n.indexOf("<font>")>-1){var e=new self.DOMParser().parseFromString(n,"text/xml");return Ih.test(e)}return!1},o.parse=function(n){var e=new self.DOMParser().parseFromString(n,"text/xml");return Ih.parse(e)},o}(),ma=[Dc,Ih,Cf];function Au(o){for(var n=0;n<ma.length;n++)if(ma[n].test(o))return ma[n];return null}function Lh(o,n,e,r,s,u){var h,f=e.fill;if(!Array.isArray(f))return f;if(f.length===1)return f[0];var y=e.dropShadow?e.dropShadowDistance:0,b=e.padding||0,T=Math.ceil(o.width/r)-y-2*b,P=Math.ceil(o.height/r)-y-2*b,j=f.slice(),G=e.fillGradientStops.slice();if(!G.length)for(var V=j.length+1,K=1;K<V;++K)G.push(K/V);if(j.unshift(f[0]),G.unshift(0),j.push(f[f.length-1]),G.push(1),e.fillGradientType===Es.LINEAR_VERTICAL){h=n.createLinearGradient(T/2,b,T/2,P+b);var _t=0,Tt=(u.fontProperties.fontSize+e.strokeThickness)/P;for(K=0;K<s.length;K++)for(var jt=u.lineHeight*K,de=0;de<j.length;de++){var Ne=jt/P+(typeof G[de]=="number"?G[de]:de/j.length)*Tt,Nt=Math.max(_t,Ne);Nt=Math.min(Nt,1),h.addColorStop(Nt,j[de]),_t=Nt}}else{h=n.createLinearGradient(b,P/2,T+b,P/2);var ue=j.length+1,$t=1;for(K=0;K<j.length;K++){var ie=void 0;ie=typeof G[K]=="number"?G[K]:$t/ue,h.addColorStop(ie,j[K]),$t++}}return h}function Hp(o,n,e,r,s,u,h){var f=e.text,y=e.fontProperties;n.translate(r,s),n.scale(u,u);var b=h.strokeThickness/2,T=-h.strokeThickness/2;n.font=h.toFontString(),n.lineWidth=h.strokeThickness,n.textBaseline=h.textBaseline,n.lineJoin=h.lineJoin,n.miterLimit=h.miterLimit,n.fillStyle=Lh(o,n,h,u,[f],e),n.strokeStyle=h.stroke,n.font=h.toFontString(),n.lineWidth=h.strokeThickness,n.textBaseline=h.textBaseline,n.lineJoin=h.lineJoin,n.miterLimit=h.miterLimit,n.fillStyle=Lh(o,n,h,u,[f],e),n.strokeStyle=h.stroke;var P=h.dropShadowColor,j=Yo(typeof P=="number"?P:Ft(P));h.dropShadow?(n.shadowColor="rgba("+255*j[0]+","+255*j[1]+","+255*j[2]+","+h.dropShadowAlpha+")",n.shadowBlur=h.dropShadowBlur,n.shadowOffsetX=Math.cos(h.dropShadowAngle)*h.dropShadowDistance,n.shadowOffsetY=Math.sin(h.dropShadowAngle)*h.dropShadowDistance):(n.shadowColor="black",n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0),h.stroke&&h.strokeThickness&&n.strokeText(f,b,T+e.lineHeight-y.descent),h.fill&&n.fillText(f,b,T+e.lineHeight-y.descent),n.setTransform(1,0,0,1,0,0),n.fillStyle="rgba(0, 0, 0, 0)"}var gl=function(){function o(n,e,r){var s=n.info[0],u=n.common[0],h=uo(n.page[0].file),f={};this._ownsTextures=r,this.font=s.face,this.size=s.size,this.lineHeight=u.lineHeight/h,this.chars={},this.pageTextures=f;for(var y=0;y<n.page.length;y++){var b=n.page[y],T=b.id,P=b.file;f[T]=e instanceof Array?e[y]:e[P]}for(y=0;y<n.char.length;y++){var j=n.char[y],G=(T=j.id,j.page),V=n.char[y],K=V.x,_t=V.y,Tt=V.width,jt=V.height,de=V.xoffset,Ne=V.yoffset,Nt=V.xadvance;_t/=h,Tt/=h,jt/=h,de/=h,Ne/=h,Nt/=h;var ue=new dr((K/=h)+f[G].frame.x/h,_t+f[G].frame.y/h,Tt,jt);this.chars[T]={xOffset:de,yOffset:Ne,xAdvance:Nt,kerning:{},texture:new qn(f[G].baseTexture,ue),page:G}}for(y=0;y<n.kerning.length;y++){var $t=n.kerning[y],ie=$t.first,Je=$t.second,he=$t.amount;ie/=h,Je/=h,he/=h,this.chars[Je]&&(this.chars[Je].kerning[ie]=he)}}return o.prototype.destroy=function(){for(var n in this.chars)this.chars[n].texture.destroy(),this.chars[n].texture=null;for(var n in this.pageTextures)this._ownsTextures&&this.pageTextures[n].destroy(!0),this.pageTextures[n]=null;this.chars=null,this.pageTextures=null},o.install=function(n,e,r){var s;if(n instanceof Jl)s=n;else{var u=Au(n);if(!u)throw new Error("Unrecognized data format for font.");s=u.parse(n)}e instanceof qn&&(e=[e]);var h=new o(s,e,r);return o.available[h.font]=h,h},o.uninstall=function(n){var e=o.available[n];if(!e)throw new Error("No font found named '"+n+"'");e.destroy(),delete o.available[n]},o.from=function(n,e,r){if(!n)throw new Error("[BitmapFont] Property `name` is required.");var s=Object.assign({},o.defaultOptions,r),u=s.chars,h=s.padding,f=s.resolution,y=s.textureWidth,b=s.textureHeight,T=function(Cn){typeof Cn=="string"&&(Cn=[Cn]);for(var kn=[],wr=0,Ar=Cn.length;wr<Ar;wr++){var Dr=Cn[wr];if(Array.isArray(Dr)){if(Dr.length!==2)throw new Error("[BitmapFont]: Invalid character range length, expecting 2 got "+Dr.length+".");var pi=Dr[0].charCodeAt(0),Ji=Dr[1].charCodeAt(0);if(Ji<pi)throw new Error("[BitmapFont]: Invalid character range.");for(var jr=pi,Zr=Ji;jr<=Zr;jr++)kn.push(String.fromCharCode(jr))}else kn.push.apply(kn,Dr.split(""))}if(kn.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return kn}(u),P=e instanceof Yl?e:new Yl(e),j=y,G=new Jl;G.info[0]={face:P.fontFamily,size:P.fontSize},G.common[0]={lineHeight:P.fontSize};for(var V,K,_t,Tt=0,jt=0,de=0,Ne=[],Nt=0;Nt<T.length;Nt++){V||((V=document.createElement("canvas")).width=y,V.height=b,K=V.getContext("2d"),_t=new Jn(V,{resolution:f}),Ne.push(new qn(_t)),G.page.push({id:Ne.length-1,file:""}));var ue=Ms.measureText(T[Nt],P,!1,V),$t=ue.width,ie=Math.ceil(ue.height),Je=Math.ceil((P.fontStyle==="italic"?2:1)*$t);if(jt>=b-ie*f){if(jt===0)throw new Error("[BitmapFont] textureHeight "+b+"px is too small for "+P.fontSize+"px fonts");--Nt,V=null,K=null,_t=null,jt=0,Tt=0,de=0}else if(de=Math.max(ie+ue.fontProperties.descent,de),Je*f+Tt>=j)--Nt,jt+=de*f,jt=Math.ceil(jt),Tt=0,de=0;else{Hp(V,K,ue,Tt,jt,f,P);var he=ue.text.charCodeAt(0);G.char.push({id:he,page:Ne.length-1,x:Tt/f,y:jt/f,width:Je,height:ie,xoffset:0,yoffset:0,xadvance:Math.ceil($t-(P.dropShadow?P.dropShadowDistance:0)-(P.stroke?P.strokeThickness:0))}),Tt+=(Je+2*h)*f,Tt=Math.ceil(Tt)}}Nt=0;for(var oe=T.length;Nt<oe;Nt++)for(var Ae=T[Nt],nn=0;nn<oe;nn++){var on=T[nn],$n=K.measureText(Ae).width,nr=K.measureText(on).width,$e=K.measureText(Ae+on).width-($n+nr);$e&&G.kerning.push({first:Ae.charCodeAt(0),second:on.charCodeAt(0),amount:$e})}var Ue=new o(G,Ne,!0);return o.available[n]!==void 0&&o.uninstall(n),o.available[n]=Ue,Ue},o.ALPHA=[["a","z"],["A","Z"]," "],o.NUMERIC=[["0","9"]],o.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],o.ASCII=[[" ","~"]],o.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:o.ALPHANUMERIC},o.available={},o}(),$l=[],zp=[],qs=(function(o){function n(e,r){r===void 0&&(r={});var s=o.call(this)||this;s._tint=16777215;var u=Object.assign({},n.styleDefaults,r),h=u.align,f=u.tint,y=u.maxWidth,b=u.letterSpacing,T=u.fontName,P=u.fontSize;if(!gl.available[T])throw new Error('Missing BitmapFont "'+T+'"');return s._activePagesMeshData=[],s._textWidth=0,s._textHeight=0,s._align=h,s._tint=f,s._fontName=T,s._fontSize=P||gl.available[T].size,s._text=e,s._maxWidth=y,s._maxLineHeight=0,s._letterSpacing=b,s._anchor=new Ml(function(){s.dirty=!0},s,0,0),s._roundPixels=Bt.ROUND_PIXELS,s.dirty=!0,s._textureCache={},s}(function(e,r){function s(){this.constructor=e}Oc(e,r),e.prototype=r===null?Object.create(r):(s.prototype=r.prototype,new s)})(n,o),n.prototype.updateText=function(){for(var e,r=gl.available[this._fontName],s=this._fontSize/r.size,u=new oi,h=[],f=[],y=[],b=this._text.replace(/(?:\r\n|\r)/g,`
5477
5477
  `)||" ",T=b.length,P=this._maxWidth*r.size/this._fontSize,j=null,G=0,V=0,K=0,_t=-1,Tt=0,jt=0,de=0,Ne=0,Nt=0;Nt<T;Nt++){var ue=b.charCodeAt(Nt),$t=b.charAt(Nt);if(/(?:\s)/.test($t)&&(_t=Nt,Tt=G,Ne++),$t!=="\r"&&$t!==`
5478
5478
  `){var ie=r.chars[ue];if(ie){j&&ie.kerning[j]&&(u.x+=ie.kerning[j]);var Je=zp.pop()||{texture:qn.EMPTY,line:0,charCode:0,prevSpaces:0,position:new oi};Je.texture=ie.texture,Je.line=K,Je.charCode=ue,Je.position.x=u.x+ie.xOffset+this._letterSpacing/2,Je.position.y=u.y+ie.yOffset,Je.prevSpaces=Ne,h.push(Je),u.x+=ie.xAdvance+this._letterSpacing,G=u.x,de=Math.max(de,ie.yOffset+ie.texture.height),j=ue,_t!==-1&&P>0&&u.x>P&&(Zn(h,1+_t-++jt,1+Nt-_t),Nt=_t,_t=-1,f.push(Tt),y.push(h.length>0?h[h.length-1].prevSpaces:0),V=Math.max(V,Tt),K++,u.x=0,u.y+=r.lineHeight,j=null,Ne=0)}}else f.push(G),y.push(-1),V=Math.max(V,G),++K,++jt,u.x=0,u.y+=r.lineHeight,j=null,Ne=0}var he=b.charAt(b.length-1);he!=="\r"&&he!==`
5479
- `&&(/(?:\s)/.test(he)&&(G=Tt),f.push(G),V=Math.max(V,G),y.push(-1));var oe=[];for(Nt=0;Nt<=K;Nt++){var Ae=0;this._align==="right"?Ae=V-f[Nt]:this._align==="center"?Ae=(V-f[Nt])/2:this._align==="justify"&&(Ae=y[Nt]<0?0:(V-f[Nt])/y[Nt]),oe.push(Ae)}var nn=h.length,on={},$n=[],nr=this._activePagesMeshData;for(Nt=0;Nt<nr.length;Nt++)$l.push(nr[Nt]);for(Nt=0;Nt<nn;Nt++){var $e=(jr=h[Nt].texture).baseTexture.uid;if(!on[$e]){if(!(ur=$l.pop())){var Ue=new Rh,Cn=new Zl(qn.EMPTY);ur={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:new Mu(Ue,Cn),vertices:null,uvs:null,indices:null}}ur.index=0,ur.indexCount=0,ur.vertexCount=0,ur.uvsCount=0,ur.total=0;var kn=this._textureCache;kn[$e]=kn[$e]||new qn(jr.baseTexture),ur.mesh.texture=kn[$e],ur.mesh.tint=this._tint,$n.push(ur),on[$e]=ur}on[$e].total++}for(Nt=0;Nt<nr.length;Nt++)$n.indexOf(nr[Nt])===-1&&this.removeChild(nr[Nt].mesh);for(Nt=0;Nt<$n.length;Nt++)$n[Nt].mesh.parent!==this&&this.addChild($n[Nt].mesh);for(var Nt in this._activePagesMeshData=$n,on){var wr=(ur=on[Nt]).total;if(!(((e=ur.indices)===null||e===void 0?void 0:e.length)>6*wr)||ur.vertices.length<2*Mu.BATCHABLE_SIZE)ur.vertices=new Float32Array(8*wr),ur.uvs=new Float32Array(8*wr),ur.indices=new Uint16Array(6*wr);else for(var Ar=ur.total,Dr=ur.vertices,pi=4*Ar*2;pi<Dr.length;pi++)Dr[pi]=0;ur.mesh.size=6*wr}for(Nt=0;Nt<nn;Nt++){var Ji=($t=h[Nt]).position.x+oe[$t.line]*(this._align==="justify"?$t.prevSpaces:1);this._roundPixels&&(Ji=Math.round(Ji));var jr,Zr=Ji*s,Ai=$t.position.y*s,xr=on[(jr=$t.texture).baseTexture.uid],so=jr.frame,Hi=jr._uvs,Sr=xr.index++;xr.indices[6*Sr+0]=0+4*Sr,xr.indices[6*Sr+1]=1+4*Sr,xr.indices[6*Sr+2]=2+4*Sr,xr.indices[6*Sr+3]=0+4*Sr,xr.indices[6*Sr+4]=2+4*Sr,xr.indices[6*Sr+5]=3+4*Sr,xr.vertices[8*Sr+0]=Zr,xr.vertices[8*Sr+1]=Ai,xr.vertices[8*Sr+2]=Zr+so.width*s,xr.vertices[8*Sr+3]=Ai,xr.vertices[8*Sr+4]=Zr+so.width*s,xr.vertices[8*Sr+5]=Ai+so.height*s,xr.vertices[8*Sr+6]=Zr,xr.vertices[8*Sr+7]=Ai+so.height*s,xr.uvs[8*Sr+0]=Hi.x0,xr.uvs[8*Sr+1]=Hi.y0,xr.uvs[8*Sr+2]=Hi.x1,xr.uvs[8*Sr+3]=Hi.y1,xr.uvs[8*Sr+4]=Hi.x2,xr.uvs[8*Sr+5]=Hi.y2,xr.uvs[8*Sr+6]=Hi.x3,xr.uvs[8*Sr+7]=Hi.y3}for(var Nt in this._textWidth=V*s,this._textHeight=(u.y+r.lineHeight)*s,on){var ur=on[Nt];if(this.anchor.x!==0||this.anchor.y!==0)for(var Io=0,lc=this._textWidth*this.anchor.x,md=this._textHeight*this.anchor.y,ff=0;ff<ur.total;ff++)ur.vertices[Io++]-=lc,ur.vertices[Io++]-=md,ur.vertices[Io++]-=lc,ur.vertices[Io++]-=md,ur.vertices[Io++]-=lc,ur.vertices[Io++]-=md,ur.vertices[Io++]-=lc,ur.vertices[Io++]-=md;this._maxLineHeight=de*s;var zm=ur.mesh.geometry.getBuffer("aVertexPosition"),jm=ur.mesh.geometry.getBuffer("aTextureCoord"),Vm=ur.mesh.geometry.getIndex();zm.data=ur.vertices,jm.data=ur.uvs,Vm.data=ur.indices,zm.update(),jm.update(),Vm.update()}for(Nt=0;Nt<h.length;Nt++)zp.push(h[Nt])},n.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},n.prototype.getLocalBounds=function(){return this.validate(),o.prototype.getLocalBounds.call(this)},n.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},Object.defineProperty(n.prototype,"tint",{get:function(){return this._tint},set:function(e){if(this._tint!==e){this._tint=e;for(var r=0;r<this._activePagesMeshData.length;r++)this._activePagesMeshData[r].mesh.tint=e}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fontName",{get:function(){return this._fontName},set:function(e){if(!gl.available[e])throw new Error('Missing BitmapFont "'+e+'"');this._fontName!==e&&(this._fontName=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"anchor",{get:function(){return this._anchor},set:function(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"text",{get:function(){return this._text},set:function(e){e=String(e==null?"":e),this._text!==e&&(this._text=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),n.prototype.destroy=function(e){var r=this._textureCache;for(var s in r)r[s].destroy(),delete r[s];this._textureCache=null,o.prototype.destroy.call(this,e)},n.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0}}(Ri),function(){function o(){}return o.add=function(){fo.setExtensionXhrType("fnt",fo.XHR_RESPONSE_TYPE.TEXT)},o.use=function(n,e){var r=Au(n.data);if(r)for(var s=o.getBaseUrl(this,n),u=r.parse(n.data),h={},f=function(K){h[K.metadata.pageFile]=K.texture,Object.keys(h).length===u.page.length&&(n.bitmapFont=gl.install(u,h,!0),e())},y=0;y<u.page.length;++y){var b=u.page[y].file,T=s+b,P=!1;for(var j in this.resources){var G=this.resources[j];if(G.url===T){G.metadata.pageFile=b,G.texture?f(G):G.onAfterMiddleware.add(f),P=!0;break}}if(!P){var V={crossOrigin:n.crossOrigin,loadType:fo.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:b},n.metadata.imageMetadata),parentResource:n};this.add(T,V,f)}}else e()},o.getBaseUrl=function(n,e){var r=e.isDataUrl?"":o.dirname(e.url);return e.isDataUrl&&(r==="."&&(r=""),n.baseUrl&&r&&n.baseUrl.charAt(n.baseUrl.length-1)==="/"&&(r+="/")),(r=r.replace(n.baseUrl,""))&&r.charAt(r.length-1)!=="/"&&(r+="/"),r},o.dirname=function(n){var e=n.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return e===n?".":e===""?"/":e},o}()),Cu=function(o,n){return(Cu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)r.hasOwnProperty(s)&&(e[s]=r[s])})(o,n)},jp=function(o){function n(e){e===void 0&&(e=1);var r=o.call(this,`attribute vec2 aVertexPosition;
5479
+ `&&(/(?:\s)/.test(he)&&(G=Tt),f.push(G),V=Math.max(V,G),y.push(-1));var oe=[];for(Nt=0;Nt<=K;Nt++){var Ae=0;this._align==="right"?Ae=V-f[Nt]:this._align==="center"?Ae=(V-f[Nt])/2:this._align==="justify"&&(Ae=y[Nt]<0?0:(V-f[Nt])/y[Nt]),oe.push(Ae)}var nn=h.length,on={},$n=[],nr=this._activePagesMeshData;for(Nt=0;Nt<nr.length;Nt++)$l.push(nr[Nt]);for(Nt=0;Nt<nn;Nt++){var $e=(jr=h[Nt].texture).baseTexture.uid;if(!on[$e]){if(!(ur=$l.pop())){var Ue=new Rh,Cn=new Zl(qn.EMPTY);ur={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:new Mu(Ue,Cn),vertices:null,uvs:null,indices:null}}ur.index=0,ur.indexCount=0,ur.vertexCount=0,ur.uvsCount=0,ur.total=0;var kn=this._textureCache;kn[$e]=kn[$e]||new qn(jr.baseTexture),ur.mesh.texture=kn[$e],ur.mesh.tint=this._tint,$n.push(ur),on[$e]=ur}on[$e].total++}for(Nt=0;Nt<nr.length;Nt++)$n.indexOf(nr[Nt])===-1&&this.removeChild(nr[Nt].mesh);for(Nt=0;Nt<$n.length;Nt++)$n[Nt].mesh.parent!==this&&this.addChild($n[Nt].mesh);for(var Nt in this._activePagesMeshData=$n,on){var wr=(ur=on[Nt]).total;if(!(((e=ur.indices)===null||e===void 0?void 0:e.length)>6*wr)||ur.vertices.length<2*Mu.BATCHABLE_SIZE)ur.vertices=new Float32Array(8*wr),ur.uvs=new Float32Array(8*wr),ur.indices=new Uint16Array(6*wr);else for(var Ar=ur.total,Dr=ur.vertices,pi=4*Ar*2;pi<Dr.length;pi++)Dr[pi]=0;ur.mesh.size=6*wr}for(Nt=0;Nt<nn;Nt++){var Ji=($t=h[Nt]).position.x+oe[$t.line]*(this._align==="justify"?$t.prevSpaces:1);this._roundPixels&&(Ji=Math.round(Ji));var jr,Zr=Ji*s,Ai=$t.position.y*s,xr=on[(jr=$t.texture).baseTexture.uid],so=jr.frame,Hi=jr._uvs,Sr=xr.index++;xr.indices[6*Sr+0]=0+4*Sr,xr.indices[6*Sr+1]=1+4*Sr,xr.indices[6*Sr+2]=2+4*Sr,xr.indices[6*Sr+3]=0+4*Sr,xr.indices[6*Sr+4]=2+4*Sr,xr.indices[6*Sr+5]=3+4*Sr,xr.vertices[8*Sr+0]=Zr,xr.vertices[8*Sr+1]=Ai,xr.vertices[8*Sr+2]=Zr+so.width*s,xr.vertices[8*Sr+3]=Ai,xr.vertices[8*Sr+4]=Zr+so.width*s,xr.vertices[8*Sr+5]=Ai+so.height*s,xr.vertices[8*Sr+6]=Zr,xr.vertices[8*Sr+7]=Ai+so.height*s,xr.uvs[8*Sr+0]=Hi.x0,xr.uvs[8*Sr+1]=Hi.y0,xr.uvs[8*Sr+2]=Hi.x1,xr.uvs[8*Sr+3]=Hi.y1,xr.uvs[8*Sr+4]=Hi.x2,xr.uvs[8*Sr+5]=Hi.y2,xr.uvs[8*Sr+6]=Hi.x3,xr.uvs[8*Sr+7]=Hi.y3}for(var Nt in this._textWidth=V*s,this._textHeight=(u.y+r.lineHeight)*s,on){var ur=on[Nt];if(this.anchor.x!==0||this.anchor.y!==0)for(var Io=0,lc=this._textWidth*this.anchor.x,md=this._textHeight*this.anchor.y,ff=0;ff<ur.total;ff++)ur.vertices[Io++]-=lc,ur.vertices[Io++]-=md,ur.vertices[Io++]-=lc,ur.vertices[Io++]-=md,ur.vertices[Io++]-=lc,ur.vertices[Io++]-=md,ur.vertices[Io++]-=lc,ur.vertices[Io++]-=md;this._maxLineHeight=de*s;var jm=ur.mesh.geometry.getBuffer("aVertexPosition"),Vm=ur.mesh.geometry.getBuffer("aTextureCoord"),Wm=ur.mesh.geometry.getIndex();jm.data=ur.vertices,Vm.data=ur.uvs,Wm.data=ur.indices,jm.update(),Vm.update(),Wm.update()}for(Nt=0;Nt<h.length;Nt++)zp.push(h[Nt])},n.prototype.updateTransform=function(){this.validate(),this.containerUpdateTransform()},n.prototype.getLocalBounds=function(){return this.validate(),o.prototype.getLocalBounds.call(this)},n.prototype.validate=function(){this.dirty&&(this.updateText(),this.dirty=!1)},Object.defineProperty(n.prototype,"tint",{get:function(){return this._tint},set:function(e){if(this._tint!==e){this._tint=e;for(var r=0;r<this._activePagesMeshData.length;r++)this._activePagesMeshData[r].mesh.tint=e}},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"align",{get:function(){return this._align},set:function(e){this._align!==e&&(this._align=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fontName",{get:function(){return this._fontName},set:function(e){if(!gl.available[e])throw new Error('Missing BitmapFont "'+e+'"');this._fontName!==e&&(this._fontName=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"fontSize",{get:function(){return this._fontSize},set:function(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"anchor",{get:function(){return this._anchor},set:function(e){typeof e=="number"?this._anchor.set(e):this._anchor.copyFrom(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"text",{get:function(){return this._text},set:function(e){e=String(e==null?"":e),this._text!==e&&(this._text=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxWidth",{get:function(){return this._maxWidth},set:function(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"maxLineHeight",{get:function(){return this.validate(),this._maxLineHeight},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"textWidth",{get:function(){return this.validate(),this._textWidth},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"letterSpacing",{get:function(){return this._letterSpacing},set:function(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"textHeight",{get:function(){return this.validate(),this._textHeight},enumerable:!1,configurable:!0}),n.prototype.destroy=function(e){var r=this._textureCache;for(var s in r)r[s].destroy(),delete r[s];this._textureCache=null,o.prototype.destroy.call(this,e)},n.styleDefaults={align:"left",tint:16777215,maxWidth:0,letterSpacing:0}}(Ri),function(){function o(){}return o.add=function(){fo.setExtensionXhrType("fnt",fo.XHR_RESPONSE_TYPE.TEXT)},o.use=function(n,e){var r=Au(n.data);if(r)for(var s=o.getBaseUrl(this,n),u=r.parse(n.data),h={},f=function(K){h[K.metadata.pageFile]=K.texture,Object.keys(h).length===u.page.length&&(n.bitmapFont=gl.install(u,h,!0),e())},y=0;y<u.page.length;++y){var b=u.page[y].file,T=s+b,P=!1;for(var j in this.resources){var G=this.resources[j];if(G.url===T){G.metadata.pageFile=b,G.texture?f(G):G.onAfterMiddleware.add(f),P=!0;break}}if(!P){var V={crossOrigin:n.crossOrigin,loadType:fo.LOAD_TYPE.IMAGE,metadata:Object.assign({pageFile:b},n.metadata.imageMetadata),parentResource:n};this.add(T,V,f)}}else e()},o.getBaseUrl=function(n,e){var r=e.isDataUrl?"":o.dirname(e.url);return e.isDataUrl&&(r==="."&&(r=""),n.baseUrl&&r&&n.baseUrl.charAt(n.baseUrl.length-1)==="/"&&(r+="/")),(r=r.replace(n.baseUrl,""))&&r.charAt(r.length-1)!=="/"&&(r+="/"),r},o.dirname=function(n){var e=n.replace(/\\/g,"/").replace(/\/$/,"").replace(/\/[^\/]*$/,"");return e===n?".":e===""?"/":e},o}()),Cu=function(o,n){return(Cu=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)r.hasOwnProperty(s)&&(e[s]=r[s])})(o,n)},jp=function(o){function n(e){e===void 0&&(e=1);var r=o.call(this,`attribute vec2 aVertexPosition;
5480
5480
  attribute vec2 aTextureCoord;
5481
5481
 
5482
5482
  uniform mat3 projectionMatrix;
@@ -5888,7 +5888,7 @@ void main(void){
5888
5888
  gl_FragColor = texColor;
5889
5889
  }
5890
5890
  }
5891
- `,{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF"}set color(n){this.currentColor=n;const e=Rs(n);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const kh=new ai.ColorMatrixFilter;kh.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const Uh=new ai.ColorMatrixFilter;Uh.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const Yd=new ai.ColorMatrixFilter;Yd.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const Gh=new ai.ColorMatrixFilter;Gh.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const Zd={darken:kh,darkenLess:Uh,lightenLess:Gh,lighten:Yd};var Jd=S(2),Nu=S.n(Jd);class $d{constructor(n){this.scaleX=1,this.scaleY=1,this.pivot={x:0,y:0},this.paths=[],this.hash="",this.width=0,this.height=0,this.graphicsId="",this.textureId="",this.id=n.id,this.type=n.type,this.heightSize=n.heightSize,this.widthSize=n.widthSize,this.fillStyle=n.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=n.lineWidth||1,this.position=n.position||{x:0,y:0},this.rotate=n.rotation||1,this.path=this.getUnitPath(),this.setScaleFromLineWidth(),this.setScaleFromSize(),this.generatePaths(),this.setPivot()}setPivot(){switch(this.type){case"oval":case"diamond":this.pivot={x:this.width/2,y:this.height/2};break;case"arrow":case"stealth":case"triangle":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+Nu()(this.path+this.scaleX+this.scaleY),this.paths=[{id:this.id,path:this.path,fill:"norm",hasStroke:!1,hash:this.hash,scale:{x:this.scaleX,y:this.scaleY}}]}getUnitPath(){switch(this.type){case"stealth":return"M 0,0 L 95250,47625 L 0,95250 L 28575,47625 C C";case"oval":return"M 0,47625 A 47625,47625,-3.14159265,6.2831853 C C";case"diamond":return"M 47625,0 L 95250,47625 L 47625,95250 L 0,47625 C C";case"arrow":return"M 9525,0 L 95250,47625 L 9525,95250 L 0,85725 L 68389.5,47625 L 0,9525 C C";case"triangle":return"M 0,0 L 95250,47625 L 0,95250 C C";default:return""}}setScaleFromLineWidth(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=.29*this.lineWidth+.7,this.scaleY*=.29*this.lineWidth+.7;break;default:throw new Error("can't match any arrow type!")}}setScaleFromSize(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=1,this.scaleY*=1;break;default:throw new Error("can't match any arrow type!")}switch(this.widthSize){case"sm":this.scaleX*=3/4;break;case"lg":this.scaleX*=1.25;break;case"med":this.scaleX*=1}switch(this.heightSize){case"sm":this.scaleY*=3/4;break;case"lg":this.scaleY*=1.25;break;case"med":this.scaleY*=1}this.width=10*this.scaleX,this.height=10*this.scaleY}}class zc extends Bh{constructor(n,e,r){super({position:{x:n.x,y:n.y},width:n.width,height:n.height},e,r),this.fillColorFilter=new Du,this.fill=new eu(this),this.json=n,this.ctx=e,this.parentGlobalPos=r,this.global={x:r.x+n.x,y:r.y+n.y},this.updateTransform({position:{x:n.x,y:n.y},width:n.width,height:n.height})}get fillActive(){var n,e;return((e=(n=this.container.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set fillActive(n){var e,r;n?((r=(e=this.container.filters)===null||e===void 0?void 0:e.indexOf(this.fillColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(n){const e=n*this.ctx.stageWidth-this.global.x,r=this.presetSubType===544?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*r}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(n){const e=n*this.ctx.stageHeight-this.global.y,r=this.presetSubType===544?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*r}get design_ppt_x(){return Cs(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return Cs(this.global.y/this.ctx.stageHeight)}}var jc=S(9),no=S.n(jc);function Is(){return Date.now().toString(32)+Math.random().toString(32).substring(2)}function Vc(o){const n=[],e=o.filter(y=>{const b=y.width<2048&&y.height<2048;return b||n.push(y),b}).sort((y,b)=>y.width*y.height-b.width*b.height);let r=e.length+1,s=2050,u=2050;const h=[];let f=null;for(;(s>2048||u>2048)&&e.length>0;)r-=1,f=no()(e.slice(0,r)),s=f.width,u=f.height;return f&&h.push(f),n.forEach(y=>{const b=no()([y]);h.push(b)}),r<e.length?h.concat(Vc(e.slice(r))):h}function Yp(o,n,e){let r,s,u=n,h=e;u===0&&(u=h/1e4),h===0&&(h=u/1e4);const f=o%360;if(f%180==0)r=Math.cos(f*(Math.PI/180))*u,s=0;else if(f%90==0)r=0,s=-Math.sin(f*(Math.PI/180))*h;else{const y=Math.tan(f*Math.PI/180);r=u*h/Math.sqrt(Math.pow(h,2)+Math.pow(u*y,2)),(f>90&&f<270||f<-90&&f>-270)&&(r=-r),s=-y*r}return{x:r,y:s}}function Fu(o,n,e,r,s,u,h){const f={x:0,y:0},y=-u,b=Yp((s=-s)/Math.PI*180,e,r),T=o.x-b.x,P=o.y-b.y;for(let j=0;j<51;j++){const G=Yp((s+j/50*y)/Math.PI*180,e,r);G.x+=T,G.y+=P,j/50==1&&(f.x=G.x,f.y=G.y),G.x=G.x/9525*n.x,G.y=G.y/9525*n.y,h.lineTo(G.x,G.y)}return f}class Wc{constructor(n,e,r,s){this.renderContainer=new Ri,this.ctx=n,this.type=e,this.lineWidth=r,this.width=s}createPaths(){if(this.type==="ww")return null;{const n=`M 0,0 L ${9525*this.width},0`;return{paths:[{id:Is(),path:n,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:Nu()(n)}],width:this.width,height:this.lineWidth}}}preRender(){const n=this.createPaths();if(n){const{paths:e,width:r,height:s}=n,u=e.reduce((h,f)=>h+f.hash,"");this.ghcTextureId=this.ctx.graphicsTexture.addGraphics(e,u,{x:0,y:0},r,s,{width:this.lineWidth},!1)}}render(){if(this.ghcTextureId){const n=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);n&&(this.sprite=new Nr,this.sprite.pivot.x=n.pivot.x,this.sprite.texture=n.texture)}}destroy(){console.log("")}}var Zp=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Xc extends zc{constructor(n,e,r){super(n,e,r),this.fillMaskSprite=new Nr,this.fillSprite=new Nr,this.strokeMaskSprite=new Nr,this.strokeSprite=new Nr,this.textureContainer=new Ri,this.underline=null;const{underLine:s,lineHeight:u,width:h}=this.json;s&&(this.underline=new Wc(e,s.type,u/16,h))}getIterateEntry(){return null}getBgElement(){return null}updateTransform(n){var e,r,s,u;const{isHorz:h}=this.json;n.position={x:h&&(r=(e=n.position)===null||e===void 0?void 0:e.x)!==null&&r!==void 0?r:0,y:h?0:(u=(s=n.position)===null||s===void 0?void 0:s.y)!==null&&u!==void 0?u:0},n.width=h?this.json.width:this.json.lineWidth,n.height=h?this.json.lineHeight:this.json.height,super.updateTransform(n)}preRender(){const{fill:n,stroke:e,lineWidth:r,lineHeight:s,content:u}=this.json;n&&(this.fillTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:n.key,filters:[{type:"changeBulletColor",args:["#000000","#FFA500"]}]},n.width,n.height,void 0,u==="\u25FE"),n.fill&&n.fill.fillType!=="noFill"&&(this.fillBgId=this.ctx.fillTexture.addFill(n.fill,r,s))),e&&(this.strokeTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:e.key,filters:[]},e.width,e.height),e.fill&&e.fill.fillType!=="noFill"&&(this.strokeBgId=this.ctx.fillTexture.addFill(e.fill,r,s))),this.underline&&this.underline.preRender()}render(){var n;return Zp(this,void 0,void 0,function*(){const{lineWidth:e,lineHeight:r,baseLine:s,isHorz:u,height:h,width:f,highlightColor:y,x:b,y:T,content:P}=this.json;if(y){const V=new ps,[K,_t]=Lu(y);V.beginFill(K,_t),V.drawRect(0,0,u?f:e,u?r:h),V.endFill(),this.textureContainer.addChild(V)}if(this.fillBgId&&this.fillTextureId){const V=this.ctx.fillTexture.getTexture(this.fillTextureId);(V==null?void 0:V.texture)&&(this.fillMaskSprite.texture=V.texture,this.fillMaskSprite.scale.x=.5,this.fillMaskSprite.scale.y=.5);const K=this.ctx.fillTexture.getTexture(this.fillBgId);K.texture&&(this.fillSprite.texture=K.texture,this.fillSprite.mask=this.fillMaskSprite,this.fillSprite.addChild(this.fillMaskSprite),u?this.fillSprite.position.y=T:this.fillSprite.position.x=b,this.textureContainer.addChild(this.fillSprite))}if(this.strokeBgId&&this.strokeTextureId){const V=this.ctx.fillTexture.getTexture(this.strokeTextureId);(V==null?void 0:V.texture)&&(this.strokeMaskSprite.texture=V.texture,this.strokeMaskSprite.scale.x=.5,this.strokeMaskSprite.scale.y=.5);const K=this.ctx.fillTexture.getTexture(this.strokeBgId);(K==null?void 0:K.texture)&&(this.strokeSprite.texture=K.texture,this.strokeSprite.mask=this.strokeMaskSprite,this.strokeSprite.addChild(this.strokeMaskSprite),u?this.strokeSprite.position.y=T:this.strokeSprite.position.x=b,this.textureContainer.addChild(this.strokeSprite))}if(this.underline&&(this.underline.render(),this.underline.sprite&&this.fillMaskSprite)){let V=null;this.fillBgId&&(V=this.ctx.fillTexture.getTexture(this.fillBgId)),this.underline.sprite.position.y=s,this.underline.sprite.position.x=0;const K=new Nr;K.texture=(n=V==null?void 0:V.texture)!==null&&n!==void 0?n:null,K.mask=this.underline.sprite,K.addChild(this.underline.sprite),this.textureContainer.addChild(K)}const j=Li.create({width:u?f:e,height:u?r:h,resolution:2});this.ctx.renderer.render(this.textureContainer,{renderTexture:j});const G=new Nr;G.texture=j,this.container.addChild(G),this.container.name=P})}destroy(){this.textureContainer.destroy({texture:!0}),this.container.destroy({children:!0,texture:!0})}}var Hh=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class qc extends zc{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(n,e,r){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}preRender(){for(let n=0,e=this.json.textUnits.length;n<e;n++){const r=this.json.textUnits[n];if(!r.content)continue;const{height:s,width:u,baseline:h}=this.json,f=new Xc(Object.assign(Object.assign({},r),{lineHeight:s,lineWidth:u,baseLine:h,isHorz:this.isHorz}),this.ctx,this.global);f.preRender(),this.units.push(f)}}render(){return Hh(this,void 0,void 0,function*(){for(const n of this.units.reverse())yield n.render(),this.container.addChild(n.container)})}destroy(){this.units.forEach(n=>{n.destroy()}),this.container.destroy({children:!1})}}var ro=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Jp extends zc{constructor(){super(...arguments),this.iterateElements=[],this.lines=[],this.isHorz=!0}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const n=this.lines.reduce((e,r)=>e=e.concat(r.getIterateElements()),[]);return this.iterateElements=n,n}getIterateEntry(n,e,r){const s=this.getIterateElements();return s[e]?s[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}preRender(){for(let n=0,e=this.json.lines.length;n<e;n++){const r=this.json.lines[n],s=new qc(r,this.ctx,this.global);s.isHorz=this.isHorz,s.container.name="line-"+n,s.preRender(),this.lines.push(s)}}render(){return ro(this,void 0,void 0,function*(){for(const n of this.lines)yield n.render(),this.container.addChild(n.container)})}destroy(){this.lines.forEach(n=>{n.destroy()}),this.container.destroy({children:!1})}}var Yc=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Zc{constructor(n,e,r,s){this.iterateElements=[],this.paragraphs=[],this.container=new Ri,this.json=n,this.ctx=e,this.parentGlobalPos=s,this.iterateType=r,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+n.position.x,y:this.parentGlobalPos.y+n.position.y},this.container.position.x=n.position.x,this.container.position.y=n.position.y,this.container.scale.x=n.scale.x,this.container.scale.y=n.scale.y;const u=new ps;u.drawRect(0,0,n.width,n.height),this.container.addChild(u)}get width(){return this.json.width}get height(){return this.json.height}get x(){return this.json.position.x}get y(){return this.json.position.y}getTextElement(n,e){return n==="paragraph"?this.paragraphs[e[0]]:null}getIterateEntry(n,e){return this.iterateElements[n]?this.iterateElements[n]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(n=>{n.destroy()})}preRender(){var n;for(let e=0,r=this.json.paragraphs.length;e<r;e++){const s=this.json.paragraphs[e],u=new Jp(s,this.ctx,this.global);u.isHorz=(n=this.json.isHorz)===null||n===void 0||n,u.preRender(),this.iterateElements=this.iterateElements.concat(u.getIterateElements()),u.container.name="\u6BB5\u843D-"+e,this.paragraphs.push(u)}}render(){return Yc(this,void 0,void 0,function*(){for(const e of this.paragraphs)yield e.render(),this.container.addChild(e.container);const{width:n}=this.container;this.container.scale.x<0&&(this.container.x+=-1*n)})}}var Kd=S(19),Jc=S.n(Kd),Ya=S(20),$p=S.n(Ya);const $c={Reflection:class extends Uo{constructor(o){super(Jc.a,$p.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uStartAlpha:o.startAlpha,uEndAlpha:o.endAlpha,uBlur:0}),this.json=o}}};var io=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};const nu={pivot:{x:0,y:0},width:0,height:0};class xl extends Bh{constructor(n,e,r){var s,u,h;super(n,e,r),this.renderContainer=new Ri,this.bgTextureId="",this.bgSprite=new Nr,this.backgroundMaskTextureId="",this.filterAreaJustifies=[],this.backgroundMask=new Nr,this.pathStrokeTextureId="",this.pathSprite=new Nr,this.pathMask=new Nr,this.pathMaskTextureId="",this.fillColorFilter=new Du,this.strokeColorFilter=new Du,this.id="",this.arrowList=[],this.fill=new eu(this),this.stroke=new ri(this),this.updateFilterArea=()=>{const f=this.renderContainer.getBounds(!1),y=this.filterAreaJustifies.map(j=>j(f)),b=y.map(j=>j.width),T=y.map(j=>j.height),P=new dr(f.x,f.y,Math.max(...b),Math.max(...T));this.renderContainer.filterArea=P,this.renderContainer.filters.forEach(j=>{j.uniforms.uShapeFilterArea=new Float32Array(4),j.uniforms.uShapeFilterArea[0]=P.x,j.uniforms.uShapeFilterArea[1]=P.y,j.uniforms.uShapeFilterArea[2]=P.width,j.uniforms.uShapeFilterArea[3]=P.height})},this.json=n,this.id=n.id,this.container.name=n.id,this.renderContainer.name=n.id+"-render-container",this.fillStyle=n.fillStyle,this.lineStyle=n.lineStyle,this.geometry=n.geometry,this.ctx.timingTargets.addTarget(this.id,this),((s=this.fillStyle)===null||s===void 0?void 0:s.fillType)==="solidFill"&&(this.fillColorFilter.currentColor=this.fillStyle.color),((h=(u=this.lineStyle)===null||u===void 0?void 0:u.fill)===null||h===void 0?void 0:h.fillType)==="solidFill"&&(this.strokeColorFilter.currentColor=this.lineStyle.fill.color),this.pathSprite.name="path-fill",this.pathMask.name="path-mask",this.bgSprite.name="bg-fill",this.backgroundMask.name="bg-mask",this.updateTransform(this.json),n.textBody&&(this.text=new Zc(n.textBody,this.ctx,n.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new dc(1,1,this.json.width,this.json.height)}get interactiveContainer(){return this.renderContainer}get strokeActive(){var n,e;return((e=(n=this.pathSprite.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set strokeActive(n){var e,r;n?((r=(e=this.pathSprite.filters)===null||e===void 0?void 0:e.indexOf(this.strokeColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.pathSprite.filters=[this.strokeColorFilter]):this.pathSprite.filters=[]}get fillActive(){var n,e;return((e=(n=this.bgSprite.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set fillActive(n){var e,r;n?((r=(e=this.bgSprite.filters)===null||e===void 0?void 0:e.indexOf(this.fillColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.bgSprite.filters=[this.fillColorFilter]):this.bgSprite.filters=[]}getTextElement(n,e){var r,s;return(s=(r=this.text)===null||r===void 0?void 0:r.getTextElement(n,e))!==null&&s!==void 0?s:null}getBgElement(){return this}getIterateEntry(n,e,r){return n==="el"||e===0?this:this.text?this.text.getIterateEntry(e-1,r)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}createBackgroundMask(){return io(this,void 0,void 0,function*(){const n=this.ctx.graphicsTexture.getGraphicsData(this.backgroundMaskTextureId);n&&(this.backgroundMask.texture=n.texture,this.backgroundMask.pivot.x=n.pivot.x,this.backgroundMask.pivot.y=n.pivot.y)})}createBackground(){var n,e,r,s,u,h,f,y,b;const{pivot:T,width:P,height:j}=((n=this.geometry)===null||n===void 0?void 0:n.fillTransform)||nu;if(this.json.useBgFill&&this.ctx.bgTexture)return this.bgSprite.texture=this.ctx.bgTexture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.bgSprite.pivot.x=((e=this.json.position)===null||e===void 0?void 0:e.x)||0,void(this.bgSprite.pivot.y=((r=this.json.position)===null||r===void 0?void 0:r.y)||0);if(((s=this.fillStyle)===null||s===void 0?void 0:s.fillType)==="gifFill"){const G=this.ctx.fillTexture.getGifFrames(this.fillStyle.src),V=G.map((Tt,jt)=>({texture:Tt,time:this.fillStyle.delays[jt]||20}));this.bgSprite=new _l(V,!0),this.bgSprite.play();let K=1;const _t=this.fillStyle.loop;this.bgSprite.onLoop=()=>{K+=1,_t>0&&K>_t&&this.bgSprite.gotoAndStop(G.length-1)},this.bgSprite.height=j||this.designHeight,this.bgSprite.width=P||this.designWidth,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite)}else if(((u=this.fillStyle)===null||u===void 0?void 0:u.fillType)==="groupFill"){if(this.groupFillTextureId){const G=this.ctx.fillTexture.getTexture(this.groupFillTextureId);G.texture&&(this.bgSprite.texture=G.texture,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=-1*((f=(h=this.json.position)===null||h===void 0?void 0:h.x)!==null&&f!==void 0?f:0),this.bgSprite.y=-1*((b=(y=this.json.position)===null||y===void 0?void 0:y.y)!==null&&b!==void 0?b:0),this.container.addChild(this.bgSprite),this.container.addChild(this.backgroundMask))}}else{const G=this.ctx.fillTexture.getTexture(this.bgTextureId);G.texture&&(this.bgSprite.texture=G.texture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.bgSprite.pivot.x=G.pivot.x,this.bgSprite.pivot.y=G.pivot.y)}}createPathFill(){const n=this.ctx.fillTexture.getTexture(this.pathStrokeTextureId);n.texture&&(this.pathSprite.texture=n.texture,this.pathSprite.pivot.x=this.pathMask.pivot.x,this.pathSprite.pivot.y=this.pathMask.pivot.y,this.pathMask.pivot.x=0,this.pathMask.pivot.y=0,this.pathSprite.mask=this.pathMask,this.pathSprite.addChild(this.pathMask),this.container.addChild(this.pathSprite))}createPathMask(){return io(this,void 0,void 0,function*(){const n=this.ctx.graphicsTexture.getGraphicsData(this.pathMaskTextureId);if(n){const{texture:e,pivot:r}=n;this.pathMask.texture=e,this.pathMask.pivot.x=r.x,this.pathMask.pivot.y=r.y,this.pathMask.texture=e}})}createFilledPathMask(){var n,e;return io(this,void 0,void 0,function*(){const r=((e=(n=this.geometry)===null||n===void 0?void 0:n.paths)===null||e===void 0?void 0:e.filter(s=>s.fill!=="none"&&s.fill!=="norm"))||[];for(const s of r){const u=this.ctx.graphicsTexture.getGraphicsData(s.id);if(u){const h=new Nr(u.texture);h.pivot.x=u.pivot.x,h.pivot.y=u.pivot.y;const f=new Nr(this.bgSprite.texture);f.pivot.x=this.bgSprite.pivot.x,f.pivot.y=this.bgSprite.pivot.y,f.mask=h,f.filters=[Zd[s.fill]],this.container.addChild(f),this.container.addChild(h)}}})}createBackgroundTexture(){var n,e,r,s,u;if(this.fillStyle&&this.fillStyle.fillType!=="gifFill"&&this.fillStyle.fillType!=="groupFill"){const h=((n=this.geometry)===null||n===void 0?void 0:n.fillTransform)||nu,f=(h==null?void 0:h.width)||this.designWidth,y=(h==null?void 0:h.height)||this.designHeight;this.bgTextureId=this.ctx.fillTexture.addFill(this.fillStyle,f+((r=(e=this.lineStyle)===null||e===void 0?void 0:e.width)!==null&&r!==void 0?r:0),y+((u=(s=this.lineStyle)===null||s===void 0?void 0:s.width)!==null&&u!==void 0?u:0))}}createPathFillTexture(){var n,e;if(((n=this.lineStyle)===null||n===void 0?void 0:n.fill)&&this.lineStyle.fill.fillType!=="gifFill"&&this.lineStyle.fill.fillType!=="groupFill"){const{width:r,height:s}=((e=this.geometry)===null||e===void 0?void 0:e.lineTransform)||nu,u=Object(X.isNumber)(this.lineStyle.width)?this.lineStyle.width:1;this.pathStrokeTextureId=this.ctx.fillTexture.addFill(this.lineStyle.fill,(r||this.designWidth)+u,(s||this.designHeight)+u)}}createArrowFillTexture(){var n;(n=this.json.lineArrowList)===null||n===void 0||n.forEach(e=>{var r,s,u,h;const f=new $d(Object.assign(Object.assign({},e),{fillStyle:(r=this.lineStyle)===null||r===void 0?void 0:r.fill,lineWidth:(u=(s=this.lineStyle)===null||s===void 0?void 0:s.width)!==null&&u!==void 0?u:0}));f.graphicsId=this.ctx.graphicsTexture.addGraphics((h=f.paths)!==null&&h!==void 0?h:[],f.hash,f.pivot||{x:0,y:0},f.width,f.height,void 0,!0),f.textureId=this.ctx.fillTexture.addFill(f.fillStyle,f.width,f.height),this.arrowList.push(f)})}createArrow(){this.arrowList.forEach(n=>{const e=this.ctx.graphicsTexture.getGraphicsData(n.graphicsId),r=this.ctx.fillTexture.getTexture(n.textureId);if(e&&r.texture){const{texture:s,pivot:u}=e,h=new Nr(s);h.pivot.x=u.x,h.pivot.y=u.y;const f=new Nr(r.texture);f.addChild(h),f.mask=h,f.position.x=n.position.x,f.position.y=n.position.y,f.pivot.x=n.pivot.x+r.pivot.x,f.pivot.y=n.pivot.y+r.pivot.y,f.rotation=n.rotate/180*Math.PI,n.sprite=f,this.container.addChild(f)}})}preRender(){var n,e,r,s,u,h,f,y,b,T;this.createBackgroundTexture(),this.createPathFillTexture(),this.createArrowFillTexture();const{width:P,height:j,pivot:G}=((n=this.geometry)===null||n===void 0?void 0:n.lineTransform)||nu,V=P||this.designWidth,K=j||this.designHeight;((e=this.geometry)===null||e===void 0?void 0:e.paths)&&this.geometry.paths.length>0&&(this.pathMaskTextureId=this.ctx.graphicsTexture.addGraphics((s=(r=this.geometry)===null||r===void 0?void 0:r.paths)!==null&&s!==void 0?s:[],this.geometry.hash,G||{x:0,y:0},V,K,this.lineStyle,!1),this.backgroundMaskTextureId=this.ctx.graphicsTexture.addGraphics((h=(u=this.geometry)===null||u===void 0?void 0:u.paths)!==null&&h!==void 0?h:[],this.geometry.hash,G||{x:0,y:0},V,K,this.lineStyle,!0));const _t=((y=(f=this.geometry)===null||f===void 0?void 0:f.paths)===null||y===void 0?void 0:y.filter(Tt=>Tt.fill!=="none"&&Tt.fill!=="norm"))||[];for(const Tt of _t)this.ctx.graphicsTexture.addGraphics([Tt],Tt.hash,(((b=this.geometry)===null||b===void 0?void 0:b.lineTransform)||nu).pivot,V,K,this.lineStyle,!0,Tt.id);(T=this.text)===null||T===void 0||T.preRender()}subClassRender(){return io(this,void 0,void 0,function*(){})}setupEffect(){const{effectList:n}=this.json;if(n&&n.length>0){const e=[];return n.forEach(r=>{r.type==="reflection"&&(this.filterAreaJustifies.push(s=>(s.height*=2,s)),e.push(new $c.Reflection(r)))}),this.ctx.ticker.add(this.updateFilterArea,void 0,-20),this.renderContainer.filters=e,!0}return!1}render(){var n,e,r,s,u,h;return io(this,void 0,void 0,function*(){if(yield this.createBackgroundMask(),yield this.createBackground(),yield this.subClassRender(),yield this.createFilledPathMask(),yield this.createPathMask(),yield this.createPathFill(),yield this.createArrow(),this.text&&(yield this.text.render()),((n=this.json.textBody)===null||n===void 0?void 0:n.iterateType)==="wd"||((e=this.json.textBody)===null||e===void 0?void 0:e.iterateType)==="lt")this.renderContainer.addChild(this.container),this.text&&(this.text.container.position.x=((s=(r=this.json.position)===null||r===void 0?void 0:r.x)!==null&&s!==void 0?s:0)+this.text.x,this.text.container.position.y=((h=(u=this.json.position)===null||u===void 0?void 0:u.y)!==null&&h!==void 0?h:0)+this.text.y,this.renderContainer.addChild(this.text.container));else{if(this.text){if(Object(X.isBoolean)(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const f=this.json.rotation||0;this.text.container.rotation=-f;const{width:y}=this.text;this.text.container.position.x=y}this.container.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.renderContainer.cacheAsBitmap=!!this.json.cacheAsBitMap,this.json.id==="background"){const f=Li.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:f}),this.ctx.bgTexture=f}})}destroy(){this.bgSprite.destroy(),this.backgroundMask.destroy(),this.pathSprite.destroy(),this.pathMask.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.arrowList.forEach(n=>{var e;(e=n.sprite)===null||e===void 0||e.destroy()})}}var c=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};function g(o,n){for(const e in n)o.style[e]=n[e]}class E{constructor(n){var e,r;this.progress=document.createElement("div"),this.totalTime=document.createElement("span"),this.playButton=document.createElement("div"),this.pauseButton=document.createElement("div"),this.currentTime=document.createElement("span"),this.mediaController=document.createElement("div"),this.currentProgress=document.createElement("div"),this.medianIsEnd=!1,this.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=s=>{s.stopPropagation();const u=s.offsetX/this.progress.clientWidth*this.duration;this.jumpToTime(u),this.medianIsEnd=!1,this.ctx.eventHub.emit(Pn.mediaSeek,{id:this.targetId,time:this.media.currentTime-this.start,isPlaying:this.media.isPlaying})},this.jumpToTime=(s=0)=>{const u=Math.floor(s)+this.start;this.media.currentTime!==u&&(this.media.currentTime=u,(this.media.paused||this.media.ended)&&this.ctx.clock.setTimeout(()=>{this.media.play().then(()=>this.media.pause())},16))},this.showController=s=>{s.stopPropagation(),this.show()},this.getMediaDuration=()=>{this.duration&&!Number.isNaN(this.duration)||(this.duration=this.media.duration,this.start&&(this.duration-=this.start,this.jumpToTime()),this.end&&(this.duration-=this.end)),this.totalTime.innerText=E.formatTime(this.duration)},this.playMedia=()=>c(this,void 0,void 0,function*(){this.playButton.style.display="none",this.pauseButton.style.display="block",yield this.media.play(),this.medianIsEnd&&(this.medianIsEnd=!1,this.jumpToTime()),this.playCallBackList.forEach(s=>{s()})}),this.pauseMedia=()=>c(this,void 0,void 0,function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()}),this.onMouseOut=s=>{s.stopPropagation(),this.mediaController.style.display="none"},this.mediaTimeUpdate=()=>c(this,void 0,void 0,function*(){const s=this.media.currentTime-this.start;this.duration>0&&(s>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=E.formatTime(s),this.currentProgress.style.flex=(s/this.duration).toString()}),this.onPauseMedia=()=>{this.playButton.style.display="block",this.pauseButton.style.display="none"},this.onPlayMedia=()=>{this.playButton.style.display="none",this.pauseButton.style.display="block",this.playCallBackList.forEach(s=>{s()})},this.playMediaFromCtrl=()=>{this.ctx.eventHub.emit(Pn.mediaPlay,{id:this.targetId,time:this.media.currentTime}),this.playMedia()},this.pauseMediaFromCtrl=()=>{this.ctx.eventHub.emit(Pn.mediaPause,{id:this.targetId,time:this.media.currentTime}),this.pauseMedia()},this.targetId=n.targetId,this.ctx=n.ctx,this.height=n.height,this.width=n.width,this.sprite=n.sprite,this.media=n.media,this.info=n.info,this.canvasElement=n.canvasElement,this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=(e=this.info.cut.start)!==null&&e!==void 0?e:0,this.end=(r=this.info.cut.end)!==null&&r!==void 0?r:0)}getMedianContainer(){var n;let e=(n=this.canvasElement.parentElement)===null||n===void 0?void 0:n.querySelector(".median-container");e||(e=document.createElement("div"),e.className="median-container",this.canvasElement.parentElement.appendChild(e)),this.container=e}static formatTime(n){let e="00:00";if(n){const r=Math.floor(n/60),s=String(r<0?0:r).padStart(2,"0"),u=Math.floor(n%60);e=`${s}:${String(u<0?0:u).padStart(2,"0")}`}return e}createButton(){const n={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};g(this.playButton,Object.assign(Object.assign({},n),{display:"block"}));const e=document.createElement("img");g(e,{height:"20px"}),e.src="https://convertcdn.netless.link/publicFiles/icon/play.png",this.playButton.appendChild(e),g(this.pauseButton,Object.assign(Object.assign({},n),{display:"none"}));const r=document.createElement("img");g(r,{height:"20px"}),r.src="https://convertcdn.netless.link/publicFiles/icon/pause.png",this.pauseButton.appendChild(r)}createTimer(){const n=document.createElement("div");g(n,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",n.append(this.currentTime,e,this.totalTime),n}createProgress(){g(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const n=document.createElement("div");g(n,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(n),g(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),n.appendChild(this.currentProgress)}bindEvent(){this.mediaController.addEventListener("mouseover",this.showController,!1),this.mediaController.addEventListener("mouseout",this.onMouseOut,!1),this.progress.addEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.addEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.addEventListener("click",this.pauseMediaFromCtrl,!1),this.media.on("durationchange",this.getMediaDuration,!1),this.media.on("timeupdate",this.mediaTimeUpdate,!1),this.media.on("pause",this.onPauseMedia,!1),this.media.on("play",this.onPlayMedia,!1)}setControllerPosition(){var n;const{sprite:e}=this,{stageWidth:r,stageHeight:s}=this.ctx,u=e.getGlobalPosition(),h=1/Number((n=this.container)===null||n===void 0?void 0:n.getAttribute("data-scale"));u.y=u.y+this.height-50,u.x=Math.max(u.x,0),u.x=Math.min(u.x,r-300*h),u.y=Math.max(u.y,0),u.y=Math.min(u.y,s-50),g(this.mediaController,{height:"50px",borderRadius:"25px",width:"300px",flexDirection:"row",alignItems:"center",position:"absolute",left:u.x+"px",top:u.y+"px",display:"none",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${h})`,transformOrigin:"0 100%"})}createMediaController(){this.setControllerPosition(),this.createButton();const n=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,n,this.progress),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(n){this.playCallBackList.push(n)}unbindEvent(){this.mediaController.removeEventListener("mouseover",this.showController,!1),this.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",()=>this.playMedia(),!1),this.pauseButton.removeEventListener("click",()=>this.pauseMedia(),!1),this.media.removeListener("durationchange",this.getMediaDuration,!1),this.media.removeListener("timeupdate",this.mediaTimeUpdate,!1),this.media.removeListener("pause",this.onPauseMedia,!1),this.media.removeListener("play",this.onPlayMedia,!1)}show(){this.setControllerPosition(),this.mediaController.style.display="flex"}hide(){this.mediaController.style.display="none"}destroy(){var n;this.unbindEvent(),this.playCallBackList=[],(n=this.container)===null||n===void 0||n.removeChild(this.mediaController)}}var F=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class q extends J.a{constructor(n){var e,r;super(),this.type="video",this.sprite=new Nr,this.isPlaying=!1,this.id=n.id,this.video=n.video,this.start=(e=n.video.cut)===null||e===void 0?void 0:e.start,this.end=(r=n.video.cut)===null||r===void 0?void 0:r.end,this.container=n.container,this.ctx=n.ctx,this.ctx.medias[this.id]=this,this.videoResource=new sl(this.video.src,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});const{video:s,width:u,height:h,sprite:f}=n;this.controller=new E({targetId:n.id,ctx:n.ctx,width:u,height:h,sprite:f,media:this,info:s,canvasElement:n.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=u,this.sprite.height=h,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const y=new Jn(null,{height:h,width:u});y.resource=this.videoResource,this.videoResource.bind(y),this.sprite=new Nr,this.sprite.visible=!1,this.sprite.texture=new qn(y),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",b=>{b.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",b=>{b.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(b=>{this.videoResource.source.addEventListener(b,()=>{b!=="timeupdate"||this.isPlaying||this.pause(),this.emit(b)})})}get currentTime(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.currentTime)!==null&&e!==void 0?e:0}set currentTime(n){this.videoResource.source&&(this.videoResource.source.currentTime=n)}get paused(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.paused)===null||e===void 0||e}get ended(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.ended)===null||e===void 0||e}get duration(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.duration)!==null&&e!==void 0?e:0}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){var n;return F(this,void 0,void 0,function*(){this.isPlaying=!0,yield this.load(),yield this.ctx.clock.waitUntil(()=>{const r=this.videoResource.source;return!!(r&&r.videoWidth>0)},3e3);const e=this.videoResource.source;e&&e.videoWidth<=0||(yield(n=this.videoResource.source)===null||n===void 0?void 0:n.play())})}load(){return this.videoResource.load()}pause(){var n;this.isPlaying=!1,(n=this.videoResource.source)===null||n===void 0||n.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(n){this.controller.jumpToTime(n)}destroy(){var n;this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),(n=this.videoResource)===null||n===void 0||n.destroy(),this.controller.destroy()}}var dt=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Mt extends J.a{constructor(n){super(),this.type="audio",this.isPlaying=!1,this.id=n.id,this.audio=n.audio,this.container=n.container,this.container=n.container,this.audioEl=document.createElement("audio"),this.audioEl.src=this.audio.src,n.audio.cut&&(this.start=n.audio.cut.start,this.end=n.audio.cut.end),this.ctx=n.ctx,this.ctx.medias[this.id]=this;const{width:e,height:r,sprite:s}=n;this.controller=new E({targetId:n.id,ctx:n.ctx,height:r,width:e,sprite:s,media:this,info:this.audio,canvasElement:n.canvasElement}),["durationchange","timeupdate","pause","play"].forEach(u=>{this.audioEl.addEventListener(u,()=>{this.emit(u)})})}get currentTime(){return this.audioEl.currentTime}set currentTime(n){this.audioEl.currentTime=n}get paused(){return this.audioEl.paused}get ended(){return this.audioEl.ended}get duration(){return this.audioEl.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return dt(this,void 0,void 0,function*(){this.isPlaying=!0;try{yield this.audioEl.play()}catch{console.debug("[PPT Player]: refuse to play()")}})}pause(){this.isPlaying=!1,this.audioEl.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(n){this.controller.jumpToTime(n)}destroy(){this.audioEl.pause(),this.controller.destroy()}}var Lt=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class qt extends xl{constructor(n,e,r){super(Object.assign(Object.assign({},n),{type:"Shape",useBgFill:!1,textRotateWithShape:!0}),e,r),this.picTextureId="",this.picSprite=new Nr,this.picMask=new Nr,this.cmd=new yo(this),this.picFill=n.picFill,this.media=n==null?void 0:n.media}applyCommand(n,e){var r,s,u,h,f;if(e==="call")if(/playFrom\(([0-9.]+)\)/.test(n)){const y=n.match(/playFrom\(([0-9.]+)\)/),b=Number(y[1]||"0");(r=this.mediaPlayer)===null||r===void 0||r.play().then(()=>{var T;(T=this.mediaPlayer)===null||T===void 0||T.seek(b)})}else n==="custom-pause"?(s=this.mediaPlayer)===null||s===void 0||s.pause():n==="togglePause"?(u=this.mediaPlayer)===null||u===void 0||u.togglePause():n==="stop"&&((h=this.mediaPlayer)===null||h===void 0||h.pause(),(f=this.mediaPlayer)===null||f===void 0||f.seek(0))}renderPic(){var n,e,r;return Lt(this,void 0,void 0,function*(){const s=this.ctx.fillTexture.getTexture(this.picTextureId);s.texture&&(this.picSprite.texture=s.texture),this.picMask.texture=this.backgroundMask.texture,this.picSprite.mask=this.picMask,this.picSprite.width=this.designWidth,this.picSprite.height=this.designHeight,this.container.addChild(this.picSprite),this.container.addChild(this.picMask),((n=this.media)===null||n===void 0?void 0:n.type)==="video"&&this.media.src?(this.mediaPlayer=new q({id:this.json.id+"-video",ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view}),((e=this.mediaPlayer)===null||e===void 0?void 0:e.sprite)&&(this.mediaPlayer.sprite.mask=this.picMask)):((r=this.media)===null||r===void 0?void 0:r.type)==="audio"&&this.media.src&&(this.mediaPlayer=new Mt({id:this.json.id+"-audio",ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view})),this.mediaPlayer&&(this.picSprite.interactive=!0,this.picSprite.on("mouseover",()=>{this.mediaPlayer.showController()}),this.picSprite.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))})}preRender(){if(super.preRender(),this.picFill.fillType!=="gifFill")this.picTextureId=this.ctx.fillTexture.addFill(this.picFill,this.designWidth,this.designHeight);else{let n=1;const e=this.ctx.fillTexture.getGifFrames(this.picFill.src),r=e.map((u,h)=>({texture:u,time:this.picFill.delays[h]||20}));this.picSprite=new _l(r,!0),this.picSprite.play();const s=this.picFill.loop;this.picSprite.onLoop=()=>{n+=1,s>0&&n>s&&this.picSprite.gotoAndStop(e.length-1)}}}subClassRender(){return Lt(this,void 0,void 0,function*(){yield this.renderPic()})}destroy(){this.mediaPlayer&&(this.picSprite.interactive=!1,this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picSprite.destroy(),this.picMask.destroy()}}var Ee=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class me extends Bh{constructor(n,e,r){var s,u,h,f;super(n,e,r),this.children=[],this.cacheSprite=new Nr,this.json=n,this.container.name=n.id,this.ctx.timingTargets.addTarget(n.id,this);const y={x:(u=(s=n.position)===null||s===void 0?void 0:s.x)!==null&&u!==void 0?u:0,y:(f=(h=n.position)===null||h===void 0?void 0:h.y)!==null&&f!==void 0?f:0};n.children.forEach(b=>{let T=null;(b==null?void 0:b.type)==="Shape"?T=new xl(b,this.ctx,y):(b==null?void 0:b.type)==="Picture"?T=new qt(b,this.ctx,y):(b==null?void 0:b.type)==="Container"&&(T=new me(b,this.ctx,y)),T&&this.children.push(T)}),this.updateTransform(this.json)}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(){if(this.json.fillStyle)if(this.json.fillStyle.fillType==="groupFill")this.fillTextureId=this.groupFillTextureId;else{const{fillStyle:n,width:e,height:r}=this.json;this.fillTextureId=this.ctx.fillTexture.addFill(n,e,r)}for(const n of this.children)n.groupFillTextureId=this.fillTextureId,n.preRender()}getBgElement(){return null}getIterateEntry(n,e,r){return e===0?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}getTextElement(){return null}render(){var n;return Ee(this,void 0,void 0,function*(){const e=new Ri;for(const r of this.children)yield r.render(),r.renderContainer&&e.addChild(r.renderContainer),(r.json.hlinkHover||r.json.hlinkClick)&&((n=r.hyperlink)===null||n===void 0||n.addProxy(this.container));this.container.addChild(e),this.json.cacheAsTexture&&(function(r,s,u,h){const f=r.getBounds(),y=Math.min(f.x,s.x,f.x+f.width,s.x+s.width),b=Math.max(f.x,s.x,f.x+f.width,s.x+s.width),T=Math.min(f.y,s.y,f.y+f.height,s.y+s.height),P=b-y,j=Math.max(f.y,s.y,f.y+f.height,s.y+s.height)-T,G=s.x-f.x>0?s.x-f.x:0,V=s.y-f.y>0?s.y-f.y:0,K=Li.create({width:P,height:j,resolution:Math.ceil(h.renderer.resolution)});r.position.x=G,r.position.y=V,h.renderer.render(r,{renderTexture:K}),u.texture=K,u.position.x=-G,u.position.y=-V}(e,new dr(this.designX,this.designY,this.designWidth,this.designHeight),this.cacheSprite,this.ctx),this.container.addChild(this.cacheSprite),e.position.x=0,e.position.y=0,e.visible=!1)})}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(n=>n.destroy()),this.container.destroy()}}class De extends J.a{constructor(n,e,r,s){super(),this.cond={},this.timeoutIds=[],this.condHandle=u=>{if(u)if(u.delay&&u.delay>0){const h=this.ctx.clock.setTimeout(()=>{u.event&&(this.cond[u.event]=!0,this.detectTrigger())},u.delay);this.timeoutIds.push(h)}else this.cond[u.event]=!0,this.detectTrigger();else this.detectTrigger()},this.id=n,this.ctx=s,this.eventHubs=r,e.forEach(u=>{this.addCond(u)})}setTriggerParams(n){this.triggerParams=n}addCond(n){const e=()=>this.condHandle(n);n.event&&(/^shape/.test(n.event)||/^time/.test(n.event)?(this.cond[n.event]=!1,this.eventHubs.global.addListener(n.event,e)):/^runtime/.test(n.event)?(this.cond[n.event]=!1,this.eventHubs.runtime.addListener(n.event,e)):/^self/.test(n.event)?n.delay&&n.delay>0&&(this.cond[n.event]=!1,this.eventHubs.runtime.addListener(n.event,e)):this.cond[n.event]=!1)}isTrigger(){return Object.keys(this.cond).every(n=>!!this.cond[n])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(n=>n!=="self").every(n=>!!this.cond[n])}detectTrigger(){if(Object.keys(this.cond).every(n=>!!this.cond[n])){Object.keys(this.cond).forEach(e=>{this.cond[e]=!1});const n=this.triggerParams;this.triggerParams=void 0,this.emit("active",n)}}reset(){Object.keys(this.cond).forEach(n=>{this.cond[n]=!1}),this.timeoutIds.forEach(n=>this.ctx.clock.clearTimeout(n))}}class gn extends J.a{constructor(n){super(),this.runtimeNodeEventHub=new J.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=()=>{var P,j,G,V,K,_t;this.hasPrev()||!this.isMainSeq?this.currentSeqState==="idle"?(this.decrSeqIndex(),(P=this.commonTimeNode.children[this.currentSeqIndex])===null||P===void 0||P.commonTimeNode.seekToStart(),(j=this.commonTimeNode.children[this.currentSeqIndex])===null||j===void 0||j.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.currentSeqState==="running"?((G=this.commonTimeNode.children[this.currentSeqIndex])===null||G===void 0||G.commonTimeNode.seekToStart(),(V=this.commonTimeNode.children[this.currentSeqIndex])===null||V===void 0||V.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.currentSeqState==="end"&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),(K=this.commonTimeNode.children[this.currentSeqIndex])===null||K===void 0||K.commonTimeNode.seekToStart(),(_t=this.commonTimeNode.children[this.currentSeqIndex])===null||_t===void 0||_t.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide")},this.handleNext=()=>{var P,j,G,V;this.hasNext()||!this.isMainSeq?this.currentSeqState==="idle"?(P=this.commonTimeNode.children[this.currentSeqIndex])===null||P===void 0||P.commonTimeNode.startTimeNodeForce():this.currentSeqState==="running"?((j=this.commonTimeNode.children[this.currentSeqIndex])===null||j===void 0||j.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),(G=this.commonTimeNode.children[this.currentSeqIndex])===null||G===void 0||G.commonTimeNode.startTimeNodeForce()):this.currentSeqState==="end"&&(this.incrSeqIndex(),(V=this.commonTimeNode.children[this.currentSeqIndex])===null||V===void 0||V.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide")};const{json:e,iterateType:r,isIterate:s,isSub:u,parent:h,ctx:f,eventHub:y,iterateIndex:b,iterateId:T}=n;this.isMainSeq=e.ctn.nodeType==="mainSeq",this.isInteractiveSeq=e.ctn.nodeType==="interactiveSeq",this.id=e.ctn.id,this.isIterate=s,this.json=e,this.ctx=f,this.globalEventHub=y,this.commonTimeNode=new Po({json:e.ctn,isSub:u,eventHubs:{global:y,runtime:this.runtimeNodeEventHub},ctx:f,parent:h,isIterate:!1,iterateType:r,iterateIndex:b,iterateId:T}),this.bindShapeEvent(),this.nextConds=new De("mainSeq",e.nextCondLst,{global:y,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new De("mainSeq",e.preCondLst,{global:y,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",P=>{const j=this.commonTimeNode.children.findIndex(G=>G.commonTimeNode.uuid===P.id);j>=0&&(this.currentSeqIndex=j),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit(Pn.mainSeqStepStart,j)}),this.commonTimeNode.on("childTimeNodeEnd",P=>{const j=this.commonTimeNode.children.findIndex(G=>G.commonTimeNode.uuid===P.id);j>=0&&(this.currentSeqIndex=j),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext()}),this.isMainSeq&&this.ctx.eventHub.emit(Pn.mainSeqStepEnd,j)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.commonTimeNode.resetForRepeat(),this.ctx.clock.setTimeout(()=>{this.currentSeqState="idle",this.currentSeqIndex=0})}),this.nextConds.on("active",()=>{if(this.isInteractiveSeq){const{mode:P}=this.ctx;P!=="interactive"&&P!=="sync"||this.ctx.eventHub.emit(Pn.interactiveSeqNext,this.json.ctn.id),P!=="sync"&&P!=="local"||this.handleNext()}else this.handleNext()}),this.prevConds.on("active",this.handlePrev)}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(n){this._currentSeqIndex=n,this.isMainSeq?this.ctx.eventHub.emit(Pn.mainSeqStepChange,n):this.isInteractiveSeq&&this.ctx.eventHub.emit(Pn.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:n,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(n){this._currentSeqState=n,this.isMainSeq?this.ctx.eventHub.emit(Pn.mainSeqStateChange,n):this.isInteractiveSeq&&this.ctx.eventHub.emit(Pn.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:n}})}get stepLength(){return this.commonTimeNode.children.length}get currentStep(){return this.currentSeqIndex}get currentState(){return this.currentSeqState}startAutoPlay(){this.autoPlay=!0,this.commonTimeNode.children[0].commonTimeNode.startTimeNodeForce()}incrSeqIndex(){this.currentSeqIndex+1<=this.commonTimeNode.children.length&&(this.currentSeqIndex+=1)}decrSeqIndex(){this.currentSeqIndex-1>=-1&&(this.currentSeqIndex-=1)}hasPrev(){return!(this.currentSeqIndex<=0&&this.currentSeqState==="idle")}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&this.currentSeqState==="end")}bindShapeEvent(){this.json.ctn.nodeType==="interactiveSeq"&&this.json.nextCondLst.forEach(n=>{if(/^shape/.test(n.event)){const e=n.event.split(" ")[1];if(e){const r=this.ctx.timingTargets.getTargetById(e);r&&(r.interactiveContainer.interactive=!0,r.interactiveContainer.cursor="pointer",r.interactiveContainer.on("pointerdown",()=>{const s=`shape ${e} onClick`;this.globalEventHub.emit(s)}))}}})}setCurrentStep(n,e){let r=n;this.commonTimeNode.seekToStart();const{length:s}=this.commonTimeNode.children;if(r===-1&&(r=s-1),r>=0&&r<s)for(let u=0;u<=r;u++){const h=this.commonTimeNode.children[u];u!==r?h.commonTimeNode.seekToEnd(!1,!0):e==="start"?h.commonTimeNode.seekToStart():e==="end"&&h.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=r,this.currentSeqState=e==="start"?"idle":"end"}}function ln(o,n,e){const r=n.split(".");r.reduce((s,u,h)=>{if(s)return h!==r.length-1?s[u]:void(s[u]=e);console.warn(`${o} not support ${n}`)},o)}function An(o,n){return n?n.split(".").reduce((e,r)=>{if(e)return e[r];console.warn(`${o} not support ${n}`)},o):null}class ve{constructor(n){this.timingTarget=null,this.runtimeNodeEventHub=new J.a,this.onTimeLineStart=()=>{if(this.isConflict){const{target:P}=this.json.cBhvr;if(this.activeWhenConflict==="next"){let j=P.id;P.type==="shape"&&P.txEl&&(j=`${j}-txEl-${P.txEl.range[0]}`),this.commonTimeNode.isIterate&&(j=`${j}-iterate-${this.commonTimeNode.iterateIndex}`),this.ctx.conflictTimeNodeManager.addRunningTimeNode(j,this.modifyAttrKey,this.commonTimeNode)}else this.activeWhenConflict==="prev"&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:r,json:s,ctx:u,parent:h,eventHub:f,iterateType:y,iterateIndex:b,iterateId:T}=n;this.json=s,this.id=s.cBhvr.ctn.id,this.ctx=u,this.globalEventHub=f,this.commonTimeNode=new Po({json:s.cBhvr.ctn,isSub:r,eventHubs:{global:f,runtime:this.runtimeNodeEventHub},ctx:u,parent:h,isIterate:e,iterateType:y,iterateIndex:b,iterateId:T}),this.timingTarget=this.ctx.timingTargets.getTarget(s.cBhvr.target,e,{type:y,index:b,id:T}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.onTimeLineStart)}}class Xe extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=An(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const e=this.json.cBhvr.attrList[0];this.startVal!==null&&this.timingTarget&&ln(this.timingTarget,e,this.startVal)},this.onSeekToEnd=()=>{const e=this.json.cBhvr.attrList[0],r=this.json.cBhvr.to||this.json.to;r&&this.timingTarget&&ln(this.timingTarget,e,r)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:e,delta:r})=>{if(r/e>=1){const s=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const u=this.json.cBhvr.to||this.json.to;u&&this.timingTarget&&ln(this.timingTarget,s,u)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}class Un{constructor(n,e){this.math={pi:Math.PI,e:Math.E,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,cosh:Math.cosh,deg:r=>r/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:r=>r/180*Math.PI,rand:Math.random,sin:Math.sin,sinh:Math.sinh,sqrt:Math.sqrt,tan:Math.tan,tanh:Math.tanh},this.timingTarget=e,this.val=n.val.value,this.time=n.time,n.fmla&&(this.fmla=this.parseFmla(n.fmla))}parseFmla(n){let e=n.replaceAll("#ppt_h",`(${this.timingTarget.design_ppt_h})`);return e=e.replaceAll("#ppt_w",`(${this.timingTarget.design_ppt_w})`),e=e.replaceAll("#ppt_x",`(${this.timingTarget.design_ppt_x})`),e=e.replaceAll("#ppt_y",`(${this.timingTarget.design_ppt_y})`),e=e.replaceAll("ppt_w","vars.ppt_w"),e=e.replaceAll("ppt_h","vars.ppt_h"),e=e.replaceAll("ppt_x","vars.ppt_x"),e=e.replaceAll("ppt_y","vars.ppt_y"),e=e.replaceAll("#","vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(r=>{const s=new RegExp(`([^a-z])${r}([^a-z])`,"g");e=e.replace(s,(u,h,f)=>`${h}math.${r}${f}`)}),new Function("vars","math","$","return "+e)}}class mn extends Un{constructor(n,e,r){super(n,e),this.value=n.val.value,r&&(this.fmla=this.parseFmla(r))}resolveValue(){return this.value}interpolationFrom(n,e,r){const s=n.resolveValue(r),u=s+(this.resolveValue()-s)*e;return n.fmla?n.fmla(r,this.math,u):u}}class Yn extends Un{constructor(n,e){var r;super(n,e),this.value=(r=n.val)===null||r===void 0?void 0:r.value}interpolationFrom(n,e,r){let s=n.resolveValue(r);return e>this.time&&(s=this.resolveValue()),s}resolveValue(){return this.value||""}}class wn extends Un{constructor(n,e){super(n,e),this.fn=this.parseFmla(this.val)}resolveValue(n){return this.fn(n,this.math,1)}interpolationFrom(n,e,r){const s=n.resolveValue(r),u=s+(this.resolveValue(r)-s)*e;return n.fmla?n.fmla(r,this.math,u):u}}class lr extends Un{constructor(n,e){super(n,e),this.value=n.val.value}interpolationFrom(n,e){return Ou(n.resolveValue(),this.value,e)}resolveValue(){return this.value}}class In extends ve{constructor(n){super(n),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.vars={ppt_x:0,ppt_y:0,ppt_w:0,ppt_h:0},this.keyFrames=[],this.isColorAnim=!1,this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal=An(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var e,r,s,u;((e=this.timingTarget)===null||e===void 0?void 0:e.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),((r=this.timingTarget)===null||r===void 0?void 0:r.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),((s=this.timingTarget)===null||s===void 0?void 0:s.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),((u=this.timingTarget)===null||u===void 0?void 0:u.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:e,delta:r})=>{const s=r/e,u=this.keyFrames.findIndex(j=>s<=j[0]),{attrList:h}=this.json.cBhvr;if(u<0){const j=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&h&&h[0]&&ln(this.timingTarget,h[0],j[1].resolveValue(this.vars)))}const f=u-1,y=this.keyFrames[u],b=this.keyFrames[f]||y,T=y[0]-b[0]==0?1:(s-b[0])/(y[0]-b[0]),P=y[1].interpolationFrom(b[1],T,this.vars);this.timingTarget&&h&&h[0]&&ln(this.timingTarget,h[0],P)},this.onSeekToStart=()=>{this.startVal!==null&&this.timingTarget&&ln(this.timingTarget,this.json.cBhvr.attrList[0],this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.initKeyFrames(),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timelineStart",this.updateVars),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}initKeyFrames(){var n;const{valueType:e}=this.json;if(this.json.tavLst.length<=0){if(this.json.to){if(this.json.from||this.startVal){const s={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(s,this.timingTarget);this.keyFrames.push([s.time,u])}}const r={time:1,val:{type:"string",value:this.json.to},fmla:""};if(e==="num"&&this.timingTarget){const s=new wn(r,this.timingTarget);this.keyFrames.push([r.time,s])}}else if(this.json.by){const r={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(r,this.timingTarget);this.keyFrames.push([r.time,u])}const s={time:1,val:{type:"string",value:(((n=r.val)===null||n===void 0?void 0:n.value)||"")+"+"+this.json.by},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(s,this.timingTarget);this.keyFrames.push([s.time,u])}}}if(this.json.tavLst.length>0){for(const r of this.json.tavLst)if(r.val&&this.timingTarget){let s=null;r.val.type==="string"?e==="num"?s=new wn(r,this.timingTarget):e==="str"&&(s=new Yn(r,this.timingTarget)):r.val.type==="number"?s=new mn(r,this.timingTarget):r.val.type==="color"?(this.isColorAnim=!0,s=new lr(r,this.timingTarget)):r.val.type==="boolean"&&console.warn("not implements"),s&&this.keyFrames.push([r.time,s])}}}}var jn=S(21),Ei=S.n(jn),xo=S(22),Ls=S.n(xo);class ki extends Uo{constructor(){super(Ls.a,Ei.a,{percent:0,direction:1,transition:0})}set transition(n){this.uniforms.transition=n}set percent(n){this.uniforms.percent=n}set direction(n){this.uniforms.direction=n}}var Zs=S(23),Za=S.n(Zs);class Ja extends Uo{constructor(){super(void 0,Za.a,{percent:0,transition:1})}set transition(n){this.uniforms.transition=Math.pow(n,n)}set percent(n){this.uniforms.percent=n}}class bl extends ve{constructor(n){var e;super(n),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:u,delta:h})=>{const f=h/u;this.filter&&(this.filter.percent=f),f>=1&&this.timingTarget&&this.ctx.clock.setTimeout(()=>{this.timingTarget&&(this.timingTarget.container.filters=[])})},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.onSeekToEnd=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.commonTimeNode.on("timelineStart",()=>{this.filter&&this.timingTarget&&(this.timingTarget.container.filters=[this.filter])}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate);let r=0;n.json.transition==="out"?r=-1:n.json.transition==="in"&&(r=1);const s=(e=n.json.filter)===null||e===void 0?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(s){const u=s[1],h=s[3];if(u==="wipe"){const f=new ki;h==="up"?f.direction=1:h==="down"?f.direction=2:h==="left"?f.direction=3:h==="right"&&(f.direction=4),this.filter=f,this.filterType=`${u}-${h}`}else if(u==="fade"){const f=new Ja;this.filter=f,this.filterType=""+u}this.filter&&(this.filter.transition=r)}}get modifyAttrKey(){return this.filterType}}var va=S(5);class _a extends ve{constructor(n){super(n),this.isConflict=!0,this.activeWhenConflict="next",this.onTimeUpdate=({duration:e,delta:r})=>{var s;const u=r/e,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{var e,r,s;const u=(r=(e=this.commonTimeNode.json)===null||e===void 0?void 0:e.spd)!==null&&r!==void 0?r:1,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u>0?0:1);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+this.timingTarget.design_ppt_y)},this.onSeekToEnd=()=>{var e,r,s;const u=(r=(e=this.commonTimeNode.json)===null||e===void 0?void 0:e.spd)!==null&&r!==void 0?r:1,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u>0?1:0);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var n;const e=new va.Path,r=(n=this.json.path)===null||n===void 0?void 0:n.match(/[MLCmlc][^MLCmlc]+/g);if(r)for(const s of r){const[u,...h]=s.trim().replace(/\s+/g," ").split(" ");if(u==="M"){const[f,y]=h.map(b=>Number(b));e.moveTo(f,y)}else if(u==="L"){const[f,y]=h.map(b=>Number(b));e.lineTo(f,y)}else if(u==="C"){const[f,y,b,T,P,j]=h.map(G=>Number(G));e.bezierCurveTo(f,y,b,T,P,j)}else if(u==="Z")e.closePath();else if(u==="E")console.warn("not implements");else if(u==="c"){const[f,y,b,T,P,j]=h.map(V=>Number(V)),G=e.currentPoint;e.bezierCurveTo(f+G.x,y+G.y,b+G.x,T+G.y,P+G.x,j+G.y)}else if(u==="l"){const f=e.currentPoint,[y,b]=h.map(T=>Number(T));e.lineTo(y+f.x,b+f.y)}else if(u==="m"){const f=e.currentPoint,[y,b]=h.map(T=>Number(T));e.moveTo(y+f.x,b+f.y)}}this.path=e}}class Bu extends ve{constructor(n){super(n),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=e=>{e.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:e,delta:r})=>{var s,u,h,f,y;const b=r/e,T={x:1,y:1};if(this.to){const P=(s=this.from)!==null&&s!==void 0?s:{x:(h=(u=this.startVal)===null||u===void 0?void 0:u.x)!==null&&h!==void 0?h:1,y:(y=(f=this.startVal)===null||f===void 0?void 0:f.y)!==null&&y!==void 0?y:1};T.x=P.x+(this.to.x-P.x)*b,T.y=P.y+(this.to.y-P.y)*b}else if(this.by){const P={x:this.by.x,y:this.by.y};T.x=1+(P.x-1)*b,T.y=1+(P.y-1)*b}this.timingTarget&&(this.timingTarget.scale=T)},this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})},this.onSeekToStart=()=>{this.timingTarget&&this.startVal&&(this.timingTarget.scale=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=n.json.from,this.to=n.json.to,this.by=n.json.by,this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart)}get modifyAttrKey(){return"scale"}updateCurrentValue(){this.timingTarget&&(this.current={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})}}class Qd extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=e=>{this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to),e.isReverse||this.updateCurrentValue();const[r]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,r+".on","true")},this.onTimeNodeEnd=()=>{if(this.json.cBhvr.ctn.fill==="remove"){const[e]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,e+".on","false")}},this.onSeekToStart=()=>{if(this.timingTarget){const[e]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,e+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const e=An(this.timingTarget,this.json.cBhvr.attrList[0]);e&&(this.startColorString=e)}},this.onTimeUpdate=({delta:e,duration:r})=>{const s=e/r;this.to.interpolationFrom(this.from,s,this.target),this.timingTarget&&ln(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1})},this.json.clrSpc==="rgb"?(this.from=new yl(this.json.from),this.to=new yl(this.json.to),this.by=new yl(this.json.by),this.target=new yl):(this.from=new Ps(this.json.from),this.to=new Ps(this.json.to),this.by=new Ps(this.json.by),this.target=new Ps),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeEnd",this.onTimeNodeEnd),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}updateCurrentValue(){if(this.timingTarget){const n=An(this.timingTarget,this.json.cBhvr.attrList[0]);n&&(this.currentColorString=n)}}}class ru extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=e=>{this.lastVal=null,e.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:e,delta:r})=>{const s=r/e;let u=0,h=0;if(this.from!==void 0&&this.to!==void 0){u=this.from,h=this.to;const f=u+(h-u)*s;this.timingTarget&&(this.timingTarget.r=f)}else if(this.by!==void 0){this.lastVal||(this.lastVal=0);const f=this.by*s-this.lastVal;this.lastVal=this.by*s,this.timingTarget&&(this.timingTarget.r+=f)}},this.onTimeNodeStart=()=>{var e;Object(X.isNumber)((e=this.timingTarget)===null||e===void 0?void 0:e.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&this.startVal!==null&&(this.timingTarget.r=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=this.json.from,this.to=this.json.to,this.by=this.json.by,this.by?this.isConflict=!1:this.isConflict=!0,this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return"rotate"}updateCurrentValue(){var n;this.currentVal=(n=this.timingTarget)===null||n===void 0?void 0:n.r}}class zh extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var e,r;const{cmd:s,cmdType:u}=this.json;!this.isApplied&&s&&u&&(this.isApplied=!0,(r=(e=this.timingTarget)===null||e===void 0?void 0:e.cmd)===null||r===void 0||r.applyCommand(s,u))},this.onSeekToStart=()=>{var e,r;(r=(e=this.timingTarget)===null||e===void 0?void 0:e.cmd)===null||r===void 0||r.applyCommand("custom-pause","call")},this.onSeekToEnd=()=>{},this.commonTimeNode.on("timeNodeStart",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeNodeEnd",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){var n,e,r,s;return((e=(n=this.json)===null||n===void 0?void 0:n.cmd)!==null&&e!==void 0?e:"")+((s=(r=this.json)===null||r===void 0?void 0:r.cmdType)!==null&&s!==void 0?s:"")}}var iu=S(24);class $a{constructor(n){$a.useRtc||(this.howl=new iu.Howl({src:[n]}))}play(){var n;(n=this.howl)===null||n===void 0||n.play()}pause(){var n;(n=this.howl)===null||n===void 0||n.pause()}stop(){var n;(n=this.howl)===null||n===void 0||n.stop()}destroy(){var n;(n=this.howl)===null||n===void 0||n.unload()}}$a.useRtc=!1;class Kp{constructor(n){this.runtimeNodeEventHub=new J.a,this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy()};const{json:e,isIterate:r,isSub:s,eventHub:u,ctx:h,parent:f,iterateType:y,iterateIndex:b,iterateId:T}=n;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new Po({json:e.cMediaNode.ctn,isSub:s,eventHubs:{global:u,runtime:this.runtimeNodeEventHub},ctx:h,parent:f,isIterate:r,iterateType:y,iterateIndex:b,iterateId:T}),this.audio=new $a(e.cMediaNode.tgtEl),this.commonTimeNode.on("timelineStart",()=>{this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy)}}var jh=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Po extends J.a{constructor(n){super(),this.uuid=Date.now().toString(32)+Math.random().toString(32).substring(2),this.isSub=!1,this.isShadow=!1,this.startCount=0,this.applyCount=0,this.isReverse=!1,this.isConflictDispose=!1,this.isIterateEnd=!1,this.parentTimeNode=null,this.isActive=!1,this.isDestroy=!1,this.shouldSeekOnStart=!1,this.repeatTimeoutId="",this.iterateShadows=[],this.isEndEventsEmitted=!1,this.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.timeDelta=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.dispose())},this.handleActive=(G=!0)=>{if(this.isActive=!0,this.applyCount+=1,this.json.iterate||this.emit("timeNodeStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startCount>0&&this.json.restart){if(this.json.restart==="never")return;this.json.restart!=="whenNotActive"&&this.json.restart!=="always"||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(G))}else this.startTimeLine(G)},this.updateTimeLine=G=>{const V=G/(Bt.TARGET_FPMS||.06);this.timeDelta+=V,this.duration-this.timeDelta<=V&&(this.timeDelta=this.duration),this.timeDelta<this.duration?this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?this.duration-this.timeDelta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}):(this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?0:this.duration,duration:this.duration,isReverse:this.isReverse}),this.onTimeLineEnd())},this.handleEnd=(G=!1)=>{(this.isTimeNodeEnd()||G)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:e,isIterate:r,ctx:s,eventHubs:u,parent:h,json:f,iterateType:y,iterateId:b,iterateIndex:T}=n;this.isSub=e,this.isIterate=r,this.parentTimeNode=h,this.json=f,this.ctx=s,this.iterateIndex=T,this.eventHubs=u,this.iterateType=y,this.iterateId=b;const P=Number(this.json.dur),j=this.json.spd||1;this.isNegativeSpeed=j<0,Number.isNaN(P)||(this.duration=P/Math.abs(j)),this.uuid+="--"+this.json.id,this.setPreStyle(),f.childTnLst&&this.createChildren(f.childTnLst),this.startConds=new De(this.json.id||"",f.stCondLst,u,this.ctx),this.endConds=new De(this.json.id||"",f.endCondLst,u,this.ctx),f.endSync&&(this.endSync=new De(this.json.id||"",[f.endSync],u,this.ctx),this.endSync.on("active",()=>{var G;this.json.nodeType==="interactiveSeq"&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),(G=this.endSync)===null||G===void 0||G.reset())})),this.startConds.on("active",G=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(G))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(G=>G.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&this.json.masterRel==="nextClick"&&this.startConds.addCond({event:"shape slide onNext"}),this.json.iterate&&this.isIterate===!1&&this.createIterateShadow()}createIterateShadow(){const n=Is();let e=!0,r=0;const s=u=>{u===n&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",s))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",s);e;){const u=JSON.parse(JSON.stringify(this.json)),h=new Po({json:u,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:u.iterate.type,iterateIndex:r,iterateId:n});this.iterateShadows[r]=h,r+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(n){this.isReverse=n}createTimeNode(n,e){let r=null;const s={json:n,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId};return n.type==="seq"?r=new gn(s):n.type==="par"?r=new Kc(s):n.type==="set"?r=new Xe(s):n.type==="anim"?r=new In(s):n.type==="animEffect"?r=new bl(s):n.type==="animMotion"?r=new _a(s):n.type==="animScale"?r=new Bu(s):n.type==="animClr"?r=new Qd(s):n.type==="animRot"?r=new ru(s):n.type==="cmd"?r=new zh(s):n.type==="audio"&&(r=new Kp(s)),r}createSubList(n){this.subList=[],n.forEach(e=>{const r=this.createTimeNode(e,!0);r&&this.subList.push(r)})}bindCommonTimeNodeEvent(n){n.commonTimeNode.on("timeNodeStart",e=>{this.emit("childTimeNodeStart",e)}),n.commonTimeNode.on("timeNodeEnd",e=>{this.emit("childTimeNodeEnd",e),this.children.every(r=>r.commonTimeNode.isTimeNodeEnd())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(n){function e(r){return function(s){var u;return(u=s==null?void 0:s.cBhvr)===null||u===void 0?void 0:u.ctn}(r)?r.cBhvr.ctn.presetOrder:function(s){return s==null?void 0:s.ctn}(r)?r.ctn.presetOrder:function(s){return s==null?void 0:s.cMediaNode}(r)?r.cMediaNode.ctn.presetOrder:void 0}e(n[0])?[...n].sort((r,s)=>{var u,h;return((u=e(r))!==null&&u!==void 0?u:0)-((h=e(s))!==null&&h!==void 0?h:0)}).forEach(r=>{const s=n.findIndex(h=>e(h)===e(r)),u=this.createTimeNode(r,!1);u&&(this.bindCommonTimeNodeEvent(u),this.children[s]=u)}):n.forEach(r=>{const s=this.createTimeNode(r,!1);s&&(this.bindCommonTimeNodeEvent(s),this.children.push(s))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(n=>n.commonTimeNode.playReverse())}allChildrenEndHandle(){if(!this.isDestroy){if(this.json.autoRev&&!this.isReverse)return this.isReverse=!0,void this.playReverse();this.isReverse&&(this.isReverse=!1),this.json.repeatCount&&this.json.repeatCount>this.applyCount?this.repeatTimeoutId=this.ctx.clock.setTimeout(()=>{this.seekToStart(!1),this.resetForRepeat(),this.startTimeNodeRepeat()}):(this.json.iterate&&!this.isIterate&&(this.isIterateEnd=!0),this.eventHubs.runtime.emit("runtime all end"),this.startSubList(),this.handleEnd())}}resetForRepeat(){this.timeDelta=0,this.children.forEach(n=>n.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(n=>n.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.timeDelta=0;const n=1e3/this.ctx.ticker.maxFPS;this.duration<=n&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit(Pn.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>n&&(this.ctx.eventHub.emit(Pn.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(n=!0){if(n&&(this.isEndEventsEmitted=!1,this.eventHubs.global.emit(`time ${this.json.id} begin`),this.eventHubs.global.emit(`time ${this.json.id} onBegin`),this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)),this.json.iterate)return void this.startIterate();this.timeDelta=0,this.emit("timelineStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse});const e=1e3/this.ctx.ticker.maxFPS;this.duration<=e&&this.duration>0?(this.timeDelta=this.isReverse?0:this.duration,this.emit("timeUpdate",{delta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}),this.emit("timelineEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.ctx.ticker.addOnce(()=>{this.onTimeLineEnd()})):this.duration>e&&(this.ctx.eventHub.emit(Pn.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return jh(this,void 0,void 0,function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const n of this.iterateShadows){if(this.isIterateEnd)break;n.children.forEach(e=>{e.commonTimeNode.startTimeNode()}),n.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}})}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}setPreStyle(){if(!this.json.presetClass)return;const n=[],e=r=>{r.forEach(s=>{var u,h,f;s.cBhvr&&s.cBhvr.target&&n.findIndex(y=>y.id===s.cBhvr.target.id)<0&&n.push(s.cBhvr.target),((h=(u=s==null?void 0:s.cBhvr)===null||u===void 0?void 0:u.ctn)===null||h===void 0?void 0:h.childTnLst)&&s.cBhvr.ctn.childTnLst.length>0&&e(s.cBhvr.ctn.childTnLst),((f=s==null?void 0:s.ctn)===null||f===void 0?void 0:f.childTnLst)&&s.ctn.childTnLst.length>0&&e(s.ctn.childTnLst)})};e(this.json.childTnLst||[]),n.forEach(r=>{if(this.json.iterate){let s=0,u=!0;for(;u;){const h=this.ctx.timingTargets.getTarget(r,!0,{type:this.json.iterate.type,index:s,id:""});h&&(this.setPreStyleForTarget(h),s+=1),u=!!h}}else{const s=this.ctx.timingTargets.getTarget(r,!1);s&&this.setPreStyleForTarget(s)}})}setPreStyleForTarget(n){var e,r;if(n&&this.json.presetSubtype&&(n.presetSubType=this.json.presetSubtype),n&&!n.hasPreset)if(this.json.presetClass==="entr"){const s=(r=(e=this.json)===null||e===void 0?void 0:e.childTnLst)===null||r===void 0?void 0:r.filter(u=>u.type==="set"&&u.to==="visible");(s==null?void 0:s.length)&&(n.hasPreset=!0,n.style.visibility="hidden")}else(this.json.presetClass==="exit"||this.json.presetClass==="path")&&(n.hasPreset=!0,n.style.visibility="visible")}startTimeNodeRepeat(){this.timeDelta=0,this.isActive=!0,this.applyCount+=1,this.startTimeLine(!1),this.json.iterate||this.emit("timeNodeRepeat",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse})}startTimeNodeForce(){this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.timeDelta=0,this.isActive=!0,this.handleActive(!1)}startTimeNode(n=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(n);const e=this.json.stCondLst.filter(s=>/^self/.test(s.event||""))[0];e&&this.startConds.condHandle(e);const r=this.json.endCondLst.filter(s=>/^self/.test(s.event||""))[0];r&&this.endConds.condHandle(r),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(this.children.length===0||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(n=>n.commonTimeNode.destroy()),this.subList=[],this.children.forEach(n=>{n.commonTimeNode.clearSubList()})}seekToStart(n=!0){if(this.isEndEventsEmitted=!1,this.isActive=!1,this.dispose(),this.timeDelta=0,this.emit("seekToStart"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(e=>e.seekToStart(n));if(n)for(let e=this.subList.length-1;e>=0;e--){const r=this.subList[e];r==null||r.commonTimeNode.seekToStart()}for(let e=this.children.length-1;e>=0;e--){const r=this.children[e];r==null||r.commonTimeNode.seekToStart()}for(let e=this.children.length-1;e>=0;e--){const r=this.children[e];r==null||r.commonTimeNode.seekToStart()}}dispose(n=!1){this.isConflictDispose=n,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(Pn.animateEnd),this.ctx.ticker.remove(this.updateTimeLine),this.startConds.reset(),this.endConds.reset()}seekToEnd(n,e=!1){if(this.isInfiniteRepeat())return;!this.isActive&&this.applyCount<=0&&this.collectStartValue(),this.applyCount=this.json.repeatCount,this.json.autoRev&&(this.isReverse=!0),this.timeDelta=this.duration,this.isActive=!1,this.dispose();const r=this.json.autoRev||n;if(r?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(s=>s.seekToEnd(r,e));this.children.length===0&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(s=>s.commonTimeNode.seekToEnd(r,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(s=>s.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEnd(){let n=!0;return this.children.length>0&&(n=n&&this.children.every(e=>e.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(n=n&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(n=n&&!this.isReverse),n=n&&this.isNatureTimeEnd(),!!this.isConflictDispose||!(!this.isIterateEnd||!this.json.iterate)||n}emitEndEvents(){this.isEndEventsEmitted||(this.isEndEventsEmitted=!0,this.eventHubs.global.emit(`time ${this.json.id} end`),this.eventHubs.global.emit(`time ${this.json.id} onEnd`),this.eventHubs.runtime.emit(`runtime ${this.json.id} end`),this.emit("timeNodeEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}))}collectStartValue(){this.emit("timeNodeCreate"),this.children.forEach(n=>n.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(n=>n.commonTimeNode.destroy()),this.clearSubList()}}class Kc extends J.a{constructor(n){super(),this.isRunning=!1,this.runtimeNodeEventHub=new J.a;const{json:e,iterateType:r,isIterate:s,isSub:u,parent:h,ctx:f,eventHub:y,iterateIndex:b,iterateId:T}=n;this.id=e.ctn.id,this.json=e,this.ctx=f,this.isIterate=s,this.globalEventHub=y,this.commonTimeNode=new Po({json:e.ctn,isSub:u,eventHubs:{global:y,runtime:this.runtimeNodeEventHub},ctx:f,parent:h,isIterate:!1,iterateType:r,iterateIndex:b,iterateId:T}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(P=>{P.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),P.commonTimeNode.startTimeNode()}),this.isRunning||(this.isRunning=!0,this.globalEventHub.emit(`runtime ${this.id} begin`),this.emit("begin"))}),this.commonTimeNode.on("timeNodeRepeat",()=>{this.commonTimeNode.children.forEach(P=>{P.commonTimeNode.startTimeNode(!1)})}),this.commonTimeNode.on("timeNodeEnd",()=>{this.commonTimeNode.isTimeNodeEnd()&&this.isRunning&&(this.isRunning=!1,this.globalEventHub.emit(`runtime ${this.id} end`),this.emit("end"))})}}var ng=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class rg{constructor(n,e,r){this.json=n,this.ctx=r;const s=n.timeNodeList.find(u=>u.type==="par"&&u.ctn.nodeType==="tmRoot");s&&(this.tmRoot=new Kc({json:s,isSub:!1,isIterate:!1,eventHub:e,ctx:r,parent:null,iterateType:"el",iterateIndex:0,iterateId:""}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(u=>{var h,f,y;return((h=u.json)===null||h===void 0?void 0:h.type)==="seq"&&((y=(f=u.json)===null||f===void 0?void 0:f.ctn)===null||y===void 0?void 0:y.nodeType)==="mainSeq"}))}findSeq(n){var e;return(e=this.tmRoot)===null||e===void 0?void 0:e.commonTimeNode.children.find(r=>{var s,u,h;return((s=r.json)===null||s===void 0?void 0:s.type)==="seq"&&((h=(u=r.json)===null||u===void 0?void 0:u.ctn)===null||h===void 0?void 0:h.id)===n})}start(){var n,e;return ng(this,void 0,void 0,function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),(n=this.mainSeq)===null||n===void 0||n.commonTimeNode.startTimeNode()):(e=this.mainSeq)===null||e===void 0||e.commonTimeNode.startTimeNode()})}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var n;(n=this.mainSeq)===null||n===void 0||n.commonTimeNode.collectStartValue()}setMainSeqStep(n,e){var r;n===-1&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),(r=this.mainSeq)===null||r===void 0||r.setCurrentStep(n,e)}destroy(){var n;(n=this.tmRoot)===null||n===void 0||n.commonTimeNode.destroy()}hasMainSeq(){return!!this.mainSeq&&this.mainSeq.commonTimeNode.children.length>0}currentMainSeqState(){return this.mainSeq?this.mainSeq.currentState:null}currentMainSeqStep(){return this.mainSeq?this.mainSeq.currentStep:0}currentMainSeqLength(){return this.mainSeq?this.mainSeq.stepLength:0}mainSeqHasNextStep(){return!!this.mainSeq&&this.mainSeq.hasNext()}mainSeqHasPrevStep(){return!!this.mainSeq&&this.mainSeq.hasPrev()}seekInteractiveSeqToEnd(n){const e=this.findSeq(n);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(n,e,r){const s=this.findSeq(n);s&&s.setCurrentStep(e,r)}applyInteractiveAction(n){const e=this.findSeq(n);e&&e.handleNext()}}var ym=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class ig extends me{constructor(n,e,r){super({id:"stage",width:n.width,height:n.height,type:"Container",children:n.children},e,r),this.globalEventHub=new J.a,this.json=n,this.container.visible=!1,this.ctx=e,this.globalEventHub.on("c:prev slide",()=>{this.ctx.eventHub.emit(Pn.requestPrevSlide)}),this.globalEventHub.on("c:next slide",()=>{this.ctx.eventHub.emit(Pn.requestNextSlide)});const s=new ps;s.drawRect(0,0,n.width,n.height),this.container.addChild(s)}get interactiveContainer(){return this.container}render(){const n=Object.create(null,{render:{get:()=>super.render}});return ym(this,void 0,void 0,function*(){yield n.render.call(this),this.ctx.eventHub.emit("StageRenderEnd")})}createTiming(){this.json.timing&&(this.timing=new rg(this.json.timing,this.globalEventHub,this.ctx))}startTiming(){var n;return((n=this.timing)===null||n===void 0?void 0:n.start())||Promise.resolve()}setMainSeqApplied(){var n;(n=this.timing)===null||n===void 0||n.setMainSeqApplied()}setMainSeqStep(n,e){var r;(r=this.timing)===null||r===void 0||r.setMainSeqStep(n,e)}collectMainSeqStartValue(){var n;(n=this.timing)===null||n===void 0||n.collectMainSeqStartValue()}hasTiming(){return!!this.timing}destroy(){var n;this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),this.ctx.fillTexture.destroy(),this.globalEventHub.removeAllListeners(),(n=this.timing)===null||n===void 0||n.destroy(),super.destroy()}mainSeqStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.currentMainSeqStep())!==null&&e!==void 0?e:0}mainSeqLength(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.currentMainSeqLength())!==null&&e!==void 0?e:0}mainSeqHasNextStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.mainSeqHasNextStep())!==null&&e!==void 0&&e}mainSeqHasPrevStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.mainSeqHasPrevStep())!==null&&e!==void 0&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(){var n;this.hasTiming()&&((n=this.timing)===null||n===void 0?void 0:n.hasMainSeq())?this.globalEventHub.emit("shape slide onNext"):this.ctx.eventHub.emit(Pn.requestNextSlide)}prevStep(){var n;this.hasTiming()&&((n=this.timing)===null||n===void 0?void 0:n.hasMainSeq())?this.globalEventHub.emit("shape slide onPrev"):this.ctx.eventHub.emit(Pn.requestPrevSlide)}applyInteractiveAction(n){var e;(e=this.timing)===null||e===void 0||e.applyInteractiveAction(n)}seekInteractiveSeqToEnd(n){var e;(e=this.timing)===null||e===void 0||e.seekInteractiveSeqToEnd(n)}setInteractiveSeqState(n,e,r){var s;(s=this.timing)===null||s===void 0||s.setInteractiveSeqState(n,e,r)}setMediaState(n,e){return ym(this,void 0,void 0,function*(){const r=this.ctx.medias[n];r&&(e?yield r.play():yield r.pause())})}setMediaCurrentTime(n,e){const r=this.ctx.medias[n];r&&r.seek(e)}}const ts=134217729;function Rf(o,n,e,r,s){let u,h,f,y,b=n[0],T=r[0],P=0,j=0;T>b==T>-b?(u=b,b=n[++P]):(u=T,T=r[++j]);let G=0;if(P<o&&j<e)for(T>b==T>-b?(h=b+u,f=u-(h-b),b=n[++P]):(h=T+u,f=u-(h-T),T=r[++j]),u=h,f!==0&&(s[G++]=f);P<o&&j<e;)T>b==T>-b?(h=u+b,y=h-u,f=u-(h-y)+(b-y),b=n[++P]):(h=u+T,y=h-u,f=u-(h-y)+(T-y),T=r[++j]),u=h,f!==0&&(s[G++]=f);for(;P<o;)h=u+b,y=h-u,f=u-(h-y)+(b-y),b=n[++P],u=h,f!==0&&(s[G++]=f);for(;j<e;)h=u+T,y=h-u,f=u-(h-y)+(T-y),T=r[++j],u=h,f!==0&&(s[G++]=f);return u===0&&G!==0||(s[G++]=u),G}function og(o,n){let e=n[0];for(let r=1;r<o;r++)e+=n[r];return e}function Vh(o){return new Float64Array(o)}const Qc=Vh(4),Wh=Vh(8),xm=Vh(12),Mi=Vh(16),Ro=Vh(4);function tp(o,n,e,r,s,u){const h=(n-u)*(e-s),f=(o-s)*(r-u),y=h-f;if(h===0||f===0||h>0!=f>0)return y;const b=Math.abs(h+f);return Math.abs(y)>=33306690738754716e-32*b?y:-function(T,P,j,G,V,K,_t){let Tt,jt,de,Ne,Nt,ue,$t,ie,Je,he,oe,Ae,nn,on,$n,nr,$e,Ue;const Cn=T-V,kn=j-V,wr=P-K,Ar=G-K;on=Cn*Ar,ue=ts*Cn,$t=ue-(ue-Cn),ie=Cn-$t,ue=ts*Ar,Je=ue-(ue-Ar),he=Ar-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=wr*kn,ue=ts*wr,$t=ue-(ue-wr),ie=wr-$t,ue=ts*kn,Je=ue-(ue-kn),he=kn-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Qc[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Qc[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Qc[2]=Ae-(Ue-Nt)+(oe-Nt),Qc[3]=Ue;let Dr=og(4,Qc),pi=22204460492503146e-32*_t;if(Dr>=pi||-Dr>=pi||(Nt=T-Cn,Tt=T-(Cn+Nt)+(Nt-V),Nt=j-kn,de=j-(kn+Nt)+(Nt-V),Nt=P-wr,jt=P-(wr+Nt)+(Nt-K),Nt=G-Ar,Ne=G-(Ar+Nt)+(Nt-K),Tt===0&&jt===0&&de===0&&Ne===0)||(pi=11093356479670487e-47*_t+33306690738754706e-32*Math.abs(Dr),Dr+=Cn*Ne+Ar*Tt-(wr*de+kn*jt),Dr>=pi||-Dr>=pi))return Dr;on=Tt*Ar,ue=ts*Tt,$t=ue-(ue-Tt),ie=Tt-$t,ue=ts*Ar,Je=ue-(ue-Ar),he=Ar-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=jt*kn,ue=ts*jt,$t=ue-(ue-jt),ie=jt-$t,ue=ts*kn,Je=ue-(ue-kn),he=kn-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Ro[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Ro[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Ro[2]=Ae-(Ue-Nt)+(oe-Nt),Ro[3]=Ue;const Ji=Rf(4,Qc,4,Ro,Wh);on=Cn*Ne,ue=ts*Cn,$t=ue-(ue-Cn),ie=Cn-$t,ue=ts*Ne,Je=ue-(ue-Ne),he=Ne-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=wr*de,ue=ts*wr,$t=ue-(ue-wr),ie=wr-$t,ue=ts*de,Je=ue-(ue-de),he=de-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Ro[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Ro[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Ro[2]=Ae-(Ue-Nt)+(oe-Nt),Ro[3]=Ue;const jr=Rf(Ji,Wh,4,Ro,xm);on=Tt*Ne,ue=ts*Tt,$t=ue-(ue-Tt),ie=Tt-$t,ue=ts*Ne,Je=ue-(ue-Ne),he=Ne-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=jt*de,ue=ts*jt,$t=ue-(ue-jt),ie=jt-$t,ue=ts*de,Je=ue-(ue-de),he=de-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Ro[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Ro[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Ro[2]=Ae-(Ue-Nt)+(oe-Nt),Ro[3]=Ue;const Zr=Rf(jr,xm,4,Ro,Mi);return Mi[Zr-1]}(o,n,e,r,s,u,b)}const ep=Math.pow(2,-52),Xh=new Uint32Array(512);class qh{static from(n,e=wm,r=Sm){const s=n.length,u=new Float64Array(2*s);for(let h=0;h<s;h++){const f=n[h];u[2*h]=e(f),u[2*h+1]=r(f)}return new qh(u)}constructor(n){const e=n.length>>1;if(e>0&&typeof n[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=n;const r=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:n,_hullPrev:e,_hullNext:r,_hullTri:s,_hullHash:u}=this,h=n.length>>1;let f=1/0,y=1/0,b=-1/0,T=-1/0;for(let he=0;he<h;he++){const oe=n[2*he],Ae=n[2*he+1];oe<f&&(f=oe),Ae<y&&(y=Ae),oe>b&&(b=oe),Ae>T&&(T=Ae),this._ids[he]=he}const P=(f+b)/2,j=(y+T)/2;let G,V,K,_t=1/0;for(let he=0;he<h;he++){const oe=Qp(P,j,n[2*he],n[2*he+1]);oe<_t&&(G=he,_t=oe)}const Tt=n[2*G],jt=n[2*G+1];_t=1/0;for(let he=0;he<h;he++){if(he===G)continue;const oe=Qp(Tt,jt,n[2*he],n[2*he+1]);oe<_t&&oe>0&&(V=he,_t=oe)}let de=n[2*V],Ne=n[2*V+1],Nt=1/0;for(let he=0;he<h;he++){if(he===G||he===V)continue;const oe=np(Tt,jt,de,Ne,n[2*he],n[2*he+1]);oe<Nt&&(K=he,Nt=oe)}let ue=n[2*K],$t=n[2*K+1];if(Nt===1/0){for(let Ae=0;Ae<h;Ae++)this._dists[Ae]=n[2*Ae]-n[0]||n[2*Ae+1]-n[1];ku(this._ids,this._dists,0,h-1);const he=new Uint32Array(h);let oe=0;for(let Ae=0,nn=-1/0;Ae<h;Ae++){const on=this._ids[Ae];this._dists[on]>nn&&(he[oe++]=on,nn=this._dists[on])}return this.hull=he.subarray(0,oe),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(tp(Tt,jt,de,Ne,ue,$t)<0){const he=V,oe=de,Ae=Ne;V=K,de=ue,Ne=$t,K=he,ue=oe,$t=Ae}const ie=function(he,oe,Ae,nn,on,$n){const nr=Ae-he,$e=nn-oe,Ue=on-he,Cn=$n-oe,kn=nr*nr+$e*$e,wr=Ue*Ue+Cn*Cn,Ar=.5/(nr*Cn-$e*Ue);return{x:he+(Cn*kn-$e*wr)*Ar,y:oe+(nr*wr-Ue*kn)*Ar}}(Tt,jt,de,Ne,ue,$t);this._cx=ie.x,this._cy=ie.y;for(let he=0;he<h;he++)this._dists[he]=Qp(n[2*he],n[2*he+1],ie.x,ie.y);ku(this._ids,this._dists,0,h-1),this._hullStart=G;let Je=3;r[G]=e[K]=V,r[V]=e[G]=K,r[K]=e[V]=G,s[G]=0,s[V]=1,s[K]=2,u.fill(-1),u[this._hashKey(Tt,jt)]=G,u[this._hashKey(de,Ne)]=V,u[this._hashKey(ue,$t)]=K,this.trianglesLen=0,this._addTriangle(G,V,K,-1,-1,-1);for(let he,oe,Ae=0;Ae<this._ids.length;Ae++){const nn=this._ids[Ae],on=n[2*nn],$n=n[2*nn+1];if(Ae>0&&Math.abs(on-he)<=ep&&Math.abs($n-oe)<=ep||(he=on,oe=$n,nn===G||nn===V||nn===K))continue;let nr=0;for(let wr=0,Ar=this._hashKey(on,$n);wr<this._hashSize&&(nr=u[(Ar+wr)%this._hashSize],nr===-1||nr===r[nr]);wr++);nr=e[nr];let $e,Ue=nr;for(;$e=r[Ue],tp(on,$n,n[2*Ue],n[2*Ue+1],n[2*$e],n[2*$e+1])>=0;)if(Ue=$e,Ue===nr){Ue=-1;break}if(Ue===-1)continue;let Cn=this._addTriangle(Ue,nn,r[Ue],-1,-1,s[Ue]);s[nn]=this._legalize(Cn+2),s[Ue]=Cn,Je++;let kn=r[Ue];for(;$e=r[kn],tp(on,$n,n[2*kn],n[2*kn+1],n[2*$e],n[2*$e+1])<0;)Cn=this._addTriangle(kn,nn,$e,s[nn],-1,s[kn]),s[nn]=this._legalize(Cn+2),r[kn]=kn,Je--,kn=$e;if(Ue===nr)for(;$e=e[Ue],tp(on,$n,n[2*$e],n[2*$e+1],n[2*Ue],n[2*Ue+1])<0;)Cn=this._addTriangle($e,nn,Ue,-1,s[Ue],s[$e]),this._legalize(Cn+2),s[$e]=Cn,r[Ue]=Ue,Je--,Ue=$e;this._hullStart=e[nn]=Ue,r[Ue]=e[kn]=nn,r[nn]=kn,u[this._hashKey(on,$n)]=nn,u[this._hashKey(n[2*Ue],n[2*Ue+1])]=Ue}this.hull=new Uint32Array(Je);for(let he=0,oe=this._hullStart;he<Je;he++)this.hull[he]=oe,oe=r[oe];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(n,e){return Math.floor(function(r,s){const u=r/(Math.abs(r)+Math.abs(s));return(s>0?3-u:1+u)/4}(n-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(n){const{_triangles:e,_halfedges:r,coords:s}=this;let u=0,h=0;for(;;){const f=r[n],y=n-n%3;if(h=y+(n+2)%3,f===-1){if(u===0)break;n=Xh[--u];continue}const b=f-f%3,T=y+(n+1)%3,P=b+(f+2)%3,j=e[h],G=e[n],V=e[T],K=e[P];if(bm(s[2*j],s[2*j+1],s[2*G],s[2*G+1],s[2*V],s[2*V+1],s[2*K],s[2*K+1])){e[n]=K,e[f]=j;const _t=r[P];if(_t===-1){let jt=this._hullStart;do{if(this._hullTri[jt]===P){this._hullTri[jt]=n;break}jt=this._hullPrev[jt]}while(jt!==this._hullStart)}this._link(n,_t),this._link(f,r[h]),this._link(h,P);const Tt=b+(f+1)%3;u<Xh.length&&(Xh[u++]=Tt)}else{if(u===0)break;n=Xh[--u]}}return h}_link(n,e){this._halfedges[n]=e,e!==-1&&(this._halfedges[e]=n)}_addTriangle(n,e,r,s,u,h){const f=this.trianglesLen;return this._triangles[f]=n,this._triangles[f+1]=e,this._triangles[f+2]=r,this._link(f,s),this._link(f+1,u),this._link(f+2,h),this.trianglesLen+=3,f}}function Qp(o,n,e,r){const s=o-e,u=n-r;return s*s+u*u}function bm(o,n,e,r,s,u,h,f){const y=o-h,b=n-f,T=e-h,P=r-f,j=s-h,G=u-f,V=T*T+P*P,K=j*j+G*G;return y*(P*K-V*G)-b*(T*K-V*j)+(y*y+b*b)*(T*G-P*j)<0}function np(o,n,e,r,s,u){const h=e-o,f=r-n,y=s-o,b=u-n,T=h*h+f*f,P=y*y+b*b,j=.5/(h*b-f*y),G=(b*T-f*P)*j,V=(h*P-y*T)*j;return G*G+V*V}function ku(o,n,e,r){if(r-e<=20)for(let s=e+1;s<=r;s++){const u=o[s],h=n[u];let f=s-1;for(;f>=e&&n[o[f]]>h;)o[f+1]=o[f--];o[f+1]=u}else{let s=e+1,u=r;Os(o,e+r>>1,s),n[o[e]]>n[o[r]]&&Os(o,e,r),n[o[s]]>n[o[r]]&&Os(o,s,r),n[o[e]]>n[o[s]]&&Os(o,e,s);const h=o[s],f=n[h];for(;;){do s++;while(n[o[s]]<f);do u--;while(n[o[u]]>f);if(u<s)break;Os(o,s,u)}o[e+1]=o[u],o[u]=h,r-s+1>=u-e?(ku(o,n,s,r),ku(o,n,e,u-1)):(ku(o,n,e,u-1),ku(o,n,s,r))}}function Os(o,n,e){const r=o[n];o[n]=o[e],o[e]=r}function wm(o){return o[0]}function Sm(o){return o[1]}function Ka(o,n,e){return o.fillType==="solidFill"?function(r,s,u){const h=new ps,[f,y]=Lu(r.color);return h.beginFill(f,y),h.drawRect(0,0,s,u),h.endFill(),h}(o,n,e):o.fillType==="gradientFill"?function(r,s,u){let h=null;const f=new Ri;if(r.stopList.sort((b,T)=>b.pos-T.pos),!r.stopList.find(b=>b.pos===0)){const b=r.stopList[0];r.stopList.unshift({pos:0,color:b.color})}if(!r.stopList.find(b=>b.pos===1)){const b=r.stopList[r.stopList.length-1];r.stopList.push({pos:1,color:b.color})}const y=b=>{const T=[];for(let P=0,j=b.length;P<j-1;P++){const G=b[P],V=b[P+1],K=G.pos+.5*(V.pos-G.pos),_t=Ou(G.color,V.color,.5),Tt=2*P;T[Tt]=G,T[Tt+1]={color:_t,pos:K},T[Tt+2]=V}return T};if(r.stopList=y(r.stopList),r.stopList=y(r.stopList),h=r.line?Tm(r,s,u):r.path?function(b,T,P){var j,G,V;const K=[],_t={x:0,y:0};if(((j=b.path)===null||j===void 0?void 0:j.path)==="circle"||((G=b.path)===null||G===void 0?void 0:G.path)==="rect"||((V=b.path)===null||V===void 0?void 0:V.path)==="shape"){const Tt=T/2,jt=P/2,de=Math.sqrt(Tt*Tt+jt*jt);b.stopList.forEach(Ne=>{if(Ne.pos===0)K.push({point:{x:0,y:0},color:Ne.color});else{const Nt=de*Ne.pos,ue=new va.Path;ue.absellipse(0,0,Nt,Nt,0,2*Math.PI,!1,0),ue.getPoints(50).forEach($t=>{K.push({point:{x:$t.x,y:$t.y},color:Ne.color})})}_t.x=Tt,_t.y=jt})}return{points:K,position:_t}}(r,s,u):Tm(r,s,u),h){const b=[],T=[],{position:P,points:j}=h,G=qh.from(j,jt=>jt.point.x,jt=>jt.point.y);for(let jt=0;jt<G.triangles.length;jt+=3)b.push(j[G.triangles[jt]].point.x,j[G.triangles[jt]].point.y),b.push(j[G.triangles[jt+1]].point.x,j[G.triangles[jt+1]].point.y),b.push(j[G.triangles[jt+2]].point.x,j[G.triangles[jt+2]].point.y),T.push(...Rs(j[G.triangles[jt]].color)),T.push(...Rs(j[G.triangles[jt+1]].color)),T.push(...Rs(j[G.triangles[jt+2]].color));const V=new Na;V.addAttribute("aVertexPosition",b,2),V.addAttribute("aColor",T,4);const K=ko.from(`
5891
+ `,{color:new Float32Array([0,0,0,0]),active:0}),this.currentColor="#FFFFFFFF"}set color(n){this.currentColor=n;const e=Rs(n);this.uniforms.color=Float32Array.from(e)}get color(){return this.currentColor}}const kh=new ai.ColorMatrixFilter;kh.matrix=[1,0,0,0,-.2,0,1,0,0,-.2,0,0,1,0,-.2,0,0,0,1,0];const Uh=new ai.ColorMatrixFilter;Uh.matrix=[1,0,0,0,-.1,0,1,0,0,-.1,0,0,1,0,-.1,0,0,0,1,0];const Yd=new ai.ColorMatrixFilter;Yd.matrix=[1,0,0,0,.2,0,1,0,0,.2,0,0,1,0,.2,0,0,0,1,0];const Gh=new ai.ColorMatrixFilter;Gh.matrix=[1,0,0,0,.1,0,1,0,0,.1,0,0,1,0,.1,0,0,0,1,0];const Zd={darken:kh,darkenLess:Uh,lightenLess:Gh,lighten:Yd};var Jd=S(2),Nu=S.n(Jd);class $d{constructor(n){this.scaleX=1,this.scaleY=1,this.pivot={x:0,y:0},this.paths=[],this.hash="",this.width=0,this.height=0,this.graphicsId="",this.textureId="",this.id=n.id,this.type=n.type,this.heightSize=n.heightSize,this.widthSize=n.widthSize,this.fillStyle=n.fillStyle||{fillType:"solidFill",color:"#ffffffff"},this.lineWidth=n.lineWidth||1,this.position=n.position||{x:0,y:0},this.rotate=n.rotation||1,this.path=this.getUnitPath(),this.setScaleFromLineWidth(),this.setScaleFromSize(),this.generatePaths(),this.setPivot()}setPivot(){switch(this.type){case"oval":case"diamond":this.pivot={x:this.width/2,y:this.height/2};break;case"arrow":case"stealth":case"triangle":default:this.pivot={x:this.width,y:this.height/2}}}generatePaths(){this.hash="arrow-"+Nu()(this.path+this.scaleX+this.scaleY),this.paths=[{id:this.id,path:this.path,fill:"norm",hasStroke:!1,hash:this.hash,scale:{x:this.scaleX,y:this.scaleY}}]}getUnitPath(){switch(this.type){case"stealth":return"M 0,0 L 95250,47625 L 0,95250 L 28575,47625 C C";case"oval":return"M 0,47625 A 47625,47625,-3.14159265,6.2831853 C C";case"diamond":return"M 47625,0 L 95250,47625 L 47625,95250 L 0,47625 C C";case"arrow":return"M 9525,0 L 95250,47625 L 9525,95250 L 0,85725 L 68389.5,47625 L 0,9525 C C";case"triangle":return"M 0,0 L 95250,47625 L 0,95250 C C";default:return""}}setScaleFromLineWidth(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=.29*this.lineWidth+.7,this.scaleY*=.29*this.lineWidth+.7;break;default:throw new Error("can't match any arrow type!")}}setScaleFromSize(){switch(this.type){case"stealth":case"oval":case"diamond":case"arrow":case"triangle":this.scaleX*=1,this.scaleY*=1;break;default:throw new Error("can't match any arrow type!")}switch(this.widthSize){case"sm":this.scaleX*=3/4;break;case"lg":this.scaleX*=1.25;break;case"med":this.scaleX*=1}switch(this.heightSize){case"sm":this.scaleY*=3/4;break;case"lg":this.scaleY*=1.25;break;case"med":this.scaleY*=1}this.width=10*this.scaleX,this.height=10*this.scaleY}}class zc extends Bh{constructor(n,e,r){super({position:{x:n.x,y:n.y},width:n.width,height:n.height},e,r),this.fillColorFilter=new Du,this.fill=new eu(this),this.json=n,this.ctx=e,this.parentGlobalPos=r,this.global={x:r.x+n.x,y:r.y+n.y},this.updateTransform({position:{x:n.x,y:n.y},width:n.width,height:n.height})}get fillActive(){var n,e;return((e=(n=this.container.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set fillActive(n){var e,r;n?((r=(e=this.container.filters)===null||e===void 0?void 0:e.indexOf(this.fillColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.container.filters=[this.fillColorFilter]):this.container.filters=[]}get renderContainer(){return this.container}get interactiveContainer(){return this.container}getTextElement(){return null}getBgElement(){return null}get ppt_x(){return this.global.x/this.ctx.stageWidth}set ppt_x(n){const e=n*this.ctx.stageWidth-this.global.x,r=this.presetSubType===544?this.scaleExt.x:1;this.container.position.x=this.designX+e+this.container.pivot.x*r}get ppt_y(){return this.global.y/this.ctx.stageHeight}set ppt_y(n){const e=n*this.ctx.stageHeight-this.global.y,r=this.presetSubType===544?this.scaleExt.y:1;this.container.position.y=this.designY+e+this.container.pivot.y*r}get design_ppt_x(){return Cs(this.global.x/this.ctx.stageWidth)}get design_ppt_y(){return Cs(this.global.y/this.ctx.stageHeight)}}var jc=S(9),no=S.n(jc);function Is(){return Date.now().toString(32)+Math.random().toString(32).substring(2)}function Vc(o){const n=[],e=o.filter(y=>{const b=y.width<2048&&y.height<2048;return b||n.push(y),b}).sort((y,b)=>y.width*y.height-b.width*b.height);let r=e.length+1,s=2050,u=2050;const h=[];let f=null;for(;(s>2048||u>2048)&&e.length>0;)r-=1,f=no()(e.slice(0,r)),s=f.width,u=f.height;return f&&h.push(f),n.forEach(y=>{const b=no()([y]);h.push(b)}),r<e.length?h.concat(Vc(e.slice(r))):h}function Yp(o,n,e){let r,s,u=n,h=e;u===0&&(u=h/1e4),h===0&&(h=u/1e4);const f=o%360;if(f%180==0)r=Math.cos(f*(Math.PI/180))*u,s=0;else if(f%90==0)r=0,s=-Math.sin(f*(Math.PI/180))*h;else{const y=Math.tan(f*Math.PI/180);r=u*h/Math.sqrt(Math.pow(h,2)+Math.pow(u*y,2)),(f>90&&f<270||f<-90&&f>-270)&&(r=-r),s=-y*r}return{x:r,y:s}}function Fu(o,n,e,r,s,u,h){const f={x:0,y:0},y=-u,b=Yp((s=-s)/Math.PI*180,e,r),T=o.x-b.x,P=o.y-b.y;for(let j=0;j<51;j++){const G=Yp((s+j/50*y)/Math.PI*180,e,r);G.x+=T,G.y+=P,j/50==1&&(f.x=G.x,f.y=G.y),G.x=G.x/9525*n.x,G.y=G.y/9525*n.y,h.lineTo(G.x,G.y)}return f}class Wc{constructor(n,e,r,s){this.renderContainer=new Ri,this.ctx=n,this.type=e,this.lineWidth=r,this.width=s}createPaths(){if(this.type==="ww")return null;{const n=`M 0,0 L ${9525*this.width},0`;return{paths:[{id:Is(),path:n,fill:"norm",hasStroke:!0,scale:{x:1,y:1},hash:Nu()(n)}],width:this.width,height:this.lineWidth}}}preRender(){const n=this.createPaths();if(n){const{paths:e,width:r,height:s}=n,u=e.reduce((h,f)=>h+f.hash,"");this.ghcTextureId=this.ctx.graphicsTexture.addGraphics(e,u,{x:0,y:0},r,s,{width:this.lineWidth},!1)}}render(){if(this.ghcTextureId){const n=this.ctx.graphicsTexture.getGraphicsData(this.ghcTextureId);n&&(this.sprite=new Nr,this.sprite.pivot.x=n.pivot.x,this.sprite.texture=n.texture)}}destroy(){console.log("")}}var Zp=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Xc extends zc{constructor(n,e,r){super(n,e,r),this.fillMaskSprite=new Nr,this.fillSprite=new Nr,this.strokeMaskSprite=new Nr,this.strokeSprite=new Nr,this.textureContainer=new Ri,this.underline=null;const{underLine:s,lineHeight:u,width:h}=this.json;s&&(this.underline=new Wc(e,s.type,u/16,h))}getIterateEntry(){return null}getBgElement(){return null}updateTransform(n){var e,r,s,u;const{isHorz:h}=this.json;n.position={x:h&&(r=(e=n.position)===null||e===void 0?void 0:e.x)!==null&&r!==void 0?r:0,y:h?0:(u=(s=n.position)===null||s===void 0?void 0:s.y)!==null&&u!==void 0?u:0},n.width=h?this.json.width:this.json.lineWidth,n.height=h?this.json.lineHeight:this.json.height,super.updateTransform(n)}preRender(){const{fill:n,stroke:e,lineWidth:r,lineHeight:s,content:u}=this.json;n&&(this.fillTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:n.key,filters:[{type:"changeBulletColor",args:["#000000","#FFA500"]}]},n.width,n.height,void 0,u==="\u25FE"),n.fill&&n.fill.fillType!=="noFill"&&(this.fillBgId=this.ctx.fillTexture.addFill(n.fill,r,s))),e&&(this.strokeTextureId=this.ctx.fillTexture.addFill({fillType:"blipFill",src:e.key,filters:[]},e.width,e.height),e.fill&&e.fill.fillType!=="noFill"&&(this.strokeBgId=this.ctx.fillTexture.addFill(e.fill,r,s))),this.underline&&this.underline.preRender()}render(){var n;return Zp(this,void 0,void 0,function*(){const{lineWidth:e,lineHeight:r,baseLine:s,isHorz:u,height:h,width:f,highlightColor:y,x:b,y:T,content:P}=this.json;if(y){const V=new ps,[K,_t]=Lu(y);V.beginFill(K,_t),V.drawRect(0,0,u?f:e,u?r:h),V.endFill(),this.textureContainer.addChild(V)}if(this.fillBgId&&this.fillTextureId){const V=this.ctx.fillTexture.getTexture(this.fillTextureId);(V==null?void 0:V.texture)&&(this.fillMaskSprite.texture=V.texture,this.fillMaskSprite.scale.x=.5,this.fillMaskSprite.scale.y=.5);const K=this.ctx.fillTexture.getTexture(this.fillBgId);K.texture&&(this.fillSprite.texture=K.texture,this.fillSprite.mask=this.fillMaskSprite,this.fillSprite.addChild(this.fillMaskSprite),u?this.fillSprite.position.y=T:this.fillSprite.position.x=b,this.textureContainer.addChild(this.fillSprite))}if(this.strokeBgId&&this.strokeTextureId){const V=this.ctx.fillTexture.getTexture(this.strokeTextureId);(V==null?void 0:V.texture)&&(this.strokeMaskSprite.texture=V.texture,this.strokeMaskSprite.scale.x=.5,this.strokeMaskSprite.scale.y=.5);const K=this.ctx.fillTexture.getTexture(this.strokeBgId);(K==null?void 0:K.texture)&&(this.strokeSprite.texture=K.texture,this.strokeSprite.mask=this.strokeMaskSprite,this.strokeSprite.addChild(this.strokeMaskSprite),u?this.strokeSprite.position.y=T:this.strokeSprite.position.x=b,this.textureContainer.addChild(this.strokeSprite))}if(this.underline&&(this.underline.render(),this.underline.sprite&&this.fillMaskSprite)){let V=null;this.fillBgId&&(V=this.ctx.fillTexture.getTexture(this.fillBgId)),this.underline.sprite.position.y=s,this.underline.sprite.position.x=0;const K=new Nr;K.texture=(n=V==null?void 0:V.texture)!==null&&n!==void 0?n:null,K.mask=this.underline.sprite,K.addChild(this.underline.sprite),this.textureContainer.addChild(K)}const j=Li.create({width:u?f:e,height:u?r:h,resolution:2});this.ctx.renderer.render(this.textureContainer,{renderTexture:j});const G=new Nr;G.texture=j,this.container.addChild(G),this.container.name=P})}destroy(){this.textureContainer.destroy({texture:!0}),this.container.destroy({children:!0,texture:!0})}}var Hh=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class qc extends zc{constructor(){super(...arguments),this.units=[],this.isHorz=!0}getIterateElements(){return this.units}getIterateEntry(n,e,r){return this.units[e]?this.units[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}preRender(){for(let n=0,e=this.json.textUnits.length;n<e;n++){const r=this.json.textUnits[n];if(!r.content)continue;const{height:s,width:u,baseline:h}=this.json,f=new Xc(Object.assign(Object.assign({},r),{lineHeight:s,lineWidth:u,baseLine:h,isHorz:this.isHorz}),this.ctx,this.global);f.preRender(),this.units.push(f)}}render(){return Hh(this,void 0,void 0,function*(){for(const n of this.units.reverse())yield n.render(),this.container.addChild(n.container)})}destroy(){this.units.forEach(n=>{n.destroy()}),this.container.destroy({children:!1})}}var ro=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Jp extends zc{constructor(){super(...arguments),this.iterateElements=[],this.lines=[],this.isHorz=!0}getIterateElements(){if(this.iterateElements.length>0)return this.iterateElements;const n=this.lines.reduce((e,r)=>e=e.concat(r.getIterateElements()),[]);return this.iterateElements=n,n}getIterateEntry(n,e,r){const s=this.getIterateElements();return s[e]?s[e]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}preRender(){for(let n=0,e=this.json.lines.length;n<e;n++){const r=this.json.lines[n],s=new qc(r,this.ctx,this.global);s.isHorz=this.isHorz,s.container.name="line-"+n,s.preRender(),this.lines.push(s)}}render(){return ro(this,void 0,void 0,function*(){for(const n of this.lines)yield n.render(),this.container.addChild(n.container)})}destroy(){this.lines.forEach(n=>{n.destroy()}),this.container.destroy({children:!1})}}var Yc=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Zc{constructor(n,e,r,s){this.iterateElements=[],this.paragraphs=[],this.container=new Ri,this.json=n,this.ctx=e,this.parentGlobalPos=s,this.iterateType=r,this.container.name="textBody",this.global={x:this.parentGlobalPos.x+n.position.x,y:this.parentGlobalPos.y+n.position.y},this.container.position.x=n.position.x,this.container.position.y=n.position.y,this.container.scale.x=n.scale.x,this.container.scale.y=n.scale.y;const u=new ps;u.drawRect(0,0,n.width,n.height),this.container.addChild(u)}get width(){return this.json.width}get height(){return this.json.height}get x(){return this.json.position.x}get y(){return this.json.position.y}getTextElement(n,e){return n==="paragraph"?this.paragraphs[e[0]]:null}getIterateEntry(n,e){return this.iterateElements[n]?this.iterateElements[n]:(this.ctx.eventHub.emit("IterateTimeNodeEnd",e),null)}destroy(){this.paragraphs.forEach(n=>{n.destroy()})}preRender(){var n;for(let e=0,r=this.json.paragraphs.length;e<r;e++){const s=this.json.paragraphs[e],u=new Jp(s,this.ctx,this.global);u.isHorz=(n=this.json.isHorz)===null||n===void 0||n,u.preRender(),this.iterateElements=this.iterateElements.concat(u.getIterateElements()),u.container.name="\u6BB5\u843D-"+e,this.paragraphs.push(u)}}render(){return Yc(this,void 0,void 0,function*(){for(const e of this.paragraphs)yield e.render(),this.container.addChild(e.container);const{width:n}=this.container;this.container.scale.x<0&&(this.container.x+=-1*n)})}}var Kd=S(19),Jc=S.n(Kd),Ya=S(20),$p=S.n(Ya);const $c={Reflection:class extends Uo{constructor(o){super(Jc.a,$p.a,{uShapeFilterArea:new Float32Array([0,0,0,0]),uStartAlpha:o.startAlpha,uEndAlpha:o.endAlpha,uBlur:0}),this.json=o}}};var io=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};const nu={pivot:{x:0,y:0},width:0,height:0};class xl extends Bh{constructor(n,e,r){var s,u,h;super(n,e,r),this.renderContainer=new Ri,this.bgTextureId="",this.bgSprite=new Nr,this.backgroundMaskTextureId="",this.filterAreaJustifies=[],this.backgroundMask=new Nr,this.pathStrokeTextureId="",this.pathSprite=new Nr,this.pathMask=new Nr,this.pathMaskTextureId="",this.fillColorFilter=new Du,this.strokeColorFilter=new Du,this.id="",this.arrowList=[],this.fill=new eu(this),this.stroke=new ri(this),this.updateFilterArea=()=>{const f=this.renderContainer.getBounds(!1),y=this.filterAreaJustifies.map(j=>j(f)),b=y.map(j=>j.width),T=y.map(j=>j.height),P=new dr(f.x,f.y,Math.max(...b),Math.max(...T));this.renderContainer.filterArea=P,this.renderContainer.filters.forEach(j=>{j.uniforms.uShapeFilterArea=new Float32Array(4),j.uniforms.uShapeFilterArea[0]=P.x,j.uniforms.uShapeFilterArea[1]=P.y,j.uniforms.uShapeFilterArea[2]=P.width,j.uniforms.uShapeFilterArea[3]=P.height})},this.json=n,this.id=n.id,this.container.name=n.id,this.renderContainer.name=n.id+"-render-container",this.fillStyle=n.fillStyle,this.lineStyle=n.lineStyle,this.geometry=n.geometry,this.ctx.timingTargets.addTarget(this.id,this),((s=this.fillStyle)===null||s===void 0?void 0:s.fillType)==="solidFill"&&(this.fillColorFilter.currentColor=this.fillStyle.color),((h=(u=this.lineStyle)===null||u===void 0?void 0:u.fill)===null||h===void 0?void 0:h.fillType)==="solidFill"&&(this.strokeColorFilter.currentColor=this.lineStyle.fill.color),this.pathSprite.name="path-fill",this.pathMask.name="path-mask",this.bgSprite.name="bg-fill",this.backgroundMask.name="bg-mask",this.updateTransform(this.json),n.textBody&&(this.text=new Zc(n.textBody,this.ctx,n.textBody.iterateType,{x:this.designGlobalPosition.x,y:this.designGlobalPosition.y})),this.container.hitArea=new dc(1,1,this.json.width,this.json.height)}get interactiveContainer(){return this.renderContainer}get strokeActive(){var n,e;return((e=(n=this.pathSprite.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set strokeActive(n){var e,r;n?((r=(e=this.pathSprite.filters)===null||e===void 0?void 0:e.indexOf(this.strokeColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.pathSprite.filters=[this.strokeColorFilter]):this.pathSprite.filters=[]}get fillActive(){var n,e;return((e=(n=this.bgSprite.filters)===null||n===void 0?void 0:n.length)!==null&&e!==void 0?e:-1)>0}set fillActive(n){var e,r;n?((r=(e=this.bgSprite.filters)===null||e===void 0?void 0:e.indexOf(this.fillColorFilter))!==null&&r!==void 0?r:-1)<0&&(this.bgSprite.filters=[this.fillColorFilter]):this.bgSprite.filters=[]}getTextElement(n,e){var r,s;return(s=(r=this.text)===null||r===void 0?void 0:r.getTextElement(n,e))!==null&&s!==void 0?s:null}getBgElement(){return this}getIterateEntry(n,e,r){return n==="el"||e===0?this:this.text?this.text.getIterateEntry(e-1,r)||null:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}createBackgroundMask(){return io(this,void 0,void 0,function*(){const n=this.ctx.graphicsTexture.getGraphicsData(this.backgroundMaskTextureId);n&&(this.backgroundMask.texture=n.texture,this.backgroundMask.pivot.x=n.pivot.x,this.backgroundMask.pivot.y=n.pivot.y)})}createBackground(){var n,e,r,s,u,h,f,y,b;const{pivot:T,width:P,height:j}=((n=this.geometry)===null||n===void 0?void 0:n.fillTransform)||nu;if(this.json.useBgFill&&this.ctx.bgTexture)return this.bgSprite.texture=this.ctx.bgTexture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.bgSprite.pivot.x=((e=this.json.position)===null||e===void 0?void 0:e.x)||0,void(this.bgSprite.pivot.y=((r=this.json.position)===null||r===void 0?void 0:r.y)||0);if(((s=this.fillStyle)===null||s===void 0?void 0:s.fillType)==="gifFill"){const G=this.ctx.fillTexture.getGifFrames(this.fillStyle.src),V=G.map((Tt,jt)=>({texture:Tt,time:this.fillStyle.delays[jt]||20}));this.bgSprite=new _l(V,!0),this.bgSprite.play();let K=1;const _t=this.fillStyle.loop;this.bgSprite.onLoop=()=>{K+=1,_t>0&&K>_t&&this.bgSprite.gotoAndStop(G.length-1)},this.bgSprite.height=j||this.designHeight,this.bgSprite.width=P||this.designWidth,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite)}else if(((u=this.fillStyle)===null||u===void 0?void 0:u.fillType)==="groupFill"){if(this.groupFillTextureId){const G=this.ctx.fillTexture.getTexture(this.groupFillTextureId);G.texture&&(this.bgSprite.texture=G.texture,this.bgSprite.mask=this.backgroundMask,this.bgSprite.x=-1*((f=(h=this.json.position)===null||h===void 0?void 0:h.x)!==null&&f!==void 0?f:0),this.bgSprite.y=-1*((b=(y=this.json.position)===null||y===void 0?void 0:y.y)!==null&&b!==void 0?b:0),this.container.addChild(this.bgSprite),this.container.addChild(this.backgroundMask))}}else{const G=this.ctx.fillTexture.getTexture(this.bgTextureId);G.texture&&(this.bgSprite.texture=G.texture,this.bgSprite.mask=this.backgroundMask,this.container.addChild(this.backgroundMask),this.container.addChild(this.bgSprite),this.bgSprite.x=T.x,this.bgSprite.y=T.y,this.bgSprite.pivot.x=G.pivot.x,this.bgSprite.pivot.y=G.pivot.y)}}createPathFill(){const n=this.ctx.fillTexture.getTexture(this.pathStrokeTextureId);n.texture&&(this.pathSprite.texture=n.texture,this.pathSprite.pivot.x=this.pathMask.pivot.x,this.pathSprite.pivot.y=this.pathMask.pivot.y,this.pathMask.pivot.x=0,this.pathMask.pivot.y=0,this.pathSprite.mask=this.pathMask,this.pathSprite.addChild(this.pathMask),this.container.addChild(this.pathSprite))}createPathMask(){return io(this,void 0,void 0,function*(){const n=this.ctx.graphicsTexture.getGraphicsData(this.pathMaskTextureId);if(n){const{texture:e,pivot:r}=n;this.pathMask.texture=e,this.pathMask.pivot.x=r.x,this.pathMask.pivot.y=r.y,this.pathMask.texture=e}})}createFilledPathMask(){var n,e;return io(this,void 0,void 0,function*(){const r=((e=(n=this.geometry)===null||n===void 0?void 0:n.paths)===null||e===void 0?void 0:e.filter(s=>s.fill!=="none"&&s.fill!=="norm"))||[];for(const s of r){const u=this.ctx.graphicsTexture.getGraphicsData(s.id);if(u){const h=new Nr(u.texture);h.pivot.x=u.pivot.x,h.pivot.y=u.pivot.y;const f=new Nr(this.bgSprite.texture);f.pivot.x=this.bgSprite.pivot.x,f.pivot.y=this.bgSprite.pivot.y,f.mask=h,f.filters=[Zd[s.fill]],this.container.addChild(f),this.container.addChild(h)}}})}createBackgroundTexture(){var n,e,r,s,u;if(this.fillStyle&&this.fillStyle.fillType!=="gifFill"&&this.fillStyle.fillType!=="groupFill"){const h=((n=this.geometry)===null||n===void 0?void 0:n.fillTransform)||nu,f=(h==null?void 0:h.width)||this.designWidth,y=(h==null?void 0:h.height)||this.designHeight;this.bgTextureId=this.ctx.fillTexture.addFill(this.fillStyle,f+((r=(e=this.lineStyle)===null||e===void 0?void 0:e.width)!==null&&r!==void 0?r:0),y+((u=(s=this.lineStyle)===null||s===void 0?void 0:s.width)!==null&&u!==void 0?u:0))}}createPathFillTexture(){var n,e;if(((n=this.lineStyle)===null||n===void 0?void 0:n.fill)&&this.lineStyle.fill.fillType!=="gifFill"&&this.lineStyle.fill.fillType!=="groupFill"){const{width:r,height:s}=((e=this.geometry)===null||e===void 0?void 0:e.lineTransform)||nu,u=Object(X.isNumber)(this.lineStyle.width)?this.lineStyle.width:1;this.pathStrokeTextureId=this.ctx.fillTexture.addFill(this.lineStyle.fill,(r||this.designWidth)+u,(s||this.designHeight)+u)}}createArrowFillTexture(){var n;(n=this.json.lineArrowList)===null||n===void 0||n.forEach(e=>{var r,s,u,h;const f=new $d(Object.assign(Object.assign({},e),{fillStyle:(r=this.lineStyle)===null||r===void 0?void 0:r.fill,lineWidth:(u=(s=this.lineStyle)===null||s===void 0?void 0:s.width)!==null&&u!==void 0?u:0}));f.graphicsId=this.ctx.graphicsTexture.addGraphics((h=f.paths)!==null&&h!==void 0?h:[],f.hash,f.pivot||{x:0,y:0},f.width,f.height,void 0,!0),f.textureId=this.ctx.fillTexture.addFill(f.fillStyle,f.width,f.height),this.arrowList.push(f)})}createArrow(){this.arrowList.forEach(n=>{const e=this.ctx.graphicsTexture.getGraphicsData(n.graphicsId),r=this.ctx.fillTexture.getTexture(n.textureId);if(e&&r.texture){const{texture:s,pivot:u}=e,h=new Nr(s);h.pivot.x=u.x,h.pivot.y=u.y;const f=new Nr(r.texture);f.addChild(h),f.mask=h,f.position.x=n.position.x,f.position.y=n.position.y,f.pivot.x=n.pivot.x+r.pivot.x,f.pivot.y=n.pivot.y+r.pivot.y,f.rotation=n.rotate/180*Math.PI,n.sprite=f,this.container.addChild(f)}})}preRender(){var n,e,r,s,u,h,f,y,b,T;this.createBackgroundTexture(),this.createPathFillTexture(),this.createArrowFillTexture();const{width:P,height:j,pivot:G}=((n=this.geometry)===null||n===void 0?void 0:n.lineTransform)||nu,V=P||this.designWidth,K=j||this.designHeight;((e=this.geometry)===null||e===void 0?void 0:e.paths)&&this.geometry.paths.length>0&&(this.pathMaskTextureId=this.ctx.graphicsTexture.addGraphics((s=(r=this.geometry)===null||r===void 0?void 0:r.paths)!==null&&s!==void 0?s:[],this.geometry.hash,G||{x:0,y:0},V,K,this.lineStyle,!1),this.backgroundMaskTextureId=this.ctx.graphicsTexture.addGraphics((h=(u=this.geometry)===null||u===void 0?void 0:u.paths)!==null&&h!==void 0?h:[],this.geometry.hash,G||{x:0,y:0},V,K,this.lineStyle,!0));const _t=((y=(f=this.geometry)===null||f===void 0?void 0:f.paths)===null||y===void 0?void 0:y.filter(Tt=>Tt.fill!=="none"&&Tt.fill!=="norm"))||[];for(const Tt of _t)this.ctx.graphicsTexture.addGraphics([Tt],Tt.hash,(((b=this.geometry)===null||b===void 0?void 0:b.lineTransform)||nu).pivot,V,K,this.lineStyle,!0,Tt.id);(T=this.text)===null||T===void 0||T.preRender()}subClassRender(){return io(this,void 0,void 0,function*(){})}setupEffect(){const{effectList:n}=this.json;if(n&&n.length>0){const e=[];return n.forEach(r=>{r.type==="reflection"&&(this.filterAreaJustifies.push(s=>(s.height*=2,s)),e.push(new $c.Reflection(r)))}),this.ctx.ticker.add(this.updateFilterArea,void 0,-20),this.renderContainer.filters=e,!0}return!1}render(){var n,e,r,s,u,h;return io(this,void 0,void 0,function*(){if(yield this.createBackgroundMask(),yield this.createBackground(),yield this.subClassRender(),yield this.createFilledPathMask(),yield this.createPathMask(),yield this.createPathFill(),yield this.createArrow(),this.text&&(yield this.text.render()),((n=this.json.textBody)===null||n===void 0?void 0:n.iterateType)==="wd"||((e=this.json.textBody)===null||e===void 0?void 0:e.iterateType)==="lt")this.renderContainer.addChild(this.container),this.text&&(this.text.container.position.x=((s=(r=this.json.position)===null||r===void 0?void 0:r.x)!==null&&s!==void 0?s:0)+this.text.x,this.text.container.position.y=((h=(u=this.json.position)===null||u===void 0?void 0:u.y)!==null&&h!==void 0?h:0)+this.text.y,this.renderContainer.addChild(this.text.container));else{if(this.text){if(Object(X.isBoolean)(this.json.textRotateWithShape)&&!this.json.textRotateWithShape){const f=this.json.rotation||0;this.text.container.rotation=-f;const{width:y}=this.text;this.text.container.position.x=y}this.container.addChild(this.text.container)}this.renderContainer.addChild(this.container)}if(this.renderContainer.cacheAsBitmap=!!this.json.cacheAsBitMap,this.json.id==="background"){const f=Li.create({width:this.json.width,height:this.json.height,resolution:Math.ceil(this.ctx.renderer.resolution)});this.ctx.renderer.render(this.renderContainer,{renderTexture:f}),this.ctx.bgTexture=f}})}destroy(){this.bgSprite.destroy(),this.backgroundMask.destroy(),this.pathSprite.destroy(),this.pathMask.destroy(),this.fillColorFilter.destroy(),this.strokeColorFilter.destroy(),this.arrowList.forEach(n=>{var e;(e=n.sprite)===null||e===void 0||e.destroy()})}}var c=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};function g(o,n){for(const e in n)o.style[e]=n[e]}class E{constructor(n){var e,r;this.progress=document.createElement("div"),this.totalTime=document.createElement("span"),this.playButton=document.createElement("div"),this.pauseButton=document.createElement("div"),this.currentTime=document.createElement("span"),this.mediaController=document.createElement("div"),this.currentProgress=document.createElement("div"),this.medianIsEnd=!1,this.playCallBackList=[],this.duration=0,this.start=0,this.end=0,this.changeMediaProgress=s=>{s.stopPropagation();const u=s.offsetX/this.progress.clientWidth*this.duration;this.jumpToTime(u),this.medianIsEnd=!1,this.ctx.eventHub.emit(Pn.mediaSeek,{id:this.targetId,time:this.media.currentTime-this.start,isPlaying:this.media.isPlaying})},this.jumpToTime=(s=0)=>{const u=Math.floor(s)+this.start;this.media.currentTime!==u&&(this.media.currentTime=u,(this.media.paused||this.media.ended)&&this.ctx.clock.setTimeout(()=>{this.media.play().then(()=>this.media.pause())},16))},this.showController=s=>{s.stopPropagation(),this.show()},this.getMediaDuration=()=>{this.duration&&!Number.isNaN(this.duration)||(this.duration=this.media.duration,this.start&&(this.duration-=this.start,this.jumpToTime()),this.end&&(this.duration-=this.end)),this.totalTime.innerText=E.formatTime(this.duration)},this.playMedia=()=>c(this,void 0,void 0,function*(){this.playButton.style.display="none",this.pauseButton.style.display="block",yield this.media.play(),this.medianIsEnd&&(this.medianIsEnd=!1,this.jumpToTime()),this.playCallBackList.forEach(s=>{s()})}),this.pauseMedia=()=>c(this,void 0,void 0,function*(){this.playButton.style.display="block",this.pauseButton.style.display="none",yield this.media.pause()}),this.onMouseOut=s=>{s.stopPropagation(),this.mediaController.style.display="none"},this.mediaTimeUpdate=()=>c(this,void 0,void 0,function*(){const s=this.media.currentTime-this.start;this.duration>0&&(s>this.duration||this.media.ended)&&(yield this.pauseMedia(),this.medianIsEnd=!0),this.currentTime.innerText=E.formatTime(s),this.currentProgress.style.flex=(s/this.duration).toString()}),this.onPauseMedia=()=>{this.playButton.style.display="block",this.pauseButton.style.display="none"},this.onPlayMedia=()=>{this.playButton.style.display="none",this.pauseButton.style.display="block",this.playCallBackList.forEach(s=>{s()})},this.playMediaFromCtrl=()=>{this.ctx.eventHub.emit(Pn.mediaPlay,{id:this.targetId,time:this.media.currentTime}),this.playMedia()},this.pauseMediaFromCtrl=()=>{this.ctx.eventHub.emit(Pn.mediaPause,{id:this.targetId,time:this.media.currentTime}),this.pauseMedia()},this.targetId=n.targetId,this.ctx=n.ctx,this.height=n.height,this.width=n.width,this.sprite=n.sprite,this.media=n.media,this.info=n.info,this.canvasElement=n.canvasElement,this.getMedianContainer(),this.createMediaController(),this.info.cut&&(this.start=(e=this.info.cut.start)!==null&&e!==void 0?e:0,this.end=(r=this.info.cut.end)!==null&&r!==void 0?r:0)}getMedianContainer(){var n;let e=(n=this.canvasElement.parentElement)===null||n===void 0?void 0:n.querySelector(".median-container");e||(e=document.createElement("div"),e.className="median-container",this.canvasElement.parentElement.appendChild(e)),this.container=e}static formatTime(n){let e="00:00";if(n){const r=Math.floor(n/60),s=String(r<0?0:r).padStart(2,"0"),u=Math.floor(n%60);e=`${s}:${String(u<0?0:u).padStart(2,"0")}`}return e}createButton(){const n={marginLeft:"15px",marginRight:"10px",fontSize:"0",height:"20px"};g(this.playButton,Object.assign(Object.assign({},n),{display:"block"}));const e=document.createElement("img");g(e,{height:"20px"}),e.src="https://convertcdn.netless.link/publicFiles/icon/play.png",this.playButton.appendChild(e),g(this.pauseButton,Object.assign(Object.assign({},n),{display:"none"}));const r=document.createElement("img");g(r,{height:"20px"}),r.src="https://convertcdn.netless.link/publicFiles/icon/pause.png",this.pauseButton.appendChild(r)}createTimer(){const n=document.createElement("div");g(n,{width:"100px"}),this.currentTime.innerText="00:00";const e=document.createElement("span");return e.innerText="/",n.append(this.currentTime,e,this.totalTime),n}createProgress(){g(this.progress,{flex:"1",position:"relative",marginRight:"10px"});const n=document.createElement("div");g(n,{background:"#D9D9D9",position:"relative",height:"10px",display:"flex"}),this.progress.appendChild(n),g(this.currentProgress,{background:"#4F4F4F",top:"0px",left:"0",height:"10px",flex:"0"}),n.appendChild(this.currentProgress)}bindEvent(){this.mediaController.addEventListener("mouseover",this.showController,!1),this.mediaController.addEventListener("mouseout",this.onMouseOut,!1),this.progress.addEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.addEventListener("click",this.playMediaFromCtrl,!1),this.pauseButton.addEventListener("click",this.pauseMediaFromCtrl,!1),this.media.on("durationchange",this.getMediaDuration,!1),this.media.on("timeupdate",this.mediaTimeUpdate,!1),this.media.on("pause",this.onPauseMedia,!1),this.media.on("play",this.onPlayMedia,!1)}setControllerPosition(){var n;const{sprite:e}=this,{stageWidth:r,stageHeight:s}=this.ctx,u=e.getGlobalPosition(),h=1/Number((n=this.container)===null||n===void 0?void 0:n.getAttribute("data-scale"));u.y=u.y+this.height-50,u.x=Math.max(u.x,0),u.x=Math.min(u.x,r-300*h),u.y=Math.max(u.y,0),u.y=Math.min(u.y,s-50),g(this.mediaController,{height:"50px",borderRadius:"25px",width:"300px",flexDirection:"row",alignItems:"center",position:"absolute",left:u.x+"px",top:u.y+"px",display:"none",background:"#fff",zIndex:"2",border:"1px solid #ccc",transform:`scale(${h})`,transformOrigin:"0 100%"})}createMediaController(){this.setControllerPosition(),this.createButton();const n=this.createTimer();this.createProgress(),this.mediaController.append(this.playButton,this.pauseButton,n,this.progress),this.container.appendChild(this.mediaController),this.bindEvent()}addPlayCallBack(n){this.playCallBackList.push(n)}unbindEvent(){this.mediaController.removeEventListener("mouseover",this.showController,!1),this.progress.removeEventListener("mousedown",this.changeMediaProgress,!1),this.playButton.removeEventListener("click",()=>this.playMedia(),!1),this.pauseButton.removeEventListener("click",()=>this.pauseMedia(),!1),this.media.removeListener("durationchange",this.getMediaDuration,!1),this.media.removeListener("timeupdate",this.mediaTimeUpdate,!1),this.media.removeListener("pause",this.onPauseMedia,!1),this.media.removeListener("play",this.onPlayMedia,!1)}show(){this.setControllerPosition(),this.mediaController.style.display="flex"}hide(){this.mediaController.style.display="none"}destroy(){var n;this.unbindEvent(),this.playCallBackList=[],(n=this.container)===null||n===void 0||n.removeChild(this.mediaController)}}var F=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class q extends J.a{constructor(n){var e,r;super(),this.type="video",this.sprite=new Nr,this.isPlaying=!1,this.id=n.id,this.video=n.video,this.start=(e=n.video.cut)===null||e===void 0?void 0:e.start,this.end=(r=n.video.cut)===null||r===void 0?void 0:r.end,this.container=n.container,this.ctx=n.ctx,this.ctx.medias[this.id]=this,this.videoResource=new sl(this.video.src,{autoLoad:!0,autoPlay:!1,updateFPS:30,crossorigin:!0});const{video:s,width:u,height:h,sprite:f}=n;this.controller=new E({targetId:n.id,ctx:n.ctx,width:u,height:h,sprite:f,media:this,info:s,canvasElement:n.canvasElement}),this.controller.addPlayCallBack(()=>{this.sprite.width=u,this.sprite.height=h,this.ctx.clock.setTimeout(()=>{this.sprite.visible=!0},50)});const y=new Jn(null,{height:h,width:u});y.resource=this.videoResource,this.videoResource.bind(y),this.sprite=new Nr,this.sprite.visible=!1,this.sprite.texture=new qn(y),this.sprite.interactive=!0,this.container.addChild(this.sprite),this.sprite.on("mouseover",b=>{b.stopPropagation(),this.controller.show()}),this.sprite.on("mouseout",b=>{b.stopPropagation(),this.controller.hide()}),["durationchange","timeupdate","pause","play"].forEach(b=>{this.videoResource.source.addEventListener(b,()=>{b!=="timeupdate"||this.isPlaying||this.pause(),this.emit(b)})})}get currentTime(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.currentTime)!==null&&e!==void 0?e:0}set currentTime(n){this.videoResource.source&&(this.videoResource.source.currentTime=n)}get paused(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.paused)===null||e===void 0||e}get ended(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.ended)===null||e===void 0||e}get duration(){var n,e;return(e=(n=this.videoResource.source)===null||n===void 0?void 0:n.duration)!==null&&e!==void 0?e:0}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){var n;return F(this,void 0,void 0,function*(){this.isPlaying=!0,yield this.load(),yield this.ctx.clock.waitUntil(()=>{const r=this.videoResource.source;return!!(r&&r.videoWidth>0)},3e3);const e=this.videoResource.source;e&&e.videoWidth<=0||(yield(n=this.videoResource.source)===null||n===void 0?void 0:n.play())})}load(){return this.videoResource.load()}pause(){var n;this.isPlaying=!1,(n=this.videoResource.source)===null||n===void 0||n.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(n){this.controller.jumpToTime(n)}destroy(){var n;this.sprite.interactive=!1,this.sprite.destroy({texture:!0,baseTexture:!0}),(n=this.videoResource)===null||n===void 0||n.destroy(),this.controller.destroy()}}var dt=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Mt extends J.a{constructor(n){super(),this.type="audio",this.isPlaying=!1,this.id=n.id,this.audio=n.audio,this.container=n.container,this.container=n.container,this.audioEl=document.createElement("audio"),this.audioEl.src=this.audio.src,n.audio.cut&&(this.start=n.audio.cut.start,this.end=n.audio.cut.end),this.ctx=n.ctx,this.ctx.medias[this.id]=this;const{width:e,height:r,sprite:s}=n;this.controller=new E({targetId:n.id,ctx:n.ctx,height:r,width:e,sprite:s,media:this,info:this.audio,canvasElement:n.canvasElement}),["durationchange","timeupdate","pause","play"].forEach(u=>{this.audioEl.addEventListener(u,()=>{this.emit(u)})})}get currentTime(){return this.audioEl.currentTime}set currentTime(n){this.audioEl.currentTime=n}get paused(){return this.audioEl.paused}get ended(){return this.audioEl.ended}get duration(){return this.audioEl.duration}load(){return Promise.resolve()}showController(){this.controller.show()}hideController(){this.controller.hide()}play(){return dt(this,void 0,void 0,function*(){this.isPlaying=!0;try{yield this.audioEl.play()}catch{console.debug("[PPT Player]: refuse to play()")}})}pause(){this.isPlaying=!1,this.audioEl.pause()}togglePause(){this.isPlaying?this.pause():this.play()}seek(n){this.controller.jumpToTime(n)}destroy(){this.audioEl.pause(),this.controller.destroy()}}var Lt=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class qt extends xl{constructor(n,e,r){super(Object.assign(Object.assign({},n),{type:"Shape",useBgFill:!1,textRotateWithShape:!0}),e,r),this.picTextureId="",this.picSprite=new Nr,this.picMask=new Nr,this.cmd=new yo(this),this.picFill=n.picFill,this.media=n==null?void 0:n.media}applyCommand(n,e){var r,s,u,h,f;if(e==="call")if(/playFrom\(([0-9.]+)\)/.test(n)){const y=n.match(/playFrom\(([0-9.]+)\)/),b=Number(y[1]||"0");(r=this.mediaPlayer)===null||r===void 0||r.play().then(()=>{var T;(T=this.mediaPlayer)===null||T===void 0||T.seek(b)})}else n==="custom-pause"?(s=this.mediaPlayer)===null||s===void 0||s.pause():n==="togglePause"?(u=this.mediaPlayer)===null||u===void 0||u.togglePause():n==="stop"&&((h=this.mediaPlayer)===null||h===void 0||h.pause(),(f=this.mediaPlayer)===null||f===void 0||f.seek(0))}renderPic(){var n,e,r;return Lt(this,void 0,void 0,function*(){const s=this.ctx.fillTexture.getTexture(this.picTextureId);s.texture&&(this.picSprite.texture=s.texture),this.picMask.texture=this.backgroundMask.texture,this.picSprite.mask=this.picMask,this.picSprite.width=this.designWidth,this.picSprite.height=this.designHeight,this.container.addChild(this.picSprite),this.container.addChild(this.picMask),((n=this.media)===null||n===void 0?void 0:n.type)==="video"&&this.media.src?(this.mediaPlayer=new q({id:this.json.id+"-video",ctx:this.ctx,video:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view}),((e=this.mediaPlayer)===null||e===void 0?void 0:e.sprite)&&(this.mediaPlayer.sprite.mask=this.picMask)):((r=this.media)===null||r===void 0?void 0:r.type)==="audio"&&this.media.src&&(this.mediaPlayer=new Mt({id:this.json.id+"-audio",ctx:this.ctx,audio:this.media,height:this.designHeight,width:this.designWidth,sprite:this.picSprite,container:this.container,canvasElement:this.ctx.view})),this.mediaPlayer&&(this.picSprite.interactive=!0,this.picSprite.on("mouseover",()=>{this.mediaPlayer.showController()}),this.picSprite.on("mouseout",()=>{this.mediaPlayer.hideController()},!1))})}preRender(){if(super.preRender(),this.picFill.fillType!=="gifFill")this.picTextureId=this.ctx.fillTexture.addFill(this.picFill,this.designWidth,this.designHeight);else{let n=1;const e=this.ctx.fillTexture.getGifFrames(this.picFill.src),r=e.map((u,h)=>({texture:u,time:this.picFill.delays[h]||20}));this.picSprite=new _l(r,!0),this.picSprite.play();const s=this.picFill.loop;this.picSprite.onLoop=()=>{n+=1,s>0&&n>s&&this.picSprite.gotoAndStop(e.length-1)}}}subClassRender(){return Lt(this,void 0,void 0,function*(){yield this.renderPic()})}destroy(){this.mediaPlayer&&(this.picSprite.interactive=!1,this.mediaPlayer.destroy(),this.mediaPlayer=void 0),this.picSprite.destroy(),this.picMask.destroy()}}var Ee=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class me extends Bh{constructor(n,e,r){var s,u,h,f;super(n,e,r),this.children=[],this.cacheSprite=new Nr,this.json=n,this.container.name=n.id,this.ctx.timingTargets.addTarget(n.id,this);const y={x:(u=(s=n.position)===null||s===void 0?void 0:s.x)!==null&&u!==void 0?u:0,y:(f=(h=n.position)===null||h===void 0?void 0:h.y)!==null&&f!==void 0?f:0};n.children.forEach(b=>{let T=null;(b==null?void 0:b.type)==="Shape"?T=new xl(b,this.ctx,y):(b==null?void 0:b.type)==="Picture"?T=new qt(b,this.ctx,y):(b==null?void 0:b.type)==="Container"&&(T=new me(b,this.ctx,y)),T&&this.children.push(T)}),this.updateTransform(this.json)}get interactiveContainer(){return this.container}get renderContainer(){return this.container}preRender(){if(this.json.fillStyle)if(this.json.fillStyle.fillType==="groupFill")this.fillTextureId=this.groupFillTextureId;else{const{fillStyle:n,width:e,height:r}=this.json;this.fillTextureId=this.ctx.fillTexture.addFill(n,e,r)}for(const n of this.children)n.groupFillTextureId=this.fillTextureId,n.preRender()}getBgElement(){return null}getIterateEntry(n,e,r){return e===0?this:(this.ctx.eventHub.emit("IterateTimeNodeEnd",r),null)}getTextElement(){return null}render(){var n;return Ee(this,void 0,void 0,function*(){const e=new Ri;for(const r of this.children)yield r.render(),r.renderContainer&&e.addChild(r.renderContainer),(r.json.hlinkHover||r.json.hlinkClick)&&((n=r.hyperlink)===null||n===void 0||n.addProxy(this.container));this.container.addChild(e),this.json.cacheAsTexture&&(function(r,s,u,h){const f=r.getBounds(),y=Math.min(f.x,s.x,f.x+f.width,s.x+s.width),b=Math.max(f.x,s.x,f.x+f.width,s.x+s.width),T=Math.min(f.y,s.y,f.y+f.height,s.y+s.height),P=b-y,j=Math.max(f.y,s.y,f.y+f.height,s.y+s.height)-T,G=s.x-f.x>0?s.x-f.x:0,V=s.y-f.y>0?s.y-f.y:0,K=Li.create({width:P,height:j,resolution:Math.ceil(h.renderer.resolution)});r.position.x=G,r.position.y=V,h.renderer.render(r,{renderTexture:K}),u.texture=K,u.position.x=-G,u.position.y=-V}(e,new dr(this.designX,this.designY,this.designWidth,this.designHeight),this.cacheSprite,this.ctx),this.container.addChild(this.cacheSprite),e.position.x=0,e.position.y=0,e.visible=!1)})}destroy(){this.cacheSprite&&this.cacheSprite.destroy({texture:!0}),this.children.forEach(n=>n.destroy()),this.container.destroy()}}class De extends J.a{constructor(n,e,r,s){super(),this.cond={},this.timeoutIds=[],this.condHandle=u=>{if(u)if(u.delay&&u.delay>0){const h=this.ctx.clock.setTimeout(()=>{u.event&&(this.cond[u.event]=!0,this.detectTrigger())},u.delay);this.timeoutIds.push(h)}else this.cond[u.event]=!0,this.detectTrigger();else this.detectTrigger()},this.id=n,this.ctx=s,this.eventHubs=r,e.forEach(u=>{this.addCond(u)})}setTriggerParams(n){this.triggerParams=n}addCond(n){const e=()=>this.condHandle(n);n.event&&(/^shape/.test(n.event)||/^time/.test(n.event)?(this.cond[n.event]=!1,this.eventHubs.global.addListener(n.event,e)):/^runtime/.test(n.event)?(this.cond[n.event]=!1,this.eventHubs.runtime.addListener(n.event,e)):/^self/.test(n.event)?n.delay&&n.delay>0&&(this.cond[n.event]=!1,this.eventHubs.runtime.addListener(n.event,e)):this.cond[n.event]=!1)}isTrigger(){return Object.keys(this.cond).every(n=>!!this.cond[n])}isTriggerWithoutParent(){return Object.keys(this.cond).filter(n=>n!=="self").every(n=>!!this.cond[n])}detectTrigger(){if(Object.keys(this.cond).every(n=>!!this.cond[n])){Object.keys(this.cond).forEach(e=>{this.cond[e]=!1});const n=this.triggerParams;this.triggerParams=void 0,this.emit("active",n)}}reset(){Object.keys(this.cond).forEach(n=>{this.cond[n]=!1}),this.timeoutIds.forEach(n=>this.ctx.clock.clearTimeout(n))}}class gn extends J.a{constructor(n){super(),this.runtimeNodeEventHub=new J.a,this._currentSeqIndex=0,this._currentSeqState="idle",this.isForward=!0,this.autoPlay=!1,this.handlePrev=()=>{var P,j,G,V,K,_t;this.hasPrev()||!this.isMainSeq?this.currentSeqState==="idle"?(this.decrSeqIndex(),(P=this.commonTimeNode.children[this.currentSeqIndex])===null||P===void 0||P.commonTimeNode.seekToStart(),(j=this.commonTimeNode.children[this.currentSeqIndex])===null||j===void 0||j.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.currentSeqState==="running"?((G=this.commonTimeNode.children[this.currentSeqIndex])===null||G===void 0||G.commonTimeNode.seekToStart(),(V=this.commonTimeNode.children[this.currentSeqIndex])===null||V===void 0||V.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.currentSeqState==="end"&&(this.currentSeqIndex>=this.commonTimeNode.children.length&&(this.currentSeqIndex=this.commonTimeNode.children.length-1),(K=this.commonTimeNode.children[this.currentSeqIndex])===null||K===void 0||K.commonTimeNode.seekToStart(),(_t=this.commonTimeNode.children[this.currentSeqIndex])===null||_t===void 0||_t.commonTimeNode.clearSubList(),this.currentSeqState="idle"):this.globalEventHub.emit("c:prev slide")},this.handleNext=()=>{var P,j,G,V;this.hasNext()||!this.isMainSeq?this.currentSeqState==="idle"?(P=this.commonTimeNode.children[this.currentSeqIndex])===null||P===void 0||P.commonTimeNode.startTimeNodeForce():this.currentSeqState==="running"?((j=this.commonTimeNode.children[this.currentSeqIndex])===null||j===void 0||j.commonTimeNode.seekToEnd(!1,!0),this.currentSeqState="end",this.incrSeqIndex(),(G=this.commonTimeNode.children[this.currentSeqIndex])===null||G===void 0||G.commonTimeNode.startTimeNodeForce()):this.currentSeqState==="end"&&(this.incrSeqIndex(),(V=this.commonTimeNode.children[this.currentSeqIndex])===null||V===void 0||V.commonTimeNode.startTimeNodeForce()):this.globalEventHub.emit("c:next slide")};const{json:e,iterateType:r,isIterate:s,isSub:u,parent:h,ctx:f,eventHub:y,iterateIndex:b,iterateId:T}=n;this.isMainSeq=e.ctn.nodeType==="mainSeq",this.isInteractiveSeq=e.ctn.nodeType==="interactiveSeq",this.id=e.ctn.id,this.isIterate=s,this.json=e,this.ctx=f,this.globalEventHub=y,this.commonTimeNode=new Po({json:e.ctn,isSub:u,eventHubs:{global:y,runtime:this.runtimeNodeEventHub},ctx:f,parent:h,isIterate:!1,iterateType:r,iterateIndex:b,iterateId:T}),this.bindShapeEvent(),this.nextConds=new De("mainSeq",e.nextCondLst,{global:y,runtime:this.runtimeNodeEventHub},this.ctx),this.prevConds=new De("mainSeq",e.preCondLst,{global:y,runtime:this.runtimeNodeEventHub},this.ctx),this.commonTimeNode.on("timeNodeRestart",()=>{this.currentSeqIndex=0,this.currentSeqState="idle"}),this.commonTimeNode.on("childTimeNodeStart",P=>{const j=this.commonTimeNode.children.findIndex(G=>G.commonTimeNode.uuid===P.id);j>=0&&(this.currentSeqIndex=j),this.currentSeqState="running",this.isMainSeq&&this.ctx.eventHub.emit(Pn.mainSeqStepStart,j)}),this.commonTimeNode.on("childTimeNodeEnd",P=>{const j=this.commonTimeNode.children.findIndex(G=>G.commonTimeNode.uuid===P.id);j>=0&&(this.currentSeqIndex=j),this.currentSeqState="end",this.autoPlay&&this.ctx.clock.setTimeout(()=>{this.handleNext()}),this.isMainSeq&&this.ctx.eventHub.emit(Pn.mainSeqStepEnd,j)}),this.commonTimeNode.on("timeNodeEndSync",()=>{this.commonTimeNode.resetForRepeat(),this.ctx.clock.setTimeout(()=>{this.currentSeqState="idle",this.currentSeqIndex=0})}),this.nextConds.on("active",()=>{if(this.isInteractiveSeq){const{mode:P}=this.ctx;P!=="interactive"&&P!=="sync"||this.ctx.eventHub.emit(Pn.interactiveSeqNext,this.json.ctn.id),P!=="sync"&&P!=="local"||this.handleNext()}else this.handleNext()}),this.prevConds.on("active",this.handlePrev)}get currentSeqIndex(){return this._currentSeqIndex}set currentSeqIndex(n){this._currentSeqIndex=n,this.isMainSeq?this.ctx.eventHub.emit(Pn.mainSeqStepChange,n):this.isInteractiveSeq&&this.ctx.eventHub.emit(Pn.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:n,state:this._currentSeqState}})}get currentSeqState(){return this._currentSeqState}set currentSeqState(n){this._currentSeqState=n,this.isMainSeq?this.ctx.eventHub.emit(Pn.mainSeqStateChange,n):this.isInteractiveSeq&&this.ctx.eventHub.emit(Pn.interactiveSeqStateChange,{id:this.json.ctn.id,state:{step:this._currentSeqIndex,state:n}})}get stepLength(){return this.commonTimeNode.children.length}get currentStep(){return this.currentSeqIndex}get currentState(){return this.currentSeqState}startAutoPlay(){this.autoPlay=!0,this.commonTimeNode.children[0].commonTimeNode.startTimeNodeForce()}incrSeqIndex(){this.currentSeqIndex+1<=this.commonTimeNode.children.length&&(this.currentSeqIndex+=1)}decrSeqIndex(){this.currentSeqIndex-1>=-1&&(this.currentSeqIndex-=1)}hasPrev(){return!(this.currentSeqIndex<=0&&this.currentSeqState==="idle")}hasNext(){return!(this.currentSeqIndex>=this.commonTimeNode.children.length||this.currentSeqIndex===this.commonTimeNode.children.length-1&&this.currentSeqState==="end")}bindShapeEvent(){this.json.ctn.nodeType==="interactiveSeq"&&this.json.nextCondLst.forEach(n=>{if(/^shape/.test(n.event)){const e=n.event.split(" ")[1];if(e){const r=this.ctx.timingTargets.getTargetById(e);r&&(r.interactiveContainer.interactive=!0,r.interactiveContainer.cursor="pointer",r.interactiveContainer.on("pointerdown",()=>{const s=`shape ${e} onClick`;this.globalEventHub.emit(s)}))}}})}setCurrentStep(n,e){let r=n;this.commonTimeNode.seekToStart();const{length:s}=this.commonTimeNode.children;if(r===-1&&(r=s-1),r>=0&&r<s)for(let u=0;u<=r;u++){const h=this.commonTimeNode.children[u];u!==r?h.commonTimeNode.seekToEnd(!1,!0):e==="start"?h.commonTimeNode.seekToStart():e==="end"&&h.commonTimeNode.seekToEnd(!1,!0)}this.currentSeqIndex=r,this.currentSeqState=e==="start"?"idle":"end"}}function ln(o,n,e){const r=n.split(".");r.reduce((s,u,h)=>{if(s)return h!==r.length-1?s[u]:void(s[u]=e);console.warn(`${o} not support ${n}`)},o)}function An(o,n){return n?n.split(".").reduce((e,r)=>{if(e)return e[r];console.warn(`${o} not support ${n}`)},o):null}class ve{constructor(n){this.timingTarget=null,this.runtimeNodeEventHub=new J.a,this.onTimeLineStart=()=>{if(this.isConflict){const{target:P}=this.json.cBhvr;if(this.activeWhenConflict==="next"){let j=P.id;P.type==="shape"&&P.txEl&&(j=`${j}-txEl-${P.txEl.range[0]}`),this.commonTimeNode.isIterate&&(j=`${j}-iterate-${this.commonTimeNode.iterateIndex}`),this.ctx.conflictTimeNodeManager.addRunningTimeNode(j,this.modifyAttrKey,this.commonTimeNode)}else this.activeWhenConflict==="prev"&&this.commonTimeNode.dispose()}};const{isIterate:e,isSub:r,json:s,ctx:u,parent:h,eventHub:f,iterateType:y,iterateIndex:b,iterateId:T}=n;this.json=s,this.id=s.cBhvr.ctn.id,this.ctx=u,this.globalEventHub=f,this.commonTimeNode=new Po({json:s.cBhvr.ctn,isSub:r,eventHubs:{global:f,runtime:this.runtimeNodeEventHub},ctx:u,parent:h,isIterate:e,iterateType:y,iterateIndex:b,iterateId:T}),this.timingTarget=this.ctx.timingTargets.getTarget(s.cBhvr.target,e,{type:y,index:b,id:T}),this.commonTimeNode.on("seekToStart",()=>this.onSeekToStart()),this.commonTimeNode.on("seekToEnd",()=>this.onSeekToEnd()),this.commonTimeNode.on("timelineStart",this.onTimeLineStart)}}class Xe extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.updateStartValue=()=>{this.timingTarget&&(this.startVal=An(this.timingTarget,this.json.cBhvr.attrList[0]))},this.onSeekToStart=()=>{const e=this.json.cBhvr.attrList[0];this.startVal!==null&&this.timingTarget&&ln(this.timingTarget,e,this.startVal)},this.onSeekToEnd=()=>{const e=this.json.cBhvr.attrList[0],r=this.json.cBhvr.to||this.json.to;r&&this.timingTarget&&ln(this.timingTarget,e,r)},this.commonTimeNode.on("timeNodeStart",this.updateStartValue),this.commonTimeNode.on("timeNodeCreate",this.updateStartValue),this.commonTimeNode.on("timeUpdate",({duration:e,delta:r})=>{if(r/e>=1){const s=this.json.cBhvr.attrList[0];this.json.cBhvr.attrList.length>1&&console.warn("this.json.cBhvr.attrList.length > 0");const u=this.json.cBhvr.to||this.json.to;u&&this.timingTarget&&ln(this.timingTarget,s,u)}})}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}}class Un{constructor(n,e){this.math={pi:Math.PI,e:Math.E,abs:Math.abs,acos:Math.acos,asin:Math.asin,atan:Math.atan,ceil:Math.ceil,cos:Math.cos,cosh:Math.cosh,deg:r=>r/Math.PI*180,exp:Math.exp,floor:Math.floor,ln:Math.log,max:Math.max,min:Math.min,rad:r=>r/180*Math.PI,rand:Math.random,sin:Math.sin,sinh:Math.sinh,sqrt:Math.sqrt,tan:Math.tan,tanh:Math.tanh},this.timingTarget=e,this.val=n.val.value,this.time=n.time,n.fmla&&(this.fmla=this.parseFmla(n.fmla))}parseFmla(n){let e=n.replaceAll("#ppt_h",`(${this.timingTarget.design_ppt_h})`);return e=e.replaceAll("#ppt_w",`(${this.timingTarget.design_ppt_w})`),e=e.replaceAll("#ppt_x",`(${this.timingTarget.design_ppt_x})`),e=e.replaceAll("#ppt_y",`(${this.timingTarget.design_ppt_y})`),e=e.replaceAll("ppt_w","vars.ppt_w"),e=e.replaceAll("ppt_h","vars.ppt_h"),e=e.replaceAll("ppt_x","vars.ppt_x"),e=e.replaceAll("ppt_y","vars.ppt_y"),e=e.replaceAll("#","vars."),["abs","acos","asin","atan","ceil","cos","cosh","deg","exp","floor","ln","max","min","rad","rand","sin","sinh","sqrt","tan","tanh","pi","e"].forEach(r=>{const s=new RegExp(`([^a-z])${r}([^a-z])`,"g");e=e.replace(s,(u,h,f)=>`${h}math.${r}${f}`)}),new Function("vars","math","$","return "+e)}}class mn extends Un{constructor(n,e,r){super(n,e),this.value=n.val.value,r&&(this.fmla=this.parseFmla(r))}resolveValue(){return this.value}interpolationFrom(n,e,r){const s=n.resolveValue(r),u=s+(this.resolveValue()-s)*e;return n.fmla?n.fmla(r,this.math,u):u}}class Yn extends Un{constructor(n,e){var r;super(n,e),this.value=(r=n.val)===null||r===void 0?void 0:r.value}interpolationFrom(n,e,r){let s=n.resolveValue(r);return e>this.time&&(s=this.resolveValue()),s}resolveValue(){return this.value||""}}class wn extends Un{constructor(n,e){super(n,e),this.fn=this.parseFmla(this.val)}resolveValue(n){return this.fn(n,this.math,1)}interpolationFrom(n,e,r){const s=n.resolveValue(r),u=s+(this.resolveValue(r)-s)*e;return n.fmla?n.fmla(r,this.math,u):u}}class lr extends Un{constructor(n,e){super(n,e),this.value=n.val.value}interpolationFrom(n,e){return Ou(n.resolveValue(),this.value,e)}resolveValue(){return this.value}}class In extends ve{constructor(n){super(n),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.vars={ppt_x:0,ppt_y:0,ppt_w:0,ppt_h:0},this.keyFrames=[],this.isColorAnim=!1,this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal=An(this.timingTarget,this.json.cBhvr.attrList[0]))},this.updateVars=()=>{var e,r,s,u;((e=this.timingTarget)===null||e===void 0?void 0:e.ppt_h)&&(this.vars.ppt_h=this.timingTarget.ppt_h),((r=this.timingTarget)===null||r===void 0?void 0:r.ppt_w)&&(this.vars.ppt_w=this.timingTarget.ppt_w),((s=this.timingTarget)===null||s===void 0?void 0:s.ppt_x)&&(this.vars.ppt_x=this.timingTarget.ppt_x),((u=this.timingTarget)===null||u===void 0?void 0:u.ppt_y)&&(this.vars.ppt_y=this.timingTarget.ppt_y),this.isColorAnim},this.onTimeUpdate=({duration:e,delta:r})=>{const s=r/e,u=this.keyFrames.findIndex(j=>s<=j[0]),{attrList:h}=this.json.cBhvr;if(u<0){const j=this.keyFrames[this.keyFrames.length-1];return void(this.timingTarget&&h&&h[0]&&ln(this.timingTarget,h[0],j[1].resolveValue(this.vars)))}const f=u-1,y=this.keyFrames[u],b=this.keyFrames[f]||y,T=y[0]-b[0]==0?1:(s-b[0])/(y[0]-b[0]),P=y[1].interpolationFrom(b[1],T,this.vars);this.timingTarget&&h&&h[0]&&ln(this.timingTarget,h[0],P)},this.onSeekToStart=()=>{this.startVal!==null&&this.timingTarget&&ln(this.timingTarget,this.json.cBhvr.attrList[0],this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.initKeyFrames(),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timelineStart",this.updateVars),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}initKeyFrames(){var n;const{valueType:e}=this.json;if(this.json.tavLst.length<=0){if(this.json.to){if(this.json.from||this.startVal){const s={time:0,val:{type:"string",value:this.json.from||this.startVal.toString()},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(s,this.timingTarget);this.keyFrames.push([s.time,u])}}const r={time:1,val:{type:"string",value:this.json.to},fmla:""};if(e==="num"&&this.timingTarget){const s=new wn(r,this.timingTarget);this.keyFrames.push([r.time,s])}}else if(this.json.by){const r={time:0,val:{type:"string",value:this.json.cBhvr.attrList[0]},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(r,this.timingTarget);this.keyFrames.push([r.time,u])}const s={time:1,val:{type:"string",value:(((n=r.val)===null||n===void 0?void 0:n.value)||"")+"+"+this.json.by},fmla:""};if(e==="num"&&this.timingTarget){const u=new wn(s,this.timingTarget);this.keyFrames.push([s.time,u])}}}if(this.json.tavLst.length>0){for(const r of this.json.tavLst)if(r.val&&this.timingTarget){let s=null;r.val.type==="string"?e==="num"?s=new wn(r,this.timingTarget):e==="str"&&(s=new Yn(r,this.timingTarget)):r.val.type==="number"?s=new mn(r,this.timingTarget):r.val.type==="color"?(this.isColorAnim=!0,s=new lr(r,this.timingTarget)):r.val.type==="boolean"&&console.warn("not implements"),s&&this.keyFrames.push([r.time,s])}}}}var jn=S(21),Ei=S.n(jn),xo=S(22),Ls=S.n(xo);class ki extends Uo{constructor(){super(Ls.a,Ei.a,{percent:0,direction:1,transition:0})}set transition(n){this.uniforms.transition=n}set percent(n){this.uniforms.percent=n}set direction(n){this.uniforms.direction=n}}var Zs=S(23),Za=S.n(Zs);class Ja extends Uo{constructor(){super(void 0,Za.a,{percent:0,transition:1})}set transition(n){this.uniforms.transition=Math.pow(n,n)}set percent(n){this.uniforms.percent=n}}class bl extends ve{constructor(n){var e;super(n),this.filterType="",this.isConflict=!0,this.activeWhenConflict="prev",this.onTimeUpdate=({duration:u,delta:h})=>{const f=h/u;this.filter&&(this.filter.percent=f),f>=1&&this.timingTarget&&this.ctx.clock.setTimeout(()=>{this.timingTarget&&(this.timingTarget.container.filters=[])})},this.onSeekToStart=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.onSeekToEnd=()=>{this.timingTarget&&(this.timingTarget.container.filters=[])},this.commonTimeNode.on("timelineStart",()=>{this.filter&&this.timingTarget&&(this.timingTarget.container.filters=[this.filter])}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate);let r=0;n.json.transition==="out"?r=-1:n.json.transition==="in"&&(r=1);const s=(e=n.json.filter)===null||e===void 0?void 0:e.match(/^([a-zA-Z]+)(\((.+)\))?/);if(s){const u=s[1],h=s[3];if(u==="wipe"){const f=new ki;h==="up"?f.direction=1:h==="down"?f.direction=2:h==="left"?f.direction=3:h==="right"&&(f.direction=4),this.filter=f,this.filterType=`${u}-${h}`}else if(u==="fade"){const f=new Ja;this.filter=f,this.filterType=""+u}this.filter&&(this.filter.transition=r)}}get modifyAttrKey(){return this.filterType}}var va=S(5);class _a extends ve{constructor(n){super(n),this.isConflict=!0,this.activeWhenConflict="next",this.onTimeUpdate=({duration:e,delta:r})=>{var s;const u=r/e,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+ +this.timingTarget.design_ppt_y)},this.onSeekToStart=()=>{var e,r,s;const u=(r=(e=this.commonTimeNode.json)===null||e===void 0?void 0:e.spd)!==null&&r!==void 0?r:1,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u>0?0:1);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+this.timingTarget.design_ppt_y)},this.onSeekToEnd=()=>{var e,r,s;const u=(r=(e=this.commonTimeNode.json)===null||e===void 0?void 0:e.spd)!==null&&r!==void 0?r:1,h=(s=this.path)===null||s===void 0?void 0:s.getPoint(u>0?1:0);this.timingTarget&&h&&(this.timingTarget.ppt_x=h.x+this.timingTarget.design_ppt_x,this.timingTarget.ppt_y=h.y+this.timingTarget.design_ppt_y)},this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.createPath()}get modifyAttrKey(){return"motion"}createPath(){var n;const e=new va.Path,r=(n=this.json.path)===null||n===void 0?void 0:n.match(/[MLCmlc][^MLCmlc]+/g);if(r)for(const s of r){const[u,...h]=s.trim().replace(/\s+/g," ").split(" ");if(u==="M"){const[f,y]=h.map(b=>Number(b));e.moveTo(f,y)}else if(u==="L"){const[f,y]=h.map(b=>Number(b));e.lineTo(f,y)}else if(u==="C"){const[f,y,b,T,P,j]=h.map(G=>Number(G));e.bezierCurveTo(f,y,b,T,P,j)}else if(u==="Z")e.closePath();else if(u==="E")console.warn("not implements");else if(u==="c"){const[f,y,b,T,P,j]=h.map(V=>Number(V)),G=e.currentPoint;e.bezierCurveTo(f+G.x,y+G.y,b+G.x,T+G.y,P+G.x,j+G.y)}else if(u==="l"){const f=e.currentPoint,[y,b]=h.map(T=>Number(T));e.lineTo(y+f.x,b+f.y)}else if(u==="m"){const f=e.currentPoint,[y,b]=h.map(T=>Number(T));e.moveTo(y+f.x,b+f.y)}}this.path=e}}class Bu extends ve{constructor(n){super(n),this.isConflict=!0,this.activeWhenConflict="next",this.startVal=null,this.onTimelineStart=e=>{e.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:e,delta:r})=>{var s,u,h,f,y;const b=r/e,T={x:1,y:1};if(this.to){const P=(s=this.from)!==null&&s!==void 0?s:{x:(h=(u=this.startVal)===null||u===void 0?void 0:u.x)!==null&&h!==void 0?h:1,y:(y=(f=this.startVal)===null||f===void 0?void 0:f.y)!==null&&y!==void 0?y:1};T.x=P.x+(this.to.x-P.x)*b,T.y=P.y+(this.to.y-P.y)*b}else if(this.by){const P={x:this.by.x,y:this.by.y};T.x=1+(P.x-1)*b,T.y=1+(P.y-1)*b}this.timingTarget&&(this.timingTarget.scale=T)},this.onTimeNodeStart=()=>{this.timingTarget&&(this.startVal={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})},this.onSeekToStart=()=>{this.timingTarget&&this.startVal&&(this.timingTarget.scale=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=n.json.from,this.to=n.json.to,this.by=n.json.by,this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart)}get modifyAttrKey(){return"scale"}updateCurrentValue(){this.timingTarget&&(this.current={x:this.timingTarget.scale.x,y:this.timingTarget.scale.y})}}class Qd extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startColorString=null,this.currentColorString="#FFFFFFFF",this.onTimelineStart=e=>{this.from.isInit()||this.from.fromHexString(this.currentColorString),this.to.isInit()||this.from.by(this.by,this.to),e.isReverse||this.updateCurrentValue();const[r]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,r+".on","true")},this.onTimeNodeEnd=()=>{if(this.json.cBhvr.ctn.fill==="remove"){const[e]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,e+".on","false")}},this.onSeekToStart=()=>{if(this.timingTarget){const[e]=this.json.cBhvr.attrList[0].split(".");ln(this.timingTarget,e+".on","false")}},this.onTimeNodeStart=()=>{if(this.timingTarget){const e=An(this.timingTarget,this.json.cBhvr.attrList[0]);e&&(this.startColorString=e)}},this.onTimeUpdate=({delta:e,duration:r})=>{const s=e/r;this.to.interpolationFrom(this.from,s,this.target),this.timingTarget&&ln(this.timingTarget,this.json.cBhvr.attrList[0],this.target.toHexString())},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1})},this.json.clrSpc==="rgb"?(this.from=new yl(this.json.from),this.to=new yl(this.json.to),this.by=new yl(this.json.by),this.target=new yl):(this.from=new Ps(this.json.from),this.to=new Ps(this.json.to),this.by=new Ps(this.json.by),this.target=new Ps),this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeNodeEnd",this.onTimeNodeEnd),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return this.json.cBhvr.attrList[0]}updateCurrentValue(){if(this.timingTarget){const n=An(this.timingTarget,this.json.cBhvr.attrList[0]);n&&(this.currentColorString=n)}}}class ru extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.startVal=null,this.lastVal=null,this.onTimelineStart=e=>{this.lastVal=null,e.isReverse||this.updateCurrentValue()},this.onTimeUpdate=({duration:e,delta:r})=>{const s=r/e;let u=0,h=0;if(this.from!==void 0&&this.to!==void 0){u=this.from,h=this.to;const f=u+(h-u)*s;this.timingTarget&&(this.timingTarget.r=f)}else if(this.by!==void 0){this.lastVal||(this.lastVal=0);const f=this.by*s-this.lastVal;this.lastVal=this.by*s,this.timingTarget&&(this.timingTarget.r+=f)}},this.onTimeNodeStart=()=>{var e;Object(X.isNumber)((e=this.timingTarget)===null||e===void 0?void 0:e.r)&&(this.startVal=this.timingTarget.r)},this.onSeekToStart=()=>{this.timingTarget&&this.startVal!==null&&(this.timingTarget.r=this.startVal)},this.onSeekToEnd=()=>{this.onTimeUpdate({duration:1,delta:1,isReverse:!1})},this.from=this.json.from,this.to=this.json.to,this.by=this.json.by,this.by?this.isConflict=!1:this.isConflict=!0,this.commonTimeNode.on("timeNodeStart",this.onTimeNodeStart),this.commonTimeNode.on("timeNodeCreate",this.onTimeNodeStart),this.commonTimeNode.on("timelineStart",this.onTimelineStart),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){return"rotate"}updateCurrentValue(){var n;this.currentVal=(n=this.timingTarget)===null||n===void 0?void 0:n.r}}class zh extends ve{constructor(n){super(n),this.isConflict=!1,this.activeWhenConflict="next",this.isApplied=!1,this.onTimeUpdate=()=>{var e,r;const{cmd:s,cmdType:u}=this.json;!this.isApplied&&s&&u&&(this.isApplied=!0,(r=(e=this.timingTarget)===null||e===void 0?void 0:e.cmd)===null||r===void 0||r.applyCommand(s,u))},this.onSeekToStart=()=>{var e,r;(r=(e=this.timingTarget)===null||e===void 0?void 0:e.cmd)===null||r===void 0||r.applyCommand("custom-pause","call")},this.onSeekToEnd=()=>{},this.commonTimeNode.on("timeNodeStart",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeNodeEnd",()=>{this.isApplied=!1}),this.commonTimeNode.on("timeUpdate",this.onTimeUpdate)}get modifyAttrKey(){var n,e,r,s;return((e=(n=this.json)===null||n===void 0?void 0:n.cmd)!==null&&e!==void 0?e:"")+((s=(r=this.json)===null||r===void 0?void 0:r.cmdType)!==null&&s!==void 0?s:"")}}var iu=S(24);class $a{constructor(n){$a.useRtc||(this.howl=new iu.Howl({src:[n]}))}play(){var n;(n=this.howl)===null||n===void 0||n.play()}pause(){var n;(n=this.howl)===null||n===void 0||n.pause()}stop(){var n;(n=this.howl)===null||n===void 0||n.stop()}destroy(){var n;(n=this.howl)===null||n===void 0||n.unload()}}$a.useRtc=!1;class Kp{constructor(n){this.runtimeNodeEventHub=new J.a,this.stopAudio=()=>{this.audio.stop()},this.destroy=()=>{this.stopAudio(),this.audio.destroy()};const{json:e,isIterate:r,isSub:s,eventHub:u,ctx:h,parent:f,iterateType:y,iterateIndex:b,iterateId:T}=n;this.json=e,this.id=e.cMediaNode.ctn.id,this.commonTimeNode=new Po({json:e.cMediaNode.ctn,isSub:s,eventHubs:{global:u,runtime:this.runtimeNodeEventHub},ctx:h,parent:f,isIterate:r,iterateType:y,iterateIndex:b,iterateId:T}),this.audio=new $a(e.cMediaNode.tgtEl),this.commonTimeNode.on("timelineStart",()=>{this.audio.play()}),this.commonTimeNode.on("seekToStart",this.stopAudio),this.commonTimeNode.on("seekToEnd",this.stopAudio),this.commonTimeNode.on("timeNodeDestroy",this.destroy)}}var jh=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Po extends J.a{constructor(n){super(),this.uuid=Date.now().toString(32)+Math.random().toString(32).substring(2),this.isSub=!1,this.isShadow=!1,this.startCount=0,this.applyCount=0,this.isReverse=!1,this.isConflictDispose=!1,this.isIterateEnd=!1,this.parentTimeNode=null,this.isActive=!1,this.isDestroy=!1,this.shouldSeekOnStart=!1,this.repeatTimeoutId="",this.iterateShadows=[],this.isEndEventsEmitted=!1,this.isIterate=!1,this.iterateType="el",this.iterateIndex=0,this.children=[],this.subList=[],this.duration=0,this.timeDelta=0,this.isNegativeSpeed=!1,this.handleEndCond=()=>{this.isActive&&(this.isActive=!1,this.dispose())},this.handleActive=(G=!0)=>{if(this.isActive=!0,this.applyCount+=1,this.json.iterate||this.emit("timeNodeStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startCount>0&&this.json.restart){if(this.json.restart==="never")return;this.json.restart!=="whenNotActive"&&this.json.restart!=="always"||(this.seekToStart(),this.emit("timeNodeRestart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.startTimeLine(G))}else this.startTimeLine(G)},this.updateTimeLine=G=>{const V=G/(Bt.TARGET_FPMS||.06);this.timeDelta+=V,this.duration-this.timeDelta<=V&&(this.timeDelta=this.duration),this.timeDelta<this.duration?this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?this.duration-this.timeDelta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}):(this.emit("timeUpdate",{delta:this.isReverse||this.isNegativeSpeed?0:this.duration,duration:this.duration,isReverse:this.isReverse}),this.onTimeLineEnd())},this.handleEnd=(G=!1)=>{(this.isTimeNodeEnd()||G)&&(this.isActive=!1,this.isSub&&this.destroy(),this.emitEndEvents())};const{isSub:e,isIterate:r,ctx:s,eventHubs:u,parent:h,json:f,iterateType:y,iterateId:b,iterateIndex:T}=n;this.isSub=e,this.isIterate=r,this.parentTimeNode=h,this.json=f,this.ctx=s,this.iterateIndex=T,this.eventHubs=u,this.iterateType=y,this.iterateId=b;const P=Number(this.json.dur),j=this.json.spd||1;this.isNegativeSpeed=j<0,Number.isNaN(P)||(this.duration=P/Math.abs(j)),this.uuid+="--"+this.json.id,this.setPreStyle(),f.childTnLst&&this.createChildren(f.childTnLst),this.startConds=new De(this.json.id||"",f.stCondLst,u,this.ctx),this.endConds=new De(this.json.id||"",f.endCondLst,u,this.ctx),f.endSync&&(this.endSync=new De(this.json.id||"",[f.endSync],u,this.ctx),this.endSync.on("active",()=>{var G;this.json.nodeType==="interactiveSeq"&&(this.isActive=!1,this.shouldSeekOnStart=!0,this.emit("timeNodeEndSync"),(G=this.endSync)===null||G===void 0||G.reset())})),this.startConds.on("active",G=>{this.isActive||(this.shouldSeekOnStart&&(this.shouldSeekOnStart=!1,this.seekToStart()),this.handleActive(G))}),this.endConds.on("active",()=>{this.handleEndCond(),this.children.forEach(G=>G.commonTimeNode.handleEndCond())}),this.parentTimeNode&&this.parentTimeNode.on("timeNodeStart",()=>{this.applyCount=0}),this.isSub&&this.json.masterRel==="nextClick"&&this.startConds.addCond({event:"shape slide onNext"}),this.json.iterate&&this.isIterate===!1&&this.createIterateShadow()}createIterateShadow(){const n=Is();let e=!0,r=0;const s=u=>{u===n&&(e=!1,this.ctx.eventHub.removeListener("IterateTimeNodeEnd",s))};for(this.ctx.eventHub.on("IterateTimeNodeEnd",s);e;){const u=JSON.parse(JSON.stringify(this.json)),h=new Po({json:u,isSub:!1,eventHubs:this.eventHubs,ctx:this.ctx,parent:null,isIterate:!0,iterateType:u.iterate.type,iterateIndex:r,iterateId:n});this.iterateShadows[r]=h,r+=1}}isInfiniteRepeat(){return this.json.repeatCount>999999998}getReverse(){return this.isReverse}setReverse(n){this.isReverse=n}createTimeNode(n,e){let r=null;const s={json:n,isSub:e,isIterate:this.isIterate,eventHub:this.eventHubs.global,ctx:this.ctx,parent:this,iterateType:this.iterateType,iterateIndex:this.iterateIndex,iterateId:this.iterateId};return n.type==="seq"?r=new gn(s):n.type==="par"?r=new Kc(s):n.type==="set"?r=new Xe(s):n.type==="anim"?r=new In(s):n.type==="animEffect"?r=new bl(s):n.type==="animMotion"?r=new _a(s):n.type==="animScale"?r=new Bu(s):n.type==="animClr"?r=new Qd(s):n.type==="animRot"?r=new ru(s):n.type==="cmd"?r=new zh(s):n.type==="audio"&&(r=new Kp(s)),r}createSubList(n){this.subList=[],n.forEach(e=>{const r=this.createTimeNode(e,!0);r&&this.subList.push(r)})}bindCommonTimeNodeEvent(n){n.commonTimeNode.on("timeNodeStart",e=>{this.emit("childTimeNodeStart",e)}),n.commonTimeNode.on("timeNodeEnd",e=>{this.emit("childTimeNodeEnd",e),this.children.every(r=>r.commonTimeNode.isTimeNodeEnd())&&(this.json.iterate||this.allChildrenEndHandle())})}createChildren(n){function e(r){return function(s){var u;return(u=s==null?void 0:s.cBhvr)===null||u===void 0?void 0:u.ctn}(r)?r.cBhvr.ctn.presetOrder:function(s){return s==null?void 0:s.ctn}(r)?r.ctn.presetOrder:function(s){return s==null?void 0:s.cMediaNode}(r)?r.cMediaNode.ctn.presetOrder:void 0}e(n[0])?[...n].sort((r,s)=>{var u,h;return((u=e(r))!==null&&u!==void 0?u:0)-((h=e(s))!==null&&h!==void 0?h:0)}).forEach(r=>{const s=n.findIndex(h=>e(h)===e(r)),u=this.createTimeNode(r,!1);u&&(this.bindCommonTimeNodeEvent(u),this.children[s]=u)}):n.forEach(r=>{const s=this.createTimeNode(r,!1);s&&(this.bindCommonTimeNodeEvent(s),this.children.push(s))})}playReverse(){this.isReverse=!0,this.startReverseTimeLine(),this.children.forEach(n=>n.commonTimeNode.playReverse())}allChildrenEndHandle(){if(!this.isDestroy){if(this.json.autoRev&&!this.isReverse)return this.isReverse=!0,void this.playReverse();this.isReverse&&(this.isReverse=!1),this.json.repeatCount&&this.json.repeatCount>this.applyCount?this.repeatTimeoutId=this.ctx.clock.setTimeout(()=>{this.seekToStart(!1),this.resetForRepeat(),this.startTimeNodeRepeat()}):(this.json.iterate&&!this.isIterate&&(this.isIterateEnd=!0),this.eventHubs.runtime.emit("runtime all end"),this.startSubList(),this.handleEnd())}}resetForRepeat(){this.timeDelta=0,this.children.forEach(n=>n.commonTimeNode.resetForRepeat())}startSubList(){this.subList.forEach(n=>n.commonTimeNode.startTimeNode())}startReverseTimeLine(){this.timeDelta=0;const n=1e3/this.ctx.ticker.maxFPS;this.duration<=n&&this.duration>0?(this.emit("timeUpdate",{delta:this.duration,duration:this.duration,isReverse:this.isReverse}),this.ctx.eventHub.emit(Pn.animateEnd),this.ctx.ticker.remove(this.updateTimeLine)):this.duration>n&&(this.ctx.eventHub.emit(Pn.animateStart),this.ctx.ticker.add(this.updateTimeLine))}startTimeLine(n=!0){if(n&&(this.isEndEventsEmitted=!1,this.eventHubs.global.emit(`time ${this.json.id} begin`),this.eventHubs.global.emit(`time ${this.json.id} onBegin`),this.eventHubs.runtime.emit(`runtime ${this.json.id} begin`)),this.json.iterate)return void this.startIterate();this.timeDelta=0,this.emit("timelineStart",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse});const e=1e3/this.ctx.ticker.maxFPS;this.duration<=e&&this.duration>0?(this.timeDelta=this.isReverse?0:this.duration,this.emit("timeUpdate",{delta:this.timeDelta,duration:this.duration,isReverse:this.isReverse}),this.emit("timelineEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}),this.ctx.ticker.addOnce(()=>{this.onTimeLineEnd()})):this.duration>e&&(this.ctx.eventHub.emit(Pn.animateStart),this.updateTimeLine(0),this.ctx.ticker.add(this.updateTimeLine))}startIterate(){return jh(this,void 0,void 0,function*(){if(this.json.iterate){this.isIterateEnd=!1;for(const n of this.iterateShadows){if(this.isIterateEnd)break;n.children.forEach(e=>{e.commonTimeNode.startTimeNode()}),n.applyCount+=1,yield this.ctx.clock.delay(this.json.iterate.interval)}this.onTimeLineEnd()}})}isNatureTimeEnd(){return this.duration>=0&&this.timeDelta>=this.duration}setPreStyle(){if(!this.json.presetClass)return;const n=[],e=r=>{r.forEach(s=>{var u,h,f;s.cBhvr&&s.cBhvr.target&&n.findIndex(y=>y.id===s.cBhvr.target.id)<0&&n.push(s.cBhvr.target),((h=(u=s==null?void 0:s.cBhvr)===null||u===void 0?void 0:u.ctn)===null||h===void 0?void 0:h.childTnLst)&&s.cBhvr.ctn.childTnLst.length>0&&e(s.cBhvr.ctn.childTnLst),((f=s==null?void 0:s.ctn)===null||f===void 0?void 0:f.childTnLst)&&s.ctn.childTnLst.length>0&&e(s.ctn.childTnLst)})};e(this.json.childTnLst||[]),n.forEach(r=>{if(this.json.iterate){let s=0,u=!0;for(;u;){const h=this.ctx.timingTargets.getTarget(r,!0,{type:this.json.iterate.type,index:s,id:""});h&&(this.setPreStyleForTarget(h),s+=1),u=!!h}}else{const s=this.ctx.timingTargets.getTarget(r,!1);s&&this.setPreStyleForTarget(s)}})}setPreStyleForTarget(n){var e,r;if(n&&this.json.presetSubtype&&(n.presetSubType=this.json.presetSubtype),n&&!n.hasPreset)if(this.json.presetClass==="entr"){const s=(r=(e=this.json)===null||e===void 0?void 0:e.childTnLst)===null||r===void 0?void 0:r.filter(u=>u.type==="set"&&u.to==="visible");(s==null?void 0:s.length)&&(n.hasPreset=!0,n.style.visibility="hidden")}else(this.json.presetClass==="exit"||this.json.presetClass==="path")&&(n.hasPreset=!0,n.style.visibility="visible")}startTimeNodeRepeat(){this.timeDelta=0,this.isActive=!0,this.applyCount+=1,this.startTimeLine(!1),this.json.iterate||this.emit("timeNodeRepeat",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse})}startTimeNodeForce(){this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.timeDelta=0,this.isActive=!0,this.handleActive(!1)}startTimeNode(n=!0){if(this.isDestroy)return;this.collectStartValue(),this.timeDelta=0,this.isReverse=!1,this.json.subTnLst&&this.createSubList(this.json.subTnLst),this.startConds.setTriggerParams(n);const e=this.json.stCondLst.filter(s=>/^self/.test(s.event||""))[0];e&&this.startConds.condHandle(e);const r=this.json.endCondLst.filter(s=>/^self/.test(s.event||""))[0];r&&this.endConds.condHandle(r),this.startConds.condHandle()}onTimeLineEnd(){this.dispose(),(this.children.length===0||this.json.iterate)&&this.allChildrenEndHandle()}clearSubList(){this.subList.forEach(n=>n.commonTimeNode.destroy()),this.subList=[],this.children.forEach(n=>{n.commonTimeNode.clearSubList()})}seekToStart(n=!0){if(this.isEndEventsEmitted=!1,this.isActive=!1,this.dispose(),this.timeDelta=0,this.emit("seekToStart"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(e=>e.seekToStart(n));if(n)for(let e=this.subList.length-1;e>=0;e--){const r=this.subList[e];r==null||r.commonTimeNode.seekToStart()}for(let e=this.children.length-1;e>=0;e--){const r=this.children[e];r==null||r.commonTimeNode.seekToStart()}for(let e=this.children.length-1;e>=0;e--){const r=this.children[e];r==null||r.commonTimeNode.seekToStart()}}dispose(n=!1){this.isConflictDispose=n,this.ctx.clock.clearTimeout(this.repeatTimeoutId),this.ctx.eventHub.emit(Pn.animateEnd),this.ctx.ticker.remove(this.updateTimeLine),this.startConds.reset(),this.endConds.reset()}seekToEnd(n,e=!1){if(this.isInfiniteRepeat())return;!this.isActive&&this.applyCount<=0&&this.collectStartValue(),this.applyCount=this.json.repeatCount,this.json.autoRev&&(this.isReverse=!0),this.timeDelta=this.duration,this.isActive=!1,this.dispose();const r=this.json.autoRev||n;if(r?this.emit("seekToStart"):this.emit("seekToEnd"),this.json.iterate&&!this.isIterate)return this.isIterateEnd=!0,void this.iterateShadows.forEach(s=>s.seekToEnd(r,e));this.children.length===0&&(this.eventHubs.runtime.emit("runtime all end"),this.handleEnd()),this.children.forEach(s=>s.commonTimeNode.seekToEnd(r,e)),e&&this.json.subTnLst&&(this.subList.length<=0&&this.createSubList(this.json.subTnLst),this.subList.forEach(s=>s.commonTimeNode.seekToEnd(!1)),this.clearSubList())}isTimeNodeEnd(){let n=!0;return this.children.length>0&&(n=n&&this.children.every(e=>e.commonTimeNode.isTimeNodeEnd())),this.json.repeatCount&&(n=n&&this.applyCount>=this.json.repeatCount),this.json.autoRev&&(n=n&&!this.isReverse),n=n&&this.isNatureTimeEnd(),!!this.isConflictDispose||!(!this.isIterateEnd||!this.json.iterate)||n}emitEndEvents(){this.isEndEventsEmitted||(this.isEndEventsEmitted=!0,this.eventHubs.global.emit(`time ${this.json.id} end`),this.eventHubs.global.emit(`time ${this.json.id} onEnd`),this.eventHubs.runtime.emit(`runtime ${this.json.id} end`),this.emit("timeNodeEnd",{id:this.uuid,activeCount:this.applyCount,isReverse:this.isReverse}))}collectStartValue(){this.emit("timeNodeCreate"),this.children.forEach(n=>n.commonTimeNode.collectStartValue())}destroy(){this.emit("timeNodeDestroy"),this.isDestroy=!0,this.dispose(),this.startConds.removeAllListeners(),this.endConds.removeAllListeners(),this.children.forEach(n=>n.commonTimeNode.destroy()),this.clearSubList()}}class Kc extends J.a{constructor(n){super(),this.isRunning=!1,this.runtimeNodeEventHub=new J.a;const{json:e,iterateType:r,isIterate:s,isSub:u,parent:h,ctx:f,eventHub:y,iterateIndex:b,iterateId:T}=n;this.id=e.ctn.id,this.json=e,this.ctx=f,this.isIterate=s,this.globalEventHub=y,this.commonTimeNode=new Po({json:e.ctn,isSub:u,eventHubs:{global:y,runtime:this.runtimeNodeEventHub},ctx:f,parent:h,isIterate:!1,iterateType:r,iterateIndex:b,iterateId:T}),this.commonTimeNode.on("timeNodeStart",()=>{this.commonTimeNode.children.forEach(P=>{P.commonTimeNode.setReverse(this.commonTimeNode.getReverse()),P.commonTimeNode.startTimeNode()}),this.isRunning||(this.isRunning=!0,this.globalEventHub.emit(`runtime ${this.id} begin`),this.emit("begin"))}),this.commonTimeNode.on("timeNodeRepeat",()=>{this.commonTimeNode.children.forEach(P=>{P.commonTimeNode.startTimeNode(!1)})}),this.commonTimeNode.on("timeNodeEnd",()=>{this.commonTimeNode.isTimeNodeEnd()&&this.isRunning&&(this.isRunning=!1,this.globalEventHub.emit(`runtime ${this.id} end`),this.emit("end"))})}}var ng=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class rg{constructor(n,e,r){this.json=n,this.ctx=r;const s=n.timeNodeList.find(u=>u.type==="par"&&u.ctn.nodeType==="tmRoot");s&&(this.tmRoot=new Kc({json:s,isSub:!1,isIterate:!1,eventHub:e,ctx:r,parent:null,iterateType:"el",iterateIndex:0,iterateId:""}),this.mainSeq=this.tmRoot.commonTimeNode.children.find(u=>{var h,f,y;return((h=u.json)===null||h===void 0?void 0:h.type)==="seq"&&((y=(f=u.json)===null||f===void 0?void 0:f.ctn)===null||y===void 0?void 0:y.nodeType)==="mainSeq"}))}findSeq(n){var e;return(e=this.tmRoot)===null||e===void 0?void 0:e.commonTimeNode.children.find(r=>{var s,u,h;return((s=r.json)===null||s===void 0?void 0:s.type)==="seq"&&((h=(u=r.json)===null||u===void 0?void 0:u.ctn)===null||h===void 0?void 0:h.id)===n})}start(){var n,e;return ng(this,void 0,void 0,function*(){this.json.autoPlayMainSeq?(yield this.ctx.clock.delay(16),(n=this.mainSeq)===null||n===void 0||n.commonTimeNode.startTimeNode()):(e=this.mainSeq)===null||e===void 0||e.commonTimeNode.startTimeNode()})}setMainSeqApplied(){this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1)}collectMainSeqStartValue(){var n;(n=this.mainSeq)===null||n===void 0||n.commonTimeNode.collectStartValue()}setMainSeqStep(n,e){var r;n===-1&&this.mainSeq&&(this.mainSeq.commonTimeNode.applyCount=1),(r=this.mainSeq)===null||r===void 0||r.setCurrentStep(n,e)}destroy(){var n;(n=this.tmRoot)===null||n===void 0||n.commonTimeNode.destroy()}hasMainSeq(){return!!this.mainSeq&&this.mainSeq.commonTimeNode.children.length>0}currentMainSeqState(){return this.mainSeq?this.mainSeq.currentState:null}currentMainSeqStep(){return this.mainSeq?this.mainSeq.currentStep:0}currentMainSeqLength(){return this.mainSeq?this.mainSeq.stepLength:0}mainSeqHasNextStep(){return!!this.mainSeq&&this.mainSeq.hasNext()}mainSeqHasPrevStep(){return!!this.mainSeq&&this.mainSeq.hasPrev()}seekInteractiveSeqToEnd(n){const e=this.findSeq(n);e&&e.commonTimeNode.seekToEnd(!1,!0)}setInteractiveSeqState(n,e,r){const s=this.findSeq(n);s&&s.setCurrentStep(e,r)}applyInteractiveAction(n){const e=this.findSeq(n);e&&e.handleNext()}}var xm=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class ig extends me{constructor(n,e,r){super({id:"stage",width:n.width,height:n.height,type:"Container",children:n.children},e,r),this.globalEventHub=new J.a,this.json=n,this.container.visible=!1,this.ctx=e,this.globalEventHub.on("c:prev slide",()=>{this.ctx.eventHub.emit(Pn.requestPrevSlide)}),this.globalEventHub.on("c:next slide",()=>{this.ctx.eventHub.emit(Pn.requestNextSlide)});const s=new ps;s.drawRect(0,0,n.width,n.height),this.container.addChild(s)}get interactiveContainer(){return this.container}render(){const n=Object.create(null,{render:{get:()=>super.render}});return xm(this,void 0,void 0,function*(){yield n.render.call(this),this.ctx.eventHub.emit("StageRenderEnd")})}createTiming(){this.json.timing&&(this.timing=new rg(this.json.timing,this.globalEventHub,this.ctx))}startTiming(){var n;return((n=this.timing)===null||n===void 0?void 0:n.start())||Promise.resolve()}setMainSeqApplied(){var n;(n=this.timing)===null||n===void 0||n.setMainSeqApplied()}setMainSeqStep(n,e){var r;(r=this.timing)===null||r===void 0||r.setMainSeqStep(n,e)}collectMainSeqStartValue(){var n;(n=this.timing)===null||n===void 0||n.collectMainSeqStartValue()}hasTiming(){return!!this.timing}destroy(){var n;this.ctx.eventHub.removeAllListeners(),this.ctx.graphicsTexture.destroy(),this.ctx.fillTexture.destroy(),this.globalEventHub.removeAllListeners(),(n=this.timing)===null||n===void 0||n.destroy(),super.destroy()}mainSeqStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.currentMainSeqStep())!==null&&e!==void 0?e:0}mainSeqLength(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.currentMainSeqLength())!==null&&e!==void 0?e:0}mainSeqHasNextStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.mainSeqHasNextStep())!==null&&e!==void 0&&e}mainSeqHasPrevStep(){var n,e;return(e=(n=this.timing)===null||n===void 0?void 0:n.mainSeqHasPrevStep())!==null&&e!==void 0&&e}mainSeqState(){return this.timing?this.timing.currentMainSeqState():null}nextStep(){var n;this.hasTiming()&&((n=this.timing)===null||n===void 0?void 0:n.hasMainSeq())?this.globalEventHub.emit("shape slide onNext"):this.ctx.eventHub.emit(Pn.requestNextSlide)}prevStep(){var n;this.hasTiming()&&((n=this.timing)===null||n===void 0?void 0:n.hasMainSeq())?this.globalEventHub.emit("shape slide onPrev"):this.ctx.eventHub.emit(Pn.requestPrevSlide)}applyInteractiveAction(n){var e;(e=this.timing)===null||e===void 0||e.applyInteractiveAction(n)}seekInteractiveSeqToEnd(n){var e;(e=this.timing)===null||e===void 0||e.seekInteractiveSeqToEnd(n)}setInteractiveSeqState(n,e,r){var s;(s=this.timing)===null||s===void 0||s.setInteractiveSeqState(n,e,r)}setMediaState(n,e){return xm(this,void 0,void 0,function*(){const r=this.ctx.medias[n];r&&(e?yield r.play():yield r.pause())})}setMediaCurrentTime(n,e){const r=this.ctx.medias[n];r&&r.seek(e)}}const ts=134217729;function Rf(o,n,e,r,s){let u,h,f,y,b=n[0],T=r[0],P=0,j=0;T>b==T>-b?(u=b,b=n[++P]):(u=T,T=r[++j]);let G=0;if(P<o&&j<e)for(T>b==T>-b?(h=b+u,f=u-(h-b),b=n[++P]):(h=T+u,f=u-(h-T),T=r[++j]),u=h,f!==0&&(s[G++]=f);P<o&&j<e;)T>b==T>-b?(h=u+b,y=h-u,f=u-(h-y)+(b-y),b=n[++P]):(h=u+T,y=h-u,f=u-(h-y)+(T-y),T=r[++j]),u=h,f!==0&&(s[G++]=f);for(;P<o;)h=u+b,y=h-u,f=u-(h-y)+(b-y),b=n[++P],u=h,f!==0&&(s[G++]=f);for(;j<e;)h=u+T,y=h-u,f=u-(h-y)+(T-y),T=r[++j],u=h,f!==0&&(s[G++]=f);return u===0&&G!==0||(s[G++]=u),G}function og(o,n){let e=n[0];for(let r=1;r<o;r++)e+=n[r];return e}function Vh(o){return new Float64Array(o)}const Qc=Vh(4),Wh=Vh(8),bm=Vh(12),Mi=Vh(16),Ro=Vh(4);function tp(o,n,e,r,s,u){const h=(n-u)*(e-s),f=(o-s)*(r-u),y=h-f;if(h===0||f===0||h>0!=f>0)return y;const b=Math.abs(h+f);return Math.abs(y)>=33306690738754716e-32*b?y:-function(T,P,j,G,V,K,_t){let Tt,jt,de,Ne,Nt,ue,$t,ie,Je,he,oe,Ae,nn,on,$n,nr,$e,Ue;const Cn=T-V,kn=j-V,wr=P-K,Ar=G-K;on=Cn*Ar,ue=ts*Cn,$t=ue-(ue-Cn),ie=Cn-$t,ue=ts*Ar,Je=ue-(ue-Ar),he=Ar-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=wr*kn,ue=ts*wr,$t=ue-(ue-wr),ie=wr-$t,ue=ts*kn,Je=ue-(ue-kn),he=kn-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Qc[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Qc[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Qc[2]=Ae-(Ue-Nt)+(oe-Nt),Qc[3]=Ue;let Dr=og(4,Qc),pi=22204460492503146e-32*_t;if(Dr>=pi||-Dr>=pi||(Nt=T-Cn,Tt=T-(Cn+Nt)+(Nt-V),Nt=j-kn,de=j-(kn+Nt)+(Nt-V),Nt=P-wr,jt=P-(wr+Nt)+(Nt-K),Nt=G-Ar,Ne=G-(Ar+Nt)+(Nt-K),Tt===0&&jt===0&&de===0&&Ne===0)||(pi=11093356479670487e-47*_t+33306690738754706e-32*Math.abs(Dr),Dr+=Cn*Ne+Ar*Tt-(wr*de+kn*jt),Dr>=pi||-Dr>=pi))return Dr;on=Tt*Ar,ue=ts*Tt,$t=ue-(ue-Tt),ie=Tt-$t,ue=ts*Ar,Je=ue-(ue-Ar),he=Ar-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=jt*kn,ue=ts*jt,$t=ue-(ue-jt),ie=jt-$t,ue=ts*kn,Je=ue-(ue-kn),he=kn-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Ro[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Ro[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Ro[2]=Ae-(Ue-Nt)+(oe-Nt),Ro[3]=Ue;const Ji=Rf(4,Qc,4,Ro,Wh);on=Cn*Ne,ue=ts*Cn,$t=ue-(ue-Cn),ie=Cn-$t,ue=ts*Ne,Je=ue-(ue-Ne),he=Ne-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=wr*de,ue=ts*wr,$t=ue-(ue-wr),ie=wr-$t,ue=ts*de,Je=ue-(ue-de),he=de-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Ro[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Ro[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Ro[2]=Ae-(Ue-Nt)+(oe-Nt),Ro[3]=Ue;const jr=Rf(Ji,Wh,4,Ro,bm);on=Tt*Ne,ue=ts*Tt,$t=ue-(ue-Tt),ie=Tt-$t,ue=ts*Ne,Je=ue-(ue-Ne),he=Ne-Je,$n=ie*he-(on-$t*Je-ie*Je-$t*he),nr=jt*de,ue=ts*jt,$t=ue-(ue-jt),ie=jt-$t,ue=ts*de,Je=ue-(ue-de),he=de-Je,$e=ie*he-(nr-$t*Je-ie*Je-$t*he),oe=$n-$e,Nt=$n-oe,Ro[0]=$n-(oe+Nt)+(Nt-$e),Ae=on+oe,Nt=Ae-on,nn=on-(Ae-Nt)+(oe-Nt),oe=nn-nr,Nt=nn-oe,Ro[1]=nn-(oe+Nt)+(Nt-nr),Ue=Ae+oe,Nt=Ue-Ae,Ro[2]=Ae-(Ue-Nt)+(oe-Nt),Ro[3]=Ue;const Zr=Rf(jr,bm,4,Ro,Mi);return Mi[Zr-1]}(o,n,e,r,s,u,b)}const ep=Math.pow(2,-52),Xh=new Uint32Array(512);class qh{static from(n,e=Sm,r=Tm){const s=n.length,u=new Float64Array(2*s);for(let h=0;h<s;h++){const f=n[h];u[2*h]=e(f),u[2*h+1]=r(f)}return new qh(u)}constructor(n){const e=n.length>>1;if(e>0&&typeof n[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=n;const r=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*r),this._halfedges=new Int32Array(3*r),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:n,_hullPrev:e,_hullNext:r,_hullTri:s,_hullHash:u}=this,h=n.length>>1;let f=1/0,y=1/0,b=-1/0,T=-1/0;for(let he=0;he<h;he++){const oe=n[2*he],Ae=n[2*he+1];oe<f&&(f=oe),Ae<y&&(y=Ae),oe>b&&(b=oe),Ae>T&&(T=Ae),this._ids[he]=he}const P=(f+b)/2,j=(y+T)/2;let G,V,K,_t=1/0;for(let he=0;he<h;he++){const oe=Qp(P,j,n[2*he],n[2*he+1]);oe<_t&&(G=he,_t=oe)}const Tt=n[2*G],jt=n[2*G+1];_t=1/0;for(let he=0;he<h;he++){if(he===G)continue;const oe=Qp(Tt,jt,n[2*he],n[2*he+1]);oe<_t&&oe>0&&(V=he,_t=oe)}let de=n[2*V],Ne=n[2*V+1],Nt=1/0;for(let he=0;he<h;he++){if(he===G||he===V)continue;const oe=np(Tt,jt,de,Ne,n[2*he],n[2*he+1]);oe<Nt&&(K=he,Nt=oe)}let ue=n[2*K],$t=n[2*K+1];if(Nt===1/0){for(let Ae=0;Ae<h;Ae++)this._dists[Ae]=n[2*Ae]-n[0]||n[2*Ae+1]-n[1];ku(this._ids,this._dists,0,h-1);const he=new Uint32Array(h);let oe=0;for(let Ae=0,nn=-1/0;Ae<h;Ae++){const on=this._ids[Ae];this._dists[on]>nn&&(he[oe++]=on,nn=this._dists[on])}return this.hull=he.subarray(0,oe),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(tp(Tt,jt,de,Ne,ue,$t)<0){const he=V,oe=de,Ae=Ne;V=K,de=ue,Ne=$t,K=he,ue=oe,$t=Ae}const ie=function(he,oe,Ae,nn,on,$n){const nr=Ae-he,$e=nn-oe,Ue=on-he,Cn=$n-oe,kn=nr*nr+$e*$e,wr=Ue*Ue+Cn*Cn,Ar=.5/(nr*Cn-$e*Ue);return{x:he+(Cn*kn-$e*wr)*Ar,y:oe+(nr*wr-Ue*kn)*Ar}}(Tt,jt,de,Ne,ue,$t);this._cx=ie.x,this._cy=ie.y;for(let he=0;he<h;he++)this._dists[he]=Qp(n[2*he],n[2*he+1],ie.x,ie.y);ku(this._ids,this._dists,0,h-1),this._hullStart=G;let Je=3;r[G]=e[K]=V,r[V]=e[G]=K,r[K]=e[V]=G,s[G]=0,s[V]=1,s[K]=2,u.fill(-1),u[this._hashKey(Tt,jt)]=G,u[this._hashKey(de,Ne)]=V,u[this._hashKey(ue,$t)]=K,this.trianglesLen=0,this._addTriangle(G,V,K,-1,-1,-1);for(let he,oe,Ae=0;Ae<this._ids.length;Ae++){const nn=this._ids[Ae],on=n[2*nn],$n=n[2*nn+1];if(Ae>0&&Math.abs(on-he)<=ep&&Math.abs($n-oe)<=ep||(he=on,oe=$n,nn===G||nn===V||nn===K))continue;let nr=0;for(let wr=0,Ar=this._hashKey(on,$n);wr<this._hashSize&&(nr=u[(Ar+wr)%this._hashSize],nr===-1||nr===r[nr]);wr++);nr=e[nr];let $e,Ue=nr;for(;$e=r[Ue],tp(on,$n,n[2*Ue],n[2*Ue+1],n[2*$e],n[2*$e+1])>=0;)if(Ue=$e,Ue===nr){Ue=-1;break}if(Ue===-1)continue;let Cn=this._addTriangle(Ue,nn,r[Ue],-1,-1,s[Ue]);s[nn]=this._legalize(Cn+2),s[Ue]=Cn,Je++;let kn=r[Ue];for(;$e=r[kn],tp(on,$n,n[2*kn],n[2*kn+1],n[2*$e],n[2*$e+1])<0;)Cn=this._addTriangle(kn,nn,$e,s[nn],-1,s[kn]),s[nn]=this._legalize(Cn+2),r[kn]=kn,Je--,kn=$e;if(Ue===nr)for(;$e=e[Ue],tp(on,$n,n[2*$e],n[2*$e+1],n[2*Ue],n[2*Ue+1])<0;)Cn=this._addTriangle($e,nn,Ue,-1,s[Ue],s[$e]),this._legalize(Cn+2),s[$e]=Cn,r[Ue]=Ue,Je--,Ue=$e;this._hullStart=e[nn]=Ue,r[Ue]=e[kn]=nn,r[nn]=kn,u[this._hashKey(on,$n)]=nn,u[this._hashKey(n[2*Ue],n[2*Ue+1])]=Ue}this.hull=new Uint32Array(Je);for(let he=0,oe=this._hullStart;he<Je;he++)this.hull[he]=oe,oe=r[oe];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(n,e){return Math.floor(function(r,s){const u=r/(Math.abs(r)+Math.abs(s));return(s>0?3-u:1+u)/4}(n-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(n){const{_triangles:e,_halfedges:r,coords:s}=this;let u=0,h=0;for(;;){const f=r[n],y=n-n%3;if(h=y+(n+2)%3,f===-1){if(u===0)break;n=Xh[--u];continue}const b=f-f%3,T=y+(n+1)%3,P=b+(f+2)%3,j=e[h],G=e[n],V=e[T],K=e[P];if(wm(s[2*j],s[2*j+1],s[2*G],s[2*G+1],s[2*V],s[2*V+1],s[2*K],s[2*K+1])){e[n]=K,e[f]=j;const _t=r[P];if(_t===-1){let jt=this._hullStart;do{if(this._hullTri[jt]===P){this._hullTri[jt]=n;break}jt=this._hullPrev[jt]}while(jt!==this._hullStart)}this._link(n,_t),this._link(f,r[h]),this._link(h,P);const Tt=b+(f+1)%3;u<Xh.length&&(Xh[u++]=Tt)}else{if(u===0)break;n=Xh[--u]}}return h}_link(n,e){this._halfedges[n]=e,e!==-1&&(this._halfedges[e]=n)}_addTriangle(n,e,r,s,u,h){const f=this.trianglesLen;return this._triangles[f]=n,this._triangles[f+1]=e,this._triangles[f+2]=r,this._link(f,s),this._link(f+1,u),this._link(f+2,h),this.trianglesLen+=3,f}}function Qp(o,n,e,r){const s=o-e,u=n-r;return s*s+u*u}function wm(o,n,e,r,s,u,h,f){const y=o-h,b=n-f,T=e-h,P=r-f,j=s-h,G=u-f,V=T*T+P*P,K=j*j+G*G;return y*(P*K-V*G)-b*(T*K-V*j)+(y*y+b*b)*(T*G-P*j)<0}function np(o,n,e,r,s,u){const h=e-o,f=r-n,y=s-o,b=u-n,T=h*h+f*f,P=y*y+b*b,j=.5/(h*b-f*y),G=(b*T-f*P)*j,V=(h*P-y*T)*j;return G*G+V*V}function ku(o,n,e,r){if(r-e<=20)for(let s=e+1;s<=r;s++){const u=o[s],h=n[u];let f=s-1;for(;f>=e&&n[o[f]]>h;)o[f+1]=o[f--];o[f+1]=u}else{let s=e+1,u=r;Os(o,e+r>>1,s),n[o[e]]>n[o[r]]&&Os(o,e,r),n[o[s]]>n[o[r]]&&Os(o,s,r),n[o[e]]>n[o[s]]&&Os(o,e,s);const h=o[s],f=n[h];for(;;){do s++;while(n[o[s]]<f);do u--;while(n[o[u]]>f);if(u<s)break;Os(o,s,u)}o[e+1]=o[u],o[u]=h,r-s+1>=u-e?(ku(o,n,s,r),ku(o,n,e,u-1)):(ku(o,n,e,u-1),ku(o,n,s,r))}}function Os(o,n,e){const r=o[n];o[n]=o[e],o[e]=r}function Sm(o){return o[0]}function Tm(o){return o[1]}function Ka(o,n,e){return o.fillType==="solidFill"?function(r,s,u){const h=new ps,[f,y]=Lu(r.color);return h.beginFill(f,y),h.drawRect(0,0,s,u),h.endFill(),h}(o,n,e):o.fillType==="gradientFill"?function(r,s,u){let h=null;const f=new Ri;if(r.stopList.sort((b,T)=>b.pos-T.pos),!r.stopList.find(b=>b.pos===0)){const b=r.stopList[0];r.stopList.unshift({pos:0,color:b.color})}if(!r.stopList.find(b=>b.pos===1)){const b=r.stopList[r.stopList.length-1];r.stopList.push({pos:1,color:b.color})}const y=b=>{const T=[];for(let P=0,j=b.length;P<j-1;P++){const G=b[P],V=b[P+1],K=G.pos+.5*(V.pos-G.pos),_t=Ou(G.color,V.color,.5),Tt=2*P;T[Tt]=G,T[Tt+1]={color:_t,pos:K},T[Tt+2]=V}return T};if(r.stopList=y(r.stopList),r.stopList=y(r.stopList),h=r.line?Em(r,s,u):r.path?function(b,T,P){var j,G,V;const K=[],_t={x:0,y:0};if(((j=b.path)===null||j===void 0?void 0:j.path)==="circle"||((G=b.path)===null||G===void 0?void 0:G.path)==="rect"||((V=b.path)===null||V===void 0?void 0:V.path)==="shape"){const Tt=T/2,jt=P/2,de=Math.sqrt(Tt*Tt+jt*jt);b.stopList.forEach(Ne=>{if(Ne.pos===0)K.push({point:{x:0,y:0},color:Ne.color});else{const Nt=de*Ne.pos,ue=new va.Path;ue.absellipse(0,0,Nt,Nt,0,2*Math.PI,!1,0),ue.getPoints(50).forEach($t=>{K.push({point:{x:$t.x,y:$t.y},color:Ne.color})})}_t.x=Tt,_t.y=jt})}return{points:K,position:_t}}(r,s,u):Em(r,s,u),h){const b=[],T=[],{position:P,points:j}=h,G=qh.from(j,jt=>jt.point.x,jt=>jt.point.y);for(let jt=0;jt<G.triangles.length;jt+=3)b.push(j[G.triangles[jt]].point.x,j[G.triangles[jt]].point.y),b.push(j[G.triangles[jt+1]].point.x,j[G.triangles[jt+1]].point.y),b.push(j[G.triangles[jt+2]].point.x,j[G.triangles[jt+2]].point.y),T.push(...Rs(j[G.triangles[jt]].color)),T.push(...Rs(j[G.triangles[jt+1]].color)),T.push(...Rs(j[G.triangles[jt+2]].color));const V=new Na;V.addAttribute("aVertexPosition",b,2),V.addAttribute("aColor",T,4);const K=ko.from(`
5892
5892
  precision mediump float;
5893
5893
  attribute vec2 aVertexPosition;
5894
5894
  attribute vec4 aColor;
@@ -5906,7 +5906,7 @@ void main(void){
5906
5906
  color.a = 1.0;
5907
5907
  gl_FragColor = color * alpha;
5908
5908
  }
5909
- `),_t=new ps;_t.drawRect(0,0,s+1,u+1),f.mask=_t,f.addChild(_t);const Tt=new Mu(V,K);Tt.position.x=P.x,Tt.position.y=P.y,f.addChild(Tt)}return f}(o,n,e):null}function Tm(o,n,e){const r=n/2,s=e/2,u=[{x:-r,y:s},{x:-r,y:-s},{x:r,y:s},{x:r,y:-s}],h=[ms.fromPointSlope({x:-r,y:0},Math.PI/2),ms.fromPointSlope({x:0,y:s},0),ms.fromPointSlope({x:r,y:0},Math.PI/2),ms.fromPointSlope({x:0,y:-s},0)],f=[],y=o.stopList.slice(1,o.stopList.length-1).map(V=>{var K,_t,Tt;const jt=2*Math.PI;let de=(_t=(K=o.line)===null||K===void 0?void 0:K.ang)!==null&&_t!==void 0?_t:0;for(;de>jt;)de-=jt;for(;de<0;)de+=jt;const Ne={x:0,y:0};jo(de,Math.PI/2)?(Ne.x=0,Ne.y=e/2-V.pos*e):jo(de,0)?(Ne.x=V.pos*n-n/2,Ne.y=0):(Ne.x=V.pos*n-n/2,Ne.y=e/2-V.pos*e),de>Math.PI/2&&de<=Math.PI&&(Ne.x*=-1),de>Math.PI&&de<=2*Math.PI&&(Ne.y*=-1);const Nt=ms.fromPointSlope(Ne,Math.PI/2-(((Tt=o.line)===null||Tt===void 0?void 0:Tt.ang)||0)),ue=h.map(ie=>Nt.crossPoint(ie)).filter(ie=>ie&&ie.x<=r&&ie.x>=-r&&ie.y<=s&&ie.y>=-s).map(ie=>({point:ie,color:V.color})).sort((ie,Je)=>Je.point.y-ie.point.y);f.push(...ue);let $t=Math.abs(ue[1].point.x-ue[0].point.x)/10;for(let ie=20;ie--;){const Je=ie%2==0?1:-1,he=Ne.x+Je*$t,oe=Nt.resolveY(he);he<=r&&he>=-r&&oe<=s&&oe>=-s&&f.push({point:{x:he,y:oe},color:V.color}),$t+=$t}return Nt});let b=[],T=[];t:for(let V=0;V<u.length;V++){const K=u[V];for(let Ne=0;Ne<y.length-1;Ne++){const Nt=y[Ne],ue=y[Ne+1],$t=Nt.distanceToLinearEquation(ue),ie=Nt.distanceToPoint(K),Je=ue.distanceToPoint(K);if(ie<$t&&Je<$t){const he=o.stopList.slice(1,o.stopList.length-1)[Ne],oe=o.stopList.slice(1,o.stopList.length-1)[Ne+1],Ae=Ou(he.color,oe.color,ie/$t);f.splice(Ne+1,0,{point:K,color:Ae});continue t}}const _t=y[0],Tt=y[y.length-1],jt=_t.distanceToPoint(K),de=Tt.distanceToPoint(K);jt<=de?b.push({point:K,dis:jt}):T.push({point:K,dis:de})}b=b.sort((V,K)=>K.dis-V.dis);const P=b.map((V,K)=>{if(K===0)return{point:V.point,color:o.stopList[0].color};{const _t=o.stopList[0].color,Tt=o.stopList[1].color;return{point:V.point,color:Ou(_t,Tt,1-(b[0].dis===0?1:V.dis/b[0].dis))}}}).sort((V,K)=>K.point.y-V.point.y);T=T.sort((V,K)=>K.dis-V.dis);const j=T.map((V,K)=>{if(K===0)return{point:V.point,color:o.stopList[o.stopList.length-1].color};{const _t=o.stopList[o.stopList.length-2].color,Tt=o.stopList[o.stopList.length-1].color;return{point:V.point,color:Ou(_t,Tt,T[0].dis===0?0:V.dis/T[0].dis)}}}).sort((V,K)=>K.point.y-V.point.y),G=P.concat(...f).concat(j);for(let V=0;V<G.length;V++)G[V].point.x+=r,G[V].point.y=-G[V].point.y+s;return{points:G,position:{x:0,y:0}}}const Uu=`
5909
+ `),_t=new ps;_t.drawRect(0,0,s+1,u+1),f.mask=_t,f.addChild(_t);const Tt=new Mu(V,K);Tt.position.x=P.x,Tt.position.y=P.y,f.addChild(Tt)}return f}(o,n,e):null}function Em(o,n,e){const r=n/2,s=e/2,u=[{x:-r,y:s},{x:-r,y:-s},{x:r,y:s},{x:r,y:-s}],h=[ms.fromPointSlope({x:-r,y:0},Math.PI/2),ms.fromPointSlope({x:0,y:s},0),ms.fromPointSlope({x:r,y:0},Math.PI/2),ms.fromPointSlope({x:0,y:-s},0)],f=[],y=o.stopList.slice(1,o.stopList.length-1).map(V=>{var K,_t,Tt;const jt=2*Math.PI;let de=(_t=(K=o.line)===null||K===void 0?void 0:K.ang)!==null&&_t!==void 0?_t:0;for(;de>jt;)de-=jt;for(;de<0;)de+=jt;const Ne={x:0,y:0};jo(de,Math.PI/2)?(Ne.x=0,Ne.y=e/2-V.pos*e):jo(de,0)?(Ne.x=V.pos*n-n/2,Ne.y=0):(Ne.x=V.pos*n-n/2,Ne.y=e/2-V.pos*e),de>Math.PI/2&&de<=Math.PI&&(Ne.x*=-1),de>Math.PI&&de<=2*Math.PI&&(Ne.y*=-1);const Nt=ms.fromPointSlope(Ne,Math.PI/2-(((Tt=o.line)===null||Tt===void 0?void 0:Tt.ang)||0)),ue=h.map(ie=>Nt.crossPoint(ie)).filter(ie=>ie&&ie.x<=r&&ie.x>=-r&&ie.y<=s&&ie.y>=-s).map(ie=>({point:ie,color:V.color})).sort((ie,Je)=>Je.point.y-ie.point.y);f.push(...ue);let $t=Math.abs(ue[1].point.x-ue[0].point.x)/10;for(let ie=20;ie--;){const Je=ie%2==0?1:-1,he=Ne.x+Je*$t,oe=Nt.resolveY(he);he<=r&&he>=-r&&oe<=s&&oe>=-s&&f.push({point:{x:he,y:oe},color:V.color}),$t+=$t}return Nt});let b=[],T=[];t:for(let V=0;V<u.length;V++){const K=u[V];for(let Ne=0;Ne<y.length-1;Ne++){const Nt=y[Ne],ue=y[Ne+1],$t=Nt.distanceToLinearEquation(ue),ie=Nt.distanceToPoint(K),Je=ue.distanceToPoint(K);if(ie<$t&&Je<$t){const he=o.stopList.slice(1,o.stopList.length-1)[Ne],oe=o.stopList.slice(1,o.stopList.length-1)[Ne+1],Ae=Ou(he.color,oe.color,ie/$t);f.splice(Ne+1,0,{point:K,color:Ae});continue t}}const _t=y[0],Tt=y[y.length-1],jt=_t.distanceToPoint(K),de=Tt.distanceToPoint(K);jt<=de?b.push({point:K,dis:jt}):T.push({point:K,dis:de})}b=b.sort((V,K)=>K.dis-V.dis);const P=b.map((V,K)=>{if(K===0)return{point:V.point,color:o.stopList[0].color};{const _t=o.stopList[0].color,Tt=o.stopList[1].color;return{point:V.point,color:Ou(_t,Tt,1-(b[0].dis===0?1:V.dis/b[0].dis))}}}).sort((V,K)=>K.point.y-V.point.y);T=T.sort((V,K)=>K.dis-V.dis);const j=T.map((V,K)=>{if(K===0)return{point:V.point,color:o.stopList[o.stopList.length-1].color};{const _t=o.stopList[o.stopList.length-2].color,Tt=o.stopList[o.stopList.length-1].color;return{point:V.point,color:Ou(_t,Tt,T[0].dis===0?0:V.dis/T[0].dis)}}}).sort((V,K)=>K.point.y-V.point.y),G=P.concat(...f).concat(j);for(let V=0;V<G.length;V++)G[V].point.x+=r,G[V].point.y=-G[V].point.y+s;return{points:G,position:{x:0,y:0}}}const Uu=`
5910
5910
  vec3 rgb2hsl(vec3 rgb) {
5911
5911
  float cMax = max(max(rgb.r, rgb.g), rgb.b);
5912
5912
  float cMin = min(min(rgb.r, rgb.g), rgb.b);
@@ -6042,7 +6042,7 @@ void main(void){
6042
6042
  vec4 texColor = texture2D(uSampler, vTextureCoord);
6043
6043
  gl_FragColor = transform(texColor, arg1, arg2);
6044
6044
  }
6045
- `),{arg1:e,arg2:r})}}class id{constructor(n,e){this.renderContainers=[],this.renderTextures=[],this.textures=Object.create(null),this.fillStyles=[],this.renderer=n,this.spriteTextures=e}addTexture(n,e){this.textures[n]={texture:e,pivot:{x:0,y:0}}}render(n){const{items:e,width:r,height:s}=n,u=new Ri;e.forEach(y=>{if(y.item.blipFillObject){const{width:b,height:T}=y;y.item.blipFillObject.position.x+=y.x+b/2,y.item.blipFillObject.position.y+=y.y+T/2,y.item.blipFillObject.anchor.x=.5,y.item.blipFillObject.anchor.y=.5,y.item.blipFillObject.rotation=y.item.rotate/180*Math.PI,u.addChild(y.item.blipFillObject)}else{const b=Ka(y.item.fill,y.width-4,y.height-4);if(b)b.position.x+=y.x+2,b.position.y+=y.y+2,u.addChild(b);else{const T=new ps;T.drawRect(0,0,y.width-4,y.height-4),u.addChild(T)}}if(y.item.name){const b=new Ic(y.item.name,{fontFamily:"Arial",fontSize:12,fill:16715792,align:"center"});b.position.x=y.x+2,b.position.y=y.y+2,u.addChild(b)}});const h=new ps;h.drawRect(0,0,Math.ceil(r),Math.ceil(s)),u.addChild(h);const f=Li.create({width:r,height:s,resolution:Math.ceil(this.renderer.resolution)});this.renderTextures.push(f),this.renderContainers.push(u),this.renderer.render(u,{renderTexture:f}),e.forEach(y=>{const b=new qn(f.baseTexture,new dr(y.x+2,y.y+2,y.width-4,y.height-4));this.textures[y.item.id]={texture:b,pivot:y.item.pivot}})}getTexture(n){const e=this.textures[n],r=this.spriteTextures.getTexture(n);return e||(this.spriteTextures.getTexture(n)?{texture:r,pivot:{x:0,y:0}}:{texture:null,pivot:{x:0,y:0}})}getGifFrames(n){return this.spriteTextures.getGifFrames(n)}addFill(n,e,r,s,u=!1){var h;const f=JSON.stringify(n)+e+r,y=Nu()(f);if(this.textures[y]||this.fillStyles.findIndex(b=>b.id===y)>=0)return y;if(n.fillType!=="blipFill"){const b={x:0,y:0};n.fillType==="solidFill"&&(e+=2,r+=2,b.x=1,b.y=1),this.fillStyles.push({fill:n,width:e,height:r,id:y,name:s,pivot:b})}else{const b=this.spriteTextures.getTexture(n.src),T=this.spriteTextures.getFrameData(n.src);if(b){const P=new Nr;P.texture=b,n.filters.length>0&&u&&(P.filters=function(j){const G=[];return j.forEach(V=>{if(V.type==="biLevel")G.push(new rp("biLevel",V.args[0]));else if(V.type==="clrChange"||V.type==="changeBulletColor"){const K=Rs(V.args[0]),_t=Rs(V.args[1]);G.push(new Jh(V.type,K,_t))}else V.type==="alphaModFix"?G.push(new rp(V.type,V.args[0])):V.type==="lum"&&G.push(new rd(V.type,V.args[0],V.args[1]))}),G}(n.filters)),this.fillStyles.push({fill:n,width:(T==null?void 0:T.rotate)?b.height:b.width,height:(T==null?void 0:T.rotate)?b.width:b.height,id:y,blipFillObject:P,pivot:{x:0,y:0},rotate:(h=T==null?void 0:T.rotate)!==null&&h!==void 0?h:0})}}return y}pack(){const n=this.fillStyles.filter(r=>!(!r.fill.fillType||r.fill.fillType==="noFill"||r.width===0||r.height===0)||(this.textures[r.id]={texture:null,pivot:{x:0,y:0}},!1));n.forEach(r=>{r.width+=4,r.height+=4});const e=Vc(n);for(let r=0,s=e.length;r<s;r++){const u=e[r];this.render(u)}}destroy(){this.textures=Object.create(null),this.fillStyles=[],this.renderTextures.forEach(n=>n.destroy(!0)),this.renderContainers.forEach(n=>n.destroy({children:!0})),this.spriteTextures.destroy()}}class od{constructor(n){this.renderContainers=[],this.renderTextures=[],this.idTidMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.renderer=n}render(n){const{items:e,width:r,height:s}=n,u=Li.create({width:r,height:s,resolution:Math.ceil(this.renderer.resolution)});this.renderTextures.push(u);const h=new Ri;e.forEach(y=>{const b=new Nr;b.texture=y.item.texture,b.x=y.x+2,b.y=y.y+2,h.addChild(b)});const f=new ps;f.drawRect(0,0,r,s),h.addChild(f),this.renderer.render(h,{renderTexture:u}),this.renderContainers.push(h),e.forEach(y=>{const b=y.item.padding;this.textures[y.item.id]={texture:new qn(u.baseTexture,new dr(y.x+2+b,y.y+2+b,y.width-4-2*b,y.height-4-2*b)),pivot:y.item.pivot}})}getGraphicsData(n){const e=this.idTidMap[n]||"";return this.textures[e]||null}addGraphics(n,e,r,s,u,h,f,y){var b,T;const P=y||Is(),j=Nu()(e+((T=(b=h==null?void 0:h.width)===null||b===void 0?void 0:b.toString())!==null&&T!==void 0?T:0)+f);if(this.idTidMap[P]=j,this.graphics.findIndex(G=>G.id===j)<0){const{texture:G,pivot:V,padding:K}=function(_t,Tt,jt,de,Ne,Nt=!0){var ue;const $t={x:Math.abs(Ne.x),y:Math.abs(Ne.y)},ie=window.devicePixelRatio,Je=document.createElement("canvas"),he=Je.getContext("2d");if(!he)throw new Error("ctx");he.lineCap=(de==null?void 0:de.cap)||"butt",he.lineJoin=(de==null?void 0:de.join)||"miter";let oe=0,Ae=0,nn=0,on=0,$n=0,nr="none",$e="none";const Ue=(ue=de==null?void 0:de.width)!==null&&ue!==void 0?ue:0;return Nt?(oe=Tt,Ae=jt,$n=0,$e="#ffffff"):(nr="#ff0000",$n=Ue,nn=.5*Ue,on=.5*Ue,oe=Tt+Ue,Ae=jt+Ue,$t.x+=.5*Ue,$t.y+=.5*Ue),oe+=Math.abs(Ne.x),Ae+=Math.abs(Ne.y),nn+=Math.abs(Ne.x),on+=Math.abs(Ne.y),oe+=4,Ae+=4,nn+=2,on+=2,nn*=ie,on*=ie,oe=Math.ceil(oe*ie),Ae=Math.ceil(Ae*ie),Je.width=oe,Je.height=Ae,he.transform(ie,0,0,ie,nn,on),_t.forEach(Cn=>{he.lineWidth=$n,he.strokeStyle=nr,Cn.fill!=="none"&&(he.fillStyle=$e),(de==null?void 0:de.dash)&&he.setLineDash(de.dash.split(",").map(Dr=>Number(Dr.trim()))),he.beginPath();const{scale:kn}=Cn,wr=Cn.path.trim().split(" ");let Ar={x:0,y:0};for(let Dr=0;Dr<wr.length;Dr+=2){const pi=wr[Dr],Ji=wr[Dr+1];if(pi==="M"){let[jr,Zr]=Ji.split(",").map(Ai=>Number(Ai));Ar={x:jr,y:Zr},jr=jr/9525*kn.x,Zr=Zr/9525*kn.y,he.moveTo(jr,Zr)}else if(pi==="A"){const[jr,Zr,Ai,xr]=Ji.split(",").map(so=>Number(so));Ar=Fu(Ar,kn,jr,Zr,Ai,xr,he)}else if(pi==="L"){let[jr,Zr]=Ji.split(",").map(Ai=>Number(Ai));Ar={x:jr,y:Zr},jr=jr/9525*kn.x,Zr=Zr/9525*kn.y,he.lineTo(jr,Zr)}else if(pi==="QB"){let[jr,Zr,Ai,xr]=Ji.split(",").map(so=>Number(so));Ar={x:Ai,y:xr},jr=jr/9525*kn.x,Zr=Zr/9525*kn.y,Ai=Ai/9525*kn.x,xr=xr/9525*kn.y,he.quadraticCurveTo(jr,Zr,Ai,xr)}else if(pi==="CB"){let[jr,Zr,Ai,xr,so,Hi]=Ji.split(",").map(Sr=>Number(Sr));Ar={x:so,y:Hi},jr=jr/9525*kn.x,Zr=Zr/9525*kn.y,Ai=Ai/9525*kn.x,xr=xr/9525*kn.y,so=so/9525*kn.x,Hi=Hi/9525*kn.y,he.bezierCurveTo(jr,Zr,Ai,xr,so,Hi)}else pi==="C"&&he.closePath()}Cn.hasStroke&&$n>0&&he.stroke(),Cn.fill!=="none"&&Nt&&he.fill("nonzero")}),{texture:new qn(new Jn(Je,{width:Je.width/2,height:Je.height/2,resolution:ie})),pivot:$t,padding:2}}(n,s,u,h,r,f);this.graphics.push({id:j,texture:G,pivot:V,width:G.width,height:G.height,padding:K})}return P}pack(){this.graphics.forEach(n=>{n.width+=4,n.height+=4}),Vc(this.graphics).forEach(n=>{this.render(n)}),this.graphics.forEach(n=>{n.texture.destroy(!0)}),this.graphics=[]}destroy(){Object.keys(this.textures).forEach(n=>{var e;(e=this.textures[n])===null||e===void 0||e.texture.destroy()}),this.textures=Object.create(null),this.graphics=[],this.renderContainers.forEach(n=>n.destroy({children:!0,baseTexture:!0,texture:!0})),this.renderTextures.forEach(n=>n.destroy(!0))}}var If=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Em{constructor(n){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.isLoaded=!1,this.loader=n}getTexture(n){return this.textures[n]||null}getFrameData(n){return this.frames[n]}getGifFrames(n){return this.gifs[n]?this.gifs[n].filter(e=>!!e):[]}loadSpriteSheetItem(n,e,r){return If(this,void 0,void 0,function*(){const s=yield this.loader.fetchJson(`${n}/${e}/jsonOutput/${r}.json`),u=yield this.loader.fetchPng(`${n}/${e}/jsonOutput/${r}.png`),h=document.createElement("img");h.src=u,yield new Promise((b,T)=>{h.onload=()=>b(""),h.onerror=()=>T()});const f=new Jn(h),y=new Hd(f,s);yield new Promise(b=>{y.parse(()=>b(""))}),this.spriteSheets.push(y),Object.keys(y.textures).forEach(b=>{const T=b.match(/^(.+)_gif_(\d+)$/);if(T&&T[1]&&T[2]){const P=T[1];this.gifs[P]||(this.gifs[P]=[]);const j=parseInt(T[2],10);this.gifs[P][j]=y.textures[b]}else this.frames[b]=s.frames[b],this.textures[b]=y.textures[b]})})}loadSpriteSheets(n,e,r){return this.isLoaded?Promise.resolve([]):(this.isLoaded=!0,Promise.all(n.map(s=>this.loadSpriteSheetItem(e,r,s))))}destroy(){this.isLoaded=!1,this.spriteSheets.forEach(n=>n.destroy(!0))}}class Lf extends J.a{constructor(){super(),this.prevTime=-1,this.times=0,this.valueTotal=0,this.destroyed=!1,this.value=0,this.calcFps()}calcFps(){requestAnimationFrame(n=>{const e=n-this.prevTime;this.valueTotal+=e,this.times+=1,this.times>20&&(this.value=Math.floor(800*this.times/this.valueTotal),this.valueTotal=0,this.times=0,this.destroyed||this.emit("update",this.value)),this.prevTime=n,this.destroyed||this.calcFps()})}destroy(){this.destroyed=!0}}var $h=S(10),ip=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Of{constructor(n){this.useCache=!1,this.useCache=n}bindTask(n){this.taskId=n,this.useCache&&(this.cache=$h.createInstance({name:"_slide_local_cache_",storeName:this.taskId,driver:$h.INDEXEDDB,version:1}),this.cache.clear().catch(()=>{}))}fetchJson(n){var e,r;return ip(this,void 0,void 0,function*(){let s=yield(e=this.cache)===null||e===void 0?void 0:e.getItem(n);return s&&this.useCache||(s=yield(yield fetch(n)).json(),this.useCache&&(yield(r=this.cache)===null||r===void 0?void 0:r.setItem(n,s))),s})}fetchPng(n){var e,r;return ip(this,void 0,void 0,function*(){let s=yield(e=this.cache)===null||e===void 0?void 0:e.getItem(n);if(s&&this.useCache)return s;if(s=yield fetch(n).then(u=>u.blob()).then(u=>new Promise((h,f)=>{const y=new FileReader;y.onload=()=>{h(y.result)},y.onerror=()=>{f(new Error(`fetch ${n} failed`))},y.readAsDataURL(u)})),this.useCache&&(yield(r=this.cache)===null||r===void 0?void 0:r.setItem(n,s)),!s)throw new Error(`fetch ${n} failed`);return s})}destroy(){var n;(n=this.cache)===null||n===void 0||n.clear().catch(()=>{})}}class Df{constructor(){this.runningTimeNodes={}}addRunningTimeNode(n,e,r){const s=`${e}_${n}`;if(this.runningTimeNodes[s])try{this.runningTimeNodes[s].dispose(!0)}catch{}this.runningTimeNodes[s]=r}}var Nf=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Ff{constructor(n){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=e=>{const r=e/(Bt.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=r,this.callbackList=this.callbackList.filter(u=>u&&!u.applied);let{length:s}=this.callbackList;for(let u=0;u<s;u++){const h=this.callbackList[u];if(h&&!h.applied){if(!(h.triggerTime<=this.timestamp))break;h.fn(),h.applied=!0,s=this.callbackList.length}}}},this.ticker=n,this.ticker.add(this.onTimeUpdate)}setTimeout(n,e){const r=Is(),s=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:n,triggerTime:s,id:r,applied:!1}),this.callbackList.sort((u,h)=>u.triggerTime-h.triggerTime),r}clearTimeout(n){const e=this.callbackList.findIndex(r=>r.id===n);e>=0&&this.callbackList.splice(e,1)}delay(n){return new Promise(e=>{this.setTimeout(e,n)})}waitUntil(n,e){return Nf(this,void 0,void 0,function*(){const r=this.timestamp;for(;!n()&&this.timestamp-r<e;)yield this.delay(50)})}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var Gu=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};W.skipHello();const ef={randomBar:"RandomLines",circle:"Shape",ripple:"Ripples",wipe:"Erase",dissolve:"Dissolve",morph:"Smooth",fade:"FadeInOut",push:"Push",split:"Separation",reveal:"Display",pull:"Uncover",cover:"Cover",flash:"Flash",checker:"Checkerboard",blinds:"WindowShades",curtains:"Curtain",fallOver:"Fall",drape:"Suspension",wheel:"Clock",comb:"Combing",warp:"Scale",peelOff:"PeelOff",flip:"Flip"};class Bf{constructor(n){this.eventHub=n,this.targets=Object.create(null)}addTarget(n,e){this.targets[n]=e}getTargetById(n){return this.targets[n]}getTarget(n,e,r={type:"el",index:0,id:""}){var s,u;let h=this.targets[n.id];return n.type!=="shape"?h:(n.type==="shape"&&n.txEl&&(h=(s=h==null?void 0:h.getTextElement(n.txEl.type,n.txEl.range))!==null&&s!==void 0?s:null),n.type==="shape"&&n.bg&&r.index===0&&(e=!1,h=(u=h==null?void 0:h.getBgElement())!==null&&u!==void 0?u:null,this.eventHub.emit("IterateTimeNodeEnd",r.id)),e&&h?h.getIterateEntry(r.type,r.index,r.id):h)}clearTargets(){this.targets=Object.create(null)}}const Pn={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqNext:"interactiveSeqNext",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",slideChange:"slideChange",renderStart:"renderStart",renderEnd:"renderEnd",hyperlinkTrigger:"hyperlinkTrigger",animateStart:"animateStart",animateEnd:"animateEnd",mediaSeek:"mediaSeek",mediaPlay:"mediaPlay",mediaPause:"mediaPause",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide"};class di extends J.a{constructor(n,e={}){super(),this.loader=new Of(!1),this.transactionPlayer=new ct.TransactionPlayer,this.transactionSprite=new Nr,this.isForward=!0,this.drawCall=0,this.scale=1,this.fps=new Lf,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.mode=n,this.config={minFPS:Object(X.isUndefined)(e.minFPS)?30:e.minFPS,maxFPS:Object(X.isUndefined)(e.maxFPS)?40:e.maxFPS,resolution:Object(X.isUndefined)(e.resolution)?window.devicePixelRatio:e.resolution,autoFPS:!Object(X.isUndefined)(e.autoFPS)&&e.autoFPS,autoResolution:!Object(X.isUndefined)(e.autoResolution)&&e.autoResolution,transactionBgColor:Object(X.isUndefined)(e.transactionBgColor)?0:e.transactionBgColor},this.app=new ar({antialias:!0,autoDensity:!1,backgroundColor:16777215}),this.updateConfig(this.config),this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const r=this.app.renderer,{drawElements:s}=r.gl;r.gl.drawElements=(...u)=>{s.call(r.gl,...u),this.drawCall+=1},this.fps.on("update",u=>{if(u<this.config.minFPS){if(this.config.autoResolution){const h=this.scale*this.config.resolution*.7,f=this.app.renderer.resolution,y=Math.max(h,f-.1);y>=h&&this.updateResolution(y)}if(this.config.autoFPS){const h=14,{minFPS:f,maxFPS:y}=this.app.ticker,b=Math.max(h,f-2),T=Math.max(h,y-2);b>=h&&T>=h&&(this.app.ticker.minFPS=b,this.app.ticker.maxFPS=T)}}else if(u>this.config.maxFPS){if(this.config.autoResolution){const h=this.scale*this.config.resolution,f=this.app.renderer.resolution,y=Math.min(h,f+.1);y<=this.config.resolution&&this.updateResolution(y)}if(this.config.autoFPS){const h=this.config.minFPS,f=this.config.maxFPS,{minFPS:y,maxFPS:b}=this.app.ticker,T=Math.min(h,y+2),P=Math.min(f,b+2);T<=h&&P<=f&&(this.app.ticker.minFPS=T,this.app.ticker.maxFPS=P)}}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,vs.LOW),this.clock=new Ff(this.app.ticker)}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var n;return((n=this.currentStage)===null||n===void 0?void 0:n.json.nextIndex)?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var n;return((n=this.currentStage)===null||n===void 0?void 0:n.json.prevIndex)?this.currentStage.json.prevIndex:this.currentIndex-1}updateConfig(n){Object(X.isUndefined)(n.minFPS)||(this.config.minFPS=n.minFPS,this.app.ticker.minFPS=n.minFPS),Object(X.isUndefined)(n.maxFPS)||(this.config.maxFPS=n.maxFPS,this.app.ticker.maxFPS=n.maxFPS),Object(X.isUndefined)(n.resolution)||(this.config.resolution=n.resolution,this.updateResolution(this.scale*this.config.resolution)),Object(X.isUndefined)(n.autoFPS)||(this.config.autoFPS=n.autoFPS),Object(X.isUndefined)(n.autoResolution)||(this.config.autoResolution=n.autoResolution),Object(X.isUndefined)(n.transactionBgColor)||(this.config.transactionBgColor=n.transactionBgColor)}preload(n){return Gu(this,void 0,void 0,function*(){if(n<1||n>this.slideCount||!this.loader.cache)return;const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${n}.json`),{sheets:r}=e;for(const s of r)yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/${s}.json`),yield this.loader.fetchPng(`${this.url}/${this.taskId}/jsonOutput/${s}.png`)})}setResourceData(n,e){this.taskId=n,this.url=e,this.loader.bindTask(n)}setInteractive(n){this.app.stage.interactive=n,this.app.stage.interactiveChildren=n}loadSlide(n){return Gu(this,void 0,void 0,function*(){const e=new Em(this.loader),r=new J.a,s={mode:this.mode,renderer:this.app.renderer,graphicsTexture:new od(this.app.renderer),fillTexture:new id(this.app.renderer,e),stageWidth:0,stageHeight:0,ticker:this.app.ticker,timingTargets:new Bf(r),eventHub:r,view:this.app.view,medias:Object.create(null),lastViewedIndex:this.currentIndex,conflictTimeNodeManager:new Df,clock:this.clock},u=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${n}.json`),{width:h,height:f,sheets:y}=u;yield e.loadSpriteSheets(y,this.url,this.taskId),s.stageWidth=h,s.stageHeight=f;const b=new ig(u,s,{x:0,y:0});return this.translateEvent(s.eventHub,[Pn.mainSeqStepChange,Pn.mainSeqStateChange,Pn.hyperlinkTrigger,Pn.interactiveSeqNext,Pn.mainSeqStepStart,Pn.mainSeqStepEnd,Pn.animateStart,Pn.animateEnd,Pn.mediaPlay,Pn.mediaPause,Pn.mediaSeek,Pn.requestGotoSlide,Pn.requestNextSlide,Pn.requestPrevSlide,Pn.interactiveSeqStateChange]),b.preRender(),s.fillTexture.pack(),s.graphicsTexture.pack(),{stage:b,json:u}})}translateEvent(n,e){e.forEach(r=>{n.on(r,(...s)=>{this.emit(r,...s)})})}renderSlide(n){return Gu(this,void 0,void 0,function*(){this.emit(Pn.renderStart,n);const e=yield this.loadSlide(n);this.currentIndex=Number(n);const{width:r,height:s,slideCount:u}=e.json;let h;this.slideCount=u,this.designWidth=r,this.designHeight=s,this.currentStage&&(e.json.transition&&e.json.transition.type&&(h=this.getBase64(this.currentStage)),this.prevStage=this.currentStage),this.currentStage=e,yield e.stage.render(),e.stage.createTiming(),e.stage.container.visible=!0,e.stage.collectMainSeqStartValue(),this.isForward?e.stage.setMainSeqStep(0,"start"):e.stage.setMainSeqStep(-1,"end");const f=this.getBase64(this.currentStage);e.stage.container.visible=!1,this.app.stage.addChild(e.stage.container),h&&f&&e.json.transition&&e.json.transition.type&&(yield this.playTransaction(h,f,e.json.transition)),this.prevStage&&(this.app.stage.removeChild(this.prevStage.stage.container),this.prevStage.stage.destroy(),this.prevStage=void 0),this.isForward?yield e.stage.startTiming():e.stage.setMainSeqApplied(),this.updateResolution(this.config.resolution*this.scale),e.stage.container.visible=!0,this.emit(Pn.renderEnd,n),this.emit(Pn.slideChange,n),this.preload(n+1).catch(()=>{}),this.preload(n-1).catch(()=>{})})}getBase64(n){const e=Li.create({width:this.designWidth,height:this.designHeight,resolution:Math.ceil(this.app.renderer.resolution)});this.app.renderer.render(n.stage.container,{renderTexture:e});const r=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(),r}getPreviewImage(n){return Gu(this,void 0,void 0,function*(){if(n<1||n>this.slideCount)return null;const e=yield this.loadSlide(n);yield e.stage.render(),e.stage.container.visible=!0;const r=this.getBase64(e);return e.stage.destroy(),r})}playTransaction(n,e,r){return Gu(this,void 0,void 0,function*(){const s=this.app.view.parentElement;if(n&&e&&s&&ef[r.type]&&this.transactionPlayer){this.transactionSprite.zIndex=999,this.app.stage.addChild(this.transactionSprite);const u=this.transactionPlayer.renderer.domElement,h=qn.from(u),f=()=>h.update();return setTimeout(()=>{this.app.ticker.add(f)}),this.transactionSprite.texture=h,new Promise(y=>{var b,T,P;(b=this.transactionPlayer)===null||b===void 0||b.play({reverse:!this.isForward,prevTextureUrl:n,nextTextureUrl:e,textureWidth:this.designWidth,textureHeight:this.designHeight,presetType:ef[r.type],stageWidth:this.designWidth,stageHeight:this.designHeight,duration:(P=(T=this.currentStage)===null||T===void 0?void 0:T.json.transition)===null||P===void 0?void 0:P.dur,delay:0,clearColor:this.config.transactionBgColor,onTransactionEnd:()=>{y(),this.app.stage.removeChild(this.transactionSprite),this.app.ticker.remove(f)}})})}return Promise.resolve()})}scaleView(n,e=!1){this.scale=n;const r=this.scale*this.config.resolution;this.view&&(this.view.style.width=Math.floor(this.designWidth*this.scale)+"px",this.view.style.height=Math.floor(this.designHeight*this.scale)+"px"),e&&this.updateResolution(r)}updateResolution(n){this.app.ticker.addOnce(()=>{this.app.renderer.resolution=n,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight)})}nextStep(){var n;(n=this.currentStage)===null||n===void 0||n.stage.nextStep()}prevStep(){var n;(n=this.currentStage)===null||n===void 0||n.stage.prevStep()}mainSeqLength(){var n,e;return(e=(n=this.currentStage)===null||n===void 0?void 0:n.stage.mainSeqLength())!==null&&e!==void 0?e:0}mainSeqStep(){var n,e;return(e=(n=this.currentStage)===null||n===void 0?void 0:n.stage.mainSeqStep())!==null&&e!==void 0?e:0}setMainSeqStep(n,e){var r;(r=this.currentStage)===null||r===void 0||r.stage.setMainSeqStep(n,e)}mainSeqState(){var n,e;return(e=(n=this.currentStage)===null||n===void 0?void 0:n.stage.mainSeqState())!==null&&e!==void 0?e:null}mainSeqHasNextStep(){var n,e;return(e=(n=this.currentStage)===null||n===void 0?void 0:n.stage.mainSeqHasNextStep())!==null&&e!==void 0&&e}mainSeqHasPrevStep(){var n,e;return(e=(n=this.currentStage)===null||n===void 0?void 0:n.stage.mainSeqHasPrevStep())!==null&&e!==void 0&&e}nextTick(n){this.app.ticker.addOnce(()=>{n()},vs.LOW)}applyInteractiveAction(n){var e;(e=this.currentStage)===null||e===void 0||e.stage.applyInteractiveAction(n)}seekInteractiveSeqToEnd(n){var e;(e=this.currentStage)===null||e===void 0||e.stage.seekInteractiveSeqToEnd(n)}setInteractiveSeqState(n,e,r){var s;(s=this.currentStage)===null||s===void 0||s.stage.setInteractiveSeqState(n,e,r)}setMediaState(n,e){var r;return Gu(this,void 0,void 0,function*(){yield(r=this.currentStage)===null||r===void 0?void 0:r.stage.setMediaState(n,e)})}setMediaCurrentTime(n,e){var r;(r=this.currentStage)===null||r===void 0||r.stage.setMediaCurrentTime(n,e)}pause(){this.app.ticker.stop()}resume(){this.app.ticker.start()}getSnapshot(){return this.currentStage?this.getBase64(this.currentStage):""}destroy(){var n;this.prevStage&&this.prevStage.stage.destroy(),this.currentStage&&this.currentStage.stage.destroy(),(n=this.transactionPlayer)===null||n===void 0||n.destroy(),this.loader.destroy(),this.fps.destroy();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch{}this.app.destroy(!0,{children:!1,texture:!0,baseTexture:!0})}}var Js,Hu=[],nf="ResizeObserver loop completed with undelivered notifications.";(function(o){o.BORDER_BOX="border-box",o.CONTENT_BOX="content-box",o.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Js||(Js={}));var rf,Vo=function(o){return Object.freeze(o)},Kh=function(o,n){this.inlineSize=o,this.blockSize=n,Vo(this)},of=function(){function o(n,e,r,s){return this.x=n,this.y=e,this.width=r,this.height=s,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Vo(this)}return o.prototype.toJSON=function(){var n=this;return{x:n.x,y:n.y,top:n.top,right:n.right,bottom:n.bottom,left:n.left,width:n.width,height:n.height}},o.fromRect=function(n){return new o(n.x,n.y,n.width,n.height)},o}(),Qh=function(o){return o instanceof SVGElement&&"getBBox"in o},kf=function(o){if(Qh(o)){var n=o.getBBox(),e=n.width,r=n.height;return!e&&!r}var s=o,u=s.offsetWidth,h=s.offsetHeight;return!(u||h||o.getClientRects().length)},tc=function(o){var n,e;if(o instanceof Element)return!0;var r=(e=(n=o)===null||n===void 0?void 0:n.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(r&&o instanceof r.Element)},Qa=typeof window!="undefined"?window:{},zu=new WeakMap,sd=/auto|scroll/,sg=/^tb|vertical/,ec=/msie|trident/i.test(Qa.navigator&&Qa.navigator.userAgent),ya=function(o){return parseFloat(o||"0")},nc=function(o,n,e){return o===void 0&&(o=0),n===void 0&&(n=0),e===void 0&&(e=!1),new Kh((e?n:o)||0,(e?o:n)||0)},Wo=Vo({devicePixelContentBoxSize:nc(),borderBoxSize:nc(),contentBoxSize:nc(),contentRect:new of(0,0,0,0)}),xa=function(o,n){if(n===void 0&&(n=!1),zu.has(o)&&!n)return zu.get(o);if(kf(o))return zu.set(o,Wo),Wo;var e=getComputedStyle(o),r=Qh(o)&&o.ownerSVGElement&&o.getBBox(),s=!ec&&e.boxSizing==="border-box",u=sg.test(e.writingMode||""),h=!r&&sd.test(e.overflowY||""),f=!r&&sd.test(e.overflowX||""),y=r?0:ya(e.paddingTop),b=r?0:ya(e.paddingRight),T=r?0:ya(e.paddingBottom),P=r?0:ya(e.paddingLeft),j=r?0:ya(e.borderTopWidth),G=r?0:ya(e.borderRightWidth),V=r?0:ya(e.borderBottomWidth),K=P+b,_t=y+T,Tt=(r?0:ya(e.borderLeftWidth))+G,jt=j+V,de=f?o.offsetHeight-jt-o.clientHeight:0,Ne=h?o.offsetWidth-Tt-o.clientWidth:0,Nt=s?K+Tt:0,ue=s?_t+jt:0,$t=r?r.width:ya(e.width)-Nt-Ne,ie=r?r.height:ya(e.height)-ue-de,Je=$t+K+Ne+Tt,he=ie+_t+de+jt,oe=Vo({devicePixelContentBoxSize:nc(Math.round($t*devicePixelRatio),Math.round(ie*devicePixelRatio),u),borderBoxSize:nc(Je,he,u),contentBoxSize:nc($t,ie,u),contentRect:new of(P,y,$t,ie)});return zu.set(o,oe),oe},ba=function(o,n,e){var r=xa(o,e),s=r.borderBoxSize,u=r.contentBoxSize,h=r.devicePixelContentBoxSize;switch(n){case Js.DEVICE_PIXEL_CONTENT_BOX:return h;case Js.BORDER_BOX:return s;default:return u}},ag=function(o){var n=xa(o);this.target=o,this.contentRect=n.contentRect,this.borderBoxSize=Vo([n.borderBoxSize]),this.contentBoxSize=Vo([n.contentBoxSize]),this.devicePixelContentBoxSize=Vo([n.devicePixelContentBoxSize])},Mm=function(o){if(kf(o))return 1/0;for(var n=0,e=o.parentNode;e;)n+=1,e=e.parentNode;return n},op=function(){var o=1/0,n=[];Hu.forEach(function(s){if(s.activeTargets.length!==0){var u=[];s.activeTargets.forEach(function(h){var f=new ag(h.target),y=Mm(h.target);u.push(f),h.lastReportedSize=ba(h.target,h.observedBox),y<o&&(o=y)}),n.push(function(){s.callback.call(s.observer,u,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var e=0,r=n;e<r.length;e++)(0,r[e])();return o},Uf=function(o){Hu.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(e){e.isActive()&&(Mm(e.target)>o?n.activeTargets.push(e):n.skippedTargets.push(e))})})},Am=function(){var o,n=0;for(Uf(n);Hu.some(function(e){return e.activeTargets.length>0});)n=op(),Uf(n);return Hu.some(function(e){return e.skippedTargets.length>0})&&(typeof ErrorEvent=="function"?o=new ErrorEvent("error",{message:nf}):((o=document.createEvent("Event")).initEvent("error",!1,!1),o.message=nf),window.dispatchEvent(o)),n>0},Gf=[],Cm=function(o){if(!rf){var n=0,e=document.createTextNode("");new MutationObserver(function(){return Gf.splice(0).forEach(function(r){return r()})}).observe(e,{characterData:!0}),rf=function(){e.textContent=""+(n?n--:n++)}}Gf.push(o),rf()},rc=0,ju={attributes:!0,characterData:!0,childList:!0,subtree:!0},wa=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],sf=function(o){return o===void 0&&(o=0),Date.now()+o},af=!1,lf=new(function(){function o(){var n=this;this.stopped=!0,this.listener=function(){return n.schedule()}}return o.prototype.run=function(n){var e=this;if(n===void 0&&(n=250),!af){af=!0;var r,s=sf(n);r=function(){var u=!1;try{u=Am()}finally{if(af=!1,n=s-sf(),!rc)return;u?e.run(1e3):n>0?e.run(n):e.start()}},Cm(function(){requestAnimationFrame(r)})}},o.prototype.schedule=function(){this.stop(),this.run()},o.prototype.observe=function(){var n=this,e=function(){return n.observer&&n.observer.observe(document.body,ju)};document.body?e():Qa.addEventListener("DOMContentLoaded",e)},o.prototype.start=function(){var n=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),wa.forEach(function(e){return Qa.addEventListener(e,n.listener,!0)}))},o.prototype.stop=function(){var n=this;this.stopped||(this.observer&&this.observer.disconnect(),wa.forEach(function(e){return Qa.removeEventListener(e,n.listener,!0)}),this.stopped=!0)},o}()),Hf=function(o){!rc&&o>0&&lf.start(),!(rc+=o)&&lf.stop()},zf=function(){function o(n,e){this.target=n,this.observedBox=e||Js.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return o.prototype.isActive=function(){var n,e=ba(this.target,this.observedBox,!0);return n=this.target,Qh(n)||function(r){switch(r.tagName){case"INPUT":if(r.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(n)||getComputedStyle(n).display!=="inline"||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},o}(),Pm=function(o,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=o,this.callback=n},ad=new WeakMap,jf=function(o,n){for(var e=0;e<o.length;e+=1)if(o[e].target===n)return e;return-1},Vu=function(){function o(){}return o.connect=function(n,e){var r=new Pm(n,e);ad.set(n,r)},o.observe=function(n,e,r){var s=ad.get(n),u=s.observationTargets.length===0;jf(s.observationTargets,e)<0&&(u&&Hu.push(s),s.observationTargets.push(new zf(e,r&&r.box)),Hf(1),lf.schedule())},o.unobserve=function(n,e){var r=ad.get(n),s=jf(r.observationTargets,e),u=r.observationTargets.length===1;s>=0&&(u&&Hu.splice(Hu.indexOf(r),1),r.observationTargets.splice(s,1),Hf(-1))},o.disconnect=function(n){var e=this,r=ad.get(n);r.observationTargets.slice().forEach(function(s){return e.unobserve(n,s.target)}),r.activeTargets.splice(0,r.activeTargets.length)},o}(),Vf=function(){function o(n){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof n!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Vu.connect(this,n)}return o.prototype.observe=function(n,e){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!tc(n))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Vu.observe(this,n,e)},o.prototype.unobserve=function(n){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!tc(n))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Vu.unobserve(this,n)},o.prototype.disconnect=function(){Vu.disconnect(this)},o.toString=function(){return"function ResizeObserver () { [polyfill code] }"},o}(),Rm=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})},Wf=function(o,n){var e,r,s,u,h={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(y){return function(b){return function(T){if(e)throw new TypeError("Generator is already executing.");for(;h;)try{if(e=1,r&&(s=2&T[0]?r.return:T[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,T[1])).done)return s;switch(r=0,s&&(T=[2&T[0],s.value]),T[0]){case 0:case 1:s=T;break;case 4:return h.label++,{value:T[1],done:!1};case 5:h.label++,r=T[1],T=[0];continue;case 7:T=h.ops.pop(),h.trys.pop();continue;default:if(s=h.trys,!((s=s.length>0&&s[s.length-1])||T[0]!==6&&T[0]!==2)){h=0;continue}if(T[0]===3&&(!s||T[1]>s[0]&&T[1]<s[3])){h.label=T[1];break}if(T[0]===6&&h.label<s[1]){h.label=s[1],s=T;break}if(s&&h.label<s[2]){h.label=s[2],h.ops.push(T);break}s[2]&&h.ops.pop(),h.trys.pop();continue}T=n.call(o,h)}catch(P){T=[6,P],r=0}finally{e=s=0}if(5&T[0])throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}([y,b])}}},sp=function(){function o(n,e,r,s,u){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=r,this.index=n,this.slideIndex=e,this.eventHub=s,this.id=u}return o.prototype.apply=function(){return Rm(this,void 0,void 0,function(){var n;return Wf(this,function(e){switch(e.label){case 0:this.eventHub.emit("task-start",this),e.label=1;case 1:return e.trys.push([1,3,,4]),this.state="start",[4,this.fn()];case 2:return e.sent(),this.state="end",this.eventHub.emit("task-end",this),[3,4];case 3:return n=e.sent(),this.eventHub.emit("task-error",{task:this,error:n}),[3,4];case 4:return[2]}})})},o}(),Im=function(){function o(){var n=this;this.eventHub=new J.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",function(e){var r,s=n.tasks.findIndex(function(h){return h.index===e.index}),u=s+1;u>=0&&((r=n.tasks[u])===null||r===void 0||r.apply()),s>=0&&(n.tasks.splice(s,1),n.replaceIdleTask()),n.eventHub.emit("task-end-"+e.id)}),this.eventHub.on("task-error",function(e){var r=e.task,s=n.tasks.findIndex(function(u){return u.index===r.index});s>=0&&(n.tasks.splice(s,1),n.replaceIdleTask())})}return o.prototype.replaceIdleTask=function(){for(var n,e=this,r=new Set,s=0,u=this.tasks.length;s<u;s++)this.tasks[s].state==="idle"&&((n=this.tasks[s+1])===null||n===void 0?void 0:n.state)==="idle"&&r.add(s);Array.from(r).forEach(function(h){e.tasks.splice(h,1)})},o.prototype.addTask=function(n,e,r){var s=new sp(this.index++,e,n,this.eventHub,r);this.tasks.push(s),this.tasks.sort(function(u,h){return u.index-h.index}),this.replaceIdleTask(),this.tasks.length===1&&s.apply()},o.prototype.hasStartTask=function(){return this.tasks.some(function(n){return n.state==="start"})},o}();function Wu(o,n){var e=o.__state.conversionName.toString(),r=Math.round(o.r),s=Math.round(o.g),u=Math.round(o.b),h=o.a,f=Math.round(o.h),y=o.s.toFixed(1),b=o.v.toFixed(1);if(n||e==="THREE_CHAR_HEX"||e==="SIX_CHAR_HEX"){for(var T=o.hex.toString(16);T.length<6;)T="0"+T;return"#"+T}return e==="CSS_RGB"?"rgb("+r+","+s+","+u+")":e==="CSS_RGBA"?"rgba("+r+","+s+","+u+","+h+")":e==="HEX"?"0x"+o.hex.toString(16):e==="RGB_ARRAY"?"["+r+","+s+","+u+"]":e==="RGBA_ARRAY"?"["+r+","+s+","+u+","+h+"]":e==="RGB_OBJ"?"{r:"+r+",g:"+s+",b:"+u+"}":e==="RGBA_OBJ"?"{r:"+r+",g:"+s+",b:"+u+",a:"+h+"}":e==="HSV_OBJ"?"{h:"+f+",s:"+y+",v:"+b+"}":e==="HSVA_OBJ"?"{h:"+f+",s:"+y+",v:"+b+",a:"+h+"}":"unknown format"}var uf=Array.prototype.forEach,ic=Array.prototype.slice,Re={BREAK:{},extend:function(o){return this.each(ic.call(arguments,1),function(n){(this.isObject(n)?Object.keys(n):[]).forEach(function(e){this.isUndefined(n[e])||(o[e]=n[e])}.bind(this))},this),o},defaults:function(o){return this.each(ic.call(arguments,1),function(n){(this.isObject(n)?Object.keys(n):[]).forEach(function(e){this.isUndefined(o[e])&&(o[e]=n[e])}.bind(this))},this),o},compose:function(){var o=ic.call(arguments);return function(){for(var n=ic.call(arguments),e=o.length-1;e>=0;e--)n=[o[e].apply(this,n)];return n[0]}},each:function(o,n,e){if(o){if(uf&&o.forEach&&o.forEach===uf)o.forEach(n,e);else if(o.length===o.length+0){var r,s=void 0;for(s=0,r=o.length;s<r;s++)if(s in o&&n.call(e,o[s],s)===this.BREAK)return}else for(var u in o)if(n.call(e,o[u],u)===this.BREAK)return}},defer:function(o){setTimeout(o,0)},debounce:function(o,n,e){var r=void 0;return function(){var s=this,u=arguments;function h(){r=null,e||o.apply(s,u)}var f=e||!r;clearTimeout(r),r=setTimeout(h,n),f&&o.apply(s,u)}},toArray:function(o){return o.toArray?o.toArray():ic.call(o)},isUndefined:function(o){return o===void 0},isNull:function(o){return o===null},isNaN:function(o){function n(e){return o.apply(this,arguments)}return n.toString=function(){return o.toString()},n}(function(o){return isNaN(o)}),isArray:Array.isArray||function(o){return o.constructor===Array},isObject:function(o){return o===Object(o)},isNumber:function(o){return o===o+0},isString:function(o){return o===o+""},isBoolean:function(o){return o===!1||o===!0},isFunction:function(o){return o instanceof Function}},ap=[{litmus:Re.isString,conversions:{THREE_CHAR_HEX:{read:function(o){var n=o.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return n!==null&&{space:"HEX",hex:parseInt("0x"+n[1].toString()+n[1].toString()+n[2].toString()+n[2].toString()+n[3].toString()+n[3].toString(),0)}},write:Wu},SIX_CHAR_HEX:{read:function(o){var n=o.match(/^#([A-F0-9]{6})$/i);return n!==null&&{space:"HEX",hex:parseInt("0x"+n[1].toString(),0)}},write:Wu},CSS_RGB:{read:function(o){var n=o.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return n!==null&&{space:"RGB",r:parseFloat(n[1]),g:parseFloat(n[2]),b:parseFloat(n[3])}},write:Wu},CSS_RGBA:{read:function(o){var n=o.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return n!==null&&{space:"RGB",r:parseFloat(n[1]),g:parseFloat(n[2]),b:parseFloat(n[3]),a:parseFloat(n[4])}},write:Wu}}},{litmus:Re.isNumber,conversions:{HEX:{read:function(o){return{space:"HEX",hex:o,conversionName:"HEX"}},write:function(o){return o.hex}}}},{litmus:Re.isArray,conversions:{RGB_ARRAY:{read:function(o){return o.length===3&&{space:"RGB",r:o[0],g:o[1],b:o[2]}},write:function(o){return[o.r,o.g,o.b]}},RGBA_ARRAY:{read:function(o){return o.length===4&&{space:"RGB",r:o[0],g:o[1],b:o[2],a:o[3]}},write:function(o){return[o.r,o.g,o.b,o.a]}}}},{litmus:Re.isObject,conversions:{RGBA_OBJ:{read:function(o){return!!(Re.isNumber(o.r)&&Re.isNumber(o.g)&&Re.isNumber(o.b)&&Re.isNumber(o.a))&&{space:"RGB",r:o.r,g:o.g,b:o.b,a:o.a}},write:function(o){return{r:o.r,g:o.g,b:o.b,a:o.a}}},RGB_OBJ:{read:function(o){return!!(Re.isNumber(o.r)&&Re.isNumber(o.g)&&Re.isNumber(o.b))&&{space:"RGB",r:o.r,g:o.g,b:o.b}},write:function(o){return{r:o.r,g:o.g,b:o.b}}},HSVA_OBJ:{read:function(o){return!!(Re.isNumber(o.h)&&Re.isNumber(o.s)&&Re.isNumber(o.v)&&Re.isNumber(o.a))&&{space:"HSV",h:o.h,s:o.s,v:o.v,a:o.a}},write:function(o){return{h:o.h,s:o.s,v:o.v,a:o.a}}},HSV_OBJ:{read:function(o){return!!(Re.isNumber(o.h)&&Re.isNumber(o.s)&&Re.isNumber(o.v))&&{space:"HSV",h:o.h,s:o.s,v:o.v}},write:function(o){return{h:o.h,s:o.s,v:o.v}}}}}],ld=void 0,oc=void 0,lp=function(){oc=!1;var o=arguments.length>1?Re.toArray(arguments):arguments[0];return Re.each(ap,function(n){if(n.litmus(o))return Re.each(n.conversions,function(e,r){if(ld=e.read(o),oc===!1&&ld!==!1)return oc=ld,ld.conversionName=r,ld.conversion=e,Re.BREAK}),Re.BREAK}),oc},hf=void 0,up={hsv_to_rgb:function(o,n,e){var r=Math.floor(o/60)%6,s=o/60-Math.floor(o/60),u=e*(1-n),h=e*(1-s*n),f=e*(1-(1-s)*n),y=[[e,f,u],[h,e,u],[u,e,f],[u,h,e],[f,u,e],[e,u,h]][r];return{r:255*y[0],g:255*y[1],b:255*y[2]}},rgb_to_hsv:function(o,n,e){var r=Math.min(o,n,e),s=Math.max(o,n,e),u=s-r,h=void 0;return s===0?{h:NaN,s:0,v:0}:(h=o===s?(n-e)/u:n===s?2+(e-o)/u:4+(o-n)/u,(h/=6)<0&&(h+=1),{h:360*h,s:u/s,v:s/255})},rgb_to_hex:function(o,n,e){var r=this.hex_with_component(0,2,o);return r=this.hex_with_component(r,1,n),r=this.hex_with_component(r,0,e)},component_from_hex:function(o,n){return o>>8*n&255},hex_with_component:function(o,n,e){return e<<(hf=8*n)|o&~(255<<hf)}},lg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},tl=function(o,n){if(!(o instanceof n))throw new TypeError("Cannot call a class as a function")},Sa=function(){function o(n,e){for(var r=0;r<e.length;r++){var s=e[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(n,s.key,s)}}return function(n,e,r){return e&&o(n.prototype,e),r&&o(n,r),n}}(),ou=function o(n,e,r){n===null&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,e);if(s===void 0){var u=Object.getPrototypeOf(n);return u===null?void 0:o(u,e,r)}if("value"in s)return s.value;var h=s.get;return h!==void 0?h.call(r):void 0},su=function(o,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof n);o.prototype=Object.create(n&&n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(o,n):o.__proto__=n)},au=function(o,n){if(!o)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||typeof n!="object"&&typeof n!="function"?o:n},oo=function(){function o(){if(tl(this,o),this.__state=lp.apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return Sa(o,[{key:"toString",value:function(){return Wu(this)}},{key:"toHexString",value:function(){return Wu(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),o}();function Xf(o,n,e){Object.defineProperty(o,n,{get:function(){return this.__state.space==="RGB"||oo.recalculateRGB(this,n,e),this.__state[n]},set:function(r){this.__state.space!=="RGB"&&(oo.recalculateRGB(this,n,e),this.__state.space="RGB"),this.__state[n]=r}})}function qf(o,n){Object.defineProperty(o,n,{get:function(){return this.__state.space==="HSV"||oo.recalculateHSV(this),this.__state[n]},set:function(e){this.__state.space!=="HSV"&&(oo.recalculateHSV(this),this.__state.space="HSV"),this.__state[n]=e}})}oo.recalculateRGB=function(o,n,e){if(o.__state.space==="HEX")o.__state[n]=up.component_from_hex(o.__state.hex,e);else{if(o.__state.space!=="HSV")throw new Error("Corrupted color state");Re.extend(o.__state,up.hsv_to_rgb(o.__state.h,o.__state.s,o.__state.v))}},oo.recalculateHSV=function(o){var n=up.rgb_to_hsv(o.r,o.g,o.b);Re.extend(o.__state,{s:n.s,v:n.v}),Re.isNaN(n.h)?Re.isUndefined(o.__state.h)&&(o.__state.h=0):o.__state.h=n.h},oo.COMPONENTS=["r","g","b","h","s","v","hex","a"],Xf(oo.prototype,"r",2),Xf(oo.prototype,"g",1),Xf(oo.prototype,"b",0),qf(oo.prototype,"h"),qf(oo.prototype,"s"),qf(oo.prototype,"v"),Object.defineProperty(oo.prototype,"a",{get:function(){return this.__state.a},set:function(o){this.__state.a=o}}),Object.defineProperty(oo.prototype,"hex",{get:function(){return this.__state.space!=="HEX"&&(this.__state.hex=up.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(o){this.__state.space="HEX",this.__state.hex=o}});var wl=function(){function o(n,e){tl(this,o),this.initialValue=n[e],this.domElement=document.createElement("div"),this.object=n,this.property=e,this.__onChange=void 0,this.__onFinishChange=void 0}return Sa(o,[{key:"onChange",value:function(n){return this.__onChange=n,this}},{key:"onFinishChange",value:function(n){return this.__onFinishChange=n,this}},{key:"setValue",value:function(n){return this.object[this.property]=n,this.__onChange&&this.__onChange.call(this,n),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),o}(),cf={};Re.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(o,n){Re.each(o,function(e){cf[e]=n})});var Lm=/(\d+(\.\d+)?)px/;function el(o){if(o==="0"||Re.isUndefined(o))return 0;var n=o.match(Lm);return Re.isNull(n)?0:parseFloat(n[1])}var re={makeSelectable:function(o,n){o!==void 0&&o.style!==void 0&&(o.onselectstart=n?function(){return!1}:function(){},o.style.MozUserSelect=n?"auto":"none",o.style.KhtmlUserSelect=n?"auto":"none",o.unselectable=n?"on":"off")},makeFullscreen:function(o,n,e){var r=e,s=n;Re.isUndefined(s)&&(s=!0),Re.isUndefined(r)&&(r=!0),o.style.position="absolute",s&&(o.style.left=0,o.style.right=0),r&&(o.style.top=0,o.style.bottom=0)},fakeEvent:function(o,n,e,r){var s=e||{},u=cf[n];if(!u)throw new Error("Event type "+n+" not supported.");var h=document.createEvent(u);switch(u){case"MouseEvents":var f=s.x||s.clientX||0,y=s.y||s.clientY||0;h.initMouseEvent(n,s.bubbles||!1,s.cancelable||!0,window,s.clickCount||1,0,0,f,y,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var b=h.initKeyboardEvent||h.initKeyEvent;Re.defaults(s,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),b(n,s.bubbles||!1,s.cancelable,window,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.keyCode,s.charCode);break;default:h.initEvent(n,s.bubbles||!1,s.cancelable||!0)}Re.defaults(h,r),o.dispatchEvent(h)},bind:function(o,n,e,r){var s=r||!1;return o.addEventListener?o.addEventListener(n,e,s):o.attachEvent&&o.attachEvent("on"+n,e),re},unbind:function(o,n,e,r){var s=r||!1;return o.removeEventListener?o.removeEventListener(n,e,s):o.detachEvent&&o.detachEvent("on"+n,e),re},addClass:function(o,n){if(o.className===void 0)o.className=n;else if(o.className!==n){var e=o.className.split(/ +/);e.indexOf(n)===-1&&(e.push(n),o.className=e.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return re},removeClass:function(o,n){if(n)if(o.className===n)o.removeAttribute("class");else{var e=o.className.split(/ +/),r=e.indexOf(n);r!==-1&&(e.splice(r,1),o.className=e.join(" "))}else o.className=void 0;return re},hasClass:function(o,n){return new RegExp("(?:^|\\s+)"+n+"(?:\\s+|$)").test(o.className)||!1},getWidth:function(o){var n=getComputedStyle(o);return el(n["border-left-width"])+el(n["border-right-width"])+el(n["padding-left"])+el(n["padding-right"])+el(n.width)},getHeight:function(o){var n=getComputedStyle(o);return el(n["border-top-width"])+el(n["border-bottom-width"])+el(n["padding-top"])+el(n["padding-bottom"])+el(n.height)},getOffset:function(o){var n=o,e={left:0,top:0};if(n.offsetParent)do e.left+=n.offsetLeft,e.top+=n.offsetTop,n=n.offsetParent;while(n);return e},isActive:function(o){return o===document.activeElement&&(o.type||o.href)}},Yf=function(o){function n(e,r){tl(this,n);var s=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r)),u=s;return s.__prev=s.getValue(),s.__checkbox=document.createElement("input"),s.__checkbox.setAttribute("type","checkbox"),re.bind(s.__checkbox,"change",function(){u.setValue(!u.__prev)},!1),s.domElement.appendChild(s.__checkbox),s.updateDisplay(),s}return su(n,o),Sa(n,[{key:"setValue",value:function(e){var r=ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),r}},{key:"updateDisplay",value:function(){return this.getValue()===!0?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"updateDisplay",this).call(this)}}]),n}(wl),Om=function(o){function n(e,r,s){tl(this,n);var u=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r)),h=s,f=u;if(u.__select=document.createElement("select"),Re.isArray(h)){var y={};Re.each(h,function(b){y[b]=b}),h=y}return Re.each(h,function(b,T){var P=document.createElement("option");P.innerHTML=T,P.setAttribute("value",b),f.__select.appendChild(P)}),u.updateDisplay(),re.bind(u.__select,"change",function(){var b=this.options[this.selectedIndex].value;f.setValue(b)}),u.domElement.appendChild(u.__select),u}return su(n,o),Sa(n,[{key:"setValue",value:function(e){var r=ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),r}},{key:"updateDisplay",value:function(){return re.isActive(this.__select)?this:(this.__select.value=this.getValue(),ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"updateDisplay",this).call(this))}}]),n}(wl),ug=function(o){function n(e,r){tl(this,n);var s=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r)),u=s;function h(){u.setValue(u.__input.value)}return s.__input=document.createElement("input"),s.__input.setAttribute("type","text"),re.bind(s.__input,"keyup",h),re.bind(s.__input,"change",h),re.bind(s.__input,"blur",function(){u.__onFinishChange&&u.__onFinishChange.call(u,u.getValue())}),re.bind(s.__input,"keydown",function(f){f.keyCode===13&&this.blur()}),s.updateDisplay(),s.domElement.appendChild(s.__input),s}return su(n,o),Sa(n,[{key:"updateDisplay",value:function(){return re.isActive(this.__input)||(this.__input.value=this.getValue()),ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"updateDisplay",this).call(this)}}]),n}(wl);function Zf(o){var n=o.toString();return n.indexOf(".")>-1?n.length-n.indexOf(".")-1:0}var Jf=function(o){function n(e,r,s){tl(this,n);var u=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r)),h=s||{};return u.__min=h.min,u.__max=h.max,u.__step=h.step,Re.isUndefined(u.__step)?u.initialValue===0?u.__impliedStep=1:u.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(u.initialValue))/Math.LN10))/10:u.__impliedStep=u.__step,u.__precision=Zf(u.__impliedStep),u}return su(n,o),Sa(n,[{key:"setValue",value:function(e){var r=e;return this.__min!==void 0&&r<this.__min?r=this.__min:this.__max!==void 0&&r>this.__max&&(r=this.__max),this.__step!==void 0&&r%this.__step!=0&&(r=Math.round(r/this.__step)*this.__step),ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"setValue",this).call(this,r)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=Zf(e),this}}]),n}(wl),Sl=function(o){function n(e,r,s){tl(this,n);var u=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r,s));u.__truncationSuspended=!1;var h=u,f=void 0;function y(){h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}function b(P){var j=f-P.clientY;h.setValue(h.getValue()+j*h.__impliedStep),f=P.clientY}function T(){re.unbind(window,"mousemove",b),re.unbind(window,"mouseup",T),y()}return u.__input=document.createElement("input"),u.__input.setAttribute("type","text"),re.bind(u.__input,"change",function(){var P=parseFloat(h.__input.value);Re.isNaN(P)||h.setValue(P)}),re.bind(u.__input,"blur",function(){y()}),re.bind(u.__input,"mousedown",function(P){re.bind(window,"mousemove",b),re.bind(window,"mouseup",T),f=P.clientY}),re.bind(u.__input,"keydown",function(P){P.keyCode===13&&(h.__truncationSuspended=!0,this.blur(),h.__truncationSuspended=!1,y())}),u.updateDisplay(),u.domElement.appendChild(u.__input),u}return su(n,o),Sa(n,[{key:"updateDisplay",value:function(){var e,r,s;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),r=this.__precision,s=Math.pow(10,r),Math.round(e*s)/s),ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"updateDisplay",this).call(this)}}]),n}(Jf);function $f(o,n,e,r,s){return r+(o-n)/(e-n)*(s-r)}var Kf=function(o){function n(e,r,s,u,h){tl(this,n);var f=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r,{min:s,max:u,step:h})),y=f;function b(G){G.preventDefault();var V=y.__background.getBoundingClientRect();return y.setValue($f(G.clientX,V.left,V.right,y.__min,y.__max)),!1}function T(){re.unbind(window,"mousemove",b),re.unbind(window,"mouseup",T),y.__onFinishChange&&y.__onFinishChange.call(y,y.getValue())}function P(G){var V=G.touches[0].clientX,K=y.__background.getBoundingClientRect();y.setValue($f(V,K.left,K.right,y.__min,y.__max))}function j(){re.unbind(window,"touchmove",P),re.unbind(window,"touchend",j),y.__onFinishChange&&y.__onFinishChange.call(y,y.getValue())}return f.__background=document.createElement("div"),f.__foreground=document.createElement("div"),re.bind(f.__background,"mousedown",function(G){document.activeElement.blur(),re.bind(window,"mousemove",b),re.bind(window,"mouseup",T),b(G)}),re.bind(f.__background,"touchstart",function(G){G.touches.length===1&&(re.bind(window,"touchmove",P),re.bind(window,"touchend",j),P(G))}),re.addClass(f.__background,"slider"),re.addClass(f.__foreground,"slider-fg"),f.updateDisplay(),f.__background.appendChild(f.__foreground),f.domElement.appendChild(f.__background),f}return su(n,o),Sa(n,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"updateDisplay",this).call(this)}}]),n}(Jf),Xu=function(o){function n(e,r,s){tl(this,n);var u=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r)),h=u;return u.__button=document.createElement("div"),u.__button.innerHTML=s===void 0?"Fire":s,re.bind(u.__button,"click",function(f){return f.preventDefault(),h.fire(),!1}),re.addClass(u.__button,"button"),u.domElement.appendChild(u.__button),u}return su(n,o),Sa(n,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),n}(wl),Qf=function(o){function n(e,r){tl(this,n);var s=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r));s.__color=new oo(s.getValue()),s.__temp=new oo(0);var u=s;s.domElement=document.createElement("div"),re.makeSelectable(s.domElement,!1),s.__selector=document.createElement("div"),s.__selector.className="selector",s.__saturation_field=document.createElement("div"),s.__saturation_field.className="saturation-field",s.__field_knob=document.createElement("div"),s.__field_knob.className="field-knob",s.__field_knob_border="2px solid ",s.__hue_knob=document.createElement("div"),s.__hue_knob.className="hue-knob",s.__hue_field=document.createElement("div"),s.__hue_field.className="hue-field",s.__input=document.createElement("input"),s.__input.type="text",s.__input_textShadow="0 1px 1px ",re.bind(s.__input,"keydown",function(_t){_t.keyCode===13&&j.call(this)}),re.bind(s.__input,"blur",j),re.bind(s.__selector,"mousedown",function(){re.addClass(this,"drag").bind(window,"mouseup",function(){re.removeClass(u.__selector,"drag")})}),re.bind(s.__selector,"touchstart",function(){re.addClass(this,"drag").bind(window,"touchend",function(){re.removeClass(u.__selector,"drag")})});var h,f=document.createElement("div");function y(_t){V(_t),re.bind(window,"mousemove",V),re.bind(window,"touchmove",V),re.bind(window,"mouseup",T),re.bind(window,"touchend",T)}function b(_t){K(_t),re.bind(window,"mousemove",K),re.bind(window,"touchmove",K),re.bind(window,"mouseup",P),re.bind(window,"touchend",P)}function T(){re.unbind(window,"mousemove",V),re.unbind(window,"touchmove",V),re.unbind(window,"mouseup",T),re.unbind(window,"touchend",T),G()}function P(){re.unbind(window,"mousemove",K),re.unbind(window,"touchmove",K),re.unbind(window,"mouseup",P),re.unbind(window,"touchend",P),G()}function j(){var _t=lp(this.value);_t!==!1?(u.__color.__state=_t,u.setValue(u.__color.toOriginal())):this.value=u.__color.toString()}function G(){u.__onFinishChange&&u.__onFinishChange.call(u,u.__color.toOriginal())}function V(_t){_t.type.indexOf("touch")===-1&&_t.preventDefault();var Tt=u.__saturation_field.getBoundingClientRect(),jt=_t.touches&&_t.touches[0]||_t,de=jt.clientX,Ne=jt.clientY,Nt=(de-Tt.left)/(Tt.right-Tt.left),ue=1-(Ne-Tt.top)/(Tt.bottom-Tt.top);return ue>1?ue=1:ue<0&&(ue=0),Nt>1?Nt=1:Nt<0&&(Nt=0),u.__color.v=ue,u.__color.s=Nt,u.setValue(u.__color.toOriginal()),!1}function K(_t){_t.type.indexOf("touch")===-1&&_t.preventDefault();var Tt=u.__hue_field.getBoundingClientRect(),jt=1-((_t.touches&&_t.touches[0]||_t).clientY-Tt.top)/(Tt.bottom-Tt.top);return jt>1?jt=1:jt<0&&(jt=0),u.__color.h=360*jt,u.setValue(u.__color.toOriginal()),!1}return Re.extend(s.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Re.extend(s.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:s.__field_knob_border+(s.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Re.extend(s.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Re.extend(s.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Re.extend(f.style,{width:"100%",height:"100%",background:"none"}),qu(f,"top","rgba(0,0,0,0)","#000"),Re.extend(s.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(h=s.__hue_field).style.background="",h.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",h.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",h.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",h.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",h.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",Re.extend(s.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:s.__input_textShadow+"rgba(0,0,0,0.7)"}),re.bind(s.__saturation_field,"mousedown",y),re.bind(s.__saturation_field,"touchstart",y),re.bind(s.__field_knob,"mousedown",y),re.bind(s.__field_knob,"touchstart",y),re.bind(s.__hue_field,"mousedown",b),re.bind(s.__hue_field,"touchstart",b),s.__saturation_field.appendChild(f),s.__selector.appendChild(s.__field_knob),s.__selector.appendChild(s.__saturation_field),s.__selector.appendChild(s.__hue_field),s.__hue_field.appendChild(s.__hue_knob),s.domElement.appendChild(s.__input),s.domElement.appendChild(s.__selector),s.updateDisplay(),s}return su(n,o),Sa(n,[{key:"updateDisplay",value:function(){var e=lp(this.getValue());if(e!==!1){var r=!1;Re.each(oo.COMPONENTS,function(h){if(!Re.isUndefined(e[h])&&!Re.isUndefined(this.__color.__state[h])&&e[h]!==this.__color.__state[h])return r=!0,{}},this),r&&Re.extend(this.__color.__state,e)}Re.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var s=this.__color.v<.5||this.__color.s>.5?255:0,u=255-s;Re.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+s+","+s+","+s+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,qu(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Re.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+s+","+s+","+s+")",textShadow:this.__input_textShadow+"rgba("+u+","+u+","+u+",.7)"})}}]),n}(wl),tm=["-moz-","-o-","-webkit-","-ms-",""];function qu(o,n,e,r){o.style.background="",Re.each(tm,function(s){o.style.cssText+="background: "+s+"linear-gradient("+n+", "+e+" 0%, "+r+" 100%); "})}var Dm=function(o,n){var e=n||document,r=document.createElement("style");r.type="text/css",r.innerHTML=o;var s=e.getElementsByTagName("head")[0];try{s.appendChild(r)}catch{}},hg=`<div id="dg-save" class="dg dialogue">
6045
+ `),{arg1:e,arg2:r})}}class id{constructor(n,e){this.renderContainers=[],this.renderTextures=[],this.textures=Object.create(null),this.fillStyles=[],this.renderer=n,this.spriteTextures=e}addTexture(n,e){this.textures[n]={texture:e,pivot:{x:0,y:0}}}render(n){const{items:e,width:r,height:s}=n,u=new Ri;e.forEach(y=>{if(y.item.blipFillObject){const{width:b,height:T}=y;y.item.blipFillObject.position.x+=y.x+b/2,y.item.blipFillObject.position.y+=y.y+T/2,y.item.blipFillObject.anchor.x=.5,y.item.blipFillObject.anchor.y=.5,y.item.blipFillObject.rotation=y.item.rotate/180*Math.PI,u.addChild(y.item.blipFillObject)}else{const b=Ka(y.item.fill,y.width-4,y.height-4);if(b)b.position.x+=y.x+2,b.position.y+=y.y+2,u.addChild(b);else{const T=new ps;T.drawRect(0,0,y.width-4,y.height-4),u.addChild(T)}}if(y.item.name){const b=new Ic(y.item.name,{fontFamily:"Arial",fontSize:12,fill:16715792,align:"center"});b.position.x=y.x+2,b.position.y=y.y+2,u.addChild(b)}});const h=new ps;h.drawRect(0,0,Math.ceil(r),Math.ceil(s)),u.addChild(h);const f=Li.create({width:r,height:s,resolution:Math.ceil(this.renderer.resolution)});this.renderTextures.push(f),this.renderContainers.push(u),this.renderer.render(u,{renderTexture:f}),e.forEach(y=>{const b=new qn(f.baseTexture,new dr(y.x+2,y.y+2,y.width-4,y.height-4));this.textures[y.item.id]={texture:b,pivot:y.item.pivot}})}getTexture(n){const e=this.textures[n],r=this.spriteTextures.getTexture(n);return e||(this.spriteTextures.getTexture(n)?{texture:r,pivot:{x:0,y:0}}:{texture:null,pivot:{x:0,y:0}})}getGifFrames(n){return this.spriteTextures.getGifFrames(n)}addFill(n,e,r,s,u=!1){var h;const f=JSON.stringify(n)+e+r,y=Nu()(f);if(this.textures[y]||this.fillStyles.findIndex(b=>b.id===y)>=0)return y;if(n.fillType!=="blipFill"){const b={x:0,y:0};n.fillType==="solidFill"&&(e+=2,r+=2,b.x=1,b.y=1),this.fillStyles.push({fill:n,width:e,height:r,id:y,name:s,pivot:b})}else{const b=this.spriteTextures.getTexture(n.src),T=this.spriteTextures.getFrameData(n.src);if(b){const P=new Nr;P.texture=b,n.filters.length>0&&u&&(P.filters=function(j){const G=[];return j.forEach(V=>{if(V.type==="biLevel")G.push(new rp("biLevel",V.args[0]));else if(V.type==="clrChange"||V.type==="changeBulletColor"){const K=Rs(V.args[0]),_t=Rs(V.args[1]);G.push(new Jh(V.type,K,_t))}else V.type==="alphaModFix"?G.push(new rp(V.type,V.args[0])):V.type==="lum"&&G.push(new rd(V.type,V.args[0],V.args[1]))}),G}(n.filters)),this.fillStyles.push({fill:n,width:(T==null?void 0:T.rotate)?b.height:b.width,height:(T==null?void 0:T.rotate)?b.width:b.height,id:y,blipFillObject:P,pivot:{x:0,y:0},rotate:(h=T==null?void 0:T.rotate)!==null&&h!==void 0?h:0})}}return y}pack(){const n=this.fillStyles.filter(r=>!(!r.fill.fillType||r.fill.fillType==="noFill"||r.width===0||r.height===0)||(this.textures[r.id]={texture:null,pivot:{x:0,y:0}},!1));n.forEach(r=>{r.width+=4,r.height+=4});const e=Vc(n);for(let r=0,s=e.length;r<s;r++){const u=e[r];this.render(u)}}destroy(){this.textures=Object.create(null),this.fillStyles=[],this.renderTextures.forEach(n=>n.destroy(!0)),this.renderContainers.forEach(n=>n.destroy({children:!0})),this.spriteTextures.destroy()}}class od{constructor(n){this.renderContainers=[],this.renderTextures=[],this.idTidMap=Object.create(null),this.textures=Object.create(null),this.graphics=[],this.renderer=n}render(n){const{items:e,width:r,height:s}=n,u=Li.create({width:r,height:s,resolution:Math.ceil(this.renderer.resolution)});this.renderTextures.push(u);const h=new Ri;e.forEach(y=>{const b=new Nr;b.texture=y.item.texture,b.x=y.x+2,b.y=y.y+2,h.addChild(b)});const f=new ps;f.drawRect(0,0,r,s),h.addChild(f),this.renderer.render(h,{renderTexture:u}),this.renderContainers.push(h),e.forEach(y=>{const b=y.item.padding;this.textures[y.item.id]={texture:new qn(u.baseTexture,new dr(y.x+2+b,y.y+2+b,y.width-4-2*b,y.height-4-2*b)),pivot:y.item.pivot}})}getGraphicsData(n){const e=this.idTidMap[n]||"";return this.textures[e]||null}addGraphics(n,e,r,s,u,h,f,y){var b,T;const P=y||Is(),j=Nu()(e+((T=(b=h==null?void 0:h.width)===null||b===void 0?void 0:b.toString())!==null&&T!==void 0?T:0)+f);if(this.idTidMap[P]=j,this.graphics.findIndex(G=>G.id===j)<0){const{texture:G,pivot:V,padding:K}=function(_t,Tt,jt,de,Ne,Nt=!0){var ue;const $t={x:Math.abs(Ne.x),y:Math.abs(Ne.y)},ie=window.devicePixelRatio,Je=document.createElement("canvas"),he=Je.getContext("2d");if(!he)throw new Error("ctx");he.lineCap=(de==null?void 0:de.cap)||"butt",he.lineJoin=(de==null?void 0:de.join)||"miter";let oe=0,Ae=0,nn=0,on=0,$n=0,nr="none",$e="none";const Ue=(ue=de==null?void 0:de.width)!==null&&ue!==void 0?ue:0;return Nt?(oe=Tt,Ae=jt,$n=0,$e="#ffffff"):(nr="#ff0000",$n=Ue,nn=.5*Ue,on=.5*Ue,oe=Tt+Ue,Ae=jt+Ue,$t.x+=.5*Ue,$t.y+=.5*Ue),oe+=Math.abs(Ne.x),Ae+=Math.abs(Ne.y),nn+=Math.abs(Ne.x),on+=Math.abs(Ne.y),oe+=4,Ae+=4,nn+=2,on+=2,nn*=ie,on*=ie,oe=Math.ceil(oe*ie),Ae=Math.ceil(Ae*ie),Je.width=oe,Je.height=Ae,he.transform(ie,0,0,ie,nn,on),_t.forEach(Cn=>{he.lineWidth=$n,he.strokeStyle=nr,Cn.fill!=="none"&&(he.fillStyle=$e),(de==null?void 0:de.dash)&&he.setLineDash(de.dash.split(",").map(Dr=>Number(Dr.trim()))),he.beginPath();const{scale:kn}=Cn,wr=Cn.path.trim().split(" ");let Ar={x:0,y:0};for(let Dr=0;Dr<wr.length;Dr+=2){const pi=wr[Dr],Ji=wr[Dr+1];if(pi==="M"){let[jr,Zr]=Ji.split(",").map(Ai=>Number(Ai));Ar={x:jr,y:Zr},jr=jr/9525*kn.x,Zr=Zr/9525*kn.y,he.moveTo(jr,Zr)}else if(pi==="A"){const[jr,Zr,Ai,xr]=Ji.split(",").map(so=>Number(so));Ar=Fu(Ar,kn,jr,Zr,Ai,xr,he)}else if(pi==="L"){let[jr,Zr]=Ji.split(",").map(Ai=>Number(Ai));Ar={x:jr,y:Zr},jr=jr/9525*kn.x,Zr=Zr/9525*kn.y,he.lineTo(jr,Zr)}else if(pi==="QB"){let[jr,Zr,Ai,xr]=Ji.split(",").map(so=>Number(so));Ar={x:Ai,y:xr},jr=jr/9525*kn.x,Zr=Zr/9525*kn.y,Ai=Ai/9525*kn.x,xr=xr/9525*kn.y,he.quadraticCurveTo(jr,Zr,Ai,xr)}else if(pi==="CB"){let[jr,Zr,Ai,xr,so,Hi]=Ji.split(",").map(Sr=>Number(Sr));Ar={x:so,y:Hi},jr=jr/9525*kn.x,Zr=Zr/9525*kn.y,Ai=Ai/9525*kn.x,xr=xr/9525*kn.y,so=so/9525*kn.x,Hi=Hi/9525*kn.y,he.bezierCurveTo(jr,Zr,Ai,xr,so,Hi)}else pi==="C"&&he.closePath()}Cn.hasStroke&&$n>0&&he.stroke(),Cn.fill!=="none"&&Nt&&he.fill("nonzero")}),{texture:new qn(new Jn(Je,{width:Je.width/2,height:Je.height/2,resolution:ie})),pivot:$t,padding:2}}(n,s,u,h,r,f);this.graphics.push({id:j,texture:G,pivot:V,width:G.width,height:G.height,padding:K})}return P}pack(){this.graphics.forEach(n=>{n.width+=4,n.height+=4}),Vc(this.graphics).forEach(n=>{this.render(n)}),this.graphics.forEach(n=>{n.texture.destroy(!0)}),this.graphics=[]}destroy(){Object.keys(this.textures).forEach(n=>{var e;(e=this.textures[n])===null||e===void 0||e.texture.destroy()}),this.textures=Object.create(null),this.graphics=[],this.renderContainers.forEach(n=>n.destroy({children:!0,baseTexture:!0,texture:!0})),this.renderTextures.forEach(n=>n.destroy(!0))}}var If=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Mm{constructor(n){this.gifs=Object.create(null),this.textures=Object.create(null),this.frames=Object.create(null),this.spriteSheets=[],this.isLoaded=!1,this.loader=n}getTexture(n){return this.textures[n]||null}getFrameData(n){return this.frames[n]}getGifFrames(n){return this.gifs[n]?this.gifs[n].filter(e=>!!e):[]}loadSpriteSheetItem(n,e,r){return If(this,void 0,void 0,function*(){const s=yield this.loader.fetchJson(`${n}/${e}/jsonOutput/${r}.json`),u=yield this.loader.fetchPng(`${n}/${e}/jsonOutput/${r}.png`),h=document.createElement("img");h.src=u,yield new Promise((b,T)=>{h.onload=()=>b(""),h.onerror=()=>T()});const f=new Jn(h),y=new Hd(f,s);yield new Promise(b=>{y.parse(()=>b(""))}),this.spriteSheets.push(y),Object.keys(y.textures).forEach(b=>{const T=b.match(/^(.+)_gif_(\d+)$/);if(T&&T[1]&&T[2]){const P=T[1];this.gifs[P]||(this.gifs[P]=[]);const j=parseInt(T[2],10);this.gifs[P][j]=y.textures[b]}else this.frames[b]=s.frames[b],this.textures[b]=y.textures[b]})})}loadSpriteSheets(n,e,r){return this.isLoaded?Promise.resolve([]):(this.isLoaded=!0,Promise.all(n.map(s=>this.loadSpriteSheetItem(e,r,s))))}destroy(){this.isLoaded=!1,this.spriteSheets.forEach(n=>n.destroy(!0))}}class Lf extends J.a{constructor(){super(),this.prevTime=-1,this.times=0,this.valueTotal=0,this.destroyed=!1,this.value=0,this.calcFps()}calcFps(){requestAnimationFrame(n=>{const e=n-this.prevTime;this.valueTotal+=e,this.times+=1,this.times>20&&(this.value=Math.floor(800*this.times/this.valueTotal),this.valueTotal=0,this.times=0,this.destroyed||this.emit("update",this.value)),this.prevTime=n,this.destroyed||this.calcFps()})}destroy(){this.destroyed=!0}}var $h=S(10),ip=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Of{constructor(n){this.useCache=!1,this.useCache=n}bindTask(n){this.taskId=n,this.useCache&&(this.cache=$h.createInstance({name:"_slide_local_cache_",storeName:this.taskId,driver:$h.INDEXEDDB,version:1}),this.cache.clear().catch(()=>{}))}fetchJson(n){var e,r;return ip(this,void 0,void 0,function*(){let s=yield(e=this.cache)===null||e===void 0?void 0:e.getItem(n);return s&&this.useCache||(s=yield(yield fetch(n)).json(),this.useCache&&(yield(r=this.cache)===null||r===void 0?void 0:r.setItem(n,s))),s})}fetchPng(n){var e,r;return ip(this,void 0,void 0,function*(){let s=yield(e=this.cache)===null||e===void 0?void 0:e.getItem(n);if(s&&this.useCache)return s;if(s=yield fetch(n).then(u=>u.blob()).then(u=>new Promise((h,f)=>{const y=new FileReader;y.onload=()=>{h(y.result)},y.onerror=()=>{f(new Error(`fetch ${n} failed`))},y.readAsDataURL(u)})),this.useCache&&(yield(r=this.cache)===null||r===void 0?void 0:r.setItem(n,s)),!s)throw new Error(`fetch ${n} failed`);return s})}destroy(){var n;(n=this.cache)===null||n===void 0||n.clear().catch(()=>{})}}class Df{constructor(){this.runningTimeNodes={}}addRunningTimeNode(n,e,r){const s=`${e}_${n}`;if(this.runningTimeNodes[s])try{this.runningTimeNodes[s].dispose(!0)}catch{}this.runningTimeNodes[s]=r}}var Nf=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};class Ff{constructor(n){this.isPaused=!1,this.timestamp=0,this.callbackList=[],this.onTimeUpdate=e=>{const r=e/(Bt.TARGET_FPMS||.06);if(!this.isPaused){this.timestamp+=r,this.callbackList=this.callbackList.filter(u=>u&&!u.applied);let{length:s}=this.callbackList;for(let u=0;u<s;u++){const h=this.callbackList[u];if(h&&!h.applied){if(!(h.triggerTime<=this.timestamp))break;h.fn(),h.applied=!0,s=this.callbackList.length}}}},this.ticker=n,this.ticker.add(this.onTimeUpdate)}setTimeout(n,e){const r=Is(),s=this.timestamp+Math.max(e||16,16);return this.callbackList.push({fn:n,triggerTime:s,id:r,applied:!1}),this.callbackList.sort((u,h)=>u.triggerTime-h.triggerTime),r}clearTimeout(n){const e=this.callbackList.findIndex(r=>r.id===n);e>=0&&this.callbackList.splice(e,1)}delay(n){return new Promise(e=>{this.setTimeout(e,n)})}waitUntil(n,e){return Nf(this,void 0,void 0,function*(){const r=this.timestamp;for(;!n()&&this.timestamp-r<e;)yield this.delay(50)})}pause(){this.isPaused=!0}resume(){this.isPaused=!1}}var Gu=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})};W.skipHello();const ef={randomBar:"RandomLines",circle:"Shape",ripple:"Ripples",wipe:"Erase",dissolve:"Dissolve",morph:"Smooth",fade:"FadeInOut",push:"Push",split:"Separation",reveal:"Display",pull:"Uncover",cover:"Cover",flash:"Flash",checker:"Checkerboard",blinds:"WindowShades",curtains:"Curtain",fallOver:"Fall",drape:"Suspension",wheel:"Clock",comb:"Combing",warp:"Scale",peelOff:"PeelOff",flip:"Flip"};class Bf{constructor(n){this.eventHub=n,this.targets=Object.create(null)}addTarget(n,e){this.targets[n]=e}getTargetById(n){return this.targets[n]}getTarget(n,e,r={type:"el",index:0,id:""}){var s,u;let h=this.targets[n.id];return n.type!=="shape"?h:(n.type==="shape"&&n.txEl&&(h=(s=h==null?void 0:h.getTextElement(n.txEl.type,n.txEl.range))!==null&&s!==void 0?s:null),n.type==="shape"&&n.bg&&r.index===0&&(e=!1,h=(u=h==null?void 0:h.getBgElement())!==null&&u!==void 0?u:null,this.eventHub.emit("IterateTimeNodeEnd",r.id)),e&&h?h.getIterateEntry(r.type,r.index,r.id):h)}clearTargets(){this.targets=Object.create(null)}}const Pn={mainSeqStepChange:"mainSeqStepChange",mainSeqStateChange:"mainSeqStateChange",interactiveSeqStateChange:"interactiveSeqStateChange",interactiveSeqNext:"interactiveSeqNext",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",slideChange:"slideChange",renderStart:"renderStart",renderEnd:"renderEnd",hyperlinkTrigger:"hyperlinkTrigger",animateStart:"animateStart",animateEnd:"animateEnd",mediaSeek:"mediaSeek",mediaPlay:"mediaPlay",mediaPause:"mediaPause",requestNextSlide:"requestNextSlide",requestPrevSlide:"requestPrevSlide",requestGotoSlide:"requestGotoSlide"};class di extends J.a{constructor(n,e={}){super(),this.loader=new Of(!1),this.transactionPlayer=new ct.TransactionPlayer,this.transactionSprite=new Nr,this.isForward=!0,this.drawCall=0,this.scale=1,this.fps=new Lf,this.designWidth=0,this.designHeight=0,this.currentIndex=0,this.slideCount=0,this.runtime={drawCall:0,fps:0},this.mode=n,this.config={minFPS:Object(X.isUndefined)(e.minFPS)?30:e.minFPS,maxFPS:Object(X.isUndefined)(e.maxFPS)?40:e.maxFPS,resolution:Object(X.isUndefined)(e.resolution)?window.devicePixelRatio:e.resolution,autoFPS:!Object(X.isUndefined)(e.autoFPS)&&e.autoFPS,autoResolution:!Object(X.isUndefined)(e.autoResolution)&&e.autoResolution,transactionBgColor:Object(X.isUndefined)(e.transactionBgColor)?0:e.transactionBgColor},this.app=new ar({antialias:!0,autoDensity:!1,backgroundColor:16777215}),this.updateConfig(this.config),this.app.view.style.zIndex="1",this.app.stage.sortableChildren=!0;const r=this.app.renderer,{drawElements:s}=r.gl;r.gl.drawElements=(...u)=>{s.call(r.gl,...u),this.drawCall+=1},this.fps.on("update",u=>{if(u<this.config.minFPS){if(this.config.autoResolution){const h=this.scale*this.config.resolution*.7,f=this.app.renderer.resolution,y=Math.max(h,f-.1);y>=h&&this.updateResolution(y)}if(this.config.autoFPS){const h=14,{minFPS:f,maxFPS:y}=this.app.ticker,b=Math.max(h,f-2),T=Math.max(h,y-2);b>=h&&T>=h&&(this.app.ticker.minFPS=b,this.app.ticker.maxFPS=T)}}else if(u>this.config.maxFPS){if(this.config.autoResolution){const h=this.scale*this.config.resolution,f=this.app.renderer.resolution,y=Math.min(h,f+.1);y<=this.config.resolution&&this.updateResolution(y)}if(this.config.autoFPS){const h=this.config.minFPS,f=this.config.maxFPS,{minFPS:y,maxFPS:b}=this.app.ticker,T=Math.min(h,y+2),P=Math.min(f,b+2);T<=h&&P<=f&&(this.app.ticker.minFPS=T,this.app.ticker.maxFPS=P)}}}),this.app.ticker.add(()=>{this.runtime.drawCall=this.drawCall,this.runtime.fps=Math.floor(this.app.ticker.minFPS),this.drawCall=0},null,vs.LOW),this.clock=new Ff(this.app.ticker)}get view(){return this.app.renderer?this.app.view:null}get nextSlideIndex(){var n;return((n=this.currentStage)===null||n===void 0?void 0:n.json.nextIndex)?this.currentStage.json.nextIndex:this.currentIndex+1}get prevSlideIndex(){var n;return((n=this.currentStage)===null||n===void 0?void 0:n.json.prevIndex)?this.currentStage.json.prevIndex:this.currentIndex-1}updateConfig(n){Object(X.isUndefined)(n.minFPS)||(this.config.minFPS=n.minFPS,this.app.ticker.minFPS=n.minFPS),Object(X.isUndefined)(n.maxFPS)||(this.config.maxFPS=n.maxFPS,this.app.ticker.maxFPS=n.maxFPS),Object(X.isUndefined)(n.resolution)||(this.config.resolution=n.resolution,this.updateResolution(this.scale*this.config.resolution)),Object(X.isUndefined)(n.autoFPS)||(this.config.autoFPS=n.autoFPS),Object(X.isUndefined)(n.autoResolution)||(this.config.autoResolution=n.autoResolution),Object(X.isUndefined)(n.transactionBgColor)||(this.config.transactionBgColor=n.transactionBgColor)}preload(n){return Gu(this,void 0,void 0,function*(){if(n<1||n>this.slideCount||!this.loader.cache)return;const e=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${n}.json`),{sheets:r}=e;for(const s of r)yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/${s}.json`),yield this.loader.fetchPng(`${this.url}/${this.taskId}/jsonOutput/${s}.png`)})}setResourceData(n,e){this.taskId=n,this.url=e,this.loader.bindTask(n)}setInteractive(n){this.app.stage.interactive=n,this.app.stage.interactiveChildren=n}loadSlide(n){return Gu(this,void 0,void 0,function*(){const e=new Mm(this.loader),r=new J.a,s={mode:this.mode,renderer:this.app.renderer,graphicsTexture:new od(this.app.renderer),fillTexture:new id(this.app.renderer,e),stageWidth:0,stageHeight:0,ticker:this.app.ticker,timingTargets:new Bf(r),eventHub:r,view:this.app.view,medias:Object.create(null),lastViewedIndex:this.currentIndex,conflictTimeNodeManager:new Df,clock:this.clock},u=yield this.loader.fetchJson(`${this.url}/${this.taskId}/jsonOutput/slide-${n}.json`),{width:h,height:f,sheets:y}=u;yield e.loadSpriteSheets(y,this.url,this.taskId),s.stageWidth=h,s.stageHeight=f;const b=new ig(u,s,{x:0,y:0});return this.translateEvent(s.eventHub,[Pn.mainSeqStepChange,Pn.mainSeqStateChange,Pn.hyperlinkTrigger,Pn.interactiveSeqNext,Pn.mainSeqStepStart,Pn.mainSeqStepEnd,Pn.animateStart,Pn.animateEnd,Pn.mediaPlay,Pn.mediaPause,Pn.mediaSeek,Pn.requestGotoSlide,Pn.requestNextSlide,Pn.requestPrevSlide,Pn.interactiveSeqStateChange]),b.preRender(),s.fillTexture.pack(),s.graphicsTexture.pack(),{stage:b,json:u}})}translateEvent(n,e){e.forEach(r=>{n.on(r,(...s)=>{this.emit(r,...s)})})}renderSlide(n){return Gu(this,void 0,void 0,function*(){this.emit(Pn.renderStart,n);const e=yield this.loadSlide(n);this.currentIndex=Number(n);const{width:r,height:s,slideCount:u}=e.json;let h;this.slideCount=u,this.designWidth=r,this.designHeight=s,this.currentStage&&(e.json.transition&&e.json.transition.type&&(h=this.getBase64(this.currentStage)),this.prevStage=this.currentStage),this.currentStage=e,yield e.stage.render(),e.stage.createTiming(),e.stage.container.visible=!0,e.stage.collectMainSeqStartValue(),this.isForward?e.stage.setMainSeqStep(0,"start"):e.stage.setMainSeqStep(-1,"end");const f=this.getBase64(this.currentStage);e.stage.container.visible=!1,this.app.stage.addChild(e.stage.container),h&&f&&e.json.transition&&e.json.transition.type&&(yield this.playTransaction(h,f,e.json.transition)),this.prevStage&&(this.app.stage.removeChild(this.prevStage.stage.container),this.prevStage.stage.destroy(),this.prevStage=void 0),this.isForward?yield e.stage.startTiming():e.stage.setMainSeqApplied(),this.updateResolution(this.config.resolution*this.scale),e.stage.container.visible=!0,this.emit(Pn.renderEnd,n),this.emit(Pn.slideChange,n),this.preload(n+1).catch(()=>{}),this.preload(n-1).catch(()=>{})})}getBase64(n){const e=Li.create({width:this.designWidth,height:this.designHeight,resolution:Math.ceil(this.app.renderer.resolution)});this.app.renderer.render(n.stage.container,{renderTexture:e});const r=this.app.renderer.plugins.extract.base64(e,"image/jpeg");return e.destroy(),r}getPreviewImage(n){return Gu(this,void 0,void 0,function*(){if(n<1||n>this.slideCount)return null;const e=yield this.loadSlide(n);yield e.stage.render(),e.stage.container.visible=!0;const r=this.getBase64(e);return e.stage.destroy(),r})}playTransaction(n,e,r){return Gu(this,void 0,void 0,function*(){const s=this.app.view.parentElement;if(n&&e&&s&&ef[r.type]&&this.transactionPlayer){this.transactionSprite.zIndex=999,this.app.stage.addChild(this.transactionSprite);const u=this.transactionPlayer.renderer.domElement,h=qn.from(u),f=()=>h.update();return setTimeout(()=>{this.app.ticker.add(f)}),this.transactionSprite.texture=h,new Promise(y=>{var b,T,P;(b=this.transactionPlayer)===null||b===void 0||b.play({reverse:!this.isForward,prevTextureUrl:n,nextTextureUrl:e,textureWidth:this.designWidth,textureHeight:this.designHeight,presetType:ef[r.type],stageWidth:this.designWidth,stageHeight:this.designHeight,duration:(P=(T=this.currentStage)===null||T===void 0?void 0:T.json.transition)===null||P===void 0?void 0:P.dur,delay:0,clearColor:this.config.transactionBgColor,onTransactionEnd:()=>{y(),this.app.stage.removeChild(this.transactionSprite),this.app.ticker.remove(f)}})})}return Promise.resolve()})}scaleView(n,e=!1){this.scale=n;const r=this.scale*this.config.resolution;this.view&&(this.view.style.width=Math.floor(this.designWidth*this.scale)+"px",this.view.style.height=Math.floor(this.designHeight*this.scale)+"px"),e&&this.updateResolution(r)}updateResolution(n){this.app.ticker.addOnce(()=>{this.app.renderer.resolution=n,this.app.renderer.plugins.interaction.resolution=this.app.renderer.resolution,this.app.renderer.resize(this.designWidth,this.designHeight)})}nextStep(){var n;(n=this.currentStage)===null||n===void 0||n.stage.nextStep()}prevStep(){var n;(n=this.currentStage)===null||n===void 0||n.stage.prevStep()}mainSeqLength(){var n,e;return(e=(n=this.currentStage)===null||n===void 0?void 0:n.stage.mainSeqLength())!==null&&e!==void 0?e:0}mainSeqStep(){var n,e;return(e=(n=this.currentStage)===null||n===void 0?void 0:n.stage.mainSeqStep())!==null&&e!==void 0?e:0}setMainSeqStep(n,e){var r;(r=this.currentStage)===null||r===void 0||r.stage.setMainSeqStep(n,e)}mainSeqState(){var n,e;return(e=(n=this.currentStage)===null||n===void 0?void 0:n.stage.mainSeqState())!==null&&e!==void 0?e:null}mainSeqHasNextStep(){var n,e;return(e=(n=this.currentStage)===null||n===void 0?void 0:n.stage.mainSeqHasNextStep())!==null&&e!==void 0&&e}mainSeqHasPrevStep(){var n,e;return(e=(n=this.currentStage)===null||n===void 0?void 0:n.stage.mainSeqHasPrevStep())!==null&&e!==void 0&&e}nextTick(n){this.app.ticker.addOnce(()=>{n()},vs.LOW)}applyInteractiveAction(n){var e;(e=this.currentStage)===null||e===void 0||e.stage.applyInteractiveAction(n)}seekInteractiveSeqToEnd(n){var e;(e=this.currentStage)===null||e===void 0||e.stage.seekInteractiveSeqToEnd(n)}setInteractiveSeqState(n,e,r){var s;(s=this.currentStage)===null||s===void 0||s.stage.setInteractiveSeqState(n,e,r)}setMediaState(n,e){var r;return Gu(this,void 0,void 0,function*(){yield(r=this.currentStage)===null||r===void 0?void 0:r.stage.setMediaState(n,e)})}setMediaCurrentTime(n,e){var r;(r=this.currentStage)===null||r===void 0||r.stage.setMediaCurrentTime(n,e)}pause(){this.app.ticker.stop()}resume(){this.app.ticker.start()}getSnapshot(){return this.currentStage?this.getBase64(this.currentStage):""}destroy(){var n;this.prevStage&&this.prevStage.stage.destroy(),this.currentStage&&this.currentStage.stage.destroy(),(n=this.transactionPlayer)===null||n===void 0||n.destroy(),this.loader.destroy(),this.fps.destroy();try{this.app.renderer.gl.getExtension("WEBGL_lose_context").loseContext()}catch{}this.app.destroy(!0,{children:!1,texture:!0,baseTexture:!0})}}var Js,Hu=[],nf="ResizeObserver loop completed with undelivered notifications.";(function(o){o.BORDER_BOX="border-box",o.CONTENT_BOX="content-box",o.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Js||(Js={}));var rf,Vo=function(o){return Object.freeze(o)},Kh=function(o,n){this.inlineSize=o,this.blockSize=n,Vo(this)},of=function(){function o(n,e,r,s){return this.x=n,this.y=e,this.width=r,this.height=s,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Vo(this)}return o.prototype.toJSON=function(){var n=this;return{x:n.x,y:n.y,top:n.top,right:n.right,bottom:n.bottom,left:n.left,width:n.width,height:n.height}},o.fromRect=function(n){return new o(n.x,n.y,n.width,n.height)},o}(),Qh=function(o){return o instanceof SVGElement&&"getBBox"in o},kf=function(o){if(Qh(o)){var n=o.getBBox(),e=n.width,r=n.height;return!e&&!r}var s=o,u=s.offsetWidth,h=s.offsetHeight;return!(u||h||o.getClientRects().length)},tc=function(o){var n,e;if(o instanceof Element)return!0;var r=(e=(n=o)===null||n===void 0?void 0:n.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(r&&o instanceof r.Element)},Qa=typeof window!="undefined"?window:{},zu=new WeakMap,sd=/auto|scroll/,sg=/^tb|vertical/,ec=/msie|trident/i.test(Qa.navigator&&Qa.navigator.userAgent),ya=function(o){return parseFloat(o||"0")},nc=function(o,n,e){return o===void 0&&(o=0),n===void 0&&(n=0),e===void 0&&(e=!1),new Kh((e?n:o)||0,(e?o:n)||0)},Wo=Vo({devicePixelContentBoxSize:nc(),borderBoxSize:nc(),contentBoxSize:nc(),contentRect:new of(0,0,0,0)}),xa=function(o,n){if(n===void 0&&(n=!1),zu.has(o)&&!n)return zu.get(o);if(kf(o))return zu.set(o,Wo),Wo;var e=getComputedStyle(o),r=Qh(o)&&o.ownerSVGElement&&o.getBBox(),s=!ec&&e.boxSizing==="border-box",u=sg.test(e.writingMode||""),h=!r&&sd.test(e.overflowY||""),f=!r&&sd.test(e.overflowX||""),y=r?0:ya(e.paddingTop),b=r?0:ya(e.paddingRight),T=r?0:ya(e.paddingBottom),P=r?0:ya(e.paddingLeft),j=r?0:ya(e.borderTopWidth),G=r?0:ya(e.borderRightWidth),V=r?0:ya(e.borderBottomWidth),K=P+b,_t=y+T,Tt=(r?0:ya(e.borderLeftWidth))+G,jt=j+V,de=f?o.offsetHeight-jt-o.clientHeight:0,Ne=h?o.offsetWidth-Tt-o.clientWidth:0,Nt=s?K+Tt:0,ue=s?_t+jt:0,$t=r?r.width:ya(e.width)-Nt-Ne,ie=r?r.height:ya(e.height)-ue-de,Je=$t+K+Ne+Tt,he=ie+_t+de+jt,oe=Vo({devicePixelContentBoxSize:nc(Math.round($t*devicePixelRatio),Math.round(ie*devicePixelRatio),u),borderBoxSize:nc(Je,he,u),contentBoxSize:nc($t,ie,u),contentRect:new of(P,y,$t,ie)});return zu.set(o,oe),oe},ba=function(o,n,e){var r=xa(o,e),s=r.borderBoxSize,u=r.contentBoxSize,h=r.devicePixelContentBoxSize;switch(n){case Js.DEVICE_PIXEL_CONTENT_BOX:return h;case Js.BORDER_BOX:return s;default:return u}},ag=function(o){var n=xa(o);this.target=o,this.contentRect=n.contentRect,this.borderBoxSize=Vo([n.borderBoxSize]),this.contentBoxSize=Vo([n.contentBoxSize]),this.devicePixelContentBoxSize=Vo([n.devicePixelContentBoxSize])},Am=function(o){if(kf(o))return 1/0;for(var n=0,e=o.parentNode;e;)n+=1,e=e.parentNode;return n},op=function(){var o=1/0,n=[];Hu.forEach(function(s){if(s.activeTargets.length!==0){var u=[];s.activeTargets.forEach(function(h){var f=new ag(h.target),y=Am(h.target);u.push(f),h.lastReportedSize=ba(h.target,h.observedBox),y<o&&(o=y)}),n.push(function(){s.callback.call(s.observer,u,s.observer)}),s.activeTargets.splice(0,s.activeTargets.length)}});for(var e=0,r=n;e<r.length;e++)(0,r[e])();return o},Uf=function(o){Hu.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(e){e.isActive()&&(Am(e.target)>o?n.activeTargets.push(e):n.skippedTargets.push(e))})})},Cm=function(){var o,n=0;for(Uf(n);Hu.some(function(e){return e.activeTargets.length>0});)n=op(),Uf(n);return Hu.some(function(e){return e.skippedTargets.length>0})&&(typeof ErrorEvent=="function"?o=new ErrorEvent("error",{message:nf}):((o=document.createEvent("Event")).initEvent("error",!1,!1),o.message=nf),window.dispatchEvent(o)),n>0},Gf=[],Pm=function(o){if(!rf){var n=0,e=document.createTextNode("");new MutationObserver(function(){return Gf.splice(0).forEach(function(r){return r()})}).observe(e,{characterData:!0}),rf=function(){e.textContent=""+(n?n--:n++)}}Gf.push(o),rf()},rc=0,ju={attributes:!0,characterData:!0,childList:!0,subtree:!0},wa=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],sf=function(o){return o===void 0&&(o=0),Date.now()+o},af=!1,lf=new(function(){function o(){var n=this;this.stopped=!0,this.listener=function(){return n.schedule()}}return o.prototype.run=function(n){var e=this;if(n===void 0&&(n=250),!af){af=!0;var r,s=sf(n);r=function(){var u=!1;try{u=Cm()}finally{if(af=!1,n=s-sf(),!rc)return;u?e.run(1e3):n>0?e.run(n):e.start()}},Pm(function(){requestAnimationFrame(r)})}},o.prototype.schedule=function(){this.stop(),this.run()},o.prototype.observe=function(){var n=this,e=function(){return n.observer&&n.observer.observe(document.body,ju)};document.body?e():Qa.addEventListener("DOMContentLoaded",e)},o.prototype.start=function(){var n=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),wa.forEach(function(e){return Qa.addEventListener(e,n.listener,!0)}))},o.prototype.stop=function(){var n=this;this.stopped||(this.observer&&this.observer.disconnect(),wa.forEach(function(e){return Qa.removeEventListener(e,n.listener,!0)}),this.stopped=!0)},o}()),Hf=function(o){!rc&&o>0&&lf.start(),!(rc+=o)&&lf.stop()},zf=function(){function o(n,e){this.target=n,this.observedBox=e||Js.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return o.prototype.isActive=function(){var n,e=ba(this.target,this.observedBox,!0);return n=this.target,Qh(n)||function(r){switch(r.tagName){case"INPUT":if(r.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1}(n)||getComputedStyle(n).display!=="inline"||(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},o}(),Rm=function(o,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=o,this.callback=n},ad=new WeakMap,jf=function(o,n){for(var e=0;e<o.length;e+=1)if(o[e].target===n)return e;return-1},Vu=function(){function o(){}return o.connect=function(n,e){var r=new Rm(n,e);ad.set(n,r)},o.observe=function(n,e,r){var s=ad.get(n),u=s.observationTargets.length===0;jf(s.observationTargets,e)<0&&(u&&Hu.push(s),s.observationTargets.push(new zf(e,r&&r.box)),Hf(1),lf.schedule())},o.unobserve=function(n,e){var r=ad.get(n),s=jf(r.observationTargets,e),u=r.observationTargets.length===1;s>=0&&(u&&Hu.splice(Hu.indexOf(r),1),r.observationTargets.splice(s,1),Hf(-1))},o.disconnect=function(n){var e=this,r=ad.get(n);r.observationTargets.slice().forEach(function(s){return e.unobserve(n,s.target)}),r.activeTargets.splice(0,r.activeTargets.length)},o}(),Vf=function(){function o(n){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof n!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");Vu.connect(this,n)}return o.prototype.observe=function(n,e){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!tc(n))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");Vu.observe(this,n,e)},o.prototype.unobserve=function(n){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!tc(n))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");Vu.unobserve(this,n)},o.prototype.disconnect=function(){Vu.disconnect(this)},o.toString=function(){return"function ResizeObserver () { [polyfill code] }"},o}(),Im=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})},Wf=function(o,n){var e,r,s,u,h={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(y){return function(b){return function(T){if(e)throw new TypeError("Generator is already executing.");for(;h;)try{if(e=1,r&&(s=2&T[0]?r.return:T[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,T[1])).done)return s;switch(r=0,s&&(T=[2&T[0],s.value]),T[0]){case 0:case 1:s=T;break;case 4:return h.label++,{value:T[1],done:!1};case 5:h.label++,r=T[1],T=[0];continue;case 7:T=h.ops.pop(),h.trys.pop();continue;default:if(s=h.trys,!((s=s.length>0&&s[s.length-1])||T[0]!==6&&T[0]!==2)){h=0;continue}if(T[0]===3&&(!s||T[1]>s[0]&&T[1]<s[3])){h.label=T[1];break}if(T[0]===6&&h.label<s[1]){h.label=s[1],s=T;break}if(s&&h.label<s[2]){h.label=s[2],h.ops.push(T);break}s[2]&&h.ops.pop(),h.trys.pop();continue}T=n.call(o,h)}catch(P){T=[6,P],r=0}finally{e=s=0}if(5&T[0])throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}([y,b])}}},sp=function(){function o(n,e,r,s,u){this.state="idle",this.index=-1,this.slideIndex=-1,this.fn=r,this.index=n,this.slideIndex=e,this.eventHub=s,this.id=u}return o.prototype.apply=function(){return Im(this,void 0,void 0,function(){var n;return Wf(this,function(e){switch(e.label){case 0:this.eventHub.emit("task-start",this),e.label=1;case 1:return e.trys.push([1,3,,4]),this.state="start",[4,this.fn()];case 2:return e.sent(),this.state="end",this.eventHub.emit("task-end",this),[3,4];case 3:return n=e.sent(),this.eventHub.emit("task-error",{task:this,error:n}),[3,4];case 4:return[2]}})})},o}(),Lm=function(){function o(){var n=this;this.eventHub=new J.a,this.tasks=[],this.index=0,this.eventHub.on("task-end",function(e){var r,s=n.tasks.findIndex(function(h){return h.index===e.index}),u=s+1;u>=0&&((r=n.tasks[u])===null||r===void 0||r.apply()),s>=0&&(n.tasks.splice(s,1),n.replaceIdleTask()),n.eventHub.emit("task-end-"+e.id)}),this.eventHub.on("task-error",function(e){var r=e.task,s=n.tasks.findIndex(function(u){return u.index===r.index});s>=0&&(n.tasks.splice(s,1),n.replaceIdleTask())})}return o.prototype.replaceIdleTask=function(){for(var n,e=this,r=new Set,s=0,u=this.tasks.length;s<u;s++)this.tasks[s].state==="idle"&&((n=this.tasks[s+1])===null||n===void 0?void 0:n.state)==="idle"&&r.add(s);Array.from(r).forEach(function(h){e.tasks.splice(h,1)})},o.prototype.addTask=function(n,e,r){var s=new sp(this.index++,e,n,this.eventHub,r);this.tasks.push(s),this.tasks.sort(function(u,h){return u.index-h.index}),this.replaceIdleTask(),this.tasks.length===1&&s.apply()},o.prototype.hasStartTask=function(){return this.tasks.some(function(n){return n.state==="start"})},o}();function Wu(o,n){var e=o.__state.conversionName.toString(),r=Math.round(o.r),s=Math.round(o.g),u=Math.round(o.b),h=o.a,f=Math.round(o.h),y=o.s.toFixed(1),b=o.v.toFixed(1);if(n||e==="THREE_CHAR_HEX"||e==="SIX_CHAR_HEX"){for(var T=o.hex.toString(16);T.length<6;)T="0"+T;return"#"+T}return e==="CSS_RGB"?"rgb("+r+","+s+","+u+")":e==="CSS_RGBA"?"rgba("+r+","+s+","+u+","+h+")":e==="HEX"?"0x"+o.hex.toString(16):e==="RGB_ARRAY"?"["+r+","+s+","+u+"]":e==="RGBA_ARRAY"?"["+r+","+s+","+u+","+h+"]":e==="RGB_OBJ"?"{r:"+r+",g:"+s+",b:"+u+"}":e==="RGBA_OBJ"?"{r:"+r+",g:"+s+",b:"+u+",a:"+h+"}":e==="HSV_OBJ"?"{h:"+f+",s:"+y+",v:"+b+"}":e==="HSVA_OBJ"?"{h:"+f+",s:"+y+",v:"+b+",a:"+h+"}":"unknown format"}var uf=Array.prototype.forEach,ic=Array.prototype.slice,Re={BREAK:{},extend:function(o){return this.each(ic.call(arguments,1),function(n){(this.isObject(n)?Object.keys(n):[]).forEach(function(e){this.isUndefined(n[e])||(o[e]=n[e])}.bind(this))},this),o},defaults:function(o){return this.each(ic.call(arguments,1),function(n){(this.isObject(n)?Object.keys(n):[]).forEach(function(e){this.isUndefined(o[e])&&(o[e]=n[e])}.bind(this))},this),o},compose:function(){var o=ic.call(arguments);return function(){for(var n=ic.call(arguments),e=o.length-1;e>=0;e--)n=[o[e].apply(this,n)];return n[0]}},each:function(o,n,e){if(o){if(uf&&o.forEach&&o.forEach===uf)o.forEach(n,e);else if(o.length===o.length+0){var r,s=void 0;for(s=0,r=o.length;s<r;s++)if(s in o&&n.call(e,o[s],s)===this.BREAK)return}else for(var u in o)if(n.call(e,o[u],u)===this.BREAK)return}},defer:function(o){setTimeout(o,0)},debounce:function(o,n,e){var r=void 0;return function(){var s=this,u=arguments;function h(){r=null,e||o.apply(s,u)}var f=e||!r;clearTimeout(r),r=setTimeout(h,n),f&&o.apply(s,u)}},toArray:function(o){return o.toArray?o.toArray():ic.call(o)},isUndefined:function(o){return o===void 0},isNull:function(o){return o===null},isNaN:function(o){function n(e){return o.apply(this,arguments)}return n.toString=function(){return o.toString()},n}(function(o){return isNaN(o)}),isArray:Array.isArray||function(o){return o.constructor===Array},isObject:function(o){return o===Object(o)},isNumber:function(o){return o===o+0},isString:function(o){return o===o+""},isBoolean:function(o){return o===!1||o===!0},isFunction:function(o){return o instanceof Function}},ap=[{litmus:Re.isString,conversions:{THREE_CHAR_HEX:{read:function(o){var n=o.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return n!==null&&{space:"HEX",hex:parseInt("0x"+n[1].toString()+n[1].toString()+n[2].toString()+n[2].toString()+n[3].toString()+n[3].toString(),0)}},write:Wu},SIX_CHAR_HEX:{read:function(o){var n=o.match(/^#([A-F0-9]{6})$/i);return n!==null&&{space:"HEX",hex:parseInt("0x"+n[1].toString(),0)}},write:Wu},CSS_RGB:{read:function(o){var n=o.match(/^rgb\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return n!==null&&{space:"RGB",r:parseFloat(n[1]),g:parseFloat(n[2]),b:parseFloat(n[3])}},write:Wu},CSS_RGBA:{read:function(o){var n=o.match(/^rgba\(\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*,\s*(.+)\s*\)/);return n!==null&&{space:"RGB",r:parseFloat(n[1]),g:parseFloat(n[2]),b:parseFloat(n[3]),a:parseFloat(n[4])}},write:Wu}}},{litmus:Re.isNumber,conversions:{HEX:{read:function(o){return{space:"HEX",hex:o,conversionName:"HEX"}},write:function(o){return o.hex}}}},{litmus:Re.isArray,conversions:{RGB_ARRAY:{read:function(o){return o.length===3&&{space:"RGB",r:o[0],g:o[1],b:o[2]}},write:function(o){return[o.r,o.g,o.b]}},RGBA_ARRAY:{read:function(o){return o.length===4&&{space:"RGB",r:o[0],g:o[1],b:o[2],a:o[3]}},write:function(o){return[o.r,o.g,o.b,o.a]}}}},{litmus:Re.isObject,conversions:{RGBA_OBJ:{read:function(o){return!!(Re.isNumber(o.r)&&Re.isNumber(o.g)&&Re.isNumber(o.b)&&Re.isNumber(o.a))&&{space:"RGB",r:o.r,g:o.g,b:o.b,a:o.a}},write:function(o){return{r:o.r,g:o.g,b:o.b,a:o.a}}},RGB_OBJ:{read:function(o){return!!(Re.isNumber(o.r)&&Re.isNumber(o.g)&&Re.isNumber(o.b))&&{space:"RGB",r:o.r,g:o.g,b:o.b}},write:function(o){return{r:o.r,g:o.g,b:o.b}}},HSVA_OBJ:{read:function(o){return!!(Re.isNumber(o.h)&&Re.isNumber(o.s)&&Re.isNumber(o.v)&&Re.isNumber(o.a))&&{space:"HSV",h:o.h,s:o.s,v:o.v,a:o.a}},write:function(o){return{h:o.h,s:o.s,v:o.v,a:o.a}}},HSV_OBJ:{read:function(o){return!!(Re.isNumber(o.h)&&Re.isNumber(o.s)&&Re.isNumber(o.v))&&{space:"HSV",h:o.h,s:o.s,v:o.v}},write:function(o){return{h:o.h,s:o.s,v:o.v}}}}}],ld=void 0,oc=void 0,lp=function(){oc=!1;var o=arguments.length>1?Re.toArray(arguments):arguments[0];return Re.each(ap,function(n){if(n.litmus(o))return Re.each(n.conversions,function(e,r){if(ld=e.read(o),oc===!1&&ld!==!1)return oc=ld,ld.conversionName=r,ld.conversion=e,Re.BREAK}),Re.BREAK}),oc},hf=void 0,up={hsv_to_rgb:function(o,n,e){var r=Math.floor(o/60)%6,s=o/60-Math.floor(o/60),u=e*(1-n),h=e*(1-s*n),f=e*(1-(1-s)*n),y=[[e,f,u],[h,e,u],[u,e,f],[u,h,e],[f,u,e],[e,u,h]][r];return{r:255*y[0],g:255*y[1],b:255*y[2]}},rgb_to_hsv:function(o,n,e){var r=Math.min(o,n,e),s=Math.max(o,n,e),u=s-r,h=void 0;return s===0?{h:NaN,s:0,v:0}:(h=o===s?(n-e)/u:n===s?2+(e-o)/u:4+(o-n)/u,(h/=6)<0&&(h+=1),{h:360*h,s:u/s,v:s/255})},rgb_to_hex:function(o,n,e){var r=this.hex_with_component(0,2,o);return r=this.hex_with_component(r,1,n),r=this.hex_with_component(r,0,e)},component_from_hex:function(o,n){return o>>8*n&255},hex_with_component:function(o,n,e){return e<<(hf=8*n)|o&~(255<<hf)}},lg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},tl=function(o,n){if(!(o instanceof n))throw new TypeError("Cannot call a class as a function")},Sa=function(){function o(n,e){for(var r=0;r<e.length;r++){var s=e[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(n,s.key,s)}}return function(n,e,r){return e&&o(n.prototype,e),r&&o(n,r),n}}(),ou=function o(n,e,r){n===null&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,e);if(s===void 0){var u=Object.getPrototypeOf(n);return u===null?void 0:o(u,e,r)}if("value"in s)return s.value;var h=s.get;return h!==void 0?h.call(r):void 0},su=function(o,n){if(typeof n!="function"&&n!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof n);o.prototype=Object.create(n&&n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(o,n):o.__proto__=n)},au=function(o,n){if(!o)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||typeof n!="object"&&typeof n!="function"?o:n},oo=function(){function o(){if(tl(this,o),this.__state=lp.apply(this,arguments),this.__state===!1)throw new Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return Sa(o,[{key:"toString",value:function(){return Wu(this)}},{key:"toHexString",value:function(){return Wu(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),o}();function Xf(o,n,e){Object.defineProperty(o,n,{get:function(){return this.__state.space==="RGB"||oo.recalculateRGB(this,n,e),this.__state[n]},set:function(r){this.__state.space!=="RGB"&&(oo.recalculateRGB(this,n,e),this.__state.space="RGB"),this.__state[n]=r}})}function qf(o,n){Object.defineProperty(o,n,{get:function(){return this.__state.space==="HSV"||oo.recalculateHSV(this),this.__state[n]},set:function(e){this.__state.space!=="HSV"&&(oo.recalculateHSV(this),this.__state.space="HSV"),this.__state[n]=e}})}oo.recalculateRGB=function(o,n,e){if(o.__state.space==="HEX")o.__state[n]=up.component_from_hex(o.__state.hex,e);else{if(o.__state.space!=="HSV")throw new Error("Corrupted color state");Re.extend(o.__state,up.hsv_to_rgb(o.__state.h,o.__state.s,o.__state.v))}},oo.recalculateHSV=function(o){var n=up.rgb_to_hsv(o.r,o.g,o.b);Re.extend(o.__state,{s:n.s,v:n.v}),Re.isNaN(n.h)?Re.isUndefined(o.__state.h)&&(o.__state.h=0):o.__state.h=n.h},oo.COMPONENTS=["r","g","b","h","s","v","hex","a"],Xf(oo.prototype,"r",2),Xf(oo.prototype,"g",1),Xf(oo.prototype,"b",0),qf(oo.prototype,"h"),qf(oo.prototype,"s"),qf(oo.prototype,"v"),Object.defineProperty(oo.prototype,"a",{get:function(){return this.__state.a},set:function(o){this.__state.a=o}}),Object.defineProperty(oo.prototype,"hex",{get:function(){return this.__state.space!=="HEX"&&(this.__state.hex=up.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(o){this.__state.space="HEX",this.__state.hex=o}});var wl=function(){function o(n,e){tl(this,o),this.initialValue=n[e],this.domElement=document.createElement("div"),this.object=n,this.property=e,this.__onChange=void 0,this.__onFinishChange=void 0}return Sa(o,[{key:"onChange",value:function(n){return this.__onChange=n,this}},{key:"onFinishChange",value:function(n){return this.__onFinishChange=n,this}},{key:"setValue",value:function(n){return this.object[this.property]=n,this.__onChange&&this.__onChange.call(this,n),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),o}(),cf={};Re.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(o,n){Re.each(o,function(e){cf[e]=n})});var Om=/(\d+(\.\d+)?)px/;function el(o){if(o==="0"||Re.isUndefined(o))return 0;var n=o.match(Om);return Re.isNull(n)?0:parseFloat(n[1])}var re={makeSelectable:function(o,n){o!==void 0&&o.style!==void 0&&(o.onselectstart=n?function(){return!1}:function(){},o.style.MozUserSelect=n?"auto":"none",o.style.KhtmlUserSelect=n?"auto":"none",o.unselectable=n?"on":"off")},makeFullscreen:function(o,n,e){var r=e,s=n;Re.isUndefined(s)&&(s=!0),Re.isUndefined(r)&&(r=!0),o.style.position="absolute",s&&(o.style.left=0,o.style.right=0),r&&(o.style.top=0,o.style.bottom=0)},fakeEvent:function(o,n,e,r){var s=e||{},u=cf[n];if(!u)throw new Error("Event type "+n+" not supported.");var h=document.createEvent(u);switch(u){case"MouseEvents":var f=s.x||s.clientX||0,y=s.y||s.clientY||0;h.initMouseEvent(n,s.bubbles||!1,s.cancelable||!0,window,s.clickCount||1,0,0,f,y,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var b=h.initKeyboardEvent||h.initKeyEvent;Re.defaults(s,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),b(n,s.bubbles||!1,s.cancelable,window,s.ctrlKey,s.altKey,s.shiftKey,s.metaKey,s.keyCode,s.charCode);break;default:h.initEvent(n,s.bubbles||!1,s.cancelable||!0)}Re.defaults(h,r),o.dispatchEvent(h)},bind:function(o,n,e,r){var s=r||!1;return o.addEventListener?o.addEventListener(n,e,s):o.attachEvent&&o.attachEvent("on"+n,e),re},unbind:function(o,n,e,r){var s=r||!1;return o.removeEventListener?o.removeEventListener(n,e,s):o.detachEvent&&o.detachEvent("on"+n,e),re},addClass:function(o,n){if(o.className===void 0)o.className=n;else if(o.className!==n){var e=o.className.split(/ +/);e.indexOf(n)===-1&&(e.push(n),o.className=e.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return re},removeClass:function(o,n){if(n)if(o.className===n)o.removeAttribute("class");else{var e=o.className.split(/ +/),r=e.indexOf(n);r!==-1&&(e.splice(r,1),o.className=e.join(" "))}else o.className=void 0;return re},hasClass:function(o,n){return new RegExp("(?:^|\\s+)"+n+"(?:\\s+|$)").test(o.className)||!1},getWidth:function(o){var n=getComputedStyle(o);return el(n["border-left-width"])+el(n["border-right-width"])+el(n["padding-left"])+el(n["padding-right"])+el(n.width)},getHeight:function(o){var n=getComputedStyle(o);return el(n["border-top-width"])+el(n["border-bottom-width"])+el(n["padding-top"])+el(n["padding-bottom"])+el(n.height)},getOffset:function(o){var n=o,e={left:0,top:0};if(n.offsetParent)do e.left+=n.offsetLeft,e.top+=n.offsetTop,n=n.offsetParent;while(n);return e},isActive:function(o){return o===document.activeElement&&(o.type||o.href)}},Yf=function(o){function n(e,r){tl(this,n);var s=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r)),u=s;return s.__prev=s.getValue(),s.__checkbox=document.createElement("input"),s.__checkbox.setAttribute("type","checkbox"),re.bind(s.__checkbox,"change",function(){u.setValue(!u.__prev)},!1),s.domElement.appendChild(s.__checkbox),s.updateDisplay(),s}return su(n,o),Sa(n,[{key:"setValue",value:function(e){var r=ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),r}},{key:"updateDisplay",value:function(){return this.getValue()===!0?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"updateDisplay",this).call(this)}}]),n}(wl),Dm=function(o){function n(e,r,s){tl(this,n);var u=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r)),h=s,f=u;if(u.__select=document.createElement("select"),Re.isArray(h)){var y={};Re.each(h,function(b){y[b]=b}),h=y}return Re.each(h,function(b,T){var P=document.createElement("option");P.innerHTML=T,P.setAttribute("value",b),f.__select.appendChild(P)}),u.updateDisplay(),re.bind(u.__select,"change",function(){var b=this.options[this.selectedIndex].value;f.setValue(b)}),u.domElement.appendChild(u.__select),u}return su(n,o),Sa(n,[{key:"setValue",value:function(e){var r=ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),r}},{key:"updateDisplay",value:function(){return re.isActive(this.__select)?this:(this.__select.value=this.getValue(),ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"updateDisplay",this).call(this))}}]),n}(wl),ug=function(o){function n(e,r){tl(this,n);var s=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r)),u=s;function h(){u.setValue(u.__input.value)}return s.__input=document.createElement("input"),s.__input.setAttribute("type","text"),re.bind(s.__input,"keyup",h),re.bind(s.__input,"change",h),re.bind(s.__input,"blur",function(){u.__onFinishChange&&u.__onFinishChange.call(u,u.getValue())}),re.bind(s.__input,"keydown",function(f){f.keyCode===13&&this.blur()}),s.updateDisplay(),s.domElement.appendChild(s.__input),s}return su(n,o),Sa(n,[{key:"updateDisplay",value:function(){return re.isActive(this.__input)||(this.__input.value=this.getValue()),ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"updateDisplay",this).call(this)}}]),n}(wl);function Zf(o){var n=o.toString();return n.indexOf(".")>-1?n.length-n.indexOf(".")-1:0}var Jf=function(o){function n(e,r,s){tl(this,n);var u=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r)),h=s||{};return u.__min=h.min,u.__max=h.max,u.__step=h.step,Re.isUndefined(u.__step)?u.initialValue===0?u.__impliedStep=1:u.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(u.initialValue))/Math.LN10))/10:u.__impliedStep=u.__step,u.__precision=Zf(u.__impliedStep),u}return su(n,o),Sa(n,[{key:"setValue",value:function(e){var r=e;return this.__min!==void 0&&r<this.__min?r=this.__min:this.__max!==void 0&&r>this.__max&&(r=this.__max),this.__step!==void 0&&r%this.__step!=0&&(r=Math.round(r/this.__step)*this.__step),ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"setValue",this).call(this,r)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=Zf(e),this}}]),n}(wl),Sl=function(o){function n(e,r,s){tl(this,n);var u=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r,s));u.__truncationSuspended=!1;var h=u,f=void 0;function y(){h.__onFinishChange&&h.__onFinishChange.call(h,h.getValue())}function b(P){var j=f-P.clientY;h.setValue(h.getValue()+j*h.__impliedStep),f=P.clientY}function T(){re.unbind(window,"mousemove",b),re.unbind(window,"mouseup",T),y()}return u.__input=document.createElement("input"),u.__input.setAttribute("type","text"),re.bind(u.__input,"change",function(){var P=parseFloat(h.__input.value);Re.isNaN(P)||h.setValue(P)}),re.bind(u.__input,"blur",function(){y()}),re.bind(u.__input,"mousedown",function(P){re.bind(window,"mousemove",b),re.bind(window,"mouseup",T),f=P.clientY}),re.bind(u.__input,"keydown",function(P){P.keyCode===13&&(h.__truncationSuspended=!0,this.blur(),h.__truncationSuspended=!1,y())}),u.updateDisplay(),u.domElement.appendChild(u.__input),u}return su(n,o),Sa(n,[{key:"updateDisplay",value:function(){var e,r,s;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),r=this.__precision,s=Math.pow(10,r),Math.round(e*s)/s),ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"updateDisplay",this).call(this)}}]),n}(Jf);function $f(o,n,e,r,s){return r+(o-n)/(e-n)*(s-r)}var Kf=function(o){function n(e,r,s,u,h){tl(this,n);var f=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r,{min:s,max:u,step:h})),y=f;function b(G){G.preventDefault();var V=y.__background.getBoundingClientRect();return y.setValue($f(G.clientX,V.left,V.right,y.__min,y.__max)),!1}function T(){re.unbind(window,"mousemove",b),re.unbind(window,"mouseup",T),y.__onFinishChange&&y.__onFinishChange.call(y,y.getValue())}function P(G){var V=G.touches[0].clientX,K=y.__background.getBoundingClientRect();y.setValue($f(V,K.left,K.right,y.__min,y.__max))}function j(){re.unbind(window,"touchmove",P),re.unbind(window,"touchend",j),y.__onFinishChange&&y.__onFinishChange.call(y,y.getValue())}return f.__background=document.createElement("div"),f.__foreground=document.createElement("div"),re.bind(f.__background,"mousedown",function(G){document.activeElement.blur(),re.bind(window,"mousemove",b),re.bind(window,"mouseup",T),b(G)}),re.bind(f.__background,"touchstart",function(G){G.touches.length===1&&(re.bind(window,"touchmove",P),re.bind(window,"touchend",j),P(G))}),re.addClass(f.__background,"slider"),re.addClass(f.__foreground,"slider-fg"),f.updateDisplay(),f.__background.appendChild(f.__foreground),f.domElement.appendChild(f.__background),f}return su(n,o),Sa(n,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",ou(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"updateDisplay",this).call(this)}}]),n}(Jf),Xu=function(o){function n(e,r,s){tl(this,n);var u=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r)),h=u;return u.__button=document.createElement("div"),u.__button.innerHTML=s===void 0?"Fire":s,re.bind(u.__button,"click",function(f){return f.preventDefault(),h.fire(),!1}),re.addClass(u.__button,"button"),u.domElement.appendChild(u.__button),u}return su(n,o),Sa(n,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),n}(wl),Qf=function(o){function n(e,r){tl(this,n);var s=au(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,r));s.__color=new oo(s.getValue()),s.__temp=new oo(0);var u=s;s.domElement=document.createElement("div"),re.makeSelectable(s.domElement,!1),s.__selector=document.createElement("div"),s.__selector.className="selector",s.__saturation_field=document.createElement("div"),s.__saturation_field.className="saturation-field",s.__field_knob=document.createElement("div"),s.__field_knob.className="field-knob",s.__field_knob_border="2px solid ",s.__hue_knob=document.createElement("div"),s.__hue_knob.className="hue-knob",s.__hue_field=document.createElement("div"),s.__hue_field.className="hue-field",s.__input=document.createElement("input"),s.__input.type="text",s.__input_textShadow="0 1px 1px ",re.bind(s.__input,"keydown",function(_t){_t.keyCode===13&&j.call(this)}),re.bind(s.__input,"blur",j),re.bind(s.__selector,"mousedown",function(){re.addClass(this,"drag").bind(window,"mouseup",function(){re.removeClass(u.__selector,"drag")})}),re.bind(s.__selector,"touchstart",function(){re.addClass(this,"drag").bind(window,"touchend",function(){re.removeClass(u.__selector,"drag")})});var h,f=document.createElement("div");function y(_t){V(_t),re.bind(window,"mousemove",V),re.bind(window,"touchmove",V),re.bind(window,"mouseup",T),re.bind(window,"touchend",T)}function b(_t){K(_t),re.bind(window,"mousemove",K),re.bind(window,"touchmove",K),re.bind(window,"mouseup",P),re.bind(window,"touchend",P)}function T(){re.unbind(window,"mousemove",V),re.unbind(window,"touchmove",V),re.unbind(window,"mouseup",T),re.unbind(window,"touchend",T),G()}function P(){re.unbind(window,"mousemove",K),re.unbind(window,"touchmove",K),re.unbind(window,"mouseup",P),re.unbind(window,"touchend",P),G()}function j(){var _t=lp(this.value);_t!==!1?(u.__color.__state=_t,u.setValue(u.__color.toOriginal())):this.value=u.__color.toString()}function G(){u.__onFinishChange&&u.__onFinishChange.call(u,u.__color.toOriginal())}function V(_t){_t.type.indexOf("touch")===-1&&_t.preventDefault();var Tt=u.__saturation_field.getBoundingClientRect(),jt=_t.touches&&_t.touches[0]||_t,de=jt.clientX,Ne=jt.clientY,Nt=(de-Tt.left)/(Tt.right-Tt.left),ue=1-(Ne-Tt.top)/(Tt.bottom-Tt.top);return ue>1?ue=1:ue<0&&(ue=0),Nt>1?Nt=1:Nt<0&&(Nt=0),u.__color.v=ue,u.__color.s=Nt,u.setValue(u.__color.toOriginal()),!1}function K(_t){_t.type.indexOf("touch")===-1&&_t.preventDefault();var Tt=u.__hue_field.getBoundingClientRect(),jt=1-((_t.touches&&_t.touches[0]||_t).clientY-Tt.top)/(Tt.bottom-Tt.top);return jt>1?jt=1:jt<0&&(jt=0),u.__color.h=360*jt,u.setValue(u.__color.toOriginal()),!1}return Re.extend(s.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),Re.extend(s.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:s.__field_knob_border+(s.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),Re.extend(s.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),Re.extend(s.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),Re.extend(f.style,{width:"100%",height:"100%",background:"none"}),qu(f,"top","rgba(0,0,0,0)","#000"),Re.extend(s.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(h=s.__hue_field).style.background="",h.style.cssText+="background: -moz-linear-gradient(top, #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",h.style.cssText+="background: -webkit-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",h.style.cssText+="background: -o-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",h.style.cssText+="background: -ms-linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",h.style.cssText+="background: linear-gradient(top, #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",Re.extend(s.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:s.__input_textShadow+"rgba(0,0,0,0.7)"}),re.bind(s.__saturation_field,"mousedown",y),re.bind(s.__saturation_field,"touchstart",y),re.bind(s.__field_knob,"mousedown",y),re.bind(s.__field_knob,"touchstart",y),re.bind(s.__hue_field,"mousedown",b),re.bind(s.__hue_field,"touchstart",b),s.__saturation_field.appendChild(f),s.__selector.appendChild(s.__field_knob),s.__selector.appendChild(s.__saturation_field),s.__selector.appendChild(s.__hue_field),s.__hue_field.appendChild(s.__hue_knob),s.domElement.appendChild(s.__input),s.domElement.appendChild(s.__selector),s.updateDisplay(),s}return su(n,o),Sa(n,[{key:"updateDisplay",value:function(){var e=lp(this.getValue());if(e!==!1){var r=!1;Re.each(oo.COMPONENTS,function(h){if(!Re.isUndefined(e[h])&&!Re.isUndefined(this.__color.__state[h])&&e[h]!==this.__color.__state[h])return r=!0,{}},this),r&&Re.extend(this.__color.__state,e)}Re.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var s=this.__color.v<.5||this.__color.s>.5?255:0,u=255-s;Re.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+s+","+s+","+s+")"}),this.__hue_knob.style.marginTop=100*(1-this.__color.h/360)+"px",this.__temp.s=1,this.__temp.v=1,qu(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),Re.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+s+","+s+","+s+")",textShadow:this.__input_textShadow+"rgba("+u+","+u+","+u+",.7)"})}}]),n}(wl),tm=["-moz-","-o-","-webkit-","-ms-",""];function qu(o,n,e,r){o.style.background="",Re.each(tm,function(s){o.style.cssText+="background: "+s+"linear-gradient("+n+", "+e+" 0%, "+r+" 100%); "})}var Nm=function(o,n){var e=n||document,r=document.createElement("style");r.type="text/css",r.innerHTML=o;var s=e.getElementsByTagName("head")[0];try{s.appendChild(r)}catch{}},hg=`<div id="dg-save" class="dg dialogue">
6046
6046
 
6047
6047
  Here's the new load parameter for your <code>GUI</code>'s constructor:
6048
6048
 
@@ -6062,11 +6062,11 @@ void main(void){
6062
6062
 
6063
6063
  </div>
6064
6064
 
6065
- </div>`,sc=function(o,n){var e=o[n];return Re.isArray(arguments[2])||Re.isObject(arguments[2])?new Om(o,n,arguments[2]):Re.isNumber(e)?Re.isNumber(arguments[2])&&Re.isNumber(arguments[3])?Re.isNumber(arguments[4])?new Kf(o,n,arguments[2],arguments[3],arguments[4]):new Kf(o,n,arguments[2],arguments[3]):Re.isNumber(arguments[4])?new Sl(o,n,{min:arguments[2],max:arguments[3],step:arguments[4]}):new Sl(o,n,{min:arguments[2],max:arguments[3]}):Re.isString(e)?new ug(o,n):Re.isFunction(e)?new Xu(o,n,""):Re.isBoolean(e)?new Yf(o,n):null},cg=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(o){setTimeout(o,1e3/60)},Nm=function(){function o(){tl(this,o),this.backgroundElement=document.createElement("div"),Re.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),re.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),Re.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var n=this;re.bind(this.backgroundElement,"click",function(){n.hide()})}return Sa(o,[{key:"show",value:function(){var n=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),Re.defer(function(){n.backgroundElement.style.opacity=1,n.domElement.style.opacity=1,n.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var n=this,e=function r(){n.domElement.style.display="none",n.backgroundElement.style.display="none",re.unbind(n.domElement,"webkitTransitionEnd",r),re.unbind(n.domElement,"transitionend",r),re.unbind(n.domElement,"oTransitionEnd",r)};re.bind(this.domElement,"webkitTransitionEnd",e),re.bind(this.domElement,"transitionend",e),re.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-re.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-re.getHeight(this.domElement)/2+"px"}}]),o}();Dm(function(o){if(o&&typeof window!="undefined"){var n=document.createElement("style");return n.setAttribute("type","text/css"),n.innerHTML=o,document.head.appendChild(n),o}}(`.dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}
6066
- `));var ud=function(){try{return!!window.localStorage}catch{return!1}}(),df=void 0,Fm=!0,hd=void 0,em=!1,Bm=[],li=function o(n){var e=this,r=n||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),re.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],r=Re.defaults(r,{closeOnTop:!1,autoPlace:!0,width:o.DEFAULT_WIDTH}),r=Re.defaults(r,{resizable:r.autoPlace,hideable:r.autoPlace}),Re.isUndefined(r.load)?r.load={preset:"Default"}:r.preset&&(r.load.preset=r.preset),Re.isUndefined(r.parent)&&r.hideable&&Bm.push(this),r.resizable=Re.isUndefined(r.parent)&&r.resizable,r.autoPlace&&Re.isUndefined(r.scrollable)&&(r.scrollable=!0);var s,u=ud&&localStorage.getItem(ac(this,"isLocal"))==="true",h=void 0,f=void 0;if(Object.defineProperties(this,{parent:{get:function(){return r.parent}},scrollable:{get:function(){return r.scrollable}},autoPlace:{get:function(){return r.autoPlace}},closeOnTop:{get:function(){return r.closeOnTop}},preset:{get:function(){return e.parent?e.getRoot().preset:r.load.preset},set:function(T){e.parent?e.getRoot().preset=T:r.load.preset=T,function(P){for(var j=0;j<P.__preset_select.length;j++)P.__preset_select[j].value===P.preset&&(P.__preset_select.selectedIndex=j)}(this),e.revert()}},width:{get:function(){return r.width},set:function(T){r.width=T,pf(e,T)}},name:{get:function(){return r.name},set:function(T){r.name=T,f&&(f.innerHTML=r.name)}},closed:{get:function(){return r.closed},set:function(T){r.closed=T,r.closed?re.addClass(e.__ul,o.CLASS_CLOSED):re.removeClass(e.__ul,o.CLASS_CLOSED),this.onResize(),e.__closeButton&&(e.__closeButton.innerHTML=T?o.TEXT_OPEN:o.TEXT_CLOSED)}},load:{get:function(){return r.load}},useLocalStorage:{get:function(){return u},set:function(T){ud&&(u=T,T?re.bind(window,"unload",h):re.unbind(window,"unload",h),localStorage.setItem(ac(e,"isLocal"),T))}}}),Re.isUndefined(r.parent)){if(this.closed=r.closed||!1,re.addClass(this.domElement,o.CLASS_MAIN),re.makeSelectable(this.domElement,!1),ud&&u){e.useLocalStorage=!0;var y=localStorage.getItem(ac(this,"gui"));y&&(r.load=JSON.parse(y))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=o.TEXT_CLOSED,re.addClass(this.__closeButton,o.CLASS_CLOSE_BUTTON),r.closeOnTop?(re.addClass(this.__closeButton,o.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(re.addClass(this.__closeButton,o.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),re.bind(this.__closeButton,"click",function(){e.closed=!e.closed})}else{r.closed===void 0&&(r.closed=!0);var b=document.createTextNode(r.name);re.addClass(b,"controller-name"),f=nm(e,b),re.addClass(this.__ul,o.CLASS_CLOSED),re.addClass(f,"title"),re.bind(f,"click",function(T){return T.preventDefault(),e.closed=!e.closed,!1}),r.closed||(this.closed=!1)}r.autoPlace&&(Re.isUndefined(r.parent)&&(Fm&&(hd=document.createElement("div"),re.addClass(hd,"dg"),re.addClass(hd,o.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(hd),Fm=!1),hd.appendChild(this.domElement),re.addClass(this.domElement,o.CLASS_AUTO_PLACE)),this.parent||pf(e,r.width)),this.__resizeHandler=function(){e.onResizeDebounced()},re.bind(window,"resize",this.__resizeHandler),re.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),re.bind(this.__ul,"transitionend",this.__resizeHandler),re.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),r.resizable&&dg(this),h=function(){ud&&localStorage.getItem(ac(e,"isLocal"))==="true"&&localStorage.setItem(ac(e,"gui"),JSON.stringify(e.getSaveObject()))},this.saveToLocalStorageIfPossible=h,r.parent||((s=e.getRoot()).width+=1,Re.defer(function(){s.width-=1}))};function nm(o,n,e){var r=document.createElement("li");return n&&r.appendChild(n),e?o.__ul.insertBefore(r,e):o.__ul.appendChild(r),o.onResize(),r}function km(o){re.unbind(window,"resize",o.__resizeHandler),o.saveToLocalStorageIfPossible&&re.unbind(window,"unload",o.saveToLocalStorageIfPossible)}function Br(o,n){var e=o.__preset_select[o.__preset_select.selectedIndex];e.innerHTML=n?e.value+"*":e.value}function rm(o,n){var e=o.getRoot(),r=e.__rememberedObjects.indexOf(n.object);if(r!==-1){var s=e.__rememberedObjectIndecesToControllers[r];if(s===void 0&&(s={},e.__rememberedObjectIndecesToControllers[r]=s),s[n.property]=n,e.load&&e.load.remembered){var u=e.load.remembered,h=void 0;if(u[o.preset])h=u[o.preset];else{if(!u.Default)return;h=u.Default}if(h[r]&&h[r][n.property]!==void 0){var f=h[r][n.property];n.initialValue=f,n.setValue(f)}}}}function hp(o,n,e,r){if(n[e]===void 0)throw new Error('Object "'+n+'" has no property "'+e+'"');var s=void 0;if(r.color)s=new Qf(n,e);else{var u=[n,e].concat(r.factoryArgs);s=sc.apply(o,u)}r.before instanceof wl&&(r.before=r.before.__li),rm(o,s),re.addClass(s.domElement,"c");var h=document.createElement("span");re.addClass(h,"property-name"),h.innerHTML=s.property;var f=document.createElement("div");f.appendChild(h),f.appendChild(s.domElement);var y=nm(o,f,r.before);return re.addClass(y,li.CLASS_CONTROLLER_ROW),s instanceof Qf?re.addClass(y,"color"):re.addClass(y,lg(s.getValue())),function(b,T,P){if(P.__li=T,P.__gui=b,Re.extend(P,{options:function(V){if(arguments.length>1){var K=P.__li.nextElementSibling;return P.remove(),hp(b,P.object,P.property,{before:K,factoryArgs:[Re.toArray(arguments)]})}if(Re.isArray(V)||Re.isObject(V)){var _t=P.__li.nextElementSibling;return P.remove(),hp(b,P.object,P.property,{before:_t,factoryArgs:[V]})}},name:function(V){return P.__li.firstElementChild.firstElementChild.innerHTML=V,P},listen:function(){return P.__gui.listen(P),P},remove:function(){return P.__gui.remove(P),P}}),P instanceof Kf){var j=new Sl(P.object,P.property,{min:P.__min,max:P.__max,step:P.__step});Re.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(V){var K=P[V],_t=j[V];P[V]=j[V]=function(){var Tt=Array.prototype.slice.call(arguments);return _t.apply(j,Tt),K.apply(P,Tt)}}),re.addClass(T,"has-slider"),P.domElement.insertBefore(j.domElement,P.domElement.firstElementChild)}else if(P instanceof Sl){var G=function(V){if(Re.isNumber(P.__min)&&Re.isNumber(P.__max)){var K=P.__li.firstElementChild.firstElementChild.innerHTML,_t=P.__gui.__listening.indexOf(P)>-1;P.remove();var Tt=hp(b,P.object,P.property,{before:P.__li.nextElementSibling,factoryArgs:[P.__min,P.__max,P.__step]});return Tt.name(K),_t&&Tt.listen(),Tt}return V};P.min=Re.compose(G,P.min),P.max=Re.compose(G,P.max)}else P instanceof Yf?(re.bind(T,"click",function(){re.fakeEvent(P.__checkbox,"click")}),re.bind(P.__checkbox,"click",function(V){V.stopPropagation()})):P instanceof Xu?(re.bind(T,"click",function(){re.fakeEvent(P.__button,"click")}),re.bind(T,"mouseover",function(){re.addClass(P.__button,"hover")}),re.bind(T,"mouseout",function(){re.removeClass(P.__button,"hover")})):P instanceof Qf&&(re.addClass(T,"color"),P.updateDisplay=Re.compose(function(V){return T.style.borderLeftColor=P.__color.toString(),V},P.updateDisplay),P.updateDisplay());P.setValue=Re.compose(function(V){return b.getRoot().__preset_select&&P.isModified()&&Br(b.getRoot(),!0),V},P.setValue)}(o,y,s),o.__controllers.push(s),s}function ac(o,n){return document.location.href+"."+n}function cd(o,n,e){var r=document.createElement("option");r.innerHTML=n,r.value=n,o.__preset_select.appendChild(r),e&&(o.__preset_select.selectedIndex=o.__preset_select.length-1)}function im(o,n){n.style.display=o.useLocalStorage?"block":"none"}function Um(o){var n=o.__save_row=document.createElement("li");re.addClass(o.domElement,"has-save"),o.__ul.insertBefore(n,o.__ul.firstChild),re.addClass(n,"save-row");var e=document.createElement("span");e.innerHTML="&nbsp;",re.addClass(e,"button gears");var r=document.createElement("span");r.innerHTML="Save",re.addClass(r,"button"),re.addClass(r,"save");var s=document.createElement("span");s.innerHTML="New",re.addClass(s,"button"),re.addClass(s,"save-as");var u=document.createElement("span");u.innerHTML="Revert",re.addClass(u,"button"),re.addClass(u,"revert");var h=o.__preset_select=document.createElement("select");if(o.load&&o.load.remembered?Re.each(o.load.remembered,function(T,P){cd(o,P,P===o.preset)}):cd(o,"Default",!1),re.bind(h,"change",function(){for(var T=0;T<o.__preset_select.length;T++)o.__preset_select[T].innerHTML=o.__preset_select[T].value;o.preset=this.value}),n.appendChild(h),n.appendChild(e),n.appendChild(r),n.appendChild(s),n.appendChild(u),ud){var f=document.getElementById("dg-local-explain"),y=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block",localStorage.getItem(ac(0,"isLocal"))==="true"&&y.setAttribute("checked","checked"),im(o,f),re.bind(y,"change",function(){o.useLocalStorage=!o.useLocalStorage,im(o,f)})}var b=document.getElementById("dg-new-constructor");re.bind(b,"keydown",function(T){!T.metaKey||T.which!==67&&T.keyCode!==67||df.hide()}),re.bind(e,"click",function(){b.innerHTML=JSON.stringify(o.getSaveObject(),void 0,2),df.show(),b.focus(),b.select()}),re.bind(r,"click",function(){o.save()}),re.bind(s,"click",function(){var T=prompt("Enter a new preset name.");T&&o.saveAs(T)}),re.bind(u,"click",function(){o.revert()})}function dg(o){var n=void 0;function e(u){return u.preventDefault(),o.width+=n-u.clientX,o.onResize(),n=u.clientX,!1}function r(){re.removeClass(o.__closeButton,li.CLASS_DRAG),re.unbind(window,"mousemove",e),re.unbind(window,"mouseup",r)}function s(u){return u.preventDefault(),n=u.clientX,re.addClass(o.__closeButton,li.CLASS_DRAG),re.bind(window,"mousemove",e),re.bind(window,"mouseup",r),!1}o.__resize_handle=document.createElement("div"),Re.extend(o.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),re.bind(o.__resize_handle,"mousedown",s),re.bind(o.__closeButton,"mousedown",s),o.domElement.insertBefore(o.__resize_handle,o.domElement.firstElementChild)}function pf(o,n){o.domElement.style.width=n+"px",o.__save_row&&o.autoPlace&&(o.__save_row.style.width=n+"px"),o.__closeButton&&(o.__closeButton.style.width=n+"px")}function dd(o,n){var e={};return Re.each(o.__rememberedObjects,function(r,s){var u={},h=o.__rememberedObjectIndecesToControllers[s];Re.each(h,function(f,y){u[y]=n?f.initialValue:f.getValue()}),e[s]=u}),e}li.toggleHide=function(){em=!em,Re.each(Bm,function(o){o.domElement.style.display=em?"none":""})},li.CLASS_AUTO_PLACE="a",li.CLASS_AUTO_PLACE_CONTAINER="ac",li.CLASS_MAIN="main",li.CLASS_CONTROLLER_ROW="cr",li.CLASS_TOO_TALL="taller-than-window",li.CLASS_CLOSED="closed",li.CLASS_CLOSE_BUTTON="close-button",li.CLASS_CLOSE_TOP="close-top",li.CLASS_CLOSE_BOTTOM="close-bottom",li.CLASS_DRAG="drag",li.DEFAULT_WIDTH=245,li.TEXT_CLOSED="Close Controls",li.TEXT_OPEN="Open Controls",li._keydownHandler=function(o){document.activeElement.type==="text"||o.which!==72&&o.keyCode!==72||li.toggleHide()},re.bind(window,"keydown",li._keydownHandler,!1),Re.extend(li.prototype,{add:function(o,n){return hp(this,o,n,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(o,n){return hp(this,o,n,{color:!0})},remove:function(o){this.__ul.removeChild(o.__li),this.__controllers.splice(this.__controllers.indexOf(o),1);var n=this;Re.defer(function(){n.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&hd.removeChild(this.domElement);var o=this;Re.each(this.__folders,function(n){o.removeFolder(n)}),re.unbind(window,"keydown",li._keydownHandler,!1),km(this)},addFolder:function(o){if(this.__folders[o]!==void 0)throw new Error('You already have a folder in this GUI by the name "'+o+'"');var n={name:o,parent:this};n.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[o]&&(n.closed=this.load.folders[o].closed,n.load=this.load.folders[o]);var e=new li(n);this.__folders[o]=e;var r=nm(this,e.domElement);return re.addClass(r,"folder"),e},removeFolder:function(o){this.__ul.removeChild(o.domElement.parentElement),delete this.__folders[o.name],this.load&&this.load.folders&&this.load.folders[o.name]&&delete this.load.folders[o.name],km(o);var n=this;Re.each(o.__folders,function(e){o.removeFolder(e)}),Re.defer(function(){n.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var o=this.getRoot();if(o.scrollable){var n=re.getOffset(o.__ul).top,e=0;Re.each(o.__ul.childNodes,function(r){o.autoPlace&&r===o.__save_row||(e+=re.getHeight(r))}),window.innerHeight-n-20<e?(re.addClass(o.domElement,li.CLASS_TOO_TALL),o.__ul.style.height=window.innerHeight-n-20+"px"):(re.removeClass(o.domElement,li.CLASS_TOO_TALL),o.__ul.style.height="auto")}o.__resize_handle&&Re.defer(function(){o.__resize_handle.style.height=o.__ul.offsetHeight+"px"}),o.__closeButton&&(o.__closeButton.style.width=o.width+"px")},onResizeDebounced:Re.debounce(function(){this.onResize()},50),remember:function(){if(Re.isUndefined(df)&&((df=new Nm).domElement.innerHTML=hg),this.parent)throw new Error("You can only call remember on a top level GUI.");var o=this;Re.each(Array.prototype.slice.call(arguments),function(n){o.__rememberedObjects.length===0&&Um(o),o.__rememberedObjects.indexOf(n)===-1&&o.__rememberedObjects.push(n)}),this.autoPlace&&pf(this,this.width)},getRoot:function(){for(var o=this;o.parent;)o=o.parent;return o},getSaveObject:function(){var o=this.load;return o.closed=this.closed,this.__rememberedObjects.length>0&&(o.preset=this.preset,o.remembered||(o.remembered={}),o.remembered[this.preset]=dd(this)),o.folders={},Re.each(this.__folders,function(n,e){o.folders[e]=n.getSaveObject()}),o},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=dd(this),Br(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(o){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=dd(this,!0)),this.load.remembered[o]=dd(this),this.preset=o,cd(this,o,!0),this.saveToLocalStorageIfPossible()},revert:function(o){Re.each(this.__controllers,function(n){this.getRoot().load.remembered?rm(o||this.getRoot(),n):n.setValue(n.initialValue),n.__onFinishChange&&n.__onFinishChange.call(n,n.getValue())},this),Re.each(this.__folders,function(n){n.revert(n)}),o||Br(this.getRoot(),!1)},listen:function(o){var n=this.__listening.length===0;this.__listening.push(o),n&&function e(r){r.length!==0&&cg.call(window,function(){e(r)}),Re.each(r,function(s){s.updateDisplay()})}(this.__listening)},updateDisplay:function(){Re.each(this.__controllers,function(o){o.updateDisplay()}),Re.each(this.__folders,function(o){o.updateDisplay()})}});var pg=li,fg=function(){function o(n){this.runTime={fps:0,resolution:""},this.target=n.target,this.data=n.params,this.player=n.player,this.gui=this.createControllerGUI(),this.createStats(),this.addEventListener()}return o.prototype.createStats=function(){var n=this;this.stateId=setInterval(function(){n.player.view&&(n.controller.runTimeFps.setValue(n.player.runtime.fps),n.controller.runTimeResolution.setValue(n.player.view.width+"*"+n.player.view.height))},500)},o.prototype.createControllerGUI=function(){var n,e,r,s,u,h=new pg({autoPlace:!0,closed:!0});return h.domElement.style.opacity=".6",h.domElement.style.transformOrigin="100% 0",h.domElement.style.transform="scale(1.4)",this.target.appendChild(h.domElement),h.domElement.style.position="absolute",h.domElement.style.right="0",h.domElement.style.top="0",h.domElement.style.zIndex="2",this.controller={runTimeFps:h.add({FPS:0},"FPS",0),runTimeResolution:h.add({\u5206\u8FA8\u7387:""},"\u5206\u8FA8\u7387",""),autoResolution:h.add({\u81EA\u52A8\u5206\u8FA8\u7387:(n=this.data.autoResolution)!==null&&n!==void 0&&n},"\u81EA\u52A8\u5206\u8FA8\u7387",!0),autoFps:h.add({\u81EA\u52A8fps:(e=this.data.autoFPS)===null||e===void 0||e},"\u81EA\u52A8fps",!0),moreCalculation:h.add({\u989D\u5916\u8BA1\u7B97:0},"\u989D\u5916\u8BA1\u7B97",0,100),minFPS:h.add({\u6700\u4F4Efps:(r=this.data.minFPS)!==null&&r!==void 0?r:40},"\u6700\u4F4Efps",0,60),maxFPS:h.add({\u6700\u9AD8fps:(s=this.data.maxFPS)!==null&&s!==void 0?s:50},"\u6700\u9AD8fps",0,60),resolution:h.add({\u76EE\u6807\u5206\u8FA8\u500D\u7387:(u=this.data.resolution)!==null&&u!==void 0?u:window.devicePixelRatio},"\u76EE\u6807\u5206\u8FA8\u500D\u7387",.5,4)},this.controller.runTimeFps.disabled=!0,this.controller.runTimeResolution.disabled=!0,h},o.prototype.addEventListener=function(){var n,e=this;this.controller.autoFps.onChange(function(r){e.data.autoFPS=r,e.player.updateConfig(e.data)}),this.controller.maxFPS.onChange(function(r){e.data.maxFPS=r,e.player.updateConfig(e.data)}),this.controller.minFPS.onChange(function(r){e.data.minFPS=r,e.player.updateConfig(e.data)}),this.controller.autoResolution.onChange(function(r){e.data.autoResolution=r,e.player.updateConfig(e.data)}),this.controller.resolution.onChange(function(r){e.data.resolution=r,e.player.updateConfig(e.data)}),this.controller.moreCalculation.onChange(function(r){n&&e.player.app.ticker.remove(n),r>0&&(n=function(){for(var s="";s.length<8e3*r;)s+=Math.random().toString(32).substr(2);Nu()(s)},e.player.app.ticker.add(n))})},o.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.target.removeChild(this.gui.domElement),this.gui.destroy()}catch{}},o}(),Gm=function(){function o(n){var e=this;this.tasks=[],this.schedule=function(){var r=e.tasks[0];r?e.fn(r).then(function(){e.tasks.splice(0,1),window.requestAnimationFrame(e.schedule)}):window.requestAnimationFrame(e.schedule)},this.fn=n,this.schedule()}return o.prototype.addTask=function(n){this.tasks.push(n)},o}(),pd=function(){function o(){this.autoUnlock=Object.create(null),this.locks=Object.create(null)}return o.prototype.addLock=function(n,e){var r=this;this.locks[n]=e,this.autoUnlock[n]=window.setTimeout(function(){delete r.locks[n]},3e3)},o.prototype.unlock=function(n,e){e&&this.locks[n]&&this.locks[n]===e&&(window.clearTimeout(this.autoUnlock[n]),delete this.locks[n])},o.prototype.isLocked=function(n){return!!this.locks[n]},o}(),Hm=function(){var o=function(n,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(r[u]=s[u])})(n,e)};return function(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}o(n,e),n.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Yu=function(){return(Yu=Object.assign||function(o){for(var n,e=1,r=arguments.length;e<r;e++)for(var s in n=arguments[e])Object.prototype.hasOwnProperty.call(n,s)&&(o[s]=n[s]);return o}).apply(this,arguments)},Ta=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})},Ea=function(o,n){var e,r,s,u,h={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(y){return function(b){return function(T){if(e)throw new TypeError("Generator is already executing.");for(;h;)try{if(e=1,r&&(s=2&T[0]?r.return:T[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,T[1])).done)return s;switch(r=0,s&&(T=[2&T[0],s.value]),T[0]){case 0:case 1:s=T;break;case 4:return h.label++,{value:T[1],done:!1};case 5:h.label++,r=T[1],T=[0];continue;case 7:T=h.ops.pop(),h.trys.pop();continue;default:if(s=h.trys,!((s=s.length>0&&s[s.length-1])||T[0]!==6&&T[0]!==2)){h=0;continue}if(T[0]===3&&(!s||T[1]>s[0]&&T[1]<s[3])){h.label=T[1];break}if(T[0]===6&&h.label<s[1]){h.label=s[1],s=T;break}if(s&&h.label<s[2]){h.label=s[2],h.ops.push(T);break}s[2]&&h.ops.pop(),h.trys.pop();continue}T=n.call(o,h)}catch(P){T=[6,P],r=0}finally{e=s=0}if(5&T[0])throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}([y,b])}}};window.__slide_local_logger__||(window.__slide_local_logger__=pt.createInstance({name:"_slide_local_log_",driver:pt.INDEXEDDB,version:1}));var Zu=window.__slide_local_logger__,mg=window.ResizeObserver||Vf,lu=function(o){return new Promise(function(n){return setTimeout(n,o)})};function fd(o,n){return Ta(this,void 0,void 0,function(){var e;return Ea(this,function(r){switch(r.label){case 0:e=Date.now(),r.label=1;case 1:return!o()&&Date.now()-e<n?[4,lu(50)]:[3,3];case 2:return r.sent(),[3,1];case 3:return[2]}})})}var Ds={syncDispatch:"syncDispatch",syncReceive:"syncReceive",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange"},om={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},gg=function(o){function n(e){var r=o.call(this)||this;return r.__slideState=Object(X.cloneDeep)(om),r.resize=!1,r.isAnimating=!1,r.renderingTaskManager=new Im,r.isLoading=!1,r.interactive=!0,r.frameWidth=1,r.frameHeight=1,r.frame=document.createElement("div"),r.medianController=document.createElement("div"),r.frameResizeObserver=new mg(function(){return r.frameResizeHandler()}),r.timestamp=function(){return Date.now()},r.mode="local",r.log="",r.logId="",r.lastEmitedState=null,r.playerController=null,r.lock=new pd,r.isInitResized=!1,r.cacheImage=document.createElement("img"),r.isFrowning=!1,r.isReleasing=!1,r.designWidth=0,r.designHeight=0,r._slideCount=0,r.persistLog=function(){return Ta(r,void 0,void 0,function(){var s,u;return Ea(this,function(h){switch(h.label){case 0:if(!Zu||!this.logId)return[3,5];h.label=1;case 1:return h.trys.push([1,4,,5]),s=this.log,[4,Zu.getItem(this.logId)];case 2:return u=h.sent()||"",[4,Zu.setItem(this.logId,u+s)];case 3:return h.sent(),this.log="",[3,5];case 4:return h.sent(),[3,5];case 5:return[2]}})})},r.handleSlideRef=function(){console.log(r)},r.handleSlideStateLog=function(){console.log(r.logId),console.log(JSON.stringify(r.slideState,null,2))},r.handleLogDownload=function(){return Ta(r,void 0,void 0,function(){var s,u,h;return Ea(this,function(f){switch(f.label){case 0:return s="",Zu?(u=s,[4,Zu.getItem(this.logId)]):[3,2];case 1:s=u+(f.sent()||""),f.label=2;case 2:return s+=this.log,(h=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(s)),h.setAttribute("download",this.logId),h.style.display="none",document.body.appendChild(h),h.click(),document.body.removeChild(h),[2]}})})},r.receiveSyncHandler=function(s){return Ta(r,void 0,void 0,function(){var u,h,f,y,b=this;return Ea(this,function(T){switch(T.label){case 0:return this.log+="=== sync receive ["+new Date().toISOString()+`] ===
6065
+ </div>`,sc=function(o,n){var e=o[n];return Re.isArray(arguments[2])||Re.isObject(arguments[2])?new Dm(o,n,arguments[2]):Re.isNumber(e)?Re.isNumber(arguments[2])&&Re.isNumber(arguments[3])?Re.isNumber(arguments[4])?new Kf(o,n,arguments[2],arguments[3],arguments[4]):new Kf(o,n,arguments[2],arguments[3]):Re.isNumber(arguments[4])?new Sl(o,n,{min:arguments[2],max:arguments[3],step:arguments[4]}):new Sl(o,n,{min:arguments[2],max:arguments[3]}):Re.isString(e)?new ug(o,n):Re.isFunction(e)?new Xu(o,n,""):Re.isBoolean(e)?new Yf(o,n):null},cg=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(o){setTimeout(o,1e3/60)},Fm=function(){function o(){tl(this,o),this.backgroundElement=document.createElement("div"),Re.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),re.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),Re.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var n=this;re.bind(this.backgroundElement,"click",function(){n.hide()})}return Sa(o,[{key:"show",value:function(){var n=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),Re.defer(function(){n.backgroundElement.style.opacity=1,n.domElement.style.opacity=1,n.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var n=this,e=function r(){n.domElement.style.display="none",n.backgroundElement.style.display="none",re.unbind(n.domElement,"webkitTransitionEnd",r),re.unbind(n.domElement,"transitionend",r),re.unbind(n.domElement,"oTransitionEnd",r)};re.bind(this.domElement,"webkitTransitionEnd",e),re.bind(this.domElement,"transitionend",e),re.bind(this.domElement,"oTransitionEnd",e),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=window.innerWidth/2-re.getWidth(this.domElement)/2+"px",this.domElement.style.top=window.innerHeight/2-re.getHeight(this.domElement)/2+"px"}}]),o}();Nm(function(o){if(o&&typeof window!="undefined"){var n=document.createElement("style");return n.setAttribute("type","text/css"),n.innerHTML=o,document.head.appendChild(n),o}}(`.dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}
6066
+ `));var ud=function(){try{return!!window.localStorage}catch{return!1}}(),df=void 0,Bm=!0,hd=void 0,em=!1,km=[],li=function o(n){var e=this,r=n||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),re.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],r=Re.defaults(r,{closeOnTop:!1,autoPlace:!0,width:o.DEFAULT_WIDTH}),r=Re.defaults(r,{resizable:r.autoPlace,hideable:r.autoPlace}),Re.isUndefined(r.load)?r.load={preset:"Default"}:r.preset&&(r.load.preset=r.preset),Re.isUndefined(r.parent)&&r.hideable&&km.push(this),r.resizable=Re.isUndefined(r.parent)&&r.resizable,r.autoPlace&&Re.isUndefined(r.scrollable)&&(r.scrollable=!0);var s,u=ud&&localStorage.getItem(ac(this,"isLocal"))==="true",h=void 0,f=void 0;if(Object.defineProperties(this,{parent:{get:function(){return r.parent}},scrollable:{get:function(){return r.scrollable}},autoPlace:{get:function(){return r.autoPlace}},closeOnTop:{get:function(){return r.closeOnTop}},preset:{get:function(){return e.parent?e.getRoot().preset:r.load.preset},set:function(T){e.parent?e.getRoot().preset=T:r.load.preset=T,function(P){for(var j=0;j<P.__preset_select.length;j++)P.__preset_select[j].value===P.preset&&(P.__preset_select.selectedIndex=j)}(this),e.revert()}},width:{get:function(){return r.width},set:function(T){r.width=T,pf(e,T)}},name:{get:function(){return r.name},set:function(T){r.name=T,f&&(f.innerHTML=r.name)}},closed:{get:function(){return r.closed},set:function(T){r.closed=T,r.closed?re.addClass(e.__ul,o.CLASS_CLOSED):re.removeClass(e.__ul,o.CLASS_CLOSED),this.onResize(),e.__closeButton&&(e.__closeButton.innerHTML=T?o.TEXT_OPEN:o.TEXT_CLOSED)}},load:{get:function(){return r.load}},useLocalStorage:{get:function(){return u},set:function(T){ud&&(u=T,T?re.bind(window,"unload",h):re.unbind(window,"unload",h),localStorage.setItem(ac(e,"isLocal"),T))}}}),Re.isUndefined(r.parent)){if(this.closed=r.closed||!1,re.addClass(this.domElement,o.CLASS_MAIN),re.makeSelectable(this.domElement,!1),ud&&u){e.useLocalStorage=!0;var y=localStorage.getItem(ac(this,"gui"));y&&(r.load=JSON.parse(y))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=o.TEXT_CLOSED,re.addClass(this.__closeButton,o.CLASS_CLOSE_BUTTON),r.closeOnTop?(re.addClass(this.__closeButton,o.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(re.addClass(this.__closeButton,o.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),re.bind(this.__closeButton,"click",function(){e.closed=!e.closed})}else{r.closed===void 0&&(r.closed=!0);var b=document.createTextNode(r.name);re.addClass(b,"controller-name"),f=nm(e,b),re.addClass(this.__ul,o.CLASS_CLOSED),re.addClass(f,"title"),re.bind(f,"click",function(T){return T.preventDefault(),e.closed=!e.closed,!1}),r.closed||(this.closed=!1)}r.autoPlace&&(Re.isUndefined(r.parent)&&(Bm&&(hd=document.createElement("div"),re.addClass(hd,"dg"),re.addClass(hd,o.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(hd),Bm=!1),hd.appendChild(this.domElement),re.addClass(this.domElement,o.CLASS_AUTO_PLACE)),this.parent||pf(e,r.width)),this.__resizeHandler=function(){e.onResizeDebounced()},re.bind(window,"resize",this.__resizeHandler),re.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),re.bind(this.__ul,"transitionend",this.__resizeHandler),re.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),r.resizable&&dg(this),h=function(){ud&&localStorage.getItem(ac(e,"isLocal"))==="true"&&localStorage.setItem(ac(e,"gui"),JSON.stringify(e.getSaveObject()))},this.saveToLocalStorageIfPossible=h,r.parent||((s=e.getRoot()).width+=1,Re.defer(function(){s.width-=1}))};function nm(o,n,e){var r=document.createElement("li");return n&&r.appendChild(n),e?o.__ul.insertBefore(r,e):o.__ul.appendChild(r),o.onResize(),r}function Um(o){re.unbind(window,"resize",o.__resizeHandler),o.saveToLocalStorageIfPossible&&re.unbind(window,"unload",o.saveToLocalStorageIfPossible)}function Br(o,n){var e=o.__preset_select[o.__preset_select.selectedIndex];e.innerHTML=n?e.value+"*":e.value}function rm(o,n){var e=o.getRoot(),r=e.__rememberedObjects.indexOf(n.object);if(r!==-1){var s=e.__rememberedObjectIndecesToControllers[r];if(s===void 0&&(s={},e.__rememberedObjectIndecesToControllers[r]=s),s[n.property]=n,e.load&&e.load.remembered){var u=e.load.remembered,h=void 0;if(u[o.preset])h=u[o.preset];else{if(!u.Default)return;h=u.Default}if(h[r]&&h[r][n.property]!==void 0){var f=h[r][n.property];n.initialValue=f,n.setValue(f)}}}}function hp(o,n,e,r){if(n[e]===void 0)throw new Error('Object "'+n+'" has no property "'+e+'"');var s=void 0;if(r.color)s=new Qf(n,e);else{var u=[n,e].concat(r.factoryArgs);s=sc.apply(o,u)}r.before instanceof wl&&(r.before=r.before.__li),rm(o,s),re.addClass(s.domElement,"c");var h=document.createElement("span");re.addClass(h,"property-name"),h.innerHTML=s.property;var f=document.createElement("div");f.appendChild(h),f.appendChild(s.domElement);var y=nm(o,f,r.before);return re.addClass(y,li.CLASS_CONTROLLER_ROW),s instanceof Qf?re.addClass(y,"color"):re.addClass(y,lg(s.getValue())),function(b,T,P){if(P.__li=T,P.__gui=b,Re.extend(P,{options:function(V){if(arguments.length>1){var K=P.__li.nextElementSibling;return P.remove(),hp(b,P.object,P.property,{before:K,factoryArgs:[Re.toArray(arguments)]})}if(Re.isArray(V)||Re.isObject(V)){var _t=P.__li.nextElementSibling;return P.remove(),hp(b,P.object,P.property,{before:_t,factoryArgs:[V]})}},name:function(V){return P.__li.firstElementChild.firstElementChild.innerHTML=V,P},listen:function(){return P.__gui.listen(P),P},remove:function(){return P.__gui.remove(P),P}}),P instanceof Kf){var j=new Sl(P.object,P.property,{min:P.__min,max:P.__max,step:P.__step});Re.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(V){var K=P[V],_t=j[V];P[V]=j[V]=function(){var Tt=Array.prototype.slice.call(arguments);return _t.apply(j,Tt),K.apply(P,Tt)}}),re.addClass(T,"has-slider"),P.domElement.insertBefore(j.domElement,P.domElement.firstElementChild)}else if(P instanceof Sl){var G=function(V){if(Re.isNumber(P.__min)&&Re.isNumber(P.__max)){var K=P.__li.firstElementChild.firstElementChild.innerHTML,_t=P.__gui.__listening.indexOf(P)>-1;P.remove();var Tt=hp(b,P.object,P.property,{before:P.__li.nextElementSibling,factoryArgs:[P.__min,P.__max,P.__step]});return Tt.name(K),_t&&Tt.listen(),Tt}return V};P.min=Re.compose(G,P.min),P.max=Re.compose(G,P.max)}else P instanceof Yf?(re.bind(T,"click",function(){re.fakeEvent(P.__checkbox,"click")}),re.bind(P.__checkbox,"click",function(V){V.stopPropagation()})):P instanceof Xu?(re.bind(T,"click",function(){re.fakeEvent(P.__button,"click")}),re.bind(T,"mouseover",function(){re.addClass(P.__button,"hover")}),re.bind(T,"mouseout",function(){re.removeClass(P.__button,"hover")})):P instanceof Qf&&(re.addClass(T,"color"),P.updateDisplay=Re.compose(function(V){return T.style.borderLeftColor=P.__color.toString(),V},P.updateDisplay),P.updateDisplay());P.setValue=Re.compose(function(V){return b.getRoot().__preset_select&&P.isModified()&&Br(b.getRoot(),!0),V},P.setValue)}(o,y,s),o.__controllers.push(s),s}function ac(o,n){return document.location.href+"."+n}function cd(o,n,e){var r=document.createElement("option");r.innerHTML=n,r.value=n,o.__preset_select.appendChild(r),e&&(o.__preset_select.selectedIndex=o.__preset_select.length-1)}function im(o,n){n.style.display=o.useLocalStorage?"block":"none"}function Gm(o){var n=o.__save_row=document.createElement("li");re.addClass(o.domElement,"has-save"),o.__ul.insertBefore(n,o.__ul.firstChild),re.addClass(n,"save-row");var e=document.createElement("span");e.innerHTML="&nbsp;",re.addClass(e,"button gears");var r=document.createElement("span");r.innerHTML="Save",re.addClass(r,"button"),re.addClass(r,"save");var s=document.createElement("span");s.innerHTML="New",re.addClass(s,"button"),re.addClass(s,"save-as");var u=document.createElement("span");u.innerHTML="Revert",re.addClass(u,"button"),re.addClass(u,"revert");var h=o.__preset_select=document.createElement("select");if(o.load&&o.load.remembered?Re.each(o.load.remembered,function(T,P){cd(o,P,P===o.preset)}):cd(o,"Default",!1),re.bind(h,"change",function(){for(var T=0;T<o.__preset_select.length;T++)o.__preset_select[T].innerHTML=o.__preset_select[T].value;o.preset=this.value}),n.appendChild(h),n.appendChild(e),n.appendChild(r),n.appendChild(s),n.appendChild(u),ud){var f=document.getElementById("dg-local-explain"),y=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block",localStorage.getItem(ac(0,"isLocal"))==="true"&&y.setAttribute("checked","checked"),im(o,f),re.bind(y,"change",function(){o.useLocalStorage=!o.useLocalStorage,im(o,f)})}var b=document.getElementById("dg-new-constructor");re.bind(b,"keydown",function(T){!T.metaKey||T.which!==67&&T.keyCode!==67||df.hide()}),re.bind(e,"click",function(){b.innerHTML=JSON.stringify(o.getSaveObject(),void 0,2),df.show(),b.focus(),b.select()}),re.bind(r,"click",function(){o.save()}),re.bind(s,"click",function(){var T=prompt("Enter a new preset name.");T&&o.saveAs(T)}),re.bind(u,"click",function(){o.revert()})}function dg(o){var n=void 0;function e(u){return u.preventDefault(),o.width+=n-u.clientX,o.onResize(),n=u.clientX,!1}function r(){re.removeClass(o.__closeButton,li.CLASS_DRAG),re.unbind(window,"mousemove",e),re.unbind(window,"mouseup",r)}function s(u){return u.preventDefault(),n=u.clientX,re.addClass(o.__closeButton,li.CLASS_DRAG),re.bind(window,"mousemove",e),re.bind(window,"mouseup",r),!1}o.__resize_handle=document.createElement("div"),Re.extend(o.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),re.bind(o.__resize_handle,"mousedown",s),re.bind(o.__closeButton,"mousedown",s),o.domElement.insertBefore(o.__resize_handle,o.domElement.firstElementChild)}function pf(o,n){o.domElement.style.width=n+"px",o.__save_row&&o.autoPlace&&(o.__save_row.style.width=n+"px"),o.__closeButton&&(o.__closeButton.style.width=n+"px")}function dd(o,n){var e={};return Re.each(o.__rememberedObjects,function(r,s){var u={},h=o.__rememberedObjectIndecesToControllers[s];Re.each(h,function(f,y){u[y]=n?f.initialValue:f.getValue()}),e[s]=u}),e}li.toggleHide=function(){em=!em,Re.each(km,function(o){o.domElement.style.display=em?"none":""})},li.CLASS_AUTO_PLACE="a",li.CLASS_AUTO_PLACE_CONTAINER="ac",li.CLASS_MAIN="main",li.CLASS_CONTROLLER_ROW="cr",li.CLASS_TOO_TALL="taller-than-window",li.CLASS_CLOSED="closed",li.CLASS_CLOSE_BUTTON="close-button",li.CLASS_CLOSE_TOP="close-top",li.CLASS_CLOSE_BOTTOM="close-bottom",li.CLASS_DRAG="drag",li.DEFAULT_WIDTH=245,li.TEXT_CLOSED="Close Controls",li.TEXT_OPEN="Open Controls",li._keydownHandler=function(o){document.activeElement.type==="text"||o.which!==72&&o.keyCode!==72||li.toggleHide()},re.bind(window,"keydown",li._keydownHandler,!1),Re.extend(li.prototype,{add:function(o,n){return hp(this,o,n,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(o,n){return hp(this,o,n,{color:!0})},remove:function(o){this.__ul.removeChild(o.__li),this.__controllers.splice(this.__controllers.indexOf(o),1);var n=this;Re.defer(function(){n.onResize()})},destroy:function(){if(this.parent)throw new Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&hd.removeChild(this.domElement);var o=this;Re.each(this.__folders,function(n){o.removeFolder(n)}),re.unbind(window,"keydown",li._keydownHandler,!1),Um(this)},addFolder:function(o){if(this.__folders[o]!==void 0)throw new Error('You already have a folder in this GUI by the name "'+o+'"');var n={name:o,parent:this};n.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[o]&&(n.closed=this.load.folders[o].closed,n.load=this.load.folders[o]);var e=new li(n);this.__folders[o]=e;var r=nm(this,e.domElement);return re.addClass(r,"folder"),e},removeFolder:function(o){this.__ul.removeChild(o.domElement.parentElement),delete this.__folders[o.name],this.load&&this.load.folders&&this.load.folders[o.name]&&delete this.load.folders[o.name],Um(o);var n=this;Re.each(o.__folders,function(e){o.removeFolder(e)}),Re.defer(function(){n.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var o=this.getRoot();if(o.scrollable){var n=re.getOffset(o.__ul).top,e=0;Re.each(o.__ul.childNodes,function(r){o.autoPlace&&r===o.__save_row||(e+=re.getHeight(r))}),window.innerHeight-n-20<e?(re.addClass(o.domElement,li.CLASS_TOO_TALL),o.__ul.style.height=window.innerHeight-n-20+"px"):(re.removeClass(o.domElement,li.CLASS_TOO_TALL),o.__ul.style.height="auto")}o.__resize_handle&&Re.defer(function(){o.__resize_handle.style.height=o.__ul.offsetHeight+"px"}),o.__closeButton&&(o.__closeButton.style.width=o.width+"px")},onResizeDebounced:Re.debounce(function(){this.onResize()},50),remember:function(){if(Re.isUndefined(df)&&((df=new Fm).domElement.innerHTML=hg),this.parent)throw new Error("You can only call remember on a top level GUI.");var o=this;Re.each(Array.prototype.slice.call(arguments),function(n){o.__rememberedObjects.length===0&&Gm(o),o.__rememberedObjects.indexOf(n)===-1&&o.__rememberedObjects.push(n)}),this.autoPlace&&pf(this,this.width)},getRoot:function(){for(var o=this;o.parent;)o=o.parent;return o},getSaveObject:function(){var o=this.load;return o.closed=this.closed,this.__rememberedObjects.length>0&&(o.preset=this.preset,o.remembered||(o.remembered={}),o.remembered[this.preset]=dd(this)),o.folders={},Re.each(this.__folders,function(n,e){o.folders[e]=n.getSaveObject()}),o},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=dd(this),Br(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(o){this.load.remembered||(this.load.remembered={},this.load.remembered.Default=dd(this,!0)),this.load.remembered[o]=dd(this),this.preset=o,cd(this,o,!0),this.saveToLocalStorageIfPossible()},revert:function(o){Re.each(this.__controllers,function(n){this.getRoot().load.remembered?rm(o||this.getRoot(),n):n.setValue(n.initialValue),n.__onFinishChange&&n.__onFinishChange.call(n,n.getValue())},this),Re.each(this.__folders,function(n){n.revert(n)}),o||Br(this.getRoot(),!1)},listen:function(o){var n=this.__listening.length===0;this.__listening.push(o),n&&function e(r){r.length!==0&&cg.call(window,function(){e(r)}),Re.each(r,function(s){s.updateDisplay()})}(this.__listening)},updateDisplay:function(){Re.each(this.__controllers,function(o){o.updateDisplay()}),Re.each(this.__folders,function(o){o.updateDisplay()})}});var pg=li,fg=function(){function o(n){this.runTime={fps:0,resolution:""},this.target=n.target,this.data=n.params,this.player=n.player,this.gui=this.createControllerGUI(),this.createStats(),this.addEventListener()}return o.prototype.createStats=function(){var n=this;this.stateId=setInterval(function(){n.player.view&&(n.controller.runTimeFps.setValue(n.player.runtime.fps),n.controller.runTimeResolution.setValue(n.player.view.width+"*"+n.player.view.height))},500)},o.prototype.createControllerGUI=function(){var n,e,r,s,u,h=new pg({autoPlace:!0,closed:!0});return h.domElement.style.opacity=".6",h.domElement.style.transformOrigin="100% 0",h.domElement.style.transform="scale(1.4)",this.target.appendChild(h.domElement),h.domElement.style.position="absolute",h.domElement.style.right="0",h.domElement.style.top="0",h.domElement.style.zIndex="2",this.controller={runTimeFps:h.add({FPS:0},"FPS",0),runTimeResolution:h.add({\u5206\u8FA8\u7387:""},"\u5206\u8FA8\u7387",""),autoResolution:h.add({\u81EA\u52A8\u5206\u8FA8\u7387:(n=this.data.autoResolution)!==null&&n!==void 0&&n},"\u81EA\u52A8\u5206\u8FA8\u7387",!0),autoFps:h.add({\u81EA\u52A8fps:(e=this.data.autoFPS)===null||e===void 0||e},"\u81EA\u52A8fps",!0),moreCalculation:h.add({\u989D\u5916\u8BA1\u7B97:0},"\u989D\u5916\u8BA1\u7B97",0,100),minFPS:h.add({\u6700\u4F4Efps:(r=this.data.minFPS)!==null&&r!==void 0?r:40},"\u6700\u4F4Efps",0,60),maxFPS:h.add({\u6700\u9AD8fps:(s=this.data.maxFPS)!==null&&s!==void 0?s:50},"\u6700\u9AD8fps",0,60),resolution:h.add({\u76EE\u6807\u5206\u8FA8\u500D\u7387:(u=this.data.resolution)!==null&&u!==void 0?u:window.devicePixelRatio},"\u76EE\u6807\u5206\u8FA8\u500D\u7387",.5,4)},this.controller.runTimeFps.disabled=!0,this.controller.runTimeResolution.disabled=!0,h},o.prototype.addEventListener=function(){var n,e=this;this.controller.autoFps.onChange(function(r){e.data.autoFPS=r,e.player.updateConfig(e.data)}),this.controller.maxFPS.onChange(function(r){e.data.maxFPS=r,e.player.updateConfig(e.data)}),this.controller.minFPS.onChange(function(r){e.data.minFPS=r,e.player.updateConfig(e.data)}),this.controller.autoResolution.onChange(function(r){e.data.autoResolution=r,e.player.updateConfig(e.data)}),this.controller.resolution.onChange(function(r){e.data.resolution=r,e.player.updateConfig(e.data)}),this.controller.moreCalculation.onChange(function(r){n&&e.player.app.ticker.remove(n),r>0&&(n=function(){for(var s="";s.length<8e3*r;)s+=Math.random().toString(32).substr(2);Nu()(s)},e.player.app.ticker.add(n))})},o.prototype.destroy=function(){try{window.clearInterval(this.stateId),this.target.removeChild(this.gui.domElement),this.gui.destroy()}catch{}},o}(),Hm=function(){function o(n){var e=this;this.tasks=[],this.schedule=function(){var r=e.tasks[0];r?e.fn(r).then(function(){e.tasks.splice(0,1),window.requestAnimationFrame(e.schedule)}):window.requestAnimationFrame(e.schedule)},this.fn=n,this.schedule()}return o.prototype.addTask=function(n){this.tasks.push(n)},o}(),pd=function(){function o(){this.autoUnlock=Object.create(null),this.locks=Object.create(null)}return o.prototype.addLock=function(n,e){var r=this;this.locks[n]=e,this.autoUnlock[n]=window.setTimeout(function(){delete r.locks[n]},3e3)},o.prototype.unlock=function(n,e){e&&this.locks[n]&&this.locks[n]===e&&(window.clearTimeout(this.autoUnlock[n]),delete this.locks[n])},o.prototype.isLocked=function(n){return!!this.locks[n]},o}(),zm=function(){var o=function(n,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(r[u]=s[u])})(n,e)};return function(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=n}o(n,e),n.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}}(),Yu=function(){return(Yu=Object.assign||function(o){for(var n,e=1,r=arguments.length;e<r;e++)for(var s in n=arguments[e])Object.prototype.hasOwnProperty.call(n,s)&&(o[s]=n[s]);return o}).apply(this,arguments)},Ta=function(o,n,e,r){return new(e||(e=Promise))(function(s,u){function h(b){try{y(r.next(b))}catch(T){u(T)}}function f(b){try{y(r.throw(b))}catch(T){u(T)}}function y(b){var T;b.done?s(b.value):(T=b.value,T instanceof e?T:new e(function(P){P(T)})).then(h,f)}y((r=r.apply(o,n||[])).next())})},Ea=function(o,n){var e,r,s,u,h={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(y){return function(b){return function(T){if(e)throw new TypeError("Generator is already executing.");for(;h;)try{if(e=1,r&&(s=2&T[0]?r.return:T[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,T[1])).done)return s;switch(r=0,s&&(T=[2&T[0],s.value]),T[0]){case 0:case 1:s=T;break;case 4:return h.label++,{value:T[1],done:!1};case 5:h.label++,r=T[1],T=[0];continue;case 7:T=h.ops.pop(),h.trys.pop();continue;default:if(s=h.trys,!((s=s.length>0&&s[s.length-1])||T[0]!==6&&T[0]!==2)){h=0;continue}if(T[0]===3&&(!s||T[1]>s[0]&&T[1]<s[3])){h.label=T[1];break}if(T[0]===6&&h.label<s[1]){h.label=s[1],s=T;break}if(s&&h.label<s[2]){h.label=s[2],h.ops.push(T);break}s[2]&&h.ops.pop(),h.trys.pop();continue}T=n.call(o,h)}catch(P){T=[6,P],r=0}finally{e=s=0}if(5&T[0])throw T[1];return{value:T[0]?T[1]:void 0,done:!0}}([y,b])}}};window.__slide_local_logger__||(window.__slide_local_logger__=pt.createInstance({name:"_slide_local_log_",driver:pt.INDEXEDDB,version:1}));var Zu=window.__slide_local_logger__,mg=window.ResizeObserver||Vf,lu=function(o){return new Promise(function(n){return setTimeout(n,o)})};function fd(o,n){return Ta(this,void 0,void 0,function(){var e;return Ea(this,function(r){switch(r.label){case 0:e=Date.now(),r.label=1;case 1:return!o()&&Date.now()-e<n?[4,lu(50)]:[3,3];case 2:return r.sent(),[3,1];case 3:return[2]}})})}var Ds={syncDispatch:"syncDispatch",syncReceive:"syncReceive",renderStart:"renderStart",renderEnd:"renderEnd",renderError:"renderError",slideChange:"slideChange",mainSeqStepStart:"mainSeqStepStart",mainSeqStepEnd:"mainSeqStepEnd",animateStart:"animateStart",animateEnd:"animateEnd",stateChange:"stateChange"},om={taskId:"",url:"",currentSlideIndex:-1,mainSeqStep:-1,mainSeqState:null,mediaState:Object.create(null),interactiveSeqState:Object.create(null)},gg=function(o){function n(e){var r=o.call(this)||this;return r.__slideState=Object(X.cloneDeep)(om),r.resize=!1,r.isAnimating=!1,r.renderingTaskManager=new Lm,r.isLoading=!1,r.interactive=!0,r.frameWidth=1,r.frameHeight=1,r.frame=document.createElement("div"),r.medianController=document.createElement("div"),r.frameResizeObserver=new mg(function(){return r.frameResizeHandler()}),r.timestamp=function(){return Date.now()},r.mode="local",r.log="",r.logId="",r.lastEmitedState=null,r.playerController=null,r.lock=new pd,r.isInitResized=!1,r.cacheImage=document.createElement("img"),r.isFrowning=!1,r.isReleasing=!1,r.designWidth=0,r.designHeight=0,r._slideCount=0,r.persistLog=function(){return Ta(r,void 0,void 0,function(){var s,u;return Ea(this,function(h){switch(h.label){case 0:if(!Zu||!this.logId)return[3,5];h.label=1;case 1:return h.trys.push([1,4,,5]),s=this.log,[4,Zu.getItem(this.logId)];case 2:return u=h.sent()||"",[4,Zu.setItem(this.logId,u+s)];case 3:return h.sent(),this.log="",[3,5];case 4:return h.sent(),[3,5];case 5:return[2]}})})},r.handleSlideRef=function(){console.log(r)},r.handleSlideStateLog=function(){console.log(r.logId),console.log(JSON.stringify(r.slideState,null,2))},r.handleLogDownload=function(){return Ta(r,void 0,void 0,function(){var s,u,h;return Ea(this,function(f){switch(f.label){case 0:return s="",Zu?(u=s,[4,Zu.getItem(this.logId)]):[3,2];case 1:s=u+(f.sent()||""),f.label=2;case 2:return s+=this.log,(h=document.createElement("a")).setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(s)),h.setAttribute("download",this.logId),h.style.display="none",document.body.appendChild(h),h.click(),document.body.removeChild(h),[2]}})})},r.receiveSyncHandler=function(s){return Ta(r,void 0,void 0,function(){var u,h,f,y,b=this;return Ea(this,function(T){switch(T.label){case 0:return this.log+="=== sync receive ["+new Date().toISOString()+`] ===
6067
6067
  `,this.log+=JSON.stringify(s,null,2),this.log+=`
6068
6068
 
6069
- `,s.type!=="nextStep"?[3,1]:(this.mainSeqStep!==s.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(s.next,"start"),this.player.nextTick(function(){b.doNextStep()})):this.doNextStep(),[3,6]);case 1:return s.type!=="prevStep"?[3,2]:(this.mainSeqStep===0&&this.mainSeqState==="idle"||this.mainSeqStep===s.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep():(this.setMainSeqStep(s.next+1,"start"),(u=this.player)===null||u===void 0||u.nextTick(function(){b.doPrevStep()})),[3,6]);case 2:return s.type!=="interactiveAnim"?[3,3]:(this.player?this.player.applyInteractiveAction(s.seqId):this.__slideState.interactiveSeqState[s.seqId].step+=1,[3,6]);case 3:return s.type!=="renderSlide"?[3,5]:[4,this.doRenderSlide(s.index,s.isForward)];case 4:return T.sent(),[3,6];case 5:s.type==="mediaPlay"?((h=this.player)===null||h===void 0||h.setMediaState(s.id,!0),this.__slideState.mediaState[s.id]=s.state):s.type==="mediaPause"?((f=this.player)===null||f===void 0||f.setMediaState(s.id,!1),this.__slideState.mediaState[s.id]=s.state):s.type==="mediaSeek"&&((y=this.player)===null||y===void 0||y.setMediaCurrentTime(s.id,s.time),this.__slideState.mediaState[s.id]=s.state),T.label=6;case 6:return[2]}})})},r.handlePrevSlide=function(){return Ta(r,void 0,void 0,function(){var s;return Ea(this,function(u){return this.player?((s=this.player.prevSlideIndex)>=1&&this.renderSlide(s,!1),[2]):[2]})})},r.handleNextSlide=function(){return Ta(r,void 0,void 0,function(){var s;return Ea(this,function(u){return this.player?((s=this.player.nextSlideIndex)<=this.slideCount&&this.renderSlide(s,!0),[2]):[2]})})},r.handleGotoSlide=function(s){if(s<=r.slideCount&&s>=1){var u=r.slideState.currentSlideIndex<=s;r.renderSlide(s,u)}else s===-1&&r.renderSlide(r.slideCount,!0)},e.timestamp&&(r.timestamp=e.timestamp),r.config=e,r.syncQueue=new Gm(r.receiveSyncHandler),r.mode=e.mode,r.anchor=e.anchor,r.resize=e.resize||!1,r.interactive=e.interactive,r.frame.style.cssText="width:100%;height:100%;display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",r.setMedianControllerAttribute(),r.frame.appendChild(r.medianController),r.anchor.appendChild(r.frame),r.frameResizeObserver.observe(r.frame),r.on(Ds.syncReceive,function(s){r.lock.unlock(s.type,s.uuid),r.syncQueue.addTask(s)}),r.renderingTaskManager.eventHub.on("task-error",function(s){var u=s.error,h=s.task;r.emit(Ds.renderError,{error:u,index:h.slideIndex})}),window.addEventListener("__slide_log__",r.handleLogDownload),window.addEventListener("__slide_state__",r.handleSlideStateLog),window.addEventListener("__slide_ref__",r.handleSlideRef),r.persistLogId=window.setInterval(r.persistLog,5e3),r.resizeView=Object(X.debounce)(r.resizeView.bind(r),50),r.initPlayer(e),r}return Hm(n,o),n.prototype.initPlayer=function(e){var r=this;this.player=new di(this.mode),this.player.setInteractive(this.interactive),this.player.updateConfig(e.renderOptions||{}),this.player.view&&this.frame.appendChild(this.player.view),this.player.on(Pn.renderStart,function(s){r.isLoading=!0,r.emit(Ds.renderStart,s)}),this.player.on(Pn.renderEnd,function(s){r.isLoading=!1,r.player&&(r.designHeight=r.player.designHeight,r.designWidth=r.player.designWidth,r.cacheImage.style.width=r.player.designWidth+"px",r.cacheImage.style.height=r.player.designHeight+"px",r._slideCount=r.player.slideCount),r.emit(Ds.renderEnd,s)}),this.player.on(Pn.slideChange,function(s){r.__slideState.currentSlideIndex=s,r.emit(Ds.slideChange,s)}),this.player.on(Pn.mainSeqStateChange,function(s){r.__slideState.mainSeqState=s,r.emitStateChange()}),this.player.on(Pn.mainSeqStepChange,function(s){r.__slideState.mainSeqStep=s,r.emitStateChange()}),this.player.on(Pn.interactiveSeqStateChange,function(s){var u=s.id,h=s.state;r.__slideState.interactiveSeqState[u]=h,r.emitStateChange()}),this.player.on(Pn.animateStart,function(){r.isAnimating!==!0&&(r.isAnimating=!0,r.emit(Ds.animateStart))}),this.player.on(Pn.animateEnd,function(){r.isAnimating!==!1&&(r.isAnimating=!1,r.emit(Ds.animateEnd))}),this.player.on(Pn.interactiveSeqNext,function(s){r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"interactiveAnim",seqId:s}),r.emitStateChange()}),this.player.on(Pn.mainSeqStepStart,function(s){r.emit(Ds.mainSeqStepStart,s)}),this.player.on(Pn.mainSeqStepEnd,function(s){r.emit(Ds.mainSeqStepEnd,s)}),this.player.on(Pn.mediaPlay,function(s){var u={type:"play",time:r.timestamp()-1e3*s.time};r.__slideState.mediaState[s.id]=u,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:s.id,state:u}),r.emitStateChange()}),this.player.on(Pn.mediaPause,function(s){var u={type:"pause",time:s.time};r.__slideState.mediaState[s.id]=u,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:s.id,state:u}),r.emitStateChange()}),this.player.on(Pn.mediaSeek,function(s){var u={type:"pause",time:0};s.isPlaying?(u.type="play",r.__slideState.mediaState[s.id]?u.time=r.__slideState.mediaState[s.id].time-1e3*s.time:u.time=r.timestamp()-1e3*s.time,r.__slideState.mediaState[s.id]=u):(u.type="pause",u.time=s.time,r.__slideState.mediaState[s.id]=u),r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaSeek",id:s.id,time:s.time,state:u}),r.emitStateChange()}),this.player.on(Pn.requestPrevSlide,this.handlePrevSlide),this.player.on(Pn.requestNextSlide,this.handleNextSlide),this.player.on(Pn.requestGotoSlide,this.handleGotoSlide),(e==null?void 0:e.controller)&&this.createController()},n.prototype.createController=function(){this.player&&(this.playerController=new fg({player:this.player,params:this.player.config||{},target:this.frame}))},n.prototype.setMedianControllerAttribute=function(){this.medianController.className="median-container",this.medianController.style.position="absolute",this.medianController.style.left="0",this.medianController.style.top="0",this.medianController.style.zIndex="2"},n.prototype.frameResizeHandler=function(){var e=this.frame.getBoundingClientRect(),r=e.width,s=e.height;this.frameWidth=r,this.frameHeight=s,this.resizeView()},n.prototype.resizeView=function(){var e,r,s=this,u=this.width,h=this.height;if(u>0&&h>0){var f=this.frameWidth/u,y=f*h;y>this.frameHeight&&(f*=this.frameHeight/y),(e=this.player)===null||e===void 0||e.scaleView(f,this.resize),this.cacheImage.style.transform="scale("+f+")",this.medianController.style.transform="scale("+f+")",this.medianController.style.top=(this.frameHeight-h*f)/2+"px",this.medianController.setAttribute("data-scale",f.toString()),this.isInitResized||(this.isInitResized=!0,(r=this.player)===null||r===void 0||r.clock.setTimeout(function(){s.frame.style.visibility="visible"},32))}},n.prototype.setSlideState=function(e){var r,s,u;return Ta(this,void 0,void 0,function(){var h,f=this;return Ea(this,function(y){switch(y.label){case 0:return this.log+="=== stateChange receive ["+new Date().toISOString()+`] ===
6069
+ `,s.type!=="nextStep"?[3,1]:(this.mainSeqStep!==s.next-1&&this.mainSeqStep+1!==this.mainSeqLength&&this.player?(this.setMainSeqStep(s.next,"start"),this.player.nextTick(function(){b.doNextStep()})):this.doNextStep(),[3,6]);case 1:return s.type!=="prevStep"?[3,2]:(this.mainSeqStep===0&&this.mainSeqState==="idle"||this.mainSeqStep===s.next+1||this.mainSeqStep+1===this.mainSeqLength?this.doPrevStep():(this.setMainSeqStep(s.next+1,"start"),(u=this.player)===null||u===void 0||u.nextTick(function(){b.doPrevStep()})),[3,6]);case 2:return s.type!=="interactiveAnim"?[3,3]:(this.player?this.player.applyInteractiveAction(s.seqId):this.__slideState.interactiveSeqState[s.seqId].step+=1,[3,6]);case 3:return s.type!=="renderSlide"?[3,5]:[4,this.doRenderSlide(s.index,s.isForward)];case 4:return T.sent(),[3,6];case 5:s.type==="mediaPlay"?((h=this.player)===null||h===void 0||h.setMediaState(s.id,!0),this.__slideState.mediaState[s.id]=s.state):s.type==="mediaPause"?((f=this.player)===null||f===void 0||f.setMediaState(s.id,!1),this.__slideState.mediaState[s.id]=s.state):s.type==="mediaSeek"&&((y=this.player)===null||y===void 0||y.setMediaCurrentTime(s.id,s.time),this.__slideState.mediaState[s.id]=s.state),T.label=6;case 6:return[2]}})})},r.handlePrevSlide=function(){return Ta(r,void 0,void 0,function(){var s;return Ea(this,function(u){return this.player?((s=this.player.prevSlideIndex)>=1&&this.renderSlide(s,!1),[2]):[2]})})},r.handleNextSlide=function(){return Ta(r,void 0,void 0,function(){var s;return Ea(this,function(u){return this.player?((s=this.player.nextSlideIndex)<=this.slideCount&&this.renderSlide(s,!0),[2]):[2]})})},r.handleGotoSlide=function(s){if(s<=r.slideCount&&s>=1){var u=r.slideState.currentSlideIndex<=s;r.renderSlide(s,u)}else s===-1&&r.renderSlide(r.slideCount,!0)},e.timestamp&&(r.timestamp=e.timestamp),r.config=e,r.syncQueue=new Hm(r.receiveSyncHandler),r.mode=e.mode,r.anchor=e.anchor,r.resize=e.resize||!1,r.interactive=e.interactive,r.frame.style.cssText="width:100%;height:100%;display:flex;justify-content:center;align-items:center;visibility:hidden;position:relative;z-index:1;",r.setMedianControllerAttribute(),r.frame.appendChild(r.medianController),r.anchor.appendChild(r.frame),r.frameResizeObserver.observe(r.frame),r.on(Ds.syncReceive,function(s){r.lock.unlock(s.type,s.uuid),r.syncQueue.addTask(s)}),r.renderingTaskManager.eventHub.on("task-error",function(s){var u=s.error,h=s.task;r.emit(Ds.renderError,{error:u,index:h.slideIndex})}),window.addEventListener("__slide_log__",r.handleLogDownload),window.addEventListener("__slide_state__",r.handleSlideStateLog),window.addEventListener("__slide_ref__",r.handleSlideRef),r.persistLogId=window.setInterval(r.persistLog,5e3),r.resizeView=Object(X.debounce)(r.resizeView.bind(r),50),r.initPlayer(e),r}return zm(n,o),n.prototype.initPlayer=function(e){var r=this;this.player=new di(this.mode),this.player.setInteractive(this.interactive),this.player.updateConfig(e.renderOptions||{}),this.player.view&&this.frame.appendChild(this.player.view),this.player.on(Pn.renderStart,function(s){r.isLoading=!0,r.emit(Ds.renderStart,s)}),this.player.on(Pn.renderEnd,function(s){r.isLoading=!1,r.player&&(r.designHeight=r.player.designHeight,r.designWidth=r.player.designWidth,r.cacheImage.style.width=r.player.designWidth+"px",r.cacheImage.style.height=r.player.designHeight+"px",r._slideCount=r.player.slideCount),r.emit(Ds.renderEnd,s)}),this.player.on(Pn.slideChange,function(s){r.__slideState.currentSlideIndex=s,r.emit(Ds.slideChange,s)}),this.player.on(Pn.mainSeqStateChange,function(s){r.__slideState.mainSeqState=s,r.emitStateChange()}),this.player.on(Pn.mainSeqStepChange,function(s){r.__slideState.mainSeqStep=s,r.emitStateChange()}),this.player.on(Pn.interactiveSeqStateChange,function(s){var u=s.id,h=s.state;r.__slideState.interactiveSeqState[u]=h,r.emitStateChange()}),this.player.on(Pn.animateStart,function(){r.isAnimating!==!0&&(r.isAnimating=!0,r.emit(Ds.animateStart))}),this.player.on(Pn.animateEnd,function(){r.isAnimating!==!1&&(r.isAnimating=!1,r.emit(Ds.animateEnd))}),this.player.on(Pn.interactiveSeqNext,function(s){r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"interactiveAnim",seqId:s}),r.emitStateChange()}),this.player.on(Pn.mainSeqStepStart,function(s){r.emit(Ds.mainSeqStepStart,s)}),this.player.on(Pn.mainSeqStepEnd,function(s){r.emit(Ds.mainSeqStepEnd,s)}),this.player.on(Pn.mediaPlay,function(s){var u={type:"play",time:r.timestamp()-1e3*s.time};r.__slideState.mediaState[s.id]=u,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPlay",id:s.id,state:u}),r.emitStateChange()}),this.player.on(Pn.mediaPause,function(s){var u={type:"pause",time:s.time};r.__slideState.mediaState[s.id]=u,r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaPause",id:s.id,state:u}),r.emitStateChange()}),this.player.on(Pn.mediaSeek,function(s){var u={type:"pause",time:0};s.isPlaying?(u.type="play",r.__slideState.mediaState[s.id]?u.time=r.__slideState.mediaState[s.id].time-1e3*s.time:u.time=r.timestamp()-1e3*s.time,r.__slideState.mediaState[s.id]=u):(u.type="pause",u.time=s.time,r.__slideState.mediaState[s.id]=u),r.emitSyncDispatch({slideIndex:r.__slideState.currentSlideIndex,type:"mediaSeek",id:s.id,time:s.time,state:u}),r.emitStateChange()}),this.player.on(Pn.requestPrevSlide,this.handlePrevSlide),this.player.on(Pn.requestNextSlide,this.handleNextSlide),this.player.on(Pn.requestGotoSlide,this.handleGotoSlide),(e==null?void 0:e.controller)&&this.createController()},n.prototype.createController=function(){this.player&&(this.playerController=new fg({player:this.player,params:this.player.config||{},target:this.frame}))},n.prototype.setMedianControllerAttribute=function(){this.medianController.className="median-container",this.medianController.style.position="absolute",this.medianController.style.left="0",this.medianController.style.top="0",this.medianController.style.zIndex="2"},n.prototype.frameResizeHandler=function(){var e=this.frame.getBoundingClientRect(),r=e.width,s=e.height;this.frameWidth=r,this.frameHeight=s,this.resizeView()},n.prototype.resizeView=function(){var e,r,s=this,u=this.width,h=this.height;if(u>0&&h>0){var f=this.frameWidth/u,y=f*h;y>this.frameHeight&&(f*=this.frameHeight/y),(e=this.player)===null||e===void 0||e.scaleView(f,this.resize),this.cacheImage.style.transform="scale("+f+")",this.medianController.style.transform="scale("+f+")",this.medianController.style.top=(this.frameHeight-h*f)/2+"px",this.medianController.setAttribute("data-scale",f.toString()),this.isInitResized||(this.isInitResized=!0,(r=this.player)===null||r===void 0||r.clock.setTimeout(function(){s.frame.style.visibility="visible"},32))}},n.prototype.setSlideState=function(e){var r,s,u;return Ta(this,void 0,void 0,function(){var h,f=this;return Ea(this,function(y){switch(y.label){case 0:return this.log+="=== stateChange receive ["+new Date().toISOString()+`] ===
6070
6070
  `,this.log+=JSON.stringify(e,null,2),this.log+=`
6071
6071
 
6072
6072
  `,e.taskId&&e.taskId!==this.__slideState.taskId&&(this.__slideState.taskId=e.taskId,(r=this.player)===null||r===void 0||r.setResourceData(e.taskId,this.__slideState.url)),e.url&&e.url!==this.__slideState.url&&(this.__slideState.url=e.url,(s=this.player)===null||s===void 0||s.setResourceData(this.__slideState.taskId,e.url)),Number.isInteger(e.currentSlideIndex)&&e.currentSlideIndex!==this.__slideState.currentSlideIndex?(this.__slideState.currentSlideIndex=e.currentSlideIndex,[4,this.doRenderSlide(e.currentSlideIndex)]):[3,2];case 1:y.sent(),y.label=2;case 2:return[4,(u=this.player)===null||u===void 0?void 0:u.clock.waitUntil(function(){var b,T;return((b=f.player)===null||b===void 0?void 0:b.currentIndex)===e.currentSlideIndex&&((T=f.player)===null||T===void 0?void 0:T.currentStage)},3e3)];case 3:return y.sent(),h=!1,Number.isInteger(e.mainSeqStep)&&e.mainSeqStep!==this.__slideState.mainSeqStep&&(h=!0,this.__slideState.mainSeqStep=e.mainSeqStep),e.mainSeqState&&e.mainSeqState!==this.__slideState.mainSeqState&&(h=!0,this.__slideState.mainSeqState=e.mainSeqState),h&&this.setMainSeqStep(this.__slideState.mainSeqStep,this.__slideState.mainSeqState==="idle"?"start":"end"),e.mediaState&&(this.initMedia(e),this.__slideState.mediaState=e.mediaState),e.interactiveSeqState&&(this.initInteractiveSeq(e),this.__slideState.interactiveSeqState=e.interactiveSeqState),[2]}})})},n.prototype.initInteractiveSeq=function(e){var r;for(var s in e.interactiveSeqState){var u=e.interactiveSeqState[s];(r=this.player)===null||r===void 0||r.setInteractiveSeqState(s,u.step,u.state==="end"?"end":"start")}},n.prototype.initMedia=function(e){var r,s,u=this,h=function(b){var T=e.mediaState[b],P=f.__slideState.mediaState[b];if(P&&T.type===P.type&&T.time===P.time)return"continue";T.type==="play"?(r=f.player)===null||r===void 0||r.setMediaState(b,!0).then(function(){var j,G=u.timestamp();(j=u.player)===null||j===void 0||j.setMediaCurrentTime(b,(G-T.time)/1e3)}):(s=f.player)===null||s===void 0||s.setMediaState(b,!1).then(function(){var j;(j=u.player)===null||j===void 0||j.setMediaCurrentTime(b,T.time)})},f=this;for(var y in e.mediaState)h(y)},Object.defineProperty(n.prototype,"slideCount",{get:function(){return this._slideCount},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"slideState",{get:function(){return this.__slideState.mainSeqState=this.mainSeqState,this.__slideState.mainSeqStep=this.mainSeqStep,JSON.parse(JSON.stringify(this.__slideState))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"mainSeqLength",{get:function(){var e;return((e=this.player)===null||e===void 0?void 0:e.mainSeqLength())||0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"mainSeqStep",{get:function(){var e;return((e=this.player)===null||e===void 0?void 0:e.mainSeqStep())||0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"mainSeqState",{get:function(){var e;return((e=this.player)===null||e===void 0?void 0:e.mainSeqState())||null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"renderOptions",{get:function(){var e;return((e=this.player)===null||e===void 0?void 0:e.config)||null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"drawCall",{get:function(){var e;return((e=this.player)===null||e===void 0?void 0:e.runtime.drawCall)||0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"renderFps",{get:function(){var e;return((e=this.player)===null||e===void 0?void 0:e.runtime.fps)||0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"runtimeFps",{get:function(){var e;return((e=this.player)===null||e===void 0?void 0:e.fps.value)||0},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"view",{get:function(){var e;return((e=this.player)===null||e===void 0?void 0:e.view)||null},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"width",{get:function(){return this.designWidth},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"height",{get:function(){return this.designHeight},enumerable:!1,configurable:!0}),n.prototype.updateRenderOption=function(e){this.player&&(this.player.updateConfig(e),this.renderOptions&&(this.config.renderOptions=this.renderOptions))},n.prototype.setResource=function(e,r){var s;(s=this.player)===null||s===void 0||s.setResourceData(e,r),this.__slideState.taskId=e,this.__slideState.url=r,this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"setResource",taskId:e,url:r}),this.logId=e+"-"+Math.random().toString(32).substr(2)},n.prototype._renderSlide=function(e){var r;return Ta(this,void 0,void 0,function(){return Ea(this,function(s){switch(s.label){case 0:return this.isLoading=!0,[4,(r=this.player)===null||r===void 0?void 0:r.renderSlide(e)];case 1:return s.sent(),this.__slideState.currentSlideIndex=e,this.isLoading=!1,this.resizeView(),this.emitStateChange(),[2]}})})},n.prototype.renderSlide=function(e,r){if(r===void 0&&(r=!0),this.player){this.isLoading=!0;var s=Number(e);(s!==this.player.currentIndex||this.renderingTaskManager.hasStartTask())&&(s>this.slideCount&&this.slideCount>0||(this.mode==="interactive"?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:s,isForward:r}):this.mode==="sync"?(this.doRenderSlide(s,r),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"renderSlide",index:s,isForward:r})):this.doRenderSlide(s,r)))}},n.prototype.doRenderSlide=function(e,r){var s=this;if(r===void 0&&(r=!0),!this.player)return Promise.resolve();var u=Math.random().toString(32).substr(2);return this.player.isForward=r,this.renderingTaskManager.addTask(function(){return s._renderSlide(e)},e,u),new Promise(function(h){s.renderingTaskManager.eventHub.once("task-end-"+u,h)})},n.prototype.nextStep=function(){!this.isLoading&&this.player&&(this.player.mainSeqHasNextStep()?this.mode==="interactive"?this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()+1}):this.mode==="sync"?(this.doNextStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"nextStep",next:this.player.mainSeqStep()})):this.doNextStep():this.handleNextSlide())},n.prototype.doNextStep=function(){if(this.player){this.player.nextStep();var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},n.prototype.prevStep=function(){!this.isLoading&&this.player&&(this.player.mainSeqHasPrevStep()?this.mode==="interactive"?this.emitSyncDispatch({type:"prevStep",slideIndex:this.__slideState.currentSlideIndex,next:this.player.mainSeqStep()-1}):this.mode==="sync"?(this.doPrevStep(),this.emitSyncDispatch({slideIndex:this.__slideState.currentSlideIndex,type:"prevStep",next:this.player.mainSeqStep()})):this.doPrevStep():this.handlePrevSlide())},n.prototype.doPrevStep=function(){if(this.player){this.player.prevStep();var e=this.player.mainSeqStep();this.__slideState.mainSeqStep=e,this.emitStateChange()}},n.prototype.isSlideStateReady=function(e){return e.taskId.length>0&&e.url.length>0&&e.currentSlideIndex>0},n.prototype.emitStateChange=function(){if(this.mode!=="local"){var e=this.slideState;!Object(X.isEqual)(this.lastEmitedState,e)&&this.isSlideStateReady(e)&&(this.lastEmitedState=e,this.emit(Ds.stateChange,e),this.log+="=== stateChange dispatch ["+new Date().toISOString()+`] ===
@@ -6075,6 +6075,6 @@ void main(void){
6075
6075
  `)}},n.prototype.emitSyncDispatch=function(e){if(!this.lock.isLocked(e.type)){var r=Math.random().toString(32).substr(2);this.lock.addLock(e.type,r),this.emit(Ds.syncDispatch,Yu(Yu({},e),{uuid:r})),this.log+="=== sync dispatch ["+new Date().toISOString()+`] ===
6076
6076
  `,this.log+=JSON.stringify(e,null,2),this.log+=`
6077
6077
 
6078
- `}},n.prototype.setMainSeqStep=function(e,r){var s;(s=this.player)===null||s===void 0||s.setMainSeqStep(e,r)},n.prototype.setInteractive=function(e){var r;this.interactive=e,(r=this.player)===null||r===void 0||r.setInteractive(e)},n.prototype.pause=function(){var e;(e=this.player)===null||e===void 0||e.pause()},n.prototype.resume=function(){var e;(e=this.player)===null||e===void 0||e.resume()},n.prototype.getPreviewImage=function(e){var r;return Ta(this,void 0,void 0,function(){return Ea(this,function(s){return[2,((r=this.player)===null||r===void 0?void 0:r.getPreviewImage(e))||null]})})},n.prototype.frozen=function(){var e;return Ta(this,void 0,void 0,function(){var r,s,u,h=this;return Ea(this,function(f){switch(f.label){case 0:return this.isFrowning?[2,fd(function(){return!h.isFrowning},6e4)]:this.view&&this.player?(this.isFrowning=!0,[4,this.player.clock.waitUntil(function(){return!h.isLoading},6e4)]):[3,2];case 1:for(s in f.sent(),r=this.player.getSnapshot()||"",this.cacheImage.src=r,this.cacheImage.style.position="absolute",this.cacheImage.style.zIndex="100",this.frame.appendChild(this.cacheImage),this.player.destroy(),(e=this.playerController)===null||e===void 0||e.destroy(),this.player=void 0,this.__slideState.mediaState)u=this.__slideState.mediaState[s],this.__slideState.mediaState[s]=Yu(Yu({},u),{frozenTime:this.timestamp()});this.isFrowning=!1,f.label=2;case 2:return[2]}})})},n.prototype.release=function(){var e;return Ta(this,void 0,void 0,function(){var r,s,u,h,f=this;return Ea(this,function(y){switch(y.label){case 0:if(this.isReleasing)return[2,fd(function(){return!f.isReleasing},6e4)];for(s in this.isReleasing=!0,this.initPlayer(this.config),this.player.view&&(this.player.view.style.visibility="hidden"),r=this.__slideState,this.__slideState=Object(X.cloneDeep)(om),r.mediaState)(u=r.mediaState[s]).type==="play"&&(h=Math.max((e=u.frozenTime)!==null&&e!==void 0?e:0,u.time),u.time=this.timestamp()-(h-u.time),u.frozenTime=void 0);return[4,this.setSlideState(r)];case 1:return y.sent(),[4,this.player.clock.delay(333)];case 2:y.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch{}return this.isReleasing=!1,[2]}})})},n.prototype.destroy=function(){var e,r,s,u;this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),(e=this.player)===null||e===void 0||e.removeAllListeners(),(r=this.player)===null||r===void 0||r.destroy(),(s=this.player)===null||s===void 0||s.removeAllListeners(),window.removeEventListener("__slide_log__",this.handleLogDownload),window.removeEventListener("__slide_state__",this.handleSlideStateLog),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.clearInterval(this.persistLogId),Zu&&Zu.removeItem(this.logId).catch(function(){});try{((u=this.player)===null||u===void 0?void 0:u.view)&&this.anchor.removeChild(this.player.view)}catch{}},n}(J.a)}]);function Zg(N,w,S){return Math.min(Math.max(N,w),S)}function Jg(N){return typeof N=="object"&&N!==null}function cm(N){return JSON.parse(JSON.stringify(N))}var $g={exports:{}},w0={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Kg={exports:{}},S0=function(w){return!w||typeof w=="string"?!1:w instanceof Array||Array.isArray(w)||w.length>=0&&(w.splice instanceof Function||Object.getOwnPropertyDescriptor(w,w.length-1)&&w.constructor.name!=="String")},T0=S0,E0=Array.prototype.concat,M0=Array.prototype.slice,Qg=Kg.exports=function(w){for(var S=[],W=0,pt=w.length;W<pt;W++){var lt=w[W];T0(lt)?S=E0.call(S,M0.call(lt)):S.push(lt)}return S};Qg.wrap=function(N){return function(){return N(Qg(arguments))}};var dm=w0,pm=Kg.exports,tv=Object.hasOwnProperty,ev={};for(var yg in dm)tv.call(dm,yg)&&(ev[dm[yg]]=yg);var il=$g.exports={to:{},get:{}};il.get=function(N){var w=N.substring(0,3).toLowerCase(),S,W;switch(w){case"hsl":S=il.get.hsl(N),W="hsl";break;case"hwb":S=il.get.hwb(N),W="hwb";break;default:S=il.get.rgb(N),W="rgb";break}return S?{model:W,value:S}:null};il.get.rgb=function(N){if(!N)return null;var w=/^#([a-f0-9]{3,4})$/i,S=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,W=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,pt=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,lt=/^(\w+)$/,J=[0,0,0,1],X,ct,tt;if(X=N.match(S)){for(tt=X[2],X=X[1],ct=0;ct<3;ct++){var $=ct*2;J[ct]=parseInt(X.slice($,$+2),16)}tt&&(J[3]=parseInt(tt,16)/255)}else if(X=N.match(w)){for(X=X[1],tt=X[3],ct=0;ct<3;ct++)J[ct]=parseInt(X[ct]+X[ct],16);tt&&(J[3]=parseInt(tt+tt,16)/255)}else if(X=N.match(W)){for(ct=0;ct<3;ct++)J[ct]=parseInt(X[ct+1],0);X[4]&&(X[5]?J[3]=parseFloat(X[4])*.01:J[3]=parseFloat(X[4]))}else if(X=N.match(pt)){for(ct=0;ct<3;ct++)J[ct]=Math.round(parseFloat(X[ct+1])*2.55);X[4]&&(X[5]?J[3]=parseFloat(X[4])*.01:J[3]=parseFloat(X[4]))}else return(X=N.match(lt))?X[1]==="transparent"?[0,0,0,0]:tv.call(dm,X[1])?(J=dm[X[1]],J[3]=1,J):null:null;for(ct=0;ct<3;ct++)J[ct]=gd(J[ct],0,255);return J[3]=gd(J[3],0,1),J};il.get.hsl=function(N){if(!N)return null;var w=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?[\d\.]+)\s*)?\)$/,S=N.match(w);if(S){var W=parseFloat(S[4]),pt=(parseFloat(S[1])%360+360)%360,lt=gd(parseFloat(S[2]),0,100),J=gd(parseFloat(S[3]),0,100),X=gd(isNaN(W)?1:W,0,1);return[pt,lt,J,X]}return null};il.get.hwb=function(N){if(!N)return null;var w=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/,S=N.match(w);if(S){var W=parseFloat(S[4]),pt=(parseFloat(S[1])%360+360)%360,lt=gd(parseFloat(S[2]),0,100),J=gd(parseFloat(S[3]),0,100),X=gd(isNaN(W)?1:W,0,1);return[pt,lt,J,X]}return null};il.to.hex=function(){var N=pm(arguments);return"#"+qm(N[0])+qm(N[1])+qm(N[2])+(N[3]<1?qm(Math.round(N[3]*255)):"")};il.to.rgb=function(){var N=pm(arguments);return N.length<4||N[3]===1?"rgb("+Math.round(N[0])+", "+Math.round(N[1])+", "+Math.round(N[2])+")":"rgba("+Math.round(N[0])+", "+Math.round(N[1])+", "+Math.round(N[2])+", "+N[3]+")"};il.to.rgb.percent=function(){var N=pm(arguments),w=Math.round(N[0]/255*100),S=Math.round(N[1]/255*100),W=Math.round(N[2]/255*100);return N.length<4||N[3]===1?"rgb("+w+"%, "+S+"%, "+W+"%)":"rgba("+w+"%, "+S+"%, "+W+"%, "+N[3]+")"};il.to.hsl=function(){var N=pm(arguments);return N.length<4||N[3]===1?"hsl("+N[0]+", "+N[1]+"%, "+N[2]+"%)":"hsla("+N[0]+", "+N[1]+"%, "+N[2]+"%, "+N[3]+")"};il.to.hwb=function(){var N=pm(arguments),w="";return N.length>=4&&N[3]!==1&&(w=", "+N[3]),"hwb("+N[0]+", "+N[1]+"%, "+N[2]+"%"+w+")"};il.to.keyword=function(N){return ev[N.slice(0,3)]};function gd(N,w,S){return Math.min(Math.max(w,N),S)}function qm(N){var w=Math.round(N).toString(16).toUpperCase();return w.length<2?"0"+w:w}var A0=$g.exports;class C0{constructor(w){this.enable=w,this.apps={},this.level="debug",this._onMessage=S=>{Jg(S.data)&&(typeof S.data.slide=="boolean"?this.enable=S.data.slide:S.data.slide==="__instance"&&console.log(this))},window.addEventListener("message",this._onMessage)}log(...w){this.enable&&console.log(...w)}verbose(...w){this.enable&&this.level==="verbose"&&console.log(...w)}dispose(w){this.enable=!1,delete this.apps[w],window.removeEventListener("message",this._onMessage)}}const $u=new C0(!1),es=$u.log.bind($u),P0=$u.verbose.bind($u);function nv(N){try{const w=window.getComputedStyle(N).backgroundColor;if(w!=="rgba(0, 0, 0, 0)"&&w!=="transparent")return w;if(N.parentElement)return nv(N.parentElement)}catch{}return"#ffffff"}function R0(N){const w=A0.get(N);if(w&&w.model==="rgb"){const S=w.value,pt=(((Math.round(S[0])&255)<<16)+((Math.round(S[1])&255)<<8)+(Math.round(S[2])&255)).toString(16);return"#"+"000000".substring(pt.length)+pt}else return N}let Ym="";function rv(N){return Ym||(Ym=R0(nv(N)),es("[Slide] guess bg color",Ym)),Ym}function iv(N){const{width:w,height:S,slideCount:W,slideState:pt}=N,{taskId:lt,url:J}=pt,X=[];for(let ct=1;ct<=W;++ct)X.push({width:w,height:S,thumbnail:`${J}/${lt}/preview/${ct}.png`,src:"ppt"});return X}function I0(N,w,S,W){var X;const pt=S.slideState.currentSlideIndex;if(!(pt>0)||!w.getIsWritable())return;const lt=[W,pt].join("/");if(N.scenePathType(lt)!=="page"){N.removeScenes(W);const ct=S.slideCount,tt=[];for(let $=1;$<=ct;++$)tt.push({name:`${$}`});N.putScenes(W,tt)}let J;w.getBox().focus?J=N.state.sceneState.scenePath:J=((X=w.getView())==null?void 0:X.focusScenePath)||"",J!==lt&&w.setScenePath(lt)}const xg="https://convertcdn.netless.link/dynamicConvert",L0=40,bg={taskId:"",url:"",state:null};class O0{constructor({context:w,anchor:S,onPageChanged:W,onTransitionStart:pt,onTransitionEnd:lt,onError:J}){this.sideEffect=new Xm,this.ready=!1,this.readyPromise=new Promise(X=>{this.resolveReady=()=>setTimeout(()=>{this.ready=!0,X()},1e3)}),this.onSyncDispatch=X=>{if(this.context.getIsWritable()&&this.room){const ct={type:bo.SLIDE_EVENTS.syncDispatch,payload:X};es("[Slide] dispatch",X),this.room.dispatchMagixEvent(this.channel,ct)}},this.magixEventListener=X=>{if(X.event===this.channel&&Jg(X.payload)){const{type:ct,payload:tt}=X.payload;ct===bo.SLIDE_EVENTS.syncDispatch&&(this.syncStateOnce(),es("[Slide] receive",tt),this.syncStateOnceFlag||this.slide.emit(bo.SLIDE_EVENTS.syncReceive,tt))}},this.onStateChange=X=>{this.context.getIsWritable()&&(P0("[Slide] state change",JSON.stringify(X,null,2)),this.context.updateAttributes(["state"],X))},this.onSeeked=()=>{const X=this.context.getAttributes().state;X&&this.slide.setSlideState(cm(X))},this.pollCount=0,this.pollReadyState=()=>{this.ready?this._toFreeze===1?this.freeze():this._toFreeze===-1&&this.unfreeze():this.pollCount<L0?(this.pollCount++,setTimeout(this.pollReadyState,500)):(this.pollCount=0,es("[Slide] renderSlide (retry after timeout)",1),this.slide.renderSlide(1))},this._pageCount=0,this.destroyed=!1,this.timestamp=()=>this.room&&this.room.calibrationTimestamp?this.room.calibrationTimestamp:this.player?this.player.beginTimestamp+this.player.progressTime:Date.now(),this.isFrozen=!1,this._toFreeze=0,this.freezePromise=null,this.freeze=()=>{this.ready?(es("[Slide] freeze",this.context.appId),this.freezePromise?this._toFreeze=1:this.isFrozen||(this._toFreeze=0,this.freezePromise=this.slide.frozen().then(this.afterFreeze.bind(this,1)))):this._toFreeze=1},this.unfreeze=async()=>{this.ready?(es("[Slide] unfreeze",this.context.appId),this.freezePromise?this._toFreeze=-1:this.isFrozen&&(this._toFreeze=0,this.freezePromise=this.slide.release().then(this.afterFreeze.bind(this,-1)))):this._toFreeze=-1},this.onPageChanged=W,this.onTransitionStart=pt,this.onTransitionEnd=lt,this.onError=J,this.context=w,this.channel=`channel-${w.appId}`,this.room=w.getRoom(),this.player=this.room?void 0:w.getDisplayer(),this.slide=this.createSlide(S),this.syncStateOnceFlag=!this.context.isAddApp,this.initialize()}jumpToPage(w){this.ready&&(w=Zg(w,1,this.pageCount),this.slide.renderSlide(w))}initialize(){this.registerEventListeners(),this.kickStart()}kickStart(){const{context:w,slide:S}=this,{taskId:W,url:pt,state:lt}=dp(dp({},bg),this.context.getAttributes());S.setResource(W,pt||xg),lt?(es("[Slide] init with state",cm(lt)),this.syncStateOnceFlag=!1,S.setSlideState(cm(lt))):w.isAddApp&&(es("[Slide] init by renderSlide",1),S.renderSlide(1)),this.pollReadyState()}registerEventListeners(){const{context:w,slide:S}=this;this.sideEffect.add(()=>{const W=w.mobxUtils.reaction(()=>w.getAttributes().state,()=>{this.syncStateOnce(),W()});return W}),this.sideEffect.add(()=>(w.emitter.on("seek",this.onSeeked),()=>w.emitter.off("seek",this.onSeeked))),this.sideEffect.add(()=>{const W=w.getDisplayer();return W.addMagixEventListener(this.channel,this.magixEventListener,{fireSelfEventAfterCommit:!0}),()=>W.removeMagixEventListener(this.channel)}),S.on(bo.SLIDE_EVENTS.slideChange,this.onPageChanged),S.on(bo.SLIDE_EVENTS.renderStart,this.onTransitionStart),S.on(bo.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),S.on(bo.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),S.on(bo.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),S.on(bo.SLIDE_EVENTS.renderError,this.onError),S.on(bo.SLIDE_EVENTS.stateChange,this.onStateChange),S.on(bo.SLIDE_EVENTS.syncDispatch,this.onSyncDispatch),S.on(bo.SLIDE_EVENTS.renderEnd,this.resolveReady)}syncStateOnce(){if(this.syncStateOnceFlag){const{state:w}=dp(dp({},bg),this.context.getAttributes());w&&(es("[Slide] sync with state (once)",cm(w)),this.slide.setSlideState(cm(w)),this.syncStateOnceFlag=!1)}}get pageCount(){return this._pageCount>0?this._pageCount:(this._pageCount=this.slide.slideCount,this._pageCount)}get page(){return this.slide.slideState.currentSlideIndex}createSlide(w){var W,pt;return new bo.Slide({anchor:w,interactive:!0,mode:"interactive",resize:!0,controller:$u.enable,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,resolution:(W=this.context.getAppOptions())==null?void 0:W.resolution,transactionBgColor:((pt=this.context.getAppOptions())==null?void 0:pt.bgColor)||rv(w)},timestamp:this.timestamp})}destroy(){this.sideEffect.flushAll(),this.destroyed||(es("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0)}afterFreeze(w){w===1?(this.isFrozen=!0,this.freezePromise=null,this._toFreeze===-1&&this.unfreeze()):w===-1&&(this.isFrozen=!1,this.freezePromise=null,this._toFreeze===1&&this.freeze())}}function D0(N){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${N}-footer-icon-sidebar`),S.setAttribute("viewBox","0 0 64 64");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),S.appendChild(W),S}function N0(N){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${N}-footer-icon-arrow-left`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),S.appendChild(W),S}function F0(N){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${N}-footer-icon-arrow-right`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),S.appendChild(W),S}function B0(N){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${N}-footer-icon-play`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),S.appendChild(W),S}function k0(N){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${N}-footer-icon-pause`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),S.appendChild(W),S}const pp=typeof window!="undefined",ov=pp&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),sv=pp&&"IntersectionObserver"in window,av=pp&&"classList"in document.createElement("p"),lv=pp&&window.devicePixelRatio>1,U0={elements_selector:".lazy",container:ov||pp?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1},uv=N=>Object.assign({},U0,N),hv=function(N,w){let S;const W="LazyLoad::Initialized",pt=new N(w);try{S=new CustomEvent(W,{detail:{instance:pt}})}catch{S=document.createEvent("CustomEvent"),S.initCustomEvent(W,!1,!1,{instance:pt})}window.dispatchEvent(S)},G0=(N,w)=>{if(!!w)if(!w.length)hv(N,w);else for(let S=0,W;W=w[S];S+=1)hv(N,W)},uc="src",wg="srcset",Sg="sizes",cv="poster",fm="llOriginalAttrs",Tg="loading",dv="loaded",pv="applied",H0="entered",Eg="error",fv="native",mv="data-",gv="ll-status",Tl=(N,w)=>N.getAttribute(mv+w),z0=(N,w,S)=>{var W=mv+w;if(S===null){N.removeAttribute(W);return}N.setAttribute(W,S)},mm=N=>Tl(N,gv),fp=(N,w)=>z0(N,gv,w),Zm=N=>fp(N,null),Mg=N=>mm(N)===null,j0=N=>mm(N)===Tg,V0=N=>mm(N)===Eg,Ag=N=>mm(N)===fv,W0=[Tg,dv,pv,Eg],X0=N=>W0.indexOf(mm(N))>=0,vd=(N,w,S,W)=>{if(!!N){if(W!==void 0){N(w,S,W);return}if(S!==void 0){N(w,S);return}N(w)}},mf=(N,w)=>{if(av){N.classList.add(w);return}N.className+=(N.className?" ":"")+w},Ku=(N,w)=>{if(av){N.classList.remove(w);return}N.className=N.className.replace(new RegExp("(^|\\s+)"+w+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},q0=N=>{N.llTempImage=document.createElement("IMG")},Y0=N=>{delete N.llTempImage},vv=N=>N.llTempImage,Jm=(N,w)=>{if(!w)return;const S=w._observer;!S||S.unobserve(N)},Z0=N=>{N.disconnect()},J0=(N,w,S)=>{w.unobserve_entered&&Jm(N,S)},Cg=(N,w)=>{!N||(N.loadingCount+=w)},$0=N=>{!N||(N.toLoadCount-=1)},_v=(N,w)=>{!N||(N.toLoadCount=w)},K0=N=>N.loadingCount>0,Q0=N=>N.toLoadCount>0,yv=N=>{let w=[];for(let S=0,W;W=N.children[S];S+=1)W.tagName==="SOURCE"&&w.push(W);return w},Pg=(N,w)=>{const S=N.parentNode;if(!S||S.tagName!=="PICTURE")return;yv(S).forEach(w)},xv=(N,w)=>{yv(N).forEach(w)},$m=[uc],bv=[uc,cv],Km=[uc,wg,Sg],Qm=N=>!!N[fm],wv=N=>N[fm],Sv=N=>delete N[fm],gm=(N,w)=>{if(Qm(N))return;const S={};w.forEach(W=>{S[W]=N.getAttribute(W)}),N[fm]=S},t_=N=>{Qm(N)||(N[fm]={backgroundImage:N.style.backgroundImage})},e_=(N,w,S)=>{if(!S){N.removeAttribute(w);return}N.setAttribute(w,S)},vm=(N,w)=>{if(!Qm(N))return;const S=wv(N);w.forEach(W=>{e_(N,W,S[W])})},n_=N=>{if(!Qm(N))return;const w=wv(N);N.style.backgroundImage=w.backgroundImage},r_=(N,w,S)=>{mf(N,w.class_applied),fp(N,pv),!!S&&(w.unobserve_completed&&Jm(N,w),vd(w.callback_applied,N,S))},Tv=(N,w,S)=>{mf(N,w.class_loading),fp(N,Tg),!!S&&(Cg(S,1),vd(w.callback_loading,N,S))},mp=(N,w,S)=>{!S||N.setAttribute(w,S)},Ev=(N,w)=>{mp(N,Sg,Tl(N,w.data_sizes)),mp(N,wg,Tl(N,w.data_srcset)),mp(N,uc,Tl(N,w.data_src))},i_=(N,w)=>{Pg(N,S=>{gm(S,Km),Ev(S,w)}),gm(N,Km),Ev(N,w)},o_=(N,w)=>{gm(N,$m),mp(N,uc,Tl(N,w.data_src))},s_=(N,w)=>{xv(N,S=>{gm(S,$m),mp(S,uc,Tl(S,w.data_src))}),gm(N,bv),mp(N,cv,Tl(N,w.data_poster)),mp(N,uc,Tl(N,w.data_src)),N.load()},a_=(N,w,S)=>{const W=Tl(N,w.data_bg),pt=Tl(N,w.data_bg_hidpi),lt=lv&&pt?pt:W;!lt||(N.style.backgroundImage=`url("${lt}")`,vv(N).setAttribute(uc,lt),Tv(N,w,S))},l_=(N,w,S)=>{const W=Tl(N,w.data_bg_multi),pt=Tl(N,w.data_bg_multi_hidpi),lt=lv&&pt?pt:W;!lt||(N.style.backgroundImage=lt,r_(N,w,S))},Mv={IMG:i_,IFRAME:o_,VIDEO:s_},u_=(N,w)=>{const S=Mv[N.tagName];!S||S(N,w)},h_=(N,w,S)=>{const W=Mv[N.tagName];!W||(W(N,w),Tv(N,w,S))},c_=["IMG","IFRAME","VIDEO"],d_=N=>c_.indexOf(N.tagName)>-1,Av=(N,w)=>{w&&!K0(w)&&!Q0(w)&&vd(N.callback_finish,w)},Cv=(N,w,S)=>{N.addEventListener(w,S),N.llEvLisnrs[w]=S},p_=(N,w,S)=>{N.removeEventListener(w,S)},Rg=N=>!!N.llEvLisnrs,f_=(N,w,S)=>{Rg(N)||(N.llEvLisnrs={});const W=N.tagName==="VIDEO"?"loadeddata":"load";Cv(N,W,w),Cv(N,"error",S)},Ig=N=>{if(!Rg(N))return;const w=N.llEvLisnrs;for(let S in w){const W=w[S];p_(N,S,W)}delete N.llEvLisnrs},Pv=(N,w,S)=>{Y0(N),Cg(S,-1),$0(S),Ku(N,w.class_loading),w.unobserve_completed&&Jm(N,S)},m_=(N,w,S,W)=>{const pt=Ag(w);Pv(w,S,W),mf(w,S.class_loaded),fp(w,dv),vd(S.callback_loaded,w,W),pt||Av(S,W)},g_=(N,w,S,W)=>{const pt=Ag(w);Pv(w,S,W),mf(w,S.class_error),fp(w,Eg),vd(S.callback_error,w,W),pt||Av(S,W)},Lg=(N,w,S)=>{const W=vv(N)||N;if(Rg(W))return;f_(W,J=>{m_(J,N,w,S),Ig(W)},J=>{g_(J,N,w,S),Ig(W)})},v_=(N,w,S)=>{q0(N),Lg(N,w,S),t_(N),a_(N,w,S),l_(N,w,S)},__=(N,w,S)=>{Lg(N,w,S),h_(N,w,S)},Og=(N,w,S)=>{d_(N)?__(N,w,S):v_(N,w,S)},y_=(N,w,S)=>{N.setAttribute("loading","lazy"),Lg(N,w,S),u_(N,w),fp(N,fv)},Rv=N=>{N.removeAttribute(uc),N.removeAttribute(wg),N.removeAttribute(Sg)},x_=N=>{Pg(N,w=>{Rv(w)}),Rv(N)},Iv=N=>{Pg(N,w=>{vm(w,Km)}),vm(N,Km)},b_=N=>{xv(N,w=>{vm(w,$m)}),vm(N,bv),N.load()},w_=N=>{vm(N,$m)},S_={IMG:Iv,IFRAME:w_,VIDEO:b_},T_=N=>{const w=S_[N.tagName];if(!w){n_(N);return}w(N)},E_=(N,w)=>{Mg(N)||Ag(N)||(Ku(N,w.class_entered),Ku(N,w.class_exited),Ku(N,w.class_applied),Ku(N,w.class_loading),Ku(N,w.class_loaded),Ku(N,w.class_error))},M_=(N,w)=>{T_(N),E_(N,w),Zm(N),Sv(N)},A_=(N,w,S,W)=>{!S.cancel_on_exit||!j0(N)||N.tagName==="IMG"&&(Ig(N),x_(N),Iv(N),Ku(N,S.class_loading),Cg(W,-1),Zm(N),vd(S.callback_cancel,N,w,W))},C_=(N,w,S,W)=>{const pt=X0(N);fp(N,H0),mf(N,S.class_entered),Ku(N,S.class_exited),J0(N,S,W),vd(S.callback_enter,N,w,W),!pt&&Og(N,S,W)},P_=(N,w,S,W)=>{Mg(N)||(mf(N,S.class_exited),A_(N,w,S,W),vd(S.callback_exit,N,w,W))},R_=["IMG","IFRAME","VIDEO"],Lv=N=>N.use_native&&"loading"in HTMLImageElement.prototype,I_=(N,w,S)=>{N.forEach(W=>{R_.indexOf(W.tagName)!==-1&&y_(W,w,S)}),_v(S,0)},L_=N=>N.isIntersecting||N.intersectionRatio>0,O_=N=>({root:N.container===document?null:N.container,rootMargin:N.thresholds||N.threshold+"px"}),D_=(N,w,S)=>{N.forEach(W=>L_(W)?C_(W.target,W,w,S):P_(W.target,W,w,S))},N_=(N,w)=>{w.forEach(S=>{N.observe(S)})},F_=(N,w)=>{Z0(N),N_(N,w)},B_=(N,w)=>{!sv||Lv(N)||(w._observer=new IntersectionObserver(S=>{D_(S,N,w)},O_(N)))},Ov=N=>Array.prototype.slice.call(N),tg=N=>N.container.querySelectorAll(N.elements_selector),k_=N=>Ov(N).filter(Mg),U_=N=>V0(N),G_=N=>Ov(N).filter(U_),Dv=(N,w)=>k_(N||tg(w)),H_=(N,w)=>{G_(tg(N)).forEach(W=>{Ku(W,N.class_error),Zm(W)}),w.update()},z_=(N,w)=>{!pp||window.addEventListener("online",()=>{H_(N,w)})},_m=function(N,w){const S=uv(N);this._settings=S,this.loadingCount=0,B_(S,this),z_(S,this),this.update(w)};_m.prototype={update:function(N){const w=this._settings,S=Dv(N,w);if(_v(this,S.length),ov||!sv){this.loadAll(S);return}if(Lv(w)){I_(S,w,this);return}F_(this._observer,S)},destroy:function(){this._observer&&this._observer.disconnect(),tg(this._settings).forEach(N=>{Sv(N)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(N){const w=this._settings;Dv(N,w).forEach(W=>{Jm(W,this),Og(W,w,this)})},restoreAll:function(){const N=this._settings;tg(N).forEach(w=>{M_(w,N)})}};_m.load=(N,w)=>{const S=uv(w);Og(N,S)};_m.resetStatus=N=>{Zm(N)};pp&&G0(_m,window.lazyLoadOptions);class Nv{constructor({readonly:w,onNewPageIndex:S,onPlay:W}){this._pages=[],this.pageIndex=0,this.setPaused=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},this.setPlaying=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!0)},this.namespace="netless-app-slide",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new Xm,this.readonly=w,this.onNewPageIndex=S,this.onPlay=W,this.render()}set pages(w){this._pages=w,this.refreshPreview(),this.refreshTotalPage(),this.refreshBtnSidebar()}get pages(){return this._pages}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(w){this.readonly=w,this.$content.classList.toggle(this.wrapClassName("readonly"),w),this.$footer.classList.toggle(this.wrapClassName("readonly"),w),this.$pageNumberInput.disabled=w}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(w){Number.isNaN(w)||(this.pageIndex=w,this.$pageNumberInput.value=String(w+1))}refreshTotalPage(){this.pages.length?this.$totalPage.textContent=" / "+this.pages.length:this.$totalPage.textContent=""}setSmallBox(w){this.isSmallBox!==w&&(this.isSmallBox=w,this.$footer.classList.toggle(this.wrapClassName("float-footer"),w))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const w=document.createElement("div");w.className=this.wrapClassName("content"),this.$content=w,this.readonly&&w.classList.add(this.wrapClassName("readonly")),w.appendChild(this.renderPreviewMask()),w.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const w=document.createElement("div");w.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=w,this.sideEffect.add(()=>(this.previewLazyLoad=new _m({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`}),()=>{var S;return(S=this.previewLazyLoad)==null?void 0:S.destroy()})),this.refreshPreview(),this.sideEffect.addEventListener(w,"click",S=>{var pt;if(this.readonly)return;const W=(pt=S.target.dataset)==null?void 0:pt.pageIndex;W&&(S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation(),this.onNewPageIndex(Number(W)),this.togglePreview(!1))})}return this.$preview}refreshPreview(){var pt;const{$preview:w}=this,S=this.wrapClassName("preview-page"),W=this.wrapClassName("preview-page-name");for(;w.firstChild;)w.firstChild.remove();this.pages.forEach((lt,J)=>{var kt;const X=(kt=lt.thumbnail)!=null?kt:lt.src.startsWith("ppt")?void 0:lt.src;if(!X)return;const ct=String(J),tt=document.createElement("a");tt.className=S+" "+this.wrapClassName(`preview-page-${J}`),tt.setAttribute("href","#"),tt.dataset.pageIndex=ct;const $=document.createElement("span");$.className=W,$.textContent=String(J+1),$.dataset.pageIndex=ct;const ut=document.createElement("img");ut.width=lt.width,ut.height=lt.height,ut.dataset.src=X,ut.dataset.pageIndex=ct,tt.appendChild(ut),tt.appendChild($),w.appendChild(tt)}),(pt=this.previewLazyLoad)==null||pt.update()}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",w=>{this.readonly||w.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}refreshBtnSidebar(){this.$btnSidebar.style.display=this.pages.length>0?"":"none"}renderFooter(){if(!this.$footer){const w=document.createElement("div");w.className=this.wrapClassName("footer"),this.$footer=w,this.readonly&&w.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&w.classList.add(this.wrapClassName("float-footer"));const S=this.renderFooterBtn("btn-sidebar",D0(this.namespace));this.sideEffect.addEventListener(S,"click",()=>{this.readonly||this.togglePreview()}),this.$btnSidebar=S,this.$btnSidebar.style.display="none",this.$footer.appendChild(S);const W=document.createElement("div");W.className=this.wrapClassName("page-jumps");const pt=this.renderFooterBtn("btn-page-back",N0(this.namespace));if(this.sideEffect.addEventListener(pt,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),W.appendChild(pt),this.onPlay){const tt=this.renderFooterBtn("btn-page-play",B0(this.namespace),k0(this.namespace));this.$btnPlay=tt,this.sideEffect.addEventListener(tt,"click",()=>{this.readonly||(this.setPlaying(),this.onPlay&&this.onPlay())}),W.appendChild(tt)}const lt=this.renderFooterBtn("btn-page-next",F0(this.namespace));this.sideEffect.addEventListener(lt,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),W.appendChild(lt);const J=document.createElement("div");J.className=this.wrapClassName("page-number");const X=document.createElement("input");X.className=this.wrapClassName("page-number-input"),X.value=String(this.pageIndex+1),this.readonly&&(X.disabled=!0),this.$pageNumberInput=X,this.sideEffect.addEventListener(X,"change",()=>{this.readonly||X.value&&this.onNewPageIndex(Number(X.value)-1)});const ct=document.createElement("span");this.$totalPage=ct,J.appendChild(X),J.appendChild(ct),this.$footer.appendChild(W),this.$footer.appendChild(J)}return this.$footer}renderFooterBtn(w,S,W){const pt=document.createElement("button");return pt.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(w),pt.appendChild(S),W&&pt.appendChild(W),pt}togglePreview(w){if(this.isShowPreview=w!=null?w:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const S=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));S&&this.$preview.scrollTo({top:S.offsetTop-16})}}wrapClassName(w){return`${this.namespace}-${w}`}}const j_=new Set(["clicker"]);class V_{constructor({box:w,view:S,mountSlideController:W,mountWhiteboard:pt}){this.slideController=null,this.isViewMounted=!1,this.onError=({error:lt})=>{this.viewer.setPaused(),console.warn("[Slide] render error",lt)},this.refreshPages=()=>{this.slideController&&(this.viewer.pages=iv(this.slideController.slide),this.viewer.setPageIndex(this.getPageIndex(this.slideController.page)),this.scaleDocsToFit())},this.scaleDocsToFit=()=>{if(this.slideController){const{width:lt,height:J}=this.slideController.slide;lt&&J&&(this.whiteboardView.moveCameraToContain({originX:-lt/2,originY:-J/2,width:lt,height:J,animationMode:"immediately"}),this.isViewMounted||(this.isViewMounted=!0,console.log("[Slide] mount whiteboard view"),this.mountWhiteboard(this.$whiteboardView)))}},this.onPlay=()=>{this.slideController&&this.slideController.slide.nextStep()},this.onNewPageIndex=lt=>{this.slideController&&this.slideController.jumpToPage(lt+1)},this.sideEffect=new Xm,this.namespace="netless-app-slide",this.box=w,this.whiteboardView=S,this.mountSlideController=W,this.mountWhiteboard=pt,this.viewer=new Nv({readonly:w.readonly,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.sideEffect.add(()=>{const lt=J=>{this.setReadonly(J)};return w.events.on("readonly",lt),()=>w.events.off("readonly",lt)}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",w=>{if(this.box.focus&&this.slideController)switch(w.key){case"ArrowUp":case"ArrowLeft":{this.slideController.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slideController.slide.nextStep();break}}})}renderSlideContainer(){if(!this.$slide){const w=document.createElement("div");w.className=this.wrapClassName("slide"),w.dataset.appKind="Slide",this.$slide=w}return this.$slide}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view")),this.$whiteboardView}mount(){return this.box.mountContent(this.viewer.$content),this.box.mountFooter(this.viewer.$footer),this.slideController=this.mountSlideController({anchor:this.$slide,onTransitionStart:this.viewer.setPlaying,onTransitionEnd:this.viewer.setPaused,onReady:this.refreshPages,onError:this.onError}),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit))),this}getPageIndex(w){return(w>0?w:1)-1}unmount(){return this.slideController&&(this.slideController.destroy(),this.slideController=null),this.viewer.unmount(),this}setReadonly(w){this.viewer.setReadonly(w)}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}toggleClickThrough(w){this.$whiteboardView.style.pointerEvents=!w||j_.has(w)?"none":"auto"}wrapClassName(w){return`${this.namespace}-${w}`}}const Fv=2,eg={map:new Map,queue:[],validateQueue(){for(es("[Slide] freezer: validate",this.queue);this.queue.length>Fv;){const N=this.queue.pop(),w=this.map.get(N);w&&(es("[Slide] freezer: validate-freeze",N,this.queue),w.freeze())}},set(N,w){es("[Slide] freezer: add",N,this.queue),this.map.set(N,w),this.queue.includes(N)||this.queue.unshift(N),this.validateQueue()},delete(N){es("[Slide] freezer: delete",N,this.queue),this.map.delete(N),this.queue=this.queue.filter(w=>w!==N)},focus(N){const w=this.map.get(N),S=this.queue.indexOf(N);S>-1&&this.queue.splice(S,1),this.queue.unshift(N),this.validateQueue(),es("[Slide] freezer: focus",N,this.queue),w&&w.unfreeze()}},W_=N=>{N.on("focus",({appId:w})=>{eg.focus(w)})};var Bv=`.netless-app-slide-content{position:relative;height:100%;overflow:hidden}.netless-app-slide-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-slide-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-slide-preview-active .netless-app-slide-preview-mask{display:block}.netless-app-slide-preview-active .netless-app-slide-preview{transform:translate(0)}.netless-app-slide-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-slide-preview-page:hover,.netless-app-slide-preview-page.netless-app-slide-preview-page-active{border-color:#444e601a}.netless-app-slide-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-slide-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-slide-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-slide-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-slide-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none}.netless-app-slide-footer-btn:hover{background:rgba(237,237,240,.9)}.netless-app-slide-footer-btn>svg{width:100%;height:100%}.netless-app-slide-footer-btn>svg:nth-of-type(2){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-slide-footer-btn~.netless-app-slide-footer-btn{margin-left:15px}.netless-app-slide-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-slide-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-slide-page-number-input{border:none;outline:none;width:1.5em;text-align:right;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text}.netless-app-slide-page-number-input:hover,.netless-app-slide-page-number-input:focus,.netless-app-slide-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-slide-readonly .netless-app-slide-footer-btn{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-footer-btn:hover{background:transparent}.netless-app-slide-readonly .netless-app-slide-page-number-input{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-page-number-input:hover,.netless-app-slide-readonly .netless-app-slide-page-number-input:focus,.netless-app-slide-readonly .netless-app-slide-page-number-input:active{background:transparent;box-shadow:none}.netless-app-slide-readonly .netless-app-slide-page-number-input:disabled{color:inherit}.netless-app-slide-readonly.netless-app-slide-float-footer{display:none}.netless-app-slide-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-slide-slide{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-slide-slide canvas{transform:scale(var(--netless-app-slide-scale, 1))}
6079
- `;function X_({container:N,taskId:w,url:S=xg,debug:W=!1}){if(!w)throw new Error("[Slide] taskId is required");N.style.cssText+="display:flex;flex-direction:column";const pt=new kv({target:N});return pt.debug=!!W,pt.mount(w,S),pt}class kv{constructor(w){this.slide=null,this.debug=!1,this.ready=!1,this.readyPromise=new Promise(S=>{this.resolveReady=()=>{this.ready=!0,S()}}),this.onPageChanged=S=>{this.viewer.setPageIndex(S-1)},this.onTransitionStart=()=>{this.viewer.setPlaying()},this.onTransitionEnd=()=>{this.viewer.setPaused()},this.onError=({error:S})=>{this.viewer.setPaused(),console.warn("[Slide] render error",S)},this.destroyed=!1,this.refreshPages=()=>{this.slide&&(this.viewer.pages=iv(this.slide),this.viewer.setPageIndex(this.getPageIndex(this.slide.slideState.currentSlideIndex)))},this.onPlay=()=>{this.slide&&this.slide.nextStep()},this.onNewPageIndex=S=>{this.slide&&this.slide.slideCount>0&&this.slide.renderSlide(Zg(S+1,1,this.slide.slideCount))},this.namespace="netless-app-slide",this.target=w.target,this.bgColor=rv(this.target),this.viewer=new Nv({readonly:!1,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer())}mount(w,S){this.target.appendChild(this.renderStyle()),this.target.appendChild(this.viewer.$content),this.target.appendChild(this.viewer.$footer),this.slide=new bo.Slide({anchor:this.$slide,interactive:!1,mode:"local",resize:!0,controller:this.debug,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,transactionBgColor:this.bgColor}}),this.registerEventListeners(),this.slide.setResource(w,S),this.slide.renderSlide(1)}renderStyle(){const w=document.createElement("style");return w.appendChild(document.createTextNode(Bv)),w}registerEventListeners(){if(!this.slide)return;const{slide:w}=this;w.on(bo.SLIDE_EVENTS.slideChange,this.onPageChanged),w.on(bo.SLIDE_EVENTS.renderStart,this.onTransitionStart),w.on(bo.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),w.on(bo.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),w.on(bo.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),w.on(bo.SLIDE_EVENTS.renderError,this.onError),w.on(bo.SLIDE_EVENTS.renderEnd,this.resolveReady),this.readyPromise.then(this.refreshPages)}destroy(){this.slide&&!this.destroyed&&(es("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0),this.viewer.destroy()}getPageIndex(w){return(w>0?w:1)-1}renderSlideContainer(){if(!this.$slide){const w=document.createElement("div");w.className=this.wrapClassName("slide"),w.dataset.appKind="Slide",this.$slide=w}return this.$slide}wrapClassName(w){return`${this.namespace}-${w}`}}const q_={kind:"Slide",setup(N){N.getIsWritable()&&b0(N,bg);const w=N.getAttributes();if(!(w==null?void 0:w.taskId))throw new Error("[Slide] no taskId");const S=N.getView();if(!S)throw new Error("[Slide] no view, please set scenePath on addApp()");S.disableCameraTransform=!0;const W=N.getBox();W.mountStyles(Bv);const pt=N.getInitScenePath();let lt=null;const J=$=>{const ut=N.getRoom();if(lt&&lt.slideController){let kt=!1;ut&&N.getIsWritable()&&(I0(ut,N,lt.slideController.slide,pt),kt=!0),es("[Slide] page to",$,kt),lt.viewer.setPageIndex($-1)}},X=$=>{var kt,Gt;const ut=new O0(Xg(dp({context:N},$),{onPageChanged:J}));return eg.set(N.appId,ut),((kt=$u.apps)[Gt=N.appId]||(kt[Gt]={})).controller=ut,ut.readyPromise.then($.onReady),ut};lt=new V_({box:W,view:S,mountSlideController:X,mountWhiteboard:N.mountView.bind(N)});const ct=N.getRoom(),tt=new Xm;tt.add(()=>{var $,ut,kt;return(($=$u.apps)[ut=N.appId]||($[ut]={})).context=N,$u.enable=((kt=N.getAppOptions())==null?void 0:kt.debug)||!1,$u.level="debug",()=>$u.dispose(N.appId)}),ct&&(lt.toggleClickThrough(ct.state.memberState.currentApplianceName),tt.add(()=>{const $=ut=>{ut.memberState&&lt&&lt.toggleClickThrough(ut.memberState.currentApplianceName)};return ct.callbacks.on("onRoomStateChanged",$),()=>ct.callbacks.off("onRoomStateChanged",$)})),N.emitter.on("destroy",()=>{es("[Slide]: destroy"),eg.delete(N.appId),tt.flushAll(),lt&&(lt.destroy(),lt=null)}),lt.mount()}};exports.DefaultUrl=xg;exports.FreezerLength=Fv;exports.SlidePreviewer=kv;exports.addHooks=W_;exports.apps=eg;exports.default=q_;exports.previewSlide=X_;
6078
+ `}},n.prototype.setMainSeqStep=function(e,r){var s;(s=this.player)===null||s===void 0||s.setMainSeqStep(e,r)},n.prototype.setInteractive=function(e){var r;this.interactive=e,(r=this.player)===null||r===void 0||r.setInteractive(e)},n.prototype.pause=function(){var e;(e=this.player)===null||e===void 0||e.pause()},n.prototype.resume=function(){var e;(e=this.player)===null||e===void 0||e.resume()},n.prototype.getPreviewImage=function(e){var r;return Ta(this,void 0,void 0,function(){return Ea(this,function(s){return[2,((r=this.player)===null||r===void 0?void 0:r.getPreviewImage(e))||null]})})},n.prototype.frozen=function(){var e;return Ta(this,void 0,void 0,function(){var r,s,u,h=this;return Ea(this,function(f){switch(f.label){case 0:return this.isFrowning?[2,fd(function(){return!h.isFrowning},6e4)]:this.view&&this.player?(this.isFrowning=!0,[4,this.player.clock.waitUntil(function(){return!h.isLoading},6e4)]):[3,2];case 1:for(s in f.sent(),r=this.player.getSnapshot()||"",this.cacheImage.src=r,this.cacheImage.style.position="absolute",this.cacheImage.style.zIndex="100",this.frame.appendChild(this.cacheImage),this.player.destroy(),(e=this.playerController)===null||e===void 0||e.destroy(),this.player=void 0,this.__slideState.mediaState)u=this.__slideState.mediaState[s],this.__slideState.mediaState[s]=Yu(Yu({},u),{frozenTime:this.timestamp()});this.isFrowning=!1,f.label=2;case 2:return[2]}})})},n.prototype.release=function(){var e;return Ta(this,void 0,void 0,function(){var r,s,u,h,f=this;return Ea(this,function(y){switch(y.label){case 0:if(this.isReleasing)return[2,fd(function(){return!f.isReleasing},6e4)];for(s in this.isReleasing=!0,this.initPlayer(this.config),this.player.view&&(this.player.view.style.visibility="hidden"),r=this.__slideState,this.__slideState=Object(X.cloneDeep)(om),r.mediaState)(u=r.mediaState[s]).type==="play"&&(h=Math.max((e=u.frozenTime)!==null&&e!==void 0?e:0,u.time),u.time=this.timestamp()-(h-u.time),u.frozenTime=void 0);return[4,this.setSlideState(r)];case 1:return y.sent(),[4,this.player.clock.delay(333)];case 2:y.sent(),this.player.view&&(this.player.view.style.visibility="visible");try{this.frame.removeChild(this.cacheImage)}catch{}return this.isReleasing=!1,[2]}})})},n.prototype.destroy=function(){var e,r,s,u;this.playerController&&this.playerController.destroy(),this.frameResizeObserver.disconnect(),(e=this.player)===null||e===void 0||e.removeAllListeners(),(r=this.player)===null||r===void 0||r.destroy(),(s=this.player)===null||s===void 0||s.removeAllListeners(),window.removeEventListener("__slide_log__",this.handleLogDownload),window.removeEventListener("__slide_state__",this.handleSlideStateLog),window.removeEventListener("__slide_ref__",this.handleSlideRef),window.clearInterval(this.persistLogId),Zu&&Zu.removeItem(this.logId).catch(function(){});try{((u=this.player)===null||u===void 0?void 0:u.view)&&this.anchor.removeChild(this.player.view)}catch{}},n}(J.a)}]);function Zg(N,w,S){return Math.min(Math.max(N,w),S)}function Jg(N){return typeof N=="object"&&N!==null}function dm(N){return JSON.parse(JSON.stringify(N))}var $g={exports:{}},w0={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Kg={exports:{}},S0=function(w){return!w||typeof w=="string"?!1:w instanceof Array||Array.isArray(w)||w.length>=0&&(w.splice instanceof Function||Object.getOwnPropertyDescriptor(w,w.length-1)&&w.constructor.name!=="String")},T0=S0,E0=Array.prototype.concat,M0=Array.prototype.slice,Qg=Kg.exports=function(w){for(var S=[],W=0,pt=w.length;W<pt;W++){var lt=w[W];T0(lt)?S=E0.call(S,M0.call(lt)):S.push(lt)}return S};Qg.wrap=function(N){return function(){return N(Qg(arguments))}};var pm=w0,fm=Kg.exports,tv=Object.hasOwnProperty,ev={};for(var yg in pm)tv.call(pm,yg)&&(ev[pm[yg]]=yg);var il=$g.exports={to:{},get:{}};il.get=function(N){var w=N.substring(0,3).toLowerCase(),S,W;switch(w){case"hsl":S=il.get.hsl(N),W="hsl";break;case"hwb":S=il.get.hwb(N),W="hwb";break;default:S=il.get.rgb(N),W="rgb";break}return S?{model:W,value:S}:null};il.get.rgb=function(N){if(!N)return null;var w=/^#([a-f0-9]{3,4})$/i,S=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,W=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,pt=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,lt=/^(\w+)$/,J=[0,0,0,1],X,ct,tt;if(X=N.match(S)){for(tt=X[2],X=X[1],ct=0;ct<3;ct++){var $=ct*2;J[ct]=parseInt(X.slice($,$+2),16)}tt&&(J[3]=parseInt(tt,16)/255)}else if(X=N.match(w)){for(X=X[1],tt=X[3],ct=0;ct<3;ct++)J[ct]=parseInt(X[ct]+X[ct],16);tt&&(J[3]=parseInt(tt+tt,16)/255)}else if(X=N.match(W)){for(ct=0;ct<3;ct++)J[ct]=parseInt(X[ct+1],0);X[4]&&(X[5]?J[3]=parseFloat(X[4])*.01:J[3]=parseFloat(X[4]))}else if(X=N.match(pt)){for(ct=0;ct<3;ct++)J[ct]=Math.round(parseFloat(X[ct+1])*2.55);X[4]&&(X[5]?J[3]=parseFloat(X[4])*.01:J[3]=parseFloat(X[4]))}else return(X=N.match(lt))?X[1]==="transparent"?[0,0,0,0]:tv.call(pm,X[1])?(J=pm[X[1]],J[3]=1,J):null:null;for(ct=0;ct<3;ct++)J[ct]=gd(J[ct],0,255);return J[3]=gd(J[3],0,1),J};il.get.hsl=function(N){if(!N)return null;var w=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,S=N.match(w);if(S){var W=parseFloat(S[4]),pt=(parseFloat(S[1])%360+360)%360,lt=gd(parseFloat(S[2]),0,100),J=gd(parseFloat(S[3]),0,100),X=gd(isNaN(W)?1:W,0,1);return[pt,lt,J,X]}return null};il.get.hwb=function(N){if(!N)return null;var w=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,S=N.match(w);if(S){var W=parseFloat(S[4]),pt=(parseFloat(S[1])%360+360)%360,lt=gd(parseFloat(S[2]),0,100),J=gd(parseFloat(S[3]),0,100),X=gd(isNaN(W)?1:W,0,1);return[pt,lt,J,X]}return null};il.to.hex=function(){var N=fm(arguments);return"#"+qm(N[0])+qm(N[1])+qm(N[2])+(N[3]<1?qm(Math.round(N[3]*255)):"")};il.to.rgb=function(){var N=fm(arguments);return N.length<4||N[3]===1?"rgb("+Math.round(N[0])+", "+Math.round(N[1])+", "+Math.round(N[2])+")":"rgba("+Math.round(N[0])+", "+Math.round(N[1])+", "+Math.round(N[2])+", "+N[3]+")"};il.to.rgb.percent=function(){var N=fm(arguments),w=Math.round(N[0]/255*100),S=Math.round(N[1]/255*100),W=Math.round(N[2]/255*100);return N.length<4||N[3]===1?"rgb("+w+"%, "+S+"%, "+W+"%)":"rgba("+w+"%, "+S+"%, "+W+"%, "+N[3]+")"};il.to.hsl=function(){var N=fm(arguments);return N.length<4||N[3]===1?"hsl("+N[0]+", "+N[1]+"%, "+N[2]+"%)":"hsla("+N[0]+", "+N[1]+"%, "+N[2]+"%, "+N[3]+")"};il.to.hwb=function(){var N=fm(arguments),w="";return N.length>=4&&N[3]!==1&&(w=", "+N[3]),"hwb("+N[0]+", "+N[1]+"%, "+N[2]+"%"+w+")"};il.to.keyword=function(N){return ev[N.slice(0,3)]};function gd(N,w,S){return Math.min(Math.max(w,N),S)}function qm(N){var w=Math.round(N).toString(16).toUpperCase();return w.length<2?"0"+w:w}var A0=$g.exports;class C0{constructor(w){this.enable=w,this.apps={},this.level="debug",this._onMessage=S=>{Jg(S.data)&&(typeof S.data.slide=="boolean"?this.enable=S.data.slide:S.data.slide==="__instance"&&console.log(this))},window.addEventListener("message",this._onMessage)}log(...w){this.enable&&console.log(...w)}verbose(...w){this.enable&&this.level==="verbose"&&console.log(...w)}dispose(w){this.enable=!1,delete this.apps[w],window.removeEventListener("message",this._onMessage)}}const $u=new C0(!1),es=$u.log.bind($u),P0=$u.verbose.bind($u);function nv(N){try{const w=window.getComputedStyle(N).backgroundColor;if(w!=="rgba(0, 0, 0, 0)"&&w!=="transparent")return w;if(N.parentElement)return nv(N.parentElement)}catch{}return"#ffffff"}function R0(N){const w=A0.get(N);if(w&&w.model==="rgb"){const S=w.value,pt=(((Math.round(S[0])&255)<<16)+((Math.round(S[1])&255)<<8)+(Math.round(S[2])&255)).toString(16);return"#"+"000000".substring(pt.length)+pt}else return N}let Ym="";function rv(N){return Ym||(Ym=R0(nv(N)),es("[Slide] guess bg color",Ym)),Ym}function iv(N){const{width:w,height:S,slideCount:W,slideState:pt}=N,{taskId:lt,url:J}=pt,X=[];for(let ct=1;ct<=W;++ct)X.push({width:w,height:S,thumbnail:`${J}/${lt}/preview/${ct}.png`,src:"ppt"});return X}function I0(N,w,S,W){var X;const pt=S.slideState.currentSlideIndex;if(!(pt>0)||!w.getIsWritable())return;const lt=[W,pt].join("/");if(N.scenePathType(lt)!=="page"){N.removeScenes(W);const ct=S.slideCount,tt=[];for(let $=1;$<=ct;++$)tt.push({name:`${$}`});N.putScenes(W,tt)}let J;w.getBox().focus?J=N.state.sceneState.scenePath:J=((X=w.getView())==null?void 0:X.focusScenePath)||"",J!==lt&&w.setScenePath(lt)}const xg="https://convertcdn.netless.link/dynamicConvert",L0=40,bg={taskId:"",url:"",state:null};class O0{constructor({context:w,anchor:S,onPageChanged:W,onTransitionStart:pt,onTransitionEnd:lt,onError:J}){this.sideEffect=new cm,this.ready=!1,this.readyPromise=new Promise(X=>{this.resolveReady=()=>setTimeout(()=>{this.ready=!0,X()},1e3)}),this.onSyncDispatch=X=>{if(this.context.getIsWritable()&&this.room){const ct={type:bo.SLIDE_EVENTS.syncDispatch,payload:X};es("[Slide] dispatch",X),this.room.dispatchMagixEvent(this.channel,ct)}},this.magixEventListener=X=>{if(X.event===this.channel&&Jg(X.payload)){const{type:ct,payload:tt}=X.payload;ct===bo.SLIDE_EVENTS.syncDispatch&&(this.syncStateOnce(),es("[Slide] receive",tt),this.syncStateOnceFlag||this.slide.emit(bo.SLIDE_EVENTS.syncReceive,tt))}},this.onStateChange=X=>{this.context.getIsWritable()&&(P0("[Slide] state change",JSON.stringify(X,null,2)),this.context.updateAttributes(["state"],X))},this.onSeeked=()=>{const X=this.context.getAttributes().state;X&&this.slide.setSlideState(dm(X))},this.pollCount=0,this.pollReadyState=()=>{this.ready?this._toFreeze===1?this.freeze():this._toFreeze===-1&&this.unfreeze():this.pollCount<L0?(this.pollCount++,setTimeout(this.pollReadyState,500)):(this.pollCount=0,es("[Slide] renderSlide (retry after timeout)",1),this.slide.renderSlide(1))},this._pageCount=0,this.destroyed=!1,this.timestamp=()=>this.room&&this.room.calibrationTimestamp?this.room.calibrationTimestamp:this.player?this.player.beginTimestamp+this.player.progressTime:Date.now(),this.isFrozen=!1,this._toFreeze=0,this.freezePromise=null,this.freeze=()=>{this.ready?(es("[Slide] freeze",this.context.appId),this.freezePromise?this._toFreeze=1:this.isFrozen||(this._toFreeze=0,this.freezePromise=this.slide.frozen().then(this.afterFreeze.bind(this,1)))):this._toFreeze=1},this.unfreeze=async()=>{this.ready?(es("[Slide] unfreeze",this.context.appId),this.freezePromise?this._toFreeze=-1:this.isFrozen&&(this._toFreeze=0,this.freezePromise=this.slide.release().then(this.afterFreeze.bind(this,-1)))):this._toFreeze=-1},this.onPageChanged=W,this.onTransitionStart=pt,this.onTransitionEnd=lt,this.onError=J,this.context=w,this.channel=`channel-${w.appId}`,this.room=w.getRoom(),this.player=this.room?void 0:w.getDisplayer(),this.slide=this.createSlide(S),this.syncStateOnceFlag=!this.context.isAddApp,this.initialize()}jumpToPage(w){this.ready&&(w=Zg(w,1,this.pageCount),this.slide.renderSlide(w))}initialize(){this.registerEventListeners(),this.kickStart()}kickStart(){const{context:w,slide:S}=this,{taskId:W,url:pt,state:lt}=dp(dp({},bg),this.context.getAttributes());S.setResource(W,pt||xg),lt?(es("[Slide] init with state",dm(lt)),this.syncStateOnceFlag=!1,S.setSlideState(dm(lt))):w.isAddApp&&(es("[Slide] init by renderSlide",1),S.renderSlide(1)),this.pollReadyState()}registerEventListeners(){const{context:w,slide:S}=this;this.sideEffect.add(()=>{const W=w.mobxUtils.reaction(()=>w.getAttributes().state,()=>{this.syncStateOnce(),W()});return W}),this.sideEffect.add(()=>(w.emitter.on("seek",this.onSeeked),()=>w.emitter.off("seek",this.onSeeked))),this.sideEffect.add(()=>{const W=w.getDisplayer();return W.addMagixEventListener(this.channel,this.magixEventListener,{fireSelfEventAfterCommit:!0}),()=>W.removeMagixEventListener(this.channel)}),S.on(bo.SLIDE_EVENTS.slideChange,this.onPageChanged),S.on(bo.SLIDE_EVENTS.renderStart,this.onTransitionStart),S.on(bo.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),S.on(bo.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),S.on(bo.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),S.on(bo.SLIDE_EVENTS.renderError,this.onError),S.on(bo.SLIDE_EVENTS.stateChange,this.onStateChange),S.on(bo.SLIDE_EVENTS.syncDispatch,this.onSyncDispatch),S.on(bo.SLIDE_EVENTS.renderEnd,this.resolveReady)}syncStateOnce(){if(this.syncStateOnceFlag){const{state:w}=dp(dp({},bg),this.context.getAttributes());w&&(es("[Slide] sync with state (once)",dm(w)),this.slide.setSlideState(dm(w)),this.syncStateOnceFlag=!1)}}get pageCount(){return this._pageCount>0?this._pageCount:(this._pageCount=this.slide.slideCount,this._pageCount)}get page(){return this.slide.slideState.currentSlideIndex}createSlide(w){var W,pt;return new bo.Slide({anchor:w,interactive:!0,mode:"interactive",resize:!0,controller:$u.enable,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,resolution:(W=this.context.getAppOptions())==null?void 0:W.resolution,transactionBgColor:((pt=this.context.getAppOptions())==null?void 0:pt.bgColor)||rv(w)},timestamp:this.timestamp})}destroy(){this.sideEffect.flushAll(),this.destroyed||(es("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0)}afterFreeze(w){w===1?(this.isFrozen=!0,this.freezePromise=null,this._toFreeze===-1&&this.unfreeze()):w===-1&&(this.isFrozen=!1,this.freezePromise=null,this._toFreeze===1&&this.freeze())}}function D0(N){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${N}-footer-icon-sidebar`),S.setAttribute("viewBox","0 0 64 64");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M50 8H14c-3.309 0-6 2.691-6 6v36c0 3.309 2.691 6 6 6h36c3.309 0 6-2.691 6-6V14c0-3.309-2.691-6-6-6zM12 50V14c0-1.103.897-2 2-2h8v40h-8c-1.103 0-2-.897-2-2zm40 0c0 1.103-.897 2-2 2H26V12h24c1.103 0 2 .897 2 2z"),S.appendChild(W),S}function N0(N){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${N}-footer-icon-arrow-left`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M177.81 249.959L337.473 90.295c2.722-2.865 2.651-7.378-.143-10.1-2.793-2.65-7.163-2.65-9.956 0l-164.75 164.75c-2.793 2.793-2.793 7.306 0 10.1l164.75 164.75c2.865 2.722 7.378 2.65 10.099-.143 2.651-2.794 2.651-7.163 0-9.957L177.809 249.959z"),S.appendChild(W),S}function F0(N){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${N}-footer-icon-arrow-right`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M322.19 250.041L162.527 409.705c-2.722 2.865-2.651 7.378.143 10.1 2.793 2.65 7.163 2.65 9.956 0l164.75-164.75c2.793-2.793 2.793-7.306 0-10.1l-164.75-164.75c-2.865-2.722-7.378-2.65-10.099.143-2.651 2.794-2.651 7.163 0 9.957l159.664 159.736z"),S.appendChild(W),S}function B0(N){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${N}-footer-icon-play`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M418.158 257.419L174.663 413.33c-6.017 3.919-15.708 3.772-21.291-.29-2.791-2.018-4.295-4.483-4.295-7.084V94.109c0-5.65 6.883-10.289 15.271-10.289 4.298 0 8.391 1.307 11.181 3.332l242.629 155.484c6.016 3.917 6.451 10.292.649 14.491-.216.154-.432.154-.649.292zM170.621 391.288l223.116-141.301L170.71 107.753l-.089 283.535z"),S.appendChild(W),S}function k0(N){const w="http://www.w3.org/2000/svg",S=document.createElementNS(w,"svg");S.setAttribute("class",`${N}-footer-icon-pause`),S.setAttribute("viewBox","0 0 500 500");const W=document.createElementNS(w,"path");return W.setAttribute("fill","currentColor"),W.setAttribute("d","M312.491 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261zM165.257 78.261c0-6.159 4.893-11.213 11.04-11.213 6.158 0 11.211 5.054 11.211 11.213v343.478c0 6.159-5.053 11.213-11.211 11.213-6.147 0-11.04-5.054-11.04-11.213V78.261z"),S.appendChild(W),S}const pp=typeof window!="undefined",ov=pp&&!("onscroll"in window)||typeof navigator!="undefined"&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),sv=pp&&"IntersectionObserver"in window,av=pp&&"classList"in document.createElement("p"),lv=pp&&window.devicePixelRatio>1,U0={elements_selector:".lazy",container:ov||pp?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1},uv=N=>Object.assign({},U0,N),hv=function(N,w){let S;const W="LazyLoad::Initialized",pt=new N(w);try{S=new CustomEvent(W,{detail:{instance:pt}})}catch{S=document.createEvent("CustomEvent"),S.initCustomEvent(W,!1,!1,{instance:pt})}window.dispatchEvent(S)},G0=(N,w)=>{if(!!w)if(!w.length)hv(N,w);else for(let S=0,W;W=w[S];S+=1)hv(N,W)},uc="src",wg="srcset",Sg="sizes",cv="poster",mm="llOriginalAttrs",Tg="loading",dv="loaded",pv="applied",H0="entered",Eg="error",fv="native",mv="data-",gv="ll-status",Tl=(N,w)=>N.getAttribute(mv+w),z0=(N,w,S)=>{var W=mv+w;if(S===null){N.removeAttribute(W);return}N.setAttribute(W,S)},gm=N=>Tl(N,gv),fp=(N,w)=>z0(N,gv,w),Zm=N=>fp(N,null),Mg=N=>gm(N)===null,j0=N=>gm(N)===Tg,V0=N=>gm(N)===Eg,Ag=N=>gm(N)===fv,W0=[Tg,dv,pv,Eg],X0=N=>W0.indexOf(gm(N))>=0,vd=(N,w,S,W)=>{if(!!N){if(W!==void 0){N(w,S,W);return}if(S!==void 0){N(w,S);return}N(w)}},mf=(N,w)=>{if(av){N.classList.add(w);return}N.className+=(N.className?" ":"")+w},Ku=(N,w)=>{if(av){N.classList.remove(w);return}N.className=N.className.replace(new RegExp("(^|\\s+)"+w+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},q0=N=>{N.llTempImage=document.createElement("IMG")},Y0=N=>{delete N.llTempImage},vv=N=>N.llTempImage,Jm=(N,w)=>{if(!w)return;const S=w._observer;!S||S.unobserve(N)},Z0=N=>{N.disconnect()},J0=(N,w,S)=>{w.unobserve_entered&&Jm(N,S)},Cg=(N,w)=>{!N||(N.loadingCount+=w)},$0=N=>{!N||(N.toLoadCount-=1)},_v=(N,w)=>{!N||(N.toLoadCount=w)},K0=N=>N.loadingCount>0,Q0=N=>N.toLoadCount>0,yv=N=>{let w=[];for(let S=0,W;W=N.children[S];S+=1)W.tagName==="SOURCE"&&w.push(W);return w},Pg=(N,w)=>{const S=N.parentNode;if(!S||S.tagName!=="PICTURE")return;yv(S).forEach(w)},xv=(N,w)=>{yv(N).forEach(w)},$m=[uc],bv=[uc,cv],Km=[uc,wg,Sg],Qm=N=>!!N[mm],wv=N=>N[mm],Sv=N=>delete N[mm],vm=(N,w)=>{if(Qm(N))return;const S={};w.forEach(W=>{S[W]=N.getAttribute(W)}),N[mm]=S},t_=N=>{Qm(N)||(N[mm]={backgroundImage:N.style.backgroundImage})},e_=(N,w,S)=>{if(!S){N.removeAttribute(w);return}N.setAttribute(w,S)},_m=(N,w)=>{if(!Qm(N))return;const S=wv(N);w.forEach(W=>{e_(N,W,S[W])})},n_=N=>{if(!Qm(N))return;const w=wv(N);N.style.backgroundImage=w.backgroundImage},r_=(N,w,S)=>{mf(N,w.class_applied),fp(N,pv),!!S&&(w.unobserve_completed&&Jm(N,w),vd(w.callback_applied,N,S))},Tv=(N,w,S)=>{mf(N,w.class_loading),fp(N,Tg),!!S&&(Cg(S,1),vd(w.callback_loading,N,S))},mp=(N,w,S)=>{!S||N.setAttribute(w,S)},Ev=(N,w)=>{mp(N,Sg,Tl(N,w.data_sizes)),mp(N,wg,Tl(N,w.data_srcset)),mp(N,uc,Tl(N,w.data_src))},i_=(N,w)=>{Pg(N,S=>{vm(S,Km),Ev(S,w)}),vm(N,Km),Ev(N,w)},o_=(N,w)=>{vm(N,$m),mp(N,uc,Tl(N,w.data_src))},s_=(N,w)=>{xv(N,S=>{vm(S,$m),mp(S,uc,Tl(S,w.data_src))}),vm(N,bv),mp(N,cv,Tl(N,w.data_poster)),mp(N,uc,Tl(N,w.data_src)),N.load()},a_=(N,w,S)=>{const W=Tl(N,w.data_bg),pt=Tl(N,w.data_bg_hidpi),lt=lv&&pt?pt:W;!lt||(N.style.backgroundImage=`url("${lt}")`,vv(N).setAttribute(uc,lt),Tv(N,w,S))},l_=(N,w,S)=>{const W=Tl(N,w.data_bg_multi),pt=Tl(N,w.data_bg_multi_hidpi),lt=lv&&pt?pt:W;!lt||(N.style.backgroundImage=lt,r_(N,w,S))},Mv={IMG:i_,IFRAME:o_,VIDEO:s_},u_=(N,w)=>{const S=Mv[N.tagName];!S||S(N,w)},h_=(N,w,S)=>{const W=Mv[N.tagName];!W||(W(N,w),Tv(N,w,S))},c_=["IMG","IFRAME","VIDEO"],d_=N=>c_.indexOf(N.tagName)>-1,Av=(N,w)=>{w&&!K0(w)&&!Q0(w)&&vd(N.callback_finish,w)},Cv=(N,w,S)=>{N.addEventListener(w,S),N.llEvLisnrs[w]=S},p_=(N,w,S)=>{N.removeEventListener(w,S)},Rg=N=>!!N.llEvLisnrs,f_=(N,w,S)=>{Rg(N)||(N.llEvLisnrs={});const W=N.tagName==="VIDEO"?"loadeddata":"load";Cv(N,W,w),Cv(N,"error",S)},Ig=N=>{if(!Rg(N))return;const w=N.llEvLisnrs;for(let S in w){const W=w[S];p_(N,S,W)}delete N.llEvLisnrs},Pv=(N,w,S)=>{Y0(N),Cg(S,-1),$0(S),Ku(N,w.class_loading),w.unobserve_completed&&Jm(N,S)},m_=(N,w,S,W)=>{const pt=Ag(w);Pv(w,S,W),mf(w,S.class_loaded),fp(w,dv),vd(S.callback_loaded,w,W),pt||Av(S,W)},g_=(N,w,S,W)=>{const pt=Ag(w);Pv(w,S,W),mf(w,S.class_error),fp(w,Eg),vd(S.callback_error,w,W),pt||Av(S,W)},Lg=(N,w,S)=>{const W=vv(N)||N;if(Rg(W))return;f_(W,J=>{m_(J,N,w,S),Ig(W)},J=>{g_(J,N,w,S),Ig(W)})},v_=(N,w,S)=>{q0(N),Lg(N,w,S),t_(N),a_(N,w,S),l_(N,w,S)},__=(N,w,S)=>{Lg(N,w,S),h_(N,w,S)},Og=(N,w,S)=>{d_(N)?__(N,w,S):v_(N,w,S)},y_=(N,w,S)=>{N.setAttribute("loading","lazy"),Lg(N,w,S),u_(N,w),fp(N,fv)},Rv=N=>{N.removeAttribute(uc),N.removeAttribute(wg),N.removeAttribute(Sg)},x_=N=>{Pg(N,w=>{Rv(w)}),Rv(N)},Iv=N=>{Pg(N,w=>{_m(w,Km)}),_m(N,Km)},b_=N=>{xv(N,w=>{_m(w,$m)}),_m(N,bv),N.load()},w_=N=>{_m(N,$m)},S_={IMG:Iv,IFRAME:w_,VIDEO:b_},T_=N=>{const w=S_[N.tagName];if(!w){n_(N);return}w(N)},E_=(N,w)=>{Mg(N)||Ag(N)||(Ku(N,w.class_entered),Ku(N,w.class_exited),Ku(N,w.class_applied),Ku(N,w.class_loading),Ku(N,w.class_loaded),Ku(N,w.class_error))},M_=(N,w)=>{T_(N),E_(N,w),Zm(N),Sv(N)},A_=(N,w,S,W)=>{!S.cancel_on_exit||!j0(N)||N.tagName==="IMG"&&(Ig(N),x_(N),Iv(N),Ku(N,S.class_loading),Cg(W,-1),Zm(N),vd(S.callback_cancel,N,w,W))},C_=(N,w,S,W)=>{const pt=X0(N);fp(N,H0),mf(N,S.class_entered),Ku(N,S.class_exited),J0(N,S,W),vd(S.callback_enter,N,w,W),!pt&&Og(N,S,W)},P_=(N,w,S,W)=>{Mg(N)||(mf(N,S.class_exited),A_(N,w,S,W),vd(S.callback_exit,N,w,W))},R_=["IMG","IFRAME","VIDEO"],Lv=N=>N.use_native&&"loading"in HTMLImageElement.prototype,I_=(N,w,S)=>{N.forEach(W=>{R_.indexOf(W.tagName)!==-1&&y_(W,w,S)}),_v(S,0)},L_=N=>N.isIntersecting||N.intersectionRatio>0,O_=N=>({root:N.container===document?null:N.container,rootMargin:N.thresholds||N.threshold+"px"}),D_=(N,w,S)=>{N.forEach(W=>L_(W)?C_(W.target,W,w,S):P_(W.target,W,w,S))},N_=(N,w)=>{w.forEach(S=>{N.observe(S)})},F_=(N,w)=>{Z0(N),N_(N,w)},B_=(N,w)=>{!sv||Lv(N)||(w._observer=new IntersectionObserver(S=>{D_(S,N,w)},O_(N)))},Ov=N=>Array.prototype.slice.call(N),tg=N=>N.container.querySelectorAll(N.elements_selector),k_=N=>Ov(N).filter(Mg),U_=N=>V0(N),G_=N=>Ov(N).filter(U_),Dv=(N,w)=>k_(N||tg(w)),H_=(N,w)=>{G_(tg(N)).forEach(W=>{Ku(W,N.class_error),Zm(W)}),w.update()},z_=(N,w)=>{!pp||window.addEventListener("online",()=>{H_(N,w)})},ym=function(N,w){const S=uv(N);this._settings=S,this.loadingCount=0,B_(S,this),z_(S,this),this.update(w)};ym.prototype={update:function(N){const w=this._settings,S=Dv(N,w);if(_v(this,S.length),ov||!sv){this.loadAll(S);return}if(Lv(w)){I_(S,w,this);return}F_(this._observer,S)},destroy:function(){this._observer&&this._observer.disconnect(),tg(this._settings).forEach(N=>{Sv(N)}),delete this._observer,delete this._settings,delete this.loadingCount,delete this.toLoadCount},loadAll:function(N){const w=this._settings;Dv(N,w).forEach(W=>{Jm(W,this),Og(W,w,this)})},restoreAll:function(){const N=this._settings;tg(N).forEach(w=>{M_(w,N)})}};ym.load=(N,w)=>{const S=uv(w);Og(N,S)};ym.resetStatus=N=>{Zm(N)};pp&&G0(ym,window.lazyLoadOptions);class Nv{constructor({readonly:w,onNewPageIndex:S,onPlay:W}){this._pages=[],this.pageIndex=0,this.setPaused=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!1)},this.setPlaying=()=>{this.$btnPlay.classList.toggle(this.wrapClassName("footer-btn-playing"),!0)},this.namespace="netless-app-slide",this.isShowPreview=!1,this.isSmallBox=!1,this.sideEffect=new cm,this.readonly=w,this.onNewPageIndex=S,this.onPlay=W,this.render()}set pages(w){this._pages=w,this.refreshPreview(),this.refreshTotalPage(),this.refreshBtnSidebar()}get pages(){return this._pages}unmount(){this.$content.remove(),this.$footer.remove()}setReadonly(w){this.readonly=w,this.$content.classList.toggle(this.wrapClassName("readonly"),w),this.$footer.classList.toggle(this.wrapClassName("readonly"),w),this.$pageNumberInput.disabled=w}destroy(){this.sideEffect.flushAll(),this.unmount()}setPageIndex(w){Number.isNaN(w)||(this.pageIndex=w,this.$pageNumberInput.value=String(w+1))}refreshTotalPage(){this.pages.length?this.$totalPage.textContent=" / "+this.pages.length:this.$totalPage.textContent=""}setSmallBox(w){this.isSmallBox!==w&&(this.isSmallBox=w,this.$footer.classList.toggle(this.wrapClassName("float-footer"),w))}render(){return this.renderContent(),this.renderFooter(),this.$content}renderContent(){if(!this.$content){const w=document.createElement("div");w.className=this.wrapClassName("content"),this.$content=w,this.readonly&&w.classList.add(this.wrapClassName("readonly")),w.appendChild(this.renderPreviewMask()),w.appendChild(this.renderPreview())}return this.$content}renderPreview(){if(!this.$preview){const w=document.createElement("div");w.className=this.wrapClassName("preview")+" tele-fancy-scrollbar",this.$preview=w,this.sideEffect.add(()=>(this.previewLazyLoad=new ym({container:this.$preview,elements_selector:`.${this.wrapClassName("preview-page>img")}`}),()=>{var S;return(S=this.previewLazyLoad)==null?void 0:S.destroy()})),this.refreshPreview(),this.sideEffect.addEventListener(w,"click",S=>{var pt;if(this.readonly)return;const W=(pt=S.target.dataset)==null?void 0:pt.pageIndex;W&&(S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation(),this.onNewPageIndex(Number(W)),this.togglePreview(!1))})}return this.$preview}refreshPreview(){var pt;const{$preview:w}=this,S=this.wrapClassName("preview-page"),W=this.wrapClassName("preview-page-name");for(;w.firstChild;)w.firstChild.remove();this.pages.forEach((lt,J)=>{var kt;const X=(kt=lt.thumbnail)!=null?kt:lt.src.startsWith("ppt")?void 0:lt.src;if(!X)return;const ct=String(J),tt=document.createElement("a");tt.className=S+" "+this.wrapClassName(`preview-page-${J}`),tt.setAttribute("href","#"),tt.dataset.pageIndex=ct;const $=document.createElement("span");$.className=W,$.textContent=String(J+1),$.dataset.pageIndex=ct;const ut=document.createElement("img");ut.width=lt.width,ut.height=lt.height,ut.dataset.src=X,ut.dataset.pageIndex=ct,tt.appendChild(ut),tt.appendChild($),w.appendChild(tt)}),(pt=this.previewLazyLoad)==null||pt.update()}renderPreviewMask(){return this.$previewMask||(this.$previewMask=document.createElement("div"),this.$previewMask.className=this.wrapClassName("preview-mask"),this.sideEffect.addEventListener(this.$previewMask,"click",w=>{this.readonly||w.target===this.$previewMask&&this.togglePreview(!1)})),this.$previewMask}refreshBtnSidebar(){this.$btnSidebar.style.display=this.pages.length>0?"":"none"}renderFooter(){if(!this.$footer){const w=document.createElement("div");w.className=this.wrapClassName("footer"),this.$footer=w,this.readonly&&w.classList.add(this.wrapClassName("readonly")),this.isSmallBox&&w.classList.add(this.wrapClassName("float-footer"));const S=this.renderFooterBtn("btn-sidebar",D0(this.namespace));this.sideEffect.addEventListener(S,"click",()=>{this.readonly||this.togglePreview()}),this.$btnSidebar=S,this.$btnSidebar.style.display="none",this.$footer.appendChild(S);const W=document.createElement("div");W.className=this.wrapClassName("page-jumps");const pt=this.renderFooterBtn("btn-page-back",N0(this.namespace));if(this.sideEffect.addEventListener(pt,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex-1)}),W.appendChild(pt),this.onPlay){const tt=this.renderFooterBtn("btn-page-play",B0(this.namespace),k0(this.namespace));this.$btnPlay=tt,this.sideEffect.addEventListener(tt,"click",()=>{this.readonly||(this.setPlaying(),this.onPlay&&this.onPlay())}),W.appendChild(tt)}const lt=this.renderFooterBtn("btn-page-next",F0(this.namespace));this.sideEffect.addEventListener(lt,"click",()=>{this.readonly||this.onNewPageIndex(this.pageIndex+1)}),W.appendChild(lt);const J=document.createElement("div");J.className=this.wrapClassName("page-number");const X=document.createElement("input");X.className=this.wrapClassName("page-number-input"),X.value=String(this.pageIndex+1),this.readonly&&(X.disabled=!0),this.$pageNumberInput=X,this.sideEffect.addEventListener(X,"change",()=>{this.readonly||X.value&&this.onNewPageIndex(Number(X.value)-1)});const ct=document.createElement("span");this.$totalPage=ct,J.appendChild(X),J.appendChild(ct),this.$footer.appendChild(W),this.$footer.appendChild(J)}return this.$footer}renderFooterBtn(w,S,W){const pt=document.createElement("button");return pt.className=this.wrapClassName("footer-btn")+" "+this.wrapClassName(w),pt.appendChild(S),W&&pt.appendChild(W),pt}togglePreview(w){if(this.isShowPreview=w!=null?w:!this.isShowPreview,this.$content.classList.toggle(this.wrapClassName("preview-active"),this.isShowPreview),this.isShowPreview){const S=this.$preview.querySelector("."+this.wrapClassName(`preview-page-${this.pageIndex}`));S&&this.$preview.scrollTo({top:S.offsetTop-16})}}wrapClassName(w){return`${this.namespace}-${w}`}}const j_=new Set(["clicker"]);class V_{constructor({box:w,view:S,mountSlideController:W,mountWhiteboard:pt}){this.slideController=null,this.isViewMounted=!1,this.onError=({error:lt})=>{this.viewer.setPaused(),console.warn("[Slide] render error",lt)},this.refreshPages=()=>{this.slideController&&(this.viewer.pages=iv(this.slideController.slide),this.viewer.setPageIndex(this.getPageIndex(this.slideController.page)),this.scaleDocsToFit())},this.scaleDocsToFit=()=>{if(this.slideController){const{width:lt,height:J}=this.slideController.slide;lt&&J&&(this.whiteboardView.moveCameraToContain({originX:-lt/2,originY:-J/2,width:lt,height:J,animationMode:"immediately"}),this.isViewMounted||(this.isViewMounted=!0,console.log("[Slide] mount whiteboard view"),this.mountWhiteboard(this.$whiteboardView)))}},this.onPlay=()=>{this.slideController&&this.slideController.slide.nextStep()},this.onNewPageIndex=lt=>{this.slideController&&this.slideController.jumpToPage(lt+1)},this.sideEffect=new cm,this.namespace="netless-app-slide",this.box=w,this.whiteboardView=S,this.mountSlideController=W,this.mountWhiteboard=pt,this.viewer=new Nv({readonly:w.readonly,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.sideEffect.add(()=>{const lt=J=>{this.setReadonly(J)};return w.events.on("readonly",lt),()=>w.events.off("readonly",lt)}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.viewer.$content.appendChild(this.renderWhiteboardView()),this.sideEffect.addEventListener(window,"keydown",w=>{if(this.box.focus&&this.slideController)switch(w.key){case"ArrowUp":case"ArrowLeft":{this.slideController.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slideController.slide.nextStep();break}}})}renderSlideContainer(){if(!this.$slide){const w=document.createElement("div");w.className=this.wrapClassName("slide"),w.dataset.appKind="Slide",this.$slide=w}return this.$slide}renderWhiteboardView(){return this.$whiteboardView||(this.$whiteboardView=document.createElement("div"),this.$whiteboardView.className=this.wrapClassName("wb-view")),this.$whiteboardView}mount(){return this.box.mountContent(this.viewer.$content),this.box.mountFooter(this.viewer.$footer),this.slideController=this.mountSlideController({anchor:this.$slide,onTransitionStart:this.viewer.setPlaying,onTransitionEnd:this.viewer.setPaused,onReady:this.refreshPages,onError:this.onError}),this.scaleDocsToFit(),this.sideEffect.add(()=>(this.whiteboardView.callbacks.on("onSizeUpdated",this.scaleDocsToFit),()=>this.whiteboardView.callbacks.off("onSizeUpdated",this.scaleDocsToFit))),this}getPageIndex(w){return(w>0?w:1)-1}unmount(){return this.slideController&&(this.slideController.destroy(),this.slideController=null),this.viewer.unmount(),this}setReadonly(w){this.viewer.setReadonly(w)}destroy(){this.sideEffect.flushAll(),this.unmount(),this.viewer.destroy()}toggleClickThrough(w){this.$whiteboardView.style.pointerEvents=!w||j_.has(w)?"none":"auto"}wrapClassName(w){return`${this.namespace}-${w}`}}const Fv=2,eg={map:new Map,queue:[],validateQueue(){for(es("[Slide] freezer: validate",this.queue);this.queue.length>Fv;){const N=this.queue.pop(),w=this.map.get(N);w&&(es("[Slide] freezer: validate-freeze",N,this.queue),w.freeze())}},set(N,w){es("[Slide] freezer: add",N,this.queue),this.map.set(N,w),this.queue.includes(N)||this.queue.unshift(N),this.validateQueue()},delete(N){es("[Slide] freezer: delete",N,this.queue),this.map.delete(N),this.queue=this.queue.filter(w=>w!==N)},focus(N){const w=this.map.get(N),S=this.queue.indexOf(N);S>-1&&this.queue.splice(S,1),this.queue.unshift(N),this.validateQueue(),es("[Slide] freezer: focus",N,this.queue),w&&w.unfreeze()}},W_=N=>{N.on("focus",({appId:w})=>{eg.focus(w)})};var Bv=`.netless-app-slide-content{position:relative;height:100%;overflow:hidden}.netless-app-slide-preview-mask{display:none;position:absolute;z-index:200;top:0;left:0;width:100%;height:100%}.netless-app-slide-preview{display:flex;flex-direction:column;align-items:center;position:absolute;z-index:300;top:0;left:0;width:33%;max-width:200px;height:100%;padding-top:10px;transform:translate(-100%);background:rgba(237,237,240,.9);box-shadow:inset -1px 0 #0000001c;transition:transform .4s}.netless-app-slide-preview-active .netless-app-slide-preview-mask{display:block}.netless-app-slide-preview-active .netless-app-slide-preview{transform:translate(0)}.netless-app-slide-preview-page{position:relative;display:block;width:55%;margin-bottom:10px;font-size:0;color:transparent;outline:none;border:7px solid transparent;border-radius:4px;transition:border-color .3s;user-select:none}.netless-app-slide-preview-page:hover,.netless-app-slide-preview-page.netless-app-slide-preview-page-active{border-color:#444e601a}.netless-app-slide-preview-page>img{width:100%;height:auto;box-sizing:border-box;border:1px solid rgba(0,0,0,.5);border-radius:1px;background-color:#fff;box-shadow:0 2px 8px #0000004d}.netless-app-slide-preview-page-name{position:absolute;top:1px;left:-10px;transform:translate(-100%);text-align:right;font-size:12px;color:#5f5f5f;user-select:none}.netless-app-slide-footer{box-sizing:border-box;height:26px;display:flex;align-items:center;padding:0 16px;border-top:1px solid #eeeef7;color:#191919}.netless-app-slide-float-footer{width:100%;min-height:26px;position:absolute;left:0;bottom:0;z-index:2000;background:rgba(249,249,252,.9);transition:opacity .4s}.netless-app-slide-footer-btn{box-sizing:border-box;width:26px;height:26px;font-size:0;margin:0;padding:3px;border:none;border-radius:1px;outline:none;color:currentColor;background:transparent;transition:background .4s;cursor:pointer;user-select:none}.netless-app-slide-footer-btn:hover{background:rgba(237,237,240,.9)}.netless-app-slide-footer-btn>svg{width:100%;height:100%}.netless-app-slide-footer-btn>svg:nth-of-type(2){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(1){display:none}.netless-app-slide-footer-btn.netless-app-slide-footer-btn-playing>svg:nth-of-type(2){display:initial}.netless-app-slide-footer-btn~.netless-app-slide-footer-btn{margin-left:15px}.netless-app-slide-page-jumps{flex:1;display:flex;justify-content:center;align-items:center}.netless-app-slide-page-number{margin-left:auto;font-size:13px;user-select:none;white-space:nowrap;word-break:keep-all}.netless-app-slide-page-number-input{border:none;outline:none;width:1.5em;text-align:right;border-radius:2px;color:currentColor;background:transparent;transition:background .4s;user-select:text}.netless-app-slide-page-number-input:hover,.netless-app-slide-page-number-input:focus,.netless-app-slide-page-number-input:active{background:#fff;box-shadow:#63636333 0 2px 8px}.netless-app-slide-readonly .netless-app-slide-footer-btn{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-footer-btn:hover{background:transparent}.netless-app-slide-readonly .netless-app-slide-page-number-input{cursor:not-allowed}.netless-app-slide-readonly .netless-app-slide-page-number-input:hover,.netless-app-slide-readonly .netless-app-slide-page-number-input:focus,.netless-app-slide-readonly .netless-app-slide-page-number-input:active{background:transparent;box-shadow:none}.netless-app-slide-readonly .netless-app-slide-page-number-input:disabled{color:inherit}.netless-app-slide-readonly.netless-app-slide-float-footer{display:none}.netless-app-slide-wb-view{position:absolute;top:0;left:0;width:100%;height:100%;z-index:100;overflow:hidden}.netless-app-slide-slide{width:100%;height:100%;display:flex;align-items:center;justify-content:center}.netless-app-slide-slide canvas{transform:scale(var(--netless-app-slide-scale, 1))}
6079
+ `;function X_({container:N,taskId:w,url:S=xg,debug:W=!1}){if(!w)throw new Error("[Slide] taskId is required");N.style.cssText+="display:flex;flex-direction:column";const pt=new kv({target:N});return pt.debug=!!W,pt.mount(w,S),pt}class kv{constructor(w){this.slide=null,this.debug=!1,this.sideEffect=new cm,this.ready=!1,this.readyPromise=new Promise(S=>{this.resolveReady=()=>{this.ready=!0,S()}}),this.onPageChanged=S=>{this.viewer.setPageIndex(S-1)},this.onTransitionStart=()=>{this.viewer.setPlaying()},this.onTransitionEnd=()=>{this.viewer.setPaused()},this.onError=({error:S})=>{this.viewer.setPaused(),console.warn("[Slide] render error",S)},this.destroyed=!1,this.refreshPages=()=>{this.slide&&(this.viewer.pages=iv(this.slide),this.viewer.setPageIndex(this.getPageIndex(this.slide.slideState.currentSlideIndex)))},this.onPlay=()=>{this.slide&&this.slide.nextStep()},this.onNewPageIndex=S=>{this.slide&&this.slide.slideCount>0&&this.slide.renderSlide(Zg(S+1,1,this.slide.slideCount))},this.namespace="netless-app-slide",this.target=w.target,this.bgColor=rv(this.target),this.viewer=new Nv({readonly:!1,onNewPageIndex:this.onNewPageIndex,onPlay:this.onPlay}),this.render()}render(){this.viewer.$content.appendChild(this.renderSlideContainer()),this.sideEffect.addEventListener(window,"keydown",w=>{if(this.slide)switch(w.key){case"ArrowUp":case"ArrowLeft":{this.slide.prevStep();break}case"ArrowRight":case"ArrowDown":{this.slide.nextStep();break}}})}mount(w,S){this.target.appendChild(this.renderStyle()),this.target.appendChild(this.viewer.$content),this.target.appendChild(this.viewer.$footer),this.slide=new bo.Slide({anchor:this.$slide,interactive:!1,mode:"local",resize:!0,controller:this.debug,renderOptions:{minFPS:25,maxFPS:30,autoFPS:!0,autoResolution:!0,transactionBgColor:this.bgColor}}),this.registerEventListeners(),this.slide.setResource(w,S),this.slide.renderSlide(1)}renderStyle(){const w=document.createElement("style");return w.appendChild(document.createTextNode(Bv)),w}registerEventListeners(){if(!this.slide)return;const{slide:w}=this;w.on(bo.SLIDE_EVENTS.slideChange,this.onPageChanged),w.on(bo.SLIDE_EVENTS.renderStart,this.onTransitionStart),w.on(bo.SLIDE_EVENTS.renderEnd,this.onTransitionEnd),w.on(bo.SLIDE_EVENTS.mainSeqStepStart,this.onTransitionStart),w.on(bo.SLIDE_EVENTS.mainSeqStepEnd,this.onTransitionEnd),w.on(bo.SLIDE_EVENTS.renderError,this.onError),w.on(bo.SLIDE_EVENTS.renderEnd,this.resolveReady),this.readyPromise.then(this.refreshPages)}destroy(){this.sideEffect.flushAll(),this.slide&&!this.destroyed&&(es("[Slide] destroy slide (once)"),this.slide.destroy(),this.destroyed=!0),this.viewer.destroy()}getPageIndex(w){return(w>0?w:1)-1}renderSlideContainer(){if(!this.$slide){const w=document.createElement("div");w.className=this.wrapClassName("slide"),w.dataset.appKind="Slide",this.$slide=w}return this.$slide}wrapClassName(w){return`${this.namespace}-${w}`}}const q_={kind:"Slide",setup(N){N.getIsWritable()&&b0(N,bg);const w=N.getAttributes();if(!(w==null?void 0:w.taskId))throw new Error("[Slide] no taskId");const S=N.getView();if(!S)throw new Error("[Slide] no view, please set scenePath on addApp()");S.disableCameraTransform=!0;const W=N.getBox();W.mountStyles(Bv);const pt=N.getInitScenePath();let lt=null;const J=$=>{const ut=N.getRoom();if(lt&&lt.slideController){let kt=!1;ut&&N.getIsWritable()&&(I0(ut,N,lt.slideController.slide,pt),kt=!0),es("[Slide] page to",$,kt),lt.viewer.setPageIndex($-1)}},X=$=>{var kt,Gt;const ut=new O0(Xg(dp({context:N},$),{onPageChanged:J}));return eg.set(N.appId,ut),((kt=$u.apps)[Gt=N.appId]||(kt[Gt]={})).controller=ut,ut.readyPromise.then($.onReady),ut};lt=new V_({box:W,view:S,mountSlideController:X,mountWhiteboard:N.mountView.bind(N)});const ct=N.getRoom(),tt=new cm;tt.add(()=>{var $,ut,kt;return(($=$u.apps)[ut=N.appId]||($[ut]={})).context=N,$u.enable=((kt=N.getAppOptions())==null?void 0:kt.debug)||!1,$u.level="debug",()=>$u.dispose(N.appId)}),ct&&(lt.toggleClickThrough(ct.state.memberState.currentApplianceName),tt.add(()=>{const $=ut=>{ut.memberState&&lt&&lt.toggleClickThrough(ut.memberState.currentApplianceName)};return ct.callbacks.on("onRoomStateChanged",$),()=>ct.callbacks.off("onRoomStateChanged",$)})),N.emitter.on("destroy",()=>{es("[Slide]: destroy"),eg.delete(N.appId),tt.flushAll(),lt&&(lt.destroy(),lt=null)}),lt.mount()}};exports.DefaultUrl=xg;exports.FreezerLength=Fv;exports.SlidePreviewer=kv;exports.addHooks=W_;exports.apps=eg;exports.default=q_;exports.previewSlide=X_;
6080
6080
  //# sourceMappingURL=main.cjs.js.map