I))throw Error(CQ(301));I+=1,iI=dI=null,A.updateQueue=null,Ch.current=pq,Q=B(E,g)}while(ih)}if(Ch.current=P0,A=dI!==null&&dI.next!==null,mh=0,iI=dI=Cg=null,x0=!1,A)throw Error(CQ(300));return Q}function qn(){var Q={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return iI===null?Cg.memoizedState=iI=Q:iI=iI.next=Q,iI}function LD(){if(dI===null){var Q=Cg.alternate;Q=Q!==null?Q.memoizedState:null}else Q=dI.next;var A=iI===null?Cg.memoizedState:iI.next;if(A!==null)iI=A,dI=Q;else{if(Q===null)throw Error(CQ(310));dI=Q,Q={memoizedState:dI.memoizedState,baseState:dI.baseState,baseQueue:dI.baseQueue,queue:dI.queue,next:null},iI===null?Cg.memoizedState=iI=Q:iI=iI.next=Q}return iI}function Yt(Q,A){return typeof A=="function"?A(Q):A}function cc(Q){var A=LD(),B=A.queue;if(B===null)throw Error(CQ(311));B.lastRenderedReducer=Q;var E=dI,g=E.baseQueue,I=B.pending;if(I!==null){if(g!==null){var C=g.next;g.next=I.next,I.next=C}E.baseQueue=g=I,B.pending=null}if(g!==null){g=g.next,E=E.baseState;var i=C=I=null,t=g;do{var e=t.lane;if((mh&e)===e)i!==null&&(i=i.next={lane:0,action:t.action,eagerReducer:t.eagerReducer,eagerState:t.eagerState,next:null}),E=t.eagerReducer===Q?t.eagerState:Q(E,t.action);else{var n={lane:e,action:t.action,eagerReducer:t.eagerReducer,eagerState:t.eagerState,next:null};i===null?(C=i=n,I=E):i=i.next=n,Cg.lanes|=e,MM|=e}t=t.next}while(t!==null&&t!==g);i===null?I=E:i.next=C,Di(E,A.memoizedState)||(Et=!0),A.memoizedState=E,A.baseState=I,A.baseQueue=i,B.lastRenderedState=E}return[A.memoizedState,B.dispatch]}function hc(Q){var A=LD(),B=A.queue;if(B===null)throw Error(CQ(311));B.lastRenderedReducer=Q;var E=B.dispatch,g=B.pending,I=A.memoizedState;if(g!==null){B.pending=null;var C=g=g.next;do I=Q(I,C.action),C=C.next;while(C!==g);Di(I,A.memoizedState)||(Et=!0),A.memoizedState=I,A.baseQueue===null&&(A.baseState=I),B.lastRenderedState=I}return[I,E]}function IK(Q,A,B){var E=A._getVersion;E=E(A._source);var g=A._workInProgressVersionPrimary;if(g!==null?Q=g===E:(Q=Q.mutableReadLanes,(Q=(mh&Q)===Q)&&(A._workInProgressVersionPrimary=E,pr.push(A))),Q)return B(A._source);throw pr.push(A),Error(CQ(350))}function OZ(Q,A,B,E){var g=jI;if(g===null)throw Error(CQ(349));var I=A._getVersion,C=I(A._source),i=Ch.current,t=i.useState(function(){return IK(g,A,B)}),e=t[1],n=t[0];t=iI;var w=Q.memoizedState,D=w.refs,c=D.getSnapshot,G=w.source;w=w.subscribe;var l=Cg;return Q.memoizedState={refs:D,source:A,subscribe:E},i.useEffect(function(){D.getSnapshot=B,D.setSnapshot=e;var M=I(A._source);if(!Di(C,M)){M=B(A._source),Di(n,M)||(e(M),M=ws(l),g.mutableReadLanes|=M&g.pendingLanes),M=g.mutableReadLanes,g.entangledLanes|=M;for(var d=g.entanglements,p=M;0B?98:B,function(){Q(!0)}),aD(97<\/script>",Q=Q.removeChild(Q.firstChild)):typeof E.is=="string"?Q=C.createElement(B,{is:E.is}):(Q=C.createElement(B),B==="select"&&(C=Q,E.multiple?C.multiple=!0:E.size&&(C.size=E.size))):Q=C.createElementNS(Q,B),Q[gs]=A,Q[Y0]=E,Ix(Q,A,!1,!1),A.stateNode=Q,C=xp(B,E),B){case"dialog":yE("cancel",Q),yE("close",Q),g=E;break;case"iframe":case"object":case"embed":yE("load",Q),g=E;break;case"video":case"audio":for(g=0;gsU&&(A.flags|=64,I=!0,Gc(E,!1),A.lanes=33554432)}else{if(!I)if(Q=Z0(C),Q!==null){if(A.flags|=64,I=!0,B=Q.updateQueue,B!==null&&(A.updateQueue=B,A.flags|=4),Gc(E,!0),E.tail===null&&E.tailMode==="hidden"&&!C.alternate&&!Zt)return A=A.lastEffect=E.lastEffect,A!==null&&(A.nextEffect=null),null}else 2*pI()-E.renderingStartTime>sU&&B!==1073741824&&(A.flags|=64,I=!0,Gc(E,!1),A.lanes=33554432);E.isBackwards?(C.sibling=A.child,A.child=C):(B=E.last,B!==null?B.sibling=C:A.child=C,E.last=C)}return E.tail!==null?(B=E.tail,E.rendering=B,E.tail=B.sibling,E.lastEffect=A.lastEffect,E.renderingStartTime=pI(),B.sibling=null,A=VE.current,XE(VE,I?A&1|2:A&1),B):null;case 23:case 24:return zu(),Q!==null&&Q.memoizedState!==null!=(A.memoizedState!==null)&&E.mode!=="unstable-defer-without-hiding"&&(A.flags|=4),null}throw Error(CQ(156,A.tag))}function uq(Q){switch(Q.tag){case 1:wC(Q.type)&&H0();var A=Q.flags;return A&4096?(Q.flags=A&-4097|64,Q):null;case 3:if(Jr(),dE(rC),dE(fI),bu(),A=Q.flags,(A&64)!==0)throw Error(CQ(285));return Q.flags=A&-4097|64,Q;case 5:return xu(Q),null;case 13:return dE(VE),A=Q.flags,A&4096?(Q.flags=A&-4097|64,Q):null;case 19:return dE(VE),null;case 4:return Jr(),null;case 10:return Su(Q),null;case 23:case 24:return zu(),null;default:return null}}function ju(Q,A){try{var B="",E=A;do B+=e4(E),E=E.return;while(E);var g=B}catch(I){g=`
+Error generating stack: `+I.message+`
+`+I.stack}return{value:Q,source:A,stack:g}}function CU(Q,A){try{console.error(A.value)}catch(B){setTimeout(function(){throw B})}}var Rq=typeof WeakMap=="function"?WeakMap:Map;function tx(Q,A,B){B=as(-1,B),B.tag=3,B.payload={element:null};var E=A.value;return B.callback=function(){V0||(V0=!0,nU=E),CU(Q,A)},B}function ex(Q,A,B){B=as(-1,B),B.tag=3;var E=Q.type.getDerivedStateFromError;if(typeof E=="function"){var g=A.value;B.payload=function(){return CU(Q,A),E(g)}}var I=Q.stateNode;return I!==null&&typeof I.componentDidCatch=="function"&&(B.callback=function(){typeof E!="function"&&(Ht===null?Ht=new Set([this]):Ht.add(this),CU(Q,A));var C=A.stack;this.componentDidCatch(A.value,{componentStack:C!==null?C:""})}),B}var Nq=typeof WeakSet=="function"?WeakSet:Set;function hK(Q){var A=Q.ref;if(A!==null)if(typeof A=="function")try{A(null)}catch(B){hs(Q,B)}else A.current=null}function Yq(Q,A){switch(A.tag){case 0:case 11:case 15:case 22:return;case 1:if(A.flags&256&&Q!==null){var B=Q.memoizedProps,E=Q.memoizedState;Q=A.stateNode,A=Q.getSnapshotBeforeUpdate(A.elementType===A.type?B:$i(A.type,B),E),Q.__reactInternalSnapshotBeforeUpdate=A}return;case 3:A.flags&256&&Ku(A.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(CQ(163))}function Hq(Q,A,B){switch(B.tag){case 0:case 11:case 15:case 22:if(A=B.updateQueue,A=A!==null?A.lastEffect:null,A!==null){Q=A=A.next;do{if((Q.tag&3)===3){var E=Q.create;Q.destroy=E()}Q=Q.next}while(Q!==A)}if(A=B.updateQueue,A=A!==null?A.lastEffect:null,A!==null){Q=A=A.next;do{var g=Q;E=g.next,g=g.tag,(g&4)!==0&&(g&1)!==0&&(hx(B,Q),bq(B,Q)),Q=E}while(Q!==A)}return;case 1:Q=B.stateNode,B.flags&4&&(A===null?Q.componentDidMount():(E=B.elementType===B.type?A.memoizedProps:$i(B.type,A.memoizedProps),Q.componentDidUpdate(E,A.memoizedState,Q.__reactInternalSnapshotBeforeUpdate))),A=B.updateQueue,A!==null&&$H(B,A,Q);return;case 3:if(A=B.updateQueue,A!==null){if(Q=null,B.child!==null)switch(B.child.tag){case 5:Q=B.child.stateNode;break;case 1:Q=B.child.stateNode}$H(B,A,Q)}return;case 5:Q=B.stateNode,A===null&&B.flags&4&&KZ(B.type,B.memoizedProps)&&Q.focus();return;case 6:return;case 4:return;case 12:return;case 13:B.memoizedState===null&&(B=B.alternate,B!==null&&(B=B.memoizedState,B!==null&&(B=B.dehydrated,B!==null&&DZ(B))));return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(CQ(163))}function MK(Q,A){for(var B=Q;;){if(B.tag===5){var E=B.stateNode;if(A)E=E.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{E=B.stateNode;var g=B.memoizedProps.style;g=g!=null&&g.hasOwnProperty("display")?g.display:null,E.style.display=BZ("display",g)}}else if(B.tag===6)B.stateNode.nodeValue=A?"":B.memoizedProps;else if((B.tag!==23&&B.tag!==24||B.memoizedState===null||B===Q)&&B.child!==null){B.child.return=B,B=B.child;continue}if(B===Q)break;for(;B.sibling===null;){if(B.return===null||B.return===Q)return;B=B.return}B.sibling.return=B.return,B=B.sibling}}function GK(Q,A){if(BD&&typeof BD.onCommitFiberUnmount=="function")try{BD.onCommitFiberUnmount(mu,A)}catch{}switch(A.tag){case 0:case 11:case 14:case 15:case 22:if(Q=A.updateQueue,Q!==null&&(Q=Q.lastEffect,Q!==null)){var B=Q=Q.next;do{var E=B,g=E.destroy;if(E=E.tag,g!==void 0)if((E&4)!==0)hx(A,B);else{E=A;try{g()}catch(I){hs(E,I)}}B=B.next}while(B!==Q)}break;case 1:if(hK(A),Q=A.stateNode,typeof Q.componentWillUnmount=="function")try{Q.props=A.memoizedProps,Q.state=A.memoizedState,Q.componentWillUnmount()}catch(I){hs(A,I)}break;case 5:hK(A);break;case 4:ox(Q,A)}}function lK(Q){Q.alternate=null,Q.child=null,Q.dependencies=null,Q.firstEffect=null,Q.lastEffect=null,Q.memoizedProps=null,Q.memoizedState=null,Q.pendingProps=null,Q.return=null,Q.updateQueue=null}function yK(Q){return Q.tag===5||Q.tag===3||Q.tag===4}function kK(Q){A:{for(var A=Q.return;A!==null;){if(yK(A))break A;A=A.return}throw Error(CQ(160))}var B=A;switch(A=B.stateNode,B.tag){case 5:var E=!1;break;case 3:A=A.containerInfo,E=!0;break;case 4:A=A.containerInfo,E=!0;break;default:throw Error(CQ(161))}B.flags&16&&(kh(A,""),B.flags&=-17);A:Q:for(B=Q;;){for(;B.sibling===null;){if(B.return===null||yK(B.return)){B=null;break A}B=B.return}for(B.sibling.return=B.return,B=B.sibling;B.tag!==5&&B.tag!==6&&B.tag!==18;){if(B.flags&2||B.child===null||B.tag===4)continue Q;B.child.return=B,B=B.child}if(!(B.flags&2)){B=B.stateNode;break A}}E?iU(Q,B,A):tU(Q,B,A)}function iU(Q,A,B){var E=Q.tag,g=E===5||E===6;if(g)Q=g?Q.stateNode:Q.stateNode.instance,A?B.nodeType===8?B.parentNode.insertBefore(Q,A):B.insertBefore(Q,A):(B.nodeType===8?(A=B.parentNode,A.insertBefore(Q,B)):(A=B,A.appendChild(Q)),B=B._reactRootContainer,B!=null||A.onclick!==null||(A.onclick=N0));else if(E!==4&&(Q=Q.child,Q!==null))for(iU(Q,A,B),Q=Q.sibling;Q!==null;)iU(Q,A,B),Q=Q.sibling}function tU(Q,A,B){var E=Q.tag,g=E===5||E===6;if(g)Q=g?Q.stateNode:Q.stateNode.instance,A?B.insertBefore(Q,A):B.appendChild(Q);else if(E!==4&&(Q=Q.child,Q!==null))for(tU(Q,A,B),Q=Q.sibling;Q!==null;)tU(Q,A,B),Q=Q.sibling}function ox(Q,A){for(var B=A,E=!1,g,I;;){if(!E){E=B.return;A:for(;;){if(E===null)throw Error(CQ(160));switch(g=E.stateNode,E.tag){case 5:I=!1;break A;case 3:g=g.containerInfo,I=!0;break A;case 4:g=g.containerInfo,I=!0;break A}E=E.return}E=!0}if(B.tag===5||B.tag===6){A:for(var C=Q,i=B,t=i;;)if(GK(C,t),t.child!==null&&t.tag!==4)t.child.return=t,t=t.child;else{if(t===i)break A;for(;t.sibling===null;){if(t.return===null||t.return===i)break A;t=t.return}t.sibling.return=t.return,t=t.sibling}I?(C=g,i=B.stateNode,C.nodeType===8?C.parentNode.removeChild(i):C.removeChild(i)):g.removeChild(B.stateNode)}else if(B.tag===4){if(B.child!==null){g=B.stateNode.containerInfo,I=!0,B.child.return=B,B=B.child;continue}}else if(GK(Q,B),B.child!==null){B.child.return=B,B=B.child;continue}if(B===A)break;for(;B.sibling===null;){if(B.return===null||B.return===A)return;B=B.return,B.tag===4&&(E=!1)}B.sibling.return=B.return,B=B.sibling}}function PF(Q,A){switch(A.tag){case 0:case 11:case 14:case 15:case 22:var B=A.updateQueue;if(B=B!==null?B.lastEffect:null,B!==null){var E=B=B.next;do(E.tag&3)===3&&(Q=E.destroy,E.destroy=void 0,Q!==void 0&&Q()),E=E.next;while(E!==B)}return;case 1:return;case 5:if(B=A.stateNode,B!=null){E=A.memoizedProps;var g=Q!==null?Q.memoizedProps:E;Q=A.type;var I=A.updateQueue;if(A.updateQueue=null,I!==null){for(B[Y0]=E,Q==="input"&&E.type==="radio"&&E.name!=null&&_S(B,E),xp(Q,g),A=xp(Q,E),g=0;gg&&(g=C),B&=~I}if(B=g,B=pI()-B,B=(120>B?120:480>B?480:1080>B?1080:1920>B?1920:3e3>B?3e3:4320>B?4320:1960*mq(B/1960))-B,10 component higher in the tree to provide a loading indicator or placeholder to display.`)}tI!==5&&(tI=2),t=ju(t,i),D=C;do{switch(D.tag){case 3:I=t,D.flags|=4096,A&=-A,D.lanes|=A;var f=tx(D,I,A);_H(D,f);break A;case 1:I=t;var m=D.type,x=D.stateNode;if((D.flags&64)===0&&(typeof m.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Ht===null||!Ht.has(x)))){D.flags|=4096,A&=-A,D.lanes|=A;var L=ex(D,I,A);_H(D,L);break A}}D=D.return}while(D!==null)}cx(B)}catch(Z){A=Z,Ug===B&&B!==null&&(Ug=B=B.return);continue}break}while(1)}function rx(){var Q=W0.current;return W0.current=P0,Q===null?P0:Q}function Xc(Q,A){var B=tB;tB|=16;var E=rx();jI===Q&&UI===A||fr(Q,A);do try{Jq();break}catch(g){ax(Q,g)}while(1);if(Ju(),tB=B,W0.current=E,Ug!==null)throw Error(CQ(261));return jI=null,UI=0,tI}function Jq(){for(;Ug!==null;)wx(Ug)}function Sq(){for(;Ug!==null&&!Mq();)wx(Ug)}function wx(Q){var A=Mx(Q.alternate,Q,rD);Q.memoizedProps=Q.pendingProps,A===null?cx(Q):Ug=A,Xu.current=null}function cx(Q){var A=Q;do{var B=A.alternate;if(Q=A.return,(A.flags&2048)===0){if(B=fq(B,A,rD),B!==null){Ug=B;return}if(B=A,B.tag!==24&&B.tag!==23||B.memoizedState===null||(rD&1073741824)!==0||(B.mode&4)===0){for(var E=0,g=B.child;g!==null;)E|=g.lanes|g.childLanes,g=g.sibling;B.childLanes=E}Q!==null&&(Q.flags&2048)===0&&(Q.firstEffect===null&&(Q.firstEffect=A.firstEffect),A.lastEffect!==null&&(Q.lastEffect!==null&&(Q.lastEffect.nextEffect=A.firstEffect),Q.lastEffect=A.lastEffect),1C&&(i=C,C=f,f=i),i=JH(p,f),I=JH(p,C),i&&I&&(u.rangeCount!==1||u.anchorNode!==i.node||u.anchorOffset!==i.offset||u.focusNode!==I.node||u.focusOffset!==I.offset)&&(R=R.createRange(),R.setStart(i.node,i.offset),u.removeAllRanges(),f>C?(u.addRange(R),u.extend(I.node,I.offset)):(R.setEnd(I.node,I.offset),u.addRange(R)))))),R=[],u=p;u=u.parentNode;)u.nodeType===1&&R.push({element:u,left:u.scrollLeft,top:u.scrollTop});for(typeof p.focus=="function"&&p.focus(),p=0;ppI()-Ou?fr(Q,0):qu|=B),li(Q,A)}function Pq(Q,A){var B=Q.stateNode;B!==null&&B.delete(A),A=0,A===0&&(A=Q.mode,(A&2)===0?A=1:(A&4)===0?A=Lr()===99?1:2:(be===0&&(be=rw),A=Ir(62914560&~be),A===0&&(A=4194304))),B=SC(),Q=Sy(Q,A),Q!==null&&(Ry(Q,A,B),li(Q,B))}var Mx;Mx=function(Q,A,B){var E=A.lanes;if(Q!==null)if(Q.memoizedProps!==A.pendingProps||rC.current)Et=!0;else if((B&E)!==0)Et=(Q.flags&16384)!==0;else{switch(Et=!1,A.tag){case 3:sK(A),bF();break;case 5:BK(A);break;case 1:wC(A.type)&&vl(A);break;case 4:AU(A,A.stateNode.containerInfo);break;case 10:E=A.memoizedProps.value;var g=A.type._context;XE(K0,g._currentValue),g._currentValue=E;break;case 13:if(A.memoizedState!==null)return(B&A.child.childLanes)!==0?nK(Q,A,B):(XE(VE,VE.current&1),A=Ve(Q,A,B),A!==null?A.sibling:null);XE(VE,VE.current&1);break;case 19:if(E=(B&A.childLanes)!==0,(Q.flags&64)!==0){if(E)return cK(Q,A,B);A.flags|=64}if(g=A.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),XE(VE,VE.current),E)break;return null;case 23:case 24:return A.lanes=0,TF(Q,A,B)}return Ve(Q,A,B)}else Et=!1;switch(A.lanes=0,A.tag){case 2:if(E=A.type,Q!==null&&(Q.alternate=null,A.alternate=null,A.flags|=2),Q=A.pendingProps,g=mr(A,fI.current),dr(A,B),g=vu(null,A,E,Q,g,B),A.flags|=1,typeof g=="object"&&g!==null&&typeof g.render=="function"&&g.$$typeof===void 0){if(A.tag=1,A.memoizedState=null,A.updateQueue=null,wC(E)){var I=!0;vl(A)}else I=!1;A.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,Zu(A);var C=E.getDerivedStateFromProps;typeof C=="function"&&J0(A,E,C,Q),g.updater=Ly,A.stateNode=g,g._reactInternals=A,$p(A,E,Q,B),A=gU(null,A,E,!0,I,B)}else A.tag=0,nC(null,A,g,B),A=A.child;return A;case 16:g=A.elementType;A:{switch(Q!==null&&(Q.alternate=null,A.alternate=null,A.flags|=2),Q=A.pendingProps,I=g._init,g=I(g._payload),A.type=g,I=A.tag=Vq(g),Q=$i(g,Q),I){case 0:A=EU(null,A,g,Q,B);break A;case 1:A=oK(null,A,g,Q,B);break A;case 11:A=tK(null,A,g,Q,B);break A;case 14:A=eK(null,A,g,$i(g.type,Q),E,B);break A}throw Error(CQ(306,g,""))}return A;case 0:return E=A.type,g=A.pendingProps,g=A.elementType===E?g:$i(E,g),EU(Q,A,E,g,B);case 1:return E=A.type,g=A.pendingProps,g=A.elementType===E?g:$i(E,g),oK(Q,A,E,g,B);case 3:if(sK(A),E=A.updateQueue,Q===null||E===null)throw Error(CQ(282));if(E=A.pendingProps,g=A.memoizedState,g=g!==null?g.element:null,PZ(Q,A),Yh(A,E,null,B),E=A.memoizedState.element,E===g)bF(),A=Ve(Q,A,B);else{if(g=A.stateNode,(I=g.hydrate)&&(Is=Fr(A.stateNode.containerInfo.firstChild),We=A,I=Zt=!0),I){if(Q=g.mutableSourceEagerHydrationData,Q!=null)for(g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(A)}catch(B){console.error(B)}}A(),Q.exports=Fi})(TC);const X0=dy(TC.exports);function uE(Q){const A=O.exports.useRef(Q);return A.current=Q,O.exports.useMemo(()=>Object.freeze({get current(){return A.current}}),[])}function BR(Q){const A=uE(Q);O.exports.useEffect(()=>()=>{A.current()},[])}function ER(Q,A,B,E=0){const g=O.exports.useRef(),I=O.exports.useRef(),C=O.exports.useRef(),i=()=>{g.current&&(clearTimeout(g.current),g.current=void 0),I.current&&(clearTimeout(I.current),I.current=void 0)};return BR(i),O.exports.useMemo(()=>{const t=()=>{if(!C.current)return;const n=C.current;C.current=void 0,Q.apply(n.this,n.args),i()},e=function(...n){g.current&&clearTimeout(g.current),C.current={args:n,this:this},g.current=setTimeout(t,B),E>0&&!I.current&&(I.current=setTimeout(t,E))};return Object.defineProperties(e,{length:{value:Q.length},name:{value:`${Q.name||"anonymous"}__debounced__${B}`}}),e},[B,E,...A])}const ql=()=>{},cC=typeof window<"u"&&typeof navigator<"u"&&typeof document<"u";function lx(Q){const A=uE(Q),B=O.exports.useRef(0),E=O.exports.useCallback(()=>{!cC||B.current&&(cancelAnimationFrame(B.current),B.current=0)},[]);return BR(E),[O.exports.useMemo(()=>{const g=(...I)=>{!cC||(E(),B.current=requestAnimationFrame(()=>{A.current(...I),B.current=0}))};return Object.defineProperties(g,{length:{value:Q.length},name:{value:`${Q.name||"anonymous"}__raf`}}),g},[]),E]}function gR(Q,...A){Q&&Q.addEventListener&&Q.addEventListener(...A)}function IR(Q,...A){Q&&Q.removeEventListener&&Q.removeEventListener(...A)}const $q=(Q,A)=>Object.prototype.hasOwnProperty.call(Q,A),A3=()=>!0,Q3=()=>!1;function CR(){const Q=O.exports.useRef(!0);return O.exports.useEffect(()=>{Q.current=!1},[]),Q.current}function B3(Q=!1){const A=O.exports.useRef(Q),B=O.exports.useCallback(()=>A.current,[]);return O.exports.useEffect(()=>(A.current=!0,()=>{A.current=!1}),[]),B}const E3=cC?O.exports.useLayoutEffect:O.exports.useEffect;function g3(Q){O.exports.useEffect(()=>{Q()},[])}const I3=Q=>(Q+1)%Number.MAX_SAFE_INTEGER;function iR(){const[,Q]=O.exports.useState(0);return O.exports.useCallback(()=>{Q(I3)},[])}function C3(Q,A){const B=CR();O.exports.useEffect(B?ql:Q,A)}const i3=Q=>{Q&&clearTimeout(Q)};function yx(Q,A){const B=uE(Q),E=uE(A),g=O.exports.useRef(null),I=O.exports.useCallback(()=>{i3(g.current)},[]),C=O.exports.useCallback(()=>{E.current!==void 0&&(I(),g.current=setTimeout(()=>B.current(),E.current))},[]);return O.exports.useEffect(()=>(C(),I),[A]),[I,C]}function kx(Q,A){return typeof Q=="function"?Q(A):Q}function t3(Q,A,B=0){const[E,g]=O.exports.useState(Q);return[E,ER(g,[],A,B)]}const XF=Map.prototype;function lM(Q){const A=O.exports.useRef(),B=iR();if(!A.current){const E=new Map(Q);A.current=E,E.set=(...g)=>(XF.set.apply(E,g),B(),E),E.clear=(...g)=>{XF.clear.apply(E,g),B()},E.delete=(...g)=>{const I=XF.delete.apply(E,g);return B(),I}}return A.current}function UK(Q){const A=O.exports.useRef();return O.exports.useEffect(()=>{A.current=Q}),A.current}function Fx(Q){const[A,B]=O.exports.useState(Q),[E,g]=lx(B);return BR(g),[A,E]}function xt(Q=!1,A=!0){const[B,E]=O.exports.useState(Q),g=uE(A);return[B,O.exports.useCallback(I=>{E(C=>I===void 0||g.current&&typeof I=="object"&&(I.constructor.name==="SyntheticBaseEvent"||typeof I._reactName=="string")?!C:Boolean(kx(I,C)))},[])]}function e3(Q,A,B){const E=uE(A),g=uE(B);return O.exports.useMemo(()=>{let I=Q;return{get current(){return g.current===void 0?I:g.current(I)},set current(C){I=E.current===void 0?C:E.current(C)}}},[])}const ED=new Map,Ol=(Q,A,B,E)=>{ED.get(Q)?.get(A)?.forEach(g=>{g!==E&&g(B)})},dx=Q=>{Q.storageArea&&Q.key&&Q.newValue&&Ol(Q.storageArea,Q.key,Q.newValue)},o3=(Q,A,B)=>{cC&&ED.size===0&&gR(window,"storage",dx,{passive:!0});let E=ED.get(Q);E||(E=new Map,ED.set(Q,E));let g=E.get(A);g||(g=new Set,E.set(A,g)),g.add(B)},s3=(Q,A,B)=>{const E=ED.get(Q);if(!E)return;const g=E.get(A);!g||(g.delete(B),g.size||E.delete(A),E.size||ED.delete(Q),cC&&!ED.size&&IR(window,"storage",dx))},n3={defaultValue:null,initializeWithValue:!0};function D3(Q,A,B){const E=uE({...n3,...B}),g=(G,l)=>(E.current.parse??r3)(G,l),I=G=>(E.current.stringify??a3)(G),C=uE({fetchRaw:()=>Q.getItem(A),fetch:()=>g(C.current.fetchRaw(),E.current.defaultValue),remove:()=>Q.removeItem(A),store:G=>{const l=I(G);return l!==null&&Q.setItem(A,l),l}}),i=CR(),[t,e]=O.exports.useState(E.current?.initializeWithValue&&i?C.current.fetch():void 0),n=uE(t),w=uE({fetch:()=>e(C.current.fetch()),setRawVal:G=>{e(g(G,E.current.defaultValue))}});C3(()=>{w.current.fetch()},[A]),O.exports.useEffect(()=>{E.current.initializeWithValue||w.current.fetch()},[]),E3(()=>{const G=w.current.setRawVal;return o3(Q,A,G),()=>{s3(Q,A,G)}},[Q,A]);const D=uE({set:G=>{if(!cC)return;const l=kx(G,n.current),M=C.current.store(l);M!==null&&Ol(Q,A,M)},delete:()=>{!cC||(C.current.remove(),Ol(Q,A,null))},fetch:()=>{!cC||Ol(Q,A,C.current.fetchRaw())}}),c=O.exports.useMemo(()=>({set:G=>D.current.set(G),remove:()=>D.current.delete(),fetch:()=>D.current.fetch()}),[]);return O.exports.useMemo(()=>({value:t,...c}),[t])}const a3=Q=>{if(Q===null)return null;try{return JSON.stringify(Q)}catch(A){return console.warn(A),null}},r3=(Q,A)=>{if(Q===null)return A;try{return JSON.parse(Q)}catch(B){return console.warn(B),A}};let cU;try{cU=cC&&!!window.localStorage}catch{cU=!1}const w3=cU?(Q,A)=>D3(localStorage,Q,A):(Q,A)=>({value:void 0,set:ql,remove:ql,fetch:ql});let RG;function c3(){if(!cC)return;if(RG)return RG;const Q=new Map,A=new ResizeObserver(B=>{B.forEach(E=>Q.get(E.target)?.forEach(g=>setTimeout(()=>g(E),0)))});return RG={observer:A,subscribe:(B,E)=>{let g=Q.get(B);g||(g=new Set,Q.set(B,g),A.observe(B)),g.add(E)},unsubscribe:(B,E)=>{const g=Q.get(B);g&&(g.delete(E),g.size||(Q.delete(B),A.unobserve(B)))}},RG}function h3(Q,A,B=!0){const E=B&&c3(),g=uE(A),I=Q&&"current"in Q?Q.current:Q;O.exports.useEffect(()=>{const C=Q&&"current"in Q?Q.current:Q;if(!E||!C)return;let i=!0;const t=(...e)=>{i&&g.current(...e)};return E.subscribe(C,t),()=>{i=!1,E.unsubscribe(C,t)}},[I,E])}function yM(Q=!0){const[A,B]=O.exports.useState(null),E=e3(null,i=>(B(i),i)),[g,I]=O.exports.useState(),[C]=lx(i=>I({width:i.contentRect.width,height:i.contentRect.height}));return h3(A,C,Q),[g,E]}function Kt(Q,...A){const B=B3(),E=uE(A[1]),g=O.exports.useMemo(()=>function(...I){!B()||(typeof E.current=="function"?E.current.apply(this,I):typeof E.current.handleEvent=="function"&&E.current.handleEvent.apply(this,I))},[]);O.exports.useEffect(()=>{const I=Q&&$q(Q,"current")?Q.current:Q;if(!I)return;const C=A.slice(2);return gR(I,A[0],g,...C),()=>IR(I,A[0],g,...C)},[Q,A[0]])}const M3=Q=>typeof Q=="function"?Q:typeof Q=="string"?A=>A.key===Q:Q?A3:Q3,G3=cC?window:null;function px(Q,A,B,E={}){const{event:g="keydown",target:I=G3,eventOptions:C}=E,i=uE(A),t=O.exports.useMemo(()=>{const e=M3(Q);return function(w){e(w)&&i.current.call(this,w)}},B);Kt(I,g,t,C)}const l3=["mousedown","touchstart"];function tR(Q,A,B=l3){const E=uE(A),g=uE(Q);O.exports.useEffect(()=>{function I(C){if(!g.current.current)return;const{target:i}=C,t=E.current;(!i||!!i&&!g.current.current.contains(i))&&t.call(this,C)}return B.forEach(C=>gR(document,C,I,{passive:!0})),()=>{B.forEach(C=>IR(document,C,I,{passive:!0}))}},[...B])}const qc=new Set,fK=()=>{qc.forEach(Q=>{Q({width:window.innerWidth,height:window.innerHeight})})};function y3(Q=Fx,A){const B=CR(),[E,g]=Q({width:B&&cC&&!A?window.innerWidth:0,height:B&&cC&&!A?window.innerHeight:0});return g3(()=>{A&&g({width:window.innerWidth,height:window.innerHeight})}),O.exports.useEffect(()=>(qc.size===0&&window.addEventListener("resize",fK,{passive:!0}),qc.add(g),()=>{qc.delete(g),qc.size===0&&window.removeEventListener("resize",fK)}),[g]),E}function q0(){return q0=Object.assign?Object.assign.bind():function(Q){for(var A=1;A=0)&&(B[g]=Q[g]);return B}var p3=typeof performance=="object"&&typeof performance.now=="function",NK=p3?function(){return performance.now()}:function(){return Date.now()};function YK(Q){cancelAnimationFrame(Q.id)}function U3(Q,A){var B=NK();function E(){NK()-B>=A?Q.call(null):g.id=requestAnimationFrame(E)}var g={id:requestAnimationFrame(E)};return g}var OF=-1;function f3(Q){if(Q===void 0&&(Q=!1),OF===-1||Q){var A=document.createElement("div"),B=A.style;B.width="50px",B.height="50px",B.overflow="scroll",document.body.appendChild(A),OF=A.offsetWidth-A.clientWidth,document.body.removeChild(A)}return OF}var Ra=null;function HK(Q){if(Q===void 0&&(Q=!1),Ra===null||Q){var A=document.createElement("div"),B=A.style;B.width="50px",B.height="50px",B.overflow="scroll",B.direction="rtl";var E=document.createElement("div"),g=E.style;return g.width="100px",g.height="100px",A.appendChild(E),document.body.appendChild(A),A.scrollLeft>0?Ra="positive-descending":(A.scrollLeft=1,A.scrollLeft===0?Ra="negative":Ra="positive-ascending"),document.body.removeChild(A),Ra}return Ra}var u3=150,R3=function(A){var B=A.columnIndex;A.data;var E=A.rowIndex;return E+":"+B};function N3(Q){var A,B=Q.getColumnOffset,E=Q.getColumnStartIndexForOffset,g=Q.getColumnStopIndexForStartIndex,I=Q.getColumnWidth,C=Q.getEstimatedTotalHeight,i=Q.getEstimatedTotalWidth,t=Q.getOffsetForColumnAndAlignment,e=Q.getOffsetForRowAndAlignment,n=Q.getRowHeight,w=Q.getRowOffset,D=Q.getRowStartIndexForOffset,c=Q.getRowStopIndexForStartIndex,G=Q.initInstanceProps,l=Q.shouldResetStyleCacheOnItemSizeChange,M=Q.validateProps;return A=function(d){eR(p,d);function p(u){var f;return f=d.call(this,u)||this,f._instanceProps=G(f.props,uK(f)),f._resetIsScrollingTimeoutId=null,f._outerRef=void 0,f.state={instance:uK(f),isScrolling:!1,horizontalScrollDirection:"forward",scrollLeft:typeof f.props.initialScrollLeft=="number"?f.props.initialScrollLeft:0,scrollTop:typeof f.props.initialScrollTop=="number"?f.props.initialScrollTop:0,scrollUpdateWasRequested:!1,verticalScrollDirection:"forward"},f._callOnItemsRendered=void 0,f._callOnItemsRendered=qF(function(m,x,L,Z,V,q,BA,X){return f.props.onItemsRendered({overscanColumnStartIndex:m,overscanColumnStopIndex:x,overscanRowStartIndex:L,overscanRowStopIndex:Z,visibleColumnStartIndex:V,visibleColumnStopIndex:q,visibleRowStartIndex:BA,visibleRowStopIndex:X})}),f._callOnScroll=void 0,f._callOnScroll=qF(function(m,x,L,Z,V){return f.props.onScroll({horizontalScrollDirection:L,scrollLeft:m,scrollTop:x,verticalScrollDirection:Z,scrollUpdateWasRequested:V})}),f._getItemStyle=void 0,f._getItemStyle=function(m,x){var L=f.props,Z=L.columnWidth,V=L.direction,q=L.rowHeight,BA=f._getItemStyleCache(l&&Z,l&&V,l&&q),X=m+":"+x,W;if(BA.hasOwnProperty(X))W=BA[X];else{var gA=B(f.props,x,f._instanceProps),EA=V==="rtl";BA[X]=W={position:"absolute",left:EA?void 0:gA,right:EA?gA:void 0,top:w(f.props,m,f._instanceProps),height:n(f.props,m,f._instanceProps),width:I(f.props,x,f._instanceProps)}}return W},f._getItemStyleCache=void 0,f._getItemStyleCache=qF(function(m,x,L){return{}}),f._onScroll=function(m){var x=m.currentTarget,L=x.clientHeight,Z=x.clientWidth,V=x.scrollLeft,q=x.scrollTop,BA=x.scrollHeight,X=x.scrollWidth;f.setState(function(W){if(W.scrollLeft===V&&W.scrollTop===q)return null;var gA=f.props.direction,EA=V;if(gA==="rtl")switch(HK()){case"negative":EA=-V;break;case"positive-descending":EA=X-Z-V;break}EA=Math.max(0,Math.min(EA,X-Z));var nA=Math.max(0,Math.min(q,BA-L));return{isScrolling:!0,horizontalScrollDirection:W.scrollLeftW?aA:0,oA=DA>BA?aA:0;this.scrollTo({scrollLeft:L!==void 0?t(this.props,L,x,EA,this._instanceProps,oA):EA,scrollTop:Z!==void 0?e(this.props,Z,x,nA,this._instanceProps,eA):nA})},R.componentDidMount=function(){var f=this.props,m=f.initialScrollLeft,x=f.initialScrollTop;if(this._outerRef!=null){var L=this._outerRef;typeof m=="number"&&(L.scrollLeft=m),typeof x=="number"&&(L.scrollTop=x)}this._callPropsCallbacks()},R.componentDidUpdate=function(){var f=this.props.direction,m=this.state,x=m.scrollLeft,L=m.scrollTop,Z=m.scrollUpdateWasRequested;if(Z&&this._outerRef!=null){var V=this._outerRef;if(f==="rtl")switch(HK()){case"negative":V.scrollLeft=-x;break;case"positive-ascending":V.scrollLeft=x;break;default:var q=V.clientWidth,BA=V.scrollWidth;V.scrollLeft=BA-q-x;break}else V.scrollLeft=Math.max(0,x);V.scrollTop=Math.max(0,L)}this._callPropsCallbacks()},R.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&YK(this._resetIsScrollingTimeoutId)},R.render=function(){var f=this.props,m=f.children,x=f.className,L=f.columnCount,Z=f.direction,V=f.height,q=f.innerRef,BA=f.innerElementType,X=f.innerTagName,W=f.itemData,gA=f.itemKey,EA=gA===void 0?R3:gA,nA=f.outerElementType,aA=f.outerTagName,DA=f.rowCount,rA=f.style,eA=f.useIsScrolling,oA=f.width,lA=this.state.isScrolling,xA=this._getHorizontalRangeToRender(),_A=xA[0],NA=xA[1],oQ=this._getVerticalRangeToRender(),AQ=oQ[0],hQ=oQ[1],QQ=[];if(L>0&&DA)for(var HA=AQ;HA<=hQ;HA++)for(var pA=_A;pA<=NA;pA++)QQ.push(O.exports.createElement(m,{columnIndex:pA,data:W,isScrolling:eA?lA:void 0,key:EA({columnIndex:pA,data:W,rowIndex:HA}),rowIndex:HA,style:this._getItemStyle(HA,pA)}));var SA=C(this.props,this._instanceProps),PA=i(this.props,this._instanceProps);return O.exports.createElement(nA||aA||"div",{className:x,onScroll:this._onScroll,ref:this._outerRefSetter,style:q0({position:"relative",height:V,width:oA,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:Z},rA)},O.exports.createElement(BA||X||"div",{children:QQ,ref:q,style:{height:SA,pointerEvents:lA?"none":void 0,width:PA}}))},R._callPropsCallbacks=function(){var f=this.props,m=f.columnCount,x=f.onItemsRendered,L=f.onScroll,Z=f.rowCount;if(typeof x=="function"&&m>0&&Z>0){var V=this._getHorizontalRangeToRender(),q=V[0],BA=V[1],X=V[2],W=V[3],gA=this._getVerticalRangeToRender(),EA=gA[0],nA=gA[1],aA=gA[2],DA=gA[3];this._callOnItemsRendered(q,BA,EA,nA,X,W,aA,DA)}if(typeof L=="function"){var rA=this.state,eA=rA.horizontalScrollDirection,oA=rA.scrollLeft,lA=rA.scrollTop,xA=rA.scrollUpdateWasRequested,_A=rA.verticalScrollDirection;this._callOnScroll(oA,lA,eA,_A,xA)}},R._getHorizontalRangeToRender=function(){var f=this.props,m=f.columnCount,x=f.overscanColumnCount,L=f.overscanColumnsCount,Z=f.overscanCount,V=f.rowCount,q=this.state,BA=q.horizontalScrollDirection,X=q.isScrolling,W=q.scrollLeft,gA=x||L||Z||1;if(m===0||V===0)return[0,0,0,0];var EA=E(this.props,W,this._instanceProps),nA=g(this.props,EA,W,this._instanceProps),aA=!X||BA==="backward"?Math.max(1,gA):1,DA=!X||BA==="forward"?Math.max(1,gA):1;return[Math.max(0,EA-aA),Math.max(0,Math.min(m-1,nA+DA)),EA,nA]},R._getVerticalRangeToRender=function(){var f=this.props,m=f.columnCount,x=f.overscanCount,L=f.overscanRowCount,Z=f.overscanRowsCount,V=f.rowCount,q=this.state,BA=q.isScrolling,X=q.verticalScrollDirection,W=q.scrollTop,gA=L||Z||x||1;if(m===0||V===0)return[0,0,0,0];var EA=D(this.props,W,this._instanceProps),nA=c(this.props,EA,W,this._instanceProps),aA=!BA||X==="backward"?Math.max(1,gA):1,DA=!BA||X==="forward"?Math.max(1,gA):1;return[Math.max(0,EA-aA),Math.max(0,Math.min(V-1,nA+DA)),EA,nA]},p}(O.exports.PureComponent),A.defaultProps={direction:"ltr",itemData:void 0,useIsScrolling:!1},A}var Y3=function(A,B){A.children,A.direction,A.height,A.innerTagName,A.outerTagName,A.overscanColumnsCount,A.overscanCount,A.overscanRowsCount,A.width,B.instance},H3=N3({getColumnOffset:function(A,B){var E=A.columnWidth;return B*E},getColumnWidth:function(A,B){var E=A.columnWidth;return E},getRowOffset:function(A,B){var E=A.rowHeight;return B*E},getRowHeight:function(A,B){var E=A.rowHeight;return E},getEstimatedTotalHeight:function(A){var B=A.rowCount,E=A.rowHeight;return E*B},getEstimatedTotalWidth:function(A){var B=A.columnCount,E=A.columnWidth;return E*B},getOffsetForColumnAndAlignment:function(A,B,E,g,I,C){var i=A.columnCount,t=A.columnWidth,e=A.width,n=Math.max(0,i*t-e),w=Math.min(n,B*t),D=Math.max(0,B*t-e+C+t);switch(E==="smart"&&(g>=D-e&&g<=w+e?E="auto":E="center"),E){case"start":return w;case"end":return D;case"center":var c=Math.round(D+(w-D)/2);return cn+Math.floor(e/2)?n:c;case"auto":default:return g>=D&&g<=w?g:D>w||g=D-t&&g<=w+t?E="auto":E="center"),E){case"start":return w;case"end":return D;case"center":var c=Math.round(D+(w-D)/2);return cn+Math.floor(t/2)?n:c;case"auto":default:return g>=D&&g<=w?g:D>w||g
+ * Copyright OpenJS Foundation and other contributors
+ * Released under MIT license
+ * Based on Underscore.js 1.8.3
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
+ */(function(Q,A){(function(){var B,E="4.17.21",g=200,I="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",C="Expected a function",i="Invalid `variable` option passed into `_.template`",t="__lodash_hash_undefined__",e=500,n="__lodash_placeholder__",w=1,D=2,c=4,G=1,l=2,M=1,d=2,p=4,R=8,u=16,f=32,m=64,x=128,L=256,Z=512,V=30,q="...",BA=800,X=16,W=1,gA=2,EA=3,nA=1/0,aA=9007199254740991,DA=17976931348623157e292,rA=0/0,eA=4294967295,oA=eA-1,lA=eA>>>1,xA=[["ary",x],["bind",M],["bindKey",d],["curry",R],["curryRight",u],["flip",Z],["partial",f],["partialRight",m],["rearg",L]],_A="[object Arguments]",NA="[object Array]",oQ="[object AsyncFunction]",AQ="[object Boolean]",hQ="[object Date]",QQ="[object DOMException]",HA="[object Error]",pA="[object Function]",SA="[object GeneratorFunction]",PA="[object Map]",cQ="[object Number]",BQ="[object Null]",JQ="[object Object]",xQ="[object Promise]",NQ="[object Proxy]",pB="[object RegExp]",nB="[object Set]",iA="[object String]",$="[object Symbol]",mA="[object Undefined]",OA="[object WeakMap]",gQ="[object WeakSet]",iQ="[object ArrayBuffer]",bQ="[object DataView]",YA="[object Float32Array]",dQ="[object Float64Array]",yQ="[object Int8Array]",aQ="[object Int16Array]",cA="[object Int32Array]",$A="[object Uint8Array]",IQ="[object Uint8ClampedArray]",SQ="[object Uint16Array]",eQ="[object Uint32Array]",VQ=/\b__p \+= '';/g,EQ=/\b(__p \+=) '' \+/g,jQ=/(__e\(.*?\)|\b__t\)) \+\n'';/g,fB=/&(?:amp|lt|gt|quot|#39);/g,FB=/[&<>"']/g,pE=RegExp(fB.source),Ng=RegExp(FB.source),tt=/<%-([\s\S]+?)%>/g,Xs=/<%([\s\S]+?)%>/g,jC=/<%=([\s\S]+?)%>/g,MB=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Be=/^\w*$/,_g=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,DI=/[\\^$.*+?()[\]{}|]/g,Ee=RegExp(DI.source),PQ=/^\s+/,IA=/\s/,yA=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,UA=/\{\n\/\* \[wrapped with (.+)\] \*/,N=/,? & /,fA=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,XQ=/[()=,{}\[\]\/\s]/,IB=/\\(\\)?/g,DB=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,CB=/\w*$/,NB=/^[-+]0x[0-9a-f]+$/i,wB=/^0b[01]+$/i,oB=/^\[object .+?Constructor\]$/,_B=/^0o[0-7]+$/i,aI=/^(?:0|[1-9]\d*)$/,_I=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ig=/($^)/,HE=/['\n\r\u2028\u2029\\]/g,fQ="\\ud800-\\udfff",SB="\\u0300-\\u036f",ZB="\\ufe20-\\ufe2f",XB="\\u20d0-\\u20ff",CE=SB+ZB+XB,ng="\\u2700-\\u27bf",HI="a-z\\xdf-\\xf6\\xf8-\\xff",JB="\\xac\\xb1\\xd7\\xf7",Yg="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",et="\\u2000-\\u206f",Hg=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",eE="A-Z\\xc0-\\xd6\\xd8-\\xde",XC="\\ufe0e\\ufe0f",$I=JB+Yg+et+Hg,rI="['\u2019]",Lw="["+fQ+"]",ge="["+$I+"]",YB="["+CE+"]",KI="\\d+",qs="["+ng+"]",di="["+HI+"]",sB="[^"+fQ+$I+KI+ng+HI+eE+"]",Ie="\\ud83c[\\udffb-\\udfff]",pi="(?:"+YB+"|"+Ie+")",Dg="[^"+fQ+"]",ag="(?:\\ud83c[\\udde6-\\uddff]){2}",Ui="[\\ud800-\\udbff][\\udc00-\\udfff]",$g="["+eE+"]",ot="\\u200d",XD="(?:"+di+"|"+sB+")",Jw="(?:"+$g+"|"+sB+")",qD="(?:"+rI+"(?:d|ll|m|re|s|t|ve))?",st="(?:"+rI+"(?:D|LL|M|RE|S|T|VE))?",nt=pi+"?",Os="["+XC+"]?",OD="(?:"+ot+"(?:"+[Dg,ag,Ui].join("|")+")"+Os+nt+")*",no="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",zD="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Dt=Os+nt+OD,_D="(?:"+[qs,ag,Ui].join("|")+")"+Dt,$D="(?:"+[Dg+YB+"?",YB,ag,Ui,Lw].join("|")+")",at=RegExp(rI,"g"),Do=RegExp(YB,"g"),GC=RegExp(Ie+"(?="+Ie+")|"+$D+Dt,"g"),Sw=RegExp([$g+"?"+di+"+"+qD+"(?="+[ge,$g,"$"].join("|")+")",Jw+"+"+st+"(?="+[ge,$g+XD,"$"].join("|")+")",$g+"?"+XD+"+"+qD,$g+"+"+st,zD,no,KI,_D].join("|"),"g"),lC=RegExp("["+ot+fQ+CE+XC+"]"),qC=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,zs=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Aa=-1,BB={};BB[YA]=BB[dQ]=BB[yQ]=BB[aQ]=BB[cA]=BB[$A]=BB[IQ]=BB[SQ]=BB[eQ]=!0,BB[_A]=BB[NA]=BB[iQ]=BB[AQ]=BB[bQ]=BB[hQ]=BB[HA]=BB[pA]=BB[PA]=BB[cQ]=BB[JQ]=BB[pB]=BB[nB]=BB[iA]=BB[OA]=!1;var HB={};HB[_A]=HB[NA]=HB[iQ]=HB[bQ]=HB[AQ]=HB[hQ]=HB[YA]=HB[dQ]=HB[yQ]=HB[aQ]=HB[cA]=HB[PA]=HB[cQ]=HB[JQ]=HB[pB]=HB[nB]=HB[iA]=HB[$]=HB[$A]=HB[IQ]=HB[SQ]=HB[eQ]=!0,HB[HA]=HB[pA]=HB[OA]=!1;var rt={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},yC={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce={"&":"&","<":"<",">":">",""":'"',"'":"'"},wI={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qa=parseFloat,Zw=parseInt,kC=typeof mC=="object"&&mC&&mC.Object===Object&&mC,AI=typeof self=="object"&&self&&self.Object===Object&&self,KE=kC||AI||Function("return this")(),wt=A&&!A.nodeType&&A,AC=wt&&!0&&Q&&!Q.nodeType&&Q,cI=AC&&AC.exports===wt,ct=cI&&kC.process,rg=function(){try{var MA=AC&&AC.require&&AC.require("util").types;return MA||ct&&ct.binding&&ct.binding("util")}catch{}}(),QC=rg&&rg.isArrayBuffer,ie=rg&&rg.isDate,ao=rg&&rg.isMap,_s=rg&&rg.isRegExp,ro=rg&&rg.isSet,mI=rg&&rg.isTypedArray;function mE(MA,KA,RA){switch(RA.length){case 0:return MA.call(KA);case 1:return MA.call(KA,RA[0]);case 2:return MA.call(KA,RA[0],RA[1]);case 3:return MA.call(KA,RA[0],RA[1],RA[2])}return MA.apply(KA,RA)}function UE(MA,KA,RA,sQ){for(var AB=-1,kB=MA==null?0:MA.length;++AB-1}function ht(MA,KA,RA){for(var sQ=-1,AB=MA==null?0:MA.length;++sQ-1;);return RA}function EC(MA,KA){for(var RA=MA.length;RA--&&BC(KA,MA[RA],0)>-1;);return RA}function Ni(MA,KA){for(var RA=MA.length,sQ=0;RA--;)MA[RA]===KA&&++sQ;return sQ}var gC=ui(rt),ga=ui(yC);function Ia(MA){return"\\"+wI[MA]}function Qn(MA,KA){return MA==null?B:MA[KA]}function Yi(MA){return lC.test(MA)}function lo(MA){return qC.test(MA)}function Bn(MA){for(var KA,RA=[];!(KA=MA.next()).done;)RA.push(KA.value);return RA}function $C(MA){var KA=-1,RA=Array(MA.size);return MA.forEach(function(sQ,AB){RA[++KA]=[AB,sQ]}),RA}function yo(MA,KA){return function(RA){return MA(KA(RA))}}function MI(MA,KA){for(var RA=-1,sQ=MA.length,AB=0,kB=[];++RA-1}function Pw(o,r){var F=this.__data__,J=Ho(F,o);return J<0?(++this.size,F.push([o,r])):F[J][1]=r,this}CC.prototype.clear=sa,CC.prototype.delete=sn,CC.prototype.get=Tw,CC.prototype.has=vw,CC.prototype.set=Pw;function Bi(o){var r=-1,F=o==null?0:o.length;for(this.clear();++r=r?o:r)),o}function zE(o,r,F,J,T,z){var tA,wA=r&w,kA=r&D,vA=r&c;if(F&&(tA=T?F(o,J,T,z):F(o)),tA!==B)return tA;if(!ZE(o))return o;var WA=aB(o);if(WA){if(tA=yP(o),!wA)return QB(o,tA)}else{var qA=kI(o),wQ=qA==pA||qA==SA;if(So(o))return ZI(o,wA);if(qA==JQ||qA==_A||wQ&&!T){if(tA=kA||wQ?{}:GY(o),!wA)return kA?sP(o,pQ(tA,o)):Ok(o,xi(tA,o))}else{if(!HB[qA])return T?o:{};tA=kP(o,qA,wA)}}z||(z=new sE);var RQ=z.get(o);if(RQ)return RQ;z.set(o,tA),qY(o)?o.forEach(function($Q){tA.add(zE($Q,r,F,$Q,o,z))}):jY(o)&&o.forEach(function($Q,UB){tA.set(UB,zE($Q,r,F,UB,o,z))});var _Q=vA?kA?AF:$k:kA?eC:xg,lB=WA?B:_Q(o);return fE(lB||o,function($Q,UB){lB&&(UB=$Q,$Q=o[UB]),Me(tA,UB,zE($Q,r,F,UB,o,z))}),tA}function wn(o){var r=xg(o);return function(F){return Ko(F,o,r)}}function Ko(o,r,F){var J=F.length;if(o==null)return!J;for(o=VB(o);J--;){var T=F[J],z=r[T],tA=o[T];if(tA===B&&!(T in o)||!z(tA))return!1}return!0}function aa(o,r,F){if(typeof o!="function")throw new Mg(C);return tc(function(){o.apply(B,F)},r)}function Ge(o,r,F,J){var T=-1,z=QI,tA=!0,wA=o.length,kA=[],vA=r.length;if(!wA)return kA;F&&(r=WB(r,mg(F))),J?(z=ht,tA=!1):r.length>=g&&(z=$B,tA=!1,r=new Zi(r));A:for(;++TT?0:T+F),J=J===B||J>T?T:cB(J),J<0&&(J+=T),J=F>J?0:zY(J);F0&&F(wA)?r>1?JE(wA,r-1,F,J,T):FC(T,wA):J||(T[T.length]=wA)}return T}var ye=iY(),EI=iY(!0);function lg(o,r){return o&&ye(o,r,xg)}function UC(o,r){return o&&EI(o,r,xg)}function ke(o,r){return wg(r,function(F){return ue(o[F])})}function _E(o,r){r=TQ(r,o);for(var F=0,J=r.length;o!=null&&Fr}function Pk(o,r){return o!=null&&KB.call(o,r)}function VM(o,r){return o!=null&&r in VB(o)}function jM(o,r,F){return o>=H(r,F)&&o=120&&WA.length>=120)?new Zi(tA&&WA):B}WA=o[0];var qA=-1,wQ=wA[0];A:for(;++qA-1;)wA!==o&&pC.call(wA,kA,1),pC.call(o,kA,1);return o}function $M(o,r){for(var F=o?r.length:0,J=F-1;F--;){var T=r[F];if(F==J||T!==z){var z=T;fe(T)?pC.call(o,T,1):K(o,T)}}return o}function yI(o,r){return o+re(_()*(r-o+1))}function Bc(o,r,F,J){for(var T=-1,z=U(Qi((r-o)/(F||1)),0),tA=RA(z);z--;)tA[J?z:++T]=o,o+=F;return tA}function Ec(o,r){var F="";if(!o||r<1||r>aA)return F;do r%2&&(F+=o),r=re(r/2),r&&(o+=o);while(r);return F}function EB(o,r){return iF(kY(o,r,oC),o+"")}function ya(o){return he(fa(o))}function Jo(o,r){var F=fa(o);return eG(F,Sg(r,0,F.length))}function Fe(o,r,F,J){if(!ZE(o))return o;r=TQ(r,o);for(var T=-1,z=r.length,tA=z-1,wA=o;wA!=null&&++TT?0:T+r),F=F>T?T:F,F<0&&(F+=T),T=r>F?0:F-r>>>0,r>>>=0;for(var z=RA(T);++J>>1,tA=o[z];tA!==null&&!fC(tA)&&(F?tA<=r:tA=g){var vA=r?null:rP(o);if(vA)return cg(vA);tA=!1,T=$B,kA=new Zi}else kA=r?[]:wA;A:for(;++J=J?o:SI(o,r,F)}var nE=Ro||function(o){return KE.clearTimeout(o)};function ZI(o,r){if(r)return o.slice();var F=o.length,J=GI?GI(F):new o.constructor(F);return o.copy(J),J}function dA(o){var r=new o.constructor(o.byteLength);return new uo(r).set(new uo(o)),r}function GA(o,r){var F=r?dA(o.buffer):o.buffer;return new o.constructor(F,o.byteOffset,o.byteLength)}function JA(o){var r=new o.constructor(o.source,CB.exec(o));return r.lastIndex=o.lastIndex,r}function MQ(o){return LE?VB(LE.call(o)):{}}function mQ(o,r){var F=r?dA(o.buffer):o.buffer;return new o.constructor(F,o.byteOffset,o.length)}function gE(o,r){if(o!==r){var F=o!==B,J=o===null,T=o===o,z=fC(o),tA=r!==B,wA=r===null,kA=r===r,vA=fC(r);if(!wA&&!vA&&!z&&o>r||z&&tA&&kA&&!wA&&!vA||J&&tA&&kA||!F&&kA||!T)return 1;if(!J&&!z&&!vA&&o=wA)return kA;var vA=F[J];return kA*(vA=="desc"?-1:1)}}return o.index-r.index}function bB(o,r,F,J){for(var T=-1,z=o.length,tA=F.length,wA=-1,kA=r.length,vA=U(z-tA,0),WA=RA(kA+vA),qA=!J;++wA1?F[T-1]:B,tA=T>2?F[2]:B;for(z=o.length>3&&typeof z=="function"?(T--,z):B,tA&&xI(F[0],F[1],tA)&&(z=T<3?B:z,T=1),r=VB(r);++J-1?T[z?r[tA]:tA]:B}}function oY(o){return Ue(function(r){var F=r.length,J=F,T=JI.prototype.thru;for(o&&r.reverse();J--;){var z=r[J];if(typeof z!="function")throw new Mg(C);if(T&&!tA&&iG(z)=="wrapper")var tA=new JI([],!0)}for(J=tA?J:F;++J1&&LB.reverse(),WA&&kAwA))return!1;var vA=z.get(o),WA=z.get(r);if(vA&&WA)return vA==r&&WA==o;var qA=-1,wQ=!0,RQ=F&l?new Zi:B;for(z.set(o,r),z.set(r,o);++qA1?"& ":"")+r[J],r=r.join(F>2?", ":" "),o.replace(yA,`{
+/* [wrapped with `+r+`] */
+`)}function dP(o){return aB(o)||Fn(o)||!!(lI&&o&&o[lI])}function fe(o,r){var F=typeof o;return r=r??aA,!!r&&(F=="number"||F!="symbol"&&aI.test(o))&&o>-1&&o%1==0&&o0){if(++r>=BA)return arguments[0]}else r=0;return o.apply(B,arguments)}}function eG(o,r){var F=-1,J=o.length,T=J-1;for(r=r===B?J:r;++F1?o[r-1]:B;return F=typeof F=="function"?(o.pop(),F):B,mY(o,F)});function LY(o){var r=j(o);return r.__chain__=!0,r}function LW(o,r){return r(o),o}function oG(o,r){return r(o)}var JW=Ue(function(o){var r=o.length,F=r?o[0]:0,J=this.__wrapped__,T=function(z){return rn(z,o)};return r>1||this.__actions__.length||!(J instanceof GB)||!fe(F)?this.thru(T):(J=J.slice(F,+F+(r?1:0)),J.__actions__.push({func:oG,args:[T],thisArg:B}),new JI(J,this.__chain__).thru(function(z){return r&&!z.length&&z.push(B),z}))});function SW(){return LY(this)}function ZW(){return new JI(this.value(),this.__chain__)}function xW(){this.__values__===B&&(this.__values__=OY(this.value()));var o=this.__index__>=this.__values__.length,r=o?B:this.__values__[this.__index__++];return{done:o,value:r}}function bW(){return this}function TW(o){for(var r,F=this;F instanceof on;){var J=uY(F);J.__index__=0,J.__values__=B,r?T.__wrapped__=J:r=J;var T=J;F=F.__wrapped__}return T.__wrapped__=o,r}function vW(){var o=this.__wrapped__;if(o instanceof GB){var r=o;return this.__actions__.length&&(r=new GB(this)),r=r.reverse(),r.__actions__.push({func:oG,args:[tF],thisArg:B}),new JI(r,this.__chain__)}return this.thru(tF)}function PW(){return CA(this.__wrapped__,this.__actions__)}var WW=BG(function(o,r,F){KB.call(o,F)?++o[F]:iC(o,F,1)});function VW(o,r,F){var J=aB(o)?OC:qw;return F&&xI(o,r,F)&&(r=B),J(o,qQ(r,3))}function jW(o,r){var F=aB(o)?wg:cn;return F(o,qQ(r,3))}var XW=eY(RY),qW=eY(NY);function OW(o,r){return JE(sG(o,r),1)}function zW(o,r){return JE(sG(o,r),nA)}function _W(o,r,F){return F=F===B?1:cB(F),JE(sG(o,r),F)}function JY(o,r){var F=aB(o)?fE:Zg;return F(o,qQ(r,3))}function SY(o,r){var F=aB(o)?wo:mo;return F(o,qQ(r,3))}var $W=BG(function(o,r,F){KB.call(o,F)?o[F].push(r):iC(o,F,[r])});function AV(o,r,F,J){o=tC(o)?o:fa(o),F=F&&!J?cB(F):0;var T=o.length;return F<0&&(F=U(T+F,0)),wG(o)?F<=T&&o.indexOf(r,F)>-1:!!T&&BC(o,r,F)>-1}var QV=EB(function(o,r,F){var J=-1,T=typeof r=="function",z=tC(o)?RA(o.length):[];return Zg(o,function(tA){z[++J]=T?mE(r,tA,F):Ei(tA,r,F)}),z}),BV=BG(function(o,r,F){iC(o,F,r)});function sG(o,r){var F=aB(o)?WB:vi;return F(o,qQ(r,3))}function EV(o,r,F,J){return o==null?[]:(aB(r)||(r=r==null?[]:[r]),F=J?B:F,aB(F)||(F=F==null?[]:[F]),$w(o,r,F))}var gV=BG(function(o,r,F){o[F?0:1].push(r)},function(){return[[],[]]});function IV(o,r,F){var J=aB(o)?Mt:BI,T=arguments.length<3;return J(o,qQ(r,4),F,T,Zg)}function CV(o,r,F){var J=aB(o)?co:BI,T=arguments.length<3;return J(o,qQ(r,4),F,T,mo)}function iV(o,r){var F=aB(o)?wg:cn;return F(o,aG(qQ(r,3)))}function tV(o){var r=aB(o)?he:ya;return r(o)}function eV(o,r,F){(F?xI(o,r,F):r===B)?r=1:r=cB(r);var J=aB(o)?Dn:Jo;return J(o,r)}function oV(o){var r=aB(o)?Yo:qk;return r(o)}function sV(o){if(o==null)return 0;if(tC(o))return wG(o)?wE(o):o.length;var r=kI(o);return r==PA||r==nB?o.size:wa(o).length}function nV(o,r,F){var J=aB(o)?fi:AG;return F&&xI(o,r,F)&&(r=B),J(o,qQ(r,3))}var DV=EB(function(o,r){if(o==null)return[];var F=r.length;return F>1&&xI(o,r[0],r[1])?r=[]:F>2&&xI(r[0],r[1],r[2])&&(r=[r[0]]),$w(o,JE(r,1),[])}),nG=No||function(){return KE.Date.now()};function aV(o,r){if(typeof r!="function")throw new Mg(C);return o=cB(o),function(){if(--o<1)return r.apply(this,arguments)}}function ZY(o,r,F){return r=F?B:r,r=o&&r==null?o.length:r,pe(o,x,B,B,B,B,r)}function xY(o,r){var F;if(typeof r!="function")throw new Mg(C);return o=cB(o),function(){return--o>0&&(F=r.apply(this,arguments)),o<=1&&(r=B),F}}var oF=EB(function(o,r,F){var J=M;if(F.length){var T=MI(F,pa(oF));J|=f}return pe(o,J,r,F,T)}),bY=EB(function(o,r,F){var J=M|d;if(F.length){var T=MI(F,pa(bY));J|=f}return pe(r,J,o,F,T)});function TY(o,r,F){r=F?B:r;var J=pe(o,R,B,B,B,B,B,r);return J.placeholder=TY.placeholder,J}function vY(o,r,F){r=F?B:r;var J=pe(o,u,B,B,B,B,B,r);return J.placeholder=vY.placeholder,J}function PY(o,r,F){var J,T,z,tA,wA,kA,vA=0,WA=!1,qA=!1,wQ=!0;if(typeof o!="function")throw new Mg(C);r=Ii(r)||0,ZE(F)&&(WA=!!F.leading,qA="maxWait"in F,z=qA?U(Ii(F.maxWait)||0,r):z,wQ="trailing"in F?!!F.trailing:wQ);function RQ(Ag){var Wi=J,Ne=T;return J=T=B,vA=Ag,tA=o.apply(Ne,Wi),tA}function _Q(Ag){return vA=Ag,wA=tc(UB,r),WA?RQ(Ag):tA}function lB(Ag){var Wi=Ag-kA,Ne=Ag-vA,eH=r-Wi;return qA?H(eH,z-Ne):eH}function $Q(Ag){var Wi=Ag-kA,Ne=Ag-vA;return kA===B||Wi>=r||Wi<0||qA&&Ne>=z}function UB(){var Ag=nG();if($Q(Ag))return LB(Ag);wA=tc(UB,lB(Ag))}function LB(Ag){return wA=B,wQ&&J?RQ(Ag):(J=T=B,tA)}function uC(){wA!==B&&nE(wA),vA=0,J=kA=T=wA=B}function bI(){return wA===B?tA:LB(nG())}function RC(){var Ag=nG(),Wi=$Q(Ag);if(J=arguments,T=this,kA=Ag,Wi){if(wA===B)return _Q(kA);if(qA)return nE(wA),wA=tc(UB,r),RQ(kA)}return wA===B&&(wA=tc(UB,r)),tA}return RC.cancel=uC,RC.flush=bI,RC}var rV=EB(function(o,r){return aa(o,1,r)}),wV=EB(function(o,r,F){return aa(o,Ii(r)||0,F)});function cV(o){return pe(o,Z)}function DG(o,r){if(typeof o!="function"||r!=null&&typeof r!="function")throw new Mg(C);var F=function(){var J=arguments,T=r?r.apply(this,J):J[0],z=F.cache;if(z.has(T))return z.get(T);var tA=o.apply(this,J);return F.cache=z.set(T,tA)||z,tA};return F.cache=new(DG.Cache||Bi),F}DG.Cache=Bi;function aG(o){if(typeof o!="function")throw new Mg(C);return function(){var r=arguments;switch(r.length){case 0:return!o.call(this);case 1:return!o.call(this,r[0]);case 2:return!o.call(this,r[0],r[1]);case 3:return!o.call(this,r[0],r[1],r[2])}return!o.apply(this,r)}}function hV(o){return xY(2,o)}var MV=lQ(function(o,r){r=r.length==1&&aB(r[0])?WB(r[0],mg(qQ())):WB(JE(r,1),mg(qQ()));var F=r.length;return EB(function(J){for(var T=-1,z=H(J.length,F);++T=r}),Fn=_w(function(){return arguments}())?_w:function(o){return PE(o)&&KB.call(o,"callee")&&!tn.call(o,"callee")},aB=RA.isArray,KV=QC?mg(QC):XM;function tC(o){return o!=null&&rG(o.length)&&!ue(o)}function $E(o){return PE(o)&&tC(o)}function mV(o){return o===!0||o===!1||PE(o)&&vE(o)==AQ}var So=Ca||yF,LV=ie?mg(ie):Mn;function JV(o){return PE(o)&&o.nodeType===1&&!ec(o)}function SV(o){if(o==null)return!0;if(tC(o)&&(aB(o)||typeof o=="string"||typeof o.splice=="function"||So(o)||Ua(o)||Fn(o)))return!o.length;var r=kI(o);if(r==PA||r==nB)return!o.size;if(ic(o))return!wa(o).length;for(var F in o)if(KB.call(o,F))return!1;return!0}function ZV(o,r){return Gn(o,r)}function xV(o,r,F){F=typeof F=="function"?F:B;var J=F?F(o,r):B;return J===B?Gn(o,r,B,F):!!J}function nF(o){if(!PE(o))return!1;var r=vE(o);return r==HA||r==QQ||typeof o.message=="string"&&typeof o.name=="string"&&!ec(o)}function bV(o){return typeof o=="number"&&en(o)}function ue(o){if(!ZE(o))return!1;var r=vE(o);return r==pA||r==SA||r==oQ||r==NQ}function VY(o){return typeof o=="number"&&o==cB(o)}function rG(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=aA}function ZE(o){var r=typeof o;return o!=null&&(r=="object"||r=="function")}function PE(o){return o!=null&&typeof o=="object"}var jY=ao?mg(ao):qM;function TV(o,r){return o===r||ra(o,r,BF(r))}function vV(o,r,F){return F=typeof F=="function"?F:B,ra(o,r,BF(r),F)}function PV(o){return XY(o)&&o!=+o}function WV(o){if(fP(o))throw new AB(I);return dt(o)}function VV(o){return o===null}function jV(o){return o==null}function XY(o){return typeof o=="number"||PE(o)&&vE(o)==cQ}function ec(o){if(!PE(o)||vE(o)!=JQ)return!1;var r=qE(o);if(r===null)return!0;var F=KB.call(r,"constructor")&&r.constructor;return typeof F=="function"&&F instanceof F&&Ai.call(F)==Cn}var DF=_s?mg(_s):Vk;function XV(o){return VY(o)&&o>=-aA&&o<=aA}var qY=ro?mg(ro):jk;function wG(o){return typeof o=="string"||!aB(o)&&PE(o)&&vE(o)==iA}function fC(o){return typeof o=="symbol"||PE(o)&&vE(o)==$}var Ua=mI?mg(mI):Ti;function qV(o){return o===B}function OV(o){return PE(o)&&kI(o)==OA}function zV(o){return PE(o)&&vE(o)==gQ}var _V=CG(ca),$V=CG(function(o,r){return o<=r});function OY(o){if(!o)return[];if(tC(o))return wG(o)?Lg(o):QB(o);if(Si&&o[Si])return Bn(o[Si]());var r=kI(o),F=r==PA?$C:r==nB?cg:fa;return F(o)}function Re(o){if(!o)return o===0?o:0;if(o=Ii(o),o===nA||o===-nA){var r=o<0?-1:1;return r*DA}return o===o?o:0}function cB(o){var r=Re(o),F=r%1;return r===r?F?r-F:r:0}function zY(o){return o?Sg(cB(o),0,eA):0}function Ii(o){if(typeof o=="number")return o;if(fC(o))return rA;if(ZE(o)){var r=typeof o.valueOf=="function"?o.valueOf():o;o=ZE(r)?r+"":r}if(typeof o!="string")return o===0?o:+o;o=Ri(o);var F=wB.test(o);return F||_B.test(o)?Zw(o.slice(2),F?2:8):NB.test(o)?rA:+o}function _Y(o){return yg(o,eC(o))}function Aj(o){return o?Sg(cB(o),-aA,aA):o===0?o:0}function QE(o){return o==null?"":a(o)}var Qj=Fa(function(o,r){if(ic(r)||tC(r)){yg(r,xg(r),o);return}for(var F in r)KB.call(r,F)&&Me(o,F,r[F])}),$Y=Fa(function(o,r){yg(r,eC(r),o)}),cG=Fa(function(o,r,F,J){yg(r,eC(r),o,J)}),Bj=Fa(function(o,r,F,J){yg(r,xg(r),o,J)}),Ej=Ue(rn);function gj(o,r){var F=we(o);return r==null?F:xi(F,r)}var Ij=EB(function(o,r){o=VB(o);var F=-1,J=r.length,T=J>2?r[2]:B;for(T&&xI(r[0],r[1],T)&&(J=1);++F1),z}),yg(o,AF(o),F),J&&(F=zE(F,w|D|c,wP));for(var T=r.length;T--;)K(F,r[T]);return F});function kj(o,r){return QH(o,aG(qQ(r)))}var Fj=Ue(function(o,r){return o==null?{}:Ac(o,r)});function QH(o,r){if(o==null)return{};var F=WB(AF(o),function(J){return[J]});return r=qQ(r),Qc(o,F,function(J,T){return r(J,T[0])})}function dj(o,r,F){r=TQ(r,o);var J=-1,T=r.length;for(T||(T=1,o=B);++Jr){var J=o;o=r,r=J}if(F||o%1||r%1){var T=_();return H(o+T*(r-o+Qa("1e-"+((T+"").length-1))),r)}return yI(o,r)}var Lj=da(function(o,r,F){return r=r.toLowerCase(),o+(F?gH(r):r)});function gH(o){return wF(QE(o).toLowerCase())}function IH(o){return o=QE(o),o&&o.replace(_I,gC).replace(Do,"")}function Jj(o,r,F){o=QE(o),r=a(r);var J=o.length;F=F===B?J:Sg(cB(F),0,J);var T=F;return F-=r.length,F>=0&&o.slice(F,T)==r}function Sj(o){return o=QE(o),o&&Ng.test(o)?o.replace(FB,ga):o}function Zj(o){return o=QE(o),o&&Ee.test(o)?o.replace(DI,"\\$&"):o}var xj=da(function(o,r,F){return o+(F?"-":"")+r.toLowerCase()}),bj=da(function(o,r,F){return o+(F?" ":"")+r.toLowerCase()}),Tj=tY("toLowerCase");function vj(o,r,F){o=QE(o),r=cB(r);var J=r?wE(o):0;if(!r||J>=r)return o;var T=(r-J)/2;return IG(re(T),F)+o+IG(Qi(T),F)}function Pj(o,r,F){o=QE(o),r=cB(r);var J=r?wE(o):0;return r&&J>>0,F?(o=QE(o),o&&(typeof r=="string"||r!=null&&!DF(r))&&(r=a(r),!r&&Yi(o))?uB(Lg(o),0,F):o.split(r,F)):[]}var zj=da(function(o,r,F){return o+(F?" ":"")+wF(r)});function _j(o,r,F){return o=QE(o),F=F==null?0:Sg(cB(F),0,o.length),r=a(r),o.slice(F,F+r.length)==r}function $j(o,r,F){var J=j.templateSettings;F&&xI(o,r,F)&&(r=B),o=QE(o),r=cG({},r,J,rY);var T=cG({},r.imports,J.imports,rY),z=xg(T),tA=te(T,z),wA,kA,vA=0,WA=r.interpolate||ig,qA="__p += '",wQ=mi((r.escape||ig).source+"|"+WA.source+"|"+(WA===jC?DB:ig).source+"|"+(r.evaluate||ig).source+"|$","g"),RQ="//# sourceURL="+(KB.call(r,"sourceURL")?(r.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Aa+"]")+`
+`;o.replace(wQ,function($Q,UB,LB,uC,bI,RC){return LB||(LB=uC),qA+=o.slice(vA,RC).replace(HE,Ia),UB&&(wA=!0,qA+=`' +
+__e(`+UB+`) +
+'`),bI&&(kA=!0,qA+=`';
+`+bI+`;
+__p += '`),LB&&(qA+=`' +
+((__t = (`+LB+`)) == null ? '' : __t) +
+'`),vA=RC+$Q.length,$Q}),qA+=`';
+`;var _Q=KB.call(r,"variable")&&r.variable;if(!_Q)qA=`with (obj) {
+`+qA+`
+}
+`;else if(XQ.test(_Q))throw new AB(i);qA=(kA?qA.replace(VQ,""):qA).replace(EQ,"$1").replace(jQ,"$1;"),qA="function("+(_Q||"obj")+`) {
+`+(_Q?"":`obj || (obj = {});
+`)+"var __t, __p = ''"+(wA?", __e = _.escape":"")+(kA?`, __j = Array.prototype.join;
+function print() { __p += __j.call(arguments, '') }
+`:`;
+`)+qA+`return __p
+}`;var lB=iH(function(){return kB(z,RQ+"return "+qA).apply(B,tA)});if(lB.source=qA,nF(lB))throw lB;return lB}function AX(o){return QE(o).toLowerCase()}function QX(o){return QE(o).toUpperCase()}function BX(o,r,F){if(o=QE(o),o&&(F||r===B))return Ri(o);if(!o||!(r=a(r)))return o;var J=Lg(o),T=Lg(r),z=ee(J,T),tA=EC(J,T)+1;return uB(J,z,tA).join("")}function EX(o,r,F){if(o=QE(o),o&&(F||r===B))return o.slice(0,Gt(o)+1);if(!o||!(r=a(r)))return o;var J=Lg(o),T=EC(J,Lg(r))+1;return uB(J,0,T).join("")}function gX(o,r,F){if(o=QE(o),o&&(F||r===B))return o.replace(PQ,"");if(!o||!(r=a(r)))return o;var J=Lg(o),T=ee(J,Lg(r));return uB(J,T).join("")}function IX(o,r){var F=V,J=q;if(ZE(r)){var T="separator"in r?r.separator:T;F="length"in r?cB(r.length):F,J="omission"in r?a(r.omission):J}o=QE(o);var z=o.length;if(Yi(o)){var tA=Lg(o);z=tA.length}if(F>=z)return o;var wA=F-wE(J);if(wA<1)return J;var kA=tA?uB(tA,0,wA).join(""):o.slice(0,wA);if(T===B)return kA+J;if(tA&&(wA+=kA.length-wA),DF(T)){if(o.slice(wA).search(T)){var vA,WA=kA;for(T.global||(T=mi(T.source,QE(CB.exec(T))+"g")),T.lastIndex=0;vA=T.exec(WA);)var qA=vA.index;kA=kA.slice(0,qA===B?wA:qA)}}else if(o.indexOf(a(T),wA)!=wA){var wQ=kA.lastIndexOf(T);wQ>-1&&(kA=kA.slice(0,wQ))}return kA+J}function CX(o){return o=QE(o),o&&pE.test(o)?o.replace(fB,eg):o}var iX=da(function(o,r,F){return o+(F?" ":"")+r.toUpperCase()}),wF=tY("toUpperCase");function CH(o,r,F){return o=QE(o),r=F?B:r,r===B?lo(o)?Hi(o):ho(o):o.match(r)||[]}var iH=EB(function(o,r){try{return mE(o,B,r)}catch(F){return nF(F)?F:new AB(F)}}),tX=Ue(function(o,r){return fE(r,function(F){F=pt(F),iC(o,F,oF(o[F],o))}),o});function eX(o){var r=o==null?0:o.length,F=qQ();return o=r?WB(o,function(J){if(typeof J[1]!="function")throw new Mg(C);return[F(J[0]),J[1]]}):[],EB(function(J){for(var T=-1;++TaA)return[];var F=eA,J=H(o,eA);r=qQ(r),o-=eA;for(var T=hI(J,r);++F0||r<0)?new GB(F):(o<0?F=F.takeRight(-o):o&&(F=F.drop(o)),r!==B&&(r=cB(r),F=r<0?F.dropRight(-r):F.take(r-o)),F)},GB.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},GB.prototype.toArray=function(){return this.take(eA)},lg(GB.prototype,function(o,r){var F=/^(?:filter|find|map|reject)|While$/.test(r),J=/^(?:head|last)$/.test(r),T=j[J?"take"+(r=="last"?"Right":""):r],z=J||/^find/.test(r);!T||(j.prototype[r]=function(){var tA=this.__wrapped__,wA=J?[1]:arguments,kA=tA instanceof GB,vA=wA[0],WA=kA||aB(tA),qA=function(UB){var LB=T.apply(j,FC([UB],wA));return J&&wQ?LB[0]:LB};WA&&F&&typeof vA=="function"&&vA.length!=1&&(kA=WA=!1);var wQ=this.__chain__,RQ=!!this.__actions__.length,_Q=z&&!wQ,lB=kA&&!RQ;if(!z&&WA){tA=lB?tA:new GB(this);var $Q=o.apply(tA,wA);return $Q.__actions__.push({func:oG,args:[qA],thisArg:B}),new JI($Q,wQ)}return _Q&&lB?o.apply(this,wA):($Q=this.thru(qA),_Q?J?$Q.value()[0]:$Q.value():$Q)})}),fE(["pop","push","shift","sort","splice","unshift"],function(o){var r=se[o],F=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",J=/^(?:pop|shift)$/.test(o);j.prototype[o]=function(){var T=arguments;if(J&&!this.__chain__){var z=this.value();return r.apply(aB(z)?z:[],T)}return this[F](function(tA){return r.apply(aB(tA)?tA:[],T)})}}),lg(GB.prototype,function(o,r){var F=j[r];if(F){var J=F.name+"";KB.call(WQ,J)||(WQ[J]=[]),WQ[J].push({name:r,func:F})}}),WQ[EG(B,d).name]=[{name:"wrapper",func:B}],GB.prototype.clone=xw,GB.prototype.reverse=WM,GB.prototype.value=bw,j.prototype.at=JW,j.prototype.chain=SW,j.prototype.commit=ZW,j.prototype.next=xW,j.prototype.plant=TW,j.prototype.reverse=vW,j.prototype.toJSON=j.prototype.valueOf=j.prototype.value=PW,j.prototype.first=j.prototype.head,Si&&(j.prototype[Si]=bW),j},hg=Ki();AC?((AC.exports=hg)._=hg,wt._=hg):KE._=hg}).call(mC)})(RB,RB.exports);/**
+ * @license
+ * Copyright 2010-2022 Three.js Authors
+ * SPDX-License-Identifier: MIT
+ */const by="141",Z3={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},x3={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ux=0,MU=1,Rx=2,b3=3,T3=0,oR=1,sR=2,Dr=3,wD=0,ZC=1,us=2,Nx=1,v3=2,ze=0,gD=1,GU=2,lU=3,yU=4,Yx=5,vn=100,Hx=101,Kx=102,kU=103,FU=104,mx=200,Lx=201,Jx=202,Sx=203,nR=204,DR=205,Zx=206,xx=207,bx=208,Tx=209,vx=210,Px=0,Wx=1,Vx=2,O0=3,jx=4,Xx=5,qx=6,Ox=7,FM=0,zx=1,_x=2,It=0,$x=1,Ab=2,Qb=3,aR=4,Bb=5,dM=300,Rs=301,Ns=302,Lh=303,Jh=304,hw=306,Sh=1e3,eI=1001,Zh=1002,Bg=1003,z0=1004,P3=1004,_0=1005,W3=1005,jE=1006,rR=1007,V3=1007,JD=1008,j3=1008,yi=1009,Eb=1010,gb=1011,wR=1012,Ib=1013,Cs=1014,gt=1015,cD=1016,Cb=1017,ib=1018,ID=1020,tb=1021,eb=1022,aC=1023,ob=1024,sb=1025,Ms=1026,hD=1027,Ty=1028,nb=1029,Db=1030,ab=1031,rb=1033,zl=33776,_l=33777,$l=33778,A0=33779,dU=35840,pU=35841,UU=35842,fU=35843,wb=36196,uU=37492,RU=37496,NU=37808,YU=37809,HU=37810,KU=37811,mU=37812,LU=37813,JU=37814,SU=37815,ZU=37816,xU=37817,bU=37818,TU=37819,vU=37820,PU=37821,WU=36492,cb=2200,hb=2201,Mb=2202,xh=2300,bh=2301,Q0=2302,On=2400,zn=2401,Th=2402,vy=2500,cR=2501,X3=0,q3=1,O3=2,Xt=3e3,hE=3001,Gb=3200,lb=3201,SD=0,yb=1,z3="",Rt="srgb",is="srgb-linear",_3=0,B0=7680,$3=7681,A9=7682,Q9=7683,B9=34055,E9=34056,g9=5386,I9=512,C9=513,i9=514,t9=515,e9=516,o9=517,s9=518,kb=519,$0=35044,n9=35048,D9=35040,a9=35045,r9=35049,w9=35041,c9=35046,h9=35050,M9=35042,G9="100",VU="300 es",Ay=1035;class Ts{addEventListener(A,B){this._listeners===void 0&&(this._listeners={});const E=this._listeners;E[A]===void 0&&(E[A]=[]),E[A].indexOf(B)===-1&&E[A].push(B)}hasEventListener(A,B){if(this._listeners===void 0)return!1;const E=this._listeners;return E[A]!==void 0&&E[A].indexOf(B)!==-1}removeEventListener(A,B){if(this._listeners===void 0)return;const g=this._listeners[A];if(g!==void 0){const I=g.indexOf(B);I!==-1&&g.splice(I,1)}}dispatchEvent(A){if(this._listeners===void 0)return;const E=this._listeners[A.type];if(E!==void 0){A.target=this;const g=E.slice(0);for(let I=0,C=g.length;I>8&255]+CI[Q>>16&255]+CI[Q>>24&255]+"-"+CI[A&255]+CI[A>>8&255]+"-"+CI[A>>16&15|64]+CI[A>>24&255]+"-"+CI[B&63|128]+CI[B>>8&255]+"-"+CI[B>>16&255]+CI[B>>24&255]+CI[E&255]+CI[E>>8&255]+CI[E>>16&255]+CI[E>>24&255]).toLowerCase()}function Eg(Q,A,B){return Math.max(A,Math.min(B,Q))}function hR(Q,A){return(Q%A+A)%A}function l9(Q,A,B,E,g){return E+(Q-A)*(g-E)/(B-A)}function y9(Q,A,B){return Q!==A?(B-Q)/(A-Q):0}function sh(Q,A,B){return(1-B)*Q+B*A}function k9(Q,A,B,E){return sh(Q,A,1-Math.exp(-B*E))}function F9(Q,A=1){return A-Math.abs(hR(Q,A*2)-A)}function d9(Q,A,B){return Q<=A?0:Q>=B?1:(Q=(Q-A)/(B-A),Q*Q*(3-2*Q))}function p9(Q,A,B){return Q<=A?0:Q>=B?1:(Q=(Q-A)/(B-A),Q*Q*Q*(Q*(Q*6-15)+10))}function U9(Q,A){return Q+Math.floor(Math.random()*(A-Q+1))}function f9(Q,A){return Q+Math.random()*(A-Q)}function u9(Q){return Q*(.5-Math.random())}function R9(Q){Q!==void 0&&(mK=Q);let A=mK+=1831565813;return A=Math.imul(A^A>>>15,A|1),A^=A+Math.imul(A^A>>>7,A|61),((A^A>>>14)>>>0)/4294967296}function N9(Q){return Q*CD}function Y9(Q){return Q*vh}function jU(Q){return(Q&Q-1)===0&&Q!==0}function Fb(Q){return Math.pow(2,Math.ceil(Math.log(Q)/Math.LN2))}function Qy(Q){return Math.pow(2,Math.floor(Math.log(Q)/Math.LN2))}function H9(Q,A,B,E,g){const I=Math.cos,C=Math.sin,i=I(B/2),t=C(B/2),e=I((A+E)/2),n=C((A+E)/2),w=I((A-E)/2),D=C((A-E)/2),c=I((E-A)/2),G=C((E-A)/2);switch(g){case"XYX":Q.set(i*n,t*w,t*D,i*e);break;case"YZY":Q.set(t*D,i*n,t*w,i*e);break;case"ZXZ":Q.set(t*w,t*D,i*n,i*e);break;case"XZX":Q.set(i*n,t*G,t*c,i*e);break;case"YXY":Q.set(t*c,i*n,t*G,i*e);break;case"ZYZ":Q.set(t*G,t*c,i*n,i*e);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+g)}}function K9(Q,A){switch(A.constructor){case Float32Array:return Q;case Uint16Array:return Q/65535;case Uint8Array:return Q/255;case Int16Array:return Math.max(Q/32767,-1);case Int8Array:return Math.max(Q/127,-1);default:throw new Error("Invalid component type.")}}function m9(Q,A){switch(A.constructor){case Float32Array:return Q;case Uint16Array:return Math.round(Q*65535);case Uint8Array:return Math.round(Q*255);case Int16Array:return Math.round(Q*32767);case Int8Array:return Math.round(Q*127);default:throw new Error("Invalid component type.")}}var L9=Object.freeze({__proto__:null,DEG2RAD:CD,RAD2DEG:vh,generateUUID:xC,clamp:Eg,euclideanModulo:hR,mapLinear:l9,inverseLerp:y9,lerp:sh,damp:k9,pingpong:F9,smoothstep:d9,smootherstep:p9,randInt:U9,randFloat:f9,randFloatSpread:u9,seededRandom:R9,degToRad:N9,radToDeg:Y9,isPowerOfTwo:jU,ceilPowerOfTwo:Fb,floorPowerOfTwo:Qy,setQuaternionFromProperEuler:H9,normalize:m9,denormalize:K9});class XA{constructor(A=0,B=0){this.isVector2=!0,this.x=A,this.y=B}get width(){return this.x}set width(A){this.x=A}get height(){return this.y}set height(A){this.y=A}set(A,B){return this.x=A,this.y=B,this}setScalar(A){return this.x=A,this.y=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setComponent(A,B){switch(A){case 0:this.x=B;break;case 1:this.y=B;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y)}copy(A){return this.x=A.x,this.y=A.y,this}add(A,B){return B!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(A,B)):(this.x+=A.x,this.y+=A.y,this)}addScalar(A){return this.x+=A,this.y+=A,this}addVectors(A,B){return this.x=A.x+B.x,this.y=A.y+B.y,this}addScaledVector(A,B){return this.x+=A.x*B,this.y+=A.y*B,this}sub(A,B){return B!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(A,B)):(this.x-=A.x,this.y-=A.y,this)}subScalar(A){return this.x-=A,this.y-=A,this}subVectors(A,B){return this.x=A.x-B.x,this.y=A.y-B.y,this}multiply(A){return this.x*=A.x,this.y*=A.y,this}multiplyScalar(A){return this.x*=A,this.y*=A,this}divide(A){return this.x/=A.x,this.y/=A.y,this}divideScalar(A){return this.multiplyScalar(1/A)}applyMatrix3(A){const B=this.x,E=this.y,g=A.elements;return this.x=g[0]*B+g[3]*E+g[6],this.y=g[1]*B+g[4]*E+g[7],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this}clamp(A,B){return this.x=Math.max(A.x,Math.min(B.x,this.x)),this.y=Math.max(A.y,Math.min(B.y,this.y)),this}clampScalar(A,B){return this.x=Math.max(A,Math.min(B,this.x)),this.y=Math.max(A,Math.min(B,this.y)),this}clampLength(A,B){const E=this.length();return this.divideScalar(E||1).multiplyScalar(Math.max(A,Math.min(B,E)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(A){return this.x*A.x+this.y*A.y}cross(A){return this.x*A.y-this.y*A.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}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const B=this.x-A.x,E=this.y-A.y;return B*B+E*E}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)}setLength(A){return this.normalize().multiplyScalar(A)}lerp(A,B){return this.x+=(A.x-this.x)*B,this.y+=(A.y-this.y)*B,this}lerpVectors(A,B,E){return this.x=A.x+(B.x-A.x)*E,this.y=A.y+(B.y-A.y)*E,this}equals(A){return A.x===this.x&&A.y===this.y}fromArray(A,B=0){return this.x=A[B],this.y=A[B+1],this}toArray(A=[],B=0){return A[B]=this.x,A[B+1]=this.y,A}fromBufferAttribute(A,B,E){return E!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=A.getX(B),this.y=A.getY(B),this}rotateAround(A,B){const E=Math.cos(B),g=Math.sin(B),I=this.x-A.x,C=this.y-A.y;return this.x=I*E-C*g+A.x,this.y=I*g+C*E+A.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class wi{constructor(){this.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}set(A,B,E,g,I,C,i,t,e){const n=this.elements;return n[0]=A,n[1]=g,n[2]=i,n[3]=B,n[4]=I,n[5]=t,n[6]=E,n[7]=C,n[8]=e,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(A){const B=this.elements,E=A.elements;return B[0]=E[0],B[1]=E[1],B[2]=E[2],B[3]=E[3],B[4]=E[4],B[5]=E[5],B[6]=E[6],B[7]=E[7],B[8]=E[8],this}extractBasis(A,B,E){return A.setFromMatrix3Column(this,0),B.setFromMatrix3Column(this,1),E.setFromMatrix3Column(this,2),this}setFromMatrix4(A){const B=A.elements;return this.set(B[0],B[4],B[8],B[1],B[5],B[9],B[2],B[6],B[10]),this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,B){const E=A.elements,g=B.elements,I=this.elements,C=E[0],i=E[3],t=E[6],e=E[1],n=E[4],w=E[7],D=E[2],c=E[5],G=E[8],l=g[0],M=g[3],d=g[6],p=g[1],R=g[4],u=g[7],f=g[2],m=g[5],x=g[8];return I[0]=C*l+i*p+t*f,I[3]=C*M+i*R+t*m,I[6]=C*d+i*u+t*x,I[1]=e*l+n*p+w*f,I[4]=e*M+n*R+w*m,I[7]=e*d+n*u+w*x,I[2]=D*l+c*p+G*f,I[5]=D*M+c*R+G*m,I[8]=D*d+c*u+G*x,this}multiplyScalar(A){const B=this.elements;return B[0]*=A,B[3]*=A,B[6]*=A,B[1]*=A,B[4]*=A,B[7]*=A,B[2]*=A,B[5]*=A,B[8]*=A,this}determinant(){const A=this.elements,B=A[0],E=A[1],g=A[2],I=A[3],C=A[4],i=A[5],t=A[6],e=A[7],n=A[8];return B*C*n-B*i*e-E*I*n+E*i*t+g*I*e-g*C*t}invert(){const A=this.elements,B=A[0],E=A[1],g=A[2],I=A[3],C=A[4],i=A[5],t=A[6],e=A[7],n=A[8],w=n*C-i*e,D=i*t-n*I,c=e*I-C*t,G=B*w+E*D+g*c;if(G===0)return this.set(0,0,0,0,0,0,0,0,0);const l=1/G;return A[0]=w*l,A[1]=(g*e-n*E)*l,A[2]=(i*E-g*C)*l,A[3]=D*l,A[4]=(n*B-g*t)*l,A[5]=(g*I-i*B)*l,A[6]=c*l,A[7]=(E*t-e*B)*l,A[8]=(C*B-E*I)*l,this}transpose(){let A;const B=this.elements;return A=B[1],B[1]=B[3],B[3]=A,A=B[2],B[2]=B[6],B[6]=A,A=B[5],B[5]=B[7],B[7]=A,this}getNormalMatrix(A){return this.setFromMatrix4(A).invert().transpose()}transposeIntoArray(A){const B=this.elements;return A[0]=B[0],A[1]=B[3],A[2]=B[6],A[3]=B[1],A[4]=B[4],A[5]=B[7],A[6]=B[2],A[7]=B[5],A[8]=B[8],this}setUvTransform(A,B,E,g,I,C,i){const t=Math.cos(I),e=Math.sin(I);return this.set(E*t,E*e,-E*(t*C+e*i)+C+A,-g*e,g*t,-g*(-e*C+t*i)+i+B,0,0,1),this}scale(A,B){const E=this.elements;return E[0]*=A,E[3]*=A,E[6]*=A,E[1]*=B,E[4]*=B,E[7]*=B,this}rotate(A){const B=Math.cos(A),E=Math.sin(A),g=this.elements,I=g[0],C=g[3],i=g[6],t=g[1],e=g[4],n=g[7];return g[0]=B*I+E*t,g[3]=B*C+E*e,g[6]=B*i+E*n,g[1]=-E*I+B*t,g[4]=-E*C+B*e,g[7]=-E*i+B*n,this}translate(A,B){const E=this.elements;return E[0]+=A*E[2],E[3]+=A*E[5],E[6]+=A*E[8],E[1]+=B*E[2],E[4]+=B*E[5],E[7]+=B*E[8],this}equals(A){const B=this.elements,E=A.elements;for(let g=0;g<9;g++)if(B[g]!==E[g])return!1;return!0}fromArray(A,B=0){for(let E=0;E<9;E++)this.elements[E]=A[E+B];return this}toArray(A=[],B=0){const E=this.elements;return A[B]=E[0],A[B+1]=E[1],A[B+2]=E[2],A[B+3]=E[3],A[B+4]=E[4],A[B+5]=E[5],A[B+6]=E[6],A[B+7]=E[7],A[B+8]=E[8],A}clone(){return new this.constructor().fromArray(this.elements)}}function db(Q){for(let A=Q.length-1;A>=0;--A)if(Q[A]>65535)return!0;return!1}const J9={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function ar(Q,A){return new J9[Q](A)}function Ph(Q){return document.createElementNS("http://www.w3.org/1999/xhtml",Q)}function iD(Q){return Q<.04045?Q*.0773993808:Math.pow(Q*.9478672986+.0521327014,2.4)}function E0(Q){return Q<.0031308?Q*12.92:1.055*Math.pow(Q,.41666)-.055}const zF={[Rt]:{[is]:iD},[is]:{[Rt]:E0}},ei={legacyMode:!0,get workingColorSpace(){return is},set workingColorSpace(Q){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(Q,A,B){if(this.legacyMode||A===B||!A||!B)return Q;if(zF[A]&&zF[A][B]!==void 0){const E=zF[A][B];return Q.r=E(Q.r),Q.g=E(Q.g),Q.b=E(Q.b),Q}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(Q,A){return this.convert(Q,this.workingColorSpace,A)},toWorkingColorSpace:function(Q,A){return this.convert(Q,A,this.workingColorSpace)}},pb={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},kg={r:0,g:0,b:0},ji={h:0,s:0,l:0},NG={h:0,s:0,l:0};function _F(Q,A,B){return B<0&&(B+=1),B>1&&(B-=1),B<1/6?Q+(A-Q)*6*B:B<1/2?A:B<2/3?Q+(A-Q)*6*(2/3-B):Q}function YG(Q,A){return A.r=Q.r,A.g=Q.g,A.b=Q.b,A}class FQ{constructor(A,B,E){return this.isColor=!0,this.r=1,this.g=1,this.b=1,B===void 0&&E===void 0?this.set(A):this.setRGB(A,B,E)}set(A){return A&&A.isColor?this.copy(A):typeof A=="number"?this.setHex(A):typeof A=="string"&&this.setStyle(A),this}setScalar(A){return this.r=A,this.g=A,this.b=A,this}setHex(A,B=Rt){return A=Math.floor(A),this.r=(A>>16&255)/255,this.g=(A>>8&255)/255,this.b=(A&255)/255,ei.toWorkingColorSpace(this,B),this}setRGB(A,B,E,g=is){return this.r=A,this.g=B,this.b=E,ei.toWorkingColorSpace(this,g),this}setHSL(A,B,E,g=is){if(A=hR(A,1),B=Eg(B,0,1),E=Eg(E,0,1),B===0)this.r=this.g=this.b=E;else{const I=E<=.5?E*(1+B):E+B-E*B,C=2*E-I;this.r=_F(C,I,A+1/3),this.g=_F(C,I,A),this.b=_F(C,I,A-1/3)}return ei.toWorkingColorSpace(this,g),this}setStyle(A,B=Rt){function E(I){I!==void 0&&parseFloat(I)<1&&console.warn("THREE.Color: Alpha component of "+A+" will be ignored.")}let g;if(g=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(A)){let I;const C=g[1],i=g[2];switch(C){case"rgb":case"rgba":if(I=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(255,parseInt(I[1],10))/255,this.g=Math.min(255,parseInt(I[2],10))/255,this.b=Math.min(255,parseInt(I[3],10))/255,ei.toWorkingColorSpace(this,B),E(I[4]),this;if(I=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i))return this.r=Math.min(100,parseInt(I[1],10))/100,this.g=Math.min(100,parseInt(I[2],10))/100,this.b=Math.min(100,parseInt(I[3],10))/100,ei.toWorkingColorSpace(this,B),E(I[4]),this;break;case"hsl":case"hsla":if(I=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(i)){const t=parseFloat(I[1])/360,e=parseInt(I[2],10)/100,n=parseInt(I[3],10)/100;return E(I[4]),this.setHSL(t,e,n,B)}break}}else if(g=/^\#([A-Fa-f\d]+)$/.exec(A)){const I=g[1],C=I.length;if(C===3)return this.r=parseInt(I.charAt(0)+I.charAt(0),16)/255,this.g=parseInt(I.charAt(1)+I.charAt(1),16)/255,this.b=parseInt(I.charAt(2)+I.charAt(2),16)/255,ei.toWorkingColorSpace(this,B),this;if(C===6)return this.r=parseInt(I.charAt(0)+I.charAt(1),16)/255,this.g=parseInt(I.charAt(2)+I.charAt(3),16)/255,this.b=parseInt(I.charAt(4)+I.charAt(5),16)/255,ei.toWorkingColorSpace(this,B),this}return A&&A.length>0?this.setColorName(A,B):this}setColorName(A,B=Rt){const E=pb[A.toLowerCase()];return E!==void 0?this.setHex(E,B):console.warn("THREE.Color: Unknown color "+A),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(A){return this.r=A.r,this.g=A.g,this.b=A.b,this}copySRGBToLinear(A){return this.r=iD(A.r),this.g=iD(A.g),this.b=iD(A.b),this}copyLinearToSRGB(A){return this.r=E0(A.r),this.g=E0(A.g),this.b=E0(A.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(A=Rt){return ei.fromWorkingColorSpace(YG(this,kg),A),Eg(kg.r*255,0,255)<<16^Eg(kg.g*255,0,255)<<8^Eg(kg.b*255,0,255)<<0}getHexString(A=Rt){return("000000"+this.getHex(A).toString(16)).slice(-6)}getHSL(A,B=is){ei.fromWorkingColorSpace(YG(this,kg),B);const E=kg.r,g=kg.g,I=kg.b,C=Math.max(E,g,I),i=Math.min(E,g,I);let t,e;const n=(i+C)/2;if(i===C)t=0,e=0;else{const w=C-i;switch(e=n<=.5?w/(C+i):w/(2-C-i),C){case E:t=(g-I)/w+(g"u")return A.src;let B;if(A instanceof HTMLCanvasElement)B=A;else{Na===void 0&&(Na=Ph("canvas")),Na.width=A.width,Na.height=A.height;const E=Na.getContext("2d");A instanceof ImageData?E.putImageData(A,0,0):E.drawImage(A,0,0,A.width,A.height),B=Na}return B.width>2048||B.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",A),B.toDataURL("image/jpeg",.6)):B.toDataURL("image/png")}static sRGBToLinear(A){if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){const B=Ph("canvas");B.width=A.width,B.height=A.height;const E=B.getContext("2d");E.drawImage(A,0,0,A.width,A.height);const g=E.getImageData(0,0,A.width,A.height),I=g.data;for(let C=0;C1)switch(this.wrapS){case Sh:A.x=A.x-Math.floor(A.x);break;case eI:A.x=A.x<0?0:1;break;case Zh:Math.abs(Math.floor(A.x)%2)===1?A.x=Math.ceil(A.x)-A.x:A.x=A.x-Math.floor(A.x);break}if(A.y<0||A.y>1)switch(this.wrapT){case Sh:A.y=A.y-Math.floor(A.y);break;case eI:A.y=A.y<0?0:1;break;case Zh:Math.abs(Math.floor(A.y)%2)===1?A.y=Math.ceil(A.y)-A.y:A.y=A.y-Math.floor(A.y);break}return this.flipY&&(A.y=1-A.y),A}set needsUpdate(A){A===!0&&(this.version++,this.source.needsUpdate=!0)}}sg.DEFAULT_IMAGE=null;sg.DEFAULT_MAPPING=dM;class IE{constructor(A=0,B=0,E=0,g=1){this.isVector4=!0,this.x=A,this.y=B,this.z=E,this.w=g}get width(){return this.z}set width(A){this.z=A}get height(){return this.w}set height(A){this.w=A}set(A,B,E,g){return this.x=A,this.y=B,this.z=E,this.w=g,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this.w=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setW(A){return this.w=A,this}setComponent(A,B){switch(A){case 0:this.x=B;break;case 1:this.y=B;break;case 2:this.z=B;break;case 3:this.w=B;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this.w=A.w!==void 0?A.w:1,this}add(A,B){return B!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(A,B)):(this.x+=A.x,this.y+=A.y,this.z+=A.z,this.w+=A.w,this)}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this.w+=A,this}addVectors(A,B){return this.x=A.x+B.x,this.y=A.y+B.y,this.z=A.z+B.z,this.w=A.w+B.w,this}addScaledVector(A,B){return this.x+=A.x*B,this.y+=A.y*B,this.z+=A.z*B,this.w+=A.w*B,this}sub(A,B){return B!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(A,B)):(this.x-=A.x,this.y-=A.y,this.z-=A.z,this.w-=A.w,this)}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this.w-=A,this}subVectors(A,B){return this.x=A.x-B.x,this.y=A.y-B.y,this.z=A.z-B.z,this.w=A.w-B.w,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this.w*=A.w,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this.w*=A,this}applyMatrix4(A){const B=this.x,E=this.y,g=this.z,I=this.w,C=A.elements;return this.x=C[0]*B+C[4]*E+C[8]*g+C[12]*I,this.y=C[1]*B+C[5]*E+C[9]*g+C[13]*I,this.z=C[2]*B+C[6]*E+C[10]*g+C[14]*I,this.w=C[3]*B+C[7]*E+C[11]*g+C[15]*I,this}divideScalar(A){return this.multiplyScalar(1/A)}setAxisAngleFromQuaternion(A){this.w=2*Math.acos(A.w);const B=Math.sqrt(1-A.w*A.w);return B<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=A.x/B,this.y=A.y/B,this.z=A.z/B),this}setAxisAngleFromRotationMatrix(A){let B,E,g,I;const t=A.elements,e=t[0],n=t[4],w=t[8],D=t[1],c=t[5],G=t[9],l=t[2],M=t[6],d=t[10];if(Math.abs(n-D)<.01&&Math.abs(w-l)<.01&&Math.abs(G-M)<.01){if(Math.abs(n+D)<.1&&Math.abs(w+l)<.1&&Math.abs(G+M)<.1&&Math.abs(e+c+d-3)<.1)return this.set(1,0,0,0),this;B=Math.PI;const R=(e+1)/2,u=(c+1)/2,f=(d+1)/2,m=(n+D)/4,x=(w+l)/4,L=(G+M)/4;return R>u&&R>f?R<.01?(E=0,g=.707106781,I=.707106781):(E=Math.sqrt(R),g=m/E,I=x/E):u>f?u<.01?(E=.707106781,g=0,I=.707106781):(g=Math.sqrt(u),E=m/g,I=L/g):f<.01?(E=.707106781,g=.707106781,I=0):(I=Math.sqrt(f),E=x/I,g=L/I),this.set(E,g,I,B),this}let p=Math.sqrt((M-G)*(M-G)+(w-l)*(w-l)+(D-n)*(D-n));return Math.abs(p)<.001&&(p=1),this.x=(M-G)/p,this.y=(w-l)/p,this.z=(D-n)/p,this.w=Math.acos((e+c+d-1)/2),this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this.w=Math.min(this.w,A.w),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this.w=Math.max(this.w,A.w),this}clamp(A,B){return this.x=Math.max(A.x,Math.min(B.x,this.x)),this.y=Math.max(A.y,Math.min(B.y,this.y)),this.z=Math.max(A.z,Math.min(B.z,this.z)),this.w=Math.max(A.w,Math.min(B.w,this.w)),this}clampScalar(A,B){return this.x=Math.max(A,Math.min(B,this.x)),this.y=Math.max(A,Math.min(B,this.y)),this.z=Math.max(A,Math.min(B,this.z)),this.w=Math.max(A,Math.min(B,this.w)),this}clampLength(A,B){const E=this.length();return this.divideScalar(E||1).multiplyScalar(Math.max(A,Math.min(B,E)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(A){return this.x*A.x+this.y*A.y+this.z*A.z+this.w*A.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(A){return this.normalize().multiplyScalar(A)}lerp(A,B){return this.x+=(A.x-this.x)*B,this.y+=(A.y-this.y)*B,this.z+=(A.z-this.z)*B,this.w+=(A.w-this.w)*B,this}lerpVectors(A,B,E){return this.x=A.x+(B.x-A.x)*E,this.y=A.y+(B.y-A.y)*E,this.z=A.z+(B.z-A.z)*E,this.w=A.w+(B.w-A.w)*E,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z&&A.w===this.w}fromArray(A,B=0){return this.x=A[B],this.y=A[B+1],this.z=A[B+2],this.w=A[B+3],this}toArray(A=[],B=0){return A[B]=this.x,A[B+1]=this.y,A[B+2]=this.z,A[B+3]=this.w,A}fromBufferAttribute(A,B,E){return E!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=A.getX(B),this.y=A.getY(B),this.z=A.getZ(B),this.w=A.getW(B),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 bC extends Ts{constructor(A,B,E={}){super(),this.isWebGLRenderTarget=!0,this.width=A,this.height=B,this.depth=1,this.scissor=new IE(0,0,A,B),this.scissorTest=!1,this.viewport=new IE(0,0,A,B);const g={width:A,height:B,depth:1};this.texture=new sg(g,E.mapping,E.wrapS,E.wrapT,E.magFilter,E.minFilter,E.format,E.type,E.anisotropy,E.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=E.generateMipmaps!==void 0?E.generateMipmaps:!1,this.texture.internalFormat=E.internalFormat!==void 0?E.internalFormat:null,this.texture.minFilter=E.minFilter!==void 0?E.minFilter:jE,this.depthBuffer=E.depthBuffer!==void 0?E.depthBuffer:!0,this.stencilBuffer=E.stencilBuffer!==void 0?E.stencilBuffer:!1,this.depthTexture=E.depthTexture!==void 0?E.depthTexture:null,this.samples=E.samples!==void 0?E.samples:0}setSize(A,B,E=1){(this.width!==A||this.height!==B||this.depth!==E)&&(this.width=A,this.height=B,this.depth=E,this.texture.image.width=A,this.texture.image.height=B,this.texture.image.depth=E,this.dispose()),this.viewport.set(0,0,A,B),this.scissor.set(0,0,A,B)}clone(){return new this.constructor().copy(this)}copy(A){this.width=A.width,this.height=A.height,this.depth=A.depth,this.viewport.copy(A.viewport),this.texture=A.texture.clone(),this.texture.isRenderTargetTexture=!0;const B=Object.assign({},A.texture.image);return this.texture.source=new _n(B),this.depthBuffer=A.depthBuffer,this.stencilBuffer=A.stencilBuffer,A.depthTexture!==null&&(this.depthTexture=A.depthTexture.clone()),this.samples=A.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class pM extends sg{constructor(A=null,B=1,E=1,g=1){super(null),this.isDataArrayTexture=!0,this.image={data:A,width:B,height:E,depth:g},this.magFilter=Bg,this.minFilter=Bg,this.wrapR=eI,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Z9 extends bC{constructor(A,B,E){super(A,B),this.isWebGLArrayRenderTarget=!0,this.depth=E,this.texture=new pM(null,A,B,E),this.texture.isRenderTargetTexture=!0}}class UM extends sg{constructor(A=null,B=1,E=1,g=1){super(null),this.isData3DTexture=!0,this.image={data:A,width:B,height:E,depth:g},this.magFilter=Bg,this.minFilter=Bg,this.wrapR=eI,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class x9 extends bC{constructor(A,B,E){super(A,B),this.isWebGL3DRenderTarget=!0,this.depth=E,this.texture=new UM(null,A,B,E),this.texture.isRenderTargetTexture=!0}}class b9 extends bC{constructor(A,B,E,g={}){super(A,B,g),this.isWebGLMultipleRenderTargets=!0;const I=this.texture;this.texture=[];for(let C=0;C=0?1:-1,R=1-d*d;if(R>Number.EPSILON){const f=Math.sqrt(R),m=Math.atan2(f,d*p);M=Math.sin(M*m)/f,i=Math.sin(i*m)/f}const u=i*p;if(t=t*M+D*u,e=e*M+c*u,n=n*M+G*u,w=w*M+l*u,M===1-i){const f=1/Math.sqrt(t*t+e*e+n*n+w*w);t*=f,e*=f,n*=f,w*=f}}A[B]=t,A[B+1]=e,A[B+2]=n,A[B+3]=w}static multiplyQuaternionsFlat(A,B,E,g,I,C){const i=E[g],t=E[g+1],e=E[g+2],n=E[g+3],w=I[C],D=I[C+1],c=I[C+2],G=I[C+3];return A[B]=i*G+n*w+t*c-e*D,A[B+1]=t*G+n*D+e*w-i*c,A[B+2]=e*G+n*c+i*D-t*w,A[B+3]=n*G-i*w-t*D-e*c,A}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get w(){return this._w}set w(A){this._w=A,this._onChangeCallback()}set(A,B,E,g){return this._x=A,this._y=B,this._z=E,this._w=g,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(A){return this._x=A.x,this._y=A.y,this._z=A.z,this._w=A.w,this._onChangeCallback(),this}setFromEuler(A,B){if(!(A&&A.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const E=A._x,g=A._y,I=A._z,C=A._order,i=Math.cos,t=Math.sin,e=i(E/2),n=i(g/2),w=i(I/2),D=t(E/2),c=t(g/2),G=t(I/2);switch(C){case"XYZ":this._x=D*n*w+e*c*G,this._y=e*c*w-D*n*G,this._z=e*n*G+D*c*w,this._w=e*n*w-D*c*G;break;case"YXZ":this._x=D*n*w+e*c*G,this._y=e*c*w-D*n*G,this._z=e*n*G-D*c*w,this._w=e*n*w+D*c*G;break;case"ZXY":this._x=D*n*w-e*c*G,this._y=e*c*w+D*n*G,this._z=e*n*G+D*c*w,this._w=e*n*w-D*c*G;break;case"ZYX":this._x=D*n*w-e*c*G,this._y=e*c*w+D*n*G,this._z=e*n*G-D*c*w,this._w=e*n*w+D*c*G;break;case"YZX":this._x=D*n*w+e*c*G,this._y=e*c*w+D*n*G,this._z=e*n*G-D*c*w,this._w=e*n*w-D*c*G;break;case"XZY":this._x=D*n*w-e*c*G,this._y=e*c*w-D*n*G,this._z=e*n*G+D*c*w,this._w=e*n*w+D*c*G;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+C)}return B!==!1&&this._onChangeCallback(),this}setFromAxisAngle(A,B){const E=B/2,g=Math.sin(E);return this._x=A.x*g,this._y=A.y*g,this._z=A.z*g,this._w=Math.cos(E),this._onChangeCallback(),this}setFromRotationMatrix(A){const B=A.elements,E=B[0],g=B[4],I=B[8],C=B[1],i=B[5],t=B[9],e=B[2],n=B[6],w=B[10],D=E+i+w;if(D>0){const c=.5/Math.sqrt(D+1);this._w=.25/c,this._x=(n-t)*c,this._y=(I-e)*c,this._z=(C-g)*c}else if(E>i&&E>w){const c=2*Math.sqrt(1+E-i-w);this._w=(n-t)/c,this._x=.25*c,this._y=(g+C)/c,this._z=(I+e)/c}else if(i>w){const c=2*Math.sqrt(1+i-E-w);this._w=(I-e)/c,this._x=(g+C)/c,this._y=.25*c,this._z=(t+n)/c}else{const c=2*Math.sqrt(1+w-E-i);this._w=(C-g)/c,this._x=(I+e)/c,this._y=(t+n)/c,this._z=.25*c}return this._onChangeCallback(),this}setFromUnitVectors(A,B){let E=A.dot(B)+1;return EMath.abs(A.z)?(this._x=-A.y,this._y=A.x,this._z=0,this._w=E):(this._x=0,this._y=-A.z,this._z=A.y,this._w=E)):(this._x=A.y*B.z-A.z*B.y,this._y=A.z*B.x-A.x*B.z,this._z=A.x*B.y-A.y*B.x,this._w=E),this.normalize()}angleTo(A){return 2*Math.acos(Math.abs(Eg(this.dot(A),-1,1)))}rotateTowards(A,B){const E=this.angleTo(A);if(E===0)return this;const g=Math.min(1,B/E);return this.slerp(A,g),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(A){return this._x*A._x+this._y*A._y+this._z*A._z+this._w*A._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 A=this.length();return A===0?(this._x=0,this._y=0,this._z=0,this._w=1):(A=1/A,this._x=this._x*A,this._y=this._y*A,this._z=this._z*A,this._w=this._w*A),this._onChangeCallback(),this}multiply(A,B){return B!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(A,B)):this.multiplyQuaternions(this,A)}premultiply(A){return this.multiplyQuaternions(A,this)}multiplyQuaternions(A,B){const E=A._x,g=A._y,I=A._z,C=A._w,i=B._x,t=B._y,e=B._z,n=B._w;return this._x=E*n+C*i+g*e-I*t,this._y=g*n+C*t+I*i-E*e,this._z=I*n+C*e+E*t-g*i,this._w=C*n-E*i-g*t-I*e,this._onChangeCallback(),this}slerp(A,B){if(B===0)return this;if(B===1)return this.copy(A);const E=this._x,g=this._y,I=this._z,C=this._w;let i=C*A._w+E*A._x+g*A._y+I*A._z;if(i<0?(this._w=-A._w,this._x=-A._x,this._y=-A._y,this._z=-A._z,i=-i):this.copy(A),i>=1)return this._w=C,this._x=E,this._y=g,this._z=I,this;const t=1-i*i;if(t<=Number.EPSILON){const c=1-B;return this._w=c*C+B*this._w,this._x=c*E+B*this._x,this._y=c*g+B*this._y,this._z=c*I+B*this._z,this.normalize(),this._onChangeCallback(),this}const e=Math.sqrt(t),n=Math.atan2(e,i),w=Math.sin((1-B)*n)/e,D=Math.sin(B*n)/e;return this._w=C*w+this._w*D,this._x=E*w+this._x*D,this._y=g*w+this._y*D,this._z=I*w+this._z*D,this._onChangeCallback(),this}slerpQuaternions(A,B,E){return this.copy(A).slerp(B,E)}random(){const A=Math.random(),B=Math.sqrt(1-A),E=Math.sqrt(A),g=2*Math.PI*Math.random(),I=2*Math.PI*Math.random();return this.set(B*Math.cos(g),E*Math.sin(I),E*Math.cos(I),B*Math.sin(g))}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._w===this._w}fromArray(A,B=0){return this._x=A[B],this._y=A[B+1],this._z=A[B+2],this._w=A[B+3],this._onChangeCallback(),this}toArray(A=[],B=0){return A[B]=this._x,A[B+1]=this._y,A[B+2]=this._z,A[B+3]=this._w,A}fromBufferAttribute(A,B){return this._x=A.getX(B),this._y=A.getY(B),this._z=A.getZ(B),this._w=A.getW(B),this}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class QA{constructor(A=0,B=0,E=0){this.isVector3=!0,this.x=A,this.y=B,this.z=E}set(A,B,E){return E===void 0&&(E=this.z),this.x=A,this.y=B,this.z=E,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setComponent(A,B){switch(A){case 0:this.x=B;break;case 1:this.y=B;break;case 2:this.z=B;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this}add(A,B){return B!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(A,B)):(this.x+=A.x,this.y+=A.y,this.z+=A.z,this)}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this}addVectors(A,B){return this.x=A.x+B.x,this.y=A.y+B.y,this.z=A.z+B.z,this}addScaledVector(A,B){return this.x+=A.x*B,this.y+=A.y*B,this.z+=A.z*B,this}sub(A,B){return B!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(A,B)):(this.x-=A.x,this.y-=A.y,this.z-=A.z,this)}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this}subVectors(A,B){return this.x=A.x-B.x,this.y=A.y-B.y,this.z=A.z-B.z,this}multiply(A,B){return B!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(A,B)):(this.x*=A.x,this.y*=A.y,this.z*=A.z,this)}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this}multiplyVectors(A,B){return this.x=A.x*B.x,this.y=A.y*B.y,this.z=A.z*B.z,this}applyEuler(A){return A&&A.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(LK.setFromEuler(A))}applyAxisAngle(A,B){return this.applyQuaternion(LK.setFromAxisAngle(A,B))}applyMatrix3(A){const B=this.x,E=this.y,g=this.z,I=A.elements;return this.x=I[0]*B+I[3]*E+I[6]*g,this.y=I[1]*B+I[4]*E+I[7]*g,this.z=I[2]*B+I[5]*E+I[8]*g,this}applyNormalMatrix(A){return this.applyMatrix3(A).normalize()}applyMatrix4(A){const B=this.x,E=this.y,g=this.z,I=A.elements,C=1/(I[3]*B+I[7]*E+I[11]*g+I[15]);return this.x=(I[0]*B+I[4]*E+I[8]*g+I[12])*C,this.y=(I[1]*B+I[5]*E+I[9]*g+I[13])*C,this.z=(I[2]*B+I[6]*E+I[10]*g+I[14])*C,this}applyQuaternion(A){const B=this.x,E=this.y,g=this.z,I=A.x,C=A.y,i=A.z,t=A.w,e=t*B+C*g-i*E,n=t*E+i*B-I*g,w=t*g+I*E-C*B,D=-I*B-C*E-i*g;return this.x=e*t+D*-I+n*-i-w*-C,this.y=n*t+D*-C+w*-I-e*-i,this.z=w*t+D*-i+e*-C-n*-I,this}project(A){return this.applyMatrix4(A.matrixWorldInverse).applyMatrix4(A.projectionMatrix)}unproject(A){return this.applyMatrix4(A.projectionMatrixInverse).applyMatrix4(A.matrixWorld)}transformDirection(A){const B=this.x,E=this.y,g=this.z,I=A.elements;return this.x=I[0]*B+I[4]*E+I[8]*g,this.y=I[1]*B+I[5]*E+I[9]*g,this.z=I[2]*B+I[6]*E+I[10]*g,this.normalize()}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this}divideScalar(A){return this.multiplyScalar(1/A)}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this}clamp(A,B){return this.x=Math.max(A.x,Math.min(B.x,this.x)),this.y=Math.max(A.y,Math.min(B.y,this.y)),this.z=Math.max(A.z,Math.min(B.z,this.z)),this}clampScalar(A,B){return this.x=Math.max(A,Math.min(B,this.x)),this.y=Math.max(A,Math.min(B,this.y)),this.z=Math.max(A,Math.min(B,this.z)),this}clampLength(A,B){const E=this.length();return this.divideScalar(E||1).multiplyScalar(Math.max(A,Math.min(B,E)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(A){return this.x*A.x+this.y*A.y+this.z*A.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(A){return this.normalize().multiplyScalar(A)}lerp(A,B){return this.x+=(A.x-this.x)*B,this.y+=(A.y-this.y)*B,this.z+=(A.z-this.z)*B,this}lerpVectors(A,B,E){return this.x=A.x+(B.x-A.x)*E,this.y=A.y+(B.y-A.y)*E,this.z=A.z+(B.z-A.z)*E,this}cross(A,B){return B!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(A,B)):this.crossVectors(this,A)}crossVectors(A,B){const E=A.x,g=A.y,I=A.z,C=B.x,i=B.y,t=B.z;return this.x=g*t-I*i,this.y=I*C-E*t,this.z=E*i-g*C,this}projectOnVector(A){const B=A.lengthSq();if(B===0)return this.set(0,0,0);const E=A.dot(this)/B;return this.copy(A).multiplyScalar(E)}projectOnPlane(A){return Ad.copy(this).projectOnVector(A),this.sub(Ad)}reflect(A){return this.sub(Ad.copy(A).multiplyScalar(2*this.dot(A)))}angleTo(A){const B=Math.sqrt(this.lengthSq()*A.lengthSq());if(B===0)return Math.PI/2;const E=this.dot(A)/B;return Math.acos(Eg(E,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const B=this.x-A.x,E=this.y-A.y,g=this.z-A.z;return B*B+E*E+g*g}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)+Math.abs(this.z-A.z)}setFromSpherical(A){return this.setFromSphericalCoords(A.radius,A.phi,A.theta)}setFromSphericalCoords(A,B,E){const g=Math.sin(B)*A;return this.x=g*Math.sin(E),this.y=Math.cos(B)*A,this.z=g*Math.cos(E),this}setFromCylindrical(A){return this.setFromCylindricalCoords(A.radius,A.theta,A.y)}setFromCylindricalCoords(A,B,E){return this.x=A*Math.sin(B),this.y=E,this.z=A*Math.cos(B),this}setFromMatrixPosition(A){const B=A.elements;return this.x=B[12],this.y=B[13],this.z=B[14],this}setFromMatrixScale(A){const B=this.setFromMatrixColumn(A,0).length(),E=this.setFromMatrixColumn(A,1).length(),g=this.setFromMatrixColumn(A,2).length();return this.x=B,this.y=E,this.z=g,this}setFromMatrixColumn(A,B){return this.fromArray(A.elements,B*4)}setFromMatrix3Column(A,B){return this.fromArray(A.elements,B*3)}setFromEuler(A){return this.x=A._x,this.y=A._y,this.z=A._z,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z}fromArray(A,B=0){return this.x=A[B],this.y=A[B+1],this.z=A[B+2],this}toArray(A=[],B=0){return A[B]=this.x,A[B+1]=this.y,A[B+2]=this.z,A}fromBufferAttribute(A,B,E){return E!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=A.getX(B),this.y=A.getY(B),this.z=A.getZ(B),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const A=(Math.random()-.5)*2,B=Math.random()*Math.PI*2,E=Math.sqrt(1-A**2);return this.x=E*Math.cos(B),this.y=E*Math.sin(B),this.z=A,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Ad=new QA,LK=new hC;class io{constructor(A=new QA(1/0,1/0,1/0),B=new QA(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=A,this.max=B}set(A,B){return this.min.copy(A),this.max.copy(B),this}setFromArray(A){let B=1/0,E=1/0,g=1/0,I=-1/0,C=-1/0,i=-1/0;for(let t=0,e=A.length;tI&&(I=n),w>C&&(C=w),D>i&&(i=D)}return this.min.set(B,E,g),this.max.set(I,C,i),this}setFromBufferAttribute(A){let B=1/0,E=1/0,g=1/0,I=-1/0,C=-1/0,i=-1/0;for(let t=0,e=A.count;tI&&(I=n),w>C&&(C=w),D>i&&(i=D)}return this.min.set(B,E,g),this.max.set(I,C,i),this}setFromPoints(A){this.makeEmpty();for(let B=0,E=A.length;Bthis.max.x||A.ythis.max.y||A.zthis.max.z)}containsBox(A){return this.min.x<=A.min.x&&A.max.x<=this.max.x&&this.min.y<=A.min.y&&A.max.y<=this.max.y&&this.min.z<=A.min.z&&A.max.z<=this.max.z}getParameter(A,B){return B.set((A.x-this.min.x)/(this.max.x-this.min.x),(A.y-this.min.y)/(this.max.y-this.min.y),(A.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(A){return!(A.max.xthis.max.x||A.max.ythis.max.y||A.max.zthis.max.z)}intersectsSphere(A){return this.clampPoint(A.center,dn),dn.distanceToSquared(A.center)<=A.radius*A.radius}intersectsPlane(A){let B,E;return A.normal.x>0?(B=A.normal.x*this.min.x,E=A.normal.x*this.max.x):(B=A.normal.x*this.max.x,E=A.normal.x*this.min.x),A.normal.y>0?(B+=A.normal.y*this.min.y,E+=A.normal.y*this.max.y):(B+=A.normal.y*this.max.y,E+=A.normal.y*this.min.y),A.normal.z>0?(B+=A.normal.z*this.min.z,E+=A.normal.z*this.max.z):(B+=A.normal.z*this.max.z,E+=A.normal.z*this.min.z),B<=-A.constant&&E>=-A.constant}intersectsTriangle(A){if(this.isEmpty())return!1;this.getCenter(yc),HG.subVectors(this.max,yc),Ya.subVectors(A.a,yc),Ha.subVectors(A.b,yc),Ka.subVectors(A.c,yc),Zo.subVectors(Ha,Ya),xo.subVectors(Ka,Ha),pn.subVectors(Ya,Ka);let B=[0,-Zo.z,Zo.y,0,-xo.z,xo.y,0,-pn.z,pn.y,Zo.z,0,-Zo.x,xo.z,0,-xo.x,pn.z,0,-pn.x,-Zo.y,Zo.x,0,-xo.y,xo.x,0,-pn.y,pn.x,0];return!Bd(B,Ya,Ha,Ka,HG)||(B=[1,0,0,0,1,0,0,0,1],!Bd(B,Ya,Ha,Ka,HG))?!1:(KG.crossVectors(Zo,xo),B=[KG.x,KG.y,KG.z],Bd(B,Ya,Ha,Ka,HG))}clampPoint(A,B){return B.copy(A).clamp(this.min,this.max)}distanceToPoint(A){return dn.copy(A).clamp(this.min,this.max).sub(A).length()}getBoundingSphere(A){return this.getCenter(A.center),A.radius=this.getSize(dn).length()*.5,A}intersect(A){return this.min.max(A.min),this.max.min(A.max),this.isEmpty()&&this.makeEmpty(),this}union(A){return this.min.min(A.min),this.max.max(A.max),this}applyMatrix4(A){return this.isEmpty()?this:(Ye[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(A),Ye[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(A),Ye[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(A),Ye[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(A),Ye[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(A),Ye[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(A),Ye[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(A),Ye[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(A),this.setFromPoints(Ye),this)}translate(A){return this.min.add(A),this.max.add(A),this}equals(A){return A.min.equals(this.min)&&A.max.equals(this.max)}}const Ye=[new QA,new QA,new QA,new QA,new QA,new QA,new QA,new QA],dn=new QA,Qd=new io,Ya=new QA,Ha=new QA,Ka=new QA,Zo=new QA,xo=new QA,pn=new QA,yc=new QA,HG=new QA,KG=new QA,Un=new QA;function Bd(Q,A,B,E,g){for(let I=0,C=Q.length-3;I<=C;I+=3){Un.fromArray(Q,I);const i=g.x*Math.abs(Un.x)+g.y*Math.abs(Un.y)+g.z*Math.abs(Un.z),t=A.dot(Un),e=B.dot(Un),n=E.dot(Un);if(Math.max(-Math.max(t,e,n),Math.min(t,e,n))>i)return!1}return!0}const T9=new io,JK=new QA,mG=new QA,Ed=new QA;class ZD{constructor(A=new QA,B=-1){this.center=A,this.radius=B}set(A,B){return this.center.copy(A),this.radius=B,this}setFromPoints(A,B){const E=this.center;B!==void 0?E.copy(B):T9.setFromPoints(A).getCenter(E);let g=0;for(let I=0,C=A.length;Ithis.radius*this.radius&&(B.sub(this.center).normalize(),B.multiplyScalar(this.radius).add(this.center)),B}getBoundingBox(A){return this.isEmpty()?(A.makeEmpty(),A):(A.set(this.center,this.center),A.expandByScalar(this.radius),A)}applyMatrix4(A){return this.center.applyMatrix4(A),this.radius=this.radius*A.getMaxScaleOnAxis(),this}translate(A){return this.center.add(A),this}expandByPoint(A){Ed.subVectors(A,this.center);const B=Ed.lengthSq();if(B>this.radius*this.radius){const E=Math.sqrt(B),g=(E-this.radius)*.5;this.center.add(Ed.multiplyScalar(g/E)),this.radius+=g}return this}union(A){return this.center.equals(A.center)===!0?mG.set(0,0,1).multiplyScalar(A.radius):mG.subVectors(A.center,this.center).normalize().multiplyScalar(A.radius),this.expandByPoint(JK.copy(A.center).add(mG)),this.expandByPoint(JK.copy(A.center).sub(mG)),this}equals(A){return A.center.equals(this.center)&&A.radius===this.radius}clone(){return new this.constructor().copy(this)}}const He=new QA,gd=new QA,LG=new QA,bo=new QA,Id=new QA,JG=new QA,Cd=new QA;class fM{constructor(A=new QA,B=new QA(0,0,-1)){this.origin=A,this.direction=B}set(A,B){return this.origin.copy(A),this.direction.copy(B),this}copy(A){return this.origin.copy(A.origin),this.direction.copy(A.direction),this}at(A,B){return B.copy(this.direction).multiplyScalar(A).add(this.origin)}lookAt(A){return this.direction.copy(A).sub(this.origin).normalize(),this}recast(A){return this.origin.copy(this.at(A,He)),this}closestPointToPoint(A,B){B.subVectors(A,this.origin);const E=B.dot(this.direction);return E<0?B.copy(this.origin):B.copy(this.direction).multiplyScalar(E).add(this.origin)}distanceToPoint(A){return Math.sqrt(this.distanceSqToPoint(A))}distanceSqToPoint(A){const B=He.subVectors(A,this.origin).dot(this.direction);return B<0?this.origin.distanceToSquared(A):(He.copy(this.direction).multiplyScalar(B).add(this.origin),He.distanceToSquared(A))}distanceSqToSegment(A,B,E,g){gd.copy(A).add(B).multiplyScalar(.5),LG.copy(B).sub(A).normalize(),bo.copy(this.origin).sub(gd);const I=A.distanceTo(B)*.5,C=-this.direction.dot(LG),i=bo.dot(this.direction),t=-bo.dot(LG),e=bo.lengthSq(),n=Math.abs(1-C*C);let w,D,c,G;if(n>0)if(w=C*t-i,D=C*i-t,G=I*n,w>=0)if(D>=-G)if(D<=G){const l=1/n;w*=l,D*=l,c=w*(w+C*D+2*i)+D*(C*w+D+2*t)+e}else D=I,w=Math.max(0,-(C*D+i)),c=-w*w+D*(D+2*t)+e;else D=-I,w=Math.max(0,-(C*D+i)),c=-w*w+D*(D+2*t)+e;else D<=-G?(w=Math.max(0,-(-C*I+i)),D=w>0?-I:Math.min(Math.max(-I,-t),I),c=-w*w+D*(D+2*t)+e):D<=G?(w=0,D=Math.min(Math.max(-I,-t),I),c=D*(D+2*t)+e):(w=Math.max(0,-(C*I+i)),D=w>0?I:Math.min(Math.max(-I,-t),I),c=-w*w+D*(D+2*t)+e);else D=C>0?-I:I,w=Math.max(0,-(C*D+i)),c=-w*w+D*(D+2*t)+e;return E&&E.copy(this.direction).multiplyScalar(w).add(this.origin),g&&g.copy(LG).multiplyScalar(D).add(gd),c}intersectSphere(A,B){He.subVectors(A.center,this.origin);const E=He.dot(this.direction),g=He.dot(He)-E*E,I=A.radius*A.radius;if(g>I)return null;const C=Math.sqrt(I-g),i=E-C,t=E+C;return i<0&&t<0?null:i<0?this.at(t,B):this.at(i,B)}intersectsSphere(A){return this.distanceSqToPoint(A.center)<=A.radius*A.radius}distanceToPlane(A){const B=A.normal.dot(this.direction);if(B===0)return A.distanceToPoint(this.origin)===0?0:null;const E=-(this.origin.dot(A.normal)+A.constant)/B;return E>=0?E:null}intersectPlane(A,B){const E=this.distanceToPlane(A);return E===null?null:this.at(E,B)}intersectsPlane(A){const B=A.distanceToPoint(this.origin);return B===0||A.normal.dot(this.direction)*B<0}intersectBox(A,B){let E,g,I,C,i,t;const e=1/this.direction.x,n=1/this.direction.y,w=1/this.direction.z,D=this.origin;return e>=0?(E=(A.min.x-D.x)*e,g=(A.max.x-D.x)*e):(E=(A.max.x-D.x)*e,g=(A.min.x-D.x)*e),n>=0?(I=(A.min.y-D.y)*n,C=(A.max.y-D.y)*n):(I=(A.max.y-D.y)*n,C=(A.min.y-D.y)*n),E>C||I>g||((I>E||E!==E)&&(E=I),(C=0?(i=(A.min.z-D.z)*w,t=(A.max.z-D.z)*w):(i=(A.max.z-D.z)*w,t=(A.min.z-D.z)*w),E>t||i>g)||((i>E||E!==E)&&(E=i),(t=0?E:g,B)}intersectsBox(A){return this.intersectBox(A,He)!==null}intersectTriangle(A,B,E,g,I){Id.subVectors(B,A),JG.subVectors(E,A),Cd.crossVectors(Id,JG);let C=this.direction.dot(Cd),i;if(C>0){if(g)return null;i=1}else if(C<0)i=-1,C=-C;else return null;bo.subVectors(this.origin,A);const t=i*this.direction.dot(JG.crossVectors(bo,JG));if(t<0)return null;const e=i*this.direction.dot(Id.cross(bo));if(e<0||t+e>C)return null;const n=-i*bo.dot(Cd);return n<0?null:this.at(n/C,I)}applyMatrix4(A){return this.origin.applyMatrix4(A),this.direction.transformDirection(A),this}equals(A){return A.origin.equals(this.origin)&&A.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class hB{constructor(){this.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}set(A,B,E,g,I,C,i,t,e,n,w,D,c,G,l,M){const d=this.elements;return d[0]=A,d[4]=B,d[8]=E,d[12]=g,d[1]=I,d[5]=C,d[9]=i,d[13]=t,d[2]=e,d[6]=n,d[10]=w,d[14]=D,d[3]=c,d[7]=G,d[11]=l,d[15]=M,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new hB().fromArray(this.elements)}copy(A){const B=this.elements,E=A.elements;return B[0]=E[0],B[1]=E[1],B[2]=E[2],B[3]=E[3],B[4]=E[4],B[5]=E[5],B[6]=E[6],B[7]=E[7],B[8]=E[8],B[9]=E[9],B[10]=E[10],B[11]=E[11],B[12]=E[12],B[13]=E[13],B[14]=E[14],B[15]=E[15],this}copyPosition(A){const B=this.elements,E=A.elements;return B[12]=E[12],B[13]=E[13],B[14]=E[14],this}setFromMatrix3(A){const B=A.elements;return this.set(B[0],B[3],B[6],0,B[1],B[4],B[7],0,B[2],B[5],B[8],0,0,0,0,1),this}extractBasis(A,B,E){return A.setFromMatrixColumn(this,0),B.setFromMatrixColumn(this,1),E.setFromMatrixColumn(this,2),this}makeBasis(A,B,E){return this.set(A.x,B.x,E.x,0,A.y,B.y,E.y,0,A.z,B.z,E.z,0,0,0,0,1),this}extractRotation(A){const B=this.elements,E=A.elements,g=1/ma.setFromMatrixColumn(A,0).length(),I=1/ma.setFromMatrixColumn(A,1).length(),C=1/ma.setFromMatrixColumn(A,2).length();return B[0]=E[0]*g,B[1]=E[1]*g,B[2]=E[2]*g,B[3]=0,B[4]=E[4]*I,B[5]=E[5]*I,B[6]=E[6]*I,B[7]=0,B[8]=E[8]*C,B[9]=E[9]*C,B[10]=E[10]*C,B[11]=0,B[12]=0,B[13]=0,B[14]=0,B[15]=1,this}makeRotationFromEuler(A){A&&A.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");const B=this.elements,E=A.x,g=A.y,I=A.z,C=Math.cos(E),i=Math.sin(E),t=Math.cos(g),e=Math.sin(g),n=Math.cos(I),w=Math.sin(I);if(A.order==="XYZ"){const D=C*n,c=C*w,G=i*n,l=i*w;B[0]=t*n,B[4]=-t*w,B[8]=e,B[1]=c+G*e,B[5]=D-l*e,B[9]=-i*t,B[2]=l-D*e,B[6]=G+c*e,B[10]=C*t}else if(A.order==="YXZ"){const D=t*n,c=t*w,G=e*n,l=e*w;B[0]=D+l*i,B[4]=G*i-c,B[8]=C*e,B[1]=C*w,B[5]=C*n,B[9]=-i,B[2]=c*i-G,B[6]=l+D*i,B[10]=C*t}else if(A.order==="ZXY"){const D=t*n,c=t*w,G=e*n,l=e*w;B[0]=D-l*i,B[4]=-C*w,B[8]=G+c*i,B[1]=c+G*i,B[5]=C*n,B[9]=l-D*i,B[2]=-C*e,B[6]=i,B[10]=C*t}else if(A.order==="ZYX"){const D=C*n,c=C*w,G=i*n,l=i*w;B[0]=t*n,B[4]=G*e-c,B[8]=D*e+l,B[1]=t*w,B[5]=l*e+D,B[9]=c*e-G,B[2]=-e,B[6]=i*t,B[10]=C*t}else if(A.order==="YZX"){const D=C*t,c=C*e,G=i*t,l=i*e;B[0]=t*n,B[4]=l-D*w,B[8]=G*w+c,B[1]=w,B[5]=C*n,B[9]=-i*n,B[2]=-e*n,B[6]=c*w+G,B[10]=D-l*w}else if(A.order==="XZY"){const D=C*t,c=C*e,G=i*t,l=i*e;B[0]=t*n,B[4]=-w,B[8]=e*n,B[1]=D*w+l,B[5]=C*n,B[9]=c*w-G,B[2]=G*w-c,B[6]=i*n,B[10]=l*w+D}return B[3]=0,B[7]=0,B[11]=0,B[12]=0,B[13]=0,B[14]=0,B[15]=1,this}makeRotationFromQuaternion(A){return this.compose(v9,A,P9)}lookAt(A,B,E){const g=this.elements;return NC.subVectors(A,B),NC.lengthSq()===0&&(NC.z=1),NC.normalize(),To.crossVectors(E,NC),To.lengthSq()===0&&(Math.abs(E.z)===1?NC.x+=1e-4:NC.z+=1e-4,NC.normalize(),To.crossVectors(E,NC)),To.normalize(),SG.crossVectors(NC,To),g[0]=To.x,g[4]=SG.x,g[8]=NC.x,g[1]=To.y,g[5]=SG.y,g[9]=NC.y,g[2]=To.z,g[6]=SG.z,g[10]=NC.z,this}multiply(A,B){return B!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(A,B)):this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,B){const E=A.elements,g=B.elements,I=this.elements,C=E[0],i=E[4],t=E[8],e=E[12],n=E[1],w=E[5],D=E[9],c=E[13],G=E[2],l=E[6],M=E[10],d=E[14],p=E[3],R=E[7],u=E[11],f=E[15],m=g[0],x=g[4],L=g[8],Z=g[12],V=g[1],q=g[5],BA=g[9],X=g[13],W=g[2],gA=g[6],EA=g[10],nA=g[14],aA=g[3],DA=g[7],rA=g[11],eA=g[15];return I[0]=C*m+i*V+t*W+e*aA,I[4]=C*x+i*q+t*gA+e*DA,I[8]=C*L+i*BA+t*EA+e*rA,I[12]=C*Z+i*X+t*nA+e*eA,I[1]=n*m+w*V+D*W+c*aA,I[5]=n*x+w*q+D*gA+c*DA,I[9]=n*L+w*BA+D*EA+c*rA,I[13]=n*Z+w*X+D*nA+c*eA,I[2]=G*m+l*V+M*W+d*aA,I[6]=G*x+l*q+M*gA+d*DA,I[10]=G*L+l*BA+M*EA+d*rA,I[14]=G*Z+l*X+M*nA+d*eA,I[3]=p*m+R*V+u*W+f*aA,I[7]=p*x+R*q+u*gA+f*DA,I[11]=p*L+R*BA+u*EA+f*rA,I[15]=p*Z+R*X+u*nA+f*eA,this}multiplyScalar(A){const B=this.elements;return B[0]*=A,B[4]*=A,B[8]*=A,B[12]*=A,B[1]*=A,B[5]*=A,B[9]*=A,B[13]*=A,B[2]*=A,B[6]*=A,B[10]*=A,B[14]*=A,B[3]*=A,B[7]*=A,B[11]*=A,B[15]*=A,this}determinant(){const A=this.elements,B=A[0],E=A[4],g=A[8],I=A[12],C=A[1],i=A[5],t=A[9],e=A[13],n=A[2],w=A[6],D=A[10],c=A[14],G=A[3],l=A[7],M=A[11],d=A[15];return G*(+I*t*w-g*e*w-I*i*D+E*e*D+g*i*c-E*t*c)+l*(+B*t*c-B*e*D+I*C*D-g*C*c+g*e*n-I*t*n)+M*(+B*e*w-B*i*c-I*C*w+E*C*c+I*i*n-E*e*n)+d*(-g*i*n-B*t*w+B*i*D+g*C*w-E*C*D+E*t*n)}transpose(){const A=this.elements;let B;return B=A[1],A[1]=A[4],A[4]=B,B=A[2],A[2]=A[8],A[8]=B,B=A[6],A[6]=A[9],A[9]=B,B=A[3],A[3]=A[12],A[12]=B,B=A[7],A[7]=A[13],A[13]=B,B=A[11],A[11]=A[14],A[14]=B,this}setPosition(A,B,E){const g=this.elements;return A.isVector3?(g[12]=A.x,g[13]=A.y,g[14]=A.z):(g[12]=A,g[13]=B,g[14]=E),this}invert(){const A=this.elements,B=A[0],E=A[1],g=A[2],I=A[3],C=A[4],i=A[5],t=A[6],e=A[7],n=A[8],w=A[9],D=A[10],c=A[11],G=A[12],l=A[13],M=A[14],d=A[15],p=w*M*e-l*D*e+l*t*c-i*M*c-w*t*d+i*D*d,R=G*D*e-n*M*e-G*t*c+C*M*c+n*t*d-C*D*d,u=n*l*e-G*w*e+G*i*c-C*l*c-n*i*d+C*w*d,f=G*w*t-n*l*t-G*i*D+C*l*D+n*i*M-C*w*M,m=B*p+E*R+g*u+I*f;if(m===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const x=1/m;return A[0]=p*x,A[1]=(l*D*I-w*M*I-l*g*c+E*M*c+w*g*d-E*D*d)*x,A[2]=(i*M*I-l*t*I+l*g*e-E*M*e-i*g*d+E*t*d)*x,A[3]=(w*t*I-i*D*I-w*g*e+E*D*e+i*g*c-E*t*c)*x,A[4]=R*x,A[5]=(n*M*I-G*D*I+G*g*c-B*M*c-n*g*d+B*D*d)*x,A[6]=(G*t*I-C*M*I-G*g*e+B*M*e+C*g*d-B*t*d)*x,A[7]=(C*D*I-n*t*I+n*g*e-B*D*e-C*g*c+B*t*c)*x,A[8]=u*x,A[9]=(G*w*I-n*l*I-G*E*c+B*l*c+n*E*d-B*w*d)*x,A[10]=(C*l*I-G*i*I+G*E*e-B*l*e-C*E*d+B*i*d)*x,A[11]=(n*i*I-C*w*I-n*E*e+B*w*e+C*E*c-B*i*c)*x,A[12]=f*x,A[13]=(n*l*g-G*w*g+G*E*D-B*l*D-n*E*M+B*w*M)*x,A[14]=(G*i*g-C*l*g-G*E*t+B*l*t+C*E*M-B*i*M)*x,A[15]=(C*w*g-n*i*g+n*E*t-B*w*t-C*E*D+B*i*D)*x,this}scale(A){const B=this.elements,E=A.x,g=A.y,I=A.z;return B[0]*=E,B[4]*=g,B[8]*=I,B[1]*=E,B[5]*=g,B[9]*=I,B[2]*=E,B[6]*=g,B[10]*=I,B[3]*=E,B[7]*=g,B[11]*=I,this}getMaxScaleOnAxis(){const A=this.elements,B=A[0]*A[0]+A[1]*A[1]+A[2]*A[2],E=A[4]*A[4]+A[5]*A[5]+A[6]*A[6],g=A[8]*A[8]+A[9]*A[9]+A[10]*A[10];return Math.sqrt(Math.max(B,E,g))}makeTranslation(A,B,E){return this.set(1,0,0,A,0,1,0,B,0,0,1,E,0,0,0,1),this}makeRotationX(A){const B=Math.cos(A),E=Math.sin(A);return this.set(1,0,0,0,0,B,-E,0,0,E,B,0,0,0,0,1),this}makeRotationY(A){const B=Math.cos(A),E=Math.sin(A);return this.set(B,0,E,0,0,1,0,0,-E,0,B,0,0,0,0,1),this}makeRotationZ(A){const B=Math.cos(A),E=Math.sin(A);return this.set(B,-E,0,0,E,B,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(A,B){const E=Math.cos(B),g=Math.sin(B),I=1-E,C=A.x,i=A.y,t=A.z,e=I*C,n=I*i;return this.set(e*C+E,e*i-g*t,e*t+g*i,0,e*i+g*t,n*i+E,n*t-g*C,0,e*t-g*i,n*t+g*C,I*t*t+E,0,0,0,0,1),this}makeScale(A,B,E){return this.set(A,0,0,0,0,B,0,0,0,0,E,0,0,0,0,1),this}makeShear(A,B,E,g,I,C){return this.set(1,E,I,0,A,1,C,0,B,g,1,0,0,0,0,1),this}compose(A,B,E){const g=this.elements,I=B._x,C=B._y,i=B._z,t=B._w,e=I+I,n=C+C,w=i+i,D=I*e,c=I*n,G=I*w,l=C*n,M=C*w,d=i*w,p=t*e,R=t*n,u=t*w,f=E.x,m=E.y,x=E.z;return g[0]=(1-(l+d))*f,g[1]=(c+u)*f,g[2]=(G-R)*f,g[3]=0,g[4]=(c-u)*m,g[5]=(1-(D+d))*m,g[6]=(M+p)*m,g[7]=0,g[8]=(G+R)*x,g[9]=(M-p)*x,g[10]=(1-(D+l))*x,g[11]=0,g[12]=A.x,g[13]=A.y,g[14]=A.z,g[15]=1,this}decompose(A,B,E){const g=this.elements;let I=ma.set(g[0],g[1],g[2]).length();const C=ma.set(g[4],g[5],g[6]).length(),i=ma.set(g[8],g[9],g[10]).length();this.determinant()<0&&(I=-I),A.x=g[12],A.y=g[13],A.z=g[14],Xi.copy(this);const e=1/I,n=1/C,w=1/i;return Xi.elements[0]*=e,Xi.elements[1]*=e,Xi.elements[2]*=e,Xi.elements[4]*=n,Xi.elements[5]*=n,Xi.elements[6]*=n,Xi.elements[8]*=w,Xi.elements[9]*=w,Xi.elements[10]*=w,B.setFromRotationMatrix(Xi),E.x=I,E.y=C,E.z=i,this}makePerspective(A,B,E,g,I,C){C===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");const i=this.elements,t=2*I/(B-A),e=2*I/(E-g),n=(B+A)/(B-A),w=(E+g)/(E-g),D=-(C+I)/(C-I),c=-2*C*I/(C-I);return i[0]=t,i[4]=0,i[8]=n,i[12]=0,i[1]=0,i[5]=e,i[9]=w,i[13]=0,i[2]=0,i[6]=0,i[10]=D,i[14]=c,i[3]=0,i[7]=0,i[11]=-1,i[15]=0,this}makeOrthographic(A,B,E,g,I,C){const i=this.elements,t=1/(B-A),e=1/(E-g),n=1/(C-I),w=(B+A)*t,D=(E+g)*e,c=(C+I)*n;return i[0]=2*t,i[4]=0,i[8]=0,i[12]=-w,i[1]=0,i[5]=2*e,i[9]=0,i[13]=-D,i[2]=0,i[6]=0,i[10]=-2*n,i[14]=-c,i[3]=0,i[7]=0,i[11]=0,i[15]=1,this}equals(A){const B=this.elements,E=A.elements;for(let g=0;g<16;g++)if(B[g]!==E[g])return!1;return!0}fromArray(A,B=0){for(let E=0;E<16;E++)this.elements[E]=A[E+B];return this}toArray(A=[],B=0){const E=this.elements;return A[B]=E[0],A[B+1]=E[1],A[B+2]=E[2],A[B+3]=E[3],A[B+4]=E[4],A[B+5]=E[5],A[B+6]=E[6],A[B+7]=E[7],A[B+8]=E[8],A[B+9]=E[9],A[B+10]=E[10],A[B+11]=E[11],A[B+12]=E[12],A[B+13]=E[13],A[B+14]=E[14],A[B+15]=E[15],A}}const ma=new QA,Xi=new hB,v9=new QA(0,0,0),P9=new QA(1,1,1),To=new QA,SG=new QA,NC=new QA,SK=new hB,ZK=new hC;class Mw{constructor(A=0,B=0,E=0,g=Mw.DefaultOrder){this.isEuler=!0,this._x=A,this._y=B,this._z=E,this._order=g}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get order(){return this._order}set order(A){this._order=A,this._onChangeCallback()}set(A,B,E,g=this._order){return this._x=A,this._y=B,this._z=E,this._order=g,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(A){return this._x=A._x,this._y=A._y,this._z=A._z,this._order=A._order,this._onChangeCallback(),this}setFromRotationMatrix(A,B=this._order,E=!0){const g=A.elements,I=g[0],C=g[4],i=g[8],t=g[1],e=g[5],n=g[9],w=g[2],D=g[6],c=g[10];switch(B){case"XYZ":this._y=Math.asin(Eg(i,-1,1)),Math.abs(i)<.9999999?(this._x=Math.atan2(-n,c),this._z=Math.atan2(-C,I)):(this._x=Math.atan2(D,e),this._z=0);break;case"YXZ":this._x=Math.asin(-Eg(n,-1,1)),Math.abs(n)<.9999999?(this._y=Math.atan2(i,c),this._z=Math.atan2(t,e)):(this._y=Math.atan2(-w,I),this._z=0);break;case"ZXY":this._x=Math.asin(Eg(D,-1,1)),Math.abs(D)<.9999999?(this._y=Math.atan2(-w,c),this._z=Math.atan2(-C,e)):(this._y=0,this._z=Math.atan2(t,I));break;case"ZYX":this._y=Math.asin(-Eg(w,-1,1)),Math.abs(w)<.9999999?(this._x=Math.atan2(D,c),this._z=Math.atan2(t,I)):(this._x=0,this._z=Math.atan2(-C,e));break;case"YZX":this._z=Math.asin(Eg(t,-1,1)),Math.abs(t)<.9999999?(this._x=Math.atan2(-n,e),this._y=Math.atan2(-w,I)):(this._x=0,this._y=Math.atan2(i,c));break;case"XZY":this._z=Math.asin(-Eg(C,-1,1)),Math.abs(C)<.9999999?(this._x=Math.atan2(D,e),this._y=Math.atan2(i,I)):(this._x=Math.atan2(-n,c),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+B)}return this._order=B,E===!0&&this._onChangeCallback(),this}setFromQuaternion(A,B,E){return SK.makeRotationFromQuaternion(A),this.setFromRotationMatrix(SK,B,E)}setFromVector3(A,B=this._order){return this.set(A.x,A.y,A.z,B)}reorder(A){return ZK.setFromEuler(this),this.setFromQuaternion(ZK,A)}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._order===this._order}fromArray(A){return this._x=A[0],this._y=A[1],this._z=A[2],A[3]!==void 0&&(this._order=A[3]),this._onChangeCallback(),this}toArray(A=[],B=0){return A[B]=this._x,A[B+1]=this._y,A[B+2]=this._z,A[B+3]=this._order,A}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}Mw.DefaultOrder="XYZ";Mw.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class tD{constructor(){this.mask=1}set(A){this.mask=(1<>>0}enable(A){this.mask|=1<1){for(let B=0;B1){for(let E=0;E0){g.children=[];for(let i=0;i0){g.animations=[];for(let i=0;i0&&(E.geometries=i),t.length>0&&(E.materials=t),e.length>0&&(E.textures=e),n.length>0&&(E.images=n),w.length>0&&(E.shapes=w),D.length>0&&(E.skeletons=D),c.length>0&&(E.animations=c),G.length>0&&(E.nodes=G)}return E.object=g,E;function C(i){const t=[];for(const e in i){const n=i[e];delete n.metadata,t.push(n)}return t}}clone(A){return new this.constructor().copy(this,A)}copy(A,B=!0){if(this.name=A.name,this.up.copy(A.up),this.position.copy(A.position),this.rotation.order=A.rotation.order,this.quaternion.copy(A.quaternion),this.scale.copy(A.scale),this.matrix.copy(A.matrix),this.matrixWorld.copy(A.matrixWorld),this.matrixAutoUpdate=A.matrixAutoUpdate,this.matrixWorldNeedsUpdate=A.matrixWorldNeedsUpdate,this.layers.mask=A.layers.mask,this.visible=A.visible,this.castShadow=A.castShadow,this.receiveShadow=A.receiveShadow,this.frustumCulled=A.frustumCulled,this.renderOrder=A.renderOrder,this.userData=JSON.parse(JSON.stringify(A.userData)),B===!0)for(let E=0;E0?g.multiplyScalar(1/Math.sqrt(I)):g.set(0,0,0)}static getBarycoord(A,B,E,g,I){qi.subVectors(g,B),me.subVectors(E,B),id.subVectors(A,B);const C=qi.dot(qi),i=qi.dot(me),t=qi.dot(id),e=me.dot(me),n=me.dot(id),w=C*e-i*i;if(w===0)return I.set(-2,-1,-1);const D=1/w,c=(e*t-i*n)*D,G=(C*n-i*t)*D;return I.set(1-c-G,G,c)}static containsPoint(A,B,E,g){return this.getBarycoord(A,B,E,g,Le),Le.x>=0&&Le.y>=0&&Le.x+Le.y<=1}static getUV(A,B,E,g,I,C,i,t){return this.getBarycoord(A,B,E,g,Le),t.set(0,0),t.addScaledVector(I,Le.x),t.addScaledVector(C,Le.y),t.addScaledVector(i,Le.z),t}static isFrontFacing(A,B,E,g){return qi.subVectors(E,B),me.subVectors(A,B),qi.cross(me).dot(g)<0}set(A,B,E){return this.a.copy(A),this.b.copy(B),this.c.copy(E),this}setFromPointsAndIndices(A,B,E,g){return this.a.copy(A[B]),this.b.copy(A[E]),this.c.copy(A[g]),this}setFromAttributeAndIndices(A,B,E,g){return this.a.fromBufferAttribute(A,B),this.b.fromBufferAttribute(A,E),this.c.fromBufferAttribute(A,g),this}clone(){return new this.constructor().copy(this)}copy(A){return this.a.copy(A.a),this.b.copy(A.b),this.c.copy(A.c),this}getArea(){return qi.subVectors(this.c,this.b),me.subVectors(this.a,this.b),qi.cross(me).length()*.5}getMidpoint(A){return A.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(A){return ri.getNormal(this.a,this.b,this.c,A)}getPlane(A){return A.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(A,B){return ri.getBarycoord(A,this.a,this.b,this.c,B)}getUV(A,B,E,g,I){return ri.getUV(A,this.a,this.b,this.c,B,E,g,I)}containsPoint(A){return ri.containsPoint(A,this.a,this.b,this.c)}isFrontFacing(A){return ri.isFrontFacing(this.a,this.b,this.c,A)}intersectsBox(A){return A.intersectsTriangle(this)}closestPointToPoint(A,B){const E=this.a,g=this.b,I=this.c;let C,i;Ja.subVectors(g,E),Sa.subVectors(I,E),td.subVectors(A,E);const t=Ja.dot(td),e=Sa.dot(td);if(t<=0&&e<=0)return B.copy(E);ed.subVectors(A,g);const n=Ja.dot(ed),w=Sa.dot(ed);if(n>=0&&w<=n)return B.copy(g);const D=t*w-n*e;if(D<=0&&t>=0&&n<=0)return C=t/(t-n),B.copy(E).addScaledVector(Ja,C);od.subVectors(A,I);const c=Ja.dot(od),G=Sa.dot(od);if(G>=0&&c<=G)return B.copy(I);const l=c*e-t*G;if(l<=0&&e>=0&&G<=0)return i=e/(e-G),B.copy(E).addScaledVector(Sa,i);const M=n*G-c*w;if(M<=0&&w-n>=0&&c-G>=0)return WK.subVectors(I,g),i=(w-n)/(w-n+(c-G)),B.copy(g).addScaledVector(WK,i);const d=1/(M+l+D);return C=l*d,i=D*d,B.copy(E).addScaledVector(Ja,C).addScaledVector(Sa,i)}equals(A){return A.a.equals(this.a)&&A.b.equals(this.b)&&A.c.equals(this.c)}}let q9=0;class ug extends Ts{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:q9++}),this.uuid=xC(),this.name="",this.type="Material",this.blending=gD,this.side=wD,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=nR,this.blendDst=DR,this.blendEquation=vn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=O0,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=kb,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=B0,this.stencilZFail=B0,this.stencilZPass=B0,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.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(A){this._alphaTest>0!=A>0&&this.version++,this._alphaTest=A}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(A){if(A!==void 0)for(const B in A){const E=A[B];if(E===void 0){console.warn("THREE.Material: '"+B+"' parameter is undefined.");continue}if(B==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=E===Nx;continue}const g=this[B];if(g===void 0){console.warn("THREE."+this.type+": '"+B+"' is not a property of this material.");continue}g&&g.isColor?g.set(E):g&&g.isVector3&&E&&E.isVector3?g.copy(E):this[B]=E}}toJSON(A){const B=A===void 0||typeof A=="string";B&&(A={textures:{},images:{}});const E={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};E.uuid=this.uuid,E.type=this.type,this.name!==""&&(E.name=this.name),this.color&&this.color.isColor&&(E.color=this.color.getHex()),this.roughness!==void 0&&(E.roughness=this.roughness),this.metalness!==void 0&&(E.metalness=this.metalness),this.sheen!==void 0&&(E.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(E.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(E.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(E.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(E.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(E.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(E.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(E.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(E.shininess=this.shininess),this.clearcoat!==void 0&&(E.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(E.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(E.clearcoatMap=this.clearcoatMap.toJSON(A).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(E.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(A).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(E.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(A).uuid,E.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(E.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(E.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(E.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(E.iridescenceMap=this.iridescenceMap.toJSON(A).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(E.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(A).uuid),this.map&&this.map.isTexture&&(E.map=this.map.toJSON(A).uuid),this.matcap&&this.matcap.isTexture&&(E.matcap=this.matcap.toJSON(A).uuid),this.alphaMap&&this.alphaMap.isTexture&&(E.alphaMap=this.alphaMap.toJSON(A).uuid),this.lightMap&&this.lightMap.isTexture&&(E.lightMap=this.lightMap.toJSON(A).uuid,E.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(E.aoMap=this.aoMap.toJSON(A).uuid,E.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(E.bumpMap=this.bumpMap.toJSON(A).uuid,E.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(E.normalMap=this.normalMap.toJSON(A).uuid,E.normalMapType=this.normalMapType,E.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(E.displacementMap=this.displacementMap.toJSON(A).uuid,E.displacementScale=this.displacementScale,E.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(E.roughnessMap=this.roughnessMap.toJSON(A).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(E.metalnessMap=this.metalnessMap.toJSON(A).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(E.emissiveMap=this.emissiveMap.toJSON(A).uuid),this.specularMap&&this.specularMap.isTexture&&(E.specularMap=this.specularMap.toJSON(A).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(E.specularIntensityMap=this.specularIntensityMap.toJSON(A).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(E.specularColorMap=this.specularColorMap.toJSON(A).uuid),this.envMap&&this.envMap.isTexture&&(E.envMap=this.envMap.toJSON(A).uuid,this.combine!==void 0&&(E.combine=this.combine)),this.envMapIntensity!==void 0&&(E.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(E.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(E.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(E.gradientMap=this.gradientMap.toJSON(A).uuid),this.transmission!==void 0&&(E.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(E.transmissionMap=this.transmissionMap.toJSON(A).uuid),this.thickness!==void 0&&(E.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(E.thicknessMap=this.thicknessMap.toJSON(A).uuid),this.attenuationDistance!==void 0&&(E.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(E.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(E.size=this.size),this.shadowSide!==null&&(E.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(E.sizeAttenuation=this.sizeAttenuation),this.blending!==gD&&(E.blending=this.blending),this.side!==wD&&(E.side=this.side),this.vertexColors&&(E.vertexColors=!0),this.opacity<1&&(E.opacity=this.opacity),this.transparent===!0&&(E.transparent=this.transparent),E.depthFunc=this.depthFunc,E.depthTest=this.depthTest,E.depthWrite=this.depthWrite,E.colorWrite=this.colorWrite,E.stencilWrite=this.stencilWrite,E.stencilWriteMask=this.stencilWriteMask,E.stencilFunc=this.stencilFunc,E.stencilRef=this.stencilRef,E.stencilFuncMask=this.stencilFuncMask,E.stencilFail=this.stencilFail,E.stencilZFail=this.stencilZFail,E.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(E.rotation=this.rotation),this.polygonOffset===!0&&(E.polygonOffset=!0),this.polygonOffsetFactor!==0&&(E.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(E.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(E.linewidth=this.linewidth),this.dashSize!==void 0&&(E.dashSize=this.dashSize),this.gapSize!==void 0&&(E.gapSize=this.gapSize),this.scale!==void 0&&(E.scale=this.scale),this.dithering===!0&&(E.dithering=!0),this.alphaTest>0&&(E.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(E.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(E.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(E.wireframe=this.wireframe),this.wireframeLinewidth>1&&(E.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(E.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(E.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(E.flatShading=this.flatShading),this.visible===!1&&(E.visible=!1),this.toneMapped===!1&&(E.toneMapped=!1),this.fog===!1&&(E.fog=!1),JSON.stringify(this.userData)!=="{}"&&(E.userData=this.userData);function g(I){const C=[];for(const i in I){const t=I[i];delete t.metadata,C.push(t)}return C}if(B){const I=g(A.textures),C=g(A.images);I.length>0&&(E.textures=I),C.length>0&&(E.images=C)}return E}clone(){return new this.constructor().copy(this)}copy(A){this.name=A.name,this.blending=A.blending,this.side=A.side,this.vertexColors=A.vertexColors,this.opacity=A.opacity,this.transparent=A.transparent,this.blendSrc=A.blendSrc,this.blendDst=A.blendDst,this.blendEquation=A.blendEquation,this.blendSrcAlpha=A.blendSrcAlpha,this.blendDstAlpha=A.blendDstAlpha,this.blendEquationAlpha=A.blendEquationAlpha,this.depthFunc=A.depthFunc,this.depthTest=A.depthTest,this.depthWrite=A.depthWrite,this.stencilWriteMask=A.stencilWriteMask,this.stencilFunc=A.stencilFunc,this.stencilRef=A.stencilRef,this.stencilFuncMask=A.stencilFuncMask,this.stencilFail=A.stencilFail,this.stencilZFail=A.stencilZFail,this.stencilZPass=A.stencilZPass,this.stencilWrite=A.stencilWrite;const B=A.clippingPlanes;let E=null;if(B!==null){const g=B.length;E=new Array(g);for(let I=0;I!==g;++I)E[I]=B[I].clone()}return this.clippingPlanes=E,this.clipIntersection=A.clipIntersection,this.clipShadows=A.clipShadows,this.shadowSide=A.shadowSide,this.colorWrite=A.colorWrite,this.precision=A.precision,this.polygonOffset=A.polygonOffset,this.polygonOffsetFactor=A.polygonOffsetFactor,this.polygonOffsetUnits=A.polygonOffsetUnits,this.dithering=A.dithering,this.alphaTest=A.alphaTest,this.alphaToCoverage=A.alphaToCoverage,this.premultipliedAlpha=A.premultipliedAlpha,this.visible=A.visible,this.toneMapped=A.toneMapped,this.userData=JSON.parse(JSON.stringify(A.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(A){A===!0&&this.version++}get vertexTangents(){return console.warn("THREE."+this.type+": .vertexTangents has been removed."),!1}set vertexTangents(A){console.warn("THREE."+this.type+": .vertexTangents has been removed.")}}ug.fromType=function(){return null};class vs extends ug{constructor(A){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new FQ(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=FM,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.specularMap=A.specularMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.combine=A.combine,this.reflectivity=A.reflectivity,this.refractionRatio=A.refractionRatio,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.fog=A.fog,this}}const og=new QA,xG=new XA;class tE{constructor(A,B,E){if(Array.isArray(A))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=A,this.itemSize=B,this.count=A!==void 0?A.length/B:0,this.normalized=E===!0,this.usage=$0,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(A){A===!0&&this.version++}setUsage(A){return this.usage=A,this}copy(A){return this.name=A.name,this.array=new A.array.constructor(A.array),this.itemSize=A.itemSize,this.count=A.count,this.normalized=A.normalized,this.usage=A.usage,this}copyAt(A,B,E){A*=this.itemSize,E*=B.itemSize;for(let g=0,I=this.itemSize;g0&&(A.userData=this.userData),this.parameters!==void 0){const t=this.parameters;for(const e in t)t[e]!==void 0&&(A[e]=t[e]);return A}A.data={attributes:{}};const B=this.index;B!==null&&(A.data.index={type:B.array.constructor.name,array:Array.prototype.slice.call(B.array)});const E=this.attributes;for(const t in E){const e=E[t];A.data.attributes[t]=e.toJSON(A.data)}const g={};let I=!1;for(const t in this.morphAttributes){const e=this.morphAttributes[t],n=[];for(let w=0,D=e.length;w0&&(g[t]=n,I=!0)}I&&(A.data.morphAttributes=g,A.data.morphTargetsRelative=this.morphTargetsRelative);const C=this.groups;C.length>0&&(A.data.groups=JSON.parse(JSON.stringify(C)));const i=this.boundingSphere;return i!==null&&(A.data.boundingSphere={center:i.center.toArray(),radius:i.radius}),A}clone(){return new this.constructor().copy(this)}copy(A){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const B={};this.name=A.name;const E=A.index;E!==null&&this.setIndex(E.clone(B));const g=A.attributes;for(const e in g){const n=g[e];this.setAttribute(e,n.clone(B))}const I=A.morphAttributes;for(const e in I){const n=[],w=I[e];for(let D=0,c=w.length;D0){const g=B[E[0]];if(g!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let I=0,C=g.length;IB.far?null:{distance:e,point:jG.clone(),object:Q}}function XG(Q,A,B,E,g,I,C,i,t,e,n,w){vo.fromBufferAttribute(g,e),Po.fromBufferAttribute(g,n),Wo.fromBufferAttribute(g,w);const D=Q.morphTargetInfluences;if(I&&D){bG.set(0,0,0),TG.set(0,0,0),vG.set(0,0,0);for(let G=0,l=I.length;G0?1:-1,n.push(DA.x,DA.y,DA.z),w.push(oA/x),w.push(1-rA/L),nA+=1}}for(let rA=0;rA0&&(B.defines=this.defines),B.vertexShader=this.vertexShader,B.fragmentShader=this.fragmentShader;const E={};for(const g in this.extensions)this.extensions[g]===!0&&(E[g]=!0);return Object.keys(E).length>0&&(B.extensions=E),B}}class Zr extends EE{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new hB,this.projectionMatrix=new hB,this.projectionMatrixInverse=new hB}copy(A,B){return super.copy(A,B),this.matrixWorldInverse.copy(A.matrixWorldInverse),this.projectionMatrix.copy(A.projectionMatrix),this.projectionMatrixInverse.copy(A.projectionMatrixInverse),this}getWorldDirection(A){this.updateWorldMatrix(!0,!1);const B=this.matrixWorld.elements;return A.set(-B[8],-B[9],-B[10]).normalize()}updateMatrixWorld(A){super.updateMatrixWorld(A),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(A,B){super.updateWorldMatrix(A,B),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class Wg extends Zr{constructor(A=50,B=1,E=.1,g=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=A,this.zoom=1,this.near=E,this.far=g,this.focus=10,this.aspect=B,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(A,B){return super.copy(A,B),this.fov=A.fov,this.zoom=A.zoom,this.near=A.near,this.far=A.far,this.focus=A.focus,this.aspect=A.aspect,this.view=A.view===null?null:Object.assign({},A.view),this.filmGauge=A.filmGauge,this.filmOffset=A.filmOffset,this}setFocalLength(A){const B=.5*this.getFilmHeight()/A;this.fov=vh*2*Math.atan(B),this.updateProjectionMatrix()}getFocalLength(){const A=Math.tan(CD*.5*this.fov);return .5*this.getFilmHeight()/A}getEffectiveFOV(){return vh*2*Math.atan(Math.tan(CD*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(A,B,E,g,I,C){this.aspect=A/B,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=A,this.view.fullHeight=B,this.view.offsetX=E,this.view.offsetY=g,this.view.width=I,this.view.height=C,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=this.near;let B=A*Math.tan(CD*.5*this.fov)/this.zoom,E=2*B,g=this.aspect*E,I=-.5*g;const C=this.view;if(this.view!==null&&this.view.enabled){const t=C.fullWidth,e=C.fullHeight;I+=C.offsetX*g/t,B-=C.offsetY*E/e,g*=C.width/t,E*=C.height/e}const i=this.filmOffset;i!==0&&(I+=A*i/this.getFilmWidth()),this.projectionMatrix.makePerspective(I,I+g,B,B-E,A,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const B=super.toJSON(A);return B.object.fov=this.fov,B.object.zoom=this.zoom,B.object.near=this.near,B.object.far=this.far,B.object.focus=this.focus,B.object.aspect=this.aspect,this.view!==null&&(B.object.view=Object.assign({},this.view)),B.object.filmGauge=this.filmGauge,B.object.filmOffset=this.filmOffset,B}}const ba=90,Ta=1;class fb extends EE{constructor(A,B,E){if(super(),this.type="CubeCamera",E.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=E;const g=new Wg(ba,Ta,A,B);g.layers=this.layers,g.up.set(0,-1,0),g.lookAt(new QA(1,0,0)),this.add(g);const I=new Wg(ba,Ta,A,B);I.layers=this.layers,I.up.set(0,-1,0),I.lookAt(new QA(-1,0,0)),this.add(I);const C=new Wg(ba,Ta,A,B);C.layers=this.layers,C.up.set(0,0,1),C.lookAt(new QA(0,1,0)),this.add(C);const i=new Wg(ba,Ta,A,B);i.layers=this.layers,i.up.set(0,0,-1),i.lookAt(new QA(0,-1,0)),this.add(i);const t=new Wg(ba,Ta,A,B);t.layers=this.layers,t.up.set(0,-1,0),t.lookAt(new QA(0,0,1)),this.add(t);const e=new Wg(ba,Ta,A,B);e.layers=this.layers,e.up.set(0,-1,0),e.lookAt(new QA(0,0,-1)),this.add(e)}update(A,B){this.parent===null&&this.updateMatrixWorld();const E=this.renderTarget,[g,I,C,i,t,e]=this.children,n=A.getRenderTarget(),w=A.toneMapping,D=A.xr.enabled;A.toneMapping=It,A.xr.enabled=!1;const c=E.texture.generateMipmaps;E.texture.generateMipmaps=!1,A.setRenderTarget(E,0),A.render(B,g),A.setRenderTarget(E,1),A.render(B,I),A.setRenderTarget(E,2),A.render(B,C),A.setRenderTarget(E,3),A.render(B,i),A.setRenderTarget(E,4),A.render(B,t),E.texture.generateMipmaps=c,A.setRenderTarget(E,5),A.render(B,e),A.setRenderTarget(n),A.toneMapping=w,A.xr.enabled=D,E.texture.needsPMREMUpdate=!0}}class uM extends sg{constructor(A,B,E,g,I,C,i,t,e,n){A=A!==void 0?A:[],B=B!==void 0?B:Rs,super(A,B,E,g,I,C,i,t,e,n),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(A){this.image=A}}class ub extends bC{constructor(A,B={}){super(A,A,B),this.isWebGLCubeRenderTarget=!0;const E={width:A,height:A,depth:1},g=[E,E,E,E,E,E];this.texture=new uM(g,B.mapping,B.wrapS,B.wrapT,B.magFilter,B.minFilter,B.format,B.type,B.anisotropy,B.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=B.generateMipmaps!==void 0?B.generateMipmaps:!1,this.texture.minFilter=B.minFilter!==void 0?B.minFilter:jE}fromEquirectangularTexture(A,B){this.texture.type=B.type,this.texture.encoding=B.encoding,this.texture.generateMipmaps=B.generateMipmaps,this.texture.minFilter=B.minFilter,this.texture.magFilter=B.magFilter;const E={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
+ #include
+
+ }
+ `,fragmentShader:`
+
+ uniform sampler2D tEquirect;
+
+ varying vec3 vWorldDirection;
+
+ #include
+
+ void main() {
+
+ vec3 direction = normalize( vWorldDirection );
+
+ vec2 sampleUV = equirectUv( direction );
+
+ gl_FragColor = texture2D( tEquirect, sampleUV );
+
+ }
+ `},g=new Bo(5,5,5),I=new qt({name:"CubemapFromEquirect",uniforms:Sr(E.uniforms),vertexShader:E.vertexShader,fragmentShader:E.fragmentShader,side:ZC,blending:ze});I.uniforms.tEquirect.value=B;const C=new oI(g,I),i=B.minFilter;return B.minFilter===JD&&(B.minFilter=jE),new fb(1,10,this).update(A,C),B.minFilter=i,C.geometry.dispose(),C.material.dispose(),this}clear(A,B,E,g){const I=A.getRenderTarget();for(let C=0;C<6;C++)A.setRenderTarget(this,C),A.clear(B,E,g);A.setRenderTarget(I)}}const cd=new QA,iO=new QA,tO=new wi;class $o{constructor(A=new QA(1,0,0),B=0){this.isPlane=!0,this.normal=A,this.constant=B}set(A,B){return this.normal.copy(A),this.constant=B,this}setComponents(A,B,E,g){return this.normal.set(A,B,E),this.constant=g,this}setFromNormalAndCoplanarPoint(A,B){return this.normal.copy(A),this.constant=-B.dot(this.normal),this}setFromCoplanarPoints(A,B,E){const g=cd.subVectors(E,B).cross(iO.subVectors(A,B)).normalize();return this.setFromNormalAndCoplanarPoint(g,A),this}copy(A){return this.normal.copy(A.normal),this.constant=A.constant,this}normalize(){const A=1/this.normal.length();return this.normal.multiplyScalar(A),this.constant*=A,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(A){return this.normal.dot(A)+this.constant}distanceToSphere(A){return this.distanceToPoint(A.center)-A.radius}projectPoint(A,B){return B.copy(this.normal).multiplyScalar(-this.distanceToPoint(A)).add(A)}intersectLine(A,B){const E=A.delta(cd),g=this.normal.dot(E);if(g===0)return this.distanceToPoint(A.start)===0?B.copy(A.start):null;const I=-(A.start.dot(this.normal)+this.constant)/g;return I<0||I>1?null:B.copy(E).multiplyScalar(I).add(A.start)}intersectsLine(A){const B=this.distanceToPoint(A.start),E=this.distanceToPoint(A.end);return B<0&&E>0||E<0&&B>0}intersectsBox(A){return A.intersectsPlane(this)}intersectsSphere(A){return A.intersectsPlane(this)}coplanarPoint(A){return A.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(A,B){const E=B||tO.getNormalMatrix(A),g=this.coplanarPoint(cd).applyMatrix4(A),I=this.normal.applyMatrix3(E).normalize();return this.constant=-g.dot(I),this}translate(A){return this.constant-=A.dot(this.normal),this}equals(A){return A.normal.equals(this.normal)&&A.constant===this.constant}clone(){return new this.constructor().copy(this)}}const va=new ZD,qG=new QA;class Py{constructor(A=new $o,B=new $o,E=new $o,g=new $o,I=new $o,C=new $o){this.planes=[A,B,E,g,I,C]}set(A,B,E,g,I,C){const i=this.planes;return i[0].copy(A),i[1].copy(B),i[2].copy(E),i[3].copy(g),i[4].copy(I),i[5].copy(C),this}copy(A){const B=this.planes;for(let E=0;E<6;E++)B[E].copy(A.planes[E]);return this}setFromProjectionMatrix(A){const B=this.planes,E=A.elements,g=E[0],I=E[1],C=E[2],i=E[3],t=E[4],e=E[5],n=E[6],w=E[7],D=E[8],c=E[9],G=E[10],l=E[11],M=E[12],d=E[13],p=E[14],R=E[15];return B[0].setComponents(i-g,w-t,l-D,R-M).normalize(),B[1].setComponents(i+g,w+t,l+D,R+M).normalize(),B[2].setComponents(i+I,w+e,l+c,R+d).normalize(),B[3].setComponents(i-I,w-e,l-c,R-d).normalize(),B[4].setComponents(i-C,w-n,l-G,R-p).normalize(),B[5].setComponents(i+C,w+n,l+G,R+p).normalize(),this}intersectsObject(A){const B=A.geometry;return B.boundingSphere===null&&B.computeBoundingSphere(),va.copy(B.boundingSphere).applyMatrix4(A.matrixWorld),this.intersectsSphere(va)}intersectsSprite(A){return va.center.set(0,0,0),va.radius=.7071067811865476,va.applyMatrix4(A.matrixWorld),this.intersectsSphere(va)}intersectsSphere(A){const B=this.planes,E=A.center,g=-A.radius;for(let I=0;I<6;I++)if(B[I].distanceToPoint(E)0?A.max.x:A.min.x,qG.y=g.normal.y>0?A.max.y:A.min.y,qG.z=g.normal.z>0?A.max.z:A.min.z,g.distanceToPoint(qG)<0)return!1}return!0}containsPoint(A){const B=this.planes;for(let E=0;E<6;E++)if(B[E].distanceToPoint(A)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Rb(){let Q=null,A=!1,B=null,E=null;function g(I,C){B(I,C),E=Q.requestAnimationFrame(g)}return{start:function(){A!==!0&&B!==null&&(E=Q.requestAnimationFrame(g),A=!0)},stop:function(){Q.cancelAnimationFrame(E),A=!1},setAnimationLoop:function(I){B=I},setContext:function(I){Q=I}}}function eO(Q,A){const B=A.isWebGL2,E=new WeakMap;function g(e,n){const w=e.array,D=e.usage,c=Q.createBuffer();Q.bindBuffer(n,c),Q.bufferData(n,w,D),e.onUploadCallback();let G;if(w instanceof Float32Array)G=5126;else if(w instanceof Uint16Array)if(e.isFloat16BufferAttribute)if(B)G=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else G=5123;else if(w instanceof Int16Array)G=5122;else if(w instanceof Uint32Array)G=5125;else if(w instanceof Int32Array)G=5124;else if(w instanceof Int8Array)G=5120;else if(w instanceof Uint8Array)G=5121;else if(w instanceof Uint8ClampedArray)G=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+w);return{buffer:c,type:G,bytesPerElement:w.BYTES_PER_ELEMENT,version:e.version}}function I(e,n,w){const D=n.array,c=n.updateRange;Q.bindBuffer(w,e),c.count===-1?Q.bufferSubData(w,0,D):(B?Q.bufferSubData(w,c.offset*D.BYTES_PER_ELEMENT,D,c.offset,c.count):Q.bufferSubData(w,c.offset*D.BYTES_PER_ELEMENT,D.subarray(c.offset,c.offset+c.count)),c.count=-1)}function C(e){return e.isInterleavedBufferAttribute&&(e=e.data),E.get(e)}function i(e){e.isInterleavedBufferAttribute&&(e=e.data);const n=E.get(e);n&&(Q.deleteBuffer(n.buffer),E.delete(e))}function t(e,n){if(e.isGLBufferAttribute){const D=E.get(e);(!D||D.version 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 );
+}
+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 );
+}
+#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`,MO=`#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 srgb = XYZ_TO_REC709 * xyz;
+ return srgb;
+}
+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 R21 = R12;
+ 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`,GO=`#ifdef USE_BUMPMAP
+ uniform sampler2D bumpMap;
+ uniform float bumpScale;
+ vec2 dHdxy_fwd() {
+ vec2 dSTdx = dFdx( vUv );
+ vec2 dSTdy = dFdy( vUv );
+ float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
+ float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
+ float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
+ return vec2( dBx, dBy );
+ }
+ vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
+ vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
+ vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
+ 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`,lO=`#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`,yO=`#if NUM_CLIPPING_PLANES > 0
+ varying vec3 vClipPosition;
+ uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
+#endif`,kO=`#if NUM_CLIPPING_PLANES > 0
+ varying vec3 vClipPosition;
+#endif`,FO=`#if NUM_CLIPPING_PLANES > 0
+ vClipPosition = - mvPosition.xyz;
+#endif`,dO=`#if defined( USE_COLOR_ALPHA )
+ diffuseColor *= vColor;
+#elif defined( USE_COLOR )
+ diffuseColor.rgb *= vColor;
+#endif`,pO=`#if defined( USE_COLOR_ALPHA )
+ varying vec4 vColor;
+#elif defined( USE_COLOR )
+ varying vec3 vColor;
+#endif`,UO=`#if defined( USE_COLOR_ALPHA )
+ varying vec4 vColor;
+#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )
+ varying vec3 vColor;
+#endif`,fO=`#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`,uO=`#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 color ) { return dot( color, vec3( 0.3333 ) ); }
+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;
+};
+struct GeometricContext {
+ vec3 position;
+ vec3 normal;
+ vec3 viewDir;
+#ifdef USE_CLEARCOAT
+ vec3 clearcoatNormal;
+#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 linearToRelativeLuminance( const in vec3 color ) {
+ vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
+ return dot( weights, color.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 );
+}`,RO=`#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 );
+ 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 r0 1.0
+ #define v0 0.339
+ #define m0 - 2.0
+ #define r1 0.8
+ #define v1 0.276
+ #define m1 - 1.0
+ #define r4 0.4
+ #define v4 0.046
+ #define m4 2.0
+ #define r5 0.305
+ #define v5 0.016
+ #define m5 3.0
+ #define r6 0.21
+ #define v6 0.0038
+ #define m6 4.0
+ float roughnessToMip( float roughness ) {
+ float mip = 0.0;
+ if ( roughness >= r1 ) {
+ mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;
+ } else if ( roughness >= r4 ) {
+ mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;
+ } else if ( roughness >= r5 ) {
+ mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;
+ } else if ( roughness >= r6 ) {
+ mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;
+ } else {
+ mip = - 2.0 * log2( 1.16 * roughness ); }
+ return mip;
+ }
+ vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
+ float mip = clamp( roughnessToMip( roughness ), 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`,NO=`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`,YO=`#ifdef USE_DISPLACEMENTMAP
+ uniform sampler2D displacementMap;
+ uniform float displacementScale;
+ uniform float displacementBias;
+#endif`,HO=`#ifdef USE_DISPLACEMENTMAP
+ transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );
+#endif`,KO=`#ifdef USE_EMISSIVEMAP
+ vec4 emissiveColor = texture2D( emissiveMap, vUv );
+ totalEmissiveRadiance *= emissiveColor.rgb;
+#endif`,mO=`#ifdef USE_EMISSIVEMAP
+ uniform sampler2D emissiveMap;
+#endif`,LO="gl_FragColor = linearToOutputTexel( gl_FragColor );",JO=`vec4 LinearToLinear( in vec4 value ) {
+ return value;
+}
+vec4 LinearTosRGB( 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 );
+}`,SO=`#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 ) );
+ #elif defined( ENVMAP_TYPE_CUBE_UV )
+ vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );
+ #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`,ZO=`#ifdef USE_ENVMAP
+ uniform float envMapIntensity;
+ uniform float flipEnvMap;
+ #ifdef ENVMAP_TYPE_CUBE
+ uniform samplerCube envMap;
+ #else
+ uniform sampler2D envMap;
+ #endif
+
+#endif`,xO=`#ifdef USE_ENVMAP
+ uniform float reflectivity;
+ #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
+ #define ENV_WORLDPOS
+ #endif
+ #ifdef ENV_WORLDPOS
+ varying vec3 vWorldPosition;
+ uniform float refractionRatio;
+ #else
+ varying vec3 vReflect;
+ #endif
+#endif`,bO=`#ifdef USE_ENVMAP
+ #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )
+ #define ENV_WORLDPOS
+ #endif
+ #ifdef ENV_WORLDPOS
+
+ varying vec3 vWorldPosition;
+ #else
+ varying vec3 vReflect;
+ uniform float refractionRatio;
+ #endif
+#endif`,TO=`#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`,vO=`#ifdef USE_FOG
+ vFogDepth = - mvPosition.z;
+#endif`,PO=`#ifdef USE_FOG
+ varying float vFogDepth;
+#endif`,WO=`#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`,VO=`#ifdef USE_FOG
+ uniform vec3 fogColor;
+ varying float vFogDepth;
+ #ifdef FOG_EXP2
+ uniform float fogDensity;
+ #else
+ uniform float fogNear;
+ uniform float fogFar;
+ #endif
+#endif`,jO=`#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
+ return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
+ #endif
+}`,XO=`#ifdef USE_LIGHTMAP
+ vec4 lightMapTexel = texture2D( lightMap, vUv2 );
+ vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
+ reflectedLight.indirectDiffuse += lightMapIrradiance;
+#endif`,qO=`#ifdef USE_LIGHTMAP
+ uniform sampler2D lightMap;
+ uniform float lightMapIntensity;
+#endif`,OO=`vec3 diffuse = vec3( 1.0 );
+GeometricContext geometry;
+geometry.position = mvPosition.xyz;
+geometry.normal = normalize( transformedNormal );
+geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );
+GeometricContext backGeometry;
+backGeometry.position = geometry.position;
+backGeometry.normal = -geometry.normal;
+backGeometry.viewDir = geometry.viewDir;
+vLightFront = vec3( 0.0 );
+vIndirectFront = vec3( 0.0 );
+#ifdef DOUBLE_SIDED
+ vLightBack = vec3( 0.0 );
+ vIndirectBack = vec3( 0.0 );
+#endif
+IncidentLight directLight;
+float dotNL;
+vec3 directLightColor_Diffuse;
+vIndirectFront += getAmbientLightIrradiance( ambientLightColor );
+vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );
+#ifdef DOUBLE_SIDED
+ vIndirectBack += getAmbientLightIrradiance( ambientLightColor );
+ vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );
+#endif
+#if NUM_POINT_LIGHTS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
+ getPointLightInfo( pointLights[ i ], geometry, directLight );
+ dotNL = dot( geometry.normal, directLight.direction );
+ directLightColor_Diffuse = directLight.color;
+ vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
+ #ifdef DOUBLE_SIDED
+ vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
+ #endif
+ }
+ #pragma unroll_loop_end
+#endif
+#if NUM_SPOT_LIGHTS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
+ getSpotLightInfo( spotLights[ i ], geometry, directLight );
+ dotNL = dot( geometry.normal, directLight.direction );
+ directLightColor_Diffuse = directLight.color;
+ vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
+ #ifdef DOUBLE_SIDED
+ vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
+ #endif
+ }
+ #pragma unroll_loop_end
+#endif
+#if NUM_DIR_LIGHTS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
+ getDirectionalLightInfo( directionalLights[ i ], geometry, directLight );
+ dotNL = dot( geometry.normal, directLight.direction );
+ directLightColor_Diffuse = directLight.color;
+ vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
+ #ifdef DOUBLE_SIDED
+ vLightBack += saturate( - dotNL ) * directLightColor_Diffuse;
+ #endif
+ }
+ #pragma unroll_loop_end
+#endif
+#if NUM_HEMI_LIGHTS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
+ vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
+ #ifdef DOUBLE_SIDED
+ vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );
+ #endif
+ }
+ #pragma unroll_loop_end
+#endif`,zO=`uniform bool receiveShadow;
+uniform vec3 ambientLightColor;
+uniform vec3 lightProbe[ 9 ];
+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 ( PHYSICALLY_CORRECT_LIGHTS )
+ float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
+ if ( cutoffDistance > 0.0 ) {
+ distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
+ }
+ return distanceFalloff;
+ #else
+ if ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
+ return pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );
+ }
+ return 1.0;
+ #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, const in GeometricContext geometry, 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 GeometricContext geometry, out IncidentLight light ) {
+ vec3 lVector = pointLight.position - geometry.position;
+ 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 GeometricContext geometry, out IncidentLight light ) {
+ vec3 lVector = spotLight.position - geometry.position;
+ 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`,_O=`#if defined( USE_ENVMAP )
+ vec3 getIBLIrradiance( const in vec3 normal ) {
+ #if defined( 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 ) {
+ #if defined( 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
+ }
+#endif`,$O=`ToonMaterial material;
+material.diffuseColor = diffuseColor.rgb;`,A5=`varying vec3 vViewPosition;
+struct ToonMaterial {
+ vec3 diffuseColor;
+};
+void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
+ vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, 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
+#define Material_LightProbeLOD( material ) (0)`,Q5=`BlinnPhongMaterial material;
+material.diffuseColor = diffuseColor.rgb;
+material.specularColor = specular;
+material.specularShininess = shininess;
+material.specularStrength = specularStrength;`,B5=`varying vec3 vViewPosition;
+struct BlinnPhongMaterial {
+ vec3 diffuseColor;
+ vec3 specularColor;
+ float specularShininess;
+ float specularStrength;
+};
+void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
+ float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
+ vec3 irradiance = dotNL * directLight.color;
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+ reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;
+}
+void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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
+#define Material_LightProbeLOD( material ) (0)`,E5=`PhysicalMaterial material;
+material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
+vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );
+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
+ #ifdef SPECULAR
+ float specularIntensityFactor = specularIntensity;
+ vec3 specularColorFactor = specularColor;
+ #ifdef USE_SPECULARINTENSITYMAP
+ specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;
+ #endif
+ #ifdef USE_SPECULARCOLORMAP
+ specularColorFactor *= texture2D( specularColorMap, vUv ).rgb;
+ #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( ( ior - 1.0 ) / ( 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, vUv ).x;
+ #endif
+ #ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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, vUv ).r;
+ #endif
+ #ifdef USE_IRIDESCENCE_THICKNESSMAP
+ material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;
+ #else
+ material.iridescenceThickness = iridescenceThicknessMaximum;
+ #endif
+#endif
+#ifdef USE_SHEEN
+ material.sheenColor = sheenColor;
+ #ifdef USE_SHEENCOLORMAP
+ material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;
+ #endif
+ material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
+ #ifdef USE_SHEENROUGHNESSMAP
+ material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;
+ #endif
+#endif`,g5=`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
+};
+vec3 clearcoatSpecular = vec3( 0.0 );
+vec3 sheenSpecular = vec3( 0.0 );
+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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
+ vec3 normal = geometry.normal;
+ vec3 viewDir = geometry.viewDir;
+ vec3 position = geometry.position;
+ 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
+ float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
+ vec3 irradiance = dotNL * directLight.color;
+ #ifdef USE_CLEARCOAT
+ float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );
+ vec3 ccIrradiance = dotNLcc * directLight.color;
+ clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
+ #endif
+ #ifdef USE_SHEEN
+ sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );
+ #endif
+ #ifdef USE_IRIDESCENCE
+ reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );
+ #else
+ reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );
+ #endif
+ reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
+}
+void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
+ #ifdef USE_CLEARCOAT
+ clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
+ #endif
+ #ifdef USE_SHEEN
+ sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );
+ #endif
+ vec3 singleScattering = vec3( 0.0 );
+ vec3 multiScattering = vec3( 0.0 );
+ vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
+ #ifdef USE_IRIDESCENCE
+ computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
+ #else
+ computeMultiscattering( geometry.normal, geometry.viewDir, 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 );
+}`,I5=`
+GeometricContext geometry;
+geometry.position = - vViewPosition;
+geometry.normal = normal;
+geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
+#ifdef USE_CLEARCOAT
+ geometry.clearcoatNormal = clearcoatNormal;
+#endif
+#ifdef USE_IRIDESCENCE
+float dotNVi = saturate( dot( normal, geometry.viewDir ) );
+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, geometry, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
+ pointLightShadow = pointLightShadows[ i ];
+ directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometry, material, reflectedLight );
+ }
+ #pragma unroll_loop_end
+#endif
+#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
+ SpotLight spotLight;
+ #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, geometry, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
+ spotLightShadow = spotLightShadows[ i ];
+ directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometry, 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, geometry, directLight );
+ #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
+ directionalLightShadow = directionalLightShadows[ i ];
+ directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
+ #endif
+ RE_Direct( directLight, geometry, 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, geometry, material, reflectedLight );
+ }
+ #pragma unroll_loop_end
+#endif
+#if defined( RE_IndirectDiffuse )
+ vec3 iblIrradiance = vec3( 0.0 );
+ vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
+ irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );
+ #if ( NUM_HEMI_LIGHTS > 0 )
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
+ irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );
+ }
+ #pragma unroll_loop_end
+ #endif
+#endif
+#if defined( RE_IndirectSpecular )
+ vec3 radiance = vec3( 0.0 );
+ vec3 clearcoatRadiance = vec3( 0.0 );
+#endif`,C5=`#if defined( RE_IndirectDiffuse )
+ #ifdef USE_LIGHTMAP
+ vec4 lightMapTexel = texture2D( lightMap, vUv2 );
+ vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
+ irradiance += lightMapIrradiance;
+ #endif
+ #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
+ iblIrradiance += getIBLIrradiance( geometry.normal );
+ #endif
+#endif
+#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
+ radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );
+ #ifdef USE_CLEARCOAT
+ clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );
+ #endif
+#endif`,i5=`#if defined( RE_IndirectDiffuse )
+ RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
+#endif
+#if defined( RE_IndirectSpecular )
+ RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );
+#endif`,t5=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
+ gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
+#endif`,e5=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
+ uniform float logDepthBufFC;
+ varying float vFragDepth;
+ varying float vIsPerspective;
+#endif`,o5=`#ifdef USE_LOGDEPTHBUF
+ #ifdef USE_LOGDEPTHBUF_EXT
+ varying float vFragDepth;
+ varying float vIsPerspective;
+ #else
+ uniform float logDepthBufFC;
+ #endif
+#endif`,s5=`#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`,n5=`#ifdef USE_MAP
+ vec4 sampledDiffuseColor = texture2D( map, vUv );
+ #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`,D5=`#ifdef USE_MAP
+ uniform sampler2D map;
+#endif`,a5=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+ vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
+#endif
+#ifdef USE_MAP
+ diffuseColor *= texture2D( map, uv );
+#endif
+#ifdef USE_ALPHAMAP
+ diffuseColor.a *= texture2D( alphaMap, uv ).g;
+#endif`,r5=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
+ uniform mat3 uvTransform;
+#endif
+#ifdef USE_MAP
+ uniform sampler2D map;
+#endif
+#ifdef USE_ALPHAMAP
+ uniform sampler2D alphaMap;
+#endif`,w5=`float metalnessFactor = metalness;
+#ifdef USE_METALNESSMAP
+ vec4 texelMetalness = texture2D( metalnessMap, vUv );
+ metalnessFactor *= texelMetalness.b;
+#endif`,c5=`#ifdef USE_METALNESSMAP
+ uniform sampler2D metalnessMap;
+#endif`,h5=`#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`,M5=`#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`,G5=`#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`,l5=`#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`,y5=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
+#ifdef FLAT_SHADED
+ vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
+ vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
+ vec3 normal = normalize( cross( fdx, fdy ) );
+#else
+ vec3 normal = normalize( vNormal );
+ #ifdef DOUBLE_SIDED
+ normal = normal * faceDirection;
+ #endif
+ #ifdef USE_TANGENT
+ vec3 tangent = normalize( vTangent );
+ vec3 bitangent = normalize( vBitangent );
+ #ifdef DOUBLE_SIDED
+ tangent = tangent * faceDirection;
+ bitangent = bitangent * faceDirection;
+ #endif
+ #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )
+ mat3 vTBN = mat3( tangent, bitangent, normal );
+ #endif
+ #endif
+#endif
+vec3 geometryNormal = normal;`,k5=`#ifdef OBJECTSPACE_NORMALMAP
+ normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
+ #ifdef FLIP_SIDED
+ normal = - normal;
+ #endif
+ #ifdef DOUBLE_SIDED
+ normal = normal * faceDirection;
+ #endif
+ normal = normalize( normalMatrix * normal );
+#elif defined( TANGENTSPACE_NORMALMAP )
+ vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
+ mapN.xy *= normalScale;
+ #ifdef USE_TANGENT
+ normal = normalize( vTBN * mapN );
+ #else
+ normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );
+ #endif
+#elif defined( USE_BUMPMAP )
+ normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
+#endif`,F5=`#ifndef FLAT_SHADED
+ varying vec3 vNormal;
+ #ifdef USE_TANGENT
+ varying vec3 vTangent;
+ varying vec3 vBitangent;
+ #endif
+#endif`,d5=`#ifndef FLAT_SHADED
+ varying vec3 vNormal;
+ #ifdef USE_TANGENT
+ varying vec3 vTangent;
+ varying vec3 vBitangent;
+ #endif
+#endif`,p5=`#ifndef FLAT_SHADED
+ vNormal = normalize( transformedNormal );
+ #ifdef USE_TANGENT
+ vTangent = normalize( transformedTangent );
+ vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
+ #endif
+#endif`,U5=`#ifdef USE_NORMALMAP
+ uniform sampler2D normalMap;
+ uniform vec2 normalScale;
+#endif
+#ifdef OBJECTSPACE_NORMALMAP
+ uniform mat3 normalMatrix;
+#endif
+#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )
+ vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {
+ vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
+ vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
+ vec2 st0 = dFdx( vUv.st );
+ vec2 st1 = dFdy( vUv.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 : faceDirection * inversesqrt( det );
+ return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );
+ }
+#endif`,f5=`#ifdef USE_CLEARCOAT
+ vec3 clearcoatNormal = geometryNormal;
+#endif`,u5=`#ifdef USE_CLEARCOAT_NORMALMAP
+ vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0;
+ clearcoatMapN.xy *= clearcoatNormalScale;
+ #ifdef USE_TANGENT
+ clearcoatNormal = normalize( vTBN * clearcoatMapN );
+ #else
+ clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection );
+ #endif
+#endif`,R5=`#ifdef USE_CLEARCOATMAP
+ uniform sampler2D clearcoatMap;
+#endif
+#ifdef USE_CLEARCOAT_ROUGHNESSMAP
+ uniform sampler2D clearcoatRoughnessMap;
+#endif
+#ifdef USE_CLEARCOAT_NORMALMAP
+ uniform sampler2D clearcoatNormalMap;
+ uniform vec2 clearcoatNormalScale;
+#endif`,N5=`#ifdef USE_IRIDESCENCEMAP
+ uniform sampler2D iridescenceMap;
+#endif
+#ifdef USE_IRIDESCENCE_THICKNESSMAP
+ uniform sampler2D iridescenceThicknessMap;
+#endif`,Y5=`#ifdef OPAQUE
+diffuseColor.a = 1.0;
+#endif
+#ifdef USE_TRANSMISSION
+diffuseColor.a *= transmissionAlpha + 0.1;
+#endif
+gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,H5=`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 );
+}
+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 linearClipZ, const in float near, const in float far ) {
+ return linearClipZ * ( 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 invClipZ, const in float near, const in float far ) {
+ return ( near * far ) / ( ( far - near ) * invClipZ - far );
+}`,K5=`#ifdef PREMULTIPLIED_ALPHA
+ gl_FragColor.rgb *= gl_FragColor.a;
+#endif`,m5=`vec4 mvPosition = vec4( transformed, 1.0 );
+#ifdef USE_INSTANCING
+ mvPosition = instanceMatrix * mvPosition;
+#endif
+mvPosition = modelViewMatrix * mvPosition;
+gl_Position = projectionMatrix * mvPosition;`,L5=`#ifdef DITHERING
+ gl_FragColor.rgb = dithering( gl_FragColor.rgb );
+#endif`,J5=`#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`,S5=`float roughnessFactor = roughness;
+#ifdef USE_ROUGHNESSMAP
+ vec4 texelRoughness = texture2D( roughnessMap, vUv );
+ roughnessFactor *= texelRoughness.g;
+#endif`,Z5=`#ifdef USE_ROUGHNESSMAP
+ uniform sampler2D roughnessMap;
+#endif`,x5=`#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 ];
+ varying vec4 vSpotShadowCoord[ 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;
+ bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
+ bool inFrustum = all( inFrustumVec );
+ bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
+ bool frustumTest = all( frustumTestVec );
+ 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`,b5=`#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
+ uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];
+ varying vec4 vSpotShadowCoord[ 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 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`,T5=`#ifdef USE_SHADOWMAP
+ #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0
+ vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
+ vec4 shadowWorldPosition;
+ #endif
+ #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_SPOT_LIGHT_SHADOWS > 0
+ #pragma unroll_loop_start
+ for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
+ shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );
+ vSpotShadowCoord[ i ] = spotShadowMatrix[ 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`,v5=`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, vSpotShadowCoord[ 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;
+}`,P5=`#ifdef USE_SKINNING
+ mat4 boneMatX = getBoneMatrix( skinIndex.x );
+ mat4 boneMatY = getBoneMatrix( skinIndex.y );
+ mat4 boneMatZ = getBoneMatrix( skinIndex.z );
+ mat4 boneMatW = getBoneMatrix( skinIndex.w );
+#endif`,W5=`#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`,V5=`#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`,j5=`#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`,X5=`float specularStrength;
+#ifdef USE_SPECULARMAP
+ vec4 texelSpecular = texture2D( specularMap, vUv );
+ specularStrength = texelSpecular.r;
+#else
+ specularStrength = 1.0;
+#endif`,q5=`#ifdef USE_SPECULARMAP
+ uniform sampler2D specularMap;
+#endif`,O5=`#if defined( TONE_MAPPING )
+ gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
+#endif`,z5=`#ifndef saturate
+#define saturate( a ) clamp( a, 0.0, 1.0 )
+#endif
+uniform float toneMappingExposure;
+vec3 LinearToneMapping( vec3 color ) {
+ return 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; }`,_5=`#ifdef USE_TRANSMISSION
+ float transmissionAlpha = 1.0;
+ float transmissionFactor = transmission;
+ float thicknessFactor = thickness;
+ #ifdef USE_TRANSMISSIONMAP
+ transmissionFactor *= texture2D( transmissionMap, vUv ).r;
+ #endif
+ #ifdef USE_THICKNESSMAP
+ thicknessFactor *= texture2D( thicknessMap, vUv ).g;
+ #endif
+ vec3 pos = vWorldPosition;
+ vec3 v = normalize( cameraPosition - pos );
+ vec3 n = inverseTransformDirection( normal, viewMatrix );
+ vec4 transmission = getIBLVolumeRefraction(
+ n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,
+ pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,
+ attenuationColor, attenuationDistance );
+ totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );
+ transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );
+#endif`,$5=`#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;
+ 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 framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
+ #ifdef texture2DLodEXT
+ return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );
+ #else
+ return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );
+ #endif
+ }
+ vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
+ if ( attenuationDistance == 0.0 ) {
+ return radiance;
+ } else {
+ vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
+ vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance;
+ }
+ }
+ 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 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );
+ vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
+ return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );
+ }
+#endif`,Az=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )
+ varying vec2 vUv;
+#endif`,Qz=`#ifdef USE_UV
+ #ifdef UVS_VERTEX_ONLY
+ vec2 vUv;
+ #else
+ varying vec2 vUv;
+ #endif
+ uniform mat3 uvTransform;
+#endif`,Bz=`#ifdef USE_UV
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
+#endif`,Ez=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
+ varying vec2 vUv2;
+#endif`,gz=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
+ attribute vec2 uv2;
+ varying vec2 vUv2;
+ uniform mat3 uv2Transform;
+#endif`,Iz=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
+ vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;
+#endif`,Cz=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )
+ vec4 worldPosition = vec4( transformed, 1.0 );
+ #ifdef USE_INSTANCING
+ worldPosition = instanceMatrix * worldPosition;
+ #endif
+ worldPosition = modelMatrix * worldPosition;
+#endif`;const iz=`varying vec2 vUv;
+uniform mat3 uvTransform;
+void main() {
+ vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
+ gl_Position = vec4( position.xy, 1.0, 1.0 );
+}`,tz=`uniform sampler2D t2D;
+varying vec2 vUv;
+void main() {
+ gl_FragColor = texture2D( t2D, vUv );
+ #ifdef DECODE_VIDEO_TEXTURE
+ gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );
+ #endif
+ #include
+ #include
+}`,ez=`varying vec3 vWorldDirection;
+#include
+void main() {
+ vWorldDirection = transformDirection( position, modelMatrix );
+ #include
+ #include
+ gl_Position.z = gl_Position.w;
+}`,oz=`#include
+uniform float opacity;
+varying vec3 vWorldDirection;
+#include
+void main() {
+ vec3 vReflect = vWorldDirection;
+ #include
+ gl_FragColor = envColor;
+ gl_FragColor.a *= opacity;
+ #include
+ #include
+}`,sz=`#include
+#include
+#include
+#include
+#include
+#include
+#include
+varying vec2 vHighPrecisionZW;
+void main() {
+ #include
+ #include
+ #ifdef USE_DISPLACEMENTMAP
+ #include
+ #include
+ #include
+ #endif
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ vHighPrecisionZW = gl_Position.zw;
+}`,nz=`#if DEPTH_PACKING == 3200
+ uniform float opacity;
+#endif
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+varying vec2 vHighPrecisionZW;
+void main() {
+ #include
+ vec4 diffuseColor = vec4( 1.0 );
+ #if DEPTH_PACKING == 3200
+ diffuseColor.a = opacity;
+ #endif
+ #include
+ #include
+ #include
+ #include
+ 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
+}`,Dz=`#define DISTANCE
+varying vec3 vWorldPosition;
+#include
+#include
+#include
+#include
+#include
+#include
+void main() {
+ #include
+ #include
+ #ifdef USE_DISPLACEMENTMAP
+ #include
+ #include
+ #include
+ #endif
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ vWorldPosition = worldPosition.xyz;
+}`,az=`#define DISTANCE
+uniform vec3 referencePosition;
+uniform float nearDistance;
+uniform float farDistance;
+varying vec3 vWorldPosition;
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+void main () {
+ #include
+ vec4 diffuseColor = vec4( 1.0 );
+ #include
+ #include
+ #include
+ float dist = length( vWorldPosition - referencePosition );
+ dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
+ dist = saturate( dist );
+ gl_FragColor = packDepthToRGBA( dist );
+}`,rz=`varying vec3 vWorldDirection;
+#include
+void main() {
+ vWorldDirection = transformDirection( position, modelMatrix );
+ #include
+ #include
+}`,wz=`uniform sampler2D tEquirect;
+varying vec3 vWorldDirection;
+#include
+void main() {
+ vec3 direction = normalize( vWorldDirection );
+ vec2 sampleUV = equirectUv( direction );
+ gl_FragColor = texture2D( tEquirect, sampleUV );
+ #include
+ #include
+}`,cz=`uniform float scale;
+attribute float lineDistance;
+varying float vLineDistance;
+#include
+#include
+#include
+#include
+#include
+#include
+void main() {
+ vLineDistance = scale * lineDistance;
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+}`,hz=`uniform vec3 diffuse;
+uniform float opacity;
+uniform float dashSize;
+uniform float totalSize;
+varying float vLineDistance;
+#include
+#include
+#include
+#include
+#include
+void main() {
+ #include
+ if ( mod( vLineDistance, totalSize ) > dashSize ) {
+ discard;
+ }
+ vec3 outgoingLight = vec3( 0.0 );
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include
+ #include
+ outgoingLight = diffuseColor.rgb;
+ #include
+ #include
+ #include
+ #include
+ #include
+}`,Mz=`#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+void main() {
+ #include
+ #include
+ #include
+ #include
+ #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
+ #include
+ #include
+ #include
+ #include
+ #include
+ #endif
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+}`,Gz=`uniform vec3 diffuse;
+uniform float opacity;
+#ifndef FLAT_SHADED
+ varying vec3 vNormal;
+#endif
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+void main() {
+ #include
+ vec4 diffuseColor = vec4( diffuse, opacity );
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
+ #ifdef USE_LIGHTMAP
+ vec4 lightMapTexel = texture2D( lightMap, vUv2 );
+ reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
+ #else
+ reflectedLight.indirectDiffuse += vec3( 1.0 );
+ #endif
+ #include
+ reflectedLight.indirectDiffuse *= diffuseColor.rgb;
+ vec3 outgoingLight = reflectedLight.indirectDiffuse;
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+ #include
+}`,lz=`#define LAMBERT
+varying vec3 vLightFront;
+varying vec3 vIndirectFront;
+#ifdef DOUBLE_SIDED
+ varying vec3 vLightBack;
+ varying vec3 vIndirectBack;
+#endif
+#include
+#include