// source --> http://nsl.com.tr/wp-content/plugins/woody_helper_plugin/elementor/assets/js/lib/countdown.min.js?ver=1 
(function(){var n;(n=jQuery).countdown=function(t,e){var r,o=this;return this.el=t,this.$el=n(t),this.$el.data("countdown",this),this.init=function(){return o.options=n.extend({},n.countdown.defaultOptions,e),o.options.refresh&&(o.interval=setInterval((function(){return o.render()}),o.options.refresh)),o.render(),o},r=function(t){var e,r;return(r=(Date.parse(n.isPlainObject(o.options.date)?o.options.date:new Date(o.options.date))-Date.parse(new Date))/1e3)<=0&&(r=0,o.interval&&o.stop(),o.options.onEnd.apply(o)),e={years:0,days:0,hours:0,min:0,sec:0,millisec:0},r>=86400&&(e.days=Math.floor(r/86400),r-=86400*e.days),r>=3600&&(e.hours=Math.floor(r/3600),r-=3600*e.hours),r>=60&&(e.min=Math.floor(r/60),r-=60*e.min),e.sec=r,e},this.leadingZeros=function(n,t){for(null==t&&(t=2),n=String(n);n.length<t;)n="0"+n;return n},this.update=function(n){return o.options.date=n,o},this.render=function(){return o.options.render.apply(o,[r(o.options.date)]),o},this.stop=function(){return o.interval&&clearInterval(o.interval),o.interval=null,o},this.start=function(t){return null==t&&(t=o.options.refresh||n.countdown.defaultOptions.refresh),o.interval&&clearInterval(o.interval),o.render(),o.options.refresh=t,o.interval=setInterval((function(){return o.render()}),o.options.refresh),o},this.init()},n.countdown.defaultOptions={date:"June 7, 2087 15:03:25",refresh:1e3,onEnd:n.noop,render:function(t){return n(this.el).html(t.years+" years, "+t.days+" days, "+this.leadingZeros(t.hours)+" hours, "+this.leadingZeros(t.min)+" min and "+this.leadingZeros(t.sec)+" sec")}},n.fn.countdown=function(t){return n.each(this,(function(e,r){var o;if(!(o=n(r)).data("countdown"))return o.data("countdown",new n.countdown(r,t))}))}}).call(this);
// source --> http://nsl.com.tr/wp-content/plugins/woody_helper_plugin/elementor/assets/js/lib/gsap.min.js?ver=1 
/*!
 * GSAP 3.12.5
 * https://gsap.com
 * 
 * @license Copyright 2024, GreenSock. All rights reserved.
 * Subject to the terms at https://gsap.com/standard-license or for Club GSAP members, the agreement issued with that membership.
 * @author: Jack Doyle, jack@greensock.com
 */

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).window=t.window||{})}(this,function(e){"use strict";function _inheritsLoose(t,e){t.prototype=Object.create(e.prototype),(t.prototype.constructor=t).__proto__=e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function r(t){return"string"==typeof t}function s(t){return"function"==typeof t}function t(t){return"number"==typeof t}function u(t){return void 0===t}function v(t){return"object"==typeof t}function w(t){return!1!==t}function x(){return"undefined"!=typeof window}function y(t){return s(t)||r(t)}function P(t){return(i=yt(t,ot))&&ze}function Q(t,e){return console.warn("Invalid property",t,"set to",e,"Missing plugin? gsap.registerPlugin()")}function R(t,e){return!e&&console.warn(t)}function S(t,e){return t&&(ot[t]=e)&&i&&(i[t]=e)||ot}function T(){return 0}function ea(t){var e,r,i=t[0];if(v(i)||s(i)||(t=[t]),!(e=(i._gsap||{}).harness)){for(r=gt.length;r--&&!gt[r].targetTest(i););e=gt[r]}for(r=t.length;r--;)t[r]&&(t[r]._gsap||(t[r]._gsap=new Vt(t[r],e)))||t.splice(r,1);return t}function fa(t){return t._gsap||ea(Mt(t))[0]._gsap}function ga(t,e,r){return(r=t[e])&&s(r)?t[e]():u(r)&&t.getAttribute&&t.getAttribute(e)||r}function ha(t,e){return(t=t.split(",")).forEach(e)||t}function ia(t){return Math.round(1e5*t)/1e5||0}function ja(t){return Math.round(1e7*t)/1e7||0}function ka(t,e){var r=e.charAt(0),i=parseFloat(e.substr(2));return t=parseFloat(t),"+"===r?t+i:"-"===r?t-i:"*"===r?t*i:t/i}function la(t,e){for(var r=e.length,i=0;t.indexOf(e[i])<0&&++i<r;);return i<r}function ma(){var t,e,r=dt.length,i=dt.slice(0);for(ct={},t=dt.length=0;t<r;t++)(e=i[t])&&e._lazy&&(e.render(e._lazy[0],e._lazy[1],!0)._lazy=0)}function na(t,e,r,i){dt.length&&!L&&ma(),t.render(e,r,i||L&&e<0&&(t._initted||t._startAt)),dt.length&&!L&&ma()}function oa(t){var e=parseFloat(t);return(e||0===e)&&(t+"").match(at).length<2?e:r(t)?t.trim():t}function pa(t){return t}function qa(t,e){for(var r in e)r in t||(t[r]=e[r]);return t}function ta(t,e){for(var r in e)"__proto__"!==r&&"constructor"!==r&&"prototype"!==r&&(t[r]=v(e[r])?ta(t[r]||(t[r]={}),e[r]):e[r]);return t}function ua(t,e){var r,i={};for(r in t)r in e||(i[r]=t[r]);return i}function va(t){var e=t.parent||I,r=t.keyframes?function _setKeyframeDefaults(i){return function(t,e){for(var r in e)r in t||"duration"===r&&i||"ease"===r||(t[r]=e[r])}}(Z(t.keyframes)):qa;if(w(t.inherit))for(;e;)r(t,e.vars.defaults),e=e.parent||e._dp;return t}function xa(t,e,r,i,n){void 0===r&&(r="_first"),void 0===i&&(i="_last");var a,s=t[i];if(n)for(a=e[n];s&&s[n]>a;)s=s._prev;return s?(e._next=s._next,s._next=e):(e._next=t[r],t[r]=e),e._next?e._next._prev=e:t[i]=e,e._prev=s,e.parent=e._dp=t,e}function ya(t,e,r,i){void 0===r&&(r="_first"),void 0===i&&(i="_last");var n=e._prev,a=e._next;n?n._next=a:t[r]===e&&(t[r]=a),a?a._prev=n:t[i]===e&&(t[i]=n),e._next=e._prev=e.parent=null}function za(t,e){t.parent&&(!e||t.parent.autoRemoveChildren)&&t.parent.remove&&t.parent.remove(t),t._act=0}function Aa(t,e){if(t&&(!e||e._end>t._dur||e._start<0))for(var r=t;r;)r._dirty=1,r=r.parent;return t}function Ca(t,e,r,i){return t._startAt&&(L?t._startAt.revert(ht):t.vars.immediateRender&&!t.vars.autoRevert||t._startAt.render(e,!0,i))}function Ea(t){return t._repeat?Tt(t._tTime,t=t.duration()+t._rDelay)*t:0}function Ga(t,e){return(t-e._start)*e._ts+(0<=e._ts?0:e._dirty?e.totalDuration():e._tDur)}function Ha(t){return t._end=ja(t._start+(t._tDur/Math.abs(t._ts||t._rts||X)||0))}function Ia(t,e){var r=t._dp;return r&&r.smoothChildTiming&&t._ts&&(t._start=ja(r._time-(0<t._ts?e/t._ts:((t._dirty?t.totalDuration():t._tDur)-e)/-t._ts)),Ha(t),r._dirty||Aa(r,t)),t}function Ja(t,e){var r;if((e._time||!e._dur&&e._initted||e._start<t._time&&(e._dur||!e.add))&&(r=Ga(t.rawTime(),e),(!e._dur||Ot(0,e.totalDuration(),r)-e._tTime>X)&&e.render(r,!0)),Aa(t,e)._dp&&t._initted&&t._time>=t._dur&&t._ts){if(t._dur<t.duration())for(r=t;r._dp;)0<=r.rawTime()&&r.totalTime(r._tTime),r=r._dp;t._zTime=-X}}function Ka(e,r,i,n){return r.parent&&za(r),r._start=ja((t(i)?i:i||e!==I?xt(e,i,r):e._time)+r._delay),r._end=ja(r._start+(r.totalDuration()/Math.abs(r.timeScale())||0)),xa(e,r,"_first","_last",e._sort?"_start":0),bt(r)||(e._recent=r),n||Ja(e,r),e._ts<0&&Ia(e,e._tTime),e}function La(t,e){return(ot.ScrollTrigger||Q("scrollTrigger",e))&&ot.ScrollTrigger.create(e,t)}function Ma(t,e,r,i,n){return Qt(t,e,n),t._initted?!r&&t._pt&&!L&&(t._dur&&!1!==t.vars.lazy||!t._dur&&t.vars.lazy)&&f!==Rt.frame?(dt.push(t),t._lazy=[n,i],1):void 0:1}function Ra(t,e,r,i){var n=t._repeat,a=ja(e)||0,s=t._tTime/t._tDur;return s&&!i&&(t._time*=a/t._dur),t._dur=a,t._tDur=n?n<0?1e10:ja(a*(n+1)+t._rDelay*n):a,0<s&&!i&&Ia(t,t._tTime=t._tDur*s),t.parent&&Ha(t),r||Aa(t.parent,t),t}function Sa(t){return t instanceof Xt?Aa(t):Ra(t,t._dur)}function Va(e,r,i){var n,a,s=t(r[1]),o=(s?2:1)+(e<2?0:1),u=r[o];if(s&&(u.duration=r[1]),u.parent=i,e){for(n=u,a=i;a&&!("immediateRender"in n);)n=a.vars.defaults||{},a=w(a.vars.inherit)&&a.parent;u.immediateRender=w(n.immediateRender),e<2?u.runBackwards=1:u.startAt=r[o-1]}return new $t(r[0],u,r[1+o])}function Wa(t,e){return t||0===t?e(t):e}function Ya(t,e){return r(t)&&(e=st.exec(t))?e[1]:""}function _a(t,e){return t&&v(t)&&"length"in t&&(!e&&!t.length||t.length-1 in t&&v(t[0]))&&!t.nodeType&&t!==h}function cb(r){return r=Mt(r)[0]||R("Invalid scope")||{},function(t){var e=r.current||r.nativeElement||r;return Mt(t,e.querySelectorAll?e:e===r?R("Invalid scope")||a.createElement("div"):r)}}function db(t){return t.sort(function(){return.5-Math.random()})}function eb(t){if(s(t))return t;var p=v(t)?t:{each:t},_=jt(p.ease),m=p.from||0,g=parseFloat(p.base)||0,y={},e=0<m&&m<1,T=isNaN(m)||e,b=p.axis,w=m,x=m;return r(m)?w=x={center:.5,edges:.5,end:1}[m]||0:!e&&T&&(w=m[0],x=m[1]),function(t,e,r){var i,n,a,s,o,u,h,l,f,d=(r||p).length,c=y[d];if(!c){if(!(f="auto"===p.grid?0:(p.grid||[1,U])[1])){for(h=-U;h<(h=r[f++].getBoundingClientRect().left)&&f<d;);f<d&&f--}for(c=y[d]=[],i=T?Math.min(f,d)*w-.5:m%f,n=f===U?0:T?d*x/f-.5:m/f|0,l=U,u=h=0;u<d;u++)a=u%f-i,s=n-(u/f|0),c[u]=o=b?Math.abs("y"===b?s:a):K(a*a+s*s),h<o&&(h=o),o<l&&(l=o);"random"===m&&db(c),c.max=h-l,c.min=l,c.v=d=(parseFloat(p.amount)||parseFloat(p.each)*(d<f?d-1:b?"y"===b?d/f:f:Math.max(f,d/f))||0)*("edges"===m?-1:1),c.b=d<0?g-d:g,c.u=Ya(p.amount||p.each)||0,_=_&&d<0?Yt(_):_}return d=(c[t]-c.min)/c.max||0,ja(c.b+(_?_(d):d)*c.v)+c.u}}function fb(i){var n=Math.pow(10,((i+"").split(".")[1]||"").length);return function(e){var r=ja(Math.round(parseFloat(e)/i)*i*n);return(r-r%1)/n+(t(e)?0:Ya(e))}}function gb(h,e){var l,f,r=Z(h);return!r&&v(h)&&(l=r=h.radius||U,h.values?(h=Mt(h.values),(f=!t(h[0]))&&(l*=l)):h=fb(h.increment)),Wa(e,r?s(h)?function(t){return f=h(t),Math.abs(f-t)<=l?f:t}:function(e){for(var r,i,n=parseFloat(f?e.x:e),a=parseFloat(f?e.y:0),s=U,o=0,u=h.length;u--;)(r=f?(r=h[u].x-n)*r+(i=h[u].y-a)*i:Math.abs(h[u]-n))<s&&(s=r,o=u);return o=!l||s<=l?h[o]:e,f||o===e||t(e)?o:o+Ya(e)}:fb(h))}function hb(t,e,r,i){return Wa(Z(t)?!e:!0===r?!!(r=0):!i,function(){return Z(t)?t[~~(Math.random()*t.length)]:(r=r||1e-5)&&(i=r<1?Math.pow(10,(r+"").length-2):1)&&Math.floor(Math.round((t-r/2+Math.random()*(e-t+.99*r))/r)*r*i)/i})}function lb(e,r,t){return Wa(t,function(t){return e[~~r(t)]})}function ob(t){for(var e,r,i,n,a=0,s="";~(e=t.indexOf("random(",a));)i=t.indexOf(")",e),n="["===t.charAt(e+7),r=t.substr(e+7,i-e-7).match(n?at:tt),s+=t.substr(a,e-a)+hb(n?r:+r[0],n?0:+r[1],+r[2]||1e-5),a=i+1;return s+t.substr(a,t.length-a)}function rb(t,e,r){var i,n,a,s=t.labels,o=U;for(i in s)(n=s[i]-e)<0==!!r&&n&&o>(n=Math.abs(n))&&(a=i,o=n);return a}function tb(t){return za(t),t.scrollTrigger&&t.scrollTrigger.kill(!!L),t.progress()<1&&Ct(t,"onInterrupt"),t}function wb(t){if(t)if(t=!t.name&&t.default||t,x()||t.headless){var e=t.name,r=s(t),i=e&&!r&&t.init?function(){this._props=[]}:t,n={init:T,render:he,add:Wt,kill:ce,modifier:fe,rawVars:0},a={targetTest:0,get:0,getSetter:ne,aliases:{},register:0};if(Ft(),t!==i){if(pt[e])return;qa(i,qa(ua(t,n),a)),yt(i.prototype,yt(n,ua(t,a))),pt[i.prop=e]=i,t.targetTest&&(gt.push(i),ft[e]=1),e=("css"===e?"CSS":e.charAt(0).toUpperCase()+e.substr(1))+"Plugin"}S(e,i),t.register&&t.register(ze,i,_e)}else At.push(t)}function zb(t,e,r){return(6*(t+=t<0?1:1<t?-1:0)<1?e+(r-e)*t*6:t<.5?r:3*t<2?e+(r-e)*(2/3-t)*6:e)*St+.5|0}function Ab(e,r,i){var n,a,s,o,u,h,l,f,d,c,p=e?t(e)?[e>>16,e>>8&St,e&St]:0:zt.black;if(!p){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),zt[e])p=zt[e];else if("#"===e.charAt(0)){if(e.length<6&&(e="#"+(n=e.charAt(1))+n+(a=e.charAt(2))+a+(s=e.charAt(3))+s+(5===e.length?e.charAt(4)+e.charAt(4):"")),9===e.length)return[(p=parseInt(e.substr(1,6),16))>>16,p>>8&St,p&St,parseInt(e.substr(7),16)/255];p=[(e=parseInt(e.substr(1),16))>>16,e>>8&St,e&St]}else if("hsl"===e.substr(0,3))if(p=c=e.match(tt),r){if(~e.indexOf("="))return p=e.match(et),i&&p.length<4&&(p[3]=1),p}else o=+p[0]%360/360,u=p[1]/100,n=2*(h=p[2]/100)-(a=h<=.5?h*(u+1):h+u-h*u),3<p.length&&(p[3]*=1),p[0]=zb(o+1/3,n,a),p[1]=zb(o,n,a),p[2]=zb(o-1/3,n,a);else p=e.match(tt)||zt.transparent;p=p.map(Number)}return r&&!c&&(n=p[0]/St,a=p[1]/St,s=p[2]/St,h=((l=Math.max(n,a,s))+(f=Math.min(n,a,s)))/2,l===f?o=u=0:(d=l-f,u=.5<h?d/(2-l-f):d/(l+f),o=l===n?(a-s)/d+(a<s?6:0):l===a?(s-n)/d+2:(n-a)/d+4,o*=60),p[0]=~~(o+.5),p[1]=~~(100*u+.5),p[2]=~~(100*h+.5)),i&&p.length<4&&(p[3]=1),p}function Bb(t){var r=[],i=[],n=-1;return t.split(Et).forEach(function(t){var e=t.match(rt)||[];r.push.apply(r,e),i.push(n+=e.length+1)}),r.c=i,r}function Cb(t,e,r){var i,n,a,s,o="",u=(t+o).match(Et),h=e?"hsla(":"rgba(",l=0;if(!u)return t;if(u=u.map(function(t){return(t=Ab(t,e,1))&&h+(e?t[0]+","+t[1]+"%,"+t[2]+"%,"+t[3]:t.join(","))+")"}),r&&(a=Bb(t),(i=r.c).join(o)!==a.c.join(o)))for(s=(n=t.replace(Et,"1").split(rt)).length-1;l<s;l++)o+=n[l]+(~i.indexOf(l)?u.shift()||h+"0,0,0,0)":(a.length?a:u.length?u:r).shift());if(!n)for(s=(n=t.split(Et)).length-1;l<s;l++)o+=n[l]+u[l];return o+n[s]}function Fb(t){var e,r=t.join(" ");if(Et.lastIndex=0,Et.test(r))return e=Dt.test(r),t[1]=Cb(t[1],e),t[0]=Cb(t[0],e,Bb(t[1])),!0}function Ob(t){var e=(t+"").split("("),r=Lt[e[0]];return r&&1<e.length&&r.config?r.config.apply(null,~t.indexOf("{")?[function _parseObjectInString(t){for(var e,r,i,n={},a=t.substr(1,t.length-3).split(":"),s=a[0],o=1,u=a.length;o<u;o++)r=a[o],e=o!==u-1?r.lastIndexOf(","):r.length,i=r.substr(0,e),n[s]=isNaN(i)?i.replace(Bt,"").trim():+i,s=r.substr(e+1).trim();return n}(e[1])]:function _valueInParentheses(t){var e=t.indexOf("(")+1,r=t.indexOf(")"),i=t.indexOf("(",e);return t.substring(e,~i&&i<r?t.indexOf(")",r+1):r)}(t).split(",").map(oa)):Lt._CE&&It.test(t)?Lt._CE("",t):r}function Qb(t,e){for(var r,i=t._first;i;)i instanceof Xt?Qb(i,e):!i.vars.yoyoEase||i._yoyo&&i._repeat||i._yoyo===e||(i.timeline?Qb(i.timeline,e):(r=i._ease,i._ease=i._yEase,i._yEase=r,i._yoyo=e)),i=i._next}function Sb(t,e,r,i){void 0===r&&(r=function easeOut(t){return 1-e(1-t)}),void 0===i&&(i=function easeInOut(t){return t<.5?e(2*t)/2:1-e(2*(1-t))/2});var n,a={easeIn:e,easeOut:r,easeInOut:i};return ha(t,function(t){for(var e in Lt[t]=ot[t]=a,Lt[n=t.toLowerCase()]=r,a)Lt[n+("easeIn"===e?".in":"easeOut"===e?".out":".inOut")]=Lt[t+"."+e]=a[e]}),a}function Tb(e){return function(t){return t<.5?(1-e(1-2*t))/2:.5+e(2*(t-.5))/2}}function Ub(r,t,e){function Jm(t){return 1===t?1:i*Math.pow(2,-10*t)*H((t-a)*n)+1}var i=1<=t?t:1,n=(e||(r?.3:.45))/(t<1?t:1),a=n/N*(Math.asin(1/i)||0),s="out"===r?Jm:"in"===r?function(t){return 1-Jm(1-t)}:Tb(Jm);return n=N/n,s.config=function(t,e){return Ub(r,t,e)},s}function Vb(e,r){function Rm(t){return t?--t*t*((r+1)*t+r)+1:0}void 0===r&&(r=1.70158);var t="out"===e?Rm:"in"===e?function(t){return 1-Rm(1-t)}:Tb(Rm);return t.config=function(t){return Vb(e,t)},t}var F,L,l,I,h,n,a,i,o,f,d,c,p,_,m,g,b,O,k,M,C,A,z,E,D,B,Y,j,q={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},V={duration:.5,overwrite:!1,delay:0},U=1e8,X=1/U,N=2*Math.PI,G=N/4,W=0,K=Math.sqrt,J=Math.cos,H=Math.sin,$="function"==typeof ArrayBuffer&&ArrayBuffer.isView||function(){},Z=Array.isArray,tt=/(?:-?\.?\d|\.)+/gi,et=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,rt=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,it=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,nt=/[+-]=-?[.\d]+/,at=/[^,'"\[\]\s]+/gi,st=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,ot={},ut={suppressEvents:!0,isStart:!0,kill:!1},ht={suppressEvents:!0,kill:!1},lt={suppressEvents:!0},ft={},dt=[],ct={},pt={},_t={},mt=30,gt=[],vt="",yt=function _merge(t,e){for(var r in e)t[r]=e[r];return t},Tt=function _animationCycle(t,e){var r=Math.floor(t/=e);return t&&r===t?r-1:r},bt=function _isFromOrFromStart(t){var e=t.data;return"isFromStart"===e||"isStart"===e},wt={_start:0,endTime:T,totalDuration:T},xt=function _parsePosition(t,e,i){var n,a,s,o=t.labels,u=t._recent||wt,h=t.duration()>=U?u.endTime(!1):t._dur;return r(e)&&(isNaN(e)||e in o)?(a=e.charAt(0),s="%"===e.substr(-1),n=e.indexOf("="),"<"===a||">"===a?(0<=n&&(e=e.replace(/=/,"")),("<"===a?u._start:u.endTime(0<=u._repeat))+(parseFloat(e.substr(1))||0)*(s?(n<0?u:i).totalDuration()/100:1)):n<0?(e in o||(o[e]=h),o[e]):(a=parseFloat(e.charAt(n-1)+e.substr(n+1)),s&&i&&(a=a/100*(Z(i)?i[0]:i).totalDuration()),1<n?_parsePosition(t,e.substr(0,n-1),i)+a:h+a)):null==e?h:+e},Ot=function _clamp(t,e,r){return r<t?t:e<r?e:r},kt=[].slice,Mt=function toArray(t,e,i){return l&&!e&&l.selector?l.selector(t):!r(t)||i||!n&&Ft()?Z(t)?function _flatten(t,e,i){return void 0===i&&(i=[]),t.forEach(function(t){return r(t)&&!e||_a(t,1)?i.push.apply(i,Mt(t)):i.push(t)})||i}(t,i):_a(t)?kt.call(t,0):t?[t]:[]:kt.call((e||a).querySelectorAll(t),0)},Pt=function mapRange(e,t,r,i,n){var a=t-e,s=i-r;return Wa(n,function(t){return r+((t-e)/a*s||0)})},Ct=function _callback(t,e,r){var i,n,a,s=t.vars,o=s[e],u=l,h=t._ctx;if(o)return i=s[e+"Params"],n=s.callbackScope||t,r&&dt.length&&ma(),h&&(l=h),a=i?o.apply(n,i):o.call(n),l=u,a},At=[],St=255,zt={aqua:[0,St,St],lime:[0,St,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,St],navy:[0,0,128],white:[St,St,St],olive:[128,128,0],yellow:[St,St,0],orange:[St,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[St,0,0],pink:[St,192,203],cyan:[0,St,St],transparent:[St,St,St,0]},Et=function(){var t,e="(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b";for(t in zt)e+="|"+t+"\\b";return new RegExp(e+")","gi")}(),Dt=/hsl[a]?\(/,Rt=(k=Date.now,M=500,C=33,A=k(),z=A,D=E=1e3/240,g={time:0,frame:0,tick:function tick(){yl(!0)},deltaRatio:function deltaRatio(t){return b/(1e3/(t||60))},wake:function wake(){o&&(!n&&x()&&(h=n=window,a=h.document||{},ot.gsap=ze,(h.gsapVersions||(h.gsapVersions=[])).push(ze.version),P(i||h.GreenSockGlobals||!h.gsap&&h||{}),At.forEach(wb)),m="undefined"!=typeof requestAnimationFrame&&requestAnimationFrame,p&&g.sleep(),_=m||function(t){return setTimeout(t,D-1e3*g.time+1|0)},c=1,yl(2))},sleep:function sleep(){(m?cancelAnimationFrame:clearTimeout)(p),c=0,_=T},lagSmoothing:function lagSmoothing(t,e){M=t||1/0,C=Math.min(e||33,M)},fps:function fps(t){E=1e3/(t||240),D=1e3*g.time+E},add:function add(n,t,e){var a=t?function(t,e,r,i){n(t,e,r,i),g.remove(a)}:n;return g.remove(n),B[e?"unshift":"push"](a),Ft(),a},remove:function remove(t,e){~(e=B.indexOf(t))&&B.splice(e,1)&&e<=O&&O--},_listeners:B=[]}),Ft=function _wake(){return!c&&Rt.wake()},Lt={},It=/^[\d.\-M][\d.\-,\s]/,Bt=/["']/g,Yt=function _invertEase(e){return function(t){return 1-e(1-t)}},jt=function _parseEase(t,e){return t&&(s(t)?t:Lt[t]||Ob(t))||e};function yl(t){var e,r,i,n,a=k()-z,s=!0===t;if((M<a||a<0)&&(A+=a-C),(0<(e=(i=(z+=a)-A)-D)||s)&&(n=++g.frame,b=i-1e3*g.time,g.time=i/=1e3,D+=e+(E<=e?4:E-e),r=1),s||(p=_(yl)),r)for(O=0;O<B.length;O++)B[O](i,b,n,t)}function gn(t){return t<j?Y*t*t:t<.7272727272727273?Y*Math.pow(t-1.5/2.75,2)+.75:t<.9090909090909092?Y*(t-=2.25/2.75)*t+.9375:Y*Math.pow(t-2.625/2.75,2)+.984375}ha("Linear,Quad,Cubic,Quart,Quint,Strong",function(t,e){var r=e<5?e+1:e;Sb(t+",Power"+(r-1),e?function(t){return Math.pow(t,r)}:function(t){return t},function(t){return 1-Math.pow(1-t,r)},function(t){return t<.5?Math.pow(2*t,r)/2:1-Math.pow(2*(1-t),r)/2})}),Lt.Linear.easeNone=Lt.none=Lt.Linear.easeIn,Sb("Elastic",Ub("in"),Ub("out"),Ub()),Y=7.5625,j=1/2.75,Sb("Bounce",function(t){return 1-gn(1-t)},gn),Sb("Expo",function(t){return t?Math.pow(2,10*(t-1)):0}),Sb("Circ",function(t){return-(K(1-t*t)-1)}),Sb("Sine",function(t){return 1===t?1:1-J(t*G)}),Sb("Back",Vb("in"),Vb("out"),Vb()),Lt.SteppedEase=Lt.steps=ot.SteppedEase={config:function config(t,e){void 0===t&&(t=1);var r=1/t,i=t+(e?0:1),n=e?1:0;return function(t){return((i*Ot(0,.99999999,t)|0)+n)*r}}},V.ease=Lt["quad.out"],ha("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt",function(t){return vt+=t+","+t+"Params,"});var qt,Vt=function GSCache(t,e){this.id=W++,(t._gsap=this).target=t,this.harness=e,this.get=e?e.get:ga,this.set=e?e.getSetter:ne},Ut=((qt=Animation.prototype).delay=function delay(t){return t||0===t?(this.parent&&this.parent.smoothChildTiming&&this.startTime(this._start+t-this._delay),this._delay=t,this):this._delay},qt.duration=function duration(t){return arguments.length?this.totalDuration(0<this._repeat?t+(t+this._rDelay)*this._repeat:t):this.totalDuration()&&this._dur},qt.totalDuration=function totalDuration(t){return arguments.length?(this._dirty=0,Ra(this,this._repeat<0?t:(t-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},qt.totalTime=function totalTime(t,e){if(Ft(),!arguments.length)return this._tTime;var r=this._dp;if(r&&r.smoothChildTiming&&this._ts){for(Ia(this,t),!r._dp||r.parent||Ja(r,this);r&&r.parent;)r.parent._time!==r._start+(0<=r._ts?r._tTime/r._ts:(r.totalDuration()-r._tTime)/-r._ts)&&r.totalTime(r._tTime,!0),r=r.parent;!this.parent&&this._dp.autoRemoveChildren&&(0<this._ts&&t<this._tDur||this._ts<0&&0<t||!this._tDur&&!t)&&Ka(this._dp,this,this._start-this._delay)}return(this._tTime!==t||!this._dur&&!e||this._initted&&Math.abs(this._zTime)===X||!t&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=t),na(this,t,e)),this},qt.time=function time(t,e){return arguments.length?this.totalTime(Math.min(this.totalDuration(),t+Ea(this))%(this._dur+this._rDelay)||(t?this._dur:0),e):this._time},qt.totalProgress=function totalProgress(t,e){return arguments.length?this.totalTime(this.totalDuration()*t,e):this.totalDuration()?Math.min(1,this._tTime/this._tDur):0<this.rawTime()?1:0},qt.progress=function progress(t,e){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?t:1-t)+Ea(this),e):this.duration()?Math.min(1,this._time/this._dur):0<this.rawTime()?1:0},qt.iteration=function iteration(t,e){var r=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(t-1)*r,e):this._repeat?Tt(this._tTime,r)+1:1},qt.timeScale=function timeScale(t,e){if(!arguments.length)return this._rts===-X?0:this._rts;if(this._rts===t)return this;var r=this.parent&&this._ts?Ga(this.parent._time,this):this._tTime;return this._rts=+t||0,this._ts=this._ps||t===-X?0:this._rts,this.totalTime(Ot(-Math.abs(this._delay),this._tDur,r),!1!==e),Ha(this),function _recacheAncestors(t){for(var e=t.parent;e&&e.parent;)e._dirty=1,e.totalDuration(),e=e.parent;return t}(this)},qt.paused=function paused(t){return arguments.length?(this._ps!==t&&((this._ps=t)?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Ft(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==X&&(this._tTime-=X)))),this):this._ps},qt.startTime=function startTime(t){if(arguments.length){this._start=t;var e=this.parent||this._dp;return!e||!e._sort&&this.parent||Ka(e,this,t-this._delay),this}return this._start},qt.endTime=function endTime(t){return this._start+(w(t)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},qt.rawTime=function rawTime(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?Ga(e.rawTime(t),this):this._tTime:this._tTime},qt.revert=function revert(t){void 0===t&&(t=lt);var e=L;return L=t,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(t),this.totalTime(-.01,t.suppressEvents)),"nested"!==this.data&&!1!==t.kill&&this.kill(),L=e,this},qt.globalTime=function globalTime(t){for(var e=this,r=arguments.length?t:e.rawTime();e;)r=e._start+r/(Math.abs(e._ts)||1),e=e._dp;return!this.parent&&this._sat?this._sat.globalTime(t):r},qt.repeat=function repeat(t){return arguments.length?(this._repeat=t===1/0?-2:t,Sa(this)):-2===this._repeat?1/0:this._repeat},qt.repeatDelay=function repeatDelay(t){if(arguments.length){var e=this._time;return this._rDelay=t,Sa(this),e?this.time(e):this}return this._rDelay},qt.yoyo=function yoyo(t){return arguments.length?(this._yoyo=t,this):this._yoyo},qt.seek=function seek(t,e){return this.totalTime(xt(this,t),w(e))},qt.restart=function restart(t,e){return this.play().totalTime(t?-this._delay:0,w(e))},qt.play=function play(t,e){return null!=t&&this.seek(t,e),this.reversed(!1).paused(!1)},qt.reverse=function reverse(t,e){return null!=t&&this.seek(t||this.totalDuration(),e),this.reversed(!0).paused(!1)},qt.pause=function pause(t,e){return null!=t&&this.seek(t,e),this.paused(!0)},qt.resume=function resume(){return this.paused(!1)},qt.reversed=function reversed(t){return arguments.length?(!!t!==this.reversed()&&this.timeScale(-this._rts||(t?-X:0)),this):this._rts<0},qt.invalidate=function invalidate(){return this._initted=this._act=0,this._zTime=-X,this},qt.isActive=function isActive(){var t,e=this.parent||this._dp,r=this._start;return!(e&&!(this._ts&&this._initted&&e.isActive()&&(t=e.rawTime(!0))>=r&&t<this.endTime(!0)-X))},qt.eventCallback=function eventCallback(t,e,r){var i=this.vars;return 1<arguments.length?(e?(i[t]=e,r&&(i[t+"Params"]=r),"onUpdate"===t&&(this._onUpdate=e)):delete i[t],this):i[t]},qt.then=function then(t){var i=this;return new Promise(function(e){function Co(){var t=i.then;i.then=null,s(r)&&(r=r(i))&&(r.then||r===i)&&(i.then=t),e(r),i.then=t}var r=s(t)?t:pa;i._initted&&1===i.totalProgress()&&0<=i._ts||!i._tTime&&i._ts<0?Co():i._prom=Co})},qt.kill=function kill(){tb(this)},Animation);function Animation(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,Ra(this,+t.duration,1,1),this.data=t.data,l&&(this._ctx=l).data.push(this),c||Rt.wake()}qa(Ut.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:-X,_prom:0,_ps:!1,_rts:1});var Xt=function(i){function Timeline(t,e){var r;return void 0===t&&(t={}),(r=i.call(this,t)||this).labels={},r.smoothChildTiming=!!t.smoothChildTiming,r.autoRemoveChildren=!!t.autoRemoveChildren,r._sort=w(t.sortChildren),I&&Ka(t.parent||I,_assertThisInitialized(r),e),t.reversed&&r.reverse(),t.paused&&r.paused(!0),t.scrollTrigger&&La(_assertThisInitialized(r),t.scrollTrigger),r}_inheritsLoose(Timeline,i);var e=Timeline.prototype;return e.to=function to(t,e,r){return Va(0,arguments,this),this},e.from=function from(t,e,r){return Va(1,arguments,this),this},e.fromTo=function fromTo(t,e,r,i){return Va(2,arguments,this),this},e.set=function set(t,e,r){return e.duration=0,e.parent=this,va(e).repeatDelay||(e.repeat=0),e.immediateRender=!!e.immediateRender,new $t(t,e,xt(this,r),1),this},e.call=function call(t,e,r){return Ka(this,$t.delayedCall(0,t,e),r)},e.staggerTo=function staggerTo(t,e,r,i,n,a,s){return r.duration=e,r.stagger=r.stagger||i,r.onComplete=a,r.onCompleteParams=s,r.parent=this,new $t(t,r,xt(this,n)),this},e.staggerFrom=function staggerFrom(t,e,r,i,n,a,s){return r.runBackwards=1,va(r).immediateRender=w(r.immediateRender),this.staggerTo(t,e,r,i,n,a,s)},e.staggerFromTo=function staggerFromTo(t,e,r,i,n,a,s,o){return i.startAt=r,va(i).immediateRender=w(i.immediateRender),this.staggerTo(t,e,i,n,a,s,o)},e.render=function render(t,e,r){var i,n,a,s,o,u,h,l,f,d,c,p,_=this._time,m=this._dirty?this.totalDuration():this._tDur,g=this._dur,v=t<=0?0:ja(t),y=this._zTime<0!=t<0&&(this._initted||!g);if(this!==I&&m<v&&0<=t&&(v=m),v!==this._tTime||r||y){if(_!==this._time&&g&&(v+=this._time-_,t+=this._time-_),i=v,f=this._start,u=!(l=this._ts),y&&(g||(_=this._zTime),!t&&e||(this._zTime=t)),this._repeat){if(c=this._yoyo,o=g+this._rDelay,this._repeat<-1&&t<0)return this.totalTime(100*o+t,e,r);if(i=ja(v%o),v===m?(s=this._repeat,i=g):((s=~~(v/o))&&s===v/o&&(i=g,s--),g<i&&(i=g)),d=Tt(this._tTime,o),!_&&this._tTime&&d!==s&&this._tTime-d*o-this._dur<=0&&(d=s),c&&1&s&&(i=g-i,p=1),s!==d&&!this._lock){var T=c&&1&d,b=T===(c&&1&s);if(s<d&&(T=!T),_=T?0:v%g?g:v,this._lock=1,this.render(_||(p?0:ja(s*o)),e,!g)._lock=0,this._tTime=v,!e&&this.parent&&Ct(this,"onRepeat"),this.vars.repeatRefresh&&!p&&(this.invalidate()._lock=1),_&&_!==this._time||u!=!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(g=this._dur,m=this._tDur,b&&(this._lock=2,_=T?g:-1e-4,this.render(_,!0),this.vars.repeatRefresh&&!p&&this.invalidate()),this._lock=0,!this._ts&&!u)return this;Qb(this,p)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(h=function _findNextPauseTween(t,e,r){var i;if(e<r)for(i=t._first;i&&i._start<=r;){if("isPause"===i.data&&i._start>e)return i;i=i._next}else for(i=t._last;i&&i._start>=r;){if("isPause"===i.data&&i._start<e)return i;i=i._prev}}(this,ja(_),ja(i)))&&(v-=i-(i=h._start)),this._tTime=v,this._time=i,this._act=!l,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=t,_=0),!_&&i&&!e&&!s&&(Ct(this,"onStart"),this._tTime!==v))return this;if(_<=i&&0<=t)for(n=this._first;n;){if(a=n._next,(n._act||i>=n._start)&&n._ts&&h!==n){if(n.parent!==this)return this.render(t,e,r);if(n.render(0<n._ts?(i-n._start)*n._ts:(n._dirty?n.totalDuration():n._tDur)+(i-n._start)*n._ts,e,r),i!==this._time||!this._ts&&!u){h=0,a&&(v+=this._zTime=-X);break}}n=a}else{n=this._last;for(var w=t<0?t:i;n;){if(a=n._prev,(n._act||w<=n._end)&&n._ts&&h!==n){if(n.parent!==this)return this.render(t,e,r);if(n.render(0<n._ts?(w-n._start)*n._ts:(n._dirty?n.totalDuration():n._tDur)+(w-n._start)*n._ts,e,r||L&&(n._initted||n._startAt)),i!==this._time||!this._ts&&!u){h=0,a&&(v+=this._zTime=w?-X:X);break}}n=a}}if(h&&!e&&(this.pause(),h.render(_<=i?0:-X)._zTime=_<=i?1:-1,this._ts))return this._start=f,Ha(this),this.render(t,e,r);this._onUpdate&&!e&&Ct(this,"onUpdate",!0),(v===m&&this._tTime>=this.totalDuration()||!v&&_)&&(f!==this._start&&Math.abs(l)===Math.abs(this._ts)||this._lock||(!t&&g||!(v===m&&0<this._ts||!v&&this._ts<0)||za(this,1),e||t<0&&!_||!v&&!_&&m||(Ct(this,v===m&&0<=t?"onComplete":"onReverseComplete",!0),!this._prom||v<m&&0<this.timeScale()||this._prom())))}return this},e.add=function add(e,i){var n=this;if(t(i)||(i=xt(this,i,e)),!(e instanceof Ut)){if(Z(e))return e.forEach(function(t){return n.add(t,i)}),this;if(r(e))return this.addLabel(e,i);if(!s(e))return this;e=$t.delayedCall(0,e)}return this!==e?Ka(this,e,i):this},e.getChildren=function getChildren(t,e,r,i){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===r&&(r=!0),void 0===i&&(i=-U);for(var n=[],a=this._first;a;)a._start>=i&&(a instanceof $t?e&&n.push(a):(r&&n.push(a),t&&n.push.apply(n,a.getChildren(!0,e,r)))),a=a._next;return n},e.getById=function getById(t){for(var e=this.getChildren(1,1,1),r=e.length;r--;)if(e[r].vars.id===t)return e[r]},e.remove=function remove(t){return r(t)?this.removeLabel(t):s(t)?this.killTweensOf(t):(ya(this,t),t===this._recent&&(this._recent=this._last),Aa(this))},e.totalTime=function totalTime(t,e){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=ja(Rt.time-(0<this._ts?t/this._ts:(this.totalDuration()-t)/-this._ts))),i.prototype.totalTime.call(this,t,e),this._forcing=0,this):this._tTime},e.addLabel=function addLabel(t,e){return this.labels[t]=xt(this,e),this},e.removeLabel=function removeLabel(t){return delete this.labels[t],this},e.addPause=function addPause(t,e,r){var i=$t.delayedCall(0,e||T,r);return i.data="isPause",this._hasPause=1,Ka(this,i,xt(this,t))},e.removePause=function removePause(t){var e=this._first;for(t=xt(this,t);e;)e._start===t&&"isPause"===e.data&&za(e),e=e._next},e.killTweensOf=function killTweensOf(t,e,r){for(var i=this.getTweensOf(t,r),n=i.length;n--;)Nt!==i[n]&&i[n].kill(t,e);return this},e.getTweensOf=function getTweensOf(e,r){for(var i,n=[],a=Mt(e),s=this._first,o=t(r);s;)s instanceof $t?la(s._targets,a)&&(o?(!Nt||s._initted&&s._ts)&&s.globalTime(0)<=r&&s.globalTime(s.totalDuration())>r:!r||s.isActive())&&n.push(s):(i=s.getTweensOf(a,r)).length&&n.push.apply(n,i),s=s._next;return n},e.tweenTo=function tweenTo(t,e){e=e||{};var r,i=this,n=xt(i,t),a=e.startAt,s=e.onStart,o=e.onStartParams,u=e.immediateRender,h=$t.to(i,qa({ease:e.ease||"none",lazy:!1,immediateRender:!1,time:n,overwrite:"auto",duration:e.duration||Math.abs((n-(a&&"time"in a?a.time:i._time))/i.timeScale())||X,onStart:function onStart(){if(i.pause(),!r){var t=e.duration||Math.abs((n-(a&&"time"in a?a.time:i._time))/i.timeScale());h._dur!==t&&Ra(h,t,0,1).render(h._time,!0,!0),r=1}s&&s.apply(h,o||[])}},e));return u?h.render(0):h},e.tweenFromTo=function tweenFromTo(t,e,r){return this.tweenTo(e,qa({startAt:{time:xt(this,t)}},r))},e.recent=function recent(){return this._recent},e.nextLabel=function nextLabel(t){return void 0===t&&(t=this._time),rb(this,xt(this,t))},e.previousLabel=function previousLabel(t){return void 0===t&&(t=this._time),rb(this,xt(this,t),1)},e.currentLabel=function currentLabel(t){return arguments.length?this.seek(t,!0):this.previousLabel(this._time+X)},e.shiftChildren=function shiftChildren(t,e,r){void 0===r&&(r=0);for(var i,n=this._first,a=this.labels;n;)n._start>=r&&(n._start+=t,n._end+=t),n=n._next;if(e)for(i in a)a[i]>=r&&(a[i]+=t);return Aa(this)},e.invalidate=function invalidate(t){var e=this._first;for(this._lock=0;e;)e.invalidate(t),e=e._next;return i.prototype.invalidate.call(this,t)},e.clear=function clear(t){void 0===t&&(t=!0);for(var e,r=this._first;r;)e=r._next,this.remove(r),r=e;return this._dp&&(this._time=this._tTime=this._pTime=0),t&&(this.labels={}),Aa(this)},e.totalDuration=function totalDuration(t){var e,r,i,n=0,a=this,s=a._last,o=U;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(),o<(r=s._start)&&a._sort&&s._ts&&!a._lock?(a._lock=1,Ka(a,s,r-s._delay,1)._lock=0):o=r,r<0&&s._ts&&(n-=r,(!i&&!a._dp||i&&i.smoothChildTiming)&&(a._start+=r/a._ts,a._time-=r,a._tTime-=r),a.shiftChildren(-r,!1,-Infinity),o=0),s._end>n&&s._ts&&(n=s._end),s=e;Ra(a,a===I&&a._time>n?a._time:n,1,1),a._dirty=0}return a._tDur},Timeline.updateRoot=function updateRoot(t){if(I._ts&&(na(I,Ga(t,I)),f=Rt.frame),Rt.frame>=mt){mt+=q.autoSleep||120;var e=I._first;if((!e||!e._ts)&&q.autoSleep&&Rt._listeners.length<2){for(;e&&!e._ts;)e=e._next;e||Rt.sleep()}}},Timeline}(Ut);qa(Xt.prototype,{_lock:0,_hasPause:0,_forcing:0});function ac(t,e,i,n,a,o){var u,h,l,f;if(pt[t]&&!1!==(u=new pt[t]).init(a,u.rawVars?e[t]:function _processVars(t,e,i,n,a){if(s(t)&&(t=Kt(t,a,e,i,n)),!v(t)||t.style&&t.nodeType||Z(t)||$(t))return r(t)?Kt(t,a,e,i,n):t;var o,u={};for(o in t)u[o]=Kt(t[o],a,e,i,n);return u}(e[t],n,a,o,i),i,n,o)&&(i._pt=h=new _e(i._pt,a,t,0,1,u.render,u,0,u.priority),i!==d))for(l=i._ptLookup[i._targets.indexOf(a)],f=u._props.length;f--;)l[u._props[f]]=h;return u}function gc(t,r,e,i){var n,a,s=r.ease||i||"power1.inOut";if(Z(r))a=e[t]||(e[t]=[]),r.forEach(function(t,e){return a.push({t:e/(r.length-1)*100,v:t,e:s})});else for(n in r)a=e[n]||(e[n]=[]),"ease"===n||a.push({t:parseFloat(t),v:r[n],e:s})}var Nt,Gt,Wt=function _addPropTween(t,e,i,n,a,o,u,h,l,f){s(n)&&(n=n(a||0,t,o));var d,c=t[e],p="get"!==i?i:s(c)?l?t[e.indexOf("set")||!s(t["get"+e.substr(3)])?e:"get"+e.substr(3)](l):t[e]():c,_=s(c)?l?re:te:Zt;if(r(n)&&(~n.indexOf("random(")&&(n=ob(n)),"="===n.charAt(1)&&(!(d=ka(p,n)+(Ya(p)||0))&&0!==d||(n=d))),!f||p!==n||Gt)return isNaN(p*n)||""===n?(c||e in t||Q(e,n),function _addComplexStringPropTween(t,e,r,i,n,a,s){var o,u,h,l,f,d,c,p,_=new _e(this._pt,t,e,0,1,ue,null,n),m=0,g=0;for(_.b=r,_.e=i,r+="",(c=~(i+="").indexOf("random("))&&(i=ob(i)),a&&(a(p=[r,i],t,e),r=p[0],i=p[1]),u=r.match(it)||[];o=it.exec(i);)l=o[0],f=i.substring(m,o.index),h?h=(h+1)%5:"rgba("===f.substr(-5)&&(h=1),l!==u[g++]&&(d=parseFloat(u[g-1])||0,_._pt={_next:_._pt,p:f||1===g?f:",",s:d,c:"="===l.charAt(1)?ka(d,l)-d:parseFloat(l)-d,m:h&&h<4?Math.round:0},m=it.lastIndex);return _.c=m<i.length?i.substring(m,i.length):"",_.fp=s,(nt.test(i)||c)&&(_.e=0),this._pt=_}.call(this,t,e,p,n,_,h||q.stringFilter,l)):(d=new _e(this._pt,t,e,+p||0,n-(p||0),"boolean"==typeof c?se:ae,0,_),l&&(d.fp=l),u&&d.modifier(u,this,t),this._pt=d)},Qt=function _initTween(t,e,r){var i,n,a,s,o,u,h,l,f,d,c,p,_,m=t.vars,g=m.ease,v=m.startAt,y=m.immediateRender,T=m.lazy,b=m.onUpdate,x=m.runBackwards,O=m.yoyoEase,k=m.keyframes,M=m.autoRevert,P=t._dur,C=t._startAt,A=t._targets,S=t.parent,z=S&&"nested"===S.data?S.vars.targets:A,E="auto"===t._overwrite&&!F,D=t.timeline;if(!D||k&&g||(g="none"),t._ease=jt(g,V.ease),t._yEase=O?Yt(jt(!0===O?g:O,V.ease)):0,O&&t._yoyo&&!t._repeat&&(O=t._yEase,t._yEase=t._ease,t._ease=O),t._from=!D&&!!m.runBackwards,!D||k&&!m.stagger){if(p=(l=A[0]?fa(A[0]).harness:0)&&m[l.prop],i=ua(m,ft),C&&(C._zTime<0&&C.progress(1),e<0&&x&&y&&!M?C.render(-1,!0):C.revert(x&&P?ht:ut),C._lazy=0),v){if(za(t._startAt=$t.set(A,qa({data:"isStart",overwrite:!1,parent:S,immediateRender:!0,lazy:!C&&w(T),startAt:null,delay:0,onUpdate:b&&function(){return Ct(t,"onUpdate")},stagger:0},v))),t._startAt._dp=0,t._startAt._sat=t,e<0&&(L||!y&&!M)&&t._startAt.revert(ht),y&&P&&e<=0&&r<=0)return void(e&&(t._zTime=e))}else if(x&&P&&!C)if(e&&(y=!1),a=qa({overwrite:!1,data:"isFromStart",lazy:y&&!C&&w(T),immediateRender:y,stagger:0,parent:S},i),p&&(a[l.prop]=p),za(t._startAt=$t.set(A,a)),t._startAt._dp=0,t._startAt._sat=t,e<0&&(L?t._startAt.revert(ht):t._startAt.render(-1,!0)),t._zTime=e,y){if(!e)return}else _initTween(t._startAt,X,X);for(t._pt=t._ptCache=0,T=P&&w(T)||T&&!P,n=0;n<A.length;n++){if(h=(o=A[n])._gsap||ea(A)[n]._gsap,t._ptLookup[n]=d={},ct[h.id]&&dt.length&&ma(),c=z===A?n:z.indexOf(o),l&&!1!==(f=new l).init(o,p||i,t,c,z)&&(t._pt=s=new _e(t._pt,o,f.name,0,1,f.render,f,0,f.priority),f._props.forEach(function(t){d[t]=s}),f.priority&&(u=1)),!l||p)for(a in i)pt[a]&&(f=ac(a,i,t,c,o,z))?f.priority&&(u=1):d[a]=s=Wt.call(t,o,a,"get",i[a],c,z,0,m.stringFilter);t._op&&t._op[n]&&t.kill(o,t._op[n]),E&&t._pt&&(Nt=t,I.killTweensOf(o,d,t.globalTime(e)),_=!t.parent,Nt=0),t._pt&&T&&(ct[h.id]=1)}u&&pe(t),t._onInit&&t._onInit(t)}t._onUpdate=b,t._initted=(!t._op||t._pt)&&!_,k&&e<=0&&D.render(U,!0,!0)},Kt=function _parseFuncOrString(t,e,i,n,a){return s(t)?t.call(e,i,n,a):r(t)&&~t.indexOf("random(")?ob(t):t},Jt=vt+"repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert",Ht={};ha(Jt+",id,stagger,delay,duration,paused,scrollTrigger",function(t){return Ht[t]=1});var $t=function(D){function Tween(e,r,i,n){var a;"number"==typeof r&&(i.duration=r,r=i,i=null);var s,o,u,h,l,f,d,c,p=(a=D.call(this,n?r:va(r))||this).vars,_=p.duration,m=p.delay,g=p.immediateRender,T=p.stagger,b=p.overwrite,x=p.keyframes,O=p.defaults,k=p.scrollTrigger,M=p.yoyoEase,P=r.parent||I,C=(Z(e)||$(e)?t(e[0]):"length"in r)?[e]:Mt(e);if(a._targets=C.length?ea(C):R("GSAP target "+e+" not found. https://gsap.com",!q.nullTargetWarn)||[],a._ptLookup=[],a._overwrite=b,x||T||y(_)||y(m)){if(r=a.vars,(s=a.timeline=new Xt({data:"nested",defaults:O||{},targets:P&&"nested"===P.data?P.vars.targets:C})).kill(),s.parent=s._dp=_assertThisInitialized(a),s._start=0,T||y(_)||y(m)){if(h=C.length,d=T&&eb(T),v(T))for(l in T)~Jt.indexOf(l)&&((c=c||{})[l]=T[l]);for(o=0;o<h;o++)(u=ua(r,Ht)).stagger=0,M&&(u.yoyoEase=M),c&&yt(u,c),f=C[o],u.duration=+Kt(_,_assertThisInitialized(a),o,f,C),u.delay=(+Kt(m,_assertThisInitialized(a),o,f,C)||0)-a._delay,!T&&1===h&&u.delay&&(a._delay=m=u.delay,a._start+=m,u.delay=0),s.to(f,u,d?d(o,f,C):0),s._ease=Lt.none;s.duration()?_=m=0:a.timeline=0}else if(x){va(qa(s.vars.defaults,{ease:"none"})),s._ease=jt(x.ease||r.ease||"none");var A,S,z,E=0;if(Z(x))x.forEach(function(t){return s.to(C,t,">")}),s.duration();else{for(l in u={},x)"ease"===l||"easeEach"===l||gc(l,x[l],u,x.easeEach);for(l in u)for(A=u[l].sort(function(t,e){return t.t-e.t}),o=E=0;o<A.length;o++)(z={ease:(S=A[o]).e,duration:(S.t-(o?A[o-1].t:0))/100*_})[l]=S.v,s.to(C,z,E),E+=z.duration;s.duration()<_&&s.to({},{duration:_-s.duration()})}}_||a.duration(_=s.duration())}else a.timeline=0;return!0!==b||F||(Nt=_assertThisInitialized(a),I.killTweensOf(C),Nt=0),Ka(P,_assertThisInitialized(a),i),r.reversed&&a.reverse(),r.paused&&a.paused(!0),(g||!_&&!x&&a._start===ja(P._time)&&w(g)&&function _hasNoPausedAncestors(t){return!t||t._ts&&_hasNoPausedAncestors(t.parent)}(_assertThisInitialized(a))&&"nested"!==P.data)&&(a._tTime=-X,a.render(Math.max(0,-m)||0)),k&&La(_assertThisInitialized(a),k),a}_inheritsLoose(Tween,D);var e=Tween.prototype;return e.render=function render(t,e,r){var i,n,a,s,o,u,h,l,f,d=this._time,c=this._tDur,p=this._dur,_=t<0,m=c-X<t&&!_?c:t<X?0:t;if(p){if(m!==this._tTime||!t||r||!this._initted&&this._tTime||this._startAt&&this._zTime<0!=_){if(i=m,l=this.timeline,this._repeat){if(s=p+this._rDelay,this._repeat<-1&&_)return this.totalTime(100*s+t,e,r);if(i=ja(m%s),m===c?(a=this._repeat,i=p):((a=~~(m/s))&&a===ja(m/s)&&(i=p,a--),p<i&&(i=p)),(u=this._yoyo&&1&a)&&(f=this._yEase,i=p-i),o=Tt(this._tTime,s),i===d&&!r&&this._initted&&a===o)return this._tTime=m,this;a!==o&&(l&&this._yEase&&Qb(l,u),this.vars.repeatRefresh&&!u&&!this._lock&&this._time!==s&&this._initted&&(this._lock=r=1,this.render(ja(s*a),!0).invalidate()._lock=0))}if(!this._initted){if(Ma(this,_?t:i,r,e,m))return this._tTime=0,this;if(!(d===this._time||r&&this.vars.repeatRefresh&&a!==o))return this;if(p!==this._dur)return this.render(t,e,r)}if(this._tTime=m,this._time=i,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=h=(f||this._ease)(i/p),this._from&&(this.ratio=h=1-h),i&&!d&&!e&&!a&&(Ct(this,"onStart"),this._tTime!==m))return this;for(n=this._pt;n;)n.r(h,n.d),n=n._next;l&&l.render(t<0?t:l._dur*l._ease(i/this._dur),e,r)||this._startAt&&(this._zTime=t),this._onUpdate&&!e&&(_&&Ca(this,t,0,r),Ct(this,"onUpdate")),this._repeat&&a!==o&&this.vars.onRepeat&&!e&&this.parent&&Ct(this,"onRepeat"),m!==this._tDur&&m||this._tTime!==m||(_&&!this._onUpdate&&Ca(this,t,0,!0),!t&&p||!(m===this._tDur&&0<this._ts||!m&&this._ts<0)||za(this,1),e||_&&!d||!(m||d||u)||(Ct(this,m===c?"onComplete":"onReverseComplete",!0),!this._prom||m<c&&0<this.timeScale()||this._prom()))}}else!function _renderZeroDurationTween(t,e,r,i){var n,a,s,o=t.ratio,u=e<0||!e&&(!t._start&&function _parentPlayheadIsBeforeStart(t){var e=t.parent;return e&&e._ts&&e._initted&&!e._lock&&(e.rawTime()<0||_parentPlayheadIsBeforeStart(e))}(t)&&(t._initted||!bt(t))||(t._ts<0||t._dp._ts<0)&&!bt(t))?0:1,h=t._rDelay,l=0;if(h&&t._repeat&&(l=Ot(0,t._tDur,e),a=Tt(l,h),t._yoyo&&1&a&&(u=1-u),a!==Tt(t._tTime,h)&&(o=1-u,t.vars.repeatRefresh&&t._initted&&t.invalidate())),u!==o||L||i||t._zTime===X||!e&&t._zTime){if(!t._initted&&Ma(t,e,i,r,l))return;for(s=t._zTime,t._zTime=e||(r?X:0),r=r||e&&!s,t.ratio=u,t._from&&(u=1-u),t._time=0,t._tTime=l,n=t._pt;n;)n.r(u,n.d),n=n._next;e<0&&Ca(t,e,0,!0),t._onUpdate&&!r&&Ct(t,"onUpdate"),l&&t._repeat&&!r&&t.parent&&Ct(t,"onRepeat"),(e>=t._tDur||e<0)&&t.ratio===u&&(u&&za(t,1),r||L||(Ct(t,u?"onComplete":"onReverseComplete",!0),t._prom&&t._prom()))}else t._zTime||(t._zTime=e)}(this,t,e,r);return this},e.targets=function targets(){return this._targets},e.invalidate=function invalidate(t){return t&&this.vars.runBackwards||(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(t),D.prototype.invalidate.call(this,t)},e.resetTo=function resetTo(t,e,r,i,n){c||Rt.wake(),this._ts||this.play();var a,s=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Qt(this,s),a=this._ease(s/this._dur),function _updatePropTweens(t,e,r,i,n,a,s,o){var u,h,l,f,d=(t._pt&&t._ptCache||(t._ptCache={}))[e];if(!d)for(d=t._ptCache[e]=[],l=t._ptLookup,f=t._targets.length;f--;){if((u=l[f][e])&&u.d&&u.d._pt)for(u=u.d._pt;u&&u.p!==e&&u.fp!==e;)u=u._next;if(!u)return Gt=1,t.vars[e]="+=0",Qt(t,s),Gt=0,o?R(e+" not eligible for reset"):1;d.push(u)}for(f=d.length;f--;)(u=(h=d[f])._pt||h).s=!i&&0!==i||n?u.s+(i||0)+a*u.c:i,u.c=r-u.s,h.e&&(h.e=ia(r)+Ya(h.e)),h.b&&(h.b=u.s+Ya(h.b))}(this,t,e,r,i,a,s,n)?this.resetTo(t,e,r,i,1):(Ia(this,0),this.parent||xa(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},e.kill=function kill(t,e){if(void 0===e&&(e="all"),!(t||e&&"all"!==e))return this._lazy=this._pt=0,this.parent?tb(this):this;if(this.timeline){var i=this.timeline.totalDuration();return this.timeline.killTweensOf(t,e,Nt&&!0!==Nt.vars.overwrite)._first||tb(this),this.parent&&i!==this.timeline.totalDuration()&&Ra(this,this._dur*this.timeline._tDur/i,0,1),this}var n,a,s,o,u,h,l,f=this._targets,d=t?Mt(t):f,c=this._ptLookup,p=this._pt;if((!e||"all"===e)&&function _arraysMatch(t,e){for(var r=t.length,i=r===e.length;i&&r--&&t[r]===e[r];);return r<0}(f,d))return"all"===e&&(this._pt=0),tb(this);for(n=this._op=this._op||[],"all"!==e&&(r(e)&&(u={},ha(e,function(t){return u[t]=1}),e=u),e=function _addAliasesToVars(t,e){var r,i,n,a,s=t[0]?fa(t[0]).harness:0,o=s&&s.aliases;if(!o)return e;for(i in r=yt({},e),o)if(i in r)for(n=(a=o[i].split(",")).length;n--;)r[a[n]]=r[i];return r}(f,e)),l=f.length;l--;)if(~d.indexOf(f[l]))for(u in a=c[l],"all"===e?(n[l]=e,o=a,s={}):(s=n[l]=n[l]||{},o=e),o)(h=a&&a[u])&&("kill"in h.d&&!0!==h.d.kill(u)||ya(this,h,"_pt"),delete a[u]),"all"!==s&&(s[u]=1);return this._initted&&!this._pt&&p&&tb(this),this},Tween.to=function to(t,e,r){return new Tween(t,e,r)},Tween.from=function from(t,e){return Va(1,arguments)},Tween.delayedCall=function delayedCall(t,e,r,i){return new Tween(e,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:t,onComplete:e,onReverseComplete:e,onCompleteParams:r,onReverseCompleteParams:r,callbackScope:i})},Tween.fromTo=function fromTo(t,e,r){return Va(2,arguments)},Tween.set=function set(t,e){return e.duration=0,e.repeatDelay||(e.repeat=0),new Tween(t,e)},Tween.killTweensOf=function killTweensOf(t,e,r){return I.killTweensOf(t,e,r)},Tween}(Ut);qa($t.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),ha("staggerTo,staggerFrom,staggerFromTo",function(r){$t[r]=function(){var t=new Xt,e=kt.call(arguments,0);return e.splice("staggerFromTo"===r?5:4,0,0),t[r].apply(t,e)}});function oc(t,e,r){return t.setAttribute(e,r)}function wc(t,e,r,i){i.mSet(t,e,i.m.call(i.tween,r,i.mt),i)}var Zt=function _setterPlain(t,e,r){return t[e]=r},te=function _setterFunc(t,e,r){return t[e](r)},re=function _setterFuncWithParam(t,e,r,i){return t[e](i.fp,r)},ne=function _getSetter(t,e){return s(t[e])?te:u(t[e])&&t.setAttribute?oc:Zt},ae=function _renderPlain(t,e){return e.set(e.t,e.p,Math.round(1e6*(e.s+e.c*t))/1e6,e)},se=function _renderBoolean(t,e){return e.set(e.t,e.p,!!(e.s+e.c*t),e)},ue=function _renderComplexString(t,e){var r=e._pt,i="";if(!t&&e.b)i=e.b;else if(1===t&&e.e)i=e.e;else{for(;r;)i=r.p+(r.m?r.m(r.s+r.c*t):Math.round(1e4*(r.s+r.c*t))/1e4)+i,r=r._next;i+=e.c}e.set(e.t,e.p,i,e)},he=function _renderPropTweens(t,e){for(var r=e._pt;r;)r.r(t,r.d),r=r._next},fe=function _addPluginModifier(t,e,r,i){for(var n,a=this._pt;a;)n=a._next,a.p===i&&a.modifier(t,e,r),a=n},ce=function _killPropTweensOf(t){for(var e,r,i=this._pt;i;)r=i._next,i.p===t&&!i.op||i.op===t?ya(this,i,"_pt"):i.dep||(e=1),i=r;return!e},pe=function _sortPropTweensByPriority(t){for(var e,r,i,n,a=t._pt;a;){for(e=a._next,r=i;r&&r.pr>a.pr;)r=r._next;(a._prev=r?r._prev:n)?a._prev._next=a:i=a,(a._next=r)?r._prev=a:n=a,a=e}t._pt=i},_e=(PropTween.prototype.modifier=function modifier(t,e,r){this.mSet=this.mSet||this.set,this.set=wc,this.m=t,this.mt=r,this.tween=e},PropTween);function PropTween(t,e,r,i,n,a,s,o,u){this.t=e,this.s=i,this.c=n,this.p=r,this.r=a||ae,this.d=s||this,this.set=o||Zt,this.pr=u||0,(this._next=t)&&(t._prev=this)}ha(vt+"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 ft[t]=1}),ot.TweenMax=ot.TweenLite=$t,ot.TimelineLite=ot.TimelineMax=Xt,I=new Xt({sortChildren:!1,defaults:V,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),q.stringFilter=Fb;function Ec(t){return(ye[t]||Te).map(function(t){return t()})}function Fc(){var t=Date.now(),o=[];2<t-Oe&&(Ec("matchMediaInit"),ge.forEach(function(t){var e,r,i,n,a=t.queries,s=t.conditions;for(r in a)(e=h.matchMedia(a[r]).matches)&&(i=1),e!==s[r]&&(s[r]=e,n=1);n&&(t.revert(),i&&o.push(t))}),Ec("matchMediaRevert"),o.forEach(function(e){return e.onMatch(e,function(t){return e.add(null,t)})}),Oe=t,Ec("matchMedia"))}var me,ge=[],ye={},Te=[],Oe=0,Me=0,Pe=((me=Context.prototype).add=function add(t,i,n){function Gw(){var t,e=l,r=a.selector;return e&&e!==a&&e.data.push(a),n&&(a.selector=cb(n)),l=a,t=i.apply(a,arguments),s(t)&&a._r.push(t),l=e,a.selector=r,a.isReverted=!1,t}s(t)&&(n=i,i=t,t=s);var a=this;return a.last=Gw,t===s?Gw(a,function(t){return a.add(null,t)}):t?a[t]=Gw:Gw},me.ignore=function ignore(t){var e=l;l=null,t(this),l=e},me.getTweens=function getTweens(){var e=[];return this.data.forEach(function(t){return t instanceof Context?e.push.apply(e,t.getTweens()):t instanceof $t&&!(t.parent&&"nested"===t.parent.data)&&e.push(t)}),e},me.clear=function clear(){this._r.length=this.data.length=0},me.kill=function kill(i,t){var n=this;if(i?function(){for(var t,e=n.getTweens(),r=n.data.length;r--;)"isFlip"===(t=n.data[r]).data&&(t.revert(),t.getChildren(!0,!0,!1).forEach(function(t){return e.splice(e.indexOf(t),1)}));for(e.map(function(t){return{g:t._dur||t._delay||t._sat&&!t._sat.vars.immediateRender?t.globalTime(0):-1/0,t:t}}).sort(function(t,e){return e.g-t.g||-1/0}).forEach(function(t){return t.t.revert(i)}),r=n.data.length;r--;)(t=n.data[r])instanceof Xt?"nested"!==t.data&&(t.scrollTrigger&&t.scrollTrigger.revert(),t.kill()):t instanceof $t||!t.revert||t.revert(i);n._r.forEach(function(t){return t(i,n)}),n.isReverted=!0}():this.data.forEach(function(t){return t.kill&&t.kill()}),this.clear(),t)for(var e=ge.length;e--;)ge[e].id===this.id&&ge.splice(e,1)},me.revert=function revert(t){this.kill(t||{})},Context);function Context(t,e){this.selector=e&&cb(e),this.data=[],this._r=[],this.isReverted=!1,this.id=Me++,t&&this.add(t)}var Ce,Ae=((Ce=MatchMedia.prototype).add=function add(t,e,r){v(t)||(t={matches:t});var i,n,a,s=new Pe(0,r||this.scope),o=s.conditions={};for(n in l&&!s.selector&&(s.selector=l.selector),this.contexts.push(s),e=s.add("onMatch",e),s.queries=t)"all"===n?a=1:(i=h.matchMedia(t[n]))&&(ge.indexOf(s)<0&&ge.push(s),(o[n]=i.matches)&&(a=1),i.addListener?i.addListener(Fc):i.addEventListener("change",Fc));return a&&e(s,function(t){return s.add(null,t)}),this},Ce.revert=function revert(t){this.kill(t||{})},Ce.kill=function kill(e){this.contexts.forEach(function(t){return t.kill(e,!0)})},MatchMedia);function MatchMedia(t){this.contexts=[],this.scope=t,l&&l.data.push(this)}var Se={registerPlugin:function registerPlugin(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];e.forEach(function(t){return wb(t)})},timeline:function timeline(t){return new Xt(t)},getTweensOf:function getTweensOf(t,e){return I.getTweensOf(t,e)},getProperty:function getProperty(i,t,e,n){r(i)&&(i=Mt(i)[0]);var a=fa(i||{}).get,s=e?pa:oa;return"native"===e&&(e=""),i?t?s((pt[t]&&pt[t].get||a)(i,t,e,n)):function(t,e,r){return s((pt[t]&&pt[t].get||a)(i,t,e,r))}:i},quickSetter:function quickSetter(r,e,i){if(1<(r=Mt(r)).length){var n=r.map(function(t){return ze.quickSetter(t,e,i)}),a=n.length;return function(t){for(var e=a;e--;)n[e](t)}}r=r[0]||{};var s=pt[e],o=fa(r),u=o.harness&&(o.harness.aliases||{})[e]||e,h=s?function(t){var e=new s;d._pt=0,e.init(r,i?t+i:t,d,0,[r]),e.render(1,e),d._pt&&he(1,d)}:o.set(r,u);return s?h:function(t){return h(r,u,i?t+i:t,o,1)}},quickTo:function quickTo(t,i,e){function $x(t,e,r){return n.resetTo(i,t,e,r)}var r,n=ze.to(t,yt(((r={})[i]="+=0.1",r.paused=!0,r),e||{}));return $x.tween=n,$x},isTweening:function isTweening(t){return 0<I.getTweensOf(t,!0).length},defaults:function defaults(t){return t&&t.ease&&(t.ease=jt(t.ease,V.ease)),ta(V,t||{})},config:function config(t){return ta(q,t||{})},registerEffect:function registerEffect(t){var i=t.name,n=t.effect,e=t.plugins,a=t.defaults,r=t.extendTimeline;(e||"").split(",").forEach(function(t){return t&&!pt[t]&&!ot[t]&&R(i+" effect requires "+t+" plugin.")}),_t[i]=function(t,e,r){return n(Mt(t),qa(e||{},a),r)},r&&(Xt.prototype[i]=function(t,e,r){return this.add(_t[i](t,v(e)?e:(r=e)&&{},this),r)})},registerEase:function registerEase(t,e){Lt[t]=jt(e)},parseEase:function parseEase(t,e){return arguments.length?jt(t,e):Lt},getById:function getById(t){return I.getById(t)},exportRoot:function exportRoot(t,e){void 0===t&&(t={});var r,i,n=new Xt(t);for(n.smoothChildTiming=w(t.smoothChildTiming),I.remove(n),n._dp=0,n._time=n._tTime=I._time,r=I._first;r;)i=r._next,!e&&!r._dur&&r instanceof $t&&r.vars.onComplete===r._targets[0]||Ka(n,r,r._start-r._delay),r=i;return Ka(I,n,0),n},context:function context(t,e){return t?new Pe(t,e):l},matchMedia:function matchMedia(t){return new Ae(t)},matchMediaRefresh:function matchMediaRefresh(){return ge.forEach(function(t){var e,r,i=t.conditions;for(r in i)i[r]&&(i[r]=!1,e=1);e&&t.revert()})||Fc()},addEventListener:function addEventListener(t,e){var r=ye[t]||(ye[t]=[]);~r.indexOf(e)||r.push(e)},removeEventListener:function removeEventListener(t,e){var r=ye[t],i=r&&r.indexOf(e);0<=i&&r.splice(i,1)},utils:{wrap:function wrap(e,t,r){var i=t-e;return Z(e)?lb(e,wrap(0,e.length),t):Wa(r,function(t){return(i+(t-e)%i)%i+e})},wrapYoyo:function wrapYoyo(e,t,r){var i=t-e,n=2*i;return Z(e)?lb(e,wrapYoyo(0,e.length-1),t):Wa(r,function(t){return e+(i<(t=(n+(t-e)%n)%n||0)?n-t:t)})},distribute:eb,random:hb,snap:gb,normalize:function normalize(t,e,r){return Pt(t,e,0,1,r)},getUnit:Ya,clamp:function clamp(e,r,t){return Wa(t,function(t){return Ot(e,r,t)})},splitColor:Ab,toArray:Mt,selector:cb,mapRange:Pt,pipe:function pipe(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return function(t){return e.reduce(function(t,e){return e(t)},t)}},unitize:function unitize(e,r){return function(t){return e(parseFloat(t))+(r||Ya(t))}},interpolate:function interpolate(e,i,t,n){var a=isNaN(e+i)?0:function(t){return(1-t)*e+t*i};if(!a){var s,o,u,h,l,f=r(e),d={};if(!0===t&&(n=1)&&(t=null),f)e={p:e},i={p:i};else if(Z(e)&&!Z(i)){for(u=[],h=e.length,l=h-2,o=1;o<h;o++)u.push(interpolate(e[o-1],e[o]));h--,a=function func(t){t*=h;var e=Math.min(l,~~t);return u[e](t-e)},t=i}else n||(e=yt(Z(e)?[]:{},e));if(!u){for(s in i)Wt.call(d,e,s,"get",i[s]);a=function func(t){return he(t,d)||(f?e.p:e)}}}return Wa(t,a)},shuffle:db},install:P,effects:_t,ticker:Rt,updateRoot:Xt.updateRoot,plugins:pt,globalTimeline:I,core:{PropTween:_e,globals:S,Tween:$t,Timeline:Xt,Animation:Ut,getCache:fa,_removeLinkedListItem:ya,reverting:function reverting(){return L},context:function context(t){return t&&l&&(l.data.push(t),t._ctx=l),l},suppressOverwrites:function suppressOverwrites(t){return F=t}}};ha("to,from,fromTo,delayedCall,set,killTweensOf",function(t){return Se[t]=$t[t]}),Rt.add(Xt.updateRoot),d=Se.to({},{duration:0});function Jc(t,e){for(var r=t._pt;r&&r.p!==e&&r.op!==e&&r.fp!==e;)r=r._next;return r}function Lc(t,a){return{name:t,rawVars:1,init:function init(t,n,e){e._onInit=function(t){var e,i;if(r(n)&&(e={},ha(n,function(t){return e[t]=1}),n=e),a){for(i in e={},n)e[i]=a(n[i]);n=e}!function _addModifiers(t,e){var r,i,n,a=t._targets;for(r in e)for(i=a.length;i--;)(n=(n=t._ptLookup[i][r])&&n.d)&&(n._pt&&(n=Jc(n,r)),n&&n.modifier&&n.modifier(e[r],t,a[i],r))}(t,n)}}}}var ze=Se.registerPlugin({name:"attr",init:function init(t,e,r,i,n){var a,s,o;for(a in this.tween=r,e)o=t.getAttribute(a)||"",(s=this.add(t,"setAttribute",(o||0)+"",e[a],i,n,0,0,a)).op=a,s.b=o,this._props.push(a)},render:function render(t,e){for(var r=e._pt;r;)L?r.set(r.t,r.p,r.b,r):r.r(t,r.d),r=r._next}},{name:"endArray",init:function init(t,e){for(var r=e.length;r--;)this.add(t,r,t[r]||0,e[r],0,0,0,0,0,1)}},Lc("roundProps",fb),Lc("modifiers"),Lc("snap",gb))||Se;$t.version=Xt.version=ze.version="3.12.5",o=1,x()&&Ft();function vd(t,e){return e.set(e.t,e.p,Math.round(1e4*(e.s+e.c*t))/1e4+e.u,e)}function wd(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)}function xd(t,e){return e.set(e.t,e.p,t?Math.round(1e4*(e.s+e.c*t))/1e4+e.u:e.b,e)}function yd(t,e){var r=e.s+e.c*t;e.set(e.t,e.p,~~(r+(r<0?-.5:.5))+e.u,e)}function zd(t,e){return e.set(e.t,e.p,t?e.e:e.b,e)}function Ad(t,e){return e.set(e.t,e.p,1!==t?e.b:e.e,e)}function Bd(t,e,r){return t.style[e]=r}function Cd(t,e,r){return t.style.setProperty(e,r)}function Dd(t,e,r){return t._gsap[e]=r}function Ed(t,e,r){return t._gsap.scaleX=t._gsap.scaleY=r}function Fd(t,e,r,i,n){var a=t._gsap;a.scaleX=a.scaleY=r,a.renderTransform(n,a)}function Gd(t,e,r,i,n){var a=t._gsap;a[e]=r,a.renderTransform(n,a)}function Jd(t,e){var r=this,i=this.target,n=i.style,a=i._gsap;if(t in ar&&n){if(this.tfm=this.tfm||{},"transform"===t)return dr.transform.split(",").forEach(function(t){return Jd.call(r,t,e)});if(~(t=dr[t]||t).indexOf(",")?t.split(",").forEach(function(t){return r.tfm[t]=yr(i,t)}):this.tfm[t]=a.x?a[t]:yr(i,t),t===pr&&(this.tfm.zOrigin=a.zOrigin),0<=this.props.indexOf(cr))return;a.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(pr,e,"")),t=cr}(n||e)&&this.props.push(t,e,n[t])}function Kd(t){t.translate&&(t.removeProperty("translate"),t.removeProperty("scale"),t.removeProperty("rotate"))}function Ld(){var t,e,r=this.props,i=this.target,n=i.style,a=i._gsap;for(t=0;t<r.length;t+=3)r[t+1]?i[r[t]]=r[t+2]:r[t+2]?n[r[t]]=r[t+2]:n.removeProperty("--"===r[t].substr(0,2)?r[t]:r[t].replace(hr,"-$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=Be())&&t.isStart||n[cr]||(Kd(n),a.zOrigin&&n[pr]&&(n[pr]+=" "+a.zOrigin+"px",a.zOrigin=0,a.renderTransform()),a.uncache=1)}}function Md(t,e){var r={target:t,props:[],revert:Ld,save:Jd};return t._gsap||ze.core.getCache(t),e&&e.split(",").forEach(function(t){return r.save(t)}),r}function Od(t,e){var r=De.createElementNS?De.createElementNS((e||"http://www.w3.org/1999/xhtml").replace(/^https/,"http"),t):De.createElement(t);return r&&r.style?r:De.createElement(t)}function Pd(t,e,r){var i=getComputedStyle(t);return i[e]||i.getPropertyValue(e.replace(hr,"-$1").toLowerCase())||i.getPropertyValue(e)||!r&&Pd(t,mr(e)||e,1)||""}function Sd(){(function _windowExists(){return"undefined"!=typeof window})()&&window.document&&(Ee=window,De=Ee.document,Re=De.documentElement,Le=Od("div")||{style:{}},Od("div"),cr=mr(cr),pr=cr+"Origin",Le.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",Ye=!!mr("perspective"),Be=ze.core.reverting,Fe=1)}function Td(t){var e,r=Od("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),i=this.parentNode,n=this.nextSibling,a=this.style.cssText;if(Re.appendChild(r),r.appendChild(this),this.style.display="block",t)try{e=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=Td}catch(t){}else this._gsapBBox&&(e=this._gsapBBox());return i&&(n?i.insertBefore(this,n):i.appendChild(this)),Re.removeChild(r),this.style.cssText=a,e}function Ud(t,e){for(var r=e.length;r--;)if(t.hasAttribute(e[r]))return t.getAttribute(e[r])}function Vd(e){var r;try{r=e.getBBox()}catch(t){r=Td.call(e,!0)}return r&&(r.width||r.height)||e.getBBox===Td||(r=Td.call(e,!0)),!r||r.width||r.x||r.y?r:{x:+Ud(e,["x","cx","x1"])||0,y:+Ud(e,["y","cy","y1"])||0,width:0,height:0}}function Wd(t){return!(!t.getCTM||t.parentNode&&!t.ownerSVGElement||!Vd(t))}function Xd(t,e){if(e){var r,i=t.style;e in ar&&e!==pr&&(e=cr),i.removeProperty?("ms"!==(r=e.substr(0,2))&&"webkit"!==e.substr(0,6)||(e="-"+e),i.removeProperty("--"===r?e:e.replace(hr,"-$1").toLowerCase())):i.removeAttribute(e)}}function Yd(t,e,r,i,n,a){var s=new _e(t._pt,e,r,0,1,a?Ad:zd);return(t._pt=s).b=i,s.e=n,t._props.push(r),s}function _d(t,e,r,i){var n,a,s,o,u=parseFloat(r)||0,h=(r+"").trim().substr((u+"").length)||"px",l=Le.style,f=lr.test(e),d="svg"===t.tagName.toLowerCase(),c=(d?"client":"offset")+(f?"Width":"Height"),p="px"===i,_="%"===i;if(i===h||!u||gr[i]||gr[h])return u;if("px"===h||p||(u=_d(t,e,r,"px")),o=t.getCTM&&Wd(t),(_||"%"===h)&&(ar[e]||~e.indexOf("adius")))return n=o?t.getBBox()[f?"width":"height"]:t[c],ia(_?u/n*100:u/100*n);if(l[f?"width":"height"]=100+(p?h:i),a=~e.indexOf("adius")||"em"===i&&t.appendChild&&!d?t:t.parentNode,o&&(a=(t.ownerSVGElement||{}).parentNode),a&&a!==De&&a.appendChild||(a=De.body),(s=a._gsap)&&_&&s.width&&f&&s.time===Rt.time&&!s.uncache)return ia(u/s.width*100);if(!_||"height"!==e&&"width"!==e)!_&&"%"!==h||vr[Pd(a,"display")]||(l.position=Pd(t,"position")),a===t&&(l.position="static"),a.appendChild(Le),n=Le[c],a.removeChild(Le),l.position="absolute";else{var m=t.style[e];t.style[e]=100+i,n=t[c],m?t.style[e]=m:Xd(t,e)}return f&&_&&((s=fa(a)).time=Rt.time,s.width=a[c]),ia(p?n*u/100:n&&u?100/n*u:0)}function be(t,e,r,i){if(!r||"none"===r){var n=mr(e,t,1),a=n&&Pd(t,n,1);a&&a!==r?(e=n,r=a):"borderColor"===e&&(r=Pd(t,"borderTopColor"))}var s,o,u,h,l,f,d,c,p,_,m,g=new _e(this._pt,t.style,e,0,1,ue),v=0,y=0;if(g.b=r,g.e=i,r+="","auto"===(i+="")&&(f=t.style[e],t.style[e]=i,i=Pd(t,e)||i,f?t.style[e]=f:Xd(t,e)),Fb(s=[r,i]),i=s[1],u=(r=s[0]).match(rt)||[],(i.match(rt)||[]).length){for(;o=rt.exec(i);)d=o[0],p=i.substring(v,o.index),l?l=(l+1)%5:"rgba("!==p.substr(-5)&&"hsla("!==p.substr(-5)||(l=1),d!==(f=u[y++]||"")&&(h=parseFloat(f)||0,m=f.substr((h+"").length),"="===d.charAt(1)&&(d=ka(h,d)+m),c=parseFloat(d),_=d.substr((c+"").length),v=rt.lastIndex-_.length,_||(_=_||q.units[e]||m,v===i.length&&(i+=_,g.e+=_)),m!==_&&(h=_d(t,e,f,_)||0),g._pt={_next:g._pt,p:p||1===y?p:",",s:h,c:c-h,m:l&&l<4||"zIndex"===e?Math.round:0});g.c=v<i.length?i.substring(v,i.length):""}else g.r="display"===e&&"none"===i?Ad:zd;return nt.test(i)&&(g.e=0),this._pt=g}function de(t){var e=t.split(" "),r=e[0],i=e[1]||"50%";return"top"!==r&&"bottom"!==r&&"left"!==i&&"right"!==i||(t=r,r=i,i=t),e[0]=Tr[r]||r,e[1]=Tr[i]||i,e.join(" ")}function ee(t,e){if(e.tween&&e.tween._time===e.tween._dur){var r,i,n,a=e.t,s=a.style,o=e.u,u=a._gsap;if("all"===o||!0===o)s.cssText="",i=1;else for(n=(o=o.split(",")).length;-1<--n;)r=o[n],ar[r]&&(i=1,r="transformOrigin"===r?pr:cr),Xd(a,r);i&&(Xd(a,cr),u&&(u.svg&&a.removeAttribute("transform"),Or(a,1),u.uncache=1,Kd(s)))}}function ie(t){return"matrix(1, 0, 0, 1, 0, 0)"===t||"none"===t||!t}function je(t){var e=Pd(t,cr);return ie(e)?wr:e.substr(7).match(et).map(ia)}function ke(t,e){var r,i,n,a,s=t._gsap||fa(t),o=t.style,u=je(t);return s.svg&&t.getAttribute("transform")?"1,0,0,1,0,0"===(u=[(n=t.transform.baseVal.consolidate().matrix).a,n.b,n.c,n.d,n.e,n.f]).join(",")?wr:u:(u!==wr||t.offsetParent||t===Re||s.svg||(n=o.display,o.display="block",(r=t.parentNode)&&t.offsetParent||(a=1,i=t.nextElementSibling,Re.appendChild(t)),u=je(t),n?o.display=n:Xd(t,"display"),a&&(i?r.insertBefore(t,i):r?r.appendChild(t):Re.removeChild(t))),e&&6<u.length?[u[0],u[1],u[4],u[5],u[12],u[13]]:u)}function le(t,e,r,i,n,a){var s,o,u,h=t._gsap,l=n||ke(t,!0),f=h.xOrigin||0,d=h.yOrigin||0,c=h.xOffset||0,p=h.yOffset||0,_=l[0],m=l[1],g=l[2],v=l[3],y=l[4],T=l[5],b=e.split(" "),w=parseFloat(b[0])||0,x=parseFloat(b[1])||0;r?l!==wr&&(o=_*v-m*g)&&(u=w*(-m/o)+x*(_/o)-(_*T-m*y)/o,w=w*(v/o)+x*(-g/o)+(g*T-v*y)/o,x=u):(w=(s=Vd(t)).x+(~b[0].indexOf("%")?w/100*s.width:w),x=s.y+(~(b[1]||b[0]).indexOf("%")?x/100*s.height:x)),i||!1!==i&&h.smooth?(y=w-f,T=x-d,h.xOffset=c+(y*_+T*g)-y,h.yOffset=p+(y*m+T*v)-T):h.xOffset=h.yOffset=0,h.xOrigin=w,h.yOrigin=x,h.smooth=!!i,h.origin=e,h.originIsAbsolute=!!r,t.style[pr]="0px 0px",a&&(Yd(a,h,"xOrigin",f,w),Yd(a,h,"yOrigin",d,x),Yd(a,h,"xOffset",c,h.xOffset),Yd(a,h,"yOffset",p,h.yOffset)),t.setAttribute("data-svg-origin",w+" "+x)}function oe(t,e,r){var i=Ya(e);return ia(parseFloat(e)+parseFloat(_d(t,"x",r+"px",i)))+i}function ve(t,e,i,n,a){var s,o,u=360,h=r(a),l=parseFloat(a)*(h&&~a.indexOf("rad")?sr:1)-n,f=n+l+"deg";return h&&("short"===(s=a.split("_")[1])&&(l%=u)!==l%180&&(l+=l<0?u:-u),"cw"===s&&l<0?l=(l+36e9)%u-~~(l/u)*u:"ccw"===s&&0<l&&(l=(l-36e9)%u-~~(l/u)*u)),t._pt=o=new _e(t._pt,e,i,n,l,wd),o.e=f,o.u="deg",t._props.push(i),o}function we(t,e){for(var r in e)t[r]=e[r];return t}function xe(t,e,r){var i,n,a,s,o,u,h,l=we({},r._gsap),f=r.style;for(n in l.svg?(a=r.getAttribute("transform"),r.setAttribute("transform",""),f[cr]=e,i=Or(r,1),Xd(r,cr),r.setAttribute("transform",a)):(a=getComputedStyle(r)[cr],f[cr]=e,i=Or(r,1),f[cr]=a),ar)(a=l[n])!==(s=i[n])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(n)<0&&(o=Ya(a)!==(h=Ya(s))?_d(r,n,a,h):parseFloat(a),u=parseFloat(s),t._pt=new _e(t._pt,i,n,o,u-o,vd),t._pt.u=h||0,t._props.push(n));we(i,l)}var Ee,De,Re,Fe,Le,Ie,Be,Ye,qe=Lt.Power0,Ve=Lt.Power1,Ue=Lt.Power2,Xe=Lt.Power3,Ne=Lt.Power4,Ge=Lt.Linear,We=Lt.Quad,Qe=Lt.Cubic,Ke=Lt.Quart,Je=Lt.Quint,He=Lt.Strong,$e=Lt.Elastic,Ze=Lt.Back,tr=Lt.SteppedEase,er=Lt.Bounce,rr=Lt.Sine,ir=Lt.Expo,nr=Lt.Circ,ar={},sr=180/Math.PI,or=Math.PI/180,ur=Math.atan2,hr=/([A-Z])/g,lr=/(left|right|width|margin|padding|x)/i,fr=/[\s,\(]\S/,dr={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},cr="transform",pr=cr+"Origin",_r="O,Moz,ms,Ms,Webkit".split(","),mr=function _checkPropPrefix(t,e,r){var i=(e||Le).style,n=5;if(t in i&&!r)return t;for(t=t.charAt(0).toUpperCase()+t.substr(1);n--&&!(_r[n]+t in i););return n<0?null:(3===n?"ms":0<=n?_r[n]:"")+t},gr={deg:1,rad:1,turn:1},vr={grid:1,flex:1},yr=function _get(t,e,r,i){var n;return Fe||Sd(),e in dr&&"transform"!==e&&~(e=dr[e]).indexOf(",")&&(e=e.split(",")[0]),ar[e]&&"transform"!==e?(n=Or(t,i),n="transformOrigin"!==e?n[e]:n.svg?n.origin:kr(Pd(t,pr))+" "+n.zOrigin+"px"):(n=t.style[e])&&"auto"!==n&&!i&&!~(n+"").indexOf("calc(")||(n=br[e]&&br[e](t,e,r)||Pd(t,e)||ga(t,e)||("opacity"===e?1:0)),r&&!~(n+"").trim().indexOf(" ")?_d(t,e,n,r)+r:n},Tr={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},br={clearProps:function clearProps(t,e,r,i,n){if("isFromStart"!==n.data){var a=t._pt=new _e(t._pt,e,r,0,0,ee);return a.u=i,a.pr=-10,a.tween=n,t._props.push(r),1}}},wr=[1,0,0,1,0,0],xr={},Or=function _parseTransform(t,e){var r=t._gsap||new Vt(t);if("x"in r&&!e&&!r.uncache)return r;var i,n,a,s,o,u,h,l,f,d,c,p,_,m,g,v,y,T,b,w,x,O,k,M,P,C,A,S,z,E,D,R,F=t.style,L=r.scaleX<0,I="deg",B=getComputedStyle(t),Y=Pd(t,pr)||"0";return i=n=a=u=h=l=f=d=c=0,s=o=1,r.svg=!(!t.getCTM||!Wd(t)),B.translate&&("none"===B.translate&&"none"===B.scale&&"none"===B.rotate||(F[cr]=("none"!==B.translate?"translate3d("+(B.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==B.rotate?"rotate("+B.rotate+") ":"")+("none"!==B.scale?"scale("+B.scale.split(" ").join(",")+") ":"")+("none"!==B[cr]?B[cr]:"")),F.scale=F.rotate=F.translate="none"),m=ke(t,r.svg),r.svg&&(M=r.uncache?(P=t.getBBox(),Y=r.xOrigin-P.x+"px "+(r.yOrigin-P.y)+"px",""):!e&&t.getAttribute("data-svg-origin"),le(t,M||Y,!!M||r.originIsAbsolute,!1!==r.smooth,m)),p=r.xOrigin||0,_=r.yOrigin||0,m!==wr&&(T=m[0],b=m[1],w=m[2],x=m[3],i=O=m[4],n=k=m[5],6===m.length?(s=Math.sqrt(T*T+b*b),o=Math.sqrt(x*x+w*w),u=T||b?ur(b,T)*sr:0,(f=w||x?ur(w,x)*sr+u:0)&&(o*=Math.abs(Math.cos(f*or))),r.svg&&(i-=p-(p*T+_*w),n-=_-(p*b+_*x))):(R=m[6],E=m[7],A=m[8],S=m[9],z=m[10],D=m[11],i=m[12],n=m[13],a=m[14],h=(g=ur(R,z))*sr,g&&(M=O*(v=Math.cos(-g))+A*(y=Math.sin(-g)),P=k*v+S*y,C=R*v+z*y,A=O*-y+A*v,S=k*-y+S*v,z=R*-y+z*v,D=E*-y+D*v,O=M,k=P,R=C),l=(g=ur(-w,z))*sr,g&&(v=Math.cos(-g),D=x*(y=Math.sin(-g))+D*v,T=M=T*v-A*y,b=P=b*v-S*y,w=C=w*v-z*y),u=(g=ur(b,T))*sr,g&&(M=T*(v=Math.cos(g))+b*(y=Math.sin(g)),P=O*v+k*y,b=b*v-T*y,k=k*v-O*y,T=M,O=P),h&&359.9<Math.abs(h)+Math.abs(u)&&(h=u=0,l=180-l),s=ia(Math.sqrt(T*T+b*b+w*w)),o=ia(Math.sqrt(k*k+R*R)),g=ur(O,k),f=2e-4<Math.abs(g)?g*sr:0,c=D?1/(D<0?-D:D):0),r.svg&&(M=t.getAttribute("transform"),r.forceCSS=t.setAttribute("transform","")||!ie(Pd(t,cr)),M&&t.setAttribute("transform",M))),90<Math.abs(f)&&Math.abs(f)<270&&(L?(s*=-1,f+=u<=0?180:-180,u+=u<=0?180:-180):(o*=-1,f+=f<=0?180:-180)),e=e||r.uncache,r.x=i-((r.xPercent=i&&(!e&&r.xPercent||(Math.round(t.offsetWidth/2)===Math.round(-i)?-50:0)))?t.offsetWidth*r.xPercent/100:0)+"px",r.y=n-((r.yPercent=n&&(!e&&r.yPercent||(Math.round(t.offsetHeight/2)===Math.round(-n)?-50:0)))?t.offsetHeight*r.yPercent/100:0)+"px",r.z=a+"px",r.scaleX=ia(s),r.scaleY=ia(o),r.rotation=ia(u)+I,r.rotationX=ia(h)+I,r.rotationY=ia(l)+I,r.skewX=f+I,r.skewY=d+I,r.transformPerspective=c+"px",(r.zOrigin=parseFloat(Y.split(" ")[2])||!e&&r.zOrigin||0)&&(F[pr]=kr(Y)),r.xOffset=r.yOffset=0,r.force3D=q.force3D,r.renderTransform=r.svg?zr:Ye?Sr:Mr,r.uncache=0,r},kr=function _firstTwoOnly(t){return(t=t.split(" "))[0]+" "+t[1]},Mr=function _renderNon3DTransforms(t,e){e.z="0px",e.rotationY=e.rotationX="0deg",e.force3D=0,Sr(t,e)},Pr="0deg",Cr="0px",Ar=") ",Sr=function _renderCSSTransforms(t,e){var r=e||this,i=r.xPercent,n=r.yPercent,a=r.x,s=r.y,o=r.z,u=r.rotation,h=r.rotationY,l=r.rotationX,f=r.skewX,d=r.skewY,c=r.scaleX,p=r.scaleY,_=r.transformPerspective,m=r.force3D,g=r.target,v=r.zOrigin,y="",T="auto"===m&&t&&1!==t||!0===m;if(v&&(l!==Pr||h!==Pr)){var b,w=parseFloat(h)*or,x=Math.sin(w),O=Math.cos(w);w=parseFloat(l)*or,b=Math.cos(w),a=oe(g,a,x*b*-v),s=oe(g,s,-Math.sin(w)*-v),o=oe(g,o,O*b*-v+v)}_!==Cr&&(y+="perspective("+_+Ar),(i||n)&&(y+="translate("+i+"%, "+n+"%) "),!T&&a===Cr&&s===Cr&&o===Cr||(y+=o!==Cr||T?"translate3d("+a+", "+s+", "+o+") ":"translate("+a+", "+s+Ar),u!==Pr&&(y+="rotate("+u+Ar),h!==Pr&&(y+="rotateY("+h+Ar),l!==Pr&&(y+="rotateX("+l+Ar),f===Pr&&d===Pr||(y+="skew("+f+", "+d+Ar),1===c&&1===p||(y+="scale("+c+", "+p+Ar),g.style[cr]=y||"translate(0, 0)"},zr=function _renderSVGTransforms(t,e){var r,i,n,a,s,o=e||this,u=o.xPercent,h=o.yPercent,l=o.x,f=o.y,d=o.rotation,c=o.skewX,p=o.skewY,_=o.scaleX,m=o.scaleY,g=o.target,v=o.xOrigin,y=o.yOrigin,T=o.xOffset,b=o.yOffset,w=o.forceCSS,x=parseFloat(l),O=parseFloat(f);d=parseFloat(d),c=parseFloat(c),(p=parseFloat(p))&&(c+=p=parseFloat(p),d+=p),d||c?(d*=or,c*=or,r=Math.cos(d)*_,i=Math.sin(d)*_,n=Math.sin(d-c)*-m,a=Math.cos(d-c)*m,c&&(p*=or,s=Math.tan(c-p),n*=s=Math.sqrt(1+s*s),a*=s,p&&(s=Math.tan(p),r*=s=Math.sqrt(1+s*s),i*=s)),r=ia(r),i=ia(i),n=ia(n),a=ia(a)):(r=_,a=m,i=n=0),(x&&!~(l+"").indexOf("px")||O&&!~(f+"").indexOf("px"))&&(x=_d(g,"x",l,"px"),O=_d(g,"y",f,"px")),(v||y||T||b)&&(x=ia(x+v-(v*r+y*n)+T),O=ia(O+y-(v*i+y*a)+b)),(u||h)&&(s=g.getBBox(),x=ia(x+u/100*s.width),O=ia(O+h/100*s.height)),s="matrix("+r+","+i+","+n+","+a+","+x+","+O+")",g.setAttribute("transform",s),w&&(g.style[cr]=s)};ha("padding,margin,Width,Radius",function(e,r){var t="Right",i="Bottom",n="Left",o=(r<3?["Top",t,i,n]:["Top"+n,"Top"+t,i+t,i+n]).map(function(t){return r<2?e+t:"border"+t+e});br[1<r?"border"+e:e]=function(e,t,r,i,n){var a,s;if(arguments.length<4)return a=o.map(function(t){return yr(e,t,r)}),5===(s=a.join(" ")).split(a[0]).length?a[0]:s;a=(i+"").split(" "),s={},o.forEach(function(t,e){return s[t]=a[e]=a[e]||a[(e-1)/2|0]}),e.init(t,s,n)}});var Er,Dr,Rr,Fr={name:"css",register:Sd,targetTest:function targetTest(t){return t.style&&t.nodeType},init:function init(t,e,i,n,a){var s,o,u,h,l,f,d,c,p,_,m,g,v,y,T,b,w=this._props,x=t.style,O=i.vars.startAt;for(d in Fe||Sd(),this.styles=this.styles||Md(t),b=this.styles.props,this.tween=i,e)if("autoRound"!==d&&(o=e[d],!pt[d]||!ac(d,e,i,n,t,a)))if(l=typeof o,f=br[d],"function"===l&&(l=typeof(o=o.call(i,n,t,a))),"string"===l&&~o.indexOf("random(")&&(o=ob(o)),f)f(this,t,d,o,i)&&(T=1);else if("--"===d.substr(0,2))s=(getComputedStyle(t).getPropertyValue(d)+"").trim(),o+="",Et.lastIndex=0,Et.test(s)||(c=Ya(s),p=Ya(o)),p?c!==p&&(s=_d(t,d,s,p)+p):c&&(o+=c),this.add(x,"setProperty",s,o,n,a,0,0,d),w.push(d),b.push(d,0,x[d]);else if("undefined"!==l){if(O&&d in O?(s="function"==typeof O[d]?O[d].call(i,n,t,a):O[d],r(s)&&~s.indexOf("random(")&&(s=ob(s)),Ya(s+"")||"auto"===s||(s+=q.units[d]||Ya(yr(t,d))||""),"="===(s+"").charAt(1)&&(s=yr(t,d))):s=yr(t,d),h=parseFloat(s),(_="string"===l&&"="===o.charAt(1)&&o.substr(0,2))&&(o=o.substr(2)),u=parseFloat(o),d in dr&&("autoAlpha"===d&&(1===h&&"hidden"===yr(t,"visibility")&&u&&(h=0),b.push("visibility",0,x.visibility),Yd(this,x,"visibility",h?"inherit":"hidden",u?"inherit":"hidden",!u)),"scale"!==d&&"transform"!==d&&~(d=dr[d]).indexOf(",")&&(d=d.split(",")[0])),m=d in ar)if(this.styles.save(d),g||((v=t._gsap).renderTransform&&!e.parseTransform||Or(t,e.parseTransform),y=!1!==e.smoothOrigin&&v.smooth,(g=this._pt=new _e(this._pt,x,cr,0,1,v.renderTransform,v,0,-1)).dep=1),"scale"===d)this._pt=new _e(this._pt,v,"scaleY",v.scaleY,(_?ka(v.scaleY,_+u):u)-v.scaleY||0,vd),this._pt.u=0,w.push("scaleY",d),d+="X";else{if("transformOrigin"===d){b.push(pr,0,x[pr]),o=de(o),v.svg?le(t,o,0,y,0,this):((p=parseFloat(o.split(" ")[2])||0)!==v.zOrigin&&Yd(this,v,"zOrigin",v.zOrigin,p),Yd(this,x,d,kr(s),kr(o)));continue}if("svgOrigin"===d){le(t,o,1,y,0,this);continue}if(d in xr){ve(this,v,d,h,_?ka(h,_+o):o);continue}if("smoothOrigin"===d){Yd(this,v,"smooth",v.smooth,o);continue}if("force3D"===d){v[d]=o;continue}if("transform"===d){xe(this,o,t);continue}}else d in x||(d=mr(d)||d);if(m||(u||0===u)&&(h||0===h)&&!fr.test(o)&&d in x)u=u||0,(c=(s+"").substr((h+"").length))!==(p=Ya(o)||(d in q.units?q.units[d]:c))&&(h=_d(t,d,s,p)),this._pt=new _e(this._pt,m?v:x,d,h,(_?ka(h,_+u):u)-h,m||"px"!==p&&"zIndex"!==d||!1===e.autoRound?vd:yd),this._pt.u=p||0,c!==p&&"%"!==p&&(this._pt.b=s,this._pt.r=xd);else if(d in x)be.call(this,t,d,s,_?_+o:o);else if(d in t)this.add(t,d,s||t[d],_?_+o:o,n,a);else if("parseTransform"!==d){Q(d,o);continue}m||(d in x?b.push(d,0,x[d]):b.push(d,1,s||t[d])),w.push(d)}T&&pe(this)},render:function render(t,e){if(e.tween._time||!Be())for(var r=e._pt;r;)r.r(t,r.d),r=r._next;else e.styles.revert()},get:yr,aliases:dr,getSetter:function getSetter(t,e,r){var i=dr[e];return i&&i.indexOf(",")<0&&(e=i),e in ar&&e!==pr&&(t._gsap.x||yr(t,"x"))?r&&Ie===r?"scale"===e?Ed:Dd:(Ie=r||{})&&("scale"===e?Fd:Gd):t.style&&!u(t.style[e])?Bd:~e.indexOf("-")?Cd:ne(t,e)},core:{_removeProperty:Xd,_getMatrix:ke}};ze.utils.checkPrefix=mr,ze.core.getStyleSaver=Md,Rr=ha((Er="x,y,z,scale,scaleX,scaleY,xPercent,yPercent")+","+(Dr="rotation,rotationX,rotationY,skewX,skewY")+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",function(t){ar[t]=1}),ha(Dr,function(t){q.units[t]="deg",xr[t]=1}),dr[Rr[13]]=Er+","+Dr,ha("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",function(t){var e=t.split(":");dr[e[1]]=Rr[e[0]]}),ha("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(t){q.units[t]="px"}),ze.registerPlugin(Fr);var Lr=ze.registerPlugin(Fr)||ze,Ir=Lr.core.Tween;e.Back=Ze,e.Bounce=er,e.CSSPlugin=Fr,e.Circ=nr,e.Cubic=Qe,e.Elastic=$e,e.Expo=ir,e.Linear=Ge,e.Power0=qe,e.Power1=Ve,e.Power2=Ue,e.Power3=Xe,e.Power4=Ne,e.Quad=We,e.Quart=Ke,e.Quint=Je,e.Sine=rr,e.SteppedEase=tr,e.Strong=He,e.TimelineLite=Xt,e.TimelineMax=Xt,e.TweenLite=$t,e.TweenMax=Ir,e.default=Lr,e.gsap=Lr;if (typeof(window)==="undefined"||window!==e){Object.defineProperty(e,"__esModule",{value:!0})} else {delete e.default}});
/*!
 * EasePack 3.12.5
 * https://gsap.com
 * 
 * @license Copyright 2024, GreenSock. All rights reserved.
 * Subject to the terms at https://gsap.com/standard-license or for Club GSAP members, the agreement issued with that membership.
 * @author: Jack Doyle, jack@greensock.com
 */

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e=e||self).window=e.window||{})}(this,function(e){"use strict";function f(){return w||"undefined"!=typeof window&&(w=window.gsap)&&w.registerPlugin&&w}function g(e,n){return!!(void 0===e?n:e&&!~(e+"").indexOf("false"))}function h(e){if(w=e||f()){r=w.registerEase;var n,t=w.parseEase(),o=function createConfig(t){return function(e){var n=.5+e/2;t.config=function(e){return t(2*(1-e)*e*n+e*e)}}};for(n in t)t[n].config||o(t[n]);for(n in r("slow",a),r("expoScale",s),r("rough",u),c)"version"!==n&&w.core.globals(n,c[n])}}function i(e,n,t){var o=(e=Math.min(1,e||.7))<1?n||0===n?n:.7:0,r=(1-e)/2,i=r+e,a=g(t);return function(e){var n=e+(.5-e)*o;return e<r?a?1-(e=1-e/r)*e:n-(e=1-e/r)*e*e*e*n:i<e?a?1===e?0:1-(e=(e-i)/r)*e:n+(e-n)*(e=(e-i)/r)*e*e*e:a?1:n}}function j(n,e,t){var o=Math.log(e/n),r=e-n;return t=t&&w.parseEase(t),function(e){return(n*Math.exp(o*(t?t(e):e))-n)/r}}function k(e,n,t){this.t=e,this.v=n,t&&(((this.next=t).prev=this).c=t.v-n,this.gap=t.t-e)}function l(e){"object"!=typeof e&&(e={points:+e||20});for(var n,t,o,r,i,a,f,s=e.taper||"none",u=[],c=0,p=0|(+e.points||20),l=p,v=g(e.randomize,!0),d=g(e.clamp),h=w?w.parseEase(e.template):0,x=.4*(+e.strength||1);-1<--l;)n=v?Math.random():1/p*l,t=h?h(n):n,o="none"===s?x:"out"===s?(r=1-n)*r*x:"in"===s?n*n*x:n<.5?(r=2*n)*r*.5*x:(r=2*(1-n))*r*.5*x,v?t+=Math.random()*o-.5*o:l%2?t+=.5*o:t-=.5*o,d&&(1<t?t=1:t<0&&(t=0)),u[c++]={x:n,y:t};for(u.sort(function(e,n){return e.x-n.x}),a=new k(1,1,null),l=p;l--;)i=u[l],a=new k(i.x,i.y,a);return f=new k(0,0,a.t?a:a.next),function(e){var n=f;if(e>n.t){for(;n.next&&e>=n.t;)n=n.next;n=n.prev}else for(;n.prev&&e<=n.t;)n=n.prev;return(f=n).v+(e-n.t)/n.gap*n.c}}var w,r,a=i(.7);(a.ease=a).config=i;var s=j(1,2);s.config=j;var u=l();(u.ease=u).config=l;var c={SlowMo:a,RoughEase:u,ExpoScaleEase:s};for(var n in c)c[n].register=h,c[n].version="3.12.5";f()&&w.registerPlugin(a),e.EasePack=c,e.ExpoScaleEase=s,e.RoughEase=u,e.SlowMo=a,e.default=c;if (typeof(window)==="undefined"||window!==e){Object.defineProperty(e,"__esModule",{value:!0})} else {delete e.default}});
// source --> http://nsl.com.tr/wp-content/plugins/woody_helper_plugin/elementor/assets/js/effects/audio-visualizers.min.js?ver=1 
function initAudioVisualizers(e,t,r,n,a,o,s,c,h){var d,p,f,m,$,x,y,S,E,_,T,M,A,C,R,P,D,U,I,N,O,F,B,z,k,H,V,G,W,X,q,Y,j,Z,K,J,Q,et,ei,er,en,ea,eo,es,el,eu,ec,eh,ed,ep,ef,em,eg,e8,e$,ev,ex,ey,eS,eE,eb,e_,eT,eM,ew,eA,eC,eR,e0,eP,eL,e1,eD,eU,eI,eN,eO,eF,eB,ez,e2,ek,eH,eV,e3,eG,e4,eW,e6,e5,e7,eX,eq,eY,ej,eZ,eK,eJ,eQ,e9,te,tt,ti,tr,tn,ta,to,ts,tl,tu,tc,th,td,tp,tf,tm,tg,t8,t$,tv,tx,ty,tS,tE,tb,t_,tT,tM,tw,tA,tC,tR,t0,tP,tL,t1,tD,tU,tI,tN,tO,tF,tB,tz,t2,tk,tH,tV,t3,tG,t4,tW,t6,t5,t7,tX,tq,tY,tj,tZ,tK,tJ,tQ,t9,ie,it,ii,ir,ia,io,is,il,iu,ic,ih,id,ip,im,ig,i8,i$,iv,ix,iy,iS,iE,ib,i_,iT,iM,iw,iA,iC,iR,i0,iP,iL,i1,iD,iU,iI,iN,iO,iF,iB,iz,i2,ik,iH,iV,i3,iG,i4,iW,i6,i5,i7,iX,iq,iY,ij,iZ,iK,iJ,iQ,i9,re,rt,ri,rr,rn,ra,ro,rs,rl,ru,rc,rh,rd,rp,rf,rm,rg,r8,r$,rv,rx,ry,rS,rE,rb,r_,rT,rM,rw,rA,rC,rR,r0,rP,rL,r1,rD,rU,rI,rN,rO,rF,rB,rz,r2,rk,rH,rV,r3,rG,r4,rW,r6,r5,r7,rX,rq,rY,rj,rZ,rK,rJ,rQ,r9,ne,nt,ni,nr,nn,na,no,ns,nl,nu,nc,nh,nd,np,nf,nm,ng,n8,n$,nv,nx,ny,nS,nE,nb,n_,nT,nM,nw,nA,nC,nR,n0,nP,nL,n1,nD,nU,nI,nN,nO,nF,nB,nz,n2,nk,nH,nV,n3,nG,n4,nW,n6,n5,n7,nX,nq,nY,nj,nZ,nK,nJ,nQ,n9,ae,at,ai,ar,an,aa,ao,as,al,au,ac,ah,ad,ap,af,am,ag,a8,a$,av,ax,ay,aS,aE,ab,a_,aT,aM,aw,aA,aC,aR,a0,aP,aL,a1,aD,aU,aI,aN,aO,aF,aB,az,a2,ak,aH,aV,a3,aG,a4,aW,a6,a5,a7,aX,aq,aY,aj,aZ,aK,aJ,aQ,a9,oe,ot,oi,or,on,oa,oo,os,ol,ou,oc,oh,od,op,of,om,og,o8,o$,ov,ox,oy=Object.defineProperty,oS=(e,t,r)=>t in e?oy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oE=(e,t,r)=>(oS(e,"symbol"!=typeof t?t+"":t,r),r);!function(){let e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(let t of document.querySelectorAll('link[rel="modulepreload"]'))r(t);new MutationObserver(e=>{for(let t of e)if("childList"===t.type)for(let n of t.addedNodes)"LINK"===n.tagName&&"modulepreload"===n.rel&&r(n)}).observe(document,{childList:!0,subtree:!0})}function r(e){if(e.ep)return;e.ep=!0;let t=function e(t){let r={};return t.integrity&&(r.integrity=t.integrity),t.referrerPolicy&&(r.referrerPolicy=t.referrerPolicy),"use-credentials"===t.crossOrigin?r.credentials="include":"anonymous"===t.crossOrigin?r.credentials="omit":r.credentials="same-origin",r}(e);fetch(e.href,t)}}();/**
	* @license
	* Copyright 2010-2023 Three.js Authors
	* SPDX-License-Identifier: MIT
	*/ let ob=0,o_="srgb",oT="srgb-linear",oM="display-p3",ow="display-p3-linear",oA="linear",oC="srgb",oR="rec709",o0="300 es";class oP{addEventListener(e,t){void 0===this._listeners&&(this._listeners={});let r=this._listeners;void 0===r[e]&&(r[e]=[]),-1===r[e].indexOf(t)&&r[e].push(t)}hasEventListener(e,t){if(void 0===this._listeners)return!1;let r=this._listeners;return void 0!==r[e]&&-1!==r[e].indexOf(t)}removeEventListener(e,t){if(void 0===this._listeners)return;let r=this._listeners[e];if(void 0!==r){let n=r.indexOf(t);-1!==n&&r.splice(n,1)}}dispatchEvent(e){if(void 0===this._listeners)return;let t=this._listeners[e.type];if(void 0!==t){e.target=this;let r=t.slice(0);for(let n=0,a=r.length;n<a;n++)r[n].call(this,e);e.target=null}}}let oL=["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"],o1=1234567,oD=Math.PI/180,oU=180/Math.PI;function oI(){let e=4294967295*Math.random()|0,t=4294967295*Math.random()|0,r=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(oL[255&e]+oL[e>>8&255]+oL[e>>16&255]+oL[e>>24&255]+"-"+oL[255&t]+oL[t>>8&255]+"-"+oL[t>>16&15|64]+oL[t>>24&255]+"-"+oL[63&r|128]+oL[r>>8&255]+"-"+oL[r>>16&255]+oL[r>>24&255]+oL[255&n]+oL[n>>8&255]+oL[n>>16&255]+oL[n>>24&255]).toLowerCase()}function oN(e,t,r){return Math.max(t,Math.min(r,e))}function oO(e,t){return(e%t+t)%t}function oF(e,t,r){return(1-r)*e+r*t}function oB(e){return e*oD}function oz(e){return e*oU}function o2(e){return(e&e-1)==0&&0!==e}function ok(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}function oH(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error("Invalid component type.")}}function oV(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw Error("Invalid component type.")}}let o3={DEG2RAD:oD,RAD2DEG:oU,generateUUID:oI,clamp:oN,euclideanModulo:oO,mapLinear:function e(t,r,n,a,o){return a+(t-r)*(o-a)/(n-r)},inverseLerp:function e(t,r,n){return t!==r?(n-t)/(r-t):0},lerp:oF,damp:function e(t,r,n,a){return oF(t,r,1-Math.exp(-n*a))},pingpong:function e(t,r=1){return r-Math.abs(oO(t,2*r)-r)},smoothstep:function e(t,r,n){return t<=r?0:t>=n?1:(t=(t-r)/(n-r))*t*(3-2*t)},smootherstep:function e(t,r,n){return t<=r?0:t>=n?1:(t=(t-r)/(n-r))*t*t*(t*(6*t-15)+10)},randInt:function e(t,r){return t+Math.floor(Math.random()*(r-t+1))},randFloat:function e(t,r){return t+Math.random()*(r-t)},randFloatSpread:function e(t){return t*(.5-Math.random())},seededRandom:function e(t){void 0!==t&&(o1=t);let r=o1+=1831565813;return r=Math.imul(r^r>>>15,1|r),(((r^=r+Math.imul(r^r>>>7,61|r))^r>>>14)>>>0)/4294967296},degToRad:oB,radToDeg:oz,isPowerOfTwo:o2,ceilPowerOfTwo:function e(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:ok,setQuaternionFromProperEuler:function e(t,r,n,a,o){let s=Math.cos,c=Math.sin,h=s(n/2),d=c(n/2),p=s((r+a)/2),f=c((r+a)/2),m=s((r-a)/2),$=c((r-a)/2),x=s((a-r)/2),y=c((a-r)/2);switch(o){case"XYX":t.set(h*f,d*m,d*$,h*p);break;case"YZY":t.set(d*$,h*f,d*m,h*p);break;case"ZXZ":t.set(d*m,d*$,h*f,h*p);break;case"XZX":t.set(h*f,d*y,d*x,h*p);break;case"YXY":t.set(d*x,h*f,d*y,h*p);break;case"ZYZ":t.set(d*y,d*x,h*f,h*p);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+o)}},normalize:oV,denormalize:oH};class oG{constructor(e=0,t=0){oG.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,r=this.y,n=e.elements;return this.x=n[0]*t+n[3]*r+n[6],this.y=n[1]*t+n[4]*r+n[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.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(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let r=this.dot(e)/t;return Math.acos(oN(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let r=Math.cos(t),n=Math.sin(t),a=this.x-e.x,o=this.y-e.y;return this.x=a*r-o*n+e.x,this.y=a*n+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class o4{constructor(e,t,r,n,a,o,s,c,h){o4.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,r,n,a,o,s,c,h)}set(e,t,r,n,a,o,s,c,h){let d=this.elements;return d[0]=e,d[1]=n,d[2]=s,d[3]=t,d[4]=a,d[5]=c,d[6]=r,d[7]=o,d[8]=h,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let r=e.elements,n=t.elements,a=this.elements,o=r[0],s=r[3],c=r[6],h=r[1],d=r[4],p=r[7],f=r[2],m=r[5],$=r[8],x=n[0],y=n[3],S=n[6],E=n[1],_=n[4],T=n[7],M=n[2],A=n[5],C=n[8];return a[0]=o*x+s*E+c*M,a[3]=o*y+s*_+c*A,a[6]=o*S+s*T+c*C,a[1]=h*x+d*E+p*M,a[4]=h*y+d*_+p*A,a[7]=h*S+d*T+p*C,a[2]=f*x+m*E+$*M,a[5]=f*y+m*_+$*A,a[8]=f*S+m*T+$*C,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],c=e[6],h=e[7],d=e[8];return t*o*d-t*s*h-r*a*d+r*s*c+n*a*h-n*o*c}invert(){let e=this.elements,t=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],c=e[6],h=e[7],d=e[8],p=d*o-s*h,f=s*c-d*a,m=h*a-o*c,$=t*p+r*f+n*m;if(0===$)return this.set(0,0,0,0,0,0,0,0,0);let x=1/$;return e[0]=p*x,e[1]=(n*h-d*r)*x,e[2]=(s*r-n*o)*x,e[3]=f*x,e[4]=(d*t-n*c)*x,e[5]=(n*a-s*t)*x,e[6]=m*x,e[7]=(r*c-h*t)*x,e[8]=(o*t-r*a)*x,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,n,a,o,s){let c=Math.cos(a),h=Math.sin(a);return this.set(r*c,r*h,-r*(c*o+h*s)+o+e,-n*h,n*c,-n*(-h*o+c*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(oW.makeScale(e,t)),this}rotate(e){return this.premultiply(oW.makeRotation(-e)),this}translate(e,t){return this.premultiply(oW.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,r=e.elements;for(let n=0;n<9;n++)if(t[n]!==r[n])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){let r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}let oW=new o4;function o6(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function o5(e){return document.createElementNS("http://www.w3.org/1999/xhtml",e)}let o7={};function oX(e){e in o7||(o7[e]=!0,console.warn(e))}let oq=new o4().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),oY=new o4().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),oj={[oT]:{transfer:oA,primaries:oR,toReference:e=>e,fromReference:e=>e},[o_]:{transfer:oC,primaries:oR,toReference:e=>e.convertSRGBToLinear(),fromReference:e=>e.convertLinearToSRGB()},[ow]:{transfer:oA,primaries:"p3",toReference:e=>e.applyMatrix3(oY),fromReference:e=>e.applyMatrix3(oq)},[oM]:{transfer:oC,primaries:"p3",toReference:e=>e.convertSRGBToLinear().applyMatrix3(oY),fromReference:e=>e.applyMatrix3(oq).convertLinearToSRGB()}},oZ=new Set([oT,ow]),oK={enabled:!0,_workingColorSpace:oT,get legacyMode(){return console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),!this.enabled},set legacyMode(i){console.warn("THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150."),this.enabled=!i},get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(i){if(!oZ.has(i))throw Error(`Unsupported working color space, "${i}".`);this._workingColorSpace=i},convert:function(e,t,r){if(!1===this.enabled||t===r||!t||!r)return e;let n=oj[t].toReference,a=oj[r].fromReference;return a(n(e))},fromWorkingColorSpace:function(e,t){return this.convert(e,this._workingColorSpace,t)},toWorkingColorSpace:function(e,t){return this.convert(e,t,this._workingColorSpace)},getPrimaries:function(e){return oj[e].primaries},getTransfer:function(e){return""===e?oA:oj[e].transfer}};function oJ(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function oQ(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let o9;class se{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{void 0===o9&&(o9=o5("canvas")),o9.width=e.width,o9.height=e.height;let r=o9.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=o9}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap){let t=o5("canvas");t.width=e.width,t.height=e.height;let r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);let n=r.getImageData(0,0,e.width,e.height),a=n.data;for(let o=0;o<a.length;o++)a[o]=255*oJ(a[o]/255);return r.putImageData(n,0,0),t}if(!e.data)return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e;{let s=e.data.slice(0);for(let c=0;c<s.length;c++)s instanceof Uint8Array||s instanceof Uint8ClampedArray?s[c]=Math.floor(255*oJ(s[c]/255)):s[c]=oJ(s[c]);return{data:s,width:e.width,height:e.height}}}}let st=0;class si{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:st++}),this.uuid=oI(),this.data=e,this.version=0}set needsUpdate(e){!0===e&&this.version++}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];let r={uuid:this.uuid,url:""},n=this.data;if(null!==n){let a;if(Array.isArray(n)){a=[];for(let o=0,s=n.length;o<s;o++)n[o].isDataTexture?a.push(sr(n[o].image)):a.push(sr(n[o]))}else a=sr(n);r.url=a}return t||(e.images[this.uuid]=r),r}}function sr(e){return"u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap?se.getDataURL(e):e.data?{data:Array.from(e.data),width:e.width,height:e.height,type:e.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}let sn=0;class sa extends oP{constructor(e=sa.DEFAULT_IMAGE,t=sa.DEFAULT_MAPPING,r=1001,n=1001,a=1006,o=1008,s=1023,c=1009,h=sa.DEFAULT_ANISOTROPY,d=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:sn++}),this.uuid=oI(),this.name="",this.source=new si(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=r,this.wrapT=n,this.magFilter=a,this.minFilter=o,this.anisotropy=h,this.format=s,this.internalFormat=null,this.type=c,this.offset=new oG(0,0),this.repeat=new oG(1,1),this.center=new oG(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new o4,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,"string"==typeof d?this.colorSpace=d:(oX("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=3001===d?o_:""),this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}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(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];let r={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).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&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(300!==this.mapping)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case 1e3:e.x=e.x-Math.floor(e.x);break;case 1001:e.x=e.x<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case 1e3:e.y=e.y-Math.floor(e.y);break;case 1001:e.y=e.y<0?0:1;break;case 1002:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}get encoding(){return oX("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace===o_?3001:3e3}set encoding(e){oX("THREE.Texture: Property .encoding has been replaced by .colorSpace."),this.colorSpace=3001===e?o_:""}}sa.DEFAULT_IMAGE=null,sa.DEFAULT_MAPPING=300,sa.DEFAULT_ANISOTROPY=1;class so{constructor(e=0,t=0,r=0,n=1){so.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=n}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,n){return this.x=e,this.y=t,this.z=r,this.w=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,r=this.y,n=this.z,a=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*n+o[12]*a,this.y=o[1]*t+o[5]*r+o[9]*n+o[13]*a,this.z=o[2]*t+o[6]*r+o[10]*n+o[14]*a,this.w=o[3]*t+o[7]*r+o[11]*n+o[15]*a,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,n,a,o=e.elements,s=o[0],c=o[4],h=o[8],d=o[1],p=o[5],f=o[9],m=o[2],$=o[6],x=o[10];if(.01>Math.abs(c-d)&&.01>Math.abs(h-m)&&.01>Math.abs(f-$)){if(.1>Math.abs(c+d)&&.1>Math.abs(h+m)&&.1>Math.abs(f+$)&&.1>Math.abs(s+p+x-3))return this.set(1,0,0,0),this;t=Math.PI;let y=(s+1)/2,S=(p+1)/2,E=(x+1)/2,_=(c+d)/4,T=(h+m)/4,M=(f+$)/4;return y>S&&y>E?y<.01?(r=0,n=.707106781,a=.707106781):(n=_/(r=Math.sqrt(y)),a=T/r):S>E?S<.01?(r=.707106781,n=0,a=.707106781):(r=_/(n=Math.sqrt(S)),a=M/n):E<.01?(r=.707106781,n=.707106781,a=0):(r=T/(a=Math.sqrt(E)),n=M/a),this.set(r,n,a,t),this}let A=Math.sqrt(($-f)*($-f)+(h-m)*(h-m)+(d-c)*(d-c));return .001>Math.abs(A)&&(A=1),this.x=($-f)/A,this.y=(h-m)/A,this.z=(d-c)/A,this.w=Math.acos((s+p+x-1)/2),this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),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 ss extends oP{constructor(e=1,t=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new so(0,0,e,t),this.scissorTest=!1,this.viewport=new so(0,0,e,t),void 0!==r.encoding&&(oX("THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace."),r.colorSpace=3001===r.encoding?o_:""),r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:1006,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0},r),this.texture=new sa({width:e,height:t,depth:1},r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps,this.texture.internalFormat=r.internalFormat,this.depthBuffer=r.depthBuffer,this.stencilBuffer=r.stencilBuffer,this.depthTexture=r.depthTexture,this.samples=r.samples}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new si(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,null!==e.depthTexture&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class sl extends ss{constructor(e=1,t=1,r={}){super(e,t,r),this.isWebGLRenderTarget=!0}}class su extends sa{constructor(e=null,t=1,r=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class sc{constructor(e=0,t=0,r=0,n=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=n}static slerpFlat(e,t,r,n,a,o,s){let c=r[n+0],h=r[n+1],d=r[n+2],p=r[n+3],f=a[o+0],m=a[o+1],$=a[o+2],x=a[o+3];if(0===s){e[t+0]=c,e[t+1]=h,e[t+2]=d,e[t+3]=p;return}if(1===s){e[t+0]=f,e[t+1]=m,e[t+2]=$,e[t+3]=x;return}if(p!==x||c!==f||h!==m||d!==$){let y=1-s,S=c*f+h*m+d*$+p*x,E=S>=0?1:-1,_=1-S*S;if(_>Number.EPSILON){let T=Math.sqrt(_),M=Math.atan2(T,S*E);y=Math.sin(y*M)/T,s=Math.sin(s*M)/T}let A=s*E;if(c=c*y+f*A,h=h*y+m*A,d=d*y+$*A,p=p*y+x*A,y===1-s){let C=1/Math.sqrt(c*c+h*h+d*d+p*p);c*=C,h*=C,d*=C,p*=C}}e[t]=c,e[t+1]=h,e[t+2]=d,e[t+3]=p}static multiplyQuaternionsFlat(e,t,r,n,a,o){let s=r[n],c=r[n+1],h=r[n+2],d=r[n+3],p=a[o],f=a[o+1],m=a[o+2],$=a[o+3];return e[t]=s*$+d*p+c*m-h*f,e[t+1]=c*$+d*f+h*p-s*m,e[t+2]=h*$+d*m+s*f-c*p,e[t+3]=d*$-s*p-c*f-h*m,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,n){return this._x=e,this._y=t,this._z=r,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){let r=e._x,n=e._y,a=e._z,o=e._order,s=Math.cos,c=Math.sin,h=s(r/2),d=s(n/2),p=s(a/2),f=c(r/2),m=c(n/2),$=c(a/2);switch(o){case"XYZ":this._x=f*d*p+h*m*$,this._y=h*m*p-f*d*$,this._z=h*d*$+f*m*p,this._w=h*d*p-f*m*$;break;case"YXZ":this._x=f*d*p+h*m*$,this._y=h*m*p-f*d*$,this._z=h*d*$-f*m*p,this._w=h*d*p+f*m*$;break;case"ZXY":this._x=f*d*p-h*m*$,this._y=h*m*p+f*d*$,this._z=h*d*$+f*m*p,this._w=h*d*p-f*m*$;break;case"ZYX":this._x=f*d*p-h*m*$,this._y=h*m*p+f*d*$,this._z=h*d*$-f*m*p,this._w=h*d*p+f*m*$;break;case"YZX":this._x=f*d*p+h*m*$,this._y=h*m*p+f*d*$,this._z=h*d*$-f*m*p,this._w=h*d*p-f*m*$;break;case"XZY":this._x=f*d*p-h*m*$,this._y=h*m*p-f*d*$,this._z=h*d*$+f*m*p,this._w=h*d*p+f*m*$;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return!1!==t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let r=t/2,n=Math.sin(r);return this._x=e.x*n,this._y=e.y*n,this._z=e.z*n,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,r=t[0],n=t[4],a=t[8],o=t[1],s=t[5],c=t[9],h=t[2],d=t[6],p=t[10],f=r+s+p;if(f>0){let m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(d-c)*m,this._y=(a-h)*m,this._z=(o-n)*m}else if(r>s&&r>p){let $=2*Math.sqrt(1+r-s-p);this._w=(d-c)/$,this._x=.25*$,this._y=(n+o)/$,this._z=(a+h)/$}else if(s>p){let x=2*Math.sqrt(1+s-r-p);this._w=(a-h)/x,this._x=(n+o)/x,this._y=.25*x,this._z=(c+d)/x}else{let y=2*Math.sqrt(1+p-r-s);this._w=(o-n)/y,this._x=(a+h)/y,this._y=(c+d)/y,this._z=.25*y}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return r<Number.EPSILON?(r=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(oN(this.dot(e),-1,1)))}rotateTowards(e,t){let r=this.angleTo(e);return 0===r||this.slerp(e,Math.min(1,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(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._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 e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let r=e._x,n=e._y,a=e._z,o=e._w,s=t._x,c=t._y,h=t._z,d=t._w;return this._x=r*d+o*s+n*h-a*c,this._y=n*d+o*c+a*s-r*h,this._z=a*d+o*h+r*c-n*s,this._w=o*d-r*s-n*c-a*h,this._onChangeCallback(),this}slerp(e,t){if(0===t)return this;if(1===t)return this.copy(e);let r=this._x,n=this._y,a=this._z,o=this._w,s=o*e._w+r*e._x+n*e._y+a*e._z;if(s<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,s=-s):this.copy(e),s>=1)return this._w=o,this._x=r,this._y=n,this._z=a,this;let c=1-s*s;if(c<=Number.EPSILON){let h=1-t;return this._w=h*o+t*this._w,this._x=h*r+t*this._x,this._y=h*n+t*this._y,this._z=h*a+t*this._z,this.normalize(),this._onChangeCallback(),this}let d=Math.sqrt(c),p=Math.atan2(d,s),f=Math.sin((1-t)*p)/d,m=Math.sin(t*p)/d;return this._w=o*f+this._w*m,this._x=r*f+this._x*m,this._y=n*f+this._y*m,this._z=a*f+this._z*m,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){let e=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),n=2*Math.PI*Math.random(),a=2*Math.PI*Math.random();return this.set(t*Math.cos(n),r*Math.sin(a),r*Math.cos(a),t*Math.sin(n))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class sh{constructor(e=0,t=0,r=0){sh.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return void 0===r&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(sp.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(sp.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,r=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[3]*r+a[6]*n,this.y=a[1]*t+a[4]*r+a[7]*n,this.z=a[2]*t+a[5]*r+a[8]*n,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,r=this.y,n=this.z,a=e.elements,o=1/(a[3]*t+a[7]*r+a[11]*n+a[15]);return this.x=(a[0]*t+a[4]*r+a[8]*n+a[12])*o,this.y=(a[1]*t+a[5]*r+a[9]*n+a[13])*o,this.z=(a[2]*t+a[6]*r+a[10]*n+a[14])*o,this}applyQuaternion(e){let t=this.x,r=this.y,n=this.z,a=e.x,o=e.y,s=e.z,c=e.w,h=2*(o*n-s*r),d=2*(s*t-a*n),p=2*(a*r-o*t);return this.x=t+c*h+o*p-s*d,this.y=r+c*d+s*h-a*p,this.z=n+c*p+a*d-o*h,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,r=this.y,n=this.z,a=e.elements;return this.x=a[0]*t+a[4]*r+a[8]*n,this.y=a[1]*t+a[5]*r+a[9]*n,this.z=a[2]*t+a[6]*r+a[10]*n,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){let r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}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(e){return this.x*e.x+this.y*e.y+this.z*e.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(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let r=e.x,n=e.y,a=e.z,o=t.x,s=t.y,c=t.z;return this.x=n*c-a*s,this.y=a*o-r*c,this.z=r*s-n*o,this}projectOnVector(e){let t=e.lengthSq();if(0===t)return this.set(0,0,0);let r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return sd.copy(this).projectOnVector(e),this.sub(sd)}reflect(e){return this.sub(sd.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;let r=this.dot(e)/t;return Math.acos(oN(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,r=this.y-e.y,n=this.z-e.z;return t*t+r*r+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){let n=Math.sin(t)*e;return this.x=n*Math.sin(r),this.y=Math.cos(t)*e,this.z=n*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),n=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=n,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}let sd=new sh,sp=new sc;class sf{constructor(e=new sh(1/0,1/0,1/0),t=new sh(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t+=3)this.expandByPoint(sg.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,r=e.count;t<r;t++)this.expandByPoint(sg.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;t<r;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let r=sg.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(r),this.max.copy(e).add(r),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.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(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let r=e.geometry;if(void 0!==r){let n=r.getAttribute("position");if(!0===t&&void 0!==n&&!0!==e.isInstancedMesh)for(let a=0,o=n.count;a<o;a++)!0===e.isMesh?e.getVertexPosition(a,sg):sg.fromBufferAttribute(n,a),sg.applyMatrix4(e.matrixWorld),this.expandByPoint(sg);else void 0!==e.boundingBox?(null===e.boundingBox&&e.computeBoundingBox(),s8.copy(e.boundingBox)):(null===r.boundingBox&&r.computeBoundingBox(),s8.copy(r.boundingBox)),s8.applyMatrix4(e.matrixWorld),this.union(s8)}let s=e.children;for(let c=0,h=s.length;c<h;c++)this.expandByObject(s[c],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,sg),sg.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(sb),s_.subVectors(this.max,sb),s$.subVectors(e.a,sb),sv.subVectors(e.b,sb),sx.subVectors(e.c,sb),sy.subVectors(sv,s$),sS.subVectors(sx,sv),sE.subVectors(s$,sx);let t=[0,-sy.z,sy.y,0,-sS.z,sS.y,0,-sE.z,sE.y,sy.z,0,-sy.x,sS.z,0,-sS.x,sE.z,0,-sE.x,-sy.y,sy.x,0,-sS.y,sS.x,0,-sE.y,sE.x,0];return!!(sw(t,s$,sv,sx,s_)&&sw(t=[1,0,0,0,1,0,0,0,1],s$,sv,sx,s_))&&(sT.crossVectors(sy,sS),sw(t=[sT.x,sT.y,sT.z],s$,sv,sx,s_))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,sg).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(sg).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(sm[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),sm[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),sm[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),sm[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),sm[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),sm[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),sm[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),sm[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(sm)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}let sm=[new sh,new sh,new sh,new sh,new sh,new sh,new sh,new sh],sg=new sh,s8=new sf,s$=new sh,sv=new sh,sx=new sh,sy=new sh,sS=new sh,sE=new sh,sb=new sh,s_=new sh,sT=new sh,sM=new sh;function sw(e,t,r,n,a){for(let o=0,s=e.length-3;o<=s;o+=3){sM.fromArray(e,o);let c=a.x*Math.abs(sM.x)+a.y*Math.abs(sM.y)+a.z*Math.abs(sM.z),h=t.dot(sM),d=r.dot(sM),p=n.dot(sM);if(Math.max(-Math.max(h,d,p),Math.min(h,d,p))>c)return!1}return!0}let sA=new sf,sC=new sh,sR=new sh;class s0{constructor(e=new sh,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let r=this.center;void 0!==t?r.copy(t):sA.setFromPoints(e).getCenter(r);let n=0;for(let a=0,o=e.length;a<o;a++)n=Math.max(n,r.distanceToSquared(e[a]));return this.radius=Math.sqrt(n),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let r=this.center.distanceToSquared(e);return t.copy(e),r>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;sC.subVectors(e,this.center);let t=sC.lengthSq();if(t>this.radius*this.radius){let r=Math.sqrt(t),n=(r-this.radius)*.5;this.center.addScaledVector(sC,n/r),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(sR.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(sC.copy(e.center).add(sR)),this.expandByPoint(sC.copy(e.center).sub(sR))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}let sP=new sh,sL=new sh,s1=new sh,sD=new sh,sU=new sh,sI=new sh,sN=new sh;class sO{constructor(e=new sh,t=new sh(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,sP)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=sP.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(sP.copy(this.origin).addScaledVector(this.direction,t),sP.distanceToSquared(e))}distanceSqToSegment(e,t,r,n){sL.copy(e).add(t).multiplyScalar(.5),s1.copy(t).sub(e).normalize(),sD.copy(this.origin).sub(sL);let a=.5*e.distanceTo(t),o=-this.direction.dot(s1),s=sD.dot(this.direction),c=-sD.dot(s1),h=sD.lengthSq(),d=Math.abs(1-o*o),p,f,m,$;if(d>0){if(p=o*c-s,f=o*s-c,$=a*d,p>=0){if(f>=-$){if(f<=$){let x=1/d;p*=x,f*=x,m=p*(p+o*f+2*s)+f*(o*p+f+2*c)+h}else m=-(p=Math.max(0,-(o*(f=a)+s)))*p+f*(f+2*c)+h}else m=-(p=Math.max(0,-(o*(f=-a)+s)))*p+f*(f+2*c)+h}else f<=-$?(f=(p=Math.max(0,-(-o*a+s)))>0?-a:Math.min(Math.max(-a,-c),a),m=-p*p+f*(f+2*c)+h):f<=$?(p=0,m=(f=Math.min(Math.max(-a,-c),a))*(f+2*c)+h):(f=(p=Math.max(0,-(o*a+s)))>0?a:Math.min(Math.max(-a,-c),a),m=-p*p+f*(f+2*c)+h)}else f=o>0?-a:a,m=-(p=Math.max(0,-(o*f+s)))*p+f*(f+2*c)+h;return r&&r.copy(this.origin).addScaledVector(this.direction,p),n&&n.copy(sL).addScaledVector(s1,f),m}intersectSphere(e,t){sP.subVectors(e.center,this.origin);let r=sP.dot(this.direction),n=sP.dot(sP)-r*r,a=e.radius*e.radius;if(n>a)return null;let o=Math.sqrt(a-n),s=r-o,c=r+o;return c<0?null:s<0?this.at(c,t):this.at(s,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;let r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){let r=this.distanceToPlane(e);return null===r?null:this.at(r,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,n,a,o,s,c,h=1/this.direction.x,d=1/this.direction.y,p=1/this.direction.z,f=this.origin;return h>=0?(r=(e.min.x-f.x)*h,n=(e.max.x-f.x)*h):(r=(e.max.x-f.x)*h,n=(e.min.x-f.x)*h),d>=0?(a=(e.min.y-f.y)*d,o=(e.max.y-f.y)*d):(a=(e.max.y-f.y)*d,o=(e.min.y-f.y)*d),r>o||a>n||((a>r||isNaN(r))&&(r=a),(o<n||isNaN(n))&&(n=o),p>=0?(s=(e.min.z-f.z)*p,c=(e.max.z-f.z)*p):(s=(e.max.z-f.z)*p,c=(e.min.z-f.z)*p),r>c||s>n)||((s>r||r!=r)&&(r=s),(c<n||n!=n)&&(n=c),n<0)?null:this.at(r>=0?r:n,t)}intersectsBox(e){return null!==this.intersectBox(e,sP)}intersectTriangle(e,t,r,n,a){sU.subVectors(t,e),sI.subVectors(r,e),sN.crossVectors(sU,sI);let o=this.direction.dot(sN),s;if(o>0){if(n)return null;s=1}else{if(!(o<0))return null;s=-1,o=-o}sD.subVectors(this.origin,e);let c=s*this.direction.dot(sI.crossVectors(sD,sI));if(c<0)return null;let h=s*this.direction.dot(sU.cross(sD));if(h<0||c+h>o)return null;let d=-s*sD.dot(sN);return d<0?null:this.at(d/o,a)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class sF{constructor(e,t,r,n,a,o,s,c,h,d,p,f,m,$,x,y){sF.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,r,n,a,o,s,c,h,d,p,f,m,$,x,y)}set(e,t,r,n,a,o,s,c,h,d,p,f,m,$,x,y){let S=this.elements;return S[0]=e,S[4]=t,S[8]=r,S[12]=n,S[1]=a,S[5]=o,S[9]=s,S[13]=c,S[2]=h,S[6]=d,S[10]=p,S[14]=f,S[3]=m,S[7]=$,S[11]=x,S[15]=y,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 sF().fromArray(this.elements)}copy(e){let t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){let t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,r=e.elements,n=1/sB.setFromMatrixColumn(e,0).length(),a=1/sB.setFromMatrixColumn(e,1).length(),o=1/sB.setFromMatrixColumn(e,2).length();return t[0]=r[0]*n,t[1]=r[1]*n,t[2]=r[2]*n,t[3]=0,t[4]=r[4]*a,t[5]=r[5]*a,t[6]=r[6]*a,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,r=e.x,n=e.y,a=e.z,o=Math.cos(r),s=Math.sin(r),c=Math.cos(n),h=Math.sin(n),d=Math.cos(a),p=Math.sin(a);if("XYZ"===e.order){let f=o*d,m=o*p,$=s*d,x=s*p;t[0]=c*d,t[4]=-c*p,t[8]=h,t[1]=m+$*h,t[5]=f-x*h,t[9]=-s*c,t[2]=x-f*h,t[6]=$+m*h,t[10]=o*c}else if("YXZ"===e.order){let y=c*d,S=c*p,E=h*d,_=h*p;t[0]=y+_*s,t[4]=E*s-S,t[8]=o*h,t[1]=o*p,t[5]=o*d,t[9]=-s,t[2]=S*s-E,t[6]=_+y*s,t[10]=o*c}else if("ZXY"===e.order){let T=c*d,M=c*p,A=h*d,C=h*p;t[0]=T-C*s,t[4]=-o*p,t[8]=A+M*s,t[1]=M+A*s,t[5]=o*d,t[9]=C-T*s,t[2]=-o*h,t[6]=s,t[10]=o*c}else if("ZYX"===e.order){let R=o*d,P=o*p,D=s*d,U=s*p;t[0]=c*d,t[4]=D*h-P,t[8]=R*h+U,t[1]=c*p,t[5]=U*h+R,t[9]=P*h-D,t[2]=-h,t[6]=s*c,t[10]=o*c}else if("YZX"===e.order){let I=o*c,N=o*h,O=s*c,F=s*h;t[0]=c*d,t[4]=F-I*p,t[8]=O*p+N,t[1]=p,t[5]=o*d,t[9]=-s*d,t[2]=-h*d,t[6]=N*p+O,t[10]=I-F*p}else if("XZY"===e.order){let B=o*c,z=o*h,k=s*c,H=s*h;t[0]=c*d,t[4]=-p,t[8]=h*d,t[1]=B*p+H,t[5]=o*d,t[9]=z*p-k,t[2]=k*p-z,t[6]=s*d,t[10]=H*p+B}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(s2,e,sk)}lookAt(e,t,r){let n=this.elements;return s3.subVectors(e,t),0===s3.lengthSq()&&(s3.z=1),s3.normalize(),sH.crossVectors(r,s3),0===sH.lengthSq()&&(1===Math.abs(r.z)?s3.x+=1e-4:s3.z+=1e-4,s3.normalize(),sH.crossVectors(r,s3)),sH.normalize(),sV.crossVectors(s3,sH),n[0]=sH.x,n[4]=sV.x,n[8]=s3.x,n[1]=sH.y,n[5]=sV.y,n[9]=s3.y,n[2]=sH.z,n[6]=sV.z,n[10]=s3.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let r=e.elements,n=t.elements,a=this.elements,o=r[0],s=r[4],c=r[8],h=r[12],d=r[1],p=r[5],f=r[9],m=r[13],$=r[2],x=r[6],y=r[10],S=r[14],E=r[3],_=r[7],T=r[11],M=r[15],A=n[0],C=n[4],R=n[8],P=n[12],D=n[1],U=n[5],I=n[9],N=n[13],O=n[2],F=n[6],B=n[10],z=n[14],k=n[3],H=n[7],V=n[11],G=n[15];return a[0]=o*A+s*D+c*O+h*k,a[4]=o*C+s*U+c*F+h*H,a[8]=o*R+s*I+c*B+h*V,a[12]=o*P+s*N+c*z+h*G,a[1]=d*A+p*D+f*O+m*k,a[5]=d*C+p*U+f*F+m*H,a[9]=d*R+p*I+f*B+m*V,a[13]=d*P+p*N+f*z+m*G,a[2]=$*A+x*D+y*O+S*k,a[6]=$*C+x*U+y*F+S*H,a[10]=$*R+x*I+y*B+S*V,a[14]=$*P+x*N+y*z+S*G,a[3]=E*A+_*D+T*O+M*k,a[7]=E*C+_*U+T*F+M*H,a[11]=E*R+_*I+T*B+M*V,a[15]=E*P+_*N+T*z+M*G,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],r=e[4],n=e[8],a=e[12],o=e[1],s=e[5],c=e[9],h=e[13],d=e[2],p=e[6],f=e[10],m=e[14],$=e[3],x=e[7],y=e[11],S=e[15];return $*(+a*c*p-n*h*p-a*s*f+r*h*f+n*s*m-r*c*m)+x*(+t*c*m-t*h*f+a*o*f-n*o*m+n*h*d-a*c*d)+y*(+t*h*p-t*s*m-a*o*p+r*o*m+a*s*d-r*h*d)+S*(-n*s*d-t*c*p+t*s*f+n*o*p-r*o*f+r*c*d)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){let n=this.elements;return e.isVector3?(n[12]=e.x,n[13]=e.y,n[14]=e.z):(n[12]=e,n[13]=t,n[14]=r),this}invert(){let e=this.elements,t=e[0],r=e[1],n=e[2],a=e[3],o=e[4],s=e[5],c=e[6],h=e[7],d=e[8],p=e[9],f=e[10],m=e[11],$=e[12],x=e[13],y=e[14],S=e[15],E=p*y*h-x*f*h+x*c*m-s*y*m-p*c*S+s*f*S,_=$*f*h-d*y*h-$*c*m+o*y*m+d*c*S-o*f*S,T=d*x*h-$*p*h+$*s*m-o*x*m-d*s*S+o*p*S,M=$*p*c-d*x*c-$*s*f+o*x*f+d*s*y-o*p*y,A=t*E+r*_+n*T+a*M;if(0===A)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let C=1/A;return e[0]=E*C,e[1]=(x*f*a-p*y*a-x*n*m+r*y*m+p*n*S-r*f*S)*C,e[2]=(s*y*a-x*c*a+x*n*h-r*y*h-s*n*S+r*c*S)*C,e[3]=(p*c*a-s*f*a-p*n*h+r*f*h+s*n*m-r*c*m)*C,e[4]=_*C,e[5]=(d*y*a-$*f*a+$*n*m-t*y*m-d*n*S+t*f*S)*C,e[6]=($*c*a-o*y*a-$*n*h+t*y*h+o*n*S-t*c*S)*C,e[7]=(o*f*a-d*c*a+d*n*h-t*f*h-o*n*m+t*c*m)*C,e[8]=T*C,e[9]=($*p*a-d*x*a-$*r*m+t*x*m+d*r*S-t*p*S)*C,e[10]=(o*x*a-$*s*a+$*r*h-t*x*h-o*r*S+t*s*S)*C,e[11]=(d*s*a-o*p*a-d*r*h+t*p*h+o*r*m-t*s*m)*C,e[12]=M*C,e[13]=(d*x*n-$*p*n+$*r*f-t*x*f-d*r*y+t*p*y)*C,e[14]=($*s*n-o*x*n-$*r*c+t*x*c+o*r*y-t*s*y)*C,e[15]=(o*p*n-d*s*n+d*r*c-t*p*c-o*r*f+t*s*f)*C,this}scale(e){let t=this.elements,r=e.x,n=e.y,a=e.z;return t[0]*=r,t[4]*=n,t[8]*=a,t[1]*=r,t[5]*=n,t[9]*=a,t[2]*=r,t[6]*=n,t[10]*=a,t[3]*=r,t[7]*=n,t[11]*=a,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,n))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let r=Math.cos(t),n=Math.sin(t),a=1-r,o=e.x,s=e.y,c=e.z,h=a*o,d=a*s;return this.set(h*o+r,h*s-n*c,h*c+n*s,0,h*s+n*c,d*s+r,d*c-n*o,0,h*c-n*s,d*c+n*o,a*c*c+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,n,a,o){return this.set(1,r,a,0,e,1,o,0,t,n,1,0,0,0,0,1),this}compose(e,t,r){let n=this.elements,a=t._x,o=t._y,s=t._z,c=t._w,h=a+a,d=o+o,p=s+s,f=a*h,m=a*d,$=a*p,x=o*d,y=o*p,S=s*p,E=c*h,_=c*d,T=c*p,M=r.x,A=r.y,C=r.z;return n[0]=(1-(x+S))*M,n[1]=(m+T)*M,n[2]=($-_)*M,n[3]=0,n[4]=(m-T)*A,n[5]=(1-(f+S))*A,n[6]=(y+E)*A,n[7]=0,n[8]=($+_)*C,n[9]=(y-E)*C,n[10]=(1-(f+x))*C,n[11]=0,n[12]=e.x,n[13]=e.y,n[14]=e.z,n[15]=1,this}decompose(e,t,r){let n=this.elements,a=sB.set(n[0],n[1],n[2]).length(),o=sB.set(n[4],n[5],n[6]).length(),s=sB.set(n[8],n[9],n[10]).length();0>this.determinant()&&(a=-a),e.x=n[12],e.y=n[13],e.z=n[14],sz.copy(this);let c=1/a,h=1/o,d=1/s;return sz.elements[0]*=c,sz.elements[1]*=c,sz.elements[2]*=c,sz.elements[4]*=h,sz.elements[5]*=h,sz.elements[6]*=h,sz.elements[8]*=d,sz.elements[9]*=d,sz.elements[10]*=d,t.setFromRotationMatrix(sz),r.x=a,r.y=o,r.z=s,this}makePerspective(e,t,r,n,a,o,s=2e3){let c=this.elements,h,d;if(2e3===s)h=-(o+a)/(o-a),d=-2*o*a/(o-a);else if(2001===s)h=-o/(o-a),d=-o*a/(o-a);else throw Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);return c[0]=2*a/(t-e),c[4]=0,c[8]=(t+e)/(t-e),c[12]=0,c[1]=0,c[5]=2*a/(r-n),c[9]=(r+n)/(r-n),c[13]=0,c[2]=0,c[6]=0,c[10]=h,c[14]=d,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,r,n,a,o,s=2e3){let c=this.elements,h=1/(t-e),d=1/(r-n),p=1/(o-a),f,m;if(2e3===s)f=(o+a)*p,m=-2*p;else if(2001===s)f=a*p,m=-1*p;else throw Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);return c[0]=2*h,c[4]=0,c[8]=0,c[12]=-((t+e)*h),c[1]=0,c[5]=2*d,c[9]=0,c[13]=-((r+n)*d),c[2]=0,c[6]=0,c[10]=m,c[14]=-f,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,r=e.elements;for(let n=0;n<16;n++)if(t[n]!==r[n])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){let r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}let sB=new sh,sz=new sF,s2=new sh(0,0,0),sk=new sh(1,1,1),sH=new sh,sV=new sh,s3=new sh,sG=new sF,s4=new sc;class sW{constructor(e=0,t=0,r=0,n=sW.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=n}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,n=this._order){return this._x=e,this._y=t,this._z=r,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){let n=e.elements,a=n[0],o=n[4],s=n[8],c=n[1],h=n[5],d=n[9],p=n[2],f=n[6],m=n[10];switch(t){case"XYZ":this._y=Math.asin(oN(s,-1,1)),.9999999>Math.abs(s)?(this._x=Math.atan2(-d,m),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(f,h),this._z=0);break;case"YXZ":this._x=Math.asin(-oN(d,-1,1)),.9999999>Math.abs(d)?(this._y=Math.atan2(s,m),this._z=Math.atan2(c,h)):(this._y=Math.atan2(-p,a),this._z=0);break;case"ZXY":this._x=Math.asin(oN(f,-1,1)),.9999999>Math.abs(f)?(this._y=Math.atan2(-p,m),this._z=Math.atan2(-o,h)):(this._y=0,this._z=Math.atan2(c,a));break;case"ZYX":this._y=Math.asin(-oN(p,-1,1)),.9999999>Math.abs(p)?(this._x=Math.atan2(f,m),this._z=Math.atan2(c,a)):(this._x=0,this._z=Math.atan2(-o,h));break;case"YZX":this._z=Math.asin(oN(c,-1,1)),.9999999>Math.abs(c)?(this._x=Math.atan2(-d,h),this._y=Math.atan2(-p,a)):(this._x=0,this._y=Math.atan2(s,m));break;case"XZY":this._z=Math.asin(-oN(o,-1,1)),.9999999>Math.abs(o)?(this._x=Math.atan2(f,h),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-d,m),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===r&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return sG.makeRotationFromQuaternion(e),this.setFromRotationMatrix(sG,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return s4.setFromEuler(this),this.setFromQuaternion(s4,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}sW.DEFAULT_ORDER="XYZ";class s6{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!=0}isEnabled(e){return(this.mask&(1<<e|0))!=0}}let s5=0,s7=new sh,sX=new sc,sq=new sF,sY=new sh,sj=new sh,sZ=new sh,sK=new sc,sJ=new sh(1,0,0),sQ=new sh(0,1,0),s9=new sh(0,0,1),le={type:"added"},lt={type:"removed"};class li extends oP{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:s5++}),this.uuid=oI(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=li.DEFAULT_UP.clone();let e=new sh,t=new sW,r=new sc,n=new sh(1,1,1);t._onChange(function e(){r.setFromEuler(t,!1)}),r._onChange(function e(){t.setFromQuaternion(r,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:r},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new sF},normalMatrix:{value:new o4}}),this.matrix=new sF,this.matrixWorld=new sF,this.matrixAutoUpdate=li.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.matrixWorldAutoUpdate=li.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.layers=new s6,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return sX.setFromAxisAngle(e,t),this.quaternion.multiply(sX),this}rotateOnWorldAxis(e,t){return sX.setFromAxisAngle(e,t),this.quaternion.premultiply(sX),this}rotateX(e){return this.rotateOnAxis(sJ,e)}rotateY(e){return this.rotateOnAxis(sQ,e)}rotateZ(e){return this.rotateOnAxis(s9,e)}translateOnAxis(e,t){return s7.copy(e).applyQuaternion(this.quaternion),this.position.add(s7.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(sJ,e)}translateY(e){return this.translateOnAxis(sQ,e)}translateZ(e){return this.translateOnAxis(s9,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(sq.copy(this.matrixWorld).invert())}lookAt(e,t,r){e.isVector3?sY.copy(e):sY.set(e,t,r);let n=this.parent;this.updateWorldMatrix(!0,!1),sj.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?sq.lookAt(sj,sY,this.up):sq.lookAt(sY,sj,this.up),this.quaternion.setFromRotationMatrix(sq),n&&(sq.extractRotation(n.matrixWorld),sX.setFromRotationMatrix(sq),this.quaternion.premultiply(sX.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(null!==e.parent&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(le)):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}let r=this.children.indexOf(e);return -1!==r&&(e.parent=null,this.children.splice(r,1),e.dispatchEvent(lt)),this}removeFromParent(){let e=this.parent;return null!==e&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),sq.copy(this.matrixWorld).invert(),null!==e.parent&&(e.parent.updateWorldMatrix(!0,!1),sq.multiply(e.parent.matrixWorld)),e.applyMatrix4(sq),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let r=0,n=this.children.length;r<n;r++){let a=this.children[r].getObjectByProperty(e,t);if(void 0!==a)return a}}getObjectsByProperty(e,t){let r=[];this[e]===t&&r.push(this);for(let n=0,a=this.children.length;n<a;n++){let o=this.children[n].getObjectsByProperty(e,t);o.length>0&&(r=r.concat(o))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sj,e,sZ),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(sj,sK,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let r=0,n=t.length;r<n;r++)t[r].traverse(e)}traverseVisible(e){if(!1===this.visible)return;e(this);let t=this.children;for(let r=0,n=t.length;r<n;r++)t[r].traverseVisible(e)}traverseAncestors(e){let t=this.parent;null!==t&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let r=0,n=t.length;r<n;r++){let a=t[r];(!0===a.matrixWorldAutoUpdate||!0===e)&&a.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let r=this.parent;if(!0===e&&null!==r&&!0===r.matrixWorldAutoUpdate&&r.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),!0===t){let n=this.children;for(let a=0,o=n.length;a<o;a++){let s=n[a];!0===s.matrixWorldAutoUpdate&&s.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=void 0===e||"string"==typeof e,r={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},r.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let n={};function a(t,r){return void 0===t[r.uuid]&&(t[r.uuid]=r.toJSON(e)),r.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=a(e.geometries,this.geometry);let o=this.geometry.parameters;if(void 0!==o&&void 0!==o.shapes){let s=o.shapes;if(Array.isArray(s))for(let c=0,h=s.length;c<h;c++){let d=s[c];a(e.shapes,d)}else a(e.shapes,s)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(a(e.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material){if(Array.isArray(this.material)){let p=[];for(let f=0,m=this.material.length;f<m;f++)p.push(a(e.materials,this.material[f]));n.material=p}else n.material=a(e.materials,this.material)}if(this.children.length>0){n.children=[];for(let $=0;$<this.children.length;$++)n.children.push(this.children[$].toJSON(e).object)}if(this.animations.length>0){n.animations=[];for(let x=0;x<this.animations.length;x++){let y=this.animations[x];n.animations.push(a(e.animations,y))}}if(t){let S=P(e.geometries),E=P(e.materials),_=P(e.textures),T=P(e.images),M=P(e.shapes),A=P(e.skeletons),C=P(e.animations),R=P(e.nodes);S.length>0&&(r.geometries=S),E.length>0&&(r.materials=E),_.length>0&&(r.textures=_),T.length>0&&(r.images=T),M.length>0&&(r.shapes=M),A.length>0&&(r.skeletons=A),C.length>0&&(r.animations=C),R.length>0&&(r.nodes=R)}return r.object=n,r;function P(e){let t=[];for(let r in e){let n=e[r];delete n.metadata,t.push(n)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let r=0;r<e.children.length;r++){let n=e.children[r];this.add(n.clone())}return this}}li.DEFAULT_UP=new sh(0,1,0),li.DEFAULT_MATRIX_AUTO_UPDATE=!0,li.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;let lr=new sh,ln=new sh,la=new sh,lo=new sh,ls=new sh,ll=new sh,lu=new sh,lc=new sh,lh=new sh,ld=new sh,lp=!1;class lf{constructor(e=new sh,t=new sh,r=new sh){this.a=e,this.b=t,this.c=r}static getNormal(e,t,r,n){n.subVectors(r,t),lr.subVectors(e,t),n.cross(lr);let a=n.lengthSq();return a>0?n.multiplyScalar(1/Math.sqrt(a)):n.set(0,0,0)}static getBarycoord(e,t,r,n,a){lr.subVectors(n,t),ln.subVectors(r,t),la.subVectors(e,t);let o=lr.dot(lr),s=lr.dot(ln),c=lr.dot(la),h=ln.dot(ln),d=ln.dot(la),p=o*h-s*s;if(0===p)return a.set(-2,-1,-1);let f=1/p,m=(h*c-s*d)*f,$=(o*d-s*c)*f;return a.set(1-m-$,$,m)}static containsPoint(e,t,r,n){return this.getBarycoord(e,t,r,n,lo),lo.x>=0&&lo.y>=0&&lo.x+lo.y<=1}static getUV(e,t,r,n,a,o,s,c){return!1===lp&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),lp=!0),this.getInterpolation(e,t,r,n,a,o,s,c)}static getInterpolation(e,t,r,n,a,o,s,c){return this.getBarycoord(e,t,r,n,lo),c.setScalar(0),c.addScaledVector(a,lo.x),c.addScaledVector(o,lo.y),c.addScaledVector(s,lo.z),c}static isFrontFacing(e,t,r,n){return lr.subVectors(r,t),ln.subVectors(e,t),0>lr.cross(ln).dot(n)}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,n){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[n]),this}setFromAttributeAndIndices(e,t,r,n){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,n),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return lr.subVectors(this.c,this.b),ln.subVectors(this.a,this.b),.5*lr.cross(ln).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return lf.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return lf.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,n,a){return!1===lp&&(console.warn("THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation()."),lp=!0),lf.getInterpolation(e,this.a,this.b,this.c,t,r,n,a)}getInterpolation(e,t,r,n,a){return lf.getInterpolation(e,this.a,this.b,this.c,t,r,n,a)}containsPoint(e){return lf.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return lf.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let r=this.a,n=this.b,a=this.c,o,s;ls.subVectors(n,r),ll.subVectors(a,r),lc.subVectors(e,r);let c=ls.dot(lc),h=ll.dot(lc);if(c<=0&&h<=0)return t.copy(r);lh.subVectors(e,n);let d=ls.dot(lh),p=ll.dot(lh);if(d>=0&&p<=d)return t.copy(n);let f=c*p-d*h;if(f<=0&&c>=0&&d<=0)return o=c/(c-d),t.copy(r).addScaledVector(ls,o);ld.subVectors(e,a);let m=ls.dot(ld),$=ll.dot(ld);if($>=0&&m<=$)return t.copy(a);let x=m*h-c*$;if(x<=0&&h>=0&&$<=0)return s=h/(h-$),t.copy(r).addScaledVector(ll,s);let y=d*$-m*p;if(y<=0&&p-d>=0&&m-$>=0)return lu.subVectors(a,n),s=(p-d)/(p-d+(m-$)),t.copy(n).addScaledVector(lu,s);let S=1/(y+x+f);return o=x*S,s=f*S,t.copy(r).addScaledVector(ls,o).addScaledVector(ll,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let lm={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},lg={h:0,s:0,l:0},l8={h:0,s:0,l:0};function l$(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*6*(2/3-r):e}let lv=class{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(void 0===t&&void 0===r){let n=e;n&&n.isColor?this.copy(n):"number"==typeof n?this.setHex(n):"string"==typeof n&&this.setStyle(n)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=o_){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,oK.toWorkingColorSpace(this,t),this}setRGB(e,t,r,n=oK.workingColorSpace){return this.r=e,this.g=t,this.b=r,oK.toWorkingColorSpace(this,n),this}setHSL(e,t,r,n=oK.workingColorSpace){if(e=oO(e,1),t=oN(t,0,1),r=oN(r,0,1),0===t)this.r=this.g=this.b=r;else{let a=r<=.5?r*(1+t):r+t-r*t,o=2*r-a;this.r=l$(o,a,e+1/3),this.g=l$(o,a,e),this.b=l$(o,a,e-1/3)}return oK.toWorkingColorSpace(this,n),this}setStyle(e,t=o_){function r(t){void 0!==t&&1>parseFloat(t)&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(e)){let a,o=n[1],s=n[2];switch(o){case"rgb":case"rgba":if(a=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(a[4]),this.setRGB(Math.min(255,parseInt(a[1],10))/255,Math.min(255,parseInt(a[2],10))/255,Math.min(255,parseInt(a[3],10))/255,t);if(a=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(a[4]),this.setRGB(Math.min(100,parseInt(a[1],10))/100,Math.min(100,parseInt(a[2],10))/100,Math.min(100,parseInt(a[3],10))/100,t);break;case"hsl":case"hsla":if(a=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return r(a[4]),this.setHSL(parseFloat(a[1])/360,parseFloat(a[2])/100,parseFloat(a[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(e)){let c=n[1],h=c.length;if(3===h)return this.setRGB(parseInt(c.charAt(0),16)/15,parseInt(c.charAt(1),16)/15,parseInt(c.charAt(2),16)/15,t);if(6===h)return this.setHex(parseInt(c,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=o_){let r=lm[e.toLowerCase()];return void 0!==r?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=oJ(e.r),this.g=oJ(e.g),this.b=oJ(e.b),this}copyLinearToSRGB(e){return this.r=oQ(e.r),this.g=oQ(e.g),this.b=oQ(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=o_){return oK.fromWorkingColorSpace(lx.copy(this),e),65536*Math.round(oN(255*lx.r,0,255))+256*Math.round(oN(255*lx.g,0,255))+Math.round(oN(255*lx.b,0,255))}getHexString(e=o_){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=oK.workingColorSpace){oK.fromWorkingColorSpace(lx.copy(this),t);let r=lx.r,n=lx.g,a=lx.b,o=Math.max(r,n,a),s=Math.min(r,n,a),c,h,d=(s+o)/2;if(s===o)c=0,h=0;else{let p=o-s;switch(h=d<=.5?p/(o+s):p/(2-o-s),o){case r:c=(n-a)/p+(n<a?6:0);break;case n:c=(a-r)/p+2;break;case a:c=(r-n)/p+4}c/=6}return e.h=c,e.s=h,e.l=d,e}getRGB(e,t=oK.workingColorSpace){return oK.fromWorkingColorSpace(lx.copy(this),t),e.r=lx.r,e.g=lx.g,e.b=lx.b,e}getStyle(e=o_){oK.fromWorkingColorSpace(lx.copy(this),e);let t=lx.r,r=lx.g,n=lx.b;return e!==o_?`color(${e} ${t.toFixed(3)} ${r.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*t)},${Math.round(255*r)},${Math.round(255*n)})`}offsetHSL(e,t,r){return this.getHSL(lg),this.setHSL(lg.h+e,lg.s+t,lg.l+r)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,r){return this.r=e.r+(t.r-e.r)*r,this.g=e.g+(t.g-e.g)*r,this.b=e.b+(t.b-e.b)*r,this}lerpHSL(e,t){this.getHSL(lg),e.getHSL(l8);let r=oF(lg.h,l8.h,t),n=oF(lg.s,l8.s,t),a=oF(lg.l,l8.l,t);return this.setHSL(r,n,a),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,r=this.g,n=this.b,a=e.elements;return this.r=a[0]*t+a[3]*r+a[6]*n,this.g=a[1]*t+a[4]*r+a[7]*n,this.b=a[2]*t+a[5]*r+a[8]*n,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},lx=new lv;lv.NAMES=lm;let ly=0;class lS extends oP{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:ly++}),this.uuid=oI(),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 lv(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=7680,this.stencilZFail=7680,this.stencilZPass=7680,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(let t in e){let r=e[t];if(void 0===r){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let n=this[t];if(void 0===n){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}n&&n.isColor?n.set(r):n&&n.isVector3&&r&&r.isVector3?n.copy(r):this[t]=r}}toJSON(e){let t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});let r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};function n(e){let t=[];for(let r in e){let n=e[r];delete n.metadata,t.push(n)}return t}if(r.uuid=this.uuid,r.type=this.type,""!==this.name&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),void 0!==this.roughness&&(r.roughness=this.roughness),void 0!==this.metalness&&(r.metalness=this.metalness),void 0!==this.sheen&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(r.shininess=this.shininess),void 0!==this.clearcoat&&(r.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),void 0!==this.iridescence&&(r.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(r.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(r.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(r.combine=this.combine)),void 0!==this.envMapIntensity&&(r.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(r.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(r.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(r.size=this.size),null!==this.shadowSide&&(r.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(r.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(r.blending=this.blending),0!==this.side&&(r.side=this.side),!0===this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),!0===this.transparent&&(r.transparent=!0),204!==this.blendSrc&&(r.blendSrc=this.blendSrc),205!==this.blendDst&&(r.blendDst=this.blendDst),100!==this.blendEquation&&(r.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(r.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(r.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(r.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(r.depthFunc=this.depthFunc),!1===this.depthTest&&(r.depthTest=this.depthTest),!1===this.depthWrite&&(r.depthWrite=this.depthWrite),!1===this.colorWrite&&(r.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(r.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(r.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(r.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(r.stencilFuncMask=this.stencilFuncMask),7680!==this.stencilFail&&(r.stencilFail=this.stencilFail),7680!==this.stencilZFail&&(r.stencilZFail=this.stencilZFail),7680!==this.stencilZPass&&(r.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(r.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(r.rotation=this.rotation),!0===this.polygonOffset&&(r.polygonOffset=!0),0!==this.polygonOffsetFactor&&(r.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(r.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(r.linewidth=this.linewidth),void 0!==this.dashSize&&(r.dashSize=this.dashSize),void 0!==this.gapSize&&(r.gapSize=this.gapSize),void 0!==this.scale&&(r.scale=this.scale),!0===this.dithering&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),!0===this.alphaHash&&(r.alphaHash=!0),!0===this.alphaToCoverage&&(r.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(r.premultipliedAlpha=!0),!0===this.forceSinglePass&&(r.forceSinglePass=!0),!0===this.wireframe&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(r.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(r.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(r.flatShading=!0),!1===this.visible&&(r.visible=!1),!1===this.toneMapped&&(r.toneMapped=!1),!1===this.fog&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData),t){let a=n(e.textures),o=n(e.images);a.length>0&&(r.textures=a),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,r=null;if(null!==t){let n=t.length;r=Array(n);for(let a=0;a!==n;++a)r[a]=t[a].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class lE extends lS{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new lv(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.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(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}let lb=new sh,l_=new oG;class lT{constructor(e,t,r=!1){if(Array.isArray(e))throw TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=r,this.usage=35044,this.updateRange={offset:0,count:-1},this.gpuType=1015,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let n=0,a=this.itemSize;n<a;n++)this.array[e+n]=t.array[r+n];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(2===this.itemSize)for(let t=0,r=this.count;t<r;t++)l_.fromBufferAttribute(this,t),l_.applyMatrix3(e),this.setXY(t,l_.x,l_.y);else if(3===this.itemSize)for(let n=0,a=this.count;n<a;n++)lb.fromBufferAttribute(this,n),lb.applyMatrix3(e),this.setXYZ(n,lb.x,lb.y,lb.z);return this}applyMatrix4(e){for(let t=0,r=this.count;t<r;t++)lb.fromBufferAttribute(this,t),lb.applyMatrix4(e),this.setXYZ(t,lb.x,lb.y,lb.z);return this}applyNormalMatrix(e){for(let t=0,r=this.count;t<r;t++)lb.fromBufferAttribute(this,t),lb.applyNormalMatrix(e),this.setXYZ(t,lb.x,lb.y,lb.z);return this}transformDirection(e){for(let t=0,r=this.count;t<r;t++)lb.fromBufferAttribute(this,t),lb.transformDirection(e),this.setXYZ(t,lb.x,lb.y,lb.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let r=this.array[e*this.itemSize+t];return this.normalized&&(r=oH(r,this.array)),r}setComponent(e,t,r){return this.normalized&&(r=oV(r,this.array)),this.array[e*this.itemSize+t]=r,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=oH(t,this.array)),t}setX(e,t){return this.normalized&&(t=oV(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=oH(t,this.array)),t}setY(e,t){return this.normalized&&(t=oV(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=oH(t,this.array)),t}setZ(e,t){return this.normalized&&(t=oV(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=oH(t,this.array)),t}setW(e,t){return this.normalized&&(t=oV(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,r){return e*=this.itemSize,this.normalized&&(t=oV(t,this.array),r=oV(r,this.array)),this.array[e+0]=t,this.array[e+1]=r,this}setXYZ(e,t,r,n){return e*=this.itemSize,this.normalized&&(t=oV(t,this.array),r=oV(r,this.array),n=oV(n,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this}setXYZW(e,t,r,n,a){return e*=this.itemSize,this.normalized&&(t=oV(t,this.array),r=oV(r,this.array),n=oV(n,this.array),a=oV(a,this.array)),this.array[e+0]=t,this.array[e+1]=r,this.array[e+2]=n,this.array[e+3]=a,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),35044!==this.usage&&(e.usage=this.usage),(0!==this.updateRange.offset||-1!==this.updateRange.count)&&(e.updateRange=this.updateRange),e}}class lM extends lT{constructor(e,t,r){super(new Uint16Array(e),t,r)}}class lw extends lT{constructor(e,t,r){super(new Uint32Array(e),t,r)}}class lA extends lT{constructor(e,t,r){super(new Float32Array(e),t,r)}}let lC=0,lR=new sF,l0=new li,lP=new sh,lL=new sf,l1=new sf,lD=new sh;class lU extends oP{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:lC++}),this.uuid=oI(),this.name="",this.type="BufferGeometry",this.index=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(e){return Array.isArray(e)?this.index=new(o6(e)?lw:lM)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t,r=0){this.groups.push({start:e,count:t,materialIndex:r})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);let r=this.attributes.normal;if(void 0!==r){let n=new o4().getNormalMatrix(e);r.applyNormalMatrix(n),r.needsUpdate=!0}let a=this.attributes.tangent;return void 0!==a&&(a.transformDirection(e),a.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return lR.makeRotationFromQuaternion(e),this.applyMatrix4(lR),this}rotateX(e){return lR.makeRotationX(e),this.applyMatrix4(lR),this}rotateY(e){return lR.makeRotationY(e),this.applyMatrix4(lR),this}rotateZ(e){return lR.makeRotationZ(e),this.applyMatrix4(lR),this}translate(e,t,r){return lR.makeTranslation(e,t,r),this.applyMatrix4(lR),this}scale(e,t,r){return lR.makeScale(e,t,r),this.applyMatrix4(lR),this}lookAt(e){return l0.lookAt(e),l0.updateMatrix(),this.applyMatrix4(l0.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(lP).negate(),this.translate(lP.x,lP.y,lP.z),this}setFromPoints(e){let t=[];for(let r=0,n=e.length;r<n;r++){let a=e[r];t.push(a.x,a.y,a.z||0)}return this.setAttribute("position",new lA(t,3)),this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new sf);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingBox.set(new sh(-1/0,-1/0,-1/0),new sh(1/0,1/0,1/0));return}if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let r=0,n=t.length;r<n;r++){let a=t[r];lL.setFromBufferAttribute(a),this.morphTargetsRelative?(lD.addVectors(this.boundingBox.min,lL.min),this.boundingBox.expandByPoint(lD),lD.addVectors(this.boundingBox.max,lL.max),this.boundingBox.expandByPoint(lD)):(this.boundingBox.expandByPoint(lL.min),this.boundingBox.expandByPoint(lL.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 s0);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error('THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".',this),this.boundingSphere.set(new sh,1/0);return}if(e){let r=this.boundingSphere.center;if(lL.setFromBufferAttribute(e),t)for(let n=0,a=t.length;n<a;n++){let o=t[n];l1.setFromBufferAttribute(o),this.morphTargetsRelative?(lD.addVectors(lL.min,l1.min),lL.expandByPoint(lD),lD.addVectors(lL.max,l1.max),lL.expandByPoint(lD)):(lL.expandByPoint(l1.min),lL.expandByPoint(l1.max))}lL.getCenter(r);let s=0;for(let c=0,h=e.count;c<h;c++)lD.fromBufferAttribute(e,c),s=Math.max(s,r.distanceToSquared(lD));if(t)for(let d=0,p=t.length;d<p;d++){let f=t[d],m=this.morphTargetsRelative;for(let $=0,x=f.count;$<x;$++)lD.fromBufferAttribute(f,$),m&&(lP.fromBufferAttribute(e,$),lD.add(lP)),s=Math.max(s,r.distanceToSquared(lD))}this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(null===e||void 0===t.position||void 0===t.normal||void 0===t.uv){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let r=e.array,n=t.position.array,a=t.normal.array,o=t.uv.array,s=n.length/3;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new lT(new Float32Array(4*s),4));let c=this.getAttribute("tangent").array,h=[],d=[];for(let p=0;p<s;p++)h[p]=new sh,d[p]=new sh;let f=new sh,m=new sh,$=new sh,x=new oG,y=new oG,S=new oG,E=new sh,_=new sh;function T(e,t,r){f.fromArray(n,3*e),m.fromArray(n,3*t),$.fromArray(n,3*r),x.fromArray(o,2*e),y.fromArray(o,2*t),S.fromArray(o,2*r),m.sub(f),$.sub(f),y.sub(x),S.sub(x);let a=1/(y.x*S.y-S.x*y.y);isFinite(a)&&(E.copy(m).multiplyScalar(S.y).addScaledVector($,-y.y).multiplyScalar(a),_.copy($).multiplyScalar(y.x).addScaledVector(m,-S.x).multiplyScalar(a),h[e].add(E),h[t].add(E),h[r].add(E),d[e].add(_),d[t].add(_),d[r].add(_))}let M=this.groups;0===M.length&&(M=[{start:0,count:r.length}]);for(let A=0,C=M.length;A<C;++A){let R=M[A],P=R.start,D=R.count;for(let U=P,I=P+D;U<I;U+=3)T(r[U+0],r[U+1],r[U+2])}let N=new sh,O=new sh,F=new sh,B=new sh;function z(e){F.fromArray(a,3*e),B.copy(F);let t=h[e];N.copy(t),N.sub(F.multiplyScalar(F.dot(t))).normalize(),O.crossVectors(B,t);let r=0>O.dot(d[e])?-1:1;c[4*e]=N.x,c[4*e+1]=N.y,c[4*e+2]=N.z,c[4*e+3]=r}for(let k=0,H=M.length;k<H;++k){let V=M[k],G=V.start,W=V.count;for(let X=G,q=G+W;X<q;X+=3)z(r[X+0]),z(r[X+1]),z(r[X+2])}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(void 0!==t){let r=this.getAttribute("normal");if(void 0===r)r=new lT(new Float32Array(3*t.count),3),this.setAttribute("normal",r);else for(let n=0,a=r.count;n<a;n++)r.setXYZ(n,0,0,0);let o=new sh,s=new sh,c=new sh,h=new sh,d=new sh,p=new sh,f=new sh,m=new sh;if(e)for(let $=0,x=e.count;$<x;$+=3){let y=e.getX($+0),S=e.getX($+1),E=e.getX($+2);o.fromBufferAttribute(t,y),s.fromBufferAttribute(t,S),c.fromBufferAttribute(t,E),f.subVectors(c,s),m.subVectors(o,s),f.cross(m),h.fromBufferAttribute(r,y),d.fromBufferAttribute(r,S),p.fromBufferAttribute(r,E),h.add(f),d.add(f),p.add(f),r.setXYZ(y,h.x,h.y,h.z),r.setXYZ(S,d.x,d.y,d.z),r.setXYZ(E,p.x,p.y,p.z)}else for(let _=0,T=t.count;_<T;_+=3)o.fromBufferAttribute(t,_+0),s.fromBufferAttribute(t,_+1),c.fromBufferAttribute(t,_+2),f.subVectors(c,s),m.subVectors(o,s),f.cross(m),r.setXYZ(_+0,f.x,f.y,f.z),r.setXYZ(_+1,f.x,f.y,f.z),r.setXYZ(_+2,f.x,f.y,f.z);this.normalizeNormals(),r.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,r=e.count;t<r;t++)lD.fromBufferAttribute(e,t),lD.normalize(),e.setXYZ(t,lD.x,lD.y,lD.z)}toNonIndexed(){function e(e,t){let r=e.array,n=e.itemSize,a=e.normalized,o=new r.constructor(t.length*n),s=0,c=0;for(let h=0,d=t.length;h<d;h++){s=e.isInterleavedBufferAttribute?t[h]*e.data.stride+e.offset:t[h]*n;for(let p=0;p<n;p++)o[c++]=r[s++]}return new lT(o,n,a)}if(null===this.index)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new lU,r=this.index.array,n=this.attributes;for(let a in n){let o=n[a],s=e(o,r);t.setAttribute(a,s)}let c=this.morphAttributes;for(let h in c){let d=[],p=c[h];for(let f=0,m=p.length;f<m;f++){let $=p[f],x=e($,r);d.push(x)}t.morphAttributes[h]=d}t.morphTargetsRelative=this.morphTargetsRelative;let y=this.groups;for(let S=0,E=y.length;S<E;S++){let _=y[S];t.addGroup(_.start,_.count,_.materialIndex)}return t}toJSON(){let e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,""!==this.name&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),void 0!==this.parameters){let t=this.parameters;for(let r in t)void 0!==t[r]&&(e[r]=t[r]);return e}e.data={attributes:{}};let n=this.index;null!==n&&(e.data.index={type:n.array.constructor.name,array:Array.prototype.slice.call(n.array)});let a=this.attributes;for(let o in a){let s=a[o];e.data.attributes[o]=s.toJSON(e.data)}let c={},h=!1;for(let d in this.morphAttributes){let p=this.morphAttributes[d],f=[];for(let m=0,$=p.length;m<$;m++){let x=p[m];f.push(x.toJSON(e.data))}f.length>0&&(c[d]=f,h=!0)}h&&(e.data.morphAttributes=c,e.data.morphTargetsRelative=this.morphTargetsRelative);let y=this.groups;y.length>0&&(e.data.groups=JSON.parse(JSON.stringify(y)));let S=this.boundingSphere;return null!==S&&(e.data.boundingSphere={center:S.center.toArray(),radius:S.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let r=e.index;null!==r&&this.setIndex(r.clone(t));let n=e.attributes;for(let a in n){let o=n[a];this.setAttribute(a,o.clone(t))}let s=e.morphAttributes;for(let c in s){let h=[],d=s[c];for(let p=0,f=d.length;p<f;p++)h.push(d[p].clone(t));this.morphAttributes[c]=h}this.morphTargetsRelative=e.morphTargetsRelative;let m=e.groups;for(let $=0,x=m.length;$<x;$++){let y=m[$];this.addGroup(y.start,y.count,y.materialIndex)}let S=e.boundingBox;null!==S&&(this.boundingBox=S.clone());let E=e.boundingSphere;return null!==E&&(this.boundingSphere=E.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}let lI=new sF,lN=new sO,lO=new s0,lF=new sh,lB=new sh,lz=new sh,l2=new sh,lk=new sh,lH=new sh,lV=new oG,l3=new oG,lG=new oG,l4=new sh,lW=new sh,l6=new sh,l5=new sh,l7=new sh;class lX extends li{constructor(e=new lU,t=new lE){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let r=e[t[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,a=r.length;n<a;n++){let o=r[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=n}}}}getVertexPosition(e,t){let r=this.geometry,n=r.attributes.position,a=r.morphAttributes.position,o=r.morphTargetsRelative;t.fromBufferAttribute(n,e);let s=this.morphTargetInfluences;if(a&&s){lH.set(0,0,0);for(let c=0,h=a.length;c<h;c++){let d=s[c],p=a[c];0!==d&&(lk.fromBufferAttribute(p,e),o?lH.addScaledVector(lk,d):lH.addScaledVector(lk.sub(t),d))}t.add(lH)}return t}raycast(e,t){let r=this.geometry,n=this.material,a=this.matrixWorld;void 0===n||(null===r.boundingSphere&&r.computeBoundingSphere(),lO.copy(r.boundingSphere),lO.applyMatrix4(a),lN.copy(e.ray).recast(e.near),!1===lO.containsPoint(lN.origin)&&(null===lN.intersectSphere(lO,lF)||lN.origin.distanceToSquared(lF)>(e.far-e.near)**2)||(lI.copy(a).invert(),lN.copy(e.ray).applyMatrix4(lI),null!==r.boundingBox&&!1===lN.intersectsBox(r.boundingBox)||this._computeIntersections(e,t,lN)))}_computeIntersections(e,t,r){let n,a=this.geometry,o=this.material,s=a.index,c=a.attributes.position,h=a.attributes.uv,d=a.attributes.uv1,p=a.attributes.normal,f=a.groups,m=a.drawRange;if(null!==s){if(Array.isArray(o))for(let $=0,x=f.length;$<x;$++){let y=f[$],S=o[y.materialIndex],E=Math.max(y.start,m.start),_=Math.min(s.count,Math.min(y.start+y.count,m.start+m.count));for(let T=E,M=_;T<M;T+=3){let A=s.getX(T),C=s.getX(T+1),R=s.getX(T+2);(n=lq(this,S,e,r,h,d,p,A,C,R))&&(n.faceIndex=Math.floor(T/3),n.face.materialIndex=y.materialIndex,t.push(n))}}else{let P=Math.max(0,m.start),D=Math.min(s.count,m.start+m.count);for(let U=P,I=D;U<I;U+=3){let N=s.getX(U),O=s.getX(U+1),F=s.getX(U+2);(n=lq(this,o,e,r,h,d,p,N,O,F))&&(n.faceIndex=Math.floor(U/3),t.push(n))}}}else if(void 0!==c){if(Array.isArray(o))for(let B=0,z=f.length;B<z;B++){let k=f[B],H=o[k.materialIndex],V=Math.max(k.start,m.start),G=Math.min(c.count,Math.min(k.start+k.count,m.start+m.count));for(let W=V,X=G;W<X;W+=3){let q=W,Y=W+1,j=W+2;(n=lq(this,H,e,r,h,d,p,q,Y,j))&&(n.faceIndex=Math.floor(W/3),n.face.materialIndex=k.materialIndex,t.push(n))}}else{let Z=Math.max(0,m.start),K=Math.min(c.count,m.start+m.count);for(let J=Z,Q=K;J<Q;J+=3){let et=J,ei=J+1,er=J+2;(n=lq(this,o,e,r,h,d,p,et,ei,er))&&(n.faceIndex=Math.floor(J/3),t.push(n))}}}}}function lq(e,t,r,n,a,o,s,c,h,d){e.getVertexPosition(c,lB),e.getVertexPosition(h,lz),e.getVertexPosition(d,l2);let p=function e(t,r,n,a,o,s,c,h){let d;if(null===(d=1===r.side?a.intersectTriangle(c,s,o,!0,h):a.intersectTriangle(o,s,c,0===r.side,h)))return null;l7.copy(h),l7.applyMatrix4(t.matrixWorld);let p=n.ray.origin.distanceTo(l7);return p<n.near||p>n.far?null:{distance:p,point:l7.clone(),object:t}}(e,t,r,n,lB,lz,l2,l5);if(p){a&&(lV.fromBufferAttribute(a,c),l3.fromBufferAttribute(a,h),lG.fromBufferAttribute(a,d),p.uv=lf.getInterpolation(l5,lB,lz,l2,lV,l3,lG,new oG)),o&&(lV.fromBufferAttribute(o,c),l3.fromBufferAttribute(o,h),lG.fromBufferAttribute(o,d),p.uv1=lf.getInterpolation(l5,lB,lz,l2,lV,l3,lG,new oG),p.uv2=p.uv1),s&&(l4.fromBufferAttribute(s,c),lW.fromBufferAttribute(s,h),l6.fromBufferAttribute(s,d),p.normal=lf.getInterpolation(l5,lB,lz,l2,l4,lW,l6,new sh),p.normal.dot(n.direction)>0&&p.normal.multiplyScalar(-1));let f={a:c,b:h,c:d,normal:new sh,materialIndex:0};lf.getNormal(lB,lz,l2,f.normal),p.face=f}return p}class lY extends lU{constructor(e=1,t=1,r=1,n=1,a=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:n,heightSegments:a,depthSegments:o};let s=this;n=Math.floor(n),a=Math.floor(a),o=Math.floor(o);let c=[],h=[],d=[],p=[],f=0,m=0;function $(e,t,r,n,a,o,$,x,y,S,E){let _=o/y,T=$/S,M=o/2,A=$/2,C=x/2,R=y+1,P=S+1,D=0,U=0,I=new sh;for(let N=0;N<P;N++){let O=N*T-A;for(let F=0;F<R;F++){let B=F*_-M;I[e]=B*n,I[t]=O*a,I[r]=C,h.push(I.x,I.y,I.z),I[e]=0,I[t]=0,I[r]=x>0?1:-1,d.push(I.x,I.y,I.z),p.push(F/y),p.push(1-N/S),D+=1}}for(let z=0;z<S;z++)for(let k=0;k<y;k++){let H=f+k+R*z,V=f+k+R*(z+1),G=f+(k+1)+R*(z+1),W=f+(k+1)+R*z;c.push(H,V,W),c.push(V,G,W),U+=6}s.addGroup(m,U,E),m+=U,f+=D}$("z","y","x",-1,-1,r,t,e,o,a,0),$("z","y","x",1,-1,r,t,-e,o,a,1),$("x","z","y",1,1,e,r,t,n,o,2),$("x","z","y",1,-1,e,r,-t,n,o,3),$("x","y","z",1,-1,e,t,r,n,a,4),$("x","y","z",-1,-1,e,t,-r,n,a,5),this.setIndex(c),this.setAttribute("position",new lA(h,3)),this.setAttribute("normal",new lA(d,3)),this.setAttribute("uv",new lA(p,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lY(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}function lj(e){let t={};for(let r in e)for(let n in t[r]={},e[r]){let a=e[r][n];a&&(a.isColor||a.isMatrix3||a.isMatrix4||a.isVector2||a.isVector3||a.isVector4||a.isTexture||a.isQuaternion)?a.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),t[r][n]=null):t[r][n]=a.clone():Array.isArray(a)?t[r][n]=a.slice():t[r][n]=a}return t}function lZ(e){let t={};for(let r=0;r<e.length;r++){let n=lj(e[r]);for(let a in n)t[a]=n[a]}return t}function lK(e){return null===e.getRenderTarget()?e.outputColorSpace:oK.workingColorSpace}let lJ={clone:lj,merge:lZ};var lQ=`void main() {
	   gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
   }`,l9=`void main() {
	   gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
   }`;class ue extends lS{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=lQ,this.fragmentShader=l9,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!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!==e&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=lj(e.uniforms),this.uniformsGroups=function e(t){let r=[];for(let n=0;n<t.length;n++)r.push(t[n].clone());return r}(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){let t=super.toJSON(e);for(let r in t.glslVersion=this.glslVersion,t.uniforms={},this.uniforms){let n=this.uniforms[r].value;n&&n.isTexture?t.uniforms[r]={type:"t",value:n.toJSON(e).uuid}:n&&n.isColor?t.uniforms[r]={type:"c",value:n.getHex()}:n&&n.isVector2?t.uniforms[r]={type:"v2",value:n.toArray()}:n&&n.isVector3?t.uniforms[r]={type:"v3",value:n.toArray()}:n&&n.isVector4?t.uniforms[r]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?t.uniforms[r]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?t.uniforms[r]={type:"m4",value:n.toArray()}:t.uniforms[r]={value:n}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let a={};for(let o in this.extensions)!0===this.extensions[o]&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t}}class ut extends li{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new sF,this.projectionMatrix=new sF,this.projectionMatrixInverse=new sF,this.coordinateSystem=2e3}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class ui extends ut{constructor(e=50,t=1,r=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=n,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=2*oU*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(.5*oD*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*oU*Math.atan(Math.tan(.5*oD*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,r,n,a,o){this.aspect=e/t,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=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=n,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(.5*oD*this.fov)/this.zoom,r=2*t,n=this.aspect*r,a=-.5*n,o=this.view;if(null!==this.view&&this.view.enabled){let s=o.fullWidth,c=o.fullHeight;a+=o.offsetX*n/s,t-=o.offsetY*r/c,n*=o.width/s,r*=o.height/c}let h=this.filmOffset;0!==h&&(a+=e*h/this.getFilmWidth()),this.projectionMatrix.makePerspective(a,a+n,t,t-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class ur extends li{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;let n=new ui(-90,1,e,t);n.layers=this.layers,this.add(n);let a=new ui(-90,1,e,t);a.layers=this.layers,this.add(a);let o=new ui(-90,1,e,t);o.layers=this.layers,this.add(o);let s=new ui(-90,1,e,t);s.layers=this.layers,this.add(s);let c=new ui(-90,1,e,t);c.layers=this.layers,this.add(c);let h=new ui(-90,1,e,t);h.layers=this.layers,this.add(h)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[r,n,a,o,s,c]=t;for(let h of t)this.remove(h);if(2e3===e)r.up.set(0,1,0),r.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),s.up.set(0,1,0),s.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(2001===e)r.up.set(0,-1,0),r.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),s.up.set(0,-1,0),s.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(let d of t)this.add(d),d.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();let{renderTarget:r,activeMipmapLevel:n}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[a,o,s,c,h,d]=this.children,p=e.getRenderTarget(),f=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),$=e.xr.enabled;e.xr.enabled=!1;let x=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,n),e.render(t,a),e.setRenderTarget(r,1,n),e.render(t,o),e.setRenderTarget(r,2,n),e.render(t,s),e.setRenderTarget(r,3,n),e.render(t,c),e.setRenderTarget(r,4,n),e.render(t,h),r.texture.generateMipmaps=x,e.setRenderTarget(r,5,n),e.render(t,d),e.setRenderTarget(p,f,m),e.xr.enabled=$,r.texture.needsPMREMUpdate=!0}}class un extends sa{constructor(e,t,r,n,a,o,s,c,h,d){super(e=void 0!==e?e:[],t=void 0!==t?t:301,r,n,a,o,s,c,h,d),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class ua extends sl{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let r={width:e,height:e,depth:1};void 0!==t.encoding&&(oX("THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace."),t.colorSpace=3001===t.encoding?o_:""),this.texture=new un([r,r,r,r,r,r],t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=void 0!==t.generateMipmaps&&t.generateMipmaps,this.texture.minFilter=void 0!==t.minFilter?t.minFilter:1006}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let r={uniforms:{tEquirect:{value:null}},vertexShader:`
   
				   varying vec3 vWorldDirection;
   
				   vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
   
					   return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
   
				   }
   
				   void main() {
   
					   vWorldDirection = transformDirection( position, modelMatrix );
   
					   #include <begin_vertex>
					   #include <project_vertex>
   
				   }
			   `,fragmentShader:`
   
				   uniform sampler2D tEquirect;
   
				   varying vec3 vWorldDirection;
   
				   #include <common>
   
				   void main() {
   
					   vec3 direction = normalize( vWorldDirection );
   
					   vec2 sampleUV = equirectUv( direction );
   
					   gl_FragColor = texture2D( tEquirect, sampleUV );
   
				   }
			   `},n=new lY(5,5,5),a=new ue({name:"CubemapFromEquirect",uniforms:lj(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:1,blending:0});a.uniforms.tEquirect.value=t;let o=new lX(n,a),s=t.minFilter;return 1008===t.minFilter&&(t.minFilter=1006),new ur(1,10,this).update(e,o),t.minFilter=s,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,r,n){let a=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,n);e.setRenderTarget(a)}}let uo=new sh,us=new sh,ul=new o4;class uu{constructor(e=new sh(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,n){return this.normal.set(e,t,r),this.constant=n,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){let n=uo.subVectors(r,t).cross(us.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(n,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){let e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let r=e.delta(uo),n=this.normal.dot(r);if(0===n)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;let a=-(e.start.dot(this.normal)+this.constant)/n;return a<0||a>1?null:t.copy(e.start).addScaledVector(r,a)}intersectsLine(e){let t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let r=t||ul.getNormalMatrix(e),n=this.coplanarPoint(uo).applyMatrix4(e),a=this.normal.applyMatrix3(r).normalize();return this.constant=-n.dot(a),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}let uc=new s0,uh=new sh;class ud{constructor(e=new uu,t=new uu,r=new uu,n=new uu,a=new uu,o=new uu){this.planes=[e,t,r,n,a,o]}set(e,t,r,n,a,o){let s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(r),s[3].copy(n),s[4].copy(a),s[5].copy(o),this}copy(e){let t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=2e3){let r=this.planes,n=e.elements,a=n[0],o=n[1],s=n[2],c=n[3],h=n[4],d=n[5],p=n[6],f=n[7],m=n[8],$=n[9],x=n[10],y=n[11],S=n[12],E=n[13],_=n[14],T=n[15];if(r[0].setComponents(c-a,f-h,y-m,T-S).normalize(),r[1].setComponents(c+a,f+h,y+m,T+S).normalize(),r[2].setComponents(c+o,f+d,y+$,T+E).normalize(),r[3].setComponents(c-o,f-d,y-$,T-E).normalize(),r[4].setComponents(c-s,f-p,y-x,T-_).normalize(),2e3===t)r[5].setComponents(c+s,f+p,y+x,T+_).normalize();else if(2001===t)r[5].setComponents(s,p,x,_).normalize();else throw Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),uc.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),uc.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(uc)}intersectsSprite(e){return uc.center.set(0,0,0),uc.radius=.7071067811865476,uc.applyMatrix4(e.matrixWorld),this.intersectsSphere(uc)}intersectsSphere(e){let t=this.planes,r=e.center,n=-e.radius;for(let a=0;a<6;a++)if(t[a].distanceToPoint(r)<n)return!1;return!0}intersectsBox(e){let t=this.planes;for(let r=0;r<6;r++){let n=t[r];if(uh.x=n.normal.x>0?e.max.x:e.min.x,uh.y=n.normal.y>0?e.max.y:e.min.y,uh.z=n.normal.z>0?e.max.z:e.min.z,0>n.distanceToPoint(uh))return!1}return!0}containsPoint(e){let t=this.planes;for(let r=0;r<6;r++)if(0>t[r].distanceToPoint(e))return!1;return!0}clone(){return new this.constructor().copy(this)}}function up(){let e=null,t=!1,r=null,n=null;function a(t,o){r(t,o),n=e.requestAnimationFrame(a)}return{start:function(){!0!==t&&null!==r&&(n=e.requestAnimationFrame(a),t=!0)},stop:function(){e.cancelAnimationFrame(n),t=!1},setAnimationLoop:function(e){r=e},setContext:function(t){e=t}}}function uf(e,t){let r=t.isWebGL2,n=new WeakMap;return{get:function e(t){return t.isInterleavedBufferAttribute&&(t=t.data),n.get(t)},remove:function t(r){r.isInterleavedBufferAttribute&&(r=r.data);let a=n.get(r);a&&(e.deleteBuffer(a.buffer),n.delete(r))},update:function t(a,o){if(a.isGLBufferAttribute){let s=n.get(a);(!s||s.version<a.version)&&n.set(a,{buffer:a.buffer,type:a.type,bytesPerElement:a.elementSize,version:a.version});return}a.isInterleavedBufferAttribute&&(a=a.data);let c=n.get(a);void 0===c?n.set(a,function t(n,a){let o=n.array,s=n.usage,c=e.createBuffer();e.bindBuffer(a,c),e.bufferData(a,o,s),n.onUploadCallback();let h;if(o instanceof Float32Array)h=e.FLOAT;else if(o instanceof Uint16Array){if(n.isFloat16BufferAttribute){if(r)h=e.HALF_FLOAT;else throw Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.")}else h=e.UNSIGNED_SHORT}else if(o instanceof Int16Array)h=e.SHORT;else if(o instanceof Uint32Array)h=e.UNSIGNED_INT;else if(o instanceof Int32Array)h=e.INT;else if(o instanceof Int8Array)h=e.BYTE;else if(o instanceof Uint8Array)h=e.UNSIGNED_BYTE;else if(o instanceof Uint8ClampedArray)h=e.UNSIGNED_BYTE;else throw Error("THREE.WebGLAttributes: Unsupported buffer data format: "+o);return{buffer:c,type:h,bytesPerElement:o.BYTES_PER_ELEMENT,version:n.version}}(a,o)):c.version<a.version&&(function t(n,a,o){let s=a.array,c=a.updateRange;e.bindBuffer(o,n),-1===c.count?e.bufferSubData(o,0,s):(r?e.bufferSubData(o,c.offset*s.BYTES_PER_ELEMENT,s,c.offset,c.count):e.bufferSubData(o,c.offset*s.BYTES_PER_ELEMENT,s.subarray(c.offset,c.offset+c.count)),c.count=-1),a.onUploadCallback()}(c.buffer,a,o),c.version=a.version)}}}class um extends lU{constructor(e=1,t=1,r=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:r,heightSegments:n};let a=e/2,o=t/2,s=Math.floor(r),c=Math.floor(n),h=s+1,d=c+1,p=e/s,f=t/c,m=[],$=[],x=[],y=[];for(let S=0;S<d;S++){let E=S*f-o;for(let _=0;_<h;_++){let T=_*p-a;$.push(T,-E,0),x.push(0,0,1),y.push(_/s),y.push(1-S/c)}}for(let M=0;M<c;M++)for(let A=0;A<s;A++){let C=A+h*M,R=A+h*(M+1),P=A+1+h*(M+1),D=A+1+h*M;m.push(C,R,D),m.push(R,P,D)}this.setIndex(m),this.setAttribute("position",new lA($,3)),this.setAttribute("normal",new lA(x,3)),this.setAttribute("uv",new lA(y,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new um(e.width,e.height,e.widthSegments,e.heightSegments)}}var ug=`#ifdef USE_ALPHAHASH
	   if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
   #endif`,u8=`#ifdef USE_ALPHAHASH
	   const float ALPHA_HASH_SCALE = 0.05;
	   float hash2D( vec2 value ) {
		   return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	   }
	   float hash3D( vec3 value ) {
		   return hash2D( vec2( hash2D( value.xy ), value.z ) );
	   }
	   float getAlphaHashThreshold( vec3 position ) {
		   float maxDeriv = max(
			   length( dFdx( position.xyz ) ),
			   length( dFdy( position.xyz ) )
		   );
		   float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		   vec2 pixScales = vec2(
			   exp2( floor( log2( pixScale ) ) ),
			   exp2( ceil( log2( pixScale ) ) )
		   );
		   vec2 alpha = vec2(
			   hash3D( floor( pixScales.x * position.xyz ) ),
			   hash3D( floor( pixScales.y * position.xyz ) )
		   );
		   float lerpFactor = fract( log2( pixScale ) );
		   float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		   float a = min( lerpFactor, 1.0 - lerpFactor );
		   vec3 cases = vec3(
			   x * x / ( 2.0 * a * ( 1.0 - a ) ),
			   ( x - 0.5 * a ) / ( 1.0 - a ),
			   1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		   );
		   float threshold = ( x < ( 1.0 - a ) )
			   ? ( ( x < a ) ? cases.x : cases.y )
			   : cases.z;
		   return clamp( threshold , 1.0e-6, 1.0 );
	   }
   #endif`,u$=`#ifdef USE_ALPHAMAP
	   diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
   #endif`,uv=`#ifdef USE_ALPHAMAP
	   uniform sampler2D alphaMap;
   #endif`,ux=`#ifdef USE_ALPHATEST
	   if ( diffuseColor.a < alphaTest ) discard;
   #endif`,uy=`#ifdef USE_ALPHATEST
	   uniform float alphaTest;
   #endif`,uS=`#ifdef USE_AOMAP
	   float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	   reflectedLight.indirectDiffuse *= ambientOcclusion;
	   #if defined( USE_CLEARCOAT ) 
		   clearcoatSpecularIndirect *= ambientOcclusion;
	   #endif
	   #if defined( USE_SHEEN ) 
		   sheenSpecularIndirect *= ambientOcclusion;
	   #endif
	   #if defined( USE_ENVMAP ) && defined( STANDARD )
		   float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		   reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	   #endif
   #endif`,uE=`#ifdef USE_AOMAP
	   uniform sampler2D aoMap;
	   uniform float aoMapIntensity;
   #endif`,ub=`vec3 transformed = vec3( position );
   #ifdef USE_ALPHAHASH
	   vPosition = vec3( position );
   #endif`,u_=`vec3 objectNormal = vec3( normal );
   #ifdef USE_TANGENT
	   vec3 objectTangent = vec3( tangent.xyz );
   #endif`,uT=`float G_BlinnPhong_Implicit( ) {
	   return 0.25;
   }
   float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	   return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
   }
   vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	   vec3 halfDir = normalize( lightDir + viewDir );
	   float dotNH = saturate( dot( normal, halfDir ) );
	   float dotVH = saturate( dot( viewDir, halfDir ) );
	   vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	   float G = G_BlinnPhong_Implicit( );
	   float D = D_BlinnPhong( shininess, dotNH );
	   return F * ( G * D );
   } // validated`,uM=`#ifdef USE_IRIDESCENCE
	   const mat3 XYZ_TO_REC709 = mat3(
			3.2404542, -0.9692660,  0.0556434,
		   -1.5371385,  1.8760108, -0.2040259,
		   -0.4985314,  0.0415560,  1.0572252
	   );
	   vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		   vec3 sqrtF0 = sqrt( fresnel0 );
		   return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	   }
	   vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		   return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	   }
	   float IorToFresnel0( float transmittedIor, float incidentIor ) {
		   return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	   }
	   vec3 evalSensitivity( float OPD, vec3 shift ) {
		   float phase = 2.0 * PI * OPD * 1.0e-9;
		   vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		   vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		   vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		   vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		   xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		   xyz /= 1.0685e-7;
		   vec3 rgb = XYZ_TO_REC709 * xyz;
		   return rgb;
	   }
	   vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		   vec3 I;
		   float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		   float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		   float cosTheta2Sq = 1.0 - sinTheta2Sq;
		   if ( cosTheta2Sq < 0.0 ) {
			   return vec3( 1.0 );
		   }
		   float cosTheta2 = sqrt( cosTheta2Sq );
		   float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		   float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		   float T121 = 1.0 - R12;
		   float phi12 = 0.0;
		   if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		   float phi21 = PI - phi12;
		   vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		   vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		   vec3 phi23 = vec3( 0.0 );
		   if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		   if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		   if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		   float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		   vec3 phi = vec3( phi21 ) + phi23;
		   vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		   vec3 r123 = sqrt( R123 );
		   vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		   vec3 C0 = R12 + Rs;
		   I = C0;
		   vec3 Cm = Rs - T121;
		   for ( int m = 1; m <= 2; ++ m ) {
			   Cm *= r123;
			   vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			   I += Cm * Sm;
		   }
		   return max( I, vec3( 0.0 ) );
	   }
   #endif`,uw=`#ifdef USE_BUMPMAP
	   uniform sampler2D bumpMap;
	   uniform float bumpScale;
	   vec2 dHdxy_fwd() {
		   vec2 dSTdx = dFdx( vBumpMapUv );
		   vec2 dSTdy = dFdy( vBumpMapUv );
		   float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		   float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		   float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		   return vec2( dBx, dBy );
	   }
	   vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		   vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		   vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		   vec3 vN = surf_norm;
		   vec3 R1 = cross( vSigmaY, vN );
		   vec3 R2 = cross( vN, vSigmaX );
		   float fDet = dot( vSigmaX, R1 ) * faceDirection;
		   vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		   return normalize( abs( fDet ) * surf_norm - vGrad );
	   }
   #endif`,uA=`#if NUM_CLIPPING_PLANES > 0
	   vec4 plane;
	   #pragma unroll_loop_start
	   for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
		   plane = clippingPlanes[ i ];
		   if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
	   }
	   #pragma unroll_loop_end
	   #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
		   bool clipped = true;
		   #pragma unroll_loop_start
		   for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
			   plane = clippingPlanes[ i ];
			   clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
		   }
		   #pragma unroll_loop_end
		   if ( clipped ) discard;
	   #endif
   #endif`,uC=`#if NUM_CLIPPING_PLANES > 0
	   varying vec3 vClipPosition;
	   uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
   #endif`,uR=`#if NUM_CLIPPING_PLANES > 0
	   varying vec3 vClipPosition;
   #endif`,u0=`#if NUM_CLIPPING_PLANES > 0
	   vClipPosition = - mvPosition.xyz;
   #endif`,uP=`#if defined( USE_COLOR_ALPHA )
	   diffuseColor *= vColor;
   #elif defined( USE_COLOR )
	   diffuseColor.rgb *= vColor;
   #endif`,uL=`#if defined( USE_COLOR_ALPHA )
	   varying vec4 vColor;
   #elif defined( USE_COLOR )
	   varying vec3 vColor;
   #endif`,u1=`#if defined( USE_COLOR_ALPHA )
	   varying vec4 vColor;
   #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
	   varying vec3 vColor;
   #endif`,uD=`#if defined( USE_COLOR_ALPHA )
	   vColor = vec4( 1.0 );
   #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
	   vColor = vec3( 1.0 );
   #endif
   #ifdef USE_COLOR
	   vColor *= color;
   #endif
   #ifdef USE_INSTANCING_COLOR
	   vColor.xyz *= instanceColor.xyz;
   #endif`,uU=`#define PI 3.141592653589793
   #define PI2 6.283185307179586
   #define PI_HALF 1.5707963267948966
   #define RECIPROCAL_PI 0.3183098861837907
   #define RECIPROCAL_PI2 0.15915494309189535
   #define EPSILON 1e-6
   #ifndef saturate
   #define saturate( a ) clamp( a, 0.0, 1.0 )
   #endif
   #define whiteComplement( a ) ( 1.0 - saturate( a ) )
   float pow2( const in float x ) { return x*x; }
   vec3 pow2( const in vec3 x ) { return x*x; }
   float pow3( const in float x ) { return x*x*x; }
   float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
   float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
   float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
   highp float rand( const in vec2 uv ) {
	   const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	   highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	   return fract( sin( sn ) * c );
   }
   #ifdef HIGH_PRECISION
	   float precisionSafeLength( vec3 v ) { return length( v ); }
   #else
	   float precisionSafeLength( vec3 v ) {
		   float maxComponent = max3( abs( v ) );
		   return length( v / maxComponent ) * maxComponent;
	   }
   #endif
   struct IncidentLight {
	   vec3 color;
	   vec3 direction;
	   bool visible;
   };
   struct ReflectedLight {
	   vec3 directDiffuse;
	   vec3 directSpecular;
	   vec3 indirectDiffuse;
	   vec3 indirectSpecular;
   };
   #ifdef USE_ALPHAHASH
	   varying vec3 vPosition;
   #endif
   vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	   return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
   }
   vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	   return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
   }
   mat3 transposeMat3( const in mat3 m ) {
	   mat3 tmp;
	   tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	   tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	   tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	   return tmp;
   }
   float luminance( const in vec3 rgb ) {
	   const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );
	   return dot( weights, rgb );
   }
   bool isPerspectiveMatrix( mat4 m ) {
	   return m[ 2 ][ 3 ] == - 1.0;
   }
   vec2 equirectUv( in vec3 dir ) {
	   float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	   float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	   return vec2( u, v );
   }
   vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	   return RECIPROCAL_PI * diffuseColor;
   }
   vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	   float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	   return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
   }
   float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	   float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	   return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
   } // validated`,uI=`#ifdef ENVMAP_TYPE_CUBE_UV
	   #define cubeUV_minMipLevel 4.0
	   #define cubeUV_minTileSize 16.0
	   float getFace( vec3 direction ) {
		   vec3 absDirection = abs( direction );
		   float face = - 1.0;
		   if ( absDirection.x > absDirection.z ) {
			   if ( absDirection.x > absDirection.y )
				   face = direction.x > 0.0 ? 0.0 : 3.0;
			   else
				   face = direction.y > 0.0 ? 1.0 : 4.0;
		   } else {
			   if ( absDirection.z > absDirection.y )
				   face = direction.z > 0.0 ? 2.0 : 5.0;
			   else
				   face = direction.y > 0.0 ? 1.0 : 4.0;
		   }
		   return face;
	   }
	   vec2 getUV( vec3 direction, float face ) {
		   vec2 uv;
		   if ( face == 0.0 ) {
			   uv = vec2( direction.z, direction.y ) / abs( direction.x );
		   } else if ( face == 1.0 ) {
			   uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		   } else if ( face == 2.0 ) {
			   uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		   } else if ( face == 3.0 ) {
			   uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		   } else if ( face == 4.0 ) {
			   uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		   } else {
			   uv = vec2( direction.x, direction.y ) / abs( direction.z );
		   }
		   return 0.5 * ( uv + 1.0 );
	   }
	   vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		   float face = getFace( direction );
		   float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		   mipInt = max( mipInt, cubeUV_minMipLevel );
		   float faceSize = exp2( mipInt );
		   highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		   if ( face > 2.0 ) {
			   uv.y += faceSize;
			   face -= 3.0;
		   }
		   uv.x += face * faceSize;
		   uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		   uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		   uv.x *= CUBEUV_TEXEL_WIDTH;
		   uv.y *= CUBEUV_TEXEL_HEIGHT;
		   #ifdef texture2DGradEXT
			   return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		   #else
			   return texture2D( envMap, uv ).rgb;
		   #endif
	   }
	   #define cubeUV_r0 1.0
	   #define cubeUV_v0 0.339
	   #define cubeUV_m0 - 2.0
	   #define cubeUV_r1 0.8
	   #define cubeUV_v1 0.276
	   #define cubeUV_m1 - 1.0
	   #define cubeUV_r4 0.4
	   #define cubeUV_v4 0.046
	   #define cubeUV_m4 2.0
	   #define cubeUV_r5 0.305
	   #define cubeUV_v5 0.016
	   #define cubeUV_m5 3.0
	   #define cubeUV_r6 0.21
	   #define cubeUV_v6 0.0038
	   #define cubeUV_m6 4.0
	   float roughnessToMip( float roughness ) {
		   float mip = 0.0;
		   if ( roughness >= cubeUV_r1 ) {
			   mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		   } else if ( roughness >= cubeUV_r4 ) {
			   mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		   } else if ( roughness >= cubeUV_r5 ) {
			   mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		   } else if ( roughness >= cubeUV_r6 ) {
			   mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		   } else {
			   mip = - 2.0 * log2( 1.16 * roughness );		}
		   return mip;
	   }
	   vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		   float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		   float mipF = fract( mip );
		   float mipInt = floor( mip );
		   vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		   if ( mipF == 0.0 ) {
			   return vec4( color0, 1.0 );
		   } else {
			   vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			   return vec4( mix( color0, color1, mipF ), 1.0 );
		   }
	   }
   #endif`,uN=`vec3 transformedNormal = objectNormal;
   #ifdef USE_INSTANCING
	   mat3 m = mat3( instanceMatrix );
	   transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );
	   transformedNormal = m * transformedNormal;
   #endif
   transformedNormal = normalMatrix * transformedNormal;
   #ifdef FLIP_SIDED
	   transformedNormal = - transformedNormal;
   #endif
   #ifdef USE_TANGENT
	   vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	   #ifdef FLIP_SIDED
		   transformedTangent = - transformedTangent;
	   #endif
   #endif`,uO=`#ifdef USE_DISPLACEMENTMAP
	   uniform sampler2D displacementMap;
	   uniform float displacementScale;
	   uniform float displacementBias;
   #endif`,uF=`#ifdef USE_DISPLACEMENTMAP
	   transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
   #endif`,uB=`#ifdef USE_EMISSIVEMAP
	   vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	   totalEmissiveRadiance *= emissiveColor.rgb;
   #endif`,uz=`#ifdef USE_EMISSIVEMAP
	   uniform sampler2D emissiveMap;
   #endif`,u2=`
   const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(
	   vec3( 0.8224621, 0.177538, 0.0 ),
	   vec3( 0.0331941, 0.9668058, 0.0 ),
	   vec3( 0.0170827, 0.0723974, 0.9105199 )
   );
   const mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(
	   vec3( 1.2249401, - 0.2249404, 0.0 ),
	   vec3( - 0.0420569, 1.0420571, 0.0 ),
	   vec3( - 0.0196376, - 0.0786361, 1.0982735 )
   );
   vec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {
	   return vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );
   }
   vec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {
	   return vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );
   }
   vec4 LinearTransferOETF( in vec4 value ) {
	   return value;
   }
   vec4 sRGBTransferOETF( in vec4 value ) {
	   return 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 );
   }
   vec4 LinearToLinear( in vec4 value ) {
	   return value;
   }
   vec4 LinearTosRGB( in vec4 value ) {
	   return sRGBTransferOETF( value );
   }`,uk=`#ifdef USE_ENVMAP
	   #ifdef ENV_WORLDPOS
		   vec3 cameraToFrag;
		   if ( isOrthographic ) {
			   cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		   } else {
			   cameraToFrag = normalize( vWorldPosition - cameraPosition );
		   }
		   vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		   #ifdef ENVMAP_MODE_REFLECTION
			   vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		   #else
			   vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		   #endif
	   #else
		   vec3 reflectVec = vReflect;
	   #endif
	   #ifdef ENVMAP_TYPE_CUBE
		   vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	   #else
		   vec4 envColor = vec4( 0.0 );
	   #endif
	   #ifdef ENVMAP_BLENDING_MULTIPLY
		   outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	   #elif defined( ENVMAP_BLENDING_MIX )
		   outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	   #elif defined( ENVMAP_BLENDING_ADD )
		   outgoingLight += envColor.xyz * specularStrength * reflectivity;
	   #endif
   #endif`,uH=`#ifdef USE_ENVMAP
	   uniform float envMapIntensity;
	   uniform float flipEnvMap;
	   #ifdef ENVMAP_TYPE_CUBE
		   uniform samplerCube envMap;
	   #else
		   uniform sampler2D envMap;
	   #endif
	   
   #endif`,uV=`#ifdef USE_ENVMAP
	   uniform float reflectivity;
	   #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		   #define ENV_WORLDPOS
	   #endif
	   #ifdef ENV_WORLDPOS
		   varying vec3 vWorldPosition;
		   uniform float refractionRatio;
	   #else
		   varying vec3 vReflect;
	   #endif
   #endif`,u3=`#ifdef USE_ENVMAP
	   #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		   #define ENV_WORLDPOS
	   #endif
	   #ifdef ENV_WORLDPOS
		   
		   varying vec3 vWorldPosition;
	   #else
		   varying vec3 vReflect;
		   uniform float refractionRatio;
	   #endif
   #endif`,uG=`#ifdef USE_ENVMAP
	   #ifdef ENV_WORLDPOS
		   vWorldPosition = worldPosition.xyz;
	   #else
		   vec3 cameraToVertex;
		   if ( isOrthographic ) {
			   cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		   } else {
			   cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		   }
		   vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		   #ifdef ENVMAP_MODE_REFLECTION
			   vReflect = reflect( cameraToVertex, worldNormal );
		   #else
			   vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		   #endif
	   #endif
   #endif`,u4=`#ifdef USE_FOG
	   vFogDepth = - mvPosition.z;
   #endif`,uW=`#ifdef USE_FOG
	   varying float vFogDepth;
   #endif`,u6=`#ifdef USE_FOG
	   #ifdef FOG_EXP2
		   float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	   #else
		   float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	   #endif
	   gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
   #endif`,u5=`#ifdef USE_FOG
	   uniform vec3 fogColor;
	   varying float vFogDepth;
	   #ifdef FOG_EXP2
		   uniform float fogDensity;
	   #else
		   uniform float fogNear;
		   uniform float fogFar;
	   #endif
   #endif`,u7=`#ifdef USE_GRADIENTMAP
	   uniform sampler2D gradientMap;
   #endif
   vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	   float dotNL = dot( normal, lightDirection );
	   vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	   #ifdef USE_GRADIENTMAP
		   return vec3( texture2D( gradientMap, coord ).r );
	   #else
		   vec2 fw = fwidth( coord ) * 0.5;
		   return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	   #endif
   }`,uX=`#ifdef USE_LIGHTMAP
	   vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
	   vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
	   reflectedLight.indirectDiffuse += lightMapIrradiance;
   #endif`,uq=`#ifdef USE_LIGHTMAP
	   uniform sampler2D lightMap;
	   uniform float lightMapIntensity;
   #endif`,uY=`LambertMaterial material;
   material.diffuseColor = diffuseColor.rgb;
   material.specularStrength = specularStrength;`,uj=`varying vec3 vViewPosition;
   struct LambertMaterial {
	   vec3 diffuseColor;
	   float specularStrength;
   };
   void 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 ) {
	   float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	   vec3 irradiance = dotNL * directLight.color;
	   reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
   }
   void 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 ) {
	   reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
   }
   #define RE_Direct				RE_Direct_Lambert
   #define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,uZ=`uniform bool receiveShadow;
   uniform vec3 ambientLightColor;
   #if defined( USE_LIGHT_PROBES )
	   uniform vec3 lightProbe[ 9 ];
   #endif
   vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	   float x = normal.x, y = normal.y, z = normal.z;
	   vec3 result = shCoefficients[ 0 ] * 0.886227;
	   result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	   result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	   result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	   result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	   result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	   result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	   result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	   result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	   return result;
   }
   vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	   vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	   vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	   return irradiance;
   }
   vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	   vec3 irradiance = ambientLightColor;
	   return irradiance;
   }
   float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	   #if defined ( LEGACY_LIGHTS )
		   if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
			   return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
		   }
		   return 1.0;
	   #else
		   float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
		   if ( cutoffDistance > 0.0 ) {
			   distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
		   }
		   return distanceFalloff;
	   #endif
   }
   float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	   return smoothstep( coneCosine, penumbraCosine, angleCosine );
   }
   #if NUM_DIR_LIGHTS > 0
	   struct DirectionalLight {
		   vec3 direction;
		   vec3 color;
	   };
	   uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	   void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		   light.color = directionalLight.color;
		   light.direction = directionalLight.direction;
		   light.visible = true;
	   }
   #endif
   #if NUM_POINT_LIGHTS > 0
	   struct PointLight {
		   vec3 position;
		   vec3 color;
		   float distance;
		   float decay;
	   };
	   uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	   void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		   vec3 lVector = pointLight.position - geometryPosition;
		   light.direction = normalize( lVector );
		   float lightDistance = length( lVector );
		   light.color = pointLight.color;
		   light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		   light.visible = ( light.color != vec3( 0.0 ) );
	   }
   #endif
   #if NUM_SPOT_LIGHTS > 0
	   struct SpotLight {
		   vec3 position;
		   vec3 direction;
		   vec3 color;
		   float distance;
		   float decay;
		   float coneCos;
		   float penumbraCos;
	   };
	   uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	   void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		   vec3 lVector = spotLight.position - geometryPosition;
		   light.direction = normalize( lVector );
		   float angleCos = dot( light.direction, spotLight.direction );
		   float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		   if ( spotAttenuation > 0.0 ) {
			   float lightDistance = length( lVector );
			   light.color = spotLight.color * spotAttenuation;
			   light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			   light.visible = ( light.color != vec3( 0.0 ) );
		   } else {
			   light.color = vec3( 0.0 );
			   light.visible = false;
		   }
	   }
   #endif
   #if NUM_RECT_AREA_LIGHTS > 0
	   struct RectAreaLight {
		   vec3 color;
		   vec3 position;
		   vec3 halfWidth;
		   vec3 halfHeight;
	   };
	   uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	   uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
   #endif
   #if NUM_HEMI_LIGHTS > 0
	   struct HemisphereLight {
		   vec3 direction;
		   vec3 skyColor;
		   vec3 groundColor;
	   };
	   uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	   vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		   float dotNL = dot( normal, hemiLight.direction );
		   float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		   vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		   return irradiance;
	   }
   #endif`,uK=`#ifdef USE_ENVMAP
	   vec3 getIBLIrradiance( const in vec3 normal ) {
		   #ifdef ENVMAP_TYPE_CUBE_UV
			   vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			   vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );
			   return PI * envMapColor.rgb * envMapIntensity;
		   #else
			   return vec3( 0.0 );
		   #endif
	   }
	   vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		   #ifdef ENVMAP_TYPE_CUBE_UV
			   vec3 reflectVec = reflect( - viewDir, normal );
			   reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			   reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			   vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );
			   return envMapColor.rgb * envMapIntensity;
		   #else
			   return vec3( 0.0 );
		   #endif
	   }
	   #ifdef USE_ANISOTROPY
		   vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			   #ifdef ENVMAP_TYPE_CUBE_UV
				   vec3 bentNormal = cross( bitangent, viewDir );
				   bentNormal = normalize( cross( bentNormal, bitangent ) );
				   bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				   return getIBLRadiance( viewDir, bentNormal, roughness );
			   #else
				   return vec3( 0.0 );
			   #endif
		   }
	   #endif
   #endif`,uJ=`ToonMaterial material;
   material.diffuseColor = diffuseColor.rgb;`,uQ=`varying vec3 vViewPosition;
   struct ToonMaterial {
	   vec3 diffuseColor;
   };
   void 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 ) {
	   vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	   reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
   }
   void 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 ) {
	   reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
   }
   #define RE_Direct				RE_Direct_Toon
   #define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,u9=`BlinnPhongMaterial material;
   material.diffuseColor = diffuseColor.rgb;
   material.specularColor = specular;
   material.specularShininess = shininess;
   material.specularStrength = specularStrength;`,ce=`varying vec3 vViewPosition;
   struct BlinnPhongMaterial {
	   vec3 diffuseColor;
	   vec3 specularColor;
	   float specularShininess;
	   float specularStrength;
   };
   void 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 ) {
	   float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	   vec3 irradiance = dotNL * directLight.color;
	   reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	   reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
   }
   void 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 ) {
	   reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
   }
   #define RE_Direct				RE_Direct_BlinnPhong
   #define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,ct=`PhysicalMaterial material;
   material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
   vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
   float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
   material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
   material.roughness = min( material.roughness, 1.0 );
   #ifdef IOR
	   material.ior = ior;
	   #ifdef USE_SPECULAR
		   float specularIntensityFactor = specularIntensity;
		   vec3 specularColorFactor = specularColor;
		   #ifdef USE_SPECULAR_COLORMAP
			   specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		   #endif
		   #ifdef USE_SPECULAR_INTENSITYMAP
			   specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		   #endif
		   material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	   #else
		   float specularIntensityFactor = 1.0;
		   vec3 specularColorFactor = vec3( 1.0 );
		   material.specularF90 = 1.0;
	   #endif
	   material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
   #else
	   material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	   material.specularF90 = 1.0;
   #endif
   #ifdef USE_CLEARCOAT
	   material.clearcoat = clearcoat;
	   material.clearcoatRoughness = clearcoatRoughness;
	   material.clearcoatF0 = vec3( 0.04 );
	   material.clearcoatF90 = 1.0;
	   #ifdef USE_CLEARCOATMAP
		   material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	   #endif
	   #ifdef USE_CLEARCOAT_ROUGHNESSMAP
		   material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	   #endif
	   material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	   material.clearcoatRoughness += geometryRoughness;
	   material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
   #endif
   #ifdef USE_IRIDESCENCE
	   material.iridescence = iridescence;
	   material.iridescenceIOR = iridescenceIOR;
	   #ifdef USE_IRIDESCENCEMAP
		   material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	   #endif
	   #ifdef USE_IRIDESCENCE_THICKNESSMAP
		   material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	   #else
		   material.iridescenceThickness = iridescenceThicknessMaximum;
	   #endif
   #endif
   #ifdef USE_SHEEN
	   material.sheenColor = sheenColor;
	   #ifdef USE_SHEEN_COLORMAP
		   material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	   #endif
	   material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	   #ifdef USE_SHEEN_ROUGHNESSMAP
		   material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	   #endif
   #endif
   #ifdef USE_ANISOTROPY
	   #ifdef USE_ANISOTROPYMAP
		   mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		   vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		   vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	   #else
		   vec2 anisotropyV = anisotropyVector;
	   #endif
	   material.anisotropy = length( anisotropyV );
	   anisotropyV /= material.anisotropy;
	   material.anisotropy = saturate( material.anisotropy );
	   material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	   material.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;
	   material.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;
   #endif`,ci=`struct PhysicalMaterial {
	   vec3 diffuseColor;
	   float roughness;
	   vec3 specularColor;
	   float specularF90;
	   #ifdef USE_CLEARCOAT
		   float clearcoat;
		   float clearcoatRoughness;
		   vec3 clearcoatF0;
		   float clearcoatF90;
	   #endif
	   #ifdef USE_IRIDESCENCE
		   float iridescence;
		   float iridescenceIOR;
		   float iridescenceThickness;
		   vec3 iridescenceFresnel;
		   vec3 iridescenceF0;
	   #endif
	   #ifdef USE_SHEEN
		   vec3 sheenColor;
		   float sheenRoughness;
	   #endif
	   #ifdef IOR
		   float ior;
	   #endif
	   #ifdef USE_TRANSMISSION
		   float transmission;
		   float transmissionAlpha;
		   float thickness;
		   float attenuationDistance;
		   vec3 attenuationColor;
	   #endif
	   #ifdef USE_ANISOTROPY
		   float anisotropy;
		   float alphaT;
		   vec3 anisotropyT;
		   vec3 anisotropyB;
	   #endif
   };
   vec3 clearcoatSpecularDirect = vec3( 0.0 );
   vec3 clearcoatSpecularIndirect = vec3( 0.0 );
   vec3 sheenSpecularDirect = vec3( 0.0 );
   vec3 sheenSpecularIndirect = vec3(0.0 );
   vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
	   float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
	   float x2 = x * x;
	   float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
	   return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
   }
   float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	   float a2 = pow2( alpha );
	   float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	   float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	   return 0.5 / max( gv + gl, EPSILON );
   }
   float D_GGX( const in float alpha, const in float dotNH ) {
	   float a2 = pow2( alpha );
	   float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	   return RECIPROCAL_PI * a2 / pow2( denom );
   }
   #ifdef USE_ANISOTROPY
	   float 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 ) {
		   float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		   float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		   float v = 0.5 / ( gv + gl );
		   return saturate(v);
	   }
	   float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		   float a2 = alphaT * alphaB;
		   highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		   highp float v2 = dot( v, v );
		   float w2 = a2 / v2;
		   return RECIPROCAL_PI * a2 * pow2 ( w2 );
	   }
   #endif
   #ifdef USE_CLEARCOAT
	   vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		   vec3 f0 = material.clearcoatF0;
		   float f90 = material.clearcoatF90;
		   float roughness = material.clearcoatRoughness;
		   float alpha = pow2( roughness );
		   vec3 halfDir = normalize( lightDir + viewDir );
		   float dotNL = saturate( dot( normal, lightDir ) );
		   float dotNV = saturate( dot( normal, viewDir ) );
		   float dotNH = saturate( dot( normal, halfDir ) );
		   float dotVH = saturate( dot( viewDir, halfDir ) );
		   vec3 F = F_Schlick( f0, f90, dotVH );
		   float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		   float D = D_GGX( alpha, dotNH );
		   return F * ( V * D );
	   }
   #endif
   vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	   vec3 f0 = material.specularColor;
	   float f90 = material.specularF90;
	   float roughness = material.roughness;
	   float alpha = pow2( roughness );
	   vec3 halfDir = normalize( lightDir + viewDir );
	   float dotNL = saturate( dot( normal, lightDir ) );
	   float dotNV = saturate( dot( normal, viewDir ) );
	   float dotNH = saturate( dot( normal, halfDir ) );
	   float dotVH = saturate( dot( viewDir, halfDir ) );
	   vec3 F = F_Schlick( f0, f90, dotVH );
	   #ifdef USE_IRIDESCENCE
		   F = mix( F, material.iridescenceFresnel, material.iridescence );
	   #endif
	   #ifdef USE_ANISOTROPY
		   float dotTL = dot( material.anisotropyT, lightDir );
		   float dotTV = dot( material.anisotropyT, viewDir );
		   float dotTH = dot( material.anisotropyT, halfDir );
		   float dotBL = dot( material.anisotropyB, lightDir );
		   float dotBV = dot( material.anisotropyB, viewDir );
		   float dotBH = dot( material.anisotropyB, halfDir );
		   float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		   float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	   #else
		   float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		   float D = D_GGX( alpha, dotNH );
	   #endif
	   return F * ( V * D );
   }
   vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	   const float LUT_SIZE = 64.0;
	   const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	   const float LUT_BIAS = 0.5 / LUT_SIZE;
	   float dotNV = saturate( dot( N, V ) );
	   vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	   uv = uv * LUT_SCALE + LUT_BIAS;
	   return uv;
   }
   float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	   float l = length( f );
	   return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
   }
   vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	   float x = dot( v1, v2 );
	   float y = abs( x );
	   float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	   float b = 3.4175940 + ( 4.1616724 + y ) * y;
	   float v = a / b;
	   float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	   return cross( v1, v2 ) * theta_sintheta;
   }
   vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	   vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	   vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	   vec3 lightNormal = cross( v1, v2 );
	   if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	   vec3 T1, T2;
	   T1 = normalize( V - N * dot( V, N ) );
	   T2 = - cross( N, T1 );
	   mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	   vec3 coords[ 4 ];
	   coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	   coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	   coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	   coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	   coords[ 0 ] = normalize( coords[ 0 ] );
	   coords[ 1 ] = normalize( coords[ 1 ] );
	   coords[ 2 ] = normalize( coords[ 2 ] );
	   coords[ 3 ] = normalize( coords[ 3 ] );
	   vec3 vectorFormFactor = vec3( 0.0 );
	   vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	   vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	   vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	   vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	   float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	   return vec3( result );
   }
   #if defined( USE_SHEEN )
   float D_Charlie( float roughness, float dotNH ) {
	   float alpha = pow2( roughness );
	   float invAlpha = 1.0 / alpha;
	   float cos2h = dotNH * dotNH;
	   float sin2h = max( 1.0 - cos2h, 0.0078125 );
	   return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
   }
   float V_Neubelt( float dotNV, float dotNL ) {
	   return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
   }
   vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	   vec3 halfDir = normalize( lightDir + viewDir );
	   float dotNL = saturate( dot( normal, lightDir ) );
	   float dotNV = saturate( dot( normal, viewDir ) );
	   float dotNH = saturate( dot( normal, halfDir ) );
	   float D = D_Charlie( sheenRoughness, dotNH );
	   float V = V_Neubelt( dotNV, dotNL );
	   return sheenColor * ( D * V );
   }
   #endif
   float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	   float dotNV = saturate( dot( normal, viewDir ) );
	   float r2 = roughness * roughness;
	   float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	   float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	   float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	   return saturate( DG * RECIPROCAL_PI );
   }
   vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	   float dotNV = saturate( dot( normal, viewDir ) );
	   const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	   const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	   vec4 r = roughness * c0 + c1;
	   float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	   vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	   return fab;
   }
   vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	   vec2 fab = DFGApprox( normal, viewDir, roughness );
	   return specularColor * fab.x + specularF90 * fab.y;
   }
   #ifdef USE_IRIDESCENCE
   void 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 ) {
   #else
   void 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 ) {
   #endif
	   vec2 fab = DFGApprox( normal, viewDir, roughness );
	   #ifdef USE_IRIDESCENCE
		   vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	   #else
		   vec3 Fr = specularColor;
	   #endif
	   vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	   float Ess = fab.x + fab.y;
	   float Ems = 1.0 - Ess;
	   vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	   singleScatter += FssEss;
	   multiScatter += Fms * Ems;
   }
   #if NUM_RECT_AREA_LIGHTS > 0
	   void 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 ) {
		   vec3 normal = geometryNormal;
		   vec3 viewDir = geometryViewDir;
		   vec3 position = geometryPosition;
		   vec3 lightPos = rectAreaLight.position;
		   vec3 halfWidth = rectAreaLight.halfWidth;
		   vec3 halfHeight = rectAreaLight.halfHeight;
		   vec3 lightColor = rectAreaLight.color;
		   float roughness = material.roughness;
		   vec3 rectCoords[ 4 ];
		   rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		   rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		   rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		   vec2 uv = LTC_Uv( normal, viewDir, roughness );
		   vec4 t1 = texture2D( ltc_1, uv );
		   vec4 t2 = texture2D( ltc_2, uv );
		   mat3 mInv = mat3(
			   vec3( t1.x, 0, t1.y ),
			   vec3(    0, 1,    0 ),
			   vec3( t1.z, 0, t1.w )
		   );
		   vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		   reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		   reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	   }
   #endif
   void 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 ) {
	   float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	   vec3 irradiance = dotNL * directLight.color;
	   #ifdef USE_CLEARCOAT
		   float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		   vec3 ccIrradiance = dotNLcc * directLight.color;
		   clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	   #endif
	   #ifdef USE_SHEEN
		   sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	   #endif
	   reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	   reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
   }
   void 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 ) {
	   reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
   }
   void 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) {
	   #ifdef USE_CLEARCOAT
		   clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	   #endif
	   #ifdef USE_SHEEN
		   sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	   #endif
	   vec3 singleScattering = vec3( 0.0 );
	   vec3 multiScattering = vec3( 0.0 );
	   vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	   #ifdef USE_IRIDESCENCE
		   computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	   #else
		   computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	   #endif
	   vec3 totalScattering = singleScattering + multiScattering;
	   vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	   reflectedLight.indirectSpecular += radiance * singleScattering;
	   reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	   reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
   }
   #define RE_Direct				RE_Direct_Physical
   #define RE_Direct_RectArea		RE_Direct_RectArea_Physical
   #define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
   #define RE_IndirectSpecular		RE_IndirectSpecular_Physical
   float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	   return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
   }`,cr=`
   vec3 geometryPosition = - vViewPosition;
   vec3 geometryNormal = normal;
   vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
   vec3 geometryClearcoatNormal = vec3( 0.0 );
   #ifdef USE_CLEARCOAT
	   geometryClearcoatNormal = clearcoatNormal;
   #endif
   #ifdef USE_IRIDESCENCE
	   float dotNVi = saturate( dot( normal, geometryViewDir ) );
	   if ( material.iridescenceThickness == 0.0 ) {
		   material.iridescence = 0.0;
	   } else {
		   material.iridescence = saturate( material.iridescence );
	   }
	   if ( material.iridescence > 0.0 ) {
		   material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		   material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	   }
   #endif
   IncidentLight directLight;
   #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	   PointLight pointLight;
	   #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	   PointLightShadow pointLightShadow;
	   #endif
	   #pragma unroll_loop_start
	   for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		   pointLight = pointLights[ i ];
		   getPointLightInfo( pointLight, geometryPosition, directLight );
		   #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		   pointLightShadow = pointLightShadows[ i ];
		   directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		   #endif
		   RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	   }
	   #pragma unroll_loop_end
   #endif
   #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	   SpotLight spotLight;
	   vec4 spotColor;
	   vec3 spotLightCoord;
	   bool inSpotLightMap;
	   #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	   SpotLightShadow spotLightShadow;
	   #endif
	   #pragma unroll_loop_start
	   for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		   spotLight = spotLights[ i ];
		   getSpotLightInfo( spotLight, geometryPosition, directLight );
		   #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		   #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		   #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		   #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		   #else
		   #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		   #endif
		   #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			   spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			   inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			   spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			   directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		   #endif
		   #undef SPOT_LIGHT_MAP_INDEX
		   #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		   spotLightShadow = spotLightShadows[ i ];
		   directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		   #endif
		   RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	   }
	   #pragma unroll_loop_end
   #endif
   #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	   DirectionalLight directionalLight;
	   #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	   DirectionalLightShadow directionalLightShadow;
	   #endif
	   #pragma unroll_loop_start
	   for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		   directionalLight = directionalLights[ i ];
		   getDirectionalLightInfo( directionalLight, directLight );
		   #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		   directionalLightShadow = directionalLightShadows[ i ];
		   directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		   #endif
		   RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	   }
	   #pragma unroll_loop_end
   #endif
   #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	   RectAreaLight rectAreaLight;
	   #pragma unroll_loop_start
	   for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		   rectAreaLight = rectAreaLights[ i ];
		   RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	   }
	   #pragma unroll_loop_end
   #endif
   #if defined( RE_IndirectDiffuse )
	   vec3 iblIrradiance = vec3( 0.0 );
	   vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	   #if defined( USE_LIGHT_PROBES )
		   irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	   #endif
	   #if ( NUM_HEMI_LIGHTS > 0 )
		   #pragma unroll_loop_start
		   for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			   irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		   }
		   #pragma unroll_loop_end
	   #endif
   #endif
   #if defined( RE_IndirectSpecular )
	   vec3 radiance = vec3( 0.0 );
	   vec3 clearcoatRadiance = vec3( 0.0 );
   #endif`,cn=`#if defined( RE_IndirectDiffuse )
	   #ifdef USE_LIGHTMAP
		   vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		   vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		   irradiance += lightMapIrradiance;
	   #endif
	   #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		   iblIrradiance += getIBLIrradiance( geometryNormal );
	   #endif
   #endif
   #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	   #ifdef USE_ANISOTROPY
		   radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	   #else
		   radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	   #endif
	   #ifdef USE_CLEARCOAT
		   clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	   #endif
   #endif`,ca=`#if defined( RE_IndirectDiffuse )
	   RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
   #endif
   #if defined( RE_IndirectSpecular )
	   RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
   #endif`,co=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	   gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
   #endif`,cs=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	   uniform float logDepthBufFC;
	   varying float vFragDepth;
	   varying float vIsPerspective;
   #endif`,cl=`#ifdef USE_LOGDEPTHBUF
	   #ifdef USE_LOGDEPTHBUF_EXT
		   varying float vFragDepth;
		   varying float vIsPerspective;
	   #else
		   uniform float logDepthBufFC;
	   #endif
   #endif`,cu=`#ifdef USE_LOGDEPTHBUF
	   #ifdef USE_LOGDEPTHBUF_EXT
		   vFragDepth = 1.0 + gl_Position.w;
		   vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
	   #else
		   if ( isPerspectiveMatrix( projectionMatrix ) ) {
			   gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
			   gl_Position.z *= gl_Position.w;
		   }
	   #endif
   #endif`,cc=`#ifdef USE_MAP
	   vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	   #ifdef DECODE_VIDEO_TEXTURE
		   sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );
	   
	   #endif
	   diffuseColor *= sampledDiffuseColor;
   #endif`,ch=`#ifdef USE_MAP
	   uniform sampler2D map;
   #endif`,cd=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	   #if defined( USE_POINTS_UV )
		   vec2 uv = vUv;
	   #else
		   vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	   #endif
   #endif
   #ifdef USE_MAP
	   diffuseColor *= texture2D( map, uv );
   #endif
   #ifdef USE_ALPHAMAP
	   diffuseColor.a *= texture2D( alphaMap, uv ).g;
   #endif`,cp=`#if defined( USE_POINTS_UV )
	   varying vec2 vUv;
   #else
	   #if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		   uniform mat3 uvTransform;
	   #endif
   #endif
   #ifdef USE_MAP
	   uniform sampler2D map;
   #endif
   #ifdef USE_ALPHAMAP
	   uniform sampler2D alphaMap;
   #endif`,cf=`float metalnessFactor = metalness;
   #ifdef USE_METALNESSMAP
	   vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	   metalnessFactor *= texelMetalness.b;
   #endif`,cm=`#ifdef USE_METALNESSMAP
	   uniform sampler2D metalnessMap;
   #endif`,cg=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )
	   vColor *= morphTargetBaseInfluence;
	   for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		   #if defined( USE_COLOR_ALPHA )
			   if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		   #elif defined( USE_COLOR )
			   if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		   #endif
	   }
   #endif`,c8=`#ifdef USE_MORPHNORMALS
	   objectNormal *= morphTargetBaseInfluence;
	   #ifdef MORPHTARGETS_TEXTURE
		   for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
			   if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
		   }
	   #else
		   objectNormal += morphNormal0 * morphTargetInfluences[ 0 ];
		   objectNormal += morphNormal1 * morphTargetInfluences[ 1 ];
		   objectNormal += morphNormal2 * morphTargetInfluences[ 2 ];
		   objectNormal += morphNormal3 * morphTargetInfluences[ 3 ];
	   #endif
   #endif`,c$=`#ifdef USE_MORPHTARGETS
	   uniform float morphTargetBaseInfluence;
	   #ifdef MORPHTARGETS_TEXTURE
		   uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
		   uniform sampler2DArray morphTargetsTexture;
		   uniform ivec2 morphTargetsTextureSize;
		   vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
			   int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
			   int y = texelIndex / morphTargetsTextureSize.x;
			   int x = texelIndex - y * morphTargetsTextureSize.x;
			   ivec3 morphUV = ivec3( x, y, morphTargetIndex );
			   return texelFetch( morphTargetsTexture, morphUV, 0 );
		   }
	   #else
		   #ifndef USE_MORPHNORMALS
			   uniform float morphTargetInfluences[ 8 ];
		   #else
			   uniform float morphTargetInfluences[ 4 ];
		   #endif
	   #endif
   #endif`,cv=`#ifdef USE_MORPHTARGETS
	   transformed *= morphTargetBaseInfluence;
	   #ifdef MORPHTARGETS_TEXTURE
		   for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
			   if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
		   }
	   #else
		   transformed += morphTarget0 * morphTargetInfluences[ 0 ];
		   transformed += morphTarget1 * morphTargetInfluences[ 1 ];
		   transformed += morphTarget2 * morphTargetInfluences[ 2 ];
		   transformed += morphTarget3 * morphTargetInfluences[ 3 ];
		   #ifndef USE_MORPHNORMALS
			   transformed += morphTarget4 * morphTargetInfluences[ 4 ];
			   transformed += morphTarget5 * morphTargetInfluences[ 5 ];
			   transformed += morphTarget6 * morphTargetInfluences[ 6 ];
			   transformed += morphTarget7 * morphTargetInfluences[ 7 ];
		   #endif
	   #endif
   #endif`,cx=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
   #ifdef FLAT_SHADED
	   vec3 fdx = dFdx( vViewPosition );
	   vec3 fdy = dFdy( vViewPosition );
	   vec3 normal = normalize( cross( fdx, fdy ) );
   #else
	   vec3 normal = normalize( vNormal );
	   #ifdef DOUBLE_SIDED
		   normal *= faceDirection;
	   #endif
   #endif
   #if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	   #ifdef USE_TANGENT
		   mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	   #else
		   mat3 tbn = getTangentFrame( - vViewPosition, normal,
		   #if defined( USE_NORMALMAP )
			   vNormalMapUv
		   #elif defined( USE_CLEARCOAT_NORMALMAP )
			   vClearcoatNormalMapUv
		   #else
			   vUv
		   #endif
		   );
	   #endif
	   #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		   tbn[0] *= faceDirection;
		   tbn[1] *= faceDirection;
	   #endif
   #endif
   #ifdef USE_CLEARCOAT_NORMALMAP
	   #ifdef USE_TANGENT
		   mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	   #else
		   mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	   #endif
	   #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		   tbn2[0] *= faceDirection;
		   tbn2[1] *= faceDirection;
	   #endif
   #endif
   vec3 nonPerturbedNormal = normal;`,cy=`#ifdef USE_NORMALMAP_OBJECTSPACE
	   normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	   #ifdef FLIP_SIDED
		   normal = - normal;
	   #endif
	   #ifdef DOUBLE_SIDED
		   normal = normal * faceDirection;
	   #endif
	   normal = normalize( normalMatrix * normal );
   #elif defined( USE_NORMALMAP_TANGENTSPACE )
	   vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	   mapN.xy *= normalScale;
	   normal = normalize( tbn * mapN );
   #elif defined( USE_BUMPMAP )
	   normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
   #endif`,cS=`#ifndef FLAT_SHADED
	   varying vec3 vNormal;
	   #ifdef USE_TANGENT
		   varying vec3 vTangent;
		   varying vec3 vBitangent;
	   #endif
   #endif`,cE=`#ifndef FLAT_SHADED
	   varying vec3 vNormal;
	   #ifdef USE_TANGENT
		   varying vec3 vTangent;
		   varying vec3 vBitangent;
	   #endif
   #endif`,cb=`#ifndef FLAT_SHADED
	   vNormal = normalize( transformedNormal );
	   #ifdef USE_TANGENT
		   vTangent = normalize( transformedTangent );
		   vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	   #endif
   #endif`,c_=`#ifdef USE_NORMALMAP
	   uniform sampler2D normalMap;
	   uniform vec2 normalScale;
   #endif
   #ifdef USE_NORMALMAP_OBJECTSPACE
	   uniform mat3 normalMatrix;
   #endif
   #if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	   mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		   vec3 q0 = dFdx( eye_pos.xyz );
		   vec3 q1 = dFdy( eye_pos.xyz );
		   vec2 st0 = dFdx( uv.st );
		   vec2 st1 = dFdy( uv.st );
		   vec3 N = surf_norm;
		   vec3 q1perp = cross( q1, N );
		   vec3 q0perp = cross( N, q0 );
		   vec3 T = q1perp * st0.x + q0perp * st1.x;
		   vec3 B = q1perp * st0.y + q0perp * st1.y;
		   float det = max( dot( T, T ), dot( B, B ) );
		   float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		   return mat3( T * scale, B * scale, N );
	   }
   #endif`,cT=`#ifdef USE_CLEARCOAT
	   vec3 clearcoatNormal = nonPerturbedNormal;
   #endif`,cM=`#ifdef USE_CLEARCOAT_NORMALMAP
	   vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	   clearcoatMapN.xy *= clearcoatNormalScale;
	   clearcoatNormal = normalize( tbn2 * clearcoatMapN );
   #endif`,cw=`#ifdef USE_CLEARCOATMAP
	   uniform sampler2D clearcoatMap;
   #endif
   #ifdef USE_CLEARCOAT_NORMALMAP
	   uniform sampler2D clearcoatNormalMap;
	   uniform vec2 clearcoatNormalScale;
   #endif
   #ifdef USE_CLEARCOAT_ROUGHNESSMAP
	   uniform sampler2D clearcoatRoughnessMap;
   #endif`,cA=`#ifdef USE_IRIDESCENCEMAP
	   uniform sampler2D iridescenceMap;
   #endif
   #ifdef USE_IRIDESCENCE_THICKNESSMAP
	   uniform sampler2D iridescenceThicknessMap;
   #endif`,cC=`#ifdef OPAQUE
   diffuseColor.a = 1.0;
   #endif
   #ifdef USE_TRANSMISSION
   diffuseColor.a *= material.transmissionAlpha;
   #endif
   gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,cR=`vec3 packNormalToRGB( const in vec3 normal ) {
	   return normalize( normal ) * 0.5 + 0.5;
   }
   vec3 unpackRGBToNormal( const in vec3 rgb ) {
	   return 2.0 * rgb.xyz - 1.0;
   }
   const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
   const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );
   const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
   const float ShiftRight8 = 1. / 256.;
   vec4 packDepthToRGBA( const in float v ) {
	   vec4 r = vec4( fract( v * PackFactors ), v );
	   r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
   }
   float unpackRGBAToDepth( const in vec4 v ) {
	   return dot( v, UnpackFactors );
   }
   vec2 packDepthToRG( in highp float v ) {
	   return packDepthToRGBA( v ).yx;
   }
   float unpackRGToDepth( const in highp vec2 v ) {
	   return unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );
   }
   vec4 pack2HalfToRGBA( vec2 v ) {
	   vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	   return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
   }
   vec2 unpackRGBATo2Half( vec4 v ) {
	   return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
   }
   float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	   return ( viewZ + near ) / ( near - far );
   }
   float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	   return depth * ( near - far ) - near;
   }
   float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	   return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
   }
   float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	   return ( near * far ) / ( ( far - near ) * depth - far );
   }`,c0=`#ifdef PREMULTIPLIED_ALPHA
	   gl_FragColor.rgb *= gl_FragColor.a;
   #endif`,cP=`vec4 mvPosition = vec4( transformed, 1.0 );
   #ifdef USE_INSTANCING
	   mvPosition = instanceMatrix * mvPosition;
   #endif
   mvPosition = modelViewMatrix * mvPosition;
   gl_Position = projectionMatrix * mvPosition;`,cL=`#ifdef DITHERING
	   gl_FragColor.rgb = dithering( gl_FragColor.rgb );
   #endif`,c1=`#ifdef DITHERING
	   vec3 dithering( vec3 color ) {
		   float grid_position = rand( gl_FragCoord.xy );
		   vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		   dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		   return color + dither_shift_RGB;
	   }
   #endif`,cD=`float roughnessFactor = roughness;
   #ifdef USE_ROUGHNESSMAP
	   vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	   roughnessFactor *= texelRoughness.g;
   #endif`,cU=`#ifdef USE_ROUGHNESSMAP
	   uniform sampler2D roughnessMap;
   #endif`,cI=`#if NUM_SPOT_LIGHT_COORDS > 0
	   varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
   #endif
   #if NUM_SPOT_LIGHT_MAPS > 0
	   uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
   #endif
   #ifdef USE_SHADOWMAP
	   #if NUM_DIR_LIGHT_SHADOWS > 0
		   uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		   varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		   struct DirectionalLightShadow {
			   float shadowBias;
			   float shadowNormalBias;
			   float shadowRadius;
			   vec2 shadowMapSize;
		   };
		   uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	   #endif
	   #if NUM_SPOT_LIGHT_SHADOWS > 0
		   uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		   struct SpotLightShadow {
			   float shadowBias;
			   float shadowNormalBias;
			   float shadowRadius;
			   vec2 shadowMapSize;
		   };
		   uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	   #endif
	   #if NUM_POINT_LIGHT_SHADOWS > 0
		   uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		   varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		   struct PointLightShadow {
			   float shadowBias;
			   float shadowNormalBias;
			   float shadowRadius;
			   vec2 shadowMapSize;
			   float shadowCameraNear;
			   float shadowCameraFar;
		   };
		   uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	   #endif
	   float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		   return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	   }
	   vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		   return unpackRGBATo2Half( texture2D( shadow, uv ) );
	   }
	   float VSMShadow (sampler2D shadow, vec2 uv, float compare ){
		   float occlusion = 1.0;
		   vec2 distribution = texture2DDistribution( shadow, uv );
		   float hard_shadow = step( compare , distribution.x );
		   if (hard_shadow != 1.0 ) {
			   float distance = compare - distribution.x ;
			   float variance = max( 0.00000, distribution.y * distribution.y );
			   float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		   }
		   return occlusion;
	   }
	   float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		   float shadow = 1.0;
		   shadowCoord.xyz /= shadowCoord.w;
		   shadowCoord.z += shadowBias;
		   bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
		   bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
		   if ( frustumTest ) {
		   #if defined( SHADOWMAP_TYPE_PCF )
			   vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			   float dx0 = - texelSize.x * shadowRadius;
			   float dy0 = - texelSize.y * shadowRadius;
			   float dx1 = + texelSize.x * shadowRadius;
			   float dy1 = + texelSize.y * shadowRadius;
			   float dx2 = dx0 / 2.0;
			   float dy2 = dy0 / 2.0;
			   float dx3 = dx1 / 2.0;
			   float dy3 = dy1 / 2.0;
			   shadow = (
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			   ) * ( 1.0 / 17.0 );
		   #elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			   vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			   float dx = texelSize.x;
			   float dy = texelSize.y;
			   vec2 uv = shadowCoord.xy;
			   vec2 f = fract( uv * shadowMapSize + 0.5 );
			   uv -= f * texelSize;
			   shadow = (
				   texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				   texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				   texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				   mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
						texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
						f.x ) +
				   mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
						texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
						f.x ) +
				   mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
						texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
						f.y ) +
				   mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
						texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
						f.y ) +
				   mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
							 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
							 f.x ),
						mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
							 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
							 f.x ),
						f.y )
			   ) * ( 1.0 / 9.0 );
		   #elif defined( SHADOWMAP_TYPE_VSM )
			   shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		   #else
			   shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		   #endif
		   }
		   return shadow;
	   }
	   vec2 cubeToUV( vec3 v, float texelSizeY ) {
		   vec3 absV = abs( v );
		   float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		   absV *= scaleToCube;
		   v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		   vec2 planar = v.xy;
		   float almostATexel = 1.5 * texelSizeY;
		   float almostOne = 1.0 - almostATexel;
		   if ( absV.z >= almostOne ) {
			   if ( v.z > 0.0 )
				   planar.x = 4.0 - v.x;
		   } else if ( absV.x >= almostOne ) {
			   float signX = sign( v.x );
			   planar.x = v.z * signX + 2.0 * signX;
		   } else if ( absV.y >= almostOne ) {
			   float signY = sign( v.y );
			   planar.x = v.x + 2.0 * signY + 2.0;
			   planar.y = v.z * signY - 2.0;
		   }
		   return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	   }
	   float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		   vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
		   vec3 lightToPosition = shadowCoord.xyz;
		   float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
		   vec3 bd3D = normalize( lightToPosition );
		   #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
			   vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
			   return (
				   texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
				   texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
				   texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
				   texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
				   texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
				   texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
				   texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
				   texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
				   texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
			   ) * ( 1.0 / 9.0 );
		   #else
			   return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
		   #endif
	   }
   #endif`,cN=`#if NUM_SPOT_LIGHT_COORDS > 0
	   uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	   varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
   #endif
   #ifdef USE_SHADOWMAP
	   #if NUM_DIR_LIGHT_SHADOWS > 0
		   uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		   varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		   struct DirectionalLightShadow {
			   float shadowBias;
			   float shadowNormalBias;
			   float shadowRadius;
			   vec2 shadowMapSize;
		   };
		   uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	   #endif
	   #if NUM_SPOT_LIGHT_SHADOWS > 0
		   struct SpotLightShadow {
			   float shadowBias;
			   float shadowNormalBias;
			   float shadowRadius;
			   vec2 shadowMapSize;
		   };
		   uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	   #endif
	   #if NUM_POINT_LIGHT_SHADOWS > 0
		   uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		   varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		   struct PointLightShadow {
			   float shadowBias;
			   float shadowNormalBias;
			   float shadowRadius;
			   vec2 shadowMapSize;
			   float shadowCameraNear;
			   float shadowCameraFar;
		   };
		   uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	   #endif
   #endif`,cO=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	   vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	   vec4 shadowWorldPosition;
   #endif
   #if defined( USE_SHADOWMAP )
	   #if NUM_DIR_LIGHT_SHADOWS > 0
		   #pragma unroll_loop_start
		   for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			   shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			   vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		   }
		   #pragma unroll_loop_end
	   #endif
	   #if NUM_POINT_LIGHT_SHADOWS > 0
		   #pragma unroll_loop_start
		   for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			   shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			   vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		   }
		   #pragma unroll_loop_end
	   #endif
   #endif
   #if NUM_SPOT_LIGHT_COORDS > 0
	   #pragma unroll_loop_start
	   for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		   shadowWorldPosition = worldPosition;
		   #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			   shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		   #endif
		   vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	   }
	   #pragma unroll_loop_end
   #endif`,cF=`float getShadowMask() {
	   float shadow = 1.0;
	   #ifdef USE_SHADOWMAP
	   #if NUM_DIR_LIGHT_SHADOWS > 0
	   DirectionalLightShadow directionalLight;
	   #pragma unroll_loop_start
	   for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		   directionalLight = directionalLightShadows[ i ];
		   shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	   }
	   #pragma unroll_loop_end
	   #endif
	   #if NUM_SPOT_LIGHT_SHADOWS > 0
	   SpotLightShadow spotLight;
	   #pragma unroll_loop_start
	   for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		   spotLight = spotLightShadows[ i ];
		   shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	   }
	   #pragma unroll_loop_end
	   #endif
	   #if NUM_POINT_LIGHT_SHADOWS > 0
	   PointLightShadow pointLight;
	   #pragma unroll_loop_start
	   for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		   pointLight = pointLightShadows[ i ];
		   shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	   }
	   #pragma unroll_loop_end
	   #endif
	   #endif
	   return shadow;
   }`,cB=`#ifdef USE_SKINNING
	   mat4 boneMatX = getBoneMatrix( skinIndex.x );
	   mat4 boneMatY = getBoneMatrix( skinIndex.y );
	   mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	   mat4 boneMatW = getBoneMatrix( skinIndex.w );
   #endif`,cz=`#ifdef USE_SKINNING
	   uniform mat4 bindMatrix;
	   uniform mat4 bindMatrixInverse;
	   uniform highp sampler2D boneTexture;
	   uniform int boneTextureSize;
	   mat4 getBoneMatrix( const in float i ) {
		   float j = i * 4.0;
		   float x = mod( j, float( boneTextureSize ) );
		   float y = floor( j / float( boneTextureSize ) );
		   float dx = 1.0 / float( boneTextureSize );
		   float dy = 1.0 / float( boneTextureSize );
		   y = dy * ( y + 0.5 );
		   vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
		   vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
		   vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
		   vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
		   mat4 bone = mat4( v1, v2, v3, v4 );
		   return bone;
	   }
   #endif`,c2=`#ifdef USE_SKINNING
	   vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	   vec4 skinned = vec4( 0.0 );
	   skinned += boneMatX * skinVertex * skinWeight.x;
	   skinned += boneMatY * skinVertex * skinWeight.y;
	   skinned += boneMatZ * skinVertex * skinWeight.z;
	   skinned += boneMatW * skinVertex * skinWeight.w;
	   transformed = ( bindMatrixInverse * skinned ).xyz;
   #endif`,ck=`#ifdef USE_SKINNING
	   mat4 skinMatrix = mat4( 0.0 );
	   skinMatrix += skinWeight.x * boneMatX;
	   skinMatrix += skinWeight.y * boneMatY;
	   skinMatrix += skinWeight.z * boneMatZ;
	   skinMatrix += skinWeight.w * boneMatW;
	   skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	   objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	   #ifdef USE_TANGENT
		   objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	   #endif
   #endif`,cH=`float specularStrength;
   #ifdef USE_SPECULARMAP
	   vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	   specularStrength = texelSpecular.r;
   #else
	   specularStrength = 1.0;
   #endif`,cV=`#ifdef USE_SPECULARMAP
	   uniform sampler2D specularMap;
   #endif`,c3=`#if defined( TONE_MAPPING )
	   gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
   #endif`,cG=`#ifndef saturate
   #define saturate( a ) clamp( a, 0.0, 1.0 )
   #endif
   uniform float toneMappingExposure;
   vec3 LinearToneMapping( vec3 color ) {
	   return saturate( toneMappingExposure * color );
   }
   vec3 ReinhardToneMapping( vec3 color ) {
	   color *= toneMappingExposure;
	   return saturate( color / ( vec3( 1.0 ) + color ) );
   }
   vec3 OptimizedCineonToneMapping( vec3 color ) {
	   color *= toneMappingExposure;
	   color = max( vec3( 0.0 ), color - 0.004 );
	   return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
   }
   vec3 RRTAndODTFit( vec3 v ) {
	   vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	   vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	   return a / b;
   }
   vec3 ACESFilmicToneMapping( vec3 color ) {
	   const mat3 ACESInputMat = mat3(
		   vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		   vec3( 0.04823, 0.01566, 0.83777 )
	   );
	   const mat3 ACESOutputMat = mat3(
		   vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		   vec3( -0.07367, -0.00605,  1.07602 )
	   );
	   color *= toneMappingExposure / 0.6;
	   color = ACESInputMat * color;
	   color = RRTAndODTFit( color );
	   color = ACESOutputMat * color;
	   return saturate( color );
   }
   vec3 CustomToneMapping( vec3 color ) { return color; }`,c4=`#ifdef USE_TRANSMISSION
	   material.transmission = transmission;
	   material.transmissionAlpha = 1.0;
	   material.thickness = thickness;
	   material.attenuationDistance = attenuationDistance;
	   material.attenuationColor = attenuationColor;
	   #ifdef USE_TRANSMISSIONMAP
		   material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	   #endif
	   #ifdef USE_THICKNESSMAP
		   material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	   #endif
	   vec3 pos = vWorldPosition;
	   vec3 v = normalize( cameraPosition - pos );
	   vec3 n = inverseTransformDirection( normal, viewMatrix );
	   vec4 transmitted = getIBLVolumeRefraction(
		   n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		   pos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,
		   material.attenuationColor, material.attenuationDistance );
	   material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	   totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
   #endif`,cW=`#ifdef USE_TRANSMISSION
	   uniform float transmission;
	   uniform float thickness;
	   uniform float attenuationDistance;
	   uniform vec3 attenuationColor;
	   #ifdef USE_TRANSMISSIONMAP
		   uniform sampler2D transmissionMap;
	   #endif
	   #ifdef USE_THICKNESSMAP
		   uniform sampler2D thicknessMap;
	   #endif
	   uniform vec2 transmissionSamplerSize;
	   uniform sampler2D transmissionSamplerMap;
	   uniform mat4 modelMatrix;
	   uniform mat4 projectionMatrix;
	   varying vec3 vWorldPosition;
	   float w0( float a ) {
		   return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	   }
	   float w1( float a ) {
		   return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	   }
	   float w2( float a ){
		   return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	   }
	   float w3( float a ) {
		   return ( 1.0 / 6.0 ) * ( a * a * a );
	   }
	   float g0( float a ) {
		   return w0( a ) + w1( a );
	   }
	   float g1( float a ) {
		   return w2( a ) + w3( a );
	   }
	   float h0( float a ) {
		   return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	   }
	   float h1( float a ) {
		   return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	   }
	   vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		   uv = uv * texelSize.zw + 0.5;
		   vec2 iuv = floor( uv );
		   vec2 fuv = fract( uv );
		   float g0x = g0( fuv.x );
		   float g1x = g1( fuv.x );
		   float h0x = h0( fuv.x );
		   float h1x = h1( fuv.x );
		   float h0y = h0( fuv.y );
		   float h1y = h1( fuv.y );
		   vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		   vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		   vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		   vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		   return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			   g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	   }
	   vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		   vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		   vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		   vec2 fLodSizeInv = 1.0 / fLodSize;
		   vec2 cLodSizeInv = 1.0 / cLodSize;
		   vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		   vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		   return mix( fSample, cSample, fract( lod ) );
	   }
	   vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		   vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		   vec3 modelScale;
		   modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		   modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		   modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		   return normalize( refractionVector ) * thickness * modelScale;
	   }
	   float applyIorToRoughness( const in float roughness, const in float ior ) {
		   return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	   }
	   vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		   float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		   return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	   }
	   vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		   if ( isinf( attenuationDistance ) ) {
			   return vec3( 1.0 );
		   } else {
			   vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			   vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		   }
	   }
	   vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		   const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		   const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,
		   const in vec3 attenuationColor, const in float attenuationDistance ) {
		   vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
		   vec3 refractedRayExit = position + transmissionRay;
		   vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
		   vec2 refractionCoords = ndcPos.xy / ndcPos.w;
		   refractionCoords += 1.0;
		   refractionCoords /= 2.0;
		   vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
		   vec3 transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		   vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		   vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		   float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		   return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	   }
   #endif`,c6=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	   varying vec2 vUv;
   #endif
   #ifdef USE_MAP
	   varying vec2 vMapUv;
   #endif
   #ifdef USE_ALPHAMAP
	   varying vec2 vAlphaMapUv;
   #endif
   #ifdef USE_LIGHTMAP
	   varying vec2 vLightMapUv;
   #endif
   #ifdef USE_AOMAP
	   varying vec2 vAoMapUv;
   #endif
   #ifdef USE_BUMPMAP
	   varying vec2 vBumpMapUv;
   #endif
   #ifdef USE_NORMALMAP
	   varying vec2 vNormalMapUv;
   #endif
   #ifdef USE_EMISSIVEMAP
	   varying vec2 vEmissiveMapUv;
   #endif
   #ifdef USE_METALNESSMAP
	   varying vec2 vMetalnessMapUv;
   #endif
   #ifdef USE_ROUGHNESSMAP
	   varying vec2 vRoughnessMapUv;
   #endif
   #ifdef USE_ANISOTROPYMAP
	   varying vec2 vAnisotropyMapUv;
   #endif
   #ifdef USE_CLEARCOATMAP
	   varying vec2 vClearcoatMapUv;
   #endif
   #ifdef USE_CLEARCOAT_NORMALMAP
	   varying vec2 vClearcoatNormalMapUv;
   #endif
   #ifdef USE_CLEARCOAT_ROUGHNESSMAP
	   varying vec2 vClearcoatRoughnessMapUv;
   #endif
   #ifdef USE_IRIDESCENCEMAP
	   varying vec2 vIridescenceMapUv;
   #endif
   #ifdef USE_IRIDESCENCE_THICKNESSMAP
	   varying vec2 vIridescenceThicknessMapUv;
   #endif
   #ifdef USE_SHEEN_COLORMAP
	   varying vec2 vSheenColorMapUv;
   #endif
   #ifdef USE_SHEEN_ROUGHNESSMAP
	   varying vec2 vSheenRoughnessMapUv;
   #endif
   #ifdef USE_SPECULARMAP
	   varying vec2 vSpecularMapUv;
   #endif
   #ifdef USE_SPECULAR_COLORMAP
	   varying vec2 vSpecularColorMapUv;
   #endif
   #ifdef USE_SPECULAR_INTENSITYMAP
	   varying vec2 vSpecularIntensityMapUv;
   #endif
   #ifdef USE_TRANSMISSIONMAP
	   uniform mat3 transmissionMapTransform;
	   varying vec2 vTransmissionMapUv;
   #endif
   #ifdef USE_THICKNESSMAP
	   uniform mat3 thicknessMapTransform;
	   varying vec2 vThicknessMapUv;
   #endif`,c5=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	   varying vec2 vUv;
   #endif
   #ifdef USE_MAP
	   uniform mat3 mapTransform;
	   varying vec2 vMapUv;
   #endif
   #ifdef USE_ALPHAMAP
	   uniform mat3 alphaMapTransform;
	   varying vec2 vAlphaMapUv;
   #endif
   #ifdef USE_LIGHTMAP
	   uniform mat3 lightMapTransform;
	   varying vec2 vLightMapUv;
   #endif
   #ifdef USE_AOMAP
	   uniform mat3 aoMapTransform;
	   varying vec2 vAoMapUv;
   #endif
   #ifdef USE_BUMPMAP
	   uniform mat3 bumpMapTransform;
	   varying vec2 vBumpMapUv;
   #endif
   #ifdef USE_NORMALMAP
	   uniform mat3 normalMapTransform;
	   varying vec2 vNormalMapUv;
   #endif
   #ifdef USE_DISPLACEMENTMAP
	   uniform mat3 displacementMapTransform;
	   varying vec2 vDisplacementMapUv;
   #endif
   #ifdef USE_EMISSIVEMAP
	   uniform mat3 emissiveMapTransform;
	   varying vec2 vEmissiveMapUv;
   #endif
   #ifdef USE_METALNESSMAP
	   uniform mat3 metalnessMapTransform;
	   varying vec2 vMetalnessMapUv;
   #endif
   #ifdef USE_ROUGHNESSMAP
	   uniform mat3 roughnessMapTransform;
	   varying vec2 vRoughnessMapUv;
   #endif
   #ifdef USE_ANISOTROPYMAP
	   uniform mat3 anisotropyMapTransform;
	   varying vec2 vAnisotropyMapUv;
   #endif
   #ifdef USE_CLEARCOATMAP
	   uniform mat3 clearcoatMapTransform;
	   varying vec2 vClearcoatMapUv;
   #endif
   #ifdef USE_CLEARCOAT_NORMALMAP
	   uniform mat3 clearcoatNormalMapTransform;
	   varying vec2 vClearcoatNormalMapUv;
   #endif
   #ifdef USE_CLEARCOAT_ROUGHNESSMAP
	   uniform mat3 clearcoatRoughnessMapTransform;
	   varying vec2 vClearcoatRoughnessMapUv;
   #endif
   #ifdef USE_SHEEN_COLORMAP
	   uniform mat3 sheenColorMapTransform;
	   varying vec2 vSheenColorMapUv;
   #endif
   #ifdef USE_SHEEN_ROUGHNESSMAP
	   uniform mat3 sheenRoughnessMapTransform;
	   varying vec2 vSheenRoughnessMapUv;
   #endif
   #ifdef USE_IRIDESCENCEMAP
	   uniform mat3 iridescenceMapTransform;
	   varying vec2 vIridescenceMapUv;
   #endif
   #ifdef USE_IRIDESCENCE_THICKNESSMAP
	   uniform mat3 iridescenceThicknessMapTransform;
	   varying vec2 vIridescenceThicknessMapUv;
   #endif
   #ifdef USE_SPECULARMAP
	   uniform mat3 specularMapTransform;
	   varying vec2 vSpecularMapUv;
   #endif
   #ifdef USE_SPECULAR_COLORMAP
	   uniform mat3 specularColorMapTransform;
	   varying vec2 vSpecularColorMapUv;
   #endif
   #ifdef USE_SPECULAR_INTENSITYMAP
	   uniform mat3 specularIntensityMapTransform;
	   varying vec2 vSpecularIntensityMapUv;
   #endif
   #ifdef USE_TRANSMISSIONMAP
	   uniform mat3 transmissionMapTransform;
	   varying vec2 vTransmissionMapUv;
   #endif
   #ifdef USE_THICKNESSMAP
	   uniform mat3 thicknessMapTransform;
	   varying vec2 vThicknessMapUv;
   #endif`,c7=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	   vUv = vec3( uv, 1 ).xy;
   #endif
   #ifdef USE_MAP
	   vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_ALPHAMAP
	   vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_LIGHTMAP
	   vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_AOMAP
	   vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_BUMPMAP
	   vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_NORMALMAP
	   vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_DISPLACEMENTMAP
	   vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_EMISSIVEMAP
	   vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_METALNESSMAP
	   vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_ROUGHNESSMAP
	   vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_ANISOTROPYMAP
	   vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_CLEARCOATMAP
	   vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_CLEARCOAT_NORMALMAP
	   vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_CLEARCOAT_ROUGHNESSMAP
	   vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_IRIDESCENCEMAP
	   vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_IRIDESCENCE_THICKNESSMAP
	   vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_SHEEN_COLORMAP
	   vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_SHEEN_ROUGHNESSMAP
	   vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_SPECULARMAP
	   vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_SPECULAR_COLORMAP
	   vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_SPECULAR_INTENSITYMAP
	   vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_TRANSMISSIONMAP
	   vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
   #endif
   #ifdef USE_THICKNESSMAP
	   vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
   #endif`,cX=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	   vec4 worldPosition = vec4( transformed, 1.0 );
	   #ifdef USE_INSTANCING
		   worldPosition = instanceMatrix * worldPosition;
	   #endif
	   worldPosition = modelMatrix * worldPosition;
   #endif`;let cq=`varying vec2 vUv;
   uniform mat3 uvTransform;
   void main() {
	   vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	   gl_Position = vec4( position.xy, 1.0, 1.0 );
   }`,cY=`uniform sampler2D t2D;
   uniform float backgroundIntensity;
   varying vec2 vUv;
   void main() {
	   vec4 texColor = texture2D( t2D, vUv );
	   #ifdef DECODE_VIDEO_TEXTURE
		   texColor = 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 );
	   #endif
	   texColor.rgb *= backgroundIntensity;
	   gl_FragColor = texColor;
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
   }`,cj=`varying vec3 vWorldDirection;
   #include <common>
   void main() {
	   vWorldDirection = transformDirection( position, modelMatrix );
	   #include <begin_vertex>
	   #include <project_vertex>
	   gl_Position.z = gl_Position.w;
   }`,cZ=`#ifdef ENVMAP_TYPE_CUBE
	   uniform samplerCube envMap;
   #elif defined( ENVMAP_TYPE_CUBE_UV )
	   uniform sampler2D envMap;
   #endif
   uniform float flipEnvMap;
   uniform float backgroundBlurriness;
   uniform float backgroundIntensity;
   varying vec3 vWorldDirection;
   #include <cube_uv_reflection_fragment>
   void main() {
	   #ifdef ENVMAP_TYPE_CUBE
		   vec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	   #elif defined( ENVMAP_TYPE_CUBE_UV )
		   vec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );
	   #else
		   vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	   #endif
	   texColor.rgb *= backgroundIntensity;
	   gl_FragColor = texColor;
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
   }`,cK=`varying vec3 vWorldDirection;
   #include <common>
   void main() {
	   vWorldDirection = transformDirection( position, modelMatrix );
	   #include <begin_vertex>
	   #include <project_vertex>
	   gl_Position.z = gl_Position.w;
   }`,cJ=`uniform samplerCube tCube;
   uniform float tFlip;
   uniform float opacity;
   varying vec3 vWorldDirection;
   void main() {
	   vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	   gl_FragColor = texColor;
	   gl_FragColor.a *= opacity;
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
   }`,cQ=`#include <common>
   #include <uv_pars_vertex>
   #include <displacementmap_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <skinning_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   varying vec2 vHighPrecisionZW;
   void main() {
	   #include <uv_vertex>
	   #include <skinbase_vertex>
	   #ifdef USE_DISPLACEMENTMAP
		   #include <beginnormal_vertex>
		   #include <morphnormal_vertex>
		   #include <skinnormal_vertex>
	   #endif
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <skinning_vertex>
	   #include <displacementmap_vertex>
	   #include <project_vertex>
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
	   vHighPrecisionZW = gl_Position.zw;
   }`,c9=`#if DEPTH_PACKING == 3200
	   uniform float opacity;
   #endif
   #include <common>
   #include <packing>
   #include <uv_pars_fragment>
   #include <map_pars_fragment>
   #include <alphamap_pars_fragment>
   #include <alphatest_pars_fragment>
   #include <alphahash_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   varying vec2 vHighPrecisionZW;
   void main() {
	   #include <clipping_planes_fragment>
	   vec4 diffuseColor = vec4( 1.0 );
	   #if DEPTH_PACKING == 3200
		   diffuseColor.a = opacity;
	   #endif
	   #include <map_fragment>
	   #include <alphamap_fragment>
	   #include <alphatest_fragment>
	   #include <alphahash_fragment>
	   #include <logdepthbuf_fragment>
	   float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
	   #if DEPTH_PACKING == 3200
		   gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	   #elif DEPTH_PACKING == 3201
		   gl_FragColor = packDepthToRGBA( fragCoordZ );
	   #endif
   }`,he=`#define DISTANCE
   varying vec3 vWorldPosition;
   #include <common>
   #include <uv_pars_vertex>
   #include <displacementmap_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <skinning_pars_vertex>
   #include <clipping_planes_pars_vertex>
   void main() {
	   #include <uv_vertex>
	   #include <skinbase_vertex>
	   #ifdef USE_DISPLACEMENTMAP
		   #include <beginnormal_vertex>
		   #include <morphnormal_vertex>
		   #include <skinnormal_vertex>
	   #endif
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <skinning_vertex>
	   #include <displacementmap_vertex>
	   #include <project_vertex>
	   #include <worldpos_vertex>
	   #include <clipping_planes_vertex>
	   vWorldPosition = worldPosition.xyz;
   }`,ht=`#define DISTANCE
   uniform vec3 referencePosition;
   uniform float nearDistance;
   uniform float farDistance;
   varying vec3 vWorldPosition;
   #include <common>
   #include <packing>
   #include <uv_pars_fragment>
   #include <map_pars_fragment>
   #include <alphamap_pars_fragment>
   #include <alphatest_pars_fragment>
   #include <alphahash_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main () {
	   #include <clipping_planes_fragment>
	   vec4 diffuseColor = vec4( 1.0 );
	   #include <map_fragment>
	   #include <alphamap_fragment>
	   #include <alphatest_fragment>
	   #include <alphahash_fragment>
	   float dist = length( vWorldPosition - referencePosition );
	   dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	   dist = saturate( dist );
	   gl_FragColor = packDepthToRGBA( dist );
   }`,hi=`varying vec3 vWorldDirection;
   #include <common>
   void main() {
	   vWorldDirection = transformDirection( position, modelMatrix );
	   #include <begin_vertex>
	   #include <project_vertex>
   }`,hr=`uniform sampler2D tEquirect;
   varying vec3 vWorldDirection;
   #include <common>
   void main() {
	   vec3 direction = normalize( vWorldDirection );
	   vec2 sampleUV = equirectUv( direction );
	   gl_FragColor = texture2D( tEquirect, sampleUV );
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
   }`,hn=`uniform float scale;
   attribute float lineDistance;
   varying float vLineDistance;
   #include <common>
   #include <uv_pars_vertex>
   #include <color_pars_vertex>
   #include <fog_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   void main() {
	   vLineDistance = scale * lineDistance;
	   #include <uv_vertex>
	   #include <color_vertex>
	   #include <morphcolor_vertex>
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <project_vertex>
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
	   #include <fog_vertex>
   }`,ha=`uniform vec3 diffuse;
   uniform float opacity;
   uniform float dashSize;
   uniform float totalSize;
   varying float vLineDistance;
   #include <common>
   #include <color_pars_fragment>
   #include <uv_pars_fragment>
   #include <map_pars_fragment>
   #include <fog_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main() {
	   #include <clipping_planes_fragment>
	   if ( mod( vLineDistance, totalSize ) > dashSize ) {
		   discard;
	   }
	   vec3 outgoingLight = vec3( 0.0 );
	   vec4 diffuseColor = vec4( diffuse, opacity );
	   #include <logdepthbuf_fragment>
	   #include <map_fragment>
	   #include <color_fragment>
	   outgoingLight = diffuseColor.rgb;
	   #include <opaque_fragment>
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
	   #include <fog_fragment>
	   #include <premultiplied_alpha_fragment>
   }`,ho=`#include <common>
   #include <uv_pars_vertex>
   #include <envmap_pars_vertex>
   #include <color_pars_vertex>
   #include <fog_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <skinning_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   void main() {
	   #include <uv_vertex>
	   #include <color_vertex>
	   #include <morphcolor_vertex>
	   #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		   #include <beginnormal_vertex>
		   #include <morphnormal_vertex>
		   #include <skinbase_vertex>
		   #include <skinnormal_vertex>
		   #include <defaultnormal_vertex>
	   #endif
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <skinning_vertex>
	   #include <project_vertex>
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
	   #include <worldpos_vertex>
	   #include <envmap_vertex>
	   #include <fog_vertex>
   }`,hs=`uniform vec3 diffuse;
   uniform float opacity;
   #ifndef FLAT_SHADED
	   varying vec3 vNormal;
   #endif
   #include <common>
   #include <dithering_pars_fragment>
   #include <color_pars_fragment>
   #include <uv_pars_fragment>
   #include <map_pars_fragment>
   #include <alphamap_pars_fragment>
   #include <alphatest_pars_fragment>
   #include <alphahash_pars_fragment>
   #include <aomap_pars_fragment>
   #include <lightmap_pars_fragment>
   #include <envmap_common_pars_fragment>
   #include <envmap_pars_fragment>
   #include <fog_pars_fragment>
   #include <specularmap_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main() {
	   #include <clipping_planes_fragment>
	   vec4 diffuseColor = vec4( diffuse, opacity );
	   #include <logdepthbuf_fragment>
	   #include <map_fragment>
	   #include <color_fragment>
	   #include <alphamap_fragment>
	   #include <alphatest_fragment>
	   #include <alphahash_fragment>
	   #include <specularmap_fragment>
	   ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	   #ifdef USE_LIGHTMAP
		   vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		   reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	   #else
		   reflectedLight.indirectDiffuse += vec3( 1.0 );
	   #endif
	   #include <aomap_fragment>
	   reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	   vec3 outgoingLight = reflectedLight.indirectDiffuse;
	   #include <envmap_fragment>
	   #include <opaque_fragment>
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
	   #include <fog_fragment>
	   #include <premultiplied_alpha_fragment>
	   #include <dithering_fragment>
   }`,hl=`#define LAMBERT
   varying vec3 vViewPosition;
   #include <common>
   #include <uv_pars_vertex>
   #include <displacementmap_pars_vertex>
   #include <envmap_pars_vertex>
   #include <color_pars_vertex>
   #include <fog_pars_vertex>
   #include <normal_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <skinning_pars_vertex>
   #include <shadowmap_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   void main() {
	   #include <uv_vertex>
	   #include <color_vertex>
	   #include <morphcolor_vertex>
	   #include <beginnormal_vertex>
	   #include <morphnormal_vertex>
	   #include <skinbase_vertex>
	   #include <skinnormal_vertex>
	   #include <defaultnormal_vertex>
	   #include <normal_vertex>
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <skinning_vertex>
	   #include <displacementmap_vertex>
	   #include <project_vertex>
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
	   vViewPosition = - mvPosition.xyz;
	   #include <worldpos_vertex>
	   #include <envmap_vertex>
	   #include <shadowmap_vertex>
	   #include <fog_vertex>
   }`,hu=`#define LAMBERT
   uniform vec3 diffuse;
   uniform vec3 emissive;
   uniform float opacity;
   #include <common>
   #include <packing>
   #include <dithering_pars_fragment>
   #include <color_pars_fragment>
   #include <uv_pars_fragment>
   #include <map_pars_fragment>
   #include <alphamap_pars_fragment>
   #include <alphatest_pars_fragment>
   #include <alphahash_pars_fragment>
   #include <aomap_pars_fragment>
   #include <lightmap_pars_fragment>
   #include <emissivemap_pars_fragment>
   #include <envmap_common_pars_fragment>
   #include <envmap_pars_fragment>
   #include <fog_pars_fragment>
   #include <bsdfs>
   #include <lights_pars_begin>
   #include <normal_pars_fragment>
   #include <lights_lambert_pars_fragment>
   #include <shadowmap_pars_fragment>
   #include <bumpmap_pars_fragment>
   #include <normalmap_pars_fragment>
   #include <specularmap_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main() {
	   #include <clipping_planes_fragment>
	   vec4 diffuseColor = vec4( diffuse, opacity );
	   ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	   vec3 totalEmissiveRadiance = emissive;
	   #include <logdepthbuf_fragment>
	   #include <map_fragment>
	   #include <color_fragment>
	   #include <alphamap_fragment>
	   #include <alphatest_fragment>
	   #include <alphahash_fragment>
	   #include <specularmap_fragment>
	   #include <normal_fragment_begin>
	   #include <normal_fragment_maps>
	   #include <emissivemap_fragment>
	   #include <lights_lambert_fragment>
	   #include <lights_fragment_begin>
	   #include <lights_fragment_maps>
	   #include <lights_fragment_end>
	   #include <aomap_fragment>
	   vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	   #include <envmap_fragment>
	   #include <opaque_fragment>
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
	   #include <fog_fragment>
	   #include <premultiplied_alpha_fragment>
	   #include <dithering_fragment>
   }`,hc=`#define MATCAP
   varying vec3 vViewPosition;
   #include <common>
   #include <uv_pars_vertex>
   #include <color_pars_vertex>
   #include <displacementmap_pars_vertex>
   #include <fog_pars_vertex>
   #include <normal_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <skinning_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   void main() {
	   #include <uv_vertex>
	   #include <color_vertex>
	   #include <morphcolor_vertex>
	   #include <beginnormal_vertex>
	   #include <morphnormal_vertex>
	   #include <skinbase_vertex>
	   #include <skinnormal_vertex>
	   #include <defaultnormal_vertex>
	   #include <normal_vertex>
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <skinning_vertex>
	   #include <displacementmap_vertex>
	   #include <project_vertex>
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
	   #include <fog_vertex>
	   vViewPosition = - mvPosition.xyz;
   }`,hh=`#define MATCAP
   uniform vec3 diffuse;
   uniform float opacity;
   uniform sampler2D matcap;
   varying vec3 vViewPosition;
   #include <common>
   #include <dithering_pars_fragment>
   #include <color_pars_fragment>
   #include <uv_pars_fragment>
   #include <map_pars_fragment>
   #include <alphamap_pars_fragment>
   #include <alphatest_pars_fragment>
   #include <alphahash_pars_fragment>
   #include <fog_pars_fragment>
   #include <normal_pars_fragment>
   #include <bumpmap_pars_fragment>
   #include <normalmap_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main() {
	   #include <clipping_planes_fragment>
	   vec4 diffuseColor = vec4( diffuse, opacity );
	   #include <logdepthbuf_fragment>
	   #include <map_fragment>
	   #include <color_fragment>
	   #include <alphamap_fragment>
	   #include <alphatest_fragment>
	   #include <alphahash_fragment>
	   #include <normal_fragment_begin>
	   #include <normal_fragment_maps>
	   vec3 viewDir = normalize( vViewPosition );
	   vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	   vec3 y = cross( viewDir, x );
	   vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	   #ifdef USE_MATCAP
		   vec4 matcapColor = texture2D( matcap, uv );
	   #else
		   vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	   #endif
	   vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	   #include <opaque_fragment>
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
	   #include <fog_fragment>
	   #include <premultiplied_alpha_fragment>
	   #include <dithering_fragment>
   }`,hd=`#define NORMAL
   #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	   varying vec3 vViewPosition;
   #endif
   #include <common>
   #include <uv_pars_vertex>
   #include <displacementmap_pars_vertex>
   #include <normal_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <skinning_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   void main() {
	   #include <uv_vertex>
	   #include <beginnormal_vertex>
	   #include <morphnormal_vertex>
	   #include <skinbase_vertex>
	   #include <skinnormal_vertex>
	   #include <defaultnormal_vertex>
	   #include <normal_vertex>
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <skinning_vertex>
	   #include <displacementmap_vertex>
	   #include <project_vertex>
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
   #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	   vViewPosition = - mvPosition.xyz;
   #endif
   }`,hp=`#define NORMAL
   uniform float opacity;
   #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	   varying vec3 vViewPosition;
   #endif
   #include <packing>
   #include <uv_pars_fragment>
   #include <normal_pars_fragment>
   #include <bumpmap_pars_fragment>
   #include <normalmap_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main() {
	   #include <clipping_planes_fragment>
	   #include <logdepthbuf_fragment>
	   #include <normal_fragment_begin>
	   #include <normal_fragment_maps>
	   gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
	   #ifdef OPAQUE
		   gl_FragColor.a = 1.0;
	   #endif
   }`,hf=`#define PHONG
   varying vec3 vViewPosition;
   #include <common>
   #include <uv_pars_vertex>
   #include <displacementmap_pars_vertex>
   #include <envmap_pars_vertex>
   #include <color_pars_vertex>
   #include <fog_pars_vertex>
   #include <normal_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <skinning_pars_vertex>
   #include <shadowmap_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   void main() {
	   #include <uv_vertex>
	   #include <color_vertex>
	   #include <morphcolor_vertex>
	   #include <beginnormal_vertex>
	   #include <morphnormal_vertex>
	   #include <skinbase_vertex>
	   #include <skinnormal_vertex>
	   #include <defaultnormal_vertex>
	   #include <normal_vertex>
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <skinning_vertex>
	   #include <displacementmap_vertex>
	   #include <project_vertex>
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
	   vViewPosition = - mvPosition.xyz;
	   #include <worldpos_vertex>
	   #include <envmap_vertex>
	   #include <shadowmap_vertex>
	   #include <fog_vertex>
   }`,hm=`#define PHONG
   uniform vec3 diffuse;
   uniform vec3 emissive;
   uniform vec3 specular;
   uniform float shininess;
   uniform float opacity;
   #include <common>
   #include <packing>
   #include <dithering_pars_fragment>
   #include <color_pars_fragment>
   #include <uv_pars_fragment>
   #include <map_pars_fragment>
   #include <alphamap_pars_fragment>
   #include <alphatest_pars_fragment>
   #include <alphahash_pars_fragment>
   #include <aomap_pars_fragment>
   #include <lightmap_pars_fragment>
   #include <emissivemap_pars_fragment>
   #include <envmap_common_pars_fragment>
   #include <envmap_pars_fragment>
   #include <fog_pars_fragment>
   #include <bsdfs>
   #include <lights_pars_begin>
   #include <normal_pars_fragment>
   #include <lights_phong_pars_fragment>
   #include <shadowmap_pars_fragment>
   #include <bumpmap_pars_fragment>
   #include <normalmap_pars_fragment>
   #include <specularmap_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main() {
	   #include <clipping_planes_fragment>
	   vec4 diffuseColor = vec4( diffuse, opacity );
	   ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	   vec3 totalEmissiveRadiance = emissive;
	   #include <logdepthbuf_fragment>
	   #include <map_fragment>
	   #include <color_fragment>
	   #include <alphamap_fragment>
	   #include <alphatest_fragment>
	   #include <alphahash_fragment>
	   #include <specularmap_fragment>
	   #include <normal_fragment_begin>
	   #include <normal_fragment_maps>
	   #include <emissivemap_fragment>
	   #include <lights_phong_fragment>
	   #include <lights_fragment_begin>
	   #include <lights_fragment_maps>
	   #include <lights_fragment_end>
	   #include <aomap_fragment>
	   vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	   #include <envmap_fragment>
	   #include <opaque_fragment>
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
	   #include <fog_fragment>
	   #include <premultiplied_alpha_fragment>
	   #include <dithering_fragment>
   }`,hg=`#define STANDARD
   varying vec3 vViewPosition;
   #ifdef USE_TRANSMISSION
	   varying vec3 vWorldPosition;
   #endif
   #include <common>
   #include <uv_pars_vertex>
   #include <displacementmap_pars_vertex>
   #include <color_pars_vertex>
   #include <fog_pars_vertex>
   #include <normal_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <skinning_pars_vertex>
   #include <shadowmap_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   void main() {
	   #include <uv_vertex>
	   #include <color_vertex>
	   #include <morphcolor_vertex>
	   #include <beginnormal_vertex>
	   #include <morphnormal_vertex>
	   #include <skinbase_vertex>
	   #include <skinnormal_vertex>
	   #include <defaultnormal_vertex>
	   #include <normal_vertex>
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <skinning_vertex>
	   #include <displacementmap_vertex>
	   #include <project_vertex>
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
	   vViewPosition = - mvPosition.xyz;
	   #include <worldpos_vertex>
	   #include <shadowmap_vertex>
	   #include <fog_vertex>
   #ifdef USE_TRANSMISSION
	   vWorldPosition = worldPosition.xyz;
   #endif
   }`,h8=`#define STANDARD
   #ifdef PHYSICAL
	   #define IOR
	   #define USE_SPECULAR
   #endif
   uniform vec3 diffuse;
   uniform vec3 emissive;
   uniform float roughness;
   uniform float metalness;
   uniform float opacity;
   #ifdef IOR
	   uniform float ior;
   #endif
   #ifdef USE_SPECULAR
	   uniform float specularIntensity;
	   uniform vec3 specularColor;
	   #ifdef USE_SPECULAR_COLORMAP
		   uniform sampler2D specularColorMap;
	   #endif
	   #ifdef USE_SPECULAR_INTENSITYMAP
		   uniform sampler2D specularIntensityMap;
	   #endif
   #endif
   #ifdef USE_CLEARCOAT
	   uniform float clearcoat;
	   uniform float clearcoatRoughness;
   #endif
   #ifdef USE_IRIDESCENCE
	   uniform float iridescence;
	   uniform float iridescenceIOR;
	   uniform float iridescenceThicknessMinimum;
	   uniform float iridescenceThicknessMaximum;
   #endif
   #ifdef USE_SHEEN
	   uniform vec3 sheenColor;
	   uniform float sheenRoughness;
	   #ifdef USE_SHEEN_COLORMAP
		   uniform sampler2D sheenColorMap;
	   #endif
	   #ifdef USE_SHEEN_ROUGHNESSMAP
		   uniform sampler2D sheenRoughnessMap;
	   #endif
   #endif
   #ifdef USE_ANISOTROPY
	   uniform vec2 anisotropyVector;
	   #ifdef USE_ANISOTROPYMAP
		   uniform sampler2D anisotropyMap;
	   #endif
   #endif
   varying vec3 vViewPosition;
   #include <common>
   #include <packing>
   #include <dithering_pars_fragment>
   #include <color_pars_fragment>
   #include <uv_pars_fragment>
   #include <map_pars_fragment>
   #include <alphamap_pars_fragment>
   #include <alphatest_pars_fragment>
   #include <alphahash_pars_fragment>
   #include <aomap_pars_fragment>
   #include <lightmap_pars_fragment>
   #include <emissivemap_pars_fragment>
   #include <iridescence_fragment>
   #include <cube_uv_reflection_fragment>
   #include <envmap_common_pars_fragment>
   #include <envmap_physical_pars_fragment>
   #include <fog_pars_fragment>
   #include <lights_pars_begin>
   #include <normal_pars_fragment>
   #include <lights_physical_pars_fragment>
   #include <transmission_pars_fragment>
   #include <shadowmap_pars_fragment>
   #include <bumpmap_pars_fragment>
   #include <normalmap_pars_fragment>
   #include <clearcoat_pars_fragment>
   #include <iridescence_pars_fragment>
   #include <roughnessmap_pars_fragment>
   #include <metalnessmap_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main() {
	   #include <clipping_planes_fragment>
	   vec4 diffuseColor = vec4( diffuse, opacity );
	   ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	   vec3 totalEmissiveRadiance = emissive;
	   #include <logdepthbuf_fragment>
	   #include <map_fragment>
	   #include <color_fragment>
	   #include <alphamap_fragment>
	   #include <alphatest_fragment>
	   #include <alphahash_fragment>
	   #include <roughnessmap_fragment>
	   #include <metalnessmap_fragment>
	   #include <normal_fragment_begin>
	   #include <normal_fragment_maps>
	   #include <clearcoat_normal_fragment_begin>
	   #include <clearcoat_normal_fragment_maps>
	   #include <emissivemap_fragment>
	   #include <lights_physical_fragment>
	   #include <lights_fragment_begin>
	   #include <lights_fragment_maps>
	   #include <lights_fragment_end>
	   #include <aomap_fragment>
	   vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	   vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	   #include <transmission_fragment>
	   vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	   #ifdef USE_SHEEN
		   float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		   outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
	   #endif
	   #ifdef USE_CLEARCOAT
		   float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		   vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		   outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	   #endif
	   #include <opaque_fragment>
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
	   #include <fog_fragment>
	   #include <premultiplied_alpha_fragment>
	   #include <dithering_fragment>
   }`,h$=`#define TOON
   varying vec3 vViewPosition;
   #include <common>
   #include <uv_pars_vertex>
   #include <displacementmap_pars_vertex>
   #include <color_pars_vertex>
   #include <fog_pars_vertex>
   #include <normal_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <skinning_pars_vertex>
   #include <shadowmap_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   void main() {
	   #include <uv_vertex>
	   #include <color_vertex>
	   #include <morphcolor_vertex>
	   #include <beginnormal_vertex>
	   #include <morphnormal_vertex>
	   #include <skinbase_vertex>
	   #include <skinnormal_vertex>
	   #include <defaultnormal_vertex>
	   #include <normal_vertex>
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <skinning_vertex>
	   #include <displacementmap_vertex>
	   #include <project_vertex>
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
	   vViewPosition = - mvPosition.xyz;
	   #include <worldpos_vertex>
	   #include <shadowmap_vertex>
	   #include <fog_vertex>
   }`,hv=`#define TOON
   uniform vec3 diffuse;
   uniform vec3 emissive;
   uniform float opacity;
   #include <common>
   #include <packing>
   #include <dithering_pars_fragment>
   #include <color_pars_fragment>
   #include <uv_pars_fragment>
   #include <map_pars_fragment>
   #include <alphamap_pars_fragment>
   #include <alphatest_pars_fragment>
   #include <alphahash_pars_fragment>
   #include <aomap_pars_fragment>
   #include <lightmap_pars_fragment>
   #include <emissivemap_pars_fragment>
   #include <gradientmap_pars_fragment>
   #include <fog_pars_fragment>
   #include <bsdfs>
   #include <lights_pars_begin>
   #include <normal_pars_fragment>
   #include <lights_toon_pars_fragment>
   #include <shadowmap_pars_fragment>
   #include <bumpmap_pars_fragment>
   #include <normalmap_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main() {
	   #include <clipping_planes_fragment>
	   vec4 diffuseColor = vec4( diffuse, opacity );
	   ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	   vec3 totalEmissiveRadiance = emissive;
	   #include <logdepthbuf_fragment>
	   #include <map_fragment>
	   #include <color_fragment>
	   #include <alphamap_fragment>
	   #include <alphatest_fragment>
	   #include <alphahash_fragment>
	   #include <normal_fragment_begin>
	   #include <normal_fragment_maps>
	   #include <emissivemap_fragment>
	   #include <lights_toon_fragment>
	   #include <lights_fragment_begin>
	   #include <lights_fragment_maps>
	   #include <lights_fragment_end>
	   #include <aomap_fragment>
	   vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	   #include <opaque_fragment>
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
	   #include <fog_fragment>
	   #include <premultiplied_alpha_fragment>
	   #include <dithering_fragment>
   }`,hx=`uniform float size;
   uniform float scale;
   #include <common>
   #include <color_pars_vertex>
   #include <fog_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   #ifdef USE_POINTS_UV
	   varying vec2 vUv;
	   uniform mat3 uvTransform;
   #endif
   void main() {
	   #ifdef USE_POINTS_UV
		   vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	   #endif
	   #include <color_vertex>
	   #include <morphcolor_vertex>
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <project_vertex>
	   gl_PointSize = size;
	   #ifdef USE_SIZEATTENUATION
		   bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		   if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	   #endif
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
	   #include <worldpos_vertex>
	   #include <fog_vertex>
   }`,hy=`uniform vec3 diffuse;
   uniform float opacity;
   #include <common>
   #include <color_pars_fragment>
   #include <map_particle_pars_fragment>
   #include <alphatest_pars_fragment>
   #include <alphahash_pars_fragment>
   #include <fog_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main() {
	   #include <clipping_planes_fragment>
	   vec3 outgoingLight = vec3( 0.0 );
	   vec4 diffuseColor = vec4( diffuse, opacity );
	   #include <logdepthbuf_fragment>
	   #include <map_particle_fragment>
	   #include <color_fragment>
	   #include <alphatest_fragment>
	   #include <alphahash_fragment>
	   outgoingLight = diffuseColor.rgb;
	   #include <opaque_fragment>
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
	   #include <fog_fragment>
	   #include <premultiplied_alpha_fragment>
   }`,hS=`#include <common>
   #include <fog_pars_vertex>
   #include <morphtarget_pars_vertex>
   #include <skinning_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <shadowmap_pars_vertex>
   void main() {
	   #include <beginnormal_vertex>
	   #include <morphnormal_vertex>
	   #include <skinbase_vertex>
	   #include <skinnormal_vertex>
	   #include <defaultnormal_vertex>
	   #include <begin_vertex>
	   #include <morphtarget_vertex>
	   #include <skinning_vertex>
	   #include <project_vertex>
	   #include <logdepthbuf_vertex>
	   #include <worldpos_vertex>
	   #include <shadowmap_vertex>
	   #include <fog_vertex>
   }`,hE=`uniform vec3 color;
   uniform float opacity;
   #include <common>
   #include <packing>
   #include <fog_pars_fragment>
   #include <bsdfs>
   #include <lights_pars_begin>
   #include <logdepthbuf_pars_fragment>
   #include <shadowmap_pars_fragment>
   #include <shadowmask_pars_fragment>
   void main() {
	   #include <logdepthbuf_fragment>
	   gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
	   #include <fog_fragment>
   }`,hb=`uniform float rotation;
   uniform vec2 center;
   #include <common>
   #include <uv_pars_vertex>
   #include <fog_pars_vertex>
   #include <logdepthbuf_pars_vertex>
   #include <clipping_planes_pars_vertex>
   void main() {
	   #include <uv_vertex>
	   vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
	   vec2 scale;
	   scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
	   scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
	   #ifndef USE_SIZEATTENUATION
		   bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		   if ( isPerspective ) scale *= - mvPosition.z;
	   #endif
	   vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	   vec2 rotatedPosition;
	   rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	   rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	   mvPosition.xy += rotatedPosition;
	   gl_Position = projectionMatrix * mvPosition;
	   #include <logdepthbuf_vertex>
	   #include <clipping_planes_vertex>
	   #include <fog_vertex>
   }`,h_=`uniform vec3 diffuse;
   uniform float opacity;
   #include <common>
   #include <uv_pars_fragment>
   #include <map_pars_fragment>
   #include <alphamap_pars_fragment>
   #include <alphatest_pars_fragment>
   #include <alphahash_pars_fragment>
   #include <fog_pars_fragment>
   #include <logdepthbuf_pars_fragment>
   #include <clipping_planes_pars_fragment>
   void main() {
	   #include <clipping_planes_fragment>
	   vec3 outgoingLight = vec3( 0.0 );
	   vec4 diffuseColor = vec4( diffuse, opacity );
	   #include <logdepthbuf_fragment>
	   #include <map_fragment>
	   #include <alphamap_fragment>
	   #include <alphatest_fragment>
	   #include <alphahash_fragment>
	   outgoingLight = diffuseColor.rgb;
	   #include <opaque_fragment>
	   #include <tonemapping_fragment>
	   #include <colorspace_fragment>
	   #include <fog_fragment>
   }`,hT={alphahash_fragment:ug,alphahash_pars_fragment:u8,alphamap_fragment:u$,alphamap_pars_fragment:uv,alphatest_fragment:ux,alphatest_pars_fragment:uy,aomap_fragment:uS,aomap_pars_fragment:uE,begin_vertex:ub,beginnormal_vertex:u_,bsdfs:uT,iridescence_fragment:uM,bumpmap_pars_fragment:uw,clipping_planes_fragment:uA,clipping_planes_pars_fragment:uC,clipping_planes_pars_vertex:uR,clipping_planes_vertex:u0,color_fragment:uP,color_pars_fragment:uL,color_pars_vertex:u1,color_vertex:uD,common:uU,cube_uv_reflection_fragment:uI,defaultnormal_vertex:uN,displacementmap_pars_vertex:uO,displacementmap_vertex:uF,emissivemap_fragment:uB,emissivemap_pars_fragment:uz,colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:u2,envmap_fragment:uk,envmap_common_pars_fragment:uH,envmap_pars_fragment:uV,envmap_pars_vertex:u3,envmap_physical_pars_fragment:uK,envmap_vertex:uG,fog_vertex:u4,fog_pars_vertex:uW,fog_fragment:u6,fog_pars_fragment:u5,gradientmap_pars_fragment:u7,lightmap_fragment:uX,lightmap_pars_fragment:uq,lights_lambert_fragment:uY,lights_lambert_pars_fragment:uj,lights_pars_begin:uZ,lights_toon_fragment:uJ,lights_toon_pars_fragment:uQ,lights_phong_fragment:u9,lights_phong_pars_fragment:ce,lights_physical_fragment:ct,lights_physical_pars_fragment:ci,lights_fragment_begin:cr,lights_fragment_maps:cn,lights_fragment_end:ca,logdepthbuf_fragment:co,logdepthbuf_pars_fragment:cs,logdepthbuf_pars_vertex:cl,logdepthbuf_vertex:cu,map_fragment:cc,map_pars_fragment:ch,map_particle_fragment:cd,map_particle_pars_fragment:cp,metalnessmap_fragment:cf,metalnessmap_pars_fragment:cm,morphcolor_vertex:cg,morphnormal_vertex:c8,morphtarget_pars_vertex:c$,morphtarget_vertex:cv,normal_fragment_begin:cx,normal_fragment_maps:cy,normal_pars_fragment:cS,normal_pars_vertex:cE,normal_vertex:cb,normalmap_pars_fragment:c_,clearcoat_normal_fragment_begin:cT,clearcoat_normal_fragment_maps:cM,clearcoat_pars_fragment:cw,iridescence_pars_fragment:cA,opaque_fragment:cC,packing:cR,premultiplied_alpha_fragment:c0,project_vertex:cP,dithering_fragment:cL,dithering_pars_fragment:c1,roughnessmap_fragment:cD,roughnessmap_pars_fragment:cU,shadowmap_pars_fragment:cI,shadowmap_pars_vertex:cN,shadowmap_vertex:cO,shadowmask_pars_fragment:cF,skinbase_vertex:cB,skinning_pars_vertex:cz,skinning_vertex:c2,skinnormal_vertex:ck,specularmap_fragment:cH,specularmap_pars_fragment:cV,tonemapping_fragment:c3,tonemapping_pars_fragment:cG,transmission_fragment:c4,transmission_pars_fragment:cW,uv_pars_fragment:c6,uv_pars_vertex:c5,uv_vertex:c7,worldpos_vertex:cX,background_vert:cq,background_frag:cY,backgroundCube_vert:cj,backgroundCube_frag:cZ,cube_vert:cK,cube_frag:cJ,depth_vert:cQ,depth_frag:c9,distanceRGBA_vert:he,distanceRGBA_frag:ht,equirect_vert:hi,equirect_frag:hr,linedashed_vert:hn,linedashed_frag:ha,meshbasic_vert:ho,meshbasic_frag:hs,meshlambert_vert:hl,meshlambert_frag:hu,meshmatcap_vert:hc,meshmatcap_frag:hh,meshnormal_vert:hd,meshnormal_frag:hp,meshphong_vert:hf,meshphong_frag:hm,meshphysical_vert:hg,meshphysical_frag:h8,meshtoon_vert:h$,meshtoon_frag:hv,points_vert:hx,points_frag:hy,shadow_vert:hS,shadow_frag:hE,sprite_vert:hb,sprite_frag:h_},hM={common:{diffuse:{value:new lv(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new o4},alphaMap:{value:null},alphaMapTransform:{value:new o4},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new o4}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new o4}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new o4}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new o4},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new o4},normalScale:{value:new oG(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new o4},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new o4}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new o4}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new o4}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new lv(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 lv(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new o4},alphaTest:{value:0},uvTransform:{value:new o4}},sprite:{diffuse:{value:new lv(16777215)},opacity:{value:1},center:{value:new oG(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new o4},alphaMap:{value:null},alphaMapTransform:{value:new o4},alphaTest:{value:0}}},hw={basic:{uniforms:lZ([hM.common,hM.specularmap,hM.envmap,hM.aomap,hM.lightmap,hM.fog]),vertexShader:hT.meshbasic_vert,fragmentShader:hT.meshbasic_frag},lambert:{uniforms:lZ([hM.common,hM.specularmap,hM.envmap,hM.aomap,hM.lightmap,hM.emissivemap,hM.bumpmap,hM.normalmap,hM.displacementmap,hM.fog,hM.lights,{emissive:{value:new lv(0)}}]),vertexShader:hT.meshlambert_vert,fragmentShader:hT.meshlambert_frag},phong:{uniforms:lZ([hM.common,hM.specularmap,hM.envmap,hM.aomap,hM.lightmap,hM.emissivemap,hM.bumpmap,hM.normalmap,hM.displacementmap,hM.fog,hM.lights,{emissive:{value:new lv(0)},specular:{value:new lv(1118481)},shininess:{value:30}}]),vertexShader:hT.meshphong_vert,fragmentShader:hT.meshphong_frag},standard:{uniforms:lZ([hM.common,hM.envmap,hM.aomap,hM.lightmap,hM.emissivemap,hM.bumpmap,hM.normalmap,hM.displacementmap,hM.roughnessmap,hM.metalnessmap,hM.fog,hM.lights,{emissive:{value:new lv(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:hT.meshphysical_vert,fragmentShader:hT.meshphysical_frag},toon:{uniforms:lZ([hM.common,hM.aomap,hM.lightmap,hM.emissivemap,hM.bumpmap,hM.normalmap,hM.displacementmap,hM.gradientmap,hM.fog,hM.lights,{emissive:{value:new lv(0)}}]),vertexShader:hT.meshtoon_vert,fragmentShader:hT.meshtoon_frag},matcap:{uniforms:lZ([hM.common,hM.bumpmap,hM.normalmap,hM.displacementmap,hM.fog,{matcap:{value:null}}]),vertexShader:hT.meshmatcap_vert,fragmentShader:hT.meshmatcap_frag},points:{uniforms:lZ([hM.points,hM.fog]),vertexShader:hT.points_vert,fragmentShader:hT.points_frag},dashed:{uniforms:lZ([hM.common,hM.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hT.linedashed_vert,fragmentShader:hT.linedashed_frag},depth:{uniforms:lZ([hM.common,hM.displacementmap]),vertexShader:hT.depth_vert,fragmentShader:hT.depth_frag},normal:{uniforms:lZ([hM.common,hM.bumpmap,hM.normalmap,hM.displacementmap,{opacity:{value:1}}]),vertexShader:hT.meshnormal_vert,fragmentShader:hT.meshnormal_frag},sprite:{uniforms:lZ([hM.sprite,hM.fog]),vertexShader:hT.sprite_vert,fragmentShader:hT.sprite_frag},background:{uniforms:{uvTransform:{value:new o4},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:hT.background_vert,fragmentShader:hT.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:hT.backgroundCube_vert,fragmentShader:hT.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:hT.cube_vert,fragmentShader:hT.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hT.equirect_vert,fragmentShader:hT.equirect_frag},distanceRGBA:{uniforms:lZ([hM.common,hM.displacementmap,{referencePosition:{value:new sh},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hT.distanceRGBA_vert,fragmentShader:hT.distanceRGBA_frag},shadow:{uniforms:lZ([hM.lights,hM.fog,{color:{value:new lv(0)},opacity:{value:1}}]),vertexShader:hT.shadow_vert,fragmentShader:hT.shadow_frag}};hw.physical={uniforms:lZ([hw.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new o4},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new o4},clearcoatNormalScale:{value:new oG(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new o4},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new o4},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new o4},sheen:{value:0},sheenColor:{value:new lv(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new o4},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new o4},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new o4},transmissionSamplerSize:{value:new oG},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new o4},attenuationDistance:{value:0},attenuationColor:{value:new lv(0)},specularColor:{value:new lv(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new o4},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new o4},anisotropyVector:{value:new oG},anisotropyMap:{value:null},anisotropyMapTransform:{value:new o4}}]),vertexShader:hT.meshphysical_vert,fragmentShader:hT.meshphysical_frag};let hA={r:0,b:0,g:0};function hC(e,t,r,n,a,o,s){let c=new lv(0),h=!0===o?0:1,d,p,f=null,m=0,$=null;function x(t,r){t.getRGB(hA,lK(e)),n.buffers.color.setClear(hA.r,hA.g,hA.b,r,s)}return{getClearColor:function(){return c},setClearColor:function(e,t=1){c.set(e),x(c,h=t)},getClearAlpha:function(){return h},setClearAlpha:function(e){x(c,h=e)},render:function o(y,S){let E=!1,_=!0===S.isScene?S.background:null;_&&_.isTexture&&(_=(S.backgroundBlurriness>0?r:t).get(_)),null===_?x(c,h):_&&_.isColor&&(x(_,1),E=!0);let T=e.xr.getEnvironmentBlendMode();"additive"===T?n.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===T&&n.buffers.color.setClear(0,0,0,0,s),(e.autoClear||E)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),_&&(_.isCubeTexture||306===_.mapping)?(void 0===p&&((p=new lX(new lY(1,1,1),new ue({name:"BackgroundCubeMaterial",uniforms:lj(hw.backgroundCube.uniforms),vertexShader:hw.backgroundCube.vertexShader,fragmentShader:hw.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),a.update(p)),p.material.uniforms.envMap.value=_,p.material.uniforms.flipEnvMap.value=_.isCubeTexture&&!1===_.isRenderTargetTexture?-1:1,p.material.uniforms.backgroundBlurriness.value=S.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,p.material.toneMapped=oK.getTransfer(_.colorSpace)!==oC,(f!==_||m!==_.version||$!==e.toneMapping)&&(p.material.needsUpdate=!0,f=_,m=_.version,$=e.toneMapping),p.layers.enableAll(),y.unshift(p,p.geometry,p.material,0,0,null)):_&&_.isTexture&&(void 0===d&&((d=new lX(new um(2,2),new ue({name:"BackgroundMaterial",uniforms:lj(hw.background.uniforms),vertexShader:hw.background.vertexShader,fragmentShader:hw.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1}))).geometry.deleteAttribute("normal"),Object.defineProperty(d.material,"map",{get:function(){return this.uniforms.t2D.value}}),a.update(d)),d.material.uniforms.t2D.value=_,d.material.uniforms.backgroundIntensity.value=S.backgroundIntensity,d.material.toneMapped=oK.getTransfer(_.colorSpace)!==oC,!0===_.matrixAutoUpdate&&_.updateMatrix(),d.material.uniforms.uvTransform.value.copy(_.matrix),(f!==_||m!==_.version||$!==e.toneMapping)&&(d.material.needsUpdate=!0,f=_,m=_.version,$=e.toneMapping),d.layers.enableAll(),y.unshift(d,d.geometry,d.material,0,0,null))}}}function hR(e,t,r,n){let a=e.getParameter(e.MAX_VERTEX_ATTRIBS),o=n.isWebGL2?null:t.get("OES_vertex_array_object"),s=n.isWebGL2||null!==o,c={},h=$(null),d=h,p=!1;function f(t){return n.isWebGL2?e.bindVertexArray(t):o.bindVertexArrayOES(t)}function m(t){return n.isWebGL2?e.deleteVertexArray(t):o.deleteVertexArrayOES(t)}function $(e){let t=[],r=[],n=[];for(let o=0;o<a;o++)t[o]=0,r[o]=0,n[o]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:r,attributeDivisors:n,object:e,attributes:{},index:null}}function x(){let e=d.newAttributes;for(let t=0,r=e.length;t<r;t++)e[t]=0}function y(e){S(e,0)}function S(r,a){let o=d.newAttributes,s=d.enabledAttributes,c=d.attributeDivisors;o[r]=1,0===s[r]&&(e.enableVertexAttribArray(r),s[r]=1),c[r]!==a&&((n.isWebGL2?e:t.get("ANGLE_instanced_arrays"))[n.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](r,a),c[r]=a)}function E(){let t=d.newAttributes,r=d.enabledAttributes;for(let n=0,a=r.length;n<a;n++)r[n]!==t[n]&&(e.disableVertexAttribArray(n),r[n]=0)}function _(t,r,n,a,o,s,c){!0===c?e.vertexAttribIPointer(t,r,n,o,s):e.vertexAttribPointer(t,r,n,a,o,s)}function T(){M(),p=!0,d!==h&&f((d=h).object)}function M(){h.geometry=null,h.program=null,h.wireframe=!1}return{setup:function a(h,m,T,M,A){let C=!1;if(s){let R=function t(r,a,s){let h=!0===s.wireframe,d=c[r.id];void 0===d&&(d={},c[r.id]=d);let p=d[a.id];void 0===p&&(p={},d[a.id]=p);let f=p[h];return void 0===f&&(f=$(n.isWebGL2?e.createVertexArray():o.createVertexArrayOES()),p[h]=f),f}(M,T,m);d!==R&&f((d=R).object),(C=function e(t,r,n,a){let o=d.attributes,s=r.attributes,c=0,h=n.getAttributes();for(let p in h)if(h[p].location>=0){let f=o[p],m=s[p];if(void 0===m&&("instanceMatrix"===p&&t.instanceMatrix&&(m=t.instanceMatrix),"instanceColor"===p&&t.instanceColor&&(m=t.instanceColor)),void 0===f||f.attribute!==m||m&&f.data!==m.data)return!0;c++}return d.attributesNum!==c||d.index!==a}(h,M,T,A))&&function e(t,r,n,a){let o={},s=r.attributes,c=0,h=n.getAttributes();for(let p in h)if(h[p].location>=0){let f=s[p];void 0===f&&("instanceMatrix"===p&&t.instanceMatrix&&(f=t.instanceMatrix),"instanceColor"===p&&t.instanceColor&&(f=t.instanceColor));let m={};m.attribute=f,f&&f.data&&(m.data=f.data),o[p]=m,c++}d.attributes=o,d.attributesNum=c,d.index=a}(h,M,T,A)}else{let P=!0===m.wireframe;(d.geometry!==M.id||d.program!==T.id||d.wireframe!==P)&&(d.geometry=M.id,d.program=T.id,d.wireframe=P,C=!0)}null!==A&&r.update(A,e.ELEMENT_ARRAY_BUFFER),(C||p)&&(p=!1,function a(o,s,c,h){if(!1===n.isWebGL2&&(o.isInstancedMesh||h.isInstancedBufferGeometry)&&null===t.get("ANGLE_instanced_arrays"))return;x();let d=h.attributes,p=c.getAttributes(),f=s.defaultAttributeValues;for(let m in p){let $=p[m];if($.location>=0){let T=d[m];if(void 0===T&&("instanceMatrix"===m&&o.instanceMatrix&&(T=o.instanceMatrix),"instanceColor"===m&&o.instanceColor&&(T=o.instanceColor)),void 0!==T){let M=T.normalized,A=T.itemSize,C=r.get(T);if(void 0===C)continue;let R=C.buffer,P=C.type,D=C.bytesPerElement,U=!0===n.isWebGL2&&(P===e.INT||P===e.UNSIGNED_INT||1013===T.gpuType);if(T.isInterleavedBufferAttribute){let I=T.data,N=I.stride,O=T.offset;if(I.isInstancedInterleavedBuffer){for(let F=0;F<$.locationSize;F++)S($.location+F,I.meshPerAttribute);!0!==o.isInstancedMesh&&void 0===h._maxInstanceCount&&(h._maxInstanceCount=I.meshPerAttribute*I.count)}else for(let B=0;B<$.locationSize;B++)y($.location+B);e.bindBuffer(e.ARRAY_BUFFER,R);for(let z=0;z<$.locationSize;z++)_($.location+z,A/$.locationSize,P,M,N*D,(O+A/$.locationSize*z)*D,U)}else{if(T.isInstancedBufferAttribute){for(let k=0;k<$.locationSize;k++)S($.location+k,T.meshPerAttribute);!0!==o.isInstancedMesh&&void 0===h._maxInstanceCount&&(h._maxInstanceCount=T.meshPerAttribute*T.count)}else for(let H=0;H<$.locationSize;H++)y($.location+H);e.bindBuffer(e.ARRAY_BUFFER,R);for(let V=0;V<$.locationSize;V++)_($.location+V,A/$.locationSize,P,M,A*D,A/$.locationSize*V*D,U)}}else if(void 0!==f){let G=f[m];if(void 0!==G)switch(G.length){case 2:e.vertexAttrib2fv($.location,G);break;case 3:e.vertexAttrib3fv($.location,G);break;case 4:e.vertexAttrib4fv($.location,G);break;default:e.vertexAttrib1fv($.location,G)}}}}E()}(h,m,T,M),null!==A&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.get(A).buffer))},reset:T,resetDefaultState:M,dispose:function e(){for(let t in T(),c){let r=c[t];for(let n in r){let a=r[n];for(let o in a)m(a[o].object),delete a[o];delete r[n]}delete c[t]}},releaseStatesOfGeometry:function e(t){if(void 0===c[t.id])return;let r=c[t.id];for(let n in r){let a=r[n];for(let o in a)m(a[o].object),delete a[o];delete r[n]}delete c[t.id]},releaseStatesOfProgram:function e(t){for(let r in c){let n=c[r];if(void 0===n[t.id])continue;let a=n[t.id];for(let o in a)m(a[o].object),delete a[o];delete n[t.id]}},initAttributes:x,enableAttribute:y,disableUnusedAttributes:E}}function h0(e,t,r,n){let a=n.isWebGL2,o;function s(e){o=e}this.setMode=s,this.render=function t(n,a){e.drawArrays(o,n,a),r.update(a,o,1)},this.renderInstances=function n(s,c,h){if(0===h)return;let d,p;if(a)d=e,p="drawArraysInstanced";else if(d=t.get("ANGLE_instanced_arrays"),p="drawArraysInstancedANGLE",null===d){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}d[p](o,s,c,h),r.update(c,o,h)}}function hP(e,t,r){let n;function a(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let o="u">typeof WebGL2RenderingContext&&"WebGL2RenderingContext"===e.constructor.name,s=void 0!==r.precision?r.precision:"highp",c=a(s);c!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",c,"instead."),s=c);let h=o||t.has("WEBGL_draw_buffers"),d=!0===r.logarithmicDepthBuffer,p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),f=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_TEXTURE_SIZE),$=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),x=e.getParameter(e.MAX_VERTEX_ATTRIBS),y=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),S=e.getParameter(e.MAX_VARYING_VECTORS),E=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),_=f>0,T=o||t.has("OES_texture_float"),M=o?e.getParameter(e.MAX_SAMPLES):0;return{isWebGL2:o,drawBuffers:h,getMaxAnisotropy:function r(){if(void 0!==n)return n;if(!0===t.has("EXT_texture_filter_anisotropic")){let a=t.get("EXT_texture_filter_anisotropic");n=e.getParameter(a.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else n=0;return n},getMaxPrecision:a,precision:s,logarithmicDepthBuffer:d,maxTextures:p,maxVertexTextures:f,maxTextureSize:m,maxCubemapSize:$,maxAttributes:x,maxVertexUniforms:y,maxVaryings:S,maxFragmentUniforms:E,vertexTextures:_,floatFragmentTextures:T,floatVertexTextures:_&&T,maxSamples:M}}function hL(e){let t=this,r=null,n=0,a=!1,o=!1,s=new uu,c=new o4,h={value:null,needsUpdate:!1};function d(e,r,n,a){let o=null!==e?e.length:0,d=null;if(0!==o){if(d=h.value,!0!==a||null===d){let p=n+4*o,f=r.matrixWorldInverse;c.getNormalMatrix(f),(null===d||d.length<p)&&(d=new Float32Array(p));for(let m=0,$=n;m!==o;++m,$+=4)s.copy(e[m]).applyMatrix4(f,c),s.normal.toArray(d,$),d[$+3]=s.constant}h.value=d,h.needsUpdate=!0}return t.numPlanes=o,t.numIntersection=0,d}this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let r=0!==e.length||t||0!==n||a;return a=t,n=e.length,r},this.beginShadows=function(){o=!0,d(null)},this.endShadows=function(){o=!1},this.setGlobalState=function(e,t){r=d(e,t,0)},this.setState=function(s,c,p){let f=s.clippingPlanes,m=s.clipIntersection,$=s.clipShadows,x=e.get(s);if(a&&null!==f&&0!==f.length&&(!o||$)){let y=o?0:n,S=4*y,E=x.clippingState||null;h.value=E,E=d(f,c,S,p);for(let _=0;_!==S;++_)E[_]=r[_];x.clippingState=E,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=y}else o?d(null):(h.value!==r&&(h.value=r,h.needsUpdate=n>0),t.numPlanes=n,t.numIntersection=0)}}function h1(e){let t=new WeakMap;function r(e,t){return 303===t?e.mapping=301:304===t&&(e.mapping=302),e}function n(e){let r=e.target;r.removeEventListener("dispose",n);let a=t.get(r);void 0!==a&&(t.delete(r),a.dispose())}return{get:function a(o){if(o&&o.isTexture&&!1===o.isRenderTargetTexture){let s=o.mapping;if(303===s||304===s){if(t.has(o)){let c=t.get(o).texture;return r(c,o.mapping)}{let h=o.image;if(!h||!(h.height>0))return null;{let d=new ua(h.height/2);return d.fromEquirectangularTexture(e,o),t.set(o,d),o.addEventListener("dispose",n),r(d.texture,o.mapping)}}}}return o},dispose:function e(){t=new WeakMap}}}let hD=[.125,.215,.35,.446,.526,.582],hU=new class e extends ut{constructor(e=-1,t=1,r=1,n=-1,a=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=n,this.near=a,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,r,n,a,o){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=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=n,this.view.width=a,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,n=(this.top+this.bottom)/2,a=r-e,o=r+e,s=n+t,c=n-t;if(null!==this.view&&this.view.enabled){let h=(this.right-this.left)/this.view.fullWidth/this.zoom,d=(this.top-this.bottom)/this.view.fullHeight/this.zoom;a+=h*this.view.offsetX,o=a+h*this.view.width,s-=d*this.view.offsetY,c=s-d*this.view.height}this.projectionMatrix.makeOrthographic(a,o,s,c,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}},hI=new lv,hN=null,hO=0,hF=0,hB=(1+Math.sqrt(5))/2,hz=1/hB,h2=[new sh(1,1,1),new sh(-1,1,1),new sh(1,1,-1),new sh(-1,1,-1),new sh(0,hB,hz),new sh(0,hB,-hz),new sh(hz,0,hB),new sh(-hz,0,hB),new sh(hB,hz,0),new sh(-hB,hz,0)];class hk{constructor(e){this._renderer=e,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(e,t=0,r=.1,n=100){hN=this._renderer.getRenderTarget(),hO=this._renderer.getActiveCubeFace(),hF=this._renderer.getActiveMipmapLevel(),this._setSize(256);let a=this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(e,r,n,a),t>0&&this._blur(a,0,0,t),this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=hG(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=h3(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(hN,hO,hF),e.scissorTest=!1,hV(e,0,0,e.width,e.height)}_fromTexture(e,t){301===e.mapping||302===e.mapping?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),hN=this._renderer.getRenderTarget(),hO=this._renderer.getActiveCubeFace(),hF=this._renderer.getActiveMipmapLevel();let r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){let e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:1006,minFilter:1006,generateMipmaps:!1,type:1016,format:1023,colorSpace:oT,depthBuffer:!1},n=hH(e,t,r);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=hH(e,t,r);let{_lodMax:a}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function e(t){let r=[],n=[],a=[],o=t,s=t-4+1+hD.length;for(let c=0;c<s;c++){let h=Math.pow(2,o);n.push(h);let d=1/h;c>t-4?d=hD[c-t+4-1]:0===c&&(d=0),a.push(d);let p=1/(h-2),f=-p,m=1+p,$=[f,f,m,f,m,m,f,f,m,m,f,m],x=new Float32Array(108),y=new Float32Array(72),S=new Float32Array(36);for(let E=0;E<6;E++){let _=E%3*2/3-1,T=E>2?0:-1,M=[_,T,0,_+2/3,T,0,_+2/3,T+1,0,_,T,0,_+2/3,T+1,0,_,T+1,0];x.set(M,18*E),y.set($,12*E);let A=[E,E,E,E,E,E];S.set(A,6*E)}let C=new lU;C.setAttribute("position",new lT(x,3)),C.setAttribute("uv",new lT(y,2)),C.setAttribute("faceIndex",new lT(S,1)),r.push(C),o>4&&o--}return{lodPlanes:r,sizeLods:n,sigmas:a}}(a)),this._blurMaterial=function e(t,r,n){let a=new Float32Array(20),o=new sh(0,1,0);return new ue({name:"SphericalGaussianBlur",defines:{n:20,CUBEUV_TEXEL_WIDTH:1/r,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:a},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:o}},vertexShader:h4(),fragmentShader:`
   
			   precision mediump float;
			   precision mediump int;
   
			   varying vec3 vOutputDirection;
   
			   uniform sampler2D envMap;
			   uniform int samples;
			   uniform float weights[ n ];
			   uniform bool latitudinal;
			   uniform float dTheta;
			   uniform float mipInt;
			   uniform vec3 poleAxis;
   
			   #define ENVMAP_TYPE_CUBE_UV
			   #include <cube_uv_reflection_fragment>
   
			   vec3 getSample( float theta, vec3 axis ) {
   
				   float cosTheta = cos( theta );
				   // Rodrigues' axis-angle rotation
				   vec3 sampleDirection = vOutputDirection * cosTheta
					   + cross( axis, vOutputDirection ) * sin( theta )
					   + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
   
				   return bilinearCubeUV( envMap, sampleDirection, mipInt );
   
			   }
   
			   void main() {
   
				   vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
   
				   if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
   
					   axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
   
				   }
   
				   axis = normalize( axis );
   
				   gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				   gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
   
				   for ( int i = 1; i < n; i++ ) {
   
					   if ( i >= samples ) {
   
						   break;
   
					   }
   
					   float theta = dTheta * float( i );
					   gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					   gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
   
				   }
   
			   }
		   `,blending:0,depthTest:!1,depthWrite:!1})}(a,e,t)}return n}_compileMaterial(e){let t=new lX(this._lodPlanes[0],e);this._renderer.compile(t,hU)}_sceneToCubeUV(e,t,r,n){let a=new ui(90,1,t,r),o=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],c=this._renderer,h=c.autoClear,d=c.toneMapping;c.getClearColor(hI),c.toneMapping=ob,c.autoClear=!1;let p=new lE({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1}),f=new lX(new lY,p),m=!1,$=e.background;$?$.isColor&&(p.color.copy($),e.background=null,m=!0):(p.color.copy(hI),m=!0);for(let x=0;x<6;x++){let y=x%3;0===y?(a.up.set(0,o[x],0),a.lookAt(s[x],0,0)):1===y?(a.up.set(0,0,o[x]),a.lookAt(0,s[x],0)):(a.up.set(0,o[x],0),a.lookAt(0,0,s[x]));let S=this._cubeSize;hV(n,y*S,x>2?S:0,S,S),c.setRenderTarget(n),m&&c.render(f,a),c.render(e,a)}f.geometry.dispose(),f.material.dispose(),c.toneMapping=d,c.autoClear=h,e.background=$}_textureToCubeUV(e,t){let r=this._renderer,n=301===e.mapping||302===e.mapping;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=hG()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=h3());let a=n?this._cubemapMaterial:this._equirectMaterial,o=new lX(this._lodPlanes[0],a),s=a.uniforms;s.envMap.value=e;let c=this._cubeSize;hV(t,0,0,3*c,2*c),r.setRenderTarget(t),r.render(o,hU)}_applyPMREM(e){let t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let n=1;n<this._lodPlanes.length;n++){let a=Math.sqrt(this._sigmas[n]*this._sigmas[n]-this._sigmas[n-1]*this._sigmas[n-1]),o=h2[(n-1)%h2.length];this._blur(e,n-1,n,a,o)}t.autoClear=r}_blur(e,t,r,n,a){let o=this._pingPongRenderTarget;this._halfBlur(e,o,t,r,n,"latitudinal",a),this._halfBlur(o,e,r,r,n,"longitudinal",a)}_halfBlur(e,t,r,n,a,o,s){let c=this._renderer,h=this._blurMaterial;"latitudinal"!==o&&"longitudinal"!==o&&console.error("blur direction must be either latitudinal or longitudinal!");let d=new lX(this._lodPlanes[n],h),p=h.uniforms,f=this._sizeLods[r]-1,m=isFinite(a)?Math.PI/(2*f):2*Math.PI/39,$=a/m,x=isFinite(a)?1+Math.floor(3*$):20;x>20&&console.warn(`sigmaRadians, ${a}, is too large and will clip, as it requested ${x} samples when the maximum is set to 20`);let y=[],S=0;for(let E=0;E<20;++E){let _=E/$,T=Math.exp(-_*_/2);y.push(T),0===E?S+=T:E<x&&(S+=2*T)}for(let M=0;M<y.length;M++)y[M]=y[M]/S;p.envMap.value=e.texture,p.samples.value=x,p.weights.value=y,p.latitudinal.value="latitudinal"===o,s&&(p.poleAxis.value=s);let{_lodMax:A}=this;p.dTheta.value=m,p.mipInt.value=A-r;let C=this._sizeLods[n],R=4*(this._cubeSize-C);hV(t,3*C*(n>A-4?n-A+4:0),R,3*C,2*C),c.setRenderTarget(t),c.render(d,hU)}}function hH(e,t,r){let n=new sl(e,t,r);return n.texture.mapping=306,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function hV(e,t,r,n,a){e.viewport.set(t,r,n,a),e.scissor.set(t,r,n,a)}function h3(){return new ue({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:h4(),fragmentShader:`
   
			   precision mediump float;
			   precision mediump int;
   
			   varying vec3 vOutputDirection;
   
			   uniform sampler2D envMap;
   
			   #include <common>
   
			   void main() {
   
				   vec3 outputDirection = normalize( vOutputDirection );
				   vec2 uv = equirectUv( outputDirection );
   
				   gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
   
			   }
		   `,blending:0,depthTest:!1,depthWrite:!1})}function hG(){return new ue({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:h4(),fragmentShader:`
   
			   precision mediump float;
			   precision mediump int;
   
			   uniform float flipEnvMap;
   
			   varying vec3 vOutputDirection;
   
			   uniform samplerCube envMap;
   
			   void main() {
   
				   gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
   
			   }
		   `,blending:0,depthTest:!1,depthWrite:!1})}function h4(){return`
   
		   precision mediump float;
		   precision mediump int;
   
		   attribute float faceIndex;
   
		   varying vec3 vOutputDirection;
   
		   // RH coordinate system; PMREM face-indexing convention
		   vec3 getDirection( vec2 uv, float face ) {
   
			   uv = 2.0 * uv - 1.0;
   
			   vec3 direction = vec3( uv, 1.0 );
   
			   if ( face == 0.0 ) {
   
				   direction = direction.zyx; // ( 1, v, u ) pos x
   
			   } else if ( face == 1.0 ) {
   
				   direction = direction.xzy;
				   direction.xz *= -1.0; // ( -u, 1, -v ) pos y
   
			   } else if ( face == 2.0 ) {
   
				   direction.x *= -1.0; // ( -u, v, 1 ) pos z
   
			   } else if ( face == 3.0 ) {
   
				   direction = direction.zyx;
				   direction.xz *= -1.0; // ( -1, v, -u ) neg x
   
			   } else if ( face == 4.0 ) {
   
				   direction = direction.xzy;
				   direction.xy *= -1.0; // ( -u, -1, v ) neg y
   
			   } else if ( face == 5.0 ) {
   
				   direction.z *= -1.0; // ( u, v, -1 ) neg z
   
			   }
   
			   return direction;
   
		   }
   
		   void main() {
   
			   vOutputDirection = getDirection( uv, faceIndex );
			   gl_Position = vec4( position, 1.0 );
   
		   }
	   `}function hW(e){let t=new WeakMap,r=null;function n(e){let r=e.target;r.removeEventListener("dispose",n);let a=t.get(r);void 0!==a&&(t.delete(r),a.dispose())}return{get:function a(o){if(o&&o.isTexture){let s=o.mapping,c=303===s||304===s,h=301===s||302===s;if(c||h){if(o.isRenderTargetTexture&&!0===o.needsPMREMUpdate){o.needsPMREMUpdate=!1;let d=t.get(o);return null===r&&(r=new hk(e)),d=c?r.fromEquirectangular(o,d):r.fromCubemap(o,d),t.set(o,d),d.texture}if(t.has(o))return t.get(o).texture;{let p=o.image;if(!(c&&p&&p.height>0||h&&p&&function e(t){let r=0;for(let n=0;n<6;n++)void 0!==t[n]&&r++;return 6===r}(p)))return null;{null===r&&(r=new hk(e));let f=c?r.fromEquirectangular(o):r.fromCubemap(o);return t.set(o,f),o.addEventListener("dispose",n),f.texture}}}}return o},dispose:function e(){t=new WeakMap,null!==r&&(r.dispose(),r=null)}}}function h6(e){let t={};function r(r){if(void 0!==t[r])return t[r];let n;switch(r){case"WEBGL_depth_texture":n=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":n=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":n=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":n=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:n=e.getExtension(r)}return t[r]=n,n}return{has:function(e){return null!==r(e)},init:function(e){e.isWebGL2?r("EXT_color_buffer_float"):(r("WEBGL_depth_texture"),r("OES_texture_float"),r("OES_texture_half_float"),r("OES_texture_half_float_linear"),r("OES_standard_derivatives"),r("OES_element_index_uint"),r("OES_vertex_array_object"),r("ANGLE_instanced_arrays")),r("OES_texture_float_linear"),r("EXT_color_buffer_half_float"),r("WEBGL_multisampled_render_to_texture")},get:function(e){let t=r(e);return null===t&&console.warn("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function h5(e,t,r,n){let a={},o=new WeakMap;function s(e){let c=e.target;for(let h in null!==c.index&&t.remove(c.index),c.attributes)t.remove(c.attributes[h]);for(let d in c.morphAttributes){let p=c.morphAttributes[d];for(let f=0,m=p.length;f<m;f++)t.remove(p[f])}c.removeEventListener("dispose",s),delete a[c.id];let $=o.get(c);$&&(t.remove($),o.delete(c)),n.releaseStatesOfGeometry(c),!0===c.isInstancedBufferGeometry&&delete c._maxInstanceCount,r.memory.geometries--}function c(e){let r=[],n=e.index,a=e.attributes.position,s=0;if(null!==n){let c=n.array;s=n.version;for(let h=0,d=c.length;h<d;h+=3){let p=c[h+0],f=c[h+1],m=c[h+2];r.push(p,f,f,m,m,p)}}else{if(void 0===a)return;let $=a.array;s=a.version;for(let x=0,y=$.length/3-1;x<y;x+=3){let S=x+0,E=x+1,_=x+2;r.push(S,E,E,_,_,S)}}let T=new(o6(r)?lw:lM)(r,1);T.version=s;let M=o.get(e);M&&t.remove(M),o.set(e,T)}return{get:function e(t,n){return!0===a[n.id]||(n.addEventListener("dispose",s),a[n.id]=!0,r.memory.geometries++),n},update:function r(n){let a=n.attributes;for(let o in a)t.update(a[o],e.ARRAY_BUFFER);let s=n.morphAttributes;for(let c in s){let h=s[c];for(let d=0,p=h.length;d<p;d++)t.update(h[d],e.ARRAY_BUFFER)}},getWireframeAttribute:function e(t){let r=o.get(t);if(r){let n=t.index;null!==n&&r.version<n.version&&c(t)}else c(t);return o.get(t)}}}function h7(e,t,r,n){let a=n.isWebGL2,o;function s(e){o=e}let c,h;this.setMode=s,this.setIndex=function e(t){c=t.type,h=t.bytesPerElement},this.render=function t(n,a){e.drawElements(o,a,c,n*h),r.update(a,o,1)},this.renderInstances=function n(s,d,p){if(0===p)return;let f,m;if(a)f=e,m="drawElementsInstanced";else if(f=t.get("ANGLE_instanced_arrays"),m="drawElementsInstancedANGLE",null===f){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}f[m](o,d,c,s*h,p),r.update(d,o,p)}}function hX(e){let t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function e(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function r(n,a,o){switch(t.calls++,a){case e.TRIANGLES:t.triangles+=o*(n/3);break;case e.LINES:t.lines+=o*(n/2);break;case e.LINE_STRIP:t.lines+=o*(n-1);break;case e.LINE_LOOP:t.lines+=o*n;break;case e.POINTS:t.points+=o*n;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",a)}}}}function hq(e,t){return e[0]-t[0]}function hY(e,t){return Math.abs(t[1])-Math.abs(e[1])}function hj(e,t,r){let n={},a=new Float32Array(8),o=new WeakMap,s=new so,c=[];for(let h=0;h<8;h++)c[h]=[h,0];return{update:function h(d,p,f){let m=d.morphTargetInfluences;if(!0===t.isWebGL2){let $=p.morphAttributes.position||p.morphAttributes.normal||p.morphAttributes.color,x=void 0!==$?$.length:0,y=o.get(p);if(void 0===y||y.count!==x){let S=function(){I.dispose(),o.delete(p),p.removeEventListener("dispose",S)};void 0!==y&&y.texture.dispose();let E=void 0!==p.morphAttributes.position,_=void 0!==p.morphAttributes.normal,T=void 0!==p.morphAttributes.color,M=p.morphAttributes.position||[],A=p.morphAttributes.normal||[],C=p.morphAttributes.color||[],R=0;!0===E&&(R=1),!0===_&&(R=2),!0===T&&(R=3);let P=p.attributes.position.count*R,D=1;P>t.maxTextureSize&&(D=Math.ceil(P/t.maxTextureSize),P=t.maxTextureSize);let U=new Float32Array(P*D*4*x),I=new su(U,P,D,x);I.type=1015,I.needsUpdate=!0;let N=4*R;for(let O=0;O<x;O++){let F=M[O],B=A[O],z=C[O],k=P*D*4*O;for(let H=0;H<F.count;H++){let V=H*N;!0===E&&(s.fromBufferAttribute(F,H),U[k+V+0]=s.x,U[k+V+1]=s.y,U[k+V+2]=s.z,U[k+V+3]=0),!0===_&&(s.fromBufferAttribute(B,H),U[k+V+4]=s.x,U[k+V+5]=s.y,U[k+V+6]=s.z,U[k+V+7]=0),!0===T&&(s.fromBufferAttribute(z,H),U[k+V+8]=s.x,U[k+V+9]=s.y,U[k+V+10]=s.z,U[k+V+11]=4===z.itemSize?s.w:1)}}y={count:x,texture:I,size:new oG(P,D)},o.set(p,y),p.addEventListener("dispose",S)}let G=0;for(let W=0;W<m.length;W++)G+=m[W];let X=p.morphTargetsRelative?1:1-G;f.getUniforms().setValue(e,"morphTargetBaseInfluence",X),f.getUniforms().setValue(e,"morphTargetInfluences",m),f.getUniforms().setValue(e,"morphTargetsTexture",y.texture,r),f.getUniforms().setValue(e,"morphTargetsTextureSize",y.size)}else{let q=void 0===m?0:m.length,Y=n[p.id];if(void 0===Y||Y.length!==q){Y=[];for(let j=0;j<q;j++)Y[j]=[j,0];n[p.id]=Y}for(let Z=0;Z<q;Z++){let K=Y[Z];K[0]=Z,K[1]=m[Z]}Y.sort(hY);for(let J=0;J<8;J++)J<q&&Y[J][1]?(c[J][0]=Y[J][0],c[J][1]=Y[J][1]):(c[J][0]=Number.MAX_SAFE_INTEGER,c[J][1]=0);c.sort(hq);let Q=p.morphAttributes.position,et=p.morphAttributes.normal,ei=0;for(let er=0;er<8;er++){let en=c[er],ea=en[0],eo=en[1];ea!==Number.MAX_SAFE_INTEGER&&eo?(Q&&p.getAttribute("morphTarget"+er)!==Q[ea]&&p.setAttribute("morphTarget"+er,Q[ea]),et&&p.getAttribute("morphNormal"+er)!==et[ea]&&p.setAttribute("morphNormal"+er,et[ea]),a[er]=eo,ei+=eo):(Q&&!0===p.hasAttribute("morphTarget"+er)&&p.deleteAttribute("morphTarget"+er),et&&!0===p.hasAttribute("morphNormal"+er)&&p.deleteAttribute("morphNormal"+er),a[er]=0)}let es=p.morphTargetsRelative?1:1-ei;f.getUniforms().setValue(e,"morphTargetBaseInfluence",es),f.getUniforms().setValue(e,"morphTargetInfluences",a)}}}}function hZ(e,t,r,n){let a=new WeakMap;function o(e){let t=e.target;t.removeEventListener("dispose",o),r.remove(t.instanceMatrix),null!==t.instanceColor&&r.remove(t.instanceColor)}return{update:function s(c){let h=n.render.frame,d=c.geometry,p=t.get(c,d);if(a.get(p)!==h&&(t.update(p),a.set(p,h)),c.isInstancedMesh&&(!1===c.hasEventListener("dispose",o)&&c.addEventListener("dispose",o),a.get(c)!==h&&(r.update(c.instanceMatrix,e.ARRAY_BUFFER),null!==c.instanceColor&&r.update(c.instanceColor,e.ARRAY_BUFFER),a.set(c,h))),c.isSkinnedMesh){let f=c.skeleton;a.get(f)!==h&&(f.update(),a.set(f,h))}return p},dispose:function e(){a=new WeakMap}}}let hK=new sa,hJ=new su,hQ=new class e extends sa{constructor(e=null,t=1,r=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:n},this.magFilter=1003,this.minFilter=1003,this.wrapR=1001,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}},h9=new un,de=[],dt=[],di=new Float32Array(16),dr=new Float32Array(9),dn=new Float32Array(4);function da(e,t,r){let n=e[0];if(n<=0||n>0)return e;let a=t*r,o=de[a];if(void 0===o&&(o=new Float32Array(a),de[a]=o),0!==t){n.toArray(o,0);for(let s=1,c=0;s!==t;++s)c+=r,e[s].toArray(o,c)}return o}function ds(e,t){if(e.length!==t.length)return!1;for(let r=0,n=e.length;r<n;r++)if(e[r]!==t[r])return!1;return!0}function dl(e,t){for(let r=0,n=t.length;r<n;r++)e[r]=t[r]}function du(e,t){let r=dt[t];void 0===r&&(r=new Int32Array(t),dt[t]=r);for(let n=0;n!==t;++n)r[n]=e.allocateTextureUnit();return r}function dc(e,t){let r=this.cache;r[0]!==t&&(e.uniform1f(this.addr,t),r[0]=t)}function dh(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(ds(r,t))return;e.uniform2fv(this.addr,t),dl(r,t)}}function dd(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else if(void 0!==t.r)(r[0]!==t.r||r[1]!==t.g||r[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b);else{if(ds(r,t))return;e.uniform3fv(this.addr,t),dl(r,t)}}function dp(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(ds(r,t))return;e.uniform4fv(this.addr,t),dl(r,t)}}function df(e,t){let r=this.cache,n=t.elements;if(void 0===n){if(ds(r,t))return;e.uniformMatrix2fv(this.addr,!1,t),dl(r,t)}else{if(ds(r,n))return;dn.set(n),e.uniformMatrix2fv(this.addr,!1,dn),dl(r,n)}}function dm(e,t){let r=this.cache,n=t.elements;if(void 0===n){if(ds(r,t))return;e.uniformMatrix3fv(this.addr,!1,t),dl(r,t)}else{if(ds(r,n))return;dr.set(n),e.uniformMatrix3fv(this.addr,!1,dr),dl(r,n)}}function dg(e,t){let r=this.cache,n=t.elements;if(void 0===n){if(ds(r,t))return;e.uniformMatrix4fv(this.addr,!1,t),dl(r,t)}else{if(ds(r,n))return;di.set(n),e.uniformMatrix4fv(this.addr,!1,di),dl(r,n)}}function d8(e,t){let r=this.cache;r[0]!==t&&(e.uniform1i(this.addr,t),r[0]=t)}function d$(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2i(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(ds(r,t))return;e.uniform2iv(this.addr,t),dl(r,t)}}function dv(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3i(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(ds(r,t))return;e.uniform3iv(this.addr,t),dl(r,t)}}function dx(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(ds(r,t))return;e.uniform4iv(this.addr,t),dl(r,t)}}function dy(e,t){let r=this.cache;r[0]!==t&&(e.uniform1ui(this.addr,t),r[0]=t)}function dS(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y)&&(e.uniform2ui(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(ds(r,t))return;e.uniform2uiv(this.addr,t),dl(r,t)}}function dE(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z)&&(e.uniform3ui(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(ds(r,t))return;e.uniform3uiv(this.addr,t),dl(r,t)}}function db(e,t){let r=this.cache;if(void 0!==t.x)(r[0]!==t.x||r[1]!==t.y||r[2]!==t.z||r[3]!==t.w)&&(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(ds(r,t))return;e.uniform4uiv(this.addr,t),dl(r,t)}}function d_(e,t,r){let n=this.cache,a=r.allocateTextureUnit();n[0]!==a&&(e.uniform1i(this.addr,a),n[0]=a),r.setTexture2D(t||hK,a)}function dT(e,t,r){let n=this.cache,a=r.allocateTextureUnit();n[0]!==a&&(e.uniform1i(this.addr,a),n[0]=a),r.setTexture3D(t||hQ,a)}function dM(e,t,r){let n=this.cache,a=r.allocateTextureUnit();n[0]!==a&&(e.uniform1i(this.addr,a),n[0]=a),r.setTextureCube(t||h9,a)}function dw(e,t,r){let n=this.cache,a=r.allocateTextureUnit();n[0]!==a&&(e.uniform1i(this.addr,a),n[0]=a),r.setTexture2DArray(t||hJ,a)}function dA(e,t){e.uniform1fv(this.addr,t)}function dC(e,t){let r=da(t,this.size,2);e.uniform2fv(this.addr,r)}function dR(e,t){let r=da(t,this.size,3);e.uniform3fv(this.addr,r)}function d0(e,t){let r=da(t,this.size,4);e.uniform4fv(this.addr,r)}function dP(e,t){let r=da(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,r)}function dL(e,t){let r=da(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,r)}function d1(e,t){let r=da(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,r)}function dD(e,t){e.uniform1iv(this.addr,t)}function dU(e,t){e.uniform2iv(this.addr,t)}function dI(e,t){e.uniform3iv(this.addr,t)}function dN(e,t){e.uniform4iv(this.addr,t)}function dO(e,t){e.uniform1uiv(this.addr,t)}function dF(e,t){e.uniform2uiv(this.addr,t)}function dB(e,t){e.uniform3uiv(this.addr,t)}function dz(e,t){e.uniform4uiv(this.addr,t)}function d2(e,t,r){let n=this.cache,a=t.length,o=du(r,a);ds(n,o)||(e.uniform1iv(this.addr,o),dl(n,o));for(let s=0;s!==a;++s)r.setTexture2D(t[s]||hK,o[s])}function dk(e,t,r){let n=this.cache,a=t.length,o=du(r,a);ds(n,o)||(e.uniform1iv(this.addr,o),dl(n,o));for(let s=0;s!==a;++s)r.setTexture3D(t[s]||hQ,o[s])}function dH(e,t,r){let n=this.cache,a=t.length,o=du(r,a);ds(n,o)||(e.uniform1iv(this.addr,o),dl(n,o));for(let s=0;s!==a;++s)r.setTextureCube(t[s]||h9,o[s])}function dV(e,t,r){let n=this.cache,a=t.length,o=du(r,a);ds(n,o)||(e.uniform1iv(this.addr,o),dl(n,o));for(let s=0;s!==a;++s)r.setTexture2DArray(t[s]||hJ,o[s])}class d3{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.setValue=function e(t){switch(t){case 5126:return dc;case 35664:return dh;case 35665:return dd;case 35666:return dp;case 35674:return df;case 35675:return dm;case 35676:return dg;case 5124:case 35670:return d8;case 35667:case 35671:return d$;case 35668:case 35672:return dv;case 35669:case 35673:return dx;case 5125:return dy;case 36294:return dS;case 36295:return dE;case 36296:return db;case 35678:case 36198:case 36298:case 36306:case 35682:return d_;case 35679:case 36299:case 36307:return dT;case 35680:case 36300:case 36308:case 36293:return dM;case 36289:case 36303:case 36311:case 36292:return dw}}(t.type)}}class dG{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.size=t.size,this.setValue=function e(t){switch(t){case 5126:return dA;case 35664:return dC;case 35665:return dR;case 35666:return d0;case 35674:return dP;case 35675:return dL;case 35676:return d1;case 5124:case 35670:return dD;case 35667:case 35671:return dU;case 35668:case 35672:return dI;case 35669:case 35673:return dN;case 5125:return dO;case 36294:return dF;case 36295:return dB;case 36296:return dz;case 35678:case 36198:case 36298:case 36306:case 35682:return d2;case 35679:case 36299:case 36307:return dk;case 35680:case 36300:case 36308:case 36293:return dH;case 36289:case 36303:case 36311:case 36292:return dV}}(t.type)}}class d4{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,r){let n=this.seq;for(let a=0,o=n.length;a!==o;++a){let s=n[a];s.setValue(e,t[s.id],r)}}}let dW=/(\w+)(\])?(\[|\.)?/g;function d6(e,t){e.seq.push(t),e.map[t.id]=t}function d5(e,t,r){let n=e.name,a=n.length;for(dW.lastIndex=0;;){let o=dW.exec(n),s=dW.lastIndex,c=o[1],h="]"===o[2],d=o[3];if(h&&(c|=0),void 0===d||"["===d&&s+2===a){d6(r,void 0===d?new d3(c,e,t):new dG(c,e,t));break}{let p=r.map[c];void 0===p&&d6(r,p=new d4(c)),r=p}}}class d7{constructor(e,t){this.seq=[],this.map={};let r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let n=0;n<r;++n){let a=e.getActiveUniform(t,n),o=e.getUniformLocation(t,a.name);d5(a,o,this)}}setValue(e,t,r,n){let a=this.map[t];void 0!==a&&a.setValue(e,r,n)}setOptional(e,t,r){let n=t[r];void 0!==n&&this.setValue(e,r,n)}static upload(e,t,r,n){for(let a=0,o=t.length;a!==o;++a){let s=t[a],c=r[s.id];!1!==c.needsUpdate&&s.setValue(e,c.value,n)}}static seqWithValue(e,t){let r=[];for(let n=0,a=e.length;n!==a;++n){let o=e[n];o.id in t&&r.push(o)}return r}}function dX(e,t,r){let n=e.createShader(t);return e.shaderSource(n,r),e.compileShader(n),n}let dq=0;function dY(e,t,r){let n=e.getShaderParameter(t,e.COMPILE_STATUS),a=e.getShaderInfoLog(t).trim();if(n&&""===a)return"";let o=/ERROR: 0:(\d+)/.exec(a);if(!o)return a;{let s=parseInt(o[1]);return r.toUpperCase()+`
   
   `+a+`
   
   `+function e(t,r){let n=t.split(`
   `),a=[],o=Math.max(r-6,0),s=Math.min(r+6,n.length);for(let c=o;c<s;c++){let h=c+1;a.push(`${h===r?">":" "} ${h}: ${n[c]}`)}return a.join(`
   `)}(e.getShaderSource(t),s)}}function dj(e){return""!==e}function dZ(e,t){let r=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,r).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function dK(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}let dJ=/^[ \t]*#include +<([\w\d./]+)>/gm;function dQ(e){return e.replace(dJ,pe)}let d9=new Map([["encodings_fragment","colorspace_fragment"],["encodings_pars_fragment","colorspace_pars_fragment"],["output_fragment","opaque_fragment"]]);function pe(e,t){let r=hT[t];if(void 0===r){let n=d9.get(t);if(void 0!==n)r=hT[n],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,n);else throw Error("Can not resolve #include <"+t+">")}return dQ(r)}let pt=/#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 pi(e){return e.replace(pt,pr)}function pr(e,t,r,n){let a="";for(let o=parseInt(t);o<parseInt(r);o++)a+=n.replace(/\[\s*i\s*\]/g,"[ "+o+" ]").replace(/UNROLLED_LOOP_INDEX/g,o);return a}function pn(e){let t="precision "+e.precision+` float;
   precision `+e.precision+" int;";return"highp"===e.precision?t+=`
   #define HIGH_PRECISION`:"mediump"===e.precision?t+=`
   #define MEDIUM_PRECISION`:"lowp"===e.precision&&(t+=`
   #define LOW_PRECISION`),t}function pa(e,t,r,n){var a,o,s;let c=e.getContext(),h=r.defines,d=r.vertexShader,p=r.fragmentShader,f,m,$=(a=r,f="SHADOWMAP_TYPE_BASIC",1===a.shadowMapType?f="SHADOWMAP_TYPE_PCF":2===a.shadowMapType?f="SHADOWMAP_TYPE_PCF_SOFT":3===a.shadowMapType&&(f="SHADOWMAP_TYPE_VSM"),f),x=function e(t){let r="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case 301:case 302:r="ENVMAP_TYPE_CUBE";break;case 306:r="ENVMAP_TYPE_CUBE_UV"}return r}(r),y=(o=r,m="ENVMAP_MODE_REFLECTION",o.envMap&&302===o.envMapMode&&(m="ENVMAP_MODE_REFRACTION"),m),S=function e(t){let r="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case 0:r="ENVMAP_BLENDING_MULTIPLY";break;case 1:r="ENVMAP_BLENDING_MIX";break;case 2:r="ENVMAP_BLENDING_ADD"}return r}(r),E=function e(t){let r=t.envMapCubeUVHeight;if(null===r)return null;let n=Math.log2(r)-2;return{texelWidth:1/(3*Math.max(Math.pow(2,n),112)),texelHeight:1/r,maxMip:n}}(r),_=r.isWebGL2?"":[(s=r).extensionDerivatives||s.envMapCubeUVHeight||s.bumpMap||s.normalMapTangentSpace||s.clearcoatNormalMap||s.flatShading||"physical"===s.shaderID?"#extension GL_OES_standard_derivatives : enable":"",(s.extensionFragDepth||s.logarithmicDepthBuffer)&&s.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",s.extensionDrawBuffers&&s.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(s.extensionShaderTextureLOD||s.envMap||s.transmission)&&s.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(dj).join(`
   `),T=function e(t){let r=[];for(let n in t){let a=t[n];!1!==a&&r.push("#define "+n+" "+a)}return r.join(`
   `)}(h),M=c.createProgram(),A,C,R=r.glslVersion?"#version "+r.glslVersion+`
   `:"";r.isRawShaderMaterial?((A=["#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,T].filter(dj).join(`
   `)).length>0&&(A+=`
   `),(C=[_,"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,T].filter(dj).join(`
   `)).length>0&&(C+=`
   `)):(A=[pn(r),"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,T,r.instancing?"#define USE_INSTANCING":"",r.instancingColor?"#define USE_INSTANCING_COLOR":"",r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+y:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.displacementMap?"#define USE_DISPLACEMENTMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.anisotropy?"#define USE_ANISOTROPY":"",r.anisotropyMap?"#define USE_ANISOTROPYMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaHash?"#define USE_ALPHAHASH":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.mapUv?"#define MAP_UV "+r.mapUv:"",r.alphaMapUv?"#define ALPHAMAP_UV "+r.alphaMapUv:"",r.lightMapUv?"#define LIGHTMAP_UV "+r.lightMapUv:"",r.aoMapUv?"#define AOMAP_UV "+r.aoMapUv:"",r.emissiveMapUv?"#define EMISSIVEMAP_UV "+r.emissiveMapUv:"",r.bumpMapUv?"#define BUMPMAP_UV "+r.bumpMapUv:"",r.normalMapUv?"#define NORMALMAP_UV "+r.normalMapUv:"",r.displacementMapUv?"#define DISPLACEMENTMAP_UV "+r.displacementMapUv:"",r.metalnessMapUv?"#define METALNESSMAP_UV "+r.metalnessMapUv:"",r.roughnessMapUv?"#define ROUGHNESSMAP_UV "+r.roughnessMapUv:"",r.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+r.anisotropyMapUv:"",r.clearcoatMapUv?"#define CLEARCOATMAP_UV "+r.clearcoatMapUv:"",r.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+r.clearcoatNormalMapUv:"",r.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+r.clearcoatRoughnessMapUv:"",r.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+r.iridescenceMapUv:"",r.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+r.iridescenceThicknessMapUv:"",r.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+r.sheenColorMapUv:"",r.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+r.sheenRoughnessMapUv:"",r.specularMapUv?"#define SPECULARMAP_UV "+r.specularMapUv:"",r.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+r.specularColorMapUv:"",r.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+r.specularIntensityMapUv:"",r.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+r.transmissionMapUv:"",r.thicknessMapUv?"#define THICKNESSMAP_UV "+r.thicknessMapUv:"",r.vertexTangents&&!1===r.flatShading?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUv1s?"#define USE_UV1":"",r.vertexUv2s?"#define USE_UV2":"",r.vertexUv3s?"#define USE_UV3":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.morphColors&&r.isWebGL2?"#define USE_MORPHCOLORS":"",r.morphTargetsCount>0&&r.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",r.morphTargetsCount>0&&r.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+r.morphTextureStride:"",r.morphTargetsCount>0&&r.isWebGL2?"#define MORPHTARGETS_COUNT "+r.morphTargetsCount:"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+$:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.numLightProbes>0?"#define USE_LIGHT_PROBES":"",r.useLegacyLights?"#define LEGACY_LIGHTS":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
   `].filter(dj).join(`
   `),C=[_,pn(r),"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,T,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+x:"",r.envMap?"#define "+y:"",r.envMap?"#define "+S:"",E?"#define CUBEUV_TEXEL_WIDTH "+E.texelWidth:"",E?"#define CUBEUV_TEXEL_HEIGHT "+E.texelHeight:"",E?"#define CUBEUV_MAX_MIP "+E.maxMip+".0":"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.anisotropy?"#define USE_ANISOTROPY":"",r.anisotropyMap?"#define USE_ANISOTROPYMAP":"",r.clearcoat?"#define USE_CLEARCOAT":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescence?"#define USE_IRIDESCENCE":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaTest?"#define USE_ALPHATEST":"",r.alphaHash?"#define USE_ALPHAHASH":"",r.sheen?"#define USE_SHEEN":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.vertexTangents&&!1===r.flatShading?"#define USE_TANGENT":"",r.vertexColors||r.instancingColor?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUv1s?"#define USE_UV1":"",r.vertexUv2s?"#define USE_UV2":"",r.vertexUv3s?"#define USE_UV3":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+$:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.numLightProbes>0?"#define USE_LIGHT_PROBES":"",r.useLegacyLights?"#define LEGACY_LIGHTS":"",r.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.logarithmicDepthBuffer&&r.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",r.toneMapping!==ob?"#define TONE_MAPPING":"",r.toneMapping!==ob?hT.tonemapping_pars_fragment:"",r.toneMapping!==ob?function e(t,r){let n;switch(r){case 1:n="Linear";break;case 2:n="Reinhard";break;case 3:n="OptimizedCineon";break;case 4:n="ACESFilmic";break;case 5:n="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",r),n="Linear"}return"vec3 "+t+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}("toneMapping",r.toneMapping):"",r.dithering?"#define DITHERING":"",r.opaque?"#define OPAQUE":"",hT.colorspace_pars_fragment,function e(t,r){let n=function e(t){let r=oK.getPrimaries(oK.workingColorSpace),n=oK.getPrimaries(t),a;switch(r===n?a="":"p3"===r&&n===oR?a="LinearDisplayP3ToLinearSRGB":r===oR&&"p3"===n&&(a="LinearSRGBToLinearDisplayP3"),t){case oT:case ow:return[a,"LinearTransferOETF"];case o_:case oM:return[a,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",t),[a,"LinearTransferOETF"]}}(r);return`vec4 ${t}( vec4 value ) { return ${n[0]}( ${n[1]}( value ) ); }`}("linearToOutputTexel",r.outputColorSpace),r.useDepthPacking?"#define DEPTH_PACKING "+r.depthPacking:"",`
   `].filter(dj).join(`
   `)),d=dK(d=dZ(d=dQ(d),r),r),p=dK(p=dZ(p=dQ(p),r),r),d=pi(d),p=pi(p),r.isWebGL2&&!0!==r.isRawShaderMaterial&&(R=`#version 300 es
   `,A=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(`
   `)+`
   `+A,C=["precision mediump sampler2DArray;","#define varying in",r.glslVersion===o0?"":"layout(location = 0) out highp vec4 pc_fragColor;",r.glslVersion===o0?"":"#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(`
   `)+`
   `+C);let P=R+A+d,D=R+C+p,U=dX(c,c.VERTEX_SHADER,P),I=dX(c,c.FRAGMENT_SHADER,D);function N(t){if(e.debug.checkShaderErrors){let r=c.getProgramInfoLog(M).trim(),n=c.getShaderInfoLog(U).trim(),a=c.getShaderInfoLog(I).trim(),o=!0,s=!0;if(!1===c.getProgramParameter(M,c.LINK_STATUS)){if(o=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(c,M,U,I);else{let h=dY(c,U,"vertex"),d=dY(c,I,"fragment");console.error("THREE.WebGLProgram: Shader Error "+c.getError()+" - VALIDATE_STATUS "+c.getProgramParameter(M,c.VALIDATE_STATUS)+`
   
   Program Info Log: `+r+`
   `+h+`
   `+d)}}else""!==r?console.warn("THREE.WebGLProgram: Program Info Log:",r):(""===n||""===a)&&(s=!1);s&&(t.diagnostics={runnable:o,programLog:r,vertexShader:{log:n,prefix:A},fragmentShader:{log:a,prefix:C}})}c.deleteShader(U),c.deleteShader(I),O=new d7(c,M),F=function e(t,r){let n={},a=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let o=0;o<a;o++){let s=t.getActiveAttrib(r,o),c=s.name,h=1;s.type===t.FLOAT_MAT2&&(h=2),s.type===t.FLOAT_MAT3&&(h=3),s.type===t.FLOAT_MAT4&&(h=4),n[c]={type:s.type,location:t.getAttribLocation(r,c),locationSize:h}}return n}(c,M)}c.attachShader(M,U),c.attachShader(M,I),void 0!==r.index0AttributeName?c.bindAttribLocation(M,0,r.index0AttributeName):!0===r.morphTargets&&c.bindAttribLocation(M,0,"position"),c.linkProgram(M);let O;this.getUniforms=function(){return void 0===O&&N(this),O};let F;this.getAttributes=function(){return void 0===F&&N(this),F};let B=!1===r.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===B&&(B=c.getProgramParameter(M,37297)),B},this.destroy=function(){n.releaseStatesOfProgram(this),c.deleteProgram(M),this.program=void 0},this.type=r.shaderType,this.name=r.shaderName,this.id=dq++,this.cacheKey=t,this.usedTimes=1,this.program=M,this.vertexShader=U,this.fragmentShader=I,this}let po=0;class ps{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,r=e.fragmentShader,n=this._getShaderStage(t),a=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return!1===o.has(n)&&(o.add(n),n.usedTimes++),!1===o.has(a)&&(o.add(a),a.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let r of t)r.usedTimes--,0===r.usedTimes&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,r=t.get(e);return void 0===r&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){let t=this.shaderCache,r=t.get(e);return void 0===r&&(r=new pl(e),t.set(e,r)),r}}class pl{constructor(e){this.id=po++,this.code=e,this.usedTimes=0}}function pu(e,t,r,n,a,o,s){let c=new s6,h=new ps,d=[],p=a.isWebGL2,f=a.logarithmicDepthBuffer,m=a.vertexTextures,$=a.precision,x={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 y(e){return 0===e?"uv":`uv${e}`}return{getParameters:function o(c,d,S,E,_){let T=E.fog,M=_.geometry,A=c.isMeshStandardMaterial?E.environment:null,C=(c.isMeshStandardMaterial?r:t).get(c.envMap||A),R=C&&306===C.mapping?C.image.height:null,P=x[c.type];null!==c.precision&&($=a.getMaxPrecision(c.precision))!==c.precision&&console.warn("THREE.WebGLProgram.getParameters:",c.precision,"not supported, using",$,"instead.");let D=M.morphAttributes.position||M.morphAttributes.normal||M.morphAttributes.color,U=void 0!==D?D.length:0,I=0;void 0!==M.morphAttributes.position&&(I=1),void 0!==M.morphAttributes.normal&&(I=2),void 0!==M.morphAttributes.color&&(I=3);let N,O,F,B;if(P){let z=hw[P];N=z.vertexShader,O=z.fragmentShader}else N=c.vertexShader,O=c.fragmentShader,h.update(c),F=h.getVertexShaderID(c),B=h.getFragmentShaderID(c);let k=e.getRenderTarget(),H=!0===_.isInstancedMesh,V=!!c.map,G=!!c.matcap,W=!!C,X=!!c.aoMap,q=!!c.lightMap,Y=!!c.bumpMap,j=!!c.normalMap,Z=!!c.displacementMap,K=!!c.emissiveMap,J=!!c.metalnessMap,Q=!!c.roughnessMap,et=c.anisotropy>0,ei=c.clearcoat>0,er=c.iridescence>0,en=c.sheen>0,ea=c.transmission>0,eo=et&&!!c.anisotropyMap,es=ei&&!!c.clearcoatMap,el=ei&&!!c.clearcoatNormalMap,eu=ei&&!!c.clearcoatRoughnessMap,ec=er&&!!c.iridescenceMap,eh=er&&!!c.iridescenceThicknessMap,ed=en&&!!c.sheenColorMap,ep=en&&!!c.sheenRoughnessMap,ef=!!c.specularMap,em=!!c.specularColorMap,eg=!!c.specularIntensityMap,e8=ea&&!!c.transmissionMap,e$=ea&&!!c.thicknessMap,ev=!!c.gradientMap,ex=!!c.alphaMap,ey=c.alphaTest>0,eS=!!c.alphaHash,eE=!!c.extensions,eb=!!M.attributes.uv1,e_=!!M.attributes.uv2,eT=!!M.attributes.uv3,eM=ob;return c.toneMapped&&(null===k||!0===k.isXRRenderTarget)&&(eM=e.toneMapping),{isWebGL2:p,shaderID:P,shaderType:c.type,shaderName:c.name,vertexShader:N,fragmentShader:O,defines:c.defines,customVertexShaderID:F,customFragmentShaderID:B,isRawShaderMaterial:!0===c.isRawShaderMaterial,glslVersion:c.glslVersion,precision:$,instancing:H,instancingColor:H&&null!==_.instanceColor,supportsVertexTextures:m,outputColorSpace:null===k?e.outputColorSpace:!0===k.isXRRenderTarget?k.texture.colorSpace:oT,map:V,matcap:G,envMap:W,envMapMode:W&&C.mapping,envMapCubeUVHeight:R,aoMap:X,lightMap:q,bumpMap:Y,normalMap:j,displacementMap:m&&Z,emissiveMap:K,normalMapObjectSpace:j&&1===c.normalMapType,normalMapTangentSpace:j&&0===c.normalMapType,metalnessMap:J,roughnessMap:Q,anisotropy:et,anisotropyMap:eo,clearcoat:ei,clearcoatMap:es,clearcoatNormalMap:el,clearcoatRoughnessMap:eu,iridescence:er,iridescenceMap:ec,iridescenceThicknessMap:eh,sheen:en,sheenColorMap:ed,sheenRoughnessMap:ep,specularMap:ef,specularColorMap:em,specularIntensityMap:eg,transmission:ea,transmissionMap:e8,thicknessMap:e$,gradientMap:ev,opaque:!1===c.transparent&&1===c.blending,alphaMap:ex,alphaTest:ey,alphaHash:eS,combine:c.combine,mapUv:V&&y(c.map.channel),aoMapUv:X&&y(c.aoMap.channel),lightMapUv:q&&y(c.lightMap.channel),bumpMapUv:Y&&y(c.bumpMap.channel),normalMapUv:j&&y(c.normalMap.channel),displacementMapUv:Z&&y(c.displacementMap.channel),emissiveMapUv:K&&y(c.emissiveMap.channel),metalnessMapUv:J&&y(c.metalnessMap.channel),roughnessMapUv:Q&&y(c.roughnessMap.channel),anisotropyMapUv:eo&&y(c.anisotropyMap.channel),clearcoatMapUv:es&&y(c.clearcoatMap.channel),clearcoatNormalMapUv:el&&y(c.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:eu&&y(c.clearcoatRoughnessMap.channel),iridescenceMapUv:ec&&y(c.iridescenceMap.channel),iridescenceThicknessMapUv:eh&&y(c.iridescenceThicknessMap.channel),sheenColorMapUv:ed&&y(c.sheenColorMap.channel),sheenRoughnessMapUv:ep&&y(c.sheenRoughnessMap.channel),specularMapUv:ef&&y(c.specularMap.channel),specularColorMapUv:em&&y(c.specularColorMap.channel),specularIntensityMapUv:eg&&y(c.specularIntensityMap.channel),transmissionMapUv:e8&&y(c.transmissionMap.channel),thicknessMapUv:e$&&y(c.thicknessMap.channel),alphaMapUv:ex&&y(c.alphaMap.channel),vertexTangents:!!M.attributes.tangent&&(j||et),vertexColors:c.vertexColors,vertexAlphas:!0===c.vertexColors&&!!M.attributes.color&&4===M.attributes.color.itemSize,vertexUv1s:eb,vertexUv2s:e_,vertexUv3s:eT,pointsUvs:!0===_.isPoints&&!!M.attributes.uv&&(V||ex),fog:!!T,useFog:!0===c.fog,fogExp2:T&&T.isFogExp2,flatShading:!0===c.flatShading,sizeAttenuation:!0===c.sizeAttenuation,logarithmicDepthBuffer:f,skinning:!0===_.isSkinnedMesh,morphTargets:void 0!==M.morphAttributes.position,morphNormals:void 0!==M.morphAttributes.normal,morphColors:void 0!==M.morphAttributes.color,morphTargetsCount:U,morphTextureStride:I,numDirLights:d.directional.length,numPointLights:d.point.length,numSpotLights:d.spot.length,numSpotLightMaps:d.spotLightMap.length,numRectAreaLights:d.rectArea.length,numHemiLights:d.hemi.length,numDirLightShadows:d.directionalShadowMap.length,numPointLightShadows:d.pointShadowMap.length,numSpotLightShadows:d.spotShadowMap.length,numSpotLightShadowsWithMaps:d.numSpotLightShadowsWithMaps,numLightProbes:d.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:c.dithering,shadowMapEnabled:e.shadowMap.enabled&&S.length>0,shadowMapType:e.shadowMap.type,toneMapping:eM,useLegacyLights:e._useLegacyLights,decodeVideoTexture:V&&!0===c.map.isVideoTexture&&oK.getTransfer(c.map.colorSpace)===oC,premultipliedAlpha:c.premultipliedAlpha,doubleSided:2===c.side,flipSided:1===c.side,useDepthPacking:c.depthPacking>=0,depthPacking:c.depthPacking||0,index0AttributeName:c.index0AttributeName,extensionDerivatives:eE&&!0===c.extensions.derivatives,extensionFragDepth:eE&&!0===c.extensions.fragDepth,extensionDrawBuffers:eE&&!0===c.extensions.drawBuffers,extensionShaderTextureLOD:eE&&!0===c.extensions.shaderTextureLOD,rendererExtensionFragDepth:p||n.has("EXT_frag_depth"),rendererExtensionDrawBuffers:p||n.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:p||n.has("EXT_shader_texture_lod"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:c.customProgramCacheKey()}},getProgramCacheKey:function t(r){var n,a,o,s;let h=[];if(r.shaderID?h.push(r.shaderID):(h.push(r.customVertexShaderID),h.push(r.customFragmentShaderID)),void 0!==r.defines)for(let d in r.defines)h.push(d),h.push(r.defines[d]);return!1===r.isRawShaderMaterial&&(n=h,a=r,n.push(a.precision),n.push(a.outputColorSpace),n.push(a.envMapMode),n.push(a.envMapCubeUVHeight),n.push(a.mapUv),n.push(a.alphaMapUv),n.push(a.lightMapUv),n.push(a.aoMapUv),n.push(a.bumpMapUv),n.push(a.normalMapUv),n.push(a.displacementMapUv),n.push(a.emissiveMapUv),n.push(a.metalnessMapUv),n.push(a.roughnessMapUv),n.push(a.anisotropyMapUv),n.push(a.clearcoatMapUv),n.push(a.clearcoatNormalMapUv),n.push(a.clearcoatRoughnessMapUv),n.push(a.iridescenceMapUv),n.push(a.iridescenceThicknessMapUv),n.push(a.sheenColorMapUv),n.push(a.sheenRoughnessMapUv),n.push(a.specularMapUv),n.push(a.specularColorMapUv),n.push(a.specularIntensityMapUv),n.push(a.transmissionMapUv),n.push(a.thicknessMapUv),n.push(a.combine),n.push(a.fogExp2),n.push(a.sizeAttenuation),n.push(a.morphTargetsCount),n.push(a.morphAttributeCount),n.push(a.numDirLights),n.push(a.numPointLights),n.push(a.numSpotLights),n.push(a.numSpotLightMaps),n.push(a.numHemiLights),n.push(a.numRectAreaLights),n.push(a.numDirLightShadows),n.push(a.numPointLightShadows),n.push(a.numSpotLightShadows),n.push(a.numSpotLightShadowsWithMaps),n.push(a.numLightProbes),n.push(a.shadowMapType),n.push(a.toneMapping),n.push(a.numClippingPlanes),n.push(a.numClipIntersection),n.push(a.depthPacking),o=h,s=r,c.disableAll(),s.isWebGL2&&c.enable(0),s.supportsVertexTextures&&c.enable(1),s.instancing&&c.enable(2),s.instancingColor&&c.enable(3),s.matcap&&c.enable(4),s.envMap&&c.enable(5),s.normalMapObjectSpace&&c.enable(6),s.normalMapTangentSpace&&c.enable(7),s.clearcoat&&c.enable(8),s.iridescence&&c.enable(9),s.alphaTest&&c.enable(10),s.vertexColors&&c.enable(11),s.vertexAlphas&&c.enable(12),s.vertexUv1s&&c.enable(13),s.vertexUv2s&&c.enable(14),s.vertexUv3s&&c.enable(15),s.vertexTangents&&c.enable(16),s.anisotropy&&c.enable(17),s.alphaHash&&c.enable(18),o.push(c.mask),c.disableAll(),s.fog&&c.enable(0),s.useFog&&c.enable(1),s.flatShading&&c.enable(2),s.logarithmicDepthBuffer&&c.enable(3),s.skinning&&c.enable(4),s.morphTargets&&c.enable(5),s.morphNormals&&c.enable(6),s.morphColors&&c.enable(7),s.premultipliedAlpha&&c.enable(8),s.shadowMapEnabled&&c.enable(9),s.useLegacyLights&&c.enable(10),s.doubleSided&&c.enable(11),s.flipSided&&c.enable(12),s.useDepthPacking&&c.enable(13),s.dithering&&c.enable(14),s.transmission&&c.enable(15),s.sheen&&c.enable(16),s.opaque&&c.enable(17),s.pointsUvs&&c.enable(18),s.decodeVideoTexture&&c.enable(19),o.push(c.mask),h.push(e.outputColorSpace)),h.push(r.customProgramCacheKey),h.join()},getUniforms:function e(t){let r=x[t.type],n;if(r){let a=hw[r];n=lJ.clone(a.uniforms)}else n=t.uniforms;return n},acquireProgram:function t(r,n){let a;for(let s=0,c=d.length;s<c;s++){let h=d[s];if(h.cacheKey===n){a=h,++a.usedTimes;break}}return void 0===a&&(a=new pa(e,n,r,o),d.push(a)),a},releaseProgram:function e(t){if(0==--t.usedTimes){let r=d.indexOf(t);d[r]=d[d.length-1],d.pop(),t.destroy()}},releaseShaderCache:function e(t){h.remove(t)},programs:d,dispose:function e(){h.dispose()}}}function pc(){let e=new WeakMap;return{get:function t(r){let n=e.get(r);return void 0===n&&(n={},e.set(r,n)),n},remove:function t(r){e.delete(r)},update:function t(r,n,a){e.get(r)[n]=a},dispose:function t(){e=new WeakMap}}}function ph(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function pd(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function pp(){let e=[],t=0,r=[],n=[],a=[];function o(r,n,a,o,s,c){let h=e[t];return void 0===h?(h={id:r.id,object:r,geometry:n,material:a,groupOrder:o,renderOrder:r.renderOrder,z:s,group:c},e[t]=h):(h.id=r.id,h.object=r,h.geometry=n,h.material=a,h.groupOrder=o,h.renderOrder=r.renderOrder,h.z=s,h.group=c),t++,h}return{opaque:r,transmissive:n,transparent:a,init:function e(){t=0,r.length=0,n.length=0,a.length=0},push:function e(t,s,c,h,d,p){let f=o(t,s,c,h,d,p);c.transmission>0?n.push(f):!0===c.transparent?a.push(f):r.push(f)},unshift:function e(t,s,c,h,d,p){let f=o(t,s,c,h,d,p);c.transmission>0?n.unshift(f):!0===c.transparent?a.unshift(f):r.unshift(f)},finish:function r(){for(let n=t,a=e.length;n<a;n++){let o=e[n];if(null===o.id)break;o.id=null,o.object=null,o.geometry=null,o.material=null,o.group=null}},sort:function e(t,o){r.length>1&&r.sort(t||ph),n.length>1&&n.sort(o||pd),a.length>1&&a.sort(o||pd)}}}function pf(){let e=new WeakMap;return{get:function t(r,n){let a=e.get(r),o;return void 0===a?(o=new pp,e.set(r,[o])):n>=a.length?(o=new pp,a.push(o)):o=a[n],o},dispose:function t(){e=new WeakMap}}}function pm(){let e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let r;switch(t.type){case"DirectionalLight":r={direction:new sh,color:new lv};break;case"SpotLight":r={position:new sh,direction:new sh,color:new lv,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new sh,color:new lv,distance:0,decay:0};break;case"HemisphereLight":r={direction:new sh,skyColor:new lv,groundColor:new lv};break;case"RectAreaLight":r={color:new lv,position:new sh,halfWidth:new sh,halfHeight:new sh}}return e[t.id]=r,r}}}let pg=0;function p8(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function p$(e,t){let r=new pm,n=function e(){let t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let r;switch(e.type){case"DirectionalLight":case"SpotLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new oG};break;case"PointLight":r={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new oG,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=r,r}}}(),a={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 o=0;o<9;o++)a.probe.push(new sh);let s=new sh,c=new sF,h=new sF;return{setup:function o(s,c){let h=0,d=0,p=0;for(let f=0;f<9;f++)a.probe[f].set(0,0,0);let m=0,$=0,x=0,y=0,S=0,E=0,_=0,T=0,M=0,A=0,C=0;s.sort(p8);let R=!0===c?Math.PI:1;for(let P=0,D=s.length;P<D;P++){let U=s[P],I=U.color,N=U.intensity,O=U.distance,F=U.shadow&&U.shadow.map?U.shadow.map.texture:null;if(U.isAmbientLight)h+=I.r*N*R,d+=I.g*N*R,p+=I.b*N*R;else if(U.isLightProbe){for(let B=0;B<9;B++)a.probe[B].addScaledVector(U.sh.coefficients[B],N);C++}else if(U.isDirectionalLight){let z=r.get(U);if(z.color.copy(U.color).multiplyScalar(U.intensity*R),U.castShadow){let k=U.shadow,H=n.get(U);H.shadowBias=k.bias,H.shadowNormalBias=k.normalBias,H.shadowRadius=k.radius,H.shadowMapSize=k.mapSize,a.directionalShadow[m]=H,a.directionalShadowMap[m]=F,a.directionalShadowMatrix[m]=U.shadow.matrix,E++}a.directional[m]=z,m++}else if(U.isSpotLight){let V=r.get(U);V.position.setFromMatrixPosition(U.matrixWorld),V.color.copy(I).multiplyScalar(N*R),V.distance=O,V.coneCos=Math.cos(U.angle),V.penumbraCos=Math.cos(U.angle*(1-U.penumbra)),V.decay=U.decay,a.spot[x]=V;let G=U.shadow;if(U.map&&(a.spotLightMap[M]=U.map,M++,G.updateMatrices(U),U.castShadow&&A++),a.spotLightMatrix[x]=G.matrix,U.castShadow){let W=n.get(U);W.shadowBias=G.bias,W.shadowNormalBias=G.normalBias,W.shadowRadius=G.radius,W.shadowMapSize=G.mapSize,a.spotShadow[x]=W,a.spotShadowMap[x]=F,T++}x++}else if(U.isRectAreaLight){let X=r.get(U);X.color.copy(I).multiplyScalar(N),X.halfWidth.set(.5*U.width,0,0),X.halfHeight.set(0,.5*U.height,0),a.rectArea[y]=X,y++}else if(U.isPointLight){let q=r.get(U);if(q.color.copy(U.color).multiplyScalar(U.intensity*R),q.distance=U.distance,q.decay=U.decay,U.castShadow){let Y=U.shadow,j=n.get(U);j.shadowBias=Y.bias,j.shadowNormalBias=Y.normalBias,j.shadowRadius=Y.radius,j.shadowMapSize=Y.mapSize,j.shadowCameraNear=Y.camera.near,j.shadowCameraFar=Y.camera.far,a.pointShadow[$]=j,a.pointShadowMap[$]=F,a.pointShadowMatrix[$]=U.shadow.matrix,_++}a.point[$]=q,$++}else if(U.isHemisphereLight){let Z=r.get(U);Z.skyColor.copy(U.color).multiplyScalar(N*R),Z.groundColor.copy(U.groundColor).multiplyScalar(N*R),a.hemi[S]=Z,S++}}y>0&&(t.isWebGL2||!0===e.has("OES_texture_float_linear")?(a.rectAreaLTC1=hM.LTC_FLOAT_1,a.rectAreaLTC2=hM.LTC_FLOAT_2):!0===e.has("OES_texture_half_float_linear")?(a.rectAreaLTC1=hM.LTC_HALF_1,a.rectAreaLTC2=hM.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),a.ambient[0]=h,a.ambient[1]=d,a.ambient[2]=p;let K=a.hash;(K.directionalLength!==m||K.pointLength!==$||K.spotLength!==x||K.rectAreaLength!==y||K.hemiLength!==S||K.numDirectionalShadows!==E||K.numPointShadows!==_||K.numSpotShadows!==T||K.numSpotMaps!==M||K.numLightProbes!==C)&&(a.directional.length=m,a.spot.length=x,a.rectArea.length=y,a.point.length=$,a.hemi.length=S,a.directionalShadow.length=E,a.directionalShadowMap.length=E,a.pointShadow.length=_,a.pointShadowMap.length=_,a.spotShadow.length=T,a.spotShadowMap.length=T,a.directionalShadowMatrix.length=E,a.pointShadowMatrix.length=_,a.spotLightMatrix.length=T+M-A,a.spotLightMap.length=M,a.numSpotLightShadowsWithMaps=A,a.numLightProbes=C,K.directionalLength=m,K.pointLength=$,K.spotLength=x,K.rectAreaLength=y,K.hemiLength=S,K.numDirectionalShadows=E,K.numPointShadows=_,K.numSpotShadows=T,K.numSpotMaps=M,K.numLightProbes=C,a.version=pg++)},setupView:function e(t,r){let n=0,o=0,d=0,p=0,f=0,m=r.matrixWorldInverse;for(let $=0,x=t.length;$<x;$++){let y=t[$];if(y.isDirectionalLight){let S=a.directional[n];S.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),S.direction.sub(s),S.direction.transformDirection(m),n++}else if(y.isSpotLight){let E=a.spot[d];E.position.setFromMatrixPosition(y.matrixWorld),E.position.applyMatrix4(m),E.direction.setFromMatrixPosition(y.matrixWorld),s.setFromMatrixPosition(y.target.matrixWorld),E.direction.sub(s),E.direction.transformDirection(m),d++}else if(y.isRectAreaLight){let _=a.rectArea[p];_.position.setFromMatrixPosition(y.matrixWorld),_.position.applyMatrix4(m),h.identity(),c.copy(y.matrixWorld),c.premultiply(m),h.extractRotation(c),_.halfWidth.set(.5*y.width,0,0),_.halfHeight.set(0,.5*y.height,0),_.halfWidth.applyMatrix4(h),_.halfHeight.applyMatrix4(h),p++}else if(y.isPointLight){let T=a.point[o];T.position.setFromMatrixPosition(y.matrixWorld),T.position.applyMatrix4(m),o++}else if(y.isHemisphereLight){let M=a.hemi[f];M.direction.setFromMatrixPosition(y.matrixWorld),M.direction.transformDirection(m),f++}}},state:a}}function pv(e,t){let r=new p$(e,t),n=[],a=[];return{init:function e(){n.length=0,a.length=0},state:{lightsArray:n,shadowsArray:a,lights:r},setupLights:function e(t){r.setup(n,t)},setupLightsView:function e(t){r.setupView(n,t)},pushLight:function e(t){n.push(t)},pushShadow:function e(t){a.push(t)}}}function px(e,t){let r=new WeakMap;return{get:function n(a,o=0){let s=r.get(a),c;return void 0===s?(c=new pv(e,t),r.set(a,[c])):o>=s.length?(c=new pv(e,t),s.push(c)):c=s[o],c},dispose:function e(){r=new WeakMap}}}class py extends lS{constructor(e){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(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class pS extends lS{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}let pE=`void main() {
	   gl_Position = vec4( position, 1.0 );
   }`,pb=`uniform sampler2D shadow_pass;
   uniform vec2 resolution;
   uniform float radius;
   #include <packing>
   void main() {
	   const float samples = float( VSM_SAMPLES );
	   float mean = 0.0;
	   float squared_mean = 0.0;
	   float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	   float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
	   for ( float i = 0.0; i < samples; i ++ ) {
		   float uvOffset = uvStart + i * uvStride;
		   #ifdef HORIZONTAL_PASS
			   vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
			   mean += distribution.x;
			   squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		   #else
			   float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
			   mean += depth;
			   squared_mean += depth * depth;
		   #endif
	   }
	   mean = mean / samples;
	   squared_mean = squared_mean / samples;
	   float std_dev = sqrt( squared_mean - mean * mean );
	   gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
   }`;function p_(e,t,r){let n=new ud,a=new oG,o=new oG,s=new so,c=new py({depthPacking:3201}),h=new pS,d={},p=r.maxTextureSize,f={0:1,1:0,2:2},m=new ue({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new oG},radius:{value:4}},vertexShader:pE,fragmentShader:pb}),$=m.clone();$.defines.HORIZONTAL_PASS=1;let x=new lU;x.setAttribute("position",new lT(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let y=new lX(x,m),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let E=this.type;function _(r,n){let o=t.update(y);m.defines.VSM_SAMPLES!==r.blurSamples&&(m.defines.VSM_SAMPLES=r.blurSamples,$.defines.VSM_SAMPLES=r.blurSamples,m.needsUpdate=!0,$.needsUpdate=!0),null===r.mapPass&&(r.mapPass=new sl(a.x,a.y)),m.uniforms.shadow_pass.value=r.map.texture,m.uniforms.resolution.value=r.mapSize,m.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(n,null,o,m,y,null),$.uniforms.shadow_pass.value=r.mapPass.texture,$.uniforms.resolution.value=r.mapSize,$.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(n,null,o,$,y,null)}function T(t,r,n,a){let o=null,s=!0===n.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)o=s;else if(o=!0===n.isPointLight?h:c,e.localClippingEnabled&&!0===r.clipShadows&&Array.isArray(r.clippingPlanes)&&0!==r.clippingPlanes.length||r.displacementMap&&0!==r.displacementScale||r.alphaMap&&r.alphaTest>0||r.map&&r.alphaTest>0){let p=o.uuid,m=r.uuid,$=d[p];void 0===$&&($={},d[p]=$);let x=$[m];void 0===x&&(x=o.clone(),$[m]=x),o=x}if(o.visible=r.visible,o.wireframe=r.wireframe,3===a?o.side=null!==r.shadowSide?r.shadowSide:r.side:o.side=null!==r.shadowSide?r.shadowSide:f[r.side],o.alphaMap=r.alphaMap,o.alphaTest=r.alphaTest,o.map=r.map,o.clipShadows=r.clipShadows,o.clippingPlanes=r.clippingPlanes,o.clipIntersection=r.clipIntersection,o.displacementMap=r.displacementMap,o.displacementScale=r.displacementScale,o.displacementBias=r.displacementBias,o.wireframeLinewidth=r.wireframeLinewidth,o.linewidth=r.linewidth,!0===n.isPointLight&&!0===o.isMeshDistanceMaterial){let y=e.properties.get(o);y.light=n}return o}function M(r,a,o,s,c){if(!1===r.visible)return;if(r.layers.test(a.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&3===c)&&(!r.frustumCulled||n.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(o.matrixWorldInverse,r.matrixWorld);let h=t.update(r),d=r.material;if(Array.isArray(d)){let p=h.groups;for(let f=0,m=p.length;f<m;f++){let $=p[f],x=d[$.materialIndex];if(x&&x.visible){let y=T(r,x,s,c);e.renderBufferDirect(o,null,h,y,r,$)}}}else if(d.visible){let S=T(r,d,s,c);e.renderBufferDirect(o,null,h,S,r,null)}}let E=r.children;for(let _=0,A=E.length;_<A;_++)M(E[_],a,o,s,c)}this.render=function(t,r,c){if(!1===S.enabled||!1===S.autoUpdate&&!1===S.needsUpdate||0===t.length)return;let h=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),m=e.state;m.setBlending(0),m.buffers.color.setClear(1,1,1,1),m.buffers.depth.setTest(!0),m.setScissorTest(!1);let $=3!==E&&3===this.type,x=3===E&&3!==this.type;for(let y=0,T=t.length;y<T;y++){let A=t[y],C=A.shadow;if(void 0===C){console.warn("THREE.WebGLShadowMap:",A,"has no shadow.");continue}if(!1===C.autoUpdate&&!1===C.needsUpdate)continue;a.copy(C.mapSize);let R=C.getFrameExtents();if(a.multiply(R),o.copy(C.mapSize),(a.x>p||a.y>p)&&(a.x>p&&(o.x=Math.floor(p/R.x),a.x=o.x*R.x,C.mapSize.x=o.x),a.y>p&&(o.y=Math.floor(p/R.y),a.y=o.y*R.y,C.mapSize.y=o.y)),null===C.map||!0===$||!0===x){let P=3!==this.type?{minFilter:1003,magFilter:1003}:{};null!==C.map&&C.map.dispose(),C.map=new sl(a.x,a.y,P),C.map.texture.name=A.name+".shadowMap",C.camera.updateProjectionMatrix()}e.setRenderTarget(C.map),e.clear();let D=C.getViewportCount();for(let U=0;U<D;U++){let I=C.getViewport(U);s.set(o.x*I.x,o.y*I.y,o.x*I.z,o.y*I.w),m.viewport(s),C.updateMatrices(A,U),n=C.getFrustum(),M(r,c,C.camera,A,this.type)}!0!==C.isPointLightShadow&&3===this.type&&_(C,c),C.needsUpdate=!1}E=this.type,S.needsUpdate=!1,e.setRenderTarget(h,d,f)}}function pT(e,t,r){let n=r.isWebGL2,a=new function t(){let r=!1,n=new so,a=null,o=new so(0,0,0,0);return{setMask:function(t){a===t||r||(e.colorMask(t,t,t,t),a=t)},setLocked:function(e){r=e},setClear:function(t,r,a,s,c){!0===c&&(t*=s,r*=s,a*=s),n.set(t,r,a,s),!1===o.equals(n)&&(e.clearColor(t,r,a,s),o.copy(n))},reset:function(){r=!1,a=null,o.set(-1,0,0,0)}}},o=new function t(){let r=!1,n=null,a=null,o=null;return{setTest:function(t){t?Z(e.DEPTH_TEST):K(e.DEPTH_TEST)},setMask:function(t){n===t||r||(e.depthMask(t),n=t)},setFunc:function(t){if(a!==t){switch(t){case 0:e.depthFunc(e.NEVER);break;case 1:e.depthFunc(e.ALWAYS);break;case 2:e.depthFunc(e.LESS);break;case 3:default:e.depthFunc(e.LEQUAL);break;case 4:e.depthFunc(e.EQUAL);break;case 5:e.depthFunc(e.GEQUAL);break;case 6:e.depthFunc(e.GREATER);break;case 7:e.depthFunc(e.NOTEQUAL)}a=t}},setLocked:function(e){r=e},setClear:function(t){o!==t&&(e.clearDepth(t),o=t)},reset:function(){r=!1,n=null,a=null,o=null}}},s=new function t(){let r=!1,n=null,a=null,o=null,s=null,c=null,h=null,d=null,p=null;return{setTest:function(t){r||(t?Z(e.STENCIL_TEST):K(e.STENCIL_TEST))},setMask:function(t){n===t||r||(e.stencilMask(t),n=t)},setFunc:function(t,r,n){(a!==t||o!==r||s!==n)&&(e.stencilFunc(t,r,n),a=t,o=r,s=n)},setOp:function(t,r,n){(c!==t||h!==r||d!==n)&&(e.stencilOp(t,r,n),c=t,h=r,d=n)},setLocked:function(e){r=e},setClear:function(t){p!==t&&(e.clearStencil(t),p=t)},reset:function(){r=!1,n=null,a=null,o=null,s=null,c=null,h=null,d=null,p=null}}},c=new WeakMap,h=new WeakMap,d={},p={},f=new WeakMap,m=[],$=null,x=!1,y=null,S=null,E=null,_=null,T=null,M=null,A=null,C=new lv(0,0,0),R=0,P=!1,D=null,U=null,I=null,N=null,O=null,F=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS),B=!1,z=0,k=e.getParameter(e.VERSION);-1!==k.indexOf("WebGL")?B=(z=parseFloat(/^WebGL (\d)/.exec(k)[1]))>=1:-1!==k.indexOf("OpenGL ES")&&(B=(z=parseFloat(/^OpenGL ES (\d)/.exec(k)[1]))>=2);let H=null,V={},G=e.getParameter(e.SCISSOR_BOX),W=e.getParameter(e.VIEWPORT),X=new so().fromArray(G),q=new so().fromArray(W);function Y(t,r,a,o){let s=new Uint8Array(4),c=e.createTexture();e.bindTexture(t,c),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let h=0;h<a;h++)n&&(t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY)?e.texImage3D(r,0,e.RGBA,1,1,o,0,e.RGBA,e.UNSIGNED_BYTE,s):e.texImage2D(r+h,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,s);return c}let j={};function Z(t){!0!==d[t]&&(e.enable(t),d[t]=!0)}function K(t){!1!==d[t]&&(e.disable(t),d[t]=!1)}j[e.TEXTURE_2D]=Y(e.TEXTURE_2D,e.TEXTURE_2D,1),j[e.TEXTURE_CUBE_MAP]=Y(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),n&&(j[e.TEXTURE_2D_ARRAY]=Y(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),j[e.TEXTURE_3D]=Y(e.TEXTURE_3D,e.TEXTURE_3D,1,1)),a.setClear(0,0,0,1),o.setClear(1),s.setClear(0),Z(e.DEPTH_TEST),o.setFunc(3),er(!1),en(1),Z(e.CULL_FACE),ei(0);let J={100:e.FUNC_ADD,101:e.FUNC_SUBTRACT,102:e.FUNC_REVERSE_SUBTRACT};if(n)J[103]=e.MIN,J[104]=e.MAX;else{let Q=t.get("EXT_blend_minmax");null!==Q&&(J[103]=Q.MIN_EXT,J[104]=Q.MAX_EXT)}let et={200:e.ZERO,201:e.ONE,202:e.SRC_COLOR,204:e.SRC_ALPHA,210:e.SRC_ALPHA_SATURATE,208:e.DST_COLOR,206:e.DST_ALPHA,203:e.ONE_MINUS_SRC_COLOR,205:e.ONE_MINUS_SRC_ALPHA,209:e.ONE_MINUS_DST_COLOR,207:e.ONE_MINUS_DST_ALPHA,211:e.CONSTANT_COLOR,212:e.ONE_MINUS_CONSTANT_COLOR,213:e.CONSTANT_ALPHA,214:e.ONE_MINUS_CONSTANT_ALPHA};function ei(t,r,n,a,o,s,c,h,d,p){if(0===t){!0===x&&(K(e.BLEND),x=!1);return}if(!1===x&&(Z(e.BLEND),x=!0),5!==t){if(t!==y||p!==P){if((100!==S||100!==T)&&(e.blendEquation(e.FUNC_ADD),S=100,T=100),p)switch(t){case 1:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.ONE,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case 1:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case 2:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case 3:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case 4:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:console.error("THREE.WebGLState: Invalid blending: ",t)}E=null,_=null,M=null,A=null,C.set(0,0,0),R=0,y=t,P=p}return}o=o||r,s=s||n,c=c||a,(r!==S||o!==T)&&(e.blendEquationSeparate(J[r],J[o]),S=r,T=o),(n!==E||a!==_||s!==M||c!==A)&&(e.blendFuncSeparate(et[n],et[a],et[s],et[c]),E=n,_=a,M=s,A=c),(!1===h.equals(C)||d!==R)&&(e.blendColor(h.r,h.g,h.b,d),C.copy(h),R=d),y=t,P=!1}function er(t){D!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),D=t)}function en(t){0!==t?(Z(e.CULL_FACE),t!==U&&(1===t?e.cullFace(e.BACK):2===t?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):K(e.CULL_FACE),U=t}function ea(t,r,n){t?(Z(e.POLYGON_OFFSET_FILL),(N!==r||O!==n)&&(e.polygonOffset(r,n),N=r,O=n)):K(e.POLYGON_OFFSET_FILL)}return{buffers:{color:a,depth:o,stencil:s},enable:Z,disable:K,bindFramebuffer:function t(r,a){return p[r]!==a&&(e.bindFramebuffer(r,a),p[r]=a,n&&(r===e.DRAW_FRAMEBUFFER&&(p[e.FRAMEBUFFER]=a),r===e.FRAMEBUFFER&&(p[e.DRAW_FRAMEBUFFER]=a)),!0)},drawBuffers:function n(a,o){let s=m,c=!1;if(a){if(void 0===(s=f.get(o))&&(s=[],f.set(o,s)),a.isWebGLMultipleRenderTargets){let h=a.texture;if(s.length!==h.length||s[0]!==e.COLOR_ATTACHMENT0){for(let d=0,p=h.length;d<p;d++)s[d]=e.COLOR_ATTACHMENT0+d;s.length=h.length,c=!0}}else s[0]!==e.COLOR_ATTACHMENT0&&(s[0]=e.COLOR_ATTACHMENT0,c=!0)}else s[0]!==e.BACK&&(s[0]=e.BACK,c=!0);c&&(r.isWebGL2?e.drawBuffers(s):t.get("WEBGL_draw_buffers").drawBuffersWEBGL(s))},useProgram:function t(r){return $!==r&&(e.useProgram(r),$=r,!0)},setBlending:ei,setMaterial:function t(r,n){2===r.side?K(e.CULL_FACE):Z(e.CULL_FACE);let c=1===r.side;n&&(c=!c),er(c),1===r.blending&&!1===r.transparent?ei(0):ei(r.blending,r.blendEquation,r.blendSrc,r.blendDst,r.blendEquationAlpha,r.blendSrcAlpha,r.blendDstAlpha,r.blendColor,r.blendAlpha,r.premultipliedAlpha),o.setFunc(r.depthFunc),o.setTest(r.depthTest),o.setMask(r.depthWrite),a.setMask(r.colorWrite);let h=r.stencilWrite;s.setTest(h),h&&(s.setMask(r.stencilWriteMask),s.setFunc(r.stencilFunc,r.stencilRef,r.stencilFuncMask),s.setOp(r.stencilFail,r.stencilZFail,r.stencilZPass)),ea(r.polygonOffset,r.polygonOffsetFactor,r.polygonOffsetUnits),!0===r.alphaToCoverage?Z(e.SAMPLE_ALPHA_TO_COVERAGE):K(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:er,setCullFace:en,setLineWidth:function t(r){r!==I&&(B&&e.lineWidth(r),I=r)},setPolygonOffset:ea,setScissorTest:function t(r){r?Z(e.SCISSOR_TEST):K(e.SCISSOR_TEST)},activeTexture:function t(r){void 0===r&&(r=e.TEXTURE0+F-1),H!==r&&(e.activeTexture(r),H=r)},bindTexture:function t(r,n,a){void 0===a&&(a=null===H?e.TEXTURE0+F-1:H);let o=V[a];void 0===o&&(o={type:void 0,texture:void 0},V[a]=o),(o.type!==r||o.texture!==n)&&(H!==a&&(e.activeTexture(a),H=a),e.bindTexture(r,n||j[r]),o.type=r,o.texture=n)},unbindTexture:function t(){let r=V[H];void 0!==r&&void 0!==r.type&&(e.bindTexture(r.type,null),r.type=void 0,r.texture=void 0)},compressedTexImage2D:function t(){try{e.compressedTexImage2D.apply(e,arguments)}catch(r){console.error("THREE.WebGLState:",r)}},compressedTexImage3D:function t(){try{e.compressedTexImage3D.apply(e,arguments)}catch(r){console.error("THREE.WebGLState:",r)}},texImage2D:function t(){try{e.texImage2D.apply(e,arguments)}catch(r){console.error("THREE.WebGLState:",r)}},texImage3D:function t(){try{e.texImage3D.apply(e,arguments)}catch(r){console.error("THREE.WebGLState:",r)}},updateUBOMapping:function t(r,n){let a=h.get(n);void 0===a&&(a=new WeakMap,h.set(n,a));let o=a.get(r);void 0===o&&(o=e.getUniformBlockIndex(n,r.name),a.set(r,o))},uniformBlockBinding:function t(r,n){let a=h.get(n).get(r);c.get(n)!==a&&(e.uniformBlockBinding(n,a,r.__bindingPointIndex),c.set(n,a))},texStorage2D:function t(){try{e.texStorage2D.apply(e,arguments)}catch(r){console.error("THREE.WebGLState:",r)}},texStorage3D:function t(){try{e.texStorage3D.apply(e,arguments)}catch(r){console.error("THREE.WebGLState:",r)}},texSubImage2D:function t(){try{e.texSubImage2D.apply(e,arguments)}catch(r){console.error("THREE.WebGLState:",r)}},texSubImage3D:function t(){try{e.texSubImage3D.apply(e,arguments)}catch(r){console.error("THREE.WebGLState:",r)}},compressedTexSubImage2D:function t(){try{e.compressedTexSubImage2D.apply(e,arguments)}catch(r){console.error("THREE.WebGLState:",r)}},compressedTexSubImage3D:function t(){try{e.compressedTexSubImage3D.apply(e,arguments)}catch(r){console.error("THREE.WebGLState:",r)}},scissor:function t(r){!1===X.equals(r)&&(e.scissor(r.x,r.y,r.z,r.w),X.copy(r))},viewport:function t(r){!1===q.equals(r)&&(e.viewport(r.x,r.y,r.z,r.w),q.copy(r))},reset:function t(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),!0===n&&(e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null)),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),d={},H=null,V={},p={},f=new WeakMap,m=[],$=null,x=!1,y=null,S=null,E=null,_=null,T=null,M=null,A=null,C=new lv(0,0,0),R=0,P=!1,D=null,U=null,I=null,N=null,O=null,X.set(0,0,e.canvas.width,e.canvas.height),q.set(0,0,e.canvas.width,e.canvas.height),a.reset(),o.reset(),s.reset()}}}function pM(e,t,r,n,a,o,s){let c=a.isWebGL2,h=a.maxTextures,d=a.maxCubemapSize,p=a.maxTextureSize,f=a.maxSamples,m=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,$=!(typeof navigator>"u")&&/OculusBrowser/g.test(navigator.userAgent),x=new WeakMap,y,S=new WeakMap,E=!1;try{E="u">typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch{}function _(e,t){return E?new OffscreenCanvas(e,t):o5("canvas")}function T(e,t,r,n){let a=1;if((e.width>n||e.height>n)&&(a=n/Math.max(e.width,e.height)),a<1||!0===t){if(!("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap))return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e;{let o=t?ok:Math.floor,s=o(a*e.width),c=o(a*e.height);void 0===y&&(y=_(s,c));let h=r?_(s,c):y;return h.width=s,h.height=c,h.getContext("2d").drawImage(e,0,0,s,c),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+s+"x"+c+")."),h}}return e}function M(e){return o2(e.width)&&o2(e.height)}function A(e,t){return e.generateMipmaps&&t&&1003!==e.minFilter&&1006!==e.minFilter}function C(t){e.generateMipmap(t)}function R(r,n,a,o,s=!1){if(!1===c)return n;if(null!==r){if(void 0!==e[r])return e[r];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+r+"'")}let h=n;if(n===e.RED&&(a===e.FLOAT&&(h=e.R32F),a===e.HALF_FLOAT&&(h=e.R16F),a===e.UNSIGNED_BYTE&&(h=e.R8)),n===e.RED_INTEGER&&(a===e.UNSIGNED_BYTE&&(h=e.R8UI),a===e.UNSIGNED_SHORT&&(h=e.R16UI),a===e.UNSIGNED_INT&&(h=e.R32UI),a===e.BYTE&&(h=e.R8I),a===e.SHORT&&(h=e.R16I),a===e.INT&&(h=e.R32I)),n===e.RG&&(a===e.FLOAT&&(h=e.RG32F),a===e.HALF_FLOAT&&(h=e.RG16F),a===e.UNSIGNED_BYTE&&(h=e.RG8)),n===e.RGBA){let d=s?oA:oK.getTransfer(o);a===e.FLOAT&&(h=e.RGBA32F),a===e.HALF_FLOAT&&(h=e.RGBA16F),a===e.UNSIGNED_BYTE&&(h=d===oC?e.SRGB8_ALPHA8:e.RGBA8),a===e.UNSIGNED_SHORT_4_4_4_4&&(h=e.RGBA4),a===e.UNSIGNED_SHORT_5_5_5_1&&(h=e.RGB5_A1)}return(h===e.R16F||h===e.R32F||h===e.RG16F||h===e.RG32F||h===e.RGBA16F||h===e.RGBA32F)&&t.get("EXT_color_buffer_float"),h}function P(e,t,r){return!0===A(e,r)||e.isFramebufferTexture&&1003!==e.minFilter&&1006!==e.minFilter?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function D(t){return 1003===t||1004===t||1005===t?e.NEAREST:e.LINEAR}function U(e){let t=e.target;t.removeEventListener("dispose",U),function e(t){let r=n.get(t);if(void 0===r.__webglInit)return;let a=t.source,o=S.get(a);if(o){let s=o[r.__cacheKey];s.usedTimes--,0===s.usedTimes&&N(t),0===Object.keys(o).length&&S.delete(a)}n.remove(t)}(t),t.isVideoTexture&&x.delete(t)}function I(t){let r=t.target;r.removeEventListener("dispose",I),function t(r){let a=r.texture,o=n.get(r),c=n.get(a);if(void 0!==c.__webglTexture&&(e.deleteTexture(c.__webglTexture),s.memory.textures--),r.depthTexture&&r.depthTexture.dispose(),r.isWebGLCubeRenderTarget)for(let h=0;h<6;h++){if(Array.isArray(o.__webglFramebuffer[h]))for(let d=0;d<o.__webglFramebuffer[h].length;d++)e.deleteFramebuffer(o.__webglFramebuffer[h][d]);else e.deleteFramebuffer(o.__webglFramebuffer[h]);o.__webglDepthbuffer&&e.deleteRenderbuffer(o.__webglDepthbuffer[h])}else{if(Array.isArray(o.__webglFramebuffer))for(let p=0;p<o.__webglFramebuffer.length;p++)e.deleteFramebuffer(o.__webglFramebuffer[p]);else e.deleteFramebuffer(o.__webglFramebuffer);if(o.__webglDepthbuffer&&e.deleteRenderbuffer(o.__webglDepthbuffer),o.__webglMultisampledFramebuffer&&e.deleteFramebuffer(o.__webglMultisampledFramebuffer),o.__webglColorRenderbuffer)for(let f=0;f<o.__webglColorRenderbuffer.length;f++)o.__webglColorRenderbuffer[f]&&e.deleteRenderbuffer(o.__webglColorRenderbuffer[f]);o.__webglDepthRenderbuffer&&e.deleteRenderbuffer(o.__webglDepthRenderbuffer)}if(r.isWebGLMultipleRenderTargets)for(let m=0,$=a.length;m<$;m++){let x=n.get(a[m]);x.__webglTexture&&(e.deleteTexture(x.__webglTexture),s.memory.textures--),n.remove(a[m])}n.remove(a),n.remove(r)}(r)}function N(t){let r=n.get(t);e.deleteTexture(r.__webglTexture);let a=t.source,o=S.get(a);delete o[r.__cacheKey],s.memory.textures--}let O=0;function F(t,a){let o=n.get(t);if(t.isVideoTexture&&function e(t){let r=s.render.frame;x.get(t)!==r&&(x.set(t,r),t.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&o.__version!==t.version){let c=t.image;if(null===c)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(!1===c.complete)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{G(o,t,a);return}}r.bindTexture(e.TEXTURE_2D,o.__webglTexture,e.TEXTURE0+a)}let B={1e3:e.REPEAT,1001:e.CLAMP_TO_EDGE,1002:e.MIRRORED_REPEAT},z={1003:e.NEAREST,1004:e.NEAREST_MIPMAP_NEAREST,1005:e.NEAREST_MIPMAP_LINEAR,1006:e.LINEAR,1007:e.LINEAR_MIPMAP_NEAREST,1008:e.LINEAR_MIPMAP_LINEAR},k={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function H(r,o,s){if(s?(e.texParameteri(r,e.TEXTURE_WRAP_S,B[o.wrapS]),e.texParameteri(r,e.TEXTURE_WRAP_T,B[o.wrapT]),(r===e.TEXTURE_3D||r===e.TEXTURE_2D_ARRAY)&&e.texParameteri(r,e.TEXTURE_WRAP_R,B[o.wrapR]),e.texParameteri(r,e.TEXTURE_MAG_FILTER,z[o.magFilter]),e.texParameteri(r,e.TEXTURE_MIN_FILTER,z[o.minFilter])):(e.texParameteri(r,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(r,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),(r===e.TEXTURE_3D||r===e.TEXTURE_2D_ARRAY)&&e.texParameteri(r,e.TEXTURE_WRAP_R,e.CLAMP_TO_EDGE),(1001!==o.wrapS||1001!==o.wrapT)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(r,e.TEXTURE_MAG_FILTER,D(o.magFilter)),e.texParameteri(r,e.TEXTURE_MIN_FILTER,D(o.minFilter)),1003!==o.minFilter&&1006!==o.minFilter&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),o.compareFunction&&(e.texParameteri(r,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(r,e.TEXTURE_COMPARE_FUNC,k[o.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){let h=t.get("EXT_texture_filter_anisotropic");1003!==o.magFilter&&(1005===o.minFilter||1008===o.minFilter)&&(1015!==o.type||!1!==t.has("OES_texture_float_linear"))&&(!1!==c||1016!==o.type||!1!==t.has("OES_texture_half_float_linear"))&&(o.anisotropy>1||n.get(o).__currentAnisotropy)&&(e.texParameterf(r,h.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(o.anisotropy,a.getMaxAnisotropy())),n.get(o).__currentAnisotropy=o.anisotropy)}}function V(t,r){let n=!1;void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",U));let a=r.source,o=S.get(a);void 0===o&&(o={},S.set(a,o));let c=function e(t){let r=[];return r.push(t.wrapS),r.push(t.wrapT),r.push(t.wrapR||0),r.push(t.magFilter),r.push(t.minFilter),r.push(t.anisotropy),r.push(t.internalFormat),r.push(t.format),r.push(t.type),r.push(t.generateMipmaps),r.push(t.premultiplyAlpha),r.push(t.flipY),r.push(t.unpackAlignment),r.push(t.colorSpace),r.join()}(r);if(c!==t.__cacheKey){void 0===o[c]&&(o[c]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,n=!0),o[c].usedTimes++;let h=o[t.__cacheKey];void 0!==h&&(o[t.__cacheKey].usedTimes--,0===h.usedTimes&&N(r)),t.__cacheKey=c,t.__webglTexture=o[c].texture}return n}function G(t,a,s){let h=e.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(h=e.TEXTURE_2D_ARRAY),a.isData3DTexture&&(h=e.TEXTURE_3D);let d=V(t,a),f=a.source;r.bindTexture(h,t.__webglTexture,e.TEXTURE0+s);let m=n.get(f);if(f.version!==m.__version||!0===d){var $;r.activeTexture(e.TEXTURE0+s);let x=oK.getPrimaries(oK.workingColorSpace),y=""===a.colorSpace?null:oK.getPrimaries(a.colorSpace),S=""===a.colorSpace||x===y?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,a.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,a.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,S);let E=($=a,!c&&(1001!==$.wrapS||1001!==$.wrapT||1003!==$.minFilter&&1006!==$.minFilter)&&!1===M(a.image)),_=T(a.image,E,!1,p);_=Z(a,_);let D=M(_)||c,U=o.convert(a.format,a.colorSpace),I=o.convert(a.type),N=R(a.internalFormat,U,I,a.colorSpace,a.isVideoTexture);H(h,a,D);let O,F=a.mipmaps,B=c&&!0!==a.isVideoTexture,z=void 0===m.__version||!0===d,k=P(a,_,D);if(a.isDepthTexture)N=e.DEPTH_COMPONENT,c?N=1015===a.type?e.DEPTH_COMPONENT32F:1014===a.type?e.DEPTH_COMPONENT24:1020===a.type?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT16:1015===a.type&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),1026===a.format&&N===e.DEPTH_COMPONENT&&1012!==a.type&&1014!==a.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),a.type=1014,I=o.convert(a.type)),1027===a.format&&N===e.DEPTH_COMPONENT&&(N=e.DEPTH_STENCIL,1020!==a.type&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),a.type=1020,I=o.convert(a.type))),z&&(B?r.texStorage2D(e.TEXTURE_2D,1,N,_.width,_.height):r.texImage2D(e.TEXTURE_2D,0,N,_.width,_.height,0,U,I,null));else if(a.isDataTexture){if(F.length>0&&D){B&&z&&r.texStorage2D(e.TEXTURE_2D,k,N,F[0].width,F[0].height);for(let G=0,W=F.length;G<W;G++)O=F[G],B?r.texSubImage2D(e.TEXTURE_2D,G,0,0,O.width,O.height,U,I,O.data):r.texImage2D(e.TEXTURE_2D,G,N,O.width,O.height,0,U,I,O.data);a.generateMipmaps=!1}else B?(z&&r.texStorage2D(e.TEXTURE_2D,k,N,_.width,_.height),r.texSubImage2D(e.TEXTURE_2D,0,0,0,_.width,_.height,U,I,_.data)):r.texImage2D(e.TEXTURE_2D,0,N,_.width,_.height,0,U,I,_.data)}else if(a.isCompressedTexture){if(a.isCompressedArrayTexture){B&&z&&r.texStorage3D(e.TEXTURE_2D_ARRAY,k,N,F[0].width,F[0].height,_.depth);for(let X=0,q=F.length;X<q;X++)O=F[X],1023!==a.format?null!==U?B?r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,X,0,0,0,O.width,O.height,_.depth,U,O.data,0,0):r.compressedTexImage3D(e.TEXTURE_2D_ARRAY,X,N,O.width,O.height,_.depth,0,O.data,0,0):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):B?r.texSubImage3D(e.TEXTURE_2D_ARRAY,X,0,0,0,O.width,O.height,_.depth,U,I,O.data):r.texImage3D(e.TEXTURE_2D_ARRAY,X,N,O.width,O.height,_.depth,0,U,I,O.data)}else{B&&z&&r.texStorage2D(e.TEXTURE_2D,k,N,F[0].width,F[0].height);for(let Y=0,j=F.length;Y<j;Y++)O=F[Y],1023!==a.format?null!==U?B?r.compressedTexSubImage2D(e.TEXTURE_2D,Y,0,0,O.width,O.height,U,O.data):r.compressedTexImage2D(e.TEXTURE_2D,Y,N,O.width,O.height,0,O.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):B?r.texSubImage2D(e.TEXTURE_2D,Y,0,0,O.width,O.height,U,I,O.data):r.texImage2D(e.TEXTURE_2D,Y,N,O.width,O.height,0,U,I,O.data)}}else if(a.isDataArrayTexture)B?(z&&r.texStorage3D(e.TEXTURE_2D_ARRAY,k,N,_.width,_.height,_.depth),r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,_.width,_.height,_.depth,U,I,_.data)):r.texImage3D(e.TEXTURE_2D_ARRAY,0,N,_.width,_.height,_.depth,0,U,I,_.data);else if(a.isData3DTexture)B?(z&&r.texStorage3D(e.TEXTURE_3D,k,N,_.width,_.height,_.depth),r.texSubImage3D(e.TEXTURE_3D,0,0,0,0,_.width,_.height,_.depth,U,I,_.data)):r.texImage3D(e.TEXTURE_3D,0,N,_.width,_.height,_.depth,0,U,I,_.data);else if(a.isFramebufferTexture){if(z){if(B)r.texStorage2D(e.TEXTURE_2D,k,N,_.width,_.height);else{let K=_.width,J=_.height;for(let Q=0;Q<k;Q++)r.texImage2D(e.TEXTURE_2D,Q,N,K,J,0,U,I,null),K>>=1,J>>=1}}}else if(F.length>0&&D){B&&z&&r.texStorage2D(e.TEXTURE_2D,k,N,F[0].width,F[0].height);for(let et=0,ei=F.length;et<ei;et++)O=F[et],B?r.texSubImage2D(e.TEXTURE_2D,et,0,0,U,I,O):r.texImage2D(e.TEXTURE_2D,et,N,U,I,O);a.generateMipmaps=!1}else B?(z&&r.texStorage2D(e.TEXTURE_2D,k,N,_.width,_.height),r.texSubImage2D(e.TEXTURE_2D,0,0,0,U,I,_)):r.texImage2D(e.TEXTURE_2D,0,N,U,I,_);A(a,D)&&C(h),m.__version=f.version,a.onUpdate&&a.onUpdate(a)}t.__version=a.version}function W(t,a,s,c,h,d){let p=o.convert(s.format,s.colorSpace),f=o.convert(s.type),$=R(s.internalFormat,p,f,s.colorSpace);if(!n.get(a).__hasExternalTextures){let x=Math.max(1,a.width>>d),y=Math.max(1,a.height>>d);h===e.TEXTURE_3D||h===e.TEXTURE_2D_ARRAY?r.texImage3D(h,d,$,x,y,a.depth,0,p,f,null):r.texImage2D(h,d,$,x,y,0,p,f,null)}r.bindFramebuffer(e.FRAMEBUFFER,t),j(a)?m.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,h,n.get(s).__webglTexture,0,Y(a)):(h===e.TEXTURE_2D||h>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,h,n.get(s).__webglTexture,d),r.bindFramebuffer(e.FRAMEBUFFER,null)}function X(t,r,n){if(e.bindRenderbuffer(e.RENDERBUFFER,t),r.depthBuffer&&!r.stencilBuffer){let a=!0===c?e.DEPTH_COMPONENT24:e.DEPTH_COMPONENT16;if(n||j(r)){let s=r.depthTexture;s&&s.isDepthTexture&&(1015===s.type?a=e.DEPTH_COMPONENT32F:1014===s.type&&(a=e.DEPTH_COMPONENT24));let h=Y(r);j(r)?m.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,h,a,r.width,r.height):e.renderbufferStorageMultisample(e.RENDERBUFFER,h,a,r.width,r.height)}else e.renderbufferStorage(e.RENDERBUFFER,a,r.width,r.height);e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t)}else if(r.depthBuffer&&r.stencilBuffer){let d=Y(r);n&&!1===j(r)?e.renderbufferStorageMultisample(e.RENDERBUFFER,d,e.DEPTH24_STENCIL8,r.width,r.height):j(r)?m.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,d,e.DEPTH24_STENCIL8,r.width,r.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,r.width,r.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t)}else{let p=!0===r.isWebGLMultipleRenderTargets?r.texture:[r.texture];for(let f=0;f<p.length;f++){let $=p[f],x=o.convert($.format,$.colorSpace),y=o.convert($.type),S=R($.internalFormat,x,y,$.colorSpace),E=Y(r);n&&!1===j(r)?e.renderbufferStorageMultisample(e.RENDERBUFFER,E,S,r.width,r.height):j(r)?m.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,E,S,r.width,r.height):e.renderbufferStorage(e.RENDERBUFFER,S,r.width,r.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function q(t){let a=n.get(t),o=!0===t.isWebGLCubeRenderTarget;if(t.depthTexture&&!a.__autoAllocateDepthBuffer){if(o)throw Error("target.depthTexture not supported in Cube render targets");!function t(a,o){if(o&&o.isWebGLCubeRenderTarget)throw Error("Depth Texture with cube render targets is not supported");if(r.bindFramebuffer(e.FRAMEBUFFER,a),!(o.depthTexture&&o.depthTexture.isDepthTexture))throw Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");n.get(o.depthTexture).__webglTexture&&o.depthTexture.image.width===o.width&&o.depthTexture.image.height===o.height||(o.depthTexture.image.width=o.width,o.depthTexture.image.height=o.height,o.depthTexture.needsUpdate=!0),F(o.depthTexture,0);let s=n.get(o.depthTexture).__webglTexture,c=Y(o);if(1026===o.depthTexture.format)j(o)?m.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,s,0,c):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,s,0);else if(1027===o.depthTexture.format)j(o)?m.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,s,0,c):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,s,0);else throw Error("Unknown depthTexture format")}(a.__webglFramebuffer,t)}else if(o){a.__webglDepthbuffer=[];for(let s=0;s<6;s++)r.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer[s]),a.__webglDepthbuffer[s]=e.createRenderbuffer(),X(a.__webglDepthbuffer[s],t,!1)}else r.bindFramebuffer(e.FRAMEBUFFER,a.__webglFramebuffer),a.__webglDepthbuffer=e.createRenderbuffer(),X(a.__webglDepthbuffer,t,!1);r.bindFramebuffer(e.FRAMEBUFFER,null)}function Y(e){return Math.min(f,e.samples)}function j(e){let r=n.get(e);return c&&e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==r.__useRenderToTexture}function Z(e,r){let n=e.colorSpace,a=e.format,o=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||1035===e.format||n!==oT&&""!==n&&(oK.getTransfer(n)===oC?!1===c?!0===t.has("EXT_sRGB")&&1023===a?(e.format=1035,e.minFilter=1006,e.generateMipmaps=!1):r=se.sRGBToLinear(r):(1023!==a||1009!==o)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",n)),r}this.allocateTextureUnit=function e(){let t=O;return t>=h&&console.warn("THREE.WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+h),O+=1,t},this.resetTextureUnits=function e(){O=0},this.setTexture2D=F,this.setTexture2DArray=function t(a,o){let s=n.get(a);if(a.version>0&&s.__version!==a.version){G(s,a,o);return}r.bindTexture(e.TEXTURE_2D_ARRAY,s.__webglTexture,e.TEXTURE0+o)},this.setTexture3D=function t(a,o){let s=n.get(a);if(a.version>0&&s.__version!==a.version){G(s,a,o);return}r.bindTexture(e.TEXTURE_3D,s.__webglTexture,e.TEXTURE0+o)},this.setTextureCube=function t(a,s){let h=n.get(a);if(a.version>0&&h.__version!==a.version){(function t(a,s,h){if(6!==s.image.length)return;let p=V(a,s),f=s.source;r.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+h);let m=n.get(f);if(f.version!==m.__version||!0===p){r.activeTexture(e.TEXTURE0+h);let $=oK.getPrimaries(oK.workingColorSpace),x=""===s.colorSpace?null:oK.getPrimaries(s.colorSpace),y=""===s.colorSpace||$===x?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,y);let S=s.isCompressedTexture||s.image[0].isCompressedTexture,E=s.image[0]&&s.image[0].isDataTexture,_=[];for(let D=0;D<6;D++)S||E?_[D]=E?s.image[D].image:s.image[D]:_[D]=T(s.image[D],!1,!0,d),_[D]=Z(s,_[D]);let U=_[0],I=M(U)||c,N=o.convert(s.format,s.colorSpace),O=o.convert(s.type),F=R(s.internalFormat,N,O,s.colorSpace),B=c&&!0!==s.isVideoTexture,z=void 0===m.__version||!0===p,k=P(s,U,I);H(e.TEXTURE_CUBE_MAP,s,I);let G;if(S){B&&z&&r.texStorage2D(e.TEXTURE_CUBE_MAP,k,F,U.width,U.height);for(let W=0;W<6;W++){G=_[W].mipmaps;for(let X=0;X<G.length;X++){let q=G[X];1023!==s.format?null!==N?B?r.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+W,X,0,0,q.width,q.height,N,q.data):r.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+W,X,F,q.width,q.height,0,q.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):B?r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+W,X,0,0,q.width,q.height,N,O,q.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+W,X,F,q.width,q.height,0,N,O,q.data)}}}else{G=s.mipmaps,B&&z&&(G.length>0&&k++,r.texStorage2D(e.TEXTURE_CUBE_MAP,k,F,_[0].width,_[0].height));for(let Y=0;Y<6;Y++)if(E){B?r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,_[Y].width,_[Y].height,N,O,_[Y].data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,F,_[Y].width,_[Y].height,0,N,O,_[Y].data);for(let j=0;j<G.length;j++){let K=G[j].image[Y].image;B?r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Y,j+1,0,0,K.width,K.height,N,O,K.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Y,j+1,F,K.width,K.height,0,N,O,K.data)}}else{B?r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,0,0,N,O,_[Y]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Y,0,F,N,O,_[Y]);for(let J=0;J<G.length;J++){let Q=G[J];B?r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Y,J+1,0,0,N,O,Q.image[Y]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+Y,J+1,F,N,O,Q.image[Y])}}}A(s,I)&&C(e.TEXTURE_CUBE_MAP),m.__version=f.version,s.onUpdate&&s.onUpdate(s)}a.__version=s.version})(h,a,s);return}r.bindTexture(e.TEXTURE_CUBE_MAP,h.__webglTexture,e.TEXTURE0+s)},this.rebindTextures=function t(r,a,o){let s=n.get(r);void 0!==a&&W(s.__webglFramebuffer,r,r.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==o&&q(r)},this.setupRenderTarget=function t(h){let d=h.texture,p=n.get(h),f=n.get(d);h.addEventListener("dispose",I),!0!==h.isWebGLMultipleRenderTargets&&(void 0===f.__webglTexture&&(f.__webglTexture=e.createTexture()),f.__version=d.version,s.memory.textures++);let m=!0===h.isWebGLCubeRenderTarget,$=!0===h.isWebGLMultipleRenderTargets,x=M(h)||c;if(m){p.__webglFramebuffer=[];for(let y=0;y<6;y++)if(c&&d.mipmaps&&d.mipmaps.length>0){p.__webglFramebuffer[y]=[];for(let S=0;S<d.mipmaps.length;S++)p.__webglFramebuffer[y][S]=e.createFramebuffer()}else p.__webglFramebuffer[y]=e.createFramebuffer()}else{if(c&&d.mipmaps&&d.mipmaps.length>0){p.__webglFramebuffer=[];for(let E=0;E<d.mipmaps.length;E++)p.__webglFramebuffer[E]=e.createFramebuffer()}else p.__webglFramebuffer=e.createFramebuffer();if($){if(a.drawBuffers){let _=h.texture;for(let T=0,P=_.length;T<P;T++){let D=n.get(_[T]);void 0===D.__webglTexture&&(D.__webglTexture=e.createTexture(),s.memory.textures++)}}else console.warn("THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.")}if(c&&h.samples>0&&!1===j(h)){let U=$?d:[d];p.__webglMultisampledFramebuffer=e.createFramebuffer(),p.__webglColorRenderbuffer=[],r.bindFramebuffer(e.FRAMEBUFFER,p.__webglMultisampledFramebuffer);for(let N=0;N<U.length;N++){let O=U[N];p.__webglColorRenderbuffer[N]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,p.__webglColorRenderbuffer[N]);let F=o.convert(O.format,O.colorSpace),B=o.convert(O.type),z=R(O.internalFormat,F,B,O.colorSpace,!0===h.isXRRenderTarget),k=Y(h);e.renderbufferStorageMultisample(e.RENDERBUFFER,k,z,h.width,h.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+N,e.RENDERBUFFER,p.__webglColorRenderbuffer[N])}e.bindRenderbuffer(e.RENDERBUFFER,null),h.depthBuffer&&(p.__webglDepthRenderbuffer=e.createRenderbuffer(),X(p.__webglDepthRenderbuffer,h,!0)),r.bindFramebuffer(e.FRAMEBUFFER,null)}}if(m){r.bindTexture(e.TEXTURE_CUBE_MAP,f.__webglTexture),H(e.TEXTURE_CUBE_MAP,d,x);for(let V=0;V<6;V++)if(c&&d.mipmaps&&d.mipmaps.length>0)for(let G=0;G<d.mipmaps.length;G++)W(p.__webglFramebuffer[V][G],h,d,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+V,G);else W(p.__webglFramebuffer[V],h,d,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+V,0);A(d,x)&&C(e.TEXTURE_CUBE_MAP),r.unbindTexture()}else if($){let Z=h.texture;for(let K=0,J=Z.length;K<J;K++){let Q=Z[K],et=n.get(Q);r.bindTexture(e.TEXTURE_2D,et.__webglTexture),H(e.TEXTURE_2D,Q,x),W(p.__webglFramebuffer,h,Q,e.COLOR_ATTACHMENT0+K,e.TEXTURE_2D,0),A(Q,x)&&C(e.TEXTURE_2D)}r.unbindTexture()}else{let ei=e.TEXTURE_2D;if((h.isWebGL3DRenderTarget||h.isWebGLArrayRenderTarget)&&(c?ei=h.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),r.bindTexture(ei,f.__webglTexture),H(ei,d,x),c&&d.mipmaps&&d.mipmaps.length>0)for(let er=0;er<d.mipmaps.length;er++)W(p.__webglFramebuffer[er],h,d,e.COLOR_ATTACHMENT0,ei,er);else W(p.__webglFramebuffer,h,d,e.COLOR_ATTACHMENT0,ei,0);A(d,x)&&C(ei),r.unbindTexture()}h.depthBuffer&&q(h)},this.updateRenderTargetMipmap=function t(a){let o=M(a)||c,s=!0===a.isWebGLMultipleRenderTargets?a.texture:[a.texture];for(let h=0,d=s.length;h<d;h++){let p=s[h];if(A(p,o)){let f=a.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:e.TEXTURE_2D,m=n.get(p).__webglTexture;r.bindTexture(f,m),C(f),r.unbindTexture()}}},this.updateMultisampleRenderTarget=function t(a){if(c&&a.samples>0&&!1===j(a)){let o=a.isWebGLMultipleRenderTargets?a.texture:[a.texture],s=a.width,h=a.height,d=e.COLOR_BUFFER_BIT,p=[],f=a.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,m=n.get(a),x=!0===a.isWebGLMultipleRenderTargets;if(x)for(let y=0;y<o.length;y++)r.bindFramebuffer(e.FRAMEBUFFER,m.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+y,e.RENDERBUFFER,null),r.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+y,e.TEXTURE_2D,null,0);r.bindFramebuffer(e.READ_FRAMEBUFFER,m.__webglMultisampledFramebuffer),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,m.__webglFramebuffer);for(let S=0;S<o.length;S++){p.push(e.COLOR_ATTACHMENT0+S),a.depthBuffer&&p.push(f);let E=void 0!==m.__ignoreDepthValues&&m.__ignoreDepthValues;if(!1===E&&(a.depthBuffer&&(d|=e.DEPTH_BUFFER_BIT),a.stencilBuffer&&(d|=e.STENCIL_BUFFER_BIT)),x&&e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,m.__webglColorRenderbuffer[S]),!0===E&&(e.invalidateFramebuffer(e.READ_FRAMEBUFFER,[f]),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[f])),x){let _=n.get(o[S]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,_,0)}e.blitFramebuffer(0,0,s,h,0,0,s,h,d,e.NEAREST),$&&e.invalidateFramebuffer(e.READ_FRAMEBUFFER,p)}if(r.bindFramebuffer(e.READ_FRAMEBUFFER,null),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),x)for(let T=0;T<o.length;T++){r.bindFramebuffer(e.FRAMEBUFFER,m.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+T,e.RENDERBUFFER,m.__webglColorRenderbuffer[T]);let M=n.get(o[T]).__webglTexture;r.bindFramebuffer(e.FRAMEBUFFER,m.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+T,e.TEXTURE_2D,M,0)}r.bindFramebuffer(e.DRAW_FRAMEBUFFER,m.__webglMultisampledFramebuffer)}},this.setupDepthRenderbuffer=q,this.setupFrameBufferTexture=W,this.useMultisampledRTT=j}function pw(e,t,r){let n=r.isWebGL2;return{convert:function r(a,o=""){let s,c=oK.getTransfer(o);if(1009===a)return e.UNSIGNED_BYTE;if(1017===a)return e.UNSIGNED_SHORT_4_4_4_4;if(1018===a)return e.UNSIGNED_SHORT_5_5_5_1;if(1010===a)return e.BYTE;if(1011===a)return e.SHORT;if(1012===a)return e.UNSIGNED_SHORT;if(1013===a)return e.INT;if(1014===a)return e.UNSIGNED_INT;if(1015===a)return e.FLOAT;if(1016===a)return n?e.HALF_FLOAT:null!==(s=t.get("OES_texture_half_float"))?s.HALF_FLOAT_OES:null;if(1021===a)return e.ALPHA;if(1023===a)return e.RGBA;if(1024===a)return e.LUMINANCE;if(1025===a)return e.LUMINANCE_ALPHA;if(1026===a)return e.DEPTH_COMPONENT;if(1027===a)return e.DEPTH_STENCIL;if(1035===a)return null!==(s=t.get("EXT_sRGB"))?s.SRGB_ALPHA_EXT:null;if(1028===a)return e.RED;if(1029===a)return e.RED_INTEGER;if(1030===a)return e.RG;if(1031===a)return e.RG_INTEGER;if(1033===a)return e.RGBA_INTEGER;if(33776===a||33777===a||33778===a||33779===a){if(c===oC){if(null===(s=t.get("WEBGL_compressed_texture_s3tc_srgb")))return null;if(33776===a)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(33777===a)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(33778===a)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(33779===a)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(null===(s=t.get("WEBGL_compressed_texture_s3tc")))return null;if(33776===a)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(33777===a)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(33778===a)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(33779===a)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}}if(35840===a||35841===a||35842===a||35843===a){if(null===(s=t.get("WEBGL_compressed_texture_pvrtc")))return null;if(35840===a)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(35841===a)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(35842===a)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(35843===a)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(36196===a)return null!==(s=t.get("WEBGL_compressed_texture_etc1"))?s.COMPRESSED_RGB_ETC1_WEBGL:null;if(37492===a||37496===a){if(null===(s=t.get("WEBGL_compressed_texture_etc")))return null;if(37492===a)return c===oC?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(37496===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}if(37808===a||37809===a||37810===a||37811===a||37812===a||37813===a||37814===a||37815===a||37816===a||37817===a||37818===a||37819===a||37820===a||37821===a){if(null===(s=t.get("WEBGL_compressed_texture_astc")))return null;if(37808===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(37809===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(37810===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(37811===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(37812===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(37813===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(37814===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(37815===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(37816===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(37817===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(37818===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(37819===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(37820===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(37821===a)return c===oC?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}if(36492===a||36494===a||36495===a){if(null===(s=t.get("EXT_texture_compression_bptc")))return null;if(36492===a)return c===oC?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(36494===a)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(36495===a)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(36283===a||36284===a||36285===a||36286===a){if(null===(s=t.get("EXT_texture_compression_rgtc")))return null;if(36492===a)return s.COMPRESSED_RED_RGTC1_EXT;if(36284===a)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(36285===a)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(36286===a)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return 1020===a?n?e.UNSIGNED_INT_24_8:null!==(s=t.get("WEBGL_depth_texture"))?s.UNSIGNED_INT_24_8_WEBGL:null:void 0!==e[a]?e[a]:null}}}class pA extends li{constructor(){super(),this.isGroup=!0,this.type="Group"}}let pC={type:"move"};class pR{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new pA,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 pA,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new sh,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new sh),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new pA,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new sh,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new sh),this._grip}dispatchEvent(e){return null!==this._targetRay&&this._targetRay.dispatchEvent(e),null!==this._grip&&this._grip.dispatchEvent(e),null!==this._hand&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(e,t,r){let n=null,a=null,o=null,s=this._targetRay,c=this._grip,h=this._hand;if(e&&"visible-blurred"!==t.session.visibilityState){if(h&&e.hand){for(let d of(o=!0,e.hand.values())){let p=t.getJointPose(d,r),f=this._getHandJoint(h,d);null!==p&&(f.matrix.fromArray(p.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=p.radius),f.visible=null!==p}let m=h.joints["index-finger-tip"],$=h.joints["thumb-tip"],x=m.position.distanceTo($.position);h.inputState.pinching&&x>.025?(h.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!h.inputState.pinching&&x<=.015&&(h.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==c&&e.gripSpace&&null!==(a=t.getPose(e.gripSpace,r))&&(c.matrix.fromArray(a.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,a.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(a.linearVelocity)):c.hasLinearVelocity=!1,a.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(a.angularVelocity)):c.hasAngularVelocity=!1);null!==s&&(null===(n=t.getPose(e.targetRaySpace,r))&&null!==a&&(n=a),null!==n&&(s.matrix.fromArray(n.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,n.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(n.linearVelocity)):s.hasLinearVelocity=!1,n.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(n.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(pC)))}return null!==s&&(s.visible=null!==n),null!==c&&(c.visible=null!==a),null!==h&&(h.visible=null!==o),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){let r=new pA;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class p0 extends sa{constructor(e,t,r,n,a,o,s,c,h,d){if(1026!==(d=void 0!==d?d:1026)&&1027!==d)throw Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===r&&1026===d&&(r=1014),void 0===r&&1027===d&&(r=1020),super(null,n,a,o,s,c,d,r,h),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=void 0!==s?s:1003,this.minFilter=void 0!==c?c:1003,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}function pP(e,t){function r(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function n(n,a){n.opacity.value=a.opacity,a.color&&n.diffuse.value.copy(a.color),a.emissive&&n.emissive.value.copy(a.emissive).multiplyScalar(a.emissiveIntensity),a.map&&(n.map.value=a.map,r(a.map,n.mapTransform)),a.alphaMap&&(n.alphaMap.value=a.alphaMap,r(a.alphaMap,n.alphaMapTransform)),a.bumpMap&&(n.bumpMap.value=a.bumpMap,r(a.bumpMap,n.bumpMapTransform),n.bumpScale.value=a.bumpScale,1===a.side&&(n.bumpScale.value*=-1)),a.normalMap&&(n.normalMap.value=a.normalMap,r(a.normalMap,n.normalMapTransform),n.normalScale.value.copy(a.normalScale),1===a.side&&n.normalScale.value.negate()),a.displacementMap&&(n.displacementMap.value=a.displacementMap,r(a.displacementMap,n.displacementMapTransform),n.displacementScale.value=a.displacementScale,n.displacementBias.value=a.displacementBias),a.emissiveMap&&(n.emissiveMap.value=a.emissiveMap,r(a.emissiveMap,n.emissiveMapTransform)),a.specularMap&&(n.specularMap.value=a.specularMap,r(a.specularMap,n.specularMapTransform)),a.alphaTest>0&&(n.alphaTest.value=a.alphaTest);let o=t.get(a).envMap;if(o&&(n.envMap.value=o,n.flipEnvMap.value=o.isCubeTexture&&!1===o.isRenderTargetTexture?-1:1,n.reflectivity.value=a.reflectivity,n.ior.value=a.ior,n.refractionRatio.value=a.refractionRatio),a.lightMap){n.lightMap.value=a.lightMap;let s=!0===e._useLegacyLights?Math.PI:1;n.lightMapIntensity.value=a.lightMapIntensity*s,r(a.lightMap,n.lightMapTransform)}a.aoMap&&(n.aoMap.value=a.aoMap,n.aoMapIntensity.value=a.aoMapIntensity,r(a.aoMap,n.aoMapTransform))}return{refreshFogUniforms:function t(r,n){n.color.getRGB(r.fogColor.value,lK(e)),n.isFog?(r.fogNear.value=n.near,r.fogFar.value=n.far):n.isFogExp2&&(r.fogDensity.value=n.density)},refreshMaterialUniforms:function e(a,o,s,c,h){var d,p,f,m,$,x,y,S,E,_,T,M,A,C,R,P,D,U,I,N,O;o.isMeshBasicMaterial||o.isMeshLambertMaterial?n(a,o):o.isMeshToonMaterial?(n(a,o),d=a,(p=o).gradientMap&&(d.gradientMap.value=p.gradientMap)):o.isMeshPhongMaterial?(n(a,o),f=a,m=o,f.specular.value.copy(m.specular),f.shininess.value=Math.max(m.shininess,1e-4)):o.isMeshStandardMaterial?(n(a,o),$=a,x=o,$.metalness.value=x.metalness,x.metalnessMap&&($.metalnessMap.value=x.metalnessMap,r(x.metalnessMap,$.metalnessMapTransform)),$.roughness.value=x.roughness,x.roughnessMap&&($.roughnessMap.value=x.roughnessMap,r(x.roughnessMap,$.roughnessMapTransform)),t.get(x).envMap&&($.envMapIntensity.value=x.envMapIntensity),o.isMeshPhysicalMaterial&&(y=a,S=o,E=h,y.ior.value=S.ior,S.sheen>0&&(y.sheenColor.value.copy(S.sheenColor).multiplyScalar(S.sheen),y.sheenRoughness.value=S.sheenRoughness,S.sheenColorMap&&(y.sheenColorMap.value=S.sheenColorMap,r(S.sheenColorMap,y.sheenColorMapTransform)),S.sheenRoughnessMap&&(y.sheenRoughnessMap.value=S.sheenRoughnessMap,r(S.sheenRoughnessMap,y.sheenRoughnessMapTransform))),S.clearcoat>0&&(y.clearcoat.value=S.clearcoat,y.clearcoatRoughness.value=S.clearcoatRoughness,S.clearcoatMap&&(y.clearcoatMap.value=S.clearcoatMap,r(S.clearcoatMap,y.clearcoatMapTransform)),S.clearcoatRoughnessMap&&(y.clearcoatRoughnessMap.value=S.clearcoatRoughnessMap,r(S.clearcoatRoughnessMap,y.clearcoatRoughnessMapTransform)),S.clearcoatNormalMap&&(y.clearcoatNormalMap.value=S.clearcoatNormalMap,r(S.clearcoatNormalMap,y.clearcoatNormalMapTransform),y.clearcoatNormalScale.value.copy(S.clearcoatNormalScale),1===S.side&&y.clearcoatNormalScale.value.negate())),S.iridescence>0&&(y.iridescence.value=S.iridescence,y.iridescenceIOR.value=S.iridescenceIOR,y.iridescenceThicknessMinimum.value=S.iridescenceThicknessRange[0],y.iridescenceThicknessMaximum.value=S.iridescenceThicknessRange[1],S.iridescenceMap&&(y.iridescenceMap.value=S.iridescenceMap,r(S.iridescenceMap,y.iridescenceMapTransform)),S.iridescenceThicknessMap&&(y.iridescenceThicknessMap.value=S.iridescenceThicknessMap,r(S.iridescenceThicknessMap,y.iridescenceThicknessMapTransform))),S.transmission>0&&(y.transmission.value=S.transmission,y.transmissionSamplerMap.value=E.texture,y.transmissionSamplerSize.value.set(E.width,E.height),S.transmissionMap&&(y.transmissionMap.value=S.transmissionMap,r(S.transmissionMap,y.transmissionMapTransform)),y.thickness.value=S.thickness,S.thicknessMap&&(y.thicknessMap.value=S.thicknessMap,r(S.thicknessMap,y.thicknessMapTransform)),y.attenuationDistance.value=S.attenuationDistance,y.attenuationColor.value.copy(S.attenuationColor)),S.anisotropy>0&&(y.anisotropyVector.value.set(S.anisotropy*Math.cos(S.anisotropyRotation),S.anisotropy*Math.sin(S.anisotropyRotation)),S.anisotropyMap&&(y.anisotropyMap.value=S.anisotropyMap,r(S.anisotropyMap,y.anisotropyMapTransform))),y.specularIntensity.value=S.specularIntensity,y.specularColor.value.copy(S.specularColor),S.specularColorMap&&(y.specularColorMap.value=S.specularColorMap,r(S.specularColorMap,y.specularColorMapTransform)),S.specularIntensityMap&&(y.specularIntensityMap.value=S.specularIntensityMap,r(S.specularIntensityMap,y.specularIntensityMapTransform)))):o.isMeshMatcapMaterial?(n(a,o),_=a,(T=o).matcap&&(_.matcap.value=T.matcap)):o.isMeshDepthMaterial?n(a,o):o.isMeshDistanceMaterial?(n(a,o),function e(r,n){let a=t.get(n).light;r.referencePosition.value.setFromMatrixPosition(a.matrixWorld),r.nearDistance.value=a.shadow.camera.near,r.farDistance.value=a.shadow.camera.far}(a,o)):o.isMeshNormalMaterial?n(a,o):o.isLineBasicMaterial?(M=a,A=o,M.diffuse.value.copy(A.color),M.opacity.value=A.opacity,A.map&&(M.map.value=A.map,r(A.map,M.mapTransform)),o.isLineDashedMaterial&&(C=a,R=o,C.dashSize.value=R.dashSize,C.totalSize.value=R.dashSize+R.gapSize,C.scale.value=R.scale)):o.isPointsMaterial?(P=a,D=o,U=s,I=c,P.diffuse.value.copy(D.color),P.opacity.value=D.opacity,P.size.value=D.size*U,P.scale.value=.5*I,D.map&&(P.map.value=D.map,r(D.map,P.uvTransform)),D.alphaMap&&(P.alphaMap.value=D.alphaMap,r(D.alphaMap,P.alphaMapTransform)),D.alphaTest>0&&(P.alphaTest.value=D.alphaTest)):o.isSpriteMaterial?(N=a,O=o,N.diffuse.value.copy(O.color),N.opacity.value=O.opacity,N.rotation.value=O.rotation,O.map&&(N.map.value=O.map,r(O.map,N.mapTransform)),O.alphaMap&&(N.alphaMap.value=O.alphaMap,r(O.alphaMap,N.alphaMapTransform)),O.alphaTest>0&&(N.alphaTest.value=O.alphaTest)):o.isShadowMaterial?(a.color.value.copy(o.color),a.opacity.value=o.opacity):o.isShaderMaterial&&(o.uniformsNeedUpdate=!1)}}}function pL(e,t,r,n){let a={},o={},s=[],c=r.isWebGL2?e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS):0;function h(e,t,r){let n=e.value;if(void 0===r[t]){if("number"==typeof n)r[t]=n;else{let a=Array.isArray(n)?n:[n],o=[];for(let s=0;s<a.length;s++)o.push(a[s].clone());r[t]=o}return!0}if("number"==typeof n){if(r[t]!==n)return r[t]=n,!0}else{let c=Array.isArray(r[t])?r[t]:[r[t]],h=Array.isArray(n)?n:[n];for(let d=0;d<c.length;d++){let p=c[d];if(!1===p.equals(h[d]))return p.copy(h[d]),!0}}return!1}function d(e){let t={boundary:0,storage:0};return"number"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function p(t){let r=t.target;r.removeEventListener("dispose",p);let n=s.indexOf(r.__bindingPointIndex);s.splice(n,1),e.deleteBuffer(a[r.id]),delete a[r.id],delete o[r.id]}return{bind:function e(t,r){let a=r.program;n.uniformBlockBinding(t,a)},update:function r(f,m){let $=a[f.id];void 0===$&&(function e(t){let r=t.uniforms,n=0,a=0;for(let o=0,s=r.length;o<s;o++){let c=r[o],h={boundary:0,storage:0},p=Array.isArray(c.value)?c.value:[c.value];for(let f=0,m=p.length;f<m;f++){let $=p[f],x=d($);h.boundary+=x.boundary,h.storage+=x.storage}if(c.__data=new Float32Array(h.storage/Float32Array.BYTES_PER_ELEMENT),c.__offset=n,o>0){a=n%16;let y=16-a;0!==a&&y-h.boundary<0&&(n+=16-a,c.__offset=n)}n+=h.storage}return(a=n%16)>0&&(n+=16-a),t.__size=n,t.__cache={},this}(f),$=function t(r){let n=function e(){for(let t=0;t<c;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}();r.__bindingPointIndex=n;let a=e.createBuffer(),o=r.__size,h=r.usage;return e.bindBuffer(e.UNIFORM_BUFFER,a),e.bufferData(e.UNIFORM_BUFFER,o,h),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,a),a}(f),a[f.id]=$,f.addEventListener("dispose",p));let x=m.program;n.updateUBOMapping(f,x);let y=t.render.frame;o[f.id]!==y&&(function t(r){let n=a[r.id],o=r.uniforms,s=r.__cache;e.bindBuffer(e.UNIFORM_BUFFER,n);for(let c=0,p=o.length;c<p;c++){let f=o[c];if(!0===h(f,c,s)){let m=f.__offset,$=Array.isArray(f.value)?f.value:[f.value],x=0;for(let y=0;y<$.length;y++){let S=$[y],E=d(S);"number"==typeof S?(f.__data[0]=S,e.bufferSubData(e.UNIFORM_BUFFER,m+x,f.__data)):S.isMatrix3?(f.__data[0]=S.elements[0],f.__data[1]=S.elements[1],f.__data[2]=S.elements[2],f.__data[3]=S.elements[0],f.__data[4]=S.elements[3],f.__data[5]=S.elements[4],f.__data[6]=S.elements[5],f.__data[7]=S.elements[0],f.__data[8]=S.elements[6],f.__data[9]=S.elements[7],f.__data[10]=S.elements[8],f.__data[11]=S.elements[0]):(S.toArray(f.__data,x),x+=E.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,m,f.__data)}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(f),o[f.id]=y)},dispose:function t(){for(let r in a)e.deleteBuffer(a[r]);s=[],a={},o={}}}}class p1{constructor(e={}){let{canvas:t=function e(){let t=o5("canvas");return t.style.display="block",t}(),context:r=null,depth:n=!0,stencil:a=!0,alpha:o=!1,antialias:s=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:h=!1,powerPreference:d="default",failIfMajorPerformanceCaveat:p=!1}=e;this.isWebGLRenderer=!0;let f;f=null!==r?r.getContextAttributes().alpha:o;let m=new Uint32Array(4),$=new Int32Array(4),x=null,y=null,S=[],E=[];this.domElement=t,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._outputColorSpace=o_,this._useLegacyLights=!1,this.toneMapping=ob,this.toneMappingExposure=1;let _=this,T=!1,M=0,A=0,C=null,R=-1,P=null,D=new so,U=new so,I=null,N=new lv(0),O=0,F=t.width,B=t.height,z=1,k=null,H=null,V=new so(0,0,F,B),G=new so(0,0,F,B),W=!1,X=new ud,q=!1,Y=!1,j=null,Z=new sF,K=new oG,J=new sh,Q={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function et(){return null===C?z:1}let ei=r;function er(e,r){for(let n=0;n<e.length;n++){let a=e[n],o=t.getContext(a,r);if(null!==o)return o}return null}try{if("setAttribute"in t&&t.setAttribute("data-engine","three.js r158"),t.addEventListener("webglcontextlost",e0,!1),t.addEventListener("webglcontextrestored",eP,!1),t.addEventListener("webglcontextcreationerror",eL,!1),null===ei){let en=["webgl2","webgl","experimental-webgl"];if(!0===_.isWebGL1Renderer&&en.shift(),ei=er(en,{alpha:!0,depth:n,stencil:a,antialias:s,premultipliedAlpha:c,preserveDrawingBuffer:h,powerPreference:d,failIfMajorPerformanceCaveat:p}),null===ei)throw er(en)?Error("Error creating WebGL context with your selected attributes."):Error("Error creating WebGL context.")}"u">typeof WebGLRenderingContext&&ei instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),void 0===ei.getShaderPrecisionFormat&&(ei.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(ea){throw console.error("THREE.WebGLRenderer: "+ea.message),ea}let eo,es,el,eu,ec,eh,ed,ep,ef,em,eg,e8,e$,ev,ex,ey,eS,eE,eb,e_,eT,eM,ew,eA;function eC(){eo=new h6(ei),es=new hP(ei,eo,e),eo.init(es),eM=new pw(ei,eo,es),el=new pT(ei,eo,es),eu=new hX(ei),ec=new pc,eh=new pM(ei,eo,el,ec,es,eM,eu),ed=new h1(_),ep=new hW(_),ef=new uf(ei,es),ew=new hR(ei,eo,ef,es),em=new h5(ei,ef,eu,ew),eg=new hZ(ei,em,ef,eu),eb=new hj(ei,es,eh),ey=new hL(ec),e8=new pu(_,ed,ep,eo,es,ew,ey),e$=new pP(_,ec),ev=new pf,ex=new px(eo,es),eE=new hC(_,ed,ep,el,eg,f,c),eS=new p_(_,eg,es),eA=new pL(ei,eu,es,el),e_=new h0(ei,eo,eu,es),eT=new h7(ei,eo,eu,es),eu.programs=e8.programs,_.capabilities=es,_.extensions=eo,_.properties=ec,_.renderLists=ev,_.shadowMap=eS,_.state=el,_.info=eu}eC();let eR=new class e extends oP{constructor(e,t){super();let r=this,n=null,a=1,o=null,s="local-floor",c=1,h=null,d=null,p=null,f=null,m=null,$=null,x=t.getContextAttributes(),y=null,S=null,E=[],_=[],T=new ui;T.layers.enable(1),T.viewport=new so;let M=new ui;M.layers.enable(2),M.viewport=new so;let A=[T,M],C=new class e extends ui{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}};C.layers.enable(1),C.layers.enable(2);let R=null,P=null;function D(e){let t=_.indexOf(e.inputSource);if(-1===t)return;let r=E[t];void 0!==r&&(r.update(e.inputSource,e.frame,h||o),r.dispatchEvent({type:e.type,data:e.inputSource}))}function U(){n.removeEventListener("select",D),n.removeEventListener("selectstart",D),n.removeEventListener("selectend",D),n.removeEventListener("squeeze",D),n.removeEventListener("squeezestart",D),n.removeEventListener("squeezeend",D),n.removeEventListener("end",U),n.removeEventListener("inputsourceschange",I);for(let t=0;t<E.length;t++){let a=_[t];null!==a&&(_[t]=null,E[t].disconnect(a))}R=null,P=null,e.setRenderTarget(y),m=null,f=null,p=null,n=null,S=null,z.stop(),r.isPresenting=!1,r.dispatchEvent({type:"sessionend"})}function I(e){for(let t=0;t<e.removed.length;t++){let r=e.removed[t],n=_.indexOf(r);n>=0&&(_[n]=null,E[n].disconnect(r))}for(let a=0;a<e.added.length;a++){let o=e.added[a],s=_.indexOf(o);if(-1===s){for(let c=0;c<E.length;c++)if(c>=_.length){_.push(o),s=c;break}else if(null===_[c]){_[c]=o,s=c;break}if(-1===s)break}let h=E[s];h&&h.connect(o)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=E[e];return void 0===t&&(t=new pR,E[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=E[e];return void 0===t&&(t=new pR,E[e]=t),t.getGripSpace()},this.getHand=function(e){let t=E[e];return void 0===t&&(t=new pR,E[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){a=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===r.isPresenting&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||o},this.setReferenceSpace=function(e){h=e},this.getBaseLayer=function(){return null!==f?f:m},this.getBinding=function(){return p},this.getFrame=function(){return $},this.getSession=function(){return n},this.setSession=async function(d){if(null!==(n=d)){if(y=e.getRenderTarget(),n.addEventListener("select",D),n.addEventListener("selectstart",D),n.addEventListener("selectend",D),n.addEventListener("squeeze",D),n.addEventListener("squeezestart",D),n.addEventListener("squeezeend",D),n.addEventListener("end",U),n.addEventListener("inputsourceschange",I),!0!==x.xrCompatible&&await t.makeXRCompatible(),void 0===n.renderState.layers||!1===e.capabilities.isWebGL2){let $={antialias:void 0!==n.renderState.layers||x.antialias,alpha:!0,depth:x.depth,stencil:x.stencil,framebufferScaleFactor:a};m=new XRWebGLLayer(n,t,$),n.updateRenderState({baseLayer:m}),S=new sl(m.framebufferWidth,m.framebufferHeight,{format:1023,type:1009,colorSpace:e.outputColorSpace,stencilBuffer:x.stencil})}else{let E=null,_=null,T=null;x.depth&&(T=x.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,E=x.stencil?1027:1026,_=x.stencil?1020:1014);let M={colorFormat:t.RGBA8,depthFormat:T,scaleFactor:a};f=(p=new XRWebGLBinding(n,t)).createProjectionLayer(M),n.updateRenderState({layers:[f]}),S=new sl(f.textureWidth,f.textureHeight,{format:1023,type:1009,depthTexture:new p0(f.textureWidth,f.textureHeight,_,void 0,void 0,void 0,void 0,void 0,void 0,E),stencilBuffer:x.stencil,colorSpace:e.outputColorSpace,samples:x.antialias?4:0});let A=e.properties.get(S);A.__ignoreDepthValues=f.ignoreDepthValues}S.isXRRenderTarget=!0,this.setFoveation(c),h=null,o=await n.requestReferenceSpace(s),z.setContext(n),z.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode};let N=new sh,O=new sh;function F(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){var t,r,a;if(null===n)return;C.near=M.near=T.near=e.near,C.far=M.far=T.far=e.far,(R!==C.near||P!==C.far)&&(n.updateRenderState({depthNear:C.near,depthFar:C.far}),R=C.near,P=C.far);let o=e.parent,s=C.cameras;F(C,o);for(let c=0;c<s.length;c++)F(s[c],o);2===s.length?function e(t,r,n){N.setFromMatrixPosition(r.matrixWorld),O.setFromMatrixPosition(n.matrixWorld);let a=N.distanceTo(O),o=r.projectionMatrix.elements,s=n.projectionMatrix.elements,c=o[14]/(o[10]-1),h=o[14]/(o[10]+1),d=(o[9]+1)/o[5],p=(o[9]-1)/o[5],f=(o[8]-1)/o[0],m=(s[8]+1)/s[0],$=a/(-f+m),x=-($*f);r.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(x),t.translateZ($),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert();let y=c+$,S=h+$;t.projectionMatrix.makePerspective(c*f-x,c*m+(a-x),d*h/S*y,p*h/S*y,y,S),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}(C,T,M):C.projectionMatrix.copy(T.projectionMatrix),t=e,r=C,null===(a=o)?t.matrix.copy(r.matrixWorld):(t.matrix.copy(a.matrixWorld),t.matrix.invert(),t.matrix.multiply(r.matrixWorld)),t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(r.projectionMatrix),t.projectionMatrixInverse.copy(r.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*oU*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)},this.getCamera=function(){return C},this.getFoveation=function(){if(!(null===f&&null===m))return c},this.setFoveation=function(e){c=e,null!==f&&(f.fixedFoveation=e),null!==m&&void 0!==m.fixedFoveation&&(m.fixedFoveation=e)};let B=null,z=new up;z.setAnimationLoop(function t(n,a){if(d=a.getViewerPose(h||o),$=a,null!==d){let s=d.views;null!==m&&(e.setRenderTargetFramebuffer(S,m.framebuffer),e.setRenderTarget(S));let c=!1;s.length!==C.cameras.length&&(C.cameras.length=0,c=!0);for(let x=0;x<s.length;x++){let y=s[x],T=null;if(null!==m)T=m.getViewport(y);else{let M=p.getViewSubImage(f,y);T=M.viewport,0===x&&(e.setRenderTargetTextures(S,M.colorTexture,f.ignoreDepthValues?void 0:M.depthStencilTexture),e.setRenderTarget(S))}let R=A[x];void 0===R&&((R=new ui).layers.enable(x),R.viewport=new so,A[x]=R),R.matrix.fromArray(y.transform.matrix),R.matrix.decompose(R.position,R.quaternion,R.scale),R.projectionMatrix.fromArray(y.projectionMatrix),R.projectionMatrixInverse.copy(R.projectionMatrix).invert(),R.viewport.set(T.x,T.y,T.width,T.height),0===x&&(C.matrix.copy(R.matrix),C.matrix.decompose(C.position,C.quaternion,C.scale)),!0===c&&C.cameras.push(R)}}for(let P=0;P<E.length;P++){let D=_[P],U=E[P];null!==D&&void 0!==U&&U.update(D,a,h||o)}B&&B(n,a),a.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:a}),$=null}),this.setAnimationLoop=function(e){B=e},this.dispose=function(){}}}(_,ei);function e0(e){e.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function eP(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;let e=eu.autoReset,t=eS.enabled,r=eS.autoUpdate,n=eS.needsUpdate,a=eS.type;eC(),eu.autoReset=e,eS.enabled=t,eS.autoUpdate=r,eS.needsUpdate=n,eS.type=a}function eL(e){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function e1(e){var t;let r=e.target;r.removeEventListener("dispose",e1),function e(t){let r=ec.get(t).programs;void 0!==r&&(r.forEach(function(e){e8.releaseProgram(e)}),t.isShaderMaterial&&e8.releaseShaderCache(t))}(t=r),ec.remove(t)}function eD(e,t,r){!0===e.transparent&&2===e.side&&!1===e.forceSinglePass?(e.side=1,e.needsUpdate=!0,e2(e,t,r),e.side=0,e.needsUpdate=!0,e2(e,t,r),e.side=2):e2(e,t,r)}this.xr=eR,this.getContext=function(){return ei},this.getContextAttributes=function(){return ei.getContextAttributes()},this.forceContextLoss=function(){let e=eo.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){let e=eo.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return z},this.setPixelRatio=function(e){void 0!==e&&(z=e,this.setSize(F,B,!1))},this.getSize=function(e){return e.set(F,B)},this.setSize=function(e,r,n=!0){if(eR.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}F=e,B=r,t.width=Math.floor(e*z),t.height=Math.floor(r*z),!0===n&&(t.style.width=e+"px",t.style.height=r+"px"),this.setViewport(0,0,e,r)},this.getDrawingBufferSize=function(e){return e.set(F*z,B*z).floor()},this.setDrawingBufferSize=function(e,r,n){F=e,B=r,z=n,t.width=Math.floor(e*n),t.height=Math.floor(r*n),this.setViewport(0,0,e,r)},this.getCurrentViewport=function(e){return e.copy(D)},this.getViewport=function(e){return e.copy(V)},this.setViewport=function(e,t,r,n){e.isVector4?V.set(e.x,e.y,e.z,e.w):V.set(e,t,r,n),el.viewport(D.copy(V).multiplyScalar(z).floor())},this.getScissor=function(e){return e.copy(G)},this.setScissor=function(e,t,r,n){e.isVector4?G.set(e.x,e.y,e.z,e.w):G.set(e,t,r,n),el.scissor(U.copy(G).multiplyScalar(z).floor())},this.getScissorTest=function(){return W},this.setScissorTest=function(e){el.setScissorTest(W=e)},this.setOpaqueSort=function(e){k=e},this.setTransparentSort=function(e){H=e},this.getClearColor=function(e){return e.copy(eE.getClearColor())},this.setClearColor=function(){eE.setClearColor.apply(eE,arguments)},this.getClearAlpha=function(){return eE.getClearAlpha()},this.setClearAlpha=function(){eE.setClearAlpha.apply(eE,arguments)},this.clear=function(e=!0,t=!0,r=!0){let n=0;if(e){let a=!1;if(null!==C){let o=C.texture.format;a=1033===o||1031===o||1029===o}if(a){let s=C.texture.type,c=eE.getClearColor(),h=eE.getClearAlpha(),d=c.r,p=c.g,f=c.b;1009===s||1014===s||1012===s||1020===s||1017===s||1018===s?(m[0]=d,m[1]=p,m[2]=f,m[3]=h,ei.clearBufferuiv(ei.COLOR,0,m)):($[0]=d,$[1]=p,$[2]=f,$[3]=h,ei.clearBufferiv(ei.COLOR,0,$))}else n|=ei.COLOR_BUFFER_BIT}t&&(n|=ei.DEPTH_BUFFER_BIT),r&&(n|=ei.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ei.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",e0,!1),t.removeEventListener("webglcontextrestored",eP,!1),t.removeEventListener("webglcontextcreationerror",eL,!1),ev.dispose(),ex.dispose(),ec.dispose(),ed.dispose(),ep.dispose(),eg.dispose(),ew.dispose(),eA.dispose(),e8.dispose(),eR.dispose(),eR.removeEventListener("sessionstart",eI),eR.removeEventListener("sessionend",eN),j&&(j.dispose(),j=null),eO.stop()},this.renderBufferDirect=function(e,t,r,n,a,o){null===t&&(t=Q);let s=a.isMesh&&0>a.matrixWorld.determinant(),c=function e(t,r,n,a,o){var s,c;!0!==r.isScene&&(r=Q),eh.resetTextureUnits();let h=r.fog,d=a.isMeshStandardMaterial?r.environment:null,p=null===C?_.outputColorSpace:!0===C.isXRRenderTarget?C.texture.colorSpace:oT,f=(a.isMeshStandardMaterial?ep:ed).get(a.envMap||d),m=!0===a.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,$=!!n.attributes.tangent&&(!!a.normalMap||a.anisotropy>0),x=!!n.morphAttributes.position,S=!!n.morphAttributes.normal,E=!!n.morphAttributes.color,T=ob;a.toneMapped&&(null===C||!0===C.isXRRenderTarget)&&(T=_.toneMapping);let M=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,A=void 0!==M?M.length:0,D=ec.get(a),U=y.state.lights;if(!0===q&&(!0===Y||t!==P)){let I=t===P&&a.id===R;ey.setState(a,t,I)}let N=!1;a.version===D.__version?(D.needsLights&&D.lightsStateVersion!==U.state.version||D.outputColorSpace!==p||o.isInstancedMesh&&!1===D.instancing||!o.isInstancedMesh&&!0===D.instancing||o.isSkinnedMesh&&!1===D.skinning||!o.isSkinnedMesh&&!0===D.skinning||o.isInstancedMesh&&!0===D.instancingColor&&null===o.instanceColor||o.isInstancedMesh&&!1===D.instancingColor&&null!==o.instanceColor||D.envMap!==f||!0===a.fog&&D.fog!==h||void 0!==D.numClippingPlanes&&(D.numClippingPlanes!==ey.numPlanes||D.numIntersection!==ey.numIntersection)||D.vertexAlphas!==m||D.vertexTangents!==$||D.morphTargets!==x||D.morphNormals!==S||D.morphColors!==E||D.toneMapping!==T||!0===es.isWebGL2&&D.morphTargetsCount!==A)&&(N=!0):(N=!0,D.__version=a.version);let O=D.currentProgram;!0===N&&(O=e2(a,r,o));let F=!1,k=!1,H=!1,V=O.getUniforms(),G=D.uniforms;if(el.useProgram(O.program)&&(F=!0,k=!0,H=!0),a.id!==R&&(R=a.id,k=!0),F||P!==t){V.setValue(ei,"projectionMatrix",t.projectionMatrix),V.setValue(ei,"viewMatrix",t.matrixWorldInverse);let W=V.map.cameraPosition;void 0!==W&&W.setValue(ei,J.setFromMatrixPosition(t.matrixWorld)),es.logarithmicDepthBuffer&&V.setValue(ei,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(a.isMeshPhongMaterial||a.isMeshToonMaterial||a.isMeshLambertMaterial||a.isMeshBasicMaterial||a.isMeshStandardMaterial||a.isShaderMaterial)&&V.setValue(ei,"isOrthographic",!0===t.isOrthographicCamera),P!==t&&(P=t,k=!0,H=!0)}if(o.isSkinnedMesh){V.setOptional(ei,o,"bindMatrix"),V.setOptional(ei,o,"bindMatrixInverse");let X=o.skeleton;X&&(es.floatVertexTextures?(null===X.boneTexture&&X.computeBoneTexture(),V.setValue(ei,"boneTexture",X.boneTexture,eh),V.setValue(ei,"boneTextureSize",X.boneTextureSize)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}let Z=n.morphAttributes;if((void 0!==Z.position||void 0!==Z.normal||void 0!==Z.color&&!0===es.isWebGL2)&&eb.update(o,n,O),(k||D.receiveShadow!==o.receiveShadow)&&(D.receiveShadow=o.receiveShadow,V.setValue(ei,"receiveShadow",o.receiveShadow)),a.isMeshGouraudMaterial&&null!==a.envMap&&(G.envMap.value=f,G.flipEnvMap.value=f.isCubeTexture&&!1===f.isRenderTargetTexture?-1:1),k&&(V.setValue(ei,"toneMappingExposure",_.toneMappingExposure),D.needsLights&&(s=G,c=H,s.ambientLightColor.needsUpdate=c,s.lightProbe.needsUpdate=c,s.directionalLights.needsUpdate=c,s.directionalLightShadows.needsUpdate=c,s.pointLights.needsUpdate=c,s.pointLightShadows.needsUpdate=c,s.spotLights.needsUpdate=c,s.spotLightShadows.needsUpdate=c,s.rectAreaLights.needsUpdate=c,s.hemisphereLights.needsUpdate=c),h&&!0===a.fog&&e$.refreshFogUniforms(G,h),e$.refreshMaterialUniforms(G,a,z,B,j),d7.upload(ei,ek(D),G,eh)),a.isShaderMaterial&&!0===a.uniformsNeedUpdate&&(d7.upload(ei,ek(D),G,eh),a.uniformsNeedUpdate=!1),a.isSpriteMaterial&&V.setValue(ei,"center",o.center),V.setValue(ei,"modelViewMatrix",o.modelViewMatrix),V.setValue(ei,"normalMatrix",o.normalMatrix),V.setValue(ei,"modelMatrix",o.matrixWorld),a.isShaderMaterial||a.isRawShaderMaterial){let K=a.uniformsGroups;for(let et=0,er=K.length;et<er;et++)if(es.isWebGL2){let en=K[et];eA.update(en,O),eA.bind(en,O)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return O}(e,t,r,n,a);el.setMaterial(n,s);let h=r.index,d=1;if(!0===n.wireframe){if(void 0===(h=em.getWireframeAttribute(r)))return;d=2}let p=r.drawRange,f=r.attributes.position,m=p.start*d,$=(p.start+p.count)*d;null!==o&&(m=Math.max(m,o.start*d),$=Math.min($,(o.start+o.count)*d)),null!==h?(m=Math.max(m,0),$=Math.min($,h.count)):null!=f&&(m=Math.max(m,0),$=Math.min($,f.count));let x=$-m;if(x<0||x===1/0)return;ew.setup(a,n,c,r,h);let S,E=e_;if(null!==h&&(S=ef.get(h),(E=eT).setIndex(S)),a.isMesh)!0===n.wireframe?(el.setLineWidth(n.wireframeLinewidth*et()),E.setMode(ei.LINES)):E.setMode(ei.TRIANGLES);else if(a.isLine){let T=n.linewidth;void 0===T&&(T=1),el.setLineWidth(T*et()),a.isLineSegments?E.setMode(ei.LINES):a.isLineLoop?E.setMode(ei.LINE_LOOP):E.setMode(ei.LINE_STRIP)}else a.isPoints?E.setMode(ei.POINTS):a.isSprite&&E.setMode(ei.TRIANGLES);if(a.isInstancedMesh)E.renderInstances(m,x,a.count);else if(r.isInstancedBufferGeometry){let M=void 0!==r._maxInstanceCount?r._maxInstanceCount:1/0,A=Math.min(r.instanceCount,M);E.renderInstances(m,x,A)}else E.render(m,x)},this.compile=function(e,t,r=null){null===r&&(r=e),(y=ex.get(r)).init(),E.push(y),r.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(y.pushLight(e),e.castShadow&&y.pushShadow(e))}),e!==r&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(y.pushLight(e),e.castShadow&&y.pushShadow(e))}),y.setupLights(_._useLegacyLights);let n=new Set;return e.traverse(function(e){let t=e.material;if(t){if(Array.isArray(t))for(let a=0;a<t.length;a++){let o=t[a];eD(o,r,e),n.add(o)}else eD(t,r,e),n.add(t)}}),E.pop(),y=null,n},this.compileAsync=function(e,t,r=null){let n=this.compile(e,t,r);return new Promise(t=>{function r(){if(n.forEach(function(e){ec.get(e).currentProgram.isReady()&&n.delete(e)}),0===n.size){t(e);return}setTimeout(r,10)}null!==eo.get("KHR_parallel_shader_compile")?r():setTimeout(r,10)})};let eU=null;function eI(){eO.stop()}function eN(){eO.start()}let eO=new up;function eF(e,t,r,n){let a=e.opaque,o=e.transmissive,s=e.transparent;y.setupLightsView(r),!0===q&&ey.setGlobalState(_.clippingPlanes,r),o.length>0&&function e(t,r,n,a){if((!0===n.isScene?n.overrideMaterial:null)!==null)return;let o=es.isWebGL2;null===j&&(j=new sl(1,1,{generateMipmaps:!0,type:eo.has("EXT_color_buffer_half_float")?1016:1009,minFilter:1008,samples:o?4:0})),_.getDrawingBufferSize(K),o?j.setSize(K.x,K.y):j.setSize(ok(K.x),ok(K.y));let s=_.getRenderTarget();_.setRenderTarget(j),_.getClearColor(N),(O=_.getClearAlpha())<1&&_.setClearColor(16777215,.5),_.clear();let c=_.toneMapping;_.toneMapping=ob,eB(t,n,a),eh.updateMultisampleRenderTarget(j),eh.updateRenderTargetMipmap(j);let h=!1;for(let d=0,p=r.length;d<p;d++){let f=r[d],m=f.object,$=f.geometry,x=f.material,y=f.group;if(2===x.side&&m.layers.test(a.layers)){let S=x.side;x.side=1,x.needsUpdate=!0,ez(m,n,a,$,x,y),x.side=S,x.needsUpdate=!0,h=!0}}!0===h&&(eh.updateMultisampleRenderTarget(j),eh.updateRenderTargetMipmap(j)),_.setRenderTarget(s),_.setClearColor(N,O),_.toneMapping=c}(a,o,t,r),n&&el.viewport(D.copy(n)),a.length>0&&eB(a,t,r),o.length>0&&eB(o,t,r),s.length>0&&eB(s,t,r),el.buffers.depth.setTest(!0),el.buffers.depth.setMask(!0),el.buffers.color.setMask(!0),el.setPolygonOffset(!1)}function eB(e,t,r){let n=!0===t.isScene?t.overrideMaterial:null;for(let a=0,o=e.length;a<o;a++){let s=e[a],c=s.object,h=s.geometry,d=null===n?s.material:n,p=s.group;c.layers.test(r.layers)&&ez(c,t,r,h,d,p)}}function ez(e,t,r,n,a,o){e.onBeforeRender(_,t,r,n,a,o),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),a.onBeforeRender(_,t,r,n,e,o),!0===a.transparent&&2===a.side&&!1===a.forceSinglePass?(a.side=1,a.needsUpdate=!0,_.renderBufferDirect(r,t,n,a,e,o),a.side=0,a.needsUpdate=!0,_.renderBufferDirect(r,t,n,a,e,o),a.side=2):_.renderBufferDirect(r,t,n,a,e,o),e.onAfterRender(_,t,r,n,a,o)}function e2(e,t,r){var n;!0!==t.isScene&&(t=Q);let a=ec.get(e),o=y.state.lights,s=y.state.shadowsArray,c=o.state.version,h=e8.getParameters(e,o.state,s,t,r),d=e8.getProgramCacheKey(h),p=a.programs;a.environment=e.isMeshStandardMaterial?t.environment:null,a.fog=t.fog,a.envMap=(e.isMeshStandardMaterial?ep:ed).get(e.envMap||a.environment),void 0===p&&(e.addEventListener("dispose",e1),p=new Map,a.programs=p);let f=p.get(d);if(void 0!==f){if(a.currentProgram===f&&a.lightsStateVersion===c)return eH(e,h),f}else h.uniforms=e8.getUniforms(e),e.onBuild(r,h,_),e.onBeforeCompile(h,_),f=e8.acquireProgram(h,d),p.set(d,f),a.uniforms=h.uniforms;let m=a.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(m.clippingPlanes=ey.uniform),eH(e,h),a.needsLights=(n=e,n.isMeshLambertMaterial||n.isMeshToonMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.isShadowMaterial||n.isShaderMaterial&&!0===n.lights),a.lightsStateVersion=c,a.needsLights&&(m.ambientLightColor.value=o.state.ambient,m.lightProbe.value=o.state.probe,m.directionalLights.value=o.state.directional,m.directionalLightShadows.value=o.state.directionalShadow,m.spotLights.value=o.state.spot,m.spotLightShadows.value=o.state.spotShadow,m.rectAreaLights.value=o.state.rectArea,m.ltc_1.value=o.state.rectAreaLTC1,m.ltc_2.value=o.state.rectAreaLTC2,m.pointLights.value=o.state.point,m.pointLightShadows.value=o.state.pointShadow,m.hemisphereLights.value=o.state.hemi,m.directionalShadowMap.value=o.state.directionalShadowMap,m.directionalShadowMatrix.value=o.state.directionalShadowMatrix,m.spotShadowMap.value=o.state.spotShadowMap,m.spotLightMatrix.value=o.state.spotLightMatrix,m.spotLightMap.value=o.state.spotLightMap,m.pointShadowMap.value=o.state.pointShadowMap,m.pointShadowMatrix.value=o.state.pointShadowMatrix),a.currentProgram=f,a.uniformsList=null,f}function ek(e){if(null===e.uniformsList){let t=e.currentProgram.getUniforms();e.uniformsList=d7.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function eH(e,t){let r=ec.get(e);r.outputColorSpace=t.outputColorSpace,r.instancing=t.instancing,r.instancingColor=t.instancingColor,r.skinning=t.skinning,r.morphTargets=t.morphTargets,r.morphNormals=t.morphNormals,r.morphColors=t.morphColors,r.morphTargetsCount=t.morphTargetsCount,r.numClippingPlanes=t.numClippingPlanes,r.numIntersection=t.numClipIntersection,r.vertexAlphas=t.vertexAlphas,r.vertexTangents=t.vertexTangents,r.toneMapping=t.toneMapping}eO.setAnimationLoop(function e(t){eU&&eU(t)}),"u">typeof self&&eO.setContext(self),this.setAnimationLoop=function(e){eU=e,eR.setAnimationLoop(e),null===e?eO.stop():eO.start()},eR.addEventListener("sessionstart",eI),eR.addEventListener("sessionend",eN),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(!0===T)return;!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===eR.enabled&&!0===eR.isPresenting&&(!0===eR.cameraAutoUpdate&&eR.updateCamera(t),t=eR.getCamera()),!0===e.isScene&&e.onBeforeRender(_,e,t,C),(y=ex.get(e,E.length)).init(),E.push(y),Z.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),X.setFromProjectionMatrix(Z),Y=this.localClippingEnabled,q=ey.init(this.clippingPlanes,Y),(x=ev.get(e,S.length)).init(),S.push(x),function e(t,r,n,a){if(!1===t.visible)return;if(t.layers.test(r.layers)){if(t.isGroup)n=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(r);else if(t.isLight)y.pushLight(t),t.castShadow&&y.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||X.intersectsSprite(t)){a&&J.setFromMatrixPosition(t.matrixWorld).applyMatrix4(Z);let o=eg.update(t),s=t.material;s.visible&&x.push(t,o,s,n,J.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||X.intersectsObject(t))){let c=eg.update(t),h=t.material;if(a&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),J.copy(t.boundingSphere.center)):(null===c.boundingSphere&&c.computeBoundingSphere(),J.copy(c.boundingSphere.center)),J.applyMatrix4(t.matrixWorld).applyMatrix4(Z)),Array.isArray(h)){let d=c.groups;for(let p=0,f=d.length;p<f;p++){let m=d[p],$=h[m.materialIndex];$&&$.visible&&x.push(t,c,$,n,J.z,m)}}else h.visible&&x.push(t,c,h,n,J.z,null)}}let S=t.children;for(let E=0,_=S.length;E<_;E++)e(S[E],r,n,a)}(e,t,0,_.sortObjects),x.finish(),!0===_.sortObjects&&x.sort(k,H),this.info.render.frame++,!0===q&&ey.beginShadows();let r=y.state.shadowsArray;if(eS.render(r,e,t),!0===q&&ey.endShadows(),!0===this.info.autoReset&&this.info.reset(),eE.render(x,e),y.setupLights(_._useLegacyLights),t.isArrayCamera){let n=t.cameras;for(let a=0,o=n.length;a<o;a++){let s=n[a];eF(x,e,s,s.viewport)}}else eF(x,e,t);null!==C&&(eh.updateMultisampleRenderTarget(C),eh.updateRenderTargetMipmap(C)),!0===e.isScene&&e.onAfterRender(_,e,t),ew.resetDefaultState(),R=-1,P=null,E.pop(),y=E.length>0?E[E.length-1]:null,S.pop(),x=S.length>0?S[S.length-1]:null},this.getActiveCubeFace=function(){return M},this.getActiveMipmapLevel=function(){return A},this.getRenderTarget=function(){return C},this.setRenderTargetTextures=function(e,t,r){ec.get(e.texture).__webglTexture=t,ec.get(e.depthTexture).__webglTexture=r;let n=ec.get(e);n.__hasExternalTextures=!0,n.__hasExternalTextures&&(n.__autoAllocateDepthBuffer=void 0===r,n.__autoAllocateDepthBuffer||!0===eo.has("WEBGL_multisampled_render_to_texture")&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),n.__useRenderToTexture=!1))},this.setRenderTargetFramebuffer=function(e,t){let r=ec.get(e);r.__webglFramebuffer=t,r.__useDefaultFramebuffer=void 0===t},this.setRenderTarget=function(e,t=0,r=0){C=e,M=t,A=r;let n=!0,a=null,o=!1,s=!1;if(e){let c=ec.get(e);void 0!==c.__useDefaultFramebuffer?(el.bindFramebuffer(ei.FRAMEBUFFER,null),n=!1):void 0===c.__webglFramebuffer?eh.setupRenderTarget(e):c.__hasExternalTextures&&eh.rebindTextures(e,ec.get(e.texture).__webglTexture,ec.get(e.depthTexture).__webglTexture);let h=e.texture;(h.isData3DTexture||h.isDataArrayTexture||h.isCompressedArrayTexture)&&(s=!0);let d=ec.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(a=Array.isArray(d[t])?d[t][r]:d[t],o=!0):a=es.isWebGL2&&e.samples>0&&!1===eh.useMultisampledRTT(e)?ec.get(e).__webglMultisampledFramebuffer:Array.isArray(d)?d[r]:d,D.copy(e.viewport),U.copy(e.scissor),I=e.scissorTest}else D.copy(V).multiplyScalar(z).floor(),U.copy(G).multiplyScalar(z).floor(),I=W;if(el.bindFramebuffer(ei.FRAMEBUFFER,a)&&es.drawBuffers&&n&&el.drawBuffers(e,a),el.viewport(D),el.scissor(U),el.setScissorTest(I),o){let p=ec.get(e.texture);ei.framebufferTexture2D(ei.FRAMEBUFFER,ei.COLOR_ATTACHMENT0,ei.TEXTURE_CUBE_MAP_POSITIVE_X+t,p.__webglTexture,r)}else if(s){let f=ec.get(e.texture);ei.framebufferTextureLayer(ei.FRAMEBUFFER,ei.COLOR_ATTACHMENT0,f.__webglTexture,r||0,t||0)}R=-1},this.readRenderTargetPixels=function(e,t,r,n,a,o,s){if(!(e&&e.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let c=ec.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(c=c[s]),c){el.bindFramebuffer(ei.FRAMEBUFFER,c);try{let h=e.texture,d=h.format,p=h.type;if(1023!==d&&eM.convert(d)!==ei.getParameter(ei.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let f=1016===p&&(eo.has("EXT_color_buffer_half_float")||es.isWebGL2&&eo.has("EXT_color_buffer_float"));if(1009!==p&&eM.convert(p)!==ei.getParameter(ei.IMPLEMENTATION_COLOR_READ_TYPE)&&!(1015===p&&(es.isWebGL2||eo.has("OES_texture_float")||eo.has("WEBGL_color_buffer_float")))&&!f){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}t>=0&&t<=e.width-n&&r>=0&&r<=e.height-a&&ei.readPixels(t,r,n,a,eM.convert(d),eM.convert(p),o)}finally{let m=null!==C?ec.get(C).__webglFramebuffer:null;el.bindFramebuffer(ei.FRAMEBUFFER,m)}}},this.copyFramebufferToTexture=function(e,t,r=0){let n=Math.pow(2,-r),a=Math.floor(t.image.width*n),o=Math.floor(t.image.height*n);eh.setTexture2D(t,0),ei.copyTexSubImage2D(ei.TEXTURE_2D,r,0,0,e.x,e.y,a,o),el.unbindTexture()},this.copyTextureToTexture=function(e,t,r,n=0){let a=t.image.width,o=t.image.height,s=eM.convert(r.format),c=eM.convert(r.type);eh.setTexture2D(r,0),ei.pixelStorei(ei.UNPACK_FLIP_Y_WEBGL,r.flipY),ei.pixelStorei(ei.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.premultiplyAlpha),ei.pixelStorei(ei.UNPACK_ALIGNMENT,r.unpackAlignment),t.isDataTexture?ei.texSubImage2D(ei.TEXTURE_2D,n,e.x,e.y,a,o,s,c,t.image.data):t.isCompressedTexture?ei.compressedTexSubImage2D(ei.TEXTURE_2D,n,e.x,e.y,t.mipmaps[0].width,t.mipmaps[0].height,s,t.mipmaps[0].data):ei.texSubImage2D(ei.TEXTURE_2D,n,e.x,e.y,s,c,t.image),0===n&&r.generateMipmaps&&ei.generateMipmap(ei.TEXTURE_2D),el.unbindTexture()},this.copyTextureToTexture3D=function(e,t,r,n,a=0){if(_.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let o=e.max.x-e.min.x+1,s=e.max.y-e.min.y+1,c=e.max.z-e.min.z+1,h=eM.convert(n.format),d=eM.convert(n.type),p;if(n.isData3DTexture)eh.setTexture3D(n,0),p=ei.TEXTURE_3D;else if(n.isDataArrayTexture)eh.setTexture2DArray(n,0),p=ei.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ei.pixelStorei(ei.UNPACK_FLIP_Y_WEBGL,n.flipY),ei.pixelStorei(ei.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.premultiplyAlpha),ei.pixelStorei(ei.UNPACK_ALIGNMENT,n.unpackAlignment);let f=ei.getParameter(ei.UNPACK_ROW_LENGTH),m=ei.getParameter(ei.UNPACK_IMAGE_HEIGHT),$=ei.getParameter(ei.UNPACK_SKIP_PIXELS),x=ei.getParameter(ei.UNPACK_SKIP_ROWS),y=ei.getParameter(ei.UNPACK_SKIP_IMAGES),S=r.isCompressedTexture?r.mipmaps[0]:r.image;ei.pixelStorei(ei.UNPACK_ROW_LENGTH,S.width),ei.pixelStorei(ei.UNPACK_IMAGE_HEIGHT,S.height),ei.pixelStorei(ei.UNPACK_SKIP_PIXELS,e.min.x),ei.pixelStorei(ei.UNPACK_SKIP_ROWS,e.min.y),ei.pixelStorei(ei.UNPACK_SKIP_IMAGES,e.min.z),r.isDataTexture||r.isData3DTexture?ei.texSubImage3D(p,a,t.x,t.y,t.z,o,s,c,h,d,S.data):r.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),ei.compressedTexSubImage3D(p,a,t.x,t.y,t.z,o,s,c,h,S.data)):ei.texSubImage3D(p,a,t.x,t.y,t.z,o,s,c,h,d,S),ei.pixelStorei(ei.UNPACK_ROW_LENGTH,f),ei.pixelStorei(ei.UNPACK_IMAGE_HEIGHT,m),ei.pixelStorei(ei.UNPACK_SKIP_PIXELS,$),ei.pixelStorei(ei.UNPACK_SKIP_ROWS,x),ei.pixelStorei(ei.UNPACK_SKIP_IMAGES,y),0===a&&n.generateMipmaps&&ei.generateMipmap(p),el.unbindTexture()},this.initTexture=function(e){e.isCubeTexture?eh.setTextureCube(e,0):e.isData3DTexture?eh.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?eh.setTexture2DArray(e,0):eh.setTexture2D(e,0),el.unbindTexture()},this.resetState=function(){M=0,A=0,C=null,el.reset(),ew.reset()},"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return 2e3}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===oM?"display-p3":"srgb",t.unpackColorSpace=oK.workingColorSpace===ow?"display-p3":"srgb"}get physicallyCorrectLights(){return console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),!this.useLegacyLights}set physicallyCorrectLights(e){console.warn("THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead."),this.useLegacyLights=!e}get outputEncoding(){return console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace===o_?3001:3e3}set outputEncoding(e){console.warn("THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead."),this.outputColorSpace=3001===e?o_:oT}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}}(class e extends p1{}).prototype.isWebGL1Renderer=!0;class pD extends li{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.overrideMaterial=null,"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t}}let pU=new sF,pI=new sO,pN=new s0,pO=new sh;class pF extends li{constructor(e=new lU,t=new class e extends lS{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new lv(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){let r=this.geometry,n=this.matrixWorld,a=e.params.Points.threshold,o=r.drawRange;if(null===r.boundingSphere&&r.computeBoundingSphere(),pN.copy(r.boundingSphere),pN.applyMatrix4(n),pN.radius+=a,!1===e.ray.intersectsSphere(pN))return;pU.copy(n).invert(),pI.copy(e.ray).applyMatrix4(pU);let s=a/((this.scale.x+this.scale.y+this.scale.z)/3),c=s*s,h=r.index,d=r.attributes.position;if(null!==h){let p=Math.max(0,o.start),f=Math.min(h.count,o.start+o.count);for(let m=p,$=f;m<$;m++){let x=h.getX(m);pO.fromBufferAttribute(d,x),pB(pO,x,c,n,e,t,this)}}else{let y=Math.max(0,o.start),S=Math.min(d.count,o.start+o.count);for(let E=y,_=S;E<_;E++)pO.fromBufferAttribute(d,E),pB(pO,E,c,n,e,t,this)}}updateMorphTargets(){let e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){let r=e[t[0]];if(void 0!==r){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let n=0,a=r.length;n<a;n++){let o=r[n].name||String(n);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=n}}}}}function pB(e,t,r,n,a,o,s){let c=pI.distanceSqToPoint(e);if(c<r){let h=new sh;pI.closestPointToPoint(e,h),h.applyMatrix4(n);let d=a.ray.origin.distanceTo(h);if(d<a.near||d>a.far)return;o.push({distance:d,distanceToRay:Math.sqrt(c),point:h,index:t,face:null,object:s})}}class pz extends lU{constructor(e=1,t=1,r=1,n=32,a=1,o=!1,s=0,c=2*Math.PI){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:n,heightSegments:a,openEnded:o,thetaStart:s,thetaLength:c};let h=this;n=Math.floor(n),a=Math.floor(a);let d=[],p=[],f=[],m=[],$=0,x=[],y=r/2,S=0;function E(r){let a=$,o=new oG,x=new sh,E=0,_=!0===r?e:t,T=!0===r?1:-1;for(let M=1;M<=n;M++)p.push(0,y*T,0),f.push(0,T,0),m.push(.5,.5),$++;let A=$;for(let C=0;C<=n;C++){let R=C/n*c+s,P=Math.cos(R),D=Math.sin(R);x.x=_*D,x.y=y*T,x.z=_*P,p.push(x.x,x.y,x.z),f.push(0,T,0),o.x=.5*P+.5,o.y=.5*D*T+.5,m.push(o.x,o.y),$++}for(let U=0;U<n;U++){let I=a+U,N=A+U;!0===r?d.push(N,N+1,I):d.push(N+1,N,I),E+=3}h.addGroup(S,E,!0===r?1:2),S+=E}(function o(){let E=new sh,_=new sh,T=0,M=(t-e)/r;for(let A=0;A<=a;A++){let C=[],R=A/a,P=R*(t-e)+e;for(let D=0;D<=n;D++){let U=D/n,I=U*c+s,N=Math.sin(I),O=Math.cos(I);_.x=P*N,_.y=-R*r+y,_.z=P*O,p.push(_.x,_.y,_.z),E.set(N,M,O).normalize(),f.push(E.x,E.y,E.z),m.push(U,1-R),C.push($++)}x.push(C)}for(let F=0;F<n;F++)for(let B=0;B<a;B++){let z=x[B][F],k=x[B+1][F],H=x[B+1][F+1],V=x[B][F+1];d.push(z,k,V),d.push(k,H,V),T+=6}h.addGroup(S,T,0),S+=T})(),!1===o&&(e>0&&E(!0),t>0&&E(!1)),this.setIndex(d),this.setAttribute("position",new lA(p,3)),this.setAttribute("normal",new lA(f,3)),this.setAttribute("uv",new lA(m,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new pz(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}let p2={enabled:!1,files:{},add:function(e,t){!1!==this.enabled&&(this.files[e]=t)},get:function(e){if(!1!==this.enabled)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}},pk=new class e{constructor(e,t,r){let n=this,a=!1,o=0,s=0,c,h=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=r,this.itemStart=function(e){s++,!1===a&&void 0!==n.onStart&&n.onStart(e,o,s),a=!0},this.itemEnd=function(e){o++,void 0!==n.onProgress&&n.onProgress(e,o,s),o===s&&(a=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(e){void 0!==n.onError&&n.onError(e)},this.resolveURL=function(e){return c?c(e):e},this.setURLModifier=function(e){return c=e,this},this.addHandler=function(e,t){return h.push(e,t),this},this.removeHandler=function(e){let t=h.indexOf(e);return -1!==t&&h.splice(t,2),this},this.getHandler=function(e){for(let t=0,r=h.length;t<r;t+=2){let n=h[t],a=h[t+1];if(n.global&&(n.lastIndex=0),n.test(e))return a}return null}}};class pH{constructor(e){this.manager=void 0!==e?e:pk,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let r=this;return new Promise(function(n,a){r.load(e,n,t,a)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}}pH.DEFAULT_MATERIAL_NAME="__DEFAULT";let pV={};class p3 extends Error{constructor(e,t){super(e),this.response=t}}class pG extends pH{constructor(e){super(e)}load(e,t,r,n){void 0===e&&(e=""),void 0!==this.path&&(e=this.path+e),e=this.manager.resolveURL(e);let a=p2.get(e);if(void 0!==a)return this.manager.itemStart(e),setTimeout(()=>{t&&t(a),this.manager.itemEnd(e)},0),a;if(void 0!==pV[e]){pV[e].push({onLoad:t,onProgress:r,onError:n});return}pV[e]=[],pV[e].push({onLoad:t,onProgress:r,onError:n});let o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),s=this.mimeType,c=this.responseType;fetch(o).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||void 0===t.body||void 0===t.body.getReader)return t;let r=pV[e],n=t.body.getReader(),a=t.headers.get("Content-Length")||t.headers.get("X-File-Size"),o=a?parseInt(a):0,s=0!==o,c=0,h=new ReadableStream({start(e){(function t(){n.read().then(({done:n,value:a})=>{if(n)e.close();else{c+=a.byteLength;let h=new ProgressEvent("progress",{lengthComputable:s,loaded:c,total:o});for(let d=0,p=r.length;d<p;d++){let f=r[d];f.onProgress&&f.onProgress(h)}e.enqueue(a),t()}})})()}});return new Response(h)}throw new p3(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(c){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>new DOMParser().parseFromString(e,s));case"json":return e.json();default:if(void 0===s)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(s),r=t&&t[1]?t[1].toLowerCase():void 0,n=new TextDecoder(r);return e.arrayBuffer().then(e=>n.decode(e))}}}).then(t=>{p2.add(e,t);let r=pV[e];delete pV[e];for(let n=0,a=r.length;n<a;n++){let o=r[n];o.onLoad&&o.onLoad(t)}}).catch(t=>{let r=pV[e];if(void 0===r)throw this.manager.itemError(e),t;delete pV[e];for(let n=0,a=r.length;n<a;n++){let o=r[n];o.onError&&o.onError(t)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}let p4;class pW{static getContext(){return void 0===p4&&(p4=new(window.AudioContext||window.webkitAudioContext)),p4}static setContext(e){p4=e}}class p6 extends pH{constructor(e){super(e)}load(e,t,r,n){let a=this,o=new pG(this.manager);function s(t){n?n(t):console.error(t),a.manager.itemError(e)}o.setResponseType("arraybuffer"),o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(e){try{let r=e.slice(0);pW.getContext().decodeAudioData(r,function(e){t(e)},s)}catch(n){s(n)}},r,n)}}function p5(){return(typeof performance>"u"?Date:performance).now()}let p7=new sh,pX=new sc,pq=new sh,pY=new sh;class pj extends li{constructor(){super(),this.type="AudioListener",this.context=pW.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new class e{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=p5(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){let t=p5();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e);let t=this.context.listener,r=this.up;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(p7,pX,pq),pY.set(0,0,-1).applyQuaternion(pX),t.positionX){let n=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(p7.x,n),t.positionY.linearRampToValueAtTime(p7.y,n),t.positionZ.linearRampToValueAtTime(p7.z,n),t.forwardX.linearRampToValueAtTime(pY.x,n),t.forwardY.linearRampToValueAtTime(pY.y,n),t.forwardZ.linearRampToValueAtTime(pY.z,n),t.upX.linearRampToValueAtTime(r.x,n),t.upY.linearRampToValueAtTime(r.y,n),t.upZ.linearRampToValueAtTime(r.z,n)}else t.setPosition(p7.x,p7.y,p7.z),t.setOrientation(pY.x,pY.y,pY.z,r.x,r.y,r.z)}}class pZ extends li{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(e=0){if(!0===this.isPlaying){console.warn("THREE.Audio: Audio is already playing.");return}if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}this._startedAt=this.context.currentTime+e;let t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return this._progress=0,null!==this.source&&(this.source.stop(),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(!1!==this._connected){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(e){return e||(e=[]),!0===this._connected?(this.disconnect(),this.filters=e.slice(),this.connect()):this.filters=e.slice(),this}setDetune(e){if(this.detune=e,void 0!==this.source.detune)return!0===this.isPlaying&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(e){return this.setFilters(e?[e]:[])}setPlaybackRate(e){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,!0===this.isPlaying&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1}getLoop(){return!1===this.hasPlaybackControl?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop}setLoop(e){if(!1===this.hasPlaybackControl){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,!0===this.isPlaying&&(this.source.loop=this.loop),this}setLoopStart(e){return this.loopStart=e,this}setLoopEnd(e){return this.loopEnd=e,this}getVolume(){return this.gain.gain.value}setVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}}class pK{constructor(e,t=2048){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0,t=this.getFrequencyData();for(let r=0;r<t.length;r++)e+=t[r];return e/t.length}}function pJ(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function pQ(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}"u">typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:"158"}})),"u">typeof window&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__="158");let p9=`#define GLSLIFY 1
   varying float vDistance;uniform float time;uniform float offsetSize;uniform float size;uniform float offsetGain;uniform float amplitude;uniform float frequency;uniform float maxDistance;vec3 mod289(vec3 x){return x-floor(x*(1./289.))*289.;}vec2 mod289(vec2 x){return x-floor(x*(1./289.))*289.;}vec3 permute(vec3 x){return mod289(((x*34.)+1.)*x);}float noise(vec2 v){const vec4 C=vec4(.211324865405187,.366025403784439,-.577350269189626,.024390243902439);vec2 i=floor(v+dot(v,C.yy));vec2 x0=v-i+dot(i,C.xx);vec2 i1;i1=(x0.x>x0.y)?vec2(1.,0.):vec2(0.,1.);vec4 x12=x0.xyxy+C.xxzz;x12.xy-=i1;i=mod289(i);vec3 p=permute(permute(i.y+vec3(0.,i1.y,1.))+i.x+vec3(0.,i1.x,1.));vec3 m=max(.5-vec3(dot(x0,x0),dot(x12.xy,x12.xy),dot(x12.zw,x12.zw)),0.);m=m*m;m=m*m;vec3 x=2.*fract(p*C.www)-1.;vec3 h=abs(x)-.5;vec3 ox=floor(x+.5);vec3 a0=x-ox;m*=1.79284291400159-.85373472095314*(a0*a0+h*h);vec3 g;g.x=a0.x*x0.x+h.x*x0.y;g.yz=a0.yz*x12.xz+h.yz*x12.yw;return 130.*dot(m,g);}vec3 curl(float x,float y,float z){float eps=1.,eps2=2.*eps;float n1,n2,a,b;x+=time*.05;y+=time*.05;z+=time*.05;vec3 curl=vec3(0.);n1=noise(vec2(x,y+eps));n2=noise(vec2(x,y-eps));a=(n1-n2)/eps2;n1=noise(vec2(x,z+eps));n2=noise(vec2(x,z-eps));b=(n1-n2)/eps2;curl.x=a-b;n1=noise(vec2(y,z+eps));n2=noise(vec2(y,z-eps));a=(n1-n2)/eps2;n1=noise(vec2(x+eps,z));n2=noise(vec2(x+eps,z));b=(n1-n2)/eps2;curl.y=a-b;n1=noise(vec2(x+eps,y));n2=noise(vec2(x-eps,y));a=(n1-n2)/eps2;n1=noise(vec2(y+eps,z));n2=noise(vec2(y-eps,z));b=(n1-n2)/eps2;curl.z=a-b;return curl;}void main(){vec3 newpos=position;vec3 target=position+(normal*.1)+curl(newpos.x*frequency,newpos.y*frequency,newpos.z*frequency)*amplitude;float d=length(newpos-target)/maxDistance;newpos=mix(position,target,pow(d,4.));newpos.z+=sin(time)*(.1*offsetGain);vec4 mvPosition=modelViewMatrix*vec4(newpos,1.);gl_PointSize=size+(pow(d,3.)*offsetSize)*(1./-mvPosition.z);gl_Position=projectionMatrix*mvPosition;vDistance=d;}`,fe=`#define GLSLIFY 1
   varying float vDistance;uniform vec3 startColor;uniform vec3 endColor;float circle(in vec2 _st,in float _radius){vec2 dist=_st-vec2(.5);return 1.-smoothstep(_radius-(_radius*.01),_radius+(_radius*.01),dot(dist,dist)*4.);}void main(){float alpha=1.;vec2 uv=vec2(gl_PointCoord.x,1.-gl_PointCoord.y);vec3 circ=vec3(circle(uv,1.));vec3 color=vec3(1.);color=mix(startColor,endColor,vDistance);gl_FragColor=vec4(color,circ.r*vDistance);}`;class ft extends li{constructor(){super(),this.name="ReactiveParticles",this.time=0,this.properties={startColor:a,endColor:o,autoMix:e,showBox:t,showCylinder:r,autoRotate:!0}}init(){vY.holder.add(this),this.holderObjects=new li,this.add(this.holderObjects),this.material=new ue({side:2,vertexShader:p9,fragmentShader:fe,transparent:!0,uniforms:{time:{value:0},offsetSize:{value:2},size:{value:1.1},frequency:{value:2},amplitude:{value:1},offsetGain:{value:0},maxDistance:{value:h},startColor:{value:new lv(this.properties.startColor)},endColor:{value:new lv(this.properties.endColor)}}}),this.resetMesh(),this.showBoxMesh()}createBoxMesh(){let e=Math.floor(o3.randInt(5,20)),t=Math.floor(o3.randInt(1,40)),r=Math.floor(o3.randInt(5,80));this.geometry=new lY(1,1,1,e,t,r),this.material.uniforms.offsetSize.value=Math.floor(o3.randInt(30,60)),this.material.needsUpdate=!0,this.pointsMesh=new li,this.pointsMesh.rotateX(Math.PI/2),this.holderObjects.add(this.pointsMesh);let n=new pF(this.geometry,this.material);this.pointsMesh.add(n),gsap.to(this.pointsMesh.rotation,{duration:3,x:Math.random()*Math.PI,z:Math.random()*Math.PI*2,ease:"none"}),gsap.to(this.position,{duration:.6,z:o3.randInt(9,11),ease:"elastic.out(0.8)"})}createDummyMesh(){let e=Math.floor(o3.randInt(5,20)),t=Math.floor(o3.randInt(1,40)),r=Math.floor(o3.randInt(5,80));this.geometry=new lY(1,1,1,e,t,r),this.material.uniforms.offsetSize.value=Math.floor(o3.randInt(30,60)),this.material.needsUpdate=!0,this.pointsMesh=new li,this.pointsMesh.rotateX(Math.PI/2),this.holderObjects.add(this.pointsMesh);let n=new pF(this.geometry,this.material);this.pointsMesh.add(n),gsap.to(this.pointsMesh.rotation,{duration:3,x:Math.random()*Math.PI,z:Math.random()*Math.PI*2,ease:"none"}),gsap.to(this.position,{duration:.6,z:o3.randInt(9,11),ease:"elastic.out(0.8)"})}createDummy2Mesh(){let e=Math.floor(o3.randInt(1,3)),t=Math.floor(o3.randInt(1,5));this.geometry=new pz(1,1,4,64*e,64*t,!0),this.material.uniforms.offsetSize.value=Math.floor(o3.randInt(30,60)),this.material.uniforms.size.value=2,this.material.needsUpdate=!0,this.material.uniforms.needsUpdate=!0,this.pointsMesh=new pF(this.geometry,this.material),this.pointsMesh.rotation.set(Math.PI/2,0,0),this.holderObjects.add(this.pointsMesh);let r=0,n=o3.randInt(9,11);.2>Math.random()&&(r=Math.PI/2,n=o3.randInt(10,11.5)),gsap.to(this.holderObjects.rotation,{duration:.2,y:r,ease:"elastic.out(0.2)"}),gsap.to(this.position,{duration:.6,z:n,ease:"elastic.out(0.8)"})}createCylinderMesh(){let e=Math.floor(o3.randInt(1,3)),t=Math.floor(o3.randInt(1,5));this.geometry=new pz(1,1,4,64*e,64*t,!0),this.material.uniforms.offsetSize.value=Math.floor(o3.randInt(30,60)),this.material.uniforms.size.value=2,this.material.needsUpdate=!0,this.material.uniforms.needsUpdate=!0,this.pointsMesh=new pF(this.geometry,this.material),this.pointsMesh.rotation.set(Math.PI/2,0,0),this.holderObjects.add(this.pointsMesh);let r=0,n=o3.randInt(9,11);.2>Math.random()&&(r=Math.PI/2,n=o3.randInt(10,11.5)),gsap.to(this.holderObjects.rotation,{duration:.2,y:r,ease:"elastic.out(0.2)"}),gsap.to(this.position,{duration:.6,z:n,ease:"elastic.out(0.8)"})}onBPMBeat(){let e=vY.bpmManager.getBPMDuration()/1e3;vY.audioManager.isPlaying&&(.3>Math.random()&&this.properties.autoRotate&&gsap.to(this.holderObjects.rotation,{duration:.8>Math.random()?15:e,z:Math.random()*Math.PI,ease:"elastic.out(0.2)"}),.3>Math.random()&&this.resetMesh(),.3>Math.random()&&this.showBoxMesh(),.3>Math.random()&&this.showCylinderMesh())}resetMesh(){this.properties.autoMix&&(this.destroyMesh(),.5>Math.random()?this.createCylinderMesh():this.createBoxMesh(),gsap.to(this.material.uniforms.frequency,{duration:vY.bpmManager?vY.bpmManager.getBPMDuration()/1e3*2:2,value:o3.randFloat(.5,3),ease:"expo.easeInOut"}))}showBoxMesh(){this.properties.showBox&&(this.destroyMesh(),.5>Math.random()?this.createDummyMesh():this.createBoxMesh(),gsap.to(this.material.uniforms.frequency,{duration:vY.bpmManager?vY.bpmManager.getBPMDuration()/1e3*2:2,value:o3.randFloat(.5,3),ease:"expo.easeInOut"}))}showCylinderMesh(){this.properties.showCylinder&&(this.destroyMesh(),.5>Math.random()?this.createDummy2Mesh():this.createCylinderMesh(),gsap.to(this.material.uniforms.frequency,{duration:vY.bpmManager?vY.bpmManager.getBPMDuration()/1e3*2:2,value:o3.randFloat(.5,3),ease:"expo.easeInOut"}))}destroyMesh(){var e,t;this.pointsMesh&&(this.holderObjects.remove(this.pointsMesh),null==(e=this.pointsMesh.geometry)||e.dispose(),null==(t=this.pointsMesh.material)||t.dispose(),this.pointsMesh=null)}update(){var e;if(null!=(e=vY.audioManager)&&e.isPlaying){this.material.uniforms.amplitude.value=.8+o3.mapLinear(vY.audioManager.frequencyData.high,0,.6,-.1,.2),this.material.uniforms.offsetGain.value=.6*vY.audioManager.frequencyData.mid;let t=o3.mapLinear(vY.audioManager.frequencyData.low,.6,1,.2,.5);this.time+=o3.clamp(t,.2,.5)}else this.material.uniforms.frequency.value=.8,this.material.uniforms.amplitude.value=1,this.time+=.2;this.material.uniforms.time.value=this.time}}function fi(e,t){var r=e.__state.conversionName.toString(),n=Math.round(e.r),a=Math.round(e.g),o=Math.round(e.b),s=e.a,c=Math.round(e.h),h=e.s.toFixed(1),d=e.v.toFixed(1);if(t||"THREE_CHAR_HEX"===r||"SIX_CHAR_HEX"===r){for(var p=e.hex.toString(16);p.length<6;)p="0"+p;return"#"+p}return"CSS_RGB"===r?"rgb("+n+","+a+","+o+")":"CSS_RGBA"===r?"rgba("+n+","+a+","+o+","+s+")":"HEX"===r?"0x"+e.hex.toString(16):"RGB_ARRAY"===r?"["+n+","+a+","+o+"]":"RGBA_ARRAY"===r?"["+n+","+a+","+o+","+s+"]":"RGB_OBJ"===r?"{r:"+n+",g:"+a+",b:"+o+"}":"RGBA_OBJ"===r?"{r:"+n+",g:"+a+",b:"+o+",a:"+s+"}":"HSV_OBJ"===r?"{h:"+c+",s:"+h+",v:"+d+"}":"HSVA_OBJ"===r?"{h:"+c+",s:"+h+",v:"+d+",a:"+s+"}":"unknown format"}var fr=Array.prototype.forEach,fn=Array.prototype.slice,fa={BREAK:{},extend:function(e){return this.each(fn.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach((function(r){this.isUndefined(t[r])||(e[r]=t[r])}).bind(this))},this),e},defaults:function(e){return this.each(fn.call(arguments,1),function(t){(this.isObject(t)?Object.keys(t):[]).forEach((function(r){this.isUndefined(e[r])&&(e[r]=t[r])}).bind(this))},this),e},compose:function(){var e=fn.call(arguments);return function(){for(var t=fn.call(arguments),r=e.length-1;r>=0;r--)t=[e[r].apply(this,t)];return t[0]}},each:function(e,t,r){if(e){if(fr&&e.forEach&&e.forEach===fr)e.forEach(t,r);else if(e.length===e.length+0){var n=void 0,a=void 0;for(n=0,a=e.length;n<a;n++)if(n in e&&t.call(r,e[n],n)===this.BREAK)return}else for(var o in e)if(t.call(r,e[o],o)===this.BREAK)return}},defer:function(e){setTimeout(e,0)},debounce:function(e,t,r){var n=void 0;return function(){var a=this,o=arguments,s=r||!n;clearTimeout(n),n=setTimeout(function t(){n=null,r||e.apply(a,o)},t),s&&e.apply(a,o)}},toArray:function(e){return e.toArray?e.toArray():fn.call(e)},isUndefined:function(e){return void 0===e},isNull:function(e){return null===e},isNaN:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){return isNaN(e)}),isArray:Array.isArray||function(e){return e.constructor===Array},isObject:function(e){return e===Object(e)},isNumber:function(e){return e===e+0},isString:function(e){return e===e+""},isBoolean:function(e){return!1===e||!0===e},isFunction:function(e){return e instanceof Function}},fo=[{litmus:fa.isString,conversions:{THREE_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9])([A-F0-9])([A-F0-9])$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString()+t[1].toString()+t[2].toString()+t[2].toString()+t[3].toString()+t[3].toString(),0)}},write:fi},SIX_CHAR_HEX:{read:function(e){var t=e.match(/^#([A-F0-9]{6})$/i);return null!==t&&{space:"HEX",hex:parseInt("0x"+t[1].toString(),0)}},write:fi},CSS_RGB:{read:function(e){var t=e.match(/^rgb\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3])}},write:fi},CSS_RGBA:{read:function(e){var t=e.match(/^rgba\(\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*,\s*(\S+)\s*\)/);return null!==t&&{space:"RGB",r:parseFloat(t[1]),g:parseFloat(t[2]),b:parseFloat(t[3]),a:parseFloat(t[4])}},write:fi}}},{litmus:fa.isNumber,conversions:{HEX:{read:function(e){return{space:"HEX",hex:e,conversionName:"HEX"}},write:function(e){return e.hex}}}},{litmus:fa.isArray,conversions:{RGB_ARRAY:{read:function(e){return 3===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2]}},write:function(e){return[e.r,e.g,e.b]}},RGBA_ARRAY:{read:function(e){return 4===e.length&&{space:"RGB",r:e[0],g:e[1],b:e[2],a:e[3]}},write:function(e){return[e.r,e.g,e.b,e.a]}}}},{litmus:fa.isObject,conversions:{RGBA_OBJ:{read:function(e){return!!(fa.isNumber(e.r)&&fa.isNumber(e.g)&&fa.isNumber(e.b)&&fa.isNumber(e.a))&&{space:"RGB",r:e.r,g:e.g,b:e.b,a:e.a}},write:function(e){return{r:e.r,g:e.g,b:e.b,a:e.a}}},RGB_OBJ:{read:function(e){return!!(fa.isNumber(e.r)&&fa.isNumber(e.g)&&fa.isNumber(e.b))&&{space:"RGB",r:e.r,g:e.g,b:e.b}},write:function(e){return{r:e.r,g:e.g,b:e.b}}},HSVA_OBJ:{read:function(e){return!!(fa.isNumber(e.h)&&fa.isNumber(e.s)&&fa.isNumber(e.v)&&fa.isNumber(e.a))&&{space:"HSV",h:e.h,s:e.s,v:e.v,a:e.a}},write:function(e){return{h:e.h,s:e.s,v:e.v,a:e.a}}},HSV_OBJ:{read:function(e){return!!(fa.isNumber(e.h)&&fa.isNumber(e.s)&&fa.isNumber(e.v))&&{space:"HSV",h:e.h,s:e.s,v:e.v}},write:function(e){return{h:e.h,s:e.s,v:e.v}}}}}],fs=void 0,fl=void 0,fu=function(){fl=!1;var e=arguments.length>1?fa.toArray(arguments):arguments[0];return fa.each(fo,function(t){if(t.litmus(e))return fa.each(t.conversions,function(t,r){if(fs=t.read(e),!1===fl&&!1!==fs)return fl=fs,fs.conversionName=r,fs.conversion=t,fa.BREAK}),fa.BREAK}),fl},fc=void 0,fh={hsv_to_rgb:function(e,t,r){var n=e/60-Math.floor(e/60),a=r*(1-t),o=r*(1-n*t),s=r*(1-(1-n)*t),c=[[r,s,a],[o,r,a],[a,r,s],[a,o,r],[s,a,r],[r,a,o]][Math.floor(e/60)%6];return{r:255*c[0],g:255*c[1],b:255*c[2]}},rgb_to_hsv:function(e,t,r){var n=Math.max(e,t,r),a=n-Math.min(e,t,r),o=void 0,s=void 0;return 0===n?{h:NaN,s:0,v:0}:(s=a/n,o=e===n?(t-r)/a:t===n?2+(r-e)/a:4+(e-t)/a,(o/=6)<0&&(o+=1),{h:360*o,s:s,v:n/255})},rgb_to_hex:function(e,t,r){var n=this.hex_with_component(0,2,e);return n=this.hex_with_component(n,1,t),n=this.hex_with_component(n,0,r)},component_from_hex:function(e,t){return e>>8*t&255},hex_with_component:function(e,t,r){return r<<(fc=8*t)|e&~(255<<fc)}},fd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},fp=function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")},ff=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),fm=function e(t,r,n){null===t&&(t=Function.prototype);var a=Object.getOwnPropertyDescriptor(t,r);if(void 0===a){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,r,n)}if("value"in a)return a.value;var s=a.get;return void 0===s?void 0:s.call(n)},fg=function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},f8=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e},f$=function(){function e(){if(fp(this,e),this.__state=fu.apply(this,arguments),!1===this.__state)throw Error("Failed to interpret color arguments");this.__state.a=this.__state.a||1}return ff(e,[{key:"toString",value:function(){return fi(this)}},{key:"toHexString",value:function(){return fi(this,!0)}},{key:"toOriginal",value:function(){return this.__state.conversion.write(this)}}]),e}();function fv(e,t,r){Object.defineProperty(e,t,{get:function(){return"RGB"===this.__state.space||f$.recalculateRGB(this,t,r),this.__state[t]},set:function(e){"RGB"!==this.__state.space&&(f$.recalculateRGB(this,t,r),this.__state.space="RGB"),this.__state[t]=e}})}function fx(e,t){Object.defineProperty(e,t,{get:function(){return"HSV"===this.__state.space||f$.recalculateHSV(this),this.__state[t]},set:function(e){"HSV"!==this.__state.space&&(f$.recalculateHSV(this),this.__state.space="HSV"),this.__state[t]=e}})}f$.recalculateRGB=function(e,t,r){if("HEX"===e.__state.space)e.__state[t]=fh.component_from_hex(e.__state.hex,r);else if("HSV"===e.__state.space)fa.extend(e.__state,fh.hsv_to_rgb(e.__state.h,e.__state.s,e.__state.v));else throw Error("Corrupted color state")},f$.recalculateHSV=function(e){var t=fh.rgb_to_hsv(e.r,e.g,e.b);fa.extend(e.__state,{s:t.s,v:t.v}),fa.isNaN(t.h)?fa.isUndefined(e.__state.h)&&(e.__state.h=0):e.__state.h=t.h},f$.COMPONENTS=["r","g","b","h","s","v","hex","a"],fv(f$.prototype,"r",2),fv(f$.prototype,"g",1),fv(f$.prototype,"b",0),fx(f$.prototype,"h"),fx(f$.prototype,"s"),fx(f$.prototype,"v"),Object.defineProperty(f$.prototype,"a",{get:function(){return this.__state.a},set:function(e){this.__state.a=e}}),Object.defineProperty(f$.prototype,"hex",{get:function(){return"HEX"!==this.__state.space&&(this.__state.hex=fh.rgb_to_hex(this.r,this.g,this.b),this.__state.space="HEX"),this.__state.hex},set:function(e){this.__state.space="HEX",this.__state.hex=e}});var fy=function(){function e(t,r){fp(this,e),this.initialValue=t[r],this.domElement=document.createElement("div"),this.object=t,this.property=r,this.__onChange=void 0,this.__onFinishChange=void 0}return ff(e,[{key:"onChange",value:function(e){return this.__onChange=e,this}},{key:"onFinishChange",value:function(e){return this.__onFinishChange=e,this}},{key:"setValue",value:function(e){return this.object[this.property]=e,this.__onChange&&this.__onChange.call(this,e),this.updateDisplay(),this}},{key:"getValue",value:function(){return this.object[this.property]}},{key:"updateDisplay",value:function(){return this}},{key:"isModified",value:function(){return this.initialValue!==this.getValue()}}]),e}(),fS={};fa.each({HTMLEvents:["change"],MouseEvents:["click","mousemove","mousedown","mouseup","mouseover"],KeyboardEvents:["keydown"]},function(e,t){fa.each(e,function(e){fS[e]=t})});var fE=/(\d+(\.\d+)?)px/;function fb(e){if("0"===e||fa.isUndefined(e))return 0;var t=e.match(fE);return fa.isNull(t)?0:parseFloat(t[1])}var f_={makeSelectable:function(e,t){void 0===e||void 0===e.style||(e.onselectstart=t?function(){return!1}:function(){},e.style.MozUserSelect=t?"auto":"none",e.style.KhtmlUserSelect=t?"auto":"none",e.unselectable=t?"on":"off")},makeFullscreen:function(e,t,r){var n=r,a=t;fa.isUndefined(a)&&(a=!0),fa.isUndefined(n)&&(n=!0),e.style.position="absolute",a&&(e.style.left=0,e.style.right=0),n&&(e.style.top=0,e.style.bottom=0)},fakeEvent:function(e,t,r,n){var a=r||{},o=fS[t];if(!o)throw Error("Event type "+t+" not supported.");var s=document.createEvent(o);switch(o){case"MouseEvents":var c=a.x||a.clientX||0,h=a.y||a.clientY||0;s.initMouseEvent(t,a.bubbles||!1,a.cancelable||!0,window,a.clickCount||1,0,0,c,h,!1,!1,!1,!1,0,null);break;case"KeyboardEvents":var d=s.initKeyboardEvent||s.initKeyEvent;fa.defaults(a,{cancelable:!0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,keyCode:void 0,charCode:void 0}),d(t,a.bubbles||!1,a.cancelable,window,a.ctrlKey,a.altKey,a.shiftKey,a.metaKey,a.keyCode,a.charCode);break;default:s.initEvent(t,a.bubbles||!1,a.cancelable||!0)}fa.defaults(s,n),e.dispatchEvent(s)},bind:function(e,t,r,n){return e.addEventListener?e.addEventListener(t,r,n||!1):e.attachEvent&&e.attachEvent("on"+t,r),f_},unbind:function(e,t,r,n){return e.removeEventListener?e.removeEventListener(t,r,n||!1):e.detachEvent&&e.detachEvent("on"+t,r),f_},addClass:function(e,t){if(void 0===e.className)e.className=t;else if(e.className!==t){var r=e.className.split(/ +/);-1===r.indexOf(t)&&(r.push(t),e.className=r.join(" ").replace(/^\s+/,"").replace(/\s+$/,""))}return f_},removeClass:function(e,t){if(t){if(e.className===t)e.removeAttribute("class");else{var r=e.className.split(/ +/),n=r.indexOf(t);-1!==n&&(r.splice(n,1),e.className=r.join(" "))}}else e.className=void 0;return f_},hasClass:function(e,t){return RegExp("(?:^|\\s+)"+t+"(?:\\s+|$)").test(e.className)||!1},getWidth:function(e){var t=getComputedStyle(e);return fb(t["border-left-width"])+fb(t["border-right-width"])+fb(t["padding-left"])+fb(t["padding-right"])+fb(t.width)},getHeight:function(e){var t=getComputedStyle(e);return fb(t["border-top-width"])+fb(t["border-bottom-width"])+fb(t["padding-top"])+fb(t["padding-bottom"])+fb(t.height)},getOffset:function(e){var t=e,r={left:0,top:0};if(t.offsetParent)do r.left+=t.offsetLeft,r.top+=t.offsetTop,t=t.offsetParent;while(t);return r},isActive:function(e){return e===document.activeElement&&(e.type||e.href)}},fT=function(e){function t(e,r){fp(this,t);var n=f8(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r)),a=n;return n.__prev=n.getValue(),n.__checkbox=document.createElement("input"),n.__checkbox.setAttribute("type","checkbox"),f_.bind(n.__checkbox,"change",function e(){a.setValue(!a.__prev)},!1),n.domElement.appendChild(n.__checkbox),n.updateDisplay(),n}return fg(t,e),ff(t,[{key:"setValue",value:function(e){var r=fm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),this.__prev=this.getValue(),r}},{key:"updateDisplay",value:function(){return!0===this.getValue()?(this.__checkbox.setAttribute("checked","checked"),this.__checkbox.checked=!0,this.__prev=!0):(this.__checkbox.checked=!1,this.__prev=!1),fm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(fy),fM=function(e){function t(e,r,n){fp(this,t);var a=f8(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r)),o=n,s=a;if(a.__select=document.createElement("select"),fa.isArray(o)){var c={};fa.each(o,function(e){c[e]=e}),o=c}return fa.each(o,function(e,t){var r=document.createElement("option");r.innerHTML=t,r.setAttribute("value",e),s.__select.appendChild(r)}),a.updateDisplay(),f_.bind(a.__select,"change",function(){var e=this.options[this.selectedIndex].value;s.setValue(e)}),a.domElement.appendChild(a.__select),a}return fg(t,e),ff(t,[{key:"setValue",value:function(e){var r=fm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,e);return this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue()),r}},{key:"updateDisplay",value:function(){return f_.isActive(this.__select)?this:(this.__select.value=this.getValue(),fm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this))}}]),t}(fy),fw=function(e){function t(e,r){fp(this,t);var n=f8(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r)),a=n;function o(){a.setValue(a.__input.value)}return n.__input=document.createElement("input"),n.__input.setAttribute("type","text"),f_.bind(n.__input,"keyup",o),f_.bind(n.__input,"change",o),f_.bind(n.__input,"blur",function e(){a.__onFinishChange&&a.__onFinishChange.call(a,a.getValue())}),f_.bind(n.__input,"keydown",function(e){13===e.keyCode&&this.blur()}),n.updateDisplay(),n.domElement.appendChild(n.__input),n}return fg(t,e),ff(t,[{key:"updateDisplay",value:function(){return f_.isActive(this.__input)||(this.__input.value=this.getValue()),fm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(fy);function fA(e){var t=e.toString();return t.indexOf(".")>-1?t.length-t.indexOf(".")-1:0}var fC=function(e){function t(e,r,n){fp(this,t);var a=f8(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r)),o=n||{};return a.__min=o.min,a.__max=o.max,a.__step=o.step,fa.isUndefined(a.__step)?0===a.initialValue?a.__impliedStep=1:a.__impliedStep=Math.pow(10,Math.floor(Math.log(Math.abs(a.initialValue))/Math.LN10))/10:a.__impliedStep=a.__step,a.__precision=fA(a.__impliedStep),a}return fg(t,e),ff(t,[{key:"setValue",value:function(e){var r=e;return void 0!==this.__min&&r<this.__min?r=this.__min:void 0!==this.__max&&r>this.__max&&(r=this.__max),void 0!==this.__step&&r%this.__step!=0&&(r=Math.round(r/this.__step)*this.__step),fm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setValue",this).call(this,r)}},{key:"min",value:function(e){return this.__min=e,this}},{key:"max",value:function(e){return this.__max=e,this}},{key:"step",value:function(e){return this.__step=e,this.__impliedStep=e,this.__precision=fA(e),this}}]),t}(fy),fR=function(e){function t(e,r,n){fp(this,t);var a=f8(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,n));a.__truncationSuspended=!1;var o=a,s=void 0;function c(){o.__onFinishChange&&o.__onFinishChange.call(o,o.getValue())}function h(e){var t=s-e.clientY;o.setValue(o.getValue()+t*o.__impliedStep),s=e.clientY}function d(){f_.unbind(window,"mousemove",h),f_.unbind(window,"mouseup",d),c()}return a.__input=document.createElement("input"),a.__input.setAttribute("type","text"),f_.bind(a.__input,"change",function e(){var t=parseFloat(o.__input.value);fa.isNaN(t)||o.setValue(t)}),f_.bind(a.__input,"blur",function e(){c()}),f_.bind(a.__input,"mousedown",function e(t){f_.bind(window,"mousemove",h),f_.bind(window,"mouseup",d),s=t.clientY}),f_.bind(a.__input,"keydown",function(e){13===e.keyCode&&(o.__truncationSuspended=!0,this.blur(),o.__truncationSuspended=!1,c())}),a.updateDisplay(),a.domElement.appendChild(a.__input),a}return fg(t,e),ff(t,[{key:"updateDisplay",value:function(){var e,r,n;return this.__input.value=this.__truncationSuspended?this.getValue():(e=this.getValue(),Math.round(e*(n=Math.pow(10,r=this.__precision)))/n),fm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(fC);function f0(e,t,r,n,a){return n+(a-n)*((e-t)/(r-t))}var fP=function(e){function t(e,r,n,a,o){fp(this,t);var s=f8(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r,{min:n,max:a,step:o})),c=s;function h(e){e.preventDefault();var t=c.__background.getBoundingClientRect();return c.setValue(f0(e.clientX,t.left,t.right,c.__min,c.__max)),!1}function d(){f_.unbind(window,"mousemove",h),f_.unbind(window,"mouseup",d),c.__onFinishChange&&c.__onFinishChange.call(c,c.getValue())}function p(e){var t=e.touches[0].clientX,r=c.__background.getBoundingClientRect();c.setValue(f0(t,r.left,r.right,c.__min,c.__max))}function f(){f_.unbind(window,"touchmove",p),f_.unbind(window,"touchend",f),c.__onFinishChange&&c.__onFinishChange.call(c,c.getValue())}return s.__background=document.createElement("div"),s.__foreground=document.createElement("div"),f_.bind(s.__background,"mousedown",function e(t){document.activeElement.blur(),f_.bind(window,"mousemove",h),f_.bind(window,"mouseup",d),h(t)}),f_.bind(s.__background,"touchstart",function e(t){1===t.touches.length&&(f_.bind(window,"touchmove",p),f_.bind(window,"touchend",f),p(t))}),f_.addClass(s.__background,"slider"),f_.addClass(s.__foreground,"slider-fg"),s.updateDisplay(),s.__background.appendChild(s.__foreground),s.domElement.appendChild(s.__background),s}return fg(t,e),ff(t,[{key:"updateDisplay",value:function(){var e=(this.getValue()-this.__min)/(this.__max-this.__min);return this.__foreground.style.width=100*e+"%",fm(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"updateDisplay",this).call(this)}}]),t}(fC),fL=function(e){function t(e,r,n){fp(this,t);var a=f8(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r)),o=a;return a.__button=document.createElement("div"),a.__button.innerHTML=void 0===n?"Fire":n,f_.bind(a.__button,"click",function(e){return e.preventDefault(),o.fire(),!1}),f_.addClass(a.__button,"button"),a.domElement.appendChild(a.__button),a}return fg(t,e),ff(t,[{key:"fire",value:function(){this.__onChange&&this.__onChange.call(this),this.getValue().call(this.object),this.__onFinishChange&&this.__onFinishChange.call(this,this.getValue())}}]),t}(fy),f1=function(e){function t(e,r){fp(this,t);var n,a=f8(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));a.__color=new f$(a.getValue()),a.__temp=new f$(0);var o=a;a.domElement=document.createElement("div"),f_.makeSelectable(a.domElement,!1),a.__selector=document.createElement("div"),a.__selector.className="selector",a.__saturation_field=document.createElement("div"),a.__saturation_field.className="saturation-field",a.__field_knob=document.createElement("div"),a.__field_knob.className="field-knob",a.__field_knob_border="2px solid ",a.__hue_knob=document.createElement("div"),a.__hue_knob.className="hue-knob",a.__hue_field=document.createElement("div"),a.__hue_field.className="hue-field",a.__input=document.createElement("input"),a.__input.type="text",a.__input_textShadow="0 1px 1px ",f_.bind(a.__input,"keydown",function(e){13===e.keyCode&&f.call(this)}),f_.bind(a.__input,"blur",f),f_.bind(a.__selector,"mousedown",function(){f_.addClass(this,"drag").bind(window,"mouseup",function(){f_.removeClass(o.__selector,"drag")})}),f_.bind(a.__selector,"touchstart",function(){f_.addClass(this,"drag").bind(window,"touchend",function(){f_.removeClass(o.__selector,"drag")})});var s=document.createElement("div");function c(e){$(e),f_.bind(window,"mousemove",$),f_.bind(window,"touchmove",$),f_.bind(window,"mouseup",d),f_.bind(window,"touchend",d)}function h(e){x(e),f_.bind(window,"mousemove",x),f_.bind(window,"touchmove",x),f_.bind(window,"mouseup",p),f_.bind(window,"touchend",p)}function d(){f_.unbind(window,"mousemove",$),f_.unbind(window,"touchmove",$),f_.unbind(window,"mouseup",d),f_.unbind(window,"touchend",d),m()}function p(){f_.unbind(window,"mousemove",x),f_.unbind(window,"touchmove",x),f_.unbind(window,"mouseup",p),f_.unbind(window,"touchend",p),m()}function f(){var e=fu(this.value);!1!==e?(o.__color.__state=e,o.setValue(o.__color.toOriginal())):this.value=o.__color.toString()}function m(){o.__onFinishChange&&o.__onFinishChange.call(o,o.__color.toOriginal())}function $(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=o.__saturation_field.getBoundingClientRect(),r=e.touches&&e.touches[0]||e,n=r.clientX,a=r.clientY,s=(n-t.left)/(t.right-t.left),c=1-(a-t.top)/(t.bottom-t.top);return c>1?c=1:c<0&&(c=0),s>1?s=1:s<0&&(s=0),o.__color.v=c,o.__color.s=s,o.setValue(o.__color.toOriginal()),!1}function x(e){-1===e.type.indexOf("touch")&&e.preventDefault();var t=o.__hue_field.getBoundingClientRect(),r=1-((e.touches&&e.touches[0]||e).clientY-t.top)/(t.bottom-t.top);return r>1?r=1:r<0&&(r=0),o.__color.h=360*r,o.setValue(o.__color.toOriginal()),!1}return fa.extend(a.__selector.style,{width:"122px",height:"102px",padding:"3px",backgroundColor:"#222",boxShadow:"0px 1px 3px rgba(0,0,0,0.3)"}),fa.extend(a.__field_knob.style,{position:"absolute",width:"12px",height:"12px",border:a.__field_knob_border+(a.__color.v<.5?"#fff":"#000"),boxShadow:"0px 1px 3px rgba(0,0,0,0.5)",borderRadius:"12px",zIndex:1}),fa.extend(a.__hue_knob.style,{position:"absolute",width:"15px",height:"2px",borderRight:"4px solid #fff",zIndex:1}),fa.extend(a.__saturation_field.style,{width:"100px",height:"100px",border:"1px solid #555",marginRight:"3px",display:"inline-block",cursor:"pointer"}),fa.extend(s.style,{width:"100%",height:"100%",background:"none"}),fU(s,"top","rgba(0,0,0,0)","#000"),fa.extend(a.__hue_field.style,{width:"15px",height:"100px",border:"1px solid #555",cursor:"ns-resize",position:"absolute",top:"3px",right:"3px"}),(n=a.__hue_field).style.background="",n.style.cssText+="background: -moz-linear-gradient(top,  #ff0000 0%, #ff00ff 17%, #0000ff 34%, #00ffff 50%, #00ff00 67%, #ffff00 84%, #ff0000 100%);",n.style.cssText+="background: -webkit-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",n.style.cssText+="background: -o-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",n.style.cssText+="background: -ms-linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",n.style.cssText+="background: linear-gradient(top,  #ff0000 0%,#ff00ff 17%,#0000ff 34%,#00ffff 50%,#00ff00 67%,#ffff00 84%,#ff0000 100%);",fa.extend(a.__input.style,{outline:"none",textAlign:"center",color:"#fff",border:0,fontWeight:"bold",textShadow:a.__input_textShadow+"rgba(0,0,0,0.7)"}),f_.bind(a.__saturation_field,"mousedown",c),f_.bind(a.__saturation_field,"touchstart",c),f_.bind(a.__field_knob,"mousedown",c),f_.bind(a.__field_knob,"touchstart",c),f_.bind(a.__hue_field,"mousedown",h),f_.bind(a.__hue_field,"touchstart",h),a.__saturation_field.appendChild(s),a.__selector.appendChild(a.__field_knob),a.__selector.appendChild(a.__saturation_field),a.__selector.appendChild(a.__hue_field),a.__hue_field.appendChild(a.__hue_knob),a.domElement.appendChild(a.__input),a.domElement.appendChild(a.__selector),a.updateDisplay(),a}return fg(t,e),ff(t,[{key:"updateDisplay",value:function(){var e=fu(this.getValue());if(!1!==e){var t=!1;fa.each(f$.COMPONENTS,function(r){if(!fa.isUndefined(e[r])&&!fa.isUndefined(this.__color.__state[r])&&e[r]!==this.__color.__state[r])return t=!0,{}},this),t&&fa.extend(this.__color.__state,e)}fa.extend(this.__temp.__state,this.__color.__state),this.__temp.a=1;var r=this.__color.v<.5||this.__color.s>.5?255:0,n=255-r;fa.extend(this.__field_knob.style,{marginLeft:100*this.__color.s-7+"px",marginTop:100*(1-this.__color.v)-7+"px",backgroundColor:this.__temp.toHexString(),border:this.__field_knob_border+"rgb("+r+","+r+","+r+")"}),this.__hue_knob.style.marginTop=(1-this.__color.h/360)*100+"px",this.__temp.s=1,this.__temp.v=1,fU(this.__saturation_field,"left","#fff",this.__temp.toHexString()),this.__input.value=this.__color.toString(),fa.extend(this.__input.style,{backgroundColor:this.__color.toHexString(),color:"rgb("+r+","+r+","+r+")",textShadow:this.__input_textShadow+"rgba("+n+","+n+","+n+",.7)"})}}]),t}(fy),fD=["-moz-","-o-","-webkit-","-ms-",""];function fU(e,t,r,n){e.style.background="",fa.each(fD,function(a){e.style.cssText+="background: "+a+"linear-gradient("+t+", "+r+" 0%, "+n+" 100%); "})}var fI=`<div id="dg-save" class="dg dialogue">
   
	 Here's the new load parameter for your <code>GUI</code>'s constructor:
   
	 <textarea id="dg-new-constructor"></textarea>
   
	 <div id="dg-save-locally">
   
	   <input id="dg-local-storage" type="checkbox"/> Automatically save
	   values to <code>localStorage</code> on exit.
   
	   <div id="dg-local-explain">The values saved to <code>localStorage</code> will
		 override those passed to <code>dat.GUI</code>'s constructor. This makes it
		 easier to work incrementally, but <code>localStorage</code> is fragile,
		 and your friends may not see the same values you do.
   
	   </div>
   
	 </div>
   
   </div>`,fN=function(e,t){var r=e[t];return fa.isArray(arguments[2])||fa.isObject(arguments[2])?new fM(e,t,arguments[2]):fa.isNumber(r)?fa.isNumber(arguments[2])&&fa.isNumber(arguments[3])?fa.isNumber(arguments[4])?new fP(e,t,arguments[2],arguments[3],arguments[4]):new fP(e,t,arguments[2],arguments[3]):fa.isNumber(arguments[4])?new fR(e,t,{min:arguments[2],max:arguments[3],step:arguments[4]}):new fR(e,t,{min:arguments[2],max:arguments[3]}):fa.isString(r)?new fw(e,t):fa.isFunction(r)?new fL(e,t,""):fa.isBoolean(r)?new fT(e,t):null},fO=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function e(t){setTimeout(t,1e3/60)},fF=function(){function e(){fp(this,e),this.backgroundElement=document.createElement("div"),fa.extend(this.backgroundElement.style,{backgroundColor:"rgba(0,0,0,0.8)",top:0,left:0,display:"none",zIndex:"1000",opacity:0,WebkitTransition:"opacity 0.2s linear",transition:"opacity 0.2s linear"}),f_.makeFullscreen(this.backgroundElement),this.backgroundElement.style.position="fixed",this.domElement=document.createElement("div"),fa.extend(this.domElement.style,{position:"fixed",display:"none",zIndex:"1001",opacity:0,WebkitTransition:"-webkit-transform 0.2s ease-out, opacity 0.2s linear",transition:"transform 0.2s ease-out, opacity 0.2s linear"}),document.body.appendChild(this.backgroundElement),document.body.appendChild(this.domElement);var t=this;f_.bind(this.backgroundElement,"click",function(){t.hide()})}return ff(e,[{key:"show",value:function(){var e=this;this.backgroundElement.style.display="block",this.domElement.style.display="block",this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)",this.layout(),fa.defer(function(){e.backgroundElement.style.opacity=1,e.domElement.style.opacity=1,e.domElement.style.webkitTransform="scale(1)"})}},{key:"hide",value:function(){var e=this,t=function t(){e.domElement.style.display="none",e.backgroundElement.style.display="none",f_.unbind(e.domElement,"webkitTransitionEnd",t),f_.unbind(e.domElement,"transitionend",t),f_.unbind(e.domElement,"oTransitionEnd",t)};f_.bind(this.domElement,"webkitTransitionEnd",t),f_.bind(this.domElement,"transitionend",t),f_.bind(this.domElement,"oTransitionEnd",t),this.backgroundElement.style.opacity=0,this.domElement.style.opacity=0,this.domElement.style.webkitTransform="scale(1.1)"}},{key:"layout",value:function(){this.domElement.style.left=document.getElementById("effect-box").clientWidth/2-f_.getWidth(this.domElement)/2+"px",this.domElement.style.top=document.getElementById("effect-box").clientHeight/2-f_.getHeight(this.domElement)/2+"px"}}]),e}();({load:function(e,t){var r=t||document,n=r.createElement("link");n.type="text/css",n.rel="stylesheet",n.href=e,r.getElementsByTagName("head")[0].appendChild(n)},inject:function(e,t){var r=document.createElement("style");r.type="text/css",r.innerHTML=e;var n=(t||document).getElementsByTagName("head")[0];try{n.appendChild(r)}catch{}}}).inject(function e(t){if(t&&!(typeof window>"u")){var r=document.createElement("style");return r.setAttribute("type","text/css"),r.innerHTML=t,document.head.appendChild(r),t}}(`.dg ul{list-style:none;margin:0;padding:0;width:100%;clear:both}.dg.ac{position:fixed;top:0;left:0;right:0;height:0;z-index:0}.dg:not(.ac) .main{overflow:hidden}.dg.main{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear}.dg.main.taller-than-window{overflow-y:auto}.dg.main.taller-than-window .close-button{opacity:1;margin-top:-1px;border-top:1px solid #2c2c2c}.dg.main ul.closed .close-button{opacity:1 !important}.dg.main:hover .close-button,.dg.main .close-button.drag{opacity:1}.dg.main .close-button{-webkit-transition:opacity .1s linear;-o-transition:opacity .1s linear;-moz-transition:opacity .1s linear;transition:opacity .1s linear;border:0;line-height:19px;height:20px;cursor:pointer;text-align:center;background-color:#000}.dg.main .close-button.close-top{position:relative}.dg.main .close-button.close-bottom{position:absolute}.dg.main .close-button:hover{background-color:#111}.dg.a{float:right;margin-right:15px;overflow-y:visible}.dg.a.has-save>ul.close-top{margin-top:0}.dg.a.has-save>ul.close-bottom{margin-top:27px}.dg.a.has-save>ul.closed{margin-top:0}.dg.a .save-row{top:0;z-index:1002}.dg.a .save-row.close-top{position:relative}.dg.a .save-row.close-bottom{position:fixed}.dg li{-webkit-transition:height .1s ease-out;-o-transition:height .1s ease-out;-moz-transition:height .1s ease-out;transition:height .1s ease-out;-webkit-transition:overflow .1s linear;-o-transition:overflow .1s linear;-moz-transition:overflow .1s linear;transition:overflow .1s linear}.dg li:not(.folder){cursor:auto;height:27px;line-height:27px;padding:0 4px 0 5px}.dg li.folder{padding:0;border-left:4px solid rgba(0,0,0,0)}.dg li.title{cursor:pointer;margin-left:-4px}.dg .closed li:not(.title),.dg .closed ul li,.dg .closed ul li>*{height:0;overflow:hidden;border:0}.dg .cr{clear:both;padding-left:3px;height:27px;overflow:hidden}.dg .property-name{cursor:default;float:left;clear:left;width:40%;overflow:hidden;text-overflow:ellipsis}.dg .cr.function .property-name{width:100%}.dg .c{float:left;width:60%;position:relative}.dg .c input[type=text]{border:0;margin-top:4px;padding:3px;width:100%;float:right}.dg .has-slider input[type=text]{width:30%;margin-left:0}.dg .slider{float:left;width:66%;margin-left:-5px;margin-right:0;height:19px;margin-top:4px}.dg .slider-fg{height:100%}.dg .c input[type=checkbox]{margin-top:7px}.dg .c select{margin-top:5px}.dg .cr.function,.dg .cr.function .property-name,.dg .cr.function *,.dg .cr.boolean,.dg .cr.boolean *{cursor:pointer}.dg .cr.color{overflow:visible}.dg .selector{display:none;position:absolute;margin-left:-9px;margin-top:23px;z-index:10}.dg .c:hover .selector,.dg .selector.drag{display:block}.dg li.save-row{padding:0}.dg li.save-row .button{display:inline-block;padding:0px 6px}.dg.dialogue{background-color:#222;width:460px;padding:15px;font-size:13px;line-height:15px}#dg-new-constructor{padding:10px;color:#222;font-family:Monaco, monospace;font-size:10px;border:0;resize:none;box-shadow:inset 1px 1px 1px #888;word-wrap:break-word;margin:12px 0;display:block;width:440px;overflow-y:scroll;height:100px;position:relative}#dg-local-explain{display:none;font-size:11px;line-height:17px;border-radius:3px;background-color:#333;padding:8px;margin-top:10px}#dg-local-explain code{font-size:10px}#dat-gui-save-locally{display:none}.dg{color:#eee;font:11px 'Lucida Grande', sans-serif;text-shadow:0 -1px 0 #111}.dg.main::-webkit-scrollbar{width:5px;background:#1a1a1a}.dg.main::-webkit-scrollbar-corner{height:0;display:none}.dg.main::-webkit-scrollbar-thumb{border-radius:5px;background:#676767}.dg li:not(.folder){background:#1a1a1a;border-bottom:1px solid #2c2c2c}.dg li.save-row{line-height:25px;background:#dad5cb;border:0}.dg li.save-row select{margin-left:5px;width:108px}.dg li.save-row .button{margin-left:5px;margin-top:1px;border-radius:2px;font-size:9px;line-height:7px;padding:4px 4px 5px 4px;background:#c5bdad;color:#fff;text-shadow:0 1px 0 #b0a58f;box-shadow:0 -1px 0 #b0a58f;cursor:pointer}.dg li.save-row .button.gears{background:#c5bdad url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAANCAYAAAB/9ZQ7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQJJREFUeNpiYKAU/P//PwGIC/ApCABiBSAW+I8AClAcgKxQ4T9hoMAEUrxx2QSGN6+egDX+/vWT4e7N82AMYoPAx/evwWoYoSYbACX2s7KxCxzcsezDh3evFoDEBYTEEqycggWAzA9AuUSQQgeYPa9fPv6/YWm/Acx5IPb7ty/fw+QZblw67vDs8R0YHyQhgObx+yAJkBqmG5dPPDh1aPOGR/eugW0G4vlIoTIfyFcA+QekhhHJhPdQxbiAIguMBTQZrPD7108M6roWYDFQiIAAv6Aow/1bFwXgis+f2LUAynwoIaNcz8XNx3Dl7MEJUDGQpx9gtQ8YCueB+D26OECAAQDadt7e46D42QAAAABJRU5ErkJggg==) 2px 1px no-repeat;height:7px;width:8px}.dg li.save-row .button:hover{background-color:#bab19e;box-shadow:0 -1px 0 #b0a58f}.dg li.folder{border-bottom:0}.dg li.title{padding-left:16px;background:#000 url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlI+hKgFxoCgAOw==) 6px 10px no-repeat;cursor:pointer;border-bottom:1px solid rgba(255,255,255,0.2)}.dg .closed li.title{background-image:url(data:image/gif;base64,R0lGODlhBQAFAJEAAP////Pz8////////yH5BAEAAAIALAAAAAAFAAUAAAIIlGIWqMCbWAEAOw==)}.dg .cr.boolean{border-left:3px solid #806787}.dg .cr.color{border-left:3px solid}.dg .cr.function{border-left:3px solid #e61d5f}.dg .cr.number{border-left:3px solid #2FA1D6}.dg .cr.number input[type=text]{color:#2FA1D6}.dg .cr.string{border-left:3px solid #1ed36f}.dg .cr.string input[type=text]{color:#1ed36f}.dg .cr.function:hover,.dg .cr.boolean:hover{background:#111}.dg .c input[type=text]{background:#303030;outline:none}.dg .c input[type=text]:hover{background:#3c3c3c}.dg .c input[type=text]:focus{background:#494949;color:#fff}.dg .c .slider{background:#303030;cursor:ew-resize}.dg .c .slider-fg{background:#2FA1D6;max-width:100%}.dg .c .slider:hover{background:#3c3c3c}.dg .c .slider:hover .slider-fg{background:#44abda}
   `));var fB="Default",fz=function(){try{return!!window.localStorage}catch{return!1}}(),f2=void 0,fk=!0,fH=void 0,fV=!1,f3=[],fG=function e(t){var r,n=this,a=t||{};this.domElement=document.createElement("div"),this.__ul=document.createElement("ul"),this.domElement.appendChild(this.__ul),f_.addClass(this.domElement,"dg"),this.__folders={},this.__controllers=[],this.__rememberedObjects=[],this.__rememberedObjectIndecesToControllers=[],this.__listening=[],a=fa.defaults(a,{closeOnTop:!1,autoPlace:!0,width:e.DEFAULT_WIDTH}),a=fa.defaults(a,{resizable:a.autoPlace,hideable:a.autoPlace}),fa.isUndefined(a.load)?a.load={preset:fB}:a.preset&&(a.load.preset=a.preset),fa.isUndefined(a.parent)&&a.hideable&&f3.push(this),a.resizable=fa.isUndefined(a.parent)&&a.resizable,a.autoPlace&&fa.isUndefined(a.scrollable)&&(a.scrollable=!0);var o=fz&&"true"===localStorage.getItem(fX(this,"isLocal")),s=void 0,c=void 0;if(Object.defineProperties(this,{parent:{get:function(){return a.parent}},scrollable:{get:function(){return a.scrollable}},autoPlace:{get:function(){return a.autoPlace}},closeOnTop:{get:function(){return a.closeOnTop}},preset:{get:function(){return n.parent?n.getRoot().preset:a.load.preset},set:function(e){n.parent?n.getRoot().preset=e:a.load.preset=e,function e(t){for(var r=0;r<t.__preset_select.length;r++)t.__preset_select[r].value===t.preset&&(t.__preset_select.selectedIndex=r)}(this),n.revert()}},width:{get:function(){return a.width},set:function(e){a.width=e,fj(n,e)}},name:{get:function(){return a.name},set:function(e){a.name=e,c&&(c.innerHTML=a.name)}},closed:{get:function(){return a.closed},set:function(t){a.closed=t,a.closed?f_.addClass(n.__ul,e.CLASS_CLOSED):f_.removeClass(n.__ul,e.CLASS_CLOSED),this.onResize(),n.__closeButton&&(n.__closeButton.innerHTML=t?e.TEXT_OPEN:e.TEXT_CLOSED)}},load:{get:function(){return a.load}},useLocalStorage:{get:function(){return o},set:function(e){fz&&(o=e,e?f_.bind(window,"unload",s):f_.unbind(window,"unload",s),localStorage.setItem(fX(n,"isLocal"),e))}}}),fa.isUndefined(a.parent)){if(this.closed=a.closed||!1,f_.addClass(this.domElement,e.CLASS_MAIN),f_.makeSelectable(this.domElement,!1),fz&&o){n.useLocalStorage=!0;var h=localStorage.getItem(fX(this,"gui"));h&&(a.load=JSON.parse(h))}this.__closeButton=document.createElement("div"),this.__closeButton.innerHTML=e.TEXT_CLOSED,f_.addClass(this.__closeButton,e.CLASS_CLOSE_BUTTON),a.closeOnTop?(f_.addClass(this.__closeButton,e.CLASS_CLOSE_TOP),this.domElement.insertBefore(this.__closeButton,this.domElement.childNodes[0])):(f_.addClass(this.__closeButton,e.CLASS_CLOSE_BOTTOM),this.domElement.appendChild(this.__closeButton)),f_.bind(this.__closeButton,"click",function(){n.closed=!n.closed})}else{void 0===a.closed&&(a.closed=!0);var d=document.createTextNode(a.name);f_.addClass(d,"controller-name"),c=f4(n,d);var p=function(e){return e.preventDefault(),n.closed=!n.closed,!1};f_.addClass(this.__ul,e.CLASS_CLOSED),f_.addClass(c,"title"),f_.bind(c,"click",p),a.closed||(this.closed=!1)}a.autoPlace&&(fa.isUndefined(a.parent)&&(fk&&(fH=document.createElement("div"),f_.addClass(fH,"dg"),f_.addClass(fH,e.CLASS_AUTO_PLACE_CONTAINER),document.body.appendChild(fH),fk=!1),fH.appendChild(this.domElement),f_.addClass(this.domElement,e.CLASS_AUTO_PLACE)),this.parent||fj(n,a.width)),this.__resizeHandler=function(){n.onResizeDebounced()},f_.bind(window,"resize",this.__resizeHandler),f_.bind(this.__ul,"webkitTransitionEnd",this.__resizeHandler),f_.bind(this.__ul,"transitionend",this.__resizeHandler),f_.bind(this.__ul,"oTransitionEnd",this.__resizeHandler),this.onResize(),a.resizable&&function e(t){var r=void 0;function n(e){return e.preventDefault(),t.width+=r-e.clientX,t.onResize(),r=e.clientX,!1}function a(){f_.removeClass(t.__closeButton,fG.CLASS_DRAG),f_.unbind(window,"mousemove",n),f_.unbind(window,"mouseup",a)}function o(e){return e.preventDefault(),r=e.clientX,f_.addClass(t.__closeButton,fG.CLASS_DRAG),f_.bind(window,"mousemove",n),f_.bind(window,"mouseup",a),!1}t.__resize_handle=document.createElement("div"),fa.extend(t.__resize_handle.style,{width:"6px",marginLeft:"-3px",height:"200px",cursor:"ew-resize",position:"absolute"}),f_.bind(t.__resize_handle,"mousedown",o),f_.bind(t.__closeButton,"mousedown",o),t.domElement.insertBefore(t.__resize_handle,t.domElement.firstElementChild)}(this),s=function(){fz&&"true"===localStorage.getItem(fX(n,"isLocal"))&&localStorage.setItem(fX(n,"gui"),JSON.stringify(n.getSaveObject()))},this.saveToLocalStorageIfPossible=s,a.parent||(r=n.getRoot(),r.width+=1,fa.defer(function(){r.width-=1}))};function f4(e,t,r){var n=document.createElement("li");return t&&n.appendChild(t),r?e.__ul.insertBefore(n,r):e.__ul.appendChild(n),e.onResize(),n}function fW(e){f_.unbind(window,"resize",e.__resizeHandler),e.saveToLocalStorageIfPossible&&f_.unbind(window,"unload",e.saveToLocalStorageIfPossible)}function f6(e,t){var r=e.__preset_select[e.__preset_select.selectedIndex];t?r.innerHTML=r.value+"*":r.innerHTML=r.value}function f5(e,t){var r=e.getRoot(),n=r.__rememberedObjects.indexOf(t.object);if(-1!==n){var a=r.__rememberedObjectIndecesToControllers[n];if(void 0===a&&(a={},r.__rememberedObjectIndecesToControllers[n]=a),a[t.property]=t,r.load&&r.load.remembered){var o=r.load.remembered,s=void 0;if(o[e.preset])s=o[e.preset];else{if(!o[fB])return;s=o[fB]}if(s[n]&&void 0!==s[n][t.property]){var c=s[n][t.property];t.initialValue=c,t.setValue(c)}}}}function f7(e,t,r,n){if(void 0===t[r])throw Error('Object "'+t+'" has no property "'+r+'"');var a=void 0;if(n.color)a=new f1(t,r);else{var o=[t,r].concat(n.factoryArgs);a=fN.apply(e,o)}n.before instanceof fy&&(n.before=n.before.__li),f5(e,a),f_.addClass(a.domElement,"c");var s=document.createElement("span");f_.addClass(s,"property-name"),s.innerHTML=a.property;var c=document.createElement("div");c.appendChild(s),c.appendChild(a.domElement);var h=f4(e,c,n.before);return f_.addClass(h,fG.CLASS_CONTROLLER_ROW),a instanceof f1?f_.addClass(h,"color"):f_.addClass(h,fd(a.getValue())),function e(t,r,n){if(n.__li=r,n.__gui=t,fa.extend(n,{options:function(e){if(arguments.length>1){var r=n.__li.nextElementSibling;return n.remove(),f7(t,n.object,n.property,{before:r,factoryArgs:[fa.toArray(arguments)]})}if(fa.isArray(e)||fa.isObject(e)){var a=n.__li.nextElementSibling;return n.remove(),f7(t,n.object,n.property,{before:a,factoryArgs:[e]})}},name:function(e){return n.__li.firstElementChild.firstElementChild.innerHTML=e,n},listen:function(){return n.__gui.listen(n),n},remove:function(){return n.__gui.remove(n),n}}),n instanceof fP){var a=new fR(n.object,n.property,{min:n.__min,max:n.__max,step:n.__step});fa.each(["updateDisplay","onChange","onFinishChange","step","min","max"],function(e){var t=n[e],r=a[e];n[e]=a[e]=function(){var e=Array.prototype.slice.call(arguments);return r.apply(a,e),t.apply(n,e)}}),f_.addClass(r,"has-slider"),n.domElement.insertBefore(a.domElement,n.domElement.firstElementChild)}else if(n instanceof fR){var o=function(e){if(fa.isNumber(n.__min)&&fa.isNumber(n.__max)){var r=n.__li.firstElementChild.firstElementChild.innerHTML,a=n.__gui.__listening.indexOf(n)>-1;n.remove();var o=f7(t,n.object,n.property,{before:n.__li.nextElementSibling,factoryArgs:[n.__min,n.__max,n.__step]});return o.name(r),a&&o.listen(),o}return e};n.min=fa.compose(o,n.min),n.max=fa.compose(o,n.max)}else n instanceof fT?(f_.bind(r,"click",function(){f_.fakeEvent(n.__checkbox,"click")}),f_.bind(n.__checkbox,"click",function(e){e.stopPropagation()})):n instanceof fL?(f_.bind(r,"click",function(){f_.fakeEvent(n.__button,"click")}),f_.bind(r,"mouseover",function(){f_.addClass(n.__button,"hover")}),f_.bind(r,"mouseout",function(){f_.removeClass(n.__button,"hover")})):n instanceof f1&&(f_.addClass(r,"color"),n.updateDisplay=fa.compose(function(e){return r.style.borderLeftColor=n.__color.toString(),e},n.updateDisplay),n.updateDisplay());n.setValue=fa.compose(function(e){return t.getRoot().__preset_select&&n.isModified()&&f6(t.getRoot(),!0),e},n.setValue)}(e,h,a),e.__controllers.push(a),a}function fX(e,t){return document.location.href+"."+t}function fq(e,t,r){var n=document.createElement("option");n.innerHTML=t,n.value=t,e.__preset_select.appendChild(n),r&&(e.__preset_select.selectedIndex=e.__preset_select.length-1)}function fY(e,t){t.style.display=e.useLocalStorage?"block":"none"}function fj(e,t){e.domElement.style.width=t+"px",e.__save_row&&e.autoPlace&&(e.__save_row.style.width=t+"px"),e.__closeButton&&(e.__closeButton.style.width=t+"px")}function fZ(e,t){var r={};return fa.each(e.__rememberedObjects,function(n,a){var o={},s=e.__rememberedObjectIndecesToControllers[a];fa.each(s,function(e,r){o[r]=t?e.initialValue:e.getValue()}),r[a]=o}),r}fG.toggleHide=function(){fV=!fV,fa.each(f3,function(e){e.domElement.style.display=fV?"none":""})},fG.CLASS_AUTO_PLACE="a",fG.CLASS_AUTO_PLACE_CONTAINER="ac",fG.CLASS_MAIN="main",fG.CLASS_CONTROLLER_ROW="cr",fG.CLASS_TOO_TALL="taller-than-window",fG.CLASS_CLOSED="closed",fG.CLASS_CLOSE_BUTTON="close-button",fG.CLASS_CLOSE_TOP="close-top",fG.CLASS_CLOSE_BOTTOM="close-bottom",fG.CLASS_DRAG="drag",fG.DEFAULT_WIDTH=245,fG.TEXT_CLOSED="Close Controls",fG.TEXT_OPEN="Open Controls",fG._keydownHandler=function(e){"text"!==document.activeElement.type&&(72===e.which||72===e.keyCode)&&fG.toggleHide()},f_.bind(window,"keydown",fG._keydownHandler,!1),fa.extend(fG.prototype,{add:function(e,t){return f7(this,e,t,{factoryArgs:Array.prototype.slice.call(arguments,2)})},addColor:function(e,t){return f7(this,e,t,{color:!0})},remove:function(e){this.__ul.removeChild(e.__li),this.__controllers.splice(this.__controllers.indexOf(e),1);var t=this;fa.defer(function(){t.onResize()})},destroy:function(){if(this.parent)throw Error("Only the root GUI should be removed with .destroy(). For subfolders, use gui.removeFolder(folder) instead.");this.autoPlace&&fH.removeChild(this.domElement);var e=this;fa.each(this.__folders,function(t){e.removeFolder(t)}),f_.unbind(window,"keydown",fG._keydownHandler,!1),fW(this)},addFolder:function(e){if(void 0!==this.__folders[e])throw Error('You already have a folder in this GUI by the name "'+e+'"');var t={name:e,parent:this};t.autoPlace=this.autoPlace,this.load&&this.load.folders&&this.load.folders[e]&&(t.closed=this.load.folders[e].closed,t.load=this.load.folders[e]);var r=new fG(t);this.__folders[e]=r;var n=f4(this,r.domElement);return f_.addClass(n,"folder"),r},removeFolder:function(e){this.__ul.removeChild(e.domElement.parentElement),delete this.__folders[e.name],this.load&&this.load.folders&&this.load.folders[e.name]&&delete this.load.folders[e.name],fW(e);var t=this;fa.each(e.__folders,function(t){e.removeFolder(t)}),fa.defer(function(){t.onResize()})},open:function(){this.closed=!1},close:function(){this.closed=!0},hide:function(){this.domElement.style.display="none"},show:function(){this.domElement.style.display=""},onResize:function(){var e=this.getRoot();if(e.scrollable){var t=f_.getOffset(e.__ul).top,r=0;fa.each(e.__ul.childNodes,function(t){e.autoPlace&&t===e.__save_row||(r+=f_.getHeight(t))}),document.getElementById("effect-box").clientHeight-t-20<r?(f_.addClass(e.domElement,fG.CLASS_TOO_TALL),e.__ul.style.height=document.getElementById("effect-box").clientHeight-t-20+"px"):(f_.removeClass(e.domElement,fG.CLASS_TOO_TALL),e.__ul.style.height="auto")}e.__resize_handle&&fa.defer(function(){e.__resize_handle.style.height=e.__ul.offsetHeight+"px"}),e.__closeButton&&(e.__closeButton.style.width=e.width+"px")},onResizeDebounced:fa.debounce(function(){this.onResize()},50),remember:function(){if(fa.isUndefined(f2)&&((f2=new fF).domElement.innerHTML=fI),this.parent)throw Error("You can only call remember on a top level GUI.");var e=this;fa.each(Array.prototype.slice.call(arguments),function(t){0===e.__rememberedObjects.length&&function e(t){var r=t.__save_row=document.createElement("li");f_.addClass(t.domElement,"has-save"),t.__ul.insertBefore(r,t.__ul.firstChild),f_.addClass(r,"save-row");var n=document.createElement("span");n.innerHTML="&nbsp;",f_.addClass(n,"button gears");var a=document.createElement("span");a.innerHTML="Save",f_.addClass(a,"button"),f_.addClass(a,"save");var o=document.createElement("span");o.innerHTML="New",f_.addClass(o,"button"),f_.addClass(o,"save-as");var s=document.createElement("span");s.innerHTML="Revert",f_.addClass(s,"button"),f_.addClass(s,"revert");var c=t.__preset_select=document.createElement("select");if(t.load&&t.load.remembered?fa.each(t.load.remembered,function(e,r){fq(t,r,r===t.preset)}):fq(t,fB,!1),f_.bind(c,"change",function(){for(var e=0;e<t.__preset_select.length;e++)t.__preset_select[e].innerHTML=t.__preset_select[e].value;t.preset=this.value}),r.appendChild(c),r.appendChild(n),r.appendChild(a),r.appendChild(o),r.appendChild(s),fz){var h=document.getElementById("dg-local-explain"),d=document.getElementById("dg-local-storage");document.getElementById("dg-save-locally").style.display="block","true"===localStorage.getItem(fX(t,"isLocal"))&&d.setAttribute("checked","checked"),fY(t,h),f_.bind(d,"change",function(){t.useLocalStorage=!t.useLocalStorage,fY(t,h)})}var p=document.getElementById("dg-new-constructor");f_.bind(p,"keydown",function(e){e.metaKey&&(67===e.which||67===e.keyCode)&&f2.hide()}),f_.bind(n,"click",function(){p.innerHTML=JSON.stringify(t.getSaveObject(),void 0,2),f2.show(),p.focus(),p.select()}),f_.bind(a,"click",function(){t.save()}),f_.bind(o,"click",function(){var e=prompt("Enter a new preset name.");e&&t.saveAs(e)}),f_.bind(s,"click",function(){t.revert()})}(e),-1===e.__rememberedObjects.indexOf(t)&&e.__rememberedObjects.push(t)}),this.autoPlace&&fj(this,this.width)},getRoot:function(){for(var e=this;e.parent;)e=e.parent;return e},getSaveObject:function(){var e=this.load;return e.closed=this.closed,this.__rememberedObjects.length>0&&(e.preset=this.preset,e.remembered||(e.remembered={}),e.remembered[this.preset]=fZ(this)),e.folders={},fa.each(this.__folders,function(t,r){e.folders[r]=t.getSaveObject()}),e},save:function(){this.load.remembered||(this.load.remembered={}),this.load.remembered[this.preset]=fZ(this),f6(this,!1),this.saveToLocalStorageIfPossible()},saveAs:function(e){this.load.remembered||(this.load.remembered={},this.load.remembered[fB]=fZ(this,!0)),this.load.remembered[e]=fZ(this),this.preset=e,fq(this,e,!0),this.saveToLocalStorageIfPossible()},revert:function(e){fa.each(this.__controllers,function(t){this.getRoot().load.remembered?f5(e||this.getRoot(),t):t.setValue(t.initialValue),t.__onFinishChange&&t.__onFinishChange.call(t,t.getValue())},this),fa.each(this.__folders,function(e){e.revert(e)}),e||f6(this.getRoot(),!1)},listen:function(e){var t=0===this.__listening.length;this.__listening.push(e),t&&function e(t){0!==t.length&&fO.call(window,function(){e(t)}),fa.each(t,function(e){e.updateDisplay()})}(this.__listening)},updateDisplay:function(){fa.each(this.__controllers,function(e){e.updateDisplay()}),fa.each(this.__folders,function(e){e.updateDisplay()})}});let fK=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,fJ=new WeakMap,fQ=(d=fJ,(e,t)=>(d.set(e,t),t)),f9=(p=fQ,f=fJ,e=>{let t=f.get(e),r=void 0===t?e.size:t<1073741824?t+1:0;if(!e.has(r))return p(e,r);if(e.size<536870912){for(;e.has(r);)r=Math.floor(1073741824*Math.random());return p(e,r)}if(e.size>fK)throw Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;e.has(r);)r=Math.floor(Math.random()*fK);return p(e,r)}),me=(m=f9,e=>{let t=m(e);return e.add(t),t}),mt=(e,t,r)=>({endTime:t,insertTime:r,type:"exponentialRampToValue",value:e}),mi=(e,t,r)=>({endTime:t,insertTime:r,type:"linearRampToValue",value:e}),mr=(e,t)=>({startTime:t,type:"setValue",value:e}),mn=(e,t,r)=>({duration:r,startTime:t,type:"setValueCurve",values:e}),ma=(e,t,{startTime:r,target:n,timeConstant:a})=>n+(t-n)*Math.exp((r-e)/a),mo=e=>"exponentialRampToValue"===e.type,ms=e=>"linearRampToValue"===e.type,ml=e=>mo(e)||ms(e),mu=e=>"setValue"===e.type,mc=e=>"setValueCurve"===e.type,mh=(e,t,r,n)=>{let a=e[t];return void 0===a?n:ml(a)||mu(a)?a.value:mc(a)?a.values[a.values.length-1]:ma(r,mh(e,t-1,a.startTime,n),a)},md=(e,t,r,n,a)=>void 0===r?[n.insertTime,a]:ml(r)?[r.endTime,r.value]:mu(r)?[r.startTime,r.value]:mc(r)?[r.startTime+r.duration,r.values[r.values.length-1]]:[r.startTime,mh(e,t-1,r.startTime,a)],mp=e=>"cancelAndHold"===e.type,mf=e=>"cancelScheduledValues"===e.type,mm=e=>mp(e)||mf(e)?e.cancelTime:mo(e)||ms(e)?e.endTime:e.startTime,mg=(e,t,r,{endTime:n,value:a})=>r===a?a:0<r&&0<a||r<0&&a<0?r*(a/r)**((e-t)/(n-t)):0,m8=(e,t,r,{endTime:n,value:a})=>r+(e-t)/(n-t)*(a-r),m$=(e,t)=>{let r=Math.floor(t),n=Math.ceil(t);return r===n?e[r]:(1-(t-r))*e[r]+(1-(n-t))*e[n]},mv=(e,{duration:t,startTime:r,values:n})=>{let a=(e-r)/t*(n.length-1);return m$(n,a)},mx=e=>"setTarget"===e.type;class my{constructor(e){this._automationEvents=[],this._currenTime=0,this._defaultValue=e}[Symbol.iterator](){return this._automationEvents[Symbol.iterator]()}add(e){let t=mm(e);if(mp(e)||mf(e)){let r=this._automationEvents.findIndex(r=>mf(e)&&mc(r)?r.startTime+r.duration>=t:mm(r)>=t),n=this._automationEvents[r];if(-1!==r&&(this._automationEvents=this._automationEvents.slice(0,r)),mp(e)){let a=this._automationEvents[this._automationEvents.length-1];if(void 0!==n&&ml(n)){if(void 0!==a&&mx(a))throw Error("The internal list is malformed.");let o=void 0===a?n.insertTime:mc(a)?a.startTime+a.duration:mm(a),s=void 0===a?this._defaultValue:mc(a)?a.values[a.values.length-1]:a.value,c=mo(n)?mg(t,o,s,n):m8(t,o,s,n),h=mo(n)?mt(c,t,this._currenTime):mi(c,t,this._currenTime);this._automationEvents.push(h)}if(void 0!==a&&mx(a)&&this._automationEvents.push(mr(this.getValue(t),t)),void 0!==a&&mc(a)&&a.startTime+a.duration>t){let d=t-a.startTime,p=(a.values.length-1)/a.duration,f=Math.max(2,1+Math.ceil(d*p)),m=d/(f-1)*p,$=a.values.slice(0,f);if(m<1)for(let x=1;x<f;x+=1){let y=m*x%1;$[x]=a.values[x-1]*(1-y)+a.values[x]*y}this._automationEvents[this._automationEvents.length-1]=mn($,a.startTime,d)}}}else{let S=this._automationEvents.findIndex(e=>mm(e)>t),E=-1===S?this._automationEvents[this._automationEvents.length-1]:this._automationEvents[S-1];if(void 0!==E&&mc(E)&&mm(E)+E.duration>t)return!1;let _=mo(e)?mt(e.value,e.endTime,this._currenTime):ms(e)?mi(e.value,t,this._currenTime):e;if(-1===S)this._automationEvents.push(_);else{if(mc(e)&&t+e.duration>mm(this._automationEvents[S]))return!1;this._automationEvents.splice(S,0,_)}}return!0}flush(e){let t=this._automationEvents.findIndex(t=>mm(t)>e);if(t>1){let r=this._automationEvents.slice(t-1),n=r[0];mx(n)&&r.unshift(mr(mh(this._automationEvents,t-2,n.startTime,this._defaultValue),n.startTime)),this._automationEvents=r}}getValue(e){if(0===this._automationEvents.length)return this._defaultValue;let t=this._automationEvents.findIndex(t=>mm(t)>e),r=this._automationEvents[t],n=(-1===t?this._automationEvents.length:t)-1,a=this._automationEvents[n];if(void 0!==a&&mx(a)&&(void 0===r||!ml(r)||r.insertTime>e))return ma(e,mh(this._automationEvents,n-1,a.startTime,this._defaultValue),a);if(void 0!==a&&mu(a)&&(void 0===r||!ml(r)))return a.value;if(void 0!==a&&mc(a)&&(void 0===r||!ml(r)||a.startTime+a.duration>e))return e<a.startTime+a.duration?mv(e,a):a.values[a.values.length-1];if(void 0!==a&&ml(a)&&(void 0===r||!ml(r)))return a.value;if(void 0!==r&&mo(r)){let[o,s]=md(this._automationEvents,n,a,r,this._defaultValue);return mg(e,o,s,r)}if(void 0!==r&&ms(r)){let[c,h]=md(this._automationEvents,n,a,r,this._defaultValue);return m8(e,c,h,r)}return this._defaultValue}}let mS=e=>({cancelTime:e,type:"cancelAndHold"}),mE=e=>({cancelTime:e,type:"cancelScheduledValues"}),mb=(e,t)=>({endTime:t,type:"exponentialRampToValue",value:e}),m_=(e,t)=>({endTime:t,type:"linearRampToValue",value:e}),mT=(e,t,r)=>({startTime:t,target:e,timeConstant:r,type:"setTarget"}),mM=()=>new DOMException("","AbortError"),mw=new WeakSet,mA=new WeakMap,mC=new WeakMap,mR=new WeakMap,m0=new WeakMap,mP=new WeakMap,mL=new WeakMap,m1=new WeakMap,mD=new WeakMap,mU={construct:()=>mU},mI=e=>{try{let t=new Proxy(e,mU);new t}catch{return!1}return!0},mN=/^import(?:(?:[\s]+[\w]+|(?:[\s]+[\w]+[\s]*,)?[\s]*\{[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?(?:[\s]*,[\s]*[\w]+(?:[\s]+as[\s]+[\w]+)?)*[\s]*}|(?:[\s]+[\w]+[\s]*,)?[\s]*\*[\s]+as[\s]+[\w]+)[\s]+from)?(?:[\s]*)("([^"\\]|\\.)+"|'([^'\\]|\\.)+')(?:[\s]*);?/,mO=(e,t)=>{let r=[],n=e.replace(/^[\s]+/,""),a=n.match(mN);for(;null!==a;){let o=a[1].slice(1,-1),s=a[0].replace(/([\s]+)?;?$/,"").replace(o,new URL(o,t).toString());r.push(s),a=(n=n.slice(a[0].length).replace(/^[\s]+/,"")).match(mN)}return[r.join(";"),n]},mF=e=>{if(void 0!==e&&!Array.isArray(e))throw TypeError("The parameterDescriptors property of given value for processorCtor is not an array.")},mB=e=>{if(!mI(e))throw TypeError("The given value for processorCtor should be a constructor.");if(null===e.prototype||"object"!=typeof e.prototype)throw TypeError("The given value for processorCtor should have a prototype.")},mz=(e,t)=>{let r=e.get(t);if(void 0===r)throw Error("A value with the given key could not be found.");return r},m2=(e,t)=>{let r=Array.from(e).filter(t);if(r.length>1)throw Error("More than one element was found.");if(0===r.length)throw Error("No element was found.");let[n]=r;return e.delete(n),n},mk=(e,t,r,n)=>{let a=mz(e,t),o=m2(a,e=>e[0]===r&&e[1]===n);return 0===a.size&&e.delete(t),o},mH=e=>mz(mL,e),mV=e=>{if(mw.has(e))throw Error("The AudioNode is already stored.");mw.add(e),mH(e).forEach(e=>e(!0))},m3=e=>"port"in e,mG=e=>{if(!mw.has(e))throw Error("The AudioNode is not stored.");mw.delete(e),mH(e).forEach(e=>e(!1))},m4=(e,t)=>{!m3(e)&&t.every(e=>0===e.size)&&mG(e)},mW=(e,t)=>e.context===t,m6=e=>{try{e.copyToChannel(new Float32Array(1),0,-1)}catch{return!1}return!0},m5=()=>new DOMException("","IndexSizeError"),m7=e=>{var t;e.getChannelData=(t=e.getChannelData,r=>{try{return t.call(e,r)}catch(n){throw 12===n.code?m5():n}})},mX=e=>mw.has(e),mq=e=>"playbackRate"in e,mY=e=>"frequency"in e&&"gain"in e,mj=e=>"offset"in e,mZ=e=>!("frequency"in e)&&"gain"in e,mK=e=>"detune"in e&&"frequency"in e,mJ=e=>"pan"in e,mQ=e=>mz(mA,e),m9=e=>mz(mR,e),ge=(e,t)=>{let{activeInputs:r}=mQ(e);r.forEach(r=>r.forEach(([r])=>{t.includes(e)||ge(r,[...t,e])}));let n=mq(e)?[e.playbackRate]:m3(e)?Array.from(e.parameters.values()):mY(e)?[e.Q,e.detune,e.frequency,e.gain]:mj(e)?[e.offset]:mZ(e)?[e.gain]:mK(e)?[e.detune,e.frequency]:mJ(e)?[e.pan]:[];for(let a of n){let o=m9(a);void 0!==o&&o.activeInputs.forEach(([e])=>ge(e,t))}mX(e)&&mG(e)},gt=e=>{ge(e.destination,[])},gi=e=>{let t=new WeakMap,r=async(r,n)=>{let a=n.destination;return t.set(n,a),await e(r,n,a),a};return{render(e,n){let a=t.get(n);return void 0!==a?Promise.resolve(a):r(e,n)}}},gr=e=>"context"in e,gn=e=>gr(e[0]),ga=(e,t,r,n)=>{for(let a of e)if(r(a)){if(n)return!1;throw Error("The set contains at least one similar element.")}return e.add(t),!0},go=(e,t,[r,n],a)=>{ga(e,[t,r,n],e=>e[0]===t&&e[1]===r,a)},gs=(e,[t,r,n],a)=>{let o=e.get(t);void 0===o?e.set(t,new Set([[r,n]])):ga(o,[r,n],e=>e[0]===r,a)},gl=e=>"inputs"in e,gu=(e,t,r,n)=>{if(gl(t)){let a=t.inputs[n];return e.connect(a,r,0),[a,r,0]}return e.connect(t,r,n),[t,r,n]},gc=(e,t,r)=>{for(let n of e)if(n[0]===t&&n[1]===r)return e.delete(n),n;return null},gh=(e,t,r)=>m2(e,e=>e[0]===t&&e[1]===r),gd=(e,t)=>{if(!mH(e).delete(t))throw Error("Missing the expected event listener.")},gp=(e,t,r)=>{let n=mz(e,t),a=m2(n,e=>e[0]===r);return 0===n.size&&e.delete(t),a},gf=(e,t,r,n)=>{gl(t)?e.disconnect(t.inputs[n],r,0):e.disconnect(t,r,n)},gm=e=>mz(mC,e),gg=e=>mz(m0,e),g8=e=>m1.has(e),g$=e=>!mw.has(e),gv=(e,t)=>new Promise(r=>{if(null!==t)r(!0);else{let n=e.createScriptProcessor(256,1,1),a=e.createGain(),o=e.createBuffer(1,2,44100),s=o.getChannelData(0);s[0]=1,s[1]=1;let c=e.createBufferSource();c.buffer=o,c.loop=!0,c.connect(n).connect(e.destination),c.connect(a),c.disconnect(a),n.onaudioprocess=t=>{let a=t.inputBuffer.getChannelData(0);Array.prototype.some.call(a,e=>1===e)?r(!0):r(!1),c.stop(),n.onaudioprocess=null,c.disconnect(n),n.disconnect(e.destination)},c.start()}}),gx=(e,t)=>{let r=new Map;for(let n of e)for(let a of n){let o=r.get(a);r.set(a,void 0===o?1:o+1)}r.forEach((e,r)=>t(r,e))},gy=e=>"context"in e,gS=(e,t,r,n)=>{let{activeInputs:a,passiveInputs:o}=m9(t),{outputs:s}=mQ(e),c=mH(e),h=s=>{let c=gm(e),h=gg(t);if(s){let d=gp(o,e,r);go(a,e,d,!1),n||g8(e)||c.connect(h,r)}else{let p=gh(a,e,r);gs(o,p,!1),n||g8(e)||c.disconnect(h,r)}};return!!ga(s,[t,r],e=>e[0]===t&&e[1]===r,!0)&&(c.add(h),mX(e)?go(a,e,[r,h],!0):gs(o,[e,r,h],!0),!0)},gE=(e,t,r,n)=>{let{activeInputs:a,passiveInputs:o}=mQ(t),s=gc(a[n],e,r);return null===s?[mk(o,e,r,n)[2],!1]:[s[2],!0]},gb=(e,t,r)=>{let{activeInputs:n,passiveInputs:a}=m9(t),o=gc(n,e,r);return null===o?[gp(a,e,r)[1],!1]:[o[2],!0]},g_=(e,t,r,n,a)=>{let[o,s]=gE(e,r,n,a);if(null===o||(gd(e,o),!s||t||g8(e)||gf(gm(e),gm(r),n,a)),mX(r)){let{activeInputs:c}=mQ(r);m4(r,c)}},gT=(e,t,r,n)=>{let[a,o]=gb(e,r,n);null===a||(gd(e,a),!o||t||g8(e)||gm(e).disconnect(gg(r),n))},gM=(e,t)=>{let r=mQ(e),n=[];for(let a of r.outputs)gn(a)?g_(e,t,...a):gT(e,t,...a),n.push(a[0]);return r.outputs.clear(),n},gw=(e,t,r)=>{let n=mQ(e),a=[];for(let o of n.outputs)o[1]===r&&(gn(o)?g_(e,t,...o):gT(e,t,...o),a.push(o[0]),n.outputs.delete(o));return a},gA=(e,t,r,n,a)=>{let o=mQ(e);return Array.from(o.outputs).filter(e=>e[0]===r&&(void 0===n||e[1]===n)&&(void 0===a||e[2]===a)).map(r=>(gn(r)?g_(e,t,...r):gT(e,t,...r),o.outputs.delete(r),r[0]))},gC=e=>({replay(t){for(let r of e)if("exponentialRampToValue"===r.type){let{endTime:n,value:a}=r;t.exponentialRampToValueAtTime(a,n)}else if("linearRampToValue"===r.type){let{endTime:o,value:s}=r;t.linearRampToValueAtTime(s,o)}else if("setTarget"===r.type){let{startTime:c,target:h,timeConstant:d}=r;t.setTargetAtTime(h,c,d)}else if("setValue"===r.type){let{startTime:p,value:f}=r;t.setValueAtTime(f,p)}else if("setValueCurve"===r.type){let{duration:m,startTime:$,values:x}=r;t.setValueCurveAtTime(x,$,m)}else throw Error("Can't apply an unknown automation.")}}),gR=()=>new DOMException("","DataCloneError"),g0=e=>{let{port1:t,port2:r}=new MessageChannel;return new Promise(n=>{let a=()=>{r.onmessage=null,t.close(),r.close(),n()};r.onmessage=()=>a();try{t.postMessage(e,[e])}catch{}finally{a()}})},gP=e=>"delayTime"in e,gL=()=>new DOMException("","EncodingError"),g1=()=>new DOMException("","InvalidStateError"),gD=()=>new DOMException("","InvalidAccessError"),gU=(e,t,r,n,a,o,s,c,h,d,p)=>{let f=d.length,m=c;for(let $=0;$<f;$+=1){let x=r[0]*d[$];for(let y=1;y<a;y+=1){let S=m-y&h-1;x+=r[y]*o[S],x-=e[y]*s[S]}for(let E=a;E<n;E+=1)x+=r[E]*o[m-E&h-1];for(let _=a;_<t;_+=1)x-=e[_]*s[m-_&h-1];o[m]=d[$],s[m]=x,m=m+1&h-1,p[$]=x}return m},gI=(e,t,r,n)=>{let a=r instanceof Float64Array?r:new Float64Array(r),o=n instanceof Float64Array?n:new Float64Array(n),s=a.length,c=o.length,h=Math.min(s,c);if(1!==a[0]){for(let d=0;d<s;d+=1)o[d]/=a[0];for(let p=1;p<c;p+=1)a[p]/=a[0]}let f=new Float32Array(32),m=new Float32Array(32),$=t.createBuffer(e.numberOfChannels,e.length,e.sampleRate),x=e.numberOfChannels;for(let y=0;y<x;y+=1){let S=e.getChannelData(y),E=$.getChannelData(y);f.fill(0),m.fill(0),gU(a,s,o,c,h,f,m,0,32,S,E)}return $},gN=e=>{let t=new Uint32Array([1179011410,40,1163280727,544501094,16,131073,44100,176400,1048580,1635017060,4,0]);try{let r=e.decodeAudioData(t.buffer,()=>{});return void 0!==r&&(r.catch(()=>{}),!0)}catch{}return!1},gO=(e,t,r)=>{let n=t[r];void 0!==n&&n!==e[r]&&(e[r]=n)},gF=(e,t)=>{gO(e,t,"channelCount"),gO(e,t,"channelCountMode"),gO(e,t,"channelInterpretation")},gB=e=>"function"==typeof e.getFloatTimeDomainData,gz=e=>{e.getFloatTimeDomainData=t=>{let r=new Uint8Array(t.length);e.getByteTimeDomainData(r);let n=Math.max(r.length,e.fftSize);for(let a=0;a<n;a+=1)t[a]=(r[a]-128)*.0078125;return t}},g2=(e,t,r)=>{let n=t[r];void 0!==n&&n!==e[r].value&&(e[r].value=n)},gk=e=>{var t;let r;e.start=(t=e.start,r=!1,(n=0,a=0,o)=>{if(r)throw g1();t.call(e,n,a,o),r=!0})},gH=e=>{var t;e.start=(t=e.start,(r=0,n=0,a)=>{if("number"==typeof a&&a<0||n<0||r<0)throw RangeError("The parameters can't be negative.");t.call(e,r,n,a)})},gV=e=>{var t;e.stop=(t=e.stop,(r=0)=>{if(r<0)throw RangeError("The parameter can't be negative.");t.call(e,r)})},g3=(e,t)=>null===e?512:Math.max(512,Math.min(16384,Math.pow(2,Math.round(Math.log2(e*t))))),gG=(e,t)=>{let r=e.createBiquadFilter();return gF(r,t),g2(r,t,"Q"),g2(r,t,"detune"),g2(r,t,"frequency"),g2(r,t,"gain"),gO(r,t,"type"),r},g4=e=>{let t=e.numberOfOutputs;Object.defineProperty(e,"channelCount",{get:()=>t,set(e){if(e!==t)throw g1()}}),Object.defineProperty(e,"channelCountMode",{get:()=>"explicit",set(e){if("explicit"!==e)throw g1()}}),Object.defineProperty(e,"channelInterpretation",{get:()=>"discrete",set(e){if("discrete"!==e)throw g1()}})},gW=(e,t)=>{let r=e.createChannelSplitter(t.numberOfOutputs);return gF(r,t),g4(r),r},g6=(e,t)=>(e.connect=t.connect.bind(t),e.disconnect=t.disconnect.bind(t),e),g5=(e,t)=>{let r=e.createDelay(t.maxDelayTime);return gF(r,t),g2(r,t,"delayTime"),r},g7=(e,t)=>{let r=e.createGain();return gF(r,t),g2(r,t,"gain"),r};function gX(e,t){let r=t[0]*t[0]+t[1]*t[1];return[(e[0]*t[0]+e[1]*t[1])/r,(e[1]*t[0]-e[0]*t[1])/r]}function gq(e,t){return[e[0]*t[0]-e[1]*t[1],e[0]*t[1]+e[1]*t[0]]}function gY(e,t){let r=[0,0];for(let n=e.length-1;n>=0;n-=1)r=gq(r,t),r[0]+=e[n];return r}let gj,gZ,gK,gJ=(e,t,r,n)=>e.createScriptProcessor(t,r,n),gQ=()=>new DOMException("","NotSupportedError"),g9=(e,t,r)=>void 0===e.copyFromChannel?e.getChannelData(r)[0]:(e.copyFromChannel(t,r),t[0]),$e=e=>{if(null===e)return!1;let t=e.length;return t%2!=0?0!==e[Math.floor(t/2)]:e[t/2-1]+e[t/2]!==0},$t=(e,t,r,n)=>{let a=e;for(;!a.hasOwnProperty(t);)a=Object.getPrototypeOf(a);let{get:o,set:s}=Object.getOwnPropertyDescriptor(a,t);Object.defineProperty(e,t,{get:r(o),set:n(s)})},$i=e=>({...e,channelCount:e.numberOfOutputs}),$r=e=>{let{imag:t,real:r}=e;return void 0===t?void 0===r?{...e,imag:[0,0],real:[0,0]}:{...e,imag:Array.from(r,()=>0),real:r}:void 0===r?{...e,imag:t,real:Array.from(t,()=>0)}:{...e,imag:t,real:r}},$n=(e,t,r)=>{try{e.setValueAtTime(t,r)}catch(n){if(9!==n.code)throw n;$n(e,t,r+1e-7)}},$a=e=>{let t=e.createBufferSource();t.start();try{t.start()}catch{return!0}return!1},$o=e=>{let t=e.createBufferSource(),r=e.createBuffer(1,1,44100);t.buffer=r;try{t.start(0,1)}catch{return!1}return!0},$s=e=>{let t=e.createBufferSource();t.start();try{t.stop()}catch{return!1}return!0},$l=e=>{let t=e.createOscillator();try{t.start(-1)}catch(r){return r instanceof RangeError}return!1},$u=e=>{let t=e.createBuffer(1,1,44100),r=e.createBufferSource();r.buffer=t,r.start(),r.stop();try{return r.stop(),!0}catch{return!1}},$c=e=>{let t=e.createOscillator();try{t.stop(-1)}catch(r){return r instanceof RangeError}return!1},$h=e=>{var t;e.start=(t=e.start,(r=0,n=0,a)=>{let o=e.buffer,s=null===o?n:Math.min(o.duration,n);null!==o&&s>o.duration-.5/e.context.sampleRate?t.call(e,r,0,0):t.call(e,r,s,a)})},$d=(e,t)=>{var r,n;let a=t.createGain();e.connect(a);let o=(r=e.disconnect,()=>{r.call(e,a),e.removeEventListener("ended",o)}),s;e.addEventListener("ended",o),g6(e,a),e.stop=(n=e.stop,s=!1,(t=0)=>{if(s)try{n.call(e,t)}catch{a.gain.setValueAtTime(0,t)}else n.call(e,t),s=!0})},$p=(e,t)=>r=>{let n={value:e};return Object.defineProperties(r,{currentTarget:n,target:n}),"function"==typeof t?t.call(e,r):t.handleEvent.call(e,r)},$f=($=ga,(e,t,[r,n,a],o)=>{$(e[n],[t,r,a],e=>e[0]===t&&e[1]===r,o)}),$m=(x=ga,(e,t,[r,n,a],o)=>{let s=e.get(r);void 0===s?e.set(r,new Set([[n,t,a]])):x(s,[n,t,a],e=>e[0]===n&&e[1]===t,o)}),$g=(y=m2,(e,t,r,n)=>y(e[n],e=>e[0]===t&&e[1]===r)),$8=new WeakMap,$$=(S=$8,e=>{var t;return null!==(t=S.get(e))&&void 0!==t?t:0}),$v=(E=new Map,_=new WeakMap,(e,t)=>{let r=_.get(e);if(void 0!==r)return r;let n=E.get(e);if(void 0!==n)return n;try{let a=t();return a instanceof Promise?(E.set(e,a),a.catch(()=>!1).then(t=>(E.delete(e),_.set(e,t),t))):(_.set(e,a),a)}catch{return _.set(e,!1),!1}}),$x=typeof window>"u"?null:window,$y=(T=$v,M=m5,(e,t)=>{let r=e.createAnalyser();if(gF(r,t),!(t.maxDecibels>t.minDecibels))throw M();return gO(r,t,"fftSize"),gO(r,t,"maxDecibels"),gO(r,t,"minDecibels"),gO(r,t,"smoothingTimeConstant"),T(gB,()=>gB(r))||gz(r),r}),$S=(A=mQ,e=>{let t=A(e);if(null===t.renderer)throw Error("Missing the renderer of the given AudioNode in the audio graph.");return t.renderer}),$E=(C=mQ,R=$S,P=g8,async(e,t,r)=>{let n=C(e);await Promise.all(n.activeInputs.map((n,a)=>Array.from(n).map(async([n,o])=>{let s=await R(n).render(n,t),c=e.context.destination;P(n)||e===c&&P(e)||s.connect(r,o,a)})).reduce((e,t)=>[...e,...t],[]))}),$b=(D=$y,U=gm,I=$E,()=>{let e=new WeakMap,t=async(t,r)=>{let n=U(t);if(!mW(n,r)){let a={channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,fftSize:n.fftSize,maxDecibels:n.maxDecibels,minDecibels:n.minDecibels,smoothingTimeConstant:n.smoothingTimeConstant};n=D(r,a)}return e.set(r,n),await I(t,r,n),n};return{render(r,n){let a=e.get(n);return void 0!==a?Promise.resolve(a):t(r,n)}}}),$_=(N=mP,e=>{let t=N.get(e);if(void 0===t)throw g1();return t}),$T=null===(O=$x)?null:O.hasOwnProperty("OfflineAudioContext")?O.OfflineAudioContext:O.hasOwnProperty("webkitOfflineAudioContext")?O.webkitOfflineAudioContext:null,$M=(F=$T,e=>null!==F&&e instanceof F),$w=new WeakMap,$A=class{constructor(e){this._nativeEventTarget=e,this._listeners=new WeakMap}addEventListener(e,t,r){if(null!==t){let n=this._listeners.get(t);void 0===n&&(n=(B=$p)(this,t),"function"==typeof t&&this._listeners.set(t,n)),this._nativeEventTarget.addEventListener(e,n,r)}}dispatchEvent(e){return this._nativeEventTarget.dispatchEvent(e)}removeEventListener(e,t,r){let n=null===t?void 0:this._listeners.get(t);this._nativeEventTarget.removeEventListener(e,void 0===n?null:n,r)}},$C=null===(z=$x)?null:z.hasOwnProperty("AudioContext")?z.AudioContext:z.hasOwnProperty("webkitAudioContext")?z.webkitAudioContext:null,$R=(k=$C,e=>null!==k&&e instanceof k),$0=(H=$x,e=>null!==H&&"function"==typeof H.AudioNode&&e instanceof H.AudioNode),$P=(V=$x,e=>null!==V&&"function"==typeof V.AudioParam&&e instanceof V.AudioParam),$L=null===(G=$x)?null:G.hasOwnProperty("AudioWorkletNode")?G.AudioWorkletNode:null,$1=(ec=(W=mA,(e,t,r)=>{let n=[];for(let a=0;a<r.numberOfInputs;a+=1)n.push(new Set);W.set(e,{activeInputs:n,outputs:new Set,passiveInputs:new WeakMap,renderer:t})}),eh=((e,t,r,n,a,o,s,c,h,d,p,f,m)=>{let $=new WeakMap;return(x,y,S,E,_)=>{let{activeInputs:T,passiveInputs:M}=o(y),{outputs:A}=o(x),C=c(x),R=o=>{let c=h(y),d=h(x);if(o){let A=mk(M,x,S,E);e(T,x,A,!1),_||f(x)||r(d,c,S,E),m(y)&&mV(y)}else{let C=n(T,x,S,E);t(M,E,C,!1),_||f(x)||a(d,c,S,E);let R=s(y);if(0===R)p(y)&&m4(y,T);else{let P=$.get(y);void 0!==P&&clearTimeout(P),$.set(y,setTimeout(()=>{p(y)&&m4(y,T)},1e3*R))}}};return!!d(A,[y,S,E],e=>e[0]===y&&e[1]===S&&e[2]===E,!0)&&(C.add(R),p(x)?e(T,x,[S,E,R],!0):t(M,E,[x,S,R],!0),!0)}})($f,$m,gu,$g,gf,mQ,$$,mH,gm,ga,mX,g8,g$),ed=$v,ep=(X=m1,q=gf,Y=mQ,j=gm,Z=gg,K=mX,e=>(t,r)=>{let n=X.get(t);if(void 0===n){if(!e&&K(t)){let a=j(t),{outputs:o}=Y(t);for(let s of o)if(gn(s)){let c=j(s[0]);q(a,c,s[1],s[2])}else{let h=Z(s[0]);a.disconnect(h,s[1])}}X.set(t,r)}else X.set(t,n+r)}),ef=m5,em=gD,eg=gQ,e8=(J=gu,Q=m1,et=mQ,ei=gm,er=gg,en=$_,ea=mX,eo=$M,(e,t)=>{let r=Q.get(e);if(void 0===r)throw Error("Missing the expected cycle count.");let n=en(e.context),a=eo(n);if(r===t){if(Q.delete(e),!a&&ea(e)){let o=ei(e),{outputs:s}=et(e);for(let c of s)if(gn(c)){let h=ei(c[0]);J(o,h,c[1],c[2])}else{let d=er(c[0]);o.connect(d,c[1])}}}else Q.set(e,r-t)}),e$=(es=$w,el=mQ,eu=mz,function e(t,r){let n=gr(r)?r:eu(es,r);if(gP(n))return[];if(t[0]===n)return[t];if(t.includes(n))return[];let{outputs:a}=el(n);return Array.from(a).map(r=>e([...t,n],r[0])).reduce((e,t)=>e.concat(t),[])}),ev=$A,ex=$_,ey=$R,eS=$0,eE=$P,eb=$M,class extends ev{constructor(e,t,r,n){super(r),this._context=e,this._nativeAudioNode=r;let a=ex(e);ey(a)&&!0!==ed(gv,()=>gv(a,e_=$L))&&(e=>{var t,r;let n=new Map;e.connect=(t=e.connect.bind(e),(e,r=0,a=0)=>{let o=gy(e)?t(e,r,a):t(e,r),s=n.get(e);return void 0===s?n.set(e,[{input:a,output:r}]):s.every(e=>e.input!==a||e.output!==r)&&s.push({input:a,output:r}),o}),e.disconnect=(r=e.disconnect,(t,a,o)=>{if(r.apply(e),void 0===t)n.clear();else if("number"==typeof t)for(let[s,c]of n){let h=c.filter(e=>e.output!==t);0===h.length?n.delete(s):n.set(s,h)}else if(n.has(t)){if(void 0===a)n.delete(t);else{let d=n.get(t);if(void 0!==d){let p=d.filter(e=>e.output!==a&&(e.input!==o||void 0===o));0===p.length?n.delete(t):n.set(t,p)}}}for(let[f,m]of n)m.forEach(t=>{gy(f)?e.connect(f,t.output,t.input):e.connect(f,t.output)})})})(r),mC.set(this,r),mL.set(this,new Set),"closed"!==e.state&&t&&mV(this),ec(this,n,r)}get channelCount(){return this._nativeAudioNode.channelCount}set channelCount(e){this._nativeAudioNode.channelCount=e}get channelCountMode(){return this._nativeAudioNode.channelCountMode}set channelCountMode(e){this._nativeAudioNode.channelCountMode=e}get channelInterpretation(){return this._nativeAudioNode.channelInterpretation}set channelInterpretation(e){this._nativeAudioNode.channelInterpretation=e}get context(){return this._context}get numberOfInputs(){return this._nativeAudioNode.numberOfInputs}get numberOfOutputs(){return this._nativeAudioNode.numberOfOutputs}connect(e,t=0,r=0){if(t<0||t>=this._nativeAudioNode.numberOfOutputs)throw ef();let n=ex(this._context),a=eb(n);if(eS(e)||eE(e))throw em();if(gr(e)){let o=gm(e);try{let s=gu(this._nativeAudioNode,o,t,r),c=g$(this);(a||c)&&this._nativeAudioNode.disconnect(...s),"closed"!==this.context.state&&!c&&g$(e)&&mV(e)}catch(h){throw 12===h.code?em():h}if(eh(this,e,t,r,a)){let d=e$([this],e);gx(d,ep(a))}return e}let p=gg(e);if("playbackRate"===p.name&&1024===p.maxValue)throw eg();try{this._nativeAudioNode.connect(p,t),(a||g$(this))&&this._nativeAudioNode.disconnect(p,t)}catch(f){throw 12===f.code?em():f}if(gS(this,e,t,a)){let m=e$([this],e);gx(m,ep(a))}}disconnect(e,t,r){let n,a=ex(this._context),o=eb(a);if(void 0===e)n=gM(this,o);else if("number"==typeof e){if(e<0||e>=this.numberOfOutputs)throw ef();n=gw(this,o,e)}else{if(void 0!==t&&(t<0||t>=this.numberOfOutputs)||gr(e)&&void 0!==r&&(r<0||r>=e.numberOfInputs))throw ef();if(0===(n=gA(this,o,e,t,r)).length)throw em()}for(let s of n){let c=e$([this],s);gx(c,e8)}}}),$D=(eT=$1,eM=$b,ew=m5,eA=$y,class extends eT{constructor(e,t){let r=(eC=$_)(e),n={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",fftSize:2048,maxDecibels:-30,minDecibels:-100,smoothingTimeConstant:.8,...t},a=eA(r,n),o=$M(r)?eM():null;super(e,!1,a,o),this._nativeAnalyserNode=a}get fftSize(){return this._nativeAnalyserNode.fftSize}set fftSize(e){this._nativeAnalyserNode.fftSize=e}get frequencyBinCount(){return this._nativeAnalyserNode.frequencyBinCount}get maxDecibels(){return this._nativeAnalyserNode.maxDecibels}set maxDecibels(e){let t=this._nativeAnalyserNode.maxDecibels;if(this._nativeAnalyserNode.maxDecibels=e,!(e>this._nativeAnalyserNode.minDecibels))throw this._nativeAnalyserNode.maxDecibels=t,ew()}get minDecibels(){return this._nativeAnalyserNode.minDecibels}set minDecibels(e){let t=this._nativeAnalyserNode.minDecibels;if(this._nativeAnalyserNode.minDecibels=e,!(this._nativeAnalyserNode.maxDecibels>e))throw this._nativeAnalyserNode.minDecibels=t,ew()}get smoothingTimeConstant(){return this._nativeAnalyserNode.smoothingTimeConstant}set smoothingTimeConstant(e){this._nativeAnalyserNode.smoothingTimeConstant=e}getByteFrequencyData(e){this._nativeAnalyserNode.getByteFrequencyData(e)}getByteTimeDomainData(e){this._nativeAnalyserNode.getByteTimeDomainData(e)}getFloatFrequencyData(e){this._nativeAnalyserNode.getFloatFrequencyData(e)}getFloatTimeDomainData(e){this._nativeAnalyserNode.getFloatTimeDomainData(e)}}),$U=new WeakSet,$I=null===(e0=$x)?null:e0.hasOwnProperty("AudioBuffer")?e0.AudioBuffer:null,$N=(eP=new Uint32Array(1),e=>(eP[0]=e,eP[0])),$O=(eL=$N,e1=m5,e=>{e.copyFromChannel=(t,r,n=0)=>{let a=eL(n),o=eL(r);if(o>=e.numberOfChannels)throw e1();let s=e.length,c=e.getChannelData(o),h=t.length;for(let d=a<0?-a:0;d+a<s&&d<h;d+=1)t[d]=c[d+a]},e.copyToChannel=(t,r,n=0)=>{let a=eL(n),o=eL(r);if(o>=e.numberOfChannels)throw e1();let s=e.length,c=e.getChannelData(o),h=t.length;for(let d=a<0?-a:0;d+a<s&&d<h;d+=1)c[d+a]=t[d]}}),$F=(eD=$N,e=>{var t,r;e.copyFromChannel=(t=e.copyFromChannel,(r,n,a=0)=>{let o=eD(a),s=eD(n);if(o<e.length)return t.call(e,r,s,o)}),e.copyToChannel=(r=e.copyToChannel,(t,n,a=0)=>{let o=eD(a),s=eD(n);if(o<e.length)return r.call(e,t,s,o)})}),$B=(eI=$U,eN=$v,eO=gQ,eF=$I,eB=$T,ez=(eU=$I,()=>{if(null===eU)return!1;try{new eU({length:1,sampleRate:44100})}catch{return!1}return!0}),e2=$O,ek=$F,gj=null,class e{constructor(e){if(null===eB)throw Error("Missing the native OfflineAudioContext constructor.");let{length:t,numberOfChannels:r,sampleRate:n}={numberOfChannels:1,...e};null===gj&&(gj=new eB(1,1,44100));let a=null!==eF&&eN(ez,ez)?new eF({length:t,numberOfChannels:r,sampleRate:n}):gj.createBuffer(r,t,n);if(0===a.numberOfChannels)throw eO();return"function"!=typeof a.copyFromChannel?(e2(a),m7(a)):eN(m6,()=>m6(a))||ek(a),eI.add(a),a}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===e.prototype||eI.has(t)}}),$z=(eH=g7,(e,t)=>{let r=eH(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});t.connect(r).connect(e.destination);let n=()=>{t.removeEventListener("ended",n),t.disconnect(r),r.disconnect()};t.addEventListener("ended",n)}),$2=(eV=$S,e3=m9,eG=g8,async(e,t,r)=>{let n=e3(e);await Promise.all(Array.from(n.activeInputs).map(async([e,n])=>{let a=await eV(e).render(e,t);eG(e)||a.connect(r,n)}))}),$k=(e4=$2,(e,t,r)=>e4(t,e,r)),$H=(e6=$z,e5=$v,e7=$a,eX=$o,eq=$s,eY=$l,ej=$u,eZ=$c,eK=$h,eJ=(eW=$t,(e,t)=>{let r=t.createBuffer(1,1,44100);null===e.buffer&&(e.buffer=r),eW(e,"buffer",t=>()=>{let n=t.call(e);return n===r?null:n},t=>n=>t.call(e,null===n?r:n))}),eQ=$d,(e,t)=>{let r=e.createBufferSource();return gF(r,t),g2(r,t,"playbackRate"),gO(r,t,"buffer"),gO(r,t,"loop"),gO(r,t,"loopEnd"),gO(r,t,"loopStart"),e5(e7,()=>e7(e))||gk(r),e5(eX,()=>eX(e))||eK(r),e5(eq,()=>eq(e))||eJ(r,e),e5(eY,()=>eY(e))||gH(r),e5(ej,()=>ej(e))||eQ(r,e),e5(eZ,()=>eZ(e))||gV(r),e6(e,r),r}),$V=(te=(e9=m9,e=>{let t=e9(e);if(null===t.renderer)throw Error("Missing the renderer of the given AudioParam in the audio graph.");return t.renderer}),tt=$2,(e,t,r)=>(te(t).replay(r),tt(t,e,r))),$3=(ti=$k,tr=$H,tn=gm,ta=$V,to=$E,()=>{let e=new WeakMap,t=null,r=null,n=async(n,a)=>{let o=tn(n),s=mW(o,a);if(!s){let c={buffer:o.buffer,channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,loop:o.loop,loopEnd:o.loopEnd,loopStart:o.loopStart,playbackRate:o.playbackRate.value};o=tr(a,c),null!==t&&o.start(...t),null!==r&&o.stop(r)}return e.set(a,o),s?await ti(a,n.playbackRate,o.playbackRate):await ta(a,n.playbackRate,o.playbackRate),await to(n,a,o),o};return{set start(l){t=l},set stop(l){r=l},render(t,r){let a=e.get(r);return void 0!==a?Promise.resolve(a):n(t,r)}}}),$G=(tl=(ts=mR,(e,t)=>{ts.set(e,{activeInputs:new Set,passiveInputs:new WeakMap,renderer:t})}),tu=$w,tc=m0,th=gC,td=mS,tp=mE,tf=mb,tm=m_,tg=mT,t8=mr,t$=mn,tv=$C,tx=$n,(e,t,r,n=null,a=null)=>{let o=r.value,s=new my(o),c=t?th(s):null,h={get defaultValue(){return o},get maxValue(){return null===n?r.maxValue:n},get minValue(){return null===a?r.minValue:a},get value(){return r.value},set value(b){r.value=b,h.setValueAtTime(b,e.context.currentTime)},cancelAndHoldAtTime(t){if("function"==typeof r.cancelAndHoldAtTime)null===c&&s.flush(e.context.currentTime),s.add(td(t)),r.cancelAndHoldAtTime(t);else{let n=Array.from(s).pop();null===c&&s.flush(e.context.currentTime),s.add(td(t));let a=Array.from(s).pop();r.cancelScheduledValues(t),n!==a&&void 0!==a&&("exponentialRampToValue"===a.type?r.exponentialRampToValueAtTime(a.value,a.endTime):"linearRampToValue"===a.type?r.linearRampToValueAtTime(a.value,a.endTime):"setValue"===a.type?r.setValueAtTime(a.value,a.startTime):"setValueCurve"===a.type&&r.setValueCurveAtTime(a.values,a.startTime,a.duration))}return h},cancelScheduledValues:t=>(null===c&&s.flush(e.context.currentTime),s.add(tp(t)),r.cancelScheduledValues(t),h),exponentialRampToValueAtTime(t,n){if(0===t||!Number.isFinite(n)||n<0)throw RangeError();let a=e.context.currentTime;return null===c&&s.flush(a),0===Array.from(s).length&&(s.add(t8(o,a)),r.setValueAtTime(o,a)),s.add(tf(t,n)),r.exponentialRampToValueAtTime(t,n),h},linearRampToValueAtTime(t,n){let a=e.context.currentTime;return null===c&&s.flush(a),0===Array.from(s).length&&(s.add(t8(o,a)),r.setValueAtTime(o,a)),s.add(tm(t,n)),r.linearRampToValueAtTime(t,n),h},setTargetAtTime:(t,n,a)=>(null===c&&s.flush(e.context.currentTime),s.add(tg(t,n,a)),r.setTargetAtTime(t,n,a),h),setValueAtTime:(t,n)=>(null===c&&s.flush(e.context.currentTime),s.add(t8(t,n)),r.setValueAtTime(t,n),h),setValueCurveAtTime(t,n,a){let o=t instanceof Float32Array?t:new Float32Array(t);if(null!==tv&&"webkitAudioContext"===tv.name){let d=n+a,p=e.context.sampleRate,f=Math.ceil(n*p),m=Math.floor(d*p),$=m-f,x=new Float32Array($);for(let y=0;y<$;y+=1){let S=(o.length-1)/a*((f+y)/p-n),E=Math.floor(S),_=Math.ceil(S);x[y]=E===_?o[E]:(1-(S-E))*o[E]+(1-(_-S))*o[_]}null===c&&s.flush(e.context.currentTime),s.add(t$(x,n,a)),r.setValueCurveAtTime(x,n,a);let T=m/p;T<d&&tx(h,x[x.length-1],T),tx(h,o[o.length-1],d)}else null===c&&s.flush(e.context.currentTime),s.add(t$(o,n,a)),r.setValueCurveAtTime(o,n,a);return h}};return tc.set(h,r),tu.set(h,e),tl(h,c),h}),$4=(ty=$1,tS=$3,tE=$G,tb=g1,t_=$H,tT=$_,class extends ty{constructor(e,t){let r=tT(e),n={buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1,...t},a=t_(r,n),o=(tM=$M)(r),s=o?tS():null;super(e,!1,a,s),this._audioBufferSourceNodeRenderer=s,this._isBufferNullified=!1,this._isBufferSet=null!==n.buffer,this._nativeAudioBufferSourceNode=a,this._onended=null,this._playbackRate=tE(this,o,a.playbackRate,34028234663852886e22,-34028234663852886e22)}get buffer(){return this._isBufferNullified?null:this._nativeAudioBufferSourceNode.buffer}set buffer(e){if(this._nativeAudioBufferSourceNode.buffer=e,null!==e){if(this._isBufferSet)throw tb();this._isBufferSet=!0}}get loop(){return this._nativeAudioBufferSourceNode.loop}set loop(e){this._nativeAudioBufferSourceNode.loop=e}get loopEnd(){return this._nativeAudioBufferSourceNode.loopEnd}set loopEnd(e){this._nativeAudioBufferSourceNode.loopEnd=e}get loopStart(){return this._nativeAudioBufferSourceNode.loopStart}set loopStart(e){this._nativeAudioBufferSourceNode.loopStart=e}get onended(){return this._onended}set onended(e){let t="function"==typeof e?(tw=$p)(this,e):null;this._nativeAudioBufferSourceNode.onended=t;let r=this._nativeAudioBufferSourceNode.onended;this._onended=null!==r&&r===t?e:r}get playbackRate(){return this._playbackRate}start(e=0,t=0,r){if(this._nativeAudioBufferSourceNode.start(e,t,r),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.start=void 0===r?[e,t]:[e,t,r]),"closed"!==this.context.state){mV(this);let n=()=>{this._nativeAudioBufferSourceNode.removeEventListener("ended",n),mX(this)&&mG(this)};this._nativeAudioBufferSourceNode.addEventListener("ended",n)}}stop(e=0){this._nativeAudioBufferSourceNode.stop(e),null!==this._audioBufferSourceNodeRenderer&&(this._audioBufferSourceNodeRenderer.stop=e)}}),$W=(tR=$1,t0=gi,tP=m5,tL=g1,t1=(tA=g7,tC=$t,(e,t,r)=>{let n=e.destination;if(n.channelCount!==t)try{n.channelCount=t}catch{}r&&"explicit"!==n.channelCountMode&&(n.channelCountMode="explicit"),0===n.maxChannelCount&&Object.defineProperty(n,"maxChannelCount",{value:t});let a=tA(e,{channelCount:t,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,gain:1});return tC(a,"channelCount",e=>()=>e.call(a),e=>t=>{e.call(a,t);try{n.channelCount=t}catch(r){if(t>n.maxChannelCount)throw r}}),tC(a,"channelCountMode",e=>()=>e.call(a),e=>t=>{e.call(a,t),n.channelCountMode=t}),tC(a,"channelInterpretation",e=>()=>e.call(a),e=>t=>{e.call(a,t),n.channelInterpretation=t}),Object.defineProperty(a,"maxChannelCount",{get:()=>n.maxChannelCount}),a.connect(n),a}),tD=$_,class extends tR{constructor(e,t){let r=tD(e),n=(tU=$M)(r),a=t1(r,t,n),o=n?t0($E):null;super(e,!1,a,o),this._isNodeOfNativeOfflineAudioContext=n,this._nativeAudioDestinationNode=a}get channelCount(){return this._nativeAudioDestinationNode.channelCount}set channelCount(e){if(this._isNodeOfNativeOfflineAudioContext)throw tL();if(e>this._nativeAudioDestinationNode.maxChannelCount)throw tP();this._nativeAudioDestinationNode.channelCount=e}get channelCountMode(){return this._nativeAudioDestinationNode.channelCountMode}set channelCountMode(e){if(this._isNodeOfNativeOfflineAudioContext)throw tL();this._nativeAudioDestinationNode.channelCountMode=e}get maxChannelCount(){return this._nativeAudioDestinationNode.maxChannelCount}}),$6=(tN=$k,tO=gG,tF=gm,tB=$V,tz=$E,()=>{let e=new WeakMap,t=async(t,r)=>{let n=tF(t),a=mW(n,r);if(!a){let o={Q:n.Q.value,channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,detune:n.detune.value,frequency:n.frequency.value,gain:n.gain.value,type:n.type};n=tO(r,o)}return e.set(r,n),a?(await tN(r,t.Q,n.Q),await tN(r,t.detune,n.detune),await tN(r,t.frequency,n.frequency),await tN(r,t.gain,n.gain)):(await tB(r,t.Q,n.Q),await tB(r,t.detune,n.detune),await tB(r,t.frequency,n.frequency),await tB(r,t.gain,n.gain)),await tz(t,r,n),n};return{render(r,n){let a=e.get(n);return void 0!==a?Promise.resolve(a):t(r,n)}}}),$5=(t2=$8,(e,t)=>t2.set(e,t)),$7=(tk=$1,tH=$G,tV=$6,t3=gD,tG=gG,t4=$_,class extends tk{constructor(e,t){let r=t4(e),n={Q:1,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:350,gain:0,type:"lowpass",...t},a=tG(r,n),o=(tW=$M)(r),s=o?tV():null;super(e,!1,a,s),this._Q=tH(this,o,a.Q,34028234663852886e22,-34028234663852886e22),this._detune=tH(this,o,a.detune,1200*Math.log2(34028234663852886e22),-1200*Math.log2(34028234663852886e22)),this._frequency=tH(this,o,a.frequency,e.sampleRate/2,0),this._gain=tH(this,o,a.gain,40*Math.log10(34028234663852886e22),-34028234663852886e22),this._nativeBiquadFilterNode=a,$5(this,1)}get detune(){return this._detune}get frequency(){return this._frequency}get gain(){return this._gain}get Q(){return this._Q}get type(){return this._nativeBiquadFilterNode.type}set type(e){this._nativeBiquadFilterNode.type=e}getFrequencyResponse(e,t,r){try{this._nativeBiquadFilterNode.getFrequencyResponse(e,t,r)}catch(n){throw 11===n.code?t3():n}if(e.length!==t.length||t.length!==r.length)throw t3()}}),$X=(t5=ga,t7=$0,(e,t,r)=>{var n,a;let o=new Set;return e.connect=(n=e.connect,(r,a=0,s=0)=>{let c=0===o.size;if(t7(r))return n.call(e,r,a,s),t5(o,[r,a,s],e=>e[0]===r&&e[1]===a&&e[2]===s,!0),c&&t(),r;n.call(e,r,a),t5(o,[r,a],e=>e[0]===r&&e[1]===a,!0),c&&t()}),e.disconnect=(a=e.disconnect,(t,n,s)=>{let c=o.size>0;if(void 0===t)a.apply(e),o.clear();else if("number"==typeof t)for(let h of(a.call(e,t),o))h[1]===t&&o.delete(h);else for(let d of(t7(t)?a.call(e,t,n,s):a.call(e,t,n),o))d[0]===t&&(void 0===n||d[1]===n)&&(void 0===s||d[2]===s)&&o.delete(d);let p=0===o.size;c&&p&&r()}),e}),$q=(tX=g1,tq=$X,(e,t)=>{t.channelCount=1,t.channelCountMode="explicit",Object.defineProperty(t,"channelCount",{get:()=>1,set(){throw tX()}}),Object.defineProperty(t,"channelCountMode",{get:()=>"explicit",set(){throw tX()}});let r=e.createBufferSource();tq(t,()=>{let e=t.numberOfInputs;for(let n=0;n<e;n+=1)r.connect(t,0,n)},()=>r.disconnect(t))}),$Y=(tY=$C,tj=$q,(e,t)=>{let r=e.createChannelMerger(t.numberOfInputs);return null!==tY&&"webkitAudioContext"===tY.name&&tj(e,r),gF(r,t),r}),$j=(tZ=$Y,tK=gm,tJ=$E,()=>{let e=new WeakMap,t=async(t,r)=>{let n=tK(t);if(!mW(n,r)){let a={channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,numberOfInputs:n.numberOfInputs};n=tZ(r,a)}return e.set(r,n),await tJ(t,r,n),n};return{render(r,n){let a=e.get(n);return void 0!==a?Promise.resolve(a):t(r,n)}}}),$Z=(tQ=$1,t9=$j,ie=$Y,class extends tQ{constructor(e,t){let r=(it=$_)(e),n={channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6,...t},a=ie(r,n),o=$M(r)?t9():null;super(e,!1,a,o)}}),$K=(ir=gW,ia=gm,io=$E,()=>{let e=new WeakMap,t=async(t,r)=>{let n=ia(t);if(!mW(n,r)){let a={channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,numberOfOutputs:n.numberOfOutputs};n=ir(r,a)}return e.set(r,n),await io(t,r,n),n};return{render(r,n){let a=e.get(n);return void 0!==a?Promise.resolve(a):t(r,n)}}}),$J=(is=$1,il=$K,iu=gW,ic=$_,class extends is{constructor(e,t){let r=ic(e),n=$i({channelCount:6,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:6,...t}),a=iu(r,n),o=(ih=$M)(r)?il():null;super(e,!1,a,o)}}),$Q=(ip=$z,im=$H,ig=g7,i8=$X,(e,{offset:t,...r})=>{let n=e.createBuffer(1,2,44100),a=im(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),o=ig(e,{...r,gain:t}),s=n.getChannelData(0);s[0]=1,s[1]=1,a.buffer=n,a.loop=!0;let c=()=>a.connect(o),h=()=>a.disconnect(o);return ip(e,a),i8(g6({get bufferSize(){},get channelCount(){return o.channelCount},set channelCount(g){o.channelCount=g},get channelCountMode(){return o.channelCountMode},set channelCountMode(g){o.channelCountMode=g},get channelInterpretation(){return o.channelInterpretation},set channelInterpretation(g){o.channelInterpretation=g},get context(){return o.context},get inputs(){return[]},get numberOfInputs(){return a.numberOfInputs},get numberOfOutputs(){return o.numberOfOutputs},get offset(){return o.gain},get onended(){return a.onended},set onended(g){a.onended=g},addEventListener:(...e)=>a.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>a.dispatchEvent(e[0]),removeEventListener:(...e)=>a.removeEventListener(e[0],e[1],e[2]),start(e=0){a.start.call(a,e)},stop(e=0){a.stop.call(a,e)}},o),c,h)}),$9=(i$=$z,iv=$v,ix=$Q,iy=$l,iS=$c,(e,t)=>{if(void 0===e.createConstantSource)return ix(e,t);let r=e.createConstantSource();return gF(r,t),g2(r,t,"offset"),iv(iy,()=>iy(e))||gH(r),iv(iS,()=>iS(e))||gV(r),i$(e,r),r}),ve=(iE=$k,ib=$9,i_=gm,iT=$V,iM=$E,()=>{let e=new WeakMap,t=null,r=null,n=async(n,a)=>{let o=i_(n),s=mW(o,a);if(!s){let c={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation,offset:o.offset.value};o=ib(a,c),null!==t&&o.start(t),null!==r&&o.stop(r)}return e.set(a,o),s?await iE(a,n.offset,o.offset):await iT(a,n.offset,o.offset),await iM(n,a,o),o};return{set start(l){t=l},set stop(l){r=l},render(t,r){let a=e.get(r);return void 0!==a?Promise.resolve(a):n(t,r)}}}),vt=(iw=$1,iA=$G,iC=ve,iR=$9,i0=$_,class extends iw{constructor(e,t){let r=i0(e),n={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",offset:1,...t},a=iR(r,n),o=(iP=$M)(r),s=o?iC():null;super(e,!1,a,s),this._constantSourceNodeRenderer=s,this._nativeConstantSourceNode=a,this._offset=iA(this,o,a.offset,34028234663852886e22,-34028234663852886e22),this._onended=null}get offset(){return this._offset}get onended(){return this._onended}set onended(e){let t="function"==typeof e?(iL=$p)(this,e):null;this._nativeConstantSourceNode.onended=t;let r=this._nativeConstantSourceNode.onended;this._onended=null!==r&&r===t?e:r}start(e=0){if(this._nativeConstantSourceNode.start(e),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.start=e),"closed"!==this.context.state){mV(this);let t=()=>{this._nativeConstantSourceNode.removeEventListener("ended",t),mX(this)&&mG(this)};this._nativeConstantSourceNode.addEventListener("ended",t)}}stop(e=0){this._nativeConstantSourceNode.stop(e),null!==this._constantSourceNodeRenderer&&(this._constantSourceNodeRenderer.stop=e)}}),vi=(i1=gQ,iD=$t,(e,t)=>{let r=e.createConvolver();if(gF(r,t),t.disableNormalization===r.normalize&&(r.normalize=!t.disableNormalization),gO(r,t,"buffer"),t.channelCount>2||(iD(r,"channelCount",e=>()=>e.call(r),e=>t=>{if(t>2)throw i1();return e.call(r,t)}),"max"===t.channelCountMode))throw i1();return iD(r,"channelCountMode",e=>()=>e.call(r),e=>t=>{if("max"===t)throw i1();return e.call(r,t)}),r}),vr=(iU=vi,iI=gm,iN=$E,()=>{let e=new WeakMap,t=async(t,r)=>{let n=iI(t);if(!mW(n,r)){let a={buffer:n.buffer,channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,disableNormalization:!n.normalize};n=iU(r,a)}return e.set(r,n),gl(n)?await iN(t,r,n.inputs[0]):await iN(t,r,n),n};return{render(r,n){let a=e.get(n);return void 0!==a?Promise.resolve(a):t(r,n)}}}),vn=(iO=$1,iF=vr,iB=vi,iz=$_,i2=$M,ik=$5,class extends iO{constructor(e,t){let r=iz(e),n={buffer:null,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",disableNormalization:!1,...t},a=iB(r,n),o=i2(r)?iF():null;super(e,!1,a,o),this._isBufferNullified=!1,this._nativeConvolverNode=a,null!==n.buffer&&ik(this,n.buffer.duration)}get buffer(){return this._isBufferNullified?null:this._nativeConvolverNode.buffer}set buffer(e){if(this._nativeConvolverNode.buffer=e,null===e&&null!==this._nativeConvolverNode.buffer){let t=this._nativeConvolverNode.context;this._nativeConvolverNode.buffer=t.createBuffer(1,1,t.sampleRate),this._isBufferNullified=!0,ik(this,0)}else this._isBufferNullified=!1,ik(this,null===this._nativeConvolverNode.buffer?0:this._nativeConvolverNode.buffer.duration)}get normalize(){return this._nativeConvolverNode.normalize}set normalize(e){this._nativeConvolverNode.normalize=e}}),va=(iH=$k,iV=g5,i3=gm,iG=$V,i4=$E,e=>{let t=new WeakMap,r=async(r,n)=>{let a=i3(r),o=mW(a,n);if(!o){let s={channelCount:a.channelCount,channelCountMode:a.channelCountMode,channelInterpretation:a.channelInterpretation,delayTime:a.delayTime.value,maxDelayTime:e};a=iV(n,s)}return t.set(n,a),o?await iH(n,r.delayTime,a.delayTime):await iG(n,r.delayTime,a.delayTime),await i4(r,n,a),a};return{render(e,n){let a=t.get(n);return void 0!==a?Promise.resolve(a):r(e,n)}}}),vo=(iW=$1,i6=$G,i5=va,i7=g5,iX=$_,class extends iW{constructor(e,t){let r=iX(e),n={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",delayTime:0,maxDelayTime:1,...t},a=i7(r,n),o=(iq=$M)(r),s=o?i5(n.maxDelayTime):null;super(e,!1,a,s),this._delayTime=i6(this,o,a.delayTime),$5(this,n.maxDelayTime)}get delayTime(){return this._delayTime}}),vs=(ij=gQ,(e,t)=>{let r=e.createDynamicsCompressor();if(gF(r,t),t.channelCount>2||"max"===t.channelCountMode)throw ij();return g2(r,t,"attack"),g2(r,t,"knee"),g2(r,t,"ratio"),g2(r,t,"release"),g2(r,t,"threshold"),r}),vl=(iZ=$k,iK=vs,iJ=gm,iQ=$V,i9=$E,()=>{let e=new WeakMap,t=async(t,r)=>{let n=iJ(t),a=mW(n,r);if(!a){let o={attack:n.attack.value,channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,knee:n.knee.value,ratio:n.ratio.value,release:n.release.value,threshold:n.threshold.value};n=iK(r,o)}return e.set(r,n),a?(await iZ(r,t.attack,n.attack),await iZ(r,t.knee,n.knee),await iZ(r,t.ratio,n.ratio),await iZ(r,t.release,n.release),await iZ(r,t.threshold,n.threshold)):(await iQ(r,t.attack,n.attack),await iQ(r,t.knee,n.knee),await iQ(r,t.ratio,n.ratio),await iQ(r,t.release,n.release),await iQ(r,t.threshold,n.threshold)),await i9(t,r,n),n};return{render(r,n){let a=e.get(n);return void 0!==a?Promise.resolve(a):t(r,n)}}}),vu=(re=$1,rt=$G,ri=vl,rr=vs,rn=gQ,ra=$_,class extends re{constructor(e,t){let r=ra(e),n={attack:.003,channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",knee:30,ratio:12,release:.25,threshold:-24,...t},a=rr(r,n),o=(ro=$M)(r),s=o?ri():null;super(e,!1,a,s),this._attack=rt(this,o,a.attack),this._knee=rt(this,o,a.knee),this._nativeDynamicsCompressorNode=a,this._ratio=rt(this,o,a.ratio),this._release=rt(this,o,a.release),this._threshold=rt(this,o,a.threshold),$5(this,.006)}get attack(){return this._attack}get channelCount(){return this._nativeDynamicsCompressorNode.channelCount}set channelCount(e){let t=this._nativeDynamicsCompressorNode.channelCount;if(this._nativeDynamicsCompressorNode.channelCount=e,e>2)throw this._nativeDynamicsCompressorNode.channelCount=t,rn()}get channelCountMode(){return this._nativeDynamicsCompressorNode.channelCountMode}set channelCountMode(e){let t=this._nativeDynamicsCompressorNode.channelCountMode;if(this._nativeDynamicsCompressorNode.channelCountMode=e,"max"===e)throw this._nativeDynamicsCompressorNode.channelCountMode=t,rn()}get knee(){return this._knee}get ratio(){return this._ratio}get reduction(){return"number"==typeof this._nativeDynamicsCompressorNode.reduction.value?this._nativeDynamicsCompressorNode.reduction.value:this._nativeDynamicsCompressorNode.reduction}get release(){return this._release}get threshold(){return this._threshold}}),vc=(rl=$k,ru=g7,rc=gm,rh=$V,rd=$E,()=>{let e=new WeakMap,t=async(t,r)=>{let n=rc(t),a=mW(n,r);if(!a){let o={channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,gain:n.gain.value};n=ru(r,o)}return e.set(r,n),a?await rl(r,t.gain,n.gain):await rh(r,t.gain,n.gain),await rd(t,r,n),n};return{render(r,n){let a=e.get(n);return void 0!==a?Promise.resolve(a):t(r,n)}}}),vh=(rp=$1,rf=$G,rm=vc,rg=g7,class extends rp{constructor(e,t){let r=(r8=$_)(e),n={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",gain:1,...t},a=rg(r,n),o=$M(r),s=o?rm():null;super(e,!1,a,s),this._gain=rf(this,o,a.gain,34028234663852886e22,-34028234663852886e22)}get gain(){return this._gain}}),vd=(rv=gD,rx=g1,ry=gJ,rS=gQ,(e,t,{channelCount:r,channelCountMode:n,channelInterpretation:a,feedback:o,feedforward:s})=>{let c=g3(t,e.sampleRate),h=o instanceof Float64Array?o:new Float64Array(o),d=s instanceof Float64Array?s:new Float64Array(s),p=h.length,f=d.length,m=Math.min(p,f);if(0===p||p>20)throw rS();if(0===h[0])throw rx();if(0===f||f>20)throw rS();if(0===d[0])throw rx();if(1!==h[0]){for(let $=0;$<f;$+=1)d[$]/=h[0];for(let x=1;x<p;x+=1)h[x]/=h[0]}let y=ry(e,c,r,r);y.channelCount=r,y.channelCountMode=n,y.channelInterpretation=a;let S=[],E=[],_=[];for(let T=0;T<r;T+=1){S.push(0);let M=new Float32Array(32),A=new Float32Array(32);M.fill(0),A.fill(0),E.push(M),_.push(A)}y.onaudioprocess=e=>{let t=e.inputBuffer,r=e.outputBuffer,n=t.numberOfChannels;for(let a=0;a<n;a+=1){let o=t.getChannelData(a),s=r.getChannelData(a);S[a]=gU(h,p,d,f,m,E[a],_[a],S[a],32,o,s)}};let C=e.sampleRate/2;return g6({get bufferSize(){return c},get channelCount(){return y.channelCount},set channelCount(w){y.channelCount=w},get channelCountMode(){return y.channelCountMode},set channelCountMode(w){y.channelCountMode=w},get channelInterpretation(){return y.channelInterpretation},set channelInterpretation(w){y.channelInterpretation=w},get context(){return y.context},get inputs(){return[y]},get numberOfInputs(){return y.numberOfInputs},get numberOfOutputs(){return y.numberOfOutputs},addEventListener:(...e)=>y.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>y.dispatchEvent(e[0]),getFrequencyResponse(e,t,r){if(e.length!==t.length||t.length!==r.length)throw rv();let n=e.length;for(let a=0;a<n;a+=1){let o=-Math.PI*(e[a]/C),s=[Math.cos(o),Math.sin(o)],c=gY(d,s),p=gY(h,s),f=gX(c,p);t[a]=Math.sqrt(f[0]*f[0]+f[1]*f[1]),r[a]=Math.atan2(f[1],f[0])}},removeEventListener:(...e)=>y.removeEventListener(e[0],e[1],e[2])},y)}),vp=(r_=$v,rT=g7,rM=gJ,rw=(rE=g7,rb=$T,()=>{if(null===rb)return Promise.resolve(!1);let e=new rb(1,1,44100),t=rE(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});return new Promise(r=>{e.oncomplete=()=>{t.disconnect(),r(0!==e.currentTime)},e.startRendering()})}),e=>r_(gN,()=>gN(e))?Promise.resolve(r_(rw,rw)).then(t=>{if(!t){let r=rM(e,512,0,1);e.oncomplete=()=>{r.onaudioprocess=null,r.disconnect()},r.onaudioprocess=()=>e.currentTime,r.connect(e.destination)}return e.startRendering()}):new Promise(t=>{let r=rT(e,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:0});e.oncomplete=e=>{r.disconnect(),t(e.renderedBuffer)},r.connect(e.destination),e.startRendering()})),vf=(rA=$H,rC=gm,rR=$T,r0=$E,rP=vp,(e,t)=>{let r=new WeakMap,n=null,a=async(a,o)=>{let s=null,c=rC(a),h=mW(c,o);if(void 0===o.createIIRFilter?s=rA(o,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}):h||(c=o.createIIRFilter(t,e)),r.set(o,null===s?c:s),null!==s){if(null===n){if(null===rR)throw Error("Missing the native OfflineAudioContext constructor.");let d=new rR(a.context.destination.channelCount,a.context.length,o.sampleRate);n=(async()=>{await r0(a,d,d.destination);let r=await rP(d);return gI(r,o,e,t)})()}let p=await n;return s.buffer=p,s.start(0),s}return await r0(a,o,c),c};return{render(e,t){let n=r.get(t);return void 0!==n?Promise.resolve(n):a(e,t)}}}),vm=(rL=vd,(e,t,r)=>{if(void 0===e.createIIRFilter)return rL(e,t,r);let n=e.createIIRFilter(r.feedforward,r.feedback);return gF(n,r),n}),vg=(r1=$1,rD=vm,rU=vf,rI=$_,class extends r1{constructor(e,t){var r,n;let a=rI(e),o=(rN=$M)(a),s={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",...t},c=rD(a,o?null:e.baseLatency,s),h=o?rU(s.feedback,s.feedforward):null;super(e,!1,c,h),(r=c).getFrequencyResponse=(n=r.getFrequencyResponse,(e,t,a)=>{if(e.length!==t.length||t.length!==a.length)throw gD();return n.call(r,e,t,a)}),this._nativeIIRFilterNode=c,$5(this,1)}getFrequencyResponse(e,t,r){return this._nativeIIRFilterNode.getFrequencyResponse(e,t,r)}}),v8=(rF=$G,rB=$Y,rz=$9,r2=gJ,rk=gQ,rH=g9,rV=$M,r3=$t,(e,t)=>{let r=t.listener,{forwardX:n,forwardY:a,forwardZ:o,positionX:s,positionY:c,positionZ:h,upX:d,upY:p,upZ:f}=void 0===r.forwardX?(()=>{let n=new Float32Array(1),a=rB(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:9}),o=rV(t),s=!1,c=[0,0,-1,0,1,0],h=[0,0,0],d=()=>{if(s)return;s=!0;let e=r2(t,256,9,0);e.onaudioprocess=({inputBuffer:e})=>{let t=[rH(e,n,0),rH(e,n,1),rH(e,n,2),rH(e,n,3),rH(e,n,4),rH(e,n,5)];t.some((e,t)=>e!==c[t])&&(r.setOrientation(...t),c=t);let a=[rH(e,n,6),rH(e,n,7),rH(e,n,8)];a.some((e,t)=>e!==h[t])&&(r.setPosition(...a),h=a)},a.connect(e)},p=e=>t=>{t!==c[e]&&(c[e]=t,r.setOrientation(...c))},f=e=>t=>{t!==h[e]&&(h[e]=t,r.setPosition(...h))},m=(r,n,s)=>{var c,h,p,f,m,$,x;let y=rz(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:n});y.connect(a,0,r),y.start(),Object.defineProperty(y.offset,"defaultValue",{get:()=>n});let S=rF({context:e},o,y.offset,34028234663852886e22,-34028234663852886e22);return r3(S,"value",e=>()=>e.call(S),e=>t=>{try{e.call(S,t)}catch(r){if(9!==r.code)throw r}d(),o&&s(t)}),S.cancelAndHoldAtTime=(c=S.cancelAndHoldAtTime,o?()=>{throw rk()}:(...e)=>{let t=c.apply(S,e);return d(),t}),S.cancelScheduledValues=(h=S.cancelScheduledValues,o?()=>{throw rk()}:(...e)=>{let t=h.apply(S,e);return d(),t}),S.exponentialRampToValueAtTime=(p=S.exponentialRampToValueAtTime,o?()=>{throw rk()}:(...e)=>{let t=p.apply(S,e);return d(),t}),S.linearRampToValueAtTime=(f=S.linearRampToValueAtTime,o?()=>{throw rk()}:(...e)=>{let t=f.apply(S,e);return d(),t}),S.setTargetAtTime=(m=S.setTargetAtTime,o?()=>{throw rk()}:(...e)=>{let t=m.apply(S,e);return d(),t}),S.setValueAtTime=($=S.setValueAtTime,o?()=>{throw rk()}:(...e)=>{let t=$.apply(S,e);return d(),t}),S.setValueCurveAtTime=(x=S.setValueCurveAtTime,o?()=>{throw rk()}:(...e)=>{let t=x.apply(S,e);return d(),t}),S};return{forwardX:m(0,0,p(0)),forwardY:m(1,0,p(1)),forwardZ:m(2,-1,p(2)),positionX:m(6,0,f(0)),positionY:m(7,0,f(1)),positionZ:m(8,0,f(2)),upX:m(3,0,p(3)),upY:m(4,1,p(4)),upZ:m(5,0,p(5))}})():r;return{get forwardX(){return n},get forwardY(){return a},get forwardZ(){return o},get positionX(){return s},get positionY(){return c},get positionZ(){return h},get upX(){return d},get upY(){return p},get upZ(){return f}}}),v$=new WeakMap,vv=(rG=$W,r4=v8,rW=$A,r6=$M,class extends rW{constructor(e,t){super(e),this._nativeContext=e,mP.set(this,e),r6(e)&&(r5=v$).set(e,new Set),this._destination=new rG(this,t),this._listener=r4(this,e),this._onstatechange=null}get currentTime(){return this._nativeContext.currentTime}get destination(){return this._destination}get listener(){return this._listener}get onstatechange(){return this._onstatechange}set onstatechange(e){let t="function"==typeof e?(r7=$p)(this,e):null;this._nativeContext.onstatechange=t;let r=this._nativeContext.onstatechange;this._onstatechange=null!==r&&r===t?e:r}get sampleRate(){return this._nativeContext.sampleRate}get state(){return this._nativeContext.state}}),vx=(rX=$z,rq=$v,rY=$l,rj=$u,rZ=$c,rK=$d,(e,t)=>{let r=e.createOscillator();return gF(r,t),g2(r,t,"detune"),g2(r,t,"frequency"),void 0!==t.periodicWave?r.setPeriodicWave(t.periodicWave):gO(r,t,"type"),rq(rY,()=>rY(e))||gH(r),rq(rj,()=>rj(e))||rK(r,e),rq(rZ,()=>rZ(e))||gV(r),rX(e,r),r}),vy=(rJ=$k,rQ=vx,r9=gm,ne=$V,nt=$E,()=>{let e=new WeakMap,t=null,r=null,n=null,a=async(a,o)=>{let s=r9(a),c=mW(s,o);if(!c){let h={channelCount:s.channelCount,channelCountMode:s.channelCountMode,channelInterpretation:s.channelInterpretation,detune:s.detune.value,frequency:s.frequency.value,periodicWave:null===t?void 0:t,type:s.type};s=rQ(o,h),null!==r&&s.start(r),null!==n&&s.stop(n)}return e.set(o,s),c?(await rJ(o,a.detune,s.detune),await rJ(o,a.frequency,s.frequency)):(await ne(o,a.detune,s.detune),await ne(o,a.frequency,s.frequency)),await nt(a,o,s),s};return{set periodicWave(u){t=u},set start(u){r=u},set stop(u){n=u},render(t,r){let n=e.get(r);return void 0!==n?Promise.resolve(n):a(t,r)}}}),vS=(ni=$1,nr=$G,nn=vx,na=vy,no=$_,class extends ni{constructor(e,t){let r=no(e),n={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",detune:0,frequency:440,periodicWave:void 0,type:"sine",...t},a=nn(r,n),o=(ns=$M)(r),s=o?na():null,c=e.sampleRate/2;super(e,!1,a,s),this._detune=nr(this,o,a.detune,153600,-153600),this._frequency=nr(this,o,a.frequency,c,-c),this._nativeOscillatorNode=a,this._onended=null,this._oscillatorNodeRenderer=s,null!==this._oscillatorNodeRenderer&&void 0!==n.periodicWave&&(this._oscillatorNodeRenderer.periodicWave=n.periodicWave)}get detune(){return this._detune}get frequency(){return this._frequency}get onended(){return this._onended}set onended(e){let t="function"==typeof e?(nl=$p)(this,e):null;this._nativeOscillatorNode.onended=t;let r=this._nativeOscillatorNode.onended;this._onended=null!==r&&r===t?e:r}get type(){return this._nativeOscillatorNode.type}set type(e){this._nativeOscillatorNode.type=e,null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=null)}setPeriodicWave(e){this._nativeOscillatorNode.setPeriodicWave(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.periodicWave=e)}start(e=0){if(this._nativeOscillatorNode.start(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.start=e),"closed"!==this.context.state){mV(this);let t=()=>{this._nativeOscillatorNode.removeEventListener("ended",t),mX(this)&&mG(this)};this._nativeOscillatorNode.addEventListener("ended",t)}}stop(e=0){this._nativeOscillatorNode.stop(e),null!==this._oscillatorNodeRenderer&&(this._oscillatorNodeRenderer.stop=e)}}),vE=(nu=$H,(e,t)=>{let r=nu(e,{buffer:null,channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",loop:!1,loopEnd:0,loopStart:0,playbackRate:1}),n=e.createBuffer(1,2,44100);return r.buffer=n,r.loop=!0,r.connect(t),r.start(),()=>{r.stop(),r.disconnect(t)}}),vb=(nc=vE,nh=g1,nd=g7,np=$e,nf=$X,(e,{curve:t,oversample:r,...n})=>{let a=e.createWaveShaper(),o=e.createWaveShaper();gF(a,n),gF(o,n);let s=nd(e,{...n,gain:1}),c=nd(e,{...n,gain:-1}),h=nd(e,{...n,gain:1}),d=nd(e,{...n,gain:-1}),p=null,f=!1,m=null,$={get bufferSize(){},get channelCount(){return a.channelCount},set channelCount(v){s.channelCount=v,c.channelCount=v,a.channelCount=v,h.channelCount=v,o.channelCount=v,d.channelCount=v},get channelCountMode(){return a.channelCountMode},set channelCountMode(v){s.channelCountMode=v,c.channelCountMode=v,a.channelCountMode=v,h.channelCountMode=v,o.channelCountMode=v,d.channelCountMode=v},get channelInterpretation(){return a.channelInterpretation},set channelInterpretation(v){s.channelInterpretation=v,c.channelInterpretation=v,a.channelInterpretation=v,h.channelInterpretation=v,o.channelInterpretation=v,d.channelInterpretation=v},get context(){return a.context},get curve(){return m},set curve(v){if(null!==v&&v.length<2)throw nh();if(null===v)a.curve=v,o.curve=v;else{let x=v.length,y=new Float32Array(x+2-x%2),S=new Float32Array(x+2-x%2);y[0]=v[0],S[0]=-v[x-1];let E=Math.ceil((x+1)/2),_=(x+1)/2-1;for(let T=1;T<E;T+=1){let M=T/E*_,A=Math.floor(M),C=Math.ceil(M);y[T]=A===C?v[A]:(1-(M-A))*v[A]+(1-(C-M))*v[C],S[T]=A===C?-v[x-1-A]:-((1-(M-A))*v[x-1-A])-(1-(C-M))*v[x-1-C]}y[E]=x%2==1?v[E-1]:(v[E-2]+v[E-1])/2,a.curve=y,o.curve=S}m=v,f&&(np(m)&&null===p?p=nc(e,s):null!==p&&(p(),p=null))},get inputs(){return[s]},get numberOfInputs(){return a.numberOfInputs},get numberOfOutputs(){return a.numberOfOutputs},get oversample(){return a.oversample},set oversample(v){a.oversample=v,o.oversample=v},addEventListener:(...e)=>s.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>s.dispatchEvent(e[0]),removeEventListener:(...e)=>s.removeEventListener(e[0],e[1],e[2])};null!==t&&($.curve=t instanceof Float32Array?t:new Float32Array(t)),r!==$.oversample&&($.oversample=r);let R=()=>{s.connect(a).connect(h),s.connect(c).connect(o).connect(d).connect(h),f=!0,np(m)&&(p=nc(e,s))},P=()=>{s.disconnect(a),a.disconnect(h),s.disconnect(c),c.disconnect(o),o.disconnect(d),d.disconnect(h),f=!1,null!==p&&(p(),p=null)};return nf(g6($,h),R,P)}),v_=(nm=vE,ng=g1,n8=vb,n$=$e,nv=$X,nx=$C,ny=$t,(e,t)=>{let r=e.createWaveShaper();if(null!==nx&&"webkitAudioContext"===nx.name&&void 0===e.createGain().gain.automationRate)return n8(e,t);gF(r,t);let n=null===t.curve||t.curve instanceof Float32Array?t.curve:new Float32Array(t.curve);if(null!==n&&n.length<2)throw ng();gO(r,{curve:n},"curve"),gO(r,t,"oversample");let a=null,o=!1;return ny(r,"curve",e=>()=>e.call(r),t=>n=>(t.call(r,n),o&&(n$(n)&&null===a?a=nm(e,r):n$(n)||null===a||(a(),a=null)),n)),nv(r,()=>{o=!0,n$(r.curve)&&(a=nm(e,r))},()=>{o=!1,null!==a&&(a(),a=null)})}),vT=(nS=gu,nE=g1,nb=$Y,n_=g7,nT=gJ,nM=v_,nw=gQ,nA=gf,nC=g9,nR=$X,(e,{coneInnerAngle:t,coneOuterAngle:r,coneOuterGain:n,distanceModel:a,maxDistance:o,orientationX:s,orientationY:c,orientationZ:h,panningModel:d,positionX:p,positionY:f,positionZ:m,refDistance:$,rolloffFactor:x,...y})=>{let S=e.createPanner();if(y.channelCount>2||"max"===y.channelCountMode)throw nw();gF(S,y);let E={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},_=nb(e,{...E,channelInterpretation:"speakers",numberOfInputs:6}),T=n_(e,{...y,gain:1}),M=n_(e,{...E,gain:1}),A=n_(e,{...E,gain:0}),C=n_(e,{...E,gain:0}),R=n_(e,{...E,gain:0}),P=n_(e,{...E,gain:0}),D=n_(e,{...E,gain:0}),U=nT(e,256,6,1),I=nM(e,{...E,curve:new Float32Array([1,1]),oversample:"none"}),N=[s,c,h],O=[p,f,m],F=new Float32Array(1);U.onaudioprocess=({inputBuffer:e})=>{let t=[nC(e,F,0),nC(e,F,1),nC(e,F,2)];t.some((e,t)=>e!==N[t])&&(S.setOrientation(...t),N=t);let r=[nC(e,F,3),nC(e,F,4),nC(e,F,5)];r.some((e,t)=>e!==O[t])&&(S.setPosition(...r),O=r)},Object.defineProperty(A.gain,"defaultValue",{get:()=>0}),Object.defineProperty(C.gain,"defaultValue",{get:()=>0}),Object.defineProperty(R.gain,"defaultValue",{get:()=>0}),Object.defineProperty(P.gain,"defaultValue",{get:()=>0}),Object.defineProperty(D.gain,"defaultValue",{get:()=>0});let B={get bufferSize(){},get channelCount(){return S.channelCount},set channelCount(ee){if(ee>2)throw nw();T.channelCount=ee,S.channelCount=ee},get channelCountMode(){return S.channelCountMode},set channelCountMode(ee){if("max"===ee)throw nw();T.channelCountMode=ee,S.channelCountMode=ee},get channelInterpretation(){return S.channelInterpretation},set channelInterpretation(ee){T.channelInterpretation=ee,S.channelInterpretation=ee},get coneInnerAngle(){return S.coneInnerAngle},set coneInnerAngle(ee){S.coneInnerAngle=ee},get coneOuterAngle(){return S.coneOuterAngle},set coneOuterAngle(ee){S.coneOuterAngle=ee},get coneOuterGain(){return S.coneOuterGain},set coneOuterGain(ee){if(ee<0||ee>1)throw nE();S.coneOuterGain=ee},get context(){return S.context},get distanceModel(){return S.distanceModel},set distanceModel(ee){S.distanceModel=ee},get inputs(){return[T]},get maxDistance(){return S.maxDistance},set maxDistance(ee){if(ee<0)throw RangeError();S.maxDistance=ee},get numberOfInputs(){return S.numberOfInputs},get numberOfOutputs(){return S.numberOfOutputs},get orientationX(){return M.gain},get orientationY(){return A.gain},get orientationZ(){return C.gain},get panningModel(){return S.panningModel},set panningModel(ee){S.panningModel=ee},get positionX(){return R.gain},get positionY(){return P.gain},get positionZ(){return D.gain},get refDistance(){return S.refDistance},set refDistance(ee){if(ee<0)throw RangeError();S.refDistance=ee},get rolloffFactor(){return S.rolloffFactor},set rolloffFactor(ee){if(ee<0)throw RangeError();S.rolloffFactor=ee},addEventListener:(...e)=>T.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>T.dispatchEvent(e[0]),removeEventListener:(...e)=>T.removeEventListener(e[0],e[1],e[2])};t!==B.coneInnerAngle&&(B.coneInnerAngle=t),r!==B.coneOuterAngle&&(B.coneOuterAngle=r),n!==B.coneOuterGain&&(B.coneOuterGain=n),a!==B.distanceModel&&(B.distanceModel=a),o!==B.maxDistance&&(B.maxDistance=o),s!==B.orientationX.value&&(B.orientationX.value=s),c!==B.orientationY.value&&(B.orientationY.value=c),h!==B.orientationZ.value&&(B.orientationZ.value=h),d!==B.panningModel&&(B.panningModel=d),p!==B.positionX.value&&(B.positionX.value=p),f!==B.positionY.value&&(B.positionY.value=f),m!==B.positionZ.value&&(B.positionZ.value=m),$!==B.refDistance&&(B.refDistance=$),x!==B.rolloffFactor&&(B.rolloffFactor=x),(1!==N[0]||0!==N[1]||0!==N[2])&&S.setOrientation(...N),(0!==O[0]||0!==O[1]||0!==O[2])&&S.setPosition(...O);let z=()=>{T.connect(S),nS(T,I,0,0),I.connect(M).connect(_,0,0),I.connect(A).connect(_,0,1),I.connect(C).connect(_,0,2),I.connect(R).connect(_,0,3),I.connect(P).connect(_,0,4),I.connect(D).connect(_,0,5),_.connect(U).connect(e.destination)},k=()=>{T.disconnect(S),nA(T,I,0,0),I.disconnect(M),M.disconnect(_),I.disconnect(A),A.disconnect(_),I.disconnect(C),C.disconnect(_),I.disconnect(R),R.disconnect(_),I.disconnect(P),P.disconnect(_),I.disconnect(D),D.disconnect(_),_.disconnect(U),U.disconnect(e.destination)};return nR(g6(B,S),z,k)}),vM=(n0=vT,(e,t)=>{let r=e.createPanner();return void 0===r.orientationX?n0(e,t):(gF(r,t),g2(r,t,"orientationX"),g2(r,t,"orientationY"),g2(r,t,"orientationZ"),g2(r,t,"positionX"),g2(r,t,"positionY"),g2(r,t,"positionZ"),gO(r,t,"coneInnerAngle"),gO(r,t,"coneOuterAngle"),gO(r,t,"coneOuterGain"),gO(r,t,"distanceModel"),gO(r,t,"maxDistance"),gO(r,t,"panningModel"),gO(r,t,"refDistance"),gO(r,t,"rolloffFactor"),r)}),vw=(nP=$k,nL=$Y,n1=$9,nD=g7,nU=vM,nI=gm,nN=$T,nO=$V,nF=$E,nB=vp,()=>{let e=new WeakMap,t=null,r=async(r,n)=>{let a=null,o=nI(r),s={channelCount:o.channelCount,channelCountMode:o.channelCountMode,channelInterpretation:o.channelInterpretation},c={...s,coneInnerAngle:o.coneInnerAngle,coneOuterAngle:o.coneOuterAngle,coneOuterGain:o.coneOuterGain,distanceModel:o.distanceModel,maxDistance:o.maxDistance,panningModel:o.panningModel,refDistance:o.refDistance,rolloffFactor:o.rolloffFactor},h=mW(o,n);if("bufferSize"in o)a=nD(n,{...s,gain:1});else if(!h){let d={...c,orientationX:o.orientationX.value,orientationY:o.orientationY.value,orientationZ:o.orientationZ.value,positionX:o.positionX.value,positionY:o.positionY.value,positionZ:o.positionZ.value};o=nU(n,d)}if(e.set(n,null===a?o:a),null!==a){if(null===t){if(null===nN)throw Error("Missing the native OfflineAudioContext constructor.");let p=new nN(6,r.context.length,n.sampleRate),f=nL(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"speakers",numberOfInputs:6});f.connect(p.destination),t=(async()=>{let e=await Promise.all([r.orientationX,r.orientationY,r.orientationZ,r.positionX,r.positionY,r.positionZ].map(async(e,t)=>{let r=n1(p,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",offset:0===t?1:0});return await nO(p,e,r.offset),r}));for(let t=0;t<6;t+=1)e[t].connect(f,0,t),e[t].start(0);return nB(p)})()}let m=await t,$=nD(n,{...s,gain:1});await nF(r,n,$);let x=[];for(let y=0;y<m.numberOfChannels;y+=1)x.push(m.getChannelData(y));let S=[x[0][0],x[1][0],x[2][0]],E=[x[3][0],x[4][0],x[5][0]],_=nD(n,{...s,gain:1}),T=nU(n,{...c,orientationX:S[0],orientationY:S[1],orientationZ:S[2],positionX:E[0],positionY:E[1],positionZ:E[2]});$.connect(_).connect(T.inputs[0]),T.connect(a);for(let M=128;M<m.length;M+=128){let A=[x[0][M],x[1][M],x[2][M]],C=[x[3][M],x[4][M],x[5][M]];if(A.some((e,t)=>e!==S[t])||C.some((e,t)=>e!==E[t])){S=A,E=C;let R=M/n.sampleRate;_.gain.setValueAtTime(0,R),_=nD(n,{...s,gain:0}),T=nU(n,{...c,orientationX:S[0],orientationY:S[1],orientationZ:S[2],positionX:E[0],positionY:E[1],positionZ:E[2]}),_.gain.setValueAtTime(1,R),$.connect(_).connect(T.inputs[0]),T.connect(a)}}return a}return h?(await nP(n,r.orientationX,o.orientationX),await nP(n,r.orientationY,o.orientationY),await nP(n,r.orientationZ,o.orientationZ),await nP(n,r.positionX,o.positionX),await nP(n,r.positionY,o.positionY),await nP(n,r.positionZ,o.positionZ)):(await nO(n,r.orientationX,o.orientationX),await nO(n,r.orientationY,o.orientationY),await nO(n,r.orientationZ,o.orientationZ),await nO(n,r.positionX,o.positionX),await nO(n,r.positionY,o.positionY),await nO(n,r.positionZ,o.positionZ)),gl(o)?await nF(r,n,o.inputs[0]):await nF(r,n,o),o};return{render(t,n){let a=e.get(n);return void 0!==a?Promise.resolve(a):r(t,n)}}}),vA=(nz=$1,n2=$G,nk=vM,nH=vw,nV=$_,class extends nz{constructor(e,t){let r=nV(e),n={channelCount:2,channelCountMode:"clamped-max",channelInterpretation:"speakers",coneInnerAngle:360,coneOuterAngle:360,coneOuterGain:0,distanceModel:"inverse",maxDistance:1e4,orientationX:1,orientationY:0,orientationZ:0,panningModel:"equalpower",positionX:0,positionY:0,positionZ:0,refDistance:1,rolloffFactor:1,...t},a=nk(r,n),o=(n3=$M)(r),s=o?nH():null;super(e,!1,a,s),this._nativePannerNode=a,this._orientationX=n2(this,o,a.orientationX,34028234663852886e22,-34028234663852886e22),this._orientationY=n2(this,o,a.orientationY,34028234663852886e22,-34028234663852886e22),this._orientationZ=n2(this,o,a.orientationZ,34028234663852886e22,-34028234663852886e22),this._positionX=n2(this,o,a.positionX,34028234663852886e22,-34028234663852886e22),this._positionY=n2(this,o,a.positionY,34028234663852886e22,-34028234663852886e22),this._positionZ=n2(this,o,a.positionZ,34028234663852886e22,-34028234663852886e22),$5(this,1)}get coneInnerAngle(){return this._nativePannerNode.coneInnerAngle}set coneInnerAngle(e){this._nativePannerNode.coneInnerAngle=e}get coneOuterAngle(){return this._nativePannerNode.coneOuterAngle}set coneOuterAngle(e){this._nativePannerNode.coneOuterAngle=e}get coneOuterGain(){return this._nativePannerNode.coneOuterGain}set coneOuterGain(e){this._nativePannerNode.coneOuterGain=e}get distanceModel(){return this._nativePannerNode.distanceModel}set distanceModel(e){this._nativePannerNode.distanceModel=e}get maxDistance(){return this._nativePannerNode.maxDistance}set maxDistance(e){this._nativePannerNode.maxDistance=e}get orientationX(){return this._orientationX}get orientationY(){return this._orientationY}get orientationZ(){return this._orientationZ}get panningModel(){return this._nativePannerNode.panningModel}set panningModel(e){this._nativePannerNode.panningModel=e}get positionX(){return this._positionX}get positionY(){return this._positionY}get positionZ(){return this._positionZ}get refDistance(){return this._nativePannerNode.refDistance}set refDistance(e){this._nativePannerNode.refDistance=e}get rolloffFactor(){return this._nativePannerNode.rolloffFactor}set rolloffFactor(e){this._nativePannerNode.rolloffFactor=e}}),vC=(n4=m5,(e,{disableNormalization:t,imag:r,real:n})=>{let a=r instanceof Float32Array?r:new Float32Array(r),o=n instanceof Float32Array?n:new Float32Array(n),s=e.createPeriodicWave(o,a,{disableNormalization:t});if(Array.from(r).length<2)throw n4();return s}),vR=(nW=vC,n6=$_,n5=new WeakSet,class e{constructor(e,t){let r=n6(e),n=$r({disableNormalization:!1,...t}),a=nW(r,n);return n5.add(a),a}static[Symbol.hasInstance](t){return null!==t&&"object"==typeof t&&Object.getPrototypeOf(t)===e.prototype||n5.has(t)}}),v0=((e,t,r,n,a,o)=>{let s=new Float32Array([1,1]),c=Math.PI/2,h={channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete"},d={...h,oversample:"none"},p=(e,t,a,o)=>{let p=new Float32Array(16385),f=new Float32Array(16385);for(let m=0;m<16385;m+=1){let $=m/16384*c;p[m]=Math.cos($),f[m]=Math.sin($)}let x=r(e,{...h,gain:0}),y=n(e,{...d,curve:p}),S=n(e,{...d,curve:s}),E=r(e,{...h,gain:0}),_=n(e,{...d,curve:f});return{connectGraph(){t.connect(x),t.connect(void 0===S.inputs?S:S.inputs[0]),t.connect(E),S.connect(a),a.connect(void 0===y.inputs?y:y.inputs[0]),a.connect(void 0===_.inputs?_:_.inputs[0]),y.connect(x.gain),_.connect(E.gain),x.connect(o,0,0),E.connect(o,0,1)},disconnectGraph(){t.disconnect(x),t.disconnect(void 0===S.inputs?S:S.inputs[0]),t.disconnect(E),S.disconnect(a),a.disconnect(void 0===y.inputs?y:y.inputs[0]),a.disconnect(void 0===_.inputs?_:_.inputs[0]),y.disconnect(x.gain),_.disconnect(E.gain),x.disconnect(o,0,0),E.disconnect(o,0,1)}}},f=(e,a,o,p)=>{let f=new Float32Array(16385),m=new Float32Array(16385),$=new Float32Array(16385),x=new Float32Array(16385),y=Math.floor(8192.5);for(let S=0;S<16385;S+=1)if(S>y){let E=(S-y)/(16384-y)*c;f[S]=Math.cos(E),m[S]=Math.sin(E),$[S]=0,x[S]=1}else{let _=S/(16384-y)*c;f[S]=1,m[S]=0,$[S]=Math.cos(_),x[S]=Math.sin(_)}let T=t(e,{channelCount:2,channelCountMode:"explicit",channelInterpretation:"discrete",numberOfOutputs:2}),M=r(e,{...h,gain:0}),A=n(e,{...d,curve:f}),C=r(e,{...h,gain:0}),R=n(e,{...d,curve:m}),P=n(e,{...d,curve:s}),D=r(e,{...h,gain:0}),U=n(e,{...d,curve:$}),I=r(e,{...h,gain:0}),N=n(e,{...d,curve:x});return{connectGraph(){a.connect(T),a.connect(void 0===P.inputs?P:P.inputs[0]),T.connect(M,0),T.connect(C,0),T.connect(D,1),T.connect(I,1),P.connect(o),o.connect(void 0===A.inputs?A:A.inputs[0]),o.connect(void 0===R.inputs?R:R.inputs[0]),o.connect(void 0===U.inputs?U:U.inputs[0]),o.connect(void 0===N.inputs?N:N.inputs[0]),A.connect(M.gain),R.connect(C.gain),U.connect(D.gain),N.connect(I.gain),M.connect(p,0,0),D.connect(p,0,0),C.connect(p,0,1),I.connect(p,0,1)},disconnectGraph(){a.disconnect(T),a.disconnect(void 0===P.inputs?P:P.inputs[0]),T.disconnect(M,0),T.disconnect(C,0),T.disconnect(D,1),T.disconnect(I,1),P.disconnect(o),o.disconnect(void 0===A.inputs?A:A.inputs[0]),o.disconnect(void 0===R.inputs?R:R.inputs[0]),o.disconnect(void 0===U.inputs?U:U.inputs[0]),o.disconnect(void 0===N.inputs?N:N.inputs[0]),A.disconnect(M.gain),R.disconnect(C.gain),U.disconnect(D.gain),N.disconnect(I.gain),M.disconnect(p,0,0),D.disconnect(p,0,0),C.disconnect(p,0,1),I.disconnect(p,0,1)}}},m=(e,t,r,n,o)=>{if(1===t)return p(e,r,n,o);if(2===t)return f(e,r,n,o);throw a()};return(t,{channelCount:n,channelCountMode:s,pan:c,...h})=>{if("max"===s)throw a();let d=e(t,{...h,channelCount:1,channelCountMode:s,numberOfInputs:2}),p=r(t,{...h,channelCount:n,channelCountMode:s,gain:1}),f=r(t,{channelCount:1,channelCountMode:"explicit",channelInterpretation:"discrete",gain:c}),{connectGraph:$,disconnectGraph:x}=m(t,n,p,f,d);Object.defineProperty(f.gain,"defaultValue",{get:()=>0}),Object.defineProperty(f.gain,"maxValue",{get:()=>1}),Object.defineProperty(f.gain,"minValue",{get:()=>-1});let y={get bufferSize(){},get channelCount(){return p.channelCount},set channelCount(L){p.channelCount!==L&&(S&&x(),{connectGraph:$,disconnectGraph:x}=m(t,L,p,f,d),S&&$()),p.channelCount=L},get channelCountMode(){return p.channelCountMode},set channelCountMode(L){if("clamped-max"===L||"max"===L)throw a();p.channelCountMode=L},get channelInterpretation(){return p.channelInterpretation},set channelInterpretation(L){p.channelInterpretation=L},get context(){return p.context},get inputs(){return[p]},get numberOfInputs(){return p.numberOfInputs},get numberOfOutputs(){return p.numberOfOutputs},get pan(){return f.gain},addEventListener:(...e)=>p.addEventListener(e[0],e[1],e[2]),dispatchEvent:(...e)=>p.dispatchEvent(e[0]),removeEventListener:(...e)=>p.removeEventListener(e[0],e[1],e[2])},S=!1,E=()=>{$(),S=!0},_=()=>{x(),S=!1};return o(g6(y,d),E,_)}})($Y,gW,g7,v_,gQ,$X),vP=(nX=v0,nq=gQ,(e,t)=>{let r=t.channelCountMode;if("clamped-max"===r)throw nq();if(void 0===e.createStereoPanner)return nX(e,t);let n=e.createStereoPanner();return gF(n,t),g2(n,t,"pan"),Object.defineProperty(n,"channelCountMode",{get:()=>r,set(e){if(e!==r)throw nq()}}),n}),vL=(nY=$k,nj=vP,nZ=gm,nK=$V,nJ=$E,()=>{let e=new WeakMap,t=async(t,r)=>{let n=nZ(t),a=mW(n,r);if(!a){let o={channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,pan:n.pan.value};n=nj(r,o)}return e.set(r,n),a?await nY(r,t.pan,n.pan):await nK(r,t.pan,n.pan),gl(n)?await nJ(t,r,n.inputs[0]):await nJ(t,r,n),n};return{render(r,n){let a=e.get(n);return void 0!==a?Promise.resolve(a):t(r,n)}}}),v1=(nQ=$1,n9=$G,ae=vP,at=vL,class extends nQ{constructor(e,t){let r=(ai=$_)(e),n={channelCount:2,channelCountMode:"explicit",channelInterpretation:"speakers",pan:0,...t},a=ae(r,n),o=$M(r),s=o?at():null;super(e,!1,a,s),this._pan=n9(this,o,a.pan)}get pan(){return this._pan}}),vD=(an=v_,aa=gm,ao=$E,()=>{let e=new WeakMap,t=async(t,r)=>{let n=aa(t);if(!mW(n,r)){let a={channelCount:n.channelCount,channelCountMode:n.channelCountMode,channelInterpretation:n.channelInterpretation,curve:n.curve,oversample:n.oversample};n=an(r,a)}return e.set(r,n),gl(n)?await ao(t,r,n.inputs[0]):await ao(t,r,n),n};return{render(r,n){let a=e.get(n);return void 0!==a?Promise.resolve(a):t(r,n)}}}),vU=(as=$1,al=g1,au=v_,ac=vD,ah=$_,class extends as{constructor(e,t){let r=ah(e),n={channelCount:2,channelCountMode:"max",channelInterpretation:"speakers",curve:null,oversample:"none",...t},a=au(r,n),o=(ad=$M)(r)?ac():null;super(e,!0,a,o),this._isCurveNullified=!1,this._nativeWaveShaperNode=a,$5(this,1)}get curve(){return this._isCurveNullified?null:this._nativeWaveShaperNode.curve}set curve(e){if(null===e)this._isCurveNullified=!0,this._nativeWaveShaperNode.curve=new Float32Array([0,0]);else{if(e.length<2)throw al();this._isCurveNullified=!1,this._nativeWaveShaperNode.curve=e}}get oversample(){return this._nativeWaveShaperNode.oversample}set oversample(e){this._nativeWaveShaperNode.oversample=e}}),vI=null!==(af=$x)&&af.isSecureContext,vN=(am=$x,(e,t,r)=>{Object.defineProperties(am,{currentFrame:{configurable:!0,get:()=>Math.round(e*t)},currentTime:{configurable:!0,get:()=>e}});try{return r()}finally{null!==am&&(delete am.currentFrame,delete am.currentTime)}}),vO=new WeakMap,vF=(ag=vO,a8=$T,e=>{let t=ag.get(e);if(void 0!==t)return t;if(null===a8)throw Error("Missing the native OfflineAudioContext constructor.");return t=new a8(1,1,44100),ag.set(e,t),t}),vB=vI?(aS=$v,aE=gQ,ab=(a$=$x,e=>new Promise((t,r)=>{if(null===a$){r(SyntaxError());return}let n=a$.document.head;if(null===n)r(SyntaxError());else{let a=a$.document.createElement("script"),o=new Blob([e],{type:"application/javascript"}),s=URL.createObjectURL(o),c=a$.onerror,h=()=>{a$.onerror=c,URL.revokeObjectURL(s)};a$.onerror=(e,t,n,a,o)=>t===s||t===a$.location.href&&1===n&&1===a?(h(),r(o),!1):null!==c?c(e,t,n,a,o):void 0,a.onerror=()=>{h(),r(SyntaxError())},a.onload=()=>{h(),t()},a.src=s,a.type="module",n.appendChild(a)}})),a_=vN,aT=(av=mM,async e=>{try{let t=await fetch(e);if(t.ok)return[await t.text(),t.url]}catch{}throw av()}),aM=$_,aw=vF,aA=$M,aC=$L,aR=new WeakMap,a0=new WeakMap,aP=(ax=$L,ay=$T,async()=>{if(null===ax)return!0;if(null===ay)return!1;let e=new Blob(['class A extends AudioWorkletProcessor{process(i){this.port.postMessage(i,[i[0][0].buffer])}}registerProcessor("a",A)'],{type:"application/javascript; charset=utf-8"}),t=new ay(1,128,44100),r=URL.createObjectURL(e),n=!1,a=!1;try{await t.audioWorklet.addModule(r);let o=new ax(t,"a",{numberOfOutputs:0}),s=t.createOscillator();o.port.onmessage=()=>n=!0,o.onprocessorerror=()=>a=!0,s.connect(o),s.start(0),await t.startRendering(),await new Promise(e=>setTimeout(e))}catch{}finally{URL.revokeObjectURL(r)}return n&&!a}),aL=$x,gZ=0,(e,t,r={credentials:"omit"})=>{let n=a0.get(e);if(void 0!==n&&n.has(t))return Promise.resolve();let a=aR.get(e);if(void 0!==a){let o=a.get(t);if(void 0!==o)return o}let s=aM(e),c=void 0===s.audioWorklet?aT(t).then(([e,t])=>{let[r,n]=mO(e,t),a=`${r};((a,b)=>{(a[b]=a[b]||[]).push((AudioWorkletProcessor,global,registerProcessor,sampleRate,self,window)=>{${n}
   })})(window,'_AWGS')`;return ab(a)}).then(()=>{let e=aL._AWGS.pop();if(void 0===e)throw SyntaxError();a_(s.currentTime,s.sampleRate,()=>e(class{},void 0,(e,t)=>{if(""===e.trim())throw aE();let r=mD.get(s);if(void 0!==r){if(r.has(e))throw aE();mB(t),mF(t.parameterDescriptors),r.set(e,t)}else mB(t),mF(t.parameterDescriptors),mD.set(s,new Map([[e,t]]))},s.sampleRate,void 0,void 0))}):Promise.all([aT(t),Promise.resolve(aS(aP,aP))]).then(([[e,t],n])=>{let a=gZ+1;gZ=a;let[o,c]=mO(e,t),h=`${o};((AudioWorkletProcessor,registerProcessor)=>{${c}
   })(${n?"AudioWorkletProcessor":"class extends AudioWorkletProcessor {__b=new WeakSet();constructor(){super();(p=>p.postMessage=(q=>(m,t)=>q.call(p,m,t?t.filter(u=>!this.__b.has(u)):t))(p.postMessage))(this.port)}}"},(n,p)=>registerProcessor(n,class extends p{${n?"":"__c = (a) => a.forEach(e=>this.__b.add(e.buffer));"}process(i,o,p){${n?"":"i.forEach(this.__c);o.forEach(this.__c);this.__c(Object.values(p));"}return super.process(i.map(j=>j.some(k=>k.length===0)?[]:j),o,p)}}));registerProcessor('__sac${a}',class extends AudioWorkletProcessor{process(){return !1}})`,d=new Blob([h],{type:"application/javascript; charset=utf-8"}),p=URL.createObjectURL(d);return s.audioWorklet.addModule(p,r).then(()=>{if(aA(s))return s;let e=aw(s);return e.audioWorklet.addModule(p,r).then(()=>e)}).then(e=>{if(null===aC)throw SyntaxError();try{new aC(e,`__sac${a}`)}catch{throw SyntaxError()}}).finally(()=>URL.revokeObjectURL(p))});return void 0===a?aR.set(e,new Map([[t,c]])):a.set(t,c),c.then(()=>{let r=a0.get(e);void 0===r?a0.set(e,new Set([t])):r.add(t)}).finally(()=>{let r=aR.get(e);void 0!==r&&r.delete(t)}),c}):void 0,vz=(a1=$R,aD=$M,e=>a1(e)||aD(e)),v2=(aU=$U,aI=$v,aN=gR,aO=gL,aF=new WeakSet,aB=$_,az=vz,a2=m6,ak=gN,aH=$O,aV=$F,(e,t)=>{let r=az(e)?e:aB(e);if(aF.has(t)){let n=aN();return Promise.reject(n)}try{aF.add(t)}catch{}return aI(ak,()=>ak(r))?r.decodeAudioData(t).then(e=>(g0(t).catch(()=>{}),aI(a2,()=>a2(e))||aV(e),aU.add(e),e)):new Promise((e,n)=>{let a=async()=>{try{await g0(t)}catch{}},o=e=>{n(e),a()};try{r.decodeAudioData(t,t=>{"function"!=typeof t.copyFromChannel&&(aH(t),m7(t)),aU.add(t),a().then(()=>e(t))},e=>{o(null===e?aO():e)})}catch(s){o(s)}})}),vk=(a3=vB,aG=$D,a4=$B,aW=$4,a6=$7,a5=$Z,a7=$J,aX=vt,aq=vn,aY=v2,aj=vo,aZ=vu,aK=vh,aJ=vg,aQ=vv,a9=vS,oe=vA,ot=vR,class extends aQ{constructor(e,t){super(e,t),this._nativeContext=e,this._audioWorklet=void 0===a3?void 0:{addModule:(e,t)=>a3(this,e,t)}}get audioWorklet(){return this._audioWorklet}createAnalyser(){return new aG(this)}createBiquadFilter(){return new a6(this)}createBuffer(e,t,r){return new a4({length:t,numberOfChannels:e,sampleRate:r})}createBufferSource(){return new aW(this)}createChannelMerger(e=6){return new a5(this,{numberOfInputs:e})}createChannelSplitter(e=6){return new a7(this,{numberOfOutputs:e})}createConstantSource(){return new aX(this)}createConvolver(){return new aq(this)}createDelay(e=1){return new aj(this,{maxDelayTime:e})}createDynamicsCompressor(){return new aZ(this)}createGain(){return new aK(this)}createIIRFilter(e,t){return new aJ(this,{feedback:t,feedforward:e})}createOscillator(){return new a9(this)}createPanner(){return new oe(this)}createPeriodicWave(e,t,r={disableNormalization:!1}){return new ot(this,{...r,imag:t,real:e})}createStereoPanner(){return new(oi=v1)(this)}createWaveShaper(){return new(or=vU)(this)}decodeAudioData(e,t,r){return aY(this._nativeContext,e).then(e=>("function"==typeof t&&t(e),e),e=>{throw"function"==typeof r&&r(e),e})}}),vH=(on=v$,e=>{let t=on.get(e);if(void 0===t)throw Error("The context has no set of AudioWorkletNodes.");return t}),vV=(oa=gQ,oo=$T,(e,t,r)=>{if(null===oo)throw Error("Missing the native OfflineAudioContext constructor.");try{return new oo(e,t,r)}catch(n){throw"SyntaxError"===n.name?oa():n}}),v3=(os=$U,ol=$v,ou=$S,oc=vH,oh=vp,od=m6,op=$O,of=$F,(e,t)=>ou(e).render(e,t).then(()=>Promise.all(Array.from(oc(t)).map(e=>ou(e).render(e,t)))).then(()=>oh(t)).then(e=>("function"!=typeof e.copyFromChannel?(op(e),m7(e)):ol(od,()=>od(e))||of(e),os.add(e),e))),vG=(om=vk,og=$v,o8=g1,class extends om{constructor(e,t,r){let n;if("number"==typeof e&&void 0!==t&&void 0!==r)n={length:t,numberOfChannels:e,sampleRate:r};else if("object"==typeof e)n=e;else throw Error("The given parameters are not valid.");let{length:a,numberOfChannels:o,sampleRate:s}={numberOfChannels:1,...n},c=(o$=vV)(o,a,s);og(gN,()=>gN(c))||c.addEventListener("statechange",(()=>{let e=0,t=r=>{"running"===this._state&&(e>0?(c.removeEventListener("statechange",t),r.stopImmediatePropagation(),this._waitForThePromiseToSettle(r)):e+=1)};return t})()),super(c,o),this._length=a,this._nativeOfflineAudioContext=c,this._state=null}get length(){return void 0===this._nativeOfflineAudioContext.length?this._length:this._nativeOfflineAudioContext.length}get state(){return null===this._state?this._nativeOfflineAudioContext.state:this._state}startRendering(){return"running"===this._state?Promise.reject(o8()):(this._state="running",(ov=v3)(this.destination,this._nativeOfflineAudioContext).finally(()=>{this._state=null,gt(this)}))}_waitForThePromiseToSettle(e){null===this._state?this._nativeOfflineAudioContext.dispatchEvent(e):setTimeout(()=>this._waitForThePromiseToSettle(e))}}),v4=(e,t,r)=>{let n=new vG(e.numberOfChannels,Math.round(r*e.sampleRate),e.sampleRate),a=n.createBiquadFilter(),o=n.createBufferSource();return a.frequency.value=240,a.type="lowpass",o.buffer=e,o.connect(a).connect(n.destination),o.start(0,t,r),n.startRendering().then(e=>{let t=e.getChannelData(0),r=e.sampleRate;return{channelData:t,sampleRate:r}})},vW=e=>{let t=new Worker(e),r=new Set;return{analyze(...e){var n;let[a,o,s]=e,c="number"==typeof o?o:0,h="number"==typeof s?s:a.duration-c,d="object"==typeof o?o:"object"==typeof s?s:null!==(n=e[3])&&void 0!==n?n:null;return new Promise(async(e,n)=>{let{channelData:o,sampleRate:s}=await v4(a,c,h),p=me(r),f=({data:a})=>{a.id===p&&(r.delete(p),t.removeEventListener("message",f),null===a.error?e(a.result.tempo):n(Error(a.error.message)))};t.addEventListener("message",f),t.postMessage({id:p,method:"analyze",params:{channelData:o,sampleRate:s,...null===d?d:{tempoSettings:d}}},[o.buffer])})},guess(...e){var n;let[a,o,s]=e,c="number"==typeof o?o:0,h="number"==typeof s?s:a.duration-c,d="object"==typeof o?o:"object"==typeof s?s:null!==(n=e[3])&&void 0!==n?n:null;return new Promise(async(e,n)=>{let{channelData:o,sampleRate:s}=await v4(a,c,h),p=me(r),f=({data:a})=>{a.id===p&&(r.delete(p),t.removeEventListener("message",f),null===a.error?e(a.result):n(Error(a.error.message)))};t.addEventListener("message",f),t.postMessage({id:p,method:"guess",params:{channelData:o,sampleRate:s,...null===d?d:{tempoSettings:d}}},[o.buffer])})}}},v6=(ox=vW,gK=null,()=>{if(null!==gK)return gK;let e=new Blob(['(()=>{"use strict";const e=(e,t,o)=>{const s=e.length,n=[];let a=!1;for(let r=0;r<s;r+=1)e[r]>t?a=!0:a&&(a=!1,n.push(r-1),r+=o/4-1);return a&&n.push(s-1),n},t=(t,o,s)=>{const n=(e=>{let t=0;const o=e.length;for(let s=0;s<o;s+=1)e[s]>t&&(t=e[s]);return t})(t),a=.3*n;let r=[],l=n-.05*n;if(n>.25)for(;r.length<30&&l>=a;)r=e(t,l,o),l-=.05*n;const p=(e=>{const t=[];return e.forEach(((o,s)=>{const n=Math.min(e.length-s,10);for(let a=1;a<n;a+=1){const n=e[s+a]-o;t.some((e=>e.interval===n&&(e.peaks.push(o),!0)))||t.push({interval:n,peaks:[o]})}})),t})(r),h=function(e,t){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s,n;const a=Math.max(0,null!==(s=o.minTempo)&&void 0!==s?s:90),r=Math.max(0,null!==(n=o.maxTempo)&&void 0!==n?n:180),l=[];return e.forEach((e=>{let o=60/(e.interval/t);for(;o<a;)o*=2;for(;o>r;)o/=2;let s=!1,n=e.peaks.length;l.forEach((t=>{if(t.tempo===o&&(t.score+=e.peaks.length,t.peaks=[...t.peaks,...e.peaks],s=!0),t.tempo>o-.5&&t.tempo<o+.5){const s=2*Math.abs(t.tempo-o);n+=(1-s)*t.peaks.length,t.score+=(1-s)*e.peaks.length}})),s||l.push({peaks:e.peaks,score:n,tempo:o})})),l}(p,o,s);return h.sort(((e,t)=>t.score-e.score)),h};addEventListener("message",(e=>{let{data:o}=e;try{if("analyze"===o.method){const{id:e,params:{channelData:s,sampleRate:n,tempoSettings:a}}=o,r=((e,o,s)=>{const n=t(e,o,s);if(0===n.length)throw new Error("The given channelData does not contain any detectable beats.");return n[0].tempo})(s,n,a);postMessage({error:null,id:e,result:{tempo:r}})}else{if("guess"!==o.method)throw new Error(\'The given method "\'.concat(o.method,\'" is not supported\'));{const{id:e,params:{channelData:s,sampleRate:n,tempoSettings:a}}=o,{bpm:r,offset:l,tempo:p}=((e,o,s)=>{const n=t(e,o,s);if(0===n.length)throw new Error("The given channelData does not contain any detectable beats.");const{peaks:a,tempo:r}=n[0],l=Math.round(r),p=60/l;a.sort(((e,t)=>e-t));let h=a[0]/o;for(;h>p;)h-=p;return{bpm:l,offset:h,tempo:r}})(s,n,a);postMessage({error:null,id:e,result:{bpm:r,offset:l,tempo:p}})}}}catch(e){postMessage({error:{message:e.message},id:o.id,result:null})}}))})();'],{type:"application/javascript; charset=utf-8"}),t=URL.createObjectURL(e);return gK=ox(t),setTimeout(()=>URL.revokeObjectURL(t)),gK}),v5=(...e)=>v6().guess(...e);class v7 extends oP{constructor(){super(),this.interval=500,this.intervalId=null,this.bpmValue=0}setBPM(e){this.interval=6e4/e,clearInterval(this.intervalId),this.intervalId=setInterval(this.updateBPM.bind(this),this.interval)}updateBPM(){this.dispatchEvent({type:"beat"})}async detectBPM(e){let{bpm:t}=await v5(e);this.setBPM(t),console.log(`BPM detected: ${t}`)}getBPMDuration(){return this.interval}}class vX{constructor(){this.frequencyArray=[],this.frequencyData={low:0,mid:0,high:0},this.isPlaying=!1,this.lowFrequency=10,this.midFrequency=150,this.highFrequency=9e3,this.smoothedLowFrequency=0,this.audioContext=null,this.song={url:n}}async loadAudioBuffer(){return new Promise(async(e,t)=>{let r=new pj;this.audio=new pZ(r),new p6().load(this.song.url,t=>{this.audio.setBuffer(t),this.audio.setLoop(s),this.audio.setVolume(c),this.audioContext=this.audio.context,this.bufferLength=this.audioAnalyser.data.length,e()}),this.audioAnalyser=new pK(this.audio,1024)})}play(){this.audio.play(),this.isPlaying=!0}pause(){this.audio.pause(),this.isPlaying=!1}collectAudioData(){this.frequencyArray=this.audioAnalyser.getFrequencyData()}analyzeFrequency(){let e=Math.floor(this.lowFrequency*this.bufferLength/this.audioContext.sampleRate),t=Math.floor(this.midFrequency*this.bufferLength/this.audioContext.sampleRate),r=Math.floor(this.midFrequency*this.bufferLength/this.audioContext.sampleRate),n=Math.floor(this.highFrequency*this.bufferLength/this.audioContext.sampleRate),a=Math.floor(this.highFrequency*this.bufferLength/this.audioContext.sampleRate),o=this.bufferLength-1,s=this.normalizeValue(this.calculateAverage(this.frequencyArray,e,t)),c=this.normalizeValue(this.calculateAverage(this.frequencyArray,r,n)),h=this.normalizeValue(this.calculateAverage(this.frequencyArray,a,o));this.frequencyData={low:s,mid:c,high:h}}calculateAverage(e,t,r){let n=0;for(let a=t;a<=r;a++)n+=e[a];return n/(r-t+1)}normalizeValue(e){return e/256}update(){this.isPlaying&&(this.collectAudioData(),this.analyzeFrequency())}}let vq=class e{constructor(){this.onClickBinder=()=>this.init(),this.onClickPause=()=>this.pause(),document.querySelector(".toggle-btn").addEventListener("click",this.onClickBinder),TweenLite.set(".button-vs-pause",{autoAlpha:0})}init(){document.querySelector(".toggle-btn").removeEventListener("click",this.onClickBinder),document.querySelector(".toggle-btn").addEventListener("click",this.onClickPause),TweenLite.fromTo(".button-vs-pause",.5,{autoAlpha:0},{autoAlpha:1}),TweenLite.fromTo(".button-vs-play",.5,{autoAlpha:1},{autoAlpha:0}),this.renderer=new p1({antialias:!0,alpha:!0}),this.renderer.setClearColor(0,0),this.renderer.setSize(document.getElementById("effect-box").clientWidth,document.getElementById("effect-box").clientHeight),this.renderer.autoClear=!1,document.querySelector("#audio_visualizers").appendChild(this.renderer.domElement),this.camera=new ui(70,document.getElementById("effect-box").clientWidth/document.getElementById("effect-box").clientHeight,.1,1e4),this.camera.position.z=12,this.camera.frustumCulled=!1,this.scene=new pD,this.scene.add(this.camera),e.holder=new li,e.holder.name="holder",this.scene.add(e.holder),e.holder.sortObjects=!1,this.createManagers(),this.resize(),window.addEventListener("resize",()=>this.resize())}async createManagers(){e.audioManager=new vX,await e.audioManager.loadAudioBuffer(),e.bpmManager=new v7,e.bpmManager.addEventListener("beat",()=>{this.particles.onBPMBeat()}),await e.bpmManager.detectBPM(e.audioManager.audio.buffer),e.audioManager.play(),this.particles=new ft,this.particles.init(),this.update()}pause(){!0==e.audioManager.isPlaying?(e.audioManager.pause(),TweenLite.fromTo(".button-vs-play",.5,{autoAlpha:0},{autoAlpha:1}),TweenLite.fromTo(".button-vs-pause",.5,{autoAlpha:1},{autoAlpha:0})):(e.audioManager.play(),TweenLite.fromTo(".button-vs-pause",.5,{autoAlpha:0},{autoAlpha:1}),TweenLite.fromTo(".button-vs-play",.5,{autoAlpha:1},{autoAlpha:0}))}resize(){this.width=document.getElementById("effect-box").clientWidth,this.height=document.getElementById("effect-box").clientHeight,this.camera.aspect=this.width/this.height,this.camera.updateProjectionMatrix(),this.renderer.setSize(this.width,this.height)}update(){var t;requestAnimationFrame(()=>this.update()),null==(t=this.particles)||t.update(),e.audioManager.update(),this.renderer.render(this.scene,this.camera)}};oE(vq,"holder",null),oE(vq,"gui",null),oE(vq,"audioManager",null),oE(vq,"bpmManager",null);let vY=vq;new vY};