cheryglsljs 1.1.17 → 1.1.18

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/cherry.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see cherry.js.LICENSE.txt */
2
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Cherryglsl",[],e):"object"==typeof exports?exports.Cherryglsl=e():t.Cherryglsl=e()}(this,(()=>(()=>{"use strict";var t={d:(e,i)=>{for(var r in i)t.o(i,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:i[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{CherryWave:()=>To,ImageTransition1:()=>Ao,ImageTransition2:()=>Eo});const i=()=>new THREE.Scene,r=()=>new THREE.PerspectiveCamera(75,window.innerWidth/window.innerHeight,.1,1e3),s=()=>new THREE.WebGLRenderer({alpha:!0});function n(t=400,e=400){const n=i(),a=r(),o=s();return o.setSize(t,e),{Scene:n,camera:a,renderer:o}}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var h,u,l,c,d,p,m,f,y,g,x,_,v,b,w,M,T,S={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},z={duration:.5,overwrite:!1,delay:0},A=1e8,k=1e-8,C=2*Math.PI,E=C/4,O=0,I=Math.sqrt,P=Math.cos,R=Math.sin,B=function(t){return"string"==typeof t},F=function(t){return"function"==typeof t},V=function(t){return"number"==typeof t},N=function(t){return void 0===t},D=function(t){return"object"==typeof t},U=function(t){return!1!==t},L=function(){return"undefined"!=typeof window},q=function(t){return F(t)||B(t)},W="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},H=Array.isArray,j=/(?:-?\.?\d|\.)+/gi,X=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Y=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Z=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,J=/[+-]=-?[.\d]+/,G=/[^,'"\[\]\s]+/gi,Q=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,$={},K={},tt=function(t){return(K=Et(t,$))&&Oi},et=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},it=function(t,e){return!e&&console.warn(t)},rt=function(t,e){return t&&($[t]=e)&&K&&(K[t]=e)||$},st=function(){return 0},nt={suppressEvents:!0,isStart:!0,kill:!1},at={suppressEvents:!0,kill:!1},ot={suppressEvents:!0},ht={},ut=[],lt={},ct={},dt={},pt=30,mt=[],ft="",yt=function(t){var e,i,r=t[0];if(D(r)||F(r)||(t=[t]),!(e=(r._gsap||{}).harness)){for(i=mt.length;i--&&!mt[i].targetTest(r););e=mt[i]}for(i=t.length;i--;)t[i]&&(t[i]._gsap||(t[i]._gsap=new je(t[i],e)))||t.splice(i,1);return t},gt=function(t){return t._gsap||yt(he(t))[0]._gsap},xt=function(t,e,i){return(i=t[e])&&F(i)?t[e]():N(i)&&t.getAttribute&&t.getAttribute(e)||i},_t=function(t,e){return(t=t.split(",")).forEach(e)||t},vt=function(t){return Math.round(1e5*t)/1e5||0},bt=function(t){return Math.round(1e7*t)/1e7||0},wt=function(t,e){var i=e.charAt(0),r=parseFloat(e.substr(2));return t=parseFloat(t),"+"===i?t+r:"-"===i?t-r:"*"===i?t*r:t/r},Mt=function(t,e){for(var i=e.length,r=0;t.indexOf(e[r])<0&&++r<i;);return r<i},Tt=function(){var t,e,i=ut.length,r=ut.slice(0);for(lt={},ut.length=0,t=0;t<i;t++)(e=r[t])&&e._lazy&&(e.render(e._lazy[0],e._lazy[1],!0)._lazy=0)},St=function(t){return!!(t._initted||t._startAt||t.add)},zt=function(t,e,i,r){ut.length&&!u&&Tt(),t.render(e,i,r||!!(u&&e<0&&St(t))),ut.length&&!u&&Tt()},At=function(t){var e=parseFloat(t);return(e||0===e)&&(t+"").match(G).length<2?e:B(t)?t.trim():t},kt=function(t){return t},Ct=function(t,e){for(var i in e)i in t||(t[i]=e[i]);return t},Et=function(t,e){for(var i in e)t[i]=e[i];return t},Ot=function t(e,i){for(var r in i)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(e[r]=D(i[r])?t(e[r]||(e[r]={}),i[r]):i[r]);return e},It=function(t,e){var i,r={};for(i in t)i in e||(r[i]=t[i]);return r},Pt=function(t){var e,i=t.parent||c,r=t.keyframes?(e=H(t.keyframes),function(t,i){for(var r in i)r in t||"duration"===r&&e||"ease"===r||(t[r]=i[r])}):Ct;if(U(t.inherit))for(;i;)r(t,i.vars.defaults),i=i.parent||i._dp;return t},Rt=function(t,e,i,r,s){void 0===i&&(i="_first"),void 0===r&&(r="_last");var n,a=t[r];if(s)for(n=e[s];a&&a[s]>n;)a=a._prev;return a?(e._next=a._next,a._next=e):(e._next=t[i],t[i]=e),e._next?e._next._prev=e:t[r]=e,e._prev=a,e.parent=e._dp=t,e},Bt=function(t,e,i,r){void 0===i&&(i="_first"),void 0===r&&(r="_last");var s=e._prev,n=e._next;s?s._next=n:t[i]===e&&(t[i]=n),n?n._prev=s:t[r]===e&&(t[r]=s),e._next=e._prev=e.parent=null},Ft=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Vt=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var i=t;i;)i._dirty=1,i=i.parent;return t},Nt=function(t,e,i,r){return t._startAt&&(u?t._startAt.revert(at):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,r))},Dt=function t(e){return!e||e._ts&&t(e.parent)},Ut=function(t){return t._repeat?Lt(t._tTime,t=t.duration()+t._rDelay)*t:0},Lt=function(t,e){var i=Math.floor(t=bt(t/e));return t&&i===t?i-1:i},qt=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},Wt=function(t){return t._end=bt(t._start+(t._tDur/Math.abs(t._ts||t._rts||k)||0))},Ht=function(t,e){var i=t._dp;return i&&i.smoothChildTiming&&t._ts&&(t._start=bt(i._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Wt(t),i._dirty||Vt(i,t)),t},jt=function(t,e){var i;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(i=qt(t.rawTime(),e),(!e._dur||re(0,e.totalDuration(),i)-e._tTime>k)&&e.render(i,!0)),Vt(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(i=t;i._dp;)i.rawTime()>=0&&i.totalTime(i._tTime),i=i._dp;t._zTime=-1e-8}},Xt=function(t,e,i,r){return e.parent&&Ft(e),e._start=bt((V(i)?i:i||t!==c?te(t,i,e):t._time)+e._delay),e._end=bt(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),Rt(t,e,"_first","_last",t._sort?"_start":0),Gt(e)||(t._recent=e),r||jt(t,e),t._ts<0&&Ht(t,t._tTime),t},Yt=function(t,e){return($.ScrollTrigger||et("scrollTrigger",e))&&$.ScrollTrigger.create(e,t)},Zt=function(t,e,i,r,s){return Ke(t,e,s),t._initted?!i&&t._pt&&!u&&(t._dur&&!1!==t.vars.lazy||!t._dur&&t.vars.lazy)&&y!==Ie.frame?(ut.push(t),t._lazy=[s,r],1):void 0:1},Jt=function t(e){var i=e.parent;return i&&i._ts&&i._initted&&!i._lock&&(i.rawTime()<0||t(i))},Gt=function(t){var e=t.data;return"isFromStart"===e||"isStart"===e},Qt=function(t,e,i,r){var s=t._repeat,n=bt(e)||0,a=t._tTime/t._tDur;return a&&!r&&(t._time*=n/t._dur),t._dur=n,t._tDur=s?s<0?1e10:bt(n*(s+1)+t._rDelay*s):n,a>0&&!r&&Ht(t,t._tTime=t._tDur*a),t.parent&&Wt(t),i||Vt(t.parent,t),t},$t=function(t){return t instanceof Ye?Vt(t):Qt(t,t._dur)},Kt={_start:0,endTime:st,totalDuration:st},te=function t(e,i,r){var s,n,a,o=e.labels,h=e._recent||Kt,u=e.duration()>=A?h.endTime(!1):e._dur;return B(i)&&(isNaN(i)||i in o)?(n=i.charAt(0),a="%"===i.substr(-1),s=i.indexOf("="),"<"===n||">"===n?(s>=0&&(i=i.replace(/=/,"")),("<"===n?h._start:h.endTime(h._repeat>=0))+(parseFloat(i.substr(1))||0)*(a?(s<0?h:r).totalDuration()/100:1)):s<0?(i in o||(o[i]=u),o[i]):(n=parseFloat(i.charAt(s-1)+i.substr(s+1)),a&&r&&(n=n/100*(H(r)?r[0]:r).totalDuration()),s>1?t(e,i.substr(0,s-1),r)+n:u+n)):null==i?u:+i},ee=function(t,e,i){var r,s,n=V(e[1]),a=(n?2:1)+(t<2?0:1),o=e[a];if(n&&(o.duration=e[1]),o.parent=i,t){for(r=o,s=i;s&&!("immediateRender"in r);)r=s.vars.defaults||{},s=U(s.vars.inherit)&&s.parent;o.immediateRender=U(r.immediateRender),t<2?o.runBackwards=1:o.startAt=e[a-1]}return new si(e[0],o,e[a+1])},ie=function(t,e){return t||0===t?e(t):e},re=function(t,e,i){return i<t?t:i>e?e:i},se=function(t,e){return B(t)&&(e=Q.exec(t))?e[1]:""},ne=[].slice,ae=function(t,e){return t&&D(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&D(t[0]))&&!t.nodeType&&t!==d},oe=function(t,e,i){return void 0===i&&(i=[]),t.forEach((function(t){var r;return B(t)&&!e||ae(t,1)?(r=i).push.apply(r,he(t)):i.push(t)}))||i},he=function(t,e,i){return l&&!e&&l.selector?l.selector(t):!B(t)||i||!p&&Pe()?H(t)?oe(t,i):ae(t)?ne.call(t,0):t?[t]:[]:ne.call((e||m).querySelectorAll(t),0)},ue=function(t){return t=he(t)[0]||it("Invalid scope")||{},function(e){var i=t.current||t.nativeElement||t;return he(e,i.querySelectorAll?i:i===t?it("Invalid scope")||m.createElement("div"):t)}},le=function(t){return t.sort((function(){return.5-Math.random()}))},ce=function(t){if(F(t))return t;var e=D(t)?t:{each:t},i=Ue(e.ease),r=e.from||0,s=parseFloat(e.base)||0,n={},a=r>0&&r<1,o=isNaN(r)||a,h=e.axis,u=r,l=r;return B(r)?u=l={center:.5,edges:.5,end:1}[r]||0:!a&&o&&(u=r[0],l=r[1]),function(t,a,c){var d,p,m,f,y,g,x,_,v,b=(c||e).length,w=n[b];if(!w){if(!(v="auto"===e.grid?0:(e.grid||[1,A])[1])){for(x=-A;x<(x=c[v++].getBoundingClientRect().left)&&v<b;);v<b&&v--}for(w=n[b]=[],d=o?Math.min(v,b)*u-.5:r%v,p=v===A?0:o?b*l/v-.5:r/v|0,x=0,_=A,g=0;g<b;g++)m=g%v-d,f=p-(g/v|0),w[g]=y=h?Math.abs("y"===h?f:m):I(m*m+f*f),y>x&&(x=y),y<_&&(_=y);"random"===r&&le(w),w.max=x-_,w.min=_,w.v=b=(parseFloat(e.amount)||parseFloat(e.each)*(v>b?b-1:h?"y"===h?b/v:v:Math.max(v,b/v))||0)*("edges"===r?-1:1),w.b=b<0?s-b:s,w.u=se(e.amount||e.each)||0,i=i&&b<0?Ne(i):i}return b=(w[t]-w.min)/w.max||0,bt(w.b+(i?i(b):b)*w.v)+w.u}},de=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(i){var r=bt(Math.round(parseFloat(i)/t)*t*e);return(r-r%1)/e+(V(i)?0:se(i))}},pe=function(t,e){var i,r,s=H(t);return!s&&D(t)&&(i=s=t.radius||A,t.values?(t=he(t.values),(r=!V(t[0]))&&(i*=i)):t=de(t.increment)),ie(e,s?F(t)?function(e){return r=t(e),Math.abs(r-e)<=i?r:e}:function(e){for(var s,n,a=parseFloat(r?e.x:e),o=parseFloat(r?e.y:0),h=A,u=0,l=t.length;l--;)(s=r?(s=t[l].x-a)*s+(n=t[l].y-o)*n:Math.abs(t[l]-a))<h&&(h=s,u=l);return u=!i||h<=i?t[u]:e,r||u===e||V(e)?u:u+se(e)}:de(t))},me=function(t,e,i,r){return ie(H(t)?!e:!0===i?!!(i=0):!r,(function(){return H(t)?t[~~(Math.random()*t.length)]:(i=i||1e-5)&&(r=i<1?Math.pow(10,(i+"").length-2):1)&&Math.floor(Math.round((t-i/2+Math.random()*(e-t+.99*i))/i)*i*r)/r}))},fe=function(t,e,i){return ie(i,(function(i){return t[~~e(i)]}))},ye=function(t){for(var e,i,r,s,n=0,a="";~(e=t.indexOf("random(",n));)r=t.indexOf(")",e),s="["===t.charAt(e+7),i=t.substr(e+7,r-e-7).match(s?G:j),a+=t.substr(n,e-n)+me(s?i:+i[0],s?0:+i[1],+i[2]||1e-5),n=r+1;return a+t.substr(n,t.length-n)},ge=function(t,e,i,r,s){var n=e-t,a=r-i;return ie(s,(function(e){return i+((e-t)/n*a||0)}))},xe=function(t,e,i){var r,s,n,a=t.labels,o=A;for(r in a)(s=a[r]-e)<0==!!i&&s&&o>(s=Math.abs(s))&&(n=r,o=s);return n},_e=function(t,e,i){var r,s,n,a=t.vars,o=a[e],h=l,u=t._ctx;if(o)return r=a[e+"Params"],s=a.callbackScope||t,i&&ut.length&&Tt(),u&&(l=u),n=r?o.apply(s,r):o.call(s),l=h,n},ve=function(t){return Ft(t),t.scrollTrigger&&t.scrollTrigger.kill(!!u),t.progress()<1&&_e(t,"onInterrupt"),t},be=[],we=function(t){if(t)if(t=!t.name&&t.default||t,L()||t.headless){var e=t.name,i=F(t),r=e&&!i&&t.init?function(){this._props=[]}:t,s={init:st,render:pi,add:Qe,kill:fi,modifier:mi,rawVars:0},n={targetTest:0,get:0,getSetter:ui,aliases:{},register:0};if(Pe(),t!==r){if(ct[e])return;Ct(r,Ct(It(t,s),n)),Et(r.prototype,Et(s,It(t,n))),ct[r.prop=e]=r,t.targetTest&&(mt.push(r),ht[e]=1),e=("css"===e?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}rt(e,r),t.register&&t.register(Oi,r,xi)}else be.push(t)},Me=255,Te={aqua:[0,Me,Me],lime:[0,Me,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Me],navy:[0,0,128],white:[Me,Me,Me],olive:[128,128,0],yellow:[Me,Me,0],orange:[Me,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Me,0,0],pink:[Me,192,203],cyan:[0,Me,Me],transparent:[Me,Me,Me,0]},Se=function(t,e,i){return(6*(t+=t<0?1:t>1?-1:0)<1?e+(i-e)*t*6:t<.5?i:3*t<2?e+(i-e)*(2/3-t)*6:e)*Me+.5|0},ze=function(t,e,i){var r,s,n,a,o,h,u,l,c,d,p=t?V(t)?[t>>16,t>>8&Me,t&Me]:0:Te.black;if(!p){if(","===t.substr(-1)&&(t=t.substr(0,t.length-1)),Te[t])p=Te[t];else if("#"===t.charAt(0)){if(t.length<6&&(r=t.charAt(1),s=t.charAt(2),n=t.charAt(3),t="#"+r+r+s+s+n+n+(5===t.length?t.charAt(4)+t.charAt(4):"")),9===t.length)return[(p=parseInt(t.substr(1,6),16))>>16,p>>8&Me,p&Me,parseInt(t.substr(7),16)/255];p=[(t=parseInt(t.substr(1),16))>>16,t>>8&Me,t&Me]}else if("hsl"===t.substr(0,3))if(p=d=t.match(j),e){if(~t.indexOf("="))return p=t.match(X),i&&p.length<4&&(p[3]=1),p}else a=+p[0]%360/360,o=+p[1]/100,r=2*(h=+p[2]/100)-(s=h<=.5?h*(o+1):h+o-h*o),p.length>3&&(p[3]*=1),p[0]=Se(a+1/3,r,s),p[1]=Se(a,r,s),p[2]=Se(a-1/3,r,s);else p=t.match(j)||Te.transparent;p=p.map(Number)}return e&&!d&&(r=p[0]/Me,s=p[1]/Me,n=p[2]/Me,h=((u=Math.max(r,s,n))+(l=Math.min(r,s,n)))/2,u===l?a=o=0:(c=u-l,o=h>.5?c/(2-u-l):c/(u+l),a=u===r?(s-n)/c+(s<n?6:0):u===s?(n-r)/c+2:(r-s)/c+4,a*=60),p[0]=~~(a+.5),p[1]=~~(100*o+.5),p[2]=~~(100*h+.5)),i&&p.length<4&&(p[3]=1),p},Ae=function(t){var e=[],i=[],r=-1;return t.split(Ce).forEach((function(t){var s=t.match(Y)||[];e.push.apply(e,s),i.push(r+=s.length+1)})),e.c=i,e},ke=function(t,e,i){var r,s,n,a,o="",h=(t+o).match(Ce),u=e?"hsla(":"rgba(",l=0;if(!h)return t;if(h=h.map((function(t){return(t=ze(t,e,1))&&u+(e?t[0]+","+t[1]+"%,"+t[2]+"%,"+t[3]:t.join(","))+")"})),i&&(n=Ae(t),(r=i.c).join(o)!==n.c.join(o)))for(a=(s=t.replace(Ce,"1").split(Y)).length-1;l<a;l++)o+=s[l]+(~r.indexOf(l)?h.shift()||u+"0,0,0,0)":(n.length?n:h.length?h:i).shift());if(!s)for(a=(s=t.split(Ce)).length-1;l<a;l++)o+=s[l]+h[l];return o+s[a]},Ce=function(){var t,e="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(t in Te)e+="|"+t+"\\b";return new RegExp(e+")","gi")}(),Ee=/hsl[a]?\(/,Oe=function(t){var e,i=t.join(" ");if(Ce.lastIndex=0,Ce.test(i))return e=Ee.test(i),t[1]=ke(t[1],e),t[0]=ke(t[0],e,Ae(t[1])),!0},Ie=function(){var t,e,i,r,s,n,a=Date.now,o=500,h=33,u=a(),l=u,c=1e3/240,y=c,g=[],_=function i(d){var p,m,f,x,_=a()-l,v=!0===d;if((_>o||_<0)&&(u+=_-h),((p=(f=(l+=_)-u)-y)>0||v)&&(x=++r.frame,s=f-1e3*r.time,r.time=f/=1e3,y+=p+(p>=c?4:c-p),m=1),v||(t=e(i)),m)for(n=0;n<g.length;n++)g[n](f,s,x,d)};return r={time:0,frame:0,tick:function(){_(!0)},deltaRatio:function(t){return s/(1e3/(t||60))},wake:function(){f&&(!p&&L()&&(d=p=window,m=d.document||{},$.gsap=Oi,(d.gsapVersions||(d.gsapVersions=[])).push(Oi.version),tt(K||d.GreenSockGlobals||!d.gsap&&d||{}),be.forEach(we)),i="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame,t&&r.sleep(),e=i||function(t){return setTimeout(t,y-1e3*r.time+1|0)},x=1,_(2))},sleep:function(){(i?cancelAnimationFrame:clearTimeout)(t),x=0,e=st},lagSmoothing:function(t,e){o=t||1/0,h=Math.min(e||33,o)},fps:function(t){c=1e3/(t||240),y=1e3*r.time+c},add:function(t,e,i){var s=e?function(e,i,n,a){t(e,i,n,a),r.remove(s)}:t;return r.remove(t),g[i?"unshift":"push"](s),Pe(),s},remove:function(t,e){~(e=g.indexOf(t))&&g.splice(e,1)&&n>=e&&n--},_listeners:g}}(),Pe=function(){return!x&&Ie.wake()},Re={},Be=/^[\d.\-M][\d.\-,\s]/,Fe=/["']/g,Ve=function(t){for(var e,i,r,s={},n=t.substr(1,t.length-3).split(":"),a=n[0],o=1,h=n.length;o<h;o++)i=n[o],e=o!==h-1?i.lastIndexOf(","):i.length,r=i.substr(0,e),s[a]=isNaN(r)?r.replace(Fe,"").trim():+r,a=i.substr(e+1).trim();return s},Ne=function(t){return function(e){return 1-t(1-e)}},De=function t(e,i){for(var r,s=e._first;s;)s instanceof Ye?t(s,i):!s.vars.yoyoEase||s._yoyo&&s._repeat||s._yoyo===i||(s.timeline?t(s.timeline,i):(r=s._ease,s._ease=s._yEase,s._yEase=r,s._yoyo=i)),s=s._next},Ue=function(t,e){return t&&(F(t)?t:Re[t]||function(t){var e,i,r,s,n=(t+"").split("("),a=Re[n[0]];return a&&n.length>1&&a.config?a.config.apply(null,~t.indexOf("{")?[Ve(n[1])]:(e=t,i=e.indexOf("(")+1,r=e.indexOf(")"),s=e.indexOf("(",i),e.substring(i,~s&&s<r?e.indexOf(")",r+1):r)).split(",").map(At)):Re._CE&&Be.test(t)?Re._CE("",t):a}(t))||e},Le=function(t,e,i,r){void 0===i&&(i=function(t){return 1-e(1-t)}),void 0===r&&(r=function(t){return t<.5?e(2*t)/2:1-e(2*(1-t))/2});var s,n={easeIn:e,easeOut:i,easeInOut:r};return _t(t,(function(t){for(var e in Re[t]=$[t]=n,Re[s=t.toLowerCase()]=i,n)Re[s+("easeIn"===e?".in":"easeOut"===e?".out":".inOut")]=Re[t+"."+e]=n[e]})),n},qe=function(t){return function(e){return e<.5?(1-t(1-2*e))/2:.5+t(2*(e-.5))/2}},We=function t(e,i,r){var s=i>=1?i:1,n=(r||(e?.3:.45))/(i<1?i:1),a=n/C*(Math.asin(1/s)||0),o=function(t){return 1===t?1:s*Math.pow(2,-10*t)*R((t-a)*n)+1},h="out"===e?o:"in"===e?function(t){return 1-o(1-t)}:qe(o);return n=C/n,h.config=function(i,r){return t(e,i,r)},h},He=function t(e,i){void 0===i&&(i=1.70158);var r=function(t){return t?--t*t*((i+1)*t+i)+1:0},s="out"===e?r:"in"===e?function(t){return 1-r(1-t)}:qe(r);return s.config=function(i){return t(e,i)},s};_t("Linear,Quad,Cubic,Quart,Quint,Strong",(function(t,e){var i=e<5?e+1:e;Le(t+",Power"+(i-1),e?function(t){return Math.pow(t,i)}:function(t){return t},(function(t){return 1-Math.pow(1-t,i)}),(function(t){return t<.5?Math.pow(2*t,i)/2:1-Math.pow(2*(1-t),i)/2}))})),Re.Linear.easeNone=Re.none=Re.Linear.easeIn,Le("Elastic",We("in"),We("out"),We()),_=7.5625,w=2*(b=1/(v=2.75)),M=2.5*b,Le("Bounce",(function(t){return 1-T(1-t)}),T=function(t){return t<b?_*t*t:t<w?_*Math.pow(t-1.5/v,2)+.75:t<M?_*(t-=2.25/v)*t+.9375:_*Math.pow(t-2.625/v,2)+.984375}),Le("Expo",(function(t){return Math.pow(2,10*(t-1))*t+t*t*t*t*t*t*(1-t)})),Le("Circ",(function(t){return-(I(1-t*t)-1)})),Le("Sine",(function(t){return 1===t?1:1-P(t*E)})),Le("Back",He("in"),He("out"),He()),Re.SteppedEase=Re.steps=$.SteppedEase={config:function(t,e){void 0===t&&(t=1);var i=1/t,r=t+(e?0:1),s=e?1:0;return function(t){return((r*re(0,.99999999,t)|0)+s)*i}}},z.ease=Re["quad.out"],_t("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(t){return ft+=t+","+t+"Params,"}));var je=function(t,e){this.id=O++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:xt,this.set=e?e.getSetter:ui},Xe=function(){function t(t){this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,Qt(this,+t.duration,1,1),this.data=t.data,l&&(this._ctx=l,l.data.push(this)),x||Ie.wake()}var e=t.prototype;return e.delay=function(t){return t||0===t?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+t-this._delay),this._delay=t,this):this._delay},e.duration=function(t){return arguments.length?this.totalDuration(this._repeat>0?t+(t+this._rDelay)*this._repeat:t):this.totalDuration()&&this._dur},e.totalDuration=function(t){return arguments.length?(this._dirty=0,Qt(this,this._repeat<0?t:(t-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(t,e){if(Pe(),!arguments.length)return this._tTime;var i=this._dp;if(i&&i.smoothChildTiming&&this._ts){for(Ht(this,t),!i._dp||i.parent||jt(i,this);i&&i.parent;)i.parent._time!==i._start+(i._ts>=0?i._tTime/i._ts:(i.totalDuration()-i._tTime)/-i._ts)&&i.totalTime(i._tTime,!0),i=i.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&t<this._tDur||this._ts<0&&t>0||!this._tDur&&!t)&&Xt(this._dp,this,this._start-this._delay)}return(this._tTime!==t||!this._dur&&!e||this._initted&&Math.abs(this._zTime)===k||!t&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=t),zt(this,t,e)),this},e.time=function(t,e){return arguments.length?this.totalTime(Math.min(this.totalDuration(),t+Ut(this))%(this._dur+this._rDelay)||(t?this._dur:0),e):this._time},e.totalProgress=function(t,e){return arguments.length?this.totalTime(this.totalDuration()*t,e):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},e.progress=function(t,e){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?t:1-t)+Ut(this),e):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(t,e){var i=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(t-1)*i,e):this._repeat?Lt(this._tTime,i)+1:1},e.timeScale=function(t,e){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===t)return this;var i=this.parent&&this._ts?qt(this.parent._time,this):this._tTime;return this._rts=+t||0,this._ts=this._ps||-1e-8===t?0:this._rts,this.totalTime(re(-Math.abs(this._delay),this.totalDuration(),i),!1!==e),Wt(this),function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t}(this)},e.paused=function(t){return arguments.length?(this._ps!==t&&(this._ps=t,t?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Pe(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==k&&(this._tTime-=k)))),this):this._ps},e.startTime=function(t){if(arguments.length){this._start=t;var e=this.parent||this._dp;return e&&(e._sort||!this.parent)&&Xt(e,this,t-this._delay),this}return this._start},e.endTime=function(t){return this._start+(U(t)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(t){var e=this.parent||this._dp;return e?t&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?qt(e.rawTime(t),this):this._tTime:this._tTime},e.revert=function(t){void 0===t&&(t=ot);var e=u;return u=t,St(this)&&(this.timeline&&this.timeline.revert(t),this.totalTime(-.01,t.suppressEvents)),"nested"!==this.data&&!1!==t.kill&&this.kill(),u=e,this},e.globalTime=function(t){for(var e=this,i=arguments.length?t:e.rawTime();e;)i=e._start+i/(Math.abs(e._ts)||1),e=e._dp;return!this.parent&&this._sat?this._sat.globalTime(t):i},e.repeat=function(t){return arguments.length?(this._repeat=t===1/0?-2:t,$t(this)):-2===this._repeat?1/0:this._repeat},e.repeatDelay=function(t){if(arguments.length){var e=this._time;return this._rDelay=t,$t(this),e?this.time(e):this}return this._rDelay},e.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},e.seek=function(t,e){return this.totalTime(te(this,t),U(e))},e.restart=function(t,e){return this.play().totalTime(t?-this._delay:0,U(e)),this._dur||(this._zTime=-1e-8),this},e.play=function(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},e.reverse=function(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},e.pause=function(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(t){return arguments.length?(!!t!==this.reversed()&&this.timeScale(-this._rts||(t?-1e-8:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},e.isActive=function(){var t,e=this.parent||this._dp,i=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(t=e.rawTime(!0))>=i&&t<this.endTime(!0)-k))},e.eventCallback=function(t,e,i){var r=this.vars;return arguments.length>1?(e?(r[t]=e,i&&(r[t+"Params"]=i),"onUpdate"===t&&(this._onUpdate=e)):delete r[t],this):r[t]},e.then=function(t){var e=this;return new Promise((function(i){var r=F(t)?t:kt,s=function(){var t=e.then;e.then=null,F(r)&&(r=r(e))&&(r.then||r===e)&&(e.then=t),i(r),e.then=t};e._initted&&1===e.totalProgress()&&e._ts>=0||!e._tTime&&e._ts<0?s():e._prom=s}))},e.kill=function(){ve(this)},t}();Ct(Xe.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-1e-8,_prom:0,_ps:!1,_rts:1});var Ye=function(t){function e(e,i){var r;return void 0===e&&(e={}),(r=t.call(this,e)||this).labels={},r.smoothChildTiming=!!e.smoothChildTiming,r.autoRemoveChildren=!!e.autoRemoveChildren,r._sort=U(e.sortChildren),c&&Xt(e.parent||c,a(r),i),e.reversed&&r.reverse(),e.paused&&r.paused(!0),e.scrollTrigger&&Yt(a(r),e.scrollTrigger),r}o(e,t);var i=e.prototype;return i.to=function(t,e,i){return ee(0,arguments,this),this},i.from=function(t,e,i){return ee(1,arguments,this),this},i.fromTo=function(t,e,i,r){return ee(2,arguments,this),this},i.set=function(t,e,i){return e.duration=0,e.parent=this,Pt(e).repeatDelay||(e.repeat=0),e.immediateRender=!!e.immediateRender,new si(t,e,te(this,i),1),this},i.call=function(t,e,i){return Xt(this,si.delayedCall(0,t,e),i)},i.staggerTo=function(t,e,i,r,s,n,a){return i.duration=e,i.stagger=i.stagger||r,i.onComplete=n,i.onCompleteParams=a,i.parent=this,new si(t,i,te(this,s)),this},i.staggerFrom=function(t,e,i,r,s,n,a){return i.runBackwards=1,Pt(i).immediateRender=U(i.immediateRender),this.staggerTo(t,e,i,r,s,n,a)},i.staggerFromTo=function(t,e,i,r,s,n,a,o){return r.startAt=i,Pt(r).immediateRender=U(r.immediateRender),this.staggerTo(t,e,r,s,n,a,o)},i.render=function(t,e,i){var r,s,n,a,o,h,l,d,p,m,f,y,g=this._time,x=this._dirty?this.totalDuration():this._tDur,_=this._dur,v=t<=0?0:bt(t),b=this._zTime<0!=t<0&&(this._initted||!_);if(this!==c&&v>x&&t>=0&&(v=x),v!==this._tTime||i||b){if(g!==this._time&&_&&(v+=this._time-g,t+=this._time-g),r=v,p=this._start,h=!(d=this._ts),b&&(_||(g=this._zTime),(t||!e)&&(this._zTime=t)),this._repeat){if(f=this._yoyo,o=_+this._rDelay,this._repeat<-1&&t<0)return this.totalTime(100*o+t,e,i);if(r=bt(v%o),v===x?(a=this._repeat,r=_):((a=~~(m=bt(v/o)))&&a===m&&(r=_,a--),r>_&&(r=_)),m=Lt(this._tTime,o),!g&&this._tTime&&m!==a&&this._tTime-m*o-this._dur<=0&&(m=a),f&&1&a&&(r=_-r,y=1),a!==m&&!this._lock){var w=f&&1&m,M=w===(f&&1&a);if(a<m&&(w=!w),g=w?0:v%_?_:v,this._lock=1,this.render(g||(y?0:bt(a*o)),e,!_)._lock=0,this._tTime=v,!e&&this.parent&&_e(this,"onRepeat"),this.vars.repeatRefresh&&!y&&(this.invalidate()._lock=1),g&&g!==this._time||h!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(_=this._dur,x=this._tDur,M&&(this._lock=2,g=w?_:-1e-4,this.render(g,!0),this.vars.repeatRefresh&&!y&&this.invalidate()),this._lock=0,!this._ts&&!h)return this;De(this,y)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(l=function(t,e,i){var r;if(i>e)for(r=t._first;r&&r._start<=i;){if("isPause"===r.data&&r._start>e)return r;r=r._next}else for(r=t._last;r&&r._start>=i;){if("isPause"===r.data&&r._start<e)return r;r=r._prev}}(this,bt(g),bt(r)),l&&(v-=r-(r=l._start))),this._tTime=v,this._time=r,this._act=!d,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=t,g=0),!g&&v&&!e&&!m&&(_e(this,"onStart"),this._tTime!==v))return this;if(r>=g&&t>=0)for(s=this._first;s;){if(n=s._next,(s._act||r>=s._start)&&s._ts&&l!==s){if(s.parent!==this)return this.render(t,e,i);if(s.render(s._ts>0?(r-s._start)*s._ts:(s._dirty?s.totalDuration():s._tDur)+(r-s._start)*s._ts,e,i),r!==this._time||!this._ts&&!h){l=0,n&&(v+=this._zTime=-1e-8);break}}s=n}else{s=this._last;for(var T=t<0?t:r;s;){if(n=s._prev,(s._act||T<=s._end)&&s._ts&&l!==s){if(s.parent!==this)return this.render(t,e,i);if(s.render(s._ts>0?(T-s._start)*s._ts:(s._dirty?s.totalDuration():s._tDur)+(T-s._start)*s._ts,e,i||u&&St(s)),r!==this._time||!this._ts&&!h){l=0,n&&(v+=this._zTime=T?-1e-8:k);break}}s=n}}if(l&&!e&&(this.pause(),l.render(r>=g?0:-1e-8)._zTime=r>=g?1:-1,this._ts))return this._start=p,Wt(this),this.render(t,e,i);this._onUpdate&&!e&&_e(this,"onUpdate",!0),(v===x&&this._tTime>=this.totalDuration()||!v&&g)&&(p!==this._start&&Math.abs(d)===Math.abs(this._ts)||this._lock||((t||!_)&&(v===x&&this._ts>0||!v&&this._ts<0)&&Ft(this,1),e||t<0&&!g||!v&&!g&&x||(_e(this,v===x&&t>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(v<x&&this.timeScale()>0)&&this._prom())))}return this},i.add=function(t,e){var i=this;if(V(e)||(e=te(this,e,t)),!(t instanceof Xe)){if(H(t))return t.forEach((function(t){return i.add(t,e)})),this;if(B(t))return this.addLabel(t,e);if(!F(t))return this;t=si.delayedCall(0,t)}return this!==t?Xt(this,t,e):this},i.getChildren=function(t,e,i,r){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!0),void 0===r&&(r=-A);for(var s=[],n=this._first;n;)n._start>=r&&(n instanceof si?e&&s.push(n):(i&&s.push(n),t&&s.push.apply(s,n.getChildren(!0,e,i)))),n=n._next;return s},i.getById=function(t){for(var e=this.getChildren(1,1,1),i=e.length;i--;)if(e[i].vars.id===t)return e[i]},i.remove=function(t){return B(t)?this.removeLabel(t):F(t)?this.killTweensOf(t):(t.parent===this&&Bt(this,t),t===this._recent&&(this._recent=this._last),Vt(this))},i.totalTime=function(e,i){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=bt(Ie.time-(this._ts>0?e/this._ts:(this.totalDuration()-e)/-this._ts))),t.prototype.totalTime.call(this,e,i),this._forcing=0,this):this._tTime},i.addLabel=function(t,e){return this.labels[t]=te(this,e),this},i.removeLabel=function(t){return delete this.labels[t],this},i.addPause=function(t,e,i){var r=si.delayedCall(0,e||st,i);return r.data="isPause",this._hasPause=1,Xt(this,r,te(this,t))},i.removePause=function(t){var e=this._first;for(t=te(this,t);e;)e._start===t&&"isPause"===e.data&&Ft(e),e=e._next},i.killTweensOf=function(t,e,i){for(var r=this.getTweensOf(t,i),s=r.length;s--;)Ze!==r[s]&&r[s].kill(t,e);return this},i.getTweensOf=function(t,e){for(var i,r=[],s=he(t),n=this._first,a=V(e);n;)n instanceof si?Mt(n._targets,s)&&(a?(!Ze||n._initted&&n._ts)&&n.globalTime(0)<=e&&n.globalTime(n.totalDuration())>e:!e||n.isActive())&&r.push(n):(i=n.getTweensOf(s,e)).length&&r.push.apply(r,i),n=n._next;return r},i.tweenTo=function(t,e){e=e||{};var i,r=this,s=te(r,t),n=e,a=n.startAt,o=n.onStart,h=n.onStartParams,u=n.immediateRender,l=si.to(r,Ct({ease:e.ease||"none",lazy:!1,immediateRender:!1,time:s,overwrite:"auto",duration:e.duration||Math.abs((s-(a&&"time"in a?a.time:r._time))/r.timeScale())||k,onStart:function(){if(r.pause(),!i){var t=e.duration||Math.abs((s-(a&&"time"in a?a.time:r._time))/r.timeScale());l._dur!==t&&Qt(l,t,0,1).render(l._time,!0,!0),i=1}o&&o.apply(l,h||[])}},e));return u?l.render(0):l},i.tweenFromTo=function(t,e,i){return this.tweenTo(e,Ct({startAt:{time:te(this,t)}},i))},i.recent=function(){return this._recent},i.nextLabel=function(t){return void 0===t&&(t=this._time),xe(this,te(this,t))},i.previousLabel=function(t){return void 0===t&&(t=this._time),xe(this,te(this,t),1)},i.currentLabel=function(t){return arguments.length?this.seek(t,!0):this.previousLabel(this._time+k)},i.shiftChildren=function(t,e,i){void 0===i&&(i=0);for(var r,s=this._first,n=this.labels;s;)s._start>=i&&(s._start+=t,s._end+=t),s=s._next;if(e)for(r in n)n[r]>=i&&(n[r]+=t);return Vt(this)},i.invalidate=function(e){var i=this._first;for(this._lock=0;i;)i.invalidate(e),i=i._next;return t.prototype.invalidate.call(this,e)},i.clear=function(t){void 0===t&&(t=!0);for(var e,i=this._first;i;)e=i._next,this.remove(i),i=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),Vt(this)},i.totalDuration=function(t){var e,i,r,s=0,n=this,a=n._last,o=A;if(arguments.length)return n.timeScale((n._repeat<0?n.duration():n.totalDuration())/(n.reversed()?-t:t));if(n._dirty){for(r=n.parent;a;)e=a._prev,a._dirty&&a.totalDuration(),(i=a._start)>o&&n._sort&&a._ts&&!n._lock?(n._lock=1,Xt(n,a,i-a._delay,1)._lock=0):o=i,i<0&&a._ts&&(s-=i,(!r&&!n._dp||r&&r.smoothChildTiming)&&(n._start+=i/n._ts,n._time-=i,n._tTime-=i),n.shiftChildren(-i,!1,-Infinity),o=0),a._end>s&&a._ts&&(s=a._end),a=e;Qt(n,n===c&&n._time>s?n._time:s,1,1),n._dirty=0}return n._tDur},e.updateRoot=function(t){if(c._ts&&(zt(c,qt(t,c)),y=Ie.frame),Ie.frame>=pt){pt+=S.autoSleep||120;var e=c._first;if((!e||!e._ts)&&S.autoSleep&&Ie._listeners.length<2){for(;e&&!e._ts;)e=e._next;e||Ie.sleep()}}},e}(Xe);Ct(Ye.prototype,{_lock:0,_hasPause:0,_forcing:0});var Ze,Je,Ge=function(t,e,i,r,s,n,a){var o,h,u,l,c,d,p,m,f=new xi(this._pt,t,e,0,1,di,null,s),y=0,g=0;for(f.b=i,f.e=r,i+="",(p=~(r+="").indexOf("random("))&&(r=ye(r)),n&&(n(m=[i,r],t,e),i=m[0],r=m[1]),h=i.match(Z)||[];o=Z.exec(r);)l=o[0],c=r.substring(y,o.index),u?u=(u+1)%5:"rgba("===c.substr(-5)&&(u=1),l!==h[g++]&&(d=parseFloat(h[g-1])||0,f._pt={_next:f._pt,p:c||1===g?c:",",s:d,c:"="===l.charAt(1)?wt(d,l)-d:parseFloat(l)-d,m:u&&u<4?Math.round:0},y=Z.lastIndex);return f.c=y<r.length?r.substring(y,r.length):"",f.fp=a,(J.test(r)||p)&&(f.e=0),this._pt=f,f},Qe=function(t,e,i,r,s,n,a,o,h,u){F(r)&&(r=r(s||0,t,n));var l,c=t[e],d="get"!==i?i:F(c)?h?t[e.indexOf("set")||!F(t["get"+e.substr(3)])?e:"get"+e.substr(3)](h):t[e]():c,p=F(c)?h?oi:ai:ni;if(B(r)&&(~r.indexOf("random(")&&(r=ye(r)),"="===r.charAt(1)&&((l=wt(d,r)+(se(d)||0))||0===l)&&(r=l)),!u||d!==r||Je)return isNaN(d*r)||""===r?(!c&&!(e in t)&&et(e,r),Ge.call(this,t,e,d,r,p,o||S.stringFilter,h)):(l=new xi(this._pt,t,e,+d||0,r-(d||0),"boolean"==typeof c?ci:li,0,p),h&&(l.fp=h),a&&l.modifier(a,this,t),this._pt=l)},$e=function(t,e,i,r,s,n){var a,o,h,u;if(ct[t]&&!1!==(a=new ct[t]).init(s,a.rawVars?e[t]:function(t,e,i,r,s){if(F(t)&&(t=ei(t,s,e,i,r)),!D(t)||t.style&&t.nodeType||H(t)||W(t))return B(t)?ei(t,s,e,i,r):t;var n,a={};for(n in t)a[n]=ei(t[n],s,e,i,r);return a}(e[t],r,s,n,i),i,r,n)&&(i._pt=o=new xi(i._pt,s,t,0,1,a.render,a,0,a.priority),i!==g))for(h=i._ptLookup[i._targets.indexOf(s)],u=a._props.length;u--;)h[a._props[u]]=o;return a},Ke=function t(e,i,r){var s,n,a,o,l,d,p,m,f,y,g,x,_,v=e.vars,b=v.ease,w=v.startAt,M=v.immediateRender,T=v.lazy,S=v.onUpdate,C=v.runBackwards,E=v.yoyoEase,O=v.keyframes,I=v.autoRevert,P=e._dur,R=e._startAt,B=e._targets,F=e.parent,V=F&&"nested"===F.data?F.vars.targets:B,N="auto"===e._overwrite&&!h,D=e.timeline;if(D&&(!O||!b)&&(b="none"),e._ease=Ue(b,z.ease),e._yEase=E?Ne(Ue(!0===E?b:E,z.ease)):0,E&&e._yoyo&&!e._repeat&&(E=e._yEase,e._yEase=e._ease,e._ease=E),e._from=!D&&!!v.runBackwards,!D||O&&!v.stagger){if(x=(m=B[0]?gt(B[0]).harness:0)&&v[m.prop],s=It(v,ht),R&&(R._zTime<0&&R.progress(1),i<0&&C&&M&&!I?R.render(-1,!0):R.revert(C&&P?at:nt),R._lazy=0),w){if(Ft(e._startAt=si.set(B,Ct({data:"isStart",overwrite:!1,parent:F,immediateRender:!0,lazy:!R&&U(T),startAt:null,delay:0,onUpdate:S&&function(){return _e(e,"onUpdate")},stagger:0},w))),e._startAt._dp=0,e._startAt._sat=e,i<0&&(u||!M&&!I)&&e._startAt.revert(at),M&&P&&i<=0&&r<=0)return void(i&&(e._zTime=i))}else if(C&&P&&!R)if(i&&(M=!1),a=Ct({overwrite:!1,data:"isFromStart",lazy:M&&!R&&U(T),immediateRender:M,stagger:0,parent:F},s),x&&(a[m.prop]=x),Ft(e._startAt=si.set(B,a)),e._startAt._dp=0,e._startAt._sat=e,i<0&&(u?e._startAt.revert(at):e._startAt.render(-1,!0)),e._zTime=i,M){if(!i)return}else t(e._startAt,k,k);for(e._pt=e._ptCache=0,T=P&&U(T)||T&&!P,n=0;n<B.length;n++){if(p=(l=B[n])._gsap||yt(B)[n]._gsap,e._ptLookup[n]=y={},lt[p.id]&&ut.length&&Tt(),g=V===B?n:V.indexOf(l),m&&!1!==(f=new m).init(l,x||s,e,g,V)&&(e._pt=o=new xi(e._pt,l,f.name,0,1,f.render,f,0,f.priority),f._props.forEach((function(t){y[t]=o})),f.priority&&(d=1)),!m||x)for(a in s)ct[a]&&(f=$e(a,s,e,g,l,V))?f.priority&&(d=1):y[a]=o=Qe.call(e,l,a,"get",s[a],g,V,0,v.stringFilter);e._op&&e._op[n]&&e.kill(l,e._op[n]),N&&e._pt&&(Ze=e,c.killTweensOf(l,y,e.globalTime(i)),_=!e.parent,Ze=0),e._pt&&T&&(lt[p.id]=1)}d&&gi(e),e._onInit&&e._onInit(e)}e._onUpdate=S,e._initted=(!e._op||e._pt)&&!_,O&&i<=0&&D.render(A,!0,!0)},ti=function(t,e,i,r){var s,n,a=e.ease||r||"power1.inOut";if(H(e))n=i[t]||(i[t]=[]),e.forEach((function(t,i){return n.push({t:i/(e.length-1)*100,v:t,e:a})}));else for(s in e)n=i[s]||(i[s]=[]),"ease"===s||n.push({t:parseFloat(t),v:e[s],e:a})},ei=function(t,e,i,r,s){return F(t)?t.call(e,i,r,s):B(t)&&~t.indexOf("random(")?ye(t):t},ii=ft+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",ri={};_t(ii+",id,stagger,delay,duration,paused,scrollTrigger",(function(t){return ri[t]=1}));var si=function(t){function e(e,i,r,s){var n;"number"==typeof i&&(r.duration=i,i=r,r=null);var o,u,l,d,p,m,f,y,g=(n=t.call(this,s?i:Pt(i))||this).vars,x=g.duration,_=g.delay,v=g.immediateRender,b=g.stagger,w=g.overwrite,M=g.keyframes,T=g.defaults,z=g.scrollTrigger,A=g.yoyoEase,k=i.parent||c,C=(H(e)||W(e)?V(e[0]):"length"in i)?[e]:he(e);if(n._targets=C.length?yt(C):it("GSAP target "+e+" not found. https://gsap.com",!S.nullTargetWarn)||[],n._ptLookup=[],n._overwrite=w,M||b||q(x)||q(_)){if(i=n.vars,(o=n.timeline=new Ye({data:"nested",defaults:T||{},targets:k&&"nested"===k.data?k.vars.targets:C})).kill(),o.parent=o._dp=a(n),o._start=0,b||q(x)||q(_)){if(d=C.length,f=b&&ce(b),D(b))for(p in b)~ii.indexOf(p)&&(y||(y={}),y[p]=b[p]);for(u=0;u<d;u++)(l=It(i,ri)).stagger=0,A&&(l.yoyoEase=A),y&&Et(l,y),m=C[u],l.duration=+ei(x,a(n),u,m,C),l.delay=(+ei(_,a(n),u,m,C)||0)-n._delay,!b&&1===d&&l.delay&&(n._delay=_=l.delay,n._start+=_,l.delay=0),o.to(m,l,f?f(u,m,C):0),o._ease=Re.none;o.duration()?x=_=0:n.timeline=0}else if(M){Pt(Ct(o.vars.defaults,{ease:"none"})),o._ease=Ue(M.ease||i.ease||"none");var E,O,I,P=0;if(H(M))M.forEach((function(t){return o.to(C,t,">")})),o.duration();else{for(p in l={},M)"ease"===p||"easeEach"===p||ti(p,M[p],l,M.easeEach);for(p in l)for(E=l[p].sort((function(t,e){return t.t-e.t})),P=0,u=0;u<E.length;u++)(I={ease:(O=E[u]).e,duration:(O.t-(u?E[u-1].t:0))/100*x})[p]=O.v,o.to(C,I,P),P+=I.duration;o.duration()<x&&o.to({},{duration:x-o.duration()})}}x||n.duration(x=o.duration())}else n.timeline=0;return!0!==w||h||(Ze=a(n),c.killTweensOf(C),Ze=0),Xt(k,a(n),r),i.reversed&&n.reverse(),i.paused&&n.paused(!0),(v||!x&&!M&&n._start===bt(k._time)&&U(v)&&Dt(a(n))&&"nested"!==k.data)&&(n._tTime=-1e-8,n.render(Math.max(0,-_)||0)),z&&Yt(a(n),z),n}o(e,t);var i=e.prototype;return i.render=function(t,e,i){var r,s,n,a,o,h,l,c,d,p=this._time,m=this._tDur,f=this._dur,y=t<0,g=t>m-k&&!y?m:t<k?0:t;if(f){if(g!==this._tTime||!t||i||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==y||this._lazy){if(r=g,c=this.timeline,this._repeat){if(a=f+this._rDelay,this._repeat<-1&&y)return this.totalTime(100*a+t,e,i);if(r=bt(g%a),g===m?(n=this._repeat,r=f):(n=~~(o=bt(g/a)))&&n===o?(r=f,n--):r>f&&(r=f),(h=this._yoyo&&1&n)&&(d=this._yEase,r=f-r),o=Lt(this._tTime,a),r===p&&!i&&this._initted&&n===o)return this._tTime=g,this;n!==o&&(c&&this._yEase&&De(c,h),this.vars.repeatRefresh&&!h&&!this._lock&&r!==a&&this._initted&&(this._lock=i=1,this.render(bt(a*n),!0).invalidate()._lock=0))}if(!this._initted){if(Zt(this,y?t:r,i,e,g))return this._tTime=0,this;if(!(p===this._time||i&&this.vars.repeatRefresh&&n!==o))return this;if(f!==this._dur)return this.render(t,e,i)}if(this._tTime=g,this._time=r,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=l=(d||this._ease)(r/f),this._from&&(this.ratio=l=1-l),!p&&g&&!e&&!o&&(_e(this,"onStart"),this._tTime!==g))return this;for(s=this._pt;s;)s.r(l,s.d),s=s._next;c&&c.render(t<0?t:c._dur*c._ease(r/this._dur),e,i)||this._startAt&&(this._zTime=t),this._onUpdate&&!e&&(y&&Nt(this,t,0,i),_e(this,"onUpdate")),this._repeat&&n!==o&&this.vars.onRepeat&&!e&&this.parent&&_e(this,"onRepeat"),g!==this._tDur&&g||this._tTime!==g||(y&&!this._onUpdate&&Nt(this,t,0,!0),(t||!f)&&(g===this._tDur&&this._ts>0||!g&&this._ts<0)&&Ft(this,1),e||y&&!p||!(g||p||h)||(_e(this,g===m?"onComplete":"onReverseComplete",!0),this._prom&&!(g<m&&this.timeScale()>0)&&this._prom()))}}else!function(t,e,i,r){var s,n,a,o=t.ratio,h=e<0||!e&&(!t._start&&Jt(t)&&(t._initted||!Gt(t))||(t._ts<0||t._dp._ts<0)&&!Gt(t))?0:1,l=t._rDelay,c=0;if(l&&t._repeat&&(c=re(0,t._tDur,e),n=Lt(c,l),t._yoyo&&1&n&&(h=1-h),n!==Lt(t._tTime,l)&&(o=1-h,t.vars.repeatRefresh&&t._initted&&t.invalidate())),h!==o||u||r||t._zTime===k||!e&&t._zTime){if(!t._initted&&Zt(t,e,r,i,c))return;for(a=t._zTime,t._zTime=e||(i?k:0),i||(i=e&&!a),t.ratio=h,t._from&&(h=1-h),t._time=0,t._tTime=c,s=t._pt;s;)s.r(h,s.d),s=s._next;e<0&&Nt(t,e,0,!0),t._onUpdate&&!i&&_e(t,"onUpdate"),c&&t._repeat&&!i&&t.parent&&_e(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===h&&(h&&Ft(t,1),i||u||(_e(t,h?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)}(this,t,e,i);return this},i.targets=function(){return this._targets},i.invalidate=function(e){return(!e||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(e),t.prototype.invalidate.call(this,e)},i.resetTo=function(t,e,i,r,s){x||Ie.wake(),this._ts||this.play();var n=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Ke(this,n),function(t,e,i,r,s,n,a,o){var h,u,l,c,d=(t._pt&&t._ptCache||(t._ptCache={}))[e];if(!d)for(d=t._ptCache[e]=[],l=t._ptLookup,c=t._targets.length;c--;){if((h=l[c][e])&&h.d&&h.d._pt)for(h=h.d._pt;h&&h.p!==e&&h.fp!==e;)h=h._next;if(!h)return Je=1,t.vars[e]="+=0",Ke(t,a),Je=0,o?it(e+" not eligible for reset"):1;d.push(h)}for(c=d.length;c--;)(h=(u=d[c])._pt||u).s=!r&&0!==r||s?h.s+(r||0)+n*h.c:r,h.c=i-h.s,u.e&&(u.e=vt(i)+se(u.e)),u.b&&(u.b=h.s+se(u.b))}(this,t,e,i,r,this._ease(n/this._dur),n,s)?this.resetTo(t,e,i,r,1):(Ht(this,0),this.parent||Rt(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},i.kill=function(t,e){if(void 0===e&&(e="all"),!(t||e&&"all"!==e))return this._lazy=this._pt=0,this.parent?ve(this):this.scrollTrigger&&this.scrollTrigger.kill(!!u),this;if(this.timeline){var i=this.timeline.totalDuration();return this.timeline.killTweensOf(t,e,Ze&&!0!==Ze.vars.overwrite)._first||ve(this),this.parent&&i!==this.timeline.totalDuration()&&Qt(this,this._dur*this.timeline._tDur/i,0,1),this}var r,s,n,a,o,h,l,c=this._targets,d=t?he(t):c,p=this._ptLookup,m=this._pt;if((!e||"all"===e)&&function(t,e){for(var i=t.length,r=i===e.length;r&&i--&&t[i]===e[i];);return i<0}(c,d))return"all"===e&&(this._pt=0),ve(this);for(r=this._op=this._op||[],"all"!==e&&(B(e)&&(o={},_t(e,(function(t){return o[t]=1})),e=o),e=function(t,e){var i,r,s,n,a=t[0]?gt(t[0]).harness:0,o=a&&a.aliases;if(!o)return e;for(r in i=Et({},e),o)if(r in i)for(s=(n=o[r].split(",")).length;s--;)i[n[s]]=i[r];return i}(c,e)),l=c.length;l--;)if(~d.indexOf(c[l]))for(o in s=p[l],"all"===e?(r[l]=e,a=s,n={}):(n=r[l]=r[l]||{},a=e),a)(h=s&&s[o])&&("kill"in h.d&&!0!==h.d.kill(o)||Bt(this,h,"_pt"),delete s[o]),"all"!==n&&(n[o]=1);return this._initted&&!this._pt&&m&&ve(this),this},e.to=function(t,i){return new e(t,i,arguments[2])},e.from=function(t,e){return ee(1,arguments)},e.delayedCall=function(t,i,r,s){return new e(i,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:i,onReverseComplete:i,onCompleteParams:r,onReverseCompleteParams:r,callbackScope:s})},e.fromTo=function(t,e,i){return ee(2,arguments)},e.set=function(t,i){return i.duration=0,i.repeatDelay||(i.repeat=0),new e(t,i)},e.killTweensOf=function(t,e,i){return c.killTweensOf(t,e,i)},e}(Xe);Ct(si.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),_t("staggerTo,staggerFrom,staggerFromTo",(function(t){si[t]=function(){var e=new Ye,i=ne.call(arguments,0);return i.splice("staggerFromTo"===t?5:4,0,0),e[t].apply(e,i)}}));var ni=function(t,e,i){return t[e]=i},ai=function(t,e,i){return t[e](i)},oi=function(t,e,i,r){return t[e](r.fp,i)},hi=function(t,e,i){return t.setAttribute(e,i)},ui=function(t,e){return F(t[e])?ai:N(t[e])&&t.setAttribute?hi:ni},li=function(t,e){return e.set(e.t,e.p,Math.round(1e6*(e.s+e.c*t))/1e6,e)},ci=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},di=function(t,e){var i=e._pt,r="";if(!t&&e.b)r=e.b;else if(1===t&&e.e)r=e.e;else{for(;i;)r=i.p+(i.m?i.m(i.s+i.c*t):Math.round(1e4*(i.s+i.c*t))/1e4)+r,i=i._next;r+=e.c}e.set(e.t,e.p,r,e)},pi=function(t,e){for(var i=e._pt;i;)i.r(t,i.d),i=i._next},mi=function(t,e,i,r){for(var s,n=this._pt;n;)s=n._next,n.p===r&&n.modifier(t,e,i),n=s},fi=function(t){for(var e,i,r=this._pt;r;)i=r._next,r.p===t&&!r.op||r.op===t?Bt(this,r,"_pt"):r.dep||(e=1),r=i;return!e},yi=function(t,e,i,r){r.mSet(t,e,r.m.call(r.tween,i,r.mt),r)},gi=function(t){for(var e,i,r,s,n=t._pt;n;){for(e=n._next,i=r;i&&i.pr>n.pr;)i=i._next;(n._prev=i?i._prev:s)?n._prev._next=n:r=n,(n._next=i)?i._prev=n:s=n,n=e}t._pt=r},xi=function(){function t(t,e,i,r,s,n,a,o,h){this.t=e,this.s=r,this.c=s,this.p=i,this.r=n||li,this.d=a||this,this.set=o||ni,this.pr=h||0,this._next=t,t&&(t._prev=this)}return t.prototype.modifier=function(t,e,i){this.mSet=this.mSet||this.set,this.set=yi,this.m=t,this.mt=i,this.tween=e},t}();_t(ft+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(t){return ht[t]=1})),$.TweenMax=$.TweenLite=si,$.TimelineLite=$.TimelineMax=Ye,c=new Ye({sortChildren:!1,defaults:z,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),S.stringFilter=Oe;var _i=[],vi={},bi=[],wi=0,Mi=0,Ti=function(t){return(vi[t]||bi).map((function(t){return t()}))},Si=function(){var t=Date.now(),e=[];t-wi>2&&(Ti("matchMediaInit"),_i.forEach((function(t){var i,r,s,n,a=t.queries,o=t.conditions;for(r in a)(i=d.matchMedia(a[r]).matches)&&(s=1),i!==o[r]&&(o[r]=i,n=1);n&&(t.revert(),s&&e.push(t))})),Ti("matchMediaRevert"),e.forEach((function(t){return t.onMatch(t,(function(e){return t.add(null,e)}))})),wi=t,Ti("matchMedia"))},zi=function(){function t(t,e){this.selector=e&&ue(e),this.data=[],this._r=[],this.isReverted=!1,this.id=Mi++,t&&this.add(t)}var e=t.prototype;return e.add=function(t,e,i){F(t)&&(i=e,e=t,t=F);var r=this,s=function(){var t,s=l,n=r.selector;return s&&s!==r&&s.data.push(r),i&&(r.selector=ue(i)),l=r,t=e.apply(r,arguments),F(t)&&r._r.push(t),l=s,r.selector=n,r.isReverted=!1,t};return r.last=s,t===F?s(r,(function(t){return r.add(null,t)})):t?r[t]=s:s},e.ignore=function(t){var e=l;l=null,t(this),l=e},e.getTweens=function(){var e=[];return this.data.forEach((function(i){return i instanceof t?e.push.apply(e,i.getTweens()):i instanceof si&&!(i.parent&&"nested"===i.parent.data)&&e.push(i)})),e},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(t,e){var i=this;if(t?function(){for(var e,r=i.getTweens(),s=i.data.length;s--;)"isFlip"===(e=i.data[s]).data&&(e.revert(),e.getChildren(!0,!0,!1).forEach((function(t){return r.splice(r.indexOf(t),1)})));for(r.map((function(t){return{g:t._dur||t._delay||t._sat&&!t._sat.vars.immediateRender?t.globalTime(0):-1/0,t}})).sort((function(t,e){return e.g-t.g||-1/0})).forEach((function(e){return e.t.revert(t)})),s=i.data.length;s--;)(e=i.data[s])instanceof Ye?"nested"!==e.data&&(e.scrollTrigger&&e.scrollTrigger.revert(),e.kill()):!(e instanceof si)&&e.revert&&e.revert(t);i._r.forEach((function(e){return e(t,i)})),i.isReverted=!0}():this.data.forEach((function(t){return t.kill&&t.kill()})),this.clear(),e)for(var r=_i.length;r--;)_i[r].id===this.id&&_i.splice(r,1)},e.revert=function(t){this.kill(t||{})},t}(),Ai=function(){function t(t){this.contexts=[],this.scope=t,l&&l.data.push(this)}var e=t.prototype;return e.add=function(t,e,i){D(t)||(t={matches:t});var r,s,n,a=new zi(0,i||this.scope),o=a.conditions={};for(s in l&&!a.selector&&(a.selector=l.selector),this.contexts.push(a),e=a.add("onMatch",e),a.queries=t,t)"all"===s?n=1:(r=d.matchMedia(t[s]))&&(_i.indexOf(a)<0&&_i.push(a),(o[s]=r.matches)&&(n=1),r.addListener?r.addListener(Si):r.addEventListener("change",Si));return n&&e(a,(function(t){return a.add(null,t)})),this},e.revert=function(t){this.kill(t||{})},e.kill=function(t){this.contexts.forEach((function(e){return e.kill(t,!0)}))},t}(),ki={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];e.forEach((function(t){return we(t)}))},timeline:function(t){return new Ye(t)},getTweensOf:function(t,e){return c.getTweensOf(t,e)},getProperty:function(t,e,i,r){B(t)&&(t=he(t)[0]);var s=gt(t||{}).get,n=i?kt:At;return"native"===i&&(i=""),t?e?n((ct[e]&&ct[e].get||s)(t,e,i,r)):function(e,i,r){return n((ct[e]&&ct[e].get||s)(t,e,i,r))}:t},quickSetter:function(t,e,i){if((t=he(t)).length>1){var r=t.map((function(t){return Oi.quickSetter(t,e,i)})),s=r.length;return function(t){for(var e=s;e--;)r[e](t)}}t=t[0]||{};var n=ct[e],a=gt(t),o=a.harness&&(a.harness.aliases||{})[e]||e,h=n?function(e){var r=new n;g._pt=0,r.init(t,i?e+i:e,g,0,[t]),r.render(1,r),g._pt&&pi(1,g)}:a.set(t,o);return n?h:function(e){return h(t,o,i?e+i:e,a,1)}},quickTo:function(t,e,i){var r,s=Oi.to(t,Ct(((r={})[e]="+=0.1",r.paused=!0,r.stagger=0,r),i||{})),n=function(t,i,r){return s.resetTo(e,t,i,r)};return n.tween=s,n},isTweening:function(t){return c.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=Ue(t.ease,z.ease)),Ot(z,t||{})},config:function(t){return Ot(S,t||{})},registerEffect:function(t){var e=t.name,i=t.effect,r=t.plugins,s=t.defaults,n=t.extendTimeline;(r||"").split(",").forEach((function(t){return t&&!ct[t]&&!$[t]&&it(e+" effect requires "+t+" plugin.")})),dt[e]=function(t,e,r){return i(he(t),Ct(e||{},s),r)},n&&(Ye.prototype[e]=function(t,i,r){return this.add(dt[e](t,D(i)?i:(r=i)&&{},this),r)})},registerEase:function(t,e){Re[t]=Ue(e)},parseEase:function(t,e){return arguments.length?Ue(t,e):Re},getById:function(t){return c.getById(t)},exportRoot:function(t,e){void 0===t&&(t={});var i,r,s=new Ye(t);for(s.smoothChildTiming=U(t.smoothChildTiming),c.remove(s),s._dp=0,s._time=s._tTime=c._time,i=c._first;i;)r=i._next,!e&&!i._dur&&i instanceof si&&i.vars.onComplete===i._targets[0]||Xt(s,i,i._start-i._delay),i=r;return Xt(c,s,0),s},context:function(t,e){return t?new zi(t,e):l},matchMedia:function(t){return new Ai(t)},matchMediaRefresh:function(){return _i.forEach((function(t){var e,i,r=t.conditions;for(i in r)r[i]&&(r[i]=!1,e=1);e&&t.revert()}))||Si()},addEventListener:function(t,e){var i=vi[t]||(vi[t]=[]);~i.indexOf(e)||i.push(e)},removeEventListener:function(t,e){var i=vi[t],r=i&&i.indexOf(e);r>=0&&i.splice(r,1)},utils:{wrap:function t(e,i,r){var s=i-e;return H(e)?fe(e,t(0,e.length),i):ie(r,(function(t){return(s+(t-e)%s)%s+e}))},wrapYoyo:function t(e,i,r){var s=i-e,n=2*s;return H(e)?fe(e,t(0,e.length-1),i):ie(r,(function(t){return e+((t=(n+(t-e)%n)%n||0)>s?n-t:t)}))},distribute:ce,random:me,snap:pe,normalize:function(t,e,i){return ge(t,e,0,1,i)},getUnit:se,clamp:function(t,e,i){return ie(i,(function(i){return re(t,e,i)}))},splitColor:ze,toArray:he,selector:ue,mapRange:ge,pipe:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];return function(t){return e.reduce((function(t,e){return e(t)}),t)}},unitize:function(t,e){return function(i){return t(parseFloat(i))+(e||se(i))}},interpolate:function t(e,i,r,s){var n=isNaN(e+i)?0:function(t){return(1-t)*e+t*i};if(!n){var a,o,h,u,l,c=B(e),d={};if(!0===r&&(s=1)&&(r=null),c)e={p:e},i={p:i};else if(H(e)&&!H(i)){for(h=[],u=e.length,l=u-2,o=1;o<u;o++)h.push(t(e[o-1],e[o]));u--,n=function(t){t*=u;var e=Math.min(l,~~t);return h[e](t-e)},r=i}else s||(e=Et(H(e)?[]:{},e));if(!h){for(a in i)Qe.call(d,e,a,"get",i[a]);n=function(t){return pi(t,d)||(c?e.p:e)}}}return ie(r,n)},shuffle:le},install:tt,effects:dt,ticker:Ie,updateRoot:Ye.updateRoot,plugins:ct,globalTimeline:c,core:{PropTween:xi,globals:rt,Tween:si,Timeline:Ye,Animation:Xe,getCache:gt,_removeLinkedListItem:Bt,reverting:function(){return u},context:function(t){return t&&l&&(l.data.push(t),t._ctx=l),l},suppressOverwrites:function(t){return h=t}}};_t("to,from,fromTo,delayedCall,set,killTweensOf",(function(t){return ki[t]=si[t]})),Ie.add(Ye.updateRoot),g=ki.to({},{duration:0});var Ci=function(t,e){for(var i=t._pt;i&&i.p!==e&&i.op!==e&&i.fp!==e;)i=i._next;return i},Ei=function(t,e){return{name:t,headless:1,rawVars:1,init:function(t,i,r){r._onInit=function(t){var r,s;if(B(i)&&(r={},_t(i,(function(t){return r[t]=1})),i=r),e){for(s in r={},i)r[s]=e(i[s]);i=r}!function(t,e){var i,r,s,n=t._targets;for(i in e)for(r=n.length;r--;)(s=t._ptLookup[r][i])&&(s=s.d)&&(s._pt&&(s=Ci(s,i)),s&&s.modifier&&s.modifier(e[i],t,n[r],i))}(t,i)}}}},Oi=ki.registerPlugin({name:"attr",init:function(t,e,i,r,s){var n,a,o;for(n in this.tween=i,e)o=t.getAttribute(n)||"",(a=this.add(t,"setAttribute",(o||0)+"",e[n],r,s,0,0,n)).op=n,a.b=o,this._props.push(n)},render:function(t,e){for(var i=e._pt;i;)u?i.set(i.t,i.p,i.b,i):i.r(t,i.d),i=i._next}},{name:"endArray",headless:1,init:function(t,e){for(var i=e.length;i--;)this.add(t,i,t[i]||0,e[i],0,0,0,0,0,1)}},Ei("roundProps",de),Ei("modifiers"),Ei("snap",pe))||ki;si.version=Ye.version=Oi.version="3.13.0",f=1,L()&&Pe();Re.Power0,Re.Power1,Re.Power2,Re.Power3,Re.Power4,Re.Linear,Re.Quad,Re.Cubic,Re.Quart,Re.Quint,Re.Strong,Re.Elastic,Re.Back,Re.SteppedEase,Re.Bounce,Re.Sine,Re.Expo,Re.Circ;var Ii,Pi,Ri,Bi,Fi,Vi,Ni,Di,Ui={},Li=180/Math.PI,qi=Math.PI/180,Wi=Math.atan2,Hi=/([A-Z])/g,ji=/(left|right|width|margin|padding|x)/i,Xi=/[\s,\(]\S/,Yi={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Zi=function(t,e){return e.set(e.t,e.p,Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},Ji=function(t,e){return e.set(e.t,e.p,1===t?e.e:Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},Gi=function(t,e){return e.set(e.t,e.p,t?Math.round(1e4*(e.s+e.c*t))/1e4+e.u:e.b,e)},Qi=function(t,e){var i=e.s+e.c*t;e.set(e.t,e.p,~~(i+(i<0?-.5:.5))+e.u,e)},$i=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Ki=function(t,e){return e.set(e.t,e.p,1!==t?e.b:e.e,e)},tr=function(t,e,i){return t.style[e]=i},er=function(t,e,i){return t.style.setProperty(e,i)},ir=function(t,e,i){return t._gsap[e]=i},rr=function(t,e,i){return t._gsap.scaleX=t._gsap.scaleY=i},sr=function(t,e,i,r,s){var n=t._gsap;n.scaleX=n.scaleY=i,n.renderTransform(s,n)},nr=function(t,e,i,r,s){var n=t._gsap;n[e]=i,n.renderTransform(s,n)},ar="transform",or=ar+"Origin",hr=function t(e,i){var r=this,s=this.target,n=s.style,a=s._gsap;if(e in Ui&&n){if(this.tfm=this.tfm||{},"transform"===e)return Yi.transform.split(",").forEach((function(e){return t.call(r,e,i)}));if(~(e=Yi[e]||e).indexOf(",")?e.split(",").forEach((function(t){return r.tfm[t]=zr(s,t)})):this.tfm[e]=a.x?a[e]:zr(s,e),e===or&&(this.tfm.zOrigin=a.zOrigin),this.props.indexOf(ar)>=0)return;a.svg&&(this.svgo=s.getAttribute("data-svg-origin"),this.props.push(or,i,"")),e=ar}(n||i)&&this.props.push(e,i,n[e])},ur=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},lr=function(){var t,e,i=this.props,r=this.target,s=r.style,n=r._gsap;for(t=0;t<i.length;t+=3)i[t+1]?2===i[t+1]?r[i[t]](i[t+2]):r[i[t]]=i[t+2]:i[t+2]?s[i[t]]=i[t+2]:s.removeProperty("--"===i[t].substr(0,2)?i[t]:i[t].replace(Hi,"-$1").toLowerCase());if(this.tfm){for(e in this.tfm)n[e]=this.tfm[e];n.svg&&(n.renderTransform(),r.setAttribute("data-svg-origin",this.svgo||"")),(t=Ni())&&t.isStart||s[ar]||(ur(s),n.zOrigin&&s[or]&&(s[or]+=" "+n.zOrigin+"px",n.zOrigin=0,n.renderTransform()),n.uncache=1)}},cr=function(t,e){var i={target:t,props:[],revert:lr,save:hr};return t._gsap||Oi.core.getCache(t),e&&t.style&&t.nodeType&&e.split(",").forEach((function(t){return i.save(t)})),i},dr=function(t,e){var i=Pi.createElementNS?Pi.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):Pi.createElement(t);return i&&i.style?i:Pi.createElement(t)},pr=function t(e,i,r){var s=getComputedStyle(e);return s[i]||s.getPropertyValue(i.replace(Hi,"-$1").toLowerCase())||s.getPropertyValue(i)||!r&&t(e,fr(i)||i,1)||""},mr="O,Moz,ms,Ms,Webkit".split(","),fr=function(t,e,i){var r=(e||Fi).style,s=5;if(t in r&&!i)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);s--&&!(mr[s]+t in r););return s<0?null:(3===s?"ms":s>=0?mr[s]:"")+t},yr=function(){"undefined"!=typeof window&&window.document&&(Ii=window,Pi=Ii.document,Ri=Pi.documentElement,Fi=dr("div")||{style:{}},dr("div"),ar=fr(ar),or=ar+"Origin",Fi.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Di=!!fr("perspective"),Ni=Oi.core.reverting,Bi=1)},gr=function(t){var e,i=t.ownerSVGElement,r=dr("svg",i&&i.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),s=t.cloneNode(!0);s.style.display="block",r.appendChild(s),Ri.appendChild(r);try{e=s.getBBox()}catch(t){}return r.removeChild(s),Ri.removeChild(r),e},xr=function(t,e){for(var i=e.length;i--;)if(t.hasAttribute(e[i]))return t.getAttribute(e[i])},_r=function(t){var e,i;try{e=t.getBBox()}catch(r){e=gr(t),i=1}return e&&(e.width||e.height)||i||(e=gr(t)),!e||e.width||e.x||e.y?e:{x:+xr(t,["x","cx","x1"])||0,y:+xr(t,["y","cy","y1"])||0,width:0,height:0}},vr=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!_r(t))},br=function(t,e){if(e){var i,r=t.style;e in Ui&&e!==or&&(e=ar),r.removeProperty?("ms"!==(i=e.substr(0,2))&&"webkit"!==e.substr(0,6)||(e="-"+e),r.removeProperty("--"===i?e:e.replace(Hi,"-$1").toLowerCase())):r.removeAttribute(e)}},wr=function(t,e,i,r,s,n){var a=new xi(t._pt,e,i,0,1,n?Ki:$i);return t._pt=a,a.b=r,a.e=s,t._props.push(i),a},Mr={deg:1,rad:1,turn:1},Tr={grid:1,flex:1},Sr=function t(e,i,r,s){var n,a,o,h,u=parseFloat(r)||0,l=(r+"").trim().substr((u+"").length)||"px",c=Fi.style,d=ji.test(i),p="svg"===e.tagName.toLowerCase(),m=(p?"client":"offset")+(d?"Width":"Height"),f=100,y="px"===s,g="%"===s;if(s===l||!u||Mr[s]||Mr[l])return u;if("px"!==l&&!y&&(u=t(e,i,r,"px")),h=e.getCTM&&vr(e),(g||"%"===l)&&(Ui[i]||~i.indexOf("adius")))return n=h?e.getBBox()[d?"width":"height"]:e[m],vt(g?u/n*f:u/100*n);if(c[d?"width":"height"]=f+(y?l:s),a="rem"!==s&&~i.indexOf("adius")||"em"===s&&e.appendChild&&!p?e:e.parentNode,h&&(a=(e.ownerSVGElement||{}).parentNode),a&&a!==Pi&&a.appendChild||(a=Pi.body),(o=a._gsap)&&g&&o.width&&d&&o.time===Ie.time&&!o.uncache)return vt(u/o.width*f);if(!g||"height"!==i&&"width"!==i)(g||"%"===l)&&!Tr[pr(a,"display")]&&(c.position=pr(e,"position")),a===e&&(c.position="static"),a.appendChild(Fi),n=Fi[m],a.removeChild(Fi),c.position="absolute";else{var x=e.style[i];e.style[i]=f+s,n=e[m],x?e.style[i]=x:br(e,i)}return d&&g&&((o=gt(a)).time=Ie.time,o.width=a[m]),vt(y?n*u/f:n&&u?f/n*u:0)},zr=function(t,e,i,r){var s;return Bi||yr(),e in Yi&&"transform"!==e&&~(e=Yi[e]).indexOf(",")&&(e=e.split(",")[0]),Ui[e]&&"transform"!==e?(s=Vr(t,r),s="transformOrigin"!==e?s[e]:s.svg?s.origin:Nr(pr(t,or))+" "+s.zOrigin+"px"):(!(s=t.style[e])||"auto"===s||r||~(s+"").indexOf("calc("))&&(s=Er[e]&&Er[e](t,e,i)||pr(t,e)||xt(t,e)||("opacity"===e?1:0)),i&&!~(s+"").trim().indexOf(" ")?Sr(t,e,s,i)+i:s},Ar=function(t,e,i,r){if(!i||"none"===i){var s=fr(e,t,1),n=s&&pr(t,s,1);n&&n!==i?(e=s,i=n):"borderColor"===e&&(i=pr(t,"borderTopColor"))}var a,o,h,u,l,c,d,p,m,f,y,g=new xi(this._pt,t.style,e,0,1,di),x=0,_=0;if(g.b=i,g.e=r,i+="","var(--"===(r+="").substring(0,6)&&(r=pr(t,r.substring(4,r.indexOf(")")))),"auto"===r&&(c=t.style[e],t.style[e]=r,r=pr(t,e)||r,c?t.style[e]=c:br(t,e)),Oe(a=[i,r]),r=a[1],h=(i=a[0]).match(Y)||[],(r.match(Y)||[]).length){for(;o=Y.exec(r);)d=o[0],m=r.substring(x,o.index),l?l=(l+1)%5:"rgba("!==m.substr(-5)&&"hsla("!==m.substr(-5)||(l=1),d!==(c=h[_++]||"")&&(u=parseFloat(c)||0,y=c.substr((u+"").length),"="===d.charAt(1)&&(d=wt(u,d)+y),p=parseFloat(d),f=d.substr((p+"").length),x=Y.lastIndex-f.length,f||(f=f||S.units[e]||y,x===r.length&&(r+=f,g.e+=f)),y!==f&&(u=Sr(t,e,c,f)||0),g._pt={_next:g._pt,p:m||1===_?m:",",s:u,c:p-u,m:l&&l<4||"zIndex"===e?Math.round:0});g.c=x<r.length?r.substring(x,r.length):""}else g.r="display"===e&&"none"===r?Ki:$i;return J.test(r)&&(g.e=0),this._pt=g,g},kr={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},Cr=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var i,r,s,n=e.t,a=n.style,o=e.u,h=n._gsap;if("all"===o||!0===o)a.cssText="",r=1;else for(s=(o=o.split(",")).length;--s>-1;)i=o[s],Ui[i]&&(r=1,i="transformOrigin"===i?or:ar),br(n,i);r&&(br(n,ar),h&&(h.svg&&n.removeAttribute("transform"),a.scale=a.rotate=a.translate="none",Vr(n,1),h.uncache=1,ur(a)))}},Er={clearProps:function(t,e,i,r,s){if("isFromStart"!==s.data){var n=t._pt=new xi(t._pt,e,i,0,0,Cr);return n.u=r,n.pr=-10,n.tween=s,t._props.push(i),1}}},Or=[1,0,0,1,0,0],Ir={},Pr=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},Rr=function(t){var e=pr(t,ar);return Pr(e)?Or:e.substr(7).match(X).map(vt)},Br=function(t,e){var i,r,s,n,a=t._gsap||gt(t),o=t.style,h=Rr(t);return a.svg&&t.getAttribute("transform")?"1,0,0,1,0,0"===(h=[(s=t.transform.baseVal.consolidate().matrix).a,s.b,s.c,s.d,s.e,s.f]).join(",")?Or:h:(h!==Or||t.offsetParent||t===Ri||a.svg||(s=o.display,o.display="block",(i=t.parentNode)&&(t.offsetParent||t.getBoundingClientRect().width)||(n=1,r=t.nextElementSibling,Ri.appendChild(t)),h=Rr(t),s?o.display=s:br(t,"display"),n&&(r?i.insertBefore(t,r):i?i.appendChild(t):Ri.removeChild(t))),e&&h.length>6?[h[0],h[1],h[4],h[5],h[12],h[13]]:h)},Fr=function(t,e,i,r,s,n){var a,o,h,u=t._gsap,l=s||Br(t,!0),c=u.xOrigin||0,d=u.yOrigin||0,p=u.xOffset||0,m=u.yOffset||0,f=l[0],y=l[1],g=l[2],x=l[3],_=l[4],v=l[5],b=e.split(" "),w=parseFloat(b[0])||0,M=parseFloat(b[1])||0;i?l!==Or&&(o=f*x-y*g)&&(h=w*(-y/o)+M*(f/o)-(f*v-y*_)/o,w=w*(x/o)+M*(-g/o)+(g*v-x*_)/o,M=h):(w=(a=_r(t)).x+(~b[0].indexOf("%")?w/100*a.width:w),M=a.y+(~(b[1]||b[0]).indexOf("%")?M/100*a.height:M)),r||!1!==r&&u.smooth?(_=w-c,v=M-d,u.xOffset=p+(_*f+v*g)-_,u.yOffset=m+(_*y+v*x)-v):u.xOffset=u.yOffset=0,u.xOrigin=w,u.yOrigin=M,u.smooth=!!r,u.origin=e,u.originIsAbsolute=!!i,t.style[or]="0px 0px",n&&(wr(n,u,"xOrigin",c,w),wr(n,u,"yOrigin",d,M),wr(n,u,"xOffset",p,u.xOffset),wr(n,u,"yOffset",m,u.yOffset)),t.setAttribute("data-svg-origin",w+" "+M)},Vr=function(t,e){var i=t._gsap||new je(t);if("x"in i&&!e&&!i.uncache)return i;var r,s,n,a,o,h,u,l,c,d,p,m,f,y,g,x,_,v,b,w,M,T,z,A,k,C,E,O,I,P,R,B,F=t.style,V=i.scaleX<0,N="px",D="deg",U=getComputedStyle(t),L=pr(t,or)||"0";return r=s=n=h=u=l=c=d=p=0,a=o=1,i.svg=!(!t.getCTM||!vr(t)),U.translate&&("none"===U.translate&&"none"===U.scale&&"none"===U.rotate||(F[ar]=("none"!==U.translate?"translate3d("+(U.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==U.rotate?"rotate("+U.rotate+") ":"")+("none"!==U.scale?"scale("+U.scale.split(" ").join(",")+") ":"")+("none"!==U[ar]?U[ar]:"")),F.scale=F.rotate=F.translate="none"),y=Br(t,i.svg),i.svg&&(i.uncache?(k=t.getBBox(),L=i.xOrigin-k.x+"px "+(i.yOrigin-k.y)+"px",A=""):A=!e&&t.getAttribute("data-svg-origin"),Fr(t,A||L,!!A||i.originIsAbsolute,!1!==i.smooth,y)),m=i.xOrigin||0,f=i.yOrigin||0,y!==Or&&(v=y[0],b=y[1],w=y[2],M=y[3],r=T=y[4],s=z=y[5],6===y.length?(a=Math.sqrt(v*v+b*b),o=Math.sqrt(M*M+w*w),h=v||b?Wi(b,v)*Li:0,(c=w||M?Wi(w,M)*Li+h:0)&&(o*=Math.abs(Math.cos(c*qi))),i.svg&&(r-=m-(m*v+f*w),s-=f-(m*b+f*M))):(B=y[6],P=y[7],E=y[8],O=y[9],I=y[10],R=y[11],r=y[12],s=y[13],n=y[14],u=(g=Wi(B,I))*Li,g&&(A=T*(x=Math.cos(-g))+E*(_=Math.sin(-g)),k=z*x+O*_,C=B*x+I*_,E=T*-_+E*x,O=z*-_+O*x,I=B*-_+I*x,R=P*-_+R*x,T=A,z=k,B=C),l=(g=Wi(-w,I))*Li,g&&(x=Math.cos(-g),R=M*(_=Math.sin(-g))+R*x,v=A=v*x-E*_,b=k=b*x-O*_,w=C=w*x-I*_),h=(g=Wi(b,v))*Li,g&&(A=v*(x=Math.cos(g))+b*(_=Math.sin(g)),k=T*x+z*_,b=b*x-v*_,z=z*x-T*_,v=A,T=k),u&&Math.abs(u)+Math.abs(h)>359.9&&(u=h=0,l=180-l),a=vt(Math.sqrt(v*v+b*b+w*w)),o=vt(Math.sqrt(z*z+B*B)),g=Wi(T,z),c=Math.abs(g)>2e-4?g*Li:0,p=R?1/(R<0?-R:R):0),i.svg&&(A=t.getAttribute("transform"),i.forceCSS=t.setAttribute("transform","")||!Pr(pr(t,ar)),A&&t.setAttribute("transform",A))),Math.abs(c)>90&&Math.abs(c)<270&&(V?(a*=-1,c+=h<=0?180:-180,h+=h<=0?180:-180):(o*=-1,c+=c<=0?180:-180)),e=e||i.uncache,i.x=r-((i.xPercent=r&&(!e&&i.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-r)?-50:0)))?t.offsetWidth*i.xPercent/100:0)+N,i.y=s-((i.yPercent=s&&(!e&&i.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-s)?-50:0)))?t.offsetHeight*i.yPercent/100:0)+N,i.z=n+N,i.scaleX=vt(a),i.scaleY=vt(o),i.rotation=vt(h)+D,i.rotationX=vt(u)+D,i.rotationY=vt(l)+D,i.skewX=c+D,i.skewY=d+D,i.transformPerspective=p+N,(i.zOrigin=parseFloat(L.split(" ")[2])||!e&&i.zOrigin||0)&&(F[or]=Nr(L)),i.xOffset=i.yOffset=0,i.force3D=S.force3D,i.renderTransform=i.svg?jr:Di?Hr:Ur,i.uncache=0,i},Nr=function(t){return(t=t.split(" "))[0]+" "+t[1]},Dr=function(t,e,i){var r=se(e);return vt(parseFloat(e)+parseFloat(Sr(t,"x",i+"px",r)))+r},Ur=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Hr(t,e)},Lr="0deg",qr="0px",Wr=") ",Hr=function(t,e){var i=e||this,r=i.xPercent,s=i.yPercent,n=i.x,a=i.y,o=i.z,h=i.rotation,u=i.rotationY,l=i.rotationX,c=i.skewX,d=i.skewY,p=i.scaleX,m=i.scaleY,f=i.transformPerspective,y=i.force3D,g=i.target,x=i.zOrigin,_="",v="auto"===y&&t&&1!==t||!0===y;if(x&&(l!==Lr||u!==Lr)){var b,w=parseFloat(u)*qi,M=Math.sin(w),T=Math.cos(w);w=parseFloat(l)*qi,b=Math.cos(w),n=Dr(g,n,M*b*-x),a=Dr(g,a,-Math.sin(w)*-x),o=Dr(g,o,T*b*-x+x)}f!==qr&&(_+="perspective("+f+Wr),(r||s)&&(_+="translate("+r+"%, "+s+"%) "),(v||n!==qr||a!==qr||o!==qr)&&(_+=o!==qr||v?"translate3d("+n+", "+a+", "+o+") ":"translate("+n+", "+a+Wr),h!==Lr&&(_+="rotate("+h+Wr),u!==Lr&&(_+="rotateY("+u+Wr),l!==Lr&&(_+="rotateX("+l+Wr),c===Lr&&d===Lr||(_+="skew("+c+", "+d+Wr),1===p&&1===m||(_+="scale("+p+", "+m+Wr),g.style[ar]=_||"translate(0, 0)"},jr=function(t,e){var i,r,s,n,a,o=e||this,h=o.xPercent,u=o.yPercent,l=o.x,c=o.y,d=o.rotation,p=o.skewX,m=o.skewY,f=o.scaleX,y=o.scaleY,g=o.target,x=o.xOrigin,_=o.yOrigin,v=o.xOffset,b=o.yOffset,w=o.forceCSS,M=parseFloat(l),T=parseFloat(c);d=parseFloat(d),p=parseFloat(p),(m=parseFloat(m))&&(p+=m=parseFloat(m),d+=m),d||p?(d*=qi,p*=qi,i=Math.cos(d)*f,r=Math.sin(d)*f,s=Math.sin(d-p)*-y,n=Math.cos(d-p)*y,p&&(m*=qi,a=Math.tan(p-m),s*=a=Math.sqrt(1+a*a),n*=a,m&&(a=Math.tan(m),i*=a=Math.sqrt(1+a*a),r*=a)),i=vt(i),r=vt(r),s=vt(s),n=vt(n)):(i=f,n=y,r=s=0),(M&&!~(l+"").indexOf("px")||T&&!~(c+"").indexOf("px"))&&(M=Sr(g,"x",l,"px"),T=Sr(g,"y",c,"px")),(x||_||v||b)&&(M=vt(M+x-(x*i+_*s)+v),T=vt(T+_-(x*r+_*n)+b)),(h||u)&&(a=g.getBBox(),M=vt(M+h/100*a.width),T=vt(T+u/100*a.height)),a="matrix("+i+","+r+","+s+","+n+","+M+","+T+")",g.setAttribute("transform",a),w&&(g.style[ar]=a)},Xr=function(t,e,i,r,s){var n,a,o=360,h=B(s),u=parseFloat(s)*(h&&~s.indexOf("rad")?Li:1)-r,l=r+u+"deg";return h&&("short"===(n=s.split("_")[1])&&(u%=o)!==u%180&&(u+=u<0?o:-360),"cw"===n&&u<0?u=(u+36e9)%o-~~(u/o)*o:"ccw"===n&&u>0&&(u=(u-36e9)%o-~~(u/o)*o)),t._pt=a=new xi(t._pt,e,i,r,u,Ji),a.e=l,a.u="deg",t._props.push(i),a},Yr=function(t,e){for(var i in e)t[i]=e[i];return t},Zr=function(t,e,i){var r,s,n,a,o,h,u,l=Yr({},i._gsap),c=i.style;for(s in l.svg?(n=i.getAttribute("transform"),i.setAttribute("transform",""),c[ar]=e,r=Vr(i,1),br(i,ar),i.setAttribute("transform",n)):(n=getComputedStyle(i)[ar],c[ar]=e,r=Vr(i,1),c[ar]=n),Ui)(n=l[s])!==(a=r[s])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(s)<0&&(o=se(n)!==(u=se(a))?Sr(i,s,n,u):parseFloat(n),h=parseFloat(a),t._pt=new xi(t._pt,r,s,o,h-o,Zi),t._pt.u=u||0,t._props.push(s));Yr(r,l)};_t("padding,margin,Width,Radius",(function(t,e){var i="Top",r="Right",s="Bottom",n="Left",a=(e<3?[i,r,s,n]:[i+n,i+r,s+r,s+n]).map((function(i){return e<2?t+i:"border"+i+t}));Er[e>1?"border"+t:t]=function(t,e,i,r,s){var n,o;if(arguments.length<4)return n=a.map((function(e){return zr(t,e,i)})),5===(o=n.join(" ")).split(n[0]).length?n[0]:o;n=(r+"").split(" "),o={},a.forEach((function(t,e){return o[t]=n[e]=n[e]||n[(e-1)/2|0]})),t.init(e,o,s)}}));var Jr,Gr,Qr,$r={name:"css",register:yr,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,i,r,s){var n,a,o,h,u,l,c,d,p,m,f,y,g,x,_,v,b,w,M,T,z=this._props,A=t.style,k=i.vars.startAt;for(c in Bi||yr(),this.styles=this.styles||cr(t),v=this.styles.props,this.tween=i,e)if("autoRound"!==c&&(a=e[c],!ct[c]||!$e(c,e,i,r,t,s)))if(u=typeof a,l=Er[c],"function"===u&&(u=typeof(a=a.call(i,r,t,s))),"string"===u&&~a.indexOf("random(")&&(a=ye(a)),l)l(this,t,c,a,i)&&(_=1);else if("--"===c.substr(0,2))n=(getComputedStyle(t).getPropertyValue(c)+"").trim(),a+="",Ce.lastIndex=0,Ce.test(n)||(d=se(n),p=se(a)),p?d!==p&&(n=Sr(t,c,n,p)+p):d&&(a+=d),this.add(A,"setProperty",n,a,r,s,0,0,c),z.push(c),v.push(c,0,A[c]);else if("undefined"!==u){if(k&&c in k?(n="function"==typeof k[c]?k[c].call(i,r,t,s):k[c],B(n)&&~n.indexOf("random(")&&(n=ye(n)),se(n+"")||"auto"===n||(n+=S.units[c]||se(zr(t,c))||""),"="===(n+"").charAt(1)&&(n=zr(t,c))):n=zr(t,c),h=parseFloat(n),(m="string"===u&&"="===a.charAt(1)&&a.substr(0,2))&&(a=a.substr(2)),o=parseFloat(a),c in Yi&&("autoAlpha"===c&&(1===h&&"hidden"===zr(t,"visibility")&&o&&(h=0),v.push("visibility",0,A.visibility),wr(this,A,"visibility",h?"inherit":"hidden",o?"inherit":"hidden",!o)),"scale"!==c&&"transform"!==c&&~(c=Yi[c]).indexOf(",")&&(c=c.split(",")[0])),f=c in Ui)if(this.styles.save(c),"string"===u&&"var(--"===a.substring(0,6)&&(a=pr(t,a.substring(4,a.indexOf(")"))),o=parseFloat(a)),y||((g=t._gsap).renderTransform&&!e.parseTransform||Vr(t,e.parseTransform),x=!1!==e.smoothOrigin&&g.smooth,(y=this._pt=new xi(this._pt,A,ar,0,1,g.renderTransform,g,0,-1)).dep=1),"scale"===c)this._pt=new xi(this._pt,g,"scaleY",g.scaleY,(m?wt(g.scaleY,m+o):o)-g.scaleY||0,Zi),this._pt.u=0,z.push("scaleY",c),c+="X";else{if("transformOrigin"===c){v.push(or,0,A[or]),w=void 0,M=void 0,T=void 0,w=(b=a).split(" "),M=w[0],T=w[1]||"50%","top"!==M&&"bottom"!==M&&"left"!==T&&"right"!==T||(b=M,M=T,T=b),w[0]=kr[M]||M,w[1]=kr[T]||T,a=w.join(" "),g.svg?Fr(t,a,0,x,0,this):((p=parseFloat(a.split(" ")[2])||0)!==g.zOrigin&&wr(this,g,"zOrigin",g.zOrigin,p),wr(this,A,c,Nr(n),Nr(a)));continue}if("svgOrigin"===c){Fr(t,a,1,x,0,this);continue}if(c in Ir){Xr(this,g,c,h,m?wt(h,m+a):a);continue}if("smoothOrigin"===c){wr(this,g,"smooth",g.smooth,a);continue}if("force3D"===c){g[c]=a;continue}if("transform"===c){Zr(this,a,t);continue}}else c in A||(c=fr(c)||c);if(f||(o||0===o)&&(h||0===h)&&!Xi.test(a)&&c in A)o||(o=0),(d=(n+"").substr((h+"").length))!==(p=se(a)||(c in S.units?S.units[c]:d))&&(h=Sr(t,c,n,p)),this._pt=new xi(this._pt,f?g:A,c,h,(m?wt(h,m+o):o)-h,f||"px"!==p&&"zIndex"!==c||!1===e.autoRound?Zi:Qi),this._pt.u=p||0,d!==p&&"%"!==p&&(this._pt.b=n,this._pt.r=Gi);else if(c in A)Ar.call(this,t,c,n,m?m+a:a);else if(c in t)this.add(t,c,n||t[c],m?m+a:a,r,s);else if("parseTransform"!==c){et(c,a);continue}f||(c in A?v.push(c,0,A[c]):"function"==typeof t[c]?v.push(c,2,t[c]()):v.push(c,1,n||t[c])),z.push(c)}_&&gi(this)},render:function(t,e){if(e.tween._time||!Ni())for(var i=e._pt;i;)i.r(t,i.d),i=i._next;else e.styles.revert()},get:zr,aliases:Yi,getSetter:function(t,e,i){var r=Yi[e];return r&&r.indexOf(",")<0&&(e=r),e in Ui&&e!==or&&(t._gsap.x||zr(t,"x"))?i&&Vi===i?"scale"===e?rr:ir:(Vi=i||{})&&("scale"===e?sr:nr):t.style&&!N(t.style[e])?tr:~e.indexOf("-")?er:ui(t,e)},core:{_removeProperty:br,_getMatrix:Br}};Oi.utils.checkPrefix=fr,Oi.core.getStyleSaver=cr,Qr=_t((Jr="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(Gr="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",(function(t){Ui[t]=1})),_t(Gr,(function(t){S.units[t]="deg",Ir[t]=1})),Yi[Qr[13]]=Jr+","+Gr,_t("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",(function(t){var e=t.split(":");Yi[e[1]]=Qr[e[0]]})),_t("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",(function(t){S.units[t]="px"})),Oi.registerPlugin($r);var Kr=Oi.registerPlugin($r)||Oi;Kr.core.Tween;const ts=1e3,es=1001,is=1002,rs=1015,ss=2300,ns=2301,as=2302,os=2400,hs=2401,us=2402,ls="srgb",cs="srgb-linear",ds="linear",ps="srgb",ms=7680,fs=35044,ys=2e3,gs=2001;class xs{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const r=i[t];if(void 0!==r){const t=r.indexOf(e);-1!==t&&r.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,r=e.length;i<r;i++)e[i].call(this,t);t.target=null}}}const _s=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];Math.PI,Math.PI;function vs(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,r=4294967295*Math.random()|0;return(_s[255&t]+_s[t>>8&255]+_s[t>>16&255]+_s[t>>24&255]+"-"+_s[255&e]+_s[e>>8&255]+"-"+_s[e>>16&15|64]+_s[e>>24&255]+"-"+_s[63&i|128]+_s[i>>8&255]+"-"+_s[i>>16&255]+_s[i>>24&255]+_s[255&r]+_s[r>>8&255]+_s[r>>16&255]+_s[r>>24&255]).toLowerCase()}function bs(t,e,i){return Math.max(e,Math.min(i,t))}function ws(t,e){return(t%e+e)%e}function Ms(t,e,i){return(1-i)*t+i*e}function Ts(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Ss(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class zs{constructor(t=0,e=0){zs.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6],this.y=r[1]*e+r[4]*i+r[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=bs(this.x,t.x,e.x),this.y=bs(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=bs(this.x,t,e),this.y=bs(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(bs(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(bs(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),r=Math.sin(e),s=this.x-t.x,n=this.y-t.y;return this.x=s*i-n*r+t.x,this.y=s*r+n*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class As{constructor(t,e,i,r,s,n,a,o,h){As.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,r,s,n,a,o,h)}set(t,e,i,r,s,n,a,o,h){const u=this.elements;return u[0]=t,u[1]=r,u[2]=a,u[3]=e,u[4]=s,u[5]=o,u[6]=i,u[7]=n,u[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,r=e.elements,s=this.elements,n=i[0],a=i[3],o=i[6],h=i[1],u=i[4],l=i[7],c=i[2],d=i[5],p=i[8],m=r[0],f=r[3],y=r[6],g=r[1],x=r[4],_=r[7],v=r[2],b=r[5],w=r[8];return s[0]=n*m+a*g+o*v,s[3]=n*f+a*x+o*b,s[6]=n*y+a*_+o*w,s[1]=h*m+u*g+l*v,s[4]=h*f+u*x+l*b,s[7]=h*y+u*_+l*w,s[2]=c*m+d*g+p*v,s[5]=c*f+d*x+p*b,s[8]=c*y+d*_+p*w,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],n=t[4],a=t[5],o=t[6],h=t[7],u=t[8];return e*n*u-e*a*h-i*s*u+i*a*o+r*s*h-r*n*o}invert(){const t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],n=t[4],a=t[5],o=t[6],h=t[7],u=t[8],l=u*n-a*h,c=a*o-u*s,d=h*s-n*o,p=e*l+i*c+r*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return t[0]=l*m,t[1]=(r*h-u*i)*m,t[2]=(a*i-r*n)*m,t[3]=c*m,t[4]=(u*e-r*o)*m,t[5]=(r*s-a*e)*m,t[6]=d*m,t[7]=(i*o-h*e)*m,t[8]=(n*e-i*s)*m,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,r,s,n,a){const o=Math.cos(s),h=Math.sin(s);return this.set(i*o,i*h,-i*(o*n+h*a)+n+t,-r*h,r*o,-r*(-h*n+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(ks.makeScale(t,e)),this}rotate(t){return this.premultiply(ks.makeRotation(-t)),this}translate(t,e){return this.premultiply(ks.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const ks=new As;Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function Cs(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}const Es=(new As).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Os=(new As).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function Is(){const t={enabled:!0,workingColorSpace:cs,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(this.spaces[e].transfer===ps&&(t.r=Rs(t.r),t.g=Rs(t.g),t.b=Rs(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===ps&&(t.r=Bs(t.r),t.g=Bs(t.g),t.b=Bs(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return""===t?ds:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],r=[.3127,.329];return t.define({[cs]:{primaries:e,whitePoint:r,transfer:ds,toXYZ:Es,fromXYZ:Os,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:ls},outputColorSpaceConfig:{drawingBufferColorSpace:ls}},[ls]:{primaries:e,whitePoint:r,transfer:ps,toXYZ:Es,fromXYZ:Os,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:ls}}}),t}const Ps=Is();function Rs(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Bs(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Fs;class Vs{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===Fs&&(Fs=Cs("canvas")),Fs.width=t.width,Fs.height=t.height;const e=Fs.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=Fs}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Cs("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const r=i.getImageData(0,0,t.width,t.height),s=r.data;for(let t=0;t<s.length;t++)s[t]=255*Rs(s[t]/255);return i.putImageData(r,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*Rs(e[t]/255)):e[t]=Rs(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let Ns=0;class Ds{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Ns++}),this.uuid=vs(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},r=this.data;if(null!==r){let t;if(Array.isArray(r)){t=[];for(let e=0,i=r.length;e<i;e++)r[e].isDataTexture?t.push(Us(r[e].image)):t.push(Us(r[e]))}else t=Us(r);i.url=t}return e||(t.images[this.uuid]=i),i}}function Us(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Vs.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let Ls=0;class qs extends xs{constructor(t=qs.DEFAULT_IMAGE,e=qs.DEFAULT_MAPPING,i=1001,r=1001,s=1006,n=1008,a=1023,o=1009,h=qs.DEFAULT_ANISOTROPY,u=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Ls++}),this.uuid=vs(),this.name="",this.source=new Ds(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=n,this.anisotropy=h,this.format=a,this.internalFormat=null,this.type=o,this.offset=new zs(0,0),this.repeat=new zs(1,1),this.center=new zs(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new As,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isTextureArray=t.isTextureArray,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case ts:t.x=t.x-Math.floor(t.x);break;case es:t.x=t.x<0?0:1;break;case is:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case ts:t.y=t.y-Math.floor(t.y);break;case es:t.y=t.y<0?0:1;break;case is:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}qs.DEFAULT_IMAGE=null,qs.DEFAULT_MAPPING=300,qs.DEFAULT_ANISOTROPY=1;class Ws{constructor(t=0,e=0,i=0,r=1){Ws.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=r}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,r){return this.x=t,this.y=e,this.z=i,this.w=r,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,r=this.z,s=this.w,n=t.elements;return this.x=n[0]*e+n[4]*i+n[8]*r+n[12]*s,this.y=n[1]*e+n[5]*i+n[9]*r+n[13]*s,this.z=n[2]*e+n[6]*i+n[10]*r+n[14]*s,this.w=n[3]*e+n[7]*i+n[11]*r+n[15]*s,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,r,s;const n=.01,a=.1,o=t.elements,h=o[0],u=o[4],l=o[8],c=o[1],d=o[5],p=o[9],m=o[2],f=o[6],y=o[10];if(Math.abs(u-c)<n&&Math.abs(l-m)<n&&Math.abs(p-f)<n){if(Math.abs(u+c)<a&&Math.abs(l+m)<a&&Math.abs(p+f)<a&&Math.abs(h+d+y-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(h+1)/2,o=(d+1)/2,g=(y+1)/2,x=(u+c)/4,_=(l+m)/4,v=(p+f)/4;return t>o&&t>g?t<n?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(t),r=x/i,s=_/i):o>g?o<n?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(o),i=x/r,s=v/r):g<n?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(g),i=_/s,r=v/s),this.set(i,r,s,e),this}let g=Math.sqrt((f-p)*(f-p)+(l-m)*(l-m)+(c-u)*(c-u));return Math.abs(g)<.001&&(g=1),this.x=(f-p)/g,this.y=(l-m)/g,this.z=(c-u)/g,this.w=Math.acos((h+d+y-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=bs(this.x,t.x,e.x),this.y=bs(this.y,t.y,e.y),this.z=bs(this.z,t.z,e.z),this.w=bs(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=bs(this.x,t,e),this.y=bs(this.y,t,e),this.z=bs(this.z,t,e),this.w=bs(this.w,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(bs(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class Hs{constructor(t=0,e=0,i=0,r=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=r}static slerpFlat(t,e,i,r,s,n,a){let o=i[r+0],h=i[r+1],u=i[r+2],l=i[r+3];const c=s[n+0],d=s[n+1],p=s[n+2],m=s[n+3];if(0===a)return t[e+0]=o,t[e+1]=h,t[e+2]=u,void(t[e+3]=l);if(1===a)return t[e+0]=c,t[e+1]=d,t[e+2]=p,void(t[e+3]=m);if(l!==m||o!==c||h!==d||u!==p){let t=1-a;const e=o*c+h*d+u*p+l*m,i=e>=0?1:-1,r=1-e*e;if(r>Number.EPSILON){const s=Math.sqrt(r),n=Math.atan2(s,e*i);t=Math.sin(t*n)/s,a=Math.sin(a*n)/s}const s=a*i;if(o=o*t+c*s,h=h*t+d*s,u=u*t+p*s,l=l*t+m*s,t===1-a){const t=1/Math.sqrt(o*o+h*h+u*u+l*l);o*=t,h*=t,u*=t,l*=t}}t[e]=o,t[e+1]=h,t[e+2]=u,t[e+3]=l}static multiplyQuaternionsFlat(t,e,i,r,s,n){const a=i[r],o=i[r+1],h=i[r+2],u=i[r+3],l=s[n],c=s[n+1],d=s[n+2],p=s[n+3];return t[e]=a*p+u*l+o*d-h*c,t[e+1]=o*p+u*c+h*l-a*d,t[e+2]=h*p+u*d+a*c-o*l,t[e+3]=u*p-a*l-o*c-h*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,r){return this._x=t,this._y=e,this._z=i,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,r=t._y,s=t._z,n=t._order,a=Math.cos,o=Math.sin,h=a(i/2),u=a(r/2),l=a(s/2),c=o(i/2),d=o(r/2),p=o(s/2);switch(n){case"XYZ":this._x=c*u*l+h*d*p,this._y=h*d*l-c*u*p,this._z=h*u*p+c*d*l,this._w=h*u*l-c*d*p;break;case"YXZ":this._x=c*u*l+h*d*p,this._y=h*d*l-c*u*p,this._z=h*u*p-c*d*l,this._w=h*u*l+c*d*p;break;case"ZXY":this._x=c*u*l-h*d*p,this._y=h*d*l+c*u*p,this._z=h*u*p+c*d*l,this._w=h*u*l-c*d*p;break;case"ZYX":this._x=c*u*l-h*d*p,this._y=h*d*l+c*u*p,this._z=h*u*p-c*d*l,this._w=h*u*l+c*d*p;break;case"YZX":this._x=c*u*l+h*d*p,this._y=h*d*l+c*u*p,this._z=h*u*p-c*d*l,this._w=h*u*l-c*d*p;break;case"XZY":this._x=c*u*l-h*d*p,this._y=h*d*l-c*u*p,this._z=h*u*p+c*d*l,this._w=h*u*l+c*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+n)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,r=Math.sin(i);return this._x=t.x*r,this._y=t.y*r,this._z=t.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],r=e[4],s=e[8],n=e[1],a=e[5],o=e[9],h=e[2],u=e[6],l=e[10],c=i+a+l;if(c>0){const t=.5/Math.sqrt(c+1);this._w=.25/t,this._x=(u-o)*t,this._y=(s-h)*t,this._z=(n-r)*t}else if(i>a&&i>l){const t=2*Math.sqrt(1+i-a-l);this._w=(u-o)/t,this._x=.25*t,this._y=(r+n)/t,this._z=(s+h)/t}else if(a>l){const t=2*Math.sqrt(1+a-i-l);this._w=(s-h)/t,this._x=(r+n)/t,this._y=.25*t,this._z=(o+u)/t}else{const t=2*Math.sqrt(1+l-i-a);this._w=(n-r)/t,this._x=(s+h)/t,this._y=(o+u)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<Number.EPSILON?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(bs(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const r=Math.min(1,e/i);return this.slerp(t,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,r=t._y,s=t._z,n=t._w,a=e._x,o=e._y,h=e._z,u=e._w;return this._x=i*u+n*a+r*h-s*o,this._y=r*u+n*o+s*a-i*h,this._z=s*u+n*h+i*o-r*a,this._w=n*u-i*a-r*o-s*h,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const i=this._x,r=this._y,s=this._z,n=this._w;let a=n*t._w+i*t._x+r*t._y+s*t._z;if(a<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,a=-a):this.copy(t),a>=1)return this._w=n,this._x=i,this._y=r,this._z=s,this;const o=1-a*a;if(o<=Number.EPSILON){const t=1-e;return this._w=t*n+e*this._w,this._x=t*i+e*this._x,this._y=t*r+e*this._y,this._z=t*s+e*this._z,this.normalize(),this}const h=Math.sqrt(o),u=Math.atan2(h,a),l=Math.sin((1-e)*u)/h,c=Math.sin(e*u)/h;return this._w=n*l+this._w*c,this._x=i*l+this._x*c,this._y=r*l+this._y*c,this._z=s*l+this._z*c,this._onChangeCallback(),this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(t),r*Math.cos(t),s*Math.sin(e),s*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class js{constructor(t=0,e=0,i=0){js.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Ys.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Ys.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[3]*i+s[6]*r,this.y=s[1]*e+s[4]*i+s[7]*r,this.z=s[2]*e+s[5]*i+s[8]*r,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,r=this.z,s=t.elements,n=1/(s[3]*e+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*e+s[4]*i+s[8]*r+s[12])*n,this.y=(s[1]*e+s[5]*i+s[9]*r+s[13])*n,this.z=(s[2]*e+s[6]*i+s[10]*r+s[14])*n,this}applyQuaternion(t){const e=this.x,i=this.y,r=this.z,s=t.x,n=t.y,a=t.z,o=t.w,h=2*(n*r-a*i),u=2*(a*e-s*r),l=2*(s*i-n*e);return this.x=e+o*h+n*l-a*u,this.y=i+o*u+a*h-s*l,this.z=r+o*l+s*u-n*h,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,r=this.z,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*r,this.y=s[1]*e+s[5]*i+s[9]*r,this.z=s[2]*e+s[6]*i+s[10]*r,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=bs(this.x,t.x,e.x),this.y=bs(this.y,t.y,e.y),this.z=bs(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=bs(this.x,t,e),this.y=bs(this.y,t,e),this.z=bs(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(bs(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,r=t.y,s=t.z,n=e.x,a=e.y,o=e.z;return this.x=r*o-s*a,this.y=s*n-i*o,this.z=i*a-r*n,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return Xs.copy(this).projectOnVector(t),this.sub(Xs)}reflect(t){return this.sub(Xs.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(bs(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,r=this.z-t.z;return e*e+i*i+r*r}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const r=Math.sin(e)*t;return this.x=r*Math.sin(i),this.y=Math.cos(e)*t,this.z=r*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),r=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=r,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Xs=new js,Ys=new Hs;class Zs{constructor(t=new js(1/0,1/0,1/0),e=new js(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Gs.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Gs.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Gs.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}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=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,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}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const r=i.getAttribute("position");if(!0===e&&void 0!==r&&!0!==t.isInstancedMesh)for(let e=0,i=r.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,Gs):Gs.fromBufferAttribute(r,e),Gs.applyMatrix4(t.matrixWorld),this.expandByPoint(Gs);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),Qs.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),Qs.copy(i.boundingBox)),Qs.applyMatrix4(t.matrixWorld),this.union(Qs)}const r=t.children;for(let t=0,i=r.length;t<i;t++)this.expandByObject(r[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}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&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}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&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Gs),Gs.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(nn),an.subVectors(this.max,nn),$s.subVectors(t.a,nn),Ks.subVectors(t.b,nn),tn.subVectors(t.c,nn),en.subVectors(Ks,$s),rn.subVectors(tn,Ks),sn.subVectors($s,tn);let e=[0,-en.z,en.y,0,-rn.z,rn.y,0,-sn.z,sn.y,en.z,0,-en.x,rn.z,0,-rn.x,sn.z,0,-sn.x,-en.y,en.x,0,-rn.y,rn.x,0,-sn.y,sn.x,0];return!!un(e,$s,Ks,tn,an)&&(e=[1,0,0,0,1,0,0,0,1],!!un(e,$s,Ks,tn,an)&&(on.crossVectors(en,rn),e=[on.x,on.y,on.z],un(e,$s,Ks,tn,an)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Gs).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Gs).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Js[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Js[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Js[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Js[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Js[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Js[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Js[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Js[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Js)),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)}}const Js=[new js,new js,new js,new js,new js,new js,new js,new js],Gs=new js,Qs=new Zs,$s=new js,Ks=new js,tn=new js,en=new js,rn=new js,sn=new js,nn=new js,an=new js,on=new js,hn=new js;function un(t,e,i,r,s){for(let n=0,a=t.length-3;n<=a;n+=3){hn.fromArray(t,n);const a=s.x*Math.abs(hn.x)+s.y*Math.abs(hn.y)+s.z*Math.abs(hn.z),o=e.dot(hn),h=i.dot(hn),u=r.dot(hn);if(Math.max(-Math.max(o,h,u),Math.min(o,h,u))>a)return!1}return!0}const ln=new Zs,cn=new js,dn=new js;class pn{constructor(t=new js,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):ln.setFromPoints(t).getCenter(i);let r=0;for(let e=0,s=t.length;e<s;e++)r=Math.max(r,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(r),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;cn.subVectors(t,this.center);const e=cn.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(cn,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(dn.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(cn.copy(t.center).add(dn)),this.expandByPoint(cn.copy(t.center).sub(dn))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const mn=new js,fn=new js,yn=new js,gn=new js,xn=new js,_n=new js,vn=new js;class bn{constructor(t=new js,e=new js(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,mn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=mn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(mn.copy(this.origin).addScaledVector(this.direction,e),mn.distanceToSquared(t))}distanceSqToSegment(t,e,i,r){fn.copy(t).add(e).multiplyScalar(.5),yn.copy(e).sub(t).normalize(),gn.copy(this.origin).sub(fn);const s=.5*t.distanceTo(e),n=-this.direction.dot(yn),a=gn.dot(this.direction),o=-gn.dot(yn),h=gn.lengthSq(),u=Math.abs(1-n*n);let l,c,d,p;if(u>0)if(l=n*o-a,c=n*a-o,p=s*u,l>=0)if(c>=-p)if(c<=p){const t=1/u;l*=t,c*=t,d=l*(l+n*c+2*a)+c*(n*l+c+2*o)+h}else c=s,l=Math.max(0,-(n*c+a)),d=-l*l+c*(c+2*o)+h;else c=-s,l=Math.max(0,-(n*c+a)),d=-l*l+c*(c+2*o)+h;else c<=-p?(l=Math.max(0,-(-n*s+a)),c=l>0?-s:Math.min(Math.max(-s,-o),s),d=-l*l+c*(c+2*o)+h):c<=p?(l=0,c=Math.min(Math.max(-s,-o),s),d=c*(c+2*o)+h):(l=Math.max(0,-(n*s+a)),c=l>0?s:Math.min(Math.max(-s,-o),s),d=-l*l+c*(c+2*o)+h);else c=n>0?-s:s,l=Math.max(0,-(n*c+a)),d=-l*l+c*(c+2*o)+h;return i&&i.copy(this.origin).addScaledVector(this.direction,l),r&&r.copy(fn).addScaledVector(yn,c),d}intersectSphere(t,e){mn.subVectors(t.center,this.origin);const i=mn.dot(this.direction),r=mn.dot(mn)-i*i,s=t.radius*t.radius;if(r>s)return null;const n=Math.sqrt(s-r),a=i-n,o=i+n;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,r,s,n,a,o;const h=1/this.direction.x,u=1/this.direction.y,l=1/this.direction.z,c=this.origin;return h>=0?(i=(t.min.x-c.x)*h,r=(t.max.x-c.x)*h):(i=(t.max.x-c.x)*h,r=(t.min.x-c.x)*h),u>=0?(s=(t.min.y-c.y)*u,n=(t.max.y-c.y)*u):(s=(t.max.y-c.y)*u,n=(t.min.y-c.y)*u),i>n||s>r?null:((s>i||isNaN(i))&&(i=s),(n<r||isNaN(r))&&(r=n),l>=0?(a=(t.min.z-c.z)*l,o=(t.max.z-c.z)*l):(a=(t.max.z-c.z)*l,o=(t.min.z-c.z)*l),i>o||a>r?null:((a>i||i!=i)&&(i=a),(o<r||r!=r)&&(r=o),r<0?null:this.at(i>=0?i:r,e)))}intersectsBox(t){return null!==this.intersectBox(t,mn)}intersectTriangle(t,e,i,r,s){xn.subVectors(e,t),_n.subVectors(i,t),vn.crossVectors(xn,_n);let n,a=this.direction.dot(vn);if(a>0){if(r)return null;n=1}else{if(!(a<0))return null;n=-1,a=-a}gn.subVectors(this.origin,t);const o=n*this.direction.dot(_n.crossVectors(gn,_n));if(o<0)return null;const h=n*this.direction.dot(xn.cross(gn));if(h<0)return null;if(o+h>a)return null;const u=-n*gn.dot(vn);return u<0?null:this.at(u/a,s)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class wn{constructor(t,e,i,r,s,n,a,o,h,u,l,c,d,p,m,f){wn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,r,s,n,a,o,h,u,l,c,d,p,m,f)}set(t,e,i,r,s,n,a,o,h,u,l,c,d,p,m,f){const y=this.elements;return y[0]=t,y[4]=e,y[8]=i,y[12]=r,y[1]=s,y[5]=n,y[9]=a,y[13]=o,y[2]=h,y[6]=u,y[10]=l,y[14]=c,y[3]=d,y[7]=p,y[11]=m,y[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new wn).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,i=t.elements,r=1/Mn.setFromMatrixColumn(t,0).length(),s=1/Mn.setFromMatrixColumn(t,1).length(),n=1/Mn.setFromMatrixColumn(t,2).length();return e[0]=i[0]*r,e[1]=i[1]*r,e[2]=i[2]*r,e[3]=0,e[4]=i[4]*s,e[5]=i[5]*s,e[6]=i[6]*s,e[7]=0,e[8]=i[8]*n,e[9]=i[9]*n,e[10]=i[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,r=t.y,s=t.z,n=Math.cos(i),a=Math.sin(i),o=Math.cos(r),h=Math.sin(r),u=Math.cos(s),l=Math.sin(s);if("XYZ"===t.order){const t=n*u,i=n*l,r=a*u,s=a*l;e[0]=o*u,e[4]=-o*l,e[8]=h,e[1]=i+r*h,e[5]=t-s*h,e[9]=-a*o,e[2]=s-t*h,e[6]=r+i*h,e[10]=n*o}else if("YXZ"===t.order){const t=o*u,i=o*l,r=h*u,s=h*l;e[0]=t+s*a,e[4]=r*a-i,e[8]=n*h,e[1]=n*l,e[5]=n*u,e[9]=-a,e[2]=i*a-r,e[6]=s+t*a,e[10]=n*o}else if("ZXY"===t.order){const t=o*u,i=o*l,r=h*u,s=h*l;e[0]=t-s*a,e[4]=-n*l,e[8]=r+i*a,e[1]=i+r*a,e[5]=n*u,e[9]=s-t*a,e[2]=-n*h,e[6]=a,e[10]=n*o}else if("ZYX"===t.order){const t=n*u,i=n*l,r=a*u,s=a*l;e[0]=o*u,e[4]=r*h-i,e[8]=t*h+s,e[1]=o*l,e[5]=s*h+t,e[9]=i*h-r,e[2]=-h,e[6]=a*o,e[10]=n*o}else if("YZX"===t.order){const t=n*o,i=n*h,r=a*o,s=a*h;e[0]=o*u,e[4]=s-t*l,e[8]=r*l+i,e[1]=l,e[5]=n*u,e[9]=-a*u,e[2]=-h*u,e[6]=i*l+r,e[10]=t-s*l}else if("XZY"===t.order){const t=n*o,i=n*h,r=a*o,s=a*h;e[0]=o*u,e[4]=-l,e[8]=h*u,e[1]=t*l+s,e[5]=n*u,e[9]=i*l-r,e[2]=r*l-i,e[6]=a*u,e[10]=s*l+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Sn,t,zn)}lookAt(t,e,i){const r=this.elements;return Cn.subVectors(t,e),0===Cn.lengthSq()&&(Cn.z=1),Cn.normalize(),An.crossVectors(i,Cn),0===An.lengthSq()&&(1===Math.abs(i.z)?Cn.x+=1e-4:Cn.z+=1e-4,Cn.normalize(),An.crossVectors(i,Cn)),An.normalize(),kn.crossVectors(Cn,An),r[0]=An.x,r[4]=kn.x,r[8]=Cn.x,r[1]=An.y,r[5]=kn.y,r[9]=Cn.y,r[2]=An.z,r[6]=kn.z,r[10]=Cn.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,r=e.elements,s=this.elements,n=i[0],a=i[4],o=i[8],h=i[12],u=i[1],l=i[5],c=i[9],d=i[13],p=i[2],m=i[6],f=i[10],y=i[14],g=i[3],x=i[7],_=i[11],v=i[15],b=r[0],w=r[4],M=r[8],T=r[12],S=r[1],z=r[5],A=r[9],k=r[13],C=r[2],E=r[6],O=r[10],I=r[14],P=r[3],R=r[7],B=r[11],F=r[15];return s[0]=n*b+a*S+o*C+h*P,s[4]=n*w+a*z+o*E+h*R,s[8]=n*M+a*A+o*O+h*B,s[12]=n*T+a*k+o*I+h*F,s[1]=u*b+l*S+c*C+d*P,s[5]=u*w+l*z+c*E+d*R,s[9]=u*M+l*A+c*O+d*B,s[13]=u*T+l*k+c*I+d*F,s[2]=p*b+m*S+f*C+y*P,s[6]=p*w+m*z+f*E+y*R,s[10]=p*M+m*A+f*O+y*B,s[14]=p*T+m*k+f*I+y*F,s[3]=g*b+x*S+_*C+v*P,s[7]=g*w+x*z+_*E+v*R,s[11]=g*M+x*A+_*O+v*B,s[15]=g*T+x*k+_*I+v*F,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],r=t[8],s=t[12],n=t[1],a=t[5],o=t[9],h=t[13],u=t[2],l=t[6],c=t[10],d=t[14];return t[3]*(+s*o*l-r*h*l-s*a*c+i*h*c+r*a*d-i*o*d)+t[7]*(+e*o*d-e*h*c+s*n*c-r*n*d+r*h*u-s*o*u)+t[11]*(+e*h*l-e*a*d-s*n*l+i*n*d+s*a*u-i*h*u)+t[15]*(-r*a*u-e*o*l+e*a*c+r*n*l-i*n*c+i*o*u)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const r=this.elements;return t.isVector3?(r[12]=t.x,r[13]=t.y,r[14]=t.z):(r[12]=t,r[13]=e,r[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],r=t[2],s=t[3],n=t[4],a=t[5],o=t[6],h=t[7],u=t[8],l=t[9],c=t[10],d=t[11],p=t[12],m=t[13],f=t[14],y=t[15],g=l*f*h-m*c*h+m*o*d-a*f*d-l*o*y+a*c*y,x=p*c*h-u*f*h-p*o*d+n*f*d+u*o*y-n*c*y,_=u*m*h-p*l*h+p*a*d-n*m*d-u*a*y+n*l*y,v=p*l*o-u*m*o-p*a*c+n*m*c+u*a*f-n*l*f,b=e*g+i*x+r*_+s*v;if(0===b)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const w=1/b;return t[0]=g*w,t[1]=(m*c*s-l*f*s-m*r*d+i*f*d+l*r*y-i*c*y)*w,t[2]=(a*f*s-m*o*s+m*r*h-i*f*h-a*r*y+i*o*y)*w,t[3]=(l*o*s-a*c*s-l*r*h+i*c*h+a*r*d-i*o*d)*w,t[4]=x*w,t[5]=(u*f*s-p*c*s+p*r*d-e*f*d-u*r*y+e*c*y)*w,t[6]=(p*o*s-n*f*s-p*r*h+e*f*h+n*r*y-e*o*y)*w,t[7]=(n*c*s-u*o*s+u*r*h-e*c*h-n*r*d+e*o*d)*w,t[8]=_*w,t[9]=(p*l*s-u*m*s-p*i*d+e*m*d+u*i*y-e*l*y)*w,t[10]=(n*m*s-p*a*s+p*i*h-e*m*h-n*i*y+e*a*y)*w,t[11]=(u*a*s-n*l*s-u*i*h+e*l*h+n*i*d-e*a*d)*w,t[12]=v*w,t[13]=(u*m*r-p*l*r+p*i*c-e*m*c-u*i*f+e*l*f)*w,t[14]=(p*a*r-n*m*r-p*i*o+e*m*o+n*i*f-e*a*f)*w,t[15]=(n*l*r-u*a*r+u*i*o-e*l*o-n*i*c+e*a*c)*w,this}scale(t){const e=this.elements,i=t.x,r=t.y,s=t.z;return e[0]*=i,e[4]*=r,e[8]*=s,e[1]*=i,e[5]*=r,e[9]*=s,e[2]*=i,e[6]*=r,e[10]*=s,e[3]*=i,e[7]*=r,e[11]*=s,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],r=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,r))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),r=Math.sin(e),s=1-i,n=t.x,a=t.y,o=t.z,h=s*n,u=s*a;return this.set(h*n+i,h*a-r*o,h*o+r*a,0,h*a+r*o,u*a+i,u*o-r*n,0,h*o-r*a,u*o+r*n,s*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,r,s,n){return this.set(1,i,s,0,t,1,n,0,e,r,1,0,0,0,0,1),this}compose(t,e,i){const r=this.elements,s=e._x,n=e._y,a=e._z,o=e._w,h=s+s,u=n+n,l=a+a,c=s*h,d=s*u,p=s*l,m=n*u,f=n*l,y=a*l,g=o*h,x=o*u,_=o*l,v=i.x,b=i.y,w=i.z;return r[0]=(1-(m+y))*v,r[1]=(d+_)*v,r[2]=(p-x)*v,r[3]=0,r[4]=(d-_)*b,r[5]=(1-(c+y))*b,r[6]=(f+g)*b,r[7]=0,r[8]=(p+x)*w,r[9]=(f-g)*w,r[10]=(1-(c+m))*w,r[11]=0,r[12]=t.x,r[13]=t.y,r[14]=t.z,r[15]=1,this}decompose(t,e,i){const r=this.elements;let s=Mn.set(r[0],r[1],r[2]).length();const n=Mn.set(r[4],r[5],r[6]).length(),a=Mn.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),t.x=r[12],t.y=r[13],t.z=r[14],Tn.copy(this);const o=1/s,h=1/n,u=1/a;return Tn.elements[0]*=o,Tn.elements[1]*=o,Tn.elements[2]*=o,Tn.elements[4]*=h,Tn.elements[5]*=h,Tn.elements[6]*=h,Tn.elements[8]*=u,Tn.elements[9]*=u,Tn.elements[10]*=u,e.setFromRotationMatrix(Tn),i.x=s,i.y=n,i.z=a,this}makePerspective(t,e,i,r,s,n,a=2e3){const o=this.elements,h=2*s/(e-t),u=2*s/(i-r),l=(e+t)/(e-t),c=(i+r)/(i-r);let d,p;if(a===ys)d=-(n+s)/(n-s),p=-2*n*s/(n-s);else{if(a!==gs)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);d=-n/(n-s),p=-n*s/(n-s)}return o[0]=h,o[4]=0,o[8]=l,o[12]=0,o[1]=0,o[5]=u,o[9]=c,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,i,r,s,n,a=2e3){const o=this.elements,h=1/(e-t),u=1/(i-r),l=1/(n-s),c=(e+t)*h,d=(i+r)*u;let p,m;if(a===ys)p=(n+s)*l,m=-2*l;else{if(a!==gs)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=s*l,m=-1*l}return o[0]=2*h,o[4]=0,o[8]=0,o[12]=-c,o[1]=0,o[5]=2*u,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=m,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const Mn=new js,Tn=new wn,Sn=new js(0,0,0),zn=new js(1,1,1),An=new js,kn=new js,Cn=new js,En=new wn,On=new Hs;class In{constructor(t=0,e=0,i=0,r=In.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=r}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,r=this._order){return this._x=t,this._y=e,this._z=i,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const r=t.elements,s=r[0],n=r[4],a=r[8],o=r[1],h=r[5],u=r[9],l=r[2],c=r[6],d=r[10];switch(e){case"XYZ":this._y=Math.asin(bs(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-n,s)):(this._x=Math.atan2(c,h),this._z=0);break;case"YXZ":this._x=Math.asin(-bs(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,h)):(this._y=Math.atan2(-l,s),this._z=0);break;case"ZXY":this._x=Math.asin(bs(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-l,d),this._z=Math.atan2(-n,h)):(this._y=0,this._z=Math.atan2(o,s));break;case"ZYX":this._y=Math.asin(-bs(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(c,d),this._z=Math.atan2(o,s)):(this._x=0,this._z=Math.atan2(-n,h));break;case"YZX":this._z=Math.asin(bs(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,h),this._y=Math.atan2(-l,s)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-bs(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(c,h),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return En.makeRotationFromQuaternion(t),this.setFromRotationMatrix(En,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return On.setFromEuler(this),this.setFromQuaternion(On,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}In.DEFAULT_ORDER="XYZ";class Pn{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let Rn=0;const Bn=new js,Fn=new Hs,Vn=new wn,Nn=new js,Dn=new js,Un=new js,Ln=new Hs,qn=new js(1,0,0),Wn=new js(0,1,0),Hn=new js(0,0,1),jn={type:"added"},Xn={type:"removed"},Yn={type:"childadded",child:null},Zn={type:"childremoved",child:null};class Jn extends xs{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Rn++}),this.uuid=vs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Jn.DEFAULT_UP.clone();const t=new js,e=new In,i=new Hs,r=new js(1,1,1);e._onChange((function(){i.setFromEuler(e,!1)})),i._onChange((function(){e.setFromQuaternion(i,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new wn},normalMatrix:{value:new As}}),this.matrix=new wn,this.matrixWorld=new wn,this.matrixAutoUpdate=Jn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Jn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Pn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Fn.setFromAxisAngle(t,e),this.quaternion.multiply(Fn),this}rotateOnWorldAxis(t,e){return Fn.setFromAxisAngle(t,e),this.quaternion.premultiply(Fn),this}rotateX(t){return this.rotateOnAxis(qn,t)}rotateY(t){return this.rotateOnAxis(Wn,t)}rotateZ(t){return this.rotateOnAxis(Hn,t)}translateOnAxis(t,e){return Bn.copy(t).applyQuaternion(this.quaternion),this.position.add(Bn.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(qn,t)}translateY(t){return this.translateOnAxis(Wn,t)}translateZ(t){return this.translateOnAxis(Hn,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Vn.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?Nn.copy(t):Nn.set(t,e,i);const r=this.parent;this.updateWorldMatrix(!0,!1),Dn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Vn.lookAt(Dn,Nn,this.up):Vn.lookAt(Nn,Dn,this.up),this.quaternion.setFromRotationMatrix(Vn),r&&(Vn.extractRotation(r.matrixWorld),Fn.setFromRotationMatrix(Vn),this.quaternion.premultiply(Fn.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(jn),Yn.child=t,this.dispatchEvent(Yn),Yn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Xn),Zn.child=t,this.dispatchEvent(Zn),Zn.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Vn.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Vn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Vn),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(jn),Yn.child=t,this.dispatchEvent(Yn),Yn.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,r=this.children.length;i<r;i++){const r=this.children[i].getObjectByProperty(t,e);if(void 0!==r)return r}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const r=this.children;for(let s=0,n=r.length;s<n;s++)r[s].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Dn,t,Un),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Dn,Ln,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,r=e.length;i<r;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,r=e.length;i<r;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,r=e.length;i<r;i++){e[i].updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){t[e].updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const r={};function s(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),!0===this.castShadow&&(r.castShadow=!0),!0===this.receiveShadow&&(r.receiveShadow=!0),!1===this.visible&&(r.visible=!1),!1===this.frustumCulled&&(r.frustumCulled=!1),0!==this.renderOrder&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map((t=>({...t,boundingBox:t.boundingBox?{min:t.boundingBox.min.toArray(),max:t.boundingBox.max.toArray()}:void 0,boundingSphere:t.boundingSphere?{radius:t.boundingSphere.radius,center:t.boundingSphere.center.toArray()}:void 0}))),r.instanceInfo=this._instanceInfo.map((t=>({...t}))),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(t),r.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(r.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(r.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),null!==this.boundingBox&&(r.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(r.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,r=i.length;e<r;e++){const r=i[e];s(t.shapes,r)}else s(t.shapes,i)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(s(t.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,r=this.material.length;i<r;i++)e.push(s(t.materials,this.material[i]));r.material=e}else r.material=s(t.materials,this.material);if(this.children.length>0){r.children=[];for(let e=0;e<this.children.length;e++)r.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){r.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];r.animations.push(s(t.animations,i))}}if(e){const e=n(t.geometries),r=n(t.materials),s=n(t.textures),a=n(t.images),o=n(t.shapes),h=n(t.skeletons),u=n(t.animations),l=n(t.nodes);e.length>0&&(i.geometries=e),r.length>0&&(i.materials=r),s.length>0&&(i.textures=s),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),h.length>0&&(i.skeletons=h),u.length>0&&(i.animations=u),l.length>0&&(i.nodes=l)}return i.object=r,i;function n(t){const e=[];for(const i in t){const r=t[i];delete r.metadata,e.push(r)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}Jn.DEFAULT_UP=new js(0,1,0),Jn.DEFAULT_MATRIX_AUTO_UPDATE=!0,Jn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const Gn=new js,Qn=new js,$n=new js,Kn=new js,ta=new js,ea=new js,ia=new js,ra=new js,sa=new js,na=new js,aa=new Ws,oa=new Ws,ha=new Ws;class ua{constructor(t=new js,e=new js,i=new js){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,r){r.subVectors(i,e),Gn.subVectors(t,e),r.cross(Gn);const s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(t,e,i,r,s){Gn.subVectors(r,e),Qn.subVectors(i,e),$n.subVectors(t,e);const n=Gn.dot(Gn),a=Gn.dot(Qn),o=Gn.dot($n),h=Qn.dot(Qn),u=Qn.dot($n),l=n*h-a*a;if(0===l)return s.set(0,0,0),null;const c=1/l,d=(h*o-a*u)*c,p=(n*u-a*o)*c;return s.set(1-d-p,p,d)}static containsPoint(t,e,i,r){return null!==this.getBarycoord(t,e,i,r,Kn)&&(Kn.x>=0&&Kn.y>=0&&Kn.x+Kn.y<=1)}static getInterpolation(t,e,i,r,s,n,a,o){return null===this.getBarycoord(t,e,i,r,Kn)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(s,Kn.x),o.addScaledVector(n,Kn.y),o.addScaledVector(a,Kn.z),o)}static getInterpolatedAttribute(t,e,i,r,s,n){return aa.setScalar(0),oa.setScalar(0),ha.setScalar(0),aa.fromBufferAttribute(t,e),oa.fromBufferAttribute(t,i),ha.fromBufferAttribute(t,r),n.setScalar(0),n.addScaledVector(aa,s.x),n.addScaledVector(oa,s.y),n.addScaledVector(ha,s.z),n}static isFrontFacing(t,e,i,r){return Gn.subVectors(i,e),Qn.subVectors(t,e),Gn.cross(Qn).dot(r)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,r){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[r]),this}setFromAttributeAndIndices(t,e,i,r){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,r),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Gn.subVectors(this.c,this.b),Qn.subVectors(this.a,this.b),.5*Gn.cross(Qn).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return ua.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return ua.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,r,s){return ua.getInterpolation(t,this.a,this.b,this.c,e,i,r,s)}containsPoint(t){return ua.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return ua.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,r=this.b,s=this.c;let n,a;ta.subVectors(r,i),ea.subVectors(s,i),ra.subVectors(t,i);const o=ta.dot(ra),h=ea.dot(ra);if(o<=0&&h<=0)return e.copy(i);sa.subVectors(t,r);const u=ta.dot(sa),l=ea.dot(sa);if(u>=0&&l<=u)return e.copy(r);const c=o*l-u*h;if(c<=0&&o>=0&&u<=0)return n=o/(o-u),e.copy(i).addScaledVector(ta,n);na.subVectors(t,s);const d=ta.dot(na),p=ea.dot(na);if(p>=0&&d<=p)return e.copy(s);const m=d*h-o*p;if(m<=0&&h>=0&&p<=0)return a=h/(h-p),e.copy(i).addScaledVector(ea,a);const f=u*p-d*l;if(f<=0&&l-u>=0&&d-p>=0)return ia.subVectors(s,r),a=(l-u)/(l-u+(d-p)),e.copy(r).addScaledVector(ia,a);const y=1/(f+m+c);return n=m*y,a=c*y,e.copy(i).addScaledVector(ta,n).addScaledVector(ea,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const la={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ca={h:0,s:0,l:0},da={h:0,s:0,l:0};function pa(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class ma{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=ls){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Ps.toWorkingColorSpace(this,e),this}setRGB(t,e,i,r=Ps.workingColorSpace){return this.r=t,this.g=e,this.b=i,Ps.toWorkingColorSpace(this,r),this}setHSL(t,e,i,r=Ps.workingColorSpace){if(t=ws(t,1),e=bs(e,0,1),i=bs(i,0,1),0===e)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+e):i+e-i*e,s=2*i-r;this.r=pa(s,r,t+1/3),this.g=pa(s,r,t),this.b=pa(s,r,t-1/3)}return Ps.toWorkingColorSpace(this,r),this}setStyle(t,e=ls){function i(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(t)){let s;const n=r[1],a=r[2];switch(n){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,e);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,e);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=r[1],s=i.length;if(3===s)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===s)return this.setHex(parseInt(i,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=ls){const i=la[t.toLowerCase()];return void 0!==i?this.setHex(i,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Rs(t.r),this.g=Rs(t.g),this.b=Rs(t.b),this}copyLinearToSRGB(t){return this.r=Bs(t.r),this.g=Bs(t.g),this.b=Bs(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=ls){return Ps.fromWorkingColorSpace(fa.copy(this),t),65536*Math.round(bs(255*fa.r,0,255))+256*Math.round(bs(255*fa.g,0,255))+Math.round(bs(255*fa.b,0,255))}getHexString(t=ls){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Ps.workingColorSpace){Ps.fromWorkingColorSpace(fa.copy(this),e);const i=fa.r,r=fa.g,s=fa.b,n=Math.max(i,r,s),a=Math.min(i,r,s);let o,h;const u=(a+n)/2;if(a===n)o=0,h=0;else{const t=n-a;switch(h=u<=.5?t/(n+a):t/(2-n-a),n){case i:o=(r-s)/t+(r<s?6:0);break;case r:o=(s-i)/t+2;break;case s:o=(i-r)/t+4}o/=6}return t.h=o,t.s=h,t.l=u,t}getRGB(t,e=Ps.workingColorSpace){return Ps.fromWorkingColorSpace(fa.copy(this),e),t.r=fa.r,t.g=fa.g,t.b=fa.b,t}getStyle(t=ls){Ps.fromWorkingColorSpace(fa.copy(this),t);const e=fa.r,i=fa.g,r=fa.b;return t!==ls?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${r.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*r)})`}offsetHSL(t,e,i){return this.getHSL(ca),this.setHSL(ca.h+t,ca.s+e,ca.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(ca),t.getHSL(da);const i=Ms(ca.h,da.h,e),r=Ms(ca.s,da.s,e),s=Ms(ca.l,da.l,e);return this.setHSL(i,r,s),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,r=this.b,s=t.elements;return this.r=s[0]*e+s[3]*i+s[6]*r,this.g=s[1]*e+s[4]*i+s[7]*r,this.b=s[2]*e+s[5]*i+s[8]*r,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const fa=new ma;ma.NAMES=la;let ya=0;class ga extends xs{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ya++}),this.uuid=vs(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=100,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new ma(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ms,this.stencilZFail=ms,this.stencilZPass=ms,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const r=this[e];void 0!==r?r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[e]=i:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function r(t){const e=[];for(const i in t){const r=t[i];delete r.metadata,e.push(r)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),100!==this.blendEquation&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ms&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ms&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ms&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){const e=r(t.textures),s=r(t.images);e.length>0&&(i.textures=e),s.length>0&&(i.images=s)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let r=0;r!==t;++r)i[r]=e[r].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class xa extends ga{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ma(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new In,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,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.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),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.fog=t.fog,this}}const _a=new js,va=new zs;let ba=0;class wa{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:ba++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=fs,this.updateRanges=[],this.gpuType=rs,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[t+r]=e.array[i+r];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)va.fromBufferAttribute(this,e),va.applyMatrix3(t),this.setXY(e,va.x,va.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)_a.fromBufferAttribute(this,e),_a.applyMatrix3(t),this.setXYZ(e,_a.x,_a.y,_a.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)_a.fromBufferAttribute(this,e),_a.applyMatrix4(t),this.setXYZ(e,_a.x,_a.y,_a.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)_a.fromBufferAttribute(this,e),_a.applyNormalMatrix(t),this.setXYZ(e,_a.x,_a.y,_a.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)_a.fromBufferAttribute(this,e),_a.transformDirection(t),this.setXYZ(e,_a.x,_a.y,_a.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=Ts(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=Ss(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=Ts(e,this.array)),e}setX(t,e){return this.normalized&&(e=Ss(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=Ts(e,this.array)),e}setY(t,e){return this.normalized&&(e=Ss(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=Ts(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Ss(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=Ts(e,this.array)),e}setW(t,e){return this.normalized&&(e=Ss(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=Ss(e,this.array),i=Ss(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,r){return t*=this.itemSize,this.normalized&&(e=Ss(e,this.array),i=Ss(i,this.array),r=Ss(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=r,this}setXYZW(t,e,i,r,s){return t*=this.itemSize,this.normalized&&(e=Ss(e,this.array),i=Ss(i,this.array),r=Ss(r,this.array),s=Ss(s,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=r,this.array[t+3]=s,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==fs&&(t.usage=this.usage),t}}class Ma extends wa{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class Ta extends wa{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class Sa extends wa{constructor(t,e,i){super(new Float32Array(t),e,i)}}let za=0;const Aa=new wn,ka=new Jn,Ca=new js,Ea=new Zs,Oa=new Zs,Ia=new js;class Pa extends xs{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:za++}),this.uuid=vs(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(function(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}(t)?Ta:Ma)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new As).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const r=this.attributes.tangent;return void 0!==r&&(r.transformDirection(t),r.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Aa.makeRotationFromQuaternion(t),this.applyMatrix4(Aa),this}rotateX(t){return Aa.makeRotationX(t),this.applyMatrix4(Aa),this}rotateY(t){return Aa.makeRotationY(t),this.applyMatrix4(Aa),this}rotateZ(t){return Aa.makeRotationZ(t),this.applyMatrix4(Aa),this}translate(t,e,i){return Aa.makeTranslation(t,e,i),this.applyMatrix4(Aa),this}scale(t,e,i){return Aa.makeScale(t,e,i),this.applyMatrix4(Aa),this}lookAt(t){return ka.lookAt(t),ka.updateMatrix(),this.applyMatrix4(ka.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ca).negate(),this.translate(Ca.x,Ca.y,Ca.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let i=0,r=t.length;i<r;i++){const r=t[i];e.push(r.x,r.y,r.z||0)}this.setAttribute("position",new Sa(e,3))}else{const i=Math.min(t.length,e.count);for(let r=0;r<i;r++){const i=t[r];e.setXYZ(r,i.x,i.y,i.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Zs);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new js(-1/0,-1/0,-1/0),new js(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Ea.setFromBufferAttribute(i),this.morphTargetsRelative?(Ia.addVectors(this.boundingBox.min,Ea.min),this.boundingBox.expandByPoint(Ia),Ia.addVectors(this.boundingBox.max,Ea.max),this.boundingBox.expandByPoint(Ia)):(this.boundingBox.expandByPoint(Ea.min),this.boundingBox.expandByPoint(Ea.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new pn);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new js,1/0);if(t){const i=this.boundingSphere.center;if(Ea.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];Oa.setFromBufferAttribute(i),this.morphTargetsRelative?(Ia.addVectors(Ea.min,Oa.min),Ea.expandByPoint(Ia),Ia.addVectors(Ea.max,Oa.max),Ea.expandByPoint(Ia)):(Ea.expandByPoint(Oa.min),Ea.expandByPoint(Oa.max))}Ea.getCenter(i);let r=0;for(let e=0,s=t.count;e<s;e++)Ia.fromBufferAttribute(t,e),r=Math.max(r,i.distanceToSquared(Ia));if(e)for(let s=0,n=e.length;s<n;s++){const n=e[s],a=this.morphTargetsRelative;for(let e=0,s=n.count;e<s;e++)Ia.fromBufferAttribute(n,e),a&&(Ca.fromBufferAttribute(t,e),Ia.add(Ca)),r=Math.max(r,i.distanceToSquared(Ia))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=e.position,r=e.normal,s=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new wa(new Float32Array(4*i.count),4));const n=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<i.count;t++)a[t]=new js,o[t]=new js;const h=new js,u=new js,l=new js,c=new zs,d=new zs,p=new zs,m=new js,f=new js;function y(t,e,r){h.fromBufferAttribute(i,t),u.fromBufferAttribute(i,e),l.fromBufferAttribute(i,r),c.fromBufferAttribute(s,t),d.fromBufferAttribute(s,e),p.fromBufferAttribute(s,r),u.sub(h),l.sub(h),d.sub(c),p.sub(c);const n=1/(d.x*p.y-p.x*d.y);isFinite(n)&&(m.copy(u).multiplyScalar(p.y).addScaledVector(l,-d.y).multiplyScalar(n),f.copy(l).multiplyScalar(d.x).addScaledVector(u,-p.x).multiplyScalar(n),a[t].add(m),a[e].add(m),a[r].add(m),o[t].add(f),o[e].add(f),o[r].add(f))}let g=this.groups;0===g.length&&(g=[{start:0,count:t.count}]);for(let e=0,i=g.length;e<i;++e){const i=g[e],r=i.start;for(let e=r,s=r+i.count;e<s;e+=3)y(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const x=new js,_=new js,v=new js,b=new js;function w(t){v.fromBufferAttribute(r,t),b.copy(v);const e=a[t];x.copy(e),x.sub(v.multiplyScalar(v.dot(e))).normalize(),_.crossVectors(b,e);const i=_.dot(o[t])<0?-1:1;n.setXYZW(t,x.x,x.y,x.z,i)}for(let e=0,i=g.length;e<i;++e){const i=g[e],r=i.start;for(let e=r,s=r+i.count;e<s;e+=3)w(t.getX(e+0)),w(t.getX(e+1)),w(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new wa(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const r=new js,s=new js,n=new js,a=new js,o=new js,h=new js,u=new js,l=new js;if(t)for(let c=0,d=t.count;c<d;c+=3){const d=t.getX(c+0),p=t.getX(c+1),m=t.getX(c+2);r.fromBufferAttribute(e,d),s.fromBufferAttribute(e,p),n.fromBufferAttribute(e,m),u.subVectors(n,s),l.subVectors(r,s),u.cross(l),a.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),h.fromBufferAttribute(i,m),a.add(u),o.add(u),h.add(u),i.setXYZ(d,a.x,a.y,a.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(m,h.x,h.y,h.z)}else for(let t=0,a=e.count;t<a;t+=3)r.fromBufferAttribute(e,t+0),s.fromBufferAttribute(e,t+1),n.fromBufferAttribute(e,t+2),u.subVectors(n,s),l.subVectors(r,s),u.cross(l),i.setXYZ(t+0,u.x,u.y,u.z),i.setXYZ(t+1,u.x,u.y,u.z),i.setXYZ(t+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)Ia.fromBufferAttribute(t,e),Ia.normalize(),t.setXYZ(e,Ia.x,Ia.y,Ia.z)}toNonIndexed(){function t(t,e){const i=t.array,r=t.itemSize,s=t.normalized,n=new i.constructor(e.length*r);let a=0,o=0;for(let s=0,h=e.length;s<h;s++){a=t.isInterleavedBufferAttribute?e[s]*t.data.stride+t.offset:e[s]*r;for(let t=0;t<r;t++)n[o++]=i[a++]}return new wa(n,r,s)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Pa,i=this.index.array,r=this.attributes;for(const s in r){const n=t(r[s],i);e.setAttribute(s,n)}const s=this.morphAttributes;for(const r in s){const n=[],a=s[r];for(let e=0,r=a.length;e<r;e++){const r=t(a[e],i);n.push(r)}e.morphAttributes[r]=n}e.morphTargetsRelative=this.morphTargetsRelative;const n=this.groups;for(let t=0,i=n.length;t<i;t++){const i=n[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const r=i[e];t.data.attributes[e]=r.toJSON(t.data)}const r={};let s=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],n=[];for(let e=0,r=i.length;e<r;e++){const r=i[e];n.push(r.toJSON(t.data))}n.length>0&&(r[e]=n,s=!0)}s&&(t.data.morphAttributes=r,t.data.morphTargetsRelative=this.morphTargetsRelative);const n=this.groups;n.length>0&&(t.data.groups=JSON.parse(JSON.stringify(n)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone());const r=t.attributes;for(const t in r){const i=r[t];this.setAttribute(t,i.clone(e))}const s=t.morphAttributes;for(const t in s){const i=[],r=s[t];for(let t=0,s=r.length;t<s;t++)i.push(r[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const n=t.groups;for(let t=0,e=n.length;t<e;t++){const e=n[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Ra=new wn,Ba=new bn,Fa=new pn,Va=new js,Na=new js,Da=new js,Ua=new js,La=new js,qa=new js,Wa=new js,Ha=new js;class ja extends Jn{constructor(t=new Pa,e=new xa){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,n=i.morphTargetsRelative;e.fromBufferAttribute(r,t);const a=this.morphTargetInfluences;if(s&&a){qa.set(0,0,0);for(let i=0,r=s.length;i<r;i++){const r=a[i],o=s[i];0!==r&&(La.fromBufferAttribute(o,t),n?qa.addScaledVector(La,r):qa.addScaledVector(La.sub(e),r))}e.add(qa)}return e}raycast(t,e){const i=this.geometry,r=this.material,s=this.matrixWorld;if(void 0!==r){if(null===i.boundingSphere&&i.computeBoundingSphere(),Fa.copy(i.boundingSphere),Fa.applyMatrix4(s),Ba.copy(t.ray).recast(t.near),!1===Fa.containsPoint(Ba.origin)){if(null===Ba.intersectSphere(Fa,Va))return;if(Ba.origin.distanceToSquared(Va)>(t.far-t.near)**2)return}Ra.copy(s).invert(),Ba.copy(t.ray).applyMatrix4(Ra),null!==i.boundingBox&&!1===Ba.intersectsBox(i.boundingBox)||this._computeIntersections(t,e,Ba)}}_computeIntersections(t,e,i){let r;const s=this.geometry,n=this.material,a=s.index,o=s.attributes.position,h=s.attributes.uv,u=s.attributes.uv1,l=s.attributes.normal,c=s.groups,d=s.drawRange;if(null!==a)if(Array.isArray(n))for(let s=0,o=c.length;s<o;s++){const o=c[s],p=n[o.materialIndex];for(let s=Math.max(o.start,d.start),n=Math.min(a.count,Math.min(o.start+o.count,d.start+d.count));s<n;s+=3){r=Xa(this,p,t,i,h,u,l,a.getX(s),a.getX(s+1),a.getX(s+2)),r&&(r.faceIndex=Math.floor(s/3),r.face.materialIndex=o.materialIndex,e.push(r))}}else{for(let s=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);s<o;s+=3){r=Xa(this,n,t,i,h,u,l,a.getX(s),a.getX(s+1),a.getX(s+2)),r&&(r.faceIndex=Math.floor(s/3),e.push(r))}}else if(void 0!==o)if(Array.isArray(n))for(let s=0,a=c.length;s<a;s++){const a=c[s],p=n[a.materialIndex];for(let s=Math.max(a.start,d.start),n=Math.min(o.count,Math.min(a.start+a.count,d.start+d.count));s<n;s+=3){r=Xa(this,p,t,i,h,u,l,s,s+1,s+2),r&&(r.faceIndex=Math.floor(s/3),r.face.materialIndex=a.materialIndex,e.push(r))}}else{for(let s=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);s<a;s+=3){r=Xa(this,n,t,i,h,u,l,s,s+1,s+2),r&&(r.faceIndex=Math.floor(s/3),e.push(r))}}}}function Xa(t,e,i,r,s,n,a,o,h,u){t.getVertexPosition(o,Na),t.getVertexPosition(h,Da),t.getVertexPosition(u,Ua);const l=function(t,e,i,r,s,n,a,o){let h;if(h=1===e.side?r.intersectTriangle(a,n,s,!0,o):r.intersectTriangle(s,n,a,0===e.side,o),null===h)return null;Ha.copy(o),Ha.applyMatrix4(t.matrixWorld);const u=i.ray.origin.distanceTo(Ha);return u<i.near||u>i.far?null:{distance:u,point:Ha.clone(),object:t}}(t,e,i,r,Na,Da,Ua,Wa);if(l){const t=new js;ua.getBarycoord(Wa,Na,Da,Ua,t),s&&(l.uv=ua.getInterpolatedAttribute(s,o,h,u,t,new zs)),n&&(l.uv1=ua.getInterpolatedAttribute(n,o,h,u,t,new zs)),a&&(l.normal=ua.getInterpolatedAttribute(a,o,h,u,t,new js),l.normal.dot(r.direction)>0&&l.normal.multiplyScalar(-1));const e={a:o,b:h,c:u,normal:new js,materialIndex:0};ua.getNormal(Na,Da,Ua,e.normal),l.face=e,l.barycoord=t}return l}function Ya(t){const e={};for(const i in t){e[i]={};for(const r in t[i]){const s=t[i][r];s&&(s.isColor||s.isMatrix3||s.isMatrix4||s.isVector2||s.isVector3||s.isVector4||s.isTexture||s.isQuaternion)?s.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[i][r]=null):e[i][r]=s.clone():Array.isArray(s)?e[i][r]=s.slice():e[i][r]=s}}return e}class Za extends ga{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=Ya(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const r=this.uniforms[i].value;r&&r.isTexture?e.uniforms[i]={type:"t",value:r.toJSON(t).uuid}:r&&r.isColor?e.uniforms[i]={type:"c",value:r.getHex()}:r&&r.isVector2?e.uniforms[i]={type:"v2",value:r.toArray()}:r&&r.isVector3?e.uniforms[i]={type:"v3",value:r.toArray()}:r&&r.isVector4?e.uniforms[i]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?e.uniforms[i]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?e.uniforms[i]={type:"m4",value:r.toArray()}:e.uniforms[i]={value:r}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class Ja extends Pa{constructor(t=1,e=1,i=1,r=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:r};const s=t/2,n=e/2,a=Math.floor(i),o=Math.floor(r),h=a+1,u=o+1,l=t/a,c=e/o,d=[],p=[],m=[],f=[];for(let t=0;t<u;t++){const e=t*c-n;for(let i=0;i<h;i++){const r=i*l-s;p.push(r,-e,0),m.push(0,0,1),f.push(i/a),f.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<a;e++){const i=e+h*t,r=e+h*(t+1),s=e+1+h*(t+1),n=e+1+h*t;d.push(i,r,n),d.push(r,s,n)}this.setIndex(d),this.setAttribute("position",new Sa(p,3)),this.setAttribute("normal",new Sa(m,3)),this.setAttribute("uv",new Sa(f,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ja(t.width,t.height,t.widthSegments,t.heightSegments)}}function Ga(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function Qa(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}class $a{constructor(t,e,i,r){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==r?r:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,r=e[i],s=e[i-1];t:{e:{let n;i:{r:if(!(t<r)){for(let n=i+2;;){if(void 0===r){if(t<s)break r;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===n)break;if(s=r,r=e[++i],t<r)break e}n=e.length;break i}if(t>=s)break t;{const a=e[1];t<a&&(i=2,s=a);for(let n=i-2;;){if(void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(i===n)break;if(r=s,s=e[--i-1],t>=s)break e}n=i,i=0}}for(;i<n;){const r=i+n>>>1;t<e[r]?n=r:i=r+1}if(r=e[i],s=e[i-1],void 0===s)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===r)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,t,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=t*r;for(let t=0;t!==r;++t)e[t]=i[s+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Ka extends $a{constructor(t,e,i,r){super(t,e,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:os,endingEnd:os}}intervalChanged_(t,e,i){const r=this.parameterPositions;let s=t-2,n=t+1,a=r[s],o=r[n];if(void 0===a)switch(this.getSettings_().endingStart){case hs:s=t,a=2*e-i;break;case us:s=r.length-2,a=e+r[s]-r[s+1];break;default:s=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case hs:n=t,o=2*i-e;break;case us:n=1,o=i+r[1]-r[0];break;default:n=t-1,o=e}const h=.5*(i-e),u=this.valueSize;this._weightPrev=h/(e-a),this._weightNext=h/(o-i),this._offsetPrev=s*u,this._offsetNext=n*u}interpolate_(t,e,i,r){const s=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,u=this._offsetPrev,l=this._offsetNext,c=this._weightPrev,d=this._weightNext,p=(i-e)/(r-e),m=p*p,f=m*p,y=-c*f+2*c*m-c*p,g=(1+c)*f+(-1.5-2*c)*m+(-.5+c)*p+1,x=(-1-d)*f+(1.5+d)*m+.5*p,_=d*f-d*m;for(let t=0;t!==a;++t)s[t]=y*n[u+t]+g*n[h+t]+x*n[o+t]+_*n[l+t];return s}}class to extends $a{constructor(t,e,i,r){super(t,e,i,r)}interpolate_(t,e,i,r){const s=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=t*a,h=o-a,u=(i-e)/(r-e),l=1-u;for(let t=0;t!==a;++t)s[t]=n[h+t]*l+n[o+t]*u;return s}}class eo extends $a{constructor(t,e,i,r){super(t,e,i,r)}interpolate_(t){return this.copySampleValue_(t-1)}}class io{constructor(t,e,i,r){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ga(e,this.TimeBufferType),this.values=Ga(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Ga(t.times,Array),values:Ga(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new eo(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new to(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Ka(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ss:e=this.InterpolantFactoryMethodDiscrete;break;case ns:e=this.InterpolantFactoryMethodLinear;break;case as:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ss;case this.InterpolantFactoryMethodLinear:return ns;case this.InterpolantFactoryMethodSmooth:return as}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,r=e.length;i!==r;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,r=e.length;i!==r;++i)e[i]*=t}return this}trim(t,e){const i=this.times,r=i.length;let s=0,n=r-1;for(;s!==r&&i[s]<t;)++s;for(;-1!==n&&i[n]>e;)--n;if(++n,0!==s||n!==r){s>=n&&(n=Math.max(n,1),s=n-1);const t=this.getValueSize();this.times=i.slice(s,n),this.values=this.values.slice(s*t,n*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,r=this.values,s=i.length;0===s&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let n=null;for(let e=0;e!==s;e++){const r=i[e];if("number"==typeof r&&isNaN(r)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,r),t=!1;break}if(null!==n&&n>r){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,r,n),t=!1;break}n=r}if(void 0!==r&&Qa(r))for(let e=0,i=r.length;e!==i;++e){const i=r[e];if(isNaN(i)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===as,s=t.length-1;let n=1;for(let a=1;a<s;++a){let s=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(r)s=!0;else{const t=a*i,r=t-i,n=t+i;for(let a=0;a!==i;++a){const i=e[t+a];if(i!==e[r+a]||i!==e[n+a]){s=!0;break}}}if(s){if(a!==n){t[n]=t[a];const r=a*i,s=n*i;for(let t=0;t!==i;++t)e[s+t]=e[r+t]}++n}}if(s>0){t[n]=t[s];for(let t=s*i,r=n*i,a=0;a!==i;++a)e[r+a]=e[t+a];++n}return n!==t.length?(this.times=t.slice(0,n),this.values=e.slice(0,n*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}io.prototype.ValueTypeName="",io.prototype.TimeBufferType=Float32Array,io.prototype.ValueBufferType=Float32Array,io.prototype.DefaultInterpolation=ns;class ro extends io{constructor(t,e,i){super(t,e,i)}}ro.prototype.ValueTypeName="bool",ro.prototype.ValueBufferType=Array,ro.prototype.DefaultInterpolation=ss,ro.prototype.InterpolantFactoryMethodLinear=void 0,ro.prototype.InterpolantFactoryMethodSmooth=void 0;class so extends io{constructor(t,e,i,r){super(t,e,i,r)}}so.prototype.ValueTypeName="color";class no extends io{constructor(t,e,i,r){super(t,e,i,r)}}no.prototype.ValueTypeName="number";class ao extends $a{constructor(t,e,i,r){super(t,e,i,r)}interpolate_(t,e,i,r){const s=this.resultBuffer,n=this.sampleValues,a=this.valueSize,o=(i-e)/(r-e);let h=t*a;for(let t=h+a;h!==t;h+=4)Hs.slerpFlat(s,0,n,h-a,n,h,o);return s}}class oo extends io{constructor(t,e,i,r){super(t,e,i,r)}InterpolantFactoryMethodLinear(t){return new ao(this.times,this.values,this.getValueSize(),t)}}oo.prototype.ValueTypeName="quaternion",oo.prototype.InterpolantFactoryMethodSmooth=void 0;class ho extends io{constructor(t,e,i){super(t,e,i)}}ho.prototype.ValueTypeName="string",ho.prototype.ValueBufferType=Array,ho.prototype.DefaultInterpolation=ss,ho.prototype.InterpolantFactoryMethodLinear=void 0,ho.prototype.InterpolantFactoryMethodSmooth=void 0;class uo extends io{constructor(t,e,i,r){super(t,e,i,r)}}uo.prototype.ValueTypeName="vector";const lo={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class co{constructor(t,e,i){const r=this;let s,n=!1,a=0,o=0;const h=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this.itemStart=function(t){o++,!1===n&&void 0!==r.onStart&&r.onStart(t,a,o),n=!0},this.itemEnd=function(t){a++,void 0!==r.onProgress&&r.onProgress(t,a,o),a===o&&(n=!1,void 0!==r.onLoad&&r.onLoad())},this.itemError=function(t){void 0!==r.onError&&r.onError(t)},this.resolveURL=function(t){return s?s(t):t},this.setURLModifier=function(t){return s=t,this},this.addHandler=function(t,e){return h.push(t,e),this},this.removeHandler=function(t){const e=h.indexOf(t);return-1!==e&&h.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=h.length;e<i;e+=2){const i=h[e],r=h[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return r}return null}}}const po=new co;class mo{constructor(t){this.manager=void 0!==t?t:po,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const i=this;return new Promise((function(r,s){i.load(t,r,e,s)}))}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}}mo.DEFAULT_MATERIAL_NAME="__DEFAULT";Error;class fo extends mo{constructor(t){super(t)}load(t,e,i,r){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const s=this,n=lo.get(t);if(void 0!==n)return s.manager.itemStart(t),setTimeout((function(){e&&e(n),s.manager.itemEnd(t)}),0),n;const a=Cs("img");function o(){u(),lo.add(t,this),e&&e(this),s.manager.itemEnd(t)}function h(e){u(),r&&r(e),s.manager.itemError(t),s.manager.itemEnd(t)}function u(){a.removeEventListener("load",o,!1),a.removeEventListener("error",h,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",h,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(t),a.src=t,a}}class yo extends mo{constructor(t){super(t)}load(t,e,i,r){const s=new qs,n=new fo(this.manager);return n.setCrossOrigin(this.crossOrigin),n.setPath(this.path),n.load(t,(function(t){s.image=t,s.needsUpdate=!0,void 0!==e&&e(s)}),i,r),s}}const go="\\[\\]\\.:\\/",xo=new RegExp("["+go+"]","g"),_o="[^"+go+"]",vo="[^"+go.replace("\\.","")+"]",bo=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",_o)+/(WCOD+)?/.source.replace("WCOD",vo)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_o)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_o)+"$"),wo=["material","materials","bones","map"];class Mo{constructor(t,e,i){this.path=e,this.parsedPath=i||Mo.parseTrackName(e),this.node=Mo.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new Mo.Composite(t,e,i):new Mo(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(xo,"")}static parseTrackName(t){const e=bo.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==r&&-1!==r){const t=i.nodeName.substring(r+1);-1!==wo.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let r=0;r<t.length;r++){const s=t[r];if(s.name===e||s.uuid===e)return s;const n=i(s.children);if(n)return n}return null},r=i(t.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)t[e++]=i[r]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,r=e.propertyName;let s=e.propertyIndex;if(t||(t=Mo.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(i){let r=e.objectIndex;switch(i){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 e=0;e<t.length;e++)if(t[e].name===r){r=e;break}break;case"map":if("map"in t){t=t.map;break}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.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==r){if(void 0===t[r])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[r]}}const n=t[r];if(void 0===n){const i=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+i+"."+r+" but it wasn't found.",t)}let a=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?a=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==s){if("morphTargetInfluences"===r){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.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[s]&&(s=t.morphTargetDictionary[s])}o=this.BindingType.ArrayElement,this.resolvedProperty=n,this.propertyIndex=s}else void 0!==n.fromArray&&void 0!==n.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=n):Array.isArray(n)?(o=this.BindingType.EntireArray,this.resolvedProperty=n):this.propertyName=r;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}Mo.Composite=class{constructor(t,e,i){const r=i||Mo.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,r)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,r=this._bindings[i];void 0!==r&&r.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},Mo.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Mo.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},Mo.prototype.GetterByBindingType=[Mo.prototype._getValue_direct,Mo.prototype._getValue_array,Mo.prototype._getValue_arrayElement,Mo.prototype._getValue_toArray],Mo.prototype.SetterByBindingTypeAndVersioning=[[Mo.prototype._setValue_direct,Mo.prototype._setValue_direct_setNeedsUpdate,Mo.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Mo.prototype._setValue_array,Mo.prototype._setValue_array_setNeedsUpdate,Mo.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Mo.prototype._setValue_arrayElement,Mo.prototype._setValue_arrayElement_setNeedsUpdate,Mo.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Mo.prototype._setValue_fromArray,Mo.prototype._setValue_fromArray_setNeedsUpdate,Mo.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];new Float32Array(1);"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"176"}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="176");const To=({container:t,image:e,speed:i=.05,strength:r=.02,hover:s=!1,light:a,p:o=0})=>{if(!e)return void console.log("No image provided");(new yo).load(e.src,(e=>{const h={uImage:{value:e},uTime:{value:0},uStrength:{value:s?0:r},uLight:{value:a}},u=n(t.clientWidth,t.clientHeight);let l;function c(){l&&(u.Scene.remove(l),l.geometry.dispose(),l.material.dispose()),l=function(){const e=t.clientWidth,i=t.clientHeight,r=new Ja(e/i*2.3,2.3,100,100),s=new Za({vertexShader:"\nprecision highp float;\n varying vec2 vUv;\n varying vec3 pos;\n uniform float uTime;\n uniform float uStrength;\n\n void main() {\n \n vUv = uv;\n \n vec3 newPosition = position;\n\n \n float waveX = uStrength * sin(10.0 * uv.y + uTime * 2.0);\n float waveY = uStrength * cos(12.0 * uv.x + uTime * 1.5);\n \n float waveZ = uStrength * sin(10.0 * uv.x + uTime * 2.5);\n\n newPosition.x += waveX;\n newPosition.y += waveY;\n newPosition.z += waveZ;\n\n pos = (modelViewMatrix * vec4(newPosition, 1.0)).xyz;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);\n }",fragmentShader:"\nprecision highp float;\n\nvarying vec2 vUv;\nuniform sampler2D uImage;\nuniform float uTime;\n\nuniform float uStrength;\nuniform bool uLight;\n\n\nvoid main() {\n vec2 uv = vUv;\n \n\n \n \n\n // Apply wave distortion\n float waveX = sin(10.0 * uv.y + uTime * 2.0);\n float waveY = cos(10.0 * uv.x + uTime * 2.0);\n uv.x += (uStrength * 0.05) * waveX;\n uv.y += (uStrength * 0.05) * waveY;\n\n \n\n vec4 color = texture2D(uImage, uv);\n if(uLight){\n color.x+=smoothstep(0.001,0.6,sin(2.0*uTime));\n color.y+=smoothstep(0.2,0.6,sin(0.2*uTime));\n }\n \n gl_FragColor = color;\n}\n",uniforms:h,transparent:!0});return new ja(r,s)}(),u.mesh=l,u.Scene.add(l)}function d(){const e=t.clientWidth,i=t.clientHeight;u.renderer.setSize(e,i),u.renderer.setPixelRatio(window.devicePixelRatio),u.camera.aspect=e/i,u.camera.updateProjectionMatrix(),c()}return u.camera.fov=2*Math.atan(t.clientHeight/2/600)*(180/Math.PI),u.camera.position.z=2.8-o,s&&(t.addEventListener("mouseenter",(()=>{Kr.to(h.uStrength,{value:r,duration:.5,ease:"power2.out"})})),t.addEventListener("mouseleave",(()=>{Kr.to(h.uStrength,{value:0,duration:.5,ease:"power2.out"})}))),t.innerHTML="",t.appendChild(u.renderer.domElement),window.addEventListener("resize",d),d(),function t(){h.uTime.value+=i,u.renderer.render(u.Scene,u.camera),requestAnimationFrame(t)}(),{mesh:u.mesh,geometry:u.geometry,renderer:u.renderer,Scene:u.Scene}}))},So="\nprecision highp float;\nuniform vec2 uMouse;\nvarying vec2 vUv;\nuniform sampler2D uImage;\nuniform float uTime;\nuniform float uRadius;\nuniform float uStrength;\nuniform float uNoise;\nuniform bool uLight;\nuniform sampler2D uImage2;\nfloat rand(float n){return fract(sin(n) * 43758.5453123);}\nfloat rand(vec2 n){return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453123);}\n\nfloat noise(float p){\n float fl = floor(p);\n float fc = fract(p);\n return mix(rand(fl), rand(fl + 1.0), fc);\n}\n \nfloat noise(vec2 n) {\n const vec2 d = vec2(0.0, 1.0);\n vec2 b = floor(n), f = smoothstep(vec2(0.0), vec2(1.0), fract(n));\n return mix(mix(rand(b), rand(b + d.yx), f.x), mix(rand(b + d.xy), rand(b + d.yy), f.x), f.y);\n}\n\nvoid main() {\n vec2 uv = vUv;\n vec2 guv = vUv;\n guv.x -= 0.5;\n guv.y -= 0.5;\n\n // Calculate distance from mouse\n float dist = length(guv - uMouse);\n\n \n float edgeNoise = noise(guv * 10.0 + uTime * 2.0 ) * uNoise;\n\n // Create mask for area following mouse, with wobbly edge\n float inside = step(dist, uRadius *edgeNoise);\n\n // Apply noise only inside the circle\n float n = noise(guv * 0.2);\n\n vec3 circle = mix(vec3(1.0), vec3(n), inside);\n\n // Apply wave distortion\n float waveX = sin(10.0 * uv.y + uTime * 2.0);\n float waveY = cos(10.0 * uv.x + uTime * 2.0);\n uv.x += (uStrength * 0.05) * waveX;\n uv.y += (uStrength * 0.05) * waveY;\n\n \n\n vec4 color = texture2D(uImage, uv);\n \n vec4 color2 = texture2D(uImage2,uv);\n gl_FragColor = mix(color,(vec4(n)+color2),inside);\n}\n",zo="\nprecision highp float;\nvarying vec2 vUv; \n\n void main() { \n vUv = uv; \n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }";function Ao(t,{speed:e=.02,strength:i=.02,radius:r=.02,hover:s=!1,noise:a=.4,p:o=0}={}){let h=Array.from(t.querySelectorAll("img"));if(!h.length)return void console.log("No image provided");const u={uImage:{value:null},uImage2:{value:null},uTime:{value:0},uStrength:{value:s?0:i},uNoise:{value:a},uMouse:{value:new zs(-10,-10)},uRadius:{value:r}},l=new yo;let c,d=[];h.map(((t,e)=>{l.load(t.src,(t=>{c=0,1==e&&(u.uImage2.value=t),0==e&&(u.uImage.value=t),d.push(t)}))}));const p=n(t.clientWidth,t.clientHeight);let m;function f(){m&&(p.Scene.remove(m),m.geometry.dispose(),m.material.dispose()),m=function(){const e=t.clientWidth,i=t.clientHeight,r=new Ja(e/i*2.3,2.3,100,100),s=new Za({vertexShader:zo,fragmentShader:So,uniforms:u,transparent:!0});return new ja(r,s)}(),p.mesh=m,p.Scene.add(m)}function y(){const e=t.clientWidth,i=t.clientHeight;p.renderer.setSize(e,i),p.renderer.setPixelRatio(window.devicePixelRatio),p.camera.aspect=e/i,p.camera.updateProjectionMatrix(),f()}return p.camera.fov=2*Math.atan(t.clientHeight/2/600)*(180/Math.PI),p.camera.position.z=2.8+o,t.addEventListener("mousemove",(function(e){const i=t.getBoundingClientRect(),r=(e.clientX-i.left)/i.width-.5,s=-(e.clientY-i.top)/i.height+.5;Kr.to(u.uMouse.value,{x:r,y:s,duration:.2})})),s&&(t.addEventListener("mouseenter",(()=>{Kr.to(u.uStrength,{value:i,duration:.5,ease:"power2.out"}),Kr.to(u.uRadius,{value:r,duration:.2})})),t.addEventListener("mouseleave",(()=>{Kr.to(u.uStrength,{value:0,duration:.5,ease:"power2.out"}),Kr.to(u.uRadius,{value:-100,duration:.6})}))),t.innerHTML="",t.appendChild(p.renderer.domElement),window.addEventListener("resize",y),y(),function t(){u.uTime.value+=e,p.renderer.render(p.Scene,p.camera),requestAnimationFrame(t)}(),t.addEventListener("click",(()=>{const t=(c+1)%d.length,e=(c+2)%d.length;Kr.to(u.uRadius,{value:2,duration:2,ease:"power2.inOut",onComplete:()=>{u.uImage.value=d[t],u.uImage2.value=d[e],Kr.fromTo(u.uRadius,{value:0},{value:r,duration:2,ease:"power2.inOut"}),c=t}})})),{mesh:p.mesh,geometry:p.geometry,renderer:p.renderer,Scene:p.Scene,currntimageIndex:c}}const ko="\nvarying vec2 vUv;\nuniform float uTime;\nuniform sampler2D uImage;\nuniform sampler2D uImage2;\nuniform float uX;\nuniform float uY;\nvoid main(){\n vec2 uv = vUv;\n float uvScale=uv.x+uY*uv.y; \n vec4 color1 = texture2D(uImage, uv);\n vec4 color2 = texture2D(uImage2, uv);\n uvScale/= 2.0;\n uv.x=step(uTime,fract(uX*1.0*uvScale) );\n gl_FragColor = mix(color2, color1, uv.x);\n}\n",Co="\nvarying vec2 vUv;\nvarying vec3 vPosition;\nvoid main() {\n vUv = uv;\n vPosition = position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";function Eo(t,{x:e=-1,y:i=1,time:r=!1,speed:s=1.2,ttime:a=4,p:o=0,hover:h=!1,target:u=null,ttype:l=0}={}){if(!t)return console.error("No container provided");const c=Array.from(t.querySelectorAll("img"));if(!(c.length>1))return console.error("No images provided, at least two images are required for transition");const d=n(t.clientWidth,t.clientHeight),p={uImage:{value:null},uImage2:{value:null},uTime:{value:0},uStrength:{value:.02},uMouse:{value:new zs(-10,-10)},uX:{value:e},uY:{value:i}},m=new yo;let f,y,g=[];function x(){y&&(d.Scene.remove(y),y.geometry.dispose(),y.material.dispose()),y=function(){const e=t.clientWidth,i=t.clientHeight,r=new Ja(e/i*2.3,2.3,100,100),s=new Za({vertexShader:Co,fragmentShader:ko,uniforms:p,transparent:!0});return new ja(r,s)}(),d.Scene.add(y)}function _(){const e=t.clientWidth,i=t.clientHeight;d.renderer.setSize(e,i),d.renderer.setPixelRatio(window.devicePixelRatio),d.camera.aspect=e/i,d.camera.updateProjectionMatrix(),x()}if(c.map(((t,e)=>{m.load(t.src,(t=>{f=0,1==e&&(p.uImage2.value=t),0==e&&(p.uImage.value=t),g.push(t)}))})),d.camera.fov=2*Math.atan(t.clientHeight/2/600)*(180/Math.PI),d.camera.position.z=2.7-o,_(),window.addEventListener("resize",_,!1),t.innerHTML="",t.appendChild(d.renderer.domElement),r)Kr.to(p.uTime,{value:1,duration:3,repeat:-1,delay:a,repeatDelay:4,onRepeat:()=>{console.log("Transition completed"),p.uTime.value=0,f=(f+1)%g.length,p.uImage.value=g[f],p.uImage2.value=g[(f+1)%g.length]}});else if(h){let e=!1;t.addEventListener("mouseenter",(()=>{e||(e=!0,Kr.to(p.uTime,{value:1,duration:1.2,onComplete:()=>{p.uTime.value=0,f=(f+1)%g.length,p.uImage.value=g[f],p.uImage2.value=g[(f+1)%g.length],e=!1}}))}))}else u&&Array.isArray(u)&&u.length===c.length&&u.forEach(((t,e)=>{let i;i=l?"click":"mouseenter",t.addEventListener(i,(()=>{console.log(i),f!==e&&Kr.to(p.uTime,{value:1,duration:1.2,onComplete:()=>{p.uTime.value=0,f=e,p.uImage.value=g[f],p.uImage2.value=g[(f+1)%g.length]}})}))}));return function t(){d.renderer.render(d.Scene,d.camera),requestAnimationFrame(t)}(),{assets:d,mesh:y,updateMesh:x}}return e})()));
2
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Cherryglsl",[],e):"object"==typeof exports?exports.Cherryglsl=e():t.Cherryglsl=e()}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{CherryWave:()=>zd,ImageTransition1:()=>kd,ImageTransition2:()=>Xd});const n="176",i=0,r=1,a=2,s=100,o=101,l=102,c=200,u=201,h=202,d=203,p=204,f=205,m=206,g=207,_=208,v=209,x=210,y=211,M=212,S=213,T=214,E=0,b=1,w=2,A=3,R=4,C=5,P=6,L=7,D=301,U=302,I=303,N=304,O=306,F=1e3,B=1001,z=1002,V=1003,H=1004,k=1005,G=1006,W=1007,X=1008,j=1009,q=1010,Y=1011,K=1012,Z=1013,J=1014,$=1015,Q=1016,tt=1017,et=1018,nt=1020,it=35902,rt=1023,at=1026,st=1027,ot=1028,lt=1029,ct=1031,ut=1033,ht=33776,dt=33777,pt=33778,ft=33779,mt=35840,gt=35841,_t=35842,vt=35843,xt=36196,yt=37492,Mt=37496,St=37808,Tt=37809,Et=37810,bt=37811,wt=37812,At=37813,Rt=37814,Ct=37815,Pt=37816,Lt=37817,Dt=37818,Ut=37819,It=37820,Nt=37821,Ot=36492,Ft=36494,Bt=36495,zt=36284,Vt=36285,Ht=36286,kt=2300,Gt=2301,Wt=2302,Xt=2400,jt=2401,qt=2402,Yt="",Kt="srgb",Zt="srgb-linear",Jt="linear",$t="srgb",Qt=7680,te=512,ee=513,ne=514,ie=515,re=516,ae=517,se=518,oe=519,le=35044,ce="300 es",ue=2e3,he=2001;class de{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const n=this._listeners;void 0===n[t]&&(n[t]=[]),-1===n[t].indexOf(e)&&n[t].push(e)}hasEventListener(t,e){const n=this._listeners;return void 0!==n&&(void 0!==n[t]&&-1!==n[t].indexOf(e))}removeEventListener(t,e){const n=this._listeners;if(void 0===n)return;const i=n[t];if(void 0!==i){const t=i.indexOf(e);-1!==t&&i.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const n=e[t.type];if(void 0!==n){t.target=this;const e=n.slice(0);for(let n=0,i=e.length;n<i;n++)e[n].call(this,t);t.target=null}}}const pe=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];const fe=Math.PI/180,me=180/Math.PI;function ge(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,n=4294967295*Math.random()|0,i=4294967295*Math.random()|0;return(pe[255&t]+pe[t>>8&255]+pe[t>>16&255]+pe[t>>24&255]+"-"+pe[255&e]+pe[e>>8&255]+"-"+pe[e>>16&15|64]+pe[e>>24&255]+"-"+pe[63&n|128]+pe[n>>8&255]+"-"+pe[n>>16&255]+pe[n>>24&255]+pe[255&i]+pe[i>>8&255]+pe[i>>16&255]+pe[i>>24&255]).toLowerCase()}function _e(t,e,n){return Math.max(e,Math.min(n,t))}function ve(t,e){return(t%e+e)%e}function xe(t,e,n){return(1-n)*t+n*e}function ye(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Me(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}class Se{constructor(t=0,e=0){Se.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,n=this.y,i=t.elements;return this.x=i[0]*e+i[3]*n+i[6],this.y=i[1]*e+i[4]*n+i[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=_e(this.x,t.x,e.x),this.y=_e(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=_e(this.x,t,e),this.y=_e(this.y,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(_e(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(_e(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const n=Math.cos(e),i=Math.sin(e),r=this.x-t.x,a=this.y-t.y;return this.x=r*n-a*i+t.x,this.y=r*i+a*n+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Te{constructor(t,e,n,i,r,a,s,o,l){Te.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,a,s,o,l)}set(t,e,n,i,r,a,s,o,l){const c=this.elements;return c[0]=t,c[1]=i,c[2]=s,c[3]=e,c[4]=r,c[5]=o,c[6]=n,c[7]=a,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],this}extractBasis(t,e,n){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],_=i[1],v=i[4],x=i[7],y=i[2],M=i[5],S=i[8];return r[0]=a*f+s*_+o*y,r[3]=a*m+s*v+o*M,r[6]=a*g+s*x+o*S,r[1]=l*f+c*_+u*y,r[4]=l*m+c*v+u*M,r[7]=l*g+c*x+u*S,r[2]=h*f+d*_+p*y,r[5]=h*m+d*v+p*M,r[8]=h*g+d*x+p*S,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8];return e*a*c-e*s*l-n*r*c+n*s*o+i*r*l-i*a*o}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],u=c*a-s*l,h=s*o-c*r,d=l*r-a*o,p=e*u+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return t[0]=u*f,t[1]=(i*l-c*n)*f,t[2]=(s*n-i*a)*f,t[3]=h*f,t[4]=(c*e-i*o)*f,t[5]=(i*r-s*e)*f,t[6]=d*f,t[7]=(n*o-l*e)*f,t[8]=(a*e-n*r)*f,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,n,i,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+t,-i*l,i*o,-i*(-l*a+o*s)+s+e,0,0,1),this}scale(t,e){return this.premultiply(Ee.makeScale(t,e)),this}rotate(t){return this.premultiply(Ee.makeRotation(-t)),this}translate(t,e){return this.premultiply(Ee.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,n,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<9;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<9;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const Ee=new Te;function be(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array;function we(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Ae(){const t=we("canvas");return t.style.display="block",t}const Re={};function Ce(t){t in Re||(Re[t]=!0,console.warn(t))}const Pe=(new Te).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Le=(new Te).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function De(){const t={enabled:!0,workingColorSpace:Zt,spaces:{},convert:function(t,e,n){return!1!==this.enabled&&e!==n&&e&&n?(this.spaces[e].transfer===$t&&(t.r=Ie(t.r),t.g=Ie(t.g),t.b=Ie(t.b)),this.spaces[e].primaries!==this.spaces[n].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===$t&&(t.r=Ne(t.r),t.g=Ne(t.g),t.b=Ne(t.b)),t):t},fromWorkingColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},toWorkingColorSpace:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===Yt?Jt:this.spaces[t].transfer},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,n){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace}},e=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Zt]:{primaries:e,whitePoint:i,transfer:Jt,toXYZ:Pe,fromXYZ:Le,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Kt},outputColorSpaceConfig:{drawingBufferColorSpace:Kt}},[Kt]:{primaries:e,whitePoint:i,transfer:$t,toXYZ:Pe,fromXYZ:Le,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Kt}}}),t}const Ue=De();function Ie(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ne(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Oe;class Fe{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let n;if(t instanceof HTMLCanvasElement)n=t;else{void 0===Oe&&(Oe=we("canvas")),Oe.width=t.width,Oe.height=t.height;const e=Oe.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),n=Oe}return n.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=we("canvas");e.width=t.width,e.height=t.height;const n=e.getContext("2d");n.drawImage(t,0,0,t.width,t.height);const i=n.getImageData(0,0,t.width,t.height),r=i.data;for(let t=0;t<r.length;t++)r[t]=255*Ie(r[t]/255);return n.putImageData(i,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*Ie(e[t]/255)):e[t]=Ie(e[t]);return{data:e,width:t.width,height:t.height}}return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let Be=0;class ze{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Be++}),this.uuid=ge(),this.data=t,this.dataReady=!0,this.version=0}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let t;if(Array.isArray(i)){t=[];for(let e=0,n=i.length;e<n;e++)i[e].isDataTexture?t.push(Ve(i[e].image)):t.push(Ve(i[e]))}else t=Ve(i);n.url=t}return e||(t.images[this.uuid]=n),n}}function Ve(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Fe.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let He=0;class ke extends de{constructor(t=ke.DEFAULT_IMAGE,e=ke.DEFAULT_MAPPING,n=1001,i=1001,r=1006,a=1008,s=1023,o=1009,l=ke.DEFAULT_ANISOTROPY,c=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:He++}),this.uuid=ge(),this.name="",this.source=new ze(t),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new Se(0,0),this.repeat=new Se(1,1),this.center=new Se(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Te,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=c,this.userData={},this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isTextureArray=!1,this.pmremVersion=0}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isTextureArray=t.isTextureArray,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const n={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),e||(t.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(300!==this.mapping)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case F:t.x=t.x-Math.floor(t.x);break;case B:t.x=t.x<0?0:1;break;case z:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case F:t.y=t.y-Math.floor(t.y);break;case B:t.y=t.y<0?0:1;break;case z:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}}ke.DEFAULT_IMAGE=null,ke.DEFAULT_MAPPING=300,ke.DEFAULT_ANISOTROPY=1;class Ge{constructor(t=0,e=0,n=0,i=1){Ge.prototype.isVector4=!0,this.x=t,this.y=e,this.z=n,this.w=i}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,n,i){return this.x=t,this.y=e,this.z=n,this.w=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=this.w,a=t.elements;return this.x=a[0]*e+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*e+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*e+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*e+a[7]*n+a[11]*i+a[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,n,i,r;const a=.01,s=.1,o=t.elements,l=o[0],c=o[4],u=o[8],h=o[1],d=o[5],p=o[9],f=o[2],m=o[6],g=o[10];if(Math.abs(c-h)<a&&Math.abs(u-f)<a&&Math.abs(p-m)<a){if(Math.abs(c+h)<s&&Math.abs(u+f)<s&&Math.abs(p+m)<s&&Math.abs(l+d+g-3)<s)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,o=(d+1)/2,_=(g+1)/2,v=(c+h)/4,x=(u+f)/4,y=(p+m)/4;return t>o&&t>_?t<a?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(t),i=v/n,r=x/n):o>_?o<a?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(o),n=v/i,r=y/i):_<a?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(_),n=x/r,i=y/r),this.set(n,i,r,e),this}let _=Math.sqrt((m-p)*(m-p)+(u-f)*(u-f)+(h-c)*(h-c));return Math.abs(_)<.001&&(_=1),this.x=(m-p)/_,this.y=(u-f)/_,this.z=(h-c)/_,this.w=Math.acos((l+d+g-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=_e(this.x,t.x,e.x),this.y=_e(this.y,t.y,e.y),this.z=_e(this.z,t.z,e.z),this.w=_e(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=_e(this.x,t,e),this.y=_e(this.y,t,e),this.z=_e(this.z,t,e),this.w=_e(this.w,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(_e(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this.w=t.w+(e.w-t.w)*n,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class We extends de{constructor(t=1,e=1,n={}){super(),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=n.depth?n.depth:1,this.scissor=new Ge(0,0,t,e),this.scissorTest=!1,this.viewport=new Ge(0,0,t,e);const i={width:t,height:e,depth:this.depth};n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:G,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,multiview:!1},n);const r=new ke(i,n.mapping,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.colorSpace);r.flipY=!1,r.generateMipmaps=n.generateMipmaps,r.internalFormat=n.internalFormat,this.textures=[];const a=n.count;for(let t=0;t<a;t++)this.textures[t]=r.clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,n=1){if(this.width!==t||this.height!==e||this.depth!==n){this.width=t,this.height=e,this.depth=n;for(let i=0,r=this.textures.length;i<r;i++)this.textures[i].image.width=t,this.textures[i].image.height=e,this.textures[i].image.depth=n;this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,n=t.textures.length;e<n;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const n=Object.assign({},t.textures[e].image);this.textures[e].source=new ze(n)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Xe extends We{constructor(t=1,e=1,n={}){super(t,e,n),this.isWebGLRenderTarget=!0}}class je extends ke{constructor(t=null,e=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=V,this.minFilter=V,this.wrapR=B,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class qe extends ke{constructor(t=null,e=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:n,depth:i},this.magFilter=V,this.minFilter=V,this.wrapR=B,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Ye{constructor(t=0,e=0,n=0,i=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=n,this._w=i}static slerpFlat(t,e,n,i,r,a,s){let o=n[i+0],l=n[i+1],c=n[i+2],u=n[i+3];const h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(0===s)return t[e+0]=o,t[e+1]=l,t[e+2]=c,void(t[e+3]=u);if(1===s)return t[e+0]=h,t[e+1]=d,t[e+2]=p,void(t[e+3]=f);if(u!==f||o!==h||l!==d||c!==p){let t=1-s;const e=o*h+l*d+c*p+u*f,n=e>=0?1:-1,i=1-e*e;if(i>Number.EPSILON){const r=Math.sqrt(i),a=Math.atan2(r,e*n);t=Math.sin(t*a)/r,s=Math.sin(s*a)/r}const r=s*n;if(o=o*t+h*r,l=l*t+d*r,c=c*t+p*r,u=u*t+f*r,t===1-s){const t=1/Math.sqrt(o*o+l*l+c*c+u*u);o*=t,l*=t,c*=t,u*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=u}static multiplyQuaternionsFlat(t,e,n,i,r,a){const s=n[i],o=n[i+1],l=n[i+2],c=n[i+3],u=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return t[e]=s*p+c*u+o*d-l*h,t[e+1]=o*p+c*h+l*u-s*d,t[e+2]=l*p+c*d+s*h-o*u,t[e+3]=c*p-s*u-o*h-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,n,i){return this._x=t,this._y=e,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const n=t._x,i=t._y,r=t._z,a=t._order,s=Math.cos,o=Math.sin,l=s(n/2),c=s(i/2),u=s(r/2),h=o(n/2),d=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"YXZ":this._x=h*c*u+l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"ZXY":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u-h*d*p;break;case"ZYX":this._x=h*c*u-l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u+h*d*p;break;case"YZX":this._x=h*c*u+l*d*p,this._y=l*d*u+h*c*p,this._z=l*c*p-h*d*u,this._w=l*c*u-h*d*p;break;case"XZY":this._x=h*c*u-l*d*p,this._y=l*d*u-h*c*p,this._z=l*c*p+h*d*u,this._w=l*c*u+h*d*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const n=e/2,i=Math.sin(n);return this._x=t.x*i,this._y=t.y*i,this._z=t.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,n=e[0],i=e[4],r=e[8],a=e[1],s=e[5],o=e[9],l=e[2],c=e[6],u=e[10],h=n+s+u;if(h>0){const t=.5/Math.sqrt(h+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(a-i)*t}else if(n>s&&n>u){const t=2*Math.sqrt(1+n-s-u);this._w=(c-o)/t,this._x=.25*t,this._y=(i+a)/t,this._z=(r+l)/t}else if(s>u){const t=2*Math.sqrt(1+s-n-u);this._w=(r-l)/t,this._x=(i+a)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+u-n-s);this._w=(a-i)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let n=t.dot(e)+1;return n<Number.EPSILON?(n=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=n):(this._x=0,this._y=-t.z,this._z=t.y,this._w=n)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=n),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(_e(this.dot(t),-1,1)))}rotateTowards(t,e){const n=this.angleTo(t);if(0===n)return this;const i=Math.min(1,e/n);return this.slerp(t,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const n=t._x,i=t._y,r=t._z,a=t._w,s=e._x,o=e._y,l=e._z,c=e._w;return this._x=n*c+a*s+i*l-r*o,this._y=i*c+a*o+r*s-n*l,this._z=r*c+a*l+n*o-i*s,this._w=a*c-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(t,e){if(0===e)return this;if(1===e)return this.copy(t);const n=this._x,i=this._y,r=this._z,a=this._w;let s=a*t._w+n*t._x+i*t._y+r*t._z;if(s<0?(this._w=-t._w,this._x=-t._x,this._y=-t._y,this._z=-t._z,s=-s):this.copy(t),s>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;const o=1-s*s;if(o<=Number.EPSILON){const t=1-e;return this._w=t*a+e*this._w,this._x=t*n+e*this._x,this._y=t*i+e*this._y,this._z=t*r+e*this._z,this.normalize(),this}const l=Math.sqrt(o),c=Math.atan2(l,s),u=Math.sin((1-e)*c)/l,h=Math.sin(e*c)/l;return this._w=a*u+this._w*h,this._x=n*u+this._x*h,this._y=i*u+this._y*h,this._z=r*u+this._z*h,this._onChangeCallback(),this}slerpQuaternions(t,e,n){return this.copy(t).slerp(e,n)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(t),i*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Ke{constructor(t=0,e=0,n=0){Ke.prototype.isVector3=!0,this.x=t,this.y=e,this.z=n}set(t,e,n){return void 0===n&&(n=this.z),this.x=t,this.y=e,this.z=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(Je.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(Je.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[3]*n+r[6]*i,this.y=r[1]*e+r[4]*n+r[7]*i,this.z=r[2]*e+r[5]*n+r[8]*i,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,n=this.y,i=this.z,r=t.elements,a=1/(r[3]*e+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*e+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*e+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*e+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(t){const e=this.x,n=this.y,i=this.z,r=t.x,a=t.y,s=t.z,o=t.w,l=2*(a*i-s*n),c=2*(s*e-r*i),u=2*(r*n-a*e);return this.x=e+o*l+a*u-s*c,this.y=n+o*c+s*l-r*u,this.z=i+o*u+r*c-a*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,n=this.y,i=this.z,r=t.elements;return this.x=r[0]*e+r[4]*n+r[8]*i,this.y=r[1]*e+r[5]*n+r[9]*i,this.z=r[2]*e+r[6]*n+r[10]*i,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=_e(this.x,t.x,e.x),this.y=_e(this.y,t.y,e.y),this.z=_e(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=_e(this.x,t,e),this.y=_e(this.y,t,e),this.z=_e(this.z,t,e),this}clampLength(t,e){const n=this.length();return this.divideScalar(n||1).multiplyScalar(_e(n,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,n){return this.x=t.x+(e.x-t.x)*n,this.y=t.y+(e.y-t.y)*n,this.z=t.z+(e.z-t.z)*n,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const n=t.x,i=t.y,r=t.z,a=e.x,s=e.y,o=e.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const n=t.dot(this)/e;return this.copy(t).multiplyScalar(n)}projectOnPlane(t){return Ze.copy(this).projectOnVector(t),this.sub(Ze)}reflect(t){return this.sub(Ze.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const n=this.dot(t)/e;return Math.acos(_e(n,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,n=this.y-t.y,i=this.z-t.z;return e*e+n*n+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,n){const i=Math.sin(e)*t;return this.x=i*Math.sin(n),this.y=Math.cos(e)*t,this.z=i*Math.cos(n),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,n){return this.x=t*Math.sin(e),this.y=n,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),n=this.setFromMatrixColumn(t,1).length(),i=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=n,this.z=i,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,n=Math.sqrt(1-e*e);return this.x=n*Math.cos(t),this.y=e,this.z=n*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ze=new Ke,Je=new Ye;class $e{constructor(t=new Ke(1/0,1/0,1/0),e=new Ke(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e+=3)this.expandByPoint(tn.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,n=t.count;e<n;e++)this.expandByPoint(tn.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,n=t.length;e<n;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const n=tn.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(n),this.max.copy(t).add(n),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}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=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,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}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const n=t.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===e&&void 0!==i&&!0!==t.isInstancedMesh)for(let e=0,n=i.count;e<n;e++)!0===t.isMesh?t.getVertexPosition(e,tn):tn.fromBufferAttribute(i,e),tn.applyMatrix4(t.matrixWorld),this.expandByPoint(tn);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),en.copy(t.boundingBox)):(null===n.boundingBox&&n.computeBoundingBox(),en.copy(n.boundingBox)),en.applyMatrix4(t.matrixWorld),this.union(en)}const i=t.children;for(let t=0,n=i.length;t<n;t++)this.expandByObject(i[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}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&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}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&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,tn),tn.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,n;return t.normal.x>0?(e=t.normal.x*this.min.x,n=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,n=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,n+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,n+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,n+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,n+=t.normal.z*this.min.z),e<=-t.constant&&n>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(cn),un.subVectors(this.max,cn),nn.subVectors(t.a,cn),rn.subVectors(t.b,cn),an.subVectors(t.c,cn),sn.subVectors(rn,nn),on.subVectors(an,rn),ln.subVectors(nn,an);let e=[0,-sn.z,sn.y,0,-on.z,on.y,0,-ln.z,ln.y,sn.z,0,-sn.x,on.z,0,-on.x,ln.z,0,-ln.x,-sn.y,sn.x,0,-on.y,on.x,0,-ln.y,ln.x,0];return!!pn(e,nn,rn,an,un)&&(e=[1,0,0,0,1,0,0,0,1],!!pn(e,nn,rn,an,un)&&(hn.crossVectors(sn,on),e=[hn.x,hn.y,hn.z],pn(e,nn,rn,an,un)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,tn).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(tn).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(Qe[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),Qe[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),Qe[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),Qe[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),Qe[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),Qe[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),Qe[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),Qe[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(Qe)),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)}}const Qe=[new Ke,new Ke,new Ke,new Ke,new Ke,new Ke,new Ke,new Ke],tn=new Ke,en=new $e,nn=new Ke,rn=new Ke,an=new Ke,sn=new Ke,on=new Ke,ln=new Ke,cn=new Ke,un=new Ke,hn=new Ke,dn=new Ke;function pn(t,e,n,i,r){for(let a=0,s=t.length-3;a<=s;a+=3){dn.fromArray(t,a);const s=r.x*Math.abs(dn.x)+r.y*Math.abs(dn.y)+r.z*Math.abs(dn.z),o=e.dot(dn),l=n.dot(dn),c=i.dot(dn);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>s)return!1}return!0}const fn=new $e,mn=new Ke,gn=new Ke;class _n{constructor(t=new Ke,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const n=this.center;void 0!==e?n.copy(e):fn.setFromPoints(t).getCenter(n);let i=0;for(let e=0,r=t.length;e<r;e++)i=Math.max(i,n.distanceToSquared(t[e]));return this.radius=Math.sqrt(i),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const n=this.center.distanceToSquared(t);return e.copy(t),n>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;mn.subVectors(t,this.center);const e=mn.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),n=.5*(t-this.radius);this.center.addScaledVector(mn,n/t),this.radius+=n}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(gn.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(mn.copy(t.center).add(gn)),this.expandByPoint(mn.copy(t.center).sub(gn))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}}const vn=new Ke,xn=new Ke,yn=new Ke,Mn=new Ke,Sn=new Ke,Tn=new Ke,En=new Ke;class bn{constructor(t=new Ke,e=new Ke(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,vn)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const n=e.dot(this.direction);return n<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=vn.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(vn.copy(this.origin).addScaledVector(this.direction,e),vn.distanceToSquared(t))}distanceSqToSegment(t,e,n,i){xn.copy(t).add(e).multiplyScalar(.5),yn.copy(e).sub(t).normalize(),Mn.copy(this.origin).sub(xn);const r=.5*t.distanceTo(e),a=-this.direction.dot(yn),s=Mn.dot(this.direction),o=-Mn.dot(yn),l=Mn.lengthSq(),c=Math.abs(1-a*a);let u,h,d,p;if(c>0)if(u=a*o-s,h=a*s-o,p=r*c,u>=0)if(h>=-p)if(h<=p){const t=1/c;u*=t,h*=t,d=u*(u+a*h+2*s)+h*(a*u+h+2*o)+l}else h=r,u=Math.max(0,-(a*h+s)),d=-u*u+h*(h+2*o)+l;else h=-r,u=Math.max(0,-(a*h+s)),d=-u*u+h*(h+2*o)+l;else h<=-p?(u=Math.max(0,-(-a*r+s)),h=u>0?-r:Math.min(Math.max(-r,-o),r),d=-u*u+h*(h+2*o)+l):h<=p?(u=0,h=Math.min(Math.max(-r,-o),r),d=h*(h+2*o)+l):(u=Math.max(0,-(a*r+s)),h=u>0?r:Math.min(Math.max(-r,-o),r),d=-u*u+h*(h+2*o)+l);else h=a>0?-r:r,u=Math.max(0,-(a*h+s)),d=-u*u+h*(h+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(xn).addScaledVector(yn,h),d}intersectSphere(t,e){vn.subVectors(t.center,this.origin);const n=vn.dot(this.direction),i=vn.dot(vn)-n*n,r=t.radius*t.radius;if(i>r)return null;const a=Math.sqrt(r-i),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,e):this.at(s,e)}intersectsSphere(t){return this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(t.normal)+t.constant)/e;return n>=0?n:null}intersectPlane(t,e){const n=this.distanceToPlane(t);return null===n?null:this.at(n,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let n,i,r,a,s,o;const l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(t.min.x-h.x)*l,i=(t.max.x-h.x)*l):(n=(t.max.x-h.x)*l,i=(t.min.x-h.x)*l),c>=0?(r=(t.min.y-h.y)*c,a=(t.max.y-h.y)*c):(r=(t.max.y-h.y)*c,a=(t.min.y-h.y)*c),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a<i||isNaN(i))&&(i=a),u>=0?(s=(t.min.z-h.z)*u,o=(t.max.z-h.z)*u):(s=(t.max.z-h.z)*u,o=(t.min.z-h.z)*u),n>o||s>i?null:((s>n||n!=n)&&(n=s),(o<i||i!=i)&&(i=o),i<0?null:this.at(n>=0?n:i,e)))}intersectsBox(t){return null!==this.intersectBox(t,vn)}intersectTriangle(t,e,n,i,r){Sn.subVectors(e,t),Tn.subVectors(n,t),En.crossVectors(Sn,Tn);let a,s=this.direction.dot(En);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}Mn.subVectors(this.origin,t);const o=a*this.direction.dot(Tn.crossVectors(Mn,Tn));if(o<0)return null;const l=a*this.direction.dot(Sn.cross(Mn));if(l<0)return null;if(o+l>s)return null;const c=-a*Mn.dot(En);return c<0?null:this.at(c/s,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class wn{constructor(t,e,n,i,r,a,s,o,l,c,u,h,d,p,f,m){wn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,n,i,r,a,s,o,l,c,u,h,d,p,f,m)}set(t,e,n,i,r,a,s,o,l,c,u,h,d,p,f,m){const g=this.elements;return g[0]=t,g[4]=e,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=c,g[10]=u,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new wn).fromArray(this.elements)}copy(t){const e=this.elements,n=t.elements;return e[0]=n[0],e[1]=n[1],e[2]=n[2],e[3]=n[3],e[4]=n[4],e[5]=n[5],e[6]=n[6],e[7]=n[7],e[8]=n[8],e[9]=n[9],e[10]=n[10],e[11]=n[11],e[12]=n[12],e[13]=n[13],e[14]=n[14],e[15]=n[15],this}copyPosition(t){const e=this.elements,n=t.elements;return e[12]=n[12],e[13]=n[13],e[14]=n[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,n){return t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(t,e,n){return this.set(t.x,e.x,n.x,0,t.y,e.y,n.y,0,t.z,e.z,n.z,0,0,0,0,1),this}extractRotation(t){const e=this.elements,n=t.elements,i=1/An.setFromMatrixColumn(t,0).length(),r=1/An.setFromMatrixColumn(t,1).length(),a=1/An.setFromMatrixColumn(t,2).length();return e[0]=n[0]*i,e[1]=n[1]*i,e[2]=n[2]*i,e[3]=0,e[4]=n[4]*r,e[5]=n[5]*r,e[6]=n[6]*r,e[7]=0,e[8]=n[8]*a,e[9]=n[9]*a,e[10]=n[10]*a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,n=t.x,i=t.y,r=t.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),c=Math.cos(r),u=Math.sin(r);if("XYZ"===t.order){const t=a*c,n=a*u,i=s*c,r=s*u;e[0]=o*c,e[4]=-o*u,e[8]=l,e[1]=n+i*l,e[5]=t-r*l,e[9]=-s*o,e[2]=r-t*l,e[6]=i+n*l,e[10]=a*o}else if("YXZ"===t.order){const t=o*c,n=o*u,i=l*c,r=l*u;e[0]=t+r*s,e[4]=i*s-n,e[8]=a*l,e[1]=a*u,e[5]=a*c,e[9]=-s,e[2]=n*s-i,e[6]=r+t*s,e[10]=a*o}else if("ZXY"===t.order){const t=o*c,n=o*u,i=l*c,r=l*u;e[0]=t-r*s,e[4]=-a*u,e[8]=i+n*s,e[1]=n+i*s,e[5]=a*c,e[9]=r-t*s,e[2]=-a*l,e[6]=s,e[10]=a*o}else if("ZYX"===t.order){const t=a*c,n=a*u,i=s*c,r=s*u;e[0]=o*c,e[4]=i*l-n,e[8]=t*l+r,e[1]=o*u,e[5]=r*l+t,e[9]=n*l-i,e[2]=-l,e[6]=s*o,e[10]=a*o}else if("YZX"===t.order){const t=a*o,n=a*l,i=s*o,r=s*l;e[0]=o*c,e[4]=r-t*u,e[8]=i*u+n,e[1]=u,e[5]=a*c,e[9]=-s*c,e[2]=-l*c,e[6]=n*u+i,e[10]=t-r*u}else if("XZY"===t.order){const t=a*o,n=a*l,i=s*o,r=s*l;e[0]=o*c,e[4]=-u,e[8]=l*c,e[1]=t*u+r,e[5]=a*c,e[9]=n*u-i,e[2]=i*u-n,e[6]=s*c,e[10]=r*u+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(Cn,t,Pn)}lookAt(t,e,n){const i=this.elements;return Un.subVectors(t,e),0===Un.lengthSq()&&(Un.z=1),Un.normalize(),Ln.crossVectors(n,Un),0===Ln.lengthSq()&&(1===Math.abs(n.z)?Un.x+=1e-4:Un.z+=1e-4,Un.normalize(),Ln.crossVectors(n,Un)),Ln.normalize(),Dn.crossVectors(Un,Ln),i[0]=Ln.x,i[4]=Dn.x,i[8]=Un.x,i[1]=Ln.y,i[5]=Dn.y,i[9]=Un.y,i[2]=Ln.z,i[6]=Dn.z,i[10]=Un.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const n=t.elements,i=e.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],_=n[3],v=n[7],x=n[11],y=n[15],M=i[0],S=i[4],T=i[8],E=i[12],b=i[1],w=i[5],A=i[9],R=i[13],C=i[2],P=i[6],L=i[10],D=i[14],U=i[3],I=i[7],N=i[11],O=i[15];return r[0]=a*M+s*b+o*C+l*U,r[4]=a*S+s*w+o*P+l*I,r[8]=a*T+s*A+o*L+l*N,r[12]=a*E+s*R+o*D+l*O,r[1]=c*M+u*b+h*C+d*U,r[5]=c*S+u*w+h*P+d*I,r[9]=c*T+u*A+h*L+d*N,r[13]=c*E+u*R+h*D+d*O,r[2]=p*M+f*b+m*C+g*U,r[6]=p*S+f*w+m*P+g*I,r[10]=p*T+f*A+m*L+g*N,r[14]=p*E+f*R+m*D+g*O,r[3]=_*M+v*b+x*C+y*U,r[7]=_*S+v*w+x*P+y*I,r[11]=_*T+v*A+x*L+y*N,r[15]=_*E+v*R+x*D+y*O,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],n=t[4],i=t[8],r=t[12],a=t[1],s=t[5],o=t[9],l=t[13],c=t[2],u=t[6],h=t[10],d=t[14];return t[3]*(+r*o*u-i*l*u-r*s*h+n*l*h+i*s*d-n*o*d)+t[7]*(+e*o*d-e*l*h+r*a*h-i*a*d+i*l*c-r*o*c)+t[11]*(+e*l*u-e*s*d-r*a*u+n*a*d+r*s*c-n*l*c)+t[15]*(-i*s*c-e*o*u+e*s*h+i*a*u-n*a*h+n*o*c)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,n){const i=this.elements;return t.isVector3?(i[12]=t.x,i[13]=t.y,i[14]=t.z):(i[12]=t,i[13]=e,i[14]=n),this}invert(){const t=this.elements,e=t[0],n=t[1],i=t[2],r=t[3],a=t[4],s=t[5],o=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11],p=t[12],f=t[13],m=t[14],g=t[15],_=u*m*l-f*h*l+f*o*d-s*m*d-u*o*g+s*h*g,v=p*h*l-c*m*l-p*o*d+a*m*d+c*o*g-a*h*g,x=c*f*l-p*u*l+p*s*d-a*f*d-c*s*g+a*u*g,y=p*u*o-c*f*o-p*s*h+a*f*h+c*s*m-a*u*m,M=e*_+n*v+i*x+r*y;if(0===M)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/M;return t[0]=_*S,t[1]=(f*h*r-u*m*r-f*i*d+n*m*d+u*i*g-n*h*g)*S,t[2]=(s*m*r-f*o*r+f*i*l-n*m*l-s*i*g+n*o*g)*S,t[3]=(u*o*r-s*h*r-u*i*l+n*h*l+s*i*d-n*o*d)*S,t[4]=v*S,t[5]=(c*m*r-p*h*r+p*i*d-e*m*d-c*i*g+e*h*g)*S,t[6]=(p*o*r-a*m*r-p*i*l+e*m*l+a*i*g-e*o*g)*S,t[7]=(a*h*r-c*o*r+c*i*l-e*h*l-a*i*d+e*o*d)*S,t[8]=x*S,t[9]=(p*u*r-c*f*r-p*n*d+e*f*d+c*n*g-e*u*g)*S,t[10]=(a*f*r-p*s*r+p*n*l-e*f*l-a*n*g+e*s*g)*S,t[11]=(c*s*r-a*u*r-c*n*l+e*u*l+a*n*d-e*s*d)*S,t[12]=y*S,t[13]=(c*f*i-p*u*i+p*n*h-e*f*h-c*n*m+e*u*m)*S,t[14]=(p*s*i-a*f*i-p*n*o+e*f*o+a*n*m-e*s*m)*S,t[15]=(a*u*i-c*s*i+c*n*o-e*u*o-a*n*h+e*s*h)*S,this}scale(t){const e=this.elements,n=t.x,i=t.y,r=t.z;return e[0]*=n,e[4]*=i,e[8]*=r,e[1]*=n,e[5]*=i,e[9]*=r,e[2]*=n,e[6]*=i,e[10]*=r,e[3]*=n,e[7]*=i,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],n=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],i=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,n,i))}makeTranslation(t,e,n){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,n,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),n=Math.sin(t);return this.set(1,0,0,0,0,e,-n,0,0,n,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,0,n,0,0,1,0,0,-n,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),n=Math.sin(t);return this.set(e,-n,0,0,n,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const n=Math.cos(e),i=Math.sin(e),r=1-n,a=t.x,s=t.y,o=t.z,l=r*a,c=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,c*s+n,c*o-i*a,0,l*o-i*s,c*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(t,e,n){return this.set(t,0,0,0,0,e,0,0,0,0,n,0,0,0,0,1),this}makeShear(t,e,n,i,r,a){return this.set(1,n,r,0,t,1,a,0,e,i,1,0,0,0,0,1),this}compose(t,e,n){const i=this.elements,r=e._x,a=e._y,s=e._z,o=e._w,l=r+r,c=a+a,u=s+s,h=r*l,d=r*c,p=r*u,f=a*c,m=a*u,g=s*u,_=o*l,v=o*c,x=o*u,y=n.x,M=n.y,S=n.z;return i[0]=(1-(f+g))*y,i[1]=(d+x)*y,i[2]=(p-v)*y,i[3]=0,i[4]=(d-x)*M,i[5]=(1-(h+g))*M,i[6]=(m+_)*M,i[7]=0,i[8]=(p+v)*S,i[9]=(m-_)*S,i[10]=(1-(h+f))*S,i[11]=0,i[12]=t.x,i[13]=t.y,i[14]=t.z,i[15]=1,this}decompose(t,e,n){const i=this.elements;let r=An.set(i[0],i[1],i[2]).length();const a=An.set(i[4],i[5],i[6]).length(),s=An.set(i[8],i[9],i[10]).length();this.determinant()<0&&(r=-r),t.x=i[12],t.y=i[13],t.z=i[14],Rn.copy(this);const o=1/r,l=1/a,c=1/s;return Rn.elements[0]*=o,Rn.elements[1]*=o,Rn.elements[2]*=o,Rn.elements[4]*=l,Rn.elements[5]*=l,Rn.elements[6]*=l,Rn.elements[8]*=c,Rn.elements[9]*=c,Rn.elements[10]*=c,e.setFromRotationMatrix(Rn),n.x=r,n.y=a,n.z=s,this}makePerspective(t,e,n,i,r,a,s=2e3){const o=this.elements,l=2*r/(e-t),c=2*r/(n-i),u=(e+t)/(e-t),h=(n+i)/(n-i);let d,p;if(s===ue)d=-(a+r)/(a-r),p=-2*a*r/(a-r);else{if(s!==he)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);d=-a/(a-r),p=-a*r/(a-r)}return o[0]=l,o[4]=0,o[8]=u,o[12]=0,o[1]=0,o[5]=c,o[9]=h,o[13]=0,o[2]=0,o[6]=0,o[10]=d,o[14]=p,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this}makeOrthographic(t,e,n,i,r,a,s=2e3){const o=this.elements,l=1/(e-t),c=1/(n-i),u=1/(a-r),h=(e+t)*l,d=(n+i)*c;let p,f;if(s===ue)p=(a+r)*u,f=-2*u;else{if(s!==he)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);p=r*u,f=-1*u}return o[0]=2*l,o[4]=0,o[8]=0,o[12]=-h,o[1]=0,o[5]=2*c,o[9]=0,o[13]=-d,o[2]=0,o[6]=0,o[10]=f,o[14]=-p,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this}equals(t){const e=this.elements,n=t.elements;for(let t=0;t<16;t++)if(e[t]!==n[t])return!1;return!0}fromArray(t,e=0){for(let n=0;n<16;n++)this.elements[n]=t[n+e];return this}toArray(t=[],e=0){const n=this.elements;return t[e]=n[0],t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+5]=n[5],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+10]=n[10],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14],t[e+15]=n[15],t}}const An=new Ke,Rn=new wn,Cn=new Ke(0,0,0),Pn=new Ke(1,1,1),Ln=new Ke,Dn=new Ke,Un=new Ke,In=new wn,Nn=new Ye;class On{constructor(t=0,e=0,n=0,i=On.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=n,this._order=i}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,n,i=this._order){return this._x=t,this._y=e,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,n=!0){const i=t.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],c=i[9],u=i[2],h=i[6],d=i[10];switch(e){case"XYZ":this._y=Math.asin(_e(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-_e(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-u,r),this._z=0);break;case"ZXY":this._x=Math.asin(_e(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-u,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-_e(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(_e(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-u,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-_e(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===n&&this._onChangeCallback(),this}setFromQuaternion(t,e,n){return In.makeRotationFromQuaternion(t),this.setFromRotationMatrix(In,e,n)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return Nn.setFromEuler(this),this.setFromQuaternion(Nn,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}On.DEFAULT_ORDER="XYZ";class Fn{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let Bn=0;const zn=new Ke,Vn=new Ye,Hn=new wn,kn=new Ke,Gn=new Ke,Wn=new Ke,Xn=new Ye,jn=new Ke(1,0,0),qn=new Ke(0,1,0),Yn=new Ke(0,0,1),Kn={type:"added"},Zn={type:"removed"},Jn={type:"childadded",child:null},$n={type:"childremoved",child:null};class Qn extends de{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:Bn++}),this.uuid=ge(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=Qn.DEFAULT_UP.clone();const t=new Ke,e=new On,n=new Ye,i=new Ke(1,1,1);e._onChange((function(){n.setFromEuler(e,!1)})),n._onChange((function(){e.setFromQuaternion(n,void 0,!1)})),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new wn},normalMatrix:{value:new Te}}),this.matrix=new wn,this.matrixWorld=new wn,this.matrixAutoUpdate=Qn.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=Qn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Fn,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return Vn.setFromAxisAngle(t,e),this.quaternion.multiply(Vn),this}rotateOnWorldAxis(t,e){return Vn.setFromAxisAngle(t,e),this.quaternion.premultiply(Vn),this}rotateX(t){return this.rotateOnAxis(jn,t)}rotateY(t){return this.rotateOnAxis(qn,t)}rotateZ(t){return this.rotateOnAxis(Yn,t)}translateOnAxis(t,e){return zn.copy(t).applyQuaternion(this.quaternion),this.position.add(zn.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(jn,t)}translateY(t){return this.translateOnAxis(qn,t)}translateZ(t){return this.translateOnAxis(Yn,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(Hn.copy(this.matrixWorld).invert())}lookAt(t,e,n){t.isVector3?kn.copy(t):kn.set(t,e,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Gn.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Hn.lookAt(Gn,kn,this.up):Hn.lookAt(kn,Gn,this.up),this.quaternion.setFromRotationMatrix(Hn),i&&(Hn.extractRotation(i.matrixWorld),Vn.setFromRotationMatrix(Hn),this.quaternion.premultiply(Vn.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(Kn),Jn.child=t,this.dispatchEvent(Jn),Jn.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(Zn),$n.child=t,this.dispatchEvent($n),$n.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),Hn.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),Hn.multiply(t.parent.matrixWorld)),t.applyMatrix4(Hn),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(Kn),Jn.child=t,this.dispatchEvent(Jn),Jn.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let n=0,i=this.children.length;n<i;n++){const i=this.children[n].getObjectByProperty(t,e);if(void 0!==i)return i}}getObjectsByProperty(t,e,n=[]){this[t]===e&&n.push(this);const i=this.children;for(let r=0,a=i.length;r<a;r++)i[r].getObjectsByProperty(t,e,n);return n}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gn,t,Wn),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Gn,Xn,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let n=0,i=e.length;n<i;n++)e[n].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let n=0,i=e.length;n<i;n++){e[n].updateMatrixWorld(t)}}updateWorldMatrix(t,e){const n=this.parent;if(!0===t&&null!==n&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,n=t.length;e<n;e++){t[e].updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,n={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});const i={};function r(e,n){return void 0===e[n.uuid]&&(e[n.uuid]=n.toJSON(t)),n.uuid}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),!0===this.castShadow&&(i.castShadow=!0),!0===this.receiveShadow&&(i.receiveShadow=!0),!1===this.visible&&(i.visible=!1),!1===this.frustumCulled&&(i.frustumCulled=!1),0!==this.renderOrder&&(i.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map((t=>({...t,boundingBox:t.boundingBox?{min:t.boundingBox.min.toArray(),max:t.boundingBox.max.toArray()}:void 0,boundingSphere:t.boundingSphere?{radius:t.boundingSphere.radius,center:t.boundingSphere.center.toArray()}:void 0}))),i.instanceInfo=this._instanceInfo.map((t=>({...t}))),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(t),i.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(i.boundingSphere={center:this.boundingSphere.center.toArray(),radius:this.boundingSphere.radius}),null!==this.boundingBox&&(i.boundingBox={min:this.boundingBox.min.toArray(),max:this.boundingBox.max.toArray()})),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const n=e.shapes;if(Array.isArray(n))for(let e=0,i=n.length;e<i;e++){const i=n[e];r(t.shapes,i)}else r(t.shapes,n)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let n=0,i=this.material.length;n<i;n++)e.push(r(t.materials,this.material[n]));i.material=e}else i.material=r(t.materials,this.material);if(this.children.length>0){i.children=[];for(let e=0;e<this.children.length;e++)i.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){i.animations=[];for(let e=0;e<this.animations.length;e++){const n=this.animations[e];i.animations.push(r(t.animations,n))}}if(e){const e=a(t.geometries),i=a(t.materials),r=a(t.textures),s=a(t.images),o=a(t.shapes),l=a(t.skeletons),c=a(t.animations),u=a(t.nodes);e.length>0&&(n.geometries=e),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),c.length>0&&(n.animations=c),u.length>0&&(n.nodes=u)}return n.object=i,n;function a(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const n=t.children[e];this.add(n.clone())}return this}}Qn.DEFAULT_UP=new Ke(0,1,0),Qn.DEFAULT_MATRIX_AUTO_UPDATE=!0,Qn.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const ti=new Ke,ei=new Ke,ni=new Ke,ii=new Ke,ri=new Ke,ai=new Ke,si=new Ke,oi=new Ke,li=new Ke,ci=new Ke,ui=new Ge,hi=new Ge,di=new Ge;class pi{constructor(t=new Ke,e=new Ke,n=new Ke){this.a=t,this.b=e,this.c=n}static getNormal(t,e,n,i){i.subVectors(n,e),ti.subVectors(t,e),i.cross(ti);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(t,e,n,i,r){ti.subVectors(i,e),ei.subVectors(n,e),ni.subVectors(t,e);const a=ti.dot(ti),s=ti.dot(ei),o=ti.dot(ni),l=ei.dot(ei),c=ei.dot(ni),u=a*l-s*s;if(0===u)return r.set(0,0,0),null;const h=1/u,d=(l*o-s*c)*h,p=(a*c-s*o)*h;return r.set(1-d-p,p,d)}static containsPoint(t,e,n,i){return null!==this.getBarycoord(t,e,n,i,ii)&&(ii.x>=0&&ii.y>=0&&ii.x+ii.y<=1)}static getInterpolation(t,e,n,i,r,a,s,o){return null===this.getBarycoord(t,e,n,i,ii)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,ii.x),o.addScaledVector(a,ii.y),o.addScaledVector(s,ii.z),o)}static getInterpolatedAttribute(t,e,n,i,r,a){return ui.setScalar(0),hi.setScalar(0),di.setScalar(0),ui.fromBufferAttribute(t,e),hi.fromBufferAttribute(t,n),di.fromBufferAttribute(t,i),a.setScalar(0),a.addScaledVector(ui,r.x),a.addScaledVector(hi,r.y),a.addScaledVector(di,r.z),a}static isFrontFacing(t,e,n,i){return ti.subVectors(n,e),ei.subVectors(t,e),ti.cross(ei).dot(i)<0}set(t,e,n){return this.a.copy(t),this.b.copy(e),this.c.copy(n),this}setFromPointsAndIndices(t,e,n,i){return this.a.copy(t[e]),this.b.copy(t[n]),this.c.copy(t[i]),this}setFromAttributeAndIndices(t,e,n,i){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,n),this.c.fromBufferAttribute(t,i),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return ti.subVectors(this.c,this.b),ei.subVectors(this.a,this.b),.5*ti.cross(ei).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return pi.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return pi.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,n,i,r){return pi.getInterpolation(t,this.a,this.b,this.c,e,n,i,r)}containsPoint(t){return pi.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return pi.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const n=this.a,i=this.b,r=this.c;let a,s;ri.subVectors(i,n),ai.subVectors(r,n),oi.subVectors(t,n);const o=ri.dot(oi),l=ai.dot(oi);if(o<=0&&l<=0)return e.copy(n);li.subVectors(t,i);const c=ri.dot(li),u=ai.dot(li);if(c>=0&&u<=c)return e.copy(i);const h=o*u-c*l;if(h<=0&&o>=0&&c<=0)return a=o/(o-c),e.copy(n).addScaledVector(ri,a);ci.subVectors(t,r);const d=ri.dot(ci),p=ai.dot(ci);if(p>=0&&d<=p)return e.copy(r);const f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),e.copy(n).addScaledVector(ai,s);const m=c*p-d*u;if(m<=0&&u-c>=0&&d-p>=0)return si.subVectors(r,i),s=(u-c)/(u-c+(d-p)),e.copy(i).addScaledVector(si,s);const g=1/(m+f+h);return a=f*g,s=h*g,e.copy(n).addScaledVector(ri,a).addScaledVector(ai,s)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}const fi={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},mi={h:0,s:0,l:0},gi={h:0,s:0,l:0};function _i(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+6*(e-t)*n:n<.5?e:n<2/3?t+6*(e-t)*(2/3-n):t}class vi{constructor(t,e,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,n)}set(t,e,n){if(void 0===e&&void 0===n){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,n);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Kt){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Ue.toWorkingColorSpace(this,e),this}setRGB(t,e,n,i=Ue.workingColorSpace){return this.r=t,this.g=e,this.b=n,Ue.toWorkingColorSpace(this,i),this}setHSL(t,e,n,i=Ue.workingColorSpace){if(t=ve(t,1),e=_e(e,0,1),n=_e(n,0,1),0===e)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+e):n+e-n*e,r=2*n-i;this.r=_i(r,i,t+1/3),this.g=_i(r,i,t),this.b=_i(r,i,t-1/3)}return Ue.toWorkingColorSpace(this,i),this}setStyle(t,e=Kt){function n(e){void 0!==e&&parseFloat(e)<1&&console.warn("THREE.Color: Alpha component of "+t+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const a=i[1],s=i[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return n(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:console.warn("THREE.Color: Unknown color model "+t)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(t)){const n=i[1],r=n.length;if(3===r)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(n,16),e);console.warn("THREE.Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Kt){const n=fi[t.toLowerCase()];return void 0!==n?this.setHex(n,e):console.warn("THREE.Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=Ie(t.r),this.g=Ie(t.g),this.b=Ie(t.b),this}copyLinearToSRGB(t){return this.r=Ne(t.r),this.g=Ne(t.g),this.b=Ne(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Kt){return Ue.fromWorkingColorSpace(xi.copy(this),t),65536*Math.round(_e(255*xi.r,0,255))+256*Math.round(_e(255*xi.g,0,255))+Math.round(_e(255*xi.b,0,255))}getHexString(t=Kt){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Ue.workingColorSpace){Ue.fromWorkingColorSpace(xi.copy(this),e);const n=xi.r,i=xi.g,r=xi.b,a=Math.max(n,i,r),s=Math.min(n,i,r);let o,l;const c=(s+a)/2;if(s===a)o=0,l=0;else{const t=a-s;switch(l=c<=.5?t/(a+s):t/(2-a-s),a){case n:o=(i-r)/t+(i<r?6:0);break;case i:o=(r-n)/t+2;break;case r:o=(n-i)/t+4}o/=6}return t.h=o,t.s=l,t.l=c,t}getRGB(t,e=Ue.workingColorSpace){return Ue.fromWorkingColorSpace(xi.copy(this),e),t.r=xi.r,t.g=xi.g,t.b=xi.b,t}getStyle(t=Kt){Ue.fromWorkingColorSpace(xi.copy(this),t);const e=xi.r,n=xi.g,i=xi.b;return t!==Kt?`color(${t} ${e.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*n)},${Math.round(255*i)})`}offsetHSL(t,e,n){return this.getHSL(mi),this.setHSL(mi.h+t,mi.s+e,mi.l+n)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,n){return this.r=t.r+(e.r-t.r)*n,this.g=t.g+(e.g-t.g)*n,this.b=t.b+(e.b-t.b)*n,this}lerpHSL(t,e){this.getHSL(mi),t.getHSL(gi);const n=xe(mi.h,gi.h,e),i=xe(mi.s,gi.s,e),r=xe(mi.l,gi.l,e);return this.setHSL(n,i,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,n=this.g,i=this.b,r=t.elements;return this.r=r[0]*e+r[3]*n+r[6]*i,this.g=r[1]*e+r[4]*n+r[7]*i,this.b=r[2]*e+r[5]*n+r[8]*i,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const xi=new vi;vi.NAMES=fi;let yi=0;class Mi extends de{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:yi++}),this.uuid=ge(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=s,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new vi(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Qt,this.stencilZFail=Qt,this.stencilZPass=Qt,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const n=t[e];if(void 0===n){console.warn(`THREE.Material: parameter '${e}' has value of undefined.`);continue}const i=this[e];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[e]=n:console.warn(`THREE.Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const n={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function i(t){const e=[];for(const n in t){const i=t[n];delete i.metadata,e.push(i)}return e}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(t).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(t).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(t).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(t).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(t).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(n.blending=this.blending),0!==this.side&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),204!==this.blendSrc&&(n.blendSrc=this.blendSrc),205!==this.blendDst&&(n.blendDst=this.blendDst),this.blendEquation!==s&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Qt&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Qt&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Qt&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),e){const e=i(t.textures),r=i(t.images);e.length>0&&(n.textures=e),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let n=null;if(null!==e){const t=e.length;n=new Array(t);for(let i=0;i!==t;++i)n[i]=e[i].clone()}return this.clippingPlanes=n,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}}class Si extends Mi{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new vi(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new On,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,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.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),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.fog=t.fog,this}}const Ti=new Ke,Ei=new Se;let bi=0;class wi{constructor(t,e,n=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:bi++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=n,this.usage=le,this.updateRanges=[],this.gpuType=$,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,n){t*=this.itemSize,n*=e.itemSize;for(let i=0,r=this.itemSize;i<r;i++)this.array[t+i]=e.array[n+i];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,n=this.count;e<n;e++)Ei.fromBufferAttribute(this,e),Ei.applyMatrix3(t),this.setXY(e,Ei.x,Ei.y);else if(3===this.itemSize)for(let e=0,n=this.count;e<n;e++)Ti.fromBufferAttribute(this,e),Ti.applyMatrix3(t),this.setXYZ(e,Ti.x,Ti.y,Ti.z);return this}applyMatrix4(t){for(let e=0,n=this.count;e<n;e++)Ti.fromBufferAttribute(this,e),Ti.applyMatrix4(t),this.setXYZ(e,Ti.x,Ti.y,Ti.z);return this}applyNormalMatrix(t){for(let e=0,n=this.count;e<n;e++)Ti.fromBufferAttribute(this,e),Ti.applyNormalMatrix(t),this.setXYZ(e,Ti.x,Ti.y,Ti.z);return this}transformDirection(t){for(let e=0,n=this.count;e<n;e++)Ti.fromBufferAttribute(this,e),Ti.transformDirection(t),this.setXYZ(e,Ti.x,Ti.y,Ti.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let n=this.array[t*this.itemSize+e];return this.normalized&&(n=ye(n,this.array)),n}setComponent(t,e,n){return this.normalized&&(n=Me(n,this.array)),this.array[t*this.itemSize+e]=n,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=ye(e,this.array)),e}setX(t,e){return this.normalized&&(e=Me(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=ye(e,this.array)),e}setY(t,e){return this.normalized&&(e=Me(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=ye(e,this.array)),e}setZ(t,e){return this.normalized&&(e=Me(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=ye(e,this.array)),e}setW(t,e){return this.normalized&&(e=Me(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,n){return t*=this.itemSize,this.normalized&&(e=Me(e,this.array),n=Me(n,this.array)),this.array[t+0]=e,this.array[t+1]=n,this}setXYZ(t,e,n,i){return t*=this.itemSize,this.normalized&&(e=Me(e,this.array),n=Me(n,this.array),i=Me(i,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this}setXYZW(t,e,n,i,r){return t*=this.itemSize,this.normalized&&(e=Me(e,this.array),n=Me(n,this.array),i=Me(i,this.array),r=Me(r,this.array)),this.array[t+0]=e,this.array[t+1]=n,this.array[t+2]=i,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==le&&(t.usage=this.usage),t}}class Ai extends wi{constructor(t,e,n){super(new Uint16Array(t),e,n)}}class Ri extends wi{constructor(t,e,n){super(new Uint32Array(t),e,n)}}class Ci extends wi{constructor(t,e,n){super(new Float32Array(t),e,n)}}let Pi=0;const Li=new wn,Di=new Qn,Ui=new Ke,Ii=new $e,Ni=new $e,Oi=new Ke;class Fi extends de{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:Pi++}),this.uuid=ge(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(be(t)?Ri:Ai)(t,1):this.index=t,this}setIndirect(t){return this.indirect=t,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,n=0){this.groups.push({start:t,count:e,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const e=(new Te).getNormalMatrix(t);n.applyNormalMatrix(e),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(t),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return Li.makeRotationFromQuaternion(t),this.applyMatrix4(Li),this}rotateX(t){return Li.makeRotationX(t),this.applyMatrix4(Li),this}rotateY(t){return Li.makeRotationY(t),this.applyMatrix4(Li),this}rotateZ(t){return Li.makeRotationZ(t),this.applyMatrix4(Li),this}translate(t,e,n){return Li.makeTranslation(t,e,n),this.applyMatrix4(Li),this}scale(t,e,n){return Li.makeScale(t,e,n),this.applyMatrix4(Li),this}lookAt(t){return Di.lookAt(t),Di.updateMatrix(),this.applyMatrix4(Di.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Ui).negate(),this.translate(Ui.x,Ui.y,Ui.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let n=0,i=t.length;n<i;n++){const i=t[n];e.push(i.x,i.y,i.z||0)}this.setAttribute("position",new Ci(e,3))}else{const n=Math.min(t.length,e.count);for(let i=0;i<n;i++){const n=t[i];e.setXYZ(i,n.x,n.y,n.z||0)}t.length>e.count&&console.warn("THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new $e);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Ke(-1/0,-1/0,-1/0),new Ke(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Ii.setFromBufferAttribute(n),this.morphTargetsRelative?(Oi.addVectors(this.boundingBox.min,Ii.min),this.boundingBox.expandByPoint(Oi),Oi.addVectors(this.boundingBox.max,Ii.max),this.boundingBox.expandByPoint(Oi)):(this.boundingBox.expandByPoint(Ii.min),this.boundingBox.expandByPoint(Ii.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new _n);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new Ke,1/0);if(t){const n=this.boundingSphere.center;if(Ii.setFromBufferAttribute(t),e)for(let t=0,n=e.length;t<n;t++){const n=e[t];Ni.setFromBufferAttribute(n),this.morphTargetsRelative?(Oi.addVectors(Ii.min,Ni.min),Ii.expandByPoint(Oi),Oi.addVectors(Ii.max,Ni.max),Ii.expandByPoint(Oi)):(Ii.expandByPoint(Ni.min),Ii.expandByPoint(Ni.max))}Ii.getCenter(n);let i=0;for(let e=0,r=t.count;e<r;e++)Oi.fromBufferAttribute(t,e),i=Math.max(i,n.distanceToSquared(Oi));if(e)for(let r=0,a=e.length;r<a;r++){const a=e[r],s=this.morphTargetsRelative;for(let e=0,r=a.count;e<r;e++)Oi.fromBufferAttribute(a,e),s&&(Ui.fromBufferAttribute(t,e),Oi.add(Ui)),i=Math.max(i,n.distanceToSquared(Oi))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const n=e.position,i=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new wi(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),s=[],o=[];for(let t=0;t<n.count;t++)s[t]=new Ke,o[t]=new Ke;const l=new Ke,c=new Ke,u=new Ke,h=new Se,d=new Se,p=new Se,f=new Ke,m=new Ke;function g(t,e,i){l.fromBufferAttribute(n,t),c.fromBufferAttribute(n,e),u.fromBufferAttribute(n,i),h.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),p.fromBufferAttribute(r,i),c.sub(l),u.sub(l),d.sub(h),p.sub(h);const a=1/(d.x*p.y-p.x*d.y);isFinite(a)&&(f.copy(c).multiplyScalar(p.y).addScaledVector(u,-d.y).multiplyScalar(a),m.copy(u).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(a),s[t].add(f),s[e].add(f),s[i].add(f),o[t].add(m),o[e].add(m),o[i].add(m))}let _=this.groups;0===_.length&&(_=[{start:0,count:t.count}]);for(let e=0,n=_.length;e<n;++e){const n=_[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)g(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const v=new Ke,x=new Ke,y=new Ke,M=new Ke;function S(t){y.fromBufferAttribute(i,t),M.copy(y);const e=s[t];v.copy(e),v.sub(y.multiplyScalar(y.dot(e))).normalize(),x.crossVectors(M,e);const n=x.dot(o[t])<0?-1:1;a.setXYZW(t,v.x,v.y,v.z,n)}for(let e=0,n=_.length;e<n;++e){const n=_[e],i=n.start;for(let e=i,r=i+n.count;e<r;e+=3)S(t.getX(e+0)),S(t.getX(e+1)),S(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let n=this.getAttribute("normal");if(void 0===n)n=new wi(new Float32Array(3*e.count),3),this.setAttribute("normal",n);else for(let t=0,e=n.count;t<e;t++)n.setXYZ(t,0,0,0);const i=new Ke,r=new Ke,a=new Ke,s=new Ke,o=new Ke,l=new Ke,c=new Ke,u=new Ke;if(t)for(let h=0,d=t.count;h<d;h+=3){const d=t.getX(h+0),p=t.getX(h+1),f=t.getX(h+2);i.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),a.fromBufferAttribute(e,f),c.subVectors(a,r),u.subVectors(i,r),c.cross(u),s.fromBufferAttribute(n,d),o.fromBufferAttribute(n,p),l.fromBufferAttribute(n,f),s.add(c),o.add(c),l.add(c),n.setXYZ(d,s.x,s.y,s.z),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(f,l.x,l.y,l.z)}else for(let t=0,s=e.count;t<s;t+=3)i.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),a.fromBufferAttribute(e,t+2),c.subVectors(a,r),u.subVectors(i,r),c.cross(u),n.setXYZ(t+0,c.x,c.y,c.z),n.setXYZ(t+1,c.x,c.y,c.z),n.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,n=t.count;e<n;e++)Oi.fromBufferAttribute(t,e),Oi.normalize(),t.setXYZ(e,Oi.x,Oi.y,Oi.z)}toNonIndexed(){function t(t,e){const n=t.array,i=t.itemSize,r=t.normalized,a=new n.constructor(e.length*i);let s=0,o=0;for(let r=0,l=e.length;r<l;r++){s=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*i;for(let t=0;t<i;t++)a[o++]=n[s++]}return new wi(a,i,r)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Fi,n=this.index.array,i=this.attributes;for(const r in i){const a=t(i[r],n);e.setAttribute(r,a)}const r=this.morphAttributes;for(const i in r){const a=[],s=r[i];for(let e=0,i=s.length;e<i;e++){const i=t(s[e],n);a.push(i)}e.morphAttributes[i]=a}e.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let t=0,n=a.length;t<n;t++){const n=a[t];e.addGroup(n.start,n.count,n.materialIndex)}return e}toJSON(){const t={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const n in e)void 0!==e[n]&&(t[n]=e[n]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const n=this.attributes;for(const e in n){const i=n[e];t.data.attributes[e]=i.toJSON(t.data)}const i={};let r=!1;for(const e in this.morphAttributes){const n=this.morphAttributes[e],a=[];for(let e=0,i=n.length;e<i;e++){const i=n[e];a.push(i.toJSON(t.data))}a.length>0&&(i[e]=a,r=!0)}r&&(t.data.morphAttributes=i,t.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(t.data.groups=JSON.parse(JSON.stringify(a)));const s=this.boundingSphere;return null!==s&&(t.data.boundingSphere={center:s.center.toArray(),radius:s.radius}),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const n=t.index;null!==n&&this.setIndex(n.clone());const i=t.attributes;for(const t in i){const n=i[t];this.setAttribute(t,n.clone(e))}const r=t.morphAttributes;for(const t in r){const n=[],i=r[t];for(let t=0,r=i.length;t<r;t++)n.push(i[t].clone(e));this.morphAttributes[t]=n}this.morphTargetsRelative=t.morphTargetsRelative;const a=t.groups;for(let t=0,e=a.length;t<e;t++){const e=a[t];this.addGroup(e.start,e.count,e.materialIndex)}const s=t.boundingBox;null!==s&&(this.boundingBox=s.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Bi=new wn,zi=new bn,Vi=new _n,Hi=new Ke,ki=new Ke,Gi=new Ke,Wi=new Ke,Xi=new Ke,ji=new Ke,qi=new Ke,Yi=new Ke;class Ki extends Qn{constructor(t=new Fi,e=new Si){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const n=t[e[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=n.length;t<e;t++){const e=n[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const n=this.geometry,i=n.attributes.position,r=n.morphAttributes.position,a=n.morphTargetsRelative;e.fromBufferAttribute(i,t);const s=this.morphTargetInfluences;if(r&&s){ji.set(0,0,0);for(let n=0,i=r.length;n<i;n++){const i=s[n],o=r[n];0!==i&&(Xi.fromBufferAttribute(o,t),a?ji.addScaledVector(Xi,i):ji.addScaledVector(Xi.sub(e),i))}e.add(ji)}return e}raycast(t,e){const n=this.geometry,i=this.material,r=this.matrixWorld;if(void 0!==i){if(null===n.boundingSphere&&n.computeBoundingSphere(),Vi.copy(n.boundingSphere),Vi.applyMatrix4(r),zi.copy(t.ray).recast(t.near),!1===Vi.containsPoint(zi.origin)){if(null===zi.intersectSphere(Vi,Hi))return;if(zi.origin.distanceToSquared(Hi)>(t.far-t.near)**2)return}Bi.copy(r).invert(),zi.copy(t.ray).applyMatrix4(Bi),null!==n.boundingBox&&!1===zi.intersectsBox(n.boundingBox)||this._computeIntersections(t,e,zi)}}_computeIntersections(t,e,n){let i;const r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,u=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let r=0,o=h.length;r<o;r++){const o=h[r],p=a[o.materialIndex];for(let r=Math.max(o.start,d.start),a=Math.min(s.count,Math.min(o.start+o.count,d.start+d.count));r<a;r+=3){i=Zi(this,p,t,n,l,c,u,s.getX(r),s.getX(r+1),s.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=o.materialIndex,e.push(i))}}else{for(let r=Math.max(0,d.start),o=Math.min(s.count,d.start+d.count);r<o;r+=3){i=Zi(this,a,t,n,l,c,u,s.getX(r),s.getX(r+1),s.getX(r+2)),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}else if(void 0!==o)if(Array.isArray(a))for(let r=0,s=h.length;r<s;r++){const s=h[r],p=a[s.materialIndex];for(let r=Math.max(s.start,d.start),a=Math.min(o.count,Math.min(s.start+s.count,d.start+d.count));r<a;r+=3){i=Zi(this,p,t,n,l,c,u,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),i.face.materialIndex=s.materialIndex,e.push(i))}}else{for(let r=Math.max(0,d.start),s=Math.min(o.count,d.start+d.count);r<s;r+=3){i=Zi(this,a,t,n,l,c,u,r,r+1,r+2),i&&(i.faceIndex=Math.floor(r/3),e.push(i))}}}}function Zi(t,e,n,i,r,a,s,o,l,c){t.getVertexPosition(o,ki),t.getVertexPosition(l,Gi),t.getVertexPosition(c,Wi);const u=function(t,e,n,i,r,a,s,o){let l;if(l=1===e.side?i.intersectTriangle(s,a,r,!0,o):i.intersectTriangle(r,a,s,0===e.side,o),null===l)return null;Yi.copy(o),Yi.applyMatrix4(t.matrixWorld);const c=n.ray.origin.distanceTo(Yi);return c<n.near||c>n.far?null:{distance:c,point:Yi.clone(),object:t}}(t,e,n,i,ki,Gi,Wi,qi);if(u){const t=new Ke;pi.getBarycoord(qi,ki,Gi,Wi,t),r&&(u.uv=pi.getInterpolatedAttribute(r,o,l,c,t,new Se)),a&&(u.uv1=pi.getInterpolatedAttribute(a,o,l,c,t,new Se)),s&&(u.normal=pi.getInterpolatedAttribute(s,o,l,c,t,new Ke),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));const e={a:o,b:l,c,normal:new Ke,materialIndex:0};pi.getNormal(ki,Gi,Wi,e.normal),u.face=e,u.barycoord=t}return u}class Ji extends Fi{constructor(t=1,e=1,n=1,i=1,r=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const o=[],l=[],c=[],u=[];let h=0,d=0;function p(t,e,n,i,r,a,p,f,m,g,_){const v=a/m,x=p/g,y=a/2,M=p/2,S=f/2,T=m+1,E=g+1;let b=0,w=0;const A=new Ke;for(let a=0;a<E;a++){const s=a*x-M;for(let o=0;o<T;o++){const h=o*v-y;A[t]=h*i,A[e]=s*r,A[n]=S,l.push(A.x,A.y,A.z),A[t]=0,A[e]=0,A[n]=f>0?1:-1,c.push(A.x,A.y,A.z),u.push(o/m),u.push(1-a/g),b+=1}}for(let t=0;t<g;t++)for(let e=0;e<m;e++){const n=h+e+T*t,i=h+e+T*(t+1),r=h+(e+1)+T*(t+1),a=h+(e+1)+T*t;o.push(n,i,a),o.push(i,r,a),w+=6}s.addGroup(d,w,_),d+=w,h+=b}p("z","y","x",-1,-1,n,e,t,a,r,0),p("z","y","x",1,-1,n,e,-t,a,r,1),p("x","z","y",1,1,t,n,e,i,a,2),p("x","z","y",1,-1,t,n,-e,i,a,3),p("x","y","z",1,-1,t,e,n,i,r,4),p("x","y","z",-1,-1,t,e,-n,i,r,5),this.setIndex(o),this.setAttribute("position",new Ci(l,3)),this.setAttribute("normal",new Ci(c,3)),this.setAttribute("uv",new Ci(u,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Ji(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}function $i(t){const e={};for(const n in t){e[n]={};for(const i in t[n]){const r=t[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[n][i]=null):e[n][i]=r.clone():Array.isArray(r)?e[n][i]=r.slice():e[n][i]=r}}return e}function Qi(t){const e={};for(let n=0;n<t.length;n++){const i=$i(t[n]);for(const t in i)e[t]=i[t]}return e}function tr(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:Ue.workingColorSpace}const er={clone:$i,merge:Qi};class nr extends Mi{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=$i(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let n=0;n<t.length;n++)e.push(t[n].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const n in this.uniforms){const i=this.uniforms[n].value;i&&i.isTexture?e.uniforms[n]={type:"t",value:i.toJSON(t).uuid}:i&&i.isColor?e.uniforms[n]={type:"c",value:i.getHex()}:i&&i.isVector2?e.uniforms[n]={type:"v2",value:i.toArray()}:i&&i.isVector3?e.uniforms[n]={type:"v3",value:i.toArray()}:i&&i.isVector4?e.uniforms[n]={type:"v4",value:i.toArray()}:i&&i.isMatrix3?e.uniforms[n]={type:"m3",value:i.toArray()}:i&&i.isMatrix4?e.uniforms[n]={type:"m4",value:i.toArray()}:e.uniforms[n]={value:i}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const n={};for(const t in this.extensions)!0===this.extensions[t]&&(n[t]=!0);return Object.keys(n).length>0&&(e.extensions=n),e}}class ir extends Qn{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new wn,this.projectionMatrix=new wn,this.projectionMatrixInverse=new wn,this.coordinateSystem=ue}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return(new this.constructor).copy(this)}}const rr=new Ke,ar=new Se,sr=new Se;class or extends ir{constructor(t=50,e=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*me*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*fe*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*me*Math.atan(Math.tan(.5*fe*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,n){rr.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(rr.x,rr.y).multiplyScalar(-t/rr.z),rr.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(rr.x,rr.y).multiplyScalar(-t/rr.z)}getViewSize(t,e){return this.getViewBounds(t,ar,sr),e.subVectors(sr,ar)}setViewOffset(t,e,n,i,r,a){this.aspect=t/e,null===this.view&&(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=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*fe*this.fov)/this.zoom,n=2*e,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const t=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/t,e-=a.offsetY*n/s,i*=a.width/t,n*=a.height/s}const s=this.filmOffset;0!==s&&(r+=t*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,e,e-n,t,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const lr=-90;class cr extends Qn{constructor(t,e,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new or(lr,1,t,e);i.layers=this.layers,this.add(i);const r=new or(lr,1,t,e);r.layers=this.layers,this.add(r);const a=new or(lr,1,t,e);a.layers=this.layers,this.add(a);const s=new or(lr,1,t,e);s.layers=this.layers,this.add(s);const o=new or(lr,1,t,e);o.layers=this.layers,this.add(o);const l=new or(lr,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[n,i,r,a,s,o]=e;for(const t of e)this.remove(t);if(t===ue)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==he)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,a,s,o,l,c]=this.children,u=t.getRenderTarget(),h=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const f=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,t.setRenderTarget(n,0,i),t.render(e,r),t.setRenderTarget(n,1,i),t.render(e,a),t.setRenderTarget(n,2,i),t.render(e,s),t.setRenderTarget(n,3,i),t.render(e,o),t.setRenderTarget(n,4,i),t.render(e,l),n.texture.generateMipmaps=f,t.setRenderTarget(n,5,i),t.render(e,c),t.setRenderTarget(u,h,d),t.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class ur extends ke{constructor(t=[],e=301,n,i,r,a,s,o,l,c){super(t,e,n,i,r,a,s,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class hr extends Xe{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const n={width:t,height:t,depth:1},i=[n,n,n,n,n,n];this.texture=new ur(i,e.mapping,e.wrapS,e.wrapT,e.magFilter,e.minFilter,e.format,e.type,e.anisotropy,e.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==e.generateMipmaps&&e.generateMipmaps,this.texture.minFilter=void 0!==e.minFilter?e.minFilter:G}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},i=new Ji(5,5,5),r=new nr({name:"CubemapFromEquirect",uniforms:$i(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const a=new Ki(i,r),s=e.minFilter;e.minFilter===X&&(e.minFilter=G);return new cr(1,10,this).update(t,a),e.minFilter=s,a.geometry.dispose(),a.material.dispose(),this}clear(t,e=!0,n=!0,i=!0){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,n,i);t.setRenderTarget(r)}}class dr extends Qn{constructor(){super(),this.isGroup=!0,this.type="Group"}}const pr={type:"move"};class fr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new dr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new dr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Ke,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Ke),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new dr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Ke,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Ke),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const n of t.hand.values())this._getHandJoint(e,n)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,n){let i=null,r=null,a=null;const s=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){a=!0;for(const i of t.hand.values()){const t=e.getJointPose(i,n),r=this._getHandJoint(l,i);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const i=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],s=i.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&s>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&s<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==s&&(i=e.getPose(t.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(pr)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const n=new dr;n.matrixAutoUpdate=!1,n.visible=!1,t.joints[e.jointName]=n,t.add(n)}return t.joints[e.jointName]}}class mr extends Qn{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new On,this.environmentIntensity=1,this.environmentRotation=new On,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}const gr=new Ke,_r=new Ke,vr=new Te;class xr{constructor(t=new Ke(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,n,i){return this.normal.set(t,e,n),this.constant=i,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,n){const i=gr.subVectors(n,e).cross(_r.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(i,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const n=t.delta(gr),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/i;return r<0||r>1?null:e.copy(t.start).addScaledVector(n,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),n=this.distanceToPoint(t.end);return e<0&&n>0||n<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const n=e||vr.getNormalMatrix(t),i=this.coplanarPoint(gr).applyMatrix4(t),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const yr=new _n,Mr=new Ke;class Sr{constructor(t=new xr,e=new xr,n=new xr,i=new xr,r=new xr,a=new xr){this.planes=[t,e,n,i,r,a]}set(t,e,n,i,r,a){const s=this.planes;return s[0].copy(t),s[1].copy(e),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(t){const e=this.planes;for(let n=0;n<6;n++)e[n].copy(t.planes[n]);return this}setFromProjectionMatrix(t,e=2e3){const n=this.planes,i=t.elements,r=i[0],a=i[1],s=i[2],o=i[3],l=i[4],c=i[5],u=i[6],h=i[7],d=i[8],p=i[9],f=i[10],m=i[11],g=i[12],_=i[13],v=i[14],x=i[15];if(n[0].setComponents(o-r,h-l,m-d,x-g).normalize(),n[1].setComponents(o+r,h+l,m+d,x+g).normalize(),n[2].setComponents(o+a,h+c,m+p,x+_).normalize(),n[3].setComponents(o-a,h-c,m-p,x-_).normalize(),n[4].setComponents(o-s,h-u,m-f,x-v).normalize(),e===ue)n[5].setComponents(o+s,h+u,m+f,x+v).normalize();else{if(e!==he)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(s,u,f,v).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),yr.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),yr.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(yr)}intersectsSprite(t){return yr.center.set(0,0,0),yr.radius=.7071067811865476,yr.applyMatrix4(t.matrixWorld),this.intersectsSphere(yr)}intersectsSphere(t){const e=this.planes,n=t.center,i=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(n)<i)return!1}return!0}intersectsBox(t){const e=this.planes;for(let n=0;n<6;n++){const i=e[n];if(Mr.x=i.normal.x>0?t.max.x:t.min.x,Mr.y=i.normal.y>0?t.max.y:t.min.y,Mr.z=i.normal.z>0?t.max.z:t.min.z,i.distanceToPoint(Mr)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let n=0;n<6;n++)if(e[n].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}class Tr extends ke{constructor(t,e,n=1014,i,r,a,s=1003,o=1003,l,c=1026){if(c!==at&&c!==st)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super(null,i,r,a,s,o,c,n,l),this.isDepthTexture=!0,this.image={width:t,height:e},this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new ze(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class Er extends Fi{constructor(t=1,e=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:n,heightSegments:i};const r=t/2,a=e/2,s=Math.floor(n),o=Math.floor(i),l=s+1,c=o+1,u=t/s,h=e/o,d=[],p=[],f=[],m=[];for(let t=0;t<c;t++){const e=t*h-a;for(let n=0;n<l;n++){const i=n*u-r;p.push(i,-e,0),f.push(0,0,1),m.push(n/s),m.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<s;e++){const n=e+l*t,i=e+l*(t+1),r=e+1+l*(t+1),a=e+1+l*t;d.push(n,i,a),d.push(i,r,a)}this.setIndex(d),this.setAttribute("position",new Ci(p,3)),this.setAttribute("normal",new Ci(f,3)),this.setAttribute("uv",new Ci(m,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new Er(t.width,t.height,t.widthSegments,t.heightSegments)}}class br extends Mi{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class wr extends Mi{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function Ar(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function Rr(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}class Cr{constructor(t,e,n,i){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new e.constructor(n),this.sampleValues=e,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let n=this._cachedIndex,i=e[n],r=e[n-1];t:{e:{let a;n:{i:if(!(t<i)){for(let a=n+2;;){if(void 0===i){if(t<r)break i;return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===a)break;if(r=i,i=e[++n],t<i)break e}a=e.length;break n}if(t>=r)break t;{const s=e[1];t<s&&(n=2,r=s);for(let a=n-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(n===a)break;if(i=r,r=e[--n-1],t>=r)break e}a=n,n=0}}for(;n<a;){const i=n+a>>>1;t<e[i]?a=i:n=i+1}if(i=e[n],r=e[n-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===i)return n=e.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,t,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=t*i;for(let t=0;t!==i;++t)e[t]=n[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Pr extends Cr{constructor(t,e,n,i){super(t,e,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Xt,endingEnd:Xt}}intervalChanged_(t,e,n){const i=this.parameterPositions;let r=t-2,a=t+1,s=i[r],o=i[a];if(void 0===s)switch(this.getSettings_().endingStart){case jt:r=t,s=2*e-n;break;case qt:r=i.length-2,s=e+i[r]-i[r+1];break;default:r=t,s=n}if(void 0===o)switch(this.getSettings_().endingEnd){case jt:a=t,o=2*n-e;break;case qt:a=1,o=n+i[1]-i[0];break;default:a=t-1,o=e}const l=.5*(n-e),c=this.valueSize;this._weightPrev=l/(e-s),this._weightNext=l/(o-n),this._offsetPrev=r*c,this._offsetNext=a*c}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=t*s,l=o-s,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,p=(n-e)/(i-e),f=p*p,m=f*p,g=-h*m+2*h*f-h*p,_=(1+h)*m+(-1.5-2*h)*f+(-.5+h)*p+1,v=(-1-d)*m+(1.5+d)*f+.5*p,x=d*m-d*f;for(let t=0;t!==s;++t)r[t]=g*a[c+t]+_*a[l+t]+v*a[o+t]+x*a[u+t];return r}}class Lr extends Cr{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=t*s,l=o-s,c=(n-e)/(i-e),u=1-c;for(let t=0;t!==s;++t)r[t]=a[l+t]*u+a[o+t]*c;return r}}class Dr extends Cr{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t){return this.copySampleValue_(t-1)}}class Ur{constructor(t,e,n,i){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Ar(e,this.TimeBufferType),this.values=Ar(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let n;if(e.toJSON!==this.toJSON)n=e.toJSON(t);else{n={name:t.name,times:Ar(t.times,Array),values:Ar(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(n.interpolation=e)}return n.type=t.ValueTypeName,n}InterpolantFactoryMethodDiscrete(t){return new Dr(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new Lr(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new Pr(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case kt:e=this.InterpolantFactoryMethodDiscrete;break;case Gt:e=this.InterpolantFactoryMethodLinear;break;case Wt:e=this.InterpolantFactoryMethodSmooth}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return console.warn("THREE.KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return kt;case this.InterpolantFactoryMethodLinear:return Gt;case this.InterpolantFactoryMethodSmooth:return Wt}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let n=0,i=e.length;n!==i;++n)e[n]*=t}return this}trim(t,e){const n=this.times,i=n.length;let r=0,a=i-1;for(;r!==i&&n[r]<t;)++r;for(;-1!==a&&n[a]>e;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const t=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*t,a*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);const n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let a=null;for(let e=0;e!==r;e++){const i=n[e];if("number"==typeof i&&isNaN(i)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,e,i),t=!1;break}if(null!==a&&a>i){console.error("THREE.KeyframeTrack: Out of order keys.",this,e,i,a),t=!1;break}a=i}if(void 0!==i&&Rr(i))for(let e=0,n=i.length;e!==n;++e){const n=i[e];if(isNaN(n)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,e,n),t=!1;break}}return t}optimize(){const t=this.times.slice(),e=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===Wt,r=t.length-1;let a=1;for(let s=1;s<r;++s){let r=!1;const o=t[s];if(o!==t[s+1]&&(1!==s||o!==t[0]))if(i)r=!0;else{const t=s*n,i=t-n,a=t+n;for(let s=0;s!==n;++s){const n=e[t+s];if(n!==e[i+s]||n!==e[a+s]){r=!0;break}}}if(r){if(s!==a){t[a]=t[s];const i=s*n,r=a*n;for(let t=0;t!==n;++t)e[r+t]=e[i+t]}++a}}if(r>0){t[a]=t[r];for(let t=r*n,i=a*n,s=0;s!==n;++s)e[i+s]=e[t+s];++a}return a!==t.length?(this.times=t.slice(0,a),this.values=e.slice(0,a*n)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),n=new(0,this.constructor)(this.name,t,e);return n.createInterpolant=this.createInterpolant,n}}Ur.prototype.ValueTypeName="",Ur.prototype.TimeBufferType=Float32Array,Ur.prototype.ValueBufferType=Float32Array,Ur.prototype.DefaultInterpolation=Gt;class Ir extends Ur{constructor(t,e,n){super(t,e,n)}}Ir.prototype.ValueTypeName="bool",Ir.prototype.ValueBufferType=Array,Ir.prototype.DefaultInterpolation=kt,Ir.prototype.InterpolantFactoryMethodLinear=void 0,Ir.prototype.InterpolantFactoryMethodSmooth=void 0;class Nr extends Ur{constructor(t,e,n,i){super(t,e,n,i)}}Nr.prototype.ValueTypeName="color";class Or extends Ur{constructor(t,e,n,i){super(t,e,n,i)}}Or.prototype.ValueTypeName="number";class Fr extends Cr{constructor(t,e,n,i){super(t,e,n,i)}interpolate_(t,e,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-e)/(i-e);let l=t*s;for(let t=l+s;l!==t;l+=4)Ye.slerpFlat(r,0,a,l-s,a,l,o);return r}}class Br extends Ur{constructor(t,e,n,i){super(t,e,n,i)}InterpolantFactoryMethodLinear(t){return new Fr(this.times,this.values,this.getValueSize(),t)}}Br.prototype.ValueTypeName="quaternion",Br.prototype.InterpolantFactoryMethodSmooth=void 0;class zr extends Ur{constructor(t,e,n){super(t,e,n)}}zr.prototype.ValueTypeName="string",zr.prototype.ValueBufferType=Array,zr.prototype.DefaultInterpolation=kt,zr.prototype.InterpolantFactoryMethodLinear=void 0,zr.prototype.InterpolantFactoryMethodSmooth=void 0;class Vr extends Ur{constructor(t,e,n,i){super(t,e,n,i)}}Vr.prototype.ValueTypeName="vector";const Hr={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(this.files[t]=e)},get:function(t){if(!1!==this.enabled)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class kr{constructor(t,e,n){const i=this;let r,a=!1,s=0,o=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=n,this.itemStart=function(t){o++,!1===a&&void 0!==i.onStart&&i.onStart(t,s,o),a=!0},this.itemEnd=function(t){s++,void 0!==i.onProgress&&i.onProgress(t,s,o),s===o&&(a=!1,void 0!==i.onLoad&&i.onLoad())},this.itemError=function(t){void 0!==i.onError&&i.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,n=l.length;e<n;e+=2){const n=l[e],i=l[e+1];if(n.global&&(n.lastIndex=0),n.test(t))return i}return null}}}const Gr=new kr;class Wr{constructor(t){this.manager=void 0!==t?t:Gr,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){const n=this;return new Promise((function(i,r){n.load(t,i,e,r)}))}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}}Wr.DEFAULT_MATERIAL_NAME="__DEFAULT";Error;class Xr extends Wr{constructor(t){super(t)}load(t,e,n,i){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,a=Hr.get(t);if(void 0!==a)return r.manager.itemStart(t),setTimeout((function(){e&&e(a),r.manager.itemEnd(t)}),0),a;const s=we("img");function o(){c(),Hr.add(t,this),e&&e(this),r.manager.itemEnd(t)}function l(e){c(),i&&i(e),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){s.removeEventListener("load",o,!1),s.removeEventListener("error",l,!1)}return s.addEventListener("load",o,!1),s.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(s.crossOrigin=this.crossOrigin),r.manager.itemStart(t),s.src=t,s}}class jr extends Wr{constructor(t){super(t)}load(t,e,n,i){const r=new ke,a=new Xr(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(t,(function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)}),n,i),r}}class qr extends ir{constructor(t=-1,e=1,n=1,i=-1,r=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),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=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,n,i,r,a){null===this.view&&(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=e,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-t,a=n+t,s=i+e,o=i-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,a=r+t*this.view.width,s-=e*this.view.offsetY,o=s-e*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class Yr extends or{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}const Kr="\\[\\]\\.:\\/",Zr=new RegExp("["+Kr+"]","g"),Jr="[^"+Kr+"]",$r="[^"+Kr.replace("\\.","")+"]",Qr=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Jr)+/(WCOD+)?/.source.replace("WCOD",$r)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Jr)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Jr)+"$"),ta=["material","materials","bones","map"];class ea{constructor(t,e,n){this.path=e,this.parsedPath=n||ea.parseTrackName(e),this.node=ea.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,n){return t&&t.isAnimationObjectGroup?new ea.Composite(t,e,n):new ea(t,e,n)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(Zr,"")}static parseTrackName(t){const e=Qr.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const n={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const t=n.nodeName.substring(i+1);-1!==ta.indexOf(t)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=t)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return n}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const n=t.skeleton.getBoneByName(e);if(void 0!==n)return n}if(t.children){const n=function(t){for(let i=0;i<t.length;i++){const r=t[i];if(r.name===e||r.uuid===e)return r;const a=n(r.children);if(a)return a}return null},i=n(t.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)t[e++]=n[i]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const n=this.resolvedProperty;for(let i=0,r=n.length;i!==r;++i)n[i]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,n=e.objectName,i=e.propertyName;let r=e.propertyIndex;if(t||(t=ea.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");if(n){let i=e.objectIndex;switch(n){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 e=0;e<t.length;e++)if(t[e].name===i){i=e;break}break;case"map":if("map"in t){t=t.map;break}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.map)return void console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[n])return void console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[n]}if(void 0!==i){if(void 0===t[i])return void console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[i]}}const a=t[i];if(void 0===a){const n=e.nodeName;return void console.error("THREE.PropertyBinding: Trying to update property for track: "+n+"."+i+" but it wasn't found.",t)}let s=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?s=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(s=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===i){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.morphAttributes)return void console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=r}else void 0!==a.fromArray&&void 0!==a.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(o=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][s]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}ea.Composite=class{constructor(t,e,n){const i=n||ea.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,i)}getValue(t,e){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];void 0!==i&&i.getValue(t,e)}setValue(t,e){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,n=t.length;e!==n;++e)t[e].unbind()}},ea.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},ea.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},ea.prototype.GetterByBindingType=[ea.prototype._getValue_direct,ea.prototype._getValue_array,ea.prototype._getValue_arrayElement,ea.prototype._getValue_toArray],ea.prototype.SetterByBindingTypeAndVersioning=[[ea.prototype._setValue_direct,ea.prototype._setValue_direct_setNeedsUpdate,ea.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[ea.prototype._setValue_array,ea.prototype._setValue_array_setNeedsUpdate,ea.prototype._setValue_array_setMatrixWorldNeedsUpdate],[ea.prototype._setValue_arrayElement,ea.prototype._setValue_arrayElement_setNeedsUpdate,ea.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[ea.prototype._setValue_fromArray,ea.prototype._setValue_fromArray_setNeedsUpdate,ea.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];new Float32Array(1);function na(t,e,n,i){const r=function(t){switch(t){case j:case q:return{byteLength:1,components:1};case K:case Y:case Q:return{byteLength:2,components:1};case tt:case et:return{byteLength:2,components:4};case J:case Z:case $:return{byteLength:4,components:1};case it:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}(i);switch(n){case 1021:return t*e;case ot:case lt:return t*e/r.components*r.byteLength;case 1030:case ct:return t*e*2/r.components*r.byteLength;case 1022:return t*e*3/r.components*r.byteLength;case rt:case ut:return t*e*4/r.components*r.byteLength;case ht:case dt:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case pt:case ft:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case gt:case vt:return Math.max(t,16)*Math.max(e,8)/4;case mt:case _t:return Math.max(t,8)*Math.max(e,8)/2;case xt:case yt:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Mt:case St:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Tt:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case Et:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case bt:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case wt:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case At:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case Rt:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case Ct:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case Pt:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case Lt:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case Dt:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case Ut:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case It:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case Nt:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Ot:case Ft:case Bt:return Math.ceil(t/4)*Math.ceil(e/4)*16;case 36283:case zt:return Math.ceil(t/4)*Math.ceil(e/4)*8;case Vt:case Ht:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${n} format.`)}function ia(){let t=null,e=!1,n=null,i=null;function r(e,a){n(e,a),i=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==n&&(i=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(t){n=t},setContext:function(e){t=e}}}function ra(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=e.get(n);i&&(t.deleteBuffer(i.buffer),e.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const t=e.get(n);return void((!t||t.version<n.version)&&e.set(n,{buffer:n.buffer,type:n.type,bytesPerElement:n.elementSize,version:n.version}))}const r=e.get(n);if(void 0===r)e.set(n,function(e,n){const i=e.array,r=e.usage,a=i.byteLength,s=t.createBuffer();let o;if(t.bindBuffer(n,s),t.bufferData(n,i,r),e.onUploadCallback(),i instanceof Float32Array)o=t.FLOAT;else if(i instanceof Uint16Array)o=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(i instanceof Int16Array)o=t.SHORT;else if(i instanceof Uint32Array)o=t.UNSIGNED_INT;else if(i instanceof Int32Array)o=t.INT;else if(i instanceof Int8Array)o=t.BYTE;else if(i instanceof Uint8Array)o=t.UNSIGNED_BYTE;else{if(!(i instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+i);o=t.UNSIGNED_BYTE}return{buffer:s,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:e.version,size:a}}(n,i));else if(r.version<n.version){if(r.size!==n.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(e,n,i){const r=n.array,a=n.updateRanges;if(t.bindBuffer(i,e),0===a.length)t.bufferSubData(i,0,r);else{a.sort(((t,e)=>t.start-e.start));let e=0;for(let t=1;t<a.length;t++){const n=a[e],i=a[t];i.start<=n.start+n.count+1?n.count=Math.max(n.count,i.start+i.count-n.start):(++e,a[e]=i)}a.length=e+1;for(let e=0,n=a.length;e<n;e++){const n=a[e];t.bufferSubData(i,n.start*r.BYTES_PER_ELEMENT,r,n.start,n.count)}n.clearUpdateRanges()}n.onUploadCallback()}(r.buffer,n,i),r.version=n.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:n}})),"undefined"!=typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=n);const aa={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},sa={common:{diffuse:{value:new vi(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Te},alphaMap:{value:null},alphaMapTransform:{value:new Te},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Te}},envmap:{envMap:{value:null},envMapRotation:{value:new Te},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Te}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Te}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Te},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Te},normalScale:{value:new Se(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Te},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Te}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Te}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Te}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new vi(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new vi(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Te},alphaTest:{value:0},uvTransform:{value:new Te}},sprite:{diffuse:{value:new vi(16777215)},opacity:{value:1},center:{value:new Se(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Te},alphaMap:{value:null},alphaMapTransform:{value:new Te},alphaTest:{value:0}}},oa={basic:{uniforms:Qi([sa.common,sa.specularmap,sa.envmap,sa.aomap,sa.lightmap,sa.fog]),vertexShader:aa.meshbasic_vert,fragmentShader:aa.meshbasic_frag},lambert:{uniforms:Qi([sa.common,sa.specularmap,sa.envmap,sa.aomap,sa.lightmap,sa.emissivemap,sa.bumpmap,sa.normalmap,sa.displacementmap,sa.fog,sa.lights,{emissive:{value:new vi(0)}}]),vertexShader:aa.meshlambert_vert,fragmentShader:aa.meshlambert_frag},phong:{uniforms:Qi([sa.common,sa.specularmap,sa.envmap,sa.aomap,sa.lightmap,sa.emissivemap,sa.bumpmap,sa.normalmap,sa.displacementmap,sa.fog,sa.lights,{emissive:{value:new vi(0)},specular:{value:new vi(1118481)},shininess:{value:30}}]),vertexShader:aa.meshphong_vert,fragmentShader:aa.meshphong_frag},standard:{uniforms:Qi([sa.common,sa.envmap,sa.aomap,sa.lightmap,sa.emissivemap,sa.bumpmap,sa.normalmap,sa.displacementmap,sa.roughnessmap,sa.metalnessmap,sa.fog,sa.lights,{emissive:{value:new vi(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:aa.meshphysical_vert,fragmentShader:aa.meshphysical_frag},toon:{uniforms:Qi([sa.common,sa.aomap,sa.lightmap,sa.emissivemap,sa.bumpmap,sa.normalmap,sa.displacementmap,sa.gradientmap,sa.fog,sa.lights,{emissive:{value:new vi(0)}}]),vertexShader:aa.meshtoon_vert,fragmentShader:aa.meshtoon_frag},matcap:{uniforms:Qi([sa.common,sa.bumpmap,sa.normalmap,sa.displacementmap,sa.fog,{matcap:{value:null}}]),vertexShader:aa.meshmatcap_vert,fragmentShader:aa.meshmatcap_frag},points:{uniforms:Qi([sa.points,sa.fog]),vertexShader:aa.points_vert,fragmentShader:aa.points_frag},dashed:{uniforms:Qi([sa.common,sa.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:aa.linedashed_vert,fragmentShader:aa.linedashed_frag},depth:{uniforms:Qi([sa.common,sa.displacementmap]),vertexShader:aa.depth_vert,fragmentShader:aa.depth_frag},normal:{uniforms:Qi([sa.common,sa.bumpmap,sa.normalmap,sa.displacementmap,{opacity:{value:1}}]),vertexShader:aa.meshnormal_vert,fragmentShader:aa.meshnormal_frag},sprite:{uniforms:Qi([sa.sprite,sa.fog]),vertexShader:aa.sprite_vert,fragmentShader:aa.sprite_frag},background:{uniforms:{uvTransform:{value:new Te},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:aa.background_vert,fragmentShader:aa.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Te}},vertexShader:aa.backgroundCube_vert,fragmentShader:aa.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:aa.cube_vert,fragmentShader:aa.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:aa.equirect_vert,fragmentShader:aa.equirect_frag},distanceRGBA:{uniforms:Qi([sa.common,sa.displacementmap,{referencePosition:{value:new Ke},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:aa.distanceRGBA_vert,fragmentShader:aa.distanceRGBA_frag},shadow:{uniforms:Qi([sa.lights,sa.fog,{color:{value:new vi(0)},opacity:{value:1}}]),vertexShader:aa.shadow_vert,fragmentShader:aa.shadow_frag}};oa.physical={uniforms:Qi([oa.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Te},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Te},clearcoatNormalScale:{value:new Se(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Te},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Te},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Te},sheen:{value:0},sheenColor:{value:new vi(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Te},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Te},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Te},transmissionSamplerSize:{value:new Se},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Te},attenuationDistance:{value:0},attenuationColor:{value:new vi(0)},specularColor:{value:new vi(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Te},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Te},anisotropyVector:{value:new Se},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Te}}]),vertexShader:aa.meshphysical_vert,fragmentShader:aa.meshphysical_frag};const la={r:0,b:0,g:0},ca=new On,ua=new wn;function ha(t,e,n,i,r,a,s){const o=new vi(0);let l,c,u=!0===a?0:1,h=null,d=0,p=null;function f(t){let i=!0===t.isScene?t.background:null;if(i&&i.isTexture){i=(t.backgroundBlurriness>0?n:e).get(i)}return i}function m(e,n){e.getRGB(la,tr(t)),i.buffers.color.setClear(la.r,la.g,la.b,n,s)}return{getClearColor:function(){return o},setClearColor:function(t,e=1){o.set(t),u=e,m(o,u)},getClearAlpha:function(){return u},setClearAlpha:function(t){u=t,m(o,u)},render:function(e){let n=!1;const r=f(e);null===r?m(o,u):r&&r.isColor&&(m(r,1),n=!0);const a=t.xr.getEnvironmentBlendMode();"additive"===a?i.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===a&&i.buffers.color.setClear(0,0,0,0,s),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,n){const i=f(n);i&&(i.isCubeTexture||i.mapping===O)?(void 0===c&&(c=new Ki(new Ji(1,1,1),new nr({name:"BackgroundCubeMaterial",uniforms:$i(oa.backgroundCube.uniforms),vertexShader:oa.backgroundCube.vertexShader,fragmentShader:oa.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(t,e,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),r.update(c)),ca.copy(n.backgroundRotation),ca.x*=-1,ca.y*=-1,ca.z*=-1,i.isCubeTexture&&!1===i.isRenderTargetTexture&&(ca.y*=-1,ca.z*=-1),c.material.uniforms.envMap.value=i,c.material.uniforms.flipEnvMap.value=i.isCubeTexture&&!1===i.isRenderTargetTexture?-1:1,c.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,c.material.uniforms.backgroundRotation.value.setFromMatrix4(ua.makeRotationFromEuler(ca)),c.material.toneMapped=Ue.getTransfer(i.colorSpace)!==$t,h===i&&d===i.version&&p===t.toneMapping||(c.material.needsUpdate=!0,h=i,d=i.version,p=t.toneMapping),c.layers.enableAll(),e.unshift(c,c.geometry,c.material,0,0,null)):i&&i.isTexture&&(void 0===l&&(l=new Ki(new Er(2,2),new nr({name:"BackgroundMaterial",uniforms:$i(oa.background.uniforms),vertexShader:oa.background.vertexShader,fragmentShader:oa.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),r.update(l)),l.material.uniforms.t2D.value=i,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=Ue.getTransfer(i.colorSpace)!==$t,!0===i.matrixAutoUpdate&&i.updateMatrix(),l.material.uniforms.uvTransform.value.copy(i.matrix),h===i&&d===i.version&&p===t.toneMapping||(l.material.needsUpdate=!0,h=i,d=i.version,p=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null))},dispose:function(){void 0!==c&&(c.geometry.dispose(),c.material.dispose(),c=void 0),void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}}}function da(t,e){const n=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},r=c(null);let a=r,s=!1;function o(e){return t.bindVertexArray(e)}function l(e){return t.deleteVertexArray(e)}function c(t){const e=[],i=[],r=[];for(let t=0;t<n;t++)e[t]=0,i[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:i,attributeDivisors:r,object:t,attributes:{},index:null}}function u(){const t=a.newAttributes;for(let e=0,n=t.length;e<n;e++)t[e]=0}function h(t){d(t,0)}function d(e,n){const i=a.newAttributes,r=a.enabledAttributes,s=a.attributeDivisors;i[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1),s[e]!==n&&(t.vertexAttribDivisor(e,n),s[e]=n)}function p(){const e=a.newAttributes,n=a.enabledAttributes;for(let i=0,r=n.length;i<r;i++)n[i]!==e[i]&&(t.disableVertexAttribArray(i),n[i]=0)}function f(e,n,i,r,a,s,o){!0===o?t.vertexAttribIPointer(e,n,i,a,s):t.vertexAttribPointer(e,n,i,r,a,s)}function m(){g(),s=!0,a!==r&&(a=r,o(a.object))}function g(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(n,r,l,m,g){let _=!1;const v=function(e,n,r){const a=!0===r.wireframe;let s=i[e.id];void 0===s&&(s={},i[e.id]=s);let o=s[n.id];void 0===o&&(o={},s[n.id]=o);let l=o[a];void 0===l&&(l=c(t.createVertexArray()),o[a]=l);return l}(m,l,r);a!==v&&(a=v,o(a.object)),_=function(t,e,n,i){const r=a.attributes,s=e.attributes;let o=0;const l=n.getAttributes();for(const e in l){if(l[e].location>=0){const n=r[e];let i=s[e];if(void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor)),void 0===n)return!0;if(n.attribute!==i)return!0;if(i&&n.data!==i.data)return!0;o++}}return a.attributesNum!==o||a.index!==i}(n,m,l,g),_&&function(t,e,n,i){const r={},s=e.attributes;let o=0;const l=n.getAttributes();for(const e in l){if(l[e].location>=0){let n=s[e];void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor));const i={};i.attribute=n,n&&n.data&&(i.data=n.data),r[e]=i,o++}}a.attributes=r,a.attributesNum=o,a.index=i}(n,m,l,g),null!==g&&e.update(g,t.ELEMENT_ARRAY_BUFFER),(_||s)&&(s=!1,function(n,i,r,a){u();const s=a.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(const i in o){const r=o[i];if(r.location>=0){let o=s[i];if(void 0===o&&("instanceMatrix"===i&&n.instanceMatrix&&(o=n.instanceMatrix),"instanceColor"===i&&n.instanceColor&&(o=n.instanceColor)),void 0!==o){const i=o.normalized,s=o.itemSize,l=e.get(o);if(void 0===l)continue;const c=l.buffer,u=l.type,p=l.bytesPerElement,m=u===t.INT||u===t.UNSIGNED_INT||o.gpuType===Z;if(o.isInterleavedBufferAttribute){const e=o.data,l=e.stride,g=o.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)d(r.location+t,e.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<r.locationSize;t++)h(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)f(r.location+t,s/r.locationSize,u,i,l*p,(g+s/r.locationSize*t)*p,m)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)d(r.location+t,o.meshPerAttribute);!0!==n.isInstancedMesh&&void 0===a._maxInstanceCount&&(a._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<r.locationSize;t++)h(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)f(r.location+t,s/r.locationSize,u,i,s*p,s/r.locationSize*t*p,m)}}else if(void 0!==l){const e=l[i];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(r.location,e);break;case 3:t.vertexAttrib3fv(r.location,e);break;case 4:t.vertexAttrib4fv(r.location,e);break;default:t.vertexAttrib1fv(r.location,e)}}}}p()}(n,r,l,m),null!==g&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(g).buffer))},reset:m,resetDefaultState:g,dispose:function(){m();for(const t in i){const e=i[t];for(const t in e){const n=e[t];for(const t in n)l(n[t].object),delete n[t];delete e[t]}delete i[t]}},releaseStatesOfGeometry:function(t){if(void 0===i[t.id])return;const e=i[t.id];for(const t in e){const n=e[t];for(const t in n)l(n[t].object),delete n[t];delete e[t]}delete i[t.id]},releaseStatesOfProgram:function(t){for(const e in i){const n=i[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)l(r[t].object),delete r[t];delete n[t.id]}},initAttributes:u,enableAttribute:h,disableUnusedAttributes:p}}function pa(t,e,n){let i;function r(e,r,a){0!==a&&(t.drawArraysInstanced(i,e,r,a),n.update(r,i,a))}this.setMode=function(t){i=t},this.render=function(e,r){t.drawArrays(i,e,r),n.update(r,i,1)},this.renderInstances=r,this.renderMultiDraw=function(t,r,a){if(0===a)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,t,0,r,0,a);let s=0;for(let t=0;t<a;t++)s+=r[t];n.update(s,i,1)},this.renderMultiDrawInstances=function(t,a,s,o){if(0===s)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<t.length;e++)r(t[e],a[e],o[e]);else{l.multiDrawArraysInstancedWEBGL(i,t,0,a,0,o,0,s);let e=0;for(let t=0;t<s;t++)e+=a[t]*o[t];n.update(e,i,1)}}}function fa(t,e,n,i){let r;function a(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp";const o=a(s);o!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=!0===n.logarithmicDepthBuffer,c=!0===n.reverseDepthBuffer&&e.has("EXT_clip_control"),u=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),h=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const n=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(e){return e===rt||i.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===Q&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(n!==j&&i.convert(n)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==$&&!r)},precision:s,logarithmicDepthBuffer:l,reverseDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:h>0,maxSamples:t.getParameter(t.MAX_SAMPLES)}}function ma(t){const e=this;let n=null,i=0,r=!1,a=!1;const s=new xr,o=new Te,l={value:null,needsUpdate:!1};function c(t,n,i,r){const a=null!==t?t.length:0;let c=null;if(0!==a){if(c=l.value,!0!==r||null===c){const e=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,n=i;e!==a;++e,n+=4)s.copy(t[e]).applyMatrix4(r,o),s.normal.toArray(c,n),c[n+3]=s.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=a,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const n=0!==t.length||e||0!==i||r;return r=e,i=t.length,n},this.beginShadows=function(){a=!0,c(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(t,e){n=c(t,e,0)},this.setState=function(s,o,u){const h=s.clippingPlanes,d=s.clipIntersection,p=s.clipShadows,f=t.get(s);if(!r||null===h||0===h.length||a&&!p)a?c(null):function(){l.value!==n&&(l.value=n,l.needsUpdate=i>0);e.numPlanes=i,e.numIntersection=0}();else{const t=a?0:i,e=4*t;let r=f.clippingState||null;l.value=r,r=c(h,o,e,u);for(let t=0;t!==e;++t)r[t]=n[t];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}function ga(t){let e=new WeakMap;function n(t,e){return e===I?t.mapping=D:e===N&&(t.mapping=U),t}function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping;if(a===I||a===N){if(e.has(r)){return n(e.get(r).texture,r.mapping)}{const a=r.image;if(a&&a.height>0){const s=new hr(a.height);return s.fromEquirectangularTexture(t,r),e.set(r,s),r.addEventListener("dispose",i),n(s.texture,r.mapping)}return null}}}return r},dispose:function(){e=new WeakMap}}}const _a=[.125,.215,.35,.446,.526,.582],va=20,xa=new qr,ya=new vi;let Ma=null,Sa=0,Ta=0,Ea=!1;const ba=(1+Math.sqrt(5))/2,wa=1/ba,Aa=[new Ke(-ba,wa,0),new Ke(ba,wa,0),new Ke(-wa,0,ba),new Ke(wa,0,ba),new Ke(0,ba,-wa),new Ke(0,ba,wa),new Ke(-1,1,-1),new Ke(1,1,-1),new Ke(-1,1,1),new Ke(1,1,1)],Ra=new Ke;class Ca{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(t,e=0,n=.1,i=100,r={}){const{size:a=256,position:s=Ra}=r;Ma=this._renderer.getRenderTarget(),Sa=this._renderer.getActiveCubeFace(),Ta=this._renderer.getActiveMipmapLevel(),Ea=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(t,n,i,o,s),e>0&&this._blur(o,0,0,e),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=Ua(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=Da(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodPlanes.length;t++)this._lodPlanes[t].dispose()}_cleanup(t){this._renderer.setRenderTarget(Ma,Sa,Ta),this._renderer.xr.enabled=Ea,t.scissorTest=!1,La(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===D||t.mapping===U?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Ma=this._renderer.getRenderTarget(),Sa=this._renderer.getActiveCubeFace(),Ta=this._renderer.getActiveMipmapLevel(),Ea=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=e||this._allocateTargets();return this._textureToCubeUV(t,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,n={magFilter:G,minFilter:G,generateMipmaps:!1,type:Q,format:rt,colorSpace:Zt,depthBuffer:!1},i=Pa(t,e,n);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=Pa(t,e,n);const{_lodMax:i}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function(t){const e=[],n=[],i=[];let r=t;const a=t-4+1+_a.length;for(let s=0;s<a;s++){const a=Math.pow(2,r);n.push(a);let o=1/a;s>t-4?o=_a[s-t+4-1]:0===s&&(o=0),i.push(o);const l=1/(a-2),c=-l,u=1+l,h=[c,c,u,c,u,u,c,c,u,u,c,u],d=6,p=6,f=3,m=2,g=1,_=new Float32Array(f*p*d),v=new Float32Array(m*p*d),x=new Float32Array(g*p*d);for(let t=0;t<d;t++){const e=t%3*2/3-1,n=t>2?0:-1,i=[e,n,0,e+2/3,n,0,e+2/3,n+1,0,e,n,0,e+2/3,n+1,0,e,n+1,0];_.set(i,f*p*t),v.set(h,m*p*t);const r=[t,t,t,t,t,t];x.set(r,g*p*t)}const y=new Fi;y.setAttribute("position",new wi(_,f)),y.setAttribute("uv",new wi(v,m)),y.setAttribute("faceIndex",new wi(x,g)),e.push(y),r>4&&r--}return{lodPlanes:e,sizeLods:n,sigmas:i}}(i)),this._blurMaterial=function(t,e,n){const i=new Float32Array(va),r=new Ke(0,1,0),a=new nr({name:"SphericalGaussianBlur",defines:{n:va,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:Ia(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return a}(i,t,e)}return i}_compileMaterial(t){const e=new Ki(this._lodPlanes[0],t);this._renderer.compile(e,xa)}_sceneToCubeUV(t,e,n,i,r){const a=new or(90,1,e,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,c=l.autoClear,u=l.toneMapping;l.getClearColor(ya),l.toneMapping=0,l.autoClear=!1;const h=new Si({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),d=new Ki(new Ji,h);let p=!1;const f=t.background;f?f.isColor&&(h.color.copy(f),t.background=null,p=!0):(h.color.copy(ya),p=!0);for(let e=0;e<6;e++){const n=e%3;0===n?(a.up.set(0,s[e],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+o[e],r.y,r.z)):1===n?(a.up.set(0,0,s[e]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+o[e],r.z)):(a.up.set(0,s[e],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+o[e]));const c=this._cubeSize;La(i,n*c,e>2?c:0,c,c),l.setRenderTarget(i),p&&l.render(d,a),l.render(t,a)}d.geometry.dispose(),d.material.dispose(),l.toneMapping=u,l.autoClear=c,t.background=f}_textureToCubeUV(t,e){const n=this._renderer,i=t.mapping===D||t.mapping===U;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=Ua()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=Da());const r=i?this._cubemapMaterial:this._equirectMaterial,a=new Ki(this._lodPlanes[0],r);r.uniforms.envMap.value=t;const s=this._cubeSize;La(e,0,0,3*s,2*s),n.setRenderTarget(e),n.render(a,xa)}_applyPMREM(t){const e=this._renderer,n=e.autoClear;e.autoClear=!1;const i=this._lodPlanes.length;for(let e=1;e<i;e++){const n=Math.sqrt(this._sigmas[e]*this._sigmas[e]-this._sigmas[e-1]*this._sigmas[e-1]),r=Aa[(i-e-1)%Aa.length];this._blur(t,e-1,e,n,r)}e.autoClear=n}_blur(t,e,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(t,a,e,n,i,"latitudinal",r),this._halfBlur(a,t,n,n,i,"longitudinal",r)}_halfBlur(t,e,n,i,r,a,s){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&console.error("blur direction must be either latitudinal or longitudinal!");const c=new Ki(this._lodPlanes[i],l),u=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):va;f>va&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to 20`);const m=[];let g=0;for(let t=0;t<va;++t){const e=t/p,n=Math.exp(-e*e/2);m.push(n),0===t?g+=n:t<f&&(g+=2*n)}for(let t=0;t<m.length;t++)m[t]=m[t]/g;u.envMap.value=t.texture,u.samples.value=f,u.weights.value=m,u.latitudinal.value="latitudinal"===a,s&&(u.poleAxis.value=s);const{_lodMax:_}=this;u.dTheta.value=d,u.mipInt.value=_-n;const v=this._sizeLods[i];La(e,3*v*(i>_-4?i-_+4:0),4*(this._cubeSize-v),3*v,2*v),o.setRenderTarget(e),o.render(c,xa)}}function Pa(t,e,n){const i=new Xe(t,e,n);return i.texture.mapping=O,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function La(t,e,n,i,r){t.viewport.set(e,n,i,r),t.scissor.set(e,n,i,r)}function Da(){return new nr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:Ia(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Ua(){return new nr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:Ia(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function Ia(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}function Na(t){let e=new WeakMap,n=null;function i(t){const n=t.target;n.removeEventListener("dispose",i);const r=e.get(n);void 0!==r&&(e.delete(n),r.dispose())}return{get:function(r){if(r&&r.isTexture){const a=r.mapping,s=a===I||a===N,o=a===D||a===U;if(s||o){let a=e.get(r);const l=void 0!==a?a.texture.pmremVersion:0;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return null===n&&(n=new Ca(t)),a=s?n.fromEquirectangular(r,a):n.fromCubemap(r,a),a.texture.pmremVersion=r.pmremVersion,e.set(r,a),a.texture;if(void 0!==a)return a.texture;{const l=r.image;return s&&l&&l.height>0||o&&l&&function(t){let e=0;const n=6;for(let i=0;i<n;i++)void 0!==t[i]&&e++;return e===n}(l)?(null===n&&(n=new Ca(t)),a=s?n.fromEquirectangular(r):n.fromCubemap(r),a.texture.pmremVersion=r.pmremVersion,e.set(r,a),r.addEventListener("dispose",i),a.texture):null}}}return r},dispose:function(){e=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function Oa(t){const e={};function n(n){if(void 0!==e[n])return e[n];let i;switch(n){case"WEBGL_depth_texture":i=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=t.getExtension(n)}return e[n]=i,i}return{has:function(t){return null!==n(t)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(t){const e=n(t);return null===e&&Ce("THREE.WebGLRenderer: "+t+" extension not supported."),e}}}function Fa(t,e,n,i){const r={},a=new WeakMap;function s(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",s),delete r[o.id];const l=a.get(o);l&&(e.remove(l),a.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(t){const n=[],i=t.index,r=t.attributes.position;let s=0;if(null!==i){const t=i.array;s=i.version;for(let e=0,i=t.length;e<i;e+=3){const i=t[e+0],r=t[e+1],a=t[e+2];n.push(i,r,r,a,a,i)}}else{if(void 0===r)return;{const t=r.array;s=r.version;for(let e=0,i=t.length/3-1;e<i;e+=3){const t=e+0,i=e+1,r=e+2;n.push(t,i,i,r,r,t)}}}const o=new(be(n)?Ri:Ai)(n,1);o.version=s;const l=a.get(t);l&&e.remove(l),a.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",s),r[e.id]=!0,n.memory.geometries++),e},update:function(n){const i=n.attributes;for(const n in i)e.update(i[n],t.ARRAY_BUFFER)},getWireframeAttribute:function(t){const e=a.get(t);if(e){const n=t.index;null!==n&&e.version<n.version&&o(t)}else o(t);return a.get(t)}}}function Ba(t,e,n){let i,r,a;function s(e,s,o){0!==o&&(t.drawElementsInstanced(i,s,r,e*a,o),n.update(s,i,o))}this.setMode=function(t){i=t},this.setIndex=function(t){r=t.type,a=t.bytesPerElement},this.render=function(e,s){t.drawElements(i,s,r,e*a),n.update(s,i,1)},this.renderInstances=s,this.renderMultiDraw=function(t,a,s){if(0===s)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,a,0,r,t,0,s);let o=0;for(let t=0;t<s;t++)o+=a[t];n.update(o,i,1)},this.renderMultiDrawInstances=function(t,o,l,c){if(0===l)return;const u=e.get("WEBGL_multi_draw");if(null===u)for(let e=0;e<t.length;e++)s(t[e]/a,o[e],c[e]);else{u.multiDrawElementsInstancedWEBGL(i,o,0,r,t,0,c,0,l);let e=0;for(let t=0;t<l;t++)e+=o[t]*c[t];n.update(e,i,1)}}}function za(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(n,i,r){switch(e.calls++,i){case t.TRIANGLES:e.triangles+=r*(n/3);break;case t.LINES:e.lines+=r*(n/2);break;case t.LINE_STRIP:e.lines+=r*(n-1);break;case t.LINE_LOOP:e.lines+=r*n;break;case t.POINTS:e.points+=r*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",i)}}}}function Va(t,e,n){const i=new WeakMap,r=new Ge;return{update:function(a,s,o){const l=a.morphTargetInfluences,c=s.morphAttributes.position||s.morphAttributes.normal||s.morphAttributes.color,u=void 0!==c?c.length:0;let h=i.get(s);if(void 0===h||h.count!==u){void 0!==h&&h.texture.dispose();const d=void 0!==s.morphAttributes.position,p=void 0!==s.morphAttributes.normal,f=void 0!==s.morphAttributes.color,m=s.morphAttributes.position||[],g=s.morphAttributes.normal||[],_=s.morphAttributes.color||[];let v=0;!0===d&&(v=1),!0===p&&(v=2),!0===f&&(v=3);let x=s.attributes.position.count*v,y=1;x>e.maxTextureSize&&(y=Math.ceil(x/e.maxTextureSize),x=e.maxTextureSize);const M=new Float32Array(x*y*4*u),S=new je(M,x,y,u);S.type=$,S.needsUpdate=!0;const T=4*v;for(let b=0;b<u;b++){const w=m[b],A=g[b],R=_[b],C=x*y*4*b;for(let P=0;P<w.count;P++){const L=P*T;!0===d&&(r.fromBufferAttribute(w,P),M[C+L+0]=r.x,M[C+L+1]=r.y,M[C+L+2]=r.z,M[C+L+3]=0),!0===p&&(r.fromBufferAttribute(A,P),M[C+L+4]=r.x,M[C+L+5]=r.y,M[C+L+6]=r.z,M[C+L+7]=0),!0===f&&(r.fromBufferAttribute(R,P),M[C+L+8]=r.x,M[C+L+9]=r.y,M[C+L+10]=r.z,M[C+L+11]=4===R.itemSize?r.w:1)}}function E(){S.dispose(),i.delete(s),s.removeEventListener("dispose",E)}h={count:u,texture:S,size:new Se(x,y)},i.set(s,h),s.addEventListener("dispose",E)}if(!0===a.isInstancedMesh&&null!==a.morphTexture)o.getUniforms().setValue(t,"morphTexture",a.morphTexture,n);else{let D=0;for(let I=0;I<l.length;I++)D+=l[I];const U=s.morphTargetsRelative?1:1-D;o.getUniforms().setValue(t,"morphTargetBaseInfluence",U),o.getUniforms().setValue(t,"morphTargetInfluences",l)}o.getUniforms().setValue(t,"morphTargetsTexture",h.texture,n),o.getUniforms().setValue(t,"morphTargetsTextureSize",h.size)}}}function Ha(t,e,n,i){let r=new WeakMap;function a(t){const e=t.target;e.removeEventListener("dispose",a),n.remove(e.instanceMatrix),null!==e.instanceColor&&n.remove(e.instanceColor)}return{update:function(s){const o=i.render.frame,l=s.geometry,c=e.get(s,l);if(r.get(c)!==o&&(e.update(c),r.set(c,o)),s.isInstancedMesh&&(!1===s.hasEventListener("dispose",a)&&s.addEventListener("dispose",a),r.get(s)!==o&&(n.update(s.instanceMatrix,t.ARRAY_BUFFER),null!==s.instanceColor&&n.update(s.instanceColor,t.ARRAY_BUFFER),r.set(s,o))),s.isSkinnedMesh){const t=s.skeleton;r.get(t)!==o&&(t.update(),r.set(t,o))}return c},dispose:function(){r=new WeakMap}}}const ka=new ke,Ga=new Tr(1,1),Wa=new je,Xa=new qe,ja=new ur,qa=[],Ya=[],Ka=new Float32Array(16),Za=new Float32Array(9),Ja=new Float32Array(4);function $a(t,e,n){const i=t[0];if(i<=0||i>0)return t;const r=e*n;let a=qa[r];if(void 0===a&&(a=new Float32Array(r),qa[r]=a),0!==e){i.toArray(a,0);for(let i=1,r=0;i!==e;++i)r+=n,t[i].toArray(a,r)}return a}function Qa(t,e){if(t.length!==e.length)return!1;for(let n=0,i=t.length;n<i;n++)if(t[n]!==e[n])return!1;return!0}function ts(t,e){for(let n=0,i=e.length;n<i;n++)t[n]=e[n]}function es(t,e){let n=Ya[e];void 0===n&&(n=new Int32Array(e),Ya[e]=n);for(let i=0;i!==e;++i)n[i]=t.allocateTextureUnit();return n}function ns(t,e){const n=this.cache;n[0]!==e&&(t.uniform1f(this.addr,e),n[0]=e)}function is(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Qa(n,e))return;t.uniform2fv(this.addr,e),ts(n,e)}}function rs(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else if(void 0!==e.r)n[0]===e.r&&n[1]===e.g&&n[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),n[0]=e.r,n[1]=e.g,n[2]=e.b);else{if(Qa(n,e))return;t.uniform3fv(this.addr,e),ts(n,e)}}function as(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Qa(n,e))return;t.uniform4fv(this.addr,e),ts(n,e)}}function ss(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Qa(n,e))return;t.uniformMatrix2fv(this.addr,!1,e),ts(n,e)}else{if(Qa(n,i))return;Ja.set(i),t.uniformMatrix2fv(this.addr,!1,Ja),ts(n,i)}}function os(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Qa(n,e))return;t.uniformMatrix3fv(this.addr,!1,e),ts(n,e)}else{if(Qa(n,i))return;Za.set(i),t.uniformMatrix3fv(this.addr,!1,Za),ts(n,i)}}function ls(t,e){const n=this.cache,i=e.elements;if(void 0===i){if(Qa(n,e))return;t.uniformMatrix4fv(this.addr,!1,e),ts(n,e)}else{if(Qa(n,i))return;Ka.set(i),t.uniformMatrix4fv(this.addr,!1,Ka),ts(n,i)}}function cs(t,e){const n=this.cache;n[0]!==e&&(t.uniform1i(this.addr,e),n[0]=e)}function us(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Qa(n,e))return;t.uniform2iv(this.addr,e),ts(n,e)}}function hs(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Qa(n,e))return;t.uniform3iv(this.addr,e),ts(n,e)}}function ds(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Qa(n,e))return;t.uniform4iv(this.addr,e),ts(n,e)}}function ps(t,e){const n=this.cache;n[0]!==e&&(t.uniform1ui(this.addr,e),n[0]=e)}function fs(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),n[0]=e.x,n[1]=e.y);else{if(Qa(n,e))return;t.uniform2uiv(this.addr,e),ts(n,e)}}function ms(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),n[0]=e.x,n[1]=e.y,n[2]=e.z);else{if(Qa(n,e))return;t.uniform3uiv(this.addr,e),ts(n,e)}}function gs(t,e){const n=this.cache;if(void 0!==e.x)n[0]===e.x&&n[1]===e.y&&n[2]===e.z&&n[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=e.w);else{if(Qa(n,e))return;t.uniform4uiv(this.addr,e),ts(n,e)}}function _s(t,e,n){const i=this.cache,r=n.allocateTextureUnit();let a;i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),this.type===t.SAMPLER_2D_SHADOW?(Ga.compareFunction=515,a=Ga):a=ka,n.setTexture2D(e||a,r)}function vs(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(e||Xa,r)}function xs(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTextureCube(e||ja,r)}function ys(t,e,n){const i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(t.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(e||Wa,r)}function Ms(t,e){t.uniform1fv(this.addr,e)}function Ss(t,e){const n=$a(e,this.size,2);t.uniform2fv(this.addr,n)}function Ts(t,e){const n=$a(e,this.size,3);t.uniform3fv(this.addr,n)}function Es(t,e){const n=$a(e,this.size,4);t.uniform4fv(this.addr,n)}function bs(t,e){const n=$a(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,n)}function ws(t,e){const n=$a(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,n)}function As(t,e){const n=$a(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,n)}function Rs(t,e){t.uniform1iv(this.addr,e)}function Cs(t,e){t.uniform2iv(this.addr,e)}function Ps(t,e){t.uniform3iv(this.addr,e)}function Ls(t,e){t.uniform4iv(this.addr,e)}function Ds(t,e){t.uniform1uiv(this.addr,e)}function Us(t,e){t.uniform2uiv(this.addr,e)}function Is(t,e){t.uniform3uiv(this.addr,e)}function Ns(t,e){t.uniform4uiv(this.addr,e)}function Os(t,e,n){const i=this.cache,r=e.length,a=es(n,r);Qa(i,a)||(t.uniform1iv(this.addr,a),ts(i,a));for(let t=0;t!==r;++t)n.setTexture2D(e[t]||ka,a[t])}function Fs(t,e,n){const i=this.cache,r=e.length,a=es(n,r);Qa(i,a)||(t.uniform1iv(this.addr,a),ts(i,a));for(let t=0;t!==r;++t)n.setTexture3D(e[t]||Xa,a[t])}function Bs(t,e,n){const i=this.cache,r=e.length,a=es(n,r);Qa(i,a)||(t.uniform1iv(this.addr,a),ts(i,a));for(let t=0;t!==r;++t)n.setTextureCube(e[t]||ja,a[t])}function zs(t,e,n){const i=this.cache,r=e.length,a=es(n,r);Qa(i,a)||(t.uniform1iv(this.addr,a),ts(i,a));for(let t=0;t!==r;++t)n.setTexture2DArray(e[t]||Wa,a[t])}class Vs{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return ns;case 35664:return is;case 35665:return rs;case 35666:return as;case 35674:return ss;case 35675:return os;case 35676:return ls;case 5124:case 35670:return cs;case 35667:case 35671:return us;case 35668:case 35672:return hs;case 35669:case 35673:return ds;case 5125:return ps;case 36294:return fs;case 36295:return ms;case 36296:return gs;case 35678:case 36198:case 36298:case 36306:case 35682:return _s;case 35679:case 36299:case 36307:return vs;case 35680:case 36300:case 36308:case 36293:return xs;case 36289:case 36303:case 36311:case 36292:return ys}}(e.type)}}class Hs{constructor(t,e,n){this.id=t,this.addr=n,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Ms;case 35664:return Ss;case 35665:return Ts;case 35666:return Es;case 35674:return bs;case 35675:return ws;case 35676:return As;case 5124:case 35670:return Rs;case 35667:case 35671:return Cs;case 35668:case 35672:return Ps;case 35669:case 35673:return Ls;case 5125:return Ds;case 36294:return Us;case 36295:return Is;case 36296:return Ns;case 35678:case 36198:case 36298:case 36306:case 35682:return Os;case 35679:case 36299:case 36307:return Fs;case 35680:case 36300:case 36308:case 36293:return Bs;case 36289:case 36303:case 36311:case 36292:return zs}}(e.type)}}class ks{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,n){const i=this.seq;for(let r=0,a=i.length;r!==a;++r){const a=i[r];a.setValue(t,e[a.id],n)}}}const Gs=/(\w+)(\])?(\[|\.)?/g;function Ws(t,e){t.seq.push(e),t.map[e.id]=e}function Xs(t,e,n){const i=t.name,r=i.length;for(Gs.lastIndex=0;;){const a=Gs.exec(i),s=Gs.lastIndex;let o=a[1];const l="]"===a[2],c=a[3];if(l&&(o|=0),void 0===c||"["===c&&s+2===r){Ws(n,void 0===c?new Vs(o,t,e):new Hs(o,t,e));break}{let t=n.map[o];void 0===t&&(t=new ks(o),Ws(n,t)),n=t}}}class js{constructor(t,e){this.seq=[],this.map={};const n=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<n;++i){const n=t.getActiveUniform(e,i);Xs(n,t.getUniformLocation(e,n.name),this)}}setValue(t,e,n,i){const r=this.map[e];void 0!==r&&r.setValue(t,n,i)}setOptional(t,e,n){const i=e[n];void 0!==i&&this.setValue(t,n,i)}static upload(t,e,n,i){for(let r=0,a=e.length;r!==a;++r){const a=e[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(t,s.value,i)}}static seqWithValue(t,e){const n=[];for(let i=0,r=t.length;i!==r;++i){const r=t[i];r.id in e&&n.push(r)}return n}}function qs(t,e,n){const i=t.createShader(e);return t.shaderSource(i,n),t.compileShader(i),i}let Ys=0;const Ks=new Te;function Zs(t,e,n){const i=t.getShaderParameter(e,t.COMPILE_STATUS),r=t.getShaderInfoLog(e).trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const n=t.split("\n"),i=[],r=Math.max(e-6,0),a=Math.min(e+6,n.length);for(let t=r;t<a;t++){const r=t+1;i.push(`${r===e?">":" "} ${r}: ${n[t]}`)}return i.join("\n")}(t.getShaderSource(e),i)}return r}function Js(t,e){const n=function(t){Ue._getMatrix(Ks,Ue.workingColorSpace,t);const e=`mat3( ${Ks.elements.map((t=>t.toFixed(4)))} )`;switch(Ue.getTransfer(t)){case Jt:return[e,"LinearTransferOETF"];case $t:return[e,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}(e);return[`vec4 ${t}( vec4 value ) {`,`\treturn ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,"}"].join("\n")}function $s(t,e){let n;switch(e){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="Cineon";break;case 4:n="ACESFilmic";break;case 6:n="AgX";break;case 7:n="Neutral";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const Qs=new Ke;function to(){Ue.getLuminanceCoefficients(Qs);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${Qs.x.toFixed(4)}, ${Qs.y.toFixed(4)}, ${Qs.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function eo(t){return""!==t}function no(t,e){const n=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function io(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const ro=/^[ \t]*#include +<([\w\d./]+)>/gm;function ao(t){return t.replace(ro,oo)}const so=new Map;function oo(t,e){let n=aa[e];if(void 0===n){const t=so.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");n=aa[t],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return ao(n)}const lo=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function co(t){return t.replace(lo,uo)}function uo(t,e,n,i){let r="";for(let t=parseInt(e);t<parseInt(n);t++)r+=i.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function ho(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\tprecision ${t.precision} sampler3D;\n\tprecision ${t.precision} sampler2DArray;\n\tprecision ${t.precision} sampler2DShadow;\n\tprecision ${t.precision} samplerCubeShadow;\n\tprecision ${t.precision} sampler2DArrayShadow;\n\tprecision ${t.precision} isampler2D;\n\tprecision ${t.precision} isampler3D;\n\tprecision ${t.precision} isamplerCube;\n\tprecision ${t.precision} isampler2DArray;\n\tprecision ${t.precision} usampler2D;\n\tprecision ${t.precision} usampler3D;\n\tprecision ${t.precision} usamplerCube;\n\tprecision ${t.precision} usampler2DArray;\n\t`;return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}function po(t,e,n,i){const r=t.getContext(),a=n.defines;let s=n.vertexShader,o=n.fragmentShader;const l=function(t){let e="SHADOWMAP_TYPE_BASIC";return 1===t.shadowMapType?e="SHADOWMAP_TYPE_PCF":2===t.shadowMapType?e="SHADOWMAP_TYPE_PCF_SOFT":3===t.shadowMapType&&(e="SHADOWMAP_TYPE_VSM"),e}(n),c=function(t){let e="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case D:case U:e="ENVMAP_TYPE_CUBE";break;case O:e="ENVMAP_TYPE_CUBE_UV"}return e}(n),u=function(t){let e="ENVMAP_MODE_REFLECTION";t.envMap&&t.envMapMode===U&&(e="ENVMAP_MODE_REFRACTION");return e}(n),h=function(t){let e="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:e="ENVMAP_BLENDING_MULTIPLY";break;case 1:e="ENVMAP_BLENDING_MIX";break;case 2:e="ENVMAP_BLENDING_ADD"}return e}(n),d=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const n=Math.log2(e)-2,i=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:i,maxMip:n}}(n),p=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(eo).join("\n")}(n),f=function(t){const e=[];for(const n in t){const i=t[n];!1!==i&&e.push("#define "+n+" "+i)}return e.join("\n")}(a),m=r.createProgram();let g,_,v=n.glslVersion?"#version "+n.glslVersion+"\n":"";n.isRawShaderMaterial?(g=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(eo).join("\n"),g.length>0&&(g+="\n"),_=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(eo).join("\n"),_.length>0&&(_+="\n")):(g=[ho(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(eo).join("\n"),_=[ho(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.envMap?"#define "+u:"",n.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor||n.batchingColor?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",n.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==n.toneMapping?"#define TONE_MAPPING":"",0!==n.toneMapping?aa.tonemapping_pars_fragment:"",0!==n.toneMapping?$s("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",aa.colorspace_pars_fragment,Js("linearToOutputTexel",n.outputColorSpace),to(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(eo).join("\n")),s=ao(s),s=no(s,n),s=io(s,n),o=ao(o),o=no(o,n),o=io(o,n),s=co(s),o=co(o),!0!==n.isRawShaderMaterial&&(v="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,_=["#define varying in",n.glslVersion===ce?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===ce?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+_);const x=v+g+s,y=v+_+o,M=qs(r,r.VERTEX_SHADER,x),S=qs(r,r.FRAGMENT_SHADER,y);function T(e){if(t.debug.checkShaderErrors){const n=r.getProgramInfoLog(m).trim(),i=r.getShaderInfoLog(M).trim(),a=r.getShaderInfoLog(S).trim();let s=!0,o=!0;if(!1===r.getProgramParameter(m,r.LINK_STATUS))if(s=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(r,m,M,S);else{const t=Zs(r,M,"vertex"),i=Zs(r,S,"fragment");console.error("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(m,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+n+"\n"+t+"\n"+i)}else""!==n?console.warn("THREE.WebGLProgram: Program Info Log:",n):""!==i&&""!==a||(o=!1);o&&(e.diagnostics={runnable:s,programLog:n,vertexShader:{log:i,prefix:g},fragmentShader:{log:a,prefix:_}})}r.deleteShader(M),r.deleteShader(S),E=new js(r,m),b=function(t,e){const n={},i=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<i;r++){const i=t.getActiveAttrib(e,r),a=i.name;let s=1;i.type===t.FLOAT_MAT2&&(s=2),i.type===t.FLOAT_MAT3&&(s=3),i.type===t.FLOAT_MAT4&&(s=4),n[a]={type:i.type,location:t.getAttribLocation(e,a),locationSize:s}}return n}(r,m)}let E,b;r.attachShader(m,M),r.attachShader(m,S),void 0!==n.index0AttributeName?r.bindAttribLocation(m,0,n.index0AttributeName):!0===n.morphTargets&&r.bindAttribLocation(m,0,"position"),r.linkProgram(m),this.getUniforms=function(){return void 0===E&&T(this),E},this.getAttributes=function(){return void 0===b&&T(this),b};let w=!1===n.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===w&&(w=r.getProgramParameter(m,37297)),w},this.destroy=function(){i.releaseStatesOfProgram(this),r.deleteProgram(m),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=Ys++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=M,this.fragmentShader=S,this}let fo=0;class mo{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,n=t.fragmentShader,i=this._getShaderStage(e),r=this._getShaderStage(n),a=this._getShaderCacheForMaterial(t);return!1===a.has(i)&&(a.add(i),i.usedTimes++),!1===a.has(r)&&(a.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let n=e.get(t);return void 0===n&&(n=new Set,e.set(t,n)),n}_getShaderStage(t){const e=this.shaderCache;let n=e.get(t);return void 0===n&&(n=new go(t),e.set(t,n)),n}}class go{constructor(t){this.id=fo++,this.code=t,this.usedTimes=0}}function _o(t,e,n,i,r,a,s){const o=new Fn,l=new mo,c=new Set,u=[],h=r.logarithmicDepthBuffer,d=r.vertexTextures;let p=r.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(t){return c.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(a,o,u,g,_){const v=g.fog,x=_.geometry,y=a.isMeshStandardMaterial?g.environment:null,M=(a.isMeshStandardMaterial?n:e).get(a.envMap||y),S=M&&M.mapping===O?M.image.height:null,T=f[a.type];null!==a.precision&&(p=r.getMaxPrecision(a.precision),p!==a.precision&&console.warn("THREE.WebGLProgram.getParameters:",a.precision,"not supported, using",p,"instead."));const E=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,b=void 0!==E?E.length:0;let w,A,R,C,P=0;if(void 0!==x.morphAttributes.position&&(P=1),void 0!==x.morphAttributes.normal&&(P=2),void 0!==x.morphAttributes.color&&(P=3),T){const t=oa[T];w=t.vertexShader,A=t.fragmentShader}else w=a.vertexShader,A=a.fragmentShader,l.update(a),R=l.getVertexShaderID(a),C=l.getFragmentShaderID(a);const L=t.getRenderTarget(),D=t.state.buffers.depth.getReversed(),U=!0===_.isInstancedMesh,I=!0===_.isBatchedMesh,N=!!a.map,F=!!a.matcap,B=!!M,z=!!a.aoMap,V=!!a.lightMap,H=!!a.bumpMap,k=!!a.normalMap,G=!!a.displacementMap,W=!!a.emissiveMap,X=!!a.metalnessMap,j=!!a.roughnessMap,q=a.anisotropy>0,Y=a.clearcoat>0,K=a.dispersion>0,Z=a.iridescence>0,J=a.sheen>0,$=a.transmission>0,Q=q&&!!a.anisotropyMap,tt=Y&&!!a.clearcoatMap,et=Y&&!!a.clearcoatNormalMap,nt=Y&&!!a.clearcoatRoughnessMap,it=Z&&!!a.iridescenceMap,rt=Z&&!!a.iridescenceThicknessMap,at=J&&!!a.sheenColorMap,st=J&&!!a.sheenRoughnessMap,ot=!!a.specularMap,lt=!!a.specularColorMap,ct=!!a.specularIntensityMap,ut=$&&!!a.transmissionMap,ht=$&&!!a.thicknessMap,dt=!!a.gradientMap,pt=!!a.alphaMap,ft=a.alphaTest>0,mt=!!a.alphaHash,gt=!!a.extensions;let _t=0;a.toneMapped&&(null!==L&&!0!==L.isXRRenderTarget||(_t=t.toneMapping));const vt={shaderID:T,shaderType:a.type,shaderName:a.name,vertexShader:w,fragmentShader:A,defines:a.defines,customVertexShaderID:R,customFragmentShaderID:C,isRawShaderMaterial:!0===a.isRawShaderMaterial,glslVersion:a.glslVersion,precision:p,batching:I,batchingColor:I&&null!==_._colorsTexture,instancing:U,instancingColor:U&&null!==_.instanceColor,instancingMorph:U&&null!==_.morphTexture,supportsVertexTextures:d,outputColorSpace:null===L?t.outputColorSpace:!0===L.isXRRenderTarget?L.texture.colorSpace:Zt,alphaToCoverage:!!a.alphaToCoverage,map:N,matcap:F,envMap:B,envMapMode:B&&M.mapping,envMapCubeUVHeight:S,aoMap:z,lightMap:V,bumpMap:H,normalMap:k,displacementMap:d&&G,emissiveMap:W,normalMapObjectSpace:k&&1===a.normalMapType,normalMapTangentSpace:k&&0===a.normalMapType,metalnessMap:X,roughnessMap:j,anisotropy:q,anisotropyMap:Q,clearcoat:Y,clearcoatMap:tt,clearcoatNormalMap:et,clearcoatRoughnessMap:nt,dispersion:K,iridescence:Z,iridescenceMap:it,iridescenceThicknessMap:rt,sheen:J,sheenColorMap:at,sheenRoughnessMap:st,specularMap:ot,specularColorMap:lt,specularIntensityMap:ct,transmission:$,transmissionMap:ut,thicknessMap:ht,gradientMap:dt,opaque:!1===a.transparent&&1===a.blending&&!1===a.alphaToCoverage,alphaMap:pt,alphaTest:ft,alphaHash:mt,combine:a.combine,mapUv:N&&m(a.map.channel),aoMapUv:z&&m(a.aoMap.channel),lightMapUv:V&&m(a.lightMap.channel),bumpMapUv:H&&m(a.bumpMap.channel),normalMapUv:k&&m(a.normalMap.channel),displacementMapUv:G&&m(a.displacementMap.channel),emissiveMapUv:W&&m(a.emissiveMap.channel),metalnessMapUv:X&&m(a.metalnessMap.channel),roughnessMapUv:j&&m(a.roughnessMap.channel),anisotropyMapUv:Q&&m(a.anisotropyMap.channel),clearcoatMapUv:tt&&m(a.clearcoatMap.channel),clearcoatNormalMapUv:et&&m(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:nt&&m(a.clearcoatRoughnessMap.channel),iridescenceMapUv:it&&m(a.iridescenceMap.channel),iridescenceThicknessMapUv:rt&&m(a.iridescenceThicknessMap.channel),sheenColorMapUv:at&&m(a.sheenColorMap.channel),sheenRoughnessMapUv:st&&m(a.sheenRoughnessMap.channel),specularMapUv:ot&&m(a.specularMap.channel),specularColorMapUv:lt&&m(a.specularColorMap.channel),specularIntensityMapUv:ct&&m(a.specularIntensityMap.channel),transmissionMapUv:ut&&m(a.transmissionMap.channel),thicknessMapUv:ht&&m(a.thicknessMap.channel),alphaMapUv:pt&&m(a.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(k||q),vertexColors:a.vertexColors,vertexAlphas:!0===a.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,pointsUvs:!0===_.isPoints&&!!x.attributes.uv&&(N||pt),fog:!!v,useFog:!0===a.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!0===a.flatShading,sizeAttenuation:!0===a.sizeAttenuation,logarithmicDepthBuffer:h,reverseDepthBuffer:D,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:b,morphTextureStride:P,numDirLights:o.directional.length,numPointLights:o.point.length,numSpotLights:o.spot.length,numSpotLightMaps:o.spotLightMap.length,numRectAreaLights:o.rectArea.length,numHemiLights:o.hemi.length,numDirLightShadows:o.directionalShadowMap.length,numPointLightShadows:o.pointShadowMap.length,numSpotLightShadows:o.spotShadowMap.length,numSpotLightShadowsWithMaps:o.numSpotLightShadowsWithMaps,numLightProbes:o.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:a.dithering,shadowMapEnabled:t.shadowMap.enabled&&u.length>0,shadowMapType:t.shadowMap.type,toneMapping:_t,decodeVideoTexture:N&&!0===a.map.isVideoTexture&&Ue.getTransfer(a.map.colorSpace)===$t,decodeVideoTextureEmissive:W&&!0===a.emissiveMap.isVideoTexture&&Ue.getTransfer(a.emissiveMap.colorSpace)===$t,premultipliedAlpha:a.premultipliedAlpha,doubleSided:2===a.side,flipSided:1===a.side,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:gt&&!0===a.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(gt&&!0===a.extensions.multiDraw||I)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:a.customProgramCacheKey()};return vt.vertexUv1s=c.has(1),vt.vertexUv2s=c.has(2),vt.vertexUv3s=c.has(3),c.clear(),vt},getProgramCacheKey:function(e){const n=[];if(e.shaderID?n.push(e.shaderID):(n.push(e.customVertexShaderID),n.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)n.push(t),n.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(n,e),function(t,e){o.disableAll(),e.supportsVertexTextures&&o.enable(0);e.instancing&&o.enable(1);e.instancingColor&&o.enable(2);e.instancingMorph&&o.enable(3);e.matcap&&o.enable(4);e.envMap&&o.enable(5);e.normalMapObjectSpace&&o.enable(6);e.normalMapTangentSpace&&o.enable(7);e.clearcoat&&o.enable(8);e.iridescence&&o.enable(9);e.alphaTest&&o.enable(10);e.vertexColors&&o.enable(11);e.vertexAlphas&&o.enable(12);e.vertexUv1s&&o.enable(13);e.vertexUv2s&&o.enable(14);e.vertexUv3s&&o.enable(15);e.vertexTangents&&o.enable(16);e.anisotropy&&o.enable(17);e.alphaHash&&o.enable(18);e.batching&&o.enable(19);e.dispersion&&o.enable(20);e.batchingColor&&o.enable(21);t.push(o.mask),o.disableAll(),e.fog&&o.enable(0);e.useFog&&o.enable(1);e.flatShading&&o.enable(2);e.logarithmicDepthBuffer&&o.enable(3);e.reverseDepthBuffer&&o.enable(4);e.skinning&&o.enable(5);e.morphTargets&&o.enable(6);e.morphNormals&&o.enable(7);e.morphColors&&o.enable(8);e.premultipliedAlpha&&o.enable(9);e.shadowMapEnabled&&o.enable(10);e.doubleSided&&o.enable(11);e.flipSided&&o.enable(12);e.useDepthPacking&&o.enable(13);e.dithering&&o.enable(14);e.transmission&&o.enable(15);e.sheen&&o.enable(16);e.opaque&&o.enable(17);e.pointsUvs&&o.enable(18);e.decodeVideoTexture&&o.enable(19);e.decodeVideoTextureEmissive&&o.enable(20);e.alphaToCoverage&&o.enable(21);t.push(o.mask)}(n,e),n.push(t.outputColorSpace)),n.push(e.customProgramCacheKey),n.join()},getUniforms:function(t){const e=f[t.type];let n;if(e){const t=oa[e];n=er.clone(t.uniforms)}else n=t.uniforms;return n},acquireProgram:function(e,n){let i;for(let t=0,e=u.length;t<e;t++){const e=u[t];if(e.cacheKey===n){i=e,++i.usedTimes;break}}return void 0===i&&(i=new po(t,n,e,a),u.push(i)),i},releaseProgram:function(t){if(0===--t.usedTimes){const e=u.indexOf(t);u[e]=u[u.length-1],u.pop(),t.destroy()}},releaseShaderCache:function(t){l.remove(t)},programs:u,dispose:function(){l.dispose()}}}function vo(){let t=new WeakMap;return{has:function(e){return t.has(e)},get:function(e){let n=t.get(e);return void 0===n&&(n={},t.set(e,n)),n},remove:function(e){t.delete(e)},update:function(e,n,i){t.get(e)[n]=i},dispose:function(){t=new WeakMap}}}function xo(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.z!==e.z?t.z-e.z:t.id-e.id}function yo(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function Mo(){const t=[];let e=0;const n=[],i=[],r=[];function a(n,i,r,a,s,o){let l=t[e];return void 0===l?(l={id:n.id,object:n,geometry:i,material:r,groupOrder:a,renderOrder:n.renderOrder,z:s,group:o},t[e]=l):(l.id=n.id,l.object=n,l.geometry=i,l.material=r,l.groupOrder=a,l.renderOrder=n.renderOrder,l.z=s,l.group=o),e++,l}return{opaque:n,transmissive:i,transparent:r,init:function(){e=0,n.length=0,i.length=0,r.length=0},push:function(t,e,s,o,l,c){const u=a(t,e,s,o,l,c);s.transmission>0?i.push(u):!0===s.transparent?r.push(u):n.push(u)},unshift:function(t,e,s,o,l,c){const u=a(t,e,s,o,l,c);s.transmission>0?i.unshift(u):!0===s.transparent?r.unshift(u):n.unshift(u)},finish:function(){for(let n=e,i=t.length;n<i;n++){const e=t[n];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){n.length>1&&n.sort(t||xo),i.length>1&&i.sort(e||yo),r.length>1&&r.sort(e||yo)}}}function So(){let t=new WeakMap;return{get:function(e,n){const i=t.get(e);let r;return void 0===i?(r=new Mo,t.set(e,[r])):n>=i.length?(r=new Mo,i.push(r)):r=i[n],r},dispose:function(){t=new WeakMap}}}function To(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":n={direction:new Ke,color:new vi};break;case"SpotLight":n={position:new Ke,direction:new Ke,color:new vi,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Ke,color:new vi,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Ke,skyColor:new vi,groundColor:new vi};break;case"RectAreaLight":n={color:new vi,position:new Ke,halfWidth:new Ke,halfHeight:new Ke}}return t[e.id]=n,n}}}let Eo=0;function bo(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function wo(t){const e=new To,n=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let n;switch(e.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Se};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Se,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)i.probe.push(new Ke);const r=new Ke,a=new wn,s=new wn;return{setup:function(r){let a=0,s=0,o=0;for(let t=0;t<9;t++)i.probe[t].set(0,0,0);let l=0,c=0,u=0,h=0,d=0,p=0,f=0,m=0,g=0,_=0,v=0;r.sort(bo);for(let t=0,x=r.length;t<x;t++){const x=r[t],y=x.color,M=x.intensity,S=x.distance,T=x.shadow&&x.shadow.map?x.shadow.map.texture:null;if(x.isAmbientLight)a+=y.r*M,s+=y.g*M,o+=y.b*M;else if(x.isLightProbe){for(let t=0;t<9;t++)i.probe[t].addScaledVector(x.sh.coefficients[t],M);v++}else if(x.isDirectionalLight){const t=e.get(x);if(t.color.copy(x.color).multiplyScalar(x.intensity),x.castShadow){const t=x.shadow,e=n.get(x);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,i.directionalShadow[l]=e,i.directionalShadowMap[l]=T,i.directionalShadowMatrix[l]=x.shadow.matrix,p++}i.directional[l]=t,l++}else if(x.isSpotLight){const t=e.get(x);t.position.setFromMatrixPosition(x.matrixWorld),t.color.copy(y).multiplyScalar(M),t.distance=S,t.coneCos=Math.cos(x.angle),t.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),t.decay=x.decay,i.spot[u]=t;const r=x.shadow;if(x.map&&(i.spotLightMap[g]=x.map,g++,r.updateMatrices(x),x.castShadow&&_++),i.spotLightMatrix[u]=r.matrix,x.castShadow){const t=n.get(x);t.shadowIntensity=r.intensity,t.shadowBias=r.bias,t.shadowNormalBias=r.normalBias,t.shadowRadius=r.radius,t.shadowMapSize=r.mapSize,i.spotShadow[u]=t,i.spotShadowMap[u]=T,m++}u++}else if(x.isRectAreaLight){const t=e.get(x);t.color.copy(y).multiplyScalar(M),t.halfWidth.set(.5*x.width,0,0),t.halfHeight.set(0,.5*x.height,0),i.rectArea[h]=t,h++}else if(x.isPointLight){const t=e.get(x);if(t.color.copy(x.color).multiplyScalar(x.intensity),t.distance=x.distance,t.decay=x.decay,x.castShadow){const t=x.shadow,e=n.get(x);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,i.pointShadow[c]=e,i.pointShadowMap[c]=T,i.pointShadowMatrix[c]=x.shadow.matrix,f++}i.point[c]=t,c++}else if(x.isHemisphereLight){const t=e.get(x);t.skyColor.copy(x.color).multiplyScalar(M),t.groundColor.copy(x.groundColor).multiplyScalar(M),i.hemi[d]=t,d++}}h>0&&(!0===t.has("OES_texture_float_linear")?(i.rectAreaLTC1=sa.LTC_FLOAT_1,i.rectAreaLTC2=sa.LTC_FLOAT_2):(i.rectAreaLTC1=sa.LTC_HALF_1,i.rectAreaLTC2=sa.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=s,i.ambient[2]=o;const x=i.hash;x.directionalLength===l&&x.pointLength===c&&x.spotLength===u&&x.rectAreaLength===h&&x.hemiLength===d&&x.numDirectionalShadows===p&&x.numPointShadows===f&&x.numSpotShadows===m&&x.numSpotMaps===g&&x.numLightProbes===v||(i.directional.length=l,i.spot.length=u,i.rectArea.length=h,i.point.length=c,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=f,i.spotLightMatrix.length=m+g-_,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=_,i.numLightProbes=v,x.directionalLength=l,x.pointLength=c,x.spotLength=u,x.rectAreaLength=h,x.hemiLength=d,x.numDirectionalShadows=p,x.numPointShadows=f,x.numSpotShadows=m,x.numSpotMaps=g,x.numLightProbes=v,i.version=Eo++)},setupView:function(t,e){let n=0,o=0,l=0,c=0,u=0;const h=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=i.directional[n];t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(h),n++}else if(d.isSpotLight){const t=i.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(h),t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(h),l++}else if(d.isRectAreaLight){const t=i.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(h),s.identity(),a.copy(d.matrixWorld),a.premultiply(h),s.extractRotation(a),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(s),t.halfHeight.applyMatrix4(s),c++}else if(d.isPointLight){const t=i.point[o];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(h),o++}else if(d.isHemisphereLight){const t=i.hemi[u];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(h),u++}}},state:i}}function Ao(t){const e=new wo(t),n=[],i=[];const r={lightsArray:n,shadowsArray:i,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){r.camera=t,n.length=0,i.length=0},state:r,setupLights:function(){e.setup(n)},setupLightsView:function(t){e.setupView(n,t)},pushLight:function(t){n.push(t)},pushShadow:function(t){i.push(t)}}}function Ro(t){let e=new WeakMap;return{get:function(n,i=0){const r=e.get(n);let a;return void 0===r?(a=new Ao(t),e.set(n,[a])):i>=r.length?(a=new Ao(t),r.push(a)):a=r[i],a},dispose:function(){e=new WeakMap}}}function Co(t,e,n){let s=new Sr;const o=new Se,l=new Se,c=new Ge,u=new br({depthPacking:3201}),h=new wr,d={},p=n.maxTextureSize,f={[i]:1,[r]:0,[a]:2},m=new nr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Se},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),g=m.clone();g.defines.HORIZONTAL_PASS=1;const _=new Fi;_.setAttribute("position",new wi(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const v=new Ki(_,m),x=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let y=this.type;function M(n,i){const r=e.update(v);m.defines.VSM_SAMPLES!==n.blurSamples&&(m.defines.VSM_SAMPLES=n.blurSamples,g.defines.VSM_SAMPLES=n.blurSamples,m.needsUpdate=!0,g.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new Xe(o.x,o.y)),m.uniforms.shadow_pass.value=n.map.texture,m.uniforms.resolution.value=n.mapSize,m.uniforms.radius.value=n.radius,t.setRenderTarget(n.mapPass),t.clear(),t.renderBufferDirect(i,null,r,m,v,null),g.uniforms.shadow_pass.value=n.mapPass.texture,g.uniforms.resolution.value=n.mapSize,g.uniforms.radius.value=n.radius,t.setRenderTarget(n.map),t.clear(),t.renderBufferDirect(i,null,r,g,v,null)}function S(e,n,i,r){let a=null;const s=!0===i.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===i.isPointLight?h:u,t.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){const t=a.uuid,e=n.uuid;let i=d[t];void 0===i&&(i={},d[t]=i);let r=i[e];void 0===r&&(r=a.clone(),i[e]=r,n.addEventListener("dispose",E)),a=r}if(a.visible=n.visible,a.wireframe=n.wireframe,a.side=3===r?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:f[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial){t.properties.get(a).light=i}return a}function T(n,i,r,a,o){if(!1===n.visible)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&3===o)&&(!n.frustumCulled||s.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,n.matrixWorld);const s=e.update(n),l=n.material;if(Array.isArray(l)){const e=s.groups;for(let c=0,u=e.length;c<u;c++){const u=e[c],h=l[u.materialIndex];if(h&&h.visible){const e=S(n,h,a,o);n.onBeforeShadow(t,n,i,r,s,e,u),t.renderBufferDirect(r,null,s,e,n,u),n.onAfterShadow(t,n,i,r,s,e,u)}}}else if(l.visible){const e=S(n,l,a,o);n.onBeforeShadow(t,n,i,r,s,e,null),t.renderBufferDirect(r,null,s,e,n,null),n.onAfterShadow(t,n,i,r,s,e,null)}}const l=n.children;for(let t=0,e=l.length;t<e;t++)T(l[t],i,r,a,o)}function E(t){t.target.removeEventListener("dispose",E);for(const e in d){const n=d[e],i=t.target.uuid;if(i in n){n[i].dispose(),delete n[i]}}}this.render=function(e,n,i){if(!1===x.enabled)return;if(!1===x.autoUpdate&&!1===x.needsUpdate)return;if(0===e.length)return;const r=t.getRenderTarget(),a=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),h=t.state;h.setBlending(0),h.buffers.color.setClear(1,1,1,1),h.buffers.depth.setTest(!0),h.setScissorTest(!1);const d=3!==y&&3===this.type,f=3===y&&3!==this.type;for(let r=0,a=e.length;r<a;r++){const a=e[r],u=a.shadow;if(void 0===u){console.warn("THREE.WebGLShadowMap:",a,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;o.copy(u.mapSize);const m=u.getFrameExtents();if(o.multiply(m),l.copy(u.mapSize),(o.x>p||o.y>p)&&(o.x>p&&(l.x=Math.floor(p/m.x),o.x=l.x*m.x,u.mapSize.x=l.x),o.y>p&&(l.y=Math.floor(p/m.y),o.y=l.y*m.y,u.mapSize.y=l.y)),null===u.map||!0===d||!0===f){const t=3!==this.type?{minFilter:V,magFilter:V}:{};null!==u.map&&u.map.dispose(),u.map=new Xe(o.x,o.y,t),u.map.texture.name=a.name+".shadowMap",u.camera.updateProjectionMatrix()}t.setRenderTarget(u.map),t.clear();const g=u.getViewportCount();for(let t=0;t<g;t++){const e=u.getViewport(t);c.set(l.x*e.x,l.y*e.y,l.x*e.z,l.y*e.w),h.viewport(c),u.updateMatrices(a,t),s=u.getFrustum(),T(n,i,u.camera,a,this.type)}!0!==u.isPointLightShadow&&3===this.type&&M(u,i),u.needsUpdate=!1}y=this.type,x.needsUpdate=!1,t.setRenderTarget(r,a,u)}}const Po={[E]:1,[w]:6,[R]:7,[A]:5,[b]:0,[P]:2,[L]:4,[C]:3};function Lo(t,e){const n=new function(){let e=!1;const n=new Ge;let i=null;const r=new Ge(0,0,0,0);return{setMask:function(n){i===n||e||(t.colorMask(n,n,n,n),i=n)},setLocked:function(t){e=t},setClear:function(e,i,a,s,o){!0===o&&(e*=s,i*=s,a*=s),n.set(e,i,a,s),!1===r.equals(n)&&(t.clearColor(e,i,a,s),r.copy(n))},reset:function(){e=!1,i=null,r.set(-1,0,0,0)}}},i=new function(){let n=!1,i=!1,r=null,a=null,s=null;return{setReversed:function(t){if(i!==t){const n=e.get("EXT_clip_control");t?n.clipControlEXT(n.LOWER_LEFT_EXT,n.ZERO_TO_ONE_EXT):n.clipControlEXT(n.LOWER_LEFT_EXT,n.NEGATIVE_ONE_TO_ONE_EXT),i=t;const r=s;s=null,this.setClear(r)}},getReversed:function(){return i},setTest:function(e){e?rt(t.DEPTH_TEST):at(t.DEPTH_TEST)},setMask:function(e){r===e||n||(t.depthMask(e),r=e)},setFunc:function(e){if(i&&(e=Po[e]),a!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}a=e}},setLocked:function(t){n=t},setClear:function(e){s!==e&&(i&&(e=1-e),t.clearDepth(e),s=e)},reset:function(){n=!1,r=null,a=null,s=null,i=!1}}},r=new function(){let e=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,c=null;return{setTest:function(n){e||(n?rt(t.STENCIL_TEST):at(t.STENCIL_TEST))},setMask:function(i){n===i||e||(t.stencilMask(i),n=i)},setFunc:function(e,n,s){i===e&&r===n&&a===s||(t.stencilFunc(e,n,s),i=e,r=n,a=s)},setOp:function(e,n,i){s===e&&o===n&&l===i||(t.stencilOp(e,n,i),s=e,o=n,l=i)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,n=null,i=null,r=null,a=null,s=null,o=null,l=null,c=null}}},a=new WeakMap,E=new WeakMap;let b={},w={},A=new WeakMap,R=[],C=null,P=!1,L=null,D=null,U=null,I=null,N=null,O=null,F=null,B=new vi(0,0,0),z=0,V=!1,H=null,k=null,G=null,W=null,X=null;const j=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,Y=0;const K=t.getParameter(t.VERSION);-1!==K.indexOf("WebGL")?(Y=parseFloat(/^WebGL (\d)/.exec(K)[1]),q=Y>=1):-1!==K.indexOf("OpenGL ES")&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),q=Y>=2);let Z=null,J={};const $=t.getParameter(t.SCISSOR_BOX),Q=t.getParameter(t.VIEWPORT),tt=(new Ge).fromArray($),et=(new Ge).fromArray(Q);function nt(e,n,i,r){const a=new Uint8Array(4),s=t.createTexture();t.bindTexture(e,s),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let s=0;s<i;s++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(n,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,a):t.texImage2D(n+s,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,a);return s}const it={};function rt(e){!0!==b[e]&&(t.enable(e),b[e]=!0)}function at(e){!1!==b[e]&&(t.disable(e),b[e]=!1)}it[t.TEXTURE_2D]=nt(t.TEXTURE_2D,t.TEXTURE_2D,1),it[t.TEXTURE_CUBE_MAP]=nt(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),it[t.TEXTURE_2D_ARRAY]=nt(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),it[t.TEXTURE_3D]=nt(t.TEXTURE_3D,t.TEXTURE_3D,1,1),n.setClear(0,0,0,1),i.setClear(1),r.setClear(0),rt(t.DEPTH_TEST),i.setFunc(3),ct(!1),ut(1),rt(t.CULL_FACE),lt(0);const st={[s]:t.FUNC_ADD,[o]:t.FUNC_SUBTRACT,[l]:t.FUNC_REVERSE_SUBTRACT};st[103]=t.MIN,st[104]=t.MAX;const ot={[c]:t.ZERO,[u]:t.ONE,[h]:t.SRC_COLOR,[p]:t.SRC_ALPHA,[x]:t.SRC_ALPHA_SATURATE,[_]:t.DST_COLOR,[m]:t.DST_ALPHA,[d]:t.ONE_MINUS_SRC_COLOR,[f]:t.ONE_MINUS_SRC_ALPHA,[v]:t.ONE_MINUS_DST_COLOR,[g]:t.ONE_MINUS_DST_ALPHA,[y]:t.CONSTANT_COLOR,[M]:t.ONE_MINUS_CONSTANT_COLOR,[S]:t.CONSTANT_ALPHA,[T]:t.ONE_MINUS_CONSTANT_ALPHA};function lt(e,n,i,r,a,o,l,c,u,h){if(0!==e){if(!1===P&&(rt(t.BLEND),P=!0),5===e)a=a||n,o=o||i,l=l||r,n===D&&a===N||(t.blendEquationSeparate(st[n],st[a]),D=n,N=a),i===U&&r===I&&o===O&&l===F||(t.blendFuncSeparate(ot[i],ot[r],ot[o],ot[l]),U=i,I=r,O=o,F=l),!1!==c.equals(B)&&u===z||(t.blendColor(c.r,c.g,c.b,u),B.copy(c),z=u),L=e,V=!1;else if(e!==L||h!==V){if(D===s&&N===s||(t.blendEquation(t.FUNC_ADD),D=s,N=s),h)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.ZERO,t.SRC_COLOR,t.ZERO,t.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.SRC_ALPHA,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFunc(t.ZERO,t.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",e)}U=null,I=null,O=null,F=null,B.set(0,0,0),z=0,L=e,V=h}}else!0===P&&(at(t.BLEND),P=!1)}function ct(e){H!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),H=e)}function ut(e){0!==e?(rt(t.CULL_FACE),e!==k&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):at(t.CULL_FACE),k=e}function ht(e,n,i){e?(rt(t.POLYGON_OFFSET_FILL),W===n&&X===i||(t.polygonOffset(n,i),W=n,X=i)):at(t.POLYGON_OFFSET_FILL)}return{buffers:{color:n,depth:i,stencil:r},enable:rt,disable:at,bindFramebuffer:function(e,n){return w[e]!==n&&(t.bindFramebuffer(e,n),w[e]=n,e===t.DRAW_FRAMEBUFFER&&(w[t.FRAMEBUFFER]=n),e===t.FRAMEBUFFER&&(w[t.DRAW_FRAMEBUFFER]=n),!0)},drawBuffers:function(e,n){let i=R,r=!1;if(e){i=A.get(n),void 0===i&&(i=[],A.set(n,i));const a=e.textures;if(i.length!==a.length||i[0]!==t.COLOR_ATTACHMENT0){for(let e=0,n=a.length;e<n;e++)i[e]=t.COLOR_ATTACHMENT0+e;i.length=a.length,r=!0}}else i[0]!==t.BACK&&(i[0]=t.BACK,r=!0);r&&t.drawBuffers(i)},useProgram:function(e){return C!==e&&(t.useProgram(e),C=e,!0)},setBlending:lt,setMaterial:function(e,a){2===e.side?at(t.CULL_FACE):rt(t.CULL_FACE);let s=1===e.side;a&&(s=!s),ct(s),1===e.blending&&!1===e.transparent?lt(0):lt(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),i.setFunc(e.depthFunc),i.setTest(e.depthTest),i.setMask(e.depthWrite),n.setMask(e.colorWrite);const o=e.stencilWrite;r.setTest(o),o&&(r.setMask(e.stencilWriteMask),r.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),r.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),ht(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?rt(t.SAMPLE_ALPHA_TO_COVERAGE):at(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:ct,setCullFace:ut,setLineWidth:function(e){e!==G&&(q&&t.lineWidth(e),G=e)},setPolygonOffset:ht,setScissorTest:function(e){e?rt(t.SCISSOR_TEST):at(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+j-1),Z!==e&&(t.activeTexture(e),Z=e)},bindTexture:function(e,n,i){void 0===i&&(i=null===Z?t.TEXTURE0+j-1:Z);let r=J[i];void 0===r&&(r={type:void 0,texture:void 0},J[i]=r),r.type===e&&r.texture===n||(Z!==i&&(t.activeTexture(i),Z=i),t.bindTexture(e,n||it[e]),r.type=e,r.texture=n)},unbindTexture:function(){const e=J[Z];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D(...arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D(...arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage2D:function(){try{t.texImage2D(...arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texImage3D:function(){try{t.texImage3D(...arguments)}catch(t){console.error("THREE.WebGLState:",t)}},updateUBOMapping:function(e,n){let i=E.get(n);void 0===i&&(i=new WeakMap,E.set(n,i));let r=i.get(e);void 0===r&&(r=t.getUniformBlockIndex(n,e.name),i.set(e,r))},uniformBlockBinding:function(e,n){const i=E.get(n).get(e);a.get(n)!==i&&(t.uniformBlockBinding(n,i,e.__bindingPointIndex),a.set(n,i))},texStorage2D:function(){try{t.texStorage2D(...arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D(...arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D(...arguments)}catch(t){console.error("THREE.WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D(...arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D(...arguments)}catch(t){console.error("THREE.WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D(...arguments)}catch(t){console.error("THREE.WebGLState:",t)}},scissor:function(e){!1===tt.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),tt.copy(e))},viewport:function(e){!1===et.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),et.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),i.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),b={},Z=null,J={},w={},A=new WeakMap,R=[],C=null,P=!1,L=null,D=null,U=null,I=null,N=null,O=null,F=null,B=new vi(0,0,0),z=0,V=!1,H=null,k=null,G=null,W=null,X=null,tt.set(0,0,t.canvas.width,t.canvas.height),et.set(0,0,t.canvas.width,t.canvas.height),n.reset(),i.reset(),r.reset()}}}function Do(t,e,n,i,r,a,s){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new Se,u=new WeakMap;let h;const d=new WeakMap;let p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function f(t,e){return p?new OffscreenCanvas(t,e):we("canvas")}function m(t,e,n){let i=1;const r=et(t);if((r.width>n||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===h&&(h=f(n,a));const s=e?f(n,a):h;s.width=n,s.height=a;return s.getContext("2d").drawImage(t,0,0,n,a),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),s}return"data"in t&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),t}return t}function g(t){return t.generateMipmaps}function _(e){t.generateMipmap(e)}function v(e){return e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:e.isWebGL3DRenderTarget?t.TEXTURE_3D:e.isWebGLArrayRenderTarget||e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function x(n,i,r,a,s=!1){if(null!==n){if(void 0!==t[n])return t[n];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}let o=i;if(i===t.RED&&(r===t.FLOAT&&(o=t.R32F),r===t.HALF_FLOAT&&(o=t.R16F),r===t.UNSIGNED_BYTE&&(o=t.R8)),i===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.R8UI),r===t.UNSIGNED_SHORT&&(o=t.R16UI),r===t.UNSIGNED_INT&&(o=t.R32UI),r===t.BYTE&&(o=t.R8I),r===t.SHORT&&(o=t.R16I),r===t.INT&&(o=t.R32I)),i===t.RG&&(r===t.FLOAT&&(o=t.RG32F),r===t.HALF_FLOAT&&(o=t.RG16F),r===t.UNSIGNED_BYTE&&(o=t.RG8)),i===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RG8UI),r===t.UNSIGNED_SHORT&&(o=t.RG16UI),r===t.UNSIGNED_INT&&(o=t.RG32UI),r===t.BYTE&&(o=t.RG8I),r===t.SHORT&&(o=t.RG16I),r===t.INT&&(o=t.RG32I)),i===t.RGB_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RGB8UI),r===t.UNSIGNED_SHORT&&(o=t.RGB16UI),r===t.UNSIGNED_INT&&(o=t.RGB32UI),r===t.BYTE&&(o=t.RGB8I),r===t.SHORT&&(o=t.RGB16I),r===t.INT&&(o=t.RGB32I)),i===t.RGBA_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RGBA8UI),r===t.UNSIGNED_SHORT&&(o=t.RGBA16UI),r===t.UNSIGNED_INT&&(o=t.RGBA32UI),r===t.BYTE&&(o=t.RGBA8I),r===t.SHORT&&(o=t.RGBA16I),r===t.INT&&(o=t.RGBA32I)),i===t.RGB&&r===t.UNSIGNED_INT_5_9_9_9_REV&&(o=t.RGB9_E5),i===t.RGBA){const e=s?Jt:Ue.getTransfer(a);r===t.FLOAT&&(o=t.RGBA32F),r===t.HALF_FLOAT&&(o=t.RGBA16F),r===t.UNSIGNED_BYTE&&(o=e===$t?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(o=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(o=t.RGB5_A1)}return o!==t.R16F&&o!==t.R32F&&o!==t.RG16F&&o!==t.RG32F&&o!==t.RGBA16F&&o!==t.RGBA32F||e.get("EXT_color_buffer_float"),o}function y(e,n){let i;return e?null===n||n===J||n===nt?i=t.DEPTH24_STENCIL8:n===$?i=t.DEPTH32F_STENCIL8:n===K&&(i=t.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===J||n===nt?i=t.DEPTH_COMPONENT24:n===$?i=t.DEPTH_COMPONENT32F:n===K&&(i=t.DEPTH_COMPONENT16),i}function M(t,e){return!0===g(t)||t.isFramebufferTexture&&t.minFilter!==V&&t.minFilter!==G?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function S(t){const e=t.target;e.removeEventListener("dispose",S),function(t){const e=i.get(t);if(void 0===e.__webglInit)return;const n=t.source,r=d.get(n);if(r){const i=r[e.__cacheKey];i.usedTimes--,0===i.usedTimes&&E(t),0===Object.keys(r).length&&d.delete(n)}i.remove(t)}(e),e.isVideoTexture&&u.delete(e)}function T(e){const n=e.target;n.removeEventListener("dispose",T),function(e){const n=i.get(e);e.depthTexture&&(e.depthTexture.dispose(),i.remove(e.depthTexture));if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(n.__webglFramebuffer[e]))for(let i=0;i<n.__webglFramebuffer[e].length;i++)t.deleteFramebuffer(n.__webglFramebuffer[e][i]);else t.deleteFramebuffer(n.__webglFramebuffer[e]);n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer[e])}else{if(Array.isArray(n.__webglFramebuffer))for(let e=0;e<n.__webglFramebuffer.length;e++)t.deleteFramebuffer(n.__webglFramebuffer[e]);else t.deleteFramebuffer(n.__webglFramebuffer);if(n.__webglDepthbuffer&&t.deleteRenderbuffer(n.__webglDepthbuffer),n.__webglMultisampledFramebuffer&&t.deleteFramebuffer(n.__webglMultisampledFramebuffer),n.__webglColorRenderbuffer)for(let e=0;e<n.__webglColorRenderbuffer.length;e++)n.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(n.__webglColorRenderbuffer[e]);n.__webglDepthRenderbuffer&&t.deleteRenderbuffer(n.__webglDepthRenderbuffer)}const r=e.textures;for(let e=0,n=r.length;e<n;e++){const n=i.get(r[e]);n.__webglTexture&&(t.deleteTexture(n.__webglTexture),s.memory.textures--),i.remove(r[e])}i.remove(e)}(n)}function E(e){const n=i.get(e);t.deleteTexture(n.__webglTexture);const r=e.source;delete d.get(r)[n.__cacheKey],s.memory.textures--}let b=0;function w(e,r){const a=i.get(e);if(e.isVideoTexture&&function(t){const e=s.render.frame;u.get(t)!==e&&(u.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&e.version>0&&a.__version!==e.version){const t=e.image;if(null===t)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void D(a,e,r);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.bindTexture(t.TEXTURE_2D,a.__webglTexture,t.TEXTURE0+r)}const A={[F]:t.REPEAT,[B]:t.CLAMP_TO_EDGE,[z]:t.MIRRORED_REPEAT},R={[V]:t.NEAREST,[H]:t.NEAREST_MIPMAP_NEAREST,[k]:t.NEAREST_MIPMAP_LINEAR,[G]:t.LINEAR,[W]:t.LINEAR_MIPMAP_NEAREST,[X]:t.LINEAR_MIPMAP_LINEAR},C={[te]:t.NEVER,[oe]:t.ALWAYS,[ee]:t.LESS,[ie]:t.LEQUAL,[ne]:t.EQUAL,[se]:t.GEQUAL,[re]:t.GREATER,[ae]:t.NOTEQUAL};function P(n,a){if(a.type!==$||!1!==e.has("OES_texture_float_linear")||a.magFilter!==G&&a.magFilter!==W&&a.magFilter!==k&&a.magFilter!==X&&a.minFilter!==G&&a.minFilter!==W&&a.minFilter!==k&&a.minFilter!==X||console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(n,t.TEXTURE_WRAP_S,A[a.wrapS]),t.texParameteri(n,t.TEXTURE_WRAP_T,A[a.wrapT]),n!==t.TEXTURE_3D&&n!==t.TEXTURE_2D_ARRAY||t.texParameteri(n,t.TEXTURE_WRAP_R,A[a.wrapR]),t.texParameteri(n,t.TEXTURE_MAG_FILTER,R[a.magFilter]),t.texParameteri(n,t.TEXTURE_MIN_FILTER,R[a.minFilter]),a.compareFunction&&(t.texParameteri(n,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(n,t.TEXTURE_COMPARE_FUNC,C[a.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(a.magFilter===V)return;if(a.minFilter!==k&&a.minFilter!==X)return;if(a.type===$&&!1===e.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const s=e.get("EXT_texture_filter_anisotropic");t.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function L(e,n){let i=!1;void 0===e.__webglInit&&(e.__webglInit=!0,n.addEventListener("dispose",S));const r=n.source;let a=d.get(r);void 0===a&&(a={},d.set(r,a));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(n);if(o!==e.__cacheKey){void 0===a[o]&&(a[o]={texture:t.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;const r=a[e.__cacheKey];void 0!==r&&(a[e.__cacheKey].usedTimes--,0===r.usedTimes&&E(n)),e.__cacheKey=o,e.__webglTexture=a[o].texture}return i}function D(e,s,o){let l=t.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=t.TEXTURE_3D);const c=L(e,s),u=s.source;n.bindTexture(l,e.__webglTexture,t.TEXTURE0+o);const h=i.get(u);if(u.version!==h.__version||!0===c){n.activeTexture(t.TEXTURE0+o);const e=Ue.getPrimaries(Ue.workingColorSpace),i=s.colorSpace===Yt?null:Ue.getPrimaries(s.colorSpace),d=s.colorSpace===Yt||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,s.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,s.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=m(s.image,!1,r.maxTextureSize);p=tt(s,p);const f=a.convert(s.format,s.colorSpace),v=a.convert(s.type);let S,T=x(s.internalFormat,f,v,s.colorSpace,s.isVideoTexture);P(l,s);const E=s.mipmaps,b=!0!==s.isVideoTexture,w=void 0===h.__version||!0===c,A=u.dataReady,R=M(s,p);if(s.isDepthTexture)T=y(s.format===st,s.type),w&&(b?n.texStorage2D(t.TEXTURE_2D,1,T,p.width,p.height):n.texImage2D(t.TEXTURE_2D,0,T,p.width,p.height,0,f,v,null));else if(s.isDataTexture)if(E.length>0){b&&w&&n.texStorage2D(t.TEXTURE_2D,R,T,E[0].width,E[0].height);for(let e=0,i=E.length;e<i;e++)S=E[e],b?A&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,S.width,S.height,f,v,S.data):n.texImage2D(t.TEXTURE_2D,e,T,S.width,S.height,0,f,v,S.data);s.generateMipmaps=!1}else b?(w&&n.texStorage2D(t.TEXTURE_2D,R,T,p.width,p.height),A&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,p.width,p.height,f,v,p.data)):n.texImage2D(t.TEXTURE_2D,0,T,p.width,p.height,0,f,v,p.data);else if(s.isCompressedTexture)if(s.isCompressedArrayTexture){b&&w&&n.texStorage3D(t.TEXTURE_2D_ARRAY,R,T,E[0].width,E[0].height,p.depth);for(let e=0,i=E.length;e<i;e++)if(S=E[e],s.format!==rt)if(null!==f)if(b){if(A)if(s.layerUpdates.size>0){const i=na(S.width,S.height,s.format,s.type);for(const r of s.layerUpdates){const a=S.data.subarray(r*i/S.data.BYTES_PER_ELEMENT,(r+1)*i/S.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,r,S.width,S.height,1,f,a)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,S.width,S.height,p.depth,f,S.data)}else n.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,T,S.width,S.height,p.depth,0,S.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else b?A&&n.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,S.width,S.height,p.depth,f,v,S.data):n.texImage3D(t.TEXTURE_2D_ARRAY,e,T,S.width,S.height,p.depth,0,f,v,S.data)}else{b&&w&&n.texStorage2D(t.TEXTURE_2D,R,T,E[0].width,E[0].height);for(let e=0,i=E.length;e<i;e++)S=E[e],s.format!==rt?null!==f?b?A&&n.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,S.width,S.height,f,S.data):n.compressedTexImage2D(t.TEXTURE_2D,e,T,S.width,S.height,0,S.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):b?A&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,S.width,S.height,f,v,S.data):n.texImage2D(t.TEXTURE_2D,e,T,S.width,S.height,0,f,v,S.data)}else if(s.isDataArrayTexture)if(b){if(w&&n.texStorage3D(t.TEXTURE_2D_ARRAY,R,T,p.width,p.height,p.depth),A)if(s.layerUpdates.size>0){const e=na(p.width,p.height,s.format,s.type);for(const i of s.layerUpdates){const r=p.data.subarray(i*e/p.data.BYTES_PER_ELEMENT,(i+1)*e/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,i,p.width,p.height,1,f,v,r)}s.clearLayerUpdates()}else n.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,f,v,p.data)}else n.texImage3D(t.TEXTURE_2D_ARRAY,0,T,p.width,p.height,p.depth,0,f,v,p.data);else if(s.isData3DTexture)b?(w&&n.texStorage3D(t.TEXTURE_3D,R,T,p.width,p.height,p.depth),A&&n.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,f,v,p.data)):n.texImage3D(t.TEXTURE_3D,0,T,p.width,p.height,p.depth,0,f,v,p.data);else if(s.isFramebufferTexture){if(w)if(b)n.texStorage2D(t.TEXTURE_2D,R,T,p.width,p.height);else{let e=p.width,i=p.height;for(let r=0;r<R;r++)n.texImage2D(t.TEXTURE_2D,r,T,e,i,0,f,v,null),e>>=1,i>>=1}}else if(E.length>0){if(b&&w){const e=et(E[0]);n.texStorage2D(t.TEXTURE_2D,R,T,e.width,e.height)}for(let e=0,i=E.length;e<i;e++)S=E[e],b?A&&n.texSubImage2D(t.TEXTURE_2D,e,0,0,f,v,S):n.texImage2D(t.TEXTURE_2D,e,T,f,v,S);s.generateMipmaps=!1}else if(b){if(w){const e=et(p);n.texStorage2D(t.TEXTURE_2D,R,T,e.width,e.height)}A&&n.texSubImage2D(t.TEXTURE_2D,0,0,0,f,v,p)}else n.texImage2D(t.TEXTURE_2D,0,T,f,v,p);g(s)&&_(l),h.__version=u.version,s.onUpdate&&s.onUpdate(s)}e.__version=s.version}function U(e,r,s,l,c,u){const h=a.convert(s.format,s.colorSpace),d=a.convert(s.type),p=x(s.internalFormat,h,d,s.colorSpace),f=i.get(r),m=i.get(s);if(m.__renderTarget=r,!f.__hasExternalTextures){const e=Math.max(1,r.width>>u),i=Math.max(1,r.height>>u);c===t.TEXTURE_3D||c===t.TEXTURE_2D_ARRAY?n.texImage3D(c,u,p,e,i,r.depth,0,h,d,null):n.texImage2D(c,u,p,e,i,0,h,d,null)}n.bindFramebuffer(t.FRAMEBUFFER,e),Q(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,c,m.__webglTexture,0,Z(r)):(c===t.TEXTURE_2D||c>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,l,c,m.__webglTexture,u),n.bindFramebuffer(t.FRAMEBUFFER,null)}function I(e,n,i){if(t.bindRenderbuffer(t.RENDERBUFFER,e),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=y(n.stencilBuffer,a),l=n.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,c=Z(n);Q(n)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,c,s,n.width,n.height):i?t.renderbufferStorageMultisample(t.RENDERBUFFER,c,s,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,s,n.width,n.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{const e=n.textures;for(let r=0;r<e.length;r++){const s=e[r],l=a.convert(s.format,s.colorSpace),c=a.convert(s.type),u=x(s.internalFormat,l,c,s.colorSpace),h=Z(n);i&&!1===Q(n)?t.renderbufferStorageMultisample(t.RENDERBUFFER,h,u,n.width,n.height):Q(n)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,h,u,n.width,n.height):t.renderbufferStorage(t.RENDERBUFFER,u,n.width,n.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function N(e,r){if(r&&r.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(n.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const a=i.get(r.depthTexture);a.__renderTarget=r,a.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),w(r.depthTexture,0);const s=a.__webglTexture,l=Z(r);if(r.depthTexture.format===at)Q(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,s,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,s,0);else{if(r.depthTexture.format!==st)throw new Error("Unknown depthTexture format");Q(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,s,0,l):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,s,0)}}function O(e){const r=i.get(e),a=!0===e.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==e.depthTexture){const t=e.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),t){const e=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,t.removeEventListener("dispose",e)};t.addEventListener("dispose",e),r.__depthDisposeCallback=e}r.__boundDepthTexture=t}if(e.depthTexture&&!r.__autoAllocateDepthBuffer){if(a)throw new Error("target.depthTexture not supported in Cube render targets");const t=e.texture.mipmaps;t&&t.length>0?N(r.__webglFramebuffer[0],e):N(r.__webglFramebuffer,e)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=t.createRenderbuffer(),I(r.__webglDepthbuffer[i],e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,a=r.__webglDepthbuffer[i];t.bindRenderbuffer(t.RENDERBUFFER,a),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,a)}}else{const i=e.texture.mipmaps;if(i&&i.length>0?n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[0]):n.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=t.createRenderbuffer(),I(r.__webglDepthbuffer,e,!1);else{const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,i),t.framebufferRenderbuffer(t.FRAMEBUFFER,n,t.RENDERBUFFER,i)}}n.bindFramebuffer(t.FRAMEBUFFER,null)}const q=[],Y=[];function Z(t){return Math.min(r.maxSamples,t.samples)}function Q(t){const n=i.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function tt(t,e){const n=t.colorSpace,i=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||n!==Zt&&n!==Yt&&(Ue.getTransfer(n)===$t?i===rt&&r===j||console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),e}function et(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(c.width=t.naturalWidth||t.width,c.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(c.width=t.displayWidth,c.height=t.displayHeight):(c.width=t.width,c.height=t.height),c}this.allocateTextureUnit=function(){const t=b;return t>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+r.maxTextures),b+=1,t},this.resetTextureUnits=function(){b=0},this.setTexture2D=w,this.setTexture2DArray=function(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?D(a,e,r):n.bindTexture(t.TEXTURE_2D_ARRAY,a.__webglTexture,t.TEXTURE0+r)},this.setTexture3D=function(e,r){const a=i.get(e);e.version>0&&a.__version!==e.version?D(a,e,r):n.bindTexture(t.TEXTURE_3D,a.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,s){const o=i.get(e);e.version>0&&o.__version!==e.version?function(e,s,o){if(6!==s.image.length)return;const l=L(e,s),c=s.source;n.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);const u=i.get(c);if(c.version!==u.__version||!0===l){n.activeTexture(t.TEXTURE0+o);const e=Ue.getPrimaries(Ue.workingColorSpace),i=s.colorSpace===Yt?null:Ue.getPrimaries(s.colorSpace),h=s.colorSpace===Yt||e===i?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,s.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,s.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,h);const d=s.isCompressedTexture||s.image[0].isCompressedTexture,p=s.image[0]&&s.image[0].isDataTexture,f=[];for(let t=0;t<6;t++)f[t]=d||p?p?s.image[t].image:s.image[t]:m(s.image[t],!0,r.maxCubemapSize),f[t]=tt(s,f[t]);const v=f[0],y=a.convert(s.format,s.colorSpace),S=a.convert(s.type),T=x(s.internalFormat,y,S,s.colorSpace),E=!0!==s.isVideoTexture,b=void 0===u.__version||!0===l,w=c.dataReady;let A,R=M(s,v);if(P(t.TEXTURE_CUBE_MAP,s),d){E&&b&&n.texStorage2D(t.TEXTURE_CUBE_MAP,R,T,v.width,v.height);for(let e=0;e<6;e++){A=f[e].mipmaps;for(let i=0;i<A.length;i++){const r=A[i];s.format!==rt?null!==y?E?w&&n.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,y,r.data):n.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,T,r.width,r.height,0,r.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):E?w&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,0,0,r.width,r.height,y,S,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i,T,r.width,r.height,0,y,S,r.data)}}}else{if(A=s.mipmaps,E&&b){A.length>0&&R++;const e=et(f[0]);n.texStorage2D(t.TEXTURE_CUBE_MAP,R,T,e.width,e.height)}for(let e=0;e<6;e++)if(p){E?w&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,f[e].width,f[e].height,y,S,f[e].data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,T,f[e].width,f[e].height,0,y,S,f[e].data);for(let i=0;i<A.length;i++){const r=A[i].image[e].image;E?w&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,r.width,r.height,y,S,r.data):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,T,r.width,r.height,0,y,S,r.data)}}else{E?w&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,y,S,f[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,T,y,S,f[e]);for(let i=0;i<A.length;i++){const r=A[i];E?w&&n.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,0,0,y,S,r.image[e]):n.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,i+1,T,y,S,r.image[e])}}}g(s)&&_(t.TEXTURE_CUBE_MAP),u.__version=c.version,s.onUpdate&&s.onUpdate(s)}e.__version=s.version}(o,e,s):n.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture,t.TEXTURE0+s)},this.rebindTextures=function(e,n,r){const a=i.get(e);void 0!==n&&U(a.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&O(e)},this.setupRenderTarget=function(e){const r=e.texture,o=i.get(e),l=i.get(r);e.addEventListener("dispose",T);const c=e.textures,u=!0===e.isWebGLCubeRenderTarget,h=c.length>1;if(h||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=r.version,s.memory.textures++),u){o.__webglFramebuffer=[];for(let e=0;e<6;e++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[e]=[];for(let n=0;n<r.mipmaps.length;n++)o.__webglFramebuffer[e][n]=t.createFramebuffer()}else o.__webglFramebuffer[e]=t.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let e=0;e<r.mipmaps.length;e++)o.__webglFramebuffer[e]=t.createFramebuffer()}else o.__webglFramebuffer=t.createFramebuffer();if(h)for(let e=0,n=c.length;e<n;e++){const n=i.get(c[e]);void 0===n.__webglTexture&&(n.__webglTexture=t.createTexture(),s.memory.textures++)}if(e.samples>0&&!1===Q(e)){o.__webglMultisampledFramebuffer=t.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(t.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n<c.length;n++){const i=c[n];o.__webglColorRenderbuffer[n]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,o.__webglColorRenderbuffer[n]);const r=a.convert(i.format,i.colorSpace),s=a.convert(i.type),l=x(i.internalFormat,r,s,i.colorSpace,!0===e.isXRRenderTarget),u=Z(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,u,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+n,t.RENDERBUFFER,o.__webglColorRenderbuffer[n])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(o.__webglDepthRenderbuffer=t.createRenderbuffer(),I(o.__webglDepthRenderbuffer,e,!0)),n.bindFramebuffer(t.FRAMEBUFFER,null)}}if(u){n.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),P(t.TEXTURE_CUBE_MAP,r);for(let n=0;n<6;n++)if(r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)U(o.__webglFramebuffer[n][i],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,i);else U(o.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+n,0);g(r)&&_(t.TEXTURE_CUBE_MAP),n.unbindTexture()}else if(h){for(let r=0,a=c.length;r<a;r++){const a=c[r],s=i.get(a);n.bindTexture(t.TEXTURE_2D,s.__webglTexture),P(t.TEXTURE_2D,a),U(o.__webglFramebuffer,e,a,t.COLOR_ATTACHMENT0+r,t.TEXTURE_2D,0),g(a)&&_(t.TEXTURE_2D)}n.unbindTexture()}else{let i=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(i=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),n.bindTexture(i,l.__webglTexture),P(i,r),r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)U(o.__webglFramebuffer[n],e,r,t.COLOR_ATTACHMENT0,i,n);else U(o.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0,i,0);g(r)&&_(i),n.unbindTexture()}e.depthBuffer&&O(e)},this.updateRenderTargetMipmap=function(t){const e=t.textures;for(let r=0,a=e.length;r<a;r++){const a=e[r];if(g(a)){const e=v(t),r=i.get(a).__webglTexture;n.bindTexture(e,r),_(e),n.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===Q(e)){const r=e.textures,a=e.width,s=e.height;let o=t.COLOR_BUFFER_BIT;const c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,u=i.get(e),h=r.length>1;if(h)for(let e=0;e<r.length;e++)n.bindFramebuffer(t.FRAMEBUFFER,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),n.bindFramebuffer(t.FRAMEBUFFER,u.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);n.bindFramebuffer(t.READ_FRAMEBUFFER,u.__webglMultisampledFramebuffer);const d=e.texture.mipmaps;d&&d.length>0?n.bindFramebuffer(t.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(t.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n<r.length;n++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(o|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(o|=t.STENCIL_BUFFER_BIT)),h){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,u.__webglColorRenderbuffer[n]);const e=i.get(r[n]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,a,s,0,0,a,s,o,t.NEAREST),!0===l&&(q.length=0,Y.length=0,q.push(t.COLOR_ATTACHMENT0+n),e.depthBuffer&&!1===e.resolveDepthBuffer&&(q.push(c),Y.push(c),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,Y)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,q))}if(n.bindFramebuffer(t.READ_FRAMEBUFFER,null),n.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),h)for(let e=0;e<r.length;e++){n.bindFramebuffer(t.FRAMEBUFFER,u.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,u.__webglColorRenderbuffer[e]);const a=i.get(r[e]).__webglTexture;n.bindFramebuffer(t.FRAMEBUFFER,u.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,a,0)}n.bindFramebuffer(t.DRAW_FRAMEBUFFER,u.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&l){const n=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[n])}},this.setupDepthRenderbuffer=O,this.setupFrameBufferTexture=U,this.useMultisampledRTT=Q}function Uo(t,e){return{convert:function(n,i=""){let r;const a=Ue.getTransfer(i);if(n===j)return t.UNSIGNED_BYTE;if(n===tt)return t.UNSIGNED_SHORT_4_4_4_4;if(n===et)return t.UNSIGNED_SHORT_5_5_5_1;if(n===it)return t.UNSIGNED_INT_5_9_9_9_REV;if(n===q)return t.BYTE;if(n===Y)return t.SHORT;if(n===K)return t.UNSIGNED_SHORT;if(n===Z)return t.INT;if(n===J)return t.UNSIGNED_INT;if(n===$)return t.FLOAT;if(n===Q)return t.HALF_FLOAT;if(1021===n)return t.ALPHA;if(1022===n)return t.RGB;if(n===rt)return t.RGBA;if(n===at)return t.DEPTH_COMPONENT;if(n===st)return t.DEPTH_STENCIL;if(n===ot)return t.RED;if(n===lt)return t.RED_INTEGER;if(1030===n)return t.RG;if(n===ct)return t.RG_INTEGER;if(n===ut)return t.RGBA_INTEGER;if(n===ht||n===dt||n===pt||n===ft)if(a===$t){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(n===ht)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===dt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===pt)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===ft)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(n===ht)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===dt)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===pt)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===ft)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===mt||n===gt||n===_t||n===vt){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(n===mt)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===gt)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===_t)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===vt)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===xt||n===yt||n===Mt){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(n===xt||n===yt)return a===$t?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(n===Mt)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC}if(n===St||n===Tt||n===Et||n===bt||n===wt||n===At||n===Rt||n===Ct||n===Pt||n===Lt||n===Dt||n===Ut||n===It||n===Nt){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(n===St)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Tt)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Et)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===bt)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===wt)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===At)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Rt)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Ct)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Pt)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Lt)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Dt)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===Ut)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===It)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Nt)return a===$t?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Ot||n===Ft||n===Bt){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(n===Ot)return a===$t?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===Ft)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Bt)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===n||n===zt||n===Vt||n===Ht){if(r=e.get("EXT_texture_compression_rgtc"),null===r)return null;if(n===Ot)return r.COMPRESSED_RED_RGTC1_EXT;if(n===zt)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Vt)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Ht)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===nt?t.UNSIGNED_INT_24_8:void 0!==t[n]?t[n]:null}}}class Io{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,n){if(null===this.texture){const i=new ke;t.properties.get(i).__webglTexture=e.texture,e.depthNear===n.depthNear&&e.depthFar===n.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=i}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,n=new nr({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Ki(new Er(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class No extends de{constructor(t,e){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=1,l=null,c=null,u=null,h=null,d=null,p=null;const f=new Io,m=e.getContextAttributes();let g=null,_=null;const v=[],x=[],y=new Se;let M=null;const S=new or;S.viewport=new Ge;const T=new or;T.viewport=new Ge;const E=[S,T],b=new Yr;let w=null,A=null;function R(t){const e=x.indexOf(t.inputSource);if(-1===e)return;const n=v[e];void 0!==n&&(n.update(t.inputSource,t.frame,l||a),n.dispatchEvent({type:t.type,data:t.inputSource}))}function C(){i.removeEventListener("select",R),i.removeEventListener("selectstart",R),i.removeEventListener("selectend",R),i.removeEventListener("squeeze",R),i.removeEventListener("squeezestart",R),i.removeEventListener("squeezeend",R),i.removeEventListener("end",C),i.removeEventListener("inputsourceschange",P);for(let t=0;t<v.length;t++){const e=x[t];null!==e&&(x[t]=null,v[t].disconnect(e))}w=null,A=null,f.reset(),t.setRenderTarget(g),d=null,h=null,u=null,i=null,_=null,N.stop(),n.isPresenting=!1,t.setPixelRatio(M),t.setSize(y.width,y.height,!1),n.dispatchEvent({type:"sessionend"})}function P(t){for(let e=0;e<t.removed.length;e++){const n=t.removed[e],i=x.indexOf(n);i>=0&&(x[i]=null,v[i].disconnect(n))}for(let e=0;e<t.added.length;e++){const n=t.added[e];let i=x.indexOf(n);if(-1===i){for(let t=0;t<v.length;t++){if(t>=x.length){x.push(n),i=t;break}if(null===x[t]){x[t]=n,i=t;break}}if(-1===i)break}const r=v[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=v[t];return void 0===e&&(e=new fr,v[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=v[t];return void 0===e&&(e=new fr,v[t]=e),e.getGripSpace()},this.getHand=function(t){let e=v[t];return void 0===e&&(e=new fr,v[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){s=t,!0===n.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(c){if(i=c,null!==i){g=t.getRenderTarget(),i.addEventListener("select",R),i.addEventListener("selectstart",R),i.addEventListener("selectend",R),i.addEventListener("squeeze",R),i.addEventListener("squeezestart",R),i.addEventListener("squeezeend",R),i.addEventListener("end",C),i.addEventListener("inputsourceschange",P),!0!==m.xrCompatible&&await e.makeXRCompatible(),M=t.getPixelRatio(),t.getSize(y);if("undefined"!=typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,a=null,s=null;m.depth&&(s=m.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,n=m.stencil?st:at,a=m.stencil?nt:J);const o={colorFormat:e.RGBA8,depthFormat:s,scaleFactor:r};u=new XRWebGLBinding(i,e),h=u.createProjectionLayer(o),i.updateRenderState({layers:[h]}),t.setPixelRatio(1),t.setSize(h.textureWidth,h.textureHeight,!1),_=new Xe(h.textureWidth,h.textureHeight,{format:rt,type:j,depthTexture:new Tr(h.textureWidth,h.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:m.stencil,colorSpace:t.outputColorSpace,samples:m.antialias?4:0,resolveDepthBuffer:!1===h.ignoreDepthValues,resolveStencilBuffer:!1===h.ignoreDepthValues})}else{const n={antialias:m.antialias,alpha:!0,depth:m.depth,stencil:m.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,e,n),i.updateRenderState({baseLayer:d}),t.setPixelRatio(1),t.setSize(d.framebufferWidth,d.framebufferHeight,!1),_=new Xe(d.framebufferWidth,d.framebufferHeight,{format:rt,type:j,colorSpace:t.outputColorSpace,stencilBuffer:m.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}_.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),N.setContext(i),N.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return f.getDepthTexture()};const L=new Ke,D=new Ke;function U(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===i)return;let e=t.near,n=t.far;null!==f.texture&&(f.depthNear>0&&(e=f.depthNear),f.depthFar>0&&(n=f.depthFar)),b.near=T.near=S.near=e,b.far=T.far=S.far=n,w===b.near&&A===b.far||(i.updateRenderState({depthNear:b.near,depthFar:b.far}),w=b.near,A=b.far),S.layers.mask=2|t.layers.mask,T.layers.mask=4|t.layers.mask,b.layers.mask=S.layers.mask|T.layers.mask;const r=t.parent,a=b.cameras;U(b,r);for(let t=0;t<a.length;t++)U(a[t],r);2===a.length?function(t,e,n){L.setFromMatrixPosition(e.matrixWorld),D.setFromMatrixPosition(n.matrixWorld);const i=L.distanceTo(D),r=e.projectionMatrix.elements,a=n.projectionMatrix.elements,s=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=s*u,p=s*h,f=i/(-u+h),m=f*-u;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(m),t.translateZ(f),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===r[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const e=s+f,n=o+f,r=d-m,a=p+(i-m),u=l*o/n*e,h=c*o/n*e;t.projectionMatrix.makePerspective(r,a,u,h,e,n),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}(b,S,T):b.projectionMatrix.copy(S.projectionMatrix),function(t,e,n){null===n?t.matrix.copy(e.matrixWorld):(t.matrix.copy(n.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld));t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*me*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,b,r)},this.getCamera=function(){return b},this.getFoveation=function(){if(null!==h||null!==d)return o},this.setFoveation=function(t){o=t,null!==h&&(h.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==f.texture},this.getDepthSensingMesh=function(){return f.getMesh(b)};let I=null;const N=new ia;N.setAnimationLoop((function(e,r){if(c=r.getViewerPose(l||a),p=r,null!==c){const e=c.views;null!==d&&(t.setRenderTargetFramebuffer(_,d.framebuffer),t.setRenderTarget(_));let n=!1;e.length!==b.cameras.length&&(b.cameras.length=0,n=!0);for(let i=0;i<e.length;i++){const r=e[i];let a=null;if(null!==d)a=d.getViewport(r);else{const e=u.getViewSubImage(h,r);a=e.viewport,0===i&&(t.setRenderTargetTextures(_,e.colorTexture,e.depthStencilTexture),t.setRenderTarget(_))}let s=E[i];void 0===s&&(s=new or,s.layers.enable(i),s.viewport=new Ge,E[i]=s),s.matrix.fromArray(r.transform.matrix),s.matrix.decompose(s.position,s.quaternion,s.scale),s.projectionMatrix.fromArray(r.projectionMatrix),s.projectionMatrixInverse.copy(s.projectionMatrix).invert(),s.viewport.set(a.x,a.y,a.width,a.height),0===i&&(b.matrix.copy(s.matrix),b.matrix.decompose(b.position,b.quaternion,b.scale)),!0===n&&b.cameras.push(s)}const r=i.enabledFeatures;if(r&&r.includes("depth-sensing")&&"gpu-optimized"==i.depthUsage&&u){const n=u.getDepthInformation(e[0]);n&&n.isValid&&n.texture&&f.init(t,n,i.renderState)}}for(let t=0;t<v.length;t++){const e=x[t],n=v[t];null!==e&&void 0!==n&&n.update(e,r,l||a)}I&&I(e,r),r.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:r}),p=null})),this.setAnimationLoop=function(t){I=t},this.dispose=function(){}}}const Oo=new On,Fo=new wn;function Bo(t,e){function n(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function i(t,i){t.opacity.value=i.opacity,i.color&&t.diffuse.value.copy(i.color),i.emissive&&t.emissive.value.copy(i.emissive).multiplyScalar(i.emissiveIntensity),i.map&&(t.map.value=i.map,n(i.map,t.mapTransform)),i.alphaMap&&(t.alphaMap.value=i.alphaMap,n(i.alphaMap,t.alphaMapTransform)),i.bumpMap&&(t.bumpMap.value=i.bumpMap,n(i.bumpMap,t.bumpMapTransform),t.bumpScale.value=i.bumpScale,1===i.side&&(t.bumpScale.value*=-1)),i.normalMap&&(t.normalMap.value=i.normalMap,n(i.normalMap,t.normalMapTransform),t.normalScale.value.copy(i.normalScale),1===i.side&&t.normalScale.value.negate()),i.displacementMap&&(t.displacementMap.value=i.displacementMap,n(i.displacementMap,t.displacementMapTransform),t.displacementScale.value=i.displacementScale,t.displacementBias.value=i.displacementBias),i.emissiveMap&&(t.emissiveMap.value=i.emissiveMap,n(i.emissiveMap,t.emissiveMapTransform)),i.specularMap&&(t.specularMap.value=i.specularMap,n(i.specularMap,t.specularMapTransform)),i.alphaTest>0&&(t.alphaTest.value=i.alphaTest);const r=e.get(i),a=r.envMap,s=r.envMapRotation;a&&(t.envMap.value=a,Oo.copy(s),Oo.x*=-1,Oo.y*=-1,Oo.z*=-1,a.isCubeTexture&&!1===a.isRenderTargetTexture&&(Oo.y*=-1,Oo.z*=-1),t.envMapRotation.value.setFromMatrix4(Fo.makeRotationFromEuler(Oo)),t.flipEnvMap.value=a.isCubeTexture&&!1===a.isRenderTargetTexture?-1:1,t.reflectivity.value=i.reflectivity,t.ior.value=i.ior,t.refractionRatio.value=i.refractionRatio),i.lightMap&&(t.lightMap.value=i.lightMap,t.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,t.lightMapTransform)),i.aoMap&&(t.aoMap.value=i.aoMap,t.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,n){n.color.getRGB(e.fogColor.value,tr(t)),n.isFog?(e.fogNear.value=n.near,e.fogFar.value=n.far):n.isFogExp2&&(e.fogDensity.value=n.density)},refreshMaterialUniforms:function(t,r,a,s,o){r.isMeshBasicMaterial||r.isMeshLambertMaterial?i(t,r):r.isMeshToonMaterial?(i(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(i(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r)):r.isMeshStandardMaterial?(i(t,r),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,n(e.metalnessMap,t.metalnessMapTransform));t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,n(e.roughnessMap,t.roughnessMapTransform));e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,i){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,n(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,n(e.sheenRoughnessMap,t.sheenRoughnessMapTransform)));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,n(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,n(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,n(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&t.clearcoatNormalScale.value.negate()));e.dispersion>0&&(t.dispersion.value=e.dispersion);e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,n(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,n(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform)));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=i.texture,t.transmissionSamplerSize.value.set(i.width,i.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,n(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,n(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,n(e.anisotropyMap,t.anisotropyMapTransform)));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,n(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,n(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,o)):r.isMeshMatcapMaterial?(i(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?i(t,r):r.isMeshDistanceMaterial?(i(t,r),function(t,n){const i=e.get(n).light;t.referencePosition.value.setFromMatrixPosition(i.matrixWorld),t.nearDistance.value=i.shadow.camera.near,t.farDistance.value=i.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?i(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,i,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*i,t.scale.value=.5*r,e.map&&(t.map.value=e.map,n(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,a,s):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,n(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,n(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function zo(t,e,n,i){let r={},a={},s=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e,n,i){const r=t.value,a=e+"_"+n;if(void 0===i[a])return i[a]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const t=i[a];if("number"==typeof r||"boolean"==typeof r){if(t!==r)return i[a]=r,!0}else if(!1===t.equals(r))return t.copy(r),!0}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",t),e}function u(e){const n=e.target;n.removeEventListener("dispose",u);const i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),t.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(t,e){const n=e.program;i.uniformBlockBinding(t,n)},update:function(n,h){let d=r[n.id];void 0===d&&(!function(t){const e=t.uniforms;let n=0;const i=16;for(let t=0,r=e.length;t<r;t++){const r=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=r.length;t<e;t++){const e=r[t],a=Array.isArray(e.value)?e.value:[e.value];for(let t=0,r=a.length;t<r;t++){const r=c(a[t]),s=n%i,o=s%r.boundary,l=s+o;n+=o,0!==l&&i-l<r.storage&&(n+=i-l),e.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=n,n+=r.storage}}}const r=n%i;r>0&&(n+=i-r);t.__size=n,t.__cache={}}(n),d=function(e){const n=function(){for(let t=0;t<o;t++)if(-1===s.indexOf(t))return s.push(t),t;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=n;const i=t.createBuffer(),r=e.__size,a=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,i),t.bufferData(t.UNIFORM_BUFFER,r,a),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,n,i),i}(n),r[n.id]=d,n.addEventListener("dispose",u));const p=h.program;i.updateUBOMapping(n,p);const f=e.render.frame;a[n.id]!==f&&(!function(e){const n=r[e.id],i=e.uniforms,a=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,n);for(let e=0,n=i.length;e<n;e++){const n=Array.isArray(i[e])?i[e]:[i[e]];for(let i=0,r=n.length;i<r;i++){const r=n[i];if(!0===l(r,e,i,a)){const e=r.__offset,n=Array.isArray(r.value)?r.value:[r.value];let i=0;for(let a=0;a<n.length;a++){const s=n[a],o=c(s);"number"==typeof s||"boolean"==typeof s?(r.__data[0]=s,t.bufferSubData(t.UNIFORM_BUFFER,e+i,r.__data)):s.isMatrix3?(r.__data[0]=s.elements[0],r.__data[1]=s.elements[1],r.__data[2]=s.elements[2],r.__data[3]=0,r.__data[4]=s.elements[3],r.__data[5]=s.elements[4],r.__data[6]=s.elements[5],r.__data[7]=0,r.__data[8]=s.elements[6],r.__data[9]=s.elements[7],r.__data[10]=s.elements[8],r.__data[11]=0):(s.toArray(r.__data,i),i+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,r.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(n),a[n.id]=f)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);s=[],r={},a={}}}}class Vo{constructor(t={}){const{canvas:e=Ae(),context:i=null,depth:r=!0,stencil:a=!1,alpha:s=!1,antialias:o=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1,reverseDepthBuffer:d=!1}=t;let p;if(this.isWebGLRenderer=!0,null!==i){if("undefined"!=typeof WebGLRenderingContext&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=s;const f=new Uint32Array(4),m=new Int32Array(4);let g=null,_=null;const v=[],x=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const y=this;let M=!1;this._outputColorSpace=Kt;let S=0,T=0,E=null,b=-1,w=null;const A=new Ge,R=new Ge;let C=null;const P=new vi(0);let L=0,D=e.width,U=e.height,I=1,N=null,O=null;const F=new Ge(0,0,D,U),B=new Ge(0,0,D,U);let z=!1;const V=new Sr;let H=!1,k=!1;const G=new wn,W=new wn,q=new Ke,Y=new Ge,Z={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let $=!1;function it(){return null===E?I:1}let rt,at,st,ot,ht,dt,pt,ft,mt,gt,_t,vt,xt,yt,Mt,St,Tt,Et,bt,wt,At,Rt,Ct,Pt,Lt=i;function Dt(t,n){return e.getContext(t,n)}try{const t={alpha:!0,depth:r,stencil:a,antialias:o,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${n}`),e.addEventListener("webglcontextlost",Nt,!1),e.addEventListener("webglcontextrestored",Ot,!1),e.addEventListener("webglcontextcreationerror",Ft,!1),null===Lt){const e="webgl2";if(Lt=Dt(e,t),null===Lt)throw Dt(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw console.error("THREE.WebGLRenderer: "+t.message),t}function Ut(){rt=new Oa(Lt),rt.init(),Rt=new Uo(Lt,rt),at=new fa(Lt,rt,t,Rt),st=new Lo(Lt,rt),at.reverseDepthBuffer&&d&&st.buffers.depth.setReversed(!0),ot=new za(Lt),ht=new vo,dt=new Do(Lt,rt,st,ht,at,Rt,ot),pt=new ga(y),ft=new Na(y),mt=new ra(Lt),Ct=new da(Lt,mt),gt=new Fa(Lt,mt,ot,Ct),_t=new Ha(Lt,gt,mt,ot),bt=new Va(Lt,at,dt),St=new ma(ht),vt=new _o(y,pt,ft,rt,at,Ct,St),xt=new Bo(y,ht),yt=new So,Mt=new Ro(rt),Et=new ha(y,pt,ft,st,_t,p,l),Tt=new Co(y,_t,at),Pt=new zo(Lt,ot,at,st),wt=new pa(Lt,rt,ot),At=new Ba(Lt,rt,ot),ot.programs=vt.programs,y.capabilities=at,y.extensions=rt,y.properties=ht,y.renderLists=yt,y.shadowMap=Tt,y.state=st,y.info=ot}Ut();const It=new No(y,Lt);function Nt(t){t.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),M=!0}function Ot(){console.log("THREE.WebGLRenderer: Context Restored."),M=!1;const t=ot.autoReset,e=Tt.enabled,n=Tt.autoUpdate,i=Tt.needsUpdate,r=Tt.type;Ut(),ot.autoReset=t,Tt.enabled=e,Tt.autoUpdate=n,Tt.needsUpdate=i,Tt.type=r}function Ft(t){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Bt(t){const e=t.target;e.removeEventListener("dispose",Bt),function(t){(function(t){const e=ht.get(t).programs;void 0!==e&&(e.forEach((function(t){vt.releaseProgram(t)})),t.isShaderMaterial&&vt.releaseShaderCache(t))})(t),ht.remove(t)}(e)}function zt(t,e,n){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=1,t.needsUpdate=!0,Jt(t,e,n),t.side=0,t.needsUpdate=!0,Jt(t,e,n),t.side=2):Jt(t,e,n)}this.xr=It,this.getContext=function(){return Lt},this.getContextAttributes=function(){return Lt.getContextAttributes()},this.forceContextLoss=function(){const t=rt.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=rt.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return I},this.setPixelRatio=function(t){void 0!==t&&(I=t,this.setSize(D,U,!1))},this.getSize=function(t){return t.set(D,U)},this.setSize=function(t,n,i=!0){It.isPresenting?console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(D=t,U=n,e.width=Math.floor(t*I),e.height=Math.floor(n*I),!0===i&&(e.style.width=t+"px",e.style.height=n+"px"),this.setViewport(0,0,t,n))},this.getDrawingBufferSize=function(t){return t.set(D*I,U*I).floor()},this.setDrawingBufferSize=function(t,n,i){D=t,U=n,I=i,e.width=Math.floor(t*i),e.height=Math.floor(n*i),this.setViewport(0,0,t,n)},this.getCurrentViewport=function(t){return t.copy(A)},this.getViewport=function(t){return t.copy(F)},this.setViewport=function(t,e,n,i){t.isVector4?F.set(t.x,t.y,t.z,t.w):F.set(t,e,n,i),st.viewport(A.copy(F).multiplyScalar(I).round())},this.getScissor=function(t){return t.copy(B)},this.setScissor=function(t,e,n,i){t.isVector4?B.set(t.x,t.y,t.z,t.w):B.set(t,e,n,i),st.scissor(R.copy(B).multiplyScalar(I).round())},this.getScissorTest=function(){return z},this.setScissorTest=function(t){st.setScissorTest(z=t)},this.setOpaqueSort=function(t){N=t},this.setTransparentSort=function(t){O=t},this.getClearColor=function(t){return t.copy(Et.getClearColor())},this.setClearColor=function(){Et.setClearColor(...arguments)},this.getClearAlpha=function(){return Et.getClearAlpha()},this.setClearAlpha=function(){Et.setClearAlpha(...arguments)},this.clear=function(t=!0,e=!0,n=!0){let i=0;if(t){let t=!1;if(null!==E){const e=E.texture.format;t=e===ut||e===ct||e===lt}if(t){const t=E.texture.type,e=t===j||t===J||t===K||t===nt||t===tt||t===et,n=Et.getClearColor(),i=Et.getClearAlpha(),r=n.r,a=n.g,s=n.b;e?(f[0]=r,f[1]=a,f[2]=s,f[3]=i,Lt.clearBufferuiv(Lt.COLOR,0,f)):(m[0]=r,m[1]=a,m[2]=s,m[3]=i,Lt.clearBufferiv(Lt.COLOR,0,m))}else i|=Lt.COLOR_BUFFER_BIT}e&&(i|=Lt.DEPTH_BUFFER_BIT),n&&(i|=Lt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Lt.clear(i)},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(){e.removeEventListener("webglcontextlost",Nt,!1),e.removeEventListener("webglcontextrestored",Ot,!1),e.removeEventListener("webglcontextcreationerror",Ft,!1),Et.dispose(),yt.dispose(),Mt.dispose(),ht.dispose(),pt.dispose(),ft.dispose(),_t.dispose(),Ct.dispose(),Pt.dispose(),vt.dispose(),It.dispose(),It.removeEventListener("sessionstart",Ht),It.removeEventListener("sessionend",kt),Gt.stop()},this.renderBufferDirect=function(t,e,n,i,r,a){null===e&&(e=Z);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=function(t,e,n,i,r){!0!==e.isScene&&(e=Z);dt.resetTextureUnits();const a=e.fog,s=i.isMeshStandardMaterial?e.environment:null,o=null===E?y.outputColorSpace:!0===E.isXRRenderTarget?E.texture.colorSpace:Zt,l=(i.isMeshStandardMaterial?ft:pt).get(i.envMap||s),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,u=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),h=!!n.morphAttributes.position,d=!!n.morphAttributes.normal,p=!!n.morphAttributes.color;let f=0;i.toneMapped&&(null!==E&&!0!==E.isXRRenderTarget||(f=y.toneMapping));const m=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,g=void 0!==m?m.length:0,v=ht.get(i),x=_.state.lights;if(!0===H&&(!0===k||t!==w)){const e=t===w&&i.id===b;St.setState(i,t,e)}let M=!1;i.version===v.__version?v.needsLights&&v.lightsStateVersion!==x.state.version||v.outputColorSpace!==o||r.isBatchedMesh&&!1===v.batching?M=!0:r.isBatchedMesh||!0!==v.batching?r.isBatchedMesh&&!0===v.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===v.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===v.instancing?M=!0:r.isInstancedMesh||!0!==v.instancing?r.isSkinnedMesh&&!1===v.skinning?M=!0:r.isSkinnedMesh||!0!==v.skinning?r.isInstancedMesh&&!0===v.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===v.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===v.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===v.instancingMorph&&null!==r.morphTexture||v.envMap!==l||!0===i.fog&&v.fog!==a?M=!0:void 0===v.numClippingPlanes||v.numClippingPlanes===St.numPlanes&&v.numIntersection===St.numIntersection?(v.vertexAlphas!==c||v.vertexTangents!==u||v.morphTargets!==h||v.morphNormals!==d||v.morphColors!==p||v.toneMapping!==f||v.morphTargetsCount!==g)&&(M=!0):M=!0:M=!0:M=!0:M=!0:(M=!0,v.__version=i.version);let S=v.currentProgram;!0===M&&(S=Jt(i,e,r));let T=!1,A=!1,R=!1;const C=S.getUniforms(),P=v.uniforms;st.useProgram(S.program)&&(T=!0,A=!0,R=!0);i.id!==b&&(b=i.id,A=!0);if(T||w!==t){st.buffers.depth.getReversed()?(G.copy(t.projectionMatrix),function(t){const e=t.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}(G),function(t){const e=t.elements;-1===e[11]?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=1-e[14])}(G),C.setValue(Lt,"projectionMatrix",G)):C.setValue(Lt,"projectionMatrix",t.projectionMatrix),C.setValue(Lt,"viewMatrix",t.matrixWorldInverse);const e=C.map.cameraPosition;void 0!==e&&e.setValue(Lt,q.setFromMatrixPosition(t.matrixWorld)),at.logarithmicDepthBuffer&&C.setValue(Lt,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(i.isMeshPhongMaterial||i.isMeshToonMaterial||i.isMeshLambertMaterial||i.isMeshBasicMaterial||i.isMeshStandardMaterial||i.isShaderMaterial)&&C.setValue(Lt,"isOrthographic",!0===t.isOrthographicCamera),w!==t&&(w=t,A=!0,R=!0)}if(r.isSkinnedMesh){C.setOptional(Lt,r,"bindMatrix"),C.setOptional(Lt,r,"bindMatrixInverse");const t=r.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),C.setValue(Lt,"boneTexture",t.boneTexture,dt))}r.isBatchedMesh&&(C.setOptional(Lt,r,"batchingTexture"),C.setValue(Lt,"batchingTexture",r._matricesTexture,dt),C.setOptional(Lt,r,"batchingIdTexture"),C.setValue(Lt,"batchingIdTexture",r._indirectTexture,dt),C.setOptional(Lt,r,"batchingColorTexture"),null!==r._colorsTexture&&C.setValue(Lt,"batchingColorTexture",r._colorsTexture,dt));const L=n.morphAttributes;void 0===L.position&&void 0===L.normal&&void 0===L.color||bt.update(r,n,S);(A||v.receiveShadow!==r.receiveShadow)&&(v.receiveShadow=r.receiveShadow,C.setValue(Lt,"receiveShadow",r.receiveShadow));i.isMeshGouraudMaterial&&null!==i.envMap&&(P.envMap.value=l,P.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1);i.isMeshStandardMaterial&&null===i.envMap&&null!==e.environment&&(P.envMapIntensity.value=e.environmentIntensity);A&&(C.setValue(Lt,"toneMappingExposure",y.toneMappingExposure),v.needsLights&&(N=R,(D=P).ambientLightColor.needsUpdate=N,D.lightProbe.needsUpdate=N,D.directionalLights.needsUpdate=N,D.directionalLightShadows.needsUpdate=N,D.pointLights.needsUpdate=N,D.pointLightShadows.needsUpdate=N,D.spotLights.needsUpdate=N,D.spotLightShadows.needsUpdate=N,D.rectAreaLights.needsUpdate=N,D.hemisphereLights.needsUpdate=N),a&&!0===i.fog&&xt.refreshFogUniforms(P,a),xt.refreshMaterialUniforms(P,i,I,U,_.state.transmissionRenderTarget[t.id]),js.upload(Lt,$t(v),P,dt));var D,N;i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(js.upload(Lt,$t(v),P,dt),i.uniformsNeedUpdate=!1);i.isSpriteMaterial&&C.setValue(Lt,"center",r.center);if(C.setValue(Lt,"modelViewMatrix",r.modelViewMatrix),C.setValue(Lt,"normalMatrix",r.normalMatrix),C.setValue(Lt,"modelMatrix",r.matrixWorld),i.isShaderMaterial||i.isRawShaderMaterial){const t=i.uniformsGroups;for(let e=0,n=t.length;e<n;e++){const n=t[e];Pt.update(n,S),Pt.bind(n,S)}}return S}(t,e,n,i,r);st.setMaterial(i,s);let l=n.index,c=1;if(!0===i.wireframe){if(l=gt.getWireframeAttribute(n),void 0===l)return;c=2}const u=n.drawRange,h=n.attributes.position;let d=u.start*c,p=(u.start+u.count)*c;null!==a&&(d=Math.max(d,a.start*c),p=Math.min(p,(a.start+a.count)*c)),null!==l?(d=Math.max(d,0),p=Math.min(p,l.count)):null!=h&&(d=Math.max(d,0),p=Math.min(p,h.count));const f=p-d;if(f<0||f===1/0)return;let m;Ct.setup(r,i,o,n,l);let g=wt;if(null!==l&&(m=mt.get(l),g=At,g.setIndex(m)),r.isMesh)!0===i.wireframe?(st.setLineWidth(i.wireframeLinewidth*it()),g.setMode(Lt.LINES)):g.setMode(Lt.TRIANGLES);else if(r.isLine){let t=i.linewidth;void 0===t&&(t=1),st.setLineWidth(t*it()),r.isLineSegments?g.setMode(Lt.LINES):r.isLineLoop?g.setMode(Lt.LINE_LOOP):g.setMode(Lt.LINE_STRIP)}else r.isPoints?g.setMode(Lt.POINTS):r.isSprite&&g.setMode(Lt.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)Ce("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),g.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(rt.get("WEBGL_multi_draw"))g.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const t=r._multiDrawStarts,e=r._multiDrawCounts,n=r._multiDrawCount,a=l?mt.get(l).bytesPerElement:1,s=ht.get(i).currentProgram.getUniforms();for(let i=0;i<n;i++)s.setValue(Lt,"_gl_DrawID",i),g.render(t[i]/a,e[i])}else if(r.isInstancedMesh)g.renderInstances(d,f,r.count);else if(n.isInstancedBufferGeometry){const t=void 0!==n._maxInstanceCount?n._maxInstanceCount:1/0,e=Math.min(n.instanceCount,t);g.renderInstances(d,f,e)}else g.render(d,f)},this.compile=function(t,e,n=null){null===n&&(n=t),_=Mt.get(n),_.init(e),x.push(_),n.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(_.pushLight(t),t.castShadow&&_.pushShadow(t))})),t!==n&&t.traverseVisible((function(t){t.isLight&&t.layers.test(e.layers)&&(_.pushLight(t),t.castShadow&&_.pushShadow(t))})),_.setupLights();const i=new Set;return t.traverse((function(t){if(!(t.isMesh||t.isPoints||t.isLine||t.isSprite))return;const e=t.material;if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++){const a=e[r];zt(a,n,t),i.add(a)}else zt(e,n,t),i.add(e)})),_=x.pop(),i},this.compileAsync=function(t,e,n=null){const i=this.compile(t,e,n);return new Promise((e=>{function n(){i.forEach((function(t){ht.get(t).currentProgram.isReady()&&i.delete(t)})),0!==i.size?setTimeout(n,10):e(t)}null!==rt.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)}))};let Vt=null;function Ht(){Gt.stop()}function kt(){Gt.start()}const Gt=new ia;function Wt(t,e,n,i){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)_.pushLight(t),t.castShadow&&_.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||V.intersectsSprite(t)){i&&Y.setFromMatrixPosition(t.matrixWorld).applyMatrix4(W);const e=_t.update(t),r=t.material;r.visible&&g.push(t,e,r,n,Y.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||V.intersectsObject(t))){const e=_t.update(t),r=t.material;if(i&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),Y.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),Y.copy(e.boundingSphere.center)),Y.applyMatrix4(t.matrixWorld).applyMatrix4(W)),Array.isArray(r)){const i=e.groups;for(let a=0,s=i.length;a<s;a++){const s=i[a],o=r[s.materialIndex];o&&o.visible&&g.push(t,e,o,n,Y.z,s)}}else r.visible&&g.push(t,e,r,n,Y.z,null)}const r=t.children;for(let t=0,a=r.length;t<a;t++)Wt(r[t],e,n,i)}function Xt(t,e,n,i){const r=t.opaque,a=t.transmissive,s=t.transparent;_.setupLightsView(n),!0===H&&St.setGlobalState(y.clippingPlanes,n),i&&st.viewport(A.copy(i)),r.length>0&&qt(r,e,n),a.length>0&&qt(a,e,n),s.length>0&&qt(s,e,n),st.buffers.depth.setTest(!0),st.buffers.depth.setMask(!0),st.buffers.color.setMask(!0),st.setPolygonOffset(!1)}function jt(t,e,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;void 0===_.state.transmissionRenderTarget[i.id]&&(_.state.transmissionRenderTarget[i.id]=new Xe(1,1,{generateMipmaps:!0,type:rt.has("EXT_color_buffer_half_float")||rt.has("EXT_color_buffer_float")?Q:j,minFilter:X,samples:4,stencilBuffer:a,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Ue.workingColorSpace}));const r=_.state.transmissionRenderTarget[i.id],s=i.viewport||A;r.setSize(s.z*y.transmissionResolutionScale,s.w*y.transmissionResolutionScale);const o=y.getRenderTarget();y.setRenderTarget(r),y.getClearColor(P),L=y.getClearAlpha(),L<1&&y.setClearColor(16777215,.5),y.clear(),$&&Et.render(n);const l=y.toneMapping;y.toneMapping=0;const c=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),_.setupLightsView(i),!0===H&&St.setGlobalState(y.clippingPlanes,i),qt(t,n,i),dt.updateMultisampleRenderTarget(r),dt.updateRenderTargetMipmap(r),!1===rt.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let r=0,a=e.length;r<a;r++){const a=e[r],s=a.object,o=a.geometry,l=a.material,c=a.group;if(2===l.side&&s.layers.test(i.layers)){const e=l.side;l.side=1,l.needsUpdate=!0,Yt(s,n,i,o,l,c),l.side=e,l.needsUpdate=!0,t=!0}}!0===t&&(dt.updateMultisampleRenderTarget(r),dt.updateRenderTargetMipmap(r))}y.setRenderTarget(o),y.setClearColor(P,L),void 0!==c&&(i.viewport=c),y.toneMapping=l}function qt(t,e,n){const i=!0===e.isScene?e.overrideMaterial:null;for(let r=0,a=t.length;r<a;r++){const a=t[r],s=a.object,o=a.geometry,l=a.group;let c=a.material;!0===c.allowOverride&&null!==i&&(c=i),s.layers.test(n.layers)&&Yt(s,e,n,o,c,l)}}function Yt(t,e,n,i,r,a){t.onBeforeRender(y,e,n,i,r,a),t.modelViewMatrix.multiplyMatrices(n.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(y,e,n,i,t,a),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,y.renderBufferDirect(n,e,i,r,t,a),r.side=0,r.needsUpdate=!0,y.renderBufferDirect(n,e,i,r,t,a),r.side=2):y.renderBufferDirect(n,e,i,r,t,a),t.onAfterRender(y,e,n,i,r,a)}function Jt(t,e,n){!0!==e.isScene&&(e=Z);const i=ht.get(t),r=_.state.lights,a=_.state.shadowsArray,s=r.state.version,o=vt.getParameters(t,r.state,a,e,n),l=vt.getProgramCacheKey(o);let c=i.programs;i.environment=t.isMeshStandardMaterial?e.environment:null,i.fog=e.fog,i.envMap=(t.isMeshStandardMaterial?ft:pt).get(t.envMap||i.environment),i.envMapRotation=null!==i.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener("dispose",Bt),c=new Map,i.programs=c);let u=c.get(l);if(void 0!==u){if(i.currentProgram===u&&i.lightsStateVersion===s)return Qt(t,o),u}else o.uniforms=vt.getUniforms(t),t.onBeforeCompile(o,y),u=vt.acquireProgram(o,l),c.set(l,u),i.uniforms=o.uniforms;const h=i.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(h.clippingPlanes=St.uniform),Qt(t,o),i.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),i.lightsStateVersion=s,i.needsLights&&(h.ambientLightColor.value=r.state.ambient,h.lightProbe.value=r.state.probe,h.directionalLights.value=r.state.directional,h.directionalLightShadows.value=r.state.directionalShadow,h.spotLights.value=r.state.spot,h.spotLightShadows.value=r.state.spotShadow,h.rectAreaLights.value=r.state.rectArea,h.ltc_1.value=r.state.rectAreaLTC1,h.ltc_2.value=r.state.rectAreaLTC2,h.pointLights.value=r.state.point,h.pointLightShadows.value=r.state.pointShadow,h.hemisphereLights.value=r.state.hemi,h.directionalShadowMap.value=r.state.directionalShadowMap,h.directionalShadowMatrix.value=r.state.directionalShadowMatrix,h.spotShadowMap.value=r.state.spotShadowMap,h.spotLightMatrix.value=r.state.spotLightMatrix,h.spotLightMap.value=r.state.spotLightMap,h.pointShadowMap.value=r.state.pointShadowMap,h.pointShadowMatrix.value=r.state.pointShadowMatrix),i.currentProgram=u,i.uniformsList=null,u}function $t(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=js.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function Qt(t,e){const n=ht.get(t);n.outputColorSpace=e.outputColorSpace,n.batching=e.batching,n.batchingColor=e.batchingColor,n.instancing=e.instancing,n.instancingColor=e.instancingColor,n.instancingMorph=e.instancingMorph,n.skinning=e.skinning,n.morphTargets=e.morphTargets,n.morphNormals=e.morphNormals,n.morphColors=e.morphColors,n.morphTargetsCount=e.morphTargetsCount,n.numClippingPlanes=e.numClippingPlanes,n.numIntersection=e.numClipIntersection,n.vertexAlphas=e.vertexAlphas,n.vertexTangents=e.vertexTangents,n.toneMapping=e.toneMapping}Gt.setAnimationLoop((function(t){Vt&&Vt(t)})),"undefined"!=typeof self&&Gt.setContext(self),this.setAnimationLoop=function(t){Vt=t,It.setAnimationLoop(t),null===t?Gt.stop():Gt.start()},It.addEventListener("sessionstart",Ht),It.addEventListener("sessionend",kt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===M)return;if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0===It.enabled&&!0===It.isPresenting&&(!0===It.cameraAutoUpdate&&It.updateCamera(e),e=It.getCamera()),!0===t.isScene&&t.onBeforeRender(y,t,e,E),_=Mt.get(t,x.length),_.init(e),x.push(_),W.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),V.setFromProjectionMatrix(W),k=this.localClippingEnabled,H=St.init(this.clippingPlanes,k),g=yt.get(t,v.length),g.init(),v.push(g),!0===It.enabled&&!0===It.isPresenting){const t=y.xr.getDepthSensingMesh();null!==t&&Wt(t,e,-1/0,y.sortObjects)}Wt(t,e,0,y.sortObjects),g.finish(),!0===y.sortObjects&&g.sort(N,O),$=!1===It.enabled||!1===It.isPresenting||!1===It.hasDepthSensing(),$&&Et.addToRenderList(g,t),this.info.render.frame++,!0===H&&St.beginShadows();const n=_.state.shadowsArray;Tt.render(n,t,e),!0===H&&St.endShadows(),!0===this.info.autoReset&&this.info.reset();const i=g.opaque,r=g.transmissive;if(_.setupLights(),e.isArrayCamera){const n=e.cameras;if(r.length>0)for(let e=0,a=n.length;e<a;e++){jt(i,r,t,n[e])}$&&Et.render(t);for(let e=0,i=n.length;e<i;e++){const i=n[e];Xt(g,t,i,i.viewport)}}else r.length>0&&jt(i,r,t,e),$&&Et.render(t),Xt(g,t,e);null!==E&&0===T&&(dt.updateMultisampleRenderTarget(E),dt.updateRenderTargetMipmap(E)),!0===t.isScene&&t.onAfterRender(y,t,e),Ct.resetDefaultState(),b=-1,w=null,x.pop(),x.length>0?(_=x[x.length-1],!0===H&&St.setGlobalState(y.clippingPlanes,_.state.camera)):_=null,v.pop(),g=v.length>0?v[v.length-1]:null},this.getActiveCubeFace=function(){return S},this.getActiveMipmapLevel=function(){return T},this.getRenderTarget=function(){return E},this.setRenderTargetTextures=function(t,e,n){const i=ht.get(t);i.__autoAllocateDepthBuffer=!1===t.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),ht.get(t.texture).__webglTexture=e,ht.get(t.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(t,e){const n=ht.get(t);n.__webglFramebuffer=e,n.__useDefaultFramebuffer=void 0===e};const te=Lt.createFramebuffer();this.setRenderTarget=function(t,e=0,n=0){E=t,S=e,T=n;let i=!0,r=null,a=!1,s=!1;if(t){const o=ht.get(t);if(void 0!==o.__useDefaultFramebuffer)st.bindFramebuffer(Lt.FRAMEBUFFER,null),i=!1;else if(void 0===o.__webglFramebuffer)dt.setupRenderTarget(t);else if(o.__hasExternalTextures)dt.rebindTextures(t,ht.get(t.texture).__webglTexture,ht.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){const e=t.depthTexture;if(o.__boundDepthTexture!==e){if(null!==e&&ht.has(e)&&(t.width!==e.image.width||t.height!==e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");dt.setupDepthRenderbuffer(t)}}const l=t.texture;(l.isData3DTexture||l.isDataArrayTexture||l.isCompressedArrayTexture)&&(s=!0);const c=ht.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(r=Array.isArray(c[e])?c[e][n]:c[e],a=!0):r=t.samples>0&&!1===dt.useMultisampledRTT(t)?ht.get(t).__webglMultisampledFramebuffer:Array.isArray(c)?c[n]:c,A.copy(t.viewport),R.copy(t.scissor),C=t.scissorTest}else A.copy(F).multiplyScalar(I).floor(),R.copy(B).multiplyScalar(I).floor(),C=z;0!==n&&(r=te);if(st.bindFramebuffer(Lt.FRAMEBUFFER,r)&&i&&st.drawBuffers(t,r),st.viewport(A),st.scissor(R),st.setScissorTest(C),a){const i=ht.get(t.texture);Lt.framebufferTexture2D(Lt.FRAMEBUFFER,Lt.COLOR_ATTACHMENT0,Lt.TEXTURE_CUBE_MAP_POSITIVE_X+e,i.__webglTexture,n)}else if(s){const i=ht.get(t.texture),r=e;Lt.framebufferTextureLayer(Lt.FRAMEBUFFER,Lt.COLOR_ATTACHMENT0,i.__webglTexture,n,r)}else if(null!==t&&0!==n){const e=ht.get(t.texture);Lt.framebufferTexture2D(Lt.FRAMEBUFFER,Lt.COLOR_ATTACHMENT0,Lt.TEXTURE_2D,e.__webglTexture,n)}b=-1},this.readRenderTargetPixels=function(t,e,n,i,r,a,s){if(!t||!t.isWebGLRenderTarget)return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ht.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){st.bindFramebuffer(Lt.FRAMEBUFFER,o);try{const s=t.texture,o=s.format,l=s.type;if(!at.textureFormatReadable(o))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!at.textureTypeReadable(l))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r&&Lt.readPixels(e,n,i,r,Rt.convert(o),Rt.convert(l),a)}finally{const t=null!==E?ht.get(E).__webglFramebuffer:null;st.bindFramebuffer(Lt.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,n,i,r,a,s){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let o=ht.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==s&&(o=o[s]),o){if(e>=0&&e<=t.width-i&&n>=0&&n<=t.height-r){st.bindFramebuffer(Lt.FRAMEBUFFER,o);const s=t.texture,l=s.format,c=s.type;if(!at.textureFormatReadable(l))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!at.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const u=Lt.createBuffer();Lt.bindBuffer(Lt.PIXEL_PACK_BUFFER,u),Lt.bufferData(Lt.PIXEL_PACK_BUFFER,a.byteLength,Lt.STREAM_READ),Lt.readPixels(e,n,i,r,Rt.convert(l),Rt.convert(c),0);const h=null!==E?ht.get(E).__webglFramebuffer:null;st.bindFramebuffer(Lt.FRAMEBUFFER,h);const d=Lt.fenceSync(Lt.SYNC_GPU_COMMANDS_COMPLETE,0);return Lt.flush(),await function(t,e,n){return new Promise((function(i,r){setTimeout((function a(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:i()}}),n)}))}(Lt,d,4),Lt.bindBuffer(Lt.PIXEL_PACK_BUFFER,u),Lt.getBufferSubData(Lt.PIXEL_PACK_BUFFER,0,a),Lt.deleteBuffer(u),Lt.deleteSync(d),a}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(t,e=null,n=0){const i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),s=null!==e?e.x:0,o=null!==e?e.y:0;dt.setTexture2D(t,0),Lt.copyTexSubImage2D(Lt.TEXTURE_2D,n,0,0,s,o,r,a),st.unbindTexture()};const ee=Lt.createFramebuffer(),ne=Lt.createFramebuffer();this.copyTextureToTexture=function(t,e,n=null,i=null,r=0,a=null){let s,o,l,c,u,h,d,p,f;null===a&&(0!==r?(Ce("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),a=r,r=0):a=0);const m=t.isCompressedTexture?t.mipmaps[a]:t.image;if(null!==n)s=n.max.x-n.min.x,o=n.max.y-n.min.y,l=n.isBox3?n.max.z-n.min.z:1,c=n.min.x,u=n.min.y,h=n.isBox3?n.min.z:0;else{const e=Math.pow(2,-r);s=Math.floor(m.width*e),o=Math.floor(m.height*e),l=t.isDataArrayTexture?m.depth:t.isData3DTexture?Math.floor(m.depth*e):1,c=0,u=0,h=0}null!==i?(d=i.x,p=i.y,f=i.z):(d=0,p=0,f=0);const g=Rt.convert(e.format),_=Rt.convert(e.type);let v;e.isData3DTexture?(dt.setTexture3D(e,0),v=Lt.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(dt.setTexture2DArray(e,0),v=Lt.TEXTURE_2D_ARRAY):(dt.setTexture2D(e,0),v=Lt.TEXTURE_2D),Lt.pixelStorei(Lt.UNPACK_FLIP_Y_WEBGL,e.flipY),Lt.pixelStorei(Lt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Lt.pixelStorei(Lt.UNPACK_ALIGNMENT,e.unpackAlignment);const x=Lt.getParameter(Lt.UNPACK_ROW_LENGTH),y=Lt.getParameter(Lt.UNPACK_IMAGE_HEIGHT),M=Lt.getParameter(Lt.UNPACK_SKIP_PIXELS),S=Lt.getParameter(Lt.UNPACK_SKIP_ROWS),T=Lt.getParameter(Lt.UNPACK_SKIP_IMAGES);Lt.pixelStorei(Lt.UNPACK_ROW_LENGTH,m.width),Lt.pixelStorei(Lt.UNPACK_IMAGE_HEIGHT,m.height),Lt.pixelStorei(Lt.UNPACK_SKIP_PIXELS,c),Lt.pixelStorei(Lt.UNPACK_SKIP_ROWS,u),Lt.pixelStorei(Lt.UNPACK_SKIP_IMAGES,h);const E=t.isDataArrayTexture||t.isData3DTexture,b=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){const n=ht.get(t),i=ht.get(e),m=ht.get(n.__renderTarget),g=ht.get(i.__renderTarget);st.bindFramebuffer(Lt.READ_FRAMEBUFFER,m.__webglFramebuffer),st.bindFramebuffer(Lt.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;n<l;n++)E&&(Lt.framebufferTextureLayer(Lt.READ_FRAMEBUFFER,Lt.COLOR_ATTACHMENT0,ht.get(t).__webglTexture,r,h+n),Lt.framebufferTextureLayer(Lt.DRAW_FRAMEBUFFER,Lt.COLOR_ATTACHMENT0,ht.get(e).__webglTexture,a,f+n)),Lt.blitFramebuffer(c,u,s,o,d,p,s,o,Lt.DEPTH_BUFFER_BIT,Lt.NEAREST);st.bindFramebuffer(Lt.READ_FRAMEBUFFER,null),st.bindFramebuffer(Lt.DRAW_FRAMEBUFFER,null)}else if(0!==r||t.isRenderTargetTexture||ht.has(t)){const n=ht.get(t),i=ht.get(e);st.bindFramebuffer(Lt.READ_FRAMEBUFFER,ee),st.bindFramebuffer(Lt.DRAW_FRAMEBUFFER,ne);for(let t=0;t<l;t++)E?Lt.framebufferTextureLayer(Lt.READ_FRAMEBUFFER,Lt.COLOR_ATTACHMENT0,n.__webglTexture,r,h+t):Lt.framebufferTexture2D(Lt.READ_FRAMEBUFFER,Lt.COLOR_ATTACHMENT0,Lt.TEXTURE_2D,n.__webglTexture,r),b?Lt.framebufferTextureLayer(Lt.DRAW_FRAMEBUFFER,Lt.COLOR_ATTACHMENT0,i.__webglTexture,a,f+t):Lt.framebufferTexture2D(Lt.DRAW_FRAMEBUFFER,Lt.COLOR_ATTACHMENT0,Lt.TEXTURE_2D,i.__webglTexture,a),0!==r?Lt.blitFramebuffer(c,u,s,o,d,p,s,o,Lt.COLOR_BUFFER_BIT,Lt.NEAREST):b?Lt.copyTexSubImage3D(v,a,d,p,f+t,c,u,s,o):Lt.copyTexSubImage2D(v,a,d,p,c,u,s,o);st.bindFramebuffer(Lt.READ_FRAMEBUFFER,null),st.bindFramebuffer(Lt.DRAW_FRAMEBUFFER,null)}else b?t.isDataTexture||t.isData3DTexture?Lt.texSubImage3D(v,a,d,p,f,s,o,l,g,_,m.data):e.isCompressedArrayTexture?Lt.compressedTexSubImage3D(v,a,d,p,f,s,o,l,g,m.data):Lt.texSubImage3D(v,a,d,p,f,s,o,l,g,_,m):t.isDataTexture?Lt.texSubImage2D(Lt.TEXTURE_2D,a,d,p,s,o,g,_,m.data):t.isCompressedTexture?Lt.compressedTexSubImage2D(Lt.TEXTURE_2D,a,d,p,m.width,m.height,g,m.data):Lt.texSubImage2D(Lt.TEXTURE_2D,a,d,p,s,o,g,_,m);Lt.pixelStorei(Lt.UNPACK_ROW_LENGTH,x),Lt.pixelStorei(Lt.UNPACK_IMAGE_HEIGHT,y),Lt.pixelStorei(Lt.UNPACK_SKIP_PIXELS,M),Lt.pixelStorei(Lt.UNPACK_SKIP_ROWS,S),Lt.pixelStorei(Lt.UNPACK_SKIP_IMAGES,T),0===a&&e.generateMipmaps&&Lt.generateMipmap(v),st.unbindTexture()},this.copyTextureToTexture3D=function(t,e,n=null,i=null,r=0){return Ce('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(t,e,n,i,r)},this.initRenderTarget=function(t){void 0===ht.get(t).__webglFramebuffer&&dt.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?dt.setTextureCube(t,0):t.isData3DTexture?dt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?dt.setTexture2DArray(t,0):dt.setTexture2D(t,0),st.unbindTexture()},this.resetState=function(){S=0,T=0,E=null,st.reset(),Ct.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return ue}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Ue._getDrawingBufferColorSpace(t),e.unpackColorSpace=Ue._getUnpackColorSpace()}}const Ho=()=>new mr,ko=()=>new or(75,window.innerWidth/window.innerHeight,.1,1e3),Go=()=>new Vo({alpha:!0});function Wo(t=400,e=400){const n=Ho(),i=ko(),r=Go();return r.setSize(t,e),{Scene:n,camera:i,renderer:r}}function Xo(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jo(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,t.__proto__=e}var qo,Yo,Ko,Zo,Jo,$o,Qo,tl,el,nl,il,rl,al,sl,ol,ll,cl,ul={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},hl={duration:.5,overwrite:!1,delay:0},dl=1e8,pl=1e-8,fl=2*Math.PI,ml=fl/4,gl=0,_l=Math.sqrt,vl=Math.cos,xl=Math.sin,yl=function(t){return"string"==typeof t},Ml=function(t){return"function"==typeof t},Sl=function(t){return"number"==typeof t},Tl=function(t){return void 0===t},El=function(t){return"object"==typeof t},bl=function(t){return!1!==t},wl=function(){return"undefined"!=typeof window},Al=function(t){return Ml(t)||yl(t)},Rl="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Cl=Array.isArray,Pl=/(?:-?\.?\d|\.)+/gi,Ll=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Dl=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,Ul=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,Il=/[+-]=-?[.\d]+/,Nl=/[^,'"\[\]\s]+/gi,Ol=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Fl={},Bl={},zl=function(t){return(Bl=mc(t,Fl))&&gh},Vl=function(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")},Hl=function(t,e){return!e&&console.warn(t)},kl=function(t,e){return t&&(Fl[t]=e)&&Bl&&(Bl[t]=e)||Fl},Gl=function(){return 0},Wl={suppressEvents:!0,isStart:!0,kill:!1},Xl={suppressEvents:!0,kill:!1},jl={suppressEvents:!0},ql={},Yl=[],Kl={},Zl={},Jl={},$l=30,Ql=[],tc="",ec=function(t){var e,n,i=t[0];if(El(i)||Ml(i)||(t=[t]),!(e=(i._gsap||{}).harness)){for(n=Ql.length;n--&&!Ql[n].targetTest(i););e=Ql[n]}for(n=t.length;n--;)t[n]&&(t[n]._gsap||(t[n]._gsap=new Pu(t[n],e)))||t.splice(n,1);return t},nc=function(t){return t._gsap||ec(qc(t))[0]._gsap},ic=function(t,e,n){return(n=t[e])&&Ml(n)?t[e]():Tl(n)&&t.getAttribute&&t.getAttribute(e)||n},rc=function(t,e){return(t=t.split(",")).forEach(e)||t},ac=function(t){return Math.round(1e5*t)/1e5||0},sc=function(t){return Math.round(1e7*t)/1e7||0},oc=function(t,e){var n=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),"+"===n?t+i:"-"===n?t-i:"*"===n?t*i:t/i},lc=function(t,e){for(var n=e.length,i=0;t.indexOf(e[i])<0&&++i<n;);return i<n},cc=function(){var t,e,n=Yl.length,i=Yl.slice(0);for(Kl={},Yl.length=0,t=0;t<n;t++)(e=i[t])&&e._lazy&&(e.render(e._lazy[0],e._lazy[1],!0)._lazy=0)},uc=function(t){return!!(t._initted||t._startAt||t.add)},hc=function(t,e,n,i){Yl.length&&!Yo&&cc(),t.render(e,n,i||!!(Yo&&e<0&&uc(t))),Yl.length&&!Yo&&cc()},dc=function(t){var e=parseFloat(t);return(e||0===e)&&(t+"").match(Nl).length<2?e:yl(t)?t.trim():t},pc=function(t){return t},fc=function(t,e){for(var n in e)n in t||(t[n]=e[n]);return t},mc=function(t,e){for(var n in e)t[n]=e[n];return t},gc=function t(e,n){for(var i in n)"__proto__"!==i&&"constructor"!==i&&"prototype"!==i&&(e[i]=El(n[i])?t(e[i]||(e[i]={}),n[i]):n[i]);return e},_c=function(t,e){var n,i={};for(n in t)n in e||(i[n]=t[n]);return i},vc=function(t){var e,n=t.parent||Zo,i=t.keyframes?(e=Cl(t.keyframes),function(t,n){for(var i in n)i in t||"duration"===i&&e||"ease"===i||(t[i]=n[i])}):fc;if(bl(t.inherit))for(;n;)i(t,n.vars.defaults),n=n.parent||n._dp;return t},xc=function(t,e,n,i,r){void 0===n&&(n="_first"),void 0===i&&(i="_last");var a,s=t[i];if(r)for(a=e[r];s&&s[r]>a;)s=s._prev;return s?(e._next=s._next,s._next=e):(e._next=t[n],t[n]=e),e._next?e._next._prev=e:t[i]=e,e._prev=s,e.parent=e._dp=t,e},yc=function(t,e,n,i){void 0===n&&(n="_first"),void 0===i&&(i="_last");var r=e._prev,a=e._next;r?r._next=a:t[n]===e&&(t[n]=a),a?a._prev=r:t[i]===e&&(t[i]=r),e._next=e._prev=e.parent=null},Mc=function(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0},Sc=function(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var n=t;n;)n._dirty=1,n=n.parent;return t},Tc=function(t,e,n,i){return t._startAt&&(Yo?t._startAt.revert(Xl):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))},Ec=function t(e){return!e||e._ts&&t(e.parent)},bc=function(t){return t._repeat?wc(t._tTime,t=t.duration()+t._rDelay)*t:0},wc=function(t,e){var n=Math.floor(t=sc(t/e));return t&&n===t?n-1:n},Ac=function(t,e){return(t-e._start)*e._ts+(e._ts>=0?0:e._dirty?e.totalDuration():e._tDur)},Rc=function(t){return t._end=sc(t._start+(t._tDur/Math.abs(t._ts||t._rts||pl)||0))},Cc=function(t,e){var n=t._dp;return n&&n.smoothChildTiming&&t._ts&&(t._start=sc(n._time-(t._ts>0?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Rc(t),n._dirty||Sc(n,t)),t},Pc=function(t,e){var n;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(n=Ac(t.rawTime(),e),(!e._dur||kc(0,e.totalDuration(),n)-e._tTime>pl)&&e.render(n,!0)),Sc(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(n=t;n._dp;)n.rawTime()>=0&&n.totalTime(n._tTime),n=n._dp;t._zTime=-1e-8}},Lc=function(t,e,n,i){return e.parent&&Mc(e),e._start=sc((Sl(n)?n:n||t!==Zo?zc(t,n,e):t._time)+e._delay),e._end=sc(e._start+(e.totalDuration()/Math.abs(e.timeScale())||0)),xc(t,e,"_first","_last",t._sort?"_start":0),Nc(e)||(t._recent=e),i||Pc(t,e),t._ts<0&&Cc(t,t._tTime),t},Dc=function(t,e){return(Fl.ScrollTrigger||Vl("scrollTrigger",e))&&Fl.ScrollTrigger.create(e,t)},Uc=function(t,e,n,i,r){return Bu(t,e,r),t._initted?!n&&t._pt&&!Yo&&(t._dur&&!1!==t.vars.lazy||!t._dur&&t.vars.lazy)&&el!==_u.frame?(Yl.push(t),t._lazy=[r,i],1):void 0:1},Ic=function t(e){var n=e.parent;return n&&n._ts&&n._initted&&!n._lock&&(n.rawTime()<0||t(n))},Nc=function(t){var e=t.data;return"isFromStart"===e||"isStart"===e},Oc=function(t,e,n,i){var r=t._repeat,a=sc(e)||0,s=t._tTime/t._tDur;return s&&!i&&(t._time*=a/t._dur),t._dur=a,t._tDur=r?r<0?1e10:sc(a*(r+1)+t._rDelay*r):a,s>0&&!i&&Cc(t,t._tTime=t._tDur*s),t.parent&&Rc(t),n||Sc(t.parent,t),t},Fc=function(t){return t instanceof Du?Sc(t):Oc(t,t._dur)},Bc={_start:0,endTime:Gl,totalDuration:Gl},zc=function t(e,n,i){var r,a,s,o=e.labels,l=e._recent||Bc,c=e.duration()>=dl?l.endTime(!1):e._dur;return yl(n)&&(isNaN(n)||n in o)?(a=n.charAt(0),s="%"===n.substr(-1),r=n.indexOf("="),"<"===a||">"===a?(r>=0&&(n=n.replace(/=/,"")),("<"===a?l._start:l.endTime(l._repeat>=0))+(parseFloat(n.substr(1))||0)*(s?(r<0?l:i).totalDuration()/100:1)):r<0?(n in o||(o[n]=c),o[n]):(a=parseFloat(n.charAt(r-1)+n.substr(r+1)),s&&i&&(a=a/100*(Cl(i)?i[0]:i).totalDuration()),r>1?t(e,n.substr(0,r-1),i)+a:c+a)):null==n?c:+n},Vc=function(t,e,n){var i,r,a=Sl(e[1]),s=(a?2:1)+(t<2?0:1),o=e[s];if(a&&(o.duration=e[1]),o.parent=n,t){for(i=o,r=n;r&&!("immediateRender"in i);)i=r.vars.defaults||{},r=bl(r.vars.inherit)&&r.parent;o.immediateRender=bl(i.immediateRender),t<2?o.runBackwards=1:o.startAt=e[s-1]}return new Gu(e[0],o,e[s+1])},Hc=function(t,e){return t||0===t?e(t):e},kc=function(t,e,n){return n<t?t:n>e?e:n},Gc=function(t,e){return yl(t)&&(e=Ol.exec(t))?e[1]:""},Wc=[].slice,Xc=function(t,e){return t&&El(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&El(t[0]))&&!t.nodeType&&t!==Jo},jc=function(t,e,n){return void 0===n&&(n=[]),t.forEach((function(t){var i;return yl(t)&&!e||Xc(t,1)?(i=n).push.apply(i,qc(t)):n.push(t)}))||n},qc=function(t,e,n){return Ko&&!e&&Ko.selector?Ko.selector(t):!yl(t)||n||!$o&&vu()?Cl(t)?jc(t,n):Xc(t)?Wc.call(t,0):t?[t]:[]:Wc.call((e||Qo).querySelectorAll(t),0)},Yc=function(t){return t=qc(t)[0]||Hl("Invalid scope")||{},function(e){var n=t.current||t.nativeElement||t;return qc(e,n.querySelectorAll?n:n===t?Hl("Invalid scope")||Qo.createElement("div"):t)}},Kc=function(t){return t.sort((function(){return.5-Math.random()}))},Zc=function(t){if(Ml(t))return t;var e=El(t)?t:{each:t},n=bu(e.ease),i=e.from||0,r=parseFloat(e.base)||0,a={},s=i>0&&i<1,o=isNaN(i)||s,l=e.axis,c=i,u=i;return yl(i)?c=u={center:.5,edges:.5,end:1}[i]||0:!s&&o&&(c=i[0],u=i[1]),function(t,s,h){var d,p,f,m,g,_,v,x,y,M=(h||e).length,S=a[M];if(!S){if(!(y="auto"===e.grid?0:(e.grid||[1,dl])[1])){for(v=-dl;v<(v=h[y++].getBoundingClientRect().left)&&y<M;);y<M&&y--}for(S=a[M]=[],d=o?Math.min(y,M)*c-.5:i%y,p=y===dl?0:o?M*u/y-.5:i/y|0,v=0,x=dl,_=0;_<M;_++)f=_%y-d,m=p-(_/y|0),S[_]=g=l?Math.abs("y"===l?m:f):_l(f*f+m*m),g>v&&(v=g),g<x&&(x=g);"random"===i&&Kc(S),S.max=v-x,S.min=x,S.v=M=(parseFloat(e.amount)||parseFloat(e.each)*(y>M?M-1:l?"y"===l?M/y:y:Math.max(y,M/y))||0)*("edges"===i?-1:1),S.b=M<0?r-M:r,S.u=Gc(e.amount||e.each)||0,n=n&&M<0?Tu(n):n}return M=(S[t]-S.min)/S.max||0,sc(S.b+(n?n(M):M)*S.v)+S.u}},Jc=function(t){var e=Math.pow(10,((t+"").split(".")[1]||"").length);return function(n){var i=sc(Math.round(parseFloat(n)/t)*t*e);return(i-i%1)/e+(Sl(n)?0:Gc(n))}},$c=function(t,e){var n,i,r=Cl(t);return!r&&El(t)&&(n=r=t.radius||dl,t.values?(t=qc(t.values),(i=!Sl(t[0]))&&(n*=n)):t=Jc(t.increment)),Hc(e,r?Ml(t)?function(e){return i=t(e),Math.abs(i-e)<=n?i:e}:function(e){for(var r,a,s=parseFloat(i?e.x:e),o=parseFloat(i?e.y:0),l=dl,c=0,u=t.length;u--;)(r=i?(r=t[u].x-s)*r+(a=t[u].y-o)*a:Math.abs(t[u]-s))<l&&(l=r,c=u);return c=!n||l<=n?t[c]:e,i||c===e||Sl(e)?c:c+Gc(e)}:Jc(t))},Qc=function(t,e,n,i){return Hc(Cl(t)?!e:!0===n?!!(n=0):!i,(function(){return Cl(t)?t[~~(Math.random()*t.length)]:(n=n||1e-5)&&(i=n<1?Math.pow(10,(n+"").length-2):1)&&Math.floor(Math.round((t-n/2+Math.random()*(e-t+.99*n))/n)*n*i)/i}))},tu=function(t,e,n){return Hc(n,(function(n){return t[~~e(n)]}))},eu=function(t){for(var e,n,i,r,a=0,s="";~(e=t.indexOf("random(",a));)i=t.indexOf(")",e),r="["===t.charAt(e+7),n=t.substr(e+7,i-e-7).match(r?Nl:Pl),s+=t.substr(a,e-a)+Qc(r?n:+n[0],r?0:+n[1],+n[2]||1e-5),a=i+1;return s+t.substr(a,t.length-a)},nu=function(t,e,n,i,r){var a=e-t,s=i-n;return Hc(r,(function(e){return n+((e-t)/a*s||0)}))},iu=function(t,e,n){var i,r,a,s=t.labels,o=dl;for(i in s)(r=s[i]-e)<0==!!n&&r&&o>(r=Math.abs(r))&&(a=i,o=r);return a},ru=function(t,e,n){var i,r,a,s=t.vars,o=s[e],l=Ko,c=t._ctx;if(o)return i=s[e+"Params"],r=s.callbackScope||t,n&&Yl.length&&cc(),c&&(Ko=c),a=i?o.apply(r,i):o.call(r),Ko=l,a},au=function(t){return Mc(t),t.scrollTrigger&&t.scrollTrigger.kill(!!Yo),t.progress()<1&&ru(t,"onInterrupt"),t},su=[],ou=function(t){if(t)if(t=!t.name&&t.default||t,wl()||t.headless){var e=t.name,n=Ml(t),i=e&&!n&&t.init?function(){this._props=[]}:t,r={init:Gl,render:$u,add:Ou,kill:th,modifier:Qu,rawVars:0},a={targetTest:0,get:0,getSetter:Yu,aliases:{},register:0};if(vu(),t!==i){if(Zl[e])return;fc(i,fc(_c(t,r),a)),mc(i.prototype,mc(r,_c(t,a))),Zl[i.prop=e]=i,t.targetTest&&(Ql.push(i),ql[e]=1),e=("css"===e?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}kl(e,i),t.register&&t.register(gh,i,ih)}else su.push(t)},lu=255,cu={aqua:[0,lu,lu],lime:[0,lu,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,lu],navy:[0,0,128],white:[lu,lu,lu],olive:[128,128,0],yellow:[lu,lu,0],orange:[lu,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[lu,0,0],pink:[lu,192,203],cyan:[0,lu,lu],transparent:[lu,lu,lu,0]},uu=function(t,e,n){return(6*(t+=t<0?1:t>1?-1:0)<1?e+(n-e)*t*6:t<.5?n:3*t<2?e+(n-e)*(2/3-t)*6:e)*lu+.5|0},hu=function(t,e,n){var i,r,a,s,o,l,c,u,h,d,p=t?Sl(t)?[t>>16,t>>8&lu,t&lu]:0:cu.black;if(!p){if(","===t.substr(-1)&&(t=t.substr(0,t.length-1)),cu[t])p=cu[t];else if("#"===t.charAt(0)){if(t.length<6&&(i=t.charAt(1),r=t.charAt(2),a=t.charAt(3),t="#"+i+i+r+r+a+a+(5===t.length?t.charAt(4)+t.charAt(4):"")),9===t.length)return[(p=parseInt(t.substr(1,6),16))>>16,p>>8&lu,p&lu,parseInt(t.substr(7),16)/255];p=[(t=parseInt(t.substr(1),16))>>16,t>>8&lu,t&lu]}else if("hsl"===t.substr(0,3))if(p=d=t.match(Pl),e){if(~t.indexOf("="))return p=t.match(Ll),n&&p.length<4&&(p[3]=1),p}else s=+p[0]%360/360,o=+p[1]/100,i=2*(l=+p[2]/100)-(r=l<=.5?l*(o+1):l+o-l*o),p.length>3&&(p[3]*=1),p[0]=uu(s+1/3,i,r),p[1]=uu(s,i,r),p[2]=uu(s-1/3,i,r);else p=t.match(Pl)||cu.transparent;p=p.map(Number)}return e&&!d&&(i=p[0]/lu,r=p[1]/lu,a=p[2]/lu,l=((c=Math.max(i,r,a))+(u=Math.min(i,r,a)))/2,c===u?s=o=0:(h=c-u,o=l>.5?h/(2-c-u):h/(c+u),s=c===i?(r-a)/h+(r<a?6:0):c===r?(a-i)/h+2:(i-r)/h+4,s*=60),p[0]=~~(s+.5),p[1]=~~(100*o+.5),p[2]=~~(100*l+.5)),n&&p.length<4&&(p[3]=1),p},du=function(t){var e=[],n=[],i=-1;return t.split(fu).forEach((function(t){var r=t.match(Dl)||[];e.push.apply(e,r),n.push(i+=r.length+1)})),e.c=n,e},pu=function(t,e,n){var i,r,a,s,o="",l=(t+o).match(fu),c=e?"hsla(":"rgba(",u=0;if(!l)return t;if(l=l.map((function(t){return(t=hu(t,e,1))&&c+(e?t[0]+","+t[1]+"%,"+t[2]+"%,"+t[3]:t.join(","))+")"})),n&&(a=du(t),(i=n.c).join(o)!==a.c.join(o)))for(s=(r=t.replace(fu,"1").split(Dl)).length-1;u<s;u++)o+=r[u]+(~i.indexOf(u)?l.shift()||c+"0,0,0,0)":(a.length?a:l.length?l:n).shift());if(!r)for(s=(r=t.split(fu)).length-1;u<s;u++)o+=r[u]+l[u];return o+r[s]},fu=function(){var t,e="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(t in cu)e+="|"+t+"\\b";return new RegExp(e+")","gi")}(),mu=/hsl[a]?\(/,gu=function(t){var e,n=t.join(" ");if(fu.lastIndex=0,fu.test(n))return e=mu.test(n),t[1]=pu(t[1],e),t[0]=pu(t[0],e,du(t[1])),!0},_u=function(){var t,e,n,i,r,a,s=Date.now,o=500,l=33,c=s(),u=c,h=1e3/240,d=h,p=[],f=function n(f){var m,g,_,v,x=s()-u,y=!0===f;if((x>o||x<0)&&(c+=x-l),((m=(_=(u+=x)-c)-d)>0||y)&&(v=++i.frame,r=_-1e3*i.time,i.time=_/=1e3,d+=m+(m>=h?4:h-m),g=1),y||(t=e(n)),g)for(a=0;a<p.length;a++)p[a](_,r,v,f)};return i={time:0,frame:0,tick:function(){f(!0)},deltaRatio:function(t){return r/(1e3/(t||60))},wake:function(){tl&&(!$o&&wl()&&(Jo=$o=window,Qo=Jo.document||{},Fl.gsap=gh,(Jo.gsapVersions||(Jo.gsapVersions=[])).push(gh.version),zl(Bl||Jo.GreenSockGlobals||!Jo.gsap&&Jo||{}),su.forEach(ou)),n="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame,t&&i.sleep(),e=n||function(t){return setTimeout(t,d-1e3*i.time+1|0)},il=1,f(2))},sleep:function(){(n?cancelAnimationFrame:clearTimeout)(t),il=0,e=Gl},lagSmoothing:function(t,e){o=t||1/0,l=Math.min(e||33,o)},fps:function(t){h=1e3/(t||240),d=1e3*i.time+h},add:function(t,e,n){var r=e?function(e,n,a,s){t(e,n,a,s),i.remove(r)}:t;return i.remove(t),p[n?"unshift":"push"](r),vu(),r},remove:function(t,e){~(e=p.indexOf(t))&&p.splice(e,1)&&a>=e&&a--},_listeners:p}}(),vu=function(){return!il&&_u.wake()},xu={},yu=/^[\d.\-M][\d.\-,\s]/,Mu=/["']/g,Su=function(t){for(var e,n,i,r={},a=t.substr(1,t.length-3).split(":"),s=a[0],o=1,l=a.length;o<l;o++)n=a[o],e=o!==l-1?n.lastIndexOf(","):n.length,i=n.substr(0,e),r[s]=isNaN(i)?i.replace(Mu,"").trim():+i,s=n.substr(e+1).trim();return r},Tu=function(t){return function(e){return 1-t(1-e)}},Eu=function t(e,n){for(var i,r=e._first;r;)r instanceof Du?t(r,n):!r.vars.yoyoEase||r._yoyo&&r._repeat||r._yoyo===n||(r.timeline?t(r.timeline,n):(i=r._ease,r._ease=r._yEase,r._yEase=i,r._yoyo=n)),r=r._next},bu=function(t,e){return t&&(Ml(t)?t:xu[t]||function(t){var e,n,i,r,a=(t+"").split("("),s=xu[a[0]];return s&&a.length>1&&s.config?s.config.apply(null,~t.indexOf("{")?[Su(a[1])]:(e=t,n=e.indexOf("(")+1,i=e.indexOf(")"),r=e.indexOf("(",n),e.substring(n,~r&&r<i?e.indexOf(")",i+1):i)).split(",").map(dc)):xu._CE&&yu.test(t)?xu._CE("",t):s}(t))||e},wu=function(t,e,n,i){void 0===n&&(n=function(t){return 1-e(1-t)}),void 0===i&&(i=function(t){return t<.5?e(2*t)/2:1-e(2*(1-t))/2});var r,a={easeIn:e,easeOut:n,easeInOut:i};return rc(t,(function(t){for(var e in xu[t]=Fl[t]=a,xu[r=t.toLowerCase()]=n,a)xu[r+("easeIn"===e?".in":"easeOut"===e?".out":".inOut")]=xu[t+"."+e]=a[e]})),a},Au=function(t){return function(e){return e<.5?(1-t(1-2*e))/2:.5+t(2*(e-.5))/2}},Ru=function t(e,n,i){var r=n>=1?n:1,a=(i||(e?.3:.45))/(n<1?n:1),s=a/fl*(Math.asin(1/r)||0),o=function(t){return 1===t?1:r*Math.pow(2,-10*t)*xl((t-s)*a)+1},l="out"===e?o:"in"===e?function(t){return 1-o(1-t)}:Au(o);return a=fl/a,l.config=function(n,i){return t(e,n,i)},l},Cu=function t(e,n){void 0===n&&(n=1.70158);var i=function(t){return t?--t*t*((n+1)*t+n)+1:0},r="out"===e?i:"in"===e?function(t){return 1-i(1-t)}:Au(i);return r.config=function(n){return t(e,n)},r};rc("Linear,Quad,Cubic,Quart,Quint,Strong",(function(t,e){var n=e<5?e+1:e;wu(t+",Power"+(n-1),e?function(t){return Math.pow(t,n)}:function(t){return t},(function(t){return 1-Math.pow(1-t,n)}),(function(t){return t<.5?Math.pow(2*t,n)/2:1-Math.pow(2*(1-t),n)/2}))})),xu.Linear.easeNone=xu.none=xu.Linear.easeIn,wu("Elastic",Ru("in"),Ru("out"),Ru()),rl=7.5625,ol=2*(sl=1/(al=2.75)),ll=2.5*sl,wu("Bounce",(function(t){return 1-cl(1-t)}),cl=function(t){return t<sl?rl*t*t:t<ol?rl*Math.pow(t-1.5/al,2)+.75:t<ll?rl*(t-=2.25/al)*t+.9375:rl*Math.pow(t-2.625/al,2)+.984375}),wu("Expo",(function(t){return Math.pow(2,10*(t-1))*t+t*t*t*t*t*t*(1-t)})),wu("Circ",(function(t){return-(_l(1-t*t)-1)})),wu("Sine",(function(t){return 1===t?1:1-vl(t*ml)})),wu("Back",Cu("in"),Cu("out"),Cu()),xu.SteppedEase=xu.steps=Fl.SteppedEase={config:function(t,e){void 0===t&&(t=1);var n=1/t,i=t+(e?0:1),r=e?1:0;return function(t){return((i*kc(0,.99999999,t)|0)+r)*n}}},hl.ease=xu["quad.out"],rc("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",(function(t){return tc+=t+","+t+"Params,"}));var Pu=function(t,e){this.id=gl++,t._gsap=this,this.target=t,this.harness=e,this.get=e?e.get:ic,this.set=e?e.getSetter:Yu},Lu=function(){function t(t){this.vars=t,this._delay=+t.delay||0,(this._repeat=t.repeat===1/0?-2:t.repeat||0)&&(this._rDelay=t.repeatDelay||0,this._yoyo=!!t.yoyo||!!t.yoyoEase),this._ts=1,Oc(this,+t.duration,1,1),this.data=t.data,Ko&&(this._ctx=Ko,Ko.data.push(this)),il||_u.wake()}var e=t.prototype;return e.delay=function(t){return t||0===t?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+t-this._delay),this._delay=t,this):this._delay},e.duration=function(t){return arguments.length?this.totalDuration(this._repeat>0?t+(t+this._rDelay)*this._repeat:t):this.totalDuration()&&this._dur},e.totalDuration=function(t){return arguments.length?(this._dirty=0,Oc(this,this._repeat<0?t:(t-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(t,e){if(vu(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(Cc(this,t),!n._dp||n.parent||Pc(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&t<this._tDur||this._ts<0&&t>0||!this._tDur&&!t)&&Lc(this._dp,this,this._start-this._delay)}return(this._tTime!==t||!this._dur&&!e||this._initted&&Math.abs(this._zTime)===pl||!t&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=t),hc(this,t,e)),this},e.time=function(t,e){return arguments.length?this.totalTime(Math.min(this.totalDuration(),t+bc(this))%(this._dur+this._rDelay)||(t?this._dur:0),e):this._time},e.totalProgress=function(t,e){return arguments.length?this.totalTime(this.totalDuration()*t,e):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},e.progress=function(t,e){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?t:1-t)+bc(this),e):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(t,e){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(t-1)*n,e):this._repeat?wc(this._tTime,n)+1:1},e.timeScale=function(t,e){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===t)return this;var n=this.parent&&this._ts?Ac(this.parent._time,this):this._tTime;return this._rts=+t||0,this._ts=this._ps||-1e-8===t?0:this._rts,this.totalTime(kc(-Math.abs(this._delay),this.totalDuration(),n),!1!==e),Rc(this),function(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t}(this)},e.paused=function(t){return arguments.length?(this._ps!==t&&(this._ps=t,t?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(vu(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==pl&&(this._tTime-=pl)))),this):this._ps},e.startTime=function(t){if(arguments.length){this._start=t;var e=this.parent||this._dp;return e&&(e._sort||!this.parent)&&Lc(e,this,t-this._delay),this}return this._start},e.endTime=function(t){return this._start+(bl(t)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(t){var e=this.parent||this._dp;return e?t&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?Ac(e.rawTime(t),this):this._tTime:this._tTime},e.revert=function(t){void 0===t&&(t=jl);var e=Yo;return Yo=t,uc(this)&&(this.timeline&&this.timeline.revert(t),this.totalTime(-.01,t.suppressEvents)),"nested"!==this.data&&!1!==t.kill&&this.kill(),Yo=e,this},e.globalTime=function(t){for(var e=this,n=arguments.length?t:e.rawTime();e;)n=e._start+n/(Math.abs(e._ts)||1),e=e._dp;return!this.parent&&this._sat?this._sat.globalTime(t):n},e.repeat=function(t){return arguments.length?(this._repeat=t===1/0?-2:t,Fc(this)):-2===this._repeat?1/0:this._repeat},e.repeatDelay=function(t){if(arguments.length){var e=this._time;return this._rDelay=t,Fc(this),e?this.time(e):this}return this._rDelay},e.yoyo=function(t){return arguments.length?(this._yoyo=t,this):this._yoyo},e.seek=function(t,e){return this.totalTime(zc(this,t),bl(e))},e.restart=function(t,e){return this.play().totalTime(t?-this._delay:0,bl(e)),this._dur||(this._zTime=-1e-8),this},e.play=function(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},e.reverse=function(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},e.pause=function(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(t){return arguments.length?(!!t!==this.reversed()&&this.timeScale(-this._rts||(t?-1e-8:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},e.isActive=function(){var t,e=this.parent||this._dp,n=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(t=e.rawTime(!0))>=n&&t<this.endTime(!0)-pl))},e.eventCallback=function(t,e,n){var i=this.vars;return arguments.length>1?(e?(i[t]=e,n&&(i[t+"Params"]=n),"onUpdate"===t&&(this._onUpdate=e)):delete i[t],this):i[t]},e.then=function(t){var e=this;return new Promise((function(n){var i=Ml(t)?t:pc,r=function(){var t=e.then;e.then=null,Ml(i)&&(i=i(e))&&(i.then||i===e)&&(e.then=t),n(i),e.then=t};e._initted&&1===e.totalProgress()&&e._ts>=0||!e._tTime&&e._ts<0?r():e._prom=r}))},e.kill=function(){au(this)},t}();fc(Lu.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-1e-8,_prom:0,_ps:!1,_rts:1});var Du=function(t){function e(e,n){var i;return void 0===e&&(e={}),(i=t.call(this,e)||this).labels={},i.smoothChildTiming=!!e.smoothChildTiming,i.autoRemoveChildren=!!e.autoRemoveChildren,i._sort=bl(e.sortChildren),Zo&&Lc(e.parent||Zo,Xo(i),n),e.reversed&&i.reverse(),e.paused&&i.paused(!0),e.scrollTrigger&&Dc(Xo(i),e.scrollTrigger),i}jo(e,t);var n=e.prototype;return n.to=function(t,e,n){return Vc(0,arguments,this),this},n.from=function(t,e,n){return Vc(1,arguments,this),this},n.fromTo=function(t,e,n,i){return Vc(2,arguments,this),this},n.set=function(t,e,n){return e.duration=0,e.parent=this,vc(e).repeatDelay||(e.repeat=0),e.immediateRender=!!e.immediateRender,new Gu(t,e,zc(this,n),1),this},n.call=function(t,e,n){return Lc(this,Gu.delayedCall(0,t,e),n)},n.staggerTo=function(t,e,n,i,r,a,s){return n.duration=e,n.stagger=n.stagger||i,n.onComplete=a,n.onCompleteParams=s,n.parent=this,new Gu(t,n,zc(this,r)),this},n.staggerFrom=function(t,e,n,i,r,a,s){return n.runBackwards=1,vc(n).immediateRender=bl(n.immediateRender),this.staggerTo(t,e,n,i,r,a,s)},n.staggerFromTo=function(t,e,n,i,r,a,s,o){return i.startAt=n,vc(i).immediateRender=bl(i.immediateRender),this.staggerTo(t,e,i,r,a,s,o)},n.render=function(t,e,n){var i,r,a,s,o,l,c,u,h,d,p,f,m=this._time,g=this._dirty?this.totalDuration():this._tDur,_=this._dur,v=t<=0?0:sc(t),x=this._zTime<0!=t<0&&(this._initted||!_);if(this!==Zo&&v>g&&t>=0&&(v=g),v!==this._tTime||n||x){if(m!==this._time&&_&&(v+=this._time-m,t+=this._time-m),i=v,h=this._start,l=!(u=this._ts),x&&(_||(m=this._zTime),(t||!e)&&(this._zTime=t)),this._repeat){if(p=this._yoyo,o=_+this._rDelay,this._repeat<-1&&t<0)return this.totalTime(100*o+t,e,n);if(i=sc(v%o),v===g?(s=this._repeat,i=_):((s=~~(d=sc(v/o)))&&s===d&&(i=_,s--),i>_&&(i=_)),d=wc(this._tTime,o),!m&&this._tTime&&d!==s&&this._tTime-d*o-this._dur<=0&&(d=s),p&&1&s&&(i=_-i,f=1),s!==d&&!this._lock){var y=p&&1&d,M=y===(p&&1&s);if(s<d&&(y=!y),m=y?0:v%_?_:v,this._lock=1,this.render(m||(f?0:sc(s*o)),e,!_)._lock=0,this._tTime=v,!e&&this.parent&&ru(this,"onRepeat"),this.vars.repeatRefresh&&!f&&(this.invalidate()._lock=1),m&&m!==this._time||l!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(_=this._dur,g=this._tDur,M&&(this._lock=2,m=y?_:-1e-4,this.render(m,!0),this.vars.repeatRefresh&&!f&&this.invalidate()),this._lock=0,!this._ts&&!l)return this;Eu(this,f)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(c=function(t,e,n){var i;if(n>e)for(i=t._first;i&&i._start<=n;){if("isPause"===i.data&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=n;){if("isPause"===i.data&&i._start<e)return i;i=i._prev}}(this,sc(m),sc(i)),c&&(v-=i-(i=c._start))),this._tTime=v,this._time=i,this._act=!u,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=t,m=0),!m&&v&&!e&&!d&&(ru(this,"onStart"),this._tTime!==v))return this;if(i>=m&&t>=0)for(r=this._first;r;){if(a=r._next,(r._act||i>=r._start)&&r._ts&&c!==r){if(r.parent!==this)return this.render(t,e,n);if(r.render(r._ts>0?(i-r._start)*r._ts:(r._dirty?r.totalDuration():r._tDur)+(i-r._start)*r._ts,e,n),i!==this._time||!this._ts&&!l){c=0,a&&(v+=this._zTime=-1e-8);break}}r=a}else{r=this._last;for(var S=t<0?t:i;r;){if(a=r._prev,(r._act||S<=r._end)&&r._ts&&c!==r){if(r.parent!==this)return this.render(t,e,n);if(r.render(r._ts>0?(S-r._start)*r._ts:(r._dirty?r.totalDuration():r._tDur)+(S-r._start)*r._ts,e,n||Yo&&uc(r)),i!==this._time||!this._ts&&!l){c=0,a&&(v+=this._zTime=S?-1e-8:pl);break}}r=a}}if(c&&!e&&(this.pause(),c.render(i>=m?0:-1e-8)._zTime=i>=m?1:-1,this._ts))return this._start=h,Rc(this),this.render(t,e,n);this._onUpdate&&!e&&ru(this,"onUpdate",!0),(v===g&&this._tTime>=this.totalDuration()||!v&&m)&&(h!==this._start&&Math.abs(u)===Math.abs(this._ts)||this._lock||((t||!_)&&(v===g&&this._ts>0||!v&&this._ts<0)&&Mc(this,1),e||t<0&&!m||!v&&!m&&g||(ru(this,v===g&&t>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(v<g&&this.timeScale()>0)&&this._prom())))}return this},n.add=function(t,e){var n=this;if(Sl(e)||(e=zc(this,e,t)),!(t instanceof Lu)){if(Cl(t))return t.forEach((function(t){return n.add(t,e)})),this;if(yl(t))return this.addLabel(t,e);if(!Ml(t))return this;t=Gu.delayedCall(0,t)}return this!==t?Lc(this,t,e):this},n.getChildren=function(t,e,n,i){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===n&&(n=!0),void 0===i&&(i=-dl);for(var r=[],a=this._first;a;)a._start>=i&&(a instanceof Gu?e&&r.push(a):(n&&r.push(a),t&&r.push.apply(r,a.getChildren(!0,e,n)))),a=a._next;return r},n.getById=function(t){for(var e=this.getChildren(1,1,1),n=e.length;n--;)if(e[n].vars.id===t)return e[n]},n.remove=function(t){return yl(t)?this.removeLabel(t):Ml(t)?this.killTweensOf(t):(t.parent===this&&yc(this,t),t===this._recent&&(this._recent=this._last),Sc(this))},n.totalTime=function(e,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=sc(_u.time-(this._ts>0?e/this._ts:(this.totalDuration()-e)/-this._ts))),t.prototype.totalTime.call(this,e,n),this._forcing=0,this):this._tTime},n.addLabel=function(t,e){return this.labels[t]=zc(this,e),this},n.removeLabel=function(t){return delete this.labels[t],this},n.addPause=function(t,e,n){var i=Gu.delayedCall(0,e||Gl,n);return i.data="isPause",this._hasPause=1,Lc(this,i,zc(this,t))},n.removePause=function(t){var e=this._first;for(t=zc(this,t);e;)e._start===t&&"isPause"===e.data&&Mc(e),e=e._next},n.killTweensOf=function(t,e,n){for(var i=this.getTweensOf(t,n),r=i.length;r--;)Uu!==i[r]&&i[r].kill(t,e);return this},n.getTweensOf=function(t,e){for(var n,i=[],r=qc(t),a=this._first,s=Sl(e);a;)a instanceof Gu?lc(a._targets,r)&&(s?(!Uu||a._initted&&a._ts)&&a.globalTime(0)<=e&&a.globalTime(a.totalDuration())>e:!e||a.isActive())&&i.push(a):(n=a.getTweensOf(r,e)).length&&i.push.apply(i,n),a=a._next;return i},n.tweenTo=function(t,e){e=e||{};var n,i=this,r=zc(i,t),a=e,s=a.startAt,o=a.onStart,l=a.onStartParams,c=a.immediateRender,u=Gu.to(i,fc({ease:e.ease||"none",lazy:!1,immediateRender:!1,time:r,overwrite:"auto",duration:e.duration||Math.abs((r-(s&&"time"in s?s.time:i._time))/i.timeScale())||pl,onStart:function(){if(i.pause(),!n){var t=e.duration||Math.abs((r-(s&&"time"in s?s.time:i._time))/i.timeScale());u._dur!==t&&Oc(u,t,0,1).render(u._time,!0,!0),n=1}o&&o.apply(u,l||[])}},e));return c?u.render(0):u},n.tweenFromTo=function(t,e,n){return this.tweenTo(e,fc({startAt:{time:zc(this,t)}},n))},n.recent=function(){return this._recent},n.nextLabel=function(t){return void 0===t&&(t=this._time),iu(this,zc(this,t))},n.previousLabel=function(t){return void 0===t&&(t=this._time),iu(this,zc(this,t),1)},n.currentLabel=function(t){return arguments.length?this.seek(t,!0):this.previousLabel(this._time+pl)},n.shiftChildren=function(t,e,n){void 0===n&&(n=0);for(var i,r=this._first,a=this.labels;r;)r._start>=n&&(r._start+=t,r._end+=t),r=r._next;if(e)for(i in a)a[i]>=n&&(a[i]+=t);return Sc(this)},n.invalidate=function(e){var n=this._first;for(this._lock=0;n;)n.invalidate(e),n=n._next;return t.prototype.invalidate.call(this,e)},n.clear=function(t){void 0===t&&(t=!0);for(var e,n=this._first;n;)e=n._next,this.remove(n),n=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),Sc(this)},n.totalDuration=function(t){var e,n,i,r=0,a=this,s=a._last,o=dl;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-t:t));if(a._dirty){for(i=a.parent;s;)e=s._prev,s._dirty&&s.totalDuration(),(n=s._start)>o&&a._sort&&s._ts&&!a._lock?(a._lock=1,Lc(a,s,n-s._delay,1)._lock=0):o=n,n<0&&s._ts&&(r-=n,(!i&&!a._dp||i&&i.smoothChildTiming)&&(a._start+=n/a._ts,a._time-=n,a._tTime-=n),a.shiftChildren(-n,!1,-Infinity),o=0),s._end>r&&s._ts&&(r=s._end),s=e;Oc(a,a===Zo&&a._time>r?a._time:r,1,1),a._dirty=0}return a._tDur},e.updateRoot=function(t){if(Zo._ts&&(hc(Zo,Ac(t,Zo)),el=_u.frame),_u.frame>=$l){$l+=ul.autoSleep||120;var e=Zo._first;if((!e||!e._ts)&&ul.autoSleep&&_u._listeners.length<2){for(;e&&!e._ts;)e=e._next;e||_u.sleep()}}},e}(Lu);fc(Du.prototype,{_lock:0,_hasPause:0,_forcing:0});var Uu,Iu,Nu=function(t,e,n,i,r,a,s){var o,l,c,u,h,d,p,f,m=new ih(this._pt,t,e,0,1,Ju,null,r),g=0,_=0;for(m.b=n,m.e=i,n+="",(p=~(i+="").indexOf("random("))&&(i=eu(i)),a&&(a(f=[n,i],t,e),n=f[0],i=f[1]),l=n.match(Ul)||[];o=Ul.exec(i);)u=o[0],h=i.substring(g,o.index),c?c=(c+1)%5:"rgba("===h.substr(-5)&&(c=1),u!==l[_++]&&(d=parseFloat(l[_-1])||0,m._pt={_next:m._pt,p:h||1===_?h:",",s:d,c:"="===u.charAt(1)?oc(d,u)-d:parseFloat(u)-d,m:c&&c<4?Math.round:0},g=Ul.lastIndex);return m.c=g<i.length?i.substring(g,i.length):"",m.fp=s,(Il.test(i)||p)&&(m.e=0),this._pt=m,m},Ou=function(t,e,n,i,r,a,s,o,l,c){Ml(i)&&(i=i(r||0,t,a));var u,h=t[e],d="get"!==n?n:Ml(h)?l?t[e.indexOf("set")||!Ml(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():h,p=Ml(h)?l?ju:Xu:Wu;if(yl(i)&&(~i.indexOf("random(")&&(i=eu(i)),"="===i.charAt(1)&&((u=oc(d,i)+(Gc(d)||0))||0===u)&&(i=u)),!c||d!==i||Iu)return isNaN(d*i)||""===i?(!h&&!(e in t)&&Vl(e,i),Nu.call(this,t,e,d,i,p,o||ul.stringFilter,l)):(u=new ih(this._pt,t,e,+d||0,i-(d||0),"boolean"==typeof h?Zu:Ku,0,p),l&&(u.fp=l),s&&u.modifier(s,this,t),this._pt=u)},Fu=function(t,e,n,i,r,a){var s,o,l,c;if(Zl[t]&&!1!==(s=new Zl[t]).init(r,s.rawVars?e[t]:function(t,e,n,i,r){if(Ml(t)&&(t=Vu(t,r,e,n,i)),!El(t)||t.style&&t.nodeType||Cl(t)||Rl(t))return yl(t)?Vu(t,r,e,n,i):t;var a,s={};for(a in t)s[a]=Vu(t[a],r,e,n,i);return s}(e[t],i,r,a,n),n,i,a)&&(n._pt=o=new ih(n._pt,r,t,0,1,s.render,s,0,s.priority),n!==nl))for(l=n._ptLookup[n._targets.indexOf(r)],c=s._props.length;c--;)l[s._props[c]]=o;return s},Bu=function t(e,n,i){var r,a,s,o,l,c,u,h,d,p,f,m,g,_=e.vars,v=_.ease,x=_.startAt,y=_.immediateRender,M=_.lazy,S=_.onUpdate,T=_.runBackwards,E=_.yoyoEase,b=_.keyframes,w=_.autoRevert,A=e._dur,R=e._startAt,C=e._targets,P=e.parent,L=P&&"nested"===P.data?P.vars.targets:C,D="auto"===e._overwrite&&!qo,U=e.timeline;if(U&&(!b||!v)&&(v="none"),e._ease=bu(v,hl.ease),e._yEase=E?Tu(bu(!0===E?v:E,hl.ease)):0,E&&e._yoyo&&!e._repeat&&(E=e._yEase,e._yEase=e._ease,e._ease=E),e._from=!U&&!!_.runBackwards,!U||b&&!_.stagger){if(m=(h=C[0]?nc(C[0]).harness:0)&&_[h.prop],r=_c(_,ql),R&&(R._zTime<0&&R.progress(1),n<0&&T&&y&&!w?R.render(-1,!0):R.revert(T&&A?Xl:Wl),R._lazy=0),x){if(Mc(e._startAt=Gu.set(C,fc({data:"isStart",overwrite:!1,parent:P,immediateRender:!0,lazy:!R&&bl(M),startAt:null,delay:0,onUpdate:S&&function(){return ru(e,"onUpdate")},stagger:0},x))),e._startAt._dp=0,e._startAt._sat=e,n<0&&(Yo||!y&&!w)&&e._startAt.revert(Xl),y&&A&&n<=0&&i<=0)return void(n&&(e._zTime=n))}else if(T&&A&&!R)if(n&&(y=!1),s=fc({overwrite:!1,data:"isFromStart",lazy:y&&!R&&bl(M),immediateRender:y,stagger:0,parent:P},r),m&&(s[h.prop]=m),Mc(e._startAt=Gu.set(C,s)),e._startAt._dp=0,e._startAt._sat=e,n<0&&(Yo?e._startAt.revert(Xl):e._startAt.render(-1,!0)),e._zTime=n,y){if(!n)return}else t(e._startAt,pl,pl);for(e._pt=e._ptCache=0,M=A&&bl(M)||M&&!A,a=0;a<C.length;a++){if(u=(l=C[a])._gsap||ec(C)[a]._gsap,e._ptLookup[a]=p={},Kl[u.id]&&Yl.length&&cc(),f=L===C?a:L.indexOf(l),h&&!1!==(d=new h).init(l,m||r,e,f,L)&&(e._pt=o=new ih(e._pt,l,d.name,0,1,d.render,d,0,d.priority),d._props.forEach((function(t){p[t]=o})),d.priority&&(c=1)),!h||m)for(s in r)Zl[s]&&(d=Fu(s,r,e,f,l,L))?d.priority&&(c=1):p[s]=o=Ou.call(e,l,s,"get",r[s],f,L,0,_.stringFilter);e._op&&e._op[a]&&e.kill(l,e._op[a]),D&&e._pt&&(Uu=e,Zo.killTweensOf(l,p,e.globalTime(n)),g=!e.parent,Uu=0),e._pt&&M&&(Kl[u.id]=1)}c&&nh(e),e._onInit&&e._onInit(e)}e._onUpdate=S,e._initted=(!e._op||e._pt)&&!g,b&&n<=0&&U.render(dl,!0,!0)},zu=function(t,e,n,i){var r,a,s=e.ease||i||"power1.inOut";if(Cl(e))a=n[t]||(n[t]=[]),e.forEach((function(t,n){return a.push({t:n/(e.length-1)*100,v:t,e:s})}));else for(r in e)a=n[r]||(n[r]=[]),"ease"===r||a.push({t:parseFloat(t),v:e[r],e:s})},Vu=function(t,e,n,i,r){return Ml(t)?t.call(e,n,i,r):yl(t)&&~t.indexOf("random(")?eu(t):t},Hu=tc+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",ku={};rc(Hu+",id,stagger,delay,duration,paused,scrollTrigger",(function(t){return ku[t]=1}));var Gu=function(t){function e(e,n,i,r){var a;"number"==typeof n&&(i.duration=n,n=i,i=null);var s,o,l,c,u,h,d,p,f=(a=t.call(this,r?n:vc(n))||this).vars,m=f.duration,g=f.delay,_=f.immediateRender,v=f.stagger,x=f.overwrite,y=f.keyframes,M=f.defaults,S=f.scrollTrigger,T=f.yoyoEase,E=n.parent||Zo,b=(Cl(e)||Rl(e)?Sl(e[0]):"length"in n)?[e]:qc(e);if(a._targets=b.length?ec(b):Hl("GSAP target "+e+" not found. https://gsap.com",!ul.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=x,y||v||Al(m)||Al(g)){if(n=a.vars,(s=a.timeline=new Du({data:"nested",defaults:M||{},targets:E&&"nested"===E.data?E.vars.targets:b})).kill(),s.parent=s._dp=Xo(a),s._start=0,v||Al(m)||Al(g)){if(c=b.length,d=v&&Zc(v),El(v))for(u in v)~Hu.indexOf(u)&&(p||(p={}),p[u]=v[u]);for(o=0;o<c;o++)(l=_c(n,ku)).stagger=0,T&&(l.yoyoEase=T),p&&mc(l,p),h=b[o],l.duration=+Vu(m,Xo(a),o,h,b),l.delay=(+Vu(g,Xo(a),o,h,b)||0)-a._delay,!v&&1===c&&l.delay&&(a._delay=g=l.delay,a._start+=g,l.delay=0),s.to(h,l,d?d(o,h,b):0),s._ease=xu.none;s.duration()?m=g=0:a.timeline=0}else if(y){vc(fc(s.vars.defaults,{ease:"none"})),s._ease=bu(y.ease||n.ease||"none");var w,A,R,C=0;if(Cl(y))y.forEach((function(t){return s.to(b,t,">")})),s.duration();else{for(u in l={},y)"ease"===u||"easeEach"===u||zu(u,y[u],l,y.easeEach);for(u in l)for(w=l[u].sort((function(t,e){return t.t-e.t})),C=0,o=0;o<w.length;o++)(R={ease:(A=w[o]).e,duration:(A.t-(o?w[o-1].t:0))/100*m})[u]=A.v,s.to(b,R,C),C+=R.duration;s.duration()<m&&s.to({},{duration:m-s.duration()})}}m||a.duration(m=s.duration())}else a.timeline=0;return!0!==x||qo||(Uu=Xo(a),Zo.killTweensOf(b),Uu=0),Lc(E,Xo(a),i),n.reversed&&a.reverse(),n.paused&&a.paused(!0),(_||!m&&!y&&a._start===sc(E._time)&&bl(_)&&Ec(Xo(a))&&"nested"!==E.data)&&(a._tTime=-1e-8,a.render(Math.max(0,-g)||0)),S&&Dc(Xo(a),S),a}jo(e,t);var n=e.prototype;return n.render=function(t,e,n){var i,r,a,s,o,l,c,u,h,d=this._time,p=this._tDur,f=this._dur,m=t<0,g=t>p-pl&&!m?p:t<pl?0:t;if(f){if(g!==this._tTime||!t||n||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==m||this._lazy){if(i=g,u=this.timeline,this._repeat){if(s=f+this._rDelay,this._repeat<-1&&m)return this.totalTime(100*s+t,e,n);if(i=sc(g%s),g===p?(a=this._repeat,i=f):(a=~~(o=sc(g/s)))&&a===o?(i=f,a--):i>f&&(i=f),(l=this._yoyo&&1&a)&&(h=this._yEase,i=f-i),o=wc(this._tTime,s),i===d&&!n&&this._initted&&a===o)return this._tTime=g,this;a!==o&&(u&&this._yEase&&Eu(u,l),this.vars.repeatRefresh&&!l&&!this._lock&&i!==s&&this._initted&&(this._lock=n=1,this.render(sc(s*a),!0).invalidate()._lock=0))}if(!this._initted){if(Uc(this,m?t:i,n,e,g))return this._tTime=0,this;if(!(d===this._time||n&&this.vars.repeatRefresh&&a!==o))return this;if(f!==this._dur)return this.render(t,e,n)}if(this._tTime=g,this._time=i,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=c=(h||this._ease)(i/f),this._from&&(this.ratio=c=1-c),!d&&g&&!e&&!o&&(ru(this,"onStart"),this._tTime!==g))return this;for(r=this._pt;r;)r.r(c,r.d),r=r._next;u&&u.render(t<0?t:u._dur*u._ease(i/this._dur),e,n)||this._startAt&&(this._zTime=t),this._onUpdate&&!e&&(m&&Tc(this,t,0,n),ru(this,"onUpdate")),this._repeat&&a!==o&&this.vars.onRepeat&&!e&&this.parent&&ru(this,"onRepeat"),g!==this._tDur&&g||this._tTime!==g||(m&&!this._onUpdate&&Tc(this,t,0,!0),(t||!f)&&(g===this._tDur&&this._ts>0||!g&&this._ts<0)&&Mc(this,1),e||m&&!d||!(g||d||l)||(ru(this,g===p?"onComplete":"onReverseComplete",!0),this._prom&&!(g<p&&this.timeScale()>0)&&this._prom()))}}else!function(t,e,n,i){var r,a,s,o=t.ratio,l=e<0||!e&&(!t._start&&Ic(t)&&(t._initted||!Nc(t))||(t._ts<0||t._dp._ts<0)&&!Nc(t))?0:1,c=t._rDelay,u=0;if(c&&t._repeat&&(u=kc(0,t._tDur,e),a=wc(u,c),t._yoyo&&1&a&&(l=1-l),a!==wc(t._tTime,c)&&(o=1-l,t.vars.repeatRefresh&&t._initted&&t.invalidate())),l!==o||Yo||i||t._zTime===pl||!e&&t._zTime){if(!t._initted&&Uc(t,e,i,n,u))return;for(s=t._zTime,t._zTime=e||(n?pl:0),n||(n=e&&!s),t.ratio=l,t._from&&(l=1-l),t._time=0,t._tTime=u,r=t._pt;r;)r.r(l,r.d),r=r._next;e<0&&Tc(t,e,0,!0),t._onUpdate&&!n&&ru(t,"onUpdate"),u&&t._repeat&&!n&&t.parent&&ru(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===l&&(l&&Mc(t,1),n||Yo||(ru(t,l?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)}(this,t,e,n);return this},n.targets=function(){return this._targets},n.invalidate=function(e){return(!e||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(e),t.prototype.invalidate.call(this,e)},n.resetTo=function(t,e,n,i,r){il||_u.wake(),this._ts||this.play();var a=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Bu(this,a),function(t,e,n,i,r,a,s,o){var l,c,u,h,d=(t._pt&&t._ptCache||(t._ptCache={}))[e];if(!d)for(d=t._ptCache[e]=[],u=t._ptLookup,h=t._targets.length;h--;){if((l=u[h][e])&&l.d&&l.d._pt)for(l=l.d._pt;l&&l.p!==e&&l.fp!==e;)l=l._next;if(!l)return Iu=1,t.vars[e]="+=0",Bu(t,s),Iu=0,o?Hl(e+" not eligible for reset"):1;d.push(l)}for(h=d.length;h--;)(l=(c=d[h])._pt||c).s=!i&&0!==i||r?l.s+(i||0)+a*l.c:i,l.c=n-l.s,c.e&&(c.e=ac(n)+Gc(c.e)),c.b&&(c.b=l.s+Gc(c.b))}(this,t,e,n,i,this._ease(a/this._dur),a,r)?this.resetTo(t,e,n,i,1):(Cc(this,0),this.parent||xc(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},n.kill=function(t,e){if(void 0===e&&(e="all"),!(t||e&&"all"!==e))return this._lazy=this._pt=0,this.parent?au(this):this.scrollTrigger&&this.scrollTrigger.kill(!!Yo),this;if(this.timeline){var n=this.timeline.totalDuration();return this.timeline.killTweensOf(t,e,Uu&&!0!==Uu.vars.overwrite)._first||au(this),this.parent&&n!==this.timeline.totalDuration()&&Oc(this,this._dur*this.timeline._tDur/n,0,1),this}var i,r,a,s,o,l,c,u=this._targets,h=t?qc(t):u,d=this._ptLookup,p=this._pt;if((!e||"all"===e)&&function(t,e){for(var n=t.length,i=n===e.length;i&&n--&&t[n]===e[n];);return n<0}(u,h))return"all"===e&&(this._pt=0),au(this);for(i=this._op=this._op||[],"all"!==e&&(yl(e)&&(o={},rc(e,(function(t){return o[t]=1})),e=o),e=function(t,e){var n,i,r,a,s=t[0]?nc(t[0]).harness:0,o=s&&s.aliases;if(!o)return e;for(i in n=mc({},e),o)if(i in n)for(r=(a=o[i].split(",")).length;r--;)n[a[r]]=n[i];return n}(u,e)),c=u.length;c--;)if(~h.indexOf(u[c]))for(o in r=d[c],"all"===e?(i[c]=e,s=r,a={}):(a=i[c]=i[c]||{},s=e),s)(l=r&&r[o])&&("kill"in l.d&&!0!==l.d.kill(o)||yc(this,l,"_pt"),delete r[o]),"all"!==a&&(a[o]=1);return this._initted&&!this._pt&&p&&au(this),this},e.to=function(t,n){return new e(t,n,arguments[2])},e.from=function(t,e){return Vc(1,arguments)},e.delayedCall=function(t,n,i,r){return new e(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:n,onReverseComplete:n,onCompleteParams:i,onReverseCompleteParams:i,callbackScope:r})},e.fromTo=function(t,e,n){return Vc(2,arguments)},e.set=function(t,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new e(t,n)},e.killTweensOf=function(t,e,n){return Zo.killTweensOf(t,e,n)},e}(Lu);fc(Gu.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),rc("staggerTo,staggerFrom,staggerFromTo",(function(t){Gu[t]=function(){var e=new Du,n=Wc.call(arguments,0);return n.splice("staggerFromTo"===t?5:4,0,0),e[t].apply(e,n)}}));var Wu=function(t,e,n){return t[e]=n},Xu=function(t,e,n){return t[e](n)},ju=function(t,e,n,i){return t[e](i.fp,n)},qu=function(t,e,n){return t.setAttribute(e,n)},Yu=function(t,e){return Ml(t[e])?Xu:Tl(t[e])&&t.setAttribute?qu:Wu},Ku=function(t,e){return e.set(e.t,e.p,Math.round(1e6*(e.s+e.c*t))/1e6,e)},Zu=function(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},Ju=function(t,e){var n=e._pt,i="";if(!t&&e.b)i=e.b;else if(1===t&&e.e)i=e.e;else{for(;n;)i=n.p+(n.m?n.m(n.s+n.c*t):Math.round(1e4*(n.s+n.c*t))/1e4)+i,n=n._next;i+=e.c}e.set(e.t,e.p,i,e)},$u=function(t,e){for(var n=e._pt;n;)n.r(t,n.d),n=n._next},Qu=function(t,e,n,i){for(var r,a=this._pt;a;)r=a._next,a.p===i&&a.modifier(t,e,n),a=r},th=function(t){for(var e,n,i=this._pt;i;)n=i._next,i.p===t&&!i.op||i.op===t?yc(this,i,"_pt"):i.dep||(e=1),i=n;return!e},eh=function(t,e,n,i){i.mSet(t,e,i.m.call(i.tween,n,i.mt),i)},nh=function(t){for(var e,n,i,r,a=t._pt;a;){for(e=a._next,n=i;n&&n.pr>a.pr;)n=n._next;(a._prev=n?n._prev:r)?a._prev._next=a:i=a,(a._next=n)?n._prev=a:r=a,a=e}t._pt=i},ih=function(){function t(t,e,n,i,r,a,s,o,l){this.t=e,this.s=i,this.c=r,this.p=n,this.r=a||Ku,this.d=s||this,this.set=o||Wu,this.pr=l||0,this._next=t,t&&(t._prev=this)}return t.prototype.modifier=function(t,e,n){this.mSet=this.mSet||this.set,this.set=eh,this.m=t,this.mt=n,this.tween=e},t}();rc(tc+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",(function(t){return ql[t]=1})),Fl.TweenMax=Fl.TweenLite=Gu,Fl.TimelineLite=Fl.TimelineMax=Du,Zo=new Du({sortChildren:!1,defaults:hl,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),ul.stringFilter=gu;var rh=[],ah={},sh=[],oh=0,lh=0,ch=function(t){return(ah[t]||sh).map((function(t){return t()}))},uh=function(){var t=Date.now(),e=[];t-oh>2&&(ch("matchMediaInit"),rh.forEach((function(t){var n,i,r,a,s=t.queries,o=t.conditions;for(i in s)(n=Jo.matchMedia(s[i]).matches)&&(r=1),n!==o[i]&&(o[i]=n,a=1);a&&(t.revert(),r&&e.push(t))})),ch("matchMediaRevert"),e.forEach((function(t){return t.onMatch(t,(function(e){return t.add(null,e)}))})),oh=t,ch("matchMedia"))},hh=function(){function t(t,e){this.selector=e&&Yc(e),this.data=[],this._r=[],this.isReverted=!1,this.id=lh++,t&&this.add(t)}var e=t.prototype;return e.add=function(t,e,n){Ml(t)&&(n=e,e=t,t=Ml);var i=this,r=function(){var t,r=Ko,a=i.selector;return r&&r!==i&&r.data.push(i),n&&(i.selector=Yc(n)),Ko=i,t=e.apply(i,arguments),Ml(t)&&i._r.push(t),Ko=r,i.selector=a,i.isReverted=!1,t};return i.last=r,t===Ml?r(i,(function(t){return i.add(null,t)})):t?i[t]=r:r},e.ignore=function(t){var e=Ko;Ko=null,t(this),Ko=e},e.getTweens=function(){var e=[];return this.data.forEach((function(n){return n instanceof t?e.push.apply(e,n.getTweens()):n instanceof Gu&&!(n.parent&&"nested"===n.parent.data)&&e.push(n)})),e},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(t,e){var n=this;if(t?function(){for(var e,i=n.getTweens(),r=n.data.length;r--;)"isFlip"===(e=n.data[r]).data&&(e.revert(),e.getChildren(!0,!0,!1).forEach((function(t){return i.splice(i.indexOf(t),1)})));for(i.map((function(t){return{g:t._dur||t._delay||t._sat&&!t._sat.vars.immediateRender?t.globalTime(0):-1/0,t}})).sort((function(t,e){return e.g-t.g||-1/0})).forEach((function(e){return e.t.revert(t)})),r=n.data.length;r--;)(e=n.data[r])instanceof Du?"nested"!==e.data&&(e.scrollTrigger&&e.scrollTrigger.revert(),e.kill()):!(e instanceof Gu)&&e.revert&&e.revert(t);n._r.forEach((function(e){return e(t,n)})),n.isReverted=!0}():this.data.forEach((function(t){return t.kill&&t.kill()})),this.clear(),e)for(var i=rh.length;i--;)rh[i].id===this.id&&rh.splice(i,1)},e.revert=function(t){this.kill(t||{})},t}(),dh=function(){function t(t){this.contexts=[],this.scope=t,Ko&&Ko.data.push(this)}var e=t.prototype;return e.add=function(t,e,n){El(t)||(t={matches:t});var i,r,a,s=new hh(0,n||this.scope),o=s.conditions={};for(r in Ko&&!s.selector&&(s.selector=Ko.selector),this.contexts.push(s),e=s.add("onMatch",e),s.queries=t,t)"all"===r?a=1:(i=Jo.matchMedia(t[r]))&&(rh.indexOf(s)<0&&rh.push(s),(o[r]=i.matches)&&(a=1),i.addListener?i.addListener(uh):i.addEventListener("change",uh));return a&&e(s,(function(t){return s.add(null,t)})),this},e.revert=function(t){this.kill(t||{})},e.kill=function(t){this.contexts.forEach((function(e){return e.kill(t,!0)}))},t}(),ph={registerPlugin:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e.forEach((function(t){return ou(t)}))},timeline:function(t){return new Du(t)},getTweensOf:function(t,e){return Zo.getTweensOf(t,e)},getProperty:function(t,e,n,i){yl(t)&&(t=qc(t)[0]);var r=nc(t||{}).get,a=n?pc:dc;return"native"===n&&(n=""),t?e?a((Zl[e]&&Zl[e].get||r)(t,e,n,i)):function(e,n,i){return a((Zl[e]&&Zl[e].get||r)(t,e,n,i))}:t},quickSetter:function(t,e,n){if((t=qc(t)).length>1){var i=t.map((function(t){return gh.quickSetter(t,e,n)})),r=i.length;return function(t){for(var e=r;e--;)i[e](t)}}t=t[0]||{};var a=Zl[e],s=nc(t),o=s.harness&&(s.harness.aliases||{})[e]||e,l=a?function(e){var i=new a;nl._pt=0,i.init(t,n?e+n:e,nl,0,[t]),i.render(1,i),nl._pt&&$u(1,nl)}:s.set(t,o);return a?l:function(e){return l(t,o,n?e+n:e,s,1)}},quickTo:function(t,e,n){var i,r=gh.to(t,fc(((i={})[e]="+=0.1",i.paused=!0,i.stagger=0,i),n||{})),a=function(t,n,i){return r.resetTo(e,t,n,i)};return a.tween=r,a},isTweening:function(t){return Zo.getTweensOf(t,!0).length>0},defaults:function(t){return t&&t.ease&&(t.ease=bu(t.ease,hl.ease)),gc(hl,t||{})},config:function(t){return gc(ul,t||{})},registerEffect:function(t){var e=t.name,n=t.effect,i=t.plugins,r=t.defaults,a=t.extendTimeline;(i||"").split(",").forEach((function(t){return t&&!Zl[t]&&!Fl[t]&&Hl(e+" effect requires "+t+" plugin.")})),Jl[e]=function(t,e,i){return n(qc(t),fc(e||{},r),i)},a&&(Du.prototype[e]=function(t,n,i){return this.add(Jl[e](t,El(n)?n:(i=n)&&{},this),i)})},registerEase:function(t,e){xu[t]=bu(e)},parseEase:function(t,e){return arguments.length?bu(t,e):xu},getById:function(t){return Zo.getById(t)},exportRoot:function(t,e){void 0===t&&(t={});var n,i,r=new Du(t);for(r.smoothChildTiming=bl(t.smoothChildTiming),Zo.remove(r),r._dp=0,r._time=r._tTime=Zo._time,n=Zo._first;n;)i=n._next,!e&&!n._dur&&n instanceof Gu&&n.vars.onComplete===n._targets[0]||Lc(r,n,n._start-n._delay),n=i;return Lc(Zo,r,0),r},context:function(t,e){return t?new hh(t,e):Ko},matchMedia:function(t){return new dh(t)},matchMediaRefresh:function(){return rh.forEach((function(t){var e,n,i=t.conditions;for(n in i)i[n]&&(i[n]=!1,e=1);e&&t.revert()}))||uh()},addEventListener:function(t,e){var n=ah[t]||(ah[t]=[]);~n.indexOf(e)||n.push(e)},removeEventListener:function(t,e){var n=ah[t],i=n&&n.indexOf(e);i>=0&&n.splice(i,1)},utils:{wrap:function t(e,n,i){var r=n-e;return Cl(e)?tu(e,t(0,e.length),n):Hc(i,(function(t){return(r+(t-e)%r)%r+e}))},wrapYoyo:function t(e,n,i){var r=n-e,a=2*r;return Cl(e)?tu(e,t(0,e.length-1),n):Hc(i,(function(t){return e+((t=(a+(t-e)%a)%a||0)>r?a-t:t)}))},distribute:Zc,random:Qc,snap:$c,normalize:function(t,e,n){return nu(t,e,0,1,n)},getUnit:Gc,clamp:function(t,e,n){return Hc(n,(function(n){return kc(t,e,n)}))},splitColor:hu,toArray:qc,selector:Yc,mapRange:nu,pipe:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){return e.reduce((function(t,e){return e(t)}),t)}},unitize:function(t,e){return function(n){return t(parseFloat(n))+(e||Gc(n))}},interpolate:function t(e,n,i,r){var a=isNaN(e+n)?0:function(t){return(1-t)*e+t*n};if(!a){var s,o,l,c,u,h=yl(e),d={};if(!0===i&&(r=1)&&(i=null),h)e={p:e},n={p:n};else if(Cl(e)&&!Cl(n)){for(l=[],c=e.length,u=c-2,o=1;o<c;o++)l.push(t(e[o-1],e[o]));c--,a=function(t){t*=c;var e=Math.min(u,~~t);return l[e](t-e)},i=n}else r||(e=mc(Cl(e)?[]:{},e));if(!l){for(s in n)Ou.call(d,e,s,"get",n[s]);a=function(t){return $u(t,d)||(h?e.p:e)}}}return Hc(i,a)},shuffle:Kc},install:zl,effects:Jl,ticker:_u,updateRoot:Du.updateRoot,plugins:Zl,globalTimeline:Zo,core:{PropTween:ih,globals:kl,Tween:Gu,Timeline:Du,Animation:Lu,getCache:nc,_removeLinkedListItem:yc,reverting:function(){return Yo},context:function(t){return t&&Ko&&(Ko.data.push(t),t._ctx=Ko),Ko},suppressOverwrites:function(t){return qo=t}}};rc("to,from,fromTo,delayedCall,set,killTweensOf",(function(t){return ph[t]=Gu[t]})),_u.add(Du.updateRoot),nl=ph.to({},{duration:0});var fh=function(t,e){for(var n=t._pt;n&&n.p!==e&&n.op!==e&&n.fp!==e;)n=n._next;return n},mh=function(t,e){return{name:t,headless:1,rawVars:1,init:function(t,n,i){i._onInit=function(t){var i,r;if(yl(n)&&(i={},rc(n,(function(t){return i[t]=1})),n=i),e){for(r in i={},n)i[r]=e(n[r]);n=i}!function(t,e){var n,i,r,a=t._targets;for(n in e)for(i=a.length;i--;)(r=t._ptLookup[i][n])&&(r=r.d)&&(r._pt&&(r=fh(r,n)),r&&r.modifier&&r.modifier(e[n],t,a[i],n))}(t,n)}}}},gh=ph.registerPlugin({name:"attr",init:function(t,e,n,i,r){var a,s,o;for(a in this.tween=n,e)o=t.getAttribute(a)||"",(s=this.add(t,"setAttribute",(o||0)+"",e[a],i,r,0,0,a)).op=a,s.b=o,this._props.push(a)},render:function(t,e){for(var n=e._pt;n;)Yo?n.set(n.t,n.p,n.b,n):n.r(t,n.d),n=n._next}},{name:"endArray",headless:1,init:function(t,e){for(var n=e.length;n--;)this.add(t,n,t[n]||0,e[n],0,0,0,0,0,1)}},mh("roundProps",Jc),mh("modifiers"),mh("snap",$c))||ph;Gu.version=Du.version=gh.version="3.13.0",tl=1,wl()&&vu();xu.Power0,xu.Power1,xu.Power2,xu.Power3,xu.Power4,xu.Linear,xu.Quad,xu.Cubic,xu.Quart,xu.Quint,xu.Strong,xu.Elastic,xu.Back,xu.SteppedEase,xu.Bounce,xu.Sine,xu.Expo,xu.Circ;var _h,vh,xh,yh,Mh,Sh,Th,Eh,bh={},wh=180/Math.PI,Ah=Math.PI/180,Rh=Math.atan2,Ch=/([A-Z])/g,Ph=/(left|right|width|margin|padding|x)/i,Lh=/[\s,\(]\S/,Dh={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},Uh=function(t,e){return e.set(e.t,e.p,Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},Ih=function(t,e){return e.set(e.t,e.p,1===t?e.e:Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)},Nh=function(t,e){return e.set(e.t,e.p,t?Math.round(1e4*(e.s+e.c*t))/1e4+e.u:e.b,e)},Oh=function(t,e){var n=e.s+e.c*t;e.set(e.t,e.p,~~(n+(n<0?-.5:.5))+e.u,e)},Fh=function(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)},Bh=function(t,e){return e.set(e.t,e.p,1!==t?e.b:e.e,e)},zh=function(t,e,n){return t.style[e]=n},Vh=function(t,e,n){return t.style.setProperty(e,n)},Hh=function(t,e,n){return t._gsap[e]=n},kh=function(t,e,n){return t._gsap.scaleX=t._gsap.scaleY=n},Gh=function(t,e,n,i,r){var a=t._gsap;a.scaleX=a.scaleY=n,a.renderTransform(r,a)},Wh=function(t,e,n,i,r){var a=t._gsap;a[e]=n,a.renderTransform(r,a)},Xh="transform",jh=Xh+"Origin",qh=function t(e,n){var i=this,r=this.target,a=r.style,s=r._gsap;if(e in bh&&a){if(this.tfm=this.tfm||{},"transform"===e)return Dh.transform.split(",").forEach((function(e){return t.call(i,e,n)}));if(~(e=Dh[e]||e).indexOf(",")?e.split(",").forEach((function(t){return i.tfm[t]=hd(r,t)})):this.tfm[e]=s.x?s[e]:hd(r,e),e===jh&&(this.tfm.zOrigin=s.zOrigin),this.props.indexOf(Xh)>=0)return;s.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push(jh,n,"")),e=Xh}(a||n)&&this.props.push(e,n,a[e])},Yh=function(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))},Kh=function(){var t,e,n=this.props,i=this.target,r=i.style,a=i._gsap;for(t=0;t<n.length;t+=3)n[t+1]?2===n[t+1]?i[n[t]](n[t+2]):i[n[t]]=n[t+2]:n[t+2]?r[n[t]]=n[t+2]:r.removeProperty("--"===n[t].substr(0,2)?n[t]:n[t].replace(Ch,"-$1").toLowerCase());if(this.tfm){for(e in this.tfm)a[e]=this.tfm[e];a.svg&&(a.renderTransform(),i.setAttribute("data-svg-origin",this.svgo||"")),(t=Th())&&t.isStart||r[Xh]||(Yh(r),a.zOrigin&&r[jh]&&(r[jh]+=" "+a.zOrigin+"px",a.zOrigin=0,a.renderTransform()),a.uncache=1)}},Zh=function(t,e){var n={target:t,props:[],revert:Kh,save:qh};return t._gsap||gh.core.getCache(t),e&&t.style&&t.nodeType&&e.split(",").forEach((function(t){return n.save(t)})),n},Jh=function(t,e){var n=vh.createElementNS?vh.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):vh.createElement(t);return n&&n.style?n:vh.createElement(t)},$h=function t(e,n,i){var r=getComputedStyle(e);return r[n]||r.getPropertyValue(n.replace(Ch,"-$1").toLowerCase())||r.getPropertyValue(n)||!i&&t(e,td(n)||n,1)||""},Qh="O,Moz,ms,Ms,Webkit".split(","),td=function(t,e,n){var i=(e||Mh).style,r=5;if(t in i&&!n)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);r--&&!(Qh[r]+t in i););return r<0?null:(3===r?"ms":r>=0?Qh[r]:"")+t},ed=function(){"undefined"!=typeof window&&window.document&&(_h=window,vh=_h.document,xh=vh.documentElement,Mh=Jh("div")||{style:{}},Jh("div"),Xh=td(Xh),jh=Xh+"Origin",Mh.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Eh=!!td("perspective"),Th=gh.core.reverting,yh=1)},nd=function(t){var e,n=t.ownerSVGElement,i=Jh("svg",n&&n.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=t.cloneNode(!0);r.style.display="block",i.appendChild(r),xh.appendChild(i);try{e=r.getBBox()}catch(t){}return i.removeChild(r),xh.removeChild(i),e},id=function(t,e){for(var n=e.length;n--;)if(t.hasAttribute(e[n]))return t.getAttribute(e[n])},rd=function(t){var e,n;try{e=t.getBBox()}catch(i){e=nd(t),n=1}return e&&(e.width||e.height)||n||(e=nd(t)),!e||e.width||e.x||e.y?e:{x:+id(t,["x","cx","x1"])||0,y:+id(t,["y","cy","y1"])||0,width:0,height:0}},ad=function(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!rd(t))},sd=function(t,e){if(e){var n,i=t.style;e in bh&&e!==jh&&(e=Xh),i.removeProperty?("ms"!==(n=e.substr(0,2))&&"webkit"!==e.substr(0,6)||(e="-"+e),i.removeProperty("--"===n?e:e.replace(Ch,"-$1").toLowerCase())):i.removeAttribute(e)}},od=function(t,e,n,i,r,a){var s=new ih(t._pt,e,n,0,1,a?Bh:Fh);return t._pt=s,s.b=i,s.e=r,t._props.push(n),s},ld={deg:1,rad:1,turn:1},cd={grid:1,flex:1},ud=function t(e,n,i,r){var a,s,o,l,c=parseFloat(i)||0,u=(i+"").trim().substr((c+"").length)||"px",h=Mh.style,d=Ph.test(n),p="svg"===e.tagName.toLowerCase(),f=(p?"client":"offset")+(d?"Width":"Height"),m=100,g="px"===r,_="%"===r;if(r===u||!c||ld[r]||ld[u])return c;if("px"!==u&&!g&&(c=t(e,n,i,"px")),l=e.getCTM&&ad(e),(_||"%"===u)&&(bh[n]||~n.indexOf("adius")))return a=l?e.getBBox()[d?"width":"height"]:e[f],ac(_?c/a*m:c/100*a);if(h[d?"width":"height"]=m+(g?u:r),s="rem"!==r&&~n.indexOf("adius")||"em"===r&&e.appendChild&&!p?e:e.parentNode,l&&(s=(e.ownerSVGElement||{}).parentNode),s&&s!==vh&&s.appendChild||(s=vh.body),(o=s._gsap)&&_&&o.width&&d&&o.time===_u.time&&!o.uncache)return ac(c/o.width*m);if(!_||"height"!==n&&"width"!==n)(_||"%"===u)&&!cd[$h(s,"display")]&&(h.position=$h(e,"position")),s===e&&(h.position="static"),s.appendChild(Mh),a=Mh[f],s.removeChild(Mh),h.position="absolute";else{var v=e.style[n];e.style[n]=m+r,a=e[f],v?e.style[n]=v:sd(e,n)}return d&&_&&((o=nc(s)).time=_u.time,o.width=s[f]),ac(g?a*c/m:a&&c?m/a*c:0)},hd=function(t,e,n,i){var r;return yh||ed(),e in Dh&&"transform"!==e&&~(e=Dh[e]).indexOf(",")&&(e=e.split(",")[0]),bh[e]&&"transform"!==e?(r=Sd(t,i),r="transformOrigin"!==e?r[e]:r.svg?r.origin:Td($h(t,jh))+" "+r.zOrigin+"px"):(!(r=t.style[e])||"auto"===r||i||~(r+"").indexOf("calc("))&&(r=md[e]&&md[e](t,e,n)||$h(t,e)||ic(t,e)||("opacity"===e?1:0)),n&&!~(r+"").trim().indexOf(" ")?ud(t,e,r,n)+n:r},dd=function(t,e,n,i){if(!n||"none"===n){var r=td(e,t,1),a=r&&$h(t,r,1);a&&a!==n?(e=r,n=a):"borderColor"===e&&(n=$h(t,"borderTopColor"))}var s,o,l,c,u,h,d,p,f,m,g,_=new ih(this._pt,t.style,e,0,1,Ju),v=0,x=0;if(_.b=n,_.e=i,n+="","var(--"===(i+="").substring(0,6)&&(i=$h(t,i.substring(4,i.indexOf(")")))),"auto"===i&&(h=t.style[e],t.style[e]=i,i=$h(t,e)||i,h?t.style[e]=h:sd(t,e)),gu(s=[n,i]),i=s[1],l=(n=s[0]).match(Dl)||[],(i.match(Dl)||[]).length){for(;o=Dl.exec(i);)d=o[0],f=i.substring(v,o.index),u?u=(u+1)%5:"rgba("!==f.substr(-5)&&"hsla("!==f.substr(-5)||(u=1),d!==(h=l[x++]||"")&&(c=parseFloat(h)||0,g=h.substr((c+"").length),"="===d.charAt(1)&&(d=oc(c,d)+g),p=parseFloat(d),m=d.substr((p+"").length),v=Dl.lastIndex-m.length,m||(m=m||ul.units[e]||g,v===i.length&&(i+=m,_.e+=m)),g!==m&&(c=ud(t,e,h,m)||0),_._pt={_next:_._pt,p:f||1===x?f:",",s:c,c:p-c,m:u&&u<4||"zIndex"===e?Math.round:0});_.c=v<i.length?i.substring(v,i.length):""}else _.r="display"===e&&"none"===i?Bh:Fh;return Il.test(i)&&(_.e=0),this._pt=_,_},pd={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},fd=function(t,e){if(e.tween&&e.tween._time===e.tween._dur){var n,i,r,a=e.t,s=a.style,o=e.u,l=a._gsap;if("all"===o||!0===o)s.cssText="",i=1;else for(r=(o=o.split(",")).length;--r>-1;)n=o[r],bh[n]&&(i=1,n="transformOrigin"===n?jh:Xh),sd(a,n);i&&(sd(a,Xh),l&&(l.svg&&a.removeAttribute("transform"),s.scale=s.rotate=s.translate="none",Sd(a,1),l.uncache=1,Yh(s)))}},md={clearProps:function(t,e,n,i,r){if("isFromStart"!==r.data){var a=t._pt=new ih(t._pt,e,n,0,0,fd);return a.u=i,a.pr=-10,a.tween=r,t._props.push(n),1}}},gd=[1,0,0,1,0,0],_d={},vd=function(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t},xd=function(t){var e=$h(t,Xh);return vd(e)?gd:e.substr(7).match(Ll).map(ac)},yd=function(t,e){var n,i,r,a,s=t._gsap||nc(t),o=t.style,l=xd(t);return s.svg&&t.getAttribute("transform")?"1,0,0,1,0,0"===(l=[(r=t.transform.baseVal.consolidate().matrix).a,r.b,r.c,r.d,r.e,r.f]).join(",")?gd:l:(l!==gd||t.offsetParent||t===xh||s.svg||(r=o.display,o.display="block",(n=t.parentNode)&&(t.offsetParent||t.getBoundingClientRect().width)||(a=1,i=t.nextElementSibling,xh.appendChild(t)),l=xd(t),r?o.display=r:sd(t,"display"),a&&(i?n.insertBefore(t,i):n?n.appendChild(t):xh.removeChild(t))),e&&l.length>6?[l[0],l[1],l[4],l[5],l[12],l[13]]:l)},Md=function(t,e,n,i,r,a){var s,o,l,c=t._gsap,u=r||yd(t,!0),h=c.xOrigin||0,d=c.yOrigin||0,p=c.xOffset||0,f=c.yOffset||0,m=u[0],g=u[1],_=u[2],v=u[3],x=u[4],y=u[5],M=e.split(" "),S=parseFloat(M[0])||0,T=parseFloat(M[1])||0;n?u!==gd&&(o=m*v-g*_)&&(l=S*(-g/o)+T*(m/o)-(m*y-g*x)/o,S=S*(v/o)+T*(-_/o)+(_*y-v*x)/o,T=l):(S=(s=rd(t)).x+(~M[0].indexOf("%")?S/100*s.width:S),T=s.y+(~(M[1]||M[0]).indexOf("%")?T/100*s.height:T)),i||!1!==i&&c.smooth?(x=S-h,y=T-d,c.xOffset=p+(x*m+y*_)-x,c.yOffset=f+(x*g+y*v)-y):c.xOffset=c.yOffset=0,c.xOrigin=S,c.yOrigin=T,c.smooth=!!i,c.origin=e,c.originIsAbsolute=!!n,t.style[jh]="0px 0px",a&&(od(a,c,"xOrigin",h,S),od(a,c,"yOrigin",d,T),od(a,c,"xOffset",p,c.xOffset),od(a,c,"yOffset",f,c.yOffset)),t.setAttribute("data-svg-origin",S+" "+T)},Sd=function(t,e){var n=t._gsap||new Pu(t);if("x"in n&&!e&&!n.uncache)return n;var i,r,a,s,o,l,c,u,h,d,p,f,m,g,_,v,x,y,M,S,T,E,b,w,A,R,C,P,L,D,U,I,N=t.style,O=n.scaleX<0,F="px",B="deg",z=getComputedStyle(t),V=$h(t,jh)||"0";return i=r=a=l=c=u=h=d=p=0,s=o=1,n.svg=!(!t.getCTM||!ad(t)),z.translate&&("none"===z.translate&&"none"===z.scale&&"none"===z.rotate||(N[Xh]=("none"!==z.translate?"translate3d("+(z.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==z.rotate?"rotate("+z.rotate+") ":"")+("none"!==z.scale?"scale("+z.scale.split(" ").join(",")+") ":"")+("none"!==z[Xh]?z[Xh]:"")),N.scale=N.rotate=N.translate="none"),g=yd(t,n.svg),n.svg&&(n.uncache?(A=t.getBBox(),V=n.xOrigin-A.x+"px "+(n.yOrigin-A.y)+"px",w=""):w=!e&&t.getAttribute("data-svg-origin"),Md(t,w||V,!!w||n.originIsAbsolute,!1!==n.smooth,g)),f=n.xOrigin||0,m=n.yOrigin||0,g!==gd&&(y=g[0],M=g[1],S=g[2],T=g[3],i=E=g[4],r=b=g[5],6===g.length?(s=Math.sqrt(y*y+M*M),o=Math.sqrt(T*T+S*S),l=y||M?Rh(M,y)*wh:0,(h=S||T?Rh(S,T)*wh+l:0)&&(o*=Math.abs(Math.cos(h*Ah))),n.svg&&(i-=f-(f*y+m*S),r-=m-(f*M+m*T))):(I=g[6],D=g[7],C=g[8],P=g[9],L=g[10],U=g[11],i=g[12],r=g[13],a=g[14],c=(_=Rh(I,L))*wh,_&&(w=E*(v=Math.cos(-_))+C*(x=Math.sin(-_)),A=b*v+P*x,R=I*v+L*x,C=E*-x+C*v,P=b*-x+P*v,L=I*-x+L*v,U=D*-x+U*v,E=w,b=A,I=R),u=(_=Rh(-S,L))*wh,_&&(v=Math.cos(-_),U=T*(x=Math.sin(-_))+U*v,y=w=y*v-C*x,M=A=M*v-P*x,S=R=S*v-L*x),l=(_=Rh(M,y))*wh,_&&(w=y*(v=Math.cos(_))+M*(x=Math.sin(_)),A=E*v+b*x,M=M*v-y*x,b=b*v-E*x,y=w,E=A),c&&Math.abs(c)+Math.abs(l)>359.9&&(c=l=0,u=180-u),s=ac(Math.sqrt(y*y+M*M+S*S)),o=ac(Math.sqrt(b*b+I*I)),_=Rh(E,b),h=Math.abs(_)>2e-4?_*wh:0,p=U?1/(U<0?-U:U):0),n.svg&&(w=t.getAttribute("transform"),n.forceCSS=t.setAttribute("transform","")||!vd($h(t,Xh)),w&&t.setAttribute("transform",w))),Math.abs(h)>90&&Math.abs(h)<270&&(O?(s*=-1,h+=l<=0?180:-180,l+=l<=0?180:-180):(o*=-1,h+=h<=0?180:-180)),e=e||n.uncache,n.x=i-((n.xPercent=i&&(!e&&n.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-i)?-50:0)))?t.offsetWidth*n.xPercent/100:0)+F,n.y=r-((n.yPercent=r&&(!e&&n.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-r)?-50:0)))?t.offsetHeight*n.yPercent/100:0)+F,n.z=a+F,n.scaleX=ac(s),n.scaleY=ac(o),n.rotation=ac(l)+B,n.rotationX=ac(c)+B,n.rotationY=ac(u)+B,n.skewX=h+B,n.skewY=d+B,n.transformPerspective=p+F,(n.zOrigin=parseFloat(V.split(" ")[2])||!e&&n.zOrigin||0)&&(N[jh]=Td(V)),n.xOffset=n.yOffset=0,n.force3D=ul.force3D,n.renderTransform=n.svg?Pd:Eh?Cd:bd,n.uncache=0,n},Td=function(t){return(t=t.split(" "))[0]+" "+t[1]},Ed=function(t,e,n){var i=Gc(e);return ac(parseFloat(e)+parseFloat(ud(t,"x",n+"px",i)))+i},bd=function(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Cd(t,e)},wd="0deg",Ad="0px",Rd=") ",Cd=function(t,e){var n=e||this,i=n.xPercent,r=n.yPercent,a=n.x,s=n.y,o=n.z,l=n.rotation,c=n.rotationY,u=n.rotationX,h=n.skewX,d=n.skewY,p=n.scaleX,f=n.scaleY,m=n.transformPerspective,g=n.force3D,_=n.target,v=n.zOrigin,x="",y="auto"===g&&t&&1!==t||!0===g;if(v&&(u!==wd||c!==wd)){var M,S=parseFloat(c)*Ah,T=Math.sin(S),E=Math.cos(S);S=parseFloat(u)*Ah,M=Math.cos(S),a=Ed(_,a,T*M*-v),s=Ed(_,s,-Math.sin(S)*-v),o=Ed(_,o,E*M*-v+v)}m!==Ad&&(x+="perspective("+m+Rd),(i||r)&&(x+="translate("+i+"%, "+r+"%) "),(y||a!==Ad||s!==Ad||o!==Ad)&&(x+=o!==Ad||y?"translate3d("+a+", "+s+", "+o+") ":"translate("+a+", "+s+Rd),l!==wd&&(x+="rotate("+l+Rd),c!==wd&&(x+="rotateY("+c+Rd),u!==wd&&(x+="rotateX("+u+Rd),h===wd&&d===wd||(x+="skew("+h+", "+d+Rd),1===p&&1===f||(x+="scale("+p+", "+f+Rd),_.style[Xh]=x||"translate(0, 0)"},Pd=function(t,e){var n,i,r,a,s,o=e||this,l=o.xPercent,c=o.yPercent,u=o.x,h=o.y,d=o.rotation,p=o.skewX,f=o.skewY,m=o.scaleX,g=o.scaleY,_=o.target,v=o.xOrigin,x=o.yOrigin,y=o.xOffset,M=o.yOffset,S=o.forceCSS,T=parseFloat(u),E=parseFloat(h);d=parseFloat(d),p=parseFloat(p),(f=parseFloat(f))&&(p+=f=parseFloat(f),d+=f),d||p?(d*=Ah,p*=Ah,n=Math.cos(d)*m,i=Math.sin(d)*m,r=Math.sin(d-p)*-g,a=Math.cos(d-p)*g,p&&(f*=Ah,s=Math.tan(p-f),r*=s=Math.sqrt(1+s*s),a*=s,f&&(s=Math.tan(f),n*=s=Math.sqrt(1+s*s),i*=s)),n=ac(n),i=ac(i),r=ac(r),a=ac(a)):(n=m,a=g,i=r=0),(T&&!~(u+"").indexOf("px")||E&&!~(h+"").indexOf("px"))&&(T=ud(_,"x",u,"px"),E=ud(_,"y",h,"px")),(v||x||y||M)&&(T=ac(T+v-(v*n+x*r)+y),E=ac(E+x-(v*i+x*a)+M)),(l||c)&&(s=_.getBBox(),T=ac(T+l/100*s.width),E=ac(E+c/100*s.height)),s="matrix("+n+","+i+","+r+","+a+","+T+","+E+")",_.setAttribute("transform",s),S&&(_.style[Xh]=s)},Ld=function(t,e,n,i,r){var a,s,o=360,l=yl(r),c=parseFloat(r)*(l&&~r.indexOf("rad")?wh:1)-i,u=i+c+"deg";return l&&("short"===(a=r.split("_")[1])&&(c%=o)!==c%180&&(c+=c<0?o:-360),"cw"===a&&c<0?c=(c+36e9)%o-~~(c/o)*o:"ccw"===a&&c>0&&(c=(c-36e9)%o-~~(c/o)*o)),t._pt=s=new ih(t._pt,e,n,i,c,Ih),s.e=u,s.u="deg",t._props.push(n),s},Dd=function(t,e){for(var n in e)t[n]=e[n];return t},Ud=function(t,e,n){var i,r,a,s,o,l,c,u=Dd({},n._gsap),h=n.style;for(r in u.svg?(a=n.getAttribute("transform"),n.setAttribute("transform",""),h[Xh]=e,i=Sd(n,1),sd(n,Xh),n.setAttribute("transform",a)):(a=getComputedStyle(n)[Xh],h[Xh]=e,i=Sd(n,1),h[Xh]=a),bh)(a=u[r])!==(s=i[r])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(r)<0&&(o=Gc(a)!==(c=Gc(s))?ud(n,r,a,c):parseFloat(a),l=parseFloat(s),t._pt=new ih(t._pt,i,r,o,l-o,Uh),t._pt.u=c||0,t._props.push(r));Dd(i,u)};rc("padding,margin,Width,Radius",(function(t,e){var n="Top",i="Right",r="Bottom",a="Left",s=(e<3?[n,i,r,a]:[n+a,n+i,r+i,r+a]).map((function(n){return e<2?t+n:"border"+n+t}));md[e>1?"border"+t:t]=function(t,e,n,i,r){var a,o;if(arguments.length<4)return a=s.map((function(e){return hd(t,e,n)})),5===(o=a.join(" ")).split(a[0]).length?a[0]:o;a=(i+"").split(" "),o={},s.forEach((function(t,e){return o[t]=a[e]=a[e]||a[(e-1)/2|0]})),t.init(e,o,r)}}));var Id,Nd,Od,Fd={name:"css",register:ed,targetTest:function(t){return t.style&&t.nodeType},init:function(t,e,n,i,r){var a,s,o,l,c,u,h,d,p,f,m,g,_,v,x,y,M,S,T,E,b=this._props,w=t.style,A=n.vars.startAt;for(h in yh||ed(),this.styles=this.styles||Zh(t),y=this.styles.props,this.tween=n,e)if("autoRound"!==h&&(s=e[h],!Zl[h]||!Fu(h,e,n,i,t,r)))if(c=typeof s,u=md[h],"function"===c&&(c=typeof(s=s.call(n,i,t,r))),"string"===c&&~s.indexOf("random(")&&(s=eu(s)),u)u(this,t,h,s,n)&&(x=1);else if("--"===h.substr(0,2))a=(getComputedStyle(t).getPropertyValue(h)+"").trim(),s+="",fu.lastIndex=0,fu.test(a)||(d=Gc(a),p=Gc(s)),p?d!==p&&(a=ud(t,h,a,p)+p):d&&(s+=d),this.add(w,"setProperty",a,s,i,r,0,0,h),b.push(h),y.push(h,0,w[h]);else if("undefined"!==c){if(A&&h in A?(a="function"==typeof A[h]?A[h].call(n,i,t,r):A[h],yl(a)&&~a.indexOf("random(")&&(a=eu(a)),Gc(a+"")||"auto"===a||(a+=ul.units[h]||Gc(hd(t,h))||""),"="===(a+"").charAt(1)&&(a=hd(t,h))):a=hd(t,h),l=parseFloat(a),(f="string"===c&&"="===s.charAt(1)&&s.substr(0,2))&&(s=s.substr(2)),o=parseFloat(s),h in Dh&&("autoAlpha"===h&&(1===l&&"hidden"===hd(t,"visibility")&&o&&(l=0),y.push("visibility",0,w.visibility),od(this,w,"visibility",l?"inherit":"hidden",o?"inherit":"hidden",!o)),"scale"!==h&&"transform"!==h&&~(h=Dh[h]).indexOf(",")&&(h=h.split(",")[0])),m=h in bh)if(this.styles.save(h),"string"===c&&"var(--"===s.substring(0,6)&&(s=$h(t,s.substring(4,s.indexOf(")"))),o=parseFloat(s)),g||((_=t._gsap).renderTransform&&!e.parseTransform||Sd(t,e.parseTransform),v=!1!==e.smoothOrigin&&_.smooth,(g=this._pt=new ih(this._pt,w,Xh,0,1,_.renderTransform,_,0,-1)).dep=1),"scale"===h)this._pt=new ih(this._pt,_,"scaleY",_.scaleY,(f?oc(_.scaleY,f+o):o)-_.scaleY||0,Uh),this._pt.u=0,b.push("scaleY",h),h+="X";else{if("transformOrigin"===h){y.push(jh,0,w[jh]),S=void 0,T=void 0,E=void 0,S=(M=s).split(" "),T=S[0],E=S[1]||"50%","top"!==T&&"bottom"!==T&&"left"!==E&&"right"!==E||(M=T,T=E,E=M),S[0]=pd[T]||T,S[1]=pd[E]||E,s=S.join(" "),_.svg?Md(t,s,0,v,0,this):((p=parseFloat(s.split(" ")[2])||0)!==_.zOrigin&&od(this,_,"zOrigin",_.zOrigin,p),od(this,w,h,Td(a),Td(s)));continue}if("svgOrigin"===h){Md(t,s,1,v,0,this);continue}if(h in _d){Ld(this,_,h,l,f?oc(l,f+s):s);continue}if("smoothOrigin"===h){od(this,_,"smooth",_.smooth,s);continue}if("force3D"===h){_[h]=s;continue}if("transform"===h){Ud(this,s,t);continue}}else h in w||(h=td(h)||h);if(m||(o||0===o)&&(l||0===l)&&!Lh.test(s)&&h in w)o||(o=0),(d=(a+"").substr((l+"").length))!==(p=Gc(s)||(h in ul.units?ul.units[h]:d))&&(l=ud(t,h,a,p)),this._pt=new ih(this._pt,m?_:w,h,l,(f?oc(l,f+o):o)-l,m||"px"!==p&&"zIndex"!==h||!1===e.autoRound?Uh:Oh),this._pt.u=p||0,d!==p&&"%"!==p&&(this._pt.b=a,this._pt.r=Nh);else if(h in w)dd.call(this,t,h,a,f?f+s:s);else if(h in t)this.add(t,h,a||t[h],f?f+s:s,i,r);else if("parseTransform"!==h){Vl(h,s);continue}m||(h in w?y.push(h,0,w[h]):"function"==typeof t[h]?y.push(h,2,t[h]()):y.push(h,1,a||t[h])),b.push(h)}x&&nh(this)},render:function(t,e){if(e.tween._time||!Th())for(var n=e._pt;n;)n.r(t,n.d),n=n._next;else e.styles.revert()},get:hd,aliases:Dh,getSetter:function(t,e,n){var i=Dh[e];return i&&i.indexOf(",")<0&&(e=i),e in bh&&e!==jh&&(t._gsap.x||hd(t,"x"))?n&&Sh===n?"scale"===e?kh:Hh:(Sh=n||{})&&("scale"===e?Gh:Wh):t.style&&!Tl(t.style[e])?zh:~e.indexOf("-")?Vh:Yu(t,e)},core:{_removeProperty:sd,_getMatrix:yd}};gh.utils.checkPrefix=td,gh.core.getStyleSaver=Zh,Od=rc((Id="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(Nd="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",(function(t){bh[t]=1})),rc(Nd,(function(t){ul.units[t]="deg",_d[t]=1})),Dh[Od[13]]=Id+","+Nd,rc("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",(function(t){var e=t.split(":");Dh[e[1]]=Od[e[0]]})),rc("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",(function(t){ul.units[t]="px"})),gh.registerPlugin(Fd);var Bd=gh.registerPlugin(Fd)||gh;Bd.core.Tween;const zd=({container:t,image:e,speed:n=.05,strength:i=.02,hover:r=!1,light:a,p:s=0})=>{if(!e)return void console.log("No image provided");(new jr).load(e.src,(e=>{const o={uImage:{value:e},uTime:{value:0},uStrength:{value:r?0:i},uLight:{value:a}},l=Wo(t.clientWidth,t.clientHeight);let c;function u(){c&&(l.Scene.remove(c),c.geometry.dispose(),c.material.dispose()),c=function(){const e=t.clientWidth,n=t.clientHeight,i=new Er(e/n*2.3,2.3,100,100),r=new nr({vertexShader:"\nprecision highp float;\n varying vec2 vUv;\n varying vec3 pos;\n uniform float uTime;\n uniform float uStrength;\n\n void main() {\n \n vUv = uv;\n \n vec3 newPosition = position;\n\n \n float waveX = uStrength * sin(10.0 * uv.y + uTime * 2.0);\n float waveY = uStrength * cos(12.0 * uv.x + uTime * 1.5);\n \n float waveZ = uStrength * sin(10.0 * uv.x + uTime * 2.5);\n\n newPosition.x += waveX;\n newPosition.y += waveY;\n newPosition.z += waveZ;\n\n pos = (modelViewMatrix * vec4(newPosition, 1.0)).xyz;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);\n }",fragmentShader:"\nprecision highp float;\n\nvarying vec2 vUv;\nuniform sampler2D uImage;\nuniform float uTime;\n\nuniform float uStrength;\nuniform bool uLight;\n\n\nvoid main() {\n vec2 uv = vUv;\n \n\n \n \n\n // Apply wave distortion\n float waveX = sin(10.0 * uv.y + uTime * 2.0);\n float waveY = cos(10.0 * uv.x + uTime * 2.0);\n uv.x += (uStrength * 0.05) * waveX;\n uv.y += (uStrength * 0.05) * waveY;\n\n \n\n vec4 color = texture2D(uImage, uv);\n if(uLight){\n color.x+=smoothstep(0.001,0.6,sin(2.0*uTime));\n color.y+=smoothstep(0.2,0.6,sin(0.2*uTime));\n }\n \n gl_FragColor = color;\n}\n",uniforms:o,transparent:!0});return new Ki(i,r)}(),l.mesh=c,l.Scene.add(c)}function h(){const e=t.clientWidth,n=t.clientHeight;l.renderer.setSize(e,n),l.renderer.setPixelRatio(window.devicePixelRatio),l.camera.aspect=e/n,l.camera.updateProjectionMatrix(),u()}return l.camera.fov=2*Math.atan(t.clientHeight/2/600)*(180/Math.PI),l.camera.position.z=2.8-s,r&&(t.addEventListener("mouseenter",(()=>{Bd.to(o.uStrength,{value:i,duration:.5,ease:"power2.out"})})),t.addEventListener("mouseleave",(()=>{Bd.to(o.uStrength,{value:0,duration:.5,ease:"power2.out"})}))),t.innerHTML="",t.appendChild(l.renderer.domElement),window.addEventListener("resize",h),h(),function t(){o.uTime.value+=n,l.renderer.render(l.Scene,l.camera),requestAnimationFrame(t)}(),{mesh:l.mesh,geometry:l.geometry,renderer:l.renderer,Scene:l.Scene}}))},Vd="\nprecision highp float;\nuniform vec2 uMouse;\nvarying vec2 vUv;\nuniform sampler2D uImage;\nuniform float uTime;\nuniform float uRadius;\nuniform float uStrength;\nuniform float uNoise;\nuniform bool uLight;\nuniform sampler2D uImage2;\nfloat rand(float n){return fract(sin(n) * 43758.5453123);}\nfloat rand(vec2 n){return fract(sin(dot(n, vec2(12.9898, 4.1414))) * 43758.5453123);}\n\nfloat noise(float p){\n float fl = floor(p);\n float fc = fract(p);\n return mix(rand(fl), rand(fl + 1.0), fc);\n}\n \nfloat noise(vec2 n) {\n const vec2 d = vec2(0.0, 1.0);\n vec2 b = floor(n), f = smoothstep(vec2(0.0), vec2(1.0), fract(n));\n return mix(mix(rand(b), rand(b + d.yx), f.x), mix(rand(b + d.xy), rand(b + d.yy), f.x), f.y);\n}\n\nvoid main() {\n vec2 uv = vUv;\n vec2 guv = vUv;\n guv.x -= 0.5;\n guv.y -= 0.5;\n\n // Calculate distance from mouse\n float dist = length(guv - uMouse);\n\n \n float edgeNoise = noise(guv * 10.0 + uTime * 2.0 ) * uNoise;\n\n // Create mask for area following mouse, with wobbly edge\n float inside = step(dist, uRadius *edgeNoise);\n\n // Apply noise only inside the circle\n float n = noise(guv * 0.2);\n\n vec3 circle = mix(vec3(1.0), vec3(n), inside);\n\n // Apply wave distortion\n float waveX = sin(10.0 * uv.y + uTime * 2.0);\n float waveY = cos(10.0 * uv.x + uTime * 2.0);\n uv.x += (uStrength * 0.05) * waveX;\n uv.y += (uStrength * 0.05) * waveY;\n\n \n\n vec4 color = texture2D(uImage, uv);\n \n vec4 color2 = texture2D(uImage2,uv);\n gl_FragColor = mix(color,(vec4(n)+color2),inside);\n}\n",Hd="\nprecision highp float;\nvarying vec2 vUv; \n\n void main() { \n vUv = uv; \n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }";function kd(t,{speed:e=.02,strength:n=.02,radius:i=.02,hover:r=!1,noise:a=.4,p:s=0}={}){let o=Array.from(t.querySelectorAll("img"));if(!o.length)return void console.log("No image provided");const l={uImage:{value:null},uImage2:{value:null},uTime:{value:0},uStrength:{value:r?0:n},uNoise:{value:a},uMouse:{value:new Se(-10,-10)},uRadius:{value:i}},c=new jr;let u,h=[];o.map(((t,e)=>{c.load(t.src,(t=>{u=0,1==e&&(l.uImage2.value=t),0==e&&(l.uImage.value=t),h.push(t)}))}));const d=Wo(t.clientWidth,t.clientHeight);let p;function f(){p&&(d.Scene.remove(p),p.geometry.dispose(),p.material.dispose()),p=function(){const e=t.clientWidth,n=t.clientHeight,i=new Er(e/n*2.3,2.3,100,100),r=new nr({vertexShader:Hd,fragmentShader:Vd,uniforms:l,transparent:!0});return new Ki(i,r)}(),d.mesh=p,d.Scene.add(p)}function m(){const e=t.clientWidth,n=t.clientHeight;d.renderer.setSize(e,n),d.renderer.setPixelRatio(window.devicePixelRatio),d.camera.aspect=e/n,d.camera.updateProjectionMatrix(),f()}return d.camera.fov=2*Math.atan(t.clientHeight/2/600)*(180/Math.PI),d.camera.position.z=2.8+s,t.addEventListener("mousemove",(function(e){const n=t.getBoundingClientRect(),i=(e.clientX-n.left)/n.width-.5,r=-(e.clientY-n.top)/n.height+.5;Bd.to(l.uMouse.value,{x:i,y:r,duration:.2})})),r&&(t.addEventListener("mouseenter",(()=>{Bd.to(l.uStrength,{value:n,duration:.5,ease:"power2.out"}),Bd.to(l.uRadius,{value:i,duration:.2})})),t.addEventListener("mouseleave",(()=>{Bd.to(l.uStrength,{value:0,duration:.5,ease:"power2.out"}),Bd.to(l.uRadius,{value:-100,duration:.6})}))),t.innerHTML="",t.appendChild(d.renderer.domElement),window.addEventListener("resize",m),m(),function t(){l.uTime.value+=e,d.renderer.render(d.Scene,d.camera),requestAnimationFrame(t)}(),t.addEventListener("click",(()=>{const t=(u+1)%h.length,e=(u+2)%h.length;Bd.to(l.uRadius,{value:2,duration:2,ease:"power2.inOut",onComplete:()=>{l.uImage.value=h[t],l.uImage2.value=h[e],Bd.fromTo(l.uRadius,{value:0},{value:i,duration:2,ease:"power2.inOut"}),u=t}})})),{mesh:d.mesh,geometry:d.geometry,renderer:d.renderer,Scene:d.Scene,currntimageIndex:u}}const Gd="\nvarying vec2 vUv;\nuniform float uTime;\nuniform sampler2D uImage;\nuniform sampler2D uImage2;\nuniform float uX;\nuniform float uY;\nvoid main(){\n vec2 uv = vUv;\n float uvScale=uv.x+uY*uv.y; \n vec4 color1 = texture2D(uImage, uv);\n vec4 color2 = texture2D(uImage2, uv);\n uvScale/= 2.0;\n uv.x=step(uTime,fract(uX*1.0*uvScale) );\n gl_FragColor = mix(color2, color1, uv.x);\n}\n",Wd="\nvarying vec2 vUv;\nvarying vec3 vPosition;\nvoid main() {\n vUv = uv;\n vPosition = position;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";function Xd(t,{x:e=-1,y:n=1,time:i=!1,speed:r=1.2,ttime:a=4,p:s=0,hover:o=!1,target:l=null,ttype:c=0}={}){if(!t)return console.error("No container provided");const u=Array.from(t.querySelectorAll("img"));if(!(u.length>1))return console.error("No images provided, at least two images are required for transition");const h=Wo(t.clientWidth,t.clientHeight),d={uImage:{value:null},uImage2:{value:null},uTime:{value:0},uStrength:{value:.02},uMouse:{value:new Se(-10,-10)},uX:{value:e},uY:{value:n}},p=new jr;let f,m,g=[];function _(){m&&(h.Scene.remove(m),m.geometry.dispose(),m.material.dispose()),m=function(){const e=t.clientWidth,n=t.clientHeight,i=new Er(e/n*2.3,2.3,100,100),r=new nr({vertexShader:Wd,fragmentShader:Gd,uniforms:d,transparent:!0});return new Ki(i,r)}(),h.Scene.add(m)}function v(){const e=t.clientWidth,n=t.clientHeight;h.renderer.setSize(e,n),h.renderer.setPixelRatio(window.devicePixelRatio),h.camera.aspect=e/n,h.camera.updateProjectionMatrix(),_()}if(u.map(((t,e)=>{p.load(t.src,(t=>{f=0,1==e&&(d.uImage2.value=t),0==e&&(d.uImage.value=t),g.push(t)}))})),h.camera.fov=2*Math.atan(t.clientHeight/2/600)*(180/Math.PI),h.camera.position.z=2.7-s,v(),window.addEventListener("resize",v,!1),t.innerHTML="",t.appendChild(h.renderer.domElement),i)Bd.to(d.uTime,{value:1,duration:3,repeat:-1,delay:a,repeatDelay:4,onRepeat:()=>{console.log("Transition completed"),d.uTime.value=0,f=(f+1)%g.length,d.uImage.value=g[f],d.uImage2.value=g[(f+1)%g.length]}});else if(o){let e=!1;t.addEventListener("mouseenter",(()=>{e||(e=!0,Bd.to(d.uTime,{value:1,duration:1.2,onComplete:()=>{d.uTime.value=0,f=(f+1)%g.length,d.uImage.value=g[f],d.uImage2.value=g[(f+1)%g.length],e=!1}}))}))}else l&&Array.isArray(l)&&l.length===u.length&&l.forEach(((t,e)=>{let n;n=c?"click":"mouseenter",t.addEventListener(n,(()=>{console.log(n),f!==e&&Bd.to(d.uTime,{value:1,duration:1.2,onComplete:()=>{d.uTime.value=0,f=e,d.uImage.value=g[f],d.uImage2.value=g[(f+1)%g.length]}})}))}));return function t(){h.renderer.render(h.Scene,h.camera),requestAnimationFrame(t)}(),{assets:h,mesh:m,updateMesh:_}}return e})()));