/*! For license information please see main.df8d747e.js.LICENSE.txt */ (()=>{"use strict";var e={4(e,t,n){var i=n(67),r=n(43),a=n(950);function s(e){var t="https://react.dev/errors/"+e;if(1)":-1--r||l[i]!==u[r]){var c="\n"+l[i].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}}while(1<=i&&0<=r);break}}}finally{D=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?I(n):""}function L(e){switch(e.tag){case 26:case 27:case 5:return I(e.type);case 16:return I("Lazy");case 13:return I("Suspense");case 19:return I("SuspenseList");case 0:case 15:return e=F(e.type,!1);case 11:return e=F(e.type.render,!1);case 1:return e=F(e.type,!0);default:return""}}function N(e){try{var t="";do{t+=L(e),e=e.return}while(e);return t}catch(rB){return"\nError generating stack: "+rB.message+"\n"+rB.stack}}function O(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!==(4098&(t=e).flags)&&(n=t.return),e=t.return}while(e)}return 3===t.tag?n:null}function k(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function U(e){if(O(e)!==e)throw Error(s(188))}function z(e){var t=e.tag;if(5===t||26===t||27===t||6===t)return e;for(e=e.child;null!==e;){if(null!==(t=z(e)))return t;e=e.sibling}return null}var G=Array.isArray,H=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V={pending:!1,data:null,method:null,action:null},j=[],W=-1;function X(e){return{current:e}}function J(e){0>W||(e.current=j[W],j[W]=null,W--)}function K(e,t){W++,j[W]=e.current,e.current=t}var q=X(null),Y=X(null),Q=X(null),Z=X(null);function $(e,t){switch(K(Q,t),K(Y,e),K(q,null),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)&&(t=t.namespaceURI)?Qc(t):0;break;default:if(t=(e=8===e?t.parentNode:t).tagName,e=e.namespaceURI)t=Zc(e=Qc(e),t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}J(q),K(q,t)}function ee(){J(q),J(Y),J(Q)}function te(e){null!==e.memoizedState&&K(Z,e);var t=q.current,n=Zc(t,e.type);t!==n&&(K(Y,e),K(q,n))}function ne(e){Y.current===e&&(J(q),J(Y)),Z.current===e&&(J(Z),Oh._currentValue=V)}var ie=Object.prototype.hasOwnProperty,re=i.unstable_scheduleCallback,ae=i.unstable_cancelCallback,se=i.unstable_shouldYield,oe=i.unstable_requestPaint,le=i.unstable_now,ue=i.unstable_getCurrentPriorityLevel,ce=i.unstable_ImmediatePriority,he=i.unstable_UserBlockingPriority,de=i.unstable_NormalPriority,pe=i.unstable_LowPriority,fe=i.unstable_IdlePriority,me=i.log,ge=i.unstable_setDisableYieldValue,ve=null,ye=null;function _e(e){if("function"===typeof me&&ge(e),ye&&"function"===typeof ye.setStrictMode)try{ye.setStrictMode(ve,e)}catch(t){}}var be=Math.clz32?Math.clz32:function(e){return e>>>=0,0===e?32:31-(xe(e)/Se|0)|0},xe=Math.log,Se=Math.LN2;var Ae=128,Me=4194304;function we(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return 4194176&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ee(e,t){var n=e.pendingLanes;if(0===n)return 0;var i=0,r=e.suspendedLanes,a=e.pingedLanes,s=e.warmLanes;e=0!==e.finishedLanes;var o=134217727&n;return 0!==o?0!==(n=o&~r)?i=we(n):0!==(a&=o)?i=we(a):e||0!==(s=o&~s)&&(i=we(s)):0!==(o=n&~r)?i=we(o):0!==a?i=we(a):e||0!==(s=n&~s)&&(i=we(s)),0===i?0:0!==t&&t!==i&&0===(t&r)&&((r=i&-i)>=(s=t&-t)||32===r&&0!==(4194176&s))?t:i}function Te(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function Ce(e,t){switch(e){case 1:case 2:case 4:case 8:return t+250;case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function Re(){var e=Ae;return 0===(4194176&(Ae<<=1))&&(Ae=128),e}function Pe(){var e=Me;return 0===(62914560&(Me<<=1))&&(Me=4194304),e}function Be(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ie(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function De(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-be(t);e.entangledLanes|=t,e.entanglements[i]=1073741824|e.entanglements[i]|4194218&n}function Fe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-be(n),r=1<=Sn),wn=String.fromCharCode(32),En=!1;function Tn(e,t){switch(e){case"keyup":return-1!==bn.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Cn(e){return"object"===typeof(e=e.detail)&&"data"in e?e.data:null}var Rn=!1;var Pn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Bn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Pn[e.type]:"textarea"===t}function In(e,t,n,i){It?Dt?Dt.push(i):Dt=[i]:It=i,0<(t=Oc(t,"onChange")).length&&(n=new Zt("onChange","change",null,n,i),e.push({event:n,listeners:t}))}var Dn=null,Fn=null;function Ln(e){Rc(e,0)}function Nn(e){if(dt(qe(e)))return e}function On(e,t){if("change"===e)return t}var kn=!1;if(nt){var Un;if(nt){var zn="oninput"in document;if(!zn){var Gn=document.createElement("div");Gn.setAttribute("oninput","return;"),zn="function"===typeof Gn.oninput}Un=zn}else Un=!1;kn=Un&&(!document.documentMode||9=t)return{node:i,offset:t-e};e=n}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Yn(i)}}function Zn(e,t){return!(!e||!t)&&(e===t||(!e||3!==e.nodeType)&&(t&&3===t.nodeType?Zn(e,t.parentNode):"contains"in e?e.contains(t):!!e.compareDocumentPosition&&!!(16&e.compareDocumentPosition(t))))}function $n(e){for(var t=pt((e=null!=e&&null!=e.ownerDocument&&null!=e.ownerDocument.defaultView?e.ownerDocument.defaultView:window).document);t instanceof e.HTMLIFrameElement;){try{var n="string"===typeof t.contentWindow.location.href}catch(i){n=!1}if(!n)break;t=pt((e=t.contentWindow).document)}return t}function ei(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}function ti(e,t){var n=$n(t);t=e.focusedElem;var i=e.selectionRange;if(n!==t&&t&&t.ownerDocument&&Zn(t.ownerDocument.documentElement,t)){if(null!==i&&ei(t))if(e=i.start,void 0===(n=i.end)&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if((n=(e=t.ownerDocument||document)&&e.defaultView||window).getSelection){n=n.getSelection();var r=t.textContent.length,a=Math.min(i.start,r);i=void 0===i.end?a:Math.min(i.end,r),!n.extend&&a>i&&(r=i,i=a,a=r),r=Qn(t,a);var s=Qn(t,i);r&&s&&(1!==n.rangeCount||n.anchorNode!==r.node||n.anchorOffset!==r.offset||n.focusNode!==s.node||n.focusOffset!==s.offset)&&((e=e.createRange()).setStart(r.node,r.offset),n.removeAllRanges(),a>i?(n.addRange(e),n.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),n.addRange(e)))}for(e=[],n=t;n=n.parentNode;)1===n.nodeType&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for("function"===typeof t.focus&&t.focus(),t=0;t=document.documentMode,ii=null,ri=null,ai=null,si=!1;function oi(e,t,n){var i=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;si||null==ii||ii!==pt(i)||("selectionStart"in(i=ii)&&ei(i)?i={start:i.selectionStart,end:i.selectionEnd}:i={anchorNode:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset},ai&&qn(ai,i)||(ai=i,0<(i=Oc(ri,"onSelect")).length&&(t=new Zt("onSelect","select",null,t,n),e.push({event:t,listeners:i}),t.target=ii)))}function li(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var ui={animationend:li("Animation","AnimationEnd"),animationiteration:li("Animation","AnimationIteration"),animationstart:li("Animation","AnimationStart"),transitionrun:li("Transition","TransitionRun"),transitionstart:li("Transition","TransitionStart"),transitioncancel:li("Transition","TransitionCancel"),transitionend:li("Transition","TransitionEnd")},ci={},hi={};function di(e){if(ci[e])return ci[e];if(!ui[e])return e;var t,n=ui[e];for(t in n)if(n.hasOwnProperty(t)&&t in hi)return ci[e]=n[t];return e}nt&&(hi=document.createElement("div").style,"AnimationEvent"in window||(delete ui.animationend.animation,delete ui.animationiteration.animation,delete ui.animationstart.animation),"TransitionEvent"in window||delete ui.transitionend.transition);var pi=di("animationend"),fi=di("animationiteration"),mi=di("animationstart"),gi=di("transitionrun"),vi=di("transitionstart"),yi=di("transitioncancel"),_i=di("transitionend"),bi=new Map,xi="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll scrollEnd toggle touchMove waiting wheel".split(" ");function Si(e,t){bi.set(e,t),et(t,[e])}var Ai=[],Mi=0,wi=0;function Ei(){for(var e=Mi,t=wi=Mi=0;t>=s,r-=s,Hi=1<<32-be(t)+r|n<d?(p=h,h=null):p=h.sibling;var f=v(r,h,o[d],l);if(null===f){null===h&&(h=p);break}e&&h&&null===f.alternate&&t(r,h),s=a(f,s,d),null===c?u=f:c.sibling=f,c=f,h=p}if(d===o.length)return n(r,h),Yi&&ji(r,d),u;if(null===h){for(;dp?(f=d,d=null):f=d.sibling;var _=v(r,d,g.value,u);if(null===_){null===d&&(d=f);break}e&&d&&null===_.alternate&&t(r,d),o=a(_,o,p),null===h?c=_:h.sibling=_,h=_,d=f}if(g.done)return n(r,d),Yi&&ji(r,p),c;if(null===d){for(;!g.done;p++,g=l.next())null!==(g=m(r,g.value,u))&&(o=a(g,o,p),null===h?c=g:h.sibling=g,h=g);return Yi&&ji(r,p),c}for(d=i(d);!g.done;p++,g=l.next())null!==(g=y(d,r,p,g.value,u))&&(e&&null!==g.alternate&&d.delete(null===g.key?p:g.key),o=a(g,o,p),null===h?c=g:h.sibling=g,h=g);return e&&d.forEach(function(e){return t(r,e)}),Yi&&ji(r,p),c}(l,d,p=b.call(p),f)}if("function"===typeof p.then)return _(l,d,gr(p),f);if(p.$$typeof===g)return _(l,d,Eo(l,p),f);yr(l,p)}return"string"===typeof p&&""!==p||"number"===typeof p||"bigint"===typeof p?(p=""+p,null!==d&&6===d.tag?(n(l,d.sibling),(f=r(d,p)).return=l,l=f):(n(l,d),(f=Hl(p,l.mode,f)).return=l,l=f),o(l)):n(l,d)}return function(e,t,n,i){try{mr=0;var r=_(e,t,n,i);return fr=null,r}catch(rB){if(rB===sr)throw rB;var a=Ll(29,rB,null,e.mode);return a.lanes=i,a.return=e,a}}}var xr=br(!0),Sr=br(!1),Ar=X(null),Mr=X(0);function wr(e,t){K(Mr,e=uu),K(Ar,t),uu=e|t.baseLanes}function Er(){K(Mr,uu),K(Ar,Ar.current)}function Tr(){uu=Mr.current,J(Ar),J(Mr)}var Cr=X(null),Rr=null;function Pr(e){var t=e.alternate;K(Fr,1&Fr.current),K(Cr,e),null===Rr&&(null===t||null!==Ar.current||null!==t.memoizedState)&&(Rr=e)}function Br(e){if(22===e.tag){if(K(Fr,Fr.current),K(Cr,e),null===Rr){var t=e.alternate;null!==t&&null!==t.memoizedState&&(Rr=e)}}else Ir()}function Ir(){K(Fr,Fr.current),K(Cr,Cr.current)}function Dr(e){J(Cr),Rr===e&&(Rr=null),J(Fr)}var Fr=X(0);function Lr(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!==(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Nr="undefined"!==typeof AbortController?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Or=i.unstable_scheduleCallback,kr=i.unstable_NormalPriority,Ur={$$typeof:g,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zr(){return{controller:new Nr,data:new Map,refCount:0}}function Gr(e){e.refCount--,0===e.refCount&&Or(kr,function(){e.controller.abort()})}var Hr=null,Vr=0,jr=0,Wr=null;function Xr(){if(0===--Vr&&null!==Hr){null!==Wr&&(Wr.status="fulfilled");var e=Hr;Hr=null,jr=0,Wr=null;for(var t=0;ta?a:8;var s=P.T,o={};P.T=o,bs(e,!1,t,n);try{var l=r(),u=P.S;if(null!==u&&u(o,l),null!==l&&"object"===typeof l&&"function"===typeof l.then){var c=function(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var e=0;e title"))),Jc(a,i,n),a[ke]=e,Qe(a),i=a;break e;case"link":var o=Ch("link","href",r).get(i+(n.href||""));if(o)for(var l=0;l<\/script>",e=e.removeChild(e.firstChild);break;case"select":e="string"===typeof i.is?r.createElement("select",{is:i.is}):r.createElement("select"),i.multiple?e.multiple=!0:i.size&&(e.size=i.size);break;default:e="string"===typeof i.is?r.createElement(n,{is:i.is}):r.createElement(n)}}e[ke]=t,e[Ue]=i;e:for(r=t.child;null!==r;){if(5===r.tag||6===r.tag)e.appendChild(r.stateNode);else if(4!==r.tag&&27!==r.tag&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break e;for(;null===r.sibling;){if(null===r.return||r.return===t)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}t.stateNode=e;e:switch(Jc(e,n,i),n){case"button":case"input":case"select":case"textarea":e=!!i.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&jl(t)}}return Kl(t),t.flags&=-16777217,null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==i&&jl(t);else{if("string"!==typeof i&&null===t.stateNode)throw Error(s(166));if(e=Q.current,ir(t)){if(e=t.stateNode,n=t.memoizedProps,i=null,null!==(r=Ki))switch(r.tag){case 27:case 5:i=r.memoizedProps}e[ke]=t,(e=!!(e.nodeValue===n||null!==i&&!0===i.suppressHydrationWarning||Vc(e.nodeValue,n)))||er(t)}else(e=Yc(e).createTextNode(i))[ke]=t,t.stateNode=e}return Kl(t),null;case 13:if(i=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(r=ir(t),null!==i&&null!==i.dehydrated){if(null===e){if(!r)throw Error(s(318));if(!(r=null!==(r=t.memoizedState)?r.dehydrated:null))throw Error(s(317));r[ke]=t}else rr(),0===(128&t.flags)&&(t.memoizedState=null),t.flags|=4;Kl(t),r=!1}else null!==Qi&&(Lu(Qi),Qi=null),r=!0;if(!r)return 256&t.flags?(Dr(t),t):(Dr(t),null)}if(Dr(t),0!==(128&t.flags))return t.lanes=n,t;if(n=null!==i,e=null!==e&&null!==e.memoizedState,n){r=null,null!==(i=t.child).alternate&&null!==i.alternate.memoizedState&&null!==i.alternate.memoizedState.cachePool&&(r=i.alternate.memoizedState.cachePool.pool);var a=null;null!==i.memoizedState&&null!==i.memoizedState.cachePool&&(a=i.memoizedState.cachePool.pool),a!==r&&(i.flags|=2048)}return n!==e&&n&&(t.child.flags|=8192),Xl(t,t.updateQueue),Kl(t),null;case 4:return ee(),null===e&&Dc(t.stateNode.containerInfo),Kl(t),null;case 10:return _o(t.type),Kl(t),null;case 19:if(J(Fr),null===(r=t.memoizedState))return Kl(t),null;if(i=0!==(128&t.flags),null===(a=r.rendering))if(i)Jl(r,!1);else{if(0!==cu||null!==e&&0!==(128&e.flags))for(e=t.child;null!==e;){if(null!==(a=Lr(e))){for(t.flags|=128,Jl(r,!1),e=a.updateQueue,t.updateQueue=e,Xl(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)kl(n,e),n=n.sibling;return K(Fr,1&Fr.current|2),t.child}e=e.sibling}null!==r.tail&&le()>bu&&(t.flags|=128,i=!0,Jl(r,!1),t.lanes=4194304)}else{if(!i)if(null!==(e=Lr(a))){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Xl(t,e),Jl(r,!0),null===r.tail&&"hidden"===r.tailMode&&!a.alternate&&!Yi)return Kl(t),null}else 2*le()-r.renderingStartTime>bu&&536870912!==n&&(t.flags|=128,i=!0,Jl(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=r.last)?e.sibling=a:t.child=a,r.last=a)}return null!==r.tail?(t=r.tail,r.rendering=t,r.tail=t.sibling,r.renderingStartTime=le(),t.sibling=null,e=Fr.current,K(Fr,i?1&e|2:1&e),t):(Kl(t),null);case 22:case 23:return Dr(t),Tr(),i=null!==t.memoizedState,null!==e?null!==e.memoizedState!==i&&(t.flags|=8192):i&&(t.flags|=8192),i?0!==(536870912&n)&&0===(128&t.flags)&&(Kl(t),6&t.subtreeFlags&&(t.flags|=8192)):Kl(t),null!==(n=t.updateQueue)&&Xl(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),i=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(i=t.memoizedState.cachePool.pool),i!==n&&(t.flags|=2048),null!==e&&J(Kr),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),_o(Ur),Kl(t),null;case 25:return null}throw Error(s(156,t.tag))}function Yl(e,t){switch(Ji(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return _o(Ur),ee(),0!==(65536&(e=t.flags))&&0===(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return ne(t),null;case 13:if(Dr(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(s(340));rr()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return J(Fr),null;case 4:return ee(),null;case 10:return _o(t.type),null;case 22:case 23:return Dr(t),Tr(),null!==e&&J(Kr),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return _o(Ur),null;default:return null}}function Ql(e,t){switch(Ji(t),t.tag){case 3:_o(Ur),ee();break;case 26:case 27:case 5:ne(t);break;case 4:ee();break;case 13:Dr(t);break;case 19:J(Fr);break;case 10:_o(t.type);break;case 22:case 23:Dr(t),Tr(),null!==e&&J(Kr);break;case 24:_o(Ur)}}var Zl={getCacheForType:function(e){var t=wo(Ur),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n}},$l="function"===typeof WeakMap?WeakMap:Map,eu=0,tu=null,nu=null,iu=0,ru=0,au=null,su=!1,ou=!1,lu=!1,uu=0,cu=0,hu=0,du=0,pu=0,fu=0,mu=0,gu=null,vu=null,yu=!1,_u=0,bu=1/0,xu=null,Su=null,Au=!1,Mu=null,wu=0,Eu=0,Tu=null,Cu=0,Ru=null;function Pu(){if(0!==(2&eu)&&0!==iu)return iu&-iu;if(null!==P.T){return 0!==jr?jr:Sc()}return Ne()}function Bu(){0===fu&&(fu=0===(536870912&iu)||Yi?Re():536870912);var e=Cr.current;return null!==e&&(e.flags|=32),fu}function Iu(e,t,n){(e===tu&&2===ru||null!==e.cancelPendingCommit)&&(Gu(e,0),ku(e,iu,fu,!1)),Ie(e,n),0!==(2&eu)&&e===tu||(e===tu&&(0===(2&eu)&&(du|=n),4===cu&&ku(e,iu,fu,!1)),gc(e))}function Fu(e,t,n){if(0!==(6&eu))throw Error(s(327));for(var i=!n&&0===(60&t)&&0===(t&e.expiredLanes)||Te(e,t),r=i?function(e,t){var n=eu;eu|=2;var i=Vu(),r=ju();tu!==e||iu!==t?(xu=null,bu=le()+500,Gu(e,t)):ou=Te(e,t);e:for(;;)try{if(0!==ru&&null!==nu){t=nu;var a=au;t:switch(ru){case 1:ru=0,au=null,Qu(e,t,a,1);break;case 2:if(ur(a)){ru=0,au=null,Yu(t);break}t=function(){2===ru&&tu===e&&(ru=7),gc(e)},a.then(t,t);break e;case 3:ru=7;break e;case 4:ru=5;break e;case 7:ur(a)?(ru=0,au=null,Yu(t)):(ru=0,au=null,Qu(e,t,a,7));break;case 5:var o=null;switch(nu.tag){case 26:o=nu.memoizedState;case 5:case 27:var l=nu;if(!o||Ph(o)){ru=0,au=null;var u=l.sibling;if(null!==u)nu=u;else{var c=l.return;null!==c?(nu=c,Zu(c)):nu=null}break t}}ru=0,au=null,Qu(e,t,a,5);break;case 6:ru=0,au=null,Qu(e,t,a,6);break;case 8:zu(),cu=6;break e;default:throw Error(s(462))}}Ku();break}catch(h){Hu(e,h)}return vo=go=null,P.H=i,P.A=r,eu=n,null!==nu?0:(tu=null,iu=0,Ei(),cu)}(e,t):Xu(e,t,!0),a=i;;){if(0===r){ou&&!i&&ku(e,t,0,!1);break}if(6===r)ku(e,t,0,!su);else{if(n=e.current.alternate,a&&!Ou(n)){r=Xu(e,t,!1),a=!1;continue}if(2===r){if(a=t,e.errorRecoveryDisabledLanes&a)var o=0;else o=0!==(o=-536870913&e.pendingLanes)?o:536870912&o?536870912:0;if(0!==o){t=o;e:{var l=e;r=gu;var u=l.current.memoizedState.isDehydrated;if(u&&(Gu(l,o).flags|=256),2!==(o=Xu(l,o,!1))){if(lu&&!u){l.errorRecoveryDisabledLanes|=a,du|=a,r=4;break e}a=vu,vu=r,null!==a&&Lu(a)}r=o}if(a=!1,2!==r)continue}}if(1===r){Gu(e,0),ku(e,t,0,!0);break}e:{switch(i=e,r){case 0:case 1:throw Error(s(345));case 4:if((4194176&t)===t){ku(i,t,fu,!su);break e}break;case 2:vu=null;break;case 3:case 5:break;default:throw Error(s(329))}if(i.finishedWork=n,i.finishedLanes=t,(62914560&t)===t&&10<(a=_u+300-le())){if(ku(i,t,fu,!su),0!==Ee(i,0))break e;i.timeoutHandle=th(Nu.bind(null,i,n,vu,xu,yu,t,fu,du,mu,su,2,-0,0),a)}else Nu(i,n,vu,xu,yu,t,fu,du,mu,su,0,-0,0)}}break}gc(e)}function Lu(e){null===vu?vu=e:vu.push.apply(vu,e)}function Nu(e,t,n,i,r,a,o,l,u,c,h,d,p){var f=t.subtreeFlags;if((8192&f||16785408===(16785408&f))&&(Bh={stylesheets:null,count:0,unsuspend:Ih},Cl(t),t=function(){if(null===Bh)throw Error(s(475));var e=Bh;return e.stylesheets&&0===e.count&&Lh(e,e.stylesheets),0n?32:n,P.T=null,null===Mu)var a=!1;else{n=Tu,Tu=null;var o=Mu,l=wu;if(Mu=null,wu=0,0!==(6&eu))throw Error(s(331));var u=eu;if(eu|=4,Bl(o.current),Al(o,o.current,l,n),eu=u,vc(0,!1),ye&&"function"===typeof ye.onPostCommitFiberRoot)try{ye.onPostCommitFiberRoot(ve,o)}catch(c){}a=!0}return a}finally{H.p=r,P.T=i,tc(e,t)}}return!1}function ic(e,t,n){t=Fi(n,t),null!==(e=Io(e,t=Us(e.stateNode,t,2),2))&&(Ie(e,2),gc(e))}function rc(e,t,n){if(3===e.tag)ic(e,e,n);else for(;null!==t;){if(3===t.tag){ic(t,e,n);break}if(1===t.tag){var i=t.stateNode;if("function"===typeof t.type.getDerivedStateFromError||"function"===typeof i.componentDidCatch&&(null===Su||!Su.has(i))){e=Fi(n,e),null!==(i=Io(t,n=zs(2),2))&&(Gs(n,i,t,e),Ie(i,2),gc(i));break}}t=t.return}}function ac(e,t,n){var i=e.pingCache;if(null===i){i=e.pingCache=new $l;var r=new Set;i.set(t,r)}else void 0===(r=i.get(t))&&(r=new Set,i.set(t,r));r.has(n)||(lu=!0,r.add(n),e=sc.bind(null,e,t,n),t.then(e,e))}function sc(e,t,n){var i=e.pingCache;null!==i&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,tu===e&&(iu&n)===n&&(4===cu||3===cu&&(62914560&iu)===iu&&300>le()-_u?0===(2&eu)&&Gu(e,0):pu|=n,mu===iu&&(mu=0)),gc(e)}function oc(e,t){0===t&&(t=Pe()),null!==(e=Ri(e,t))&&(Ie(e,t),gc(e))}function lc(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),oc(e,n)}function uc(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,r=e.memoizedState;null!==r&&(n=r.retryLane);break;case 19:i=e.stateNode;break;case 22:i=e.stateNode._retryCache;break;default:throw Error(s(314))}null!==i&&i.delete(t),oc(e,n)}var cc=null,hc=null,dc=!1,pc=!1,fc=!1,mc=0;function gc(e){var t;e!==hc&&null===e.next&&(null===hc?cc=hc=e:hc=hc.next=e),pc=!0,dc||(dc=!0,t=yc,rh(function(){0!==(6&eu)?re(ce,t):t()}))}function vc(e,t){if(!fc&&pc){fc=!0;do{for(var n=!1,i=cc;null!==i;){if(!t)if(0!==e){var r=i.pendingLanes;if(0===r)var a=0;else{var s=i.suspendedLanes,o=i.pingedLanes;a=(1<<31-be(42|e)+1)-1,a=201326677&(a&=r&~(s&~o))?201326677&a|1:a?2|a:0}0!==a&&(n=!0,xc(i,a))}else a=iu,0===(3&(a=Ee(i,i===tu?a:0)))||Te(i,a)||(n=!0,xc(i,a));i=i.next}}while(n);fc=!1}}function yc(){pc=dc=!1;var e=0;0!==mc&&(function(){var e=window.event;if(e&&"popstate"===e.type)return e!==eh&&(eh=e,!0);return eh=null,!1}()&&(e=mc),mc=0);for(var t=le(),n=null,i=cc;null!==i;){var r=i.next,a=_c(i,t);0===a?(i.next=null,null===n?cc=r:n.next=r,null===r&&(hc=n)):(n=i,(0!==e||0!==(3&a))&&(pc=!0)),i=r}vc(e,!1)}function _c(e,t){for(var n=e.suspendedLanes,i=e.pingedLanes,r=e.expirationTimes,a=-62914561&e.pendingLanes;0 title"):null)}function Ph(e){return"stylesheet"!==e.type||0!==(3&e.state.loading)}var Bh=null;function Ih(){}function Dh(){if(this.count--,0===this.count)if(this.stylesheets)Lh(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}var Fh=null;function Lh(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,Fh=new Map,t.forEach(Nh,e),Fh=null,Dh.call(e))}function Nh(e,t){if(!(4&t.state.loading)){var n=Fh.get(e);if(n)var i=n.get(null);else{n=new Map,Fh.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a>>1,r=e[i];if(!(0>>1;ia(l,n))ua(c,l)?(e[i]=c,e[u]=n,i=u):(e[i]=l,e[o]=n,i=o);else{if(!(ua(c,n)))break e;e[i]=c,e[u]=n,i=u}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(t.unstable_now=void 0,"object"===typeof performance&&"function"===typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var u=[],c=[],h=1,d=null,p=3,f=!1,m=!1,g=!1,v="function"===typeof setTimeout?setTimeout:null,y="function"===typeof clearTimeout?clearTimeout:null,_="undefined"!==typeof setImmediate?setImmediate:null;function b(e){for(var t=i(c);null!==t;){if(null===t.callback)r(c);else{if(!(t.startTime<=e))break;r(c),t.sortIndex=t.expirationTime,n(u,t)}t=i(c)}}function x(e){if(g=!1,b(e),!m)if(null!==i(u))m=!0,B();else{var t=i(c);null!==t&&I(x,t.startTime-e)}}var S,A=!1,M=-1,w=5,E=-1;function T(){return!(t.unstable_now()-Ee&&T());){var s=d.callback;if("function"===typeof s){d.callback=null,p=d.priorityLevel;var o=s(d.expirationTime<=e);if(e=t.unstable_now(),"function"===typeof o){d.callback=o,b(e),n=!0;break t}d===i(u)&&r(u),b(e)}else r(u);d=i(u)}if(null!==d)n=!0;else{var l=i(c);null!==l&&I(x,l.startTime-e),n=!1}}break e}finally{d=null,p=a,f=!1}n=void 0}}finally{n?S():A=!1}}}if("function"===typeof _)S=function(){_(C)};else if("undefined"!==typeof MessageChannel){var R=new MessageChannel,P=R.port2;R.port1.onmessage=C,S=function(){P.postMessage(null)}}else S=function(){v(C,0)};function B(){A||(A=!0,S())}function I(e,n){M=v(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){m||f||(m=!0,B())},t.unstable_forceFrameRate=function(e){0>e||125s?(e.sortIndex=a,n(c,e),null===i(u)&&e===i(c)&&(g?(y(M),M=-1):g=!0,I(x,a-s))):(e.sortIndex=o,n(u,e),m||f||(m=!0,B())),e},t.unstable_shouldYield=T,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}},67(e,t,n){e.exports=n(914)},799(e,t){var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function r(e,t,i){var r=null;if(void 0!==i&&(r=""+i),void 0!==t.key&&(r=""+t.key),"key"in t)for(var a in i={},t)"key"!==a&&(i[a]=t[a]);else i=t;return t=i.ref,{$$typeof:n,type:e,key:r,ref:void 0!==t?t:null,props:i}}t.Fragment=i,t.jsx=r,t.jsxs=r},288(e,t){var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),p=Symbol.iterator;var f={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},m=Object.assign,g={};function v(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||f}function y(){}function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||f}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},y.prototype=v.prototype;var b=_.prototype=new y;b.constructor=_,m(b,v.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S={H:null,A:null,T:null,S:null},A=Object.prototype.hasOwnProperty;function M(e,t,i,r,a,s){return i=s.ref,{$$typeof:n,type:e,key:t,ref:void 0!==i?i:null,props:s}}function w(e){return"object"===typeof e&&null!==e&&e.$$typeof===n}var E=/\/+/g;function T(e,t){return"object"===typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(e){return t[e]})}(""+e.key):t.toString(36)}function C(){}function R(e,t,r,a,s){var o=typeof e;"undefined"!==o&&"boolean"!==o||(e=null);var l,u,c=!1;if(null===e)c=!0;else switch(o){case"bigint":case"string":case"number":c=!0;break;case"object":switch(e.$$typeof){case n:case i:c=!0;break;case d:return R((c=e._init)(e._payload),t,r,a,s)}}if(c)return s=s(e),c=""===a?"."+T(e,0):a,x(s)?(r="",null!=c&&(r=c.replace(E,"$&/")+"/"),R(s,t,r,"",function(e){return e})):null!=s&&(w(s)&&(l=s,u=r+(null==s.key||e&&e.key===s.key?"":(""+s.key).replace(E,"$&/")+"/")+c,s=M(l.type,u,void 0,0,0,l.props)),t.push(s)),1;c=0;var h,f=""===a?".":a+":";if(x(e))for(var m=0;m>>1,r=e[i];if(!(0>>1;ia(l,n))ua(c,l)?(e[i]=c,e[u]=n,i=u):(e[i]=l,e[o]=n,i=o);else{if(!(ua(c,n)))break e;e[i]=c,e[u]=n,i=u}}}return t}function a(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}if(t.unstable_now=void 0,"object"===typeof performance&&"function"===typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var u=[],c=[],h=1,d=null,p=3,f=!1,m=!1,g=!1,v=!1,y="function"===typeof setTimeout?setTimeout:null,_="function"===typeof clearTimeout?clearTimeout:null,b="undefined"!==typeof setImmediate?setImmediate:null;function x(e){for(var t=i(c);null!==t;){if(null===t.callback)r(c);else{if(!(t.startTime<=e))break;r(c),t.sortIndex=t.expirationTime,n(u,t)}t=i(c)}}function S(e){if(g=!1,x(e),!m)if(null!==i(u))m=!0,M||(M=!0,A());else{var t=i(c);null!==t&&I(S,t.startTime-e)}}var A,M=!1,w=-1,E=5,T=-1;function C(){return!!v||!(t.unstable_now()-Te&&C());){var s=d.callback;if("function"===typeof s){d.callback=null,p=d.priorityLevel;var o=s(d.expirationTime<=e);if(e=t.unstable_now(),"function"===typeof o){d.callback=o,x(e),n=!0;break t}d===i(u)&&r(u),x(e)}else r(u);d=i(u)}if(null!==d)n=!0;else{var l=i(c);null!==l&&I(S,l.startTime-e),n=!1}}break e}finally{d=null,p=a,f=!1}n=void 0}}finally{n?A():M=!1}}}if("function"===typeof b)A=function(){b(R)};else if("undefined"!==typeof MessageChannel){var P=new MessageChannel,B=P.port2;P.port1.onmessage=R,A=function(){B.postMessage(null)}}else A=function(){y(R,0)};function I(e,n){w=y(function(){e(t.unstable_now())},n)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_forceFrameRate=function(e){0>e||125s?(e.sortIndex=a,n(c,e),null===i(u)&&e===i(c)&&(g?(_(w),w=-1):g=!0,I(S,a-s))):(e.sortIndex=o,n(u,e),m||f||(m=!0,M||(M=!0,A()))),e},t.unstable_shouldYield=C,t.unstable_wrapCallback=function(e){var t=p;return function(){var n=p;p=t;try{return e.apply(this,arguments)}finally{p=n}}}},853(e,t,n){e.exports=n(896)},330(e,t,n){var i=n(43);var r="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},a=i.useState,s=i.useEffect,o=i.useLayoutEffect,l=i.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch(Du){return!0}}var c="undefined"===typeof window||"undefined"===typeof window.document||"undefined"===typeof window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),i=a({inst:{value:n,getSnapshot:t}}),r=i[0].inst,c=i[1];return o(function(){r.value=n,r.getSnapshot=t,u(r)&&c({inst:r})},[e,n,t]),s(function(){return u(r)&&c({inst:r}),e(function(){u(r)&&c({inst:r})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==i.useSyncExternalStore?i.useSyncExternalStore:c},717(e,t,n){var i=n(43),r=n(461);var a="function"===typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},s=r.useSyncExternalStore,o=i.useRef,l=i.useEffect,u=i.useMemo,c=i.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,i,r){var h=o(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;h=u(function(){function e(e){if(!l){if(l=!0,s=e,e=i(e),void 0!==r&&d.hasValue){var t=d.value;if(r(t,e))return o=t}return o=e}if(t=o,a(s,e))return t;var n=i(e);return void 0!==r&&r(t,n)?(s=e,t):(s=e,o=n)}var s,o,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]},[t,n,i,r]);var p=s(e,h[0],h[1]);return l(function(){d.hasValue=!0,d.value=p},[p]),c(p),p}},461(e,t,n){e.exports=n(330)},443(e,t,n){e.exports=n(717)}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var a=t[i]={exports:{}};return e[i](a,a.exports,n),a.exports}(()=>{var e,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__;n.t=function(i,r){if(1&r&&(i=this(i)),8&r)return i;if("object"===typeof i&&i){if(4&r&&i.__esModule)return i;if(16&r&&"function"===typeof i.then)return i}var a=Object.create(null);n.r(a);var s={};e=e||[null,t({}),t([]),t(t)];for(var o=2&r&&i;("object"==typeof o||"function"==typeof o)&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach(e=>s[e]=()=>i[e]);return s.default=()=>i,n.d(a,s),a}})(),n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};n.r(i),n.d(i,{ACESFilmicToneMapping:()=>Ts,AddEquation:()=>Xa,AddOperation:()=>Ss,AdditiveAnimationBlendMode:()=>gl,AdditiveBlending:()=>Ga,AgXToneMapping:()=>Rs,AlphaFormat:()=>ho,AlwaysCompare:()=>iu,AlwaysDepth:()=>ps,AlwaysStencilFunc:()=>ql,AmbientLight:()=>Dv,AnimationAction:()=>Cy,AnimationClip:()=>qg,AnimationLoader:()=>av,AnimationMixer:()=>Py,AnimationObjectGroup:()=>Ty,AnimationUtils:()=>Lg,ArcCurve:()=>$f,ArrayCamera:()=>iy,ArrowHelper:()=>P_,AttachedBindMode:()=>Bs,Audio:()=>dy,AudioAnalyser:()=>yy,AudioContext:()=>qv,AudioListener:()=>hy,AudioLoader:()=>Yv,AxesHelper:()=>B_,BackSide:()=>Oa,BasicDepthPacking:()=>bl,BasicShadowMap:()=>Ia,BatchedMesh:()=>af,BezierInterpolant:()=>zg,Bone:()=>mp,BooleanKeyframeTrack:()=>Hg,Box2:()=>Xy,Box3:()=>Sh,Box3Helper:()=>w_,BoxGeometry:()=>Uf,BoxHelper:()=>M_,BufferAttribute:()=>Wh,BufferGeometry:()=>dd,BufferGeometryLoader:()=>zv,ByteType:()=>$s,Cache:()=>Qg,Camera:()=>xv,CameraHelper:()=>x_,CanvasTexture:()=>Ff,CapsuleGeometry:()=>zf,CatmullRomCurve3:()=>sm,CineonToneMapping:()=>Es,CircleGeometry:()=>Gf,ClampToEdgeWrapping:()=>zs,Clock:()=>Gy,Color:()=>ih,ColorKeyframeTrack:()=>Vg,ColorManagement:()=>rc,Compatibility:()=>bu,CompressedArrayTexture:()=>Bf,CompressedCubeTexture:()=>If,CompressedTexture:()=>Pf,CompressedTextureLoader:()=>sv,ConeGeometry:()=>Vf,ConstantAlphaFactor:()=>cs,ConstantColorFactor:()=>ls,Controls:()=>D_,CubeCamera:()=>ny,CubeDepthTexture:()=>Of,CubeReflectionMapping:()=>Fs,CubeRefractionMapping:()=>Ls,CubeTexture:()=>Df,CubeTextureLoader:()=>uv,CubeUVReflectionMapping:()=>ks,CubicBezierCurve:()=>cm,CubicBezierCurve3:()=>hm,CubicInterpolant:()=>Og,CullFaceBack:()=>Ra,CullFaceFront:()=>Pa,CullFaceFrontBack:()=>Ba,CullFaceNone:()=>Ca,Curve:()=>Qf,CurvePath:()=>ym,CustomBlending:()=>ja,CustomToneMapping:()=>Cs,CylinderGeometry:()=>Hf,Cylindrical:()=>Vy,Data3DTexture:()=>bc,DataArrayTexture:()=>yc,DataTexture:()=>gp,DataTextureLoader:()=>cv,DataUtils:()=>Gh,DecrementStencilOp:()=>kl,DecrementWrapStencilOp:()=>zl,DefaultLoadingManager:()=>ev,DepthFormat:()=>mo,DepthStencilFormat:()=>go,DepthTexture:()=>Nf,DetachedBindMode:()=>Is,DirectionalLight:()=>Iv,DirectionalLightHelper:()=>y_,DiscreteInterpolant:()=>Ug,DodecahedronGeometry:()=>Wf,DoubleSide:()=>ka,DstAlphaFactor:()=>is,DstColorFactor:()=>as,DynamicCopyUsage:()=>hu,DynamicDrawUsage:()=>au,DynamicReadUsage:()=>lu,EdgesGeometry:()=>Yf,EllipseCurve:()=>Zf,EqualCompare:()=>Zl,EqualDepth:()=>gs,EqualStencilFunc:()=>jl,EquirectangularReflectionMapping:()=>Ns,EquirectangularRefractionMapping:()=>Os,Euler:()=>Ic,EventDispatcher:()=>Nu,ExternalTexture:()=>kf,ExtrudeGeometry:()=>Qm,FileLoader:()=>rv,Float16BufferAttribute:()=>$h,Float32BufferAttribute:()=>ed,FloatType:()=>ro,Fog:()=>sh,FogExp2:()=>ah,FramebufferTexture:()=>Rf,FrontSide:()=>Na,Frustum:()=>Np,FrustumArray:()=>Up,GLBufferAttribute:()=>Ny,GLSL1:()=>pu,GLSL3:()=>fu,GreaterCompare:()=>eu,GreaterDepth:()=>ys,GreaterEqualCompare:()=>nu,GreaterEqualDepth:()=>vs,GreaterEqualStencilFunc:()=>Kl,GreaterStencilFunc:()=>Xl,GridHelper:()=>p_,Group:()=>Yc,HTMLTexture:()=>Lf,HalfFloatType:()=>ao,HemisphereLight:()=>pv,HemisphereLightHelper:()=>d_,IcosahedronGeometry:()=>$m,ImageBitmapLoader:()=>Jv,ImageLoader:()=>lv,ImageUtils:()=>lc,IncrementStencilOp:()=>Ol,IncrementWrapStencilOp:()=>Ul,InstancedBufferAttribute:()=>bp,InstancedBufferGeometry:()=>Uv,InstancedInterleavedBuffer:()=>Ly,InstancedMesh:()=>Cp,Int16BufferAttribute:()=>qh,Int32BufferAttribute:()=>Qh,Int8BufferAttribute:()=>Xh,IntType:()=>no,InterleavedBuffer:()=>pd,InterleavedBufferAttribute:()=>md,Interpolant:()=>Ng,InterpolateBezier:()=>hl,InterpolateDiscrete:()=>ll,InterpolateLinear:()=>ul,InterpolateSmooth:()=>cl,InterpolationSamplingMode:()=>_u,InterpolationSamplingType:()=>yu,InvertStencilOp:()=>Gl,KeepStencilOp:()=>Ll,KeyframeTrack:()=>Gg,LOD:()=>Nd,LatheGeometry:()=>eg,Layers:()=>Dc,LessCompare:()=>Ql,LessDepth:()=>fs,LessEqualCompare:()=>$l,LessEqualDepth:()=>ms,LessEqualStencilFunc:()=>Wl,LessStencilFunc:()=>Vl,Light:()=>dv,LightProbe:()=>Nv,Line:()=>ff,Line3:()=>e_,LineBasicMaterial:()=>sf,LineCurve:()=>dm,LineCurve3:()=>pm,LineDashedMaterial:()=>Pg,LineLoop:()=>_f,LineSegments:()=>yf,LinearFilter:()=>Js,LinearInterpolant:()=>kg,LinearMipMapLinearFilter:()=>Qs,LinearMipMapNearestFilter:()=>qs,LinearMipmapLinearFilter:()=>Ys,LinearMipmapNearestFilter:()=>Ks,LinearSRGBColorSpace:()=>Cl,LinearToneMapping:()=>Ms,LinearTransfer:()=>Rl,Loader:()=>tv,LoaderUtils:()=>kv,LoadingManager:()=>$g,LoopOnce:()=>al,LoopPingPong:()=>ol,LoopRepeat:()=>sl,MOUSE:()=>Ea,Material:()=>yd,MaterialBlending:()=>Wa,MaterialLoader:()=>Ov,MathUtils:()=>Ju,Matrix2:()=>jy,Matrix3:()=>$u,Matrix4:()=>Sc,MaxEquation:()=>Ya,Mesh:()=>ip,MeshBasicMaterial:()=>Wd,MeshDepthMaterial:()=>Tg,MeshDistanceMaterial:()=>Cg,MeshLambertMaterial:()=>Eg,MeshMatcapMaterial:()=>Rg,MeshNormalMaterial:()=>wg,MeshPhongMaterial:()=>Ag,MeshPhysicalMaterial:()=>Sg,MeshStandardMaterial:()=>xg,MeshToonMaterial:()=>Mg,MinEquation:()=>qa,MirroredRepeatWrapping:()=>Gs,MixOperation:()=>xs,MultiplyBlending:()=>Va,MultiplyOperation:()=>bs,NearestFilter:()=>Hs,NearestMipMapLinearFilter:()=>Xs,NearestMipMapNearestFilter:()=>js,NearestMipmapLinearFilter:()=>Ws,NearestMipmapNearestFilter:()=>Vs,NeutralToneMapping:()=>Ps,NeverCompare:()=>Yl,NeverDepth:()=>ds,NeverStencilFunc:()=>Hl,NoBlending:()=>Ua,NoColorSpace:()=>El,NoNormalPacking:()=>Bl,NoToneMapping:()=>As,NormalAnimationBlendMode:()=>ml,NormalBlending:()=>za,NormalGAPacking:()=>Dl,NormalRGPacking:()=>Il,NotEqualCompare:()=>tu,NotEqualDepth:()=>_s,NotEqualStencilFunc:()=>Jl,NumberKeyframeTrack:()=>jg,Object3D:()=>qc,ObjectLoader:()=>Hv,ObjectSpaceNormalMap:()=>wl,OctahedronGeometry:()=>tg,OneFactor:()=>Za,OneMinusConstantAlphaFactor:()=>hs,OneMinusConstantColorFactor:()=>us,OneMinusDstAlphaFactor:()=>rs,OneMinusDstColorFactor:()=>ss,OneMinusSrcAlphaFactor:()=>ns,OneMinusSrcColorFactor:()=>es,OrthographicCamera:()=>Pv,PCFShadowMap:()=>Da,PCFSoftShadowMap:()=>Fa,PMREMGenerator:()=>bC,Path:()=>_m,PerspectiveCamera:()=>wv,Plane:()=>Ip,PlaneGeometry:()=>ng,PlaneHelper:()=>E_,PointLight:()=>Rv,PointLightHelper:()=>l_,Points:()=>wf,PointsMaterial:()=>bf,PolarGridHelper:()=>f_,PolyhedronGeometry:()=>jf,PositionalAudio:()=>vy,PropertyBinding:()=>Ey,PropertyMixer:()=>_y,QuadraticBezierCurve:()=>fm,QuadraticBezierCurve3:()=>mm,Quaternion:()=>qu,QuaternionKeyframeTrack:()=>Xg,QuaternionLinearInterpolant:()=>Wg,R11_EAC_Format:()=>Fo,RED_GREEN_RGTC2_Format:()=>il,RED_RGTC1_Format:()=>tl,REVISION:()=>wa,RG11_EAC_Format:()=>No,RGBADepthPacking:()=>xl,RGBAFormat:()=>fo,RGBAIntegerFormat:()=>So,RGBA_ASTC_10x10_Format:()=>qo,RGBA_ASTC_10x5_Format:()=>Xo,RGBA_ASTC_10x6_Format:()=>Jo,RGBA_ASTC_10x8_Format:()=>Ko,RGBA_ASTC_12x10_Format:()=>Yo,RGBA_ASTC_12x12_Format:()=>Qo,RGBA_ASTC_4x4_Format:()=>ko,RGBA_ASTC_5x4_Format:()=>Uo,RGBA_ASTC_5x5_Format:()=>zo,RGBA_ASTC_6x5_Format:()=>Go,RGBA_ASTC_6x6_Format:()=>Ho,RGBA_ASTC_8x5_Format:()=>Vo,RGBA_ASTC_8x6_Format:()=>jo,RGBA_ASTC_8x8_Format:()=>Wo,RGBA_BPTC_Format:()=>Zo,RGBA_ETC2_EAC_Format:()=>Do,RGBA_PVRTC_2BPPV1_Format:()=>Po,RGBA_PVRTC_4BPPV1_Format:()=>Ro,RGBA_S3TC_DXT1_Format:()=>Mo,RGBA_S3TC_DXT3_Format:()=>wo,RGBA_S3TC_DXT5_Format:()=>Eo,RGBDepthPacking:()=>Sl,RGBFormat:()=>po,RGBIntegerFormat:()=>xo,RGB_BPTC_SIGNED_Format:()=>$o,RGB_BPTC_UNSIGNED_Format:()=>el,RGB_ETC1_Format:()=>Bo,RGB_ETC2_Format:()=>Io,RGB_PVRTC_2BPPV1_Format:()=>Co,RGB_PVRTC_4BPPV1_Format:()=>To,RGB_S3TC_DXT1_Format:()=>Ao,RGDepthPacking:()=>Al,RGFormat:()=>_o,RGIntegerFormat:()=>bo,RawShaderMaterial:()=>bg,Ray:()=>jd,Raycaster:()=>ky,RectAreaLight:()=>Fv,RedFormat:()=>vo,RedIntegerFormat:()=>yo,ReinhardToneMapping:()=>ws,RenderTarget:()=>gc,RenderTarget3D:()=>By,RepeatWrapping:()=>Us,ReplaceStencilOp:()=>Nl,ReverseSubtractEquation:()=>Ka,RingGeometry:()=>ig,SIGNED_R11_EAC_Format:()=>Lo,SIGNED_RED_GREEN_RGTC2_Format:()=>rl,SIGNED_RED_RGTC1_Format:()=>nl,SIGNED_RG11_EAC_Format:()=>Oo,SRGBColorSpace:()=>Tl,SRGBTransfer:()=>Pl,Scene:()=>oh,ShaderChunk:()=>eC,ShaderLib:()=>nC,ShaderMaterial:()=>_g,ShadowMaterial:()=>pg,Shape:()=>bm,ShapeGeometry:()=>rg,ShapePath:()=>I_,ShapeUtils:()=>Km,ShortType:()=>eo,Skeleton:()=>_p,SkeletonHelper:()=>s_,SkinnedMesh:()=>fp,Source:()=>cc,Sphere:()=>rd,SphereGeometry:()=>ag,Spherical:()=>Hy,SphericalHarmonics3:()=>Lv,SplineCurve:()=>gm,SpotLight:()=>Tv,SpotLightHelper:()=>n_,Sprite:()=>Id,SpriteMaterial:()=>_d,SrcAlphaFactor:()=>ts,SrcAlphaSaturateFactor:()=>os,SrcColorFactor:()=>$a,StaticCopyUsage:()=>cu,StaticDrawUsage:()=>ru,StaticReadUsage:()=>ou,StereoCamera:()=>ey,StreamCopyUsage:()=>du,StreamDrawUsage:()=>su,StreamReadUsage:()=>uu,StringKeyframeTrack:()=>Jg,SubtractEquation:()=>Ja,SubtractiveBlending:()=>Ha,TOUCH:()=>Ta,TangentSpaceNormalMap:()=>Ml,TetrahedronGeometry:()=>sg,Texture:()=>fc,TextureLoader:()=>hv,TextureUtils:()=>L_,Timer:()=>ry,TimestampQuery:()=>vu,TorusGeometry:()=>og,TorusKnotGeometry:()=>lg,Triangle:()=>xh,TriangleFanDrawMode:()=>_l,TriangleStripDrawMode:()=>yl,TrianglesDrawMode:()=>vl,TubeGeometry:()=>ug,UVMapping:()=>Ds,Uint16BufferAttribute:()=>Yh,Uint32BufferAttribute:()=>Zh,Uint8BufferAttribute:()=>Jh,Uint8ClampedBufferAttribute:()=>Kh,Uniform:()=>Iy,UniformsGroup:()=>Fy,UniformsLib:()=>tC,UniformsUtils:()=>yg,UnsignedByteType:()=>Zs,UnsignedInt101111Type:()=>co,UnsignedInt248Type:()=>lo,UnsignedInt5999Type:()=>uo,UnsignedIntType:()=>io,UnsignedShort4444Type:()=>so,UnsignedShort5551Type:()=>oo,UnsignedShortType:()=>to,VSMShadowMap:()=>La,Vector2:()=>Ku,Vector3:()=>Yu,Vector4:()=>mc,VectorKeyframeTrack:()=>Kg,VideoFrameTexture:()=>Cf,VideoTexture:()=>Tf,WebGL3DRenderTarget:()=>xc,WebGLArrayRenderTarget:()=>_c,WebGLCoordinateSystem:()=>mu,WebGLCubeRenderTarget:()=>wC,WebGLRenderTarget:()=>vc,WebGLRenderer:()=>VP,WebGLUtils:()=>FP,WebGPUCoordinateSystem:()=>gu,WebXRController:()=>Zc,WireframeGeometry:()=>cg,WrapAroundEnding:()=>fl,ZeroCurvatureEnding:()=>dl,ZeroFactor:()=>Qa,ZeroSlopeEnding:()=>pl,ZeroStencilOp:()=>Fl,createCanvasElement:()=>wu,error:()=>Du,getConsoleFunction:()=>Ru,log:()=>Pu,setConsoleFunction:()=>Cu,warn:()=>Iu,warnOnce:()=>Fu});var r=n(43),a=n.t(r,2),s=n(391);function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function l(e){var t=function(e,t){if("object"!=o(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=o(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==o(t)?t:t+""}function u(e,t,n){return(t=l(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function h(e){for(var t=1;tT(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function M(e,t){return e===t||typeof e===typeof t&&(!(!e||!t||"object"!==typeof e||"object"!==typeof t)&&!Object.keys(t).some(n=>!M(e[n],t[n])))}function w(e,t){if(e===t)return e;const n=E(e)&&E(t);if(n||T(e)&&T(t)){const i=n?e:Object.keys(e),r=i.length,a=n?t:Object.keys(t),s=a.length,o=n?[]:{};let l=0;for(let u=0;u2&&void 0!==arguments[2]?arguments[2]:0;const i=[...e,t];return n&&i.length>n?i.slice(1):i}function B(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const i=[t,...e];return n&&i.length>n?i.slice(0,-1):i}var I=Symbol();function D(e,t){return!e.queryFn&&null!==t&&void 0!==t&&t.initialPromise?()=>t.initialPromise:e.queryFn&&e.queryFn!==I?e.queryFn:()=>Promise.reject(new Error("Missing queryFn: '".concat(e.queryHash,"'")))}function F(e,t){d(e,t),t.add(e)}var L,N,O,k,U,z,G=function(){let e=[],t=0,n=e=>{e()},i=e=>{e()},r=e=>setTimeout(e,0);const a=i=>{t?e.push(i):r(()=>{n(i)})};return{batch:a=>{let s;t++;try{s=a()}finally{t--,t||(()=>{const t=e;e=[],t.length&&r(()=>{i(()=>{t.forEach(e=>{n(e)})})})})()}return s},batchCalls:e=>function(){for(var t=arguments.length,n=new Array(t),i=0;i{e(...n)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{i=e},setScheduler:e=>{r=e}}}(),H=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},V=new(L=new WeakMap,N=new WeakMap,O=new WeakMap,class extends H{constructor(){super(),p(this,L,void 0),p(this,N,void 0),p(this,O,void 0),g(O,this,e=>{if(!v&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){m(N,this)||this.setEventListener(m(O,this))}onUnsubscribe(){var e;this.hasListeners()||(null===(e=m(N,this))||void 0===e||e.call(this),g(N,this,void 0))}setEventListener(e){var t;g(O,this,e),null===(t=m(N,this))||void 0===t||t.call(this),g(N,this,e(e=>{"boolean"===typeof e?this.setFocused(e):this.onFocus()}))}setFocused(e){m(L,this)!==e&&(g(L,this,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return"boolean"===typeof m(L,this)?m(L,this):"hidden"!==(null===(e=globalThis.document)||void 0===e?void 0:e.visibilityState)}}),j=new(k=new WeakMap,U=new WeakMap,z=new WeakMap,class extends H{constructor(){super(),p(this,k,!0),p(this,U,void 0),p(this,z,void 0),g(z,this,e=>{if(!v&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}})}onSubscribe(){m(U,this)||this.setEventListener(m(z,this))}onUnsubscribe(){var e;this.hasListeners()||(null===(e=m(U,this))||void 0===e||e.call(this),g(U,this,void 0))}setEventListener(e){var t;g(z,this,e),null===(t=m(U,this))||void 0===t||t.call(this),g(U,this,e(this.setOnline.bind(this)))}setOnline(e){m(k,this)!==e&&(g(k,this,e),this.listeners.forEach(t=>{t(e)}))}isOnline(){return m(k,this)}});function W(e){return Math.min(1e3*2**e,3e4)}function X(e){return"online"!==(null!==e&&void 0!==e?e:"online")||j.isOnline()}var J,K=class extends Error{constructor(e){super("CancelledError"),this.revert=null===e||void 0===e?void 0:e.revert,this.silent=null===e||void 0===e?void 0:e.silent}};function q(e){return e instanceof K}function Y(e){let t,n,i,r=!1,a=0,s=!1;const o=new Promise((e,t)=>{n=e,i=t}),l=()=>V.isFocused()&&("always"===e.networkMode||j.isOnline())&&e.canRun(),u=()=>X(e.networkMode)&&e.canRun(),c=i=>{var r,a;s||(s=!0,null===(r=e.onSuccess)||void 0===r||r.call(e,i),null===(a=t)||void 0===a||a(),n(i))},h=n=>{var r,a;s||(s=!0,null===(r=e.onError)||void 0===r||r.call(e,n),null===(a=t)||void 0===a||a(),i(n))},d=()=>new Promise(n=>{var i;t=e=>{(s||l())&&n(e)},null===(i=e.onPause)||void 0===i||i.call(e)}).then(()=>{var n;(t=void 0,s)||(null===(n=e.onContinue)||void 0===n||n.call(e))}),p=()=>{if(s)return;let t;const n=0===a?e.initialPromise:void 0;try{t=null!==n&&void 0!==n?n:e.fn()}catch(Du){t=Promise.reject(Du)}Promise.resolve(t).then(c).catch(t=>{var n,i,o;if(s)return;const u=null!==(n=e.retry)&&void 0!==n?n:v?0:3,c=null!==(i=e.retryDelay)&&void 0!==i?i:W,f="function"===typeof c?c(a,t):c,m=!0===u||"number"===typeof u&&a{setTimeout(e,g)})).then(()=>l()?void 0:d()).then(()=>{r?h(t):p()})):h(t)})};return{promise:o,cancel:t=>{var n;s||(h(new K(t)),null===(n=e.abort)||void 0===n||n.call(e))},continue:()=>{var e;return null===(e=t)||void 0===e||e(),o},cancelRetry:()=>{r=!0},continueRetry:()=>{r=!1},canStart:u,start:()=>(u()?p():d().then(p),o)}}var Q,Z,$,ee,te,ne,ie,re,ae=(J=new WeakMap,class{constructor(){p(this,J,void 0)}destroy(){this.clearGcTimeout()}scheduleGc(){var e;this.clearGcTimeout(),"number"===typeof(e=this.gcTime)&&e>=0&&e!==1/0&&g(J,this,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,null!==e&&void 0!==e?e:v?1/0:3e5)}clearGcTimeout(){m(J,this)&&(clearTimeout(m(J,this)),g(J,this,void 0))}}),se=(Q=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,ne=new WeakMap,ie=new WeakSet,class extends ae{constructor(e){var t;super(),F(this,ie),p(this,Q,void 0),p(this,Z,void 0),p(this,$,void 0),p(this,ee,void 0),p(this,te,void 0),p(this,ne,void 0),g(ne,this,!1),g(te,this,e.defaultOptions),this.setOptions(e.options),this.observers=[],g($,this,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,g(Q,this,function(e){const t="function"===typeof e.initialData?e.initialData():e.initialData,n=void 0!==t,i=n?"function"===typeof e.initialDataUpdatedAt?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?null!==i&&void 0!==i?i:Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}(this.options)),this.state=null!==(t=e.state)&&void 0!==t?t:m(Q,this),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return null===(e=m(ee,this))||void 0===e?void 0:e.promise}setOptions(e){this.options=h(h({},m(te,this)),e),this.updateGcTime(this.options.gcTime)}optionalRemove(){this.observers.length||"idle"!==this.state.fetchStatus||m($,this).remove(this)}setData(e,t){const n=R(this.state.data,e,this.options);return f(ie,this,oe).call(this,{data:n,type:"success",dataUpdatedAt:null===t||void 0===t?void 0:t.updatedAt,manual:null===t||void 0===t?void 0:t.manual}),n}setState(e,t){f(ie,this,oe).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var t,n;const i=null===(t=m(ee,this))||void 0===t?void 0:t.promise;return null===(n=m(ee,this))||void 0===n||n.cancel(e),i?i.then(y).catch(y):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(m(Q,this))}isActive(){return this.observers.some(e=>!1!==function(e,t){return"function"===typeof e?e(t):e}(e.options.enabled,this))}isDisabled(){return this.getObserversCount()>0&&!this.isActive()}isStale(){return!!this.state.isInvalidated||(this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):void 0===this.state.data)}isStaleByTime(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.state.isInvalidated||void 0===this.state.data||!function(e,t){return Math.max(e+(t||0)-Date.now(),0)}(this.state.dataUpdatedAt,e)}onFocus(){var e;const t=this.observers.find(e=>e.shouldFetchOnWindowFocus());null===t||void 0===t||t.refetch({cancelRefetch:!1}),null===(e=m(ee,this))||void 0===e||e.continue()}onOnline(){var e;const t=this.observers.find(e=>e.shouldFetchOnReconnect());null===t||void 0===t||t.refetch({cancelRefetch:!1}),null===(e=m(ee,this))||void 0===e||e.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),m($,this).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(m(ee,this)&&(m(ne,this)?m(ee,this).cancel({revert:!0}):m(ee,this).cancelRetry()),this.scheduleGc()),m($,this).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||f(ie,this,oe).call(this,{type:"invalidate"})}fetch(e,t){var n,i;if("idle"!==this.state.fetchStatus)if(void 0!==this.state.data&&null!==t&&void 0!==t&&t.cancelRefetch)this.cancel({silent:!0});else if(m(ee,this))return m(ee,this).continueRetry(),m(ee,this).promise;if(e&&this.setOptions(e),!this.options.queryFn){const e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}const r=new AbortController,a=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(g(ne,this,!0),r.signal)})},s={fetchOptions:t,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:()=>{const e=D(this.options,t),n={queryKey:this.queryKey,meta:this.meta};return a(n),g(ne,this,!1),this.options.persister?this.options.persister(e,n,this):e(n)}};var o;(a(s),null===(n=this.options.behavior)||void 0===n||n.onFetch(s,this),g(Z,this,this.state),"idle"===this.state.fetchStatus||this.state.fetchMeta!==(null===(i=s.fetchOptions)||void 0===i?void 0:i.meta))&&f(ie,this,oe).call(this,{type:"fetch",meta:null===(o=s.fetchOptions)||void 0===o?void 0:o.meta});const l=e=>{var t,n,i,r;(q(e)&&e.silent||f(ie,this,oe).call(this,{type:"error",error:e}),q(e))||(null===(t=(n=m($,this).config).onError)||void 0===t||t.call(n,e,this),null===(i=(r=m($,this).config).onSettled)||void 0===i||i.call(r,this.state.data,e,this));this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1};return g(ee,this,Y({initialPromise:null===t||void 0===t?void 0:t.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:e=>{var t,n,i,r;if(void 0!==e){try{this.setData(e)}catch(Du){return void l(Du)}null===(t=(n=m($,this).config).onSuccess)||void 0===t||t.call(n,e,this),null===(i=(r=m($,this).config).onSettled)||void 0===i||i.call(r,e,this.state.error,this),this.isFetchingOptimistic||this.scheduleGc(),this.isFetchingOptimistic=!1}else l(new Error("".concat(this.queryHash," data is undefined")))},onError:l,onFail:(e,t)=>{f(ie,this,oe).call(this,{type:"failed",failureCount:e,error:t})},onPause:()=>{f(ie,this,oe).call(this,{type:"pause"})},onContinue:()=>{f(ie,this,oe).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),m(ee,this).start()}});function oe(e){this.state=(t=>{var n,i,r;switch(e.type){case"failed":return h(h({},t),{},{fetchFailureCount:e.failureCount,fetchFailureReason:e.error});case"pause":return h(h({},t),{},{fetchStatus:"paused"});case"continue":return h(h({},t),{},{fetchStatus:"fetching"});case"fetch":return h(h(h({},t),(r=t.data,h({fetchFailureCount:0,fetchFailureReason:null,fetchStatus:X(this.options.networkMode)?"fetching":"paused"},void 0===r&&{error:null,status:"pending"}))),{},{fetchMeta:null!==(n=e.meta)&&void 0!==n?n:null});case"success":return h(h({},t),{},{data:e.data,dataUpdateCount:t.dataUpdateCount+1,dataUpdatedAt:null!==(i=e.dataUpdatedAt)&&void 0!==i?i:Date.now(),error:null,isInvalidated:!1,status:"success"},!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null});case"error":const a=e.error;return q(a)&&a.revert&&m(Z,this)?h(h({},m(Z,this)),{},{fetchStatus:"idle"}):h(h({},t),{},{error:a,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:a,fetchStatus:"idle",status:"error"});case"invalidate":return h(h({},t),{},{isInvalidated:!0});case"setState":return h(h({},t),e.state)}})(this.state),G.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),m($,this).notify({query:this,type:"updated",action:e})})}var le,ue,ce,he,de,pe,fe=(re=new WeakMap,class extends H{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),p(this,re,void 0),this.config=e,g(re,this,new Map)}build(e,t,n){var i;const r=t.queryKey,a=null!==(i=t.queryHash)&&void 0!==i?i:S(r,t);let s=this.get(a);return s||(s=new se({cache:this,queryKey:r,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(s)),s}add(e){m(re,this).has(e.queryHash)||(m(re,this).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=m(re,this).get(e.queryHash);t&&(e.destroy(),t===e&&m(re,this).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){G.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return m(re,this).get(e)}getAll(){return[...m(re,this).values()]}find(e){const t=h({exact:!0},e);return this.getAll().find(e=>b(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this.getAll();return Object.keys(e).length>0?t.filter(t=>b(e,t)):t}notify(e){G.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){G.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){G.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}}),me=(le=new WeakMap,ue=new WeakMap,ce=new WeakMap,he=new WeakSet,class extends ae{constructor(e){super(),F(this,he),p(this,le,void 0),p(this,ue,void 0),p(this,ce,void 0),this.mutationId=e.mutationId,g(ue,this,e.mutationCache),g(le,this,[]),this.state=e.state||{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0},this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){m(le,this).includes(e)||(m(le,this).push(e),this.clearGcTimeout(),m(ue,this).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){g(le,this,m(le,this).filter(t=>t!==e)),this.scheduleGc(),m(ue,this).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){m(le,this).length||("pending"===this.state.status?this.scheduleGc():m(ue,this).remove(this))}continue(){var e,t;return null!==(e=null===(t=m(ce,this))||void 0===t?void 0:t.continue())&&void 0!==e?e:this.execute(this.state.variables)}async execute(e){var t;g(ce,this,Y({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(e,t)=>{f(he,this,ge).call(this,{type:"failed",failureCount:e,error:t})},onPause:()=>{f(he,this,ge).call(this,{type:"pause"})},onContinue:()=>{f(he,this,ge).call(this,{type:"continue"})},retry:null!==(t=this.options.retry)&&void 0!==t?t:0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>m(ue,this).canRun(this)}));const n="pending"===this.state.status,i=!m(ce,this).canStart();try{var r,a,s,o,l,u,c,h;if(!n){var d,p,v,y;f(he,this,ge).call(this,{type:"pending",variables:e,isPaused:i}),await(null===(d=(p=m(ue,this).config).onMutate)||void 0===d?void 0:d.call(p,e,this));const t=await(null===(v=(y=this.options).onMutate)||void 0===v?void 0:v.call(y,e));t!==this.state.context&&f(he,this,ge).call(this,{type:"pending",context:t,variables:e,isPaused:i})}const t=await m(ce,this).start();return await(null===(r=(a=m(ue,this).config).onSuccess)||void 0===r?void 0:r.call(a,t,e,this.state.context,this)),await(null===(s=(o=this.options).onSuccess)||void 0===s?void 0:s.call(o,t,e,this.state.context)),await(null===(l=(u=m(ue,this).config).onSettled)||void 0===l?void 0:l.call(u,t,null,this.state.variables,this.state.context,this)),await(null===(c=(h=this.options).onSettled)||void 0===c?void 0:c.call(h,t,null,e,this.state.context)),f(he,this,ge).call(this,{type:"success",data:t}),t}catch(Du){try{var _,b,x,S,A,M,w,E;throw await(null===(_=(b=m(ue,this).config).onError)||void 0===_?void 0:_.call(b,Du,e,this.state.context,this)),await(null===(x=(S=this.options).onError)||void 0===x?void 0:x.call(S,Du,e,this.state.context)),await(null===(A=(M=m(ue,this).config).onSettled)||void 0===A?void 0:A.call(M,void 0,Du,this.state.variables,this.state.context,this)),await(null===(w=(E=this.options).onSettled)||void 0===w?void 0:w.call(E,void 0,Du,e,this.state.context)),Du}finally{f(he,this,ge).call(this,{type:"error",error:Du})}}finally{m(ue,this).runNext(this)}}});function ge(e){this.state=(t=>{switch(e.type){case"failed":return h(h({},t),{},{failureCount:e.failureCount,failureReason:e.error});case"pause":return h(h({},t),{},{isPaused:!0});case"continue":return h(h({},t),{},{isPaused:!1});case"pending":return h(h({},t),{},{context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()});case"success":return h(h({},t),{},{data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1});case"error":return h(h({},t),{},{data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"})}})(this.state),G.batch(()=>{m(le,this).forEach(t=>{t.onMutationUpdate(e)}),m(ue,this).notify({mutation:this,type:"updated",action:e})})}var ve,ye,_e,be,xe,Se,Ae,Me,we=(de=new WeakMap,pe=new WeakMap,class extends H{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),p(this,de,void 0),p(this,pe,void 0),this.config=e,g(de,this,new Map),g(pe,this,Date.now())}build(e,t,n){var i;const r=new me({mutationCache:this,mutationId:g(pe,this,(i=m(pe,this),++i)),options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){var t;const n=Ee(e),i=null!==(t=m(de,this).get(n))&&void 0!==t?t:[];i.push(e),m(de,this).set(n,i),this.notify({type:"added",mutation:e})}remove(e){const t=Ee(e);if(m(de,this).has(t)){var n;const i=null===(n=m(de,this).get(t))||void 0===n?void 0:n.filter(t=>t!==e);i&&(0===i.length?m(de,this).delete(t):m(de,this).set(t,i))}this.notify({type:"removed",mutation:e})}canRun(e){var t;const n=null===(t=m(de,this).get(Ee(e)))||void 0===t?void 0:t.find(e=>"pending"===e.state.status);return!n||n===e}runNext(e){var t,n;const i=null===(t=m(de,this).get(Ee(e)))||void 0===t?void 0:t.find(t=>t!==e&&t.state.isPaused);return null!==(n=null===i||void 0===i?void 0:i.continue())&&void 0!==n?n:Promise.resolve()}clear(){G.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...m(de,this).values()].flat()}find(e){const t=h({exact:!0},e);return this.getAll().find(e=>x(t,e))}findAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.getAll().filter(t=>x(e,t))}notify(e){G.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(e=>e.state.isPaused);return G.batch(()=>Promise.all(e.map(e=>e.continue().catch(y))))}});function Ee(e){var t,n;return null!==(t=null===(n=e.options.scope)||void 0===n?void 0:n.id)&&void 0!==t?t:String(e.mutationId)}function Te(e){return{onFetch:(t,n)=>{var i,r,a;const s=t.options,o=null===(i=t.fetchOptions)||void 0===i||null===(i=i.meta)||void 0===i||null===(i=i.fetchMore)||void 0===i?void 0:i.direction,l=(null===(r=t.state.data)||void 0===r?void 0:r.pages)||[],u=(null===(a=t.state.data)||void 0===a?void 0:a.pageParams)||[];let c={pages:[],pageParams:[]},h=0;const d=async()=>{let n=!1;const i=D(t.options,t.fetchOptions),r=async(e,r,a)=>{if(n)return Promise.reject();if(null==r&&e.pages.length)return Promise.resolve(e);const s={queryKey:t.queryKey,pageParam:r,direction:a?"backward":"forward",meta:t.options.meta};var o;o=s,Object.defineProperty(o,"signal",{enumerable:!0,get:()=>(t.signal.aborted?n=!0:t.signal.addEventListener("abort",()=>{n=!0}),t.signal)});const l=await i(s),u=t.options.maxPages,c=a?B:P;return{pages:c(e.pages,l,u),pageParams:c(e.pageParams,r,u)}};if(o&&l.length){const e="backward"===o,t={pages:l,pageParams:u},n=(e?Re:Ce)(s,t);c=await r(t,n,e)}else{const t=null!==e&&void 0!==e?e:l.length;do{var a;const e=0===h?null!==(a=u[0])&&void 0!==a?a:s.initialPageParam:Ce(s,c);if(h>0&&null==e)break;c=await r(c,e),h++}while(h{var e,i;return null===(e=(i=t.options).persister)||void 0===e?void 0:e.call(i,d,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=d}}}function Ce(e,t){let n=t.pages,i=t.pageParams;const r=n.length-1;return n.length>0?e.getNextPageParam(n[r],n,i[r],i):void 0}function Re(e,t){var n;let i=t.pages,r=t.pageParams;return i.length>0?null===(n=e.getPreviousPageParam)||void 0===n?void 0:n.call(e,i[0],i,r[0],r):void 0}var Pe=(ve=new WeakMap,ye=new WeakMap,_e=new WeakMap,be=new WeakMap,xe=new WeakMap,Se=new WeakMap,Ae=new WeakMap,Me=new WeakMap,class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};p(this,ve,void 0),p(this,ye,void 0),p(this,_e,void 0),p(this,be,void 0),p(this,xe,void 0),p(this,Se,void 0),p(this,Ae,void 0),p(this,Me,void 0),g(ve,this,e.queryCache||new fe),g(ye,this,e.mutationCache||new we),g(_e,this,e.defaultOptions||{}),g(be,this,new Map),g(xe,this,new Map),g(Se,this,0)}mount(){var e;g(Se,this,(e=m(Se,this),e++,e)),1===m(Se,this)&&(g(Ae,this,V.subscribe(async e=>{e&&(await this.resumePausedMutations(),m(ve,this).onFocus())})),g(Me,this,j.subscribe(async e=>{e&&(await this.resumePausedMutations(),m(ve,this).onOnline())})))}unmount(){var e,t,n;g(Se,this,(e=m(Se,this),e--,e)),0===m(Se,this)&&(null===(t=m(Ae,this))||void 0===t||t.call(this),g(Ae,this,void 0),null===(n=m(Me,this))||void 0===n||n.call(this),g(Me,this,void 0))}isFetching(e){return m(ve,this).findAll(h(h({},e),{},{fetchStatus:"fetching"})).length}isMutating(e){return m(ye,this).findAll(h(h({},e),{},{status:"pending"})).length}getQueryData(e){var t;const n=this.defaultQueryOptions({queryKey:e});return null===(t=m(ve,this).get(n.queryHash))||void 0===t?void 0:t.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(void 0===t)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),i=m(ve,this).build(this,n);return e.revalidateIfStale&&i.isStaleByTime(_(n.staleTime,i))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return m(ve,this).findAll(e).map(e=>[e.queryKey,e.state.data])}setQueryData(e,t,n){const i=this.defaultQueryOptions({queryKey:e}),r=m(ve,this).get(i.queryHash),a=function(e,t){return"function"===typeof e?e(t):e}(t,null===r||void 0===r?void 0:r.state.data);if(void 0!==a)return m(ve,this).build(this,i).setData(a,h(h({},n),{},{manual:!0}))}setQueriesData(e,t,n){return G.batch(()=>m(ve,this).findAll(e).map(e=>{let i=e.queryKey;return[i,this.setQueryData(i,t,n)]}))}getQueryState(e){var t;const n=this.defaultQueryOptions({queryKey:e});return null===(t=m(ve,this).get(n.queryHash))||void 0===t?void 0:t.state}removeQueries(e){const t=m(ve,this);G.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){const n=m(ve,this),i=h({type:"active"},e);return G.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries(i,t)))}cancelQueries(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=h({revert:!0},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}),n=G.batch(()=>m(ve,this).findAll(e).map(e=>e.cancel(t)));return Promise.all(n).then(y).catch(y)}invalidateQueries(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return G.batch(()=>{var n,i;if(m(ve,this).findAll(e).forEach(e=>{e.invalidate()}),"none"===e.refetchType)return Promise.resolve();const r=h(h({},e),{},{type:null!==(n=null!==(i=e.refetchType)&&void 0!==i?i:e.type)&&void 0!==n?n:"active"});return this.refetchQueries(r,t)})}refetchQueries(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;const i=h(h({},n),{},{cancelRefetch:null===(e=null===n||void 0===n?void 0:n.cancelRefetch)||void 0===e||e}),r=G.batch(()=>m(ve,this).findAll(t).filter(e=>!e.isDisabled()).map(e=>{let t=e.fetch(void 0,i);return i.throwOnError||(t=t.catch(y)),"paused"===e.state.fetchStatus?Promise.resolve():t}));return Promise.all(r).then(y)}fetchQuery(e){const t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);const n=m(ve,this).build(this,t);return n.isStaleByTime(_(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(y).catch(y)}fetchInfiniteQuery(e){return e.behavior=Te(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(y).catch(y)}ensureInfiniteQueryData(e){return e.behavior=Te(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return j.isOnline()?m(ye,this).resumePausedMutations():Promise.resolve()}getQueryCache(){return m(ve,this)}getMutationCache(){return m(ye,this)}getDefaultOptions(){return m(_e,this)}setDefaultOptions(e){g(_e,this,e)}setQueryDefaults(e,t){m(be,this).set(A(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...m(be,this).values()];let n={};return t.forEach(t=>{M(e,t.queryKey)&&(n=h(h({},n),t.defaultOptions))}),n}setMutationDefaults(e,t){m(xe,this).set(A(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...m(xe,this).values()];let n={};return t.forEach(t=>{M(e,t.mutationKey)&&(n=h(h({},n),t.defaultOptions))}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t=h(h(h(h({},m(_e,this).queries),this.getQueryDefaults(e.queryKey)),e),{},{_defaulted:!0});return t.queryHash||(t.queryHash=S(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),!0!==t.enabled&&t.queryFn===I&&(t.enabled=!1),t}defaultMutationOptions(e){return null!==e&&void 0!==e&&e._defaulted?e:h(h(h(h({},m(_e,this).mutations),(null===e||void 0===e?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey)),e),{},{_defaulted:!0})}clear(){m(ve,this).clear(),m(ye,this).clear()}}),Be=n(579),Ie=r.createContext(void 0),De=e=>{let t=e.client,n=e.children;return r.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),(0,Be.jsx)(Ie.Provider,{value:t,children:n})};function Fe(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Le(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var Ne,Oe,ke,Ue,ze,Ge,He,Ve,je,We,Xe,Je={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Ke={duration:.5,overwrite:!1,delay:0},qe=1e8,Ye=1e-8,Qe=2*Math.PI,Ze=Qe/4,$e=0,et=Math.sqrt,tt=Math.cos,nt=Math.sin,it=function(e){return"string"===typeof e},rt=function(e){return"function"===typeof e},at=function(e){return"number"===typeof e},st=function(e){return"undefined"===typeof e},ot=function(e){return"object"===typeof e},lt=function(e){return!1!==e},ut=function(){return"undefined"!==typeof window},ct=function(e){return rt(e)||it(e)},ht="function"===typeof ArrayBuffer&&ArrayBuffer.isView||function(){},dt=Array.isArray,pt=/random\([^)]+\)/g,ft=/,\s*/g,mt=/(?:-?\.?\d|\.)+/gi,gt=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,vt=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,yt=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,_t=/[+-]=-?[.\d]+/,bt=/[^,'"\[\]\s]+/gi,xt=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,St={},At={},Mt=function(e){return(At=en(e,St))&&tr},wt=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Et=function(e,t){return!t&&console.warn(e)},Tt=function(e,t){return e&&(St[e]=t)&&At&&(At[e]=t)||St},Ct=function(){return 0},Rt={suppressEvents:!0,isStart:!0,kill:!1},Pt={suppressEvents:!0,kill:!1},Bt={suppressEvents:!0},It={},Dt=[],Ft={},Lt={},Nt={},Ot=30,kt=[],Ut="",zt=function(e){var t,n,i=e[0];if(ot(i)||rt(i)||(e=[e]),!(t=(i._gsap||{}).harness)){for(n=kt.length;n--&&!kt[n].targetTest(i););t=kt[n]}for(n=e.length;n--;)e[n]&&(e[n]._gsap||(e[n]._gsap=new mi(e[n],t)))||e.splice(n,1);return e},Gt=function(e){return e._gsap||zt(Dn(e))[0]._gsap},Ht=function(e,t,n){return(n=e[t])&&rt(n)?e[t]():st(n)&&e.getAttribute&&e.getAttribute(t)||n},Vt=function(e,t){return(e=e.split(",")).forEach(t)||e},jt=function(e){return Math.round(1e5*e)/1e5||0},Wt=function(e){return Math.round(1e7*e)/1e7||0},Xt=function(e,t){var n=t.charAt(0),i=parseFloat(t.substr(2));return e=parseFloat(e),"+"===n?e+i:"-"===n?e-i:"*"===n?e*i:e/i},Jt=function(e,t){for(var n=t.length,i=0;e.indexOf(t[i])<0&&++ia;)s=s._prev;return s?(t._next=s._next,s._next=t):(t._next=e[n],e[n]=t),t._next?t._next._prev=t:e[i]=t,t._prev=s,t.parent=t._dp=e,t},sn=function(e,t,n,i){void 0===n&&(n="_first"),void 0===i&&(i="_last");var r=t._prev,a=t._next;r?r._next=a:e[n]===t&&(e[n]=a),a?a._prev=r:e[i]===t&&(e[i]=r),t._next=t._prev=t.parent=null},on=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},ln=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var n=e;n;)n._dirty=1,n=n.parent;return e},un=function(e,t,n,i){return e._startAt&&(Oe?e._startAt.revert(Pt):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},cn=function e(t){return!t||t._ts&&e(t.parent)},hn=function(e){return e._repeat?dn(e._tTime,e=e.duration()+e._rDelay)*e:0},dn=function(e,t){var n=Math.floor(e=Wt(e/t));return e&&n===e?n-1:n},pn=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},fn=function(e){return e._end=Wt(e._start+(e._tDur/Math.abs(e._ts||e._rts||Ye)||0))},mn=function(e,t){var n=e._dp;return n&&n.smoothChildTiming&&e._ts&&(e._start=Wt(n._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),fn(e),n._dirty||ln(n,e)),e},gn=function(e,t){var n;if((t._time||!t._dur&&t._initted||t._startYe)&&t.render(n,!0)),ln(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&n.totalTime(n._tTime),n=n._dp;e._zTime=-1e-8}},vn=function(e,t,n,i){return t.parent&&on(t),t._start=Wt((at(n)?n:n||e!==Ue?wn(e,n,t):e._time)+t._delay),t._end=Wt(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),an(e,t,"_first","_last",e._sort?"_start":0),xn(t)||(e._recent=t),i||gn(e,t),e._ts<0&&mn(e,e._tTime),e},yn=function(e,t){return(St.ScrollTrigger||wt("scrollTrigger",t))&&St.ScrollTrigger.create(t,e)},_n=function(e,t,n,i,r){return Ai(e,t,r),e._initted?!n&&e._pt&&!Oe&&(e._dur&&!1!==e.vars.lazy||!e._dur&&e.vars.lazy)&&je!==ii.frame?(Dt.push(e),e._lazy=[r,i],1):void 0:1},bn=function e(t){var n=t.parent;return n&&n._ts&&n._initted&&!n._lock&&(n.rawTime()<0||e(n))},xn=function(e){var t=e.data;return"isFromStart"===t||"isStart"===t},Sn=function(e,t,n,i){var r=e._repeat,a=Wt(t)||0,s=e._tTime/e._tDur;return s&&!i&&(e._time*=a/e._dur),e._dur=a,e._tDur=r?r<0?1e10:Wt(a*(r+1)+e._rDelay*r):a,s>0&&!i&&mn(e,e._tTime=e._tDur*s),e.parent&&fn(e),n||ln(e.parent,e),e},An=function(e){return e instanceof vi?ln(e):Sn(e,e._dur)},Mn={_start:0,endTime:Ct,totalDuration:Ct},wn=function e(t,n,i){var r,a,s,o=t.labels,l=t._recent||Mn,u=t.duration()>=qe?l.endTime(!1):t._dur;return it(n)&&(isNaN(n)||n in o)?(a=n.charAt(0),s="%"===n.substr(-1),r=n.indexOf("="),"<"===a||">"===a?(r>=0&&(n=n.replace(/=/,"")),("<"===a?l._start:l.endTime(l._repeat>=0))+(parseFloat(n.substr(1))||0)*(s?(r<0?l:i).totalDuration()/100:1)):r<0?(n in o||(o[n]=u),o[n]):(a=parseFloat(n.charAt(r-1)+n.substr(r+1)),s&&i&&(a=a/100*(dt(i)?i[0]:i).totalDuration()),r>1?e(t,n.substr(0,r-1),i)+a:u+a)):null==n?u:+n},En=function(e,t,n){var i,r,a=at(t[1]),s=(a?2:1)+(e<2?0:1),o=t[s];if(a&&(o.duration=t[1]),o.parent=n,e){for(i=o,r=n;r&&!("immediateRender"in i);)i=r.vars.defaults||{},r=lt(r.vars.inherit)&&r.parent;o.immediateRender=lt(i.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new Ci(t[0],o,t[s+1])},Tn=function(e,t){return e||0===e?t(e):t},Cn=function(e,t,n){return nt?t:n},Rn=function(e,t){return it(e)&&(t=xt.exec(e))?t[1]:""},Pn=[].slice,Bn=function(e,t){return e&&ot(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&ot(e[0]))&&!e.nodeType&&e!==ze},In=function(e,t,n){return void 0===n&&(n=[]),e.forEach(function(e){var i;return it(e)&&!t||Bn(e,1)?(i=n).push.apply(i,Dn(e)):n.push(e)})||n},Dn=function(e,t,n){return ke&&!t&&ke.selector?ke.selector(e):!it(e)||n||!Ge&&ri()?dt(e)?In(e,n):Bn(e)?Pn.call(e,0):e?[e]:[]:Pn.call((t||He).querySelectorAll(e),0)},Fn=function(e){return e=Dn(e)[0]||Et("Invalid scope")||{},function(t){var n=e.current||e.nativeElement||e;return Dn(t,n.querySelectorAll?n:n===e?Et("Invalid scope")||He.createElement("div"):e)}},Ln=function(e){return e.sort(function(){return.5-Math.random()})},Nn=function(e){if(rt(e))return e;var t=ot(e)?e:{each:e},n=ci(t.ease),i=t.from||0,r=parseFloat(t.base)||0,a={},s=i>0&&i<1,o=isNaN(i)||s,l=t.axis,u=i,c=i;return it(i)?u=c={center:.5,edges:.5,end:1}[i]||0:!s&&o&&(u=i[0],c=i[1]),function(e,s,h){var d,p,f,m,g,v,y,_,b,x=(h||t).length,S=a[x];if(!S){if(!(b="auto"===t.grid?0:(t.grid||[1,qe])[1])){for(y=-qe;y<(y=h[b++].getBoundingClientRect().left)&&by&&(y=g),g<_&&(_=g);"random"===i&&Ln(S),S.max=y-_,S.min=_,S.v=x=(parseFloat(t.amount)||parseFloat(t.each)*(b>x?x-1:l?"y"===l?x/b:b:Math.max(b,x/b))||0)*("edges"===i?-1:1),S.b=x<0?r-x:r,S.u=Rn(t.amount||t.each)||0,n=n&&x<0?ui(n):n}return x=(S[e]-S.min)/S.max||0,Wt(S.b+(n?n(x):x)*S.v)+S.u}},On=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(n){var i=Wt(Math.round(parseFloat(n)/e)*e*t);return(i-i%1)/t+(at(n)?0:Rn(n))}},kn=function(e,t){var n,i,r=dt(e);return!r&&ot(e)&&(n=r=e.radius||qe,e.values?(e=Dn(e.values),(i=!at(e[0]))&&(n*=n)):e=On(e.increment)),Tn(t,r?rt(e)?function(t){return i=e(t),Math.abs(i-t)<=n?i:t}:function(t){for(var r,a,s=parseFloat(i?t.x:t),o=parseFloat(i?t.y:0),l=qe,u=0,c=e.length;c--;)(r=i?(r=e[c].x-s)*r+(a=e[c].y-o)*a:Math.abs(e[c]-s))(r=Math.abs(r))&&(a=i,o=r);return a},jn=function(e,t,n){var i,r,a,s=e.vars,o=s[t],l=ke,u=e._ctx;if(o)return i=s[t+"Params"],r=s.callbackScope||e,n&&Dt.length&&Kt(),u&&(ke=u),a=i?o.apply(r,i):o.call(r),ke=l,a},Wn=function(e){return on(e),e.scrollTrigger&&e.scrollTrigger.kill(!!Oe),e.progress()<1&&jn(e,"onInterrupt"),e},Xn=[],Jn=function(e){if(e)if(e=!e.name&&e.default||e,ut()||e.headless){var t=e.name,n=rt(e),i=t&&!n&&e.init?function(){this._props=[]}:e,r={init:Ct,render:Oi,add:xi,kill:Ui,modifier:ki,rawVars:0},a={targetTest:0,get:0,getSetter:Di,aliases:{},register:0};if(ri(),e!==i){if(Lt[t])return;$t(i,$t(nn(e,r),a)),en(i.prototype,en(r,nn(e,a))),Lt[i.prop=t]=i,e.targetTest&&(kt.push(i),It[t]=1),t=("css"===t?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}Tt(t,i),e.register&&e.register(tr,i,Hi)}else Xn.push(e)},Kn=255,qn={aqua:[0,Kn,Kn],lime:[0,Kn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,Kn],navy:[0,0,128],white:[Kn,Kn,Kn],olive:[128,128,0],yellow:[Kn,Kn,0],orange:[Kn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[Kn,0,0],pink:[Kn,192,203],cyan:[0,Kn,Kn],transparent:[Kn,Kn,Kn,0]},Yn=function(e,t,n){return(6*(e+=e<0?1:e>1?-1:0)<1?t+(n-t)*e*6:e<.5?n:3*e<2?t+(n-t)*(2/3-e)*6:t)*Kn+.5|0},Qn=function(e,t,n){var i,r,a,s,o,l,u,c,h,d,p=e?at(e)?[e>>16,e>>8&Kn,e&Kn]:0:qn.black;if(!p){if(","===e.substr(-1)&&(e=e.substr(0,e.length-1)),qn[e])p=qn[e];else if("#"===e.charAt(0)){if(e.length<6&&(i=e.charAt(1),r=e.charAt(2),a=e.charAt(3),e="#"+i+i+r+r+a+a+(5===e.length?e.charAt(4)+e.charAt(4):"")),9===e.length)return[(p=parseInt(e.substr(1,6),16))>>16,p>>8&Kn,p&Kn,parseInt(e.substr(7),16)/255];p=[(e=parseInt(e.substr(1),16))>>16,e>>8&Kn,e&Kn]}else if("hsl"===e.substr(0,3))if(p=d=e.match(mt),t){if(~e.indexOf("="))return p=e.match(gt),n&&p.length<4&&(p[3]=1),p}else s=+p[0]%360/360,o=+p[1]/100,i=2*(l=+p[2]/100)-(r=l<=.5?l*(o+1):l+o-l*o),p.length>3&&(p[3]*=1),p[0]=Yn(s+1/3,i,r),p[1]=Yn(s,i,r),p[2]=Yn(s-1/3,i,r);else p=e.match(mt)||qn.transparent;p=p.map(Number)}return t&&!d&&(i=p[0]/Kn,r=p[1]/Kn,a=p[2]/Kn,l=((u=Math.max(i,r,a))+(c=Math.min(i,r,a)))/2,u===c?s=o=0:(h=u-c,o=l>.5?h/(2-u-c):h/(u+c),s=u===i?(r-a)/h+(ro||_<0)&&(u+=_-l),((m=(v=(c+=_)-u)-d)>0||b)&&(y=++i.frame,r=v-1e3*i.time,i.time=v/=1e3,d+=m+(m>=h?4:h-m),g=1),b||(e=t(n)),g)for(a=0;a=t&&a--},_listeners:p},i}(),ri=function(){return!Xe&&ii.wake()},ai={},si=/^[\d.\-M][\d.\-,\s]/,oi=/["']/g,li=function(e){for(var t,n,i,r={},a=e.substr(1,e.length-3).split(":"),s=a[0],o=1,l=a.length;o1&&n.config?n.config.apply(null,~e.indexOf("{")?[li(t[1])]:function(e){var t=e.indexOf("(")+1,n=e.indexOf(")"),i=e.indexOf("(",t);return e.substring(t,~i&&i=1?n:1,a=(i||(t?.3:.45))/(n<1?n:1),s=a/Qe*(Math.asin(1/r)||0),o=function(e){return 1===e?1:r*Math.pow(2,-10*e)*nt((e-s)*a)+1},l="out"===t?o:"in"===t?function(e){return 1-o(1-e)}:di(o);return a=Qe/a,l.config=function(n,i){return e(t,n,i)},l},fi=function e(t,n){void 0===n&&(n=1.70158);var i=function(e){return e?--e*e*((n+1)*e+n)+1:0},r="out"===t?i:"in"===t?function(e){return 1-i(1-e)}:di(i);return r.config=function(n){return e(t,n)},r};Vt("Linear,Quad,Cubic,Quart,Quint,Strong",function(e,t){var n=t<5?t+1:t;hi(e+",Power"+(n-1),t?function(e){return Math.pow(e,n)}:function(e){return e},function(e){return 1-Math.pow(1-e,n)},function(e){return e<.5?Math.pow(2*e,n)/2:1-Math.pow(2*(1-e),n)/2})}),ai.Linear.easeNone=ai.none=ai.Linear.easeIn,hi("Elastic",pi("in"),pi("out"),pi()),function(e,t){var n=1/t,i=2*n,r=2.5*n,a=function(a){return a0?e+(e+this._rDelay)*this._repeat:e):this.totalDuration()&&this._dur},t.totalDuration=function(e){return arguments.length?(this._dirty=0,Sn(this,this._repeat<0?e:(e-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},t.totalTime=function(e,t){if(ri(),!arguments.length)return this._tTime;var n=this._dp;if(n&&n.smoothChildTiming&&this._ts){for(mn(this,e),!n._dp||n.parent||gn(n,this);n&&n.parent;)n.parent._time!==n._start+(n._ts>=0?n._tTime/n._ts:(n.totalDuration()-n._tTime)/-n._ts)&&n.totalTime(n._tTime,!0),n=n.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&e0||!this._tDur&&!e)&&vn(this._dp,this,this._start-this._delay)}return(this._tTime!==e||!this._dur&&!t||this._initted&&Math.abs(this._zTime)===Ye||!this._initted&&this._dur&&e||!e&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=e),Yt(this,e,t)),this},t.time=function(e,t){return arguments.length?this.totalTime(Math.min(this.totalDuration(),e+hn(this))%(this._dur+this._rDelay)||(e?this._dur:0),t):this._time},t.totalProgress=function(e,t){return arguments.length?this.totalTime(this.totalDuration()*e,t):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>=0&&this._initted?1:0},t.progress=function(e,t){return arguments.length?this.totalTime(this.duration()*(!this._yoyo||1&this.iteration()?e:1-e)+hn(this),t):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},t.iteration=function(e,t){var n=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(e-1)*n,t):this._repeat?dn(this._tTime,n)+1:1},t.timeScale=function(e,t){if(!arguments.length)return-1e-8===this._rts?0:this._rts;if(this._rts===e)return this;var n=this.parent&&this._ts?pn(this.parent._time,this):this._tTime;return this._rts=+e||0,this._ts=this._ps||-1e-8===e?0:this._rts,this.totalTime(Cn(-Math.abs(this._delay),this.totalDuration(),n),!1!==t),fn(this),function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e}(this)},t.paused=function(e){return arguments.length?(this._ps!==e&&(this._ps=e,e?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(ri(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,1===this.progress()&&Math.abs(this._zTime)!==Ye&&(this._tTime-=Ye)))),this):this._ps},t.startTime=function(e){if(arguments.length){this._start=Wt(e);var t=this.parent||this._dp;return t&&(t._sort||!this.parent)&&vn(t,this,this._start-this._delay),this}return this._start},t.endTime=function(e){return this._start+(lt(e)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},t.rawTime=function(e){var t=this.parent||this._dp;return t?e&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?pn(t.rawTime(e),this):this._tTime:this._tTime},t.revert=function(e){void 0===e&&(e=Bt);var t=Oe;return Oe=e,qt(this)&&(this.timeline&&this.timeline.revert(e),this.totalTime(-.01,e.suppressEvents)),"nested"!==this.data&&!1!==e.kill&&this.kill(),Oe=t,this},t.globalTime=function(e){for(var t=this,n=arguments.length?e:t.rawTime();t;)n=t._start+n/(Math.abs(t._ts)||1),t=t._dp;return!this.parent&&this._sat?this._sat.globalTime(e):n},t.repeat=function(e){return arguments.length?(this._repeat=e===1/0?-2:e,An(this)):-2===this._repeat?1/0:this._repeat},t.repeatDelay=function(e){if(arguments.length){var t=this._time;return this._rDelay=e,An(this),t?this.time(t):this}return this._rDelay},t.yoyo=function(e){return arguments.length?(this._yoyo=e,this):this._yoyo},t.seek=function(e,t){return this.totalTime(wn(this,e),lt(t))},t.restart=function(e,t){return this.play().totalTime(e?-this._delay:0,lt(t)),this._dur||(this._zTime=-1e-8),this},t.play=function(e,t){return null!=e&&this.seek(e,t),this.reversed(!1).paused(!1)},t.reverse=function(e,t){return null!=e&&this.seek(e||this.totalDuration(),t),this.reversed(!0).paused(!1)},t.pause=function(e,t){return null!=e&&this.seek(e,t),this.paused(!0)},t.resume=function(){return this.paused(!1)},t.reversed=function(e){return arguments.length?(!!e!==this.reversed()&&this.timeScale(-this._rts||(e?-1e-8:0)),this):this._rts<0},t.invalidate=function(){return this._initted=this._act=0,this._zTime=-1e-8,this},t.isActive=function(){var e,t=this.parent||this._dp,n=this._start;return!(t&&!(this._ts&&this._initted&&t.isActive()&&(e=t.rawTime(!0))>=n&&e1?(t?(i[e]=t,n&&(i[e+"Params"]=n),"onUpdate"===e&&(this._onUpdate=t)):delete i[e],this):i[e]},t.then=function(e){var t=this,n=t._prom;return new Promise(function(i){var r=rt(e)?e:Zt,a=function(){var e=t.then;t.then=null,n&&n(),rt(r)&&(r=r(t))&&(r.then||r===t)&&(t.then=e),i(r),t.then=e};t._initted&&1===t.totalProgress()&&t._ts>=0||!t._tTime&&t._ts<0?a():t._prom=a})},t.kill=function(){Wn(this)},e}();$t(gi.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-1e-8,_prom:0,_ps:!1,_rts:1});var vi=function(e){function t(t,n){var i;return void 0===t&&(t={}),(i=e.call(this,t)||this).labels={},i.smoothChildTiming=!!t.smoothChildTiming,i.autoRemoveChildren=!!t.autoRemoveChildren,i._sort=lt(t.sortChildren),Ue&&vn(t.parent||Ue,Fe(i),n),t.reversed&&i.reverse(),t.paused&&i.paused(!0),t.scrollTrigger&&yn(Fe(i),t.scrollTrigger),i}Le(t,e);var n=t.prototype;return n.to=function(e,t,n){return En(0,arguments,this),this},n.from=function(e,t,n){return En(1,arguments,this),this},n.fromTo=function(e,t,n,i){return En(2,arguments,this),this},n.set=function(e,t,n){return t.duration=0,t.parent=this,rn(t).repeatDelay||(t.repeat=0),t.immediateRender=!!t.immediateRender,new Ci(e,t,wn(this,n),1),this},n.call=function(e,t,n){return vn(this,Ci.delayedCall(0,e,t),n)},n.staggerTo=function(e,t,n,i,r,a,s){return n.duration=t,n.stagger=n.stagger||i,n.onComplete=a,n.onCompleteParams=s,n.parent=this,new Ci(e,n,wn(this,r)),this},n.staggerFrom=function(e,t,n,i,r,a,s){return n.runBackwards=1,rn(n).immediateRender=lt(n.immediateRender),this.staggerTo(e,t,n,i,r,a,s)},n.staggerFromTo=function(e,t,n,i,r,a,s,o){return i.startAt=n,rn(i).immediateRender=lt(i.immediateRender),this.staggerTo(e,t,i,r,a,s,o)},n.render=function(e,t,n){var i,r,a,s,o,l,u,c,h,d,p,f,m=this._time,g=this._dirty?this.totalDuration():this._tDur,v=this._dur,y=e<=0?0:Wt(e),_=this._zTime<0!==e<0&&(this._initted||!v);if(this!==Ue&&y>g&&e>=0&&(y=g),y!==this._tTime||n||_){if(m!==this._time&&v&&(y+=this._time-m,e+=this._time-m),i=y,h=this._start,l=!(c=this._ts),_&&(v||(m=this._zTime),(e||!t)&&(this._zTime=e)),this._repeat){if(p=this._yoyo,o=v+this._rDelay,this._repeat<-1&&e<0)return this.totalTime(100*o+e,t,n);if(i=Wt(y%o),y===g?(s=this._repeat,i=v):((s=~~(d=Wt(y/o)))&&s===d&&(i=v,s--),i>v&&(i=v)),d=dn(this._tTime,o),!m&&this._tTime&&d!==s&&this._tTime-d*o-this._dur<=0&&(d=s),p&&1&s&&(i=v-i,f=1),s!==d&&!this._lock){var b=p&&1&d,x=b===(p&&1&s);if(st)for(i=e._first;i&&i._start<=n;){if("isPause"===i.data&&i._start>t)return i;i=i._next}else for(i=e._last;i&&i._start>=n;){if("isPause"===i.data&&i._start=m&&e>=0)for(r=this._first;r;){if(a=r._next,(r._act||i>=r._start)&&r._ts&&u!==r){if(r.parent!==this)return this.render(e,t,n);if(r.render(r._ts>0?(i-r._start)*r._ts:(r._dirty?r.totalDuration():r._tDur)+(i-r._start)*r._ts,t,n),i!==this._time||!this._ts&&!l){u=0,a&&(y+=this._zTime=-1e-8);break}}r=a}else{r=this._last;for(var S=e<0?e:i;r;){if(a=r._prev,(r._act||S<=r._end)&&r._ts&&u!==r){if(r.parent!==this)return this.render(e,t,n);if(r.render(r._ts>0?(S-r._start)*r._ts:(r._dirty?r.totalDuration():r._tDur)+(S-r._start)*r._ts,t,n||Oe&&qt(r)),i!==this._time||!this._ts&&!l){u=0,a&&(y+=this._zTime=S?-1e-8:Ye);break}}r=a}}if(u&&!t&&(this.pause(),u.render(i>=m?0:-1e-8)._zTime=i>=m?1:-1,this._ts))return this._start=h,fn(this),this.render(e,t,n);this._onUpdate&&!t&&jn(this,"onUpdate",!0),(y===g&&this._tTime>=this.totalDuration()||!y&&m)&&(h!==this._start&&Math.abs(c)===Math.abs(this._ts)||this._lock||((e||!v)&&(y===g&&this._ts>0||!y&&this._ts<0)&&on(this,1),t||e<0&&!m||!y&&!m&&g||(jn(this,y===g&&e>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(y0)&&this._prom())))}return this},n.add=function(e,t){var n=this;if(at(t)||(t=wn(this,t,e)),!(e instanceof gi)){if(dt(e))return e.forEach(function(e){return n.add(e,t)}),this;if(it(e))return this.addLabel(e,t);if(!rt(e))return this;e=Ci.delayedCall(0,e)}return this!==e?vn(this,e,t):this},n.getChildren=function(e,t,n,i){void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===n&&(n=!0),void 0===i&&(i=-qe);for(var r=[],a=this._first;a;)a._start>=i&&(a instanceof Ci?t&&r.push(a):(n&&r.push(a),e&&r.push.apply(r,a.getChildren(!0,t,n)))),a=a._next;return r},n.getById=function(e){for(var t=this.getChildren(1,1,1),n=t.length;n--;)if(t[n].vars.id===e)return t[n]},n.remove=function(e){return it(e)?this.removeLabel(e):rt(e)?this.killTweensOf(e):(e.parent===this&&sn(this,e),e===this._recent&&(this._recent=this._last),ln(this))},n.totalTime=function(t,n){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Wt(ii.time-(this._ts>0?t/this._ts:(this.totalDuration()-t)/-this._ts))),e.prototype.totalTime.call(this,t,n),this._forcing=0,this):this._tTime},n.addLabel=function(e,t){return this.labels[e]=wn(this,t),this},n.removeLabel=function(e){return delete this.labels[e],this},n.addPause=function(e,t,n){var i=Ci.delayedCall(0,t||Ct,n);return i.data="isPause",this._hasPause=1,vn(this,i,wn(this,e))},n.removePause=function(e){var t=this._first;for(e=wn(this,e);t;)t._start===e&&"isPause"===t.data&&on(t),t=t._next},n.killTweensOf=function(e,t,n){for(var i=this.getTweensOf(e,n),r=i.length;r--;)yi!==i[r]&&i[r].kill(e,t);return this},n.getTweensOf=function(e,t){for(var n,i=[],r=Dn(e),a=this._first,s=at(t);a;)a instanceof Ci?Jt(a._targets,r)&&(s?(!yi||a._initted&&a._ts)&&a.globalTime(0)<=t&&a.globalTime(a.totalDuration())>t:!t||a.isActive())&&i.push(a):(n=a.getTweensOf(r,t)).length&&i.push.apply(i,n),a=a._next;return i},n.tweenTo=function(e,t){t=t||{};var n,i=this,r=wn(i,e),a=t,s=a.startAt,o=a.onStart,l=a.onStartParams,u=a.immediateRender,c=Ci.to(i,$t({ease:t.ease||"none",lazy:!1,immediateRender:!1,time:r,overwrite:"auto",duration:t.duration||Math.abs((r-(s&&"time"in s?s.time:i._time))/i.timeScale())||Ye,onStart:function(){if(i.pause(),!n){var e=t.duration||Math.abs((r-(s&&"time"in s?s.time:i._time))/i.timeScale());c._dur!==e&&Sn(c,e,0,1).render(c._time,!0,!0),n=1}o&&o.apply(c,l||[])}},t));return u?c.render(0):c},n.tweenFromTo=function(e,t,n){return this.tweenTo(t,$t({startAt:{time:wn(this,e)}},n))},n.recent=function(){return this._recent},n.nextLabel=function(e){return void 0===e&&(e=this._time),Vn(this,wn(this,e))},n.previousLabel=function(e){return void 0===e&&(e=this._time),Vn(this,wn(this,e),1)},n.currentLabel=function(e){return arguments.length?this.seek(e,!0):this.previousLabel(this._time+Ye)},n.shiftChildren=function(e,t,n){void 0===n&&(n=0);var i,r=this._first,a=this.labels;for(e=Wt(e);r;)r._start>=n&&(r._start+=e,r._end+=e),r=r._next;if(t)for(i in a)a[i]>=n&&(a[i]+=e);return ln(this)},n.invalidate=function(t){var n=this._first;for(this._lock=0;n;)n.invalidate(t),n=n._next;return e.prototype.invalidate.call(this,t)},n.clear=function(e){void 0===e&&(e=!0);for(var t,n=this._first;n;)t=n._next,this.remove(n),n=t;return this._dp&&(this._time=this._tTime=this._pTime=0),e&&(this.labels={}),ln(this)},n.totalDuration=function(e){var t,n,i,r=0,a=this,s=a._last,o=qe;if(arguments.length)return a.timeScale((a._repeat<0?a.duration():a.totalDuration())/(a.reversed()?-e:e));if(a._dirty){for(i=a.parent;s;)t=s._prev,s._dirty&&s.totalDuration(),(n=s._start)>o&&a._sort&&s._ts&&!a._lock?(a._lock=1,vn(a,s,n-s._delay,1)._lock=0):o=n,n<0&&s._ts&&(r-=n,(!i&&!a._dp||i&&i.smoothChildTiming)&&(a._start+=Wt(n/a._ts),a._time-=n,a._tTime-=n),a.shiftChildren(-n,!1,-1/0),o=0),s._end>r&&s._ts&&(r=s._end),s=t;Sn(a,a===Ue&&a._time>r?a._time:r,1,1),a._dirty=0}return a._tDur},t.updateRoot=function(e){if(Ue._ts&&(Yt(Ue,pn(e,Ue)),je=ii.frame),ii.frame>=Ot){Ot+=Je.autoSleep||120;var t=Ue._first;if((!t||!t._ts)&&Je.autoSleep&&ii._listeners.length<2){for(;t&&!t._ts;)t=t._next;t||ii.sleep()}}},t}(gi);$t(vi.prototype,{_lock:0,_hasPause:0,_forcing:0});var yi,_i,bi=function(e,t,n,i,r,a,s){var o,l,u,c,h,d,p,f,m=new Hi(this._pt,e,t,0,1,Ni,null,r),g=0,v=0;for(m.b=n,m.e=i,n+="",(p=~(i+="").indexOf("random("))&&(i=Gn(i)),a&&(a(f=[n,i],e,t),n=f[0],i=f[1]),l=n.match(yt)||[];o=yt.exec(i);)c=o[0],h=i.substring(g,o.index),u?u=(u+1)%5:"rgba("===h.substr(-5)&&(u=1),c!==l[v++]&&(d=parseFloat(l[v-1])||0,m._pt={_next:m._pt,p:h||1===v?h:",",s:d,c:"="===c.charAt(1)?Xt(d,c)-d:parseFloat(c)-d,m:u&&u<4?Math.round:0},g=yt.lastIndex);return m.c=g")}),s.duration();else{for(c in l={},b)"ease"===c||"easeEach"===c||Mi(c,b[c],l,b.easeEach);for(c in l)for(E=l[c].sort(function(e,t){return e.t-t.t}),R=0,o=0;od-Ye&&!f?d:ep&&(i=p),(l=this._yoyo&&1&a)&&(i=p-i),o=dn(this._tTime,s),i===h&&!n&&this._initted&&a===o)return this._tTime=m,this;a!==o&&this.vars.repeatRefresh&&!l&&!this._lock&&i!==s&&this._initted&&(this._lock=n=1,this.render(Wt(s*a),!0).invalidate()._lock=0)}if(!this._initted){if(_n(this,f?e:i,n,t,m))return this._tTime=0,this;if(h!==this._time&&(!n||!this.vars.repeatRefresh||a===o))return this;if(p!==this._dur)return this.render(e,t,n)}if(this._rEase){var g=i0||!m&&this._ts<0)&&on(this,1),t||f&&!h||!(m||h||l)||(jn(this,m===d?"onComplete":"onReverseComplete",!0),this._prom&&!(m0)&&this._prom()))}}else!function(e,t,n,i){var r,a,s,o=e.ratio,l=t<0||!t&&(!e._start&&bn(e)&&(e._initted||!xn(e))||(e._ts<0||e._dp._ts<0)&&!xn(e))?0:1,u=e._rDelay,c=0;if(u&&e._repeat&&(c=Cn(0,e._tDur,t),a=dn(c,u),e._yoyo&&1&a&&(l=1-l),a!==dn(e._tTime,u)&&(o=1-l,e.vars.repeatRefresh&&e._initted&&e.invalidate())),l!==o||Oe||i||e._zTime===Ye||!t&&e._zTime){if(!e._initted&&_n(e,t,i,n,c))return;for(s=e._zTime,e._zTime=t||(n?Ye:0),n||(n=t&&!s),e.ratio=l,e._from&&(l=1-l),e._time=0,e._tTime=c,r=e._pt;r;)r.r(l,r.d),r=r._next;t<0&&un(e,t,0,!0),e._onUpdate&&!n&&jn(e,"onUpdate"),c&&e._repeat&&!n&&e.parent&&jn(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===l&&(l&&on(e,1),n||Oe||(jn(e,l?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)}(this,e,t,n);return this},n.targets=function(){return this._targets},n.invalidate=function(t){return(!t||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(t),e.prototype.invalidate.call(this,t)},n.resetTo=function(e,t,n,i,r){Xe||ii.wake(),this._ts||this.play();var a=Math.min(this._dur,(this._dp._time-this._start)*this._ts);return this._initted||Ai(this,a),function(e,t,n,i,r,a,s,o){var l,u,c,h,d=(e._pt&&e._ptCache||(e._ptCache={}))[t];if(!d)for(d=e._ptCache[t]=[],c=e._ptLookup,h=e._targets.length;h--;){if((l=c[h][t])&&l.d&&l.d._pt)for(l=l.d._pt;l&&l.p!==t&&l.fp!==t;)l=l._next;if(!l)return _i=1,e.vars[t]="+=0",Ai(e,s),_i=0,o?Et(t+" not eligible for reset. Try splitting into individual properties"):1;d.push(l)}for(h=d.length;h--;)(l=(u=d[h])._pt||u).s=!i&&0!==i||r?l.s+(i||0)+a*l.c:i,l.c=n-l.s,u.e&&(u.e=jt(n)+Rn(u.e)),u.b&&(u.b=l.s+Rn(u.b))}(this,e,t,n,i,this._ease(a/this._dur),a,r)?this.resetTo(e,t,n,i,1):(mn(this,0),this.parent||an(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},n.kill=function(e,t){if(void 0===t&&(t="all"),!e&&(!t||"all"===t))return this._lazy=this._pt=0,this.parent?Wn(this):this.scrollTrigger&&this.scrollTrigger.kill(!!Oe),this;if(this.timeline){var n=this.timeline.totalDuration();return this.timeline.killTweensOf(e,t,yi&&!0!==yi.vars.overwrite)._first||Wn(this),this.parent&&n!==this.timeline.totalDuration()&&Sn(this,this._dur*this.timeline._tDur/n,0,1),this}var i,r,a,s,o,l,u,c=this._targets,h=e?Dn(e):c,d=this._ptLookup,p=this._pt;if((!t||"all"===t)&&function(e,t){for(var n=e.length,i=n===t.length;i&&n--&&e[n]===t[n];);return n<0}(c,h))return"all"===t&&(this._pt=0),Wn(this);for(i=this._op=this._op||[],"all"!==t&&(it(t)&&(o={},Vt(t,function(e){return o[e]=1}),t=o),t=function(e,t){var n,i,r,a,s=e[0]?Gt(e[0]).harness:0,o=s&&s.aliases;if(!o)return t;for(i in n=en({},t),o)if(i in n)for(r=(a=o[i].split(",")).length;r--;)n[a[r]]=n[i];return n}(c,t)),u=c.length;u--;)if(~h.indexOf(c[u]))for(o in r=d[u],"all"===t?(i[u]=t,s=r,a={}):(a=i[u]=i[u]||{},s=t),s)(l=r&&r[o])&&("kill"in l.d&&!0!==l.d.kill(o)||sn(this,l,"_pt"),delete r[o]),"all"!==a&&(a[o]=1);return this._initted&&!this._pt&&p&&Wn(this),this},t.to=function(e,n){return new t(e,n,arguments[2])},t.from=function(e,t){return En(1,arguments)},t.delayedCall=function(e,n,i,r){return new t(n,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:e,onComplete:n,onReverseComplete:n,onCompleteParams:i,onReverseCompleteParams:i,callbackScope:r})},t.fromTo=function(e,t,n){return En(2,arguments)},t.set=function(e,n){return n.duration=0,n.repeatDelay||(n.repeat=0),new t(e,n)},t.killTweensOf=function(e,t,n){return Ue.killTweensOf(e,t,n)},t}(gi);$t(Ci.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0}),Vt("staggerTo,staggerFrom,staggerFromTo",function(e){Ci[e]=function(){var t=new vi,n=Pn.call(arguments,0);return n.splice("staggerFromTo"===e?5:4,0,0),t[e].apply(t,n)}});var Ri=function(e,t,n){return e[t]=n},Pi=function(e,t,n){return e[t](n)},Bi=function(e,t,n,i){return e[t](i.fp,n)},Ii=function(e,t,n){return e.setAttribute(t,n)},Di=function(e,t){return rt(e[t])?Pi:st(e[t])&&e.setAttribute?Ii:Ri},Fi=function(e,t){return t.set(t.t,t.p,Math.round(1e6*(t.s+t.c*e))/1e6,t)},Li=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},Ni=function(e,t){var n=t._pt,i="";if(!e&&t.b)i=t.b;else if(1===e&&t.e)i=t.e;else{for(;n;)i=n.p+(n.m?n.m(n.s+n.c*e):Math.round(1e4*(n.s+n.c*e))/1e4)+i,n=n._next;i+=t.c}t.set(t.t,t.p,i,t)},Oi=function(e,t){for(var n=t._pt;n;)n.r(e,n.d),n=n._next},ki=function(e,t,n,i){for(var r,a=this._pt;a;)r=a._next,a.p===i&&a.modifier(e,t,n),a=r},Ui=function(e){for(var t,n,i=this._pt;i;)n=i._next,i.p===e&&!i.op||i.op===e?sn(this,i,"_pt"):i.dep||(t=1),i=n;return!t},zi=function(e,t,n,i){i.mSet(e,t,i.m.call(i.tween,n,i.mt),i)},Gi=function(e){for(var t,n,i,r,a=e._pt;a;){for(t=a._next,n=i;n&&n.pr>a.pr;)n=n._next;(a._prev=n?n._prev:r)?a._prev._next=a:i=a,(a._next=n)?n._prev=a:r=a,a=t}e._pt=i},Hi=function(){function e(e,t,n,i,r,a,s,o,l){this.t=t,this.s=i,this.c=r,this.p=n,this.r=a||Fi,this.d=s||this,this.set=o||Ri,this.pr=l||0,this._next=e,e&&(e._prev=this)}return e.prototype.modifier=function(e,t,n){this.mSet=this.mSet||this.set,this.set=zi,this.m=e,this.mt=n,this.tween=t},e}();Vt(Ut+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger,easeReverse",function(e){return It[e]=1}),St.TweenMax=St.TweenLite=Ci,St.TimelineLite=St.TimelineMax=vi,Ue=new vi({sortChildren:!1,defaults:Ke,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0}),Je.stringFilter=ni;var Vi=[],ji={},Wi=[],Xi=0,Ji=0,Ki=function(e){return(ji[e]||Wi).map(function(e){return e()})},qi=function(){var e=Date.now(),t=[];e-Xi>2&&(Ki("matchMediaInit"),Vi.forEach(function(e){var n,i,r,a,s=e.queries,o=e.conditions;for(i in s)(n=ze.matchMedia(s[i]).matches)&&(r=1),n!==o[i]&&(o[i]=n,a=1);a&&(e.revert(),r&&t.push(e))}),Ki("matchMediaRevert"),t.forEach(function(e){return e.onMatch(e,function(t){return e.add(null,t)})}),Xi=e,Ki("matchMedia"))},Yi=function(){function e(e,t){this.selector=t&&Fn(t),this.data=[],this._r=[],this.isReverted=!1,this.id=Ji++,e&&this.add(e)}var t=e.prototype;return t.add=function(e,t,n){rt(e)&&(n=t,t=e,e=rt);var i=this,r=function(){var e,r=ke,a=i.selector;return r&&r!==i&&r.data.push(i),n&&(i.selector=Fn(n)),ke=i,e=t.apply(i,arguments),rt(e)&&i._r.push(e),ke=r,i.selector=a,i.isReverted=!1,e};return i.last=r,e===rt?r(i,function(e){return i.add(null,e)}):e?i[e]=r:r},t.ignore=function(e){var t=ke;ke=null,e(this),ke=t},t.getTweens=function(){var t=[];return this.data.forEach(function(n){return n instanceof e?t.push.apply(t,n.getTweens()):n instanceof Ci&&!(n.parent&&"nested"===n.parent.data)&&t.push(n)}),t},t.clear=function(){this._r.length=this.data.length=0},t.kill=function(e,t){var n=this;if(e?function(){for(var t,i=n.getTweens(),r=n.data.length;r--;)"isFlip"===(t=n.data[r]).data&&(t.revert(),t.getChildren(!0,!0,!1).forEach(function(e){return i.splice(i.indexOf(e),1)}));for(i.map(function(e){return{g:e._dur||e._delay||e._sat&&!e._sat.vars.immediateRender?e.globalTime(0):-1/0,t:e}}).sort(function(e,t){return t.g-e.g||-1/0}).forEach(function(t){return t.t.revert(e)}),r=n.data.length;r--;)(t=n.data[r])instanceof vi?"nested"!==t.data&&(t.scrollTrigger&&t.scrollTrigger.revert(),t.kill()):!(t instanceof Ci)&&t.revert&&t.revert(e);n._r.forEach(function(t){return t(e,n)}),n.isReverted=!0}():this.data.forEach(function(e){return e.kill&&e.kill()}),this.clear(),t)for(var i=Vi.length;i--;)Vi[i].id===this.id&&Vi.splice(i,1)},t.revert=function(e){this.kill(e||{})},e}(),Qi=function(){function e(e){this.contexts=[],this.scope=e,ke&&ke.data.push(this)}var t=e.prototype;return t.add=function(e,t,n){ot(e)||(e={matches:e});var i,r,a,s=new Yi(0,n||this.scope),o=s.conditions={};for(r in ke&&!s.selector&&(s.selector=ke.selector),this.contexts.push(s),t=s.add("onMatch",t),s.queries=e,e)"all"===r?a=1:(i=ze.matchMedia(e[r]))&&(Vi.indexOf(s)<0&&Vi.push(s),(o[r]=i.matches)&&(a=1),i.addListener?i.addListener(qi):i.addEventListener("change",qi));return a&&t(s,function(e){return s.add(null,e)}),this},t.revert=function(e){this.kill(e||{})},t.kill=function(e){this.contexts.forEach(function(t){return t.kill(e,!0)})},e}(),Zi={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),n=0;n1){var i=e.map(function(e){return tr.quickSetter(e,t,n)}),r=i.length;return function(e){for(var t=r;t--;)i[t](e)}}e=e[0]||{};var a=Lt[t],s=Gt(e),o=s.harness&&(s.harness.aliases||{})[t]||t,l=a?function(t){var i=new a;We._pt=0,i.init(e,n?t+n:t,We,0,[e]),i.render(1,i),We._pt&&Oi(1,We)}:s.set(e,o);return a?l:function(t){return l(e,o,n?t+n:t,s,1)}},quickTo:function(e,t,n){var i,r=tr.to(e,$t(((i={})[t]="+=0.1",i.paused=!0,i.stagger=0,i),n||{})),a=function(e,n,i){return r.resetTo(t,e,n,i)};return a.tween=r,a},isTweening:function(e){return Ue.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=ci(e.ease,Ke.ease)),tn(Ke,e||{})},config:function(e){return tn(Je,e||{})},registerEffect:function(e){var t=e.name,n=e.effect,i=e.plugins,r=e.defaults,a=e.extendTimeline;(i||"").split(",").forEach(function(e){return e&&!Lt[e]&&!St[e]&&Et(t+" effect requires "+e+" plugin.")}),Nt[t]=function(e,t,i){return n(Dn(e),$t(t||{},r),i)},a&&(vi.prototype[t]=function(e,n,i){return this.add(Nt[t](e,ot(n)?n:(i=n)&&{},this),i)})},registerEase:function(e,t){ai[e]=ci(t)},parseEase:function(e,t){return arguments.length?ci(e,t):ai},getById:function(e){return Ue.getById(e)},exportRoot:function(e,t){void 0===e&&(e={});var n,i,r=new vi(e);for(r.smoothChildTiming=lt(e.smoothChildTiming),Ue.remove(r),r._dp=0,r._time=r._tTime=Ue._time,n=Ue._first;n;)i=n._next,!t&&!n._dur&&n instanceof Ci&&n.vars.onComplete===n._targets[0]||vn(r,n,n._start-n._delay),n=i;return vn(Ue,r,0),r},context:function(e,t){return e?new Yi(e,t):ke},matchMedia:function(e){return new Qi(e)},matchMediaRefresh:function(){return Vi.forEach(function(e){var t,n,i=e.conditions;for(n in i)i[n]&&(i[n]=!1,t=1);t&&e.revert()})||qi()},addEventListener:function(e,t){var n=ji[e]||(ji[e]=[]);~n.indexOf(t)||n.push(t)},removeEventListener:function(e,t){var n=ji[e],i=n&&n.indexOf(t);i>=0&&n.splice(i,1)},utils:{wrap:function e(t,n,i){var r=n-t;return dt(t)?zn(t,e(0,t.length),n):Tn(i,function(e){return(r+(e-t)%r)%r+t})},wrapYoyo:function e(t,n,i){var r=n-t,a=2*r;return dt(t)?zn(t,e(0,t.length-1),n):Tn(i,function(e){return t+((e=(a+(e-t)%a)%a||0)>r?a-e:e)})},distribute:Nn,random:Un,snap:kn,normalize:function(e,t,n){return Hn(e,t,0,1,n)},getUnit:Rn,clamp:function(e,t,n){return Tn(n,function(n){return Cn(e,t,n)})},splitColor:Qn,toArray:Dn,selector:Fn,mapRange:Hn,pipe:function(){for(var e=arguments.length,t=new Array(e),n=0;n=0)return;s.svg&&(this.svgo=r.getAttribute("data-svg-origin"),this.props.push(Ir,n,"")),t=Br}(a||n)&&this.props.push(t,n,a[t])},Fr=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},Lr=function(){var e,t,n=this.props,i=this.target,r=i.style,a=i._gsap;for(e=0;e=0?Ur[r]:"")+e},Gr=function(){"undefined"!==typeof window&&window.document&&(nr=window,ir=nr.document,rr=ir.documentElement,sr=Or("div")||{style:{}},Or("div"),Br=zr(Br),Ir=Br+"Origin",sr.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",ur=!!zr("perspective"),lr=tr.core.reverting,ar=1)},Hr=function(e){var t,n=e.ownerSVGElement,i=Or("svg",n&&n.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=e.cloneNode(!0);r.style.display="block",i.appendChild(r),rr.appendChild(i);try{t=r.getBBox()}catch(a){}return i.removeChild(r),rr.removeChild(i),t},Vr=function(e,t){for(var n=t.length;n--;)if(e.hasAttribute(t[n]))return e.getAttribute(t[n])},jr=function(e){var t,n;try{t=e.getBBox()}catch(Du){t=Hr(e),n=1}return t&&(t.width||t.height)||n||(t=Hr(e)),!t||t.width||t.x||t.y?t:{x:+Vr(e,["x","cx","x1"])||0,y:+Vr(e,["y","cy","y1"])||0,width:0,height:0}},Wr=function(e){return!(!e.getCTM||e.parentNode&&!e.ownerSVGElement||!jr(e))},Xr=function(e,t){if(t){var n,i=e.style;t in cr&&t!==Ir&&(t=Br),i.removeProperty?("ms"!==(n=t.substr(0,2))&&"webkit"!==t.substr(0,6)||(t="-"+t),i.removeProperty("--"===n?t:t.replace(fr,"-$1").toLowerCase())):i.removeAttribute(t)}},Jr=function(e,t,n,i,r,a){var s=new Hi(e._pt,t,n,0,1,a?Mr:Ar);return e._pt=s,s.b=i,s.e=r,e._props.push(n),s},Kr={deg:1,rad:1,turn:1},qr={grid:1,flex:1},Yr=function e(t,n,i,r){var a,s,o,l,u=parseFloat(i)||0,c=(i+"").trim().substr((u+"").length)||"px",h=sr.style,d=mr.test(n),p="svg"===t.tagName.toLowerCase(),f=(p?"client":"offset")+(d?"Width":"Height"),m=100,g="px"===r,v="%"===r;if(r===c||!u||Kr[r]||Kr[c])return u;if("px"!==c&&!g&&(u=e(t,n,i,"px")),l=t.getCTM&&Wr(t),(v||"%"===c)&&(cr[n]||~n.indexOf("adius")))return a=l?t.getBBox()[d?"width":"height"]:t[f],jt(v?u/a*m:u/100*a);if(h[d?"width":"height"]=m+(g?c:r),s="rem"!==r&&~n.indexOf("adius")||"em"===r&&t.appendChild&&!p?t:t.parentNode,l&&(s=(t.ownerSVGElement||{}).parentNode),s&&s!==ir&&s.appendChild||(s=ir.body),(o=s._gsap)&&v&&o.width&&d&&o.time===ii.time&&!o.uncache)return jt(u/o.width*m);if(!v||"height"!==n&&"width"!==n)(v||"%"===c)&&!qr[kr(s,"display")]&&(h.position=kr(t,"position")),s===t&&(h.position="static"),s.appendChild(sr),a=sr[f],s.removeChild(sr),h.position="absolute";else{var y=t.style[n];t.style[n]=m+r,a=t[f],y?t.style[n]=y:Xr(t,n)}return d&&v&&((o=Gt(s)).time=ii.time,o.width=s[f]),jt(g?a*u/m:a&&u?m/a*u:0)},Qr=function(e,t,n,i){var r;return ar||Gr(),t in vr&&"transform"!==t&&~(t=vr[t]).indexOf(",")&&(t=t.split(",")[0]),cr[t]&&"transform"!==t?(r=ua(e,i),r="transformOrigin"!==t?r[t]:r.svg?r.origin:ca(kr(e,Ir))+" "+r.zOrigin+"px"):(!(r=e.style[t])||"auto"===r||i||~(r+"").indexOf("calc("))&&(r=na[t]&&na[t](e,t,n)||kr(e,t)||Ht(e,t)||("opacity"===t?1:0)),n&&!~(r+"").trim().indexOf(" ")?Yr(e,t,r,n)+n:r},Zr=function(e,t,n,i){if(!n||"none"===n){var r=zr(t,e,1),a=r&&kr(e,r,1);a&&a!==n?(t=r,n=a):"borderColor"===t&&(n=kr(e,"borderTopColor"))}var s,o,l,u,c,h,d,p,f,m,g,v=new Hi(this._pt,e.style,t,0,1,Ni),y=0,_=0;if(v.b=n,v.e=i,n+="","var(--"===(i+="").substring(0,6)&&(i=kr(e,i.substring(4,i.indexOf(")")))),"auto"===i&&(h=e.style[t],e.style[t]=i,i=kr(e,t)||i,h?e.style[t]=h:Xr(e,t)),ni(s=[n,i]),i=s[1],l=(n=s[0]).match(vt)||[],(i.match(vt)||[]).length){for(;o=vt.exec(i);)d=o[0],f=i.substring(y,o.index),c?c=(c+1)%5:"rgba("!==f.substr(-5)&&"hsla("!==f.substr(-5)||(c=1),d!==(h=l[_++]||"")&&(u=parseFloat(h)||0,g=h.substr((u+"").length),"="===d.charAt(1)&&(d=Xt(u,d)+g),p=parseFloat(d),m=d.substr((p+"").length),y=vt.lastIndex-m.length,m||(m=m||Je.units[t]||g,y===i.length&&(i+=m,v.e+=m)),g!==m&&(u=Yr(e,t,h,m)||0),v._pt={_next:v._pt,p:f||1===_?f:",",s:u,c:p-u,m:c&&c<4||"zIndex"===t?Math.round:0});v.c=y-1;)n=o[r],cr[n]&&(i=1,n="transformOrigin"===n?Ir:Br),Xr(a,n);i&&(Xr(a,Br),l&&(l.svg&&a.removeAttribute("transform"),s.scale=s.rotate=s.translate="none",ua(a,1),l.uncache=1,Fr(s)))}},na={clearProps:function(e,t,n,i,r){if("isFromStart"!==r.data){var a=e._pt=new Hi(e._pt,t,n,0,0,ta);return a.u=i,a.pr=-10,a.tween=r,e._props.push(n),1}}},ia=[1,0,0,1,0,0],ra={},aa=function(e){return"matrix(1, 0, 0, 1, 0, 0)"===e||"none"===e||!e},sa=function(e){var t=kr(e,Br);return aa(t)?ia:t.substr(7).match(gt).map(jt)},oa=function(e,t){var n,i,r,a,s=e._gsap||Gt(e),o=e.style,l=sa(e);return s.svg&&e.getAttribute("transform")?"1,0,0,1,0,0"===(l=[(r=e.transform.baseVal.consolidate().matrix).a,r.b,r.c,r.d,r.e,r.f]).join(",")?ia:l:(l!==ia||e.offsetParent||e===rr||s.svg||(r=o.display,o.display="block",(n=e.parentNode)&&(e.offsetParent||e.getBoundingClientRect().width)||(a=1,i=e.nextElementSibling,rr.appendChild(e)),l=sa(e),r?o.display=r:Xr(e,"display"),a&&(i?n.insertBefore(e,i):n?n.appendChild(e):rr.removeChild(e))),t&&l.length>6?[l[0],l[1],l[4],l[5],l[12],l[13]]:l)},la=function(e,t,n,i,r,a){var s,o,l,u=e._gsap,c=r||oa(e,!0),h=u.xOrigin||0,d=u.yOrigin||0,p=u.xOffset||0,f=u.yOffset||0,m=c[0],g=c[1],v=c[2],y=c[3],_=c[4],b=c[5],x=t.split(" "),S=parseFloat(x[0])||0,A=parseFloat(x[1])||0;n?c!==ia&&(o=m*y-g*v)&&(l=S*(-g/o)+A*(m/o)-(m*b-g*_)/o,S=S*(y/o)+A*(-v/o)+(v*b-y*_)/o,A=l):(S=(s=jr(e)).x+(~x[0].indexOf("%")?S/100*s.width:S),A=s.y+(~(x[1]||x[0]).indexOf("%")?A/100*s.height:A)),i||!1!==i&&u.smooth?(_=S-h,b=A-d,u.xOffset=p+(_*m+b*v)-_,u.yOffset=f+(_*g+b*y)-b):u.xOffset=u.yOffset=0,u.xOrigin=S,u.yOrigin=A,u.smooth=!!i,u.origin=t,u.originIsAbsolute=!!n,e.style[Ir]="0px 0px",a&&(Jr(a,u,"xOrigin",h,S),Jr(a,u,"yOrigin",d,A),Jr(a,u,"xOffset",p,u.xOffset),Jr(a,u,"yOffset",f,u.yOffset)),e.setAttribute("data-svg-origin",S+" "+A)},ua=function(e,t){var n=e._gsap||new mi(e);if("x"in n&&!t&&!n.uncache)return n;var i,r,a,s,o,l,u,c,h,d,p,f,m,g,v,y,_,b,x,S,A,M,w,E,T,C,R,P,B,I,D,F,L=e.style,N=n.scaleX<0,O="px",k="deg",U=getComputedStyle(e),z=kr(e,Ir)||"0";return i=r=a=l=u=c=h=d=p=0,s=o=1,n.svg=!(!e.getCTM||!Wr(e)),U.translate&&("none"===U.translate&&"none"===U.scale&&"none"===U.rotate||(L[Br]=("none"!==U.translate?"translate3d("+(U.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+("none"!==U.rotate?"rotate("+U.rotate+") ":"")+("none"!==U.scale?"scale("+U.scale.split(" ").join(",")+") ":"")+("none"!==U[Br]?U[Br]:"")),L.scale=L.rotate=L.translate="none"),g=oa(e,n.svg),n.svg&&(n.uncache?(T=e.getBBox(),z=n.xOrigin-T.x+"px "+(n.yOrigin-T.y)+"px",E=""):E=!t&&e.getAttribute("data-svg-origin"),la(e,E||z,!!E||n.originIsAbsolute,!1!==n.smooth,g)),f=n.xOrigin||0,m=n.yOrigin||0,g!==ia&&(b=g[0],x=g[1],S=g[2],A=g[3],i=M=g[4],r=w=g[5],6===g.length?(s=Math.sqrt(b*b+x*x),o=Math.sqrt(A*A+S*S),l=b||x?pr(x,b)*hr:0,(h=S||A?pr(S,A)*hr+l:0)&&(o*=Math.abs(Math.cos(h*dr))),n.svg&&(i-=f-(f*b+m*S),r-=m-(f*x+m*A))):(F=g[6],I=g[7],R=g[8],P=g[9],B=g[10],D=g[11],i=g[12],r=g[13],a=g[14],u=(v=pr(F,B))*hr,v&&(E=M*(y=Math.cos(-v))+R*(_=Math.sin(-v)),T=w*y+P*_,C=F*y+B*_,R=M*-_+R*y,P=w*-_+P*y,B=F*-_+B*y,D=I*-_+D*y,M=E,w=T,F=C),c=(v=pr(-S,B))*hr,v&&(y=Math.cos(-v),D=A*(_=Math.sin(-v))+D*y,b=E=b*y-R*_,x=T=x*y-P*_,S=C=S*y-B*_),l=(v=pr(x,b))*hr,v&&(E=b*(y=Math.cos(v))+x*(_=Math.sin(v)),T=M*y+w*_,x=x*y-b*_,w=w*y-M*_,b=E,M=T),u&&Math.abs(u)+Math.abs(l)>359.9&&(u=l=0,c=180-c),s=jt(Math.sqrt(b*b+x*x+S*S)),o=jt(Math.sqrt(w*w+F*F)),v=pr(M,w),h=Math.abs(v)>2e-4?v*hr:0,p=D?1/(D<0?-D:D):0),n.svg&&(E=e.getAttribute("transform"),n.forceCSS=e.setAttribute("transform","")||!aa(kr(e,Br)),E&&e.setAttribute("transform",E))),Math.abs(h)>90&&Math.abs(h)<270&&(N?(s*=-1,h+=l<=0?180:-180,l+=l<=0?180:-180):(o*=-1,h+=h<=0?180:-180)),t=t||n.uncache,n.x=i-((n.xPercent=i&&(!t&&n.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-i)?-50:0)))?e.offsetWidth*n.xPercent/100:0)+O,n.y=r-((n.yPercent=r&&(!t&&n.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-r)?-50:0)))?e.offsetHeight*n.yPercent/100:0)+O,n.z=a+O,n.scaleX=jt(s),n.scaleY=jt(o),n.rotation=jt(l)+k,n.rotationX=jt(u)+k,n.rotationY=jt(c)+k,n.skewX=h+k,n.skewY=d+k,n.transformPerspective=p+O,(n.zOrigin=parseFloat(z.split(" ")[2])||!t&&n.zOrigin||0)&&(L[Ir]=ca(z)),n.xOffset=n.yOffset=0,n.force3D=Je.force3D,n.renderTransform=n.svg?va:ur?ga:da,n.uncache=0,n},ca=function(e){return(e=e.split(" "))[0]+" "+e[1]},ha=function(e,t,n){var i=Rn(t);return jt(parseFloat(t)+parseFloat(Yr(e,"x",n+"px",i)))+i},da=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,ga(e,t)},pa="0deg",fa="0px",ma=") ",ga=function(e,t){var n=t||this,i=n.xPercent,r=n.yPercent,a=n.x,s=n.y,o=n.z,l=n.rotation,u=n.rotationY,c=n.rotationX,h=n.skewX,d=n.skewY,p=n.scaleX,f=n.scaleY,m=n.transformPerspective,g=n.force3D,v=n.target,y=n.zOrigin,_="",b="auto"===g&&e&&1!==e||!0===g;if(y&&(c!==pa||u!==pa)){var x,S=parseFloat(u)*dr,A=Math.sin(S),M=Math.cos(S);S=parseFloat(c)*dr,x=Math.cos(S),a=ha(v,a,A*x*-y),s=ha(v,s,-Math.sin(S)*-y),o=ha(v,o,M*x*-y+y)}m!==fa&&(_+="perspective("+m+ma),(i||r)&&(_+="translate("+i+"%, "+r+"%) "),(b||a!==fa||s!==fa||o!==fa)&&(_+=o!==fa||b?"translate3d("+a+", "+s+", "+o+") ":"translate("+a+", "+s+ma),l!==pa&&(_+="rotate("+l+ma),u!==pa&&(_+="rotateY("+u+ma),c!==pa&&(_+="rotateX("+c+ma),h===pa&&d===pa||(_+="skew("+h+", "+d+ma),1===p&&1===f||(_+="scale("+p+", "+f+ma),v.style[Br]=_||"translate(0, 0)"},va=function(e,t){var n,i,r,a,s,o=t||this,l=o.xPercent,u=o.yPercent,c=o.x,h=o.y,d=o.rotation,p=o.skewX,f=o.skewY,m=o.scaleX,g=o.scaleY,v=o.target,y=o.xOrigin,_=o.yOrigin,b=o.xOffset,x=o.yOffset,S=o.forceCSS,A=parseFloat(c),M=parseFloat(h);d=parseFloat(d),p=parseFloat(p),(f=parseFloat(f))&&(p+=f=parseFloat(f),d+=f),d||p?(d*=dr,p*=dr,n=Math.cos(d)*m,i=Math.sin(d)*m,r=Math.sin(d-p)*-g,a=Math.cos(d-p)*g,p&&(f*=dr,s=Math.tan(p-f),r*=s=Math.sqrt(1+s*s),a*=s,f&&(s=Math.tan(f),n*=s=Math.sqrt(1+s*s),i*=s)),n=jt(n),i=jt(i),r=jt(r),a=jt(a)):(n=m,a=g,i=r=0),(A&&!~(c+"").indexOf("px")||M&&!~(h+"").indexOf("px"))&&(A=Yr(v,"x",c,"px"),M=Yr(v,"y",h,"px")),(y||_||b||x)&&(A=jt(A+y-(y*n+_*r)+b),M=jt(M+_-(y*i+_*a)+x)),(l||u)&&(s=v.getBBox(),A=jt(A+l/100*s.width),M=jt(M+u/100*s.height)),s="matrix("+n+","+i+","+r+","+a+","+A+","+M+")",v.setAttribute("transform",s),S&&(v.style[Br]=s)},ya=function(e,t,n,i,r){var a,s,o=360,l=it(r),u=parseFloat(r)*(l&&~r.indexOf("rad")?hr:1)-i,c=i+u+"deg";return l&&("short"===(a=r.split("_")[1])&&(u%=o)!==u%180&&(u+=u<0?o:-360),"cw"===a&&u<0?u=(u+36e9)%o-~~(u/o)*o:"ccw"===a&&u>0&&(u=(u-36e9)%o-~~(u/o)*o)),e._pt=s=new Hi(e._pt,t,n,i,u,_r),s.e=c,s.u="deg",e._props.push(n),s},_a=function(e,t){for(var n in t)e[n]=t[n];return e},ba=function(e,t,n){var i,r,a,s,o,l,u,c=_a({},n._gsap),h=n.style;for(r in c.svg?(a=n.getAttribute("transform"),n.setAttribute("transform",""),h[Br]=t,i=ua(n,1),Xr(n,Br),n.setAttribute("transform",a)):(a=getComputedStyle(n)[Br],h[Br]=t,i=ua(n,1),h[Br]=a),cr)(a=c[r])!==(s=i[r])&&"perspective,force3D,transformOrigin,svgOrigin".indexOf(r)<0&&(o=Rn(a)!==(u=Rn(s))?Yr(n,r,a,u):parseFloat(a),l=parseFloat(s),e._pt=new Hi(e._pt,i,r,o,l-o,yr),e._pt.u=u||0,e._props.push(r));_a(i,c)};Vt("padding,margin,Width,Radius",function(e,t){var n="Top",i="Right",r="Bottom",a="Left",s=(t<3?[n,i,r,a]:[n+a,n+i,r+i,r+a]).map(function(n){return t<2?e+n:"border"+n+e});na[t>1?"border"+e:e]=function(e,t,n,i,r){var a,o;if(arguments.length<4)return a=s.map(function(t){return Qr(e,t,n)}),5===(o=a.join(" ")).split(a[0]).length?a[0]:o;a=(i+"").split(" "),o={},s.forEach(function(e,t){return o[e]=a[t]=a[t]||a[(t-1)/2|0]}),e.init(t,o,r)}});var xa={name:"css",register:Gr,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,n,i,r){var a,s,o,l,u,c,h,d,p,f,m,g,v,y,_,b,x,S=this._props,A=e.style,M=n.vars.startAt;for(h in ar||Gr(),this.styles=this.styles||Nr(e),b=this.styles.props,this.tween=n,t)if("autoRound"!==h&&(s=t[h],!Lt[h]||!Si(h,t,n,i,e,r)))if(u=typeof s,c=na[h],"function"===u&&(u=typeof(s=s.call(n,i,e,r))),"string"===u&&~s.indexOf("random(")&&(s=Gn(s)),c)c(this,e,h,s,n)&&(_=1);else if("--"===h.substr(0,2))a=(getComputedStyle(e).getPropertyValue(h)+"").trim(),s+="",ei.lastIndex=0,ei.test(a)||(d=Rn(a),(p=Rn(s))?d!==p&&(a=Yr(e,h,a,p)+p):d&&(s+=d)),this.add(A,"setProperty",a,s,i,r,0,0,h),S.push(h),b.push(h,0,A[h]);else if("undefined"!==u){if(M&&h in M?(a="function"===typeof M[h]?M[h].call(n,i,e,r):M[h],it(a)&&~a.indexOf("random(")&&(a=Gn(a)),Rn(a+"")||"auto"===a||(a+=Je.units[h]||Rn(Qr(e,h))||""),"="===(a+"").charAt(1)&&(a=Qr(e,h))):a=Qr(e,h),l=parseFloat(a),(f="string"===u&&"="===s.charAt(1)&&s.substr(0,2))&&(s=s.substr(2)),o=parseFloat(s),h in vr&&("autoAlpha"===h&&(1===l&&"hidden"===Qr(e,"visibility")&&o&&(l=0),b.push("visibility",0,A.visibility),Jr(this,A,"visibility",l?"inherit":"hidden",o?"inherit":"hidden",!o)),"scale"!==h&&"transform"!==h&&~(h=vr[h]).indexOf(",")&&(h=h.split(",")[0])),m=h in cr){if(this.styles.save(h),x=s,"string"===u&&"var(--"===s.substring(0,6)){if("calc("===(s=kr(e,s.substring(4,s.indexOf(")")))).substring(0,5)){var w=e.style.perspective;e.style.perspective=s,s=kr(e,"perspective"),w?e.style.perspective=w:Xr(e,"perspective")}o=parseFloat(s)}if(g||((v=e._gsap).renderTransform&&!t.parseTransform||ua(e,t.parseTransform),y=!1!==t.smoothOrigin&&v.smooth,(g=this._pt=new Hi(this._pt,A,Br,0,1,v.renderTransform,v,0,-1)).dep=1),"scale"===h)this._pt=new Hi(this._pt,v,"scaleY",v.scaleY,(f?Xt(v.scaleY,f+o):o)-v.scaleY||0,yr),this._pt.u=0,S.push("scaleY",h),h+="X";else{if("transformOrigin"===h){b.push(Ir,0,A[Ir]),s=ea(s),v.svg?la(e,s,0,y,0,this):((p=parseFloat(s.split(" ")[2])||0)!==v.zOrigin&&Jr(this,v,"zOrigin",v.zOrigin,p),Jr(this,A,h,ca(a),ca(s)));continue}if("svgOrigin"===h){la(e,s,1,y,0,this);continue}if(h in ra){ya(this,v,h,l,f?Xt(l,f+s):s);continue}if("smoothOrigin"===h){Jr(this,v,"smooth",v.smooth,s);continue}if("force3D"===h){v[h]=s;continue}if("transform"===h){ba(this,s,e);continue}}}else h in A||(h=zr(h)||h);if(m||(o||0===o)&&(l||0===l)&&!gr.test(s)&&h in A)o||(o=0),(d=(a+"").substr((l+"").length))!==(p=Rn(s)||(h in Je.units?Je.units[h]:d))&&(l=Yr(e,h,a,p)),this._pt=new Hi(this._pt,m?v:A,h,l,(f?Xt(l,f+o):o)-l,m||"px"!==p&&"zIndex"!==h||!1===t.autoRound?yr:Sr),this._pt.u=p||0,m&&x!==s?(this._pt.b=a,this._pt.e=x,this._pt.r=xr):d!==p&&"%"!==p&&(this._pt.b=a,this._pt.r=br);else if(h in A)Zr.call(this,e,h,a,f?f+s:s);else if(h in e)this.add(e,h,a||e[h],f?f+s:s,i,r);else if("parseTransform"!==h){wt(h,s);continue}m||(h in A?b.push(h,0,A[h]):"function"===typeof e[h]?b.push(h,2,e[h]()):b.push(h,1,a||e[h])),S.push(h)}_&&Gi(this)},render:function(e,t){if(t.tween._time||!lr())for(var n=t._pt;n;)n.r(e,n.d),n=n._next;else t.styles.revert()},get:Qr,aliases:vr,getSetter:function(e,t,n){var i=vr[t];return i&&i.indexOf(",")<0&&(t=i),t in cr&&t!==Ir&&(e._gsap.x||Qr(e,"x"))?n&&or===n?"scale"===t?Cr:Tr:(or=n||{})&&("scale"===t?Rr:Pr):e.style&&!st(e.style[t])?wr:~t.indexOf("-")?Er:Di(e,t)},core:{_removeProperty:Xr,_getMatrix:oa}};tr.utils.checkPrefix=zr,tr.core.getStyleSaver=Nr,function(e,t){var n=Vt(e+","+t+",transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective",function(e){cr[e]=1});Vt(t,function(e){Je.units[e]="deg",ra[e]=1}),vr[n[13]]=e+","+t,Vt("0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY",function(e){var t=e.split(":");vr[t[1]]=n[t[0]]})}("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY"),Vt("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(e){Je.units[e]="px"}),tr.registerPlugin(xa);var Sa=tr.registerPlugin(xa)||tr;Sa.core.Tween;function Aa(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=Array(t);n>8&255]+Ou[e>>16&255]+Ou[e>>24&255]+"-"+Ou[255&t]+Ou[t>>8&255]+"-"+Ou[t>>16&15|64]+Ou[t>>24&255]+"-"+Ou[63&n|128]+Ou[n>>8&255]+"-"+Ou[n>>16&255]+Ou[n>>24&255]+Ou[255&i]+Ou[i>>8&255]+Ou[i>>16&255]+Ou[i>>24&255]).toLowerCase()}function Hu(e,t,n){return Math.max(t,Math.min(n,e))}function Vu(e,t){return(e%t+t)%t}function ju(e,t,n){return(1-n)*e+n*t}function Wu(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw new Error("Invalid component type.")}}function Xu(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(4294967295*e);case Uint16Array:return Math.round(65535*e);case Uint8Array:return Math.round(255*e);case Int32Array:return Math.round(2147483647*e);case Int16Array:return Math.round(32767*e);case Int8Array:return Math.round(127*e);default:throw new Error("Invalid component type.")}}const Ju={DEG2RAD:Uu,RAD2DEG:zu,generateUUID:Gu,clamp:Hu,euclideanModulo:Vu,mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},inverseLerp:function(e,t,n){return e!==t?(n-e)/(t-e):0},lerp:ju,damp:function(e,t,n,i){return ju(e,t,1-Math.exp(-n*i))},pingpong:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return t-Math.abs(Vu(e,2*t)-t)},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*(3-2*e)},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t))*e*e*(e*(6*e-15)+10)},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},seededRandom:function(e){void 0!==e&&(ku=e);let t=ku+=1831565813;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296},degToRad:function(e){return e*Uu},radToDeg:function(e){return e*zu},isPowerOfTwo:function(e){return 0===(e&e-1)&&0!==e},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))},setQuaternionFromProperEuler:function(e,t,n,i,r){const a=Math.cos,s=Math.sin,o=a(n/2),l=s(n/2),u=a((t+i)/2),c=s((t+i)/2),h=a((t-i)/2),d=s((t-i)/2),p=a((i-t)/2),f=s((i-t)/2);switch(r){case"XYX":e.set(o*c,l*h,l*d,o*u);break;case"YZY":e.set(l*d,o*c,l*h,o*u);break;case"ZXZ":e.set(l*h,l*d,o*c,o*u);break;case"XZX":e.set(o*c,l*f,l*p,o*u);break;case"YXY":e.set(l*p,o*c,l*f,o*u);break;case"ZYZ":e.set(l*f,l*p,o*c,o*u);break;default:Iu("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:Xu,denormalize:Wu};class Ku{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Hu(this.x,e.x,t.x),this.y=Hu(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Hu(this.x,e,t),this.y=Hu(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Hu(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Hu(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}Ku.prototype.isVector2=!0;class qu{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,r,a,s){let o=n[i+0],l=n[i+1],u=n[i+2],c=n[i+3],h=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(c!==f||o!==h||l!==d||u!==p){let e=o*h+l*d+u*p+c*f;e<0&&(h=-h,d=-d,p=-p,f=-f,e=-e);let t=1-s;if(e<.9995){const n=Math.acos(e),i=Math.sin(n);t=Math.sin(t*n)/i,o=o*t+h*(s=Math.sin(s*n)/i),l=l*t+d*s,u=u*t+p*s,c=c*t+f*s}else{o=o*t+h*s,l=l*t+d*s,u=u*t+p*s,c=c*t+f*s;const e=1/Math.sqrt(o*o+l*l+u*u+c*c);o*=e,l*=e,u*=e,c*=e}}e[t]=o,e[t+1]=l,e[t+2]=u,e[t+3]=c}static multiplyQuaternionsFlat(e,t,n,i,r,a){const s=n[i],o=n[i+1],l=n[i+2],u=n[i+3],c=r[a],h=r[a+1],d=r[a+2],p=r[a+3];return e[t]=s*p+u*c+o*d-l*h,e[t+1]=o*p+u*h+l*c-s*d,e[t+2]=l*p+u*d+s*h-o*c,e[t+3]=u*p-s*c-o*h-l*d,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=e._x,i=e._y,r=e._z,a=e._order,s=Math.cos,o=Math.sin,l=s(n/2),u=s(i/2),c=s(r/2),h=o(n/2),d=o(i/2),p=o(r/2);switch(a){case"XYZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"YXZ":this._x=h*u*c+l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"ZXY":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c-h*d*p;break;case"ZYX":this._x=h*u*c-l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c+h*d*p;break;case"YZX":this._x=h*u*c+l*d*p,this._y=l*d*c+h*u*p,this._z=l*u*p-h*d*c,this._w=l*u*c-h*d*p;break;case"XZY":this._x=h*u*c-l*d*p,this._y=l*d*c-h*u*p,this._z=l*u*p+h*d*c,this._w=l*u*c+h*d*p;break;default:Iu("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return!0===t&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],s=t[5],o=t[9],l=t[2],u=t[6],c=t[10],h=n+s+c;if(h>0){const e=.5/Math.sqrt(h+1);this._w=.25/e,this._x=(u-o)*e,this._y=(r-l)*e,this._z=(a-i)*e}else if(n>s&&n>c){const e=2*Math.sqrt(1+n-s-c);this._w=(u-o)/e,this._x=.25*e,this._y=(i+a)/e,this._z=(r+l)/e}else if(s>c){const e=2*Math.sqrt(1+s-n-c);this._w=(r-l)/e,this._x=(i+a)/e,this._y=.25*e,this._z=(o+u)/e}else{const e=2*Math.sqrt(1+c-n-s);this._w=(a-i)/e,this._x=(r+l)/e,this._y=(o+u)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Hu(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(0===n)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return 0===e?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,r=e._z,a=e._w,s=t._x,o=t._y,l=t._z,u=t._w;return this._x=n*u+a*s+i*l-r*o,this._y=i*u+a*o+r*s-n*l,this._z=r*u+a*l+n*o-i*s,this._w=a*u-n*s-i*o-r*l,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,r=e._z,a=e._w,s=this.dot(e);s<0&&(n=-n,i=-i,r=-r,a=-a,s=-s);let o=1-t;if(s<.9995){const e=Math.acos(s),l=Math.sin(e);o=Math.sin(o*e)/l,t=Math.sin(t*e)/l,this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this._onChangeCallback()}else this._x=this._x*o+n*t,this._y=this._y*o+i*t,this._z=this._z*o+r*t,this._w=this._w*o+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),r=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),r*Math.sin(t),r*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Yu{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.x=e,this.y=t,this.z=n}set(e,t,n){return void 0===n&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Zu.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Zu.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,s=e.z,o=e.w,l=2*(a*i-s*n),u=2*(s*t-r*i),c=2*(r*n-a*t);return this.x=t+o*l+a*c-s*u,this.y=n+o*u+s*l-r*c,this.z=i+o*c+r*u-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Hu(this.x,e.x,t.x),this.y=Hu(this.y,e.y,t.y),this.z=Hu(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Hu(this.x,e,t),this.y=Hu(this.y,e,t),this.z=Hu(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(Hu(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,r=e.z,a=t.x,s=t.y,o=t.z;return this.x=i*o-r*s,this.y=r*a-n*o,this.z=n*s-i*a,this}projectOnVector(e){const t=e.lengthSq();if(0===t)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Qu.copy(this).projectOnVector(e),this.sub(Qu)}reflect(e){return this.sub(Qu.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(0===t)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(Hu(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,4*t)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,3*t)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=2*Math.random()-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}Yu.prototype.isVector3=!0;const Qu=new Yu,Zu=new qu;class $u{constructor(e,t,n,i,r,a,s,o,l){this.elements=[1,0,0,0,1,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l)}set(e,t,n,i,r,a,s,o,l){const u=this.elements;return u[0]=e,u[1]=i,u[2]=s,u[3]=t,u[4]=r,u[5]=o,u[6]=n,u[7]=a,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[3],o=n[6],l=n[1],u=n[4],c=n[7],h=n[2],d=n[5],p=n[8],f=i[0],m=i[3],g=i[6],v=i[1],y=i[4],_=i[7],b=i[2],x=i[5],S=i[8];return r[0]=a*f+s*v+o*b,r[3]=a*m+s*y+o*x,r[6]=a*g+s*_+o*S,r[1]=l*f+u*v+c*b,r[4]=l*m+u*y+c*x,r[7]=l*g+u*_+c*S,r[2]=h*f+d*v+p*b,r[5]=h*m+d*y+p*x,r[8]=h*g+d*_+p*S,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8];return t*a*u-t*s*l-n*r*u+n*s*o+i*r*l-i*a*o}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=u*a-s*l,h=s*o-u*r,d=l*r-a*o,p=t*c+n*h+i*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const f=1/p;return e[0]=c*f,e[1]=(i*l-u*n)*f,e[2]=(s*n-i*a)*f,e[3]=h*f,e[4]=(u*t-i*o)*f,e[5]=(i*r-s*t)*f,e[6]=d*f,e[7]=(n*o-l*t)*f,e[8]=(a*t-n*r)*f,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,r,a,s){const o=Math.cos(r),l=Math.sin(r);return this.set(n*o,n*l,-n*(o*a+l*s)+a+e,-i*l,i*o,-i*(-l*a+o*s)+s+t,0,0,1),this}scale(e,t){return this.premultiply(ec.makeScale(e,t)),this}rotate(e){return this.premultiply(ec.makeRotation(-e)),this}translate(e,t){return this.premultiply(ec.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return(new this.constructor).fromArray(this.elements)}}$u.prototype.isMatrix3=!0;const ec=new $u,tc=(new $u).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),nc=(new $u).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ic(){const e={enabled:!0,workingColorSpace:Cl,spaces:{},convert:function(e,t,n){return!1!==this.enabled&&t!==n&&t&&n?(this.spaces[t].transfer===Pl&&(e.r=ac(e.r),e.g=ac(e.g),e.b=ac(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Pl&&(e.r=sc(e.r),e.g=sc(e.g),e.b=sc(e.b)),e):e},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===El?Rl:this.spaces[e].transfer},getToneMappingMode:function(e){return this.spaces[e].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.workingColorSpace;return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.workingColorSpace;return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return Fu("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return Fu("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],i=[.3127,.329];return e.define({[Cl]:{primaries:t,whitePoint:i,transfer:Rl,toXYZ:tc,fromXYZ:nc,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Tl},outputColorSpaceConfig:{drawingBufferColorSpace:Tl}},[Tl]:{primaries:t,whitePoint:i,transfer:Pl,toXYZ:tc,fromXYZ:nc,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Tl}}}),e}const rc=ic();function ac(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function sc(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}let oc;class lc{static getDataURL(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"image/png";if(/^data:/i.test(e.src))return e.src;if("undefined"===typeof HTMLCanvasElement)return e.src;if(e instanceof HTMLCanvasElement)t=e;else{void 0===oc&&(oc=Mu("canvas")),oc.width=e.width,oc.height=e.height;const n=oc.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=oc}return t.toDataURL(n)}static sRGBToLinear(e){if("undefined"!==typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&e instanceof ImageBitmap){const t=Mu("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),r=i.data;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:null;this.isSource=!0,Object.defineProperty(this,"id",{value:uc++}),this.uuid=Gu(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return"undefined"!==typeof HTMLVideoElement&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):"undefined"!==typeof VideoFrame&&t instanceof VideoFrame?e.set(t.displayWidth,t.displayHeight,0):null!==t?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){!0===e&&this.version++}toJSON(e){const t=void 0===e||"string"===typeof e;if(!t&&void 0!==e.images[this.uuid])return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(null!==i){let e;if(Array.isArray(i)){e=[];for(let t=0,n=i.length;t0&&void 0!==arguments[0]?arguments[0]:fc.DEFAULT_IMAGE,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fc.DEFAULT_MAPPING,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:zs,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:zs,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Js,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Ys,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:fo,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:Zs,l=arguments.length>8&&void 0!==arguments[8]?arguments[8]:fc.DEFAULT_ANISOTROPY,u=arguments.length>9&&void 0!==arguments[9]?arguments[9]:El;super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:dc++}),this.uuid=Gu(),this.name="",this.source=new cc(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=r,this.minFilter=a,this.anisotropy=l,this.format=s,this.internalFormat=null,this.type=o,this.offset=new Ku(0,0),this.repeat=new Ku(1,1),this.center=new Ku(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new $u,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0,this.normalized=!1}get width(){return this.source.getSize(pc).x}get height(){return this.source.getSize(pc).y}get depth(){return this.source.getSize(pc).z}get image(){return this.source.data}set image(e){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.normalized=e.normalized,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(void 0===n){Iu("Texture.setValues(): parameter '".concat(t,"' has value of undefined."));continue}const i=this[t];void 0!==i?i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n:Iu("Texture.setValues(): property '".concat(t,"' does not exist."))}}toJSON(e){const t=void 0===e||"string"===typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,normalized:this.normalized,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==Ds)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Us:e.x=e.x-Math.floor(e.x);break;case zs:e.x=e.x<0?0:1;break;case Gs:1===Math.abs(Math.floor(e.x)%2)?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x)}if(e.y<0||e.y>1)switch(this.wrapT){case Us:e.y=e.y-Math.floor(e.y);break;case zs:e.y=e.y<0?0:1;break;case Gs:1===Math.abs(Math.floor(e.y)%2)?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y)}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){!0===e&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){!0===e&&this.pmremVersion++}}fc.DEFAULT_IMAGE=null,fc.DEFAULT_MAPPING=Ds,fc.DEFAULT_ANISOTROPY=1;class mc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=void 0!==e.w?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,r;const a=.01,s=.1,o=e.elements,l=o[0],u=o[4],c=o[8],h=o[1],d=o[5],p=o[9],f=o[2],m=o[6],g=o[10];if(Math.abs(u-h)o&&e>v?ev?o1&&void 0!==arguments[1]?arguments[1]:0;return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}mc.prototype.isVector4=!0;class gc extends Nu{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Js,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new mc(0,0,e,t),this.scissorTest=!1,this.viewport=new mc(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},r=new fc(i),a=n.count;for(let s=0;s0&&void 0!==arguments[0]?arguments[0]:{};const t={minFilter:Js,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==e.mapping&&(t.mapping=e.mapping),void 0!==e.wrapS&&(t.wrapS=e.wrapS),void 0!==e.wrapT&&(t.wrapT=e.wrapT),void 0!==e.wrapR&&(t.wrapR=e.wrapR),void 0!==e.magFilter&&(t.magFilter=e.magFilter),void 0!==e.minFilter&&(t.minFilter=e.minFilter),void 0!==e.format&&(t.format=e.format),void 0!==e.type&&(t.type=e.type),void 0!==e.anisotropy&&(t.anisotropy=e.anisotropy),void 0!==e.colorSpace&&(t.colorSpace=e.colorSpace),void 0!==e.flipY&&(t.flipY=e.flipY),void 0!==e.generateMipmaps&&(t.generateMipmaps=e.generateMipmaps),void 0!==e.internalFormat&&(t.internalFormat=e.internalFormat);for(let n=0;n2&&void 0!==arguments[2]?arguments[2]:1;if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,r=this.textures.length;i1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return(new this.constructor).copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t0&&void 0!==arguments[0]?arguments[0]:1,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),this.isWebGLRenderTarget=!0}}class yc extends fc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Hs,this.minFilter=Hs,this.wrapR=zs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class _c extends vc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(e,t,i),this.isWebGLArrayRenderTarget=!0,this.depth=n,this.texture=new yc(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class bc extends fc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=Hs,this.minFilter=Hs,this.wrapR=zs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class xc extends vc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(e,t,i),this.isWebGL3DRenderTarget=!0,this.depth=n,this.texture=new bc(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Sc{constructor(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==e&&this.set(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m)}set(e,t,n,i,r,a,s,o,l,u,c,h,d,p,f,m){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=r,g[5]=a,g[9]=s,g[13]=o,g[2]=l,g[6]=u,g[10]=c,g[14]=h,g[3]=d,g[7]=p,g[11]=f,g[15]=m,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Sc).fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return 0===this.determinant()?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(0===e.determinant())return this.identity();const t=this.elements,n=e.elements,i=1/Ac.setFromMatrixColumn(e,0).length(),r=1/Ac.setFromMatrixColumn(e,1).length(),a=1/Ac.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*r,t[5]=n[5]*r,t[6]=n[6]*r,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),s=Math.sin(n),o=Math.cos(i),l=Math.sin(i),u=Math.cos(r),c=Math.sin(r);if("XYZ"===e.order){const e=a*u,n=a*c,i=s*u,r=s*c;t[0]=o*u,t[4]=-o*c,t[8]=l,t[1]=n+i*l,t[5]=e-r*l,t[9]=-s*o,t[2]=r-e*l,t[6]=i+n*l,t[10]=a*o}else if("YXZ"===e.order){const e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e+r*s,t[4]=i*s-n,t[8]=a*l,t[1]=a*c,t[5]=a*u,t[9]=-s,t[2]=n*s-i,t[6]=r+e*s,t[10]=a*o}else if("ZXY"===e.order){const e=o*u,n=o*c,i=l*u,r=l*c;t[0]=e-r*s,t[4]=-a*c,t[8]=i+n*s,t[1]=n+i*s,t[5]=a*u,t[9]=r-e*s,t[2]=-a*l,t[6]=s,t[10]=a*o}else if("ZYX"===e.order){const e=a*u,n=a*c,i=s*u,r=s*c;t[0]=o*u,t[4]=i*l-n,t[8]=e*l+r,t[1]=o*c,t[5]=r*l+e,t[9]=n*l-i,t[2]=-l,t[6]=s*o,t[10]=a*o}else if("YZX"===e.order){const e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*u,t[4]=r-e*c,t[8]=i*c+n,t[1]=c,t[5]=a*u,t[9]=-s*u,t[2]=-l*u,t[6]=n*c+i,t[10]=e-r*c}else if("XZY"===e.order){const e=a*o,n=a*l,i=s*o,r=s*l;t[0]=o*u,t[4]=-c,t[8]=l*u,t[1]=e*c+r,t[5]=a*u,t[9]=n*c-i,t[2]=i*c-n,t[6]=s*u,t[10]=r*c+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(wc,e,Ec)}lookAt(e,t,n){const i=this.elements;return Rc.subVectors(e,t),0===Rc.lengthSq()&&(Rc.z=1),Rc.normalize(),Tc.crossVectors(n,Rc),0===Tc.lengthSq()&&(1===Math.abs(n.z)?Rc.x+=1e-4:Rc.z+=1e-4,Rc.normalize(),Tc.crossVectors(n,Rc)),Tc.normalize(),Cc.crossVectors(Rc,Tc),i[0]=Tc.x,i[4]=Cc.x,i[8]=Rc.x,i[1]=Tc.y,i[5]=Cc.y,i[9]=Rc.y,i[2]=Tc.z,i[6]=Cc.z,i[10]=Rc.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,r=this.elements,a=n[0],s=n[4],o=n[8],l=n[12],u=n[1],c=n[5],h=n[9],d=n[13],p=n[2],f=n[6],m=n[10],g=n[14],v=n[3],y=n[7],_=n[11],b=n[15],x=i[0],S=i[4],A=i[8],M=i[12],w=i[1],E=i[5],T=i[9],C=i[13],R=i[2],P=i[6],B=i[10],I=i[14],D=i[3],F=i[7],L=i[11],N=i[15];return r[0]=a*x+s*w+o*R+l*D,r[4]=a*S+s*E+o*P+l*F,r[8]=a*A+s*T+o*B+l*L,r[12]=a*M+s*C+o*I+l*N,r[1]=u*x+c*w+h*R+d*D,r[5]=u*S+c*E+h*P+d*F,r[9]=u*A+c*T+h*B+d*L,r[13]=u*M+c*C+h*I+d*N,r[2]=p*x+f*w+m*R+g*D,r[6]=p*S+f*E+m*P+g*F,r[10]=p*A+f*T+m*B+g*L,r[14]=p*M+f*C+m*I+g*N,r[3]=v*x+y*w+_*R+b*D,r[7]=v*S+y*E+_*P+b*F,r[11]=v*A+y*T+_*B+b*L,r[15]=v*M+y*C+_*I+b*N,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],s=e[5],o=e[9],l=e[13],u=e[2],c=e[6],h=e[10],d=e[14],p=e[3],f=e[7],m=e[11],g=e[15],v=o*d-l*h,y=s*d-l*c,_=s*h-o*c,b=a*d-l*u,x=a*h-o*u,S=a*c-s*u;return t*(f*v-m*y+g*_)-n*(p*v-m*b+g*x)+i*(p*y-f*b+g*S)-r*(p*_-f*x+m*S)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],s=e[5],o=e[6],l=e[7],u=e[8],c=e[9],h=e[10],d=e[11],p=e[12],f=e[13],m=e[14],g=e[15],v=t*s-n*a,y=t*o-i*a,_=t*l-r*a,b=n*o-i*s,x=n*l-r*s,S=i*l-r*o,A=u*f-c*p,M=u*m-h*p,w=u*g-d*p,E=c*m-h*f,T=c*g-d*f,C=h*g-d*m,R=v*C-y*T+_*E+b*w-x*M+S*A;if(0===R)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const P=1/R;return e[0]=(s*C-o*T+l*E)*P,e[1]=(i*T-n*C-r*E)*P,e[2]=(f*S-m*x+g*b)*P,e[3]=(h*x-c*S-d*b)*P,e[4]=(o*w-a*C-l*M)*P,e[5]=(t*C-i*w+r*M)*P,e[6]=(m*_-p*S-g*y)*P,e[7]=(u*S-h*_+d*y)*P,e[8]=(a*T-s*w+l*A)*P,e[9]=(n*w-t*T-r*A)*P,e[10]=(p*x-f*_+g*v)*P,e[11]=(c*_-u*x-d*v)*P,e[12]=(s*M-a*E-o*A)*P,e[13]=(t*E-n*M+i*A)*P,e[14]=(f*y-p*b-m*v)*P,e[15]=(u*b-c*y+h*v)*P,this}scale(e){const t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,s=e.y,o=e.z,l=r*a,u=r*s;return this.set(l*a+n,l*s-i*o,l*o+i*s,0,l*s+i*o,u*s+n,u*o-i*a,0,l*o-i*s,u*o+i*a,r*o*o+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,r,a){return this.set(1,n,r,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,r=t._x,a=t._y,s=t._z,o=t._w,l=r+r,u=a+a,c=s+s,h=r*l,d=r*u,p=r*c,f=a*u,m=a*c,g=s*c,v=o*l,y=o*u,_=o*c,b=n.x,x=n.y,S=n.z;return i[0]=(1-(f+g))*b,i[1]=(d+_)*b,i[2]=(p-y)*b,i[3]=0,i[4]=(d-_)*x,i[5]=(1-(h+g))*x,i[6]=(m+v)*x,i[7]=0,i[8]=(p+y)*S,i[9]=(m-v)*S,i[10]=(1-(h+f))*S,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const r=this.determinant();if(0===r)return n.set(1,1,1),t.identity(),this;let a=Ac.set(i[0],i[1],i[2]).length();const s=Ac.set(i[4],i[5],i[6]).length(),o=Ac.set(i[8],i[9],i[10]).length();r<0&&(a=-a),Mc.copy(this);const l=1/a,u=1/s,c=1/o;return Mc.elements[0]*=l,Mc.elements[1]*=l,Mc.elements[2]*=l,Mc.elements[4]*=u,Mc.elements[5]*=u,Mc.elements[6]*=u,Mc.elements[8]*=c,Mc.elements[9]*=c,Mc.elements[10]*=c,t.setFromRotationMatrix(Mc),n.x=a,n.y=s,n.z=o,this}makePerspective(e,t,n,i,r,a){let s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:mu,o=arguments.length>7&&void 0!==arguments[7]&&arguments[7];const l=this.elements,u=2*r/(t-e),c=2*r/(n-i),h=(t+e)/(t-e),d=(n+i)/(n-i);let p,f;if(o)p=r/(a-r),f=a*r/(a-r);else if(s===mu)p=-(a+r)/(a-r),f=-2*a*r/(a-r);else{if(s!==gu)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+s);p=-a/(a-r),f=-a*r/(a-r)}return l[0]=u,l[4]=0,l[8]=h,l[12]=0,l[1]=0,l[5]=c,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=f,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,r,a){let s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:mu,o=arguments.length>7&&void 0!==arguments[7]&&arguments[7];const l=this.elements,u=2/(t-e),c=2/(n-i),h=-(t+e)/(t-e),d=-(n+i)/(n-i);let p,f;if(o)p=1/(a-r),f=a/(a-r);else if(s===mu)p=-2/(a-r),f=-(a+r)/(a-r);else{if(s!==gu)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+s);p=-1/(a-r),f=-r/(a-r)}return l[0]=u,l[4]=0,l[8]=0,l[12]=h,l[1]=0,l[5]=c,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=p,l[14]=f,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}Sc.prototype.isMatrix4=!0;const Ac=new Yu,Mc=new Sc,wc=new Yu(0,0,0),Ec=new Yu(1,1,1),Tc=new Yu,Cc=new Yu,Rc=new Yu,Pc=new Sc,Bc=new qu;class Ic{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ic.DEFAULT_ORDER;this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:this._order;return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const i=e.elements,r=i[0],a=i[4],s=i[8],o=i[1],l=i[5],u=i[9],c=i[2],h=i[6],d=i[10];switch(t){case"XYZ":this._y=Math.asin(Hu(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-u,d),this._z=Math.atan2(-a,r)):(this._x=Math.atan2(h,l),this._z=0);break;case"YXZ":this._x=Math.asin(-Hu(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(s,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-c,r),this._z=0);break;case"ZXY":this._x=Math.asin(Hu(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(-c,d),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-Hu(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(h,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(Hu(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-c,r)):(this._x=0,this._y=Math.atan2(s,d));break;case"XZY":this._z=Math.asin(-Hu(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(h,l),this._y=Math.atan2(s,r)):(this._x=Math.atan2(-u,d),this._y=0);break;default:Iu("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,!0===n&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Pc.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Pc,t,n)}setFromVector3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._order;return this.set(e.x,e.y,e.z,t)}reorder(e){return Bc.setFromEuler(this),this.setFromQuaternion(Bc,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],void 0!==e[3]&&(this._order=e[3]),this._onChangeCallback(),this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Ic.DEFAULT_ORDER="XYZ";class Dc{constructor(){this.mask=1}set(e){this.mask=1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e2&&void 0!==arguments[2]?arguments[2]:[];this[e]===t&&n.push(this);const i=this.children;for(let r=0,a=i.length;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),null!==this.pivot&&(i.pivot=this.pivot.toArray()),!1===this.matrixAutoUpdate&&(i.matrixAutoUpdate=!1),void 0!==this.morphTargetDictionary&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(e=>h(h({},e),{},{boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(e=>h({},e)),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),null!==this._colorsTexture&&(i.colorsTexture=this._colorsTexture.toJSON(e)),null!==this.boundingSphere&&(i.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(i.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);const t=this.geometry.parameters;if(void 0!==t&&void 0!==t.shapes){const n=t.shapes;if(Array.isArray(n))for(let t=0,i=n.length;t0){i.children=[];for(let t=0;t0){i.animations=[];for(let t=0;t0&&(n.geometries=t),i.length>0&&(n.materials=i),r.length>0&&(n.textures=r),s.length>0&&(n.images=s),o.length>0&&(n.shapes=o),l.length>0&&(n.skeletons=l),u.length>0&&(n.animations=u),c.length>0&&(n.nodes=c)}return n.object=i,n;function a(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}}clone(e){return(new this.constructor).copy(this,e)}copy(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.pivot=null!==e.pivot?e.pivot.clone():null,this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(let n=0;no+u?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&s<=o-u&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else null!==o&&e.gripSpace&&(r=t.getPose(e.gripSpace,n),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,o.eventsEnabled&&o.dispatchEvent({type:"gripUpdated",data:e,target:this})));null!==s&&(i=t.getPose(e.targetRaySpace,n),null===i&&null!==r&&(i=r),null!==i&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1,this.dispatchEvent(Qc)))}return null!==s&&(s.visible=null!==i),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==a),this}_getHandJoint(e,t){if(void 0===e.joints[t.jointName]){const n=new Yc;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const $c={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},eh={h:0,s:0,l:0},th={h:0,s:0,l:0};function nh(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}class ih{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(void 0===t&&void 0===n){const t=e;t&&t.isColor?this.copy(t):"number"===typeof t?this.setHex(t):"string"===typeof t&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tl;return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,rc.colorSpaceToWorking(this,t),this}setRGB(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:rc.workingColorSpace;return this.r=e,this.g=t,this.b=n,rc.colorSpaceToWorking(this,i),this}setHSL(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:rc.workingColorSpace;if(e=Vu(e,1),t=Hu(t,0,1),n=Hu(n,0,1),0===t)this.r=this.g=this.b=n;else{const i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=nh(r,i,e+1/3),this.g=nh(r,i,e),this.b=nh(r,i,e-1/3)}return rc.colorSpaceToWorking(this,i),this}setStyle(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tl;function i(t){void 0!==t&&parseFloat(t)<1&&Iu("Color: Alpha component of "+e+" will be ignored.")}if(t=/^(\w+)\(([^\)]*)\)/.exec(e)){let r;const a=t[1],s=t[2];switch(a){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,n);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,n);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(s))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,n);break;default:Iu("Color: Unknown color model "+e)}}else if(t=/^\#([A-Fa-f\d]+)$/.exec(e)){const i=t[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,n);if(6===r)return this.setHex(parseInt(i,16),n);Iu("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,n);return this}setColorName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Tl;const n=$c[e.toLowerCase()];return void 0!==n?this.setHex(n,t):Iu("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=ac(e.r),this.g=ac(e.g),this.b=ac(e.b),this}copyLinearToSRGB(e){return this.r=sc(e.r),this.g=sc(e.g),this.b=sc(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Tl;return rc.workingToColorSpace(rh.copy(this),e),65536*Math.round(Hu(255*rh.r,0,255))+256*Math.round(Hu(255*rh.g,0,255))+Math.round(Hu(255*rh.b,0,255))}getHexString(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Tl;return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:rc.workingColorSpace;rc.workingToColorSpace(rh.copy(this),t);const n=rh.r,i=rh.g,r=rh.b,a=Math.max(n,i,r),s=Math.min(n,i,r);let o,l;const u=(s+a)/2;if(s===a)o=0,l=0;else{const e=a-s;switch(l=u<=.5?e/(a+s):e/(2-a-s),a){case n:o=(i-r)/e+(i1&&void 0!==arguments[1]?arguments[1]:rc.workingColorSpace;return rc.workingToColorSpace(rh.copy(this),t),e.r=rh.r,e.g=rh.g,e.b=rh.b,e}getStyle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Tl;rc.workingToColorSpace(rh.copy(this),e);const t=rh.r,n=rh.g,i=rh.b;return e!==Tl?"color(".concat(e," ").concat(t.toFixed(3)," ").concat(n.toFixed(3)," ").concat(i.toFixed(3),")"):"rgb(".concat(Math.round(255*t),",").concat(Math.round(255*n),",").concat(Math.round(255*i),")")}offsetHSL(e,t,n){return this.getHSL(eh),this.setHSL(eh.h+e,eh.s+t,eh.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(eh),e.getHSL(th);const n=ju(eh.h,th.h,t),i=ju(eh.s,th.s,t),r=ju(eh.l,th.l,t);return this.setHSL(n,i,r),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,r=e.elements;return this.r=r[0]*t+r[3]*n+r[6]*i,this.g=r[1]*t+r[4]*n+r[7]*i,this.b=r[2]*t+r[5]*n+r[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const rh=new ih;ih.NAMES=$c;class ah{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:25e-5;this.isFogExp2=!0,this.name="",this.color=new ih(e),this.density=t}clone(){return new ah(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class sh{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3;this.isFog=!0,this.name="",this.color=new ih(e),this.near=t,this.far=n}clone(){return new sh(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class oh extends qc{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Ic,this.environmentIntensity=1,this.environmentRotation=new Ic,this.overrideMaterial=null,"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),null!==e.background&&(this.background=e.background.clone()),null!==e.environment&&(this.environment=e.environment.clone()),null!==e.fog&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),null!==e.overrideMaterial&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return null!==this.fog&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const lh=new Yu,uh=new Yu,ch=new Yu,hh=new Yu,dh=new Yu,ph=new Yu,fh=new Yu,mh=new Yu,gh=new Yu,vh=new Yu,yh=new mc,_h=new mc,bh=new mc;class xh{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yu,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Yu;this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),lh.subVectors(e,t),i.cross(lh);const r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)}static getBarycoord(e,t,n,i,r){lh.subVectors(i,t),uh.subVectors(n,t),ch.subVectors(e,t);const a=lh.dot(lh),s=lh.dot(uh),o=lh.dot(ch),l=uh.dot(uh),u=uh.dot(ch),c=a*l-s*s;if(0===c)return r.set(0,0,0),null;const h=1/c,d=(l*o-s*u)*h,p=(a*u-s*o)*h;return r.set(1-d-p,p,d)}static containsPoint(e,t,n,i){return null!==this.getBarycoord(e,t,n,i,hh)&&(hh.x>=0&&hh.y>=0&&hh.x+hh.y<=1)}static getInterpolation(e,t,n,i,r,a,s,o){return null===this.getBarycoord(e,t,n,i,hh)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,hh.x),o.addScaledVector(a,hh.y),o.addScaledVector(s,hh.z),o)}static getInterpolatedAttribute(e,t,n,i,r,a){return yh.setScalar(0),_h.setScalar(0),bh.setScalar(0),yh.fromBufferAttribute(e,t),_h.fromBufferAttribute(e,n),bh.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(yh,r.x),a.addScaledVector(_h,r.y),a.addScaledVector(bh,r.z),a}static isFrontFacing(e,t,n,i){return lh.subVectors(n,t),uh.subVectors(e,t),lh.cross(uh).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return(new this.constructor).copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return lh.subVectors(this.c,this.b),uh.subVectors(this.a,this.b),.5*lh.cross(uh).length()}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return xh.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return xh.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,r){return xh.getInterpolation(e,this.a,this.b,this.c,t,n,i,r)}containsPoint(e){return xh.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return xh.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,r=this.c;let a,s;dh.subVectors(i,n),ph.subVectors(r,n),mh.subVectors(e,n);const o=dh.dot(mh),l=ph.dot(mh);if(o<=0&&l<=0)return t.copy(n);gh.subVectors(e,i);const u=dh.dot(gh),c=ph.dot(gh);if(u>=0&&c<=u)return t.copy(i);const h=o*c-u*l;if(h<=0&&o>=0&&u<=0)return a=o/(o-u),t.copy(n).addScaledVector(dh,a);vh.subVectors(e,r);const d=dh.dot(vh),p=ph.dot(vh);if(p>=0&&d<=p)return t.copy(r);const f=d*l-o*p;if(f<=0&&l>=0&&p<=0)return s=l/(l-p),t.copy(n).addScaledVector(ph,s);const m=u*p-d*c;if(m<=0&&c-u>=0&&d-p>=0)return fh.subVectors(r,i),s=(c-u)/(c-u+(d-p)),t.copy(i).addScaledVector(fh,s);const g=1/(m+f+h);return a=f*g,s=h*g,t.copy(n).addScaledVector(dh,a).addScaledVector(ph,s)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class Sh{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yu(1/0,1/0,1/0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu(-1/0,-1/0,-1/0);this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t1&&void 0!==arguments[1]&&arguments[1];return this.makeEmpty(),this.expandByObject(e,t)}clone(){return(new this.constructor).copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x1&&void 0!==arguments[1]&&arguments[1];e.updateWorldMatrix(!1,!1);const n=e.geometry;if(void 0!==n){const i=n.getAttribute("position");if(!0===t&&void 0!==i&&!0!==e.isInstancedMesh)for(let t=0,n=i.count;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Mh),Mh.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Ih),Dh.subVectors(this.max,Ih),Eh.subVectors(e.a,Ih),Th.subVectors(e.b,Ih),Ch.subVectors(e.c,Ih),Rh.subVectors(Th,Eh),Ph.subVectors(Ch,Th),Bh.subVectors(Eh,Ch);let t=[0,-Rh.z,Rh.y,0,-Ph.z,Ph.y,0,-Bh.z,Bh.y,Rh.z,0,-Rh.x,Ph.z,0,-Ph.x,Bh.z,0,-Bh.x,-Rh.y,Rh.x,0,-Ph.y,Ph.x,0,-Bh.y,Bh.x,0];return!!Nh(t,Eh,Th,Ch,Dh)&&(t=[1,0,0,0,1,0,0,0,1],!!Nh(t,Eh,Th,Ch,Dh)&&(Fh.crossVectors(Rh,Ph),t=[Fh.x,Fh.y,Fh.z],Nh(t,Eh,Th,Ch,Dh)))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Mh).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=.5*this.getSize(Mh).length()),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()||(Ah[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ah[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ah[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ah[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ah[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ah[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ah[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ah[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ah)),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Ah=[new Yu,new Yu,new Yu,new Yu,new Yu,new Yu,new Yu,new Yu],Mh=new Yu,wh=new Sh,Eh=new Yu,Th=new Yu,Ch=new Yu,Rh=new Yu,Ph=new Yu,Bh=new Yu,Ih=new Yu,Dh=new Yu,Fh=new Yu,Lh=new Yu;function Nh(e,t,n,i,r){for(let a=0,s=e.length-3;a<=s;a+=3){Lh.fromArray(e,a);const s=r.x*Math.abs(Lh.x)+r.y*Math.abs(Lh.y)+r.z*Math.abs(Lh.z),o=t.dot(Lh),l=n.dot(Lh),u=i.dot(Lh);if(Math.max(-Math.max(o,l,u),Math.min(o,l,u))>s)return!1}return!0}const Oh=kh();function kh(){const e=new ArrayBuffer(4),t=new Float32Array(e),n=new Uint32Array(e),i=new Uint32Array(512),r=new Uint32Array(512);for(let l=0;l<256;++l){const e=l-127;e<-27?(i[l]=0,i[256|l]=32768,r[l]=24,r[256|l]=24):e<-14?(i[l]=1024>>-e-14,i[256|l]=1024>>-e-14|32768,r[l]=-e-1,r[256|l]=-e-1):e<=15?(i[l]=e+15<<10,i[256|l]=e+15<<10|32768,r[l]=13,r[256|l]=13):e<128?(i[l]=31744,i[256|l]=64512,r[l]=24,r[256|l]=24):(i[l]=31744,i[256|l]=64512,r[l]=13,r[256|l]=13)}const a=new Uint32Array(2048),s=new Uint32Array(64),o=new Uint32Array(64);for(let l=1;l<1024;++l){let e=l<<13,t=0;for(;0===(8388608&e);)e<<=1,t-=8388608;e&=-8388609,t+=947912704,a[l]=e|t}for(let l=1024;l<2048;++l)a[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)s[l]=l<<23;s[31]=1199570944,s[32]=2147483648;for(let l=33;l<63;++l)s[l]=2147483648+(l-32<<23);s[63]=3347054592;for(let l=1;l<64;++l)32!==l&&(o[l]=1024);return{floatView:t,uint32View:n,baseTable:i,shiftTable:r,mantissaTable:a,exponentTable:s,offsetTable:o}}function Uh(e){Math.abs(e)>65504&&Iu("DataUtils.toHalfFloat(): Value out of range."),e=Hu(e,-65504,65504),Oh.floatView[0]=e;const t=Oh.uint32View[0],n=t>>23&511;return Oh.baseTable[n]+((8388607&t)>>Oh.shiftTable[n])}function zh(e){const t=e>>10;return Oh.uint32View[0]=Oh.mantissaTable[Oh.offsetTable[t]+(1023&e)]+Oh.exponentTable[t],Oh.floatView[0]}class Gh{static toHalfFloat(e){return Uh(e)}static fromHalfFloat(e){return zh(e)}}const Hh=new Yu,Vh=new Ku;let jh=0;class Wh extends Nu{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(super(),Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:jh++}),this.name="",this.array=e,this.itemSize=t,this.count=void 0!==e?e.length/t:0,this.normalized=n,this.usage=ru,this.updateRanges=[],this.gpuType=ro,this.version=0}onUploadCallback(){}set needsUpdate(e){!0===e&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,r=this.itemSize;i1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=Wu(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=Xu(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Wu(t,this.array)),t}setX(e,t){return this.normalized&&(t=Xu(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Wu(t,this.array)),t}setY(e,t){return this.normalized&&(t=Xu(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Wu(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Xu(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Wu(t,this.array)),t}setW(e,t){return this.normalized&&(t=Xu(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Xu(t,this.array),n=Xu(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Xu(t,this.array),n=Xu(n,this.array),i=Xu(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Xu(t,this.array),n=Xu(n,this.array),i=Xu(i,this.array),r=Xu(r,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(e.name=this.name),this.usage!==ru&&(e.usage=this.usage),e}dispose(){this.dispatchEvent({type:"dispose"})}}class Xh extends Wh{constructor(e,t,n){super(new Int8Array(e),t,n)}}class Jh extends Wh{constructor(e,t,n){super(new Uint8Array(e),t,n)}}class Kh extends Wh{constructor(e,t,n){super(new Uint8ClampedArray(e),t,n)}}class qh extends Wh{constructor(e,t,n){super(new Int16Array(e),t,n)}}class Yh extends Wh{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class Qh extends Wh{constructor(e,t,n){super(new Int32Array(e),t,n)}}class Zh extends Wh{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class $h extends Wh{constructor(e,t,n){super(new Uint16Array(e),t,n),this.isFloat16BufferAttribute=!0}getX(e){let t=zh(this.array[e*this.itemSize]);return this.normalized&&(t=Wu(t,this.array)),t}setX(e,t){return this.normalized&&(t=Xu(t,this.array)),this.array[e*this.itemSize]=Uh(t),this}getY(e){let t=zh(this.array[e*this.itemSize+1]);return this.normalized&&(t=Wu(t,this.array)),t}setY(e,t){return this.normalized&&(t=Xu(t,this.array)),this.array[e*this.itemSize+1]=Uh(t),this}getZ(e){let t=zh(this.array[e*this.itemSize+2]);return this.normalized&&(t=Wu(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Xu(t,this.array)),this.array[e*this.itemSize+2]=Uh(t),this}getW(e){let t=zh(this.array[e*this.itemSize+3]);return this.normalized&&(t=Wu(t,this.array)),t}setW(e,t){return this.normalized&&(t=Xu(t,this.array)),this.array[e*this.itemSize+3]=Uh(t),this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=Xu(t,this.array),n=Xu(n,this.array)),this.array[e+0]=Uh(t),this.array[e+1]=Uh(n),this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=Xu(t,this.array),n=Xu(n,this.array),i=Xu(i,this.array)),this.array[e+0]=Uh(t),this.array[e+1]=Uh(n),this.array[e+2]=Uh(i),this}setXYZW(e,t,n,i,r){return e*=this.itemSize,this.normalized&&(t=Xu(t,this.array),n=Xu(n,this.array),i=Xu(i,this.array),r=Xu(r,this.array)),this.array[e+0]=Uh(t),this.array[e+1]=Uh(n),this.array[e+2]=Uh(i),this.array[e+3]=Uh(r),this}}class ed extends Wh{constructor(e,t,n){super(new Float32Array(e),t,n)}}const td=new Sh,nd=new Yu,id=new Yu;class rd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yu,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;void 0!==t?n.copy(t):td.setFromPoints(e).getCenter(n);let i=0;for(let r=0,a=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;nd.subVectors(e,this.center);const t=nd.lengthSq();if(t>this.radius*this.radius){const e=Math.sqrt(t),n=.5*(e-this.radius);this.center.addScaledVector(nd,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(!0===this.center.equals(e.center)?this.radius=Math.max(this.radius,e.radius):(id.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(nd.copy(e.center).add(id)),this.expandByPoint(nd.copy(e.center).sub(id))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let ad=0;const sd=new Sc,od=new qc,ld=new Yu,ud=new Sh,cd=new Sh,hd=new Yu;class dd extends Nu{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ad++}),this.uuid=Gu(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(function(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}(e)?Zh:Yh)(e,1):this.index=e,this}setIndirect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return void 0!==this.attributes[e]}addGroup(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;void 0!==t&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(void 0!==n){const t=(new $u).getNormalMatrix(e);n.applyNormalMatrix(t),n.needsUpdate=!0}const i=this.attributes.tangent;return void 0!==i&&(i.transformDirection(e),i.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(e){return sd.makeRotationFromQuaternion(e),this.applyMatrix4(sd),this}rotateX(e){return sd.makeRotationX(e),this.applyMatrix4(sd),this}rotateY(e){return sd.makeRotationY(e),this.applyMatrix4(sd),this}rotateZ(e){return sd.makeRotationZ(e),this.applyMatrix4(sd),this}translate(e,t,n){return sd.makeTranslation(e,t,n),this.applyMatrix4(sd),this}scale(e,t,n){return sd.makeScale(e,t,n),this.applyMatrix4(sd),this}lookAt(e){return od.lookAt(e),od.updateMatrix(),this.applyMatrix4(od.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(ld).negate(),this.translate(ld.x,ld.y,ld.z),this}setFromPoints(e){const t=this.getAttribute("position");if(void 0===t){const t=[];for(let n=0,i=e.length;nt.count&&Iu("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Sh);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute)return Du("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new Yu(-1/0,-1/0,-1/0),new Yu(1/0,1/0,1/0));if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n0&&(e.userData=this.userData),void 0!==this.parameters){const t=this.parameters;for(const n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};const t=this.index;null!==t&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const o in n){const t=n[o];e.data.attributes[o]=t.toJSON(e.data)}const i={};let r=!1;for(const o in this.morphAttributes){const t=this.morphAttributes[o],n=[];for(let i=0,r=t.length;i0&&(i[o]=n,r=!0)}r&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const s=this.boundingSphere;return null!==s&&(e.data.boundingSphere=s.toJSON()),e}clone(){return(new this.constructor).copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;null!==n&&this.setIndex(n.clone());const i=e.attributes;for(const l in i){const e=i[l];this.setAttribute(l,e.clone(t))}const r=e.morphAttributes;for(const l in r){const e=[],n=r[l];for(let i=0,r=n.length;i1&&void 0!==arguments[1]?arguments[1]:0;return this.array.set(e,t),this}clone(e){void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Gu()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return void 0===e.arrayBuffers&&(e.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=Gu()),void 0===e.arrayBuffers[this.array.buffer._uuid]&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const fd=new Yu;class md{constructor(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t0!==e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(void 0!==e)for(const t in e){const n=e[t];if(void 0===n){Iu("Material: parameter '".concat(t,"' has value of undefined."));continue}const i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:Iu("Material: '".concat(t,"' is not a property of THREE.").concat(this.type,"."))}}toJSON(e){const t=void 0===e||"string"===typeof e;t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function i(e){const t=[];for(const n in e){const i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),void 0!==this.sheen&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),void 0!==this.dispersion&&(n.dispersion=this.dispersion),void 0!==this.iridescence&&(n.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(n.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),void 0!==this.anisotropy&&(n.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,void 0!==this.combine&&(n.combine=this.combine)),void 0!==this.envMapRotation&&(n.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(n.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.transmission&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),void 0!==this.thickness&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(n.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(n.size=this.size),null!==this.shadowSide&&(n.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==za&&(n.blending=this.blending),this.side!==Na&&(n.side=this.side),!0===this.vertexColors&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=!0),this.blendSrc!==ts&&(n.blendSrc=this.blendSrc),this.blendDst!==ns&&(n.blendDst=this.blendDst),this.blendEquation!==Xa&&(n.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(n.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(n.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==ms&&(n.depthFunc=this.depthFunc),!1===this.depthTest&&(n.depthTest=this.depthTest),!1===this.depthWrite&&(n.depthWrite=this.depthWrite),!1===this.colorWrite&&(n.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==ql&&(n.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(n.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ll&&(n.stencilFail=this.stencilFail),this.stencilZFail!==Ll&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==Ll&&(n.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(n.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.alphaHash&&(n.alphaHash=!0),!0===this.alphaToCoverage&&(n.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=!0),!0===this.forceSinglePass&&(n.forceSinglePass=!0),!1===this.allowOverride&&(n.allowOverride=!1),!0===this.wireframe&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(n.flatShading=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),!1===this.fog&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData),t){const t=i(e.textures),r=i(e.images);t.length>0&&(n.textures=t),r.length>0&&(n.images=r)}return n}clone(){return(new this.constructor).copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(null!==t){const e=t.length;n=new Array(e);for(let i=0;i!==e;++i)n[i]=t[i].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){!0===e&&this.version++}}class _d extends yd{constructor(e){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new ih(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const bd=new Yu,xd=new Yu,Sd=new Yu,Ad=new Ku,Md=new Ku,wd=new Sc,Ed=new Yu,Td=new Yu,Cd=new Yu,Rd=new Ku,Pd=new Ku,Bd=new Ku;class Id extends qc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new _d;if(super(),this.isSprite=!0,this.type="Sprite",void 0===gd){gd=new dd;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),t=new pd(e,5);gd.setIndex([0,1,2,0,2,3]),gd.setAttribute("position",new md(t,3,0,!1)),gd.setAttribute("uv",new md(t,2,3,!1))}this.geometry=gd,this.material=e,this.center=new Ku(.5,.5),this.count=1}raycast(e,t){null===e.camera&&Du('Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.'),xd.setFromMatrixScale(this.matrixWorld),wd.copy(e.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(e.camera.matrixWorldInverse,this.matrixWorld),Sd.setFromMatrixPosition(this.modelViewMatrix),e.camera.isPerspectiveCamera&&!1===this.material.sizeAttenuation&&xd.multiplyScalar(-Sd.z);const n=this.material.rotation;let i,r;0!==n&&(r=Math.cos(n),i=Math.sin(n));const a=this.center;Dd(Ed.set(-.5,-.5,0),Sd,a,xd,i,r),Dd(Td.set(.5,-.5,0),Sd,a,xd,i,r),Dd(Cd.set(.5,.5,0),Sd,a,xd,i,r),Rd.set(0,0),Pd.set(1,0),Bd.set(1,1);let s=e.ray.intersectTriangle(Ed,Td,Cd,!1,bd);if(null===s&&(Dd(Td.set(-.5,.5,0),Sd,a,xd,i,r),Pd.set(0,1),s=e.ray.intersectTriangle(Ed,Cd,Td,!1,bd),null===s))return;const o=e.ray.origin.distanceTo(bd);oe.far||t.push({distance:o,point:bd.clone(),uv:xh.getInterpolation(bd,Ed,Td,Cd,Rd,Pd,Bd,new Ku),face:null,object:this})}copy(e,t){return super.copy(e,t),void 0!==e.center&&this.center.copy(e.center),this.material=e.material,this}}function Dd(e,t,n,i,r,a){Ad.subVectors(e,n).addScalar(.5).multiply(i),void 0!==r?(Md.x=a*Ad.x-r*Ad.y,Md.y=r*Ad.x+a*Ad.y):Md.copy(Ad),e.copy(t),e.x+=Md.x,e.y+=Md.y,e.applyMatrix4(wd)}const Fd=new Yu,Ld=new Yu;class Nd extends qc{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(e){super.copy(e,!1);const t=e.levels;for(let n=0,i=t.length;n1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t=Math.abs(t);const i=this.levels;let r;for(r=0;r0){let n,i;for(n=1,i=t.length;n0){Fd.setFromMatrixPosition(this.matrixWorld);const n=e.ray.origin.distanceTo(Fd);this.getObjectForDistance(n).raycast(e,t)}}update(e){const t=this.levels;if(t.length>1){Fd.setFromMatrixPosition(e.matrixWorld),Ld.setFromMatrixPosition(this.matrixWorld);const n=Fd.distanceTo(Ld)/e.zoom;let i,r;for(t[0].object.visible=!0,i=1,r=t.length;i=e))break;t[i-1].object.visible=!1,t[i].object.visible=!0}for(this._currentLevel=i-1;i0&&void 0!==arguments[0]?arguments[0]:new Yu,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu(0,0,-1);this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Od)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Od.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Od.copy(this.origin).addScaledVector(this.direction,t),Od.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){kd.copy(e).add(t).multiplyScalar(.5),Ud.copy(t).sub(e).normalize(),zd.copy(this.origin).sub(kd);const r=.5*e.distanceTo(t),a=-this.direction.dot(Ud),s=zd.dot(this.direction),o=-zd.dot(Ud),l=zd.lengthSq(),u=Math.abs(1-a*a);let c,h,d,p;if(u>0)if(c=a*o-s,h=a*s-o,p=r*u,c>=0)if(h>=-p)if(h<=p){const e=1/u;c*=e,h*=e,d=c*(c+a*h+2*s)+h*(a*c+h+2*o)+l}else h=r,c=Math.max(0,-(a*h+s)),d=-c*c+h*(h+2*o)+l;else h=-r,c=Math.max(0,-(a*h+s)),d=-c*c+h*(h+2*o)+l;else h<=-p?(c=Math.max(0,-(-a*r+s)),h=c>0?-r:Math.min(Math.max(-r,-o),r),d=-c*c+h*(h+2*o)+l):h<=p?(c=0,h=Math.min(Math.max(-r,-o),r),d=h*(h+2*o)+l):(c=Math.max(0,-(a*r+s)),h=c>0?r:Math.min(Math.max(-r,-o),r),d=-c*c+h*(h+2*o)+l);else h=a>0?-r:r,c=Math.max(0,-(a*h+s)),d=-c*c+h*(h+2*o)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,c),i&&i.copy(kd).addScaledVector(Ud,h),d}intersectSphere(e,t){Od.subVectors(e.center,this.origin);const n=Od.dot(this.direction),i=Od.dot(Od)-n*n,r=e.radius*e.radius;if(i>r)return null;const a=Math.sqrt(r-i),s=n-a,o=n+a;return o<0?null:s<0?this.at(o,t):this.at(s,t)}intersectsSphere(e){return!(e.radius<0)&&this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return null===n?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);if(0===t)return!0;return e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,r,a,s,o;const l=1/this.direction.x,u=1/this.direction.y,c=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),u>=0?(r=(e.min.y-h.y)*u,a=(e.max.y-h.y)*u):(r=(e.max.y-h.y)*u,a=(e.min.y-h.y)*u),n>a||r>i?null:((r>n||isNaN(n))&&(n=r),(a=0?(s=(e.min.z-h.z)*c,o=(e.max.z-h.z)*c):(s=(e.max.z-h.z)*c,o=(e.min.z-h.z)*c),n>o||s>i?null:((s>n||n!==n)&&(n=s),(o=0?n:i,t)))}intersectsBox(e){return null!==this.intersectBox(e,Od)}intersectTriangle(e,t,n,i,r){Gd.subVectors(t,e),Hd.subVectors(n,e),Vd.crossVectors(Gd,Hd);let a,s=this.direction.dot(Vd);if(s>0){if(i)return null;a=1}else{if(!(s<0))return null;a=-1,s=-s}zd.subVectors(this.origin,e);const o=a*this.direction.dot(Hd.crossVectors(zd,Hd));if(o<0)return null;const l=a*this.direction.dot(Gd.cross(zd));if(l<0)return null;if(o+l>s)return null;const u=-a*zd.dot(Vd);return u<0?null:this.at(u/s,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Wd extends yd{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ih(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ic,this.combine=bs,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Xd=new Sc,Jd=new jd,Kd=new rd,qd=new Yu,Yd=new Yu,Qd=new Yu,Zd=new Yu,$d=new Yu,ep=new Yu,tp=new Yu,np=new Yu;class ip extends qc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new dd,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Wd;super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),void 0!==e.morphTargetInfluences&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,t=Object.keys(e);if(t.length>0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2)return}Xd.copy(r).invert(),Jd.copy(e.ray).applyMatrix4(Xd),null!==n.boundingBox&&!1===Jd.intersectsBox(n.boundingBox)||this._computeIntersections(e,t,Jd)}}_computeIntersections(e,t,n){let i;const r=this.geometry,a=this.material,s=r.index,o=r.attributes.position,l=r.attributes.uv,u=r.attributes.uv1,c=r.attributes.normal,h=r.groups,d=r.drawRange;if(null!==s)if(Array.isArray(a))for(let p=0,f=h.length;pn.far?null:{distance:u,point:np.clone(),object:e}}(e,t,n,i,Yd,Qd,Zd,tp);if(c){const e=new Yu;xh.getBarycoord(tp,Yd,Qd,Zd,e),r&&(c.uv=xh.getInterpolatedAttribute(r,o,l,u,e,new Ku)),a&&(c.uv1=xh.getInterpolatedAttribute(a,o,l,u,e,new Ku)),s&&(c.normal=xh.getInterpolatedAttribute(s,o,l,u,e,new Yu),c.normal.dot(i.direction)>0&&c.normal.multiplyScalar(-1));const t={a:o,b:l,c:u,normal:new Yu,materialIndex:0};xh.getNormal(Yd,Qd,Zd,t.normal),c.face=t,c.barycoord=e}return c}const ap=new mc,sp=new mc,op=new mc,lp=new mc,up=new Sc,cp=new Yu,hp=new rd,dp=new Sc,pp=new jd;class fp extends ip{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=Bs,this.bindMatrix=new Sc,this.bindMatrixInverse=new Sc,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;null===this.boundingBox&&(this.boundingBox=new Sh),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;super(null,arguments.length>5?arguments[5]:void 0,arguments.length>6?arguments[6]:void 0,arguments.length>7?arguments[7]:void 0,arguments.length>8&&void 0!==arguments[8]?arguments[8]:Hs,arguments.length>9&&void 0!==arguments[9]?arguments[9]:Hs,arguments.length>3?arguments[3]:void 0,arguments.length>4?arguments[4]:void 0,arguments.length>10?arguments[10]:void 0,arguments.length>11?arguments[11]:void 0),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const vp=new Sc,yp=new Sc;class _p{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.uuid=Gu(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(16*e.length),0===t.length)this.calculateInverses();else if(e.length!==t.length){Iu("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let e=0,t=this.bones.length;e3&&void 0!==arguments[3]?arguments[3]:1;super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const xp=new Sc,Sp=new Sc,Ap=[],Mp=new Sh,wp=new Sc,Ep=new ip,Tp=new rd;class Cp extends ip{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new bp(new Float32Array(16*n),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:new Yu(1,0,0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Rp.subVectors(n,t).cross(Pp.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const i=e.delta(Rp),r=this.normal.dot(i);if(0===r)return 0===this.distanceToPoint(e.start)?t.copy(e.start):null;const a=-(e.start.dot(this.normal)+this.constant)/r;return!0===n&&(a<0||a>1)?null:t.copy(e.start).addScaledVector(i,a)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Bp.getNormalMatrix(e),i=this.coplanarPoint(Rp).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Dp=new rd,Fp=new Ku(.5,.5),Lp=new Yu;class Np{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ip,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ip,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Ip,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Ip,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:new Ip,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:new Ip;this.planes=[e,t,n,i,r,a]}set(e,t,n,i,r,a){const s=this.planes;return s[0].copy(e),s[1].copy(t),s[2].copy(n),s[3].copy(i),s[4].copy(r),s[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:mu,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const i=this.planes,r=e.elements,a=r[0],s=r[1],o=r[2],l=r[3],u=r[4],c=r[5],h=r[6],d=r[7],p=r[8],f=r[9],m=r[10],g=r[11],v=r[12],y=r[13],_=r[14],b=r[15];if(i[0].setComponents(l-a,d-u,g-p,b-v).normalize(),i[1].setComponents(l+a,d+u,g+p,b+v).normalize(),i[2].setComponents(l+s,d+c,g+f,b+y).normalize(),i[3].setComponents(l-s,d-c,g-f,b-y).normalize(),n)i[4].setComponents(o,h,m,_).normalize(),i[5].setComponents(l-o,d-h,g-m,b-_).normalize();else if(i[4].setComponents(l-o,d-h,g-m,b-_).normalize(),t===mu)i[5].setComponents(l+o,d+h,g+m,b+_).normalize();else{if(t!==gu)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);i[5].setComponents(o,h,m,_).normalize()}return this}intersectsObject(e){if(void 0!==e.boundingSphere)null===e.boundingSphere&&e.computeBoundingSphere(),Dp.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;null===t.boundingSphere&&t.computeBoundingSphere(),Dp.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Dp)}intersectsSprite(e){Dp.center.set(0,0,0);const t=Fp.distanceTo(e.center);return Dp.radius=.7071067811865476+t,Dp.applyMatrix4(e.matrixWorld),this.intersectsSphere(Dp)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let r=0;r<6;r++){if(t[r].distanceToPoint(n)0?e.max.x:e.min.x,Lp.y=i.normal.y>0?e.max.y:e.min.y,Lp.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Lp)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}const Op=new Sc,kp=new Np;class Up{constructor(){this.coordinateSystem=mu}intersectsObject(e,t){if(!t.isArrayCamera||0===t.cameras.length)return!1;for(let n=0;n=r.length&&r.push({start:-1,count:-1,z:-1,index:-1});const s=r[this.index];a.push(s),this.index++,s.start=e,s.count=t,s.z=n,s.index=i}reset(){this.list.length=0,this.index=0}}const jp=new Sc,Wp=new ih(1,1,1),Xp=new Np,Jp=new Up,Kp=new Sh,qp=new rd,Yp=new Yu,Qp=new Yu,Zp=new Yu,$p=new Vp,ef=new ip,tf=[];function nf(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const i=t.itemSize;if(e.isInterleavedBufferAttribute||e.array.constructor!==t.array.constructor){const r=e.count;for(let a=0;a2&&void 0!==arguments[2]?arguments[2]:2*t,i=arguments.length>3?arguments[3]:void 0;super(new dd,i),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=e,this._maxVertexCount=t,this._maxIndexCount=n,this._multiDrawCounts=new Int32Array(e),this._multiDrawStarts=new Int32Array(e),this._multiDrawCount=0,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let e=Math.sqrt(4*this._maxInstanceCount);e=4*Math.ceil(e/4),e=Math.max(e,4);const t=new Float32Array(e*e*4),n=new gp(t,e,e,fo,ro);this._matricesTexture=n}_initIndirectTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Uint32Array(e*e),n=new gp(t,e,e,yo,io);this._indirectTexture=n}_initColorsTexture(){let e=Math.sqrt(this._maxInstanceCount);e=Math.ceil(e);const t=new Float32Array(e*e*4).fill(1),n=new gp(t,e,e,fo,ro);n.colorSpace=rc.workingColorSpace,this._colorsTexture=n}_initializeGeometry(e){const t=this.geometry,n=this._maxVertexCount,i=this._maxIndexCount;if(!1===this._geometryInitialized){for(const i in e.attributes){const r=e.getAttribute(i),a=r.array,s=r.itemSize,o=r.normalized,l=new a.constructor(n*s),u=new Wh(l,s,o);t.setAttribute(i,u)}if(null!==e.getIndex()){const e=n>65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new Wh(e,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(Boolean(e.getIndex())!==Boolean(t.getIndex()))throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const n in t.attributes){if(!e.hasAttribute(n))throw new Error('THREE.BatchedMesh: Added geometry missing "'.concat(n,'". All geometries must have consistent attributes.'));const i=e.getAttribute(n),r=t.getAttribute(n);if(i.itemSize!==r.itemSize||i.normalized!==r.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(e){const t=this._instanceInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error("THREE.BatchedMesh: Invalid instanceId ".concat(e,". Instance is either out of range or has been deleted."))}validateGeometryId(e){const t=this._geometryInfo;if(e<0||e>=t.length||!1===t[e].active)throw new Error("THREE.BatchedMesh: Invalid geometryId ".concat(e,". Geometry is either out of range or has been deleted."))}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Sh);const e=this.boundingBox,t=this._instanceInfo;e.makeEmpty();for(let n=0,i=t.length;n=this.maxInstanceCount&&0===this._availableInstanceIds.length)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const t={visible:!0,active:!0,geometryIndex:e};let n=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(zp),n=this._availableInstanceIds.shift(),this._instanceInfo[n]=t):(n=this._instanceInfo.length,this._instanceInfo.push(t));const i=this._matricesTexture;jp.identity().toArray(i.image.data,16*n),i.needsUpdate=!0;const r=this._colorsTexture;return r&&(Wp.toArray(r.image.data,4*n),r.needsUpdate=!0),this._visibilityChanged=!0,n}addGeometry(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;this._initializeGeometry(e),this._validateGeometry(e);const i={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},r=this._geometryInfo;i.vertexStart=this._nextVertexStart,i.reservedVertexCount=-1===t?e.getAttribute("position").count:t;const a=e.getIndex();if(null!==a&&(i.indexStart=this._nextIndexStart,i.reservedIndexCount=-1===n?a.count:n),-1!==i.indexStart&&i.indexStart+i.reservedIndexCount>this._maxIndexCount||i.vertexStart+i.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let s;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(zp),s=this._availableGeometryIds.shift(),r[s]=i):(s=this._geometryCount,this._geometryCount++,r.push(i)),this.setGeometryAt(s,e),this._nextIndexStart=i.indexStart+i.reservedIndexCount,this._nextVertexStart=i.vertexStart+i.reservedVertexCount,s}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const n=this.geometry,i=null!==n.getIndex(),r=n.getIndex(),a=t.getIndex(),s=this._geometryInfo[e];if(i&&a.count>s.reservedIndexCount||t.attributes.position.count>s.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const o=s.vertexStart,l=s.reservedVertexCount;s.vertexCount=t.getAttribute("position").count;for(const u in n.attributes){const e=t.getAttribute(u),i=n.getAttribute(u);nf(e,i,o);const r=e.itemSize;for(let t=e.count,n=l;t=t.length||!1===t[e].active)return this;const n=this._instanceInfo;for(let i=0,r=n.length;it).sort((e,t)=>n[e].vertexStart-n[t].vertexStart),r=this.geometry;for(let a=0,s=n.length;a=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingBox){const e=new Sh,t=n.index,r=n.attributes.position;for(let n=i.start,a=i.start+i.count;n=this._geometryCount)return null;const n=this.geometry,i=this._geometryInfo[e];if(null===i.boundingSphere){const t=new rd;this.getBoundingBoxAt(e,Kp),Kp.getCenter(t.center);const r=n.index,a=n.attributes.position;let s=0;for(let e=i.start,n=i.start+i.count;e1&&void 0!==arguments[1]?arguments[1]:{};this.validateGeometryId(e);const n=this._geometryInfo[e];return t.vertexStart=n.vertexStart,t.vertexCount=n.vertexCount,t.reservedVertexCount=n.reservedVertexCount,t.indexStart=n.indexStart,t.indexCount=n.indexCount,t.reservedIndexCount=n.reservedIndexCount,t.start=n.start,t.count=n.count,t}setInstanceCount(e){const t=this._availableInstanceIds,n=this._instanceInfo;for(t.sort(zp);t[t.length-1]===n.length-1;)n.pop(),t.pop();if(ee.active);if(Math.max(...n.map(e=>e.vertexStart+e.reservedVertexCount))>e)throw new Error("BatchedMesh: Geometry vertex values are being used outside the range ".concat(t,". Cannot shrink further."));if(this.geometry.index){if(Math.max(...n.map(e=>e.indexStart+e.reservedIndexCount))>t)throw new Error("BatchedMesh: Geometry index values are being used outside the range ".concat(t,". Cannot shrink further."))}const i=this.geometry;i.dispose(),this._maxVertexCount=e,this._maxIndexCount=t,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new dd,this._initializeGeometry(i));const r=this.geometry;i.index&&rf(i.index.array,r.index.array);for(const a in i.attributes)rf(i.attributes[a].array,r.attributes[a].array)}raycast(e,t){const n=this._instanceInfo,i=this._geometryInfo,r=this.matrixWorld,a=this.geometry;ef.material=this.material,ef.geometry.index=a.index,ef.geometry.attributes=a.attributes,null===ef.geometry.boundingBox&&(ef.geometry.boundingBox=new Sh),null===ef.geometry.boundingSphere&&(ef.geometry.boundingSphere=new rd);for(let s=0,o=n.length;sh(h({},e),{},{boundingBox:null!==e.boundingBox?e.boundingBox.clone():null,boundingSphere:null!==e.boundingSphere?e.boundingSphere.clone():null})),this._instanceInfo=e._instanceInfo.map(e=>h({},e)),this._availableInstanceIds=e._availableInstanceIds.slice(),this._availableGeometryIds=e._availableGeometryIds.slice(),this._nextIndexStart=e._nextIndexStart,this._nextVertexStart=e._nextVertexStart,this._geometryCount=e._geometryCount,this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._indirectTexture=e._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),null!==this._colorsTexture&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,null!==this._colorsTexture&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(e,t,n,i,r){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const a=i.getIndex();let s=null===a?1:a.array.BYTES_PER_ELEMENT,o=1;r.wireframe&&(o=2,s=i.attributes.position.count>65535?4:2);const l=this._instanceInfo,u=this._multiDrawStarts,c=this._multiDrawCounts,h=this._geometryInfo,d=this.perObjectFrustumCulled,p=this._indirectTexture,f=p.image.data,m=n.isArrayCamera?Jp:Xp;d&&!n.isArrayCamera&&(jp.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse).multiply(this.matrixWorld),Xp.setFromProjectionMatrix(jp,n.coordinateSystem,n.reversedDepth));let g=0;if(this.sortObjects){jp.copy(this.matrixWorld).invert(),Yp.setFromMatrixPosition(n.matrixWorld).applyMatrix4(jp),Qp.set(0,0,-1).transformDirection(n.matrixWorld).transformDirection(jp);for(let i=0,r=l.length;i0&&void 0!==arguments[0]?arguments[0]:new dd,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new sf;super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[0];for(let e=1,i=t.count;e0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei)return;df.applyMatrix4(e.matrixWorld);const l=t.ray.origin.distanceTo(df);return lt.far?void 0:{distance:l,point:pf.clone().applyMatrix4(e.matrixWorld),index:s,face:null,faceIndex:null,barycoord:null,object:e}}const gf=new Yu,vf=new Yu;class yf extends ff{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(null===e.index){const t=e.attributes.position,n=[];for(let e=0,i=t.count;e0&&void 0!==arguments[0]?arguments[0]:new dd,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new bf;super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,r=e.params.Points.threshold,a=n.drawRange;if(null===n.boundingSphere&&n.computeBoundingSphere(),Af.copy(n.boundingSphere),Af.applyMatrix4(i),Af.radius+=r,!1===e.ray.intersectsSphere(Af))return;xf.copy(i).invert(),Sf.copy(e.ray).applyMatrix4(xf);const s=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=s*s,l=n.index,u=n.attributes.position;if(null!==l){for(let n=Math.max(0,a.start),r=Math.min(l.count,a.start+a.count);n0){const n=e[t[0]];if(void 0!==n){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er.far)return;a.push({distance:l,distanceToRay:Math.sqrt(o),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:s})}}class Tf extends fc{constructor(e,t,n,i){super(e,t,n,i,arguments.length>4&&void 0!==arguments[4]?arguments[4]:Js,arguments.length>5&&void 0!==arguments[5]?arguments[5]:Js,arguments.length>6?arguments[6]:void 0,arguments.length>7?arguments[7]:void 0,arguments.length>8?arguments[8]:void 0),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const r=this;"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(function t(){r.needsUpdate=!0,r._requestVideoFrameCallbackId=e.requestVideoFrameCallback(t)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;!1==="requestVideoFrameCallback"in e&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class Cf extends Tf{constructor(e,t,n,i,r,a,s,o){super({},e,t,n,i,r,a,s,o),this.isVideoFrameTexture=!0}update(){}clone(){return(new this.constructor).copy(this)}setFrame(e){this.image=e,this.needsUpdate=!0}}class Rf extends fc{constructor(e,t){super({width:e,height:t}),this.isFramebufferTexture=!0,this.magFilter=Hs,this.minFilter=Hs,this.generateMipmaps=!1,this.needsUpdate=!0}}class Pf extends fc{constructor(e,t,n,i,r,a,s,o,l,u,c,h){super(null,a,s,o,l,u,i,r,c,h),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Bf extends Pf{constructor(e,t,n,i,r,a){super(e,t,n,r,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=zs,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class If extends Pf{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,Fs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class Df extends fc{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],arguments.length>1&&void 0!==arguments[1]?arguments[1]:Fs,arguments.length>2?arguments[2]:void 0,arguments.length>3?arguments[3]:void 0,arguments.length>4?arguments[4]:void 0,arguments.length>5?arguments[5]:void 0,arguments.length>6?arguments[6]:void 0,arguments.length>7?arguments[7]:void 0,arguments.length>8?arguments[8]:void 0,arguments.length>9?arguments[9]:void 0),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Ff extends fc{constructor(e,t,n,i,r,a,s,o,l){super(e,t,n,i,r,a,s,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Lf extends fc{constructor(e,t,n,i,r,a,s,o,l){super(e,t,n,i,r,a,s,o,l),this.isHTMLTexture=!0,this.generateMipmaps=!1,this.needsUpdate=!0;const u=e?e.parentNode:null;null!==u&&"requestPaint"in u&&(u.onpaint=()=>{this.needsUpdate=!0},u.requestPaint())}dispose(){const e=this.image?this.image.parentNode:null;null!==e&&"onpaint"in e&&(e.onpaint=null),super.dispose()}}class Nf extends fc{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:io,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Hs,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:Hs,l=arguments.length>8?arguments[8]:void 0,u=arguments.length>9&&void 0!==arguments[9]?arguments[9]:mo,c=arguments.length>10&&void 0!==arguments[10]?arguments[10]:1;if(u!==mo&&u!==go)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:e,height:t,depth:c},i,r,a,s,o,u,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new cc(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return null!==this.compareFunction&&(t.compareFunction=this.compareFunction),t}}class Of extends Nf{constructor(e){const t={width:e,height:e,depth:1},n=[t,t,t,t,t,t];super(e,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:io,arguments.length>2&&void 0!==arguments[2]?arguments[2]:Fs,arguments.length>3?arguments[3]:void 0,arguments.length>4?arguments[4]:void 0,arguments.length>5&&void 0!==arguments[5]?arguments[5]:Hs,arguments.length>6&&void 0!==arguments[6]?arguments[6]:Hs,arguments.length>7?arguments[7]:void 0,arguments.length>8&&void 0!==arguments[8]?arguments[8]:mo),this.image=n,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class kf extends fc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class Uf extends dd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1;super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};const s=this;i=Math.floor(i),r=Math.floor(r),a=Math.floor(a);const o=[],l=[],u=[],c=[];let h=0,d=0;function p(e,t,n,i,r,a,p,f,m,g,v){const y=a/m,_=p/g,b=a/2,x=p/2,S=f/2,A=m+1,M=g+1;let w=0,E=0;const T=new Yu;for(let s=0;s0?1:-1,u.push(T.x,T.y,T.z),c.push(o/m),c.push(1-s/g),w+=1}}for(let s=0;s0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;super(),this.type="CapsuleGeometry",this.parameters={radius:e,height:t,capSegments:n,radialSegments:i,heightSegments:r},t=Math.max(0,t),n=Math.max(1,Math.floor(n)),i=Math.max(3,Math.floor(i)),r=Math.max(1,Math.floor(r));const a=[],s=[],o=[],l=[],u=t/2,c=Math.PI/2*e,h=t,d=2*c+h,p=2*n+r,f=i+1,m=new Yu,g=new Yu;for(let v=0;v<=p;v++){let y=0,_=0,b=0,x=0;if(v<=n){const t=v/n,i=t*Math.PI/2;_=-u-e*Math.cos(i),b=e*Math.sin(i),x=-e*Math.cos(i),y=t*c}else if(v<=n+r){const i=(v-n)/r;_=i*t-u,b=e,x=0,y=c+i*h}else{const t=(v-n-r)/n,i=t*Math.PI/2;_=u+e*Math.sin(i),b=e*Math.cos(i),x=e*Math.sin(i),y=c+h+t*c}const S=Math.max(0,Math.min(1,y/d));let A=0;0===v?A=.5/i:v===p&&(A=-.5/i);for(let e=0;e<=i;e++){const t=e/i,n=t*Math.PI*2,r=Math.sin(n),a=Math.cos(n);g.x=-b*a,g.y=_,g.z=b*r,s.push(g.x,g.y,g.z),m.set(-b*a,x,b*r),m.normalize(),o.push(m.x,m.y,m.z),l.push(t+A,S)}if(v>0){const e=(v-1)*f;for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;super(),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},t=Math.max(3,t);const r=[],a=[],s=[],o=[],l=new Yu,u=new Ku;a.push(0,0,0),s.push(0,0,1),o.push(.5,.5);for(let c=0,h=3;c<=t;c++,h+=3){const r=n+c/t*i;l.x=e*Math.cos(r),l.y=e*Math.sin(r),a.push(l.x,l.y,l.z),s.push(0,0,1),u.x=(a[h]/e+1)/2,u.y=(a[h+1]/e+1)/2,o.push(u.x,u.y)}for(let c=1;c<=t;c++)r.push(c,c+1,0);this.setIndex(r),this.setAttribute("position",new ed(a,3)),this.setAttribute("normal",new ed(s,3)),this.setAttribute("uv",new ed(o,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Gf(e.radius,e.segments,e.thetaStart,e.thetaLength)}}class Hf extends dd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:32,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:2*Math.PI;super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:s,thetaLength:o};const l=this;i=Math.floor(i),r=Math.floor(r);const u=[],c=[],h=[],d=[];let p=0;const f=[],m=n/2;let g=0;function v(n){const r=p,a=new Ku,f=new Yu;let v=0;const y=!0===n?e:t,_=!0===n?1:-1;for(let e=1;e<=i;e++)c.push(0,m*_,0),h.push(0,_,0),d.push(.5,.5),p++;const b=p;for(let e=0;e<=i;e++){const t=e/i*o+s,n=Math.cos(t),r=Math.sin(t);f.x=y*r,f.y=m*_,f.z=y*n,c.push(f.x,f.y,f.z),h.push(0,_,0),a.x=.5*n+.5,a.y=.5*r*_+.5,d.push(a.x,a.y),p++}for(let e=0;e0||0!==i)&&(u.push(a,s,l),y+=3),(t>0||i!==r-1)&&(u.push(s,o,l),y+=3)}l.addGroup(g,y,0),g+=y}(),!1===a&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(u),this.setAttribute("position",new ed(c,3)),this.setAttribute("normal",new ed(h,3)),this.setAttribute("uv",new ed(d,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new Hf(e.radiusTop,e.radiusBottom,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class Vf extends Hf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Math.PI;super(0,e,t,n,i,r,a,s),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:s}}static fromJSON(e){return new Vf(e.radius,e.height,e.radialSegments,e.heightSegments,e.openEnded,e.thetaStart,e.thetaLength)}}class jf extends dd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;super(),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i};const r=[],a=[];function s(e,t,n,i){const r=i+1,a=[];for(let s=0;s<=r;s++){a[s]=[];const i=e.clone().lerp(n,s/r),o=t.clone().lerp(n,s/r),l=r-s;for(let e=0;e<=l;e++)a[s][e]=0===e&&s===r?i:i.clone().lerp(o,e/l)}for(let s=0;s.9&&s<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new ed(r,3)),this.setAttribute("normal",new ed(r.slice(),3)),this.setAttribute("uv",new ed(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jf(e.vertices,e.indices,e.radius,e.detail)}}class Wf extends jf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=(1+Math.sqrt(5))/2,i=1/n;super([-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],e,t),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new Wf(e.radius,e.detail)}}const Xf=new Yu,Jf=new Yu,Kf=new Yu,qf=new xh;class Yf extends dd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(super(),this.type="EdgesGeometry",this.parameters={geometry:e,thresholdAngle:t},null!==e){const n=4,i=Math.pow(10,n),r=Math.cos(Uu*t),a=e.getIndex(),s=e.getAttribute("position"),o=a?a.count:s.count,l=[0,0,0],u=["a","b","c"],c=new Array(3),h={},d=[];for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:5;const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5;const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.arcLengthDivisions;if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),r=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),r+=n.distanceTo(i),t.push(r),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n=this.getLengths();let i=0;const r=n.length;let a;a=t||e*n[r-1];let s,o=0,l=r-1;for(;o<=l;)if(i=Math.floor(o+(l-o)/2),s=n[i]-a,s<0)o=i+1;else{if(!(s>0)){l=i;break}l=i-1}if(i=l,n[i]===a)return i/(r-1);const u=n[i];return(i+(a-u)/(n[i+1]-u))/(r-1)}getTangent(e,t){const n=1e-4;let i=e-n,r=e+n;i<0&&(i=0),r>1&&(r=1);const a=this.getPoint(i),s=this.getPoint(r),o=t||(a.isVector2?new Ku:new Yu);return o.copy(s).sub(a).normalize(),o}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=new Yu,i=[],r=[],a=[],s=new Yu,o=new Sc;for(let d=0;d<=e;d++){const t=d/e;i[d]=this.getTangentAt(t,new Yu)}r[0]=new Yu,a[0]=new Yu;let l=Number.MAX_VALUE;const u=Math.abs(i[0].x),c=Math.abs(i[0].y),h=Math.abs(i[0].z);u<=l&&(l=u,n.set(1,0,0)),c<=l&&(l=c,n.set(0,1,0)),h<=l&&n.set(0,0,1),s.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],s),a[0].crossVectors(i[0],r[0]);for(let d=1;d<=e;d++){if(r[d]=r[d-1].clone(),a[d]=a[d-1].clone(),s.crossVectors(i[d-1],i[d]),s.length()>Number.EPSILON){s.normalize();const e=Math.acos(Hu(i[d-1].dot(i[d]),-1,1));r[d].applyMatrix4(o.makeRotationAxis(s,e))}a[d].crossVectors(i[d],r[d])}if(!0===t){let t=Math.acos(Hu(r[0].dot(r[e]),-1,1));t/=e,i[0].dot(s.crossVectors(r[0],r[e]))>0&&(t=-t);for(let n=1;n<=e;n++)r[n].applyMatrix4(o.makeRotationAxis(i[n],t*n)),a[n].crossVectors(i[n],r[n])}return{tangents:i,normals:r,binormals:a}}clone(){return(new this.constructor).copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Zf extends Qf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI,s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=r,this.aEndAngle=a,this.aClockwise=s,this.aRotation=o}getPoint(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ku,n=2*Math.PI;let i=this.aEndAngle-this.aStartAngle;const r=Math.abs(i)n;)i-=n;i0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"centripetal",i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu,n=this.points,i=n.length,r=(i-(this.closed?0:1))*e;let a,s,o=Math.floor(r),l=r-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/i)+1)*i:0===l&&o===i-1&&(o=i-2,l=1),this.closed||o>0?a=n[(o-1)%i]:(nm.subVectors(n[0],n[1]).add(n[0]),a=nm);const u=n[o%i],c=n[(o+1)%i];if(this.closed||o+20&&void 0!==arguments[0]?arguments[0]:new Ku,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ku,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Ku,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Ku;super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ku,n=this.v0,i=this.v1,r=this.v2,a=this.v3;return t.set(um(e,n.x,i.x,r.x,a.x),um(e,n.y,i.y,r.y,a.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class hm extends Qf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yu,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Yu,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:new Yu;super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu,n=this.v0,i=this.v1,r=this.v2,a=this.v3;return t.set(um(e,n.x,i.x,r.x,a.x),um(e,n.y,i.y,r.y,a.y),um(e,n.z,i.z,r.z,a.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class dm extends Qf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ku,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ku;super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ku;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ku).subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class pm extends Qf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yu,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu;super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu;return 1===e?t.copy(this.v2):(t.copy(this.v2).sub(this.v1),t.multiplyScalar(e).add(this.v1)),t}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e){return(arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu).subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class fm extends Qf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ku,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ku,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Ku;super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ku,n=this.v0,i=this.v1,r=this.v2;return t.set(lm(e,n.x,i.x,r.x),lm(e,n.y,i.y,r.y)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class mm extends Qf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yu,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Yu;super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu,n=this.v0,i=this.v1,r=this.v2;return t.set(lm(e,n.x,i.x,r.x),lm(e,n.y,i.y,r.y),lm(e,n.z,i.z,r.z)),t}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class gm extends Qf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e){const t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ku,n=this.points,i=(n.length-1)*e,r=Math.floor(i),a=i-r,s=n[0===r?r:r-1],o=n[r],l=n[r>n.length-2?n.length-1:r+1],u=n[r>n.length-3?n.length-1:r+2];return t.set(om(a,s.x,o.x,l.x,u.x),om(a,s.y,o.y,l.y,u.y)),t}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t=n){const e=i[r]-n,a=this.curves[r],s=a.getLength(),o=0===s?0:1-e/s;return a.getPointAt(o,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n0&&void 0!==arguments[0]?arguments[0]:40;const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:12;const t=[];let n;for(let i=0,r=this.curves;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t0){const e=l.getPoint(0);e.equals(this.currentPoint)||this.lineTo(e.x,e.y)}this.curves.push(l);const u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class bm extends _m{constructor(e){super(e),this.uuid=Gu(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n2&&void 0!==arguments[2]?arguments[2]:2;const i=t&&t.length,r=i?t[0]*n:e.length;let a=Sm(e,0,r,n,!0);const s=[];if(!a||a.next===a.prev)return s;let o,l,u;if(i&&(a=function(e,t,n,i){const r=[];for(let a=0,s=t.length;a80*n){o=e[0],l=e[1];let t=o,i=l;for(let a=n;at&&(t=n),r>i&&(i=r)}u=Math.max(t-o,i-l),u=0!==u?32767/u:0}return Mm(a,s,n,o,l,u,0),s}function Sm(e,t,n,i,r){let a;if(r===function(e,t,n,i){let r=0;for(let a=t,s=n-i;a0)for(let s=t;s=t;s-=i)a=jm(s/i|0,e[s],e[s+1],a);return a&&km(a,a.next)&&(Wm(a),a=a.next),a}function Am(e,t){if(!e)return e;t||(t=e);let n,i=e;do{if(n=!1,i.steiner||!km(i,i.next)&&0!==Om(i.prev,i,i.next))i=i.next;else{if(Wm(i),i=t=i.prev,i===i.next)break;n=!0}}while(n||i!==t);return t}function Mm(e,t,n,i,r,a,s){if(!e)return;!s&&a&&function(e,t,n,i){let r=e;do{0===r.z&&(r.z=Im(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,function(e){let t,n=1;do{let i,r=e;e=null;let a=null;for(t=0;r;){t++;let s=r,o=0;for(let e=0;e0||l>0&&s;)0!==o&&(0===l||!s||r.z<=s.z)?(i=r,r=r.nextZ,o--):(i=s,s=s.nextZ,l--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=s}a.nextZ=null,n*=2}while(t>1)}(r)}(e,i,r,a);let o=e;for(;e.prev!==e.next;){const l=e.prev,u=e.next;if(a?Em(e,i,r,a):wm(e))t.push(l.i,e.i,u.i),Wm(e),e=u.next,o=u.next;else if((e=u)===o){s?1===s?Mm(e=Tm(Am(e),t),t,n,i,r,a,2):2===s&&Cm(e,t,n,i,r,a):Mm(Am(e),t,n,i,r,a,1);break}}}function wm(e){const t=e.prev,n=e,i=e.next;if(Om(t,n,i)>=0)return!1;const r=t.x,a=n.x,s=i.x,o=t.y,l=n.y,u=i.y,c=Math.min(r,a,s),h=Math.min(o,l,u),d=Math.max(r,a,s),p=Math.max(o,l,u);let f=i.next;for(;f!==t;){if(f.x>=c&&f.x<=d&&f.y>=h&&f.y<=p&&Lm(r,o,a,l,s,u,f.x,f.y)&&Om(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Em(e,t,n,i){const r=e.prev,a=e,s=e.next;if(Om(r,a,s)>=0)return!1;const o=r.x,l=a.x,u=s.x,c=r.y,h=a.y,d=s.y,p=Math.min(o,l,u),f=Math.min(c,h,d),m=Math.max(o,l,u),g=Math.max(c,h,d),v=Im(p,f,t,n,i),y=Im(m,g,t,n,i);let _=e.prevZ,b=e.nextZ;for(;_&&_.z>=v&&b&&b.z<=y;){if(_.x>=p&&_.x<=m&&_.y>=f&&_.y<=g&&_!==r&&_!==s&&Lm(o,c,l,h,u,d,_.x,_.y)&&Om(_.prev,_,_.next)>=0)return!1;if(_=_.prevZ,b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==r&&b!==s&&Lm(o,c,l,h,u,d,b.x,b.y)&&Om(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;_&&_.z>=v;){if(_.x>=p&&_.x<=m&&_.y>=f&&_.y<=g&&_!==r&&_!==s&&Lm(o,c,l,h,u,d,_.x,_.y)&&Om(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;b&&b.z<=y;){if(b.x>=p&&b.x<=m&&b.y>=f&&b.y<=g&&b!==r&&b!==s&&Lm(o,c,l,h,u,d,b.x,b.y)&&Om(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Tm(e,t){let n=e;do{const i=n.prev,r=n.next.next;!km(i,r)&&Um(i,n,n.next,r)&&Hm(i,r)&&Hm(r,i)&&(t.push(i.i,n.i,r.i),Wm(n),Wm(n.next),n=e=r),n=n.next}while(n!==e);return Am(n)}function Cm(e,t,n,i,r,a){let s=e;do{let e=s.next.next;for(;e!==s.prev;){if(s.i!==e.i&&Nm(s,e)){let o=Vm(s,e);return s=Am(s,s.next),o=Am(o,o.next),Mm(s,t,n,i,r,a,0),void Mm(o,t,n,i,r,a,0)}e=e.next}s=s.next}while(s!==e)}function Rm(e,t){let n=e.x-t.x;if(0===n&&(n=e.y-t.y,0===n)){n=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)}return n}function Pm(e,t){const n=function(e,t){let n=t;const i=e.x,r=e.y;let a,s=-1/0;if(km(e,n))return n;do{if(km(e,n.next))return n.next;if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){const e=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(e<=i&&e>s&&(s=e,a=n.x=n.x&&n.x>=l&&i!==n.x&&Fm(ra.x||n.x===a.x&&Bm(a,n)))&&(a=n,c=t)}n=n.next}while(n!==o);return a}(e,t);if(!n)return t;const i=Vm(n,e);return Am(i,i.next),Am(n,n.next)}function Bm(e,t){return Om(e.prev,e,t.prev)<0&&Om(t.next,e,e.next)<0}function Im(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Dm(e){let t=e,n=e;do{(t.x=(e-s)*(a-o)&&(e-s)*(i-o)>=(n-s)*(t-o)&&(n-s)*(a-o)>=(r-s)*(i-o)}function Lm(e,t,n,i,r,a,s,o){return!(e===s&&t===o)&&Fm(e,t,n,i,r,a,s,o)}function Nm(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Um(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&(Hm(e,t)&&Hm(t,e)&&function(e,t){let n=e,i=!1;const r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!==n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)&&(Om(e.prev,e,t.prev)||Om(e,t.prev,t))||km(e,t)&&Om(e.prev,e,e.next)>0&&Om(t.prev,t,t.next)>0)}function Om(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function km(e,t){return e.x===t.x&&e.y===t.y}function Um(e,t,n,i){const r=Gm(Om(e,t,n)),a=Gm(Om(e,t,i)),s=Gm(Om(n,i,e)),o=Gm(Om(n,i,t));return r!==a&&s!==o||(!(0!==r||!zm(e,n,t))||(!(0!==a||!zm(e,i,t))||(!(0!==s||!zm(n,e,i))||!(0!==o||!zm(n,t,i)))))}function zm(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function Gm(e){return e>0?1:e<0?-1:0}function Hm(e,t){return Om(e.prev,e,e.next)<0?Om(e,t,e.next)>=0&&Om(e,e.prev,t)>=0:Om(e,t,e.prev)<0||Om(e,e.next,t)<0}function Vm(e,t){const n=Xm(e.i,e.x,e.y),i=Xm(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function jm(e,t,n,i){const r=Xm(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function Wm(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Xm(e,t,n){return{i:e,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Jm{static triangulate(e,t){return xm(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:2)}}class Km{static area(e){const t=e.length;let n=0;for(let i=t-1,r=0;r2&&e[t-1].equals(e[0])&&e.pop()}function Ym(e,t){for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:new bm([new Ku(.5,.5),new Ku(-.5,.5),new Ku(-.5,-.5),new Ku(.5,-.5)]),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];const n=this,i=[],r=[];for(let s=0,o=e.length;sNumber.EPSILON){const h=Math.sqrt(c),d=Math.sqrt(l*l+u*u),p=t.x-o/h,f=t.y+s/h,m=((n.x-u/d-p)*u-(n.y+l/d-f)*l)/(s*u-o*l);i=p+s*m-e.x,r=f+o*m-e.y;const g=i*i+r*r;if(g<=2)return new Ku(i,r);a=Math.sqrt(g/2)}else{let e=!1;s>Number.EPSILON?l>Number.EPSILON&&(e=!0):s<-Number.EPSILON?l<-Number.EPSILON&&(e=!0):Math.sign(o)===Math.sign(u)&&(e=!0),e?(i=-o,r=s,a=Math.sqrt(c)):(i=s,r=o,a=Math.sqrt(c/2))}return new Ku(i/a,r/a)}const B=[];for(let t=0,n=T.length,i=n-1,r=t+1;t=0;t--){const e=t/p,n=c*Math.cos(e*Math.PI/2),i=h*Math.sin(e*Math.PI/2)+d;for(let t=0,r=T.length;t=0;){const i=n;let r=n-1;r<0&&(r=e.length-1);for(let e=0,n=o+2*p;e0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=(1+Math.sqrt(5))/2;super([-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],e,t),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new $m(e.radius,e.detail)}}class eg extends dd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[new Ku(0,-.5),new Ku(.5,0),new Ku(0,.5)],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;super(),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t),i=Hu(i,0,2*Math.PI);const r=[],a=[],s=[],o=[],l=[],u=1/t,c=new Yu,h=new Ku,d=new Yu,p=new Yu,f=new Yu;let m=0,g=0;for(let v=0;v<=e.length-1;v++)switch(v){case 0:m=e[v+1].x-e[v].x,g=e[v+1].y-e[v].y,d.x=1*g,d.y=-m,d.z=0*g,f.copy(d),d.normalize(),o.push(d.x,d.y,d.z);break;case e.length-1:o.push(f.x,f.y,f.z);break;default:m=e[v+1].x-e[v].x,g=e[v+1].y-e[v].y,d.x=1*g,d.y=-m,d.z=0*g,p.copy(d),d.x+=f.x,d.y+=f.y,d.z+=f.z,d.normalize(),o.push(d.x,d.y,d.z),f.copy(p)}for(let v=0;v<=t;v++){const r=n+v*u*i,d=Math.sin(r),p=Math.cos(r);for(let n=0;n<=e.length-1;n++){c.x=e[n].x*d,c.y=e[n].y,c.z=e[n].x*p,a.push(c.x,c.y,c.z),h.x=v/t,h.y=n/(e.length-1),s.push(h.x,h.y);const i=o[3*n+0]*d,r=o[3*n+1],u=o[3*n+0]*p;l.push(i,r,u)}}for(let v=0;v0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super([1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],e,t),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new tg(e.radius,e.detail)}}class ng extends dd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const r=e/2,a=t/2,s=Math.floor(n),o=Math.floor(i),l=s+1,u=o+1,c=e/s,h=t/o,d=[],p=[],f=[],m=[];for(let g=0;g0&&void 0!==arguments[0]?arguments[0]:.5,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:32,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2*Math.PI;super(),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},n=Math.max(3,n),i=Math.max(1,i);const s=[],o=[],l=[],u=[];let c=e;const h=(t-e)/i,d=new Yu,p=new Ku;for(let f=0;f<=i;f++){for(let e=0;e<=n;e++){const i=r+e/n*a;d.x=c*Math.cos(i),d.y=c*Math.sin(i),o.push(d.x,d.y,d.z),l.push(0,0,1),p.x=(d.x/t+1)/2,p.y=(d.y/t+1)/2,u.push(p.x,p.y)}c+=h}for(let f=0;f0&&void 0!==arguments[0]?arguments[0]:new bm([new Ku(0,.5),new Ku(-.5,-.5),new Ku(.5,-.5)]),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12;super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],r=[],a=[];let s=0,o=0;if(!1===Array.isArray(e))l(e);else for(let u=0;u0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:Math.PI;super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:s},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const o=Math.min(a+s,Math.PI);let l=0;const u=[],c=new Yu,h=new Yu,d=[],p=[],f=[],m=[];for(let g=0;g<=n;g++){const d=[],v=g/n;let y=0;0===g&&0===a?y=.5/t:g===n&&o===Math.PI&&(y=-.5/t);for(let n=0;n<=t;n++){const o=n/t;c.x=-e*Math.cos(i+o*r)*Math.sin(a+v*s),c.y=e*Math.cos(a+v*s),c.z=e*Math.sin(i+o*r)*Math.sin(a+v*s),p.push(c.x,c.y,c.z),h.copy(c).normalize(),f.push(h.x,h.y,h.z),m.push(o+y,1-v),d.push(l++)}u.push(d)}for(let g=0;g0)&&d.push(t,i,s),(g!==n-1||o0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super([1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],[2,1,0,0,3,2,1,3,0,2,3,1],e,t),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t}}static fromJSON(e){return new sg(e.radius,e.detail)}}class og extends dd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:12,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:48,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2*Math.PI,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:2*Math.PI;super(),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r,thetaStart:a,thetaLength:s},n=Math.floor(n),i=Math.floor(i);const o=[],l=[],u=[],c=[],h=new Yu,d=new Yu,p=new Yu;for(let f=0;f<=n;f++){const o=a+f/n*s;for(let a=0;a<=i;a++){const s=a/i*r;d.x=(e+t*Math.cos(o))*Math.cos(s),d.y=(e+t*Math.cos(o))*Math.sin(s),d.z=t*Math.sin(o),l.push(d.x,d.y,d.z),h.x=e*Math.cos(s),h.y=e*Math.sin(s),p.subVectors(d,h).normalize(),u.push(p.x,p.y,p.z),c.push(a/i),c.push(f/n)}}for(let f=1;f<=n;f++)for(let e=1;e<=i;e++){const t=(i+1)*f+e-1,n=(i+1)*(f-1)+e-1,r=(i+1)*(f-1)+e,a=(i+1)*f+e;o.push(t,n,a),o.push(n,r,a)}this.setIndex(o),this.setAttribute("position",new ed(l,3)),this.setAttribute("normal",new ed(u,3)),this.setAttribute("uv",new ed(c,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new og(e.radius,e.tube,e.radialSegments,e.tubularSegments,e.arc)}}class lg extends dd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.4,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:64,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:2,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:3;super(),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},n=Math.floor(n),i=Math.floor(i);const s=[],o=[],l=[],u=[],c=new Yu,h=new Yu,d=new Yu,p=new Yu,f=new Yu,m=new Yu,g=new Yu;for(let y=0;y<=n;++y){const s=y/n*r*Math.PI*2;v(s,r,a,e,d),v(s+.01,r,a,e,p),m.subVectors(p,d),g.addVectors(p,d),f.crossVectors(m,g),g.crossVectors(f,m),f.normalize(),g.normalize();for(let e=0;e<=i;++e){const r=e/i*Math.PI*2,a=-t*Math.cos(r),s=t*Math.sin(r);c.x=d.x+(a*g.x+s*f.x),c.y=d.y+(a*g.y+s*f.y),c.z=d.z+(a*g.z+s*f.z),o.push(c.x,c.y,c.z),h.subVectors(c,d).normalize(),l.push(h.x,h.y,h.z),u.push(y/n),u.push(e/i)}}for(let y=1;y<=n;y++)for(let e=1;e<=i;e++){const t=(i+1)*(y-1)+(e-1),n=(i+1)*y+(e-1),r=(i+1)*y+e,a=(i+1)*(y-1)+e;s.push(t,n,a),s.push(n,r,a)}function v(e,t,n,i,r){const a=Math.cos(e),s=Math.sin(e),o=n/t*e,l=Math.cos(o);r.x=i*(2+l)*.5*a,r.y=i*(2+l)*s*.5,r.z=i*Math.sin(o)*.5}this.setIndex(s),this.setAttribute("position",new ed(o,3)),this.setAttribute("normal",new ed(l,3)),this.setAttribute("uv",new ed(u,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new lg(e.radius,e.tube,e.tubularSegments,e.radialSegments,e.p,e.q)}}class ug extends dd{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new mm(new Yu(-1,-1,0),new Yu(-1,1,0),new Yu(1,1,0)),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8,r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];super(),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r};const a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;const s=new Yu,o=new Yu,l=new Ku;let u=new Yu;const c=[],h=[],d=[],p=[];function f(r){u=e.getPointAt(r/t,u);const l=a.normals[r],d=a.binormals[r];for(let e=0;e<=i;e++){const t=e/i*Math.PI*2,r=Math.sin(t),a=-Math.cos(t);o.x=a*l.x+r*d.x,o.y=a*l.y+r*d.y,o.z=a*l.z+r*d.z,o.normalize(),h.push(o.x,o.y,o.z),s.x=u.x+n*o.x,s.y=u.y+n*o.y,s.z=u.z+n*o.z,c.push(s.x,s.y,s.z)}}!function(){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:null;if(super(),this.type="WireframeGeometry",this.parameters={geometry:e},null!==e){const t=[],n=new Set,i=new Yu,r=new Yu;if(null!==e.index){const a=e.attributes.position,s=e.index;let o=e.groups;0===o.length&&(o=[{start:0,count:s.count,materialIndex:0}]);for(let e=0,l=o.length;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)!0===this.extensions[i]&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class bg extends _g{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class xg extends yd{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new ih(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ih(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ml,this.normalScale=new Ku(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ic,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Sg extends xg{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ku(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Hu(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new ih(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new ih(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new ih(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!==e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!==e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!==e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!==e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!==e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!==e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class Ag extends yd{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ih(16777215),this.specular=new ih(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ih(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ml,this.normalScale=new Ku(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ic,this.combine=bs,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Mg extends yd{constructor(e){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new ih(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ih(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ml,this.normalScale=new Ku(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.gradientMap=e.gradientMap,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}class wg extends yd{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ml,this.normalScale=new Ku(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Eg extends yd{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ih(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ih(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ml,this.normalScale=new Ku(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Ic,this.combine=bs,this.reflectivity=1,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Tg extends yd{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=bl,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Cg extends yd{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}class Rg extends yd{constructor(e){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ih(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ml,this.normalScale=new Ku(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Pg extends sf{constructor(e){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}copy(e){return super.copy(e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this}}function Bg(e,t){return e&&e.constructor!==t?"number"===typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e):e}function Ig(e){const t=e.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(function(t,n){return e[t]-e[n]}),n}function Dg(e,t,n){const i=e.length,r=new e.constructor(i);for(let a=0,s=0;s!==i;++a){const i=n[a]*t;for(let n=0;n!==t;++n)r[s++]=e[i+n]}return r}function Fg(e,t,n,i){let r=1,a=e[0];for(;void 0!==a&&void 0===a[i];)a=e[r++];if(void 0===a)return;let s=a[i];if(void 0!==s)if(Array.isArray(s))do{s=a[i],void 0!==s&&(t.push(a.time),n.push(...s)),a=e[r++]}while(void 0!==a);else if(void 0!==s.toArray)do{s=a[i],void 0!==s&&(t.push(a.time),s.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{s=a[i],void 0!==s&&(t.push(a.time),n.push(s)),a=e[r++]}while(void 0!==a)}class Lg{static convertArray(e,t){return Bg(e,t)}static isTypedArray(e){return Au(e)}static getKeyframeOrder(e){return Ig(e)}static sortedArray(e,t,n){return Dg(e,t,n)}static flattenJSON(e,t,n,i){Fg(e,t,n,i)}static subclip(e,t,n,i){return function(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:30;const a=e.clone();a.name=t;const s=[];for(let l=0;l=i)){o.push(e.times[a]);for(let n=0;na.tracks[l].times[0]&&(o=a.tracks[l].times[0]);for(let l=0;l4&&void 0!==arguments[4]?arguments[4]:30)}static makeClipAdditive(e){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:30;i<=0&&(i=30);const r=n.tracks.length,a=t/i;for(let s=0;s=t.times[h]){const e=h*l+o,n=e+l-o;d=t.values.slice(e,n)}else{const e=t.createInterpolant(),n=o,i=l-o;e.evaluate(a),d=e.resultBuffer.slice(n,i)}"quaternion"===i&&(new qu).fromArray(d).normalize().conjugate().toArray(d);const p=r.times.length;for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,arguments.length>3&&void 0!==arguments[3]?arguments[3]:30)}}class Ng{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=void 0!==i?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{let a;n:{i:if(!(e=r)){const s=t[1];e=r)break t}a=n,n=0;break n}break e}for(;n>>1;et;)--a;if(++a,0!==r||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);const e=this.getValueSize();this.times=n.slice(r,a),this.values=this.values.slice(r*e,a*e)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Du("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,r=n.length;0===r&&(Du("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let s=0;s!==r;s++){const t=n[s];if("number"===typeof t&&isNaN(t)){Du("KeyframeTrack: Time is not a valid number.",this,s,t),e=!1;break}if(null!==a&&a>t){Du("KeyframeTrack: Out of order keys.",this,s,t,a),e=!1;break}a=t}if(void 0!==i&&Au(i))for(let s=0,o=i.length;s!==o;++s){const t=i[s];if(isNaN(t)){Du("KeyframeTrack: Value is not a valid number.",this,s,t),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===cl,r=e.length-1;let a=1;for(let s=1;s0){e[a]=e[r];for(let e=r*n,i=a*n,s=0;s!==n;++s)t[i+s]=t[e+s];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}Gg.prototype.ValueTypeName="",Gg.prototype.TimeBufferType=Float32Array,Gg.prototype.ValueBufferType=Float32Array,Gg.prototype.DefaultInterpolation=ul;class Hg extends Gg{constructor(e,t,n){super(e,t,n)}}Hg.prototype.ValueTypeName="bool",Hg.prototype.ValueBufferType=Array,Hg.prototype.DefaultInterpolation=ll,Hg.prototype.InterpolantFactoryMethodLinear=void 0,Hg.prototype.InterpolantFactoryMethodSmooth=void 0;class Vg extends Gg{constructor(e,t,n,i){super(e,t,n,i)}}Vg.prototype.ValueTypeName="color";class jg extends Gg{constructor(e,t,n,i){super(e,t,n,i)}}jg.prototype.ValueTypeName="number";class Wg extends Ng{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const r=this.resultBuffer,a=this.sampleValues,s=this.valueSize,o=(n-t)/(i-t);let l=e*s;for(let u=l+s;l!==u;l+=4)qu.slerpFlat(r,0,a,l-s,a,l,o);return r}}class Xg extends Gg{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new Wg(this.times,this.values,this.getValueSize(),e)}}Xg.prototype.ValueTypeName="quaternion",Xg.prototype.InterpolantFactoryMethodSmooth=void 0;class Jg extends Gg{constructor(e,t,n){super(e,t,n)}}Jg.prototype.ValueTypeName="string",Jg.prototype.ValueBufferType=Array,Jg.prototype.DefaultInterpolation=ll,Jg.prototype.InterpolantFactoryMethodLinear=void 0,Jg.prototype.InterpolantFactoryMethodSmooth=void 0;class Kg extends Gg{constructor(e,t,n,i){super(e,t,n,i)}}Kg.prototype.ValueTypeName="vector";class qg{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ml;this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Gu(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,s=n.length;a!==s;++a)t.push(Yg(n[a]).scale(i));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r.userData=JSON.parse(e.userData||"{}"),r}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let r=0,a=n.length;r!==a;++r)t.push(Gg.toJSON(n[r]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const r=t.length,a=[];for(let s=0;s1){const e=n[1];let r=i[e];r||(i[e]=r=[]),r.push(t)}}const a=[];for(const s in i)a.push(this.CreateFromMorphTargetSequence(s,i[s],t,n));return a}static parseAnimation(e,t){if(Iu("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Du("AnimationClip: No animation in JSONLoader data."),null;const n=function(e,t,n,i,r){if(0!==n.length){const a=[],s=[];Fg(n,a,s,i),0!==a.length&&r.push(new e(t,a,s))}},i=[],r=e.name||"default",a=e.fps||30,s=e.blendMode;let o=e.length||-1;const l=e.hierarchy||[];for(let u=0;u{t&&t(r),this.manager.itemEnd(e)},0);if(void 0!==nv[e])return void nv[e].push({onLoad:t,onProgress:n,onError:i});nv[e]=[],nv[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"===typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),s=this.mimeType,o=this.responseType;fetch(a).then(t=>{if(200===t.status||0===t.status){if(0===t.status&&Iu("FileLoader: HTTP Status 0 received."),"undefined"===typeof ReadableStream||void 0===t.body||void 0===t.body.getReader)return t;const n=nv[e],i=t.body.getReader(),r=t.headers.get("X-File-Size")||t.headers.get("Content-Length"),a=r?parseInt(r):0,s=0!==a;let o=0;const l=new ReadableStream({start(e){!function t(){i.read().then(i=>{let r=i.done,l=i.value;if(r)e.close();else{o+=l.byteLength;const i=new ProgressEvent("progress",{lengthComputable:s,loaded:o,total:a});for(let e=0,t=n.length;e{e.error(t)})}()}});return new Response(l)}throw new iv('fetch for "'.concat(t.url,'" responded with ').concat(t.status,": ").concat(t.statusText),t)}).then(e=>{switch(o){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"document":return e.text().then(e=>(new DOMParser).parseFromString(e,s));case"json":return e.json();default:if(""===s)return e.text();{const t=/charset="?([^;"\s]*)"?/i.exec(s),n=t&&t[1]?t[1].toLowerCase():void 0,i=new TextDecoder(n);return e.arrayBuffer().then(e=>i.decode(e))}}}).then(t=>{Qg.add("file:".concat(e),t);const n=nv[e];delete nv[e];for(let e=0,i=n.length;e{const n=nv[e];if(void 0===n)throw this.manager.itemError(e),t;delete nv[e];for(let e=0,i=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class av extends tv{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new rv(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(a){i?i(a):Du(a),r.manager.itemError(e)}},n,i)}parse(e){const t=[];for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:1;super(),this.isLight=!0,this.type="Light",this.color=new ih(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}class pv extends dv{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(qc.DEFAULT_UP),this.updateMatrix(),this.groundColor=new ih(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}toJSON(e){const t=super.toJSON(e);return t.object.groundColor=this.groundColor.getHex(),t}}const fv=new Sc,mv=new Yu,gv=new Yu;class vv{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ku(512,512),this.mapType=Zs,this.map=null,this.mapPass=null,this.matrix=new Sc,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Np,this._frameExtents=new Ku(1,1),this._viewportCount=1,this._viewports=[new mc(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;mv.setFromMatrixPosition(e.matrixWorld),t.position.copy(mv),gv.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(gv),t.updateMatrixWorld(),fv.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fv,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===gu||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(fv)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return(new this.constructor).copy(this)}toJSON(){const e={};return 1!==this.intensity&&(e.intensity=this.intensity),0!==this.bias&&(e.bias=this.bias),0!==this.normalBias&&(e.normalBias=this.normalBias),1!==this.radius&&(e.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const yv=new Yu,_v=new qu,bv=new Yu;class xv extends qc{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Sc,this.projectionMatrix=new Sc,this.projectionMatrixInverse=new Sc,this.coordinateSystem=mu,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(yv,_v,bv),1===bv.x&&1===bv.y&&1===bv.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(yv,_v,bv.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(yv,_v,bv),1===bv.x&&1===bv.y&&1===bv.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(yv,_v,bv.set(1,1,1)).invert()}clone(){return(new this.constructor).copy(this)}}const Sv=new Yu,Av=new Ku,Mv=new Ku;class wv extends xv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:50,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2e3;super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=null===e.view?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=2*zu*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(.5*Uu*this.fov);return.5*this.getFilmHeight()/e}getEffectiveFOV(){return 2*zu*Math.atan(Math.tan(.5*Uu*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){Sv.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Sv.x,Sv.y).multiplyScalar(-e/Sv.z),Sv.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(Sv.x,Sv.y).multiplyScalar(-e/Sv.z)}getViewSize(e,t){return this.getViewBounds(e,Av,Mv),t.subVectors(Mv,Av)}setViewOffset(e,t,n,i,r,a){this.aspect=e/t,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(.5*Uu*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i;const a=this.view;if(null!==this.view&&this.view.enabled){const e=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/e,t-=a.offsetY*n/s,i*=a.width/e,n*=a.height/s}const s=this.filmOffset;0!==s&&(r+=e*s/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,null!==this.view&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class Ev extends vv{constructor(){super(new wv(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=2*zu*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,r=e.distance||t.far;n===t.fov&&i===t.aspect&&r===t.far||(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Tv extends dv{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Math.PI/3,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2;super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(qc.DEFAULT_UP),this.updateMatrix(),this.target=new qc,this.distance=n,this.angle=i,this.penumbra=r,this.decay=a,this.map=null,this.shadow=new Ev}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class Cv extends vv{constructor(){super(new wv(90,1,.5,500)),this.isPointLightShadow=!0}}class Rv extends dv{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2;super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Cv}get power(){return 4*this.intensity*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class Pv extends xv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.1,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:2e3;super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=r,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=null===e.view?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,r,a){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let r=n-e,a=n+e,s=i+t,o=i-t;if(null!==this.view&&this.view.enabled){const e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=e*this.view.offsetX,a=r+e*this.view.width,s-=t*this.view.offsetY,o=s-t*this.view.height}this.projectionMatrix.makeOrthographic(r,a,s,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,null!==this.view&&(t.object.view=Object.assign({},this.view)),t}}class Bv extends vv{constructor(){super(new Pv(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Iv extends dv{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(qc.DEFAULT_UP),this.updateMatrix(),this.target=new qc,this.shadow=new Bv}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class Dv extends dv{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class Fv extends dv{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10;super(e,t),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=n,this.height=i}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class Lv{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new Yu)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*r),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],n*i*1.092548),t.addScaledVector(a[5],i*r*1.092548),t.addScaledVector(a[6],.315392*(3*r*r-1)),t.addScaledVector(a[7],n*r*1.092548),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],1.023328*i),t.addScaledVector(a[2],1.023328*r),t.addScaledVector(a[3],1.023328*n),t.addScaledVector(a[4],.858086*n*i),t.addScaledVector(a[5],.858086*i*r),t.addScaledVector(a[6],.743125*r*r-.247708),t.addScaledVector(a[7],.858086*n*r),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+3*i);return this}toArray(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+3*i);return e}static getBasisAt(e,t){const n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}}class Nv extends dv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Lv;super(void 0,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class Ov extends tv{constructor(e){super(e),this.textures={}}load(e,t,n,i){const r=this,a=new rv(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(a){i?i(a):Du(a),r.manager.itemError(e)}},n,i)}parse(e){const t=this.textures;function n(e){return void 0===t[e]&&Iu("MaterialLoader: Undefined texture",e),t[e]}const i=this.createMaterialFromType(e.type);if(void 0!==e.uuid&&(i.uuid=e.uuid),void 0!==e.name&&(i.name=e.name),void 0!==e.color&&void 0!==i.color&&i.color.setHex(e.color),void 0!==e.roughness&&(i.roughness=e.roughness),void 0!==e.metalness&&(i.metalness=e.metalness),void 0!==e.sheen&&(i.sheen=e.sheen),void 0!==e.sheenColor&&(i.sheenColor=(new ih).setHex(e.sheenColor)),void 0!==e.sheenRoughness&&(i.sheenRoughness=e.sheenRoughness),void 0!==e.emissive&&void 0!==i.emissive&&i.emissive.setHex(e.emissive),void 0!==e.specular&&void 0!==i.specular&&i.specular.setHex(e.specular),void 0!==e.specularIntensity&&(i.specularIntensity=e.specularIntensity),void 0!==e.specularColor&&void 0!==i.specularColor&&i.specularColor.setHex(e.specularColor),void 0!==e.shininess&&(i.shininess=e.shininess),void 0!==e.clearcoat&&(i.clearcoat=e.clearcoat),void 0!==e.clearcoatRoughness&&(i.clearcoatRoughness=e.clearcoatRoughness),void 0!==e.dispersion&&(i.dispersion=e.dispersion),void 0!==e.iridescence&&(i.iridescence=e.iridescence),void 0!==e.iridescenceIOR&&(i.iridescenceIOR=e.iridescenceIOR),void 0!==e.iridescenceThicknessRange&&(i.iridescenceThicknessRange=e.iridescenceThicknessRange),void 0!==e.transmission&&(i.transmission=e.transmission),void 0!==e.thickness&&(i.thickness=e.thickness),void 0!==e.attenuationDistance&&(i.attenuationDistance=e.attenuationDistance),void 0!==e.attenuationColor&&void 0!==i.attenuationColor&&i.attenuationColor.setHex(e.attenuationColor),void 0!==e.anisotropy&&(i.anisotropy=e.anisotropy),void 0!==e.anisotropyRotation&&(i.anisotropyRotation=e.anisotropyRotation),void 0!==e.fog&&(i.fog=e.fog),void 0!==e.flatShading&&(i.flatShading=e.flatShading),void 0!==e.blending&&(i.blending=e.blending),void 0!==e.combine&&(i.combine=e.combine),void 0!==e.side&&(i.side=e.side),void 0!==e.shadowSide&&(i.shadowSide=e.shadowSide),void 0!==e.opacity&&(i.opacity=e.opacity),void 0!==e.transparent&&(i.transparent=e.transparent),void 0!==e.alphaTest&&(i.alphaTest=e.alphaTest),void 0!==e.alphaHash&&(i.alphaHash=e.alphaHash),void 0!==e.depthFunc&&(i.depthFunc=e.depthFunc),void 0!==e.depthTest&&(i.depthTest=e.depthTest),void 0!==e.depthWrite&&(i.depthWrite=e.depthWrite),void 0!==e.colorWrite&&(i.colorWrite=e.colorWrite),void 0!==e.blendSrc&&(i.blendSrc=e.blendSrc),void 0!==e.blendDst&&(i.blendDst=e.blendDst),void 0!==e.blendEquation&&(i.blendEquation=e.blendEquation),void 0!==e.blendSrcAlpha&&(i.blendSrcAlpha=e.blendSrcAlpha),void 0!==e.blendDstAlpha&&(i.blendDstAlpha=e.blendDstAlpha),void 0!==e.blendEquationAlpha&&(i.blendEquationAlpha=e.blendEquationAlpha),void 0!==e.blendColor&&void 0!==i.blendColor&&i.blendColor.setHex(e.blendColor),void 0!==e.blendAlpha&&(i.blendAlpha=e.blendAlpha),void 0!==e.stencilWriteMask&&(i.stencilWriteMask=e.stencilWriteMask),void 0!==e.stencilFunc&&(i.stencilFunc=e.stencilFunc),void 0!==e.stencilRef&&(i.stencilRef=e.stencilRef),void 0!==e.stencilFuncMask&&(i.stencilFuncMask=e.stencilFuncMask),void 0!==e.stencilFail&&(i.stencilFail=e.stencilFail),void 0!==e.stencilZFail&&(i.stencilZFail=e.stencilZFail),void 0!==e.stencilZPass&&(i.stencilZPass=e.stencilZPass),void 0!==e.stencilWrite&&(i.stencilWrite=e.stencilWrite),void 0!==e.wireframe&&(i.wireframe=e.wireframe),void 0!==e.wireframeLinewidth&&(i.wireframeLinewidth=e.wireframeLinewidth),void 0!==e.wireframeLinecap&&(i.wireframeLinecap=e.wireframeLinecap),void 0!==e.wireframeLinejoin&&(i.wireframeLinejoin=e.wireframeLinejoin),void 0!==e.rotation&&(i.rotation=e.rotation),void 0!==e.linewidth&&(i.linewidth=e.linewidth),void 0!==e.dashSize&&(i.dashSize=e.dashSize),void 0!==e.gapSize&&(i.gapSize=e.gapSize),void 0!==e.scale&&(i.scale=e.scale),void 0!==e.polygonOffset&&(i.polygonOffset=e.polygonOffset),void 0!==e.polygonOffsetFactor&&(i.polygonOffsetFactor=e.polygonOffsetFactor),void 0!==e.polygonOffsetUnits&&(i.polygonOffsetUnits=e.polygonOffsetUnits),void 0!==e.dithering&&(i.dithering=e.dithering),void 0!==e.alphaToCoverage&&(i.alphaToCoverage=e.alphaToCoverage),void 0!==e.premultipliedAlpha&&(i.premultipliedAlpha=e.premultipliedAlpha),void 0!==e.forceSinglePass&&(i.forceSinglePass=e.forceSinglePass),void 0!==e.allowOverride&&(i.allowOverride=e.allowOverride),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.toneMapped&&(i.toneMapped=e.toneMapped),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.vertexColors&&("number"===typeof e.vertexColors?i.vertexColors=e.vertexColors>0:i.vertexColors=e.vertexColors),void 0!==e.uniforms)for(const r in e.uniforms){const t=e.uniforms[r];switch(i.uniforms[r]={},t.type){case"t":i.uniforms[r].value=n(t.value);break;case"c":i.uniforms[r].value=(new ih).setHex(t.value);break;case"v2":i.uniforms[r].value=(new Ku).fromArray(t.value);break;case"v3":i.uniforms[r].value=(new Yu).fromArray(t.value);break;case"v4":i.uniforms[r].value=(new mc).fromArray(t.value);break;case"m3":i.uniforms[r].value=(new $u).fromArray(t.value);break;case"m4":i.uniforms[r].value=(new Sc).fromArray(t.value);break;default:i.uniforms[r].value=t.value}}if(void 0!==e.defines&&(i.defines=e.defines),void 0!==e.vertexShader&&(i.vertexShader=e.vertexShader),void 0!==e.fragmentShader&&(i.fragmentShader=e.fragmentShader),void 0!==e.glslVersion&&(i.glslVersion=e.glslVersion),void 0!==e.extensions)for(const r in e.extensions)i.extensions[r]=e.extensions[r];if(void 0!==e.lights&&(i.lights=e.lights),void 0!==e.clipping&&(i.clipping=e.clipping),void 0!==e.size&&(i.size=e.size),void 0!==e.sizeAttenuation&&(i.sizeAttenuation=e.sizeAttenuation),void 0!==e.map&&(i.map=n(e.map)),void 0!==e.matcap&&(i.matcap=n(e.matcap)),void 0!==e.alphaMap&&(i.alphaMap=n(e.alphaMap)),void 0!==e.bumpMap&&(i.bumpMap=n(e.bumpMap)),void 0!==e.bumpScale&&(i.bumpScale=e.bumpScale),void 0!==e.normalMap&&(i.normalMap=n(e.normalMap)),void 0!==e.normalMapType&&(i.normalMapType=e.normalMapType),void 0!==e.normalScale){let t=e.normalScale;!1===Array.isArray(t)&&(t=[t,t]),i.normalScale=(new Ku).fromArray(t)}return void 0!==e.displacementMap&&(i.displacementMap=n(e.displacementMap)),void 0!==e.displacementScale&&(i.displacementScale=e.displacementScale),void 0!==e.displacementBias&&(i.displacementBias=e.displacementBias),void 0!==e.roughnessMap&&(i.roughnessMap=n(e.roughnessMap)),void 0!==e.metalnessMap&&(i.metalnessMap=n(e.metalnessMap)),void 0!==e.emissiveMap&&(i.emissiveMap=n(e.emissiveMap)),void 0!==e.emissiveIntensity&&(i.emissiveIntensity=e.emissiveIntensity),void 0!==e.specularMap&&(i.specularMap=n(e.specularMap)),void 0!==e.specularIntensityMap&&(i.specularIntensityMap=n(e.specularIntensityMap)),void 0!==e.specularColorMap&&(i.specularColorMap=n(e.specularColorMap)),void 0!==e.envMap&&(i.envMap=n(e.envMap)),void 0!==e.envMapRotation&&i.envMapRotation.fromArray(e.envMapRotation),void 0!==e.envMapIntensity&&(i.envMapIntensity=e.envMapIntensity),void 0!==e.reflectivity&&(i.reflectivity=e.reflectivity),void 0!==e.refractionRatio&&(i.refractionRatio=e.refractionRatio),void 0!==e.lightMap&&(i.lightMap=n(e.lightMap)),void 0!==e.lightMapIntensity&&(i.lightMapIntensity=e.lightMapIntensity),void 0!==e.aoMap&&(i.aoMap=n(e.aoMap)),void 0!==e.aoMapIntensity&&(i.aoMapIntensity=e.aoMapIntensity),void 0!==e.gradientMap&&(i.gradientMap=n(e.gradientMap)),void 0!==e.clearcoatMap&&(i.clearcoatMap=n(e.clearcoatMap)),void 0!==e.clearcoatRoughnessMap&&(i.clearcoatRoughnessMap=n(e.clearcoatRoughnessMap)),void 0!==e.clearcoatNormalMap&&(i.clearcoatNormalMap=n(e.clearcoatNormalMap)),void 0!==e.clearcoatNormalScale&&(i.clearcoatNormalScale=(new Ku).fromArray(e.clearcoatNormalScale)),void 0!==e.iridescenceMap&&(i.iridescenceMap=n(e.iridescenceMap)),void 0!==e.iridescenceThicknessMap&&(i.iridescenceThicknessMap=n(e.iridescenceThicknessMap)),void 0!==e.transmissionMap&&(i.transmissionMap=n(e.transmissionMap)),void 0!==e.thicknessMap&&(i.thicknessMap=n(e.thicknessMap)),void 0!==e.anisotropyMap&&(i.anisotropyMap=n(e.anisotropyMap)),void 0!==e.sheenColorMap&&(i.sheenColorMap=n(e.sheenColorMap)),void 0!==e.sheenRoughnessMap&&(i.sheenRoughnessMap=n(e.sheenRoughnessMap)),i}setTextures(e){return this.textures=e,this}createMaterialFromType(e){return Ov.createMaterialFromType(e)}static createMaterialFromType(e){return new{ShadowMaterial:pg,SpriteMaterial:_d,RawShaderMaterial:bg,ShaderMaterial:_g,PointsMaterial:bf,MeshPhysicalMaterial:Sg,MeshStandardMaterial:xg,MeshPhongMaterial:Ag,MeshToonMaterial:Mg,MeshNormalMaterial:wg,MeshLambertMaterial:Eg,MeshDepthMaterial:Tg,MeshDistanceMaterial:Cg,MeshBasicMaterial:Wd,MeshMatcapMaterial:Rg,LineDashedMaterial:Pg,LineBasicMaterial:sf,Material:yd}[e]}}class kv{static extractUrlBase(e){const t=e.lastIndexOf("/");return-1===t?"./":e.slice(0,t+1)}static resolveURL(e,t){return"string"!==typeof e||""===e?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}class Uv extends dd{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(e){return super.copy(e),this.instanceCount=e.instanceCount,this}toJSON(){const e=super.toJSON();return e.instanceCount=this.instanceCount,e.isInstancedBufferGeometry=!0,e}}class zv extends tv{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new rv(r.manager);a.setPath(r.path),a.setRequestHeader(r.requestHeader),a.setWithCredentials(r.withCredentials),a.load(e,function(n){try{t(r.parse(JSON.parse(n)))}catch(a){i?i(a):Du(a),r.manager.itemError(e)}},n,i)}parse(e){const t={},n={};function i(e,i){if(void 0!==t[i])return t[i];const r=e.interleavedBuffers[i],a=function(e,t){if(void 0!==n[t])return n[t];const i=e.arrayBuffers,r=i[t],a=new Uint32Array(r).buffer;return n[t]=a,a}(e,r.buffer),s=Su(r.type,a),o=new pd(s,r.stride);return o.uuid=r.uuid,t[i]=o,o}const r=e.isInstancedBufferGeometry?new Uv:new dd,a=e.data.index;if(void 0!==a){const e=Su(a.type,a.array);r.setIndex(new Wh(e,1))}const s=e.data.attributes;for(const c in s){const t=s[c];let n;if(t.isInterleavedBufferAttribute){const r=i(e.data,t.data);n=new md(r,t.itemSize,t.offset,t.normalized)}else{const e=Su(t.type,t.array);n=new(t.isInstancedBufferAttribute?bp:Wh)(e,t.itemSize,t.normalized)}void 0!==t.name&&(n.name=t.name),void 0!==t.usage&&n.setUsage(t.usage),r.setAttribute(c,n)}const o=e.data.morphAttributes;if(o)for(const c in o){const t=o[c],n=[];for(let r=0,a=t.length;r0){const n=new $g(t);r=new lv(n),r.setCrossOrigin(this.crossOrigin);for(let t=0,r=e.length;t0){i=new lv(this.manager),i.setCrossOrigin(this.crossOrigin);for(let t=0,i=e.length;t{let t=null,n=null;return void 0!==e.boundingBox&&(t=(new Sh).fromJSON(e.boundingBox)),void 0!==e.boundingSphere&&(n=(new rd).fromJSON(e.boundingSphere)),h(h({},e),{},{boundingBox:t,boundingSphere:n})}),a._instanceInfo=e.instanceInfo,a._availableInstanceIds=e._availableInstanceIds,a._availableGeometryIds=e._availableGeometryIds,a._nextIndexStart=e.nextIndexStart,a._nextVertexStart=e.nextVertexStart,a._geometryCount=e.geometryCount,a._maxInstanceCount=e.maxInstanceCount,a._maxVertexCount=e.maxVertexCount,a._maxIndexCount=e.maxIndexCount,a._geometryInitialized=e.geometryInitialized,a._matricesTexture=c(e.matricesTexture.uuid),a._indirectTexture=c(e.indirectTexture.uuid),void 0!==e.colorsTexture&&(a._colorsTexture=c(e.colorsTexture.uuid)),void 0!==e.boundingSphere&&(a.boundingSphere=(new rd).fromJSON(e.boundingSphere)),void 0!==e.boundingBox&&(a.boundingBox=(new Sh).fromJSON(e.boundingBox));break;case"LOD":a=new Nd;break;case"Line":a=new ff(l(e.geometry),u(e.material));break;case"LineLoop":a=new _f(l(e.geometry),u(e.material));break;case"LineSegments":a=new yf(l(e.geometry),u(e.material));break;case"PointCloud":case"Points":a=new wf(l(e.geometry),u(e.material));break;case"Sprite":a=new Id(u(e.material));break;case"Group":a=new Yc;break;case"Bone":a=new mp;break;default:a=new qc}if(a.uuid=e.uuid,void 0!==e.name&&(a.name=e.name),void 0!==e.matrix?(a.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(a.matrixAutoUpdate=e.matrixAutoUpdate),a.matrixAutoUpdate&&a.matrix.decompose(a.position,a.quaternion,a.scale)):(void 0!==e.position&&a.position.fromArray(e.position),void 0!==e.rotation&&a.rotation.fromArray(e.rotation),void 0!==e.quaternion&&a.quaternion.fromArray(e.quaternion),void 0!==e.scale&&a.scale.fromArray(e.scale)),void 0!==e.up&&a.up.fromArray(e.up),void 0!==e.pivot&&(a.pivot=(new Yu).fromArray(e.pivot)),void 0!==e.morphTargetDictionary&&(a.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),void 0!==e.morphTargetInfluences&&(a.morphTargetInfluences=e.morphTargetInfluences.slice()),void 0!==e.castShadow&&(a.castShadow=e.castShadow),void 0!==e.receiveShadow&&(a.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.intensity&&(a.shadow.intensity=e.shadow.intensity),void 0!==e.shadow.bias&&(a.shadow.bias=e.shadow.bias),void 0!==e.shadow.normalBias&&(a.shadow.normalBias=e.shadow.normalBias),void 0!==e.shadow.radius&&(a.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&a.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(a.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(a.visible=e.visible),void 0!==e.frustumCulled&&(a.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(a.renderOrder=e.renderOrder),void 0!==e.static&&(a.static=e.static),void 0!==e.userData&&(a.userData=e.userData),void 0!==e.layers&&(a.layers.mask=e.layers),void 0!==e.children){const s=e.children;for(let e=0;e{!0===Xv.has(a)?(i&&i(Xv.get(a)),r.manager.itemError(e),r.manager.itemEnd(e)):(t&&t(n),r.manager.itemEnd(e))}):void setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0);const s={};s.credentials="anonymous"===this.crossOrigin?"same-origin":"include",s.headers=this.requestHeader,s.signal="function"===typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const o=fetch(e,s).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(n){Qg.add("image-bitmap:".concat(e),n),t&&t(n),r.manager.itemEnd(e)}).catch(function(t){i&&i(t),Xv.set(o,t),Qg.remove("image-bitmap:".concat(e)),r.manager.itemError(e),r.manager.itemEnd(e)});Qg.add("image-bitmap:".concat(e),o),r.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let Kv;class qv{static getContext(){return void 0===Kv&&(Kv=new(window.AudioContext||window.webkitAudioContext)),Kv}static setContext(e){Kv=e}}class Yv extends tv{constructor(e){super(e)}load(e,t,n,i){const r=this,a=new rv(this.manager);function s(t){i?i(t):Du(t),r.manager.itemError(e)}a.setResponseType("arraybuffer"),a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(e,function(n){try{const i=n.slice(0),a=qv.getContext(),o=e+"#decode";r.manager.itemStart(o),a.decodeAudioData(i,function(e){t(e),r.manager.itemEnd(o)}).catch(function(e){s(e),r.manager.itemEnd(o)})}catch(i){s(i)}},n,i)}}const Qv=new Sc,Zv=new Sc,$v=new Sc;class ey{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new wv,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new wv,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(e){const t=this._cache;if(t.focus!==e.focus||t.fov!==e.fov||t.aspect!==e.aspect*this.aspect||t.near!==e.near||t.far!==e.far||t.zoom!==e.zoom||t.eyeSep!==this.eyeSep){t.focus=e.focus,t.fov=e.fov,t.aspect=e.aspect*this.aspect,t.near=e.near,t.far=e.far,t.zoom=e.zoom,t.eyeSep=this.eyeSep,$v.copy(e.projectionMatrix);const n=t.eyeSep/2,i=n*t.near/t.focus,r=t.near*Math.tan(Uu*t.fov*.5)/t.zoom;let a,s;Zv.elements[12]=-n,Qv.elements[12]=n,a=-r*t.aspect+i,s=r*t.aspect+i,$v.elements[0]=2*t.near/(s-a),$v.elements[8]=(s+a)/(s-a),this.cameraL.projectionMatrix.copy($v),a=-r*t.aspect-i,s=r*t.aspect-i,$v.elements[0]=2*t.near/(s-a),$v.elements[8]=(s+a)/(s-a),this.cameraR.projectionMatrix.copy($v)}this.cameraL.matrixWorld.copy(e.matrixWorld).multiply(Zv),this.cameraR.matrixWorld.copy(e.matrixWorld).multiply(Qv)}}const ty=-90;class ny extends qc{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new wv(ty,1,e,t);i.layers=this.layers,this.add(i);const r=new wv(ty,1,e,t);r.layers=this.layers,this.add(r);const a=new wv(ty,1,e,t);a.layers=this.layers,this.add(a);const s=new wv(ty,1,e,t);s.layers=this.layers,this.add(s);const o=new wv(ty,1,e,t);o.layers=this.layers,this.add(o);const l=new wv(ty,1,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),n=Ma(t,6),i=n[0],r=n[1],a=n[2],s=n[3],o=n[4],l=n[5];for(const u of t)this.remove(u);if(e===mu)i.up.set(0,1,0),i.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),a.up.set(0,0,-1),a.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else{if(e!==gu)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);i.up.set(0,-1,0),i.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),a.up.set(0,0,1),a.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1)}for(const u of t)this.add(u),u.updateMatrixWorld()}update(e,t){null===this.parent&&this.updateMatrixWorld();const n=this.renderTarget,i=this.activeMipmapLevel;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const r=Ma(this.children,6),a=r[0],s=r[1],o=r[2],l=r[3],u=r[4],c=r[5],h=e.getRenderTarget(),d=e.getActiveCubeFace(),p=e.getActiveMipmapLevel(),f=e.xr.enabled;e.xr.enabled=!1;const m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let g=!1;g=!0===e.isWebGLRenderer?e.state.buffers.depth.getReversed():e.reversedDepthBuffer,e.setRenderTarget(n,0,i),g&&!1===e.autoClear&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,1,i),g&&!1===e.autoClear&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,2,i),g&&!1===e.autoClear&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,i),g&&!1===e.autoClear&&e.clearDepth(),e.render(t,l),e.setRenderTarget(n,4,i),g&&!1===e.autoClear&&e.clearDepth(),e.render(t,u),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,i),g&&!1===e.autoClear&&e.clearDepth(),e.render(t,c),e.setRenderTarget(h,d,p),e.xr.enabled=f,n.texture.needsPMREMUpdate=!0}}class iy extends wv{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class ry{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(e){this._document=e,void 0!==e.hidden&&(this._pageVisibilityHandler=ay.bind(this),e.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){null!==this._pageVisibilityHandler&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(e){return this._timescale=e,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(e){return null!==this._pageVisibilityHandler&&!0===this._document.hidden?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(void 0!==e?e:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function ay(){!1===this._document.hidden&&this.reset()}const sy=new Yu,oy=new qu,ly=new Yu,uy=new Yu,cy=new Yu;class hy extends qc{constructor(){super(),this.type="AudioListener",this.context=qv.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._timer=new ry}getInput(){return this.gain}removeFilter(){return null!==this.filter&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(e){return null!==this.filter?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}updateMatrixWorld(e){super.updateMatrixWorld(e),this._timer.update();const t=this.context.listener;if(this.timeDelta=this._timer.getDelta(),this.matrixWorld.decompose(sy,oy,ly),uy.set(0,0,-1).applyQuaternion(oy),cy.set(0,1,0).applyQuaternion(oy),t.positionX){const e=this.context.currentTime+this.timeDelta;t.positionX.linearRampToValueAtTime(sy.x,e),t.positionY.linearRampToValueAtTime(sy.y,e),t.positionZ.linearRampToValueAtTime(sy.z,e),t.forwardX.linearRampToValueAtTime(uy.x,e),t.forwardY.linearRampToValueAtTime(uy.y,e),t.forwardZ.linearRampToValueAtTime(uy.z,e),t.upX.linearRampToValueAtTime(cy.x,e),t.upY.linearRampToValueAtTime(cy.y,e),t.upZ.linearRampToValueAtTime(cy.z,e)}else t.setPosition(sy.x,sy.y,sy.z),t.setOrientation(uy.x,uy.y,uy.z,cy.x,cy.y,cy.z)}}class dy extends qc{constructor(e){super(),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this}setMediaElementSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this}setMediaStreamSource(e){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(e),this.connect(),this}setBuffer(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this}play(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!0===this.isPlaying)return void Iu("Audio: Audio is already playing.");if(!1===this.hasPlaybackControl)return void Iu("Audio: this Audio has no playback control.");this._startedAt=this.context.currentTime+e;const t=this.context.createBufferSource();return t.buffer=this.buffer,t.loop=this.loop,t.loopStart=this.loopStart,t.loopEnd=this.loopEnd,t.onended=this.onEnded.bind(this),t.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=t,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(!1!==this.hasPlaybackControl)return!0===this.isPlaying&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,!0===this.loop&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this;Iu("Audio: this Audio has no playback control.")}stop(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(!1!==this.hasPlaybackControl)return this._progress=0,null!==this.source&&(this.source.stop(this.context.currentTime+e),this.source.onended=null),this.isPlaying=!1,this;Iu("Audio: this Audio has no playback control.")}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(let e=1,t=this.filters.length;e1&&void 0!==arguments[1]?arguments[1]:2048;this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let e=0;const t=this.getFrequencyData();for(let n=0;n0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let o=t,l=t+t;o!==l;++o)if(n[o]!==n[o+t]){s.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=3*this.valueSize;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n=.5)for(let a=0;a!==r;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){qu.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,r){const a=this._workIndex*r;qu.multiplyQuaternionsFlat(e,a,e,t,e,n),qu.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,r){const a=1-i;for(let s=0;s!==r;++s){const r=t+s;e[r]=e[r]*a+e[n+s]*i}}_lerpAdditive(e,t,n,i,r){for(let a=0;a!==r;++a){const r=t+a;e[r]=e[r]+e[n+a]*i}}}const by="\\[\\]\\.:\\/",xy=new RegExp("["+by+"]","g"),Sy="[^"+by+"]",Ay="[^"+by.replace("\\.","")+"]",My=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",Sy)+/(WCOD+)?/.source.replace("WCOD",Ay)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Sy)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Sy)+"$"),wy=["material","materials","bones","map"];class Ey{constructor(e,t,n){this.path=t,this.parsedPath=n||Ey.parseTrackName(t),this.node=Ey.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new Ey.Composite(e,t,n):new Ey(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(xy,"")}static parseTrackName(e){const t=My.exec(e);if(null===t)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(void 0!==i&&-1!==i){const e=n.nodeName.substring(i+1);-1!==wy.indexOf(e)&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=e)}if(null===n.propertyName||0===n.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(void 0===t||""===t||"."===t||-1===t||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(void 0!==n)return n}if(e.children){const n=function(e){for(let i=0;i=r){const a=r++,u=e[a];t[u.uuid]=l,e[l]=u,t[o]=a,e[a]=s;for(let e=0,t=i;e!==t;++e){const t=n[e],i=t[a],r=t[l];t[l]=i,t[a]=r}}}this.nCachedObjects_=r}uncache(){const e=this._objects,t=this._indicesByUUID,n=this._bindings,i=n.length;let r=this.nCachedObjects_,a=e.length;for(let s=0,o=arguments.length;s!==o;++s){const o=arguments[s].uuid,l=t[o];if(void 0!==l)if(delete t[o],l0&&(t[s.uuid]=l),e[l]=s,e.pop();for(let e=0,t=i;e!==t;++e){const t=n[e];t[l]=t[r],t.pop()}}}this.nCachedObjects_=r}subscribe_(e,t){const n=this._bindingsIndicesByPath;let i=n[e];const r=this._bindings;if(void 0!==i)return r[i];const a=this._paths,s=this._parsedPaths,o=this._objects,l=o.length,u=this.nCachedObjects_,c=new Array(l);i=r.length,n[e]=i,a.push(e),s.push(t),r.push(c);for(let h=u,d=o.length;h!==d;++h){const n=o[h];c[h]=new Ey(n,e,t)}return c}unsubscribe_(e){const t=this._bindingsIndicesByPath,n=t[e];if(void 0!==n){const i=this._paths,r=this._parsedPaths,a=this._bindings,s=a.length-1,o=a[s];t[e[s]]=n,a[n]=o,a.pop(),r[n]=r[s],r.pop(),i[n]=i[s],i.pop()}}}class Cy{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t.blendMode;this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const r=t.tracks,a=r.length,s=new Array(a),o={endingStart:dl,endingEnd:dl};for(let l=0;l!==a;++l){const e=r[l].createInterpolant(null);s[l]=e,e.settings&&Object.assign(o,e.settings),e.settings=o}this._interpolantSettings=o,this._interpolants=s,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=sl,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e.fadeOut(t),this.fadeIn(t),!0===n){const n=this._clip.duration,i=e._clip.duration,r=i/n,a=n/i;e.warp(1,r,t),this.warp(a,1,t)}return this}crossFadeTo(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return null!==e&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,r=i.time,a=this.timeScale;let s=this._timeScaleInterpolant;null===s&&(s=i._lendControlInterpolant(),this._timeScaleInterpolant=s);const o=s.parameterPositions,l=s.sampleValues;return o[0]=r,o[1]=r+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return null!==e&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled)return void this._updateWeight(e);const r=this._startTime;if(null!==r){const i=(e-r)*n;i<0||0===n?t=0:(this._startTime=null,t=n*i)}t*=this._updateTimeScale(e);const a=this._updateTime(t),s=this._updateWeight(e);if(s>0){const e=this._interpolants,t=this._propertyBindings;if(this.blendMode===gl)for(let n=0,i=e.length;n!==i;++n)e[n].evaluate(a),t[n].accumulateAdditive(s);else for(let n=0,r=e.length;n!==r;++n)e[n].evaluate(a),t[n].accumulate(i,s)}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(null!==n){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(null!==n){t*=n.evaluate(e)[0],e>n.parameterPositions[1]&&(this.stopWarping(),0===t?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,r=this._loopCount;const a=n===ol;if(0===e)return-1===r?i:a&&1===(1&r)?t-i:i;if(n===al){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else{if(!(i<0)){this.time=i;break e}i=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(-1===r&&(e>=0?(r=0,this._setEndings(!0,0===this.repetitions,a)):this._setEndings(0===this.repetitions,!0,a)),i>=t||i<0){const n=Math.floor(i/t);i-=t*n,r+=Math.abs(n);const s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){const t=e<0;this._setEndings(t,!t,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:n})}}else this._loopCount=r,this.time=i;if(a&&1===(1&r))return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=pl,i.endingEnd=pl):(i.endingStart=e?this.zeroSlopeAtStart?pl:dl:fl,i.endingEnd=t?this.zeroSlopeAtEnd?pl:dl:fl)}_scheduleFading(e,t,n){const i=this._mixer,r=i.time;let a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const s=a.parameterPositions,o=a.sampleValues;return s[0]=r,o[0]=t,s[1]=r+e,o[1]=n,this}}const Ry=new Float32Array(1);class Py extends Nu{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,s=e._interpolants,o=n.uuid,l=this._bindingsByRootAndName;let u=l[o];void 0===u&&(u={},l[o]=u);for(let c=0;c!==r;++c){const e=i[c],r=e.name;let l=u[r];if(void 0!==l)++l.referenceCount,a[c]=l;else{if(l=a[c],void 0!==l){null===l._cacheIndex&&(++l.referenceCount,this._addInactiveBinding(l,o,r));continue}const i=t&&t._propertyBindings[c].binding.parsedPath;l=new _y(Ey.create(n,r,i),e.ValueTypeName,e.getValueSize()),++l.referenceCount,this._addInactiveBinding(l,o,r),a[c]=l}s[c].resultBuffer=l.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){const t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0===n.useCount++&&(this._lendBinding(n),n.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let e=0,n=t.length;e!==n;++e){const n=t[e];0===--n.useCount&&(n.restoreOriginalState(),this._takeBackBinding(n))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return null!==t&&t=0;--t)e[t].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l){t[l]._update(i,e,r,a)}const s=this._bindings,o=this._nActiveBindings;for(let l=0;l!==o;++l)s[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};super(e,t,i),this.isRenderTarget3D=!0,this.depth=n,this.texture=new bc(null,e,t,n),this._setTextureOptions(i),this.texture.isRenderTargetTexture=!0}}class Iy{constructor(e){this.value=e}clone(){return new Iy(void 0===this.value.clone?this.value:this.value.clone())}}let Dy=0;class Fy extends Nu{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:Dy++}),this.name="",this.usage=ru,this.uniforms=[]}add(e){return this.uniforms.push(e),this}remove(e){const t=this.uniforms.indexOf(e);return-1!==t&&this.uniforms.splice(t,1),this}setName(e){return this.name=e,this}setUsage(e){return this.usage=e,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(e){this.name=e.name,this.usage=e.usage;const t=e.uniforms;this.uniforms.length=0;for(let n=0,i=t.length;n2&&void 0!==arguments[2]?arguments[2]:1;super(e,t),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=n}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}clone(e){const t=super.clone(e);return t.meshPerAttribute=this.meshPerAttribute,t}toJSON(e){const t=super.toJSON(e);return t.isInstancedInterleavedBuffer=!0,t.meshPerAttribute=this.meshPerAttribute,t}}class Ny{constructor(e,t,n,i,r){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];this.isGLBufferAttribute=!0,this.name="",this.buffer=e,this.type=t,this.itemSize=n,this.elementSize=i,this.count=r,this.normalized=a,this.version=0}set needsUpdate(e){!0===e&&this.version++}setBuffer(e){return this.buffer=e,this}setType(e,t){return this.type=e,this.elementSize=t,this}setItemSize(e){return this.itemSize=e,this}setCount(e){return this.count=e,this}}const Oy=new Sc;class ky{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1/0;this.ray=new jd(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Dc,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Du("Raycaster: Unsupported camera type: "+t.type)}setFromXRController(e){return Oy.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Oy),this}intersectObject(e){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return zy(e,this,t,!(arguments.length>1&&void 0!==arguments[1])||arguments[1]),t.sort(Uy),t}intersectObjects(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];for(let i=0,r=e.length;i0&&void 0!==arguments[0])||arguments[0];this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1,Iu("Clock: This module has been deprecated. Please use THREE.Timer instead.")}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=performance.now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}class Hy{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){const e=1e-6;return this.phi=Hu(this.phi,e,Math.PI-e),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Hu(t/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}class Vy{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.radius=e,this.theta=t,this.y=n}set(e,t,n){return this.radius=e,this.theta=t,this.y=n,this}copy(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}clone(){return(new this.constructor).copy(this)}}class jy{constructor(e,t,n,i){this.elements=[1,0,0,1],void 0!==e&&this.set(e,t,n,i)}identity(){return this.set(1,0,0,1),this}fromArray(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;for(let n=0;n<4;n++)this.elements[n]=e[n+t];return this}set(e,t,n,i){const r=this.elements;return r[0]=e,r[2]=t,r[1]=n,r[3]=i,this}}jy.prototype.isMatrix2=!0;const Wy=new Ku;class Xy{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ku(1/0,1/0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Ku(-1/0,-1/0);this.isBox2=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Wy).distanceTo(e)}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Jy=new Yu,Ky=new Yu,qy=new Yu,Yy=new Yu,Qy=new Yu,Zy=new Yu,$y=new Yu;class e_{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yu,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu;this.start=e,this.end=t}set(e,t){return this.start.copy(e),this.end.copy(t),this}copy(e){return this.start.copy(e.start),this.end.copy(e.end),this}getCenter(e){return e.addVectors(this.start,this.end).multiplyScalar(.5)}delta(e){return e.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(e,t){return this.delta(t).multiplyScalar(e).add(this.start)}closestPointToPointParameter(e,t){Jy.subVectors(e,this.start),Ky.subVectors(this.end,this.start);const n=Ky.dot(Ky);if(0===n)return 0;let i=Ky.dot(Jy)/n;return t&&(i=Hu(i,0,1)),i}closestPointToPoint(e,t,n){const i=this.closestPointToPointParameter(e,t);return this.delta(n).multiplyScalar(i).add(this.start)}distanceSqToLine3(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Zy,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:$y;const i=1e-8*1e-8;let r,a;const s=this.start,o=e.start,l=this.end,u=e.end;qy.subVectors(l,s),Yy.subVectors(u,o),Qy.subVectors(s,o);const c=qy.dot(qy),h=Yy.dot(Yy),d=Yy.dot(Qy);if(c<=i&&h<=i)return t.copy(s),n.copy(o),t.sub(n),t.dot(t);if(c<=i)r=0,a=d/h,a=Hu(a,0,1);else{const e=qy.dot(Qy);if(h<=i)a=0,r=Hu(-e/c,0,1);else{const t=qy.dot(Yy),n=c*h-t*t;r=0!==n?Hu((t*d-e*h)/n,0,1):0,a=(t*r+d)/h,a<0?(a=0,r=Hu(-e/c,0,1)):a>1&&(a=1,r=Hu((t-e)/c,0,1))}}return t.copy(s).addScaledVector(qy,r),n.copy(o).addScaledVector(Yy,a),t.distanceToSquared(n)}applyMatrix4(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this}equals(e){return e.start.equals(this.start)&&e.end.equals(this.end)}clone(){return(new this.constructor).copy(this)}}const t_=new Yu;class n_ extends qc{constructor(e,t){super(),this.light=e,this.matrixAutoUpdate=!1,this.color=t,this.type="SpotLightHelper";const n=new dd,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let a=0,s=1,o=32;a0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4473924,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:8947848;n=new ih(n),i=new ih(i);const r=t/2,a=e/t,s=e/2,o=[],l=[];for(let c=0,h=0,d=-s;c<=t;c++,d+=a){o.push(-s,0,d,s,0,d),o.push(d,0,-s,d,0,s);const e=c===r?n:i;e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3,e.toArray(l,h),h+=3}const u=new dd;u.setAttribute("position",new ed(o,3)),u.setAttribute("color",new ed(l,3));super(u,new sf({vertexColors:!0,toneMapped:!1})),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class f_ extends yf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:64,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:4473924,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:8947848;r=new ih(r),a=new ih(a);const s=[],o=[];if(t>1)for(let u=0;u1&&void 0!==arguments[1]?arguments[1]:16776960;const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(24),r=new dd;r.setIndex(new Wh(n,1)),r.setAttribute("position",new Wh(i,3)),super(r,new sf({color:t,toneMapped:!1})),this.object=e,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(void 0!==this.object&&A_.setFromObject(this.object),A_.isEmpty())return;const e=A_.min,t=A_.max,n=this.geometry.attributes.position,i=n.array;i[0]=t.x,i[1]=t.y,i[2]=t.z,i[3]=e.x,i[4]=t.y,i[5]=t.z,i[6]=e.x,i[7]=e.y,i[8]=t.z,i[9]=t.x,i[10]=e.y,i[11]=t.z,i[12]=t.x,i[13]=t.y,i[14]=e.z,i[15]=e.x,i[16]=t.y,i[17]=e.z,i[18]=e.x,i[19]=e.y,i[20]=e.z,i[21]=t.x,i[22]=e.y,i[23]=e.z,n.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(e){return this.object=e,this.update(),this}copy(e,t){return super.copy(e,t),this.object=e.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class w_ extends yf{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16776960;const n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new dd;i.setIndex(new Wh(n,1)),i.setAttribute("position",new ed([1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],3)),super(i,new sf({color:t,toneMapped:!1})),this.box=e,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(e){const t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(e))}dispose(){this.geometry.dispose(),this.material.dispose()}}class E_ extends ff{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:16776960,i=new dd;i.setAttribute("position",new ed([1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],3)),i.computeBoundingSphere(),super(i,new sf({color:n,toneMapped:!1})),this.type="PlaneHelper",this.plane=e,this.size=t;const r=new dd;r.setAttribute("position",new ed([1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],3)),r.computeBoundingSphere(),this.add(new ip(r,new Wd({color:n,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(e){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(e)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const T_=new Yu;let C_,R_;class P_ extends qc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Yu(0,0,1),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Yu(0,0,0),n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:16776960,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.2*n,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.2*r;super(),this.type="ArrowHelper",void 0===C_&&(C_=new dd,C_.setAttribute("position",new ed([0,0,0,0,1,0],3)),R_=new Vf(.5,1,5,1),R_.translate(0,-.5,0)),this.position.copy(t),this.line=new ff(C_,new sf({color:i,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new ip(R_,new Wd({color:i,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}setDirection(e){if(e.y>.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{T_.set(e.z,0,-e.x).normalize();const t=Math.acos(e.y);this.quaternion.setFromAxisAngle(T_,t)}}setLength(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.2*e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.2*t;this.line.scale.set(1,Math.max(1e-4,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()}setColor(e){this.line.material.color.set(e),this.cone.material.color.set(e)}copy(e){return super.copy(e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class B_ extends yf{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=new dd;n.setAttribute("position",new ed(t,3)),n.setAttribute("color",new ed([1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],3));super(n,new sf({vertexColors:!0,toneMapped:!1})),this.type="AxesHelper"}setColors(e,t,n){const i=new ih,r=this.geometry.attributes.color.array;return i.set(e),i.toArray(r,0),i.toArray(r,3),i.set(t),i.toArray(r,6),i.toArray(r,9),i.set(n),i.toArray(r,12),i.toArray(r,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class I_{constructor(){this.type="ShapePath",this.color=new ih,this.subPaths=[],this.currentPath=null}moveTo(e,t){return this.currentPath=new _m,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t),this}lineTo(e,t){return this.currentPath.lineTo(e,t),this}quadraticCurveTo(e,t,n,i){return this.currentPath.quadraticCurveTo(e,t,n,i),this}bezierCurveTo(e,t,n,i,r,a){return this.currentPath.bezierCurveTo(e,t,n,i,r,a),this}splineThru(e){return this.currentPath.splineThru(e),this}toShapes(e){function t(e,t){const n=t.length;let i=!1;for(let r=n-1,a=0;aNumber.EPSILON){if(l<0&&(n=t[a],o=-o,s=t[r],l=-l),e.ys.y)continue;if(e.y===n.y){if(e.x===n.x)return!0}else{const t=l*(e.x-n.x)-o*(e.y-n.y);if(0===t)return!0;if(t<0)continue;i=!i}}else{if(e.y!==n.y)continue;if(s.x<=e.x&&e.x<=n.x||n.x<=e.x&&e.x<=s.x)return!0}}return i}const n=Km.isClockWise,i=this.subPaths;if(0===i.length)return[];let r,a,s;const o=[];if(1===i.length)return a=i[0],s=new bm,s.curves=a.curves,o.push(s),o;let l=!n(i[0].getPoints());l=e?!l:l;const u=[],c=[];let h,d,p=[],f=0;c[f]=void 0,p[f]=[];for(let m=0,g=i.length;m1){let e=!1,n=0;for(let t=0,i=c.length;t0&&!1===e&&(p=u)}for(let m=0,g=c.length;m1&&void 0!==arguments[1]?arguments[1]:null;super(),this.object=e,this.domElement=t,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(e){void 0!==e?(null!==this.domElement&&this.disconnect(),this.domElement=e):Iu("Controls: connect() now requires an element.")}disconnect(){}dispose(){}update(){}}function F_(e,t,n,i){const r=function(e){switch(e){case Zs:case $s:return{byteLength:1,components:1};case to:case eo:case ao:return{byteLength:2,components:1};case so:case oo:return{byteLength:2,components:4};case io:case no:case ro:return{byteLength:4,components:1};case uo:case co:return{byteLength:4,components:3}}throw new Error("Unknown texture type ".concat(e,"."))}(i);switch(n){case ho:return e*t;case vo:case yo:return e*t/r.components*r.byteLength;case _o:case bo:return e*t*2/r.components*r.byteLength;case po:return e*t*3/r.components*r.byteLength;case fo:case So:return e*t*4/r.components*r.byteLength;case Ao:case Mo:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case wo:case Eo:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Co:case Po:return Math.max(e,16)*Math.max(t,8)/4;case To:case Ro:return Math.max(e,8)*Math.max(t,8)/2;case Bo:case Io:case Fo:case Lo:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*8;case Do:case No:case Oo:case ko:return Math.floor((e+3)/4)*Math.floor((t+3)/4)*16;case Uo:return Math.floor((e+4)/5)*Math.floor((t+3)/4)*16;case zo:return Math.floor((e+4)/5)*Math.floor((t+4)/5)*16;case Go:return Math.floor((e+5)/6)*Math.floor((t+4)/5)*16;case Ho:return Math.floor((e+5)/6)*Math.floor((t+5)/6)*16;case Vo:return Math.floor((e+7)/8)*Math.floor((t+4)/5)*16;case jo:return Math.floor((e+7)/8)*Math.floor((t+5)/6)*16;case Wo:return Math.floor((e+7)/8)*Math.floor((t+7)/8)*16;case Xo:return Math.floor((e+9)/10)*Math.floor((t+4)/5)*16;case Jo:return Math.floor((e+9)/10)*Math.floor((t+5)/6)*16;case Ko:return Math.floor((e+9)/10)*Math.floor((t+7)/8)*16;case qo:return Math.floor((e+9)/10)*Math.floor((t+9)/10)*16;case Yo:return Math.floor((e+11)/12)*Math.floor((t+9)/10)*16;case Qo:return Math.floor((e+11)/12)*Math.floor((t+11)/12)*16;case Zo:case $o:case el:return Math.ceil(e/4)*Math.ceil(t/4)*16;case tl:case nl:return Math.ceil(e/4)*Math.ceil(t/4)*8;case il:case rl:return Math.ceil(e/4)*Math.ceil(t/4)*16}throw new Error("Unable to determine texture byte length for ".concat(n," format."))}class L_{static contain(e,t){return function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2):(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0),e}(e,t)}static cover(e,t){return function(e,t){const n=e.image&&e.image.width?e.image.width/e.image.height:1;return n>t?(e.repeat.x=t/n,e.repeat.y=1,e.offset.x=(1-e.repeat.x)/2,e.offset.y=0):(e.repeat.x=1,e.repeat.y=n/t,e.offset.x=0,e.offset.y=(1-e.repeat.y)/2),e}(e,t)}static fill(e){return function(e){return e.repeat.x=1,e.repeat.y=1,e.offset.x=0,e.offset.y=0,e}(e)}static getByteLength(e,t,n,i){return F_(e,t,n,i)}}"undefined"!==typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:wa}})),"undefined"!==typeof window&&(window.__THREE__?Iu("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=wa);const N_=e=>{let t;const n=new Set,i=(e,i)=>{const r="function"===typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=i?i:"object"!==typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,a={setState:i,getState:r,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e))},s=t=e(i,r,a);return a},O_=e=>e?N_(e):N_,k_=e=>e;const U_=e=>{const t=O_(e),n=e=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:k_;const n=r.useSyncExternalStore(e.subscribe,r.useCallback(()=>t(e.getState()),[e,t]),r.useCallback(()=>t(e.getInitialState()),[e,t]));return r.useDebugValue(n),n}(t,e);return Object.assign(n,t),n},z_=e=>e?U_(e):U_;let G_=0;const H_=z_(e=>(ev.onStart=(t,n,i)=>{e({active:!0,item:t,loaded:n,total:i,progress:(n-G_)/(i-G_)*100})},ev.onLoad=()=>{e({active:!1})},ev.onError=t=>e(e=>({errors:[...e.errors,t]})),ev.onProgress=(t,n,i)=>{n===i&&(G_=i),e({active:!0,item:t,loaded:n,total:i,progress:(n-G_)/(i-G_)*100||100})},{errors:[],active:!1,progress:0,item:"",loaded:0,total:0}));function V_(e){if("undefined"===typeof Proxy)return e;const t=new Map;return new Proxy(function(){return e(...arguments)},{get:(n,i)=>"create"===i?e:(t.has(i)||t.set(i,e(i)),t.get(i))})}function j_(e){return null!==e&&"object"===typeof e&&"function"===typeof e.start}function W_(e,t){if(null==e)return{};var n,i,r=function(e,t){if(null==e)return{};var n={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;n[i]=e[i]}return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;iArray.isArray(e);function J_(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let i=0;i{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function Y_(e,t,n,i){if("function"===typeof t){const r=Ma(q_(i),2),a=r[0],s=r[1];t=t(void 0!==n?n:e.custom,a,s)}if("string"===typeof t&&(t=e.variants&&e.variants[t]),"function"===typeof t){const r=Ma(q_(i),2),a=r[0],s=r[1];t=t(void 0!==n?n:e.custom,a,s)}return t}function Q_(e,t,n){const i=e.getProps();return Y_(i,t,void 0!==n?n:i.custom,e)}const Z_=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],$_=["initial",...Z_];function eb(e){let t;return()=>(void 0===t&&(t=e()),t)}const tb=eb(()=>void 0!==window.ScrollTimeline);class nb{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;ntb()&&n.attachTimeline?n.attachTimeline(e):"function"===typeof t?t(n):void 0);return()=>{n.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let t=0;tt[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class ib extends nb{then(e,t){return Promise.all(this.animations).then(e).catch(t)}}function rb(e,t){return e?e[t]||e.default||e:void 0}const ab=2e4;function sb(e){let t=0;let n=e.next(t);for(;!n.done&&t=ab?1/0:t}function ob(e){return"function"===typeof e}function lb(e,t){e.timeline=t,e.onfinish=null}const ub=e=>Array.isArray(e)&&"number"===typeof e[0],cb={linearEasing:void 0};function hb(e,t){const n=eb(e);return()=>{var e;return null!==(e=cb[t])&&void 0!==e?e:n()}}const db=hb(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing"),pb=(e,t,n)=>{const i=t-e;return 0===i?1:(n-e)/i},fb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,i="";const r=Math.max(Math.round(t/n),2);for(let a=0;a{let t=Ma(e,4),n=t[0],i=t[1],r=t[2],a=t[3];return"cubic-bezier(".concat(n,", ").concat(i,", ").concat(r,", ").concat(a,")")},vb={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:gb([0,.65,.55,1]),circOut:gb([.55,0,1,.45]),backIn:gb([.31,.01,.66,-.59]),backOut:gb([.33,1.53,.69,.99])};function yb(e,t){return e?"function"===typeof e&&db()?fb(e,t):ub(e)?gb(e):Array.isArray(e)?e.map(e=>yb(e,t)||vb.easeOut):vb[e]:void 0}const _b={x:!1,y:!1};function bb(){return _b.x||_b.y}function xb(e,t){const n=function(e,t,n){var i;if(e instanceof Element)return[e];if("string"===typeof e){let r=document;t&&(r=t.current);const a=null!==(i=null===n||void 0===n?void 0:n[e])&&void 0!==i?i:r.querySelectorAll(e);return a?Array.from(a):[]}return Array.from(e)}(e),i=new AbortController;return[n,h(h({passive:!0},t),{},{signal:i.signal}),()=>i.abort()]}function Sb(e){return t=>{"touch"===t.pointerType||bb()||e(t)}}const Ab=(e,t)=>!!t&&(e===t||Ab(e,t.parentElement)),Mb=e=>"mouse"===e.pointerType?"number"!==typeof e.button||e.button<=0:!1!==e.isPrimary,wb=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);const Eb=new WeakSet;function Tb(e){return t=>{"Enter"===t.key&&e(t)}}function Cb(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function Rb(e){return Mb(e)&&!bb()}function Pb(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const i=Ma(xb(e,n),3),r=i[0],a=i[1],s=i[2],o=e=>{const i=e.currentTarget;if(!Rb(e)||Eb.has(i))return;Eb.add(i);const r=t(e),s=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),Rb(e)&&Eb.has(i)&&(Eb.delete(i),"function"===typeof r&&r(e,{success:t}))},o=e=>{s(e,n.useGlobalTarget||Ab(i,e.target))},l=e=>{s(e,!1)};window.addEventListener("pointerup",o,a),window.addEventListener("pointercancel",l,a)};return r.forEach(e=>{(function(e){return wb.has(e.tagName)||-1!==e.tabIndex})(e)||null!==e.getAttribute("tabindex")||(e.tabIndex=0);(n.useGlobalTarget?window:e).addEventListener("pointerdown",o,a),e.addEventListener("focus",e=>((e,t)=>{const n=e.currentTarget;if(!n)return;const i=Tb(()=>{if(Eb.has(n))return;Cb(n,"down");const e=Tb(()=>{Cb(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>Cb(n,"cancel"),t)});n.addEventListener("keydown",i,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),t)})(e,a),a)}),s}const Bb=e=>1e3*e,Ib=e=>e/1e3,Db=e=>e;const Fb=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Lb=new Set(Fb),Nb=new Set(["width","height","top","left","right","bottom",...Fb]),Ob=e=>X_(e)?e[e.length-1]||0:e,kb=!1,Ub=!1;const zb=["read","resolveKeyframes","update","preRender","render","postRender"];function Gb(e,t){let n=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,s=zb.reduce((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,i=!1,r=!1;const a=new WeakSet;let s={delta:0,timestamp:0,isProcessing:!1};function o(t){a.has(t)&&(l.schedule(t),e()),t(s)}const l={schedule:function(e){const r=arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&i?t:n;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&a.add(e),r.has(e)||r.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(s=e,i)r=!0;else{i=!0;var a=[n,t];t=a[0],n=a[1],t.forEach(o),t.clear(),i=!1,r&&(r=!1,l.process(e))}}};return l}(a),e),{}),o=s.read,l=s.resolveKeyframes,u=s.update,c=s.preRender,h=s.render,d=s.postRender,p=()=>{const a=Ub?r.timestamp:performance.now();n=!1,r.delta=i?1e3/60:Math.max(Math.min(a-r.timestamp,40),1),r.timestamp=a,r.isProcessing=!0,o.process(r),l.process(r),u.process(r),c.process(r),h.process(r),d.process(r),r.isProcessing=!1,n&&t&&(i=!1,e(p))},f=zb.reduce((t,a)=>{const o=s[a];return t[a]=function(t){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return n||(n=!0,i=!0,r.isProcessing||e(p)),o.schedule(t,a,s)},t},{});return{schedule:f,cancel:e=>{for(let t=0;t(void 0===Jb&&qb.set(Wb.isProcessing||Ub?Wb.timestamp:performance.now()),Jb),set:e=>{Jb=e,queueMicrotask(Kb)}};function Yb(e,t){-1===e.indexOf(t)&&e.push(t)}function Qb(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class Zb{constructor(){this.subscriptions=[]}add(e){return Yb(this.subscriptions,e),()=>Qb(this.subscriptions,e)}notify(e,t,n){const i=this.subscriptions.length;if(i)if(1===i)this.subscriptions[0](e,t,n);else for(let r=0;r1&&void 0!==arguments[1]?arguments[1]:{};this.version="11.18.0",this.canTrackVelocity=null,this.events={},this.updateAndNotify=function(e){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=qb.now();t.updatedAt!==i&&t.setPrevFrameValue(),t.prev=t.current,t.setCurrent(e),t.current!==t.prev&&t.events.change&&t.events.change.notify(t.current),n&&t.events.renderRequest&&t.events.renderRequest.notify(t.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){var t;this.current=e,this.updatedAt=qb.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=(t=this.current,!isNaN(parseFloat(t))))}setPrevFrameValue(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.current;this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new Zb);const n=this.events[e].add(t);return"change"===e?()=>{n(),Vb.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t&&this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e,t)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return ex.current&&ex.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){const e=qb.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return $b(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function nx(e,t){return new tx(e,t)}const ix=["transitionEnd","transition"];function rx(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,nx(n))}const ax=e=>Boolean(e&&e.getVelocity);function sx(e,t){const n=e.getValue("willChange");if(i=n,Boolean(ax(i)&&i.add))return n.add(t);var i}const ox=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),lx="data-"+ox("framerAppearId");function ux(e){return e.props[lx]}const cx=!1,hx=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function dx(e,t,n,i){if(e===t&&n===i)return Db;const r=t=>function(e,t,n,i,r){let a,s,o=0;do{s=t+(n-t)/2,a=hx(s,i,r)-e,a>0?n=s:t=s}while(Math.abs(a)>1e-7&&++o<12);return s}(t,0,1,e,n);return e=>0===e||1===e?e:hx(r(e),t,i)}const px=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,fx=e=>t=>1-e(1-t),mx=dx(.33,1.53,.69,.99),gx=fx(mx),vx=px(gx),yx=e=>(e*=2)<1?.5*gx(e):.5*(2-Math.pow(2,-10*(e-1))),_x=e=>1-Math.sin(Math.acos(e)),bx=fx(_x),xx=px(_x),Sx=e=>/^0(?:[\0-\x08\x0E-\x1F!-\x2D\/-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+$/.test(e);function Ax(e){return"number"===typeof e?0===e:null===e||("none"===e||"0"===e||Sx(e))}const Mx=(e,t,n)=>n>t?t:n"number"===typeof e,parse:parseFloat,transform:e=>e},Ex=h(h({},wx),{},{transform:e=>Mx(0,1,e)}),Tx=h(h({},wx),{},{default:1}),Cx=e=>Math.round(1e5*e)/1e5,Rx=/-?(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+)/g;const Px=/^(?:#[0-9a-f]{3,8}|(?:rgb|h[s\u017F]l)a?\((?:-?[\.0-9]+%?[\t-\r ,\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+){2}-?[\.0-9]+%?[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?:[,\/][\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)?(?:\b[0-9]+(?:\.[0-9]+)?|\.[0-9]+)?%?\))$/i,Bx=(e,t)=>n=>Boolean("string"===typeof n&&Px.test(n)&&n.startsWith(e)||t&&!function(e){return null==e}(n)&&Object.prototype.hasOwnProperty.call(n,t)),Ix=(e,t,n)=>i=>{if("string"!==typeof i)return i;const r=Ma(i.match(Rx),4),a=r[0],s=r[1],o=r[2],l=r[3];return{[e]:parseFloat(a),[t]:parseFloat(s),[n]:parseFloat(o),alpha:void 0!==l?parseFloat(l):1}},Dx=h(h({},wx),{},{transform:e=>Math.round((e=>Mx(0,255,e))(e))}),Fx={test:Bx("rgb","red"),parse:Ix("red","green","blue"),transform:e=>{let t=e.red,n=e.green,i=e.blue,r=e.alpha,a=void 0===r?1:r;return"rgba("+Dx.transform(t)+", "+Dx.transform(n)+", "+Dx.transform(i)+", "+Cx(Ex.transform(a))+")"}};const Lx={test:Bx("#"),parse:function(e){let t="",n="",i="",r="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),i=e.substring(5,7),r=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),i=e.substring(3,4),r=e.substring(4,5),t+=t,n+=n,i+=i,r+=r),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}},transform:Fx.transform},Nx=e=>({test:t=>"string"===typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>"".concat(t).concat(e)}),Ox=Nx("deg"),kx=Nx("%"),Ux=Nx("px"),zx=Nx("vh"),Gx=Nx("vw"),Hx=h(h({},kx),{},{parse:e=>kx.parse(e)/100,transform:e=>kx.transform(100*e)}),Vx={test:Bx("hsl","hue"),parse:Ix("hue","saturation","lightness"),transform:e=>{let t=e.hue,n=e.saturation,i=e.lightness,r=e.alpha,a=void 0===r?1:r;return"hsla("+Math.round(t)+", "+kx.transform(Cx(n))+", "+kx.transform(Cx(i))+", "+Cx(Ex.transform(a))+")"}},jx={test:e=>Fx.test(e)||Lx.test(e)||Vx.test(e),parse:e=>Fx.test(e)?Fx.parse(e):Vx.test(e)?Vx.parse(e):Lx.parse(e),transform:e=>"string"===typeof e?e:e.hasOwnProperty("red")?Fx.transform(e):Vx.transform(e)},Wx=/(?:#[0-9a-f]{3,8}|(?:rgb|h[s\u017F]l)a?\((?:-?[\.0-9]+%?[\t-\r ,\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+){2}-?[\.0-9]+%?[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?:[,\/][\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)?(?:\b[0-9]+(?:\.[0-9]+)?|\.[0-9]+)?%?\))/gi;const Xx="number",Jx="color",Kx=/var[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*--(?:[\x2D0-9A-Z_a-z\u017F\u212A]+[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*|[\x2D0-9A-Z_a-z\u017F\u212A]+[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*,(?:[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?:(?![\t-\r \(\)\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uD800-\uDFFF\uFEFF])[^]|[\uD800-\uDBFF][\uDC00-\uDFFF])|[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\((?:(?:(?![\(\)\uD800-\uDFFF])[^]|[\uD800-\uDBFF][\uDC00-\uDFFF])|\((?:(?![\(\)\uD800-\uDFFF])[^]|[\uD800-\uDBFF][\uDC00-\uDFFF])*\))*\))+[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)\)|#[0-9a-f]{3,8}|(?:rgb|h[s\u017F]l)a?\((?:-?[\.0-9]+%?[\t-\r ,\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+){2}-?[\.0-9]+%?[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?:[,\/][\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)?(?:\b[0-9]+(?:\.[0-9]+)?|\.[0-9]+)?%?\)|-?(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+)/gi;function qx(e){const t=e.toString(),n=[],i={color:[],number:[],var:[]},r=[];let a=0;const s=t.replace(Kx,e=>(jx.test(e)?(i.color.push(a),r.push(Jx),n.push(jx.parse(e))):e.startsWith("var(")?(i.var.push(a),r.push("var"),n.push(e)):(i.number.push(a),r.push(Xx),n.push(parseFloat(e))),++a,"${}")).split("${}");return{values:n,split:s,indexes:i,types:r}}function Yx(e){return qx(e).values}function Qx(e){const t=qx(e),n=t.split,i=t.types,r=n.length;return e=>{let t="";for(let a=0;a"number"===typeof e?0:e;const $x={test:function(e){var t,n;return isNaN(e)&&"string"===typeof e&&((null===(t=e.match(Rx))||void 0===t?void 0:t.length)||0)+((null===(n=e.match(Wx))||void 0===n?void 0:n.length)||0)>0},parse:Yx,createTransformer:Qx,getAnimatableNone:function(e){const t=Yx(e);return Qx(e)(t.map(Zx))}},eS=new Set(["brightness","contrast","saturate","opacity"]);function tS(e){const t=Ma(e.slice(0,-1).split("("),2),n=t[0],i=t[1];if("drop-shadow"===n)return e;const r=Ma(i.match(Rx)||[],1)[0];if(!r)return e;const a=i.replace(r,"");let s=eS.has(n)?1:0;return r!==i&&(s*=100),n+"("+s+a+")"}const nS=/\b([\x2Da-z]*)\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\)/g,iS=h(h({},$x),{},{getAnimatableNone:e=>{const t=e.match(nS);return t?t.map(tS).join(" "):e}}),rS={borderWidth:Ux,borderTopWidth:Ux,borderRightWidth:Ux,borderBottomWidth:Ux,borderLeftWidth:Ux,borderRadius:Ux,radius:Ux,borderTopLeftRadius:Ux,borderTopRightRadius:Ux,borderBottomRightRadius:Ux,borderBottomLeftRadius:Ux,width:Ux,maxWidth:Ux,height:Ux,maxHeight:Ux,top:Ux,right:Ux,bottom:Ux,left:Ux,padding:Ux,paddingTop:Ux,paddingRight:Ux,paddingBottom:Ux,paddingLeft:Ux,margin:Ux,marginTop:Ux,marginRight:Ux,marginBottom:Ux,marginLeft:Ux,backgroundPositionX:Ux,backgroundPositionY:Ux},aS={rotate:Ox,rotateX:Ox,rotateY:Ox,rotateZ:Ox,scale:Tx,scaleX:Tx,scaleY:Tx,scaleZ:Tx,skew:Ox,skewX:Ox,skewY:Ox,distance:Ux,translateX:Ux,translateY:Ux,translateZ:Ux,x:Ux,y:Ux,z:Ux,perspective:Ux,transformPerspective:Ux,opacity:Ex,originX:Hx,originY:Hx,originZ:Ux},sS=h(h({},wx),{},{transform:Math.round}),oS=h(h(h({},rS),aS),{},{zIndex:sS,size:Ux,fillOpacity:Ex,strokeOpacity:Ex,numOctaves:sS}),lS=h(h({},oS),{},{color:jx,backgroundColor:jx,outlineColor:jx,fill:jx,stroke:jx,borderColor:jx,borderTopColor:jx,borderRightColor:jx,borderBottomColor:jx,borderLeftColor:jx,filter:iS,WebkitFilter:iS}),uS=e=>lS[e];function cS(e,t){let n=uS(e);return n!==iS&&(n=$x),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const hS=new Set(["auto","none","0"]);const dS=e=>e===wx||e===Ux,pS=(e,t)=>parseFloat(e.split(", ")[t]),fS=(e,t)=>(n,i)=>{let r=i.transform;if("none"===r||!r)return 0;const a=r.match(/^matrix3d\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)\)$/);if(a)return pS(a[1],t);{const t=r.match(/^matrix\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)\)$/);return t?pS(t[1],e):0}},mS=new Set(["x","y","z"]),gS=Fb.filter(e=>!mS.has(e));const vS={width:(e,t)=>{let n=e.x,i=t.paddingLeft,r=void 0===i?"0":i,a=t.paddingRight,s=void 0===a?"0":a;return n.max-n.min-parseFloat(r)-parseFloat(s)},height:(e,t)=>{let n=e.y,i=t.paddingTop,r=void 0===i?"0":i,a=t.paddingBottom,s=void 0===a?"0":a;return n.max-n.min-parseFloat(r)-parseFloat(s)},top:(e,t)=>{let n=t.top;return parseFloat(n)},left:(e,t)=>{let n=t.left;return parseFloat(n)},bottom:(e,t)=>{let n=e.y,i=t.top;return parseFloat(i)+(n.max-n.min)},right:(e,t)=>{let n=e.x,i=t.left;return parseFloat(i)+(n.max-n.min)},x:fS(4,13),y:fS(5,14)};vS.translateX=vS.x,vS.translateY=vS.y;const yS=new Set;let _S=!1,bS=!1;function xS(){if(bS){const e=Array.from(yS).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{const t=function(e){const t=[];return gS.forEach(n=>{const i=e.getValue(n);void 0!==i&&(t.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),t}(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();const t=n.get(e);t&&t.forEach(t=>{let n=Ma(t,2),i=n[0],r=n[1];var a;null===(a=e.getValue(i))||void 0===a||a.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}bS=!1,_S=!1,yS.forEach(e=>e.complete()),yS.clear()}function SS(){yS.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(bS=!0)})}class AS{constructor(e,t,n,i,r){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=i,this.element=r,this.isAsync=a}scheduleResolve(){this.isScheduled=!0,this.isAsync?(yS.add(this),_S||(_S=!0,Vb.read(SS),Vb.resolveKeyframes(xS))):(this.readKeyframes(),this.complete())}readKeyframes(){const e=this.unresolvedKeyframes,t=this.name,n=this.element,i=this.motionValue;for(let r=0;r/^-?(?:[0-9]+(?:\.[0-9]+)?|\.[0-9]+)$/.test(e),TS=e=>t=>"string"===typeof t&&t.startsWith(e),CS=TS("--"),RS=TS("var(--"),PS=e=>!!RS(e)&&BS.test(e.split("/*")[0].trim()),BS=/var\(--(?:[\x2D0-9A-Z_a-z\u017F\u212A]+[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*|[\x2D0-9A-Z_a-z\u017F\u212A]+[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*,(?:[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*(?:(?![\t-\r \(\)\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uD800-\uDFFF\uFEFF])[^]|[\uD800-\uDBFF][\uDC00-\uDFFF])|[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\((?:(?:(?![\(\)\uD800-\uDFFF])[^]|[\uD800-\uDBFF][\uDC00-\uDFFF])|\((?:(?![\(\)\uD800-\uDFFF])[^]|[\uD800-\uDBFF][\uDC00-\uDFFF])*\))*\))+[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)\)$/i,IS=/^var\(--(?:([\x2D0-9A-Z_a-z]+)|([\x2D0-9A-Z_a-z]+), ?([ #%\(\),-\.0-9A-Za-z]+))\)/;function DS(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;wS(n<=4,'Max CSS variable fallback depth detected in property "'.concat(e,'". This may indicate a circular fallback dependency.'));const i=function(e){const t=IS.exec(e);if(!t)return[,];const n=Ma(t,4),i=n[1],r=n[2],a=n[3];return["--".concat(null!==i&&void 0!==i?i:r),a]}(e),r=Ma(i,2),a=r[0],s=r[1];if(!a)return;const o=window.getComputedStyle(t).getPropertyValue(a);if(o){const e=o.trim();return ES(e)?parseFloat(e):e}return PS(s)?DS(s,t,n+1):s}const FS=e=>t=>t.test(e),LS=[wx,Ux,kx,Ox,Gx,zx,{test:e=>"auto"===e,parse:e=>e}],NS=e=>LS.find(FS(e));class OS extends AS{constructor(e,t,n,i,r){super(e,t,n,i,r,!0)}readKeyframes(){const e=this.unresolvedKeyframes,t=this.element,n=this.name;if(!t||!t.current)return;super.readKeyframes();for(let l=0;l{let n=Ma(e,2),i=n[0],r=n[1];t.getValue(i).set(r)}),this.resolveNoneKeyframes()}}const kS=(e,t)=>"zIndex"!==t&&(!("number"!==typeof e&&!Array.isArray(e))||!("string"!==typeof e||!$x.test(e)&&"0"!==e||e.startsWith("url(")));function US(e,t,n,i){const r=e[0];if(null===r)return!1;if("display"===t||"visibility"===t)return!0;const a=e[e.length-1],s=kS(r,t),o=kS(a,t);return MS(s===o,"You are trying to animate ".concat(t,' from "').concat(r,'" to "').concat(a,'". ').concat(r," is not an animatable value - to enable this animation set ").concat(r," to a value animatable to ").concat(a," via the `style` property.")),!(!s||!o)&&(function(e){const t=e[0];if(1===e.length)return!0;for(let n=0;nnull!==e;function GS(e,t,n){let i=t.repeat,r=t.repeatType,a=void 0===r?"loop":r;const s=e.filter(zS),o=i&&"loop"!==a&&i%2===1?0:s.length-1;return o&&void 0!==n?n:s[o]}const HS=["autoplay","delay","type","repeat","repeatDelay","repeatType"];class VS{constructor(e){let t=e.autoplay,n=void 0===t||t,i=e.delay,r=void 0===i?0:i,a=e.type,s=void 0===a?"keyframes":a,o=e.repeat,l=void 0===o?0:o,u=e.repeatDelay,c=void 0===u?0:u,d=e.repeatType,p=void 0===d?"loop":d,f=W_(e,HS);this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=qb.now(),this.options=h({autoplay:n,delay:r,type:s,repeat:l,repeatDelay:c,repeatType:p},f),this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(SS(),xS()),this._resolved}onKeyframesResolved(e,t){this.resolvedAt=qb.now(),this.hasAttemptedResolve=!0;const n=this.options,i=n.name,r=n.type,a=n.velocity,s=n.delay,o=n.onComplete,l=n.onUpdate;if(!n.isGenerator&&!US(e,i,r,a)){if(cx||!s)return null===l||void 0===l||l(GS(e,this.options,t)),null===o||void 0===o||o(),void this.resolveFinishedPromise();this.options.duration=0}const u=this.initPlayback(e,t);!1!==u&&(this._resolved=h({keyframes:e,finalKeyframe:t},u),this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}const jS=(e,t,n)=>e+(t-e)*n;function WS(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function XS(e,t){return n=>n>0?t:e}const JS=(e,t,n)=>{const i=e*e,r=n*(t*t-i)+i;return r<0?0:Math.sqrt(r)},KS=[Lx,Fx,Vx];function qS(e){const t=(e=>KS.find(t=>t.test(e)))(e);if(MS(Boolean(t),"'".concat(e,"' is not an animatable color. Use the equivalent color code instead.")),!Boolean(t))return!1;let n=t.parse(e);return t===Vx&&(n=function(e){let t=e.hue,n=e.saturation,i=e.lightness,r=e.alpha;t/=360,n/=100,i/=100;let a=0,s=0,o=0;if(n){const e=i<.5?i*(1+n):i+n-i*n,r=2*i-e;a=WS(r,e,t+1/3),s=WS(r,e,t),o=WS(r,e,t-1/3)}else a=s=o=i;return{red:Math.round(255*a),green:Math.round(255*s),blue:Math.round(255*o),alpha:r}}(n)),n}const YS=(e,t)=>{const n=qS(e),i=qS(t);if(!n||!i)return XS(e,t);const r=h({},n);return e=>(r.red=JS(n.red,i.red,e),r.green=JS(n.green,i.green,e),r.blue=JS(n.blue,i.blue,e),r.alpha=jS(n.alpha,i.alpha,e),Fx.transform(r))},QS=(e,t)=>n=>t(e(n)),ZS=function(){for(var e=arguments.length,t=new Array(e),n=0;njS(e,t,n)}function tA(e){return"number"===typeof e?eA:"string"===typeof e?PS(e)?XS:jx.test(e)?YS:rA:Array.isArray(e)?nA:"object"===typeof e?jx.test(e)?YS:iA:XS}function nA(e,t){const n=[...e],i=n.length,r=e.map((e,n)=>tA(e)(e,t[n]));return e=>{for(let t=0;t{for(const t in i)n[t]=i[t](e);return n}}const rA=(e,t)=>{const n=$x.createTransformer(t),i=qx(e),r=qx(t);return i.indexes.var.length===r.indexes.var.length&&i.indexes.color.length===r.indexes.color.length&&i.indexes.number.length>=r.indexes.number.length?$S.has(e)&&!r.values.length||$S.has(t)&&!i.values.length?function(e,t){return $S.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):ZS(nA(function(e,t){var n;const i=[],r={color:0,var:0,number:0};for(let a=0;a{const t=e*h,n=t*r,i=t-l,a=AA(e,h),s=Math.exp(-n);return bA-i/a*s},n=e=>{const n=e*h*r,i=n*l+l,a=Math.pow(h,2)*Math.pow(e,2)*r,s=Math.exp(-n),o=AA(Math.pow(e,2),h);return(-t(e)+bA>0?-1:1)*((i-a)*s)/o}):(t=e=>Math.exp(-e*r)*((e-l)*r+1)-.001,n=e=>Math.exp(-e*r)*(r*r*(l-e)));const d=function(e,t,n){let i=n;for(let r=1;rvoid 0!==e[t])}function TA(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pA;const t="object"!==typeof e?{visualDuration:e,keyframes:[0,1],bounce:arguments.length>1&&void 0!==arguments[1]?arguments[1]:dA}:e;let n=t.restSpeed,i=t.restDelta;const r=t.keyframes[0],a=t.keyframes[t.keyframes.length-1],s={done:!1,value:r},o=function(e){let t=h({velocity:cA,stiffness:oA,damping:lA,mass:uA,isResolvedFromDuration:!1},e);if(!EA(e,wA)&&EA(e,MA))if(e.visualDuration){const n=e.visualDuration,i=2*Math.PI/(1.2*n),r=i*i,a=2*Mx(.05,1,1-(e.bounce||0))*Math.sqrt(r);t=h(h({},t),{},{mass:uA,stiffness:r,damping:a})}else{const n=xA(e);t=h(h(h({},t),n),{},{mass:uA}),t.isResolvedFromDuration=!0}return t}(h(h({},t),{},{velocity:-Ib(t.velocity||0)})),l=o.stiffness,u=o.damping,c=o.mass,d=o.duration,p=o.velocity,f=o.isResolvedFromDuration,m=p||0,g=u/(2*Math.sqrt(l*c)),v=a-r,y=Ib(Math.sqrt(l/c)),_=Math.abs(v)<5;let b;if(n||(n=_?fA.granular:fA.default),i||(i=_?mA.granular:mA.default),g<1){const e=AA(y,g);b=t=>{const n=Math.exp(-g*y*t);return a-n*((m+g*y*v)/e*Math.sin(e*t)+v*Math.cos(e*t))}}else if(1===g)b=e=>a-Math.exp(-y*e)*(v+(m+y*v)*e);else{const e=y*Math.sqrt(g*g-1);b=t=>{const n=Math.exp(-g*y*t),i=Math.min(e*t,300);return a-n*((m+g*y*v)*Math.sinh(i)+e*v*Math.cosh(i))/e}}const x={calculatedDuration:f&&d||null,next:e=>{const t=b(e);if(f)s.done=e>=d;else{let r=0;g<1&&(r=0===e?Bb(m):sA(b,e,t));const o=Math.abs(r)<=n,l=Math.abs(a-t)<=i;s.done=o&&l}return s.value=s.done?a:t,s},toString:()=>{const e=Math.min(sb(x),ab),t=fb(t=>x.next(e*t).value,e,30);return e+"ms "+t}};return x}function CA(e){let t=e.keyframes,n=e.velocity,i=void 0===n?0:n,r=e.power,a=void 0===r?.8:r,s=e.timeConstant,o=void 0===s?325:s,l=e.bounceDamping,u=void 0===l?10:l,c=e.bounceStiffness,h=void 0===c?500:c,d=e.modifyTarget,p=e.min,f=e.max,m=e.restDelta,g=void 0===m?.5:m,v=e.restSpeed;const y=t[0],_={done:!1,value:y},b=e=>void 0===p?f:void 0===f||Math.abs(p-e)-x*Math.exp(-e/o),w=e=>A+M(e),E=e=>{const t=M(e),n=w(e);_.done=Math.abs(t)<=g,_.value=_.done?A:n};let T,C;const R=e=>{(e=>void 0!==p&&ef)(_.value)&&(T=e,C=TA({keyframes:[_.value,b(_.value)],velocity:sA(w,e,_.value),damping:u,stiffness:h,restDelta:g,restSpeed:v}))};return R(0),{calculatedDuration:null,next:e=>{let t=!1;return C||void 0!==T||(t=!0,E(e),R(e)),void 0!==T&&e>=T?C.next(e-T):(!t&&E(e),_)}}}const RA=dx(.42,0,1,1),PA=dx(0,0,.58,1),BA=dx(.42,0,.58,1),IA={linear:Db,easeIn:RA,easeInOut:BA,easeOut:PA,circIn:_x,circInOut:xx,circOut:bx,backIn:gx,backInOut:vx,backOut:mx,anticipate:yx},DA=e=>{if(ub(e)){wS(4===e.length,"Cubic bezier arrays must contain four numerical values.");const t=Ma(e,4);return dx(t[0],t[1],t[2],t[3])}return"string"===typeof e?(wS(void 0!==IA[e],"Invalid easing type '".concat(e,"'")),IA[e]):e};function FA(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.clamp,r=void 0===i||i,a=n.ease,s=n.mixer;const o=e.length;if(wS(o===t.length,"Both input and output ranges must be the same length"),1===o)return()=>t[0];if(2===o&&t[0]===t[1])return()=>t[1];const l=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const u=function(e,t,n){const i=[],r=n||aA,a=e.length-1;for(let s=0;s{if(l&&n1)for(;ih(Mx(e[0],e[o-1],t)):h}function LA(e){const t=[0];return function(e,t){const n=e[e.length-1];for(let i=1;i<=t;i++){const r=pb(0,t,i);e.push(jS(n,1,r))}}(t,e.length-1),t}function NA(e){let t=e.duration,n=void 0===t?300:t,i=e.keyframes,r=e.times,a=e.ease,s=void 0===a?"easeInOut":a;const o=(e=>Array.isArray(e)&&"number"!==typeof e[0])(s)?s.map(DA):DA(s),l={done:!1,value:i[0]},u=function(e,t){return e.map(e=>e*t)}(r&&r.length===i.length?r:LA(i),n),c=FA(u,i,{ease:Array.isArray(o)?o:(h=i,d=o,h.map(()=>d||BA).splice(0,h.length-1))});var h,d;return{calculatedDuration:n,next:e=>(l.value=c(e),l.done=e>=n,l)}}const OA=e=>{const t=t=>{let n=t.timestamp;return e(n)};return{start:()=>Vb.update(t,!0),stop:()=>jb(t),now:()=>Wb.isProcessing?Wb.timestamp:qb.now()}},kA={decay:CA,inertia:CA,tween:NA,keyframes:NA,spring:TA},UA=e=>e/100;class zA extends VS{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();const e=this.options.onStop;e&&e()};const t=this.options,n=t.name,i=t.motionValue,r=t.element,a=t.keyframes,s=(null===r||void 0===r?void 0:r.KeyframeResolver)||AS;this.resolver=new s(a,(e,t)=>this.onKeyframesResolved(e,t),n,i,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){const t=this.options,n=t.type,i=void 0===n?"keyframes":n,r=t.repeat,a=void 0===r?0:r,s=t.repeatDelay,o=void 0===s?0:s,l=t.repeatType,u=t.velocity,c=void 0===u?0:u,d=ob(i)?i:kA[i]||NA;let p,f;d!==NA&&"number"!==typeof e[0]&&(p=ZS(UA,aA(e[0],e[1])),e=[0,100]);const m=d(h(h({},this.options),{},{keyframes:e}));"mirror"===l&&(f=d(h(h({},this.options),{},{keyframes:[...e].reverse(),velocity:-c}))),null===m.calculatedDuration&&(m.calculatedDuration=sb(m));const g=m.calculatedDuration,v=g+o;return{generator:m,mirroredGenerator:f,mapPercentToKeyframes:p,calculatedDuration:g,resolvedDuration:v,totalDuration:v*(a+1)-o}}onPostResolved(){const e=this.options.autoplay,t=void 0===e||e;this.play(),"paused"!==this.pendingPlayState&&t?this.state=this.pendingPlayState:this.pause()}tick(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.resolved;if(!n){const e=this.options.keyframes;return{done:!0,value:e[e.length-1]}}const i=n.finalKeyframe,r=n.generator,a=n.mirroredGenerator,s=n.mapPercentToKeyframes,o=n.keyframes,l=n.calculatedDuration,u=n.totalDuration,c=n.resolvedDuration;if(null===this.startTime)return r.next(0);const h=this.options,d=h.delay,p=h.repeat,f=h.repeatType,m=h.repeatDelay,g=h.onUpdate;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-u/this.speed,this.startTime)),t?this.currentTime=e:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const v=this.currentTime-d*(this.speed>=0?1:-1),y=this.speed>=0?v<0:v>u;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let _=this.currentTime,b=r;if(p){const e=Math.min(this.currentTime,u)/c;let t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,t=Math.min(t,p+1);Boolean(t%2)&&("reverse"===f?(n=1-n,m&&(n-=m/c)):"mirror"===f&&(b=a)),_=Mx(0,1,n)*c}const x=y?{done:!1,value:o[0]}:b.next(_);s&&(x.value=s(x.value));let S=x.done;y||null===l||(S=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const A=null===this.holdTime&&("finished"===this.state||"running"===this.state&&S);return A&&void 0!==i&&(x.value=GS(o,this.options,i)),g&&g(x.value),A&&this.finish(),x}get duration(){const e=this.resolved;return e?Ib(e.calculatedDuration):0}get time(){return Ib(this.currentTime)}set time(e){e=Bb(e),this.currentTime=e,null!==this.holdTime||0===this.speed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Ib(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved)return void(this.pendingPlayState="running");if(this.isStopped)return;const e=this.options,t=e.driver,n=void 0===t?OA:t,i=e.onPlay,r=e.startTime;this.driver||(this.driver=n(e=>this.tick(e))),i&&i();const a=this.driver.now();null!==this.holdTime?this.startTime=a-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=a):this.startTime=null!==r&&void 0!==r?r:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;this._resolved?(this.state="paused",this.holdTime=null!==(e=this.currentTime)&&void 0!==e?e:0):this.pendingPlayState="paused"}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const e=this.options.onComplete;e&&e()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const GA=new Set(["opacity","clipPath","filter","transform"]);const HA=eb(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),VA=["onComplete","onUpdate","motionValue","element"],jA=["motionValue","onUpdate","onComplete","element"];const WA={anticipate:yx,backInOut:vx,circInOut:xx};class XA extends VS{constructor(e){super(e);const t=this.options,n=t.name,i=t.motionValue,r=t.element,a=t.keyframes;this.resolver=new OS(a,(e,t)=>this.onKeyframesResolved(e,t),n,i,r),this.resolver.scheduleResolve()}initPlayback(e,t){var n;let i=this.options,r=i.duration,a=void 0===r?300:r,s=i.times,o=i.ease,l=i.type,u=i.motionValue,c=i.name,d=i.startTime;if(!(null===(n=u.owner)||void 0===n?void 0:n.current))return!1;var p;if("string"===typeof o&&db()&&o in WA&&(o=WA[o]),ob((p=this.options).type)||"spring"===p.type||!mb(p.ease)){const t=this.options,n=(t.onComplete,t.onUpdate,t.motionValue,t.element,W_(t,VA)),i=function(e,t){const n=new zA(h(h({},t),{},{keyframes:e,repeat:0,delay:0,isGenerator:!0}));let i={done:!1,value:e[0]};const r=[];let a=0;for(;!i.done&&a<2e4;)i=n.sample(a),r.push(i.value),a+=10;return{times:void 0,keyframes:r,duration:a-10,ease:"linear"}}(e,n);1===(e=i.keyframes).length&&(e[1]=e[0]),a=i.duration,s=i.times,o=i.ease,l="keyframes"}const f=function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i.delay,a=void 0===r?0:r,s=i.duration,o=void 0===s?300:s,l=i.repeat,u=void 0===l?0:l,c=i.repeatType,h=void 0===c?"loop":c,d=i.ease,p=void 0===d?"easeInOut":d,f=i.times;const m={[t]:n};f&&(m.offset=f);const g=yb(p,o);return Array.isArray(g)&&(m.easing=g),e.animate(m,{delay:a,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:u+1,direction:"reverse"===h?"alternate":"normal"})}(u.owner.current,c,e,h(h({},this.options),{},{duration:a,times:s,ease:o}));return f.startTime=null!==d&&void 0!==d?d:this.calcStartTime(),this.pendingTimeline?(lb(f,this.pendingTimeline),this.pendingTimeline=void 0):f.onfinish=()=>{const n=this.options.onComplete;u.set(GS(e,this.options,t)),n&&n(),this.cancel(),this.resolveFinishedPromise()},{animation:f,duration:a,times:s,type:l,ease:o,keyframes:e}}get duration(){const e=this.resolved;if(!e)return 0;const t=e.duration;return Ib(t)}get time(){const e=this.resolved;if(!e)return 0;const t=e.animation;return Ib(t.currentTime||0)}set time(e){const t=this.resolved;if(!t)return;t.animation.currentTime=Bb(e)}get speed(){const e=this.resolved;if(!e)return 1;return e.animation.playbackRate}set speed(e){const t=this.resolved;if(!t)return;t.animation.playbackRate=e}get state(){const e=this.resolved;if(!e)return"idle";return e.animation.playState}get startTime(){const e=this.resolved;if(!e)return null;return e.animation.startTime}attachTimeline(e){if(this._resolved){const t=this.resolved;if(!t)return Db;lb(t.animation,e)}else this.pendingTimeline=e;return Db}play(){if(this.isStopped)return;const e=this.resolved;if(!e)return;const t=e.animation;"finished"===t.playState&&this.updateFinishedPromise(),t.play()}pause(){const e=this.resolved;if(!e)return;e.animation.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();const e=this.resolved;if(!e)return;const t=e.animation,n=e.keyframes,i=e.duration,r=e.type,a=e.ease,s=e.times;if("idle"===t.playState||"finished"===t.playState)return;if(this.time){const e=this.options,t=e.motionValue,o=(e.onUpdate,e.onComplete,e.element,W_(e,jA)),l=new zA(h(h({},o),{},{keyframes:n,duration:i,type:r,ease:a,times:s,isGenerator:!0})),u=Bb(this.time);t.setWithVelocity(l.sample(u-10).value,l.sample(u).value,10)}const o=this.options.onStop;o&&o(),this.cancel()}complete(){const e=this.resolved;e&&e.animation.finish()}cancel(){const e=this.resolved;e&&e.animation.cancel()}static supports(e){const t=e.motionValue,n=e.name,i=e.repeatDelay,r=e.repeatType,a=e.damping,s=e.type;return HA()&&n&&GA.has(n)&&t&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate&&!i&&"mirror"!==r&&0!==a&&"inertia"!==s}}const JA={type:"spring",stiffness:500,damping:25,restSpeed:10},KA={type:"keyframes",duration:.8},qA={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},YA=(e,t)=>{let n=t.keyframes;return n.length>2?KA:Lb.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===n[1]?2*Math.sqrt(550):30,restSpeed:10}:JA:qA},QA=["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"];const ZA=function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;return s=>{const o=rb(i,e)||{},l=o.delay||i.delay||0;let u=i.elapsed,c=void 0===u?0:u;c-=Bb(l);let d=h(h({keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity()},o),{},{delay:-c,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{s(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:a?void 0:r});(function(e){e.when,e.delay,e.delayChildren,e.staggerChildren,e.staggerDirection,e.repeat,e.repeatType,e.repeatDelay,e.from,e.elapsed;let t=W_(e,QA);return!!Object.keys(t).length})(o)||(d=h(h({},d),YA(e,d))),d.duration&&(d.duration=Bb(d.duration)),d.repeatDelay&&(d.repeatDelay=Bb(d.repeatDelay)),void 0!==d.from&&(d.keyframes[0]=d.from);let p=!1;if((!1===d.type||0===d.duration&&!d.repeatDelay)&&(d.duration=0,0===d.delay&&(p=!0)),(cx||kb)&&(p=!0,d.duration=0,d.delay=0),p&&!a&&void 0!==t.get()){const e=GS(d.keyframes,o);if(void 0!==e)return Vb.update(()=>{d.onUpdate(e),d.onComplete()}),new ib([])}return!a&&XA.supports(d)?new XA(d):new zA(d)}},$A=["transition","transitionEnd"];function eM(e,t){let n=e.protectedKeys,i=e.needsAnimating;const r=n.hasOwnProperty(t)&&!0!==i[t];return i[t]=!1,r}function tM(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.delay,r=void 0===i?0:i,a=n.transitionOverride,s=n.type;var o;let l=t.transition,u=void 0===l?e.getDefaultTransition():l,c=t.transitionEnd,d=W_(t,$A);a&&(u=a);const p=[],f=s&&e.animationState&&e.animationState.getState()[s];for(const m in d){const t=e.getValue(m,null!==(o=e.latestValues[m])&&void 0!==o?o:null),n=d[m];if(void 0===n||f&&eM(f,m))continue;const i=h({delay:r},rb(u||{},m));let a=!1;if(window.MotionHandoffAnimation){const t=ux(e);if(t){const e=window.MotionHandoffAnimation(t,m,Vb);null!==e&&(i.startTime=e,a=!0)}}sx(e,m),t.start(ZA(m,t,n,e.shouldReduceMotion&&Nb.has(m)?{type:!1}:i,e,a));const s=t.animation;s&&p.push(s)}return c&&Promise.all(p).then(()=>{Vb.update(()=>{c&&function(e,t){let n=Q_(e,t)||{},i=n.transitionEnd,r=void 0===i?{}:i,a=(n.transition,W_(n,ix));a=h(h({},a),r);for(const s in a)rx(e,s,Ob(a[s]))}(e,c)})}),p}function nM(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var i;const r=Q_(e,t,"exit"===n.type?null===(i=e.presenceContext)||void 0===i?void 0:i.custom:void 0);let a=(r||{}).transition,s=void 0===a?e.getDefaultTransition()||{}:a;n.transitionOverride&&(s=n.transitionOverride);const o=r?()=>Promise.all(tM(e,r,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?function(){let i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const r=s,a=r.delayChildren,o=void 0===a?0:a,l=r.staggerChildren,u=r.staggerDirection;return function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,a=arguments.length>5?arguments[5]:void 0;const s=[],o=(e.variantChildren.size-1)*i,l=1===r?function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)*i}:function(){return o-(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)*i};return Array.from(e.variantChildren).sort(iM).forEach((e,i)=>{e.notify("AnimationStart",t),s.push(nM(e,t,h(h({},a),{},{delay:n+l(i)})).then(()=>e.notify("AnimationComplete",t)))}),Promise.all(s)}(e,t,o+i,l,u,n)}:()=>Promise.resolve(),u=s.when;if(u){const e=Ma("beforeChildren"===u?[o,l]:[l,o],2),t=e[0],n=e[1];return t().then(()=>n())}return Promise.all([o(),l(n.delay)])}function iM(e,t){return e.sortNodePosition(t)}const rM=$_.length;function aM(e){if(!e)return;if(!e.isControllingVariants){const t=e.parent&&aM(e.parent)||{};return void 0!==e.props.initial&&(t.initial=e.props.initial),t}const t={};for(let n=0;nPromise.all(t.map(t=>{let n=t.animation,i=t.options;return function(e,t){let n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(e.notify("AnimationStart",t),Array.isArray(t)){const r=t.map(t=>nM(e,t,i));n=Promise.all(r)}else if("string"===typeof t)n=nM(e,t,i);else{const r="function"===typeof t?Q_(e,t,i.custom):t;n=Promise.all(tM(e,r,i))}return n.then(()=>{e.notify("AnimationComplete",t)})}(e,n,i)}))}function cM(e){let t=uM(e),n=pM(),i=!0;const r=t=>(n,i)=>{var r;const a=Q_(e,i,"exit"===t?null===(r=e.presenceContext)||void 0===r?void 0:r.custom:void 0);if(a){a.transition;const e=a.transitionEnd,t=W_(a,sM);n=h(h(h({},n),t),e)}return n};function a(a){const s=e.props,o=aM(e.parent)||{},l=[],u=new Set;let c={},d=1/0;for(let t=0;td&&g,x=!1;const S=Array.isArray(m)?m:[m];let A=S.reduce(r(p),{});!1===v&&(A={});const M=f.prevResolvedValues,w=void 0===M?{}:M,E=h(h({},w),A),T=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),f.needsAnimating[t]=!0;const n=e.getValue(t);n&&(n.liveStyle=!1)};for(const e in E){const t=A[e],n=w[e];if(c.hasOwnProperty(e))continue;let i=!1;i=X_(t)&&X_(n)?!J_(t,n):t!==n,i?void 0!==t&&null!==t?T(e):u.add(e):void 0!==t&&u.has(e)?T(e):f.protectedKeys[e]=!0}f.prevProp=m,f.prevResolvedValues=A,f.isActive&&(c=h(h({},c),A)),i&&e.blockInitialAnimation&&(b=!1);b&&(!(y&&_)||x)&&l.push(...S.map(e=>({animation:e,options:{type:p}})))}if(u.size){const t={};u.forEach(n=>{const i=e.getBaseTarget(n),r=e.getValue(n);r&&(r.liveStyle=!0),t[n]=null!==i&&void 0!==i?i:null}),l.push({animation:t})}let p=Boolean(l.length);return!i||!1!==s.initial&&s.initial!==s.animate||e.manuallyAnimateOnMount||(p=!1),i=!1,p?t(l):Promise.resolve()}return{animateChanges:a,setActive:function(t,i){var r;if(n[t].isActive===i)return Promise.resolve();null===(r=e.variantChildren)||void 0===r||r.forEach(e=>{var n;return null===(n=e.animationState)||void 0===n?void 0:n.setActive(t,i)}),n[t].isActive=i;const s=a(t);for(const e in n)n[e].protectedKeys={};return s},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=pM(),i=!0}}}function hM(e,t){return"string"===typeof t?t!==e:!!Array.isArray(t)&&!J_(t,e)}function dM(){return{isActive:arguments.length>0&&void 0!==arguments[0]&&arguments[0],protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function pM(){return{animate:dM(!0),whileInView:dM(),whileHover:dM(),whileTap:dM(),whileDrag:dM(),whileFocus:dM(),exit:dM()}}class fM{constructor(e){this.isMounted=!1,this.node=e}update(){}}let mM=0;const gM={animation:{Feature:class extends fM{constructor(e){super(e),e.animationState||(e.animationState=cM(e))}updateAnimationControlsSubscription(){const e=this.node.getProps().animate;j_(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){this.node.getProps().animate!==(this.node.prevProps||{}).animate&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),null===(e=this.unmountControls)||void 0===e||e.call(this)}}},exit:{Feature:class extends fM{constructor(){super(...arguments),this.id=mM++}update(){if(!this.node.presenceContext)return;const e=this.node.presenceContext,t=e.isPresent,n=e.onExitComplete,i=(this.node.prevPresenceContext||{}).isPresent;if(!this.node.animationState||t===i)return;const r=this.node.animationState.setActive("exit",!t);n&&!t&&r.then(()=>n(this.id))}mount(){const e=(this.node.presenceContext||{}).register;e&&(this.unmount=e(this.id))}unmount(){}}}};function vM(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{passive:!0};return e.addEventListener(t,n,i),()=>e.removeEventListener(t,n)}function yM(e){return{point:{x:e.pageX,y:e.pageY}}}function _M(e,t,n,i){return vM(e,t,(e=>t=>Mb(t)&&e(t,yM(t)))(n),i)}const bM=(e,t)=>Math.abs(e-t);class xM{constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.transformPagePoint,r=n.contextWindow,a=n.dragSnapToOrigin,s=void 0!==a&&a;if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!this.lastMoveEvent||!this.lastMoveEventInfo)return;const e=MM(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){const n=bM(e.x,t.x),i=bM(e.y,t.y);return Math.sqrt(n**2+i**2)}(e.offset,{x:0,y:0})>=3;if(!t&&!n)return;const i=e.point,r=Wb.timestamp;this.history.push(h(h({},i),{},{timestamp:r}));const a=this.handlers,s=a.onStart,o=a.onMove;t||(s&&s(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=SM(t,this.transformPagePoint),Vb.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();const n=this.handlers,i=n.onEnd,r=n.onSessionEnd,a=n.resumeAnimation;if(this.dragSnapToOrigin&&a&&a(),!this.lastMoveEvent||!this.lastMoveEventInfo)return;const s=MM("pointercancel"===e.type?this.lastMoveEventInfo:SM(t,this.transformPagePoint),this.history);this.startEvent&&i&&i(e,s),r&&r(e,s)},!Mb(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=i,this.contextWindow=r||window;const o=SM(yM(e),this.transformPagePoint),l=o.point,u=Wb.timestamp;this.history=[h(h({},l),{},{timestamp:u})];const c=t.onSessionStart;c&&c(e,MM(o,this.history)),this.removeListeners=ZS(_M(this.contextWindow,"pointermove",this.handlePointerMove),_M(this.contextWindow,"pointerup",this.handlePointerUp),_M(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),jb(this.updatePoint)}}function SM(e,t){return t?{point:t(e.point)}:e}function AM(e,t){return{x:e.x-t.x,y:e.y-t.y}}function MM(e,t){let n=e.point;return{point:n,delta:AM(n,EM(t)),offset:AM(n,wM(t)),velocity:TM(t,.1)}}function wM(e){return e[0]}function EM(e){return e[e.length-1]}function TM(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,i=null;const r=EM(e);for(;n>=0&&(i=e[n],!(r.timestamp-i.timestamp>Bb(t)));)n--;if(!i)return{x:0,y:0};const a=Ib(r.timestamp-i.timestamp);if(0===a)return{x:0,y:0};const s={x:(r.x-i.x)/a,y:(r.y-i.y)/a};return s.x===1/0&&(s.x=0),s.y===1/0&&(s.y=0),s}function CM(e){return e&&"object"===typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}function RM(e){return e.max-e.min}function PM(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5;e.origin=i,e.originPoint=jS(t.min,t.max,e.origin),e.scale=RM(n)/RM(t),e.translate=jS(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function BM(e,t,n,i){PM(e.x,t.x,n.x,i?i.originX:void 0),PM(e.y,t.y,n.y,i?i.originY:void 0)}function IM(e,t,n){e.min=n.min+t.min,e.max=e.min+RM(t)}function DM(e,t,n){e.min=t.min-n.min,e.max=e.min+RM(t)}function FM(e,t,n){DM(e.x,t.x,n.x),DM(e.y,t.y,n.y)}function LM(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function NM(e,t){let n=t.min-e.min,i=t.max-e.max;if(t.max-t.min({x:{min:0,max:0},y:{min:0,max:0}});function GM(e){return[e("x"),e("y")]}function HM(e){let t=e.top;return{x:{min:e.left,max:e.right},y:{min:t,max:e.bottom}}}function VM(e){return void 0===e||1===e}function jM(e){let t=e.scale,n=e.scaleX,i=e.scaleY;return!VM(t)||!VM(n)||!VM(i)}function WM(e){return jM(e)||XM(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function XM(e){return JM(e.x)||JM(e.y)}function JM(e){return e&&"0%"!==e}function KM(e,t,n){return n+t*(e-n)}function qM(e,t,n,i,r){return void 0!==r&&(e=KM(e,r,i)),KM(e,n,i)+t}function YM(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3?arguments[3]:void 0,r=arguments.length>4?arguments[4]:void 0;e.min=qM(e.min,t,n,i,r),e.max=qM(e.max,t,n,i,r)}function QM(e,t){let n=t.x,i=t.y;YM(e.x,n.translate,n.scale,n.originPoint),YM(e.y,i.translate,i.scale,i.originPoint)}const ZM=.999999999999,$M=1.0000000000001;function ew(e,t){e.min=e.min+t,e.max=e.max+t}function tw(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.5;YM(e,t,n,jS(e.min,e.max,r),i)}function nw(e,t){tw(e.x,t.x,t.scaleX,t.scale,t.originX),tw(e.y,t.y,t.scaleY,t.scale,t.originY)}function iw(e,t){return HM(function(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),i=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}(e.getBoundingClientRect(),t))}const rw=e=>{let t=e.current;return t?t.ownerDocument.defaultView:null},aw=new WeakMap;class sw{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic={x:{min:0,max:0},y:{min:0,max:0}},this.visualElement=e}start(e){let t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).snapToCursor,n=void 0!==t&&t;const i=this.visualElement.presenceContext;if(i&&!1===i.isPresent)return;const r=this.getProps().dragSnapToOrigin;this.panSession=new xM(e,{onSessionStart:e=>{this.getProps().dragSnapToOrigin?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(yM(e).point)},onStart:(e,t)=>{const n=this.getProps(),i=n.drag,r=n.dragPropagation,a=n.onDragStart;if(i&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock="x"===(s=i)||"y"===s?_b[s]?null:(_b[s]=!0,()=>{_b[s]=!1}):_b.x||_b.y?null:(_b.x=_b.y=!0,()=>{_b.x=_b.y=!1}),!this.openDragLock))return;var s;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),GM(e=>{let t=this.getAxisMotionValue(e).get()||0;if(kx.test(t)){const n=this.visualElement.projection;if(n&&n.layout){const i=n.layout.layoutBox[e];if(i){t=RM(i)*(parseFloat(t)/100)}}}this.originPoint[e]=t}),a&&Vb.postRender(()=>a(e,t)),sx(this.visualElement,"transform");const o=this.visualElement.animationState;o&&o.setActive("whileDrag",!0)},onMove:(e,t)=>{const n=this.getProps(),i=n.dragPropagation,r=n.dragDirectionLock,a=n.onDirectionLock,s=n.onDrag;if(!i&&!this.openDragLock)return;const o=t.offset;if(r&&null===this.currentDirection)return this.currentDirection=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=null;Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x");return n}(o),void(null!==this.currentDirection&&a&&a(this.currentDirection));this.updateAxis("x",t.point,o),this.updateAxis("y",t.point,o),this.visualElement.render(),s&&s(e,t)},onSessionEnd:(e,t)=>this.stop(e,t),resumeAnimation:()=>GM(e=>{var t;return"paused"===this.getAnimationState(e)&&(null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.play())})},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:r,contextWindow:rw(this.visualElement)})}stop(e,t){const n=this.isDragging;if(this.cancel(),!n)return;const i=t.velocity;this.startAnimation(i);const r=this.getProps().onDragEnd;r&&Vb.postRender(()=>r(e,t))}cancel(){this.isDragging=!1;const e=this.visualElement,t=e.projection,n=e.animationState;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;!this.getProps().dragPropagation&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,t,n){const i=this.getProps().drag;if(!n||!ow(e,i,this.currentDirection))return;const r=this.getAxisMotionValue(e);let a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=function(e,t,n){let i=t.min,r=t.max;return void 0!==i&&er&&(e=n?jS(r,e,n.max):Math.min(e,r)),e}(a,this.constraints[e],this.elastic[e])),r.set(a)}resolveConstraints(){var e;const t=this.getProps(),n=t.dragConstraints,i=t.dragElastic,r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null===(e=this.visualElement.projection)||void 0===e?void 0:e.layout,a=this.constraints;n&&CM(n)?this.constraints||(this.constraints=this.resolveRefConstraints()):this.constraints=!(!n||!r)&&function(e,t){let n=t.top,i=t.left,r=t.bottom,a=t.right;return{x:LM(e.x,i,a),y:LM(e.y,n,r)}}(r.layoutBox,n),this.elastic=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:OM;return!1===e?e=0:!0===e&&(e=OM),{x:kM(e,"left","right"),y:kM(e,"top","bottom")}}(i),a!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&GM(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){const n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){const e=this.getProps(),t=e.dragConstraints,n=e.onMeasureDragConstraints;if(!t||!CM(t))return!1;const i=t.current;wS(null!==i,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const r=this.visualElement.projection;if(!r||!r.layout)return!1;const a=function(e,t,n){const i=iw(e,n),r=t.scroll;return r&&(ew(i.x,r.offset.x),ew(i.y,r.offset.y)),i}(i,r.root,this.visualElement.getTransformPagePoint());let s=function(e,t){return{x:NM(e.x,t.x),y:NM(e.y,t.y)}}(r.layout.layoutBox,a);if(n){const e=n(function(e){let t=e.x,n=e.y;return{top:n.min,right:t.max,bottom:n.max,left:t.min}}(s));this.hasMutatedConstraints=!!e,e&&(s=HM(e))}return s}startAnimation(e){const t=this.getProps(),n=t.drag,i=t.dragMomentum,r=t.dragElastic,a=t.dragTransition,s=t.dragSnapToOrigin,o=t.onDragTransitionEnd,l=this.constraints||{},u=GM(t=>{if(!ow(t,n,this.currentDirection))return;let o=l&&l[t]||{};s&&(o={min:0,max:0});const u=r?200:1e6,c=r?40:1e7,d=h(h({type:"inertia",velocity:i?e[t]:0,bounceStiffness:u,bounceDamping:c,timeConstant:750,restDelta:1,restSpeed:10},a),o);return this.startAxisValueAnimation(t,d)});return Promise.all(u).then(o)}startAxisValueAnimation(e,t){const n=this.getAxisMotionValue(e);return sx(this.visualElement,e),n.start(ZA(e,n,0,t,this.visualElement,!1))}stopAnimation(){GM(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){GM(e=>{var t;return null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.pause()})}getAnimationState(e){var t;return null===(t=this.getAxisMotionValue(e).animation)||void 0===t?void 0:t.state}getAxisMotionValue(e){const t="_drag".concat(e.toUpperCase()),n=this.visualElement.getProps(),i=n[t];return i||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){GM(t=>{if(!ow(t,this.getProps().drag,this.currentDirection))return;const n=this.visualElement.projection,i=this.getAxisMotionValue(t);if(n&&n.layout){const r=n.layout.layoutBox[t],a=r.min,s=r.max;i.set(e[t]-jS(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const e=this.getProps(),t=e.drag,n=e.dragConstraints,i=this.visualElement.projection;if(!CM(n)||!i||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};GM(e=>{const t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){const n=t.get();r[e]=function(e,t){let n=.5;const i=RM(e),r=RM(t);return r>i?n=pb(t.min,t.max-i,e.min):i>r&&(n=pb(e.min,e.max-r,t.min)),Mx(0,1,n)}({min:n,max:n},this.constraints[e])}});const a=this.visualElement.getProps().transformTemplate;this.visualElement.current.style.transform=a?a({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),GM(e=>{if(!ow(e,t,null))return;const n=this.getAxisMotionValue(e),i=this.constraints[e],a=i.min,s=i.max;n.set(jS(a,s,r[e]))})}addListeners(){if(!this.visualElement.current)return;aw.set(this.visualElement,this);const e=_M(this.visualElement.current,"pointerdown",e=>{const t=this.getProps(),n=t.drag,i=t.dragListener;n&&(void 0===i||i)&&this.start(e)}),t=()=>{const e=this.getProps().dragConstraints;CM(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},n=this.visualElement.projection,i=n.addEventListener("measure",t);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),Vb.read(t);const r=vM(window,"resize",()=>this.scalePositionWithinConstraints()),a=n.addEventListener("didUpdate",e=>{let t=e.delta,n=e.hasLayoutChanged;this.isDragging&&n&&(GM(e=>{const n=this.getAxisMotionValue(e);n&&(this.originPoint[e]+=t[e].translate,n.set(n.get()+t[e].translate))}),this.visualElement.render())});return()=>{r(),e(),i(),a&&a()}}getProps(){const e=this.visualElement.getProps(),t=e.drag,n=void 0!==t&&t,i=e.dragDirectionLock,r=void 0!==i&&i,a=e.dragPropagation,s=void 0!==a&&a,o=e.dragConstraints,l=void 0!==o&&o,u=e.dragElastic,c=void 0===u?OM:u,d=e.dragMomentum,p=void 0===d||d;return h(h({},e),{},{drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:l,dragElastic:c,dragMomentum:p})}}function ow(e,t,n){return(!0===t||t===e)&&(null===n||n===e)}const lw=e=>(t,n)=>{e&&Vb.postRender(()=>e(t,n))};const uw=(0,r.createContext)(null);const cw=(0,r.createContext)({}),hw=(0,r.createContext)({}),dw={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function pw(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const fw={correct:(e,t)=>{if(!t.target)return e;if("string"===typeof e){if(!Ux.test(e))return e;e=parseFloat(e)}const n=pw(e,t.target.x),i=pw(e,t.target.y);return"".concat(n,"% ").concat(i,"%")}},mw={correct:(e,t)=>{let n=t.treeScale,i=t.projectionDelta;const r=e,a=$x.parse(e);if(a.length>5)return r;const s=$x.createTransformer(e),o="number"!==typeof a[0]?1:0,l=i.x.scale*n.x,u=i.y.scale*n.y;a[0+o]/=l,a[1+o]/=u;const c=jS(l,u,.5);return"number"===typeof a[2+o]&&(a[2+o]/=c),"number"===typeof a[3+o]&&(a[3+o]/=c),s(a)}},gw={};const vw=Gb(queueMicrotask,!1),yw=vw.schedule;vw.cancel;class _w extends r.Component{componentDidMount(){const e=this.props,t=e.visualElement,n=e.layoutGroup,i=e.switchLayoutGroup,r=e.layoutId,a=t.projection;var s;s=xw,Object.assign(gw,s),a&&(n.group&&n.group.add(a),i&&i.register&&r&&i.register(a),a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions(h(h({},a.options),{},{onExitComplete:()=>this.safeToRemove()}))),dw.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const t=this.props,n=t.layoutDependency,i=t.visualElement,r=t.drag,a=t.isPresent,s=i.projection;return s?(s.isPresent=a,r||e.layoutDependency!==n||void 0===n?s.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?s.promote():s.relegate()||Vb.postRender(()=>{const e=s.getStack();e&&e.members.length||this.safeToRemove()})),null):null}componentDidUpdate(){const e=this.props.visualElement.projection;e&&(e.root.didUpdate(),yw.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const e=this.props,t=e.visualElement,n=e.layoutGroup,i=e.switchLayoutGroup,r=t.projection;r&&(r.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(r),i&&i.deregister&&i.deregister(r))}safeToRemove(){const e=this.props.safeToRemove;e&&e()}render(){return null}}function bw(e){const t=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=(0,r.useContext)(uw);if(null===t)return[!0,null];const n=t.isPresent,i=t.onExitComplete,a=t.register,s=(0,r.useId)();(0,r.useEffect)(()=>{e&&a(s)},[e]);const o=(0,r.useCallback)(()=>e&&i&&i(s),[s,i,e]);return!n&&i?[!1,o]:[!0]}(),n=Ma(t,2),i=n[0],a=n[1],s=(0,r.useContext)(cw);return(0,Be.jsx)(_w,h(h({},e),{},{layoutGroup:s,switchLayoutGroup:(0,r.useContext)(hw),isPresent:i,safeToRemove:a}))}const xw={borderRadius:h(h({},fw),{},{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:fw,borderTopRightRadius:fw,borderBottomLeftRadius:fw,borderBottomRightRadius:fw,boxShadow:mw};const Sw=(e,t)=>e.depth-t.depth;class Aw{constructor(){this.children=[],this.isDirty=!1}add(e){Yb(this.children,e),this.isDirty=!0}remove(e){Qb(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Sw),this.isDirty=!1,this.children.forEach(e)}}function Mw(e,t){const n=qb.now(),i=r=>{const a=r.timestamp-n;a>=t&&(jb(i),e(a-t))};return Vb.read(i,!0),()=>jb(i)}function ww(e){const t=ax(e)?e.get():e;return(e=>Boolean(e&&"object"===typeof e&&e.mix&&e.toValue))(t)?t.toValue():t}const Ew=["TopLeft","TopRight","BottomLeft","BottomRight"],Tw=Ew.length,Cw=e=>"string"===typeof e?parseFloat(e):e,Rw=e=>"number"===typeof e||Ux.test(e);function Pw(e,t){return void 0!==e[t]?e[t]:e.borderRadius}const Bw=Dw(0,.5,bx),Iw=Dw(.5,.95,Db);function Dw(e,t,n){return i=>it?1:n(pb(e,t,i))}function Fw(e,t){e.min=t.min,e.max=t.max}function Lw(e,t){Fw(e.x,t.x),Fw(e.y,t.y)}function Nw(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function Ow(e,t,n,i,r){return e=KM(e-=t,1/n,i),void 0!==r&&(e=KM(e,1/r,i)),e}function kw(e,t,n,i,r){let a=Ma(n,3),s=a[0],o=a[1],l=a[2];!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.5,r=arguments.length>4?arguments[4]:void 0,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:e;kx.test(t)&&(t=parseFloat(t),t=jS(s.min,s.max,t/100)-s.min);if("number"!==typeof t)return;let o=jS(a.min,a.max,i);e===a&&(o-=t),e.min=Ow(e.min,t,n,o,r),e.max=Ow(e.max,t,n,o,r)}(e,t[s],t[o],t[l],t.scale,i,r)}const Uw=["x","scaleX","originX"],zw=["y","scaleY","originY"];function Gw(e,t,n,i){kw(e.x,t,Uw,n?n.x:void 0,i?i.x:void 0),kw(e.y,t,zw,n?n.y:void 0,i?i.y:void 0)}function Hw(e){return 0===e.translate&&1===e.scale}function Vw(e){return Hw(e.x)&&Hw(e.y)}function jw(e,t){return e.min===t.min&&e.max===t.max}function Ww(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Xw(e,t){return Ww(e.x,t.x)&&Ww(e.y,t.y)}function Jw(e){return RM(e.x)/RM(e.y)}function Kw(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class qw{constructor(){this.members=[]}add(e){Yb(this.members,e),e.scheduleRender()}remove(e){if(Qb(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){const t=this.members.findIndex(t=>e===t);if(0===t)return!1;let n;for(let i=t;i>=0;i--){const e=this.members[i];if(!1!==e.isPresent){n=e;break}}return!!n&&(this.promote(n),!0)}promote(e,t){const n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);!1===e.options.crossfade&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const t=e.options,n=e.resumingFrom;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Yw={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},Qw="undefined"!==typeof window&&void 0!==window.MotionDebug,Zw=["","X","Y","Z"],$w={visibility:"hidden"};let eE=0;function tE(e,t,n,i){const r=t.latestValues;r[e]&&(n[e]=r[e],t.setStaticValue(e,0),i&&(i[e]=0))}function nE(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const t=e.options.visualElement;if(!t)return;const n=ux(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const t=e.options,i=t.layout,r=t.layoutId;window.MotionCancelOptimisedAnimation(n,"transform",Vb,!(i||r))}const i=e.parent;i&&!i.hasCheckedOptimisedAppear&&nE(i)}function iE(e){let t=e.attachResizeListener,n=e.defaultParent,i=e.measureScroll,r=e.checkIsScrollRoot,a=e.resetTransform;return class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===n||void 0===n?void 0:n();this.id=eE++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Qw&&(Yw.totalNodes=Yw.resolvedTargetDeltas=Yw.recalculatedProjection=0),this.nodes.forEach(sE),this.nodes.forEach(pE),this.nodes.forEach(fE),this.nodes.forEach(oE),Qw&&window.MotionDebug.record(Yw)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=t?t.root||t:this,this.path=t?[...t.path,t]:[],this.parent=t,this.depth=t?t.depth+1:0;for(let n=0;n1?n-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:this.root.hasTreeAnimated;if(this.instance)return;var i;this.isSVG=(i=e)instanceof SVGElement&&"svg"!==i.tagName,this.instance=e;const r=this.options,a=r.layoutId,s=r.layout,o=r.visualElement;if(o&&!o.current&&o.mount(e),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(s||a)&&(this.isLayoutDirty=!0),t){let n;const i=()=>this.root.updateBlockedByResize=!1;t(e,()=>{this.root.updateBlockedByResize=!0,n&&n(),n=Mw(i,250),dw.hasAnimatedSinceResize&&(dw.hasAnimatedSinceResize=!1,this.nodes.forEach(dE))})}a&&this.root.registerSharedNode(a,this),!1!==this.options.animate&&o&&(a||s)&&this.addEventListener("didUpdate",e=>{let t=e.delta,n=e.hasLayoutChanged,i=e.hasRelativeTargetChanged,r=e.layout;if(this.isTreeAnimationBlocked())return this.target=void 0,void(this.relativeTarget=void 0);const a=this.options.transition||o.getDefaultTransition()||bE,s=o.getProps(),l=s.onLayoutAnimationStart,u=s.onLayoutAnimationComplete,c=!this.targetLayout||!Xw(this.targetLayout,r)||i,d=!n&&i;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||d||n&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(t,d);const e=h(h({},rb(a,"layout")),{},{onPlay:l,onComplete:u});(o.shouldReduceMotion||this.options.layoutRoot)&&(e.delay=0,e.type=!1),this.startAnimation(e)}else n||dE(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,jb(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(mE),this.animationId++)}getTransformTemplate(){const e=this.options.visualElement;return e&&e.getProps().transformTemplate}willUpdate(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked())return void(this.options.onExitComplete&&this.options.onExitComplete());if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&nE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let a=0;a{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance)return;if(this.updateScroll(),(!this.options.alwaysMeasureLayout||!this.isLead())&&!this.isLayoutDirty)return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:"measure",t=Boolean(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t){const t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:i(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!a)return;const e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!Vw(this.projectionDelta),n=this.getTransformTemplate(),i=n?n(this.latestValues,""):void 0,r=i!==this.prevTransformTemplateValue;e&&(t||WM(this.latestValues)||r)&&(a(this.instance,i),this.shouldResetTransform=!1,this.scheduleRender())}measure(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=this.measurePageBox();let n=this.removeElementScroll(t);var i;return e&&(n=this.removeTransform(n)),AE((i=n).x),AE(i.y),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){var e;const t=this.options.visualElement;if(!t)return{x:{min:0,max:0},y:{min:0,max:0}};const n=t.measureViewportBox();if(!((null===(e=this.scroll)||void 0===e?void 0:e.wasRoot)||this.path.some(wE))){const e=this.root.scroll;e&&(ew(n.x,e.offset.x),ew(n.y,e.offset.y))}return n}removeElementScroll(e){var t;const n={x:{min:0,max:0},y:{min:0,max:0}};if(Lw(n,e),null===(t=this.scroll)||void 0===t?void 0:t.wasRoot)return n;for(let i=0;i1&&void 0!==arguments[1]&&arguments[1];const n={x:{min:0,max:0},y:{min:0,max:0}};Lw(n,e);for(let i=0;i0&&void 0!==arguments[0]&&arguments[0];var t;const n=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=n.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=n.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=n.isSharedProjectionDirty);const i=Boolean(this.resumingFrom)||this!==n;if(!(e||i&&this.isSharedProjectionDirty||this.isProjectionDirty||(null===(t=this.parent)||void 0===t?void 0:t.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const r=this.options,a=r.layout,s=r.layoutId;if(this.layout&&(a||s)){if(this.resolvedRelativeTargetAt=Wb.timestamp,!this.targetDelta&&!this.relativeTarget){const e=this.getClosestProjectingParent();e&&e.layout&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},FM(this.relativeTargetOrigin,this.layout.layoutBox,e.layout.layoutBox),Lw(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){var o,l,u;if(this.target||(this.target={x:{min:0,max:0},y:{min:0,max:0}},this.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}}),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),o=this.target,l=this.relativeTarget,u=this.relativeParent.target,IM(o.x,l.x,u.x),IM(o.y,l.y,u.y)):this.targetDelta?(Boolean(this.resumingFrom)?this.target=this.applyTransform(this.layout.layoutBox):Lw(this.target,this.layout.layoutBox),QM(this.target,this.targetDelta)):Lw(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const e=this.getClosestProjectingParent();e&&Boolean(e.resumingFrom)===Boolean(this.resumingFrom)&&!e.options.layoutScroll&&e.target&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget={x:{min:0,max:0},y:{min:0,max:0}},this.relativeTargetOrigin={x:{min:0,max:0},y:{min:0,max:0}},FM(this.relativeTargetOrigin,this.target,e.target),Lw(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}Qw&&Yw.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(this.parent&&!jM(this.parent.latestValues)&&!XM(this.parent.latestValues))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return Boolean((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var e;const t=this.getLead(),n=Boolean(this.resumingFrom)||this!==t;let i=!0;if((this.isProjectionDirty||(null===(e=this.parent)||void 0===e?void 0:e.isProjectionDirty))&&(i=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(i=!1),this.resolvedRelativeTargetAt===Wb.timestamp&&(i=!1),i)return;const r=this.options,a=r.layout,s=r.layoutId;if(this.isTreeAnimating=Boolean(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!a&&!s)return;Lw(this.layoutCorrected,this.layout.layoutBox);const o=this.treeScale.x,l=this.treeScale.y;!function(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=n.length;if(!r)return;let a,s;t.x=t.y=1;for(let o=0;oZM&&(t.x=1),t.y<$M&&t.y>ZM&&(t.y=1)}(this.layoutCorrected,this.treeScale,this.path,n),!t.layout||t.target||1===this.treeScale.x&&1===this.treeScale.y||(t.target=t.layout.layoutBox,t.targetWithTransforms={x:{min:0,max:0},y:{min:0,max:0}});const u=t.target;u?(this.projectionDelta&&this.prevProjectionDelta?(Nw(this.prevProjectionDelta.x,this.projectionDelta.x),Nw(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),BM(this.projectionDelta,this.layoutCorrected,u,this.latestValues),this.treeScale.x===o&&this.treeScale.y===l&&Kw(this.projectionDelta.x,this.prevProjectionDelta.x)&&Kw(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",u)),Qw&&Yw.recalculatedProjection++):this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender())}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];var t;if(null===(t=this.options.visualElement)||void 0===t||t.scheduleRender(),e){const e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDelta={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}},this.projectionDeltaWithTransform={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}}}setAnimationOrigin(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=this.snapshot,i=n?n.latestValues:{},r=h({},this.latestValues),a={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;const s={x:{min:0,max:0},y:{min:0,max:0}},o=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,c=Boolean(o&&!u&&!0===this.options.crossfade&&!this.path.some(_E));let d;this.animationProgress=0,this.mixTargetDelta=t=>{const n=t/1e3;vE(a.x,e.x,n),vE(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(FM(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox),function(e,t,n,i){yE(e.x,t.x,n.x,i),yE(e.y,t.y,n.y,i)}(this.relativeTarget,this.relativeTargetOrigin,s,n),d&&function(e,t){return jw(e.x,t.x)&&jw(e.y,t.y)}(this.relativeTarget,d)&&(this.isProjectionDirty=!1),d||(d={x:{min:0,max:0},y:{min:0,max:0}}),Lw(d,this.relativeTarget)),o&&(this.animationValues=r,function(e,t,n,i,r,a){r?(e.opacity=jS(0,void 0!==n.opacity?n.opacity:1,Bw(i)),e.opacityExit=jS(void 0!==t.opacity?t.opacity:1,0,Iw(i))):a&&(e.opacity=jS(void 0!==t.opacity?t.opacity:1,void 0!==n.opacity?n.opacity:1,i));for(let s=0;s{dw.hasAnimatedSinceResize=!0,this.currentAnimation=function(e,t,n){const i=ax(e)?e:nx(e);return i.start(ZA("",i,t,n)),i.animation}(0,1e3,h(h({},e),{},{onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}})),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const e=this.getLead();let t=e.targetWithTransforms,n=e.target,i=e.layout,r=e.latestValues;if(t&&n&&i){if(this!==e&&this.layout&&i&&ME(this.options.animationType,this.layout.layoutBox,i.layoutBox)){n=this.target||{x:{min:0,max:0},y:{min:0,max:0}};const t=RM(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;const i=RM(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+i}Lw(t,n),nw(t,r),BM(this.projectionDeltaWithTransform,this.layoutCorrected,t,r)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new qw);this.sharedNodes.get(e).add(t);const n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){const e=this.getStack();return!e||e.lead===this}getLead(){var e;return this.options.layoutId&&(null===(e=this.getStack())||void 0===e?void 0:e.lead)||this}getPrevLead(){var e;return this.options.layoutId?null===(e=this.getStack())||void 0===e?void 0:e.prevLead:void 0}getStack(){const e=this.options.layoutId;if(e)return this.root.sharedNodes.get(e)}promote(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.needsReset,n=e.transition,i=e.preserveFollowOpacity;const r=this.getStack();r&&r.promote(this,i),t&&(this.projectionDelta=void 0,this.needsReset=!0),n&&this.setOptions({transition:n})}relegate(){const e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){const e=this.options.visualElement;if(!e)return;let t=!1;const n=e.latestValues;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;const i={};n.z&&tE("z",e,i,this.animationValues);for(let r=0;r{var t;return null===(t=e.currentAnimation)||void 0===t?void 0:t.stop()}),this.root.nodes.forEach(uE),this.root.sharedNodes.clear()}}}function rE(e){e.updateLayout()}function aE(e){var t;const n=(null===(t=e.resumeFrom)||void 0===t?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const t=e.layout,i=t.layoutBox,r=t.measuredBox,a=e.options.animationType,s=n.source!==e.layout.source;"size"===a?GM(e=>{const t=s?n.measuredBox[e]:n.layoutBox[e],r=RM(t);t.min=i[e].min,t.max=t.min+r}):ME(a,n.layoutBox,i)&&GM(t=>{const r=s?n.measuredBox[t]:n.layoutBox[t],a=RM(i[t]);r.max=r.min+a,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[t].max=e.relativeTarget[t].min+a)});const o={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};BM(o,i,n.layoutBox);const l={x:{translate:0,scale:1,origin:0,originPoint:0},y:{translate:0,scale:1,origin:0,originPoint:0}};s?BM(l,e.applyTransform(r,!0),n.measuredBox):BM(l,i,n.layoutBox);const u=!Vw(o);let c=!1;if(!e.resumeFrom){const t=e.getClosestProjectingParent();if(t&&!t.resumeFrom){const r=t.snapshot,a=t.layout;if(r&&a){const s={x:{min:0,max:0},y:{min:0,max:0}};FM(s,n.layoutBox,r.layoutBox);const o={x:{min:0,max:0},y:{min:0,max:0}};FM(o,i,a.layoutBox),Xw(s,o)||(c=!0),t.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=s,e.relativeParent=t)}}}e.notifyListeners("didUpdate",{layout:i,snapshot:n,delta:l,layoutDelta:o,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const t=e.options.onExitComplete;t&&t()}e.options.transition=void 0}function sE(e){Qw&&Yw.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=Boolean(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function oE(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function lE(e){e.clearSnapshot()}function uE(e){e.clearMeasurements()}function cE(e){e.isLayoutDirty=!1}function hE(e){const t=e.options.visualElement;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function dE(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function pE(e){e.resolveTargetDelta()}function fE(e){e.calcProjection()}function mE(e){e.resetSkewAndRotation()}function gE(e){e.removeLeadSnapshot()}function vE(e,t,n){e.translate=jS(t.translate,0,n),e.scale=jS(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function yE(e,t,n,i){e.min=jS(t.min,n.min,i),e.max=jS(t.max,n.max,i)}function _E(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}const bE={duration:.45,ease:[.4,0,.1,1]},xE=e=>"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),SE=xE("applewebkit/")&&!xE("chrome/")?Math.round:Db;function AE(e){e.min=SE(e.min),e.max=SE(e.max)}function ME(e,t,n){return"position"===e||"preserve-aspect"===e&&(i=Jw(t),r=Jw(n),a=.2,!(Math.abs(i-r)<=a));var i,r,a}function wE(e){var t;return e!==e.root&&(null===(t=e.scroll)||void 0===t?void 0:t.wasRoot)}const EE=iE({attachResizeListener:(e,t)=>vM(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),TE={current:void 0},CE=iE({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!TE.current){const e=new EE({});e.mount(window),e.setOptions({layoutScroll:!0}),TE.current=e}return TE.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>Boolean("fixed"===window.getComputedStyle(e).position)}),RE={pan:{Feature:class extends fM{constructor(){super(...arguments),this.removePointerDownListener=Db}onPointerDown(e){this.session=new xM(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:rw(this.node)})}createPanHandlers(){const e=this.node.getProps(),t=e.onPanSessionStart,n=e.onPanStart,i=e.onPan,r=e.onPanEnd;return{onSessionStart:lw(t),onStart:lw(n),onMove:i,onEnd:(e,t)=>{delete this.session,r&&Vb.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=_M(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends fM{constructor(e){super(e),this.removeGroupControls=Db,this.removeListeners=Db,this.controls=new sw(e)}mount(){const e=this.node.getProps().dragControls;e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Db}unmount(){this.removeGroupControls(),this.removeListeners()}},ProjectionNode:CE,MeasureLayout:bw}};function PE(e,t,n){const i=e.props;e.animationState&&i.whileHover&&e.animationState.setActive("whileHover","Start"===n);const r=i["onHover"+n];r&&Vb.postRender(()=>r(t,yM(t)))}function BE(e,t,n){const i=e.props;e.animationState&&i.whileTap&&e.animationState.setActive("whileTap","Start"===n);const r=i["onTap"+("End"===n?"":n)];r&&Vb.postRender(()=>r(t,yM(t)))}const IE=["root"],DE=new WeakMap,FE=new WeakMap,LE=e=>{const t=DE.get(e.target);t&&t(e)},NE=e=>{e.forEach(LE)};function OE(e,t,n){const i=function(e){let t=e.root,n=W_(e,IE);const i=t||document;FE.has(i)||FE.set(i,{});const r=FE.get(i),a=JSON.stringify(n);return r[a]||(r[a]=new IntersectionObserver(NE,h({root:t},n))),r[a]}(t);return DE.set(e,n),i.observe(e),()=>{DE.delete(e),i.unobserve(e)}}const kE={some:0,all:1};const UE={inView:{Feature:class extends fM{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const e=this.node.getProps().viewport,t=void 0===e?{}:e,n=t.root,i=t.margin,r=t.amount,a=void 0===r?"some":r,s=t.once,o={root:n?n.current:void 0,rootMargin:i,threshold:"number"===typeof a?a:kE[a]};return OE(this.node.current,o,e=>{const t=e.isIntersecting;if(this.isInView===t)return;if(this.isInView=t,s&&!t&&this.hasEnteredView)return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);const n=this.node.getProps(),i=n.onViewportEnter,r=n.onViewportLeave,a=t?i:r;a&&a(e)})}mount(){this.startObserver()}update(){if("undefined"===typeof IntersectionObserver)return;const e=this.node,t=e.props,n=e.prevProps,i=["amount","margin","root"].some(function(e){let t=e.viewport,n=void 0===t?{}:t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i.viewport,a=void 0===r?{}:r;return e=>n[e]!==a[e]}(t,n));i&&this.startObserver()}unmount(){}}},tap:{Feature:class extends fM{mount(){const e=this.node.current;e&&(this.unmount=Pb(e,e=>(BE(this.node,e,"Start"),(e,t)=>{let n=t.success;return BE(this.node,e,n?"End":"Cancel")}),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends fM{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=ZS(vM(this.node.current,"focus",()=>this.onFocus()),vM(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends fM{mount(){const e=this.node.current;e&&(this.unmount=function(e,t){const n=Ma(xb(e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}),3),i=n[0],r=n[1],a=n[2],s=Sb(e=>{const n=e.target,i=t(e);if("function"!==typeof i||!n)return;const a=Sb(e=>{i(e),n.removeEventListener("pointerleave",a)});n.addEventListener("pointerleave",a,r)});return i.forEach(e=>{e.addEventListener("pointerenter",s,r)}),a}(e,e=>(PE(this.node,e,"Start"),e=>PE(this.node,e,"End"))))}unmount(){}}}},zE={layout:{ProjectionNode:CE,MeasureLayout:bw}},GE=(0,r.createContext)({strict:!1}),HE=(0,r.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),VE=(0,r.createContext)({});function jE(e){return j_(e.animate)||$_.some(t=>K_(e[t]))}function WE(e){return Boolean(jE(e)||e.variants)}function XE(e){const t=function(e,t){if(jE(e)){const t=e.initial,n=e.animate;return{initial:!1===t||K_(t)?t:void 0,animate:K_(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,(0,r.useContext)(VE)),n=t.initial,i=t.animate;return(0,r.useMemo)(()=>({initial:n,animate:i}),[JE(n),JE(i)])}function JE(e){return Array.isArray(e)?e.join(" "):e}const KE="undefined"!==typeof window,qE={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},YE={};for(const fF in qE)YE[fF]={isEnabled:e=>qE[fF].some(t=>!!e[t])};const QE=Symbol.for("motionComponentSymbol");function ZE(e,t,n){return(0,r.useCallback)(i=>{i&&e.onMount&&e.onMount(i),t&&(i?t.mount(i):t.unmount()),n&&("function"===typeof n?n(i):CM(n)&&(n.current=i))},[t])}const $E=KE?r.useLayoutEffect:r.useEffect;function eT(e,t,n,i,a){var s,o;const l=(0,r.useContext)(VE).visualElement,u=(0,r.useContext)(GE),c=(0,r.useContext)(uw),h=(0,r.useContext)(HE).reducedMotion,d=(0,r.useRef)(null);i=i||u.renderer,!d.current&&i&&(d.current=i(e,{visualState:t,parent:l,props:n,presenceContext:c,blockInitialAnimation:!!c&&!1===c.initial,reducedMotionConfig:h}));const p=d.current,f=(0,r.useContext)(hw);!p||p.projection||!a||"html"!==p.type&&"svg"!==p.type||function(e,t,n,i){const r=t.layoutId,a=t.layout,s=t.drag,o=t.dragConstraints,l=t.layoutScroll,u=t.layoutRoot;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:tT(e.parent)),e.projection.setOptions({layoutId:r,layout:a,alwaysMeasureLayout:Boolean(s)||o&&CM(o),visualElement:e,animationType:"string"===typeof a?a:"both",initialPromotionConfig:i,layoutScroll:l,layoutRoot:u})}(d.current,n,a,f);const m=(0,r.useRef)(!1);(0,r.useInsertionEffect)(()=>{p&&m.current&&p.update(n,c)});const g=n[lx],v=(0,r.useRef)(Boolean(g)&&!(null===(s=window.MotionHandoffIsComplete)||void 0===s?void 0:s.call(window,g))&&(null===(o=window.MotionHasOptimisedAnimation)||void 0===o?void 0:o.call(window,g)));return $E(()=>{p&&(m.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),yw.render(p.render),v.current&&p.animationState&&p.animationState.animateChanges())}),(0,r.useEffect)(()=>{p&&(!v.current&&p.animationState&&p.animationState.animateChanges(),v.current&&(queueMicrotask(()=>{var e;null===(e=window.MotionHandoffMarkAsComplete)||void 0===e||e.call(window,g)}),v.current=!1))}),p}function tT(e){if(e)return!1!==e.options.allowProjection?e.projection:tT(e.parent)}function nT(e){let t=e.preloadedFeatures,n=e.createVisualElement,i=e.useRender,a=e.useVisualState,s=e.Component;var o,l;function u(e,t){let o;const l=h(h(h({},(0,r.useContext)(HE)),e),{},{layoutId:iT(e)}),u=l.isStatic,c=XE(e),d=a(e,u);if(!u&&KE){!function(){(0,r.useContext)(GE).strict;0}();const e=function(e){const t=YE.drag,n=YE.layout;if(!t&&!n)return{};const i=h(h({},t),n);return{MeasureLayout:(null===t||void 0===t?void 0:t.isEnabled(e))||(null===n||void 0===n?void 0:n.isEnabled(e))?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}(l);o=e.MeasureLayout,c.visualElement=eT(s,d,l,n,e.ProjectionNode)}return(0,Be.jsxs)(VE.Provider,{value:c,children:[o&&c.visualElement?(0,Be.jsx)(o,h({visualElement:c.visualElement},l)):null,i(s,e,ZE(d,c.visualElement,t),d,u,c.visualElement)]})}t&&function(e){for(const t in e)YE[t]=h(h({},YE[t]),e[t])}(t),u.displayName="motion.".concat("string"===typeof s?s:"create(".concat(null!==(l=null!==(o=s.displayName)&&void 0!==o?o:s.name)&&void 0!==l?l:"",")"));const c=(0,r.forwardRef)(u);return c[QE]=s,c}function iT(e){let t=e.layoutId;const n=(0,r.useContext)(cw).id;return n&&void 0!==t?n+"-"+t:t}const rT=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function aT(e){return"string"===typeof e&&!e.includes("-")&&!!(rT.indexOf(e)>-1||/[A-Z]/.test(e))}const sT=["transitionEnd","transition"];const oT=e=>(t,n)=>{const i=(0,r.useContext)(VE),a=(0,r.useContext)(uw),s=()=>function(e,t,n,i){let r=e.scrapeMotionValuesFromProps,a=e.createRenderState,s=e.onUpdate;const o={latestValues:lT(t,n,i,r),renderState:a()};return s&&(o.onMount=e=>s(h({props:t,current:e},o)),o.onUpdate=e=>s(e)),o}(e,t,i,a);return n?s():function(e){const t=(0,r.useRef)(null);return null===t.current&&(t.current=e()),t.current}(s)};function lT(e,t,n,i){const r={},a=i(e,{});for(const d in a)r[d]=ww(a[d]);let s=e.initial,o=e.animate;const l=jE(e),u=WE(e);t&&u&&!l&&!1!==e.inherit&&(void 0===s&&(s=t.initial),void 0===o&&(o=t.animate));let c=!!n&&!1===n.initial;c=c||!1===s;const h=c?o:s;if(h&&"boolean"!==typeof h&&!j_(h)){const t=Array.isArray(h)?h:[h];for(let n=0;nt&&"number"===typeof e?t.transform(e):e,cT={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hT=Fb.length;function dT(e,t,n){const i=e.style,r=e.vars,a=e.transformOrigin;let s=!1,o=!1;for(const l in t){const e=t[l];if(Lb.has(l))s=!0;else if(CS(l))r[l]=e;else{const t=uT(e,oS[l]);l.startsWith("origin")?(o=!0,a[l]=t):i[l]=t}}if(t.transform||(s||n?i.transform=function(e,t,n){let i="",r=!0;for(let a=0;a2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];e.pathLength=1;const a=r?fT:mT;e[a.offset]=Ux.transform(-i);const s=Ux.transform(t),o=Ux.transform(n);e[a.array]="".concat(s," ").concat(o)}(f,u,h,p,!1)}const yT=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),_T=()=>h(h({},{style:{},transform:{},transformOrigin:{},vars:{}}),{},{attrs:{}}),bT=e=>"string"===typeof e&&"svg"===e.toLowerCase();function xT(e,t,n,i){let r=t.style,a=t.vars;Object.assign(e.style,r,i&&i.getProjectionStyles(n));for(const s in a)e.style.setProperty(s,a[s])}const ST=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function AT(e,t,n,i){xT(e,t,void 0,i);for(const r in t.attrs)e.setAttribute(ST.has(r)?r:ox(r),t.attrs[r])}function MT(e,t){let n=t.layout,i=t.layoutId;return Lb.has(e)||e.startsWith("origin")||(n||void 0!==i)&&(!!gw[e]||"opacity"===e)}function wT(e,t,n){var i;const r=e.style,a={};for(const s in r)(ax(r[s])||t.style&&ax(t.style[s])||MT(s,e)||void 0!==(null===(i=null===n||void 0===n?void 0:n.getValue(s))||void 0===i?void 0:i.liveStyle))&&(a[s]=r[s]);return a}function ET(e,t,n){const i=wT(e,t,n);for(const r in e)if(ax(e[r])||ax(t[r])){i[-1!==Fb.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=e[r]}return i}const TT=["x","y","width","height","cx","cy","r"],CT={useVisualState:oT({scrapeMotionValuesFromProps:ET,createRenderState:_T,onUpdate:e=>{let t=e.props,n=e.prevProps,i=e.current,r=e.renderState,a=e.latestValues;if(!i)return;let s=!!t.drag;if(!s)for(const l in a)if(Lb.has(l)){s=!0;break}if(!s)return;let o=!n;if(n)for(let l=0;lfunction(e,t){try{t.dimensions="function"===typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(n){t.dimensions={x:0,y:0,width:0,height:0}}}(i,r)),Vb.render(()=>{vT(r,a,bT(i.tagName),t.transformTemplate),AT(i,r)}))}})},RT={useVisualState:oT({scrapeMotionValuesFromProps:wT,createRenderState:yT})};function PT(e,t,n){for(const i in t)ax(t[i])||MT(i,n)||(e[i]=t[i])}function BT(e,t){const n={};return PT(n,e.style||{},e),Object.assign(n,function(e,t){let n=e.transformTemplate;return(0,r.useMemo)(()=>{const e={style:{},transform:{},transformOrigin:{},vars:{}};return dT(e,t,n),Object.assign({},e.vars,e.style)},[t])}(e,t)),n}function IT(e,t){const n={},i=BT(e,t);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===e.drag?"none":"pan-".concat("x"===e.drag?"y":"x")),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=i,n}const DT=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function FT(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||DT.has(e)}let LT=e=>!FT(e);try{(NT=require("@emotion/is-prop-valid").default)&&(LT=e=>e.startsWith("on")?!FT(e):NT(e))}catch(pF){}var NT;function OT(e,t,n,i){const a=(0,r.useMemo)(()=>{const n=_T();return vT(n,t,bT(i),e.transformTemplate),h(h({},n.attrs),{},{style:h({},n.style)})},[t]);if(e.style){const t={};PT(t,e.style,e),a.style=h(h({},t),a.style)}return a}function kT(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(t,n,i,a,s)=>{let o=a.latestValues;const l=(aT(t)?OT:IT)(n,o,s,t),u=function(e,t,n){const i={};for(const r in e)"values"===r&&"object"===typeof e.values||(LT(r)||!0===n&&FT(r)||!t&&!FT(r)||e.draggable&&r.startsWith("onDrag"))&&(i[r]=e[r]);return i}(n,"string"===typeof t,e),c=t!==r.Fragment?h(h(h({},u),l),{},{ref:i}):{},d=n.children,p=(0,r.useMemo)(()=>ax(d)?d.get():d,[d]);return(0,r.createElement)(t,h(h({},c),{},{children:p}))}}function UT(e,t){return function(n){let i=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{forwardMotionProps:!1}).forwardMotionProps;return nT(h(h({},aT(n)?CT:RT),{},{preloadedFeatures:e,useRender:kT(i),createVisualElement:t,Component:n}))}}const zT={current:null},GT={current:!1};const HT=[...LS,jx,$x],VT=new WeakMap;const jT=["willChange"],WT=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class XT{scrapeMotionValuesFromProps(e,t,n){return{}}constructor(e){let t=e.parent,n=e.props,i=e.presenceContext,r=e.reducedMotionConfig,a=e.blockInitialAnimation,s=e.visualState,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=AS,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const e=qb.now();this.renderScheduledAtthis.bindToMotionValue(t,e)),GT.current||function(){if(GT.current=!0,KE)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>zT.current=e.matches;e.addListener(t),t()}else zT.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||zT.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){VT.delete(this.current),this.projection&&this.projection.unmount(),jb(this.notifyUpdate),jb(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const n=Lb.has(e),i=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&Vb.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),r=t.on("renderRequest",this.scheduleRender);let a;window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),r(),a&&a(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in YE){const t=YE[e];if(!t)continue;const n=t.isEnabled,i=t.Feature;if(!this.features[e]&&i&&n(this.props)&&(this.features[e]=new i(this)),this.features[e]){const t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):{x:{min:0,max:0},y:{min:0,max:0}}}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let n=0;nt.variantChildren.delete(e)}addValue(e,t){const n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=nx(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){var n;let i=void 0===this.latestValues[e]&&this.current?null!==(n=this.getBaseTargetFromProps(this.props,e))&&void 0!==n?n:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];return void 0!==i&&null!==i&&("string"===typeof i&&(ES(i)||Sx(i))?i=parseFloat(i):!(e=>HT.find(FS(e)))(i)&&$x.test(t)&&(i=cS(e,t)),this.setBaseTarget(e,ax(i)?i.get():i)),ax(i)?i.get():i}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const n=this.props.initial;let i;if("string"===typeof n||"object"===typeof n){const r=Y_(this.props,n,null===(t=this.presenceContext)||void 0===t?void 0:t.custom);r&&(i=r[e])}if(n&&void 0!==i)return i;const r=this.getBaseTargetFromProps(this.props,e);return void 0===r||ax(r)?void 0!==this.initialValues[e]&&void 0===i?void 0:this.baseTarget[e]:r}on(e,t){return this.events[e]||(this.events[e]=new Zb),this.events[e].add(t)}notify(e){if(this.events[e]){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i{this.current&&(this.current.textContent="".concat(e))}))}}class KT extends JT{constructor(){super(...arguments),this.type="html",this.renderInstance=xT}readValueFromInstance(e,t){if(Lb.has(t)){const e=uS(t);return e&&e.default||0}{const i=(n=e,window.getComputedStyle(n)),r=(CS(t)?i.getPropertyValue(t):i[t])||0;return"string"===typeof r?r.trim():r}var n}measureInstanceViewportBox(e,t){return iw(e,t.transformPagePoint)}build(e,t,n){dT(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return wT(e,t,n)}}class qT extends JT{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=zM}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Lb.has(t)){const e=uS(t);return e&&e.default||0}return t=ST.has(t)?t:ox(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return ET(e,t,n)}build(e,t,n){vT(e,t,this.isSVGTag,n.transformTemplate)}renderInstance(e,t,n,i){AT(e,t,0,i)}mount(e){this.isSVGTag=bT(e.tagName),super.mount(e)}}const YT=(e,t)=>aT(e)?new qT(t):new KT(t,{allowProjection:e!==r.Fragment}),QT=V_(UT(h(h(h(h({},gM),UE),RE),zE),YT));function ZT(){let e=null,t=!1,n=null,i=null;function r(t,a){n(t,a),i=e.requestAnimationFrame(r)}return{start:function(){!0!==t&&null!==n&&null!==e&&(i=e.requestAnimationFrame(r),t=!0)},stop:function(){null!==e&&e.cancelAnimationFrame(i),t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function $T(e){const t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);const i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){if(n.isInterleavedBufferAttribute&&(n=n.data),n.isGLBufferAttribute){const e=t.get(n);return void((!e||e.versione.start-t.start);let t=0;for(let e=1;e 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec4 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n\tvColor *= color;\n#elif defined( USE_COLOR )\n\tvColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * reflectVec );\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t\t#endif\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif\n#include ",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = vec3( 0.04 );\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tvec3 diffuseContribution;\n\tvec3 specularColor;\n\tvec3 specularColorBlended;\n\tfloat roughness;\n\tfloat metalness;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t\tvec3 iridescenceFresnelDielectric;\n\t\tvec3 iridescenceFresnelMetallic;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\treturn 0.5 / max( gv + gl, EPSILON );\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColorBlended;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat rInv = 1.0 / ( roughness + 0.1 );\n\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n\tfloat DG = exp( a * dotNV + b );\n\treturn saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n\tvec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n\tvec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t\t#ifdef USE_CLEARCOAT\n\t\t\tvec3 Ncc = geometryClearcoatNormal;\n\t\t\tvec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n\t\t\tvec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n\t\t\tvec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n\t\t\tmat3 mInvClearcoat = mat3(\n\t\t\t\tvec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n\t\t\t\tvec3( 0, 1, 0 ),\n\t\t\t\tvec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n\t\t\t);\n\t\t\tvec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n\t\t\tclearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n\t\t#endif\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n \n \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n \t\tirradiance *= sheenEnergyComp;\n \n \t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tdiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n \t#endif\n\tvec3 singleScatteringDielectric = vec3( 0.0 );\n\tvec3 multiScatteringDielectric = vec3( 0.0 );\n\tvec3 singleScatteringMetallic = vec3( 0.0 );\n\tvec3 multiScatteringMetallic = vec3( 0.0 );\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#endif\n\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tvec3 indirectSpecular = radiance * singleScattering;\n\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\n\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tindirectSpecular *= sheenEnergyComp;\n\t\tindirectDiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectSpecular += indirectSpecular;\n\treflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n\t\tmaterial.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#ifdef USE_LIGHT_PROBES_GRID\n\t\tvec3 probeWorldPos = ( ( vec4( geometryPosition, 1.0 ) - viewMatrix[ 3 ] ) * viewMatrix ).xyz;\n\t\tvec3 probeWorldNormal = inverseTransformDirection( geometryNormal, viewMatrix );\n\t\tirradiance += getLightProbeGridIrradiance( probeWorldPos, probeWorldNormal );\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\t#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n\t\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t\t#endif\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\t#if defined( LAMBERT ) || defined( PHONG )\n\t\tirradiance += iblIrradiance;\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",lightprobes_pars_fragment:"#ifdef USE_LIGHT_PROBES_GRID\nuniform highp sampler3D probesSH;\nuniform vec3 probesMin;\nuniform vec3 probesMax;\nuniform vec3 probesResolution;\nvec3 getLightProbeGridIrradiance( vec3 worldPos, vec3 worldNormal ) {\n\tvec3 res = probesResolution;\n\tvec3 gridRange = probesMax - probesMin;\n\tvec3 resMinusOne = res - 1.0;\n\tvec3 probeSpacing = gridRange / resMinusOne;\n\tvec3 samplePos = worldPos + worldNormal * probeSpacing * 0.5;\n\tvec3 uvw = clamp( ( samplePos - probesMin ) / gridRange, 0.0, 1.0 );\n\tuvw = uvw * resMinusOne / res + 0.5 / res;\n\tfloat nz = res.z;\n\tfloat paddedSlices = nz + 2.0;\n\tfloat atlasDepth = 7.0 * paddedSlices;\n\tfloat uvZBase = uvw.z * nz + 1.0;\n\tvec4 s0 = texture( probesSH, vec3( uvw.xy, ( uvZBase ) / atlasDepth ) );\n\tvec4 s1 = texture( probesSH, vec3( uvw.xy, ( uvZBase + paddedSlices ) / atlasDepth ) );\n\tvec4 s2 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 2.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s3 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 3.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s4 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 4.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s5 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 5.0 * paddedSlices ) / atlasDepth ) );\n\tvec4 s6 = texture( probesSH, vec3( uvw.xy, ( uvZBase + 6.0 * paddedSlices ) / atlasDepth ) );\n\tvec3 c0 = s0.xyz;\n\tvec3 c1 = vec3( s0.w, s1.xy );\n\tvec3 c2 = vec3( s1.zw, s2.x );\n\tvec3 c3 = s2.yzw;\n\tvec3 c4 = s3.xyz;\n\tvec3 c5 = vec3( s3.w, s4.xy );\n\tvec3 c6 = vec3( s4.zw, s5.x );\n\tvec3 c7 = s5.yzw;\n\tvec3 c8 = s6.xyz;\n\tfloat x = worldNormal.x, y = worldNormal.y, z = worldNormal.z;\n\tvec3 result = c0 * 0.886227;\n\tresult += c1 * 2.0 * 0.511664 * y;\n\tresult += c2 * 2.0 * 0.511664 * z;\n\tresult += c3 * 2.0 * 0.511664 * x;\n\tresult += c4 * 2.0 * 0.429043 * x * y;\n\tresult += c5 * 2.0 * 0.429043 * y * z;\n\tresult += c6 * ( 0.743125 * z * z - 0.247708 );\n\tresult += c7 * 2.0 * 0.429043 * x * z;\n\tresult += c8 * 0.429043 * ( x * x - y * y );\n\treturn max( result, vec3( 0.0 ) );\n}\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#if defined( USE_PACKED_NORMALMAP )\n\t\tmapN = vec3( mapN.xy, sqrt( saturate( 1.0 - dot( mapN.xy, mapN.xy ) ) ) );\n\t#endif\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\n\t\treturn depth * ( far - near ) - far;\n\t#else\n\t\treturn depth * ( near - far ) - near;\n\t#endif\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\treturn ( near * far ) / ( ( near - far ) * depth - near );\n\t#else\n\t\treturn ( near * far ) / ( ( far - near ) * depth - far );\n\t#endif\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat interleavedGradientNoise( vec2 position ) {\n\t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n\t\t}\n\t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n\t\t\tconst float goldenAngle = 2.399963229728653;\n\t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n\t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\n\t\t\treturn vec2( cos( theta ), sin( theta ) ) * r;\n\t\t}\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\t\tfloat radius = shadowRadius * texelSize.x;\n\t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n\t\t\t\t) * 0.2;\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n\t\t\t\tfloat mean = distribution.x;\n\t\t\t\tfloat variance = distribution.y * distribution.y;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean );\n\t\t\t\t#endif\n\t\t\t\t\n\t\t\t\tif ( hard_shadow == 1.0 ) {\n\t\t\t\t\tshadow = 1.0;\n\t\t\t\t} else {\n\t\t\t\t\tvariance = max( variance, 0.0000001 );\n\t\t\t\t\tfloat d = shadowCoord.z - mean;\n\t\t\t\t\tfloat p_max = variance / ( variance + d * d );\n\t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n\t\t\t\t\tshadow = max( hard_shadow, p_max );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#else\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tshadow = step( depth, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tshadow = step( shadowCoord.z, depth );\n\t\t\t\t#endif\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tfloat dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp -= shadowBias;\n\t\t\t#else\n\t\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp += shadowBias;\n\t\t\t#endif\n\t\t\tfloat texelSize = shadowRadius / shadowMapSize.x;\n\t\t\tvec3 absDir = abs( bd3D );\n\t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\ttangent = normalize( cross( bd3D, tangent ) );\n\t\t\tvec3 bitangent = cross( bd3D, tangent );\n\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\tvec2 sample0 = vogelDiskSample( 0, 5, phi );\n\t\t\tvec2 sample1 = vogelDiskSample( 1, 5, phi );\n\t\t\tvec2 sample2 = vogelDiskSample( 2, 5, phi );\n\t\t\tvec2 sample3 = vogelDiskSample( 3, 5, phi );\n\t\t\tvec2 sample4 = vogelDiskSample( 4, 5, phi );\n\t\t\tshadow = (\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n\t\t\t) * 0.2;\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tfloat depth = textureCube( shadowMap, bd3D ).r;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tdepth = 1.0 - depth;\n\t\t\t#endif\n\t\t\tshadow = step( dp, depth );\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#endif\n\t#endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\t#ifdef HAS_NORMAL\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t#else\n\t\tvec3 shadowWorldNormal = vec3( 0.0 );\n\t#endif\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vWorldDirection );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include \n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n \t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\t#include \n\t#include \n\t#include \n\t#include \n}"},tC={common:{diffuse:{value:new ih(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new $u},alphaMap:{value:null},alphaMapTransform:{value:new $u},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new $u}},envmap:{envMap:{value:null},envMapRotation:{value:new $u},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new $u}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new $u}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new $u},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new $u},normalScale:{value:new Ku(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new $u},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new $u}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new $u}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new $u}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ih(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null},probesSH:{value:null},probesMin:{value:new Yu},probesMax:{value:new Yu},probesResolution:{value:new Yu}},points:{diffuse:{value:new ih(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new $u},alphaTest:{value:0},uvTransform:{value:new $u}},sprite:{diffuse:{value:new ih(16777215)},opacity:{value:1},center:{value:new Ku(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new $u},alphaMap:{value:null},alphaMapTransform:{value:new $u},alphaTest:{value:0}}},nC={basic:{uniforms:mg([tC.common,tC.specularmap,tC.envmap,tC.aomap,tC.lightmap,tC.fog]),vertexShader:eC.meshbasic_vert,fragmentShader:eC.meshbasic_frag},lambert:{uniforms:mg([tC.common,tC.specularmap,tC.envmap,tC.aomap,tC.lightmap,tC.emissivemap,tC.bumpmap,tC.normalmap,tC.displacementmap,tC.fog,tC.lights,{emissive:{value:new ih(0)},envMapIntensity:{value:1}}]),vertexShader:eC.meshlambert_vert,fragmentShader:eC.meshlambert_frag},phong:{uniforms:mg([tC.common,tC.specularmap,tC.envmap,tC.aomap,tC.lightmap,tC.emissivemap,tC.bumpmap,tC.normalmap,tC.displacementmap,tC.fog,tC.lights,{emissive:{value:new ih(0)},specular:{value:new ih(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:eC.meshphong_vert,fragmentShader:eC.meshphong_frag},standard:{uniforms:mg([tC.common,tC.envmap,tC.aomap,tC.lightmap,tC.emissivemap,tC.bumpmap,tC.normalmap,tC.displacementmap,tC.roughnessmap,tC.metalnessmap,tC.fog,tC.lights,{emissive:{value:new ih(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:eC.meshphysical_vert,fragmentShader:eC.meshphysical_frag},toon:{uniforms:mg([tC.common,tC.aomap,tC.lightmap,tC.emissivemap,tC.bumpmap,tC.normalmap,tC.displacementmap,tC.gradientmap,tC.fog,tC.lights,{emissive:{value:new ih(0)}}]),vertexShader:eC.meshtoon_vert,fragmentShader:eC.meshtoon_frag},matcap:{uniforms:mg([tC.common,tC.bumpmap,tC.normalmap,tC.displacementmap,tC.fog,{matcap:{value:null}}]),vertexShader:eC.meshmatcap_vert,fragmentShader:eC.meshmatcap_frag},points:{uniforms:mg([tC.points,tC.fog]),vertexShader:eC.points_vert,fragmentShader:eC.points_frag},dashed:{uniforms:mg([tC.common,tC.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:eC.linedashed_vert,fragmentShader:eC.linedashed_frag},depth:{uniforms:mg([tC.common,tC.displacementmap]),vertexShader:eC.depth_vert,fragmentShader:eC.depth_frag},normal:{uniforms:mg([tC.common,tC.bumpmap,tC.normalmap,tC.displacementmap,{opacity:{value:1}}]),vertexShader:eC.meshnormal_vert,fragmentShader:eC.meshnormal_frag},sprite:{uniforms:mg([tC.sprite,tC.fog]),vertexShader:eC.sprite_vert,fragmentShader:eC.sprite_frag},background:{uniforms:{uvTransform:{value:new $u},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:eC.background_vert,fragmentShader:eC.background_frag},backgroundCube:{uniforms:{envMap:{value:null},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new $u}},vertexShader:eC.backgroundCube_vert,fragmentShader:eC.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:eC.cube_vert,fragmentShader:eC.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:eC.equirect_vert,fragmentShader:eC.equirect_frag},distance:{uniforms:mg([tC.common,tC.displacementmap,{referencePosition:{value:new Yu},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:eC.distance_vert,fragmentShader:eC.distance_frag},shadow:{uniforms:mg([tC.lights,tC.fog,{color:{value:new ih(0)},opacity:{value:1}}]),vertexShader:eC.shadow_vert,fragmentShader:eC.shadow_frag}};nC.physical={uniforms:mg([nC.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new $u},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new $u},clearcoatNormalScale:{value:new Ku(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new $u},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new $u},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new $u},sheen:{value:0},sheenColor:{value:new ih(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new $u},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new $u},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new $u},transmissionSamplerSize:{value:new Ku},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new $u},attenuationDistance:{value:0},attenuationColor:{value:new ih(0)},specularColor:{value:new ih(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new $u},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new $u},anisotropyVector:{value:new Ku},anisotropyMap:{value:null},anisotropyMapTransform:{value:new $u}}]),vertexShader:eC.meshphysical_vert,fragmentShader:eC.meshphysical_frag};const iC={r:0,b:0,g:0},rC=new Sc,aC=new $u;function sC(e,t,n,i,r,a){const s=new ih(0);let o,l,u=!0===r?0:1,c=null,h=0,d=null;function p(e){let n=!0===e.isScene?e.background:null;if(n&&n.isTexture){const i=e.backgroundBlurriness>0;n=t.get(n,i)}return n}function f(t,i){t.getRGB(iC,vg(e)),n.buffers.color.setClear(iC.r,iC.g,iC.b,i,a)}return{getClearColor:function(){return s},setClearColor:function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;s.set(e),u=t,f(s,u)},getClearAlpha:function(){return u},setClearAlpha:function(e){u=e,f(s,u)},render:function(t){let i=!1;const r=p(t);null===r?f(s,u):r&&r.isColor&&(f(r,1),i=!0);const o=e.xr.getEnvironmentBlendMode();"additive"===o?n.buffers.color.setClear(0,0,0,1,a):"alpha-blend"===o&&n.buffers.color.setClear(0,0,0,0,a),(e.autoClear||i)&&(n.buffers.depth.setTest(!0),n.buffers.depth.setMask(!0),n.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function(t,n){const r=p(n);r&&(r.isCubeTexture||r.mapping===ks)?(void 0===l&&(l=new ip(new Uf(1,1,1),new _g({name:"BackgroundCubeMaterial",uniforms:fg(nC.backgroundCube.uniforms),vertexShader:nC.backgroundCube.vertexShader,fragmentShader:nC.backgroundCube.fragmentShader,side:Oa,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(l)),l.material.uniforms.envMap.value=r,l.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(rC.makeRotationFromEuler(n.backgroundRotation)).transpose(),r.isCubeTexture&&!1===r.isRenderTargetTexture&&l.material.uniforms.backgroundRotation.value.premultiply(aC),l.material.toneMapped=rc.getTransfer(r.colorSpace)!==Pl,c===r&&h===r.version&&d===e.toneMapping||(l.material.needsUpdate=!0,c=r,h=r.version,d=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null)):r&&r.isTexture&&(void 0===o&&(o=new ip(new ng(2,2),new _g({name:"BackgroundMaterial",uniforms:fg(nC.background.uniforms),vertexShader:nC.background.vertexShader,fragmentShader:nC.background.fragmentShader,side:Na,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(o)),o.material.uniforms.t2D.value=r,o.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,o.material.toneMapped=rc.getTransfer(r.colorSpace)!==Pl,!0===r.matrixAutoUpdate&&r.updateMatrix(),o.material.uniforms.uvTransform.value.copy(r.matrix),c===r&&h===r.version&&d===e.toneMapping||(o.material.needsUpdate=!0,c=r,h=r.version,d=e.toneMapping),o.layers.enableAll(),t.unshift(o,o.geometry,o.material,0,0,null))},dispose:function(){void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0),void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0)}}}function oC(e,t){const n=e.getParameter(e.MAX_VERTEX_ATTRIBS),i={},r=u(null);let a=r,s=!1;function o(t){return e.bindVertexArray(t)}function l(t){return e.deleteVertexArray(t)}function u(e){const t=[],i=[],r=[];for(let a=0;a=0){const t=r[a];let n=s[a];if(void 0===n&&("instanceMatrix"===a&&e.instanceMatrix&&(n=e.instanceMatrix),"instanceColor"===a&&e.instanceColor&&(n=e.instanceColor)),void 0===t)return!0;if(t.attribute!==n)return!0;if(n&&t.data!==n.data)return!0;o++}}return a.attributesNum!==o||a.index!==i}(n,m,l,g),v&&function(e,t,n,i){const r={},s=t.attributes;let o=0;const l=n.getAttributes();for(const a in l){if(l[a].location>=0){let t=s[a];void 0===t&&("instanceMatrix"===a&&e.instanceMatrix&&(t=e.instanceMatrix),"instanceColor"===a&&e.instanceColor&&(t=e.instanceColor));const n={};n.attribute=t,t&&t.data&&(n.data=t.data),r[a]=n,o++}}a.attributes=r,a.attributesNum=o,a.index=i}(n,m,l,g),null!==g&&t.update(g,e.ELEMENT_ARRAY_BUFFER),(v||s)&&(s=!1,function(n,i,r,a){c();const s=a.attributes,o=r.getAttributes(),l=i.defaultAttributeValues;for(const u in o){const i=o[u];if(i.location>=0){let r=s[u];if(void 0===r&&("instanceMatrix"===u&&n.instanceMatrix&&(r=n.instanceMatrix),"instanceColor"===u&&n.instanceColor&&(r=n.instanceColor)),void 0!==r){const s=r.normalized,o=r.itemSize,l=t.get(r);if(void 0===l)continue;const u=l.buffer,c=l.type,p=l.bytesPerElement,m=c===e.INT||c===e.UNSIGNED_INT||r.gpuType===no;if(r.isInterleavedBufferAttribute){const t=r.data,l=t.stride,g=r.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let s=void 0!==n.precision?n.precision:"highp";const o=a(s);o!==s&&(Iu("WebGLRenderer:",s,"not supported, using",o,"instead."),s=o);const l=!0===n.logarithmicDepthBuffer,u=!0===n.reversedDepthBuffer&&t.has("EXT_clip_control");!0===n.reversedDepthBuffer&&!1===u&&Iu("WebGLRenderer: Unable to use reversed depth buffer due to missing EXT_clip_control extension. Fallback to default depth buffer.");return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===t.has("EXT_texture_filter_anisotropic")){const n=t.get("EXT_texture_filter_anisotropic");r=e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:a,textureFormatReadable:function(t){return t===fo||i.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(n){const r=n===ao&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(n!==Zs&&i.convert(n)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&n!==ro&&!r)},precision:s,logarithmicDepthBuffer:l,reversedDepthBuffer:u,maxTextures:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:e.getParameter(e.MAX_SAMPLES),samples:e.getParameter(e.SAMPLES)}}function cC(e){const t=this;let n=null,i=0,r=!1,a=!1;const s=new Ip,o=new $u,l={value:null,needsUpdate:!1};function u(e,n,i,r){const a=null!==e?e.length:0;let u=null;if(0!==a){if(u=l.value,!0!==r||null===u){const t=i+4*a,r=n.matrixWorldInverse;o.getNormalMatrix(r),(null===u||u.length0);t.numPlanes=i,t.numIntersection=0}();else{const e=a?0:i,t=4*e;let r=f.clippingState||null;l.value=r,r=u(h,o,t,c);for(let i=0;i!==t;++i)r[i]=n[i];f.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=e}}}aC.set(-1,0,0,0,1,0,0,0,1);const hC=[.125,.215,.35,.446,.526,.582],dC=20,pC=new Pv,fC=new ih;let mC=null,gC=0,vC=0,yC=!1;const _C=new Yu;class bC{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};const a=r.size,s=void 0===a?256:a,o=r.position,l=void 0===o?_C:o;mC=this._renderer.getRenderTarget(),gC=this._renderer.getActiveCubeFace(),vC=this._renderer.getActiveMipmapLevel(),yC=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);const u=this._allocateTargets();return u.depthBuffer=!0,this._sceneToCubeUV(e,n,i,u,l),t>0&&this._blur(u,0,0,t),this._applyPMREM(u),this._cleanup(u),u}fromEquirectangular(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}fromCubemap(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=MC(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=AC(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;ee-4?o=hC[s-e+4-1]:0===s&&(o=0),n.push(o);const l=1/(a-2),u=-l,c=1+l,h=[u,u,c,u,c,c,u,u,c,c,u,c],d=6,p=6,f=3,m=2,g=1,v=new Float32Array(f*p*d),y=new Float32Array(m*p*d),_=new Float32Array(g*p*d);for(let e=0;e2?0:-1,i=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];v.set(i,f*p*e),y.set(h,m*p*e);const r=[e,e,e,e,e,e];_.set(r,g*p*e)}const b=new dd;b.setAttribute("position",new Wh(v,f)),b.setAttribute("uv",new Wh(y,m)),b.setAttribute("faceIndex",new Wh(_,g)),i.push(new ip(b,null)),r>4&&r--}return{lodMeshes:i,sizeLods:t,sigmas:n}}(i);this._lodMeshes=r.lodMeshes,this._sizeLods=r.sizeLods,this._sigmas=r.sigmas,this._blurMaterial=function(e,t,n){const i=new Float32Array(dC),r=new Yu(0,1,0),a=new _g({name:"SphericalGaussianBlur",defines:{n:dC,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:Ua,depthTest:!1,depthWrite:!1});return a}(i,e,t),this._ggxMaterial=function(e,t,n){const i=new _g({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:"".concat(e,".0")},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:'\n\n\t\t\tprecision highp float;\n\t\t\tprecision highp int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform float roughness;\n\t\t\tuniform float mipInt;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include \n\n\t\t\t#define PI 3.14159265359\n\n\t\t\t// Van der Corput radical inverse\n\t\t\tfloat radicalInverse_VdC(uint bits) {\n\t\t\t\tbits = (bits << 16u) | (bits >> 16u);\n\t\t\t\tbits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n\t\t\t\tbits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n\t\t\t\tbits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n\t\t\t\tbits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n\t\t\t\treturn float(bits) * 2.3283064365386963e-10; // / 0x100000000\n\t\t\t}\n\n\t\t\t// Hammersley sequence\n\t\t\tvec2 hammersley(uint i, uint N) {\n\t\t\t\treturn vec2(float(i) / float(N), radicalInverse_VdC(i));\n\t\t\t}\n\n\t\t\t// GGX VNDF importance sampling (Eric Heitz 2018)\n\t\t\t// "Sampling the GGX Distribution of Visible Normals"\n\t\t\t// https://jcgt.org/published/0007/04/01/\n\t\t\tvec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {\n\t\t\t\tfloat alpha = roughness * roughness;\n\n\t\t\t\t// Section 4.1: Orthonormal basis\n\t\t\t\tvec3 T1 = vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 T2 = cross(V, T1);\n\n\t\t\t\t// Section 4.2: Parameterization of projected area\n\t\t\t\tfloat r = sqrt(Xi.x);\n\t\t\t\tfloat phi = 2.0 * PI * Xi.y;\n\t\t\t\tfloat t1 = r * cos(phi);\n\t\t\t\tfloat t2 = r * sin(phi);\n\t\t\t\tfloat s = 0.5 * (1.0 + V.z);\n\t\t\t\tt2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;\n\n\t\t\t\t// Section 4.3: Reprojection onto hemisphere\n\t\t\t\tvec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;\n\n\t\t\t\t// Section 3.4: Transform back to ellipsoid configuration\n\t\t\t\treturn normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\tvec3 N = normalize(vOutputDirection);\n\t\t\t\tvec3 V = N; // Assume view direction equals normal for pre-filtering\n\n\t\t\t\tvec3 prefilteredColor = vec3(0.0);\n\t\t\t\tfloat totalWeight = 0.0;\n\n\t\t\t\t// For very low roughness, just sample the environment directly\n\t\t\t\tif (roughness < 0.001) {\n\t\t\t\t\tgl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Tangent space basis for VNDF sampling\n\t\t\t\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 tangent = normalize(cross(up, N));\n\t\t\t\tvec3 bitangent = cross(N, tangent);\n\n\t\t\t\tfor(uint i = 0u; i < uint(GGX_SAMPLES); i++) {\n\t\t\t\t\tvec2 Xi = hammersley(i, uint(GGX_SAMPLES));\n\n\t\t\t\t\t// For PMREM, V = N, so in tangent space V is always (0, 0, 1)\n\t\t\t\t\tvec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);\n\n\t\t\t\t\t// Transform H back to world space\n\t\t\t\t\tvec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);\n\t\t\t\t\tvec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n\t\t\t\t\tfloat NdotL = max(dot(N, L), 0.0);\n\n\t\t\t\t\tif(NdotL > 0.0) {\n\t\t\t\t\t\t// Sample environment at fixed mip level\n\t\t\t\t\t\t// VNDF importance sampling handles the distribution filtering\n\t\t\t\t\t\tvec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);\n\n\t\t\t\t\t\t// Weight by NdotL for the split-sum approximation\n\t\t\t\t\t\t// VNDF PDF naturally accounts for the visible microfacet distribution\n\t\t\t\t\t\tprefilteredColor += sampleColor * NdotL;\n\t\t\t\t\t\ttotalWeight += NdotL;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (totalWeight > 0.0) {\n\t\t\t\t\tprefilteredColor = prefilteredColor / totalWeight;\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4(prefilteredColor, 1.0);\n\t\t\t}\n\t\t',blending:Ua,depthTest:!1,depthWrite:!1});return i}(i,e,t)}return i}_compileMaterial(e){const t=new ip(new dd,e);this._renderer.compile(t,pC)}_sceneToCubeUV(e,t,n,i,r){const a=new wv(90,1,t,n),s=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,u=l.autoClear,c=l.toneMapping;l.getClearColor(fC),l.toneMapping=As,l.autoClear=!1;l.state.buffers.depth.getReversed()&&(l.setRenderTarget(i),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new ip(new Uf,new Wd({name:"PMREM.Background",side:Oa,depthWrite:!1,depthTest:!1})));const h=this._backgroundBox,d=h.material;let p=!1;const f=e.background;f?f.isColor&&(d.color.copy(f),e.background=null,p=!0):(d.color.copy(fC),p=!0);for(let m=0;m<6;m++){const t=m%3;0===t?(a.up.set(0,s[m],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x+o[m],r.y,r.z)):1===t?(a.up.set(0,0,s[m]),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y+o[m],r.z)):(a.up.set(0,s[m],0),a.position.set(r.x,r.y,r.z),a.lookAt(r.x,r.y,r.z+o[m]));const n=this._cubeSize;SC(i,t*n,m>2?n:0,n,n),l.setRenderTarget(i),p&&l.render(h,a),l.render(e,a)}l.toneMapping=c,l.autoClear=u,e.background=f}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===Fs||e.mapping===Ls;i?(null===this._cubemapMaterial&&(this._cubemapMaterial=MC()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=AC());const r=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=r;r.uniforms.envMap.value=e;const s=this._cubeSize;SC(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,pC)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let r=1;rh-4?n-h+4:0),f=4*(this._cubeSize-d);o.envMap.value=e.texture,o.roughness.value=c,o.mipInt.value=h-t,SC(r,p,f,3*d,2*d),i.setRenderTarget(r),i.render(s,pC),o.envMap.value=r.texture,o.roughness.value=0,o.mipInt.value=h-n,SC(e,p,f,3*d,2*d),i.setRenderTarget(e),i.render(s,pC)}_blur(e,t,n,i,r){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",r),this._halfBlur(a,e,n,n,i,"longitudinal",r)}_halfBlur(e,t,n,i,r,a,s){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==a&&"longitudinal"!==a&&Du("blur direction must be either latitudinal or longitudinal!");const u=this._lodMeshes[i];u.material=l;const c=l.uniforms,h=this._sizeLods[n]-1,d=isFinite(r)?Math.PI/(2*h):2*Math.PI/39,p=r/d,f=isFinite(r)?1+Math.floor(3*p):dC;f>dC&&Iu("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(f," samples when the maximum is set to ").concat(dC));const m=[];let g=0;for(let _=0;_v-4?i-v+4:0),4*(this._cubeSize-y),3*y,2*y),o.setRenderTarget(t),o.render(u,pC)}}function xC(e,t,n){const i=new vc(e,t,n);return i.texture.mapping=ks,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function SC(e,t,n,i,r){e.viewport.set(t,n,i,r),e.scissor.set(t,n,i,r)}function AC(){return new _g({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include \n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:Ua,depthTest:!1,depthWrite:!1})}function MC(){return new _g({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t",fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:Ua,depthTest:!1,depthWrite:!1})}class wC extends vc{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new Df(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={tEquirect:{value:null}},i="\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include \n\t\t\t\t\t#include \n\n\t\t\t\t}\n\t\t\t",r="\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include \n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t",a=new Uf(5,5,5),s=new _g({name:"CubemapFromEquirect",uniforms:fg(n),vertexShader:i,fragmentShader:r,side:Oa,blending:Ua});s.uniforms.tEquirect.value=t;const o=new ip(a,s),l=t.minFilter;t.minFilter===Ys&&(t.minFilter=Js);return new ny(1,10,this).update(e,o),t.minFilter=l,o.geometry.dispose(),o.material.dispose(),this}clear(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const r=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(r)}}function EC(e){let t=new WeakMap,n=new WeakMap,i=null;function r(e,t){return t===Ns?e.mapping=Fs:t===Os&&(e.mapping=Ls),e}function a(e){const n=e.target;n.removeEventListener("dispose",a);const i=t.get(n);void 0!==i&&(t.delete(n),i.dispose())}function s(e){const t=e.target;t.removeEventListener("dispose",s);const i=n.get(t);void 0!==i&&(n.delete(t),i.dispose())}return{get:function(o){return null===o||void 0===o?null:arguments.length>1&&void 0!==arguments[1]&&arguments[1]?function(t){if(t&&t.isTexture){const r=t.mapping,a=r===Ns||r===Os,o=r===Fs||r===Ls;if(a||o){let r=n.get(t);const l=void 0!==r?r.texture.pmremVersion:0;if(t.isRenderTargetTexture&&t.pmremVersion!==l)return null===i&&(i=new bC(e)),r=a?i.fromEquirectangular(t,r):i.fromCubemap(t,r),r.texture.pmremVersion=t.pmremVersion,n.set(t,r),r.texture;if(void 0!==r)return r.texture;{const l=t.image;return a&&l&&l.height>0||o&&l&&function(e){let t=0;const n=6;for(let i=0;i0){const s=new wC(i.height);return s.fromEquirectangularTexture(e,n),t.set(n,s),n.addEventListener("dispose",a),r(s.texture,n.mapping)}return null}}}return n}(o)},dispose:function(){t=new WeakMap,n=new WeakMap,null!==i&&(i.dispose(),i=null)}}}function TC(e){const t={};function n(n){if(void 0!==t[n])return t[n];const i=e.getExtension(n);return t[n]=i,i}return{has:function(e){return null!==n(e)},init:function(){n("EXT_color_buffer_float"),n("WEBGL_clip_cull_distance"),n("OES_texture_float_linear"),n("EXT_color_buffer_half_float"),n("WEBGL_multisampled_render_to_texture"),n("WEBGL_render_shared_exponent")},get:function(e){const t=n(e);return null===t&&Fu("WebGLRenderer: "+e+" extension not supported."),t}}}function CC(e,t,n,i){const r={},a=new WeakMap;function s(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const n in o.attributes)t.remove(o.attributes[n]);o.removeEventListener("dispose",s),delete r[o.id];const l=a.get(o);l&&(t.remove(l),a.delete(o)),i.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,n.memory.geometries--}function o(e){const n=[],i=e.index,r=e.attributes.position;let s=0;if(void 0===r)return;if(null!==i){const e=i.array;s=i.version;for(let t=0,i=e.length;t=65535?Zh:Yh)(n,1);o.version=s;const l=a.get(e);l&&t.remove(l),a.set(e,o)}return{get:function(e,t){return!0===r[t.id]||(t.addEventListener("dispose",s),r[t.id]=!0,n.memory.geometries++),t},update:function(n){const i=n.attributes;for(const r in i)t.update(i[r],e.ARRAY_BUFFER)},getWireframeAttribute:function(e){const t=a.get(e);if(t){const n=e.index;null!==n&&t.versiont.maxTextureSize&&(b=Math.ceil(_/t.maxTextureSize),_=t.maxTextureSize);const x=new Float32Array(_*b*4*c),S=new yc(x,_,b,c);S.type=ro,S.needsUpdate=!0;const A=4*y;for(let w=0;w\n\t\t\t#include \n\n\t\t\tvoid main() {\n\t\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t\t#ifdef LINEAR_TONE_MAPPING\n\t\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( AGX_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CUSTOM_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\t\t\t\t#endif\n\n\t\t\t\t#ifdef SRGB_TRANSFER\n\t\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\t\t\t\t#endif\n\t\t\t}",depthTest:!1,depthWrite:!1}),u=new ip(o,l),c=new Pv(-1,1,1,-1,0,1);let h,d=null,p=null,f=!1,m=null,g=[],v=!1;this.setSize=function(e,t){a.setSize(e,t),s.setSize(e,t);for(let n=0;n0&&!0===g[0].isRenderPass;const t=a.width,n=a.height;for(let i=0;i0)return e;const r=t*n;let a=zC[r];if(void 0===a&&(a=new Float32Array(r),zC[r]=a),0!==t){i.toArray(a,0);for(let i=1,r=0;i!==t;++i)r+=n,e[i].toArray(a,r)}return a}function XC(e,t){if(e.length!==t.length)return!1;for(let n=0,i=e.length;n0&&(this.seq=i.concat(r))}setValue(e,t,n,i){const r=this.map[t];void 0!==r&&r.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];void 0!==i&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let r=0,a=t.length;r!==a;++r){const a=t[r],s=n[a.id];!1!==s.needsUpdate&&a.setValue(e,s.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,r=e.length;i!==r;++i){const r=e[i];r.id in t&&n.push(r)}return n}}function zR(e,t,n){const i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}let GR=0;const HR=new $u;function VR(e,t,n){const i=e.getShaderParameter(t,e.COMPILE_STATUS),r=(e.getShaderInfoLog(t)||"").trim();if(i&&""===r)return"";const a=/ERROR: 0:(\d+)/.exec(r);if(a){const i=parseInt(a[1]);return n.toUpperCase()+"\n\n"+r+"\n\n"+function(e,t){const n=e.split("\n"),i=[],r=Math.max(t-6,0),a=Math.min(t+6,n.length);for(let s=r;s":" "," ").concat(e,": ").concat(n[s]))}return i.join("\n")}(e.getShaderSource(t),i)}return r}function jR(e,t){const n=function(e){rc._getMatrix(HR,rc.workingColorSpace,e);const t="mat3( ".concat(HR.elements.map(e=>e.toFixed(4))," )");switch(rc.getTransfer(e)){case Rl:return[t,"LinearTransferOETF"];case Pl:return[t,"sRGBTransferOETF"];default:return Iu("WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return["vec4 ".concat(e,"( vec4 value ) {"),"\treturn ".concat(n[1],"( vec4( value.rgb * ").concat(n[0],", value.a ) );"),"}"].join("\n")}const WR={[Ms]:"Linear",[ws]:"Reinhard",[Es]:"Cineon",[Ts]:"ACESFilmic",[Rs]:"AgX",[Ps]:"Neutral",[Cs]:"Custom"};function XR(e,t){const n=WR[t];return void 0===n?(Iu("WebGLProgram: Unsupported toneMapping:",t),"vec3 "+e+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}const JR=new Yu;function KR(){rc.getLuminanceCoefficients(JR);const e=JR.x.toFixed(4),t=JR.y.toFixed(4),n=JR.z.toFixed(4);return["float luminance( const in vec3 rgb ) {","\tconst vec3 weights = vec3( ".concat(e,", ").concat(t,", ").concat(n," );"),"\treturn dot( weights, rgb );","}"].join("\n")}function qR(e){return""!==e}function YR(e,t){const n=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,n).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function QR(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const ZR=/^[ \t]*#include +<([\w\d./]+)>/gm;function $R(e){return e.replace(ZR,tP)}const eP=new Map;function tP(e,t){let n=eC[t];if(void 0===n){const e=eP.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");n=eC[e],Iu('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return $R(n)}const nP=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function iP(e){return e.replace(nP,rP)}function rP(e,t,n,i){let r="";for(let a=parseInt(t);a0&&(g+="\n"),v=["#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f].filter(qR).join("\n"),v.length>0&&(v+="\n")):(g=[aP(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",n.batching?"#define USE_BATCHING":"",n.batchingColor?"#define USE_BATCHING_COLOR":"",n.instancing?"#define USE_INSTANCING":"",n.instancingColor?"#define USE_INSTANCING_COLOR":"",n.instancingMorph?"#define USE_INSTANCING_MORPH":"",n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.map?"#define USE_MAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+c:"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.displacementMap?"#define USE_DISPLACEMENTMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.mapUv?"#define MAP_UV "+n.mapUv:"",n.alphaMapUv?"#define ALPHAMAP_UV "+n.alphaMapUv:"",n.lightMapUv?"#define LIGHTMAP_UV "+n.lightMapUv:"",n.aoMapUv?"#define AOMAP_UV "+n.aoMapUv:"",n.emissiveMapUv?"#define EMISSIVEMAP_UV "+n.emissiveMapUv:"",n.bumpMapUv?"#define BUMPMAP_UV "+n.bumpMapUv:"",n.normalMapUv?"#define NORMALMAP_UV "+n.normalMapUv:"",n.displacementMapUv?"#define DISPLACEMENTMAP_UV "+n.displacementMapUv:"",n.metalnessMapUv?"#define METALNESSMAP_UV "+n.metalnessMapUv:"",n.roughnessMapUv?"#define ROUGHNESSMAP_UV "+n.roughnessMapUv:"",n.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+n.anisotropyMapUv:"",n.clearcoatMapUv?"#define CLEARCOATMAP_UV "+n.clearcoatMapUv:"",n.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+n.clearcoatNormalMapUv:"",n.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+n.clearcoatRoughnessMapUv:"",n.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+n.iridescenceMapUv:"",n.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+n.iridescenceThicknessMapUv:"",n.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+n.sheenColorMapUv:"",n.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+n.sheenRoughnessMapUv:"",n.specularMapUv?"#define SPECULARMAP_UV "+n.specularMapUv:"",n.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+n.specularColorMapUv:"",n.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+n.specularIntensityMapUv:"",n.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+n.transmissionMapUv:"",n.thicknessMapUv?"#define THICKNESSMAP_UV "+n.thicknessMapUv:"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexNormals?"#define HAS_NORMAL":"",n.vertexColors?"#define USE_COLOR":"",n.vertexAlphas?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.flatShading?"#define FLAT_SHADED":"",n.skinning?"#define USE_SKINNING":"",n.morphTargets?"#define USE_MORPHTARGETS":"",n.morphNormals&&!1===n.flatShading?"#define USE_MORPHNORMALS":"",n.morphColors?"#define USE_MORPHCOLORS":"",n.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+n.morphTextureStride:"",n.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+n.morphTargetsCount:"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.sizeAttenuation?"#define USE_SIZEATTENUATION":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(qR).join("\n"),v=[aP(n),"#define SHADER_TYPE "+n.shaderType,"#define SHADER_NAME "+n.shaderName,f,n.useFog&&n.fog?"#define USE_FOG":"",n.useFog&&n.fogExp2?"#define FOG_EXP2":"",n.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",n.map?"#define USE_MAP":"",n.matcap?"#define USE_MATCAP":"",n.envMap?"#define USE_ENVMAP":"",n.envMap?"#define "+u:"",n.envMap?"#define "+c:"",n.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",n.lightMap?"#define USE_LIGHTMAP":"",n.aoMap?"#define USE_AOMAP":"",n.bumpMap?"#define USE_BUMPMAP":"",n.normalMap?"#define USE_NORMALMAP":"",n.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",n.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",n.packedNormalMap?"#define USE_PACKED_NORMALMAP":"",n.emissiveMap?"#define USE_EMISSIVEMAP":"",n.anisotropy?"#define USE_ANISOTROPY":"",n.anisotropyMap?"#define USE_ANISOTROPYMAP":"",n.clearcoat?"#define USE_CLEARCOAT":"",n.clearcoatMap?"#define USE_CLEARCOATMAP":"",n.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",n.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",n.dispersion?"#define USE_DISPERSION":"",n.iridescence?"#define USE_IRIDESCENCE":"",n.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",n.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",n.specularMap?"#define USE_SPECULARMAP":"",n.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",n.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",n.roughnessMap?"#define USE_ROUGHNESSMAP":"",n.metalnessMap?"#define USE_METALNESSMAP":"",n.alphaMap?"#define USE_ALPHAMAP":"",n.alphaTest?"#define USE_ALPHATEST":"",n.alphaHash?"#define USE_ALPHAHASH":"",n.sheen?"#define USE_SHEEN":"",n.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",n.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",n.transmission?"#define USE_TRANSMISSION":"",n.transmissionMap?"#define USE_TRANSMISSIONMAP":"",n.thicknessMap?"#define USE_THICKNESSMAP":"",n.vertexTangents&&!1===n.flatShading?"#define USE_TANGENT":"",n.vertexColors||n.instancingColor?"#define USE_COLOR":"",n.vertexAlphas||n.batchingColor?"#define USE_COLOR_ALPHA":"",n.vertexUv1s?"#define USE_UV1":"",n.vertexUv2s?"#define USE_UV2":"",n.vertexUv3s?"#define USE_UV3":"",n.pointsUvs?"#define USE_POINTS_UV":"",n.gradientMap?"#define USE_GRADIENTMAP":"",n.flatShading?"#define FLAT_SHADED":"",n.doubleSided?"#define DOUBLE_SIDED":"",n.flipSided?"#define FLIP_SIDED":"",n.shadowMapEnabled?"#define USE_SHADOWMAP":"",n.shadowMapEnabled?"#define "+l:"",n.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",n.numLightProbes>0?"#define USE_LIGHT_PROBES":"",n.numLightProbeGrids>0?"#define USE_LIGHT_PROBES_GRID":"",n.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",n.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",n.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",n.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",n.toneMapping!==As?"#define TONE_MAPPING":"",n.toneMapping!==As?eC.tonemapping_pars_fragment:"",n.toneMapping!==As?XR("toneMapping",n.toneMapping):"",n.dithering?"#define DITHERING":"",n.opaque?"#define OPAQUE":"",eC.colorspace_pars_fragment,jR("linearToOutputTexel",n.outputColorSpace),KR(),n.useDepthPacking?"#define DEPTH_PACKING "+n.depthPacking:"","\n"].filter(qR).join("\n")),s=$R(s),s=YR(s,n),s=QR(s,n),o=$R(o),o=YR(o,n),o=QR(o,n),s=iP(s),o=iP(o),!0!==n.isRawShaderMaterial&&(y="#version 300 es\n",g=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+g,v=["#define varying in",n.glslVersion===fu?"":"layout(location = 0) out highp vec4 pc_fragColor;",n.glslVersion===fu?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+v);const _=y+g+s,b=y+v+o,x=zR(r,r.VERTEX_SHADER,_),S=zR(r,r.FRAGMENT_SHADER,b);function A(t){if(e.debug.checkShaderErrors){const n=r.getProgramInfoLog(m)||"",i=r.getShaderInfoLog(x)||"",a=r.getShaderInfoLog(S)||"",s=n.trim(),o=i.trim(),l=a.trim();let u=!0,c=!0;if(!1===r.getProgramParameter(m,r.LINK_STATUS))if(u=!1,"function"===typeof e.debug.onShaderError)e.debug.onShaderError(r,m,x,S);else{const e=VR(r,x,"vertex"),n=VR(r,S,"fragment");Du("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(m,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+s+"\n"+e+"\n"+n)}else""!==s?Iu("WebGLProgram: Program Info Log:",s):""!==o&&""!==l||(c=!1);c&&(t.diagnostics={runnable:u,programLog:s,vertexShader:{log:o,prefix:g},fragmentShader:{log:l,prefix:v}})}r.deleteShader(x),r.deleteShader(S),M=new UR(r,m),w=function(e,t){const n={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let r=0;r0,J=r.clearcoat>0,K=r.dispersion>0,q=r.iridescence>0,Y=r.sheen>0,Q=r.transmission>0,Z=X&&!!r.anisotropyMap,$=J&&!!r.clearcoatMap,ee=J&&!!r.clearcoatNormalMap,te=J&&!!r.clearcoatRoughnessMap,ne=q&&!!r.iridescenceMap,ie=q&&!!r.iridescenceThicknessMap,re=Y&&!!r.sheenColorMap,ae=Y&&!!r.sheenRoughnessMap,se=!!r.specularMap,oe=!!r.specularColorMap,le=!!r.specularIntensityMap,ue=Q&&!!r.transmissionMap,ce=Q&&!!r.thicknessMap,he=!!r.gradientMap,de=!!r.alphaMap,pe=r.alphaTest>0,fe=!!r.alphaHash,me=!!r.extensions;let ge=As;r.toneMapped&&(null!==B&&!0!==B.isXRRenderTarget||(ge=e.toneMapping));const ve={shaderID:A,shaderType:r.type,shaderName:r.name,vertexShader:E,fragmentShader:T,defines:r.defines,customVertexShaderID:C,customFragmentShaderID:R,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:d,batching:F,batchingColor:F&&null!==m._colorsTexture,instancing:D,instancingColor:D&&null!==m.instanceColor,instancingMorph:D&&null!==m.morphTexture,outputColorSpace:null===B?e.outputColorSpace:!0===B.isXRRenderTarget?B.texture.colorSpace:rc.workingColorSpace,alphaToCoverage:!!r.alphaToCoverage,map:L,matcap:N,envMap:O,envMapMode:O&&x.mapping,envMapCubeUVHeight:S,aoMap:k,lightMap:U,bumpMap:z,normalMap:G,displacementMap:H,emissiveMap:V,normalMapObjectSpace:G&&r.normalMapType===wl,normalMapTangentSpace:G&&r.normalMapType===Ml,packedNormalMap:G&&r.normalMapType===Ml&&(ye=r.normalMap.format,ye===_o||ye===No||ye===il),metalnessMap:j,roughnessMap:W,anisotropy:X,anisotropyMap:Z,clearcoat:J,clearcoatMap:$,clearcoatNormalMap:ee,clearcoatRoughnessMap:te,dispersion:K,iridescence:q,iridescenceMap:ne,iridescenceThicknessMap:ie,sheen:Y,sheenColorMap:re,sheenRoughnessMap:ae,specularMap:se,specularColorMap:oe,specularIntensityMap:le,transmission:Q,transmissionMap:ue,thicknessMap:ce,gradientMap:he,opaque:!1===r.transparent&&r.blending===za&&!1===r.alphaToCoverage,alphaMap:de,alphaTest:pe,alphaHash:fe,combine:r.combine,mapUv:L&&f(r.map.channel),aoMapUv:k&&f(r.aoMap.channel),lightMapUv:U&&f(r.lightMap.channel),bumpMapUv:z&&f(r.bumpMap.channel),normalMapUv:G&&f(r.normalMap.channel),displacementMapUv:H&&f(r.displacementMap.channel),emissiveMapUv:V&&f(r.emissiveMap.channel),metalnessMapUv:j&&f(r.metalnessMap.channel),roughnessMapUv:W&&f(r.roughnessMap.channel),anisotropyMapUv:Z&&f(r.anisotropyMap.channel),clearcoatMapUv:$&&f(r.clearcoatMap.channel),clearcoatNormalMapUv:ee&&f(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:te&&f(r.clearcoatRoughnessMap.channel),iridescenceMapUv:ne&&f(r.iridescenceMap.channel),iridescenceThicknessMapUv:ie&&f(r.iridescenceThicknessMap.channel),sheenColorMapUv:re&&f(r.sheenColorMap.channel),sheenRoughnessMapUv:ae&&f(r.sheenRoughnessMap.channel),specularMapUv:se&&f(r.specularMap.channel),specularColorMapUv:oe&&f(r.specularColorMap.channel),specularIntensityMapUv:le&&f(r.specularIntensityMap.channel),transmissionMapUv:ue&&f(r.transmissionMap.channel),thicknessMapUv:ce&&f(r.thicknessMap.channel),alphaMapUv:de&&f(r.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(G||X),vertexNormals:!!y.attributes.normal,vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!y.attributes.color&&4===y.attributes.color.itemSize,pointsUvs:!0===m.isPoints&&!!y.attributes.uv&&(L||de),fog:!!v,useFog:!0===r.fog,fogExp2:!!v&&v.isFogExp2,flatShading:!1===r.wireframe&&(!0===r.flatShading||void 0===y.attributes.normal&&!1===G&&(r.isMeshLambertMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isMeshPhysicalMaterial)),sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:h,reversedDepthBuffer:I,skinning:!0===m.isSkinnedMesh,morphTargets:void 0!==y.morphAttributes.position,morphNormals:void 0!==y.morphAttributes.normal,morphColors:void 0!==y.morphAttributes.color,morphTargetsCount:w,morphTextureStride:P,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numLightProbeGrids:g.length,numClippingPlanes:a.numPlanes,numClipIntersection:a.numIntersection,dithering:r.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:ge,decodeVideoTexture:L&&!0===r.map.isVideoTexture&&rc.getTransfer(r.map.colorSpace)===Pl,decodeVideoTextureEmissive:V&&!0===r.emissiveMap.isVideoTexture&&rc.getTransfer(r.emissiveMap.colorSpace)===Pl,premultipliedAlpha:r.premultipliedAlpha,doubleSided:r.side===ka,flipSided:r.side===Oa,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionClipCullDistance:me&&!0===r.extensions.clipCullDistance&&n.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(me&&!0===r.extensions.multiDraw||F)&&n.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:n.has("KHR_parallel_shader_compile"),customProgramCacheKey:r.customProgramCacheKey()};var ye;return ve.vertexUv1s=l.has(1),ve.vertexUv2s=l.has(2),ve.vertexUv3s=l.has(3),l.clear(),ve},getProgramCacheKey:function(t){const n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)n.push(e),n.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(n,t),function(e,t){s.disableAll(),t.instancing&&s.enable(0);t.instancingColor&&s.enable(1);t.instancingMorph&&s.enable(2);t.matcap&&s.enable(3);t.envMap&&s.enable(4);t.normalMapObjectSpace&&s.enable(5);t.normalMapTangentSpace&&s.enable(6);t.clearcoat&&s.enable(7);t.iridescence&&s.enable(8);t.alphaTest&&s.enable(9);t.vertexColors&&s.enable(10);t.vertexAlphas&&s.enable(11);t.vertexUv1s&&s.enable(12);t.vertexUv2s&&s.enable(13);t.vertexUv3s&&s.enable(14);t.vertexTangents&&s.enable(15);t.anisotropy&&s.enable(16);t.alphaHash&&s.enable(17);t.batching&&s.enable(18);t.dispersion&&s.enable(19);t.batchingColor&&s.enable(20);t.gradientMap&&s.enable(21);t.packedNormalMap&&s.enable(22);t.vertexNormals&&s.enable(23);e.push(s.mask),s.disableAll(),t.fog&&s.enable(0);t.useFog&&s.enable(1);t.flatShading&&s.enable(2);t.logarithmicDepthBuffer&&s.enable(3);t.reversedDepthBuffer&&s.enable(4);t.skinning&&s.enable(5);t.morphTargets&&s.enable(6);t.morphNormals&&s.enable(7);t.morphColors&&s.enable(8);t.premultipliedAlpha&&s.enable(9);t.shadowMapEnabled&&s.enable(10);t.doubleSided&&s.enable(11);t.flipSided&&s.enable(12);t.useDepthPacking&&s.enable(13);t.dithering&&s.enable(14);t.transmission&&s.enable(15);t.sheen&&s.enable(16);t.opaque&&s.enable(17);t.pointsUvs&&s.enable(18);t.decodeVideoTexture&&s.enable(19);t.decodeVideoTextureEmissive&&s.enable(20);t.alphaToCoverage&&s.enable(21);t.numLightProbeGrids>0&&s.enable(22);e.push(s.mask)}(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()},getUniforms:function(e){const t=p[e.type];let n;if(t){const e=nC[t];n=yg.clone(e.uniforms)}else n=e.uniforms;return n},acquireProgram:function(t,n){let i=c.get(n);return void 0!==i?++i.usedTimes:(i=new cP(e,n,t,r),u.push(i),c.set(n,i)),i},releaseProgram:function(e){if(0===--e.usedTimes){const t=u.indexOf(e);u[t]=u[u.length-1],u.pop(),c.delete(e.cacheKey),e.destroy()}},releaseShaderCache:function(e){o.remove(e)},programs:u,dispose:function(){o.dispose()}}}function mP(){let e=new WeakMap;return{has:function(t){return e.has(t)},get:function(t){let n=e.get(t);return void 0===n&&(n={},e.set(t,n)),n},remove:function(t){e.delete(t)},update:function(t,n,i){e.get(t)[n]=i},dispose:function(){e=new WeakMap}}}function gP(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.materialVariant!==t.materialVariant?e.materialVariant-t.materialVariant:e.z!==t.z?e.z-t.z:e.id-t.id}function vP(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function yP(){const e=[];let t=0;const n=[],i=[],r=[];function a(e){let t=0;return e.isInstancedMesh&&(t+=2),e.isSkinnedMesh&&(t+=1),t}function s(n,i,r,s,o,l){let u=e[t];return void 0===u?(u={id:n.id,object:n,geometry:i,material:r,materialVariant:a(n),groupOrder:s,renderOrder:n.renderOrder,z:o,group:l},e[t]=u):(u.id=n.id,u.object=n,u.geometry=i,u.material=r,u.materialVariant=a(n),u.groupOrder=s,u.renderOrder=n.renderOrder,u.z=o,u.group=l),t++,u}return{opaque:n,transmissive:i,transparent:r,init:function(){t=0,n.length=0,i.length=0,r.length=0},push:function(e,t,a,o,l,u){const c=s(e,t,a,o,l,u);a.transmission>0?i.push(c):!0===a.transparent?r.push(c):n.push(c)},unshift:function(e,t,a,o,l,u){const c=s(e,t,a,o,l,u);a.transmission>0?i.unshift(c):!0===a.transparent?r.unshift(c):n.unshift(c)},finish:function(){for(let n=t,i=e.length;n1&&n.sort(e||gP),i.length>1&&i.sort(t||vP),r.length>1&&r.sort(t||vP)}}}function _P(){let e=new WeakMap;return{get:function(t,n){const i=e.get(t);let r;return void 0===i?(r=new yP,e.set(t,[r])):n>=i.length?(r=new yP,i.push(r)):r=i[n],r},dispose:function(){e=new WeakMap}}}function bP(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":n={direction:new Yu,color:new ih};break;case"SpotLight":n={position:new Yu,direction:new Yu,color:new ih,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":n={position:new Yu,color:new ih,distance:0,decay:0};break;case"HemisphereLight":n={direction:new Yu,skyColor:new ih,groundColor:new ih};break;case"RectAreaLight":n={color:new ih,position:new Yu,halfWidth:new Yu,halfHeight:new Yu}}return e[t.id]=n,n}}}let xP=0;function SP(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function AP(e){const t=new bP,n=function(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let n;switch(t.type){case"DirectionalLight":case"SpotLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ku};break;case"PointLight":n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ku,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=n,n}}}(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let o=0;o<9;o++)i.probe.push(new Yu);const r=new Yu,a=new Sc,s=new Sc;return{setup:function(r){let a=0,s=0,o=0;for(let e=0;e<9;e++)i.probe[e].set(0,0,0);let l=0,u=0,c=0,h=0,d=0,p=0,f=0,m=0,g=0,v=0,y=0;r.sort(SP);for(let e=0,b=r.length;e0&&(!0===e.has("OES_texture_float_linear")?(i.rectAreaLTC1=tC.LTC_FLOAT_1,i.rectAreaLTC2=tC.LTC_FLOAT_2):(i.rectAreaLTC1=tC.LTC_HALF_1,i.rectAreaLTC2=tC.LTC_HALF_2)),i.ambient[0]=a,i.ambient[1]=s,i.ambient[2]=o;const _=i.hash;_.directionalLength===l&&_.pointLength===u&&_.spotLength===c&&_.rectAreaLength===h&&_.hemiLength===d&&_.numDirectionalShadows===p&&_.numPointShadows===f&&_.numSpotShadows===m&&_.numSpotMaps===g&&_.numLightProbes===y||(i.directional.length=l,i.spot.length=c,i.rectArea.length=h,i.point.length=u,i.hemi.length=d,i.directionalShadow.length=p,i.directionalShadowMap.length=p,i.pointShadow.length=f,i.pointShadowMap.length=f,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=p,i.pointShadowMatrix.length=f,i.spotLightMatrix.length=m+g-v,i.spotLightMap.length=g,i.numSpotLightShadowsWithMaps=v,i.numLightProbes=y,_.directionalLength=l,_.pointLength=u,_.spotLength=c,_.rectAreaLength=h,_.hemiLength=d,_.numDirectionalShadows=p,_.numPointShadows=f,_.numSpotShadows=m,_.numSpotMaps=g,_.numLightProbes=y,i.version=xP++)},setupView:function(e,t){let n=0,o=0,l=0,u=0,c=0;const h=t.matrixWorldInverse;for(let d=0,p=e.length;d1&&void 0!==arguments[1]?arguments[1]:0;const r=t.get(n);let a;return void 0===r?(a=new MP(e),t.set(n,[a])):i>=r.length?(a=new MP(e),r.push(a)):a=r[i],a},dispose:function(){t=new WeakMap}}}const EP=[new Yu(1,0,0),new Yu(-1,0,0),new Yu(0,1,0),new Yu(0,-1,0),new Yu(0,0,1),new Yu(0,0,-1)],TP=[new Yu(0,-1,0),new Yu(0,-1,0),new Yu(0,0,1),new Yu(0,0,-1),new Yu(0,-1,0),new Yu(0,-1,0)],CP=new Sc,RP=new Yu,PP=new Yu;function BP(e,t,n){let i=new Np;const r=new Ku,a=new Ku,s=new mc,o=new Tg,l=new Cg,u={},c=n.maxTextureSize,h={[Na]:Oa,[Oa]:Na,[ka]:ka},d=new _g({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ku},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const f=new dd;f.setAttribute("position",new Wh(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new ip(f,d),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Da;let v=this.type;function y(n,i){const a=t.update(m);d.defines.VSM_SAMPLES!==n.blurSamples&&(d.defines.VSM_SAMPLES=n.blurSamples,p.defines.VSM_SAMPLES=n.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===n.mapPass&&(n.mapPass=new vc(r.x,r.y,{format:_o,type:ao})),d.uniforms.shadow_pass.value=n.map.depthTexture,d.uniforms.resolution.value=n.mapSize,d.uniforms.radius.value=n.radius,e.setRenderTarget(n.mapPass),e.clear(),e.renderBufferDirect(i,null,a,d,m,null),p.uniforms.shadow_pass.value=n.mapPass.texture,p.uniforms.resolution.value=n.mapSize,p.uniforms.radius.value=n.radius,e.setRenderTarget(n.map),e.clear(),e.renderBufferDirect(i,null,a,p,m,null)}function _(t,n,i,r){let a=null;const s=!0===i.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==s)a=s;else if(a=!0===i.isPointLight?l:o,e.localClippingEnabled&&!0===n.clipShadows&&Array.isArray(n.clippingPlanes)&&0!==n.clippingPlanes.length||n.displacementMap&&0!==n.displacementScale||n.alphaMap&&n.alphaTest>0||n.map&&n.alphaTest>0||!0===n.alphaToCoverage){const e=a.uuid,t=n.uuid;let i=u[e];void 0===i&&(i={},u[e]=i);let r=i[t];void 0===r&&(r=a.clone(),i[t]=r,n.addEventListener("dispose",x)),a=r}if(a.visible=n.visible,a.wireframe=n.wireframe,a.side=r===La?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],a.alphaMap=n.alphaMap,a.alphaTest=!0===n.alphaToCoverage?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,!0===i.isPointLight&&!0===a.isMeshDistanceMaterial){e.properties.get(a).light=i}return a}function b(n,r,a,s,o){if(!1===n.visible)return;if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&o===La)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);const i=t.update(n),l=n.material;if(Array.isArray(l)){const t=i.groups;for(let u=0,c=t.length;ue.needsUpdate=!0):e.material.needsUpdate=!0)});for(let f=0,m=t.length;fc||r.y>c)&&(r.x>c&&(a.x=Math.floor(c/h.x),r.x=a.x*h.x,u.mapSize.x=a.x),r.y>c&&(a.y=Math.floor(c/h.y),r.y=a.y*h.y,u.mapSize.y=a.y));const m=e.state.buffers.depth.getReversed();if(u.camera._reversedDepth=m,null===u.map||!0===p){if(null!==u.map&&(null!==u.map.depthTexture&&(u.map.depthTexture.dispose(),u.map.depthTexture=null),u.map.dispose()),this.type===La){if(l.isPointLight){Iu("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}u.map=new vc(r.x,r.y,{format:_o,type:ao,minFilter:Js,magFilter:Js,generateMipmaps:!1}),u.map.texture.name=l.name+".shadowMap",u.map.depthTexture=new Nf(r.x,r.y,ro),u.map.depthTexture.name=l.name+".shadowMapDepth",u.map.depthTexture.format=mo,u.map.depthTexture.compareFunction=null,u.map.depthTexture.minFilter=Hs,u.map.depthTexture.magFilter=Hs}else l.isPointLight?(u.map=new wC(r.x),u.map.depthTexture=new Of(r.x,io)):(u.map=new vc(r.x,r.y),u.map.depthTexture=new Nf(r.x,r.y,io)),u.map.depthTexture.name=l.name+".shadowMap",u.map.depthTexture.format=mo,this.type===Da?(u.map.depthTexture.compareFunction=m?nu:$l,u.map.depthTexture.minFilter=Js,u.map.depthTexture.magFilter=Js):(u.map.depthTexture.compareFunction=null,u.map.depthTexture.minFilter=Hs,u.map.depthTexture.magFilter=Hs);u.camera.updateProjectionMatrix()}const g=u.map.isWebGLCubeRenderTarget?6:1;for(let t=0;t=1):-1!==I.indexOf("OpenGL ES")&&(B=parseFloat(/^OpenGL ES (\d)/.exec(I)[1]),P=B>=2);let D=null,F={};const L=e.getParameter(e.SCISSOR_BOX),N=e.getParameter(e.VIEWPORT),O=(new mc).fromArray(L),k=(new mc).fromArray(N);function U(t,n,i,r){const a=new Uint8Array(4),s=e.createTexture();e.bindTexture(t,s),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;on||r.height>n)&&(i=n/Math.max(r.width,r.height)),i<1){if("undefined"!==typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!==typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!==typeof VideoFrame&&e instanceof VideoFrame){const n=Math.floor(i*r.width),a=Math.floor(i*r.height);void 0===d&&(d=m(n,a));const s=t?m(n,a):d;s.width=n,s.height=a;return s.getContext("2d").drawImage(e,0,0,n,a),Iu("WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+n+"x"+a+")."),s}return"data"in e&&Iu("WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),e}return e}function v(e){return e.generateMipmaps}function y(t){e.generateMipmap(t)}function _(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function b(n,i,r,a,s){let o,l=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(null!==n){if(void 0!==e[n])return e[n];Iu("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+n+"'")}a&&(o=t.get("EXT_texture_norm16"),o||Iu("WebGLRenderer: Unable to use normalized textures without EXT_texture_norm16 extension"));let u=i;if(i===e.RED&&(r===e.FLOAT&&(u=e.R32F),r===e.HALF_FLOAT&&(u=e.R16F),r===e.UNSIGNED_BYTE&&(u=e.R8),r===e.UNSIGNED_SHORT&&o&&(u=o.R16_EXT),r===e.SHORT&&o&&(u=o.R16_SNORM_EXT)),i===e.RED_INTEGER&&(r===e.UNSIGNED_BYTE&&(u=e.R8UI),r===e.UNSIGNED_SHORT&&(u=e.R16UI),r===e.UNSIGNED_INT&&(u=e.R32UI),r===e.BYTE&&(u=e.R8I),r===e.SHORT&&(u=e.R16I),r===e.INT&&(u=e.R32I)),i===e.RG&&(r===e.FLOAT&&(u=e.RG32F),r===e.HALF_FLOAT&&(u=e.RG16F),r===e.UNSIGNED_BYTE&&(u=e.RG8),r===e.UNSIGNED_SHORT&&o&&(u=o.RG16_EXT),r===e.SHORT&&o&&(u=o.RG16_SNORM_EXT)),i===e.RG_INTEGER&&(r===e.UNSIGNED_BYTE&&(u=e.RG8UI),r===e.UNSIGNED_SHORT&&(u=e.RG16UI),r===e.UNSIGNED_INT&&(u=e.RG32UI),r===e.BYTE&&(u=e.RG8I),r===e.SHORT&&(u=e.RG16I),r===e.INT&&(u=e.RG32I)),i===e.RGB_INTEGER&&(r===e.UNSIGNED_BYTE&&(u=e.RGB8UI),r===e.UNSIGNED_SHORT&&(u=e.RGB16UI),r===e.UNSIGNED_INT&&(u=e.RGB32UI),r===e.BYTE&&(u=e.RGB8I),r===e.SHORT&&(u=e.RGB16I),r===e.INT&&(u=e.RGB32I)),i===e.RGBA_INTEGER&&(r===e.UNSIGNED_BYTE&&(u=e.RGBA8UI),r===e.UNSIGNED_SHORT&&(u=e.RGBA16UI),r===e.UNSIGNED_INT&&(u=e.RGBA32UI),r===e.BYTE&&(u=e.RGBA8I),r===e.SHORT&&(u=e.RGBA16I),r===e.INT&&(u=e.RGBA32I)),i===e.RGB&&(r===e.UNSIGNED_SHORT&&o&&(u=o.RGB16_EXT),r===e.SHORT&&o&&(u=o.RGB16_SNORM_EXT),r===e.UNSIGNED_INT_5_9_9_9_REV&&(u=e.RGB9_E5),r===e.UNSIGNED_INT_10F_11F_11F_REV&&(u=e.R11F_G11F_B10F)),i===e.RGBA){const t=l?Rl:rc.getTransfer(s);r===e.FLOAT&&(u=e.RGBA32F),r===e.HALF_FLOAT&&(u=e.RGBA16F),r===e.UNSIGNED_BYTE&&(u=t===Pl?e.SRGB8_ALPHA8:e.RGBA8),r===e.UNSIGNED_SHORT&&o&&(u=o.RGBA16_EXT),r===e.SHORT&&o&&(u=o.RGBA16_SNORM_EXT),r===e.UNSIGNED_SHORT_4_4_4_4&&(u=e.RGBA4),r===e.UNSIGNED_SHORT_5_5_5_1&&(u=e.RGB5_A1)}return u!==e.R16F&&u!==e.R32F&&u!==e.RG16F&&u!==e.RG32F&&u!==e.RGBA16F&&u!==e.RGBA32F||t.get("EXT_color_buffer_float"),u}function x(t,n){let i;return t?null===n||n===io||n===lo?i=e.DEPTH24_STENCIL8:n===ro?i=e.DEPTH32F_STENCIL8:n===to&&(i=e.DEPTH24_STENCIL8,Iu("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===n||n===io||n===lo?i=e.DEPTH_COMPONENT24:n===ro?i=e.DEPTH_COMPONENT32F:n===to&&(i=e.DEPTH_COMPONENT16),i}function S(e,t){return!0===v(e)||e.isFramebufferTexture&&e.minFilter!==Hs&&e.minFilter!==Js?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function A(e){const t=e.target;t.removeEventListener("dispose",A),function(e){const t=i.get(e);if(void 0===t.__webglInit)return;const n=e.source,r=p.get(n);if(r){const i=r[t.__cacheKey];i.usedTimes--,0===i.usedTimes&&w(e),0===Object.keys(r).length&&p.delete(n)}i.remove(e)}(t),t.isVideoTexture&&c.delete(t),t.isHTMLTexture&&h.delete(t)}function M(t){const n=t.target;n.removeEventListener("dispose",M),function(t){const n=i.get(t);t.depthTexture&&(t.depthTexture.dispose(),i.remove(t.depthTexture));if(t.isWebGLCubeRenderTarget)for(let i=0;i<6;i++){if(Array.isArray(n.__webglFramebuffer[i]))for(let t=0;t0&&a.__version!==t.version){const e=t.image;if(null===e)Iu("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void F(a,t,r);Iu("WebGLRenderer: Texture marked for update but image is incomplete")}}else t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null);n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+r)}const C={[Us]:e.REPEAT,[zs]:e.CLAMP_TO_EDGE,[Gs]:e.MIRRORED_REPEAT},R={[Hs]:e.NEAREST,[Vs]:e.NEAREST_MIPMAP_NEAREST,[Ws]:e.NEAREST_MIPMAP_LINEAR,[Js]:e.LINEAR,[Ks]:e.LINEAR_MIPMAP_NEAREST,[Ys]:e.LINEAR_MIPMAP_LINEAR},P={[Yl]:e.NEVER,[iu]:e.ALWAYS,[Ql]:e.LESS,[$l]:e.LEQUAL,[Zl]:e.EQUAL,[nu]:e.GEQUAL,[eu]:e.GREATER,[tu]:e.NOTEQUAL};function B(n,a){if(a.type!==ro||!1!==t.has("OES_texture_float_linear")||a.magFilter!==Js&&a.magFilter!==Ks&&a.magFilter!==Ws&&a.magFilter!==Ys&&a.minFilter!==Js&&a.minFilter!==Ks&&a.minFilter!==Ws&&a.minFilter!==Ys||Iu("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(n,e.TEXTURE_WRAP_S,C[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,C[a.wrapT]),n!==e.TEXTURE_3D&&n!==e.TEXTURE_2D_ARRAY||e.texParameteri(n,e.TEXTURE_WRAP_R,C[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,R[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,R[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,P[a.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(a.magFilter===Hs)return;if(a.minFilter!==Ws&&a.minFilter!==Ys)return;if(a.type===ro&&!1===t.has("OES_texture_float_linear"))return;if(a.anisotropy>1||i.get(a).__currentAnisotropy){const s=t.get("EXT_texture_filter_anisotropic");e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy}}}function I(t,n){let i=!1;void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",A));const r=n.source;let a=p.get(r);void 0===a&&(a={},p.set(r,a));const o=function(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(n);if(o!==t.__cacheKey){void 0===a[o]&&(a[o]={texture:e.createTexture(),usedTimes:0},s.memory.textures++,i=!0),a[o].usedTimes++;const r=a[t.__cacheKey];void 0!==r&&(a[t.__cacheKey].usedTimes--,0===r.usedTimes&&w(n)),t.__cacheKey=o,t.__webglTexture=a[o].texture}return i}function D(e,t,n){return Math.floor(Math.floor(e/n)/t)}function F(t,s,o){let l=e.TEXTURE_2D;(s.isDataArrayTexture||s.isCompressedArrayTexture)&&(l=e.TEXTURE_2D_ARRAY),s.isData3DTexture&&(l=e.TEXTURE_3D);const u=I(t,s),c=s.source;n.bindTexture(l,t.__webglTexture,e.TEXTURE0+o);const d=i.get(c);if(c.version!==d.__version||!0===u){n.activeTexture(e.TEXTURE0+o);if(!1===("undefined"!==typeof ImageBitmap&&s.image instanceof ImageBitmap)){const t=rc.getPrimaries(rc.workingColorSpace),i=s.colorSpace===El?null:rc.getPrimaries(s.colorSpace),r=s.colorSpace===El||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,r)}n.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment);let t=g(s.image,!1,r.maxTextureSize);t=V(s,t);const i=a.convert(s.format,s.colorSpace),p=a.convert(s.type);let f,m=b(s.internalFormat,i,p,s.normalized,s.colorSpace,s.isVideoTexture);B(l,s);const _=s.mipmaps,A=!0!==s.isVideoTexture,M=void 0===d.__version||!0===u,w=c.dataReady,E=S(s,t);if(s.isDepthTexture)m=x(s.format===go,s.type),M&&(A?n.texStorage2D(e.TEXTURE_2D,1,m,t.width,t.height):n.texImage2D(e.TEXTURE_2D,0,m,t.width,t.height,0,i,p,null));else if(s.isDataTexture)if(_.length>0){A&&M&&n.texStorage2D(e.TEXTURE_2D,E,m,_[0].width,_[0].height);for(let t=0,r=_.length;te.start-t.start);let o=0;for(let e=1;e0){const t=F_(f.width,f.height,s.format,s.type);for(const a of s.layerUpdates){const s=f.data.subarray(a*t/f.data.BYTES_PER_ELEMENT,(a+1)*t/f.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,a,f.width,f.height,1,i,s)}s.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,f.width,f.height,t.depth,i,f.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,r,m,f.width,f.height,t.depth,0,f.data,0,0);else Iu("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else A?w&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,r,0,0,0,f.width,f.height,t.depth,i,p,f.data):n.texImage3D(e.TEXTURE_2D_ARRAY,r,m,f.width,f.height,t.depth,0,i,p,f.data)}else{A&&M&&n.texStorage2D(e.TEXTURE_2D,E,m,_[0].width,_[0].height);for(let t=0,r=_.length;t0){const r=F_(t.width,t.height,s.format,s.type);for(const a of s.layerUpdates){const s=t.data.subarray(a*r/t.data.BYTES_PER_ELEMENT,(a+1)*r/t.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,a,t.width,t.height,1,i,p,s)}s.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,t.width,t.height,t.depth,i,p,t.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,m,t.width,t.height,t.depth,0,i,p,t.data);else if(s.isData3DTexture)A?(M&&n.texStorage3D(e.TEXTURE_3D,E,m,t.width,t.height,t.depth),w&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,t.width,t.height,t.depth,i,p,t.data)):n.texImage3D(e.TEXTURE_3D,0,m,t.width,t.height,t.depth,0,i,p,t.data);else if(s.isFramebufferTexture){if(M)if(A)n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height);else{let r=t.width,a=t.height;for(let t=0;t>=1,a>>=1}}else if(s.isHTMLTexture){if("texElementImage2D"in e){const n=e.canvas;if(n.hasAttribute("layoutsubtree")||n.setAttribute("layoutsubtree","true"),t.parentNode!==n)return n.appendChild(t),h.add(s),n.onpaint=e=>{const t=e.changedElements;for(const n of h)t.includes(n.image)&&(n.needsUpdate=!0)},void n.requestPaint();const i=0,r=e.RGBA,a=e.RGBA,o=e.UNSIGNED_BYTE;e.texElementImage2D(e.TEXTURE_2D,i,r,a,o,t),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}else if(_.length>0){if(A&&M){const t=j(_[0]);n.texStorage2D(e.TEXTURE_2D,E,m,t.width,t.height)}for(let t=0,r=_.length;t>c),i=Math.max(1,r.height>>c);u===e.TEXTURE_3D||u===e.TEXTURE_2D_ARRAY?n.texImage3D(u,c,p,t,i,r.depth,0,h,d,null):n.texImage2D(u,c,p,t,i,0,h,d,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),H(r)?o.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,l,u,m.__webglTexture,0,G(r)):(u===e.TEXTURE_2D||u>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&u<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,l,u,m.__webglTexture,c),n.bindFramebuffer(e.FRAMEBUFFER,null)}function N(t,n,i){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){const r=n.depthTexture,a=r&&r.isDepthTexture?r.type:null,s=x(n.stencilBuffer,a),l=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;H(n)?o.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,G(n),s,n.width,n.height):i?e.renderbufferStorageMultisample(e.RENDERBUFFER,G(n),s,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,s,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,t)}else{const t=n.textures;for(let r=0;r{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,e.removeEventListener("dispose",t)};e.addEventListener("dispose",t),r.__depthDisposeCallback=t}r.__boundDepthTexture=e}if(t.depthTexture&&!r.__autoAllocateDepthBuffer)if(a)for(let e=0;e<6;e++)O(r.__webglFramebuffer[e],t,e);else{const e=t.texture.mipmaps;e&&e.length>0?O(r.__webglFramebuffer[0],t,0):O(r.__webglFramebuffer,t,0)}else if(a){r.__webglDepthbuffer=[];for(let i=0;i<6;i++)if(n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[i]),void 0===r.__webglDepthbuffer[i])r.__webglDepthbuffer[i]=e.createRenderbuffer(),N(r.__webglDepthbuffer[i],t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=r.__webglDepthbuffer[i];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{const i=t.texture.mipmaps;if(i&&i.length>0?n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=e.createRenderbuffer(),N(r.__webglDepthbuffer,t,!1);else{const n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,i=r.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,i)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}const U=[],z=[];function G(e){return Math.min(r.maxSamples,e.samples)}function H(e){const n=i.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==n.__useRenderToTexture}function V(e,t){const n=e.colorSpace,i=e.format,r=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||n!==Cl&&n!==El&&(rc.getTransfer(n)===Pl?i===fo&&r===Zs||Iu("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Du("WebGLTextures: Unsupported texture color space:",n)),t}function j(e){return"undefined"!==typeof HTMLImageElement&&e instanceof HTMLImageElement?(u.width=e.naturalWidth||e.width,u.height=e.naturalHeight||e.height):"undefined"!==typeof VideoFrame&&e instanceof VideoFrame?(u.width=e.displayWidth,u.height=e.displayHeight):(u.width=e.width,u.height=e.height),u}this.allocateTextureUnit=function(){const e=E;return e>=r.maxTextures&&Iu("WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+r.maxTextures),E+=1,e},this.resetTextureUnits=function(){E=0},this.getTextureUnits=function(){return E},this.setTextureUnits=function(e){E=e},this.setTexture2D=T,this.setTexture2DArray=function(t,r){const a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?F(a,t,r):(t.isExternalTexture&&(a.__webglTexture=t.sourceTexture?t.sourceTexture:null),n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+r))},this.setTexture3D=function(t,r){const a=i.get(t);!1===t.isRenderTargetTexture&&t.version>0&&a.__version!==t.version?F(a,t,r):n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+r)},this.setTextureCube=function(t,s){const o=i.get(t);!0!==t.isCubeDepthTexture&&t.version>0&&o.__version!==t.version?function(t,s,o){if(6!==s.image.length)return;const l=I(t,s),u=s.source;n.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+o);const c=i.get(u);if(u.version!==c.__version||!0===l){n.activeTexture(e.TEXTURE0+o);const t=rc.getPrimaries(rc.workingColorSpace),i=s.colorSpace===El?null:rc.getPrimaries(s.colorSpace),h=s.colorSpace===El||t===i?e.NONE:e.BROWSER_DEFAULT_WEBGL;n.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,s.flipY),n.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s.premultiplyAlpha),n.pixelStorei(e.UNPACK_ALIGNMENT,s.unpackAlignment),n.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,h);const d=s.isCompressedTexture||s.image[0].isCompressedTexture,p=s.image[0]&&s.image[0].isDataTexture,f=[];for(let e=0;e<6;e++)f[e]=d||p?p?s.image[e].image:s.image[e]:g(s.image[e],!0,r.maxCubemapSize),f[e]=V(s,f[e]);const m=f[0],_=a.convert(s.format,s.colorSpace),x=a.convert(s.type),A=b(s.internalFormat,_,x,s.normalized,s.colorSpace),M=!0!==s.isVideoTexture,w=void 0===c.__version||!0===l,E=u.dataReady;let T,C=S(s,m);if(B(e.TEXTURE_CUBE_MAP,s),d){M&&w&&n.texStorage2D(e.TEXTURE_CUBE_MAP,C,A,m.width,m.height);for(let t=0;t<6;t++){T=f[t].mipmaps;for(let i=0;i0&&C++;const t=j(f[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,C,A,t.width,t.height)}for(let t=0;t<6;t++)if(p){M?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,f[t].width,f[t].height,_,x,f[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,A,f[t].width,f[t].height,0,_,x,f[t].data);for(let i=0;i1;if(h||(void 0===l.__webglTexture&&(l.__webglTexture=e.createTexture()),l.__version=r.version,s.memory.textures++),c){o.__webglFramebuffer=[];for(let t=0;t<6;t++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[t]=[];for(let n=0;n0){o.__webglFramebuffer=[];for(let t=0;t0&&!1===H(t)){o.__webglMultisampledFramebuffer=e.createFramebuffer(),o.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let n=0;n0)for(let i=0;i0)for(let n=0;n0)if(!1===H(t)){const r=t.textures,a=t.width,s=t.height;let o=e.COLOR_BUFFER_BIT;const u=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,c=i.get(t),h=r.length>1;if(h)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,c.__webglFramebuffer);for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:El;const a=rc.getTransfer(r);if(n===Zs)return e.UNSIGNED_BYTE;if(n===so)return e.UNSIGNED_SHORT_4_4_4_4;if(n===oo)return e.UNSIGNED_SHORT_5_5_5_1;if(n===uo)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===co)return e.UNSIGNED_INT_10F_11F_11F_REV;if(n===$s)return e.BYTE;if(n===eo)return e.SHORT;if(n===to)return e.UNSIGNED_SHORT;if(n===no)return e.INT;if(n===io)return e.UNSIGNED_INT;if(n===ro)return e.FLOAT;if(n===ao)return e.HALF_FLOAT;if(n===ho)return e.ALPHA;if(n===po)return e.RGB;if(n===fo)return e.RGBA;if(n===mo)return e.DEPTH_COMPONENT;if(n===go)return e.DEPTH_STENCIL;if(n===vo)return e.RED;if(n===yo)return e.RED_INTEGER;if(n===_o)return e.RG;if(n===bo)return e.RG_INTEGER;if(n===So)return e.RGBA_INTEGER;if(n===Ao||n===Mo||n===wo||n===Eo)if(a===Pl){if(i=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===i)return null;if(n===Ao)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Mo)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===wo)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Eo)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(i=t.get("WEBGL_compressed_texture_s3tc"),null===i)return null;if(n===Ao)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Mo)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===wo)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Eo)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(n===To||n===Co||n===Ro||n===Po){if(i=t.get("WEBGL_compressed_texture_pvrtc"),null===i)return null;if(n===To)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Co)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===Ro)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Po)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(n===Bo||n===Io||n===Do||n===Fo||n===Lo||n===No||n===Oo){if(i=t.get("WEBGL_compressed_texture_etc"),null===i)return null;if(n===Bo||n===Io)return a===Pl?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===Do)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC;if(n===Fo)return i.COMPRESSED_R11_EAC;if(n===Lo)return i.COMPRESSED_SIGNED_R11_EAC;if(n===No)return i.COMPRESSED_RG11_EAC;if(n===Oo)return i.COMPRESSED_SIGNED_RG11_EAC}if(n===ko||n===Uo||n===zo||n===Go||n===Ho||n===Vo||n===jo||n===Wo||n===Xo||n===Jo||n===Ko||n===qo||n===Yo||n===Qo){if(i=t.get("WEBGL_compressed_texture_astc"),null===i)return null;if(n===ko)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Uo)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===zo)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Go)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===Ho)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Vo)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===jo)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===Wo)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Xo)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Jo)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Ko)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===qo)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Yo)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Qo)return a===Pl?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}if(n===Zo||n===$o||n===el){if(i=t.get("EXT_texture_compression_bptc"),null===i)return null;if(n===Zo)return a===Pl?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===$o)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===el)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(n===tl||n===nl||n===il||n===rl){if(i=t.get("EXT_texture_compression_rgtc"),null===i)return null;if(n===tl)return i.COMPRESSED_RED_RGTC1_EXT;if(n===nl)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===il)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===rl)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return n===lo?e.UNSIGNED_INT_24_8:void 0!==e[n]?e[n]:null}}}class LP{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(null===this.texture){const n=new kf(e.texture);e.depthNear===t.depthNear&&e.depthFar===t.depthFar||(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,n=new _g({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new ip(new ng(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class NP extends Nu{constructor(e,t){super();const n=this;let i=null,r=1,a=null,s="local-floor",o=1,l=null,u=null,c=null,h=null,d=null,p=null;const f="undefined"!==typeof XRWebGLBinding,m=new LP,g={},v=t.getContextAttributes();let y=null,_=null;const b=[],x=[],S=new Ku;let A=null;const M=new wv;M.viewport=new mc;const w=new wv;w.viewport=new mc;const E=[M,w],T=new iy;let C=null,R=null;function P(e){const t=x.indexOf(e.inputSource);if(-1===t)return;const n=b[t];void 0!==n&&(n.update(e.inputSource,e.frame,l||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function B(){i.removeEventListener("select",P),i.removeEventListener("selectstart",P),i.removeEventListener("selectend",P),i.removeEventListener("squeeze",P),i.removeEventListener("squeezestart",P),i.removeEventListener("squeezeend",P),i.removeEventListener("end",B),i.removeEventListener("inputsourceschange",I);for(let e=0;e=0&&(x[i]=null,b[i].disconnect(n))}for(let t=0;t=x.length){x.push(n),i=e;break}if(null===x[e]){x[e]=n,i=e;break}}if(-1===i)break}const r=b[i];r&&r.connect(n)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=b[e];return void 0===t&&(t=new Zc,b[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=b[e];return void 0===t&&(t=new Zc,b[e]=t),t.getGripSpace()},this.getHand=function(e){let t=b[e];return void 0===t&&(t=new Zc,b[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){r=e,!0===n.isPresenting&&Iu("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){s=e,!0===n.isPresenting&&Iu("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(e){l=e},this.getBaseLayer=function(){return null!==h?h:d},this.getBinding=function(){return null===c&&f&&(c=new XRWebGLBinding(i,t)),c},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(u){if(i=u,null!==i){y=e.getRenderTarget(),i.addEventListener("select",P),i.addEventListener("selectstart",P),i.addEventListener("selectend",P),i.addEventListener("squeeze",P),i.addEventListener("squeezestart",P),i.addEventListener("squeezeend",P),i.addEventListener("end",B),i.addEventListener("inputsourceschange",I),!0!==v.xrCompatible&&await t.makeXRCompatible(),A=e.getPixelRatio(),e.getSize(S);if(f&&"createProjectionLayer"in XRWebGLBinding.prototype){let n=null,a=null,s=null;v.depth&&(s=v.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,n=v.stencil?go:mo,a=v.stencil?lo:io);const o={colorFormat:t.RGBA8,depthFormat:s,scaleFactor:r};c=this.getBinding(),h=c.createProjectionLayer(o),i.updateRenderState({layers:[h]}),e.setPixelRatio(1),e.setSize(h.textureWidth,h.textureHeight,!1),_=new vc(h.textureWidth,h.textureHeight,{format:fo,type:Zs,depthTexture:new Nf(h.textureWidth,h.textureHeight,a,void 0,void 0,void 0,void 0,void 0,void 0,n),stencilBuffer:v.stencil,colorSpace:e.outputColorSpace,samples:v.antialias?4:0,resolveDepthBuffer:!1===h.ignoreDepthValues,resolveStencilBuffer:!1===h.ignoreDepthValues})}else{const n={antialias:v.antialias,alpha:!0,depth:v.depth,stencil:v.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(i,t,n),i.updateRenderState({baseLayer:d}),e.setPixelRatio(1),e.setSize(d.framebufferWidth,d.framebufferHeight,!1),_=new vc(d.framebufferWidth,d.framebufferHeight,{format:fo,type:Zs,colorSpace:e.outputColorSpace,stencilBuffer:v.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}_.isXRRenderTarget=!0,this.setFoveation(o),l=null,a=await i.requestReferenceSpace(s),O.setContext(i),O.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==i)return i.environmentBlendMode},this.getDepthTexture=function(){return m.getDepthTexture()};const D=new Yu,F=new Yu;function L(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===i)return;let t=e.near,n=e.far;null!==m.texture&&(m.depthNear>0&&(t=m.depthNear),m.depthFar>0&&(n=m.depthFar)),T.near=w.near=M.near=t,T.far=w.far=M.far=n,C===T.near&&R===T.far||(i.updateRenderState({depthNear:T.near,depthFar:T.far}),C=T.near,R=T.far),T.layers.mask=6|e.layers.mask,M.layers.mask=-5&T.layers.mask,w.layers.mask=-3&T.layers.mask;const r=e.parent,a=T.cameras;L(T,r);for(let i=0;i0&&(e.alphaTest.value=i.alphaTest);const r=t.get(i),a=r.envMap,s=r.envMapRotation;a&&(e.envMap.value=a,e.envMapRotation.value.setFromMatrix4(OP.makeRotationFromEuler(s)).transpose(),a.isCubeTexture&&!1===a.isRenderTargetTexture&&e.envMapRotation.value.premultiply(kP),e.reflectivity.value=i.reflectivity,e.ior.value=i.ior,e.refractionRatio.value=i.refractionRatio),i.lightMap&&(e.lightMap.value=i.lightMap,e.lightMapIntensity.value=i.lightMapIntensity,n(i.lightMap,e.lightMapTransform)),i.aoMap&&(e.aoMap.value=i.aoMap,e.aoMapIntensity.value=i.aoMapIntensity,n(i.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function(t,n){n.color.getRGB(t.fogColor.value,vg(e)),n.isFog?(t.fogNear.value=n.near,t.fogFar.value=n.far):n.isFogExp2&&(t.fogDensity.value=n.density)},refreshMaterialUniforms:function(e,r,a,s,o){r.isNodeMaterial?r.uniformsNeedUpdate=!1:r.isMeshBasicMaterial?i(e,r):r.isMeshLambertMaterial?(i(e,r),r.envMap&&(e.envMapIntensity.value=r.envMapIntensity)):r.isMeshToonMaterial?(i(e,r),function(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(i(e,r),function(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r),r.envMap&&(e.envMapIntensity.value=r.envMapIntensity)):r.isMeshStandardMaterial?(i(e,r),function(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform));e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform));t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function(e,t,i){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===Oa&&e.clearcoatNormalScale.value.negate()));t.dispersion>0&&(e.dispersion.value=t.dispersion);t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=i.texture,e.transmissionSamplerSize.value.set(i.width,i.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,o)):r.isMeshMatcapMaterial?(i(e,r),function(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?i(e,r):r.isMeshDistanceMaterial?(i(e,r),function(e,n){const i=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(i.matrixWorld),e.nearDistance.value=i.shadow.camera.near,e.farDistance.value=i.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?i(e,r):r.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function(e,t,i,r){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*i,e.scale.value=.5*r,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,a,s):r.isSpriteMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function zP(e,t,n,i){let r={},a={},s=[];const o=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function l(e,t,n,i){const r=e.value,a=t+"_"+n;if(void 0===i[a])return"number"===typeof r||"boolean"===typeof r?i[a]=r:ArrayBuffer.isView(r)?i[a]=r.slice():i[a]=r.clone(),!0;{const e=i[a];if("number"===typeof r||"boolean"===typeof r){if(e!==r)return i[a]=r,!0}else{if(ArrayBuffer.isView(r))return!0;if(!1===e.equals(r))return e.copy(r),!0}}return!1}function u(e){const t={boundary:0,storage:0};return"number"===typeof e||"boolean"===typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?Iu("WebGLRenderer: Texture samplers can not be part of an uniforms group."):ArrayBuffer.isView(e)?(t.boundary=16,t.storage=e.byteLength):Iu("WebGLRenderer: Unsupported uniform value type.",e),t}function c(t){const n=t.target;n.removeEventListener("dispose",c);const i=s.indexOf(n.__bindingPointIndex);s.splice(i,1),e.deleteBuffer(r[n.id]),delete r[n.id],delete a[n.id]}return{bind:function(e,t){const n=t.program;i.uniformBlockBinding(e,n)},update:function(n,h){let d=r[n.id];void 0===d&&(!function(e){const t=e.uniforms;let n=0;const i=16;for(let a=0,s=t.length;a0&&(n+=i-r);e.__size=n,e.__cache={}}(n),d=function(t){const n=function(){for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:{};const t=e.canvas,n=void 0===t?wu():t,i=e.context,r=void 0===i?null:i,a=e.depth,s=void 0===a||a,o=e.stencil,l=void 0!==o&&o,u=e.alpha,c=void 0!==u&&u,h=e.antialias,d=void 0!==h&&h,p=e.premultipliedAlpha,f=void 0===p||p,m=e.preserveDrawingBuffer,g=void 0!==m&&m,v=e.powerPreference,y=void 0===v?"default":v,_=e.failIfMajorPerformanceCaveat,b=void 0!==_&&_,x=e.reversedDepthBuffer,S=void 0!==x&&x,A=e.outputBufferType,M=void 0===A?Zs:A;let w;if(this.isWebGLRenderer=!0,null!==r){if("undefined"!==typeof WebGLRenderingContext&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");w=r.getContextAttributes().alpha}else w=c;const E=M,T=new Set([So,bo,yo]),C=new Set([Zs,io,to,lo,so,oo]),R=new Uint32Array(4),P=new Int32Array(4),B=new Yu;let I=null,D=null;const F=[],L=[];let N=null;this.domElement=n,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=As,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const O=this;let k=!1,U=null;this._outputColorSpace=Tl;let z=0,G=0,H=null,V=-1,j=null;const W=new mc,X=new mc;let J=null;const K=new ih(0);let q=0,Y=n.width,Q=n.height,Z=1,$=null,ee=null;const te=new mc(0,0,Y,Q),ne=new mc(0,0,Y,Q);let ie=!1;const re=new Np;let ae=!1,se=!1;const oe=new Sc,le=new Yu,ue=new mc,ce={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let he=!1;function de(){return null===H?Z:1}let pe,fe,me,ge,ve,ye,_e,be,xe,Se,Ae,Me,we,Ee,Te,Ce,Re,Pe,Be,Ie,De,Fe,Le,Ne=r;function Oe(e,t){return n.getContext(e,t)}try{const e={alpha:!0,depth:s,stencil:l,antialias:d,premultipliedAlpha:f,preserveDrawingBuffer:g,powerPreference:y,failIfMajorPerformanceCaveat:b};if("setAttribute"in n&&n.setAttribute("data-engine","three.js r".concat(wa)),n.addEventListener("webglcontextlost",ze,!1),n.addEventListener("webglcontextrestored",Ge,!1),n.addEventListener("webglcontextcreationerror",He,!1),null===Ne){const t="webgl2";if(Ne=Oe(t,e),null===Ne)throw Oe(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(st){throw Du("WebGLRenderer: "+st.message),st}function ke(){pe=new TC(Ne),pe.init(),De=new FP(Ne,pe),fe=new uC(Ne,pe,e,De),me=new IP(Ne,pe),fe.reversedDepthBuffer&&S&&me.buffers.depth.setReversed(!0),ge=new PC(Ne),ve=new mP,ye=new DP(Ne,pe,me,ve,fe,De,ge),_e=new EC(O),be=new $T(Ne),Fe=new oC(Ne,be),xe=new CC(Ne,be,ge,Fe),Se=new IC(Ne,xe,be,Fe,ge),Pe=new BC(Ne,fe,ye),Te=new cC(ve),Ae=new fP(O,_e,pe,fe,Fe,Te),Me=new UP(O,ve),we=new _P,Ee=new wP(pe),Re=new sC(O,_e,me,Se,w,f),Ce=new BP(O,Se,fe),Le=new zP(Ne,ge,fe,me),Be=new lC(Ne,pe,ge),Ie=new RC(Ne,pe,ge),ge.programs=Ae.programs,O.capabilities=fe,O.extensions=pe,O.properties=ve,O.renderLists=we,O.shadowMap=Ce,O.state=me,O.info=ge}ke(),E!==Zs&&(N=new FC(E,n.width,n.height,s,l));const Ue=new NP(O,Ne);function ze(e){e.preventDefault(),Pu("WebGLRenderer: Context Lost."),k=!0}function Ge(){Pu("WebGLRenderer: Context Restored."),k=!1;const e=ge.autoReset,t=Ce.enabled,n=Ce.autoUpdate,i=Ce.needsUpdate,r=Ce.type;ke(),ge.autoReset=e,Ce.enabled=t,Ce.autoUpdate=n,Ce.needsUpdate=i,Ce.type=r}function He(e){Du("WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function Ve(e){const t=e.target;t.removeEventListener("dispose",Ve),function(e){(function(e){const t=ve.get(e).programs;void 0!==t&&(t.forEach(function(e){Ae.releaseProgram(e)}),e.isShaderMaterial&&Ae.releaseShaderCache(e))})(e),ve.remove(e)}(t)}function je(e,t,n){!0===e.transparent&&e.side===ka&&!1===e.forceSinglePass?(e.side=Oa,e.needsUpdate=!0,et(e,t,n),e.side=Na,e.needsUpdate=!0,et(e,t,n),e.side=ka):et(e,t,n)}this.xr=Ue,this.getContext=function(){return Ne},this.getContextAttributes=function(){return Ne.getContextAttributes()},this.forceContextLoss=function(){const e=pe.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=pe.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Z},this.setPixelRatio=function(e){void 0!==e&&(Z=e,this.setSize(Y,Q,!1))},this.getSize=function(e){return e.set(Y,Q)},this.setSize=function(e,t){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];Ue.isPresenting?Iu("WebGLRenderer: Can't change size while VR device is presenting."):(Y=e,Q=t,n.width=Math.floor(e*Z),n.height=Math.floor(t*Z),!0===i&&(n.style.width=e+"px",n.style.height=t+"px"),null!==N&&N.setSize(n.width,n.height),this.setViewport(0,0,e,t))},this.getDrawingBufferSize=function(e){return e.set(Y*Z,Q*Z).floor()},this.setDrawingBufferSize=function(e,t,i){Y=e,Q=t,Z=i,n.width=Math.floor(e*i),n.height=Math.floor(t*i),this.setViewport(0,0,e,t)},this.setEffects=function(e){if(E!==Zs){if(e)for(let t=0;t1&&void 0!==arguments[1])||arguments[1],t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=0;if(!(arguments.length>0&&void 0!==arguments[0])||arguments[0]){let e=!1;if(null!==H){const t=H.texture.format;e=T.has(t)}if(e){const e=H.texture.type,t=C.has(e),n=Re.getClearColor(),i=Re.getClearAlpha(),r=n.r,a=n.g,s=n.b;t?(R[0]=r,R[1]=a,R[2]=s,R[3]=i,Ne.clearBufferuiv(Ne.COLOR,0,R)):(P[0]=r,P[1]=a,P[2]=s,P[3]=i,Ne.clearBufferiv(Ne.COLOR,0,P))}else n|=Ne.COLOR_BUFFER_BIT}e&&(n|=Ne.DEPTH_BUFFER_BIT,this.state.buffers.depth.setMask(!0)),t&&(n|=Ne.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),0!==n&&Ne.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.setNodesHandler=function(e){e.setRenderer(this),U=e},this.dispose=function(){n.removeEventListener("webglcontextlost",ze,!1),n.removeEventListener("webglcontextrestored",Ge,!1),n.removeEventListener("webglcontextcreationerror",He,!1),Re.dispose(),we.dispose(),Ee.dispose(),ve.dispose(),_e.dispose(),Se.dispose(),Fe.dispose(),Le.dispose(),Ae.dispose(),Ue.dispose(),Ue.removeEventListener("sessionstart",Xe),Ue.removeEventListener("sessionend",Je),Ke.stop()},this.renderBufferDirect=function(e,t,n,i,r,a){null===t&&(t=ce);const s=r.isMesh&&r.matrixWorld.determinant()<0,o=function(e,t,n,i,r){!0!==t.isScene&&(t=ce);ye.resetTextureUnits();const a=t.fog,s=i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial?t.environment:null,o=null===H?O.outputColorSpace:!0===H.isXRRenderTarget?H.texture.colorSpace:rc.workingColorSpace,l=i.isMeshStandardMaterial||i.isMeshLambertMaterial&&!i.envMap||i.isMeshPhongMaterial&&!i.envMap,u=_e.get(i.envMap||s,l),c=!0===i.vertexColors&&!!n.attributes.color&&4===n.attributes.color.itemSize,h=!!n.attributes.tangent&&(!!i.normalMap||i.anisotropy>0),d=!!n.morphAttributes.position,p=!!n.morphAttributes.normal,f=!!n.morphAttributes.color;let m=As;i.toneMapped&&(null!==H&&!0!==H.isXRRenderTarget||(m=O.toneMapping));const g=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,v=void 0!==g?g.length:0,y=ve.get(i),_=D.state.lights;if(!0===ae&&(!0===se||e!==j)){const t=e===j&&i.id===V;Te.setState(i,e,t)}let b=!1;i.version===y.__version?y.needsLights&&y.lightsStateVersion!==_.state.version||y.outputColorSpace!==o||r.isBatchedMesh&&!1===y.batching?b=!0:r.isBatchedMesh||!0!==y.batching?r.isBatchedMesh&&!0===y.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===y.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===y.instancing?b=!0:r.isInstancedMesh||!0!==y.instancing?r.isSkinnedMesh&&!1===y.skinning?b=!0:r.isSkinnedMesh||!0!==y.skinning?r.isInstancedMesh&&!0===y.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===y.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===y.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===y.instancingMorph&&null!==r.morphTexture||y.envMap!==u||!0===i.fog&&y.fog!==a?b=!0:void 0===y.numClippingPlanes||y.numClippingPlanes===Te.numPlanes&&y.numIntersection===Te.numIntersection?(y.vertexAlphas!==c||y.vertexTangents!==h||y.morphTargets!==d||y.morphNormals!==p||y.morphColors!==f||y.toneMapping!==m||y.morphTargetsCount!==v||!!y.lightProbeGrid!==D.state.lightProbeGridArray.length>0)&&(b=!0):b=!0:b=!0:b=!0:b=!0:(b=!0,y.__version=i.version);let x=y.currentProgram;!0===b&&(x=et(i,t,r),U&&i.isNodeMaterial&&U.onUpdateProgram(i,x,y));let S=!1,A=!1,M=!1;const w=x.getUniforms(),E=y.uniforms;me.useProgram(x.program)&&(S=!0,A=!0,M=!0);i.id!==V&&(V=i.id,A=!0);if(y.needsLights){const e=function(e,t){if(0===e.length)return null;if(1===e.length)return null!==e[0].texture?e[0]:null;B.setFromMatrixPosition(t.matrixWorld);for(let n=0,i=e.length;n0&&w.setValue(Ne,"directionalShadowMap",_.state.directionalShadowMap,ye),_.state.spotShadowMap.length>0&&w.setValue(Ne,"spotShadowMap",_.state.spotShadowMap,ye),_.state.pointShadowMap.length>0&&w.setValue(Ne,"pointShadowMap",_.state.pointShadowMap,ye));if(r.isSkinnedMesh){w.setOptional(Ne,r,"bindMatrix"),w.setOptional(Ne,r,"bindMatrixInverse");const e=r.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),w.setValue(Ne,"boneTexture",e.boneTexture,ye))}r.isBatchedMesh&&(w.setOptional(Ne,r,"batchingTexture"),w.setValue(Ne,"batchingTexture",r._matricesTexture,ye),w.setOptional(Ne,r,"batchingIdTexture"),w.setValue(Ne,"batchingIdTexture",r._indirectTexture,ye),w.setOptional(Ne,r,"batchingColorTexture"),null!==r._colorsTexture&&w.setValue(Ne,"batchingColorTexture",r._colorsTexture,ye));const T=n.morphAttributes;void 0===T.position&&void 0===T.normal&&void 0===T.color||Pe.update(r,n,x);(A||y.receiveShadow!==r.receiveShadow)&&(y.receiveShadow=r.receiveShadow,w.setValue(Ne,"receiveShadow",r.receiveShadow));(i.isMeshStandardMaterial||i.isMeshLambertMaterial||i.isMeshPhongMaterial)&&null===i.envMap&&null!==t.environment&&(E.envMapIntensity.value=t.environmentIntensity);void 0!==E.dfgLUT&&(E.dfgLUT.value=(null===HP&&(HP=new gp(GP,16,16,_o,ao),HP.name="DFG_LUT",HP.minFilter=Js,HP.magFilter=Js,HP.wrapS=zs,HP.wrapT=zs,HP.generateMipmaps=!1,HP.needsUpdate=!0),HP));if(A){if(w.setValue(Ne,"toneMappingExposure",O.toneMappingExposure),y.needsLights&&(R=M,(C=E).ambientLightColor.needsUpdate=R,C.lightProbe.needsUpdate=R,C.directionalLights.needsUpdate=R,C.directionalLightShadows.needsUpdate=R,C.pointLights.needsUpdate=R,C.pointLightShadows.needsUpdate=R,C.spotLights.needsUpdate=R,C.spotLightShadows.needsUpdate=R,C.rectAreaLights.needsUpdate=R,C.hemisphereLights.needsUpdate=R),a&&!0===i.fog&&Me.refreshFogUniforms(E,a),Me.refreshMaterialUniforms(E,i,Z,Q,D.state.transmissionRenderTarget[e.id]),y.needsLights&&y.lightProbeGrid){const e=y.lightProbeGrid;E.probesSH.value=e.texture,E.probesMin.value.copy(e.boundingBox.min),E.probesMax.value.copy(e.boundingBox.max),E.probesResolution.value.copy(e.resolution)}UR.upload(Ne,tt(y),E,ye)}var C,R;i.isShaderMaterial&&!0===i.uniformsNeedUpdate&&(UR.upload(Ne,tt(y),E,ye),i.uniformsNeedUpdate=!1);i.isSpriteMaterial&&w.setValue(Ne,"center",r.center);if(w.setValue(Ne,"modelViewMatrix",r.modelViewMatrix),w.setValue(Ne,"normalMatrix",r.normalMatrix),w.setValue(Ne,"modelMatrix",r.matrixWorld),void 0!==i.uniformsGroups){const e=i.uniformsGroups;for(let t=0,n=e.length;t2&&void 0!==arguments[2]?arguments[2]:null;null===n&&(n=e),D=Ee.get(n),D.init(t),L.push(D),n.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(D.pushLight(e),e.castShadow&&D.pushShadow(e))}),e!==n&&e.traverseVisible(function(e){e.isLight&&e.layers.test(t.layers)&&(D.pushLight(e),e.castShadow&&D.pushShadow(e))}),D.setupLights();const i=new Set;return e.traverse(function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;const t=e.material;if(t)if(Array.isArray(t))for(let r=0;r2&&void 0!==arguments[2]?arguments[2]:null;const i=this.compile(e,t,n);return new Promise(t=>{function n(){i.forEach(function(e){ve.get(e).currentProgram.isReady()&&i.delete(e)}),0!==i.size?setTimeout(n,10):t(e)}null!==pe.get("KHR_parallel_shader_compile")?n():setTimeout(n,10)})};let We=null;function Xe(){Ke.stop()}function Je(){Ke.start()}const Ke=new ZT;function qe(e,t,n,i){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)n=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLightProbeGrid)D.pushLightProbeGrid(e);else if(e.isLight)D.pushLight(e),e.castShadow&&D.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||re.intersectsSprite(e)){i&&ue.setFromMatrixPosition(e.matrixWorld).applyMatrix4(oe);const t=Se.update(e),r=e.material;r.visible&&I.push(e,t,r,n,ue.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||re.intersectsObject(e))){const t=Se.update(e),r=e.material;if(i&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),ue.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),ue.copy(t.boundingSphere.center)),ue.applyMatrix4(e.matrixWorld).applyMatrix4(oe)),Array.isArray(r)){const i=t.groups;for(let a=0,s=i.length;a0&&Ze(r,t,n),a.length>0&&Ze(a,t,n),s.length>0&&Ze(s,t,n),me.buffers.depth.setTest(!0),me.buffers.depth.setMask(!0),me.buffers.color.setMask(!0),me.setPolygonOffset(!1)}function Qe(e,t,n,i){if(null!==(!0===n.isScene?n.overrideMaterial:null))return;if(void 0===D.state.transmissionRenderTarget[i.id]){const e=pe.has("EXT_color_buffer_half_float")||pe.has("EXT_color_buffer_float");D.state.transmissionRenderTarget[i.id]=new vc(1,1,{generateMipmaps:!0,type:e?ao:Zs,minFilter:Ys,samples:Math.max(4,fe.samples),stencilBuffer:l,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:rc.workingColorSpace})}const r=D.state.transmissionRenderTarget[i.id],a=i.viewport||W;r.setSize(a.z*O.transmissionResolutionScale,a.w*O.transmissionResolutionScale);const s=O.getRenderTarget(),o=O.getActiveCubeFace(),u=O.getActiveMipmapLevel();O.setRenderTarget(r),O.getClearColor(K),q=O.getClearAlpha(),q<1&&O.setClearColor(16777215,.5),O.clear(),he&&Re.render(n);const c=O.toneMapping;O.toneMapping=As;const h=i.viewport;if(void 0!==i.viewport&&(i.viewport=void 0),D.setupLightsView(i),!0===ae&&Te.setGlobalState(O.clippingPlanes,i),Ze(e,n,i),ye.updateMultisampleRenderTarget(r),ye.updateRenderTargetMipmap(r),!1===pe.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let r=0,a=t.length;r0,i.currentProgram=h,i.uniformsList=null,h}function tt(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=UR.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function nt(e,t){const n=ve.get(e);n.outputColorSpace=t.outputColorSpace,n.batching=t.batching,n.batchingColor=t.batchingColor,n.instancing=t.instancing,n.instancingColor=t.instancingColor,n.instancingMorph=t.instancingMorph,n.skinning=t.skinning,n.morphTargets=t.morphTargets,n.morphNormals=t.morphNormals,n.morphColors=t.morphColors,n.morphTargetsCount=t.morphTargetsCount,n.numClippingPlanes=t.numClippingPlanes,n.numIntersection=t.numClipIntersection,n.vertexAlphas=t.vertexAlphas,n.vertexTangents=t.vertexTangents,n.toneMapping=t.toneMapping}Ke.setAnimationLoop(function(e){We&&We(e)}),"undefined"!==typeof self&&Ke.setContext(self),this.setAnimationLoop=function(e){We=e,Ue.setAnimationLoop(e),null===e?Ke.stop():Ke.start()},Ue.addEventListener("sessionstart",Xe),Ue.addEventListener("sessionend",Je),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void Du("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===k)return;null!==U&&U.renderStart(e,t);const n=!0===Ue.enabled&&!0===Ue.isPresenting,i=null!==N&&(null===H||n)&&N.begin(O,H);if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0!==Ue.enabled||!0!==Ue.isPresenting||null!==N&&!1!==N.isCompositing()||(!0===Ue.cameraAutoUpdate&&Ue.updateCamera(t),t=Ue.getCamera()),!0===e.isScene&&e.onBeforeRender(O,e,t,H),D=Ee.get(e,L.length),D.init(t),D.state.textureUnits=ye.getTextureUnits(),L.push(D),oe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),re.setFromProjectionMatrix(oe,mu,t.reversedDepth),se=this.localClippingEnabled,ae=Te.init(this.clippingPlanes,se),I=we.get(e,F.length),I.init(),F.push(I),!0===Ue.enabled&&!0===Ue.isPresenting){const e=O.xr.getDepthSensingMesh();null!==e&&qe(e,t,-1/0,O.sortObjects)}qe(e,t,0,O.sortObjects),I.finish(),!0===O.sortObjects&&I.sort($,ee),he=!1===Ue.enabled||!1===Ue.isPresenting||!1===Ue.hasDepthSensing(),he&&Re.addToRenderList(I,e),this.info.render.frame++,!0===ae&&Te.beginShadows();const r=D.state.shadowsArray;Ce.render(r,e,t),!0===ae&&Te.endShadows(),!0===this.info.autoReset&&this.info.reset();if(!1===(i&&N.hasRenderPass())){const n=I.opaque,i=I.transmissive;if(D.setupLights(),t.isArrayCamera){const r=t.cameras;if(i.length>0)for(let t=0,a=r.length;t0&&Qe(n,i,e,t),he&&Re.render(e),Ye(I,e,t)}null!==H&&0===G&&(ye.updateMultisampleRenderTarget(H),ye.updateRenderTargetMipmap(H)),i&&N.end(O),!0===e.isScene&&e.onAfterRender(O,e,t),Fe.resetDefaultState(),V=-1,j=null,L.pop(),L.length>0?(D=L[L.length-1],ye.setTextureUnits(D.state.textureUnits),!0===ae&&Te.setGlobalState(O.clippingPlanes,D.state.camera)):D=null,F.pop(),I=F.length>0?F[F.length-1]:null,null!==U&&U.renderEnd()},this.getActiveCubeFace=function(){return z},this.getActiveMipmapLevel=function(){return G},this.getRenderTarget=function(){return H},this.setRenderTargetTextures=function(e,t,n){const i=ve.get(e);i.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===i.__autoAllocateDepthBuffer&&(i.__useRenderToTexture=!1),ve.get(e.texture).__webglTexture=t,ve.get(e.depthTexture).__webglTexture=i.__autoAllocateDepthBuffer?void 0:n,i.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){const n=ve.get(e);n.__webglFramebuffer=t,n.__useDefaultFramebuffer=void 0===t};const it=Ne.createFramebuffer();this.setRenderTarget=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;H=e,z=t,G=n;let i=null,r=!1,a=!1;if(e){const s=ve.get(e);if(void 0!==s.__useDefaultFramebuffer)return me.bindFramebuffer(Ne.FRAMEBUFFER,s.__webglFramebuffer),W.copy(e.viewport),X.copy(e.scissor),J=e.scissorTest,me.viewport(W),me.scissor(X),me.setScissorTest(J),void(V=-1);if(void 0===s.__webglFramebuffer)ye.setupRenderTarget(e);else if(s.__hasExternalTextures)ye.rebindTextures(e,ve.get(e.texture).__webglTexture,ve.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(s.__boundDepthTexture!==t){if(null!==t&&ve.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");ye.setupDepthRenderbuffer(e)}}const o=e.texture;(o.isData3DTexture||o.isDataArrayTexture||o.isCompressedArrayTexture)&&(a=!0);const l=ve.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(i=Array.isArray(l[t])?l[t][n]:l[t],r=!0):i=e.samples>0&&!1===ye.useMultisampledRTT(e)?ve.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,W.copy(e.viewport),X.copy(e.scissor),J=e.scissorTest}else W.copy(te).multiplyScalar(Z).floor(),X.copy(ne).multiplyScalar(Z).floor(),J=ie;0!==n&&(i=it);if(me.bindFramebuffer(Ne.FRAMEBUFFER,i)&&me.drawBuffers(e,i),me.viewport(W),me.scissor(X),me.setScissorTest(J),r){const i=ve.get(e.texture);Ne.framebufferTexture2D(Ne.FRAMEBUFFER,Ne.COLOR_ATTACHMENT0,Ne.TEXTURE_CUBE_MAP_POSITIVE_X+t,i.__webglTexture,n)}else if(a){const i=t;for(let t=0;t7&&void 0!==arguments[7]?arguments[7]:0;if(!e||!e.isWebGLRenderTarget)return void Du("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=ve.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(l=l[s]),l){me.bindFramebuffer(Ne.FRAMEBUFFER,l);try{const s=e.textures[o],l=s.format,u=s.type;if(e.textures.length>1&&Ne.readBuffer(Ne.COLOR_ATTACHMENT0+o),!fe.textureFormatReadable(l))return void Du("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!fe.textureTypeReadable(u))return void Du("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&Ne.readPixels(t,n,i,r,De.convert(l),De.convert(u),a)}finally{const e=null!==H?ve.get(H).__webglFramebuffer:null;me.bindFramebuffer(Ne.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,i,r,a,s){let o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:0;if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=ve.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==s&&(l=l[s]),l){if(t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r){me.bindFramebuffer(Ne.FRAMEBUFFER,l);const s=e.textures[o],u=s.format,c=s.type;if(e.textures.length>1&&Ne.readBuffer(Ne.COLOR_ATTACHMENT0+o),!fe.textureFormatReadable(u))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!fe.textureTypeReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const h=Ne.createBuffer();Ne.bindBuffer(Ne.PIXEL_PACK_BUFFER,h),Ne.bufferData(Ne.PIXEL_PACK_BUFFER,a.byteLength,Ne.STREAM_READ),Ne.readPixels(t,n,i,r,De.convert(u),De.convert(c),0);const d=null!==H?ve.get(H).__webglFramebuffer:null;me.bindFramebuffer(Ne.FRAMEBUFFER,d);const p=Ne.fenceSync(Ne.SYNC_GPU_COMMANDS_COMPLETE,0);return Ne.flush(),await function(e,t,n){return new Promise(function(i,r){setTimeout(function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:r();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:i()}},n)})}(Ne,p,4),Ne.bindBuffer(Ne.PIXEL_PACK_BUFFER,h),Ne.getBufferSubData(Ne.PIXEL_PACK_BUFFER,0,a),Ne.deleteBuffer(h),Ne.deleteSync(p),a}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const i=Math.pow(2,-n),r=Math.floor(e.image.width*i),a=Math.floor(e.image.height*i),s=null!==t?t.x:0,o=null!==t?t.y:0;ye.setTexture2D(e,0),Ne.copyTexSubImage2D(Ne.TEXTURE_2D,n,0,0,s,o,r,a),me.unbindTexture()};const rt=Ne.createFramebuffer(),at=Ne.createFramebuffer();this.copyTextureToTexture=function(e,t){let n,i,r,a,s,o,l,u,c,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,f=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;const m=e.isCompressedTexture?e.mipmaps[f]:e.image;if(null!==h)n=h.max.x-h.min.x,i=h.max.y-h.min.y,r=h.isBox3?h.max.z-h.min.z:1,a=h.min.x,s=h.min.y,o=h.isBox3?h.min.z:0;else{const t=Math.pow(2,-p);n=Math.floor(m.width*t),i=Math.floor(m.height*t),r=e.isDataArrayTexture?m.depth:e.isData3DTexture?Math.floor(m.depth*t):1,a=0,s=0,o=0}null!==d?(l=d.x,u=d.y,c=d.z):(l=0,u=0,c=0);const g=De.convert(t.format),v=De.convert(t.type);let y;t.isData3DTexture?(ye.setTexture3D(t,0),y=Ne.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(ye.setTexture2DArray(t,0),y=Ne.TEXTURE_2D_ARRAY):(ye.setTexture2D(t,0),y=Ne.TEXTURE_2D),me.activeTexture(Ne.TEXTURE0),me.pixelStorei(Ne.UNPACK_FLIP_Y_WEBGL,t.flipY),me.pixelStorei(Ne.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),me.pixelStorei(Ne.UNPACK_ALIGNMENT,t.unpackAlignment);const _=me.getParameter(Ne.UNPACK_ROW_LENGTH),b=me.getParameter(Ne.UNPACK_IMAGE_HEIGHT),x=me.getParameter(Ne.UNPACK_SKIP_PIXELS),S=me.getParameter(Ne.UNPACK_SKIP_ROWS),A=me.getParameter(Ne.UNPACK_SKIP_IMAGES);me.pixelStorei(Ne.UNPACK_ROW_LENGTH,m.width),me.pixelStorei(Ne.UNPACK_IMAGE_HEIGHT,m.height),me.pixelStorei(Ne.UNPACK_SKIP_PIXELS,a),me.pixelStorei(Ne.UNPACK_SKIP_ROWS,s),me.pixelStorei(Ne.UNPACK_SKIP_IMAGES,o);const M=e.isDataArrayTexture||e.isData3DTexture,w=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const h=ve.get(e),d=ve.get(t),m=ve.get(h.__renderTarget),g=ve.get(d.__renderTarget);me.bindFramebuffer(Ne.READ_FRAMEBUFFER,m.__webglFramebuffer),me.bindFramebuffer(Ne.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let v=0;ve;const XP=(e,t)=>{const n=O_(e),i=function(e){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:WP,n=arguments.length>2?arguments[2]:void 0;const i=jP(e.subscribe,e.getState,e.getInitialState,t,n);return r.useDebugValue(i),i}(n,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:t)};return Object.assign(i,n),i},JP=[];function KP(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(e,t)=>e===t;if(e===t)return!0;if(!e||!t)return!1;const i=e.length;if(t.length!==i)return!1;for(let r=0;r1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};null===t&&(t=[e]);for(const s of JP)if(KP(t,s.keys,s.equal)){if(n)return;if(Object.prototype.hasOwnProperty.call(s,"error"))throw s.error;if(Object.prototype.hasOwnProperty.call(s,"response"))return i.lifespan&&i.lifespan>0&&(s.timeout&&clearTimeout(s.timeout),s.timeout=setTimeout(s.remove,i.lifespan)),s.response;if(!n)throw s.promise}const r={keys:t,equal:i.equal,remove:()=>{const e=JP.indexOf(r);-1!==e&&JP.splice(e,1)},promise:(a=e,"object"===typeof a&&"function"===typeof a.then?e:e(...t)).then(e=>{r.response=e,i.lifespan&&i.lifespan>0&&(r.timeout=setTimeout(r.remove,i.lifespan))}).catch(e=>r.error=e)};var a;if(JP.push(r),!n)throw r.promise}var YP=n(853);(()=>{var e,t;return"undefined"!=typeof window&&((null==(e=window.document)?void 0:e.createElement)||"ReactNative"===(null==(t=window.navigator)?void 0:t.product))})()?r.useLayoutEffect:r.useEffect;function QP(e,t,n){if(!e)return;if(!0===n(e))return e;let i=t?e.return:e.child;for(;i;){const e=QP(i,t,n);if(e)return e;i=t?null:i.sibling}}function ZP(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}const $P=ZP(r.createContext(null));class eB extends r.Component{render(){return r.createElement($P.Provider,{value:this._reactInternals},this.props.children)}}function tB(){const e=r.useContext($P);if(null===e)throw new Error("its-fine: useFiber must be called within a !");const t=r.useId();return r.useMemo(()=>{for(const n of[e,null==e?void 0:e.alternate]){if(!n)continue;const e=QP(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}const nB=Symbol.for("react.context"),iB=e=>null!==e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===nB;function rB(){const e=function(){const e=tB(),t=Ma(r.useState(()=>new Map),1)[0];t.clear();let n=e;for(;n;){const e=n.type;iB(e)&&e!==$P&&!t.has(e)&&t.set(e,r.use(ZP(e))),n=n.return}return t}();return r.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>i=>r.createElement(t,null,r.createElement(n.Provider,h(h({},i),{},{value:e.get(n)}))),e=>r.createElement(eB,h({},e))),[e])}const aB=["params"];function sB(e){let t=e.root;for(;t.getState().previousRoot;)t=t.getState().previousRoot;return t}a.act;const oB=e=>e&&e.isOrthographicCamera,lB=e=>null!=e&&("string"===typeof e||"number"===typeof e||e.isColor),uB=((e,t)=>"undefined"!==typeof window&&((null==(e=window.document)?void 0:e.createElement)||"ReactNative"===(null==(t=window.navigator)?void 0:t.product)))()?r.useLayoutEffect:r.useEffect;function cB(e){const t=r.useRef(e);return uB(()=>{t.current=e},[e]),t}function hB(e){let t=e.set;return uB(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}const dB=(e=>((e=class extends r.Component{constructor(){super(...arguments),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}}).getDerivedStateFromError=()=>({error:!0}),e))();function pB(e){var t;const n="undefined"!==typeof window?null!=(t=window.devicePixelRatio)?t:2:1;return Array.isArray(e)?Math.min(Math.max(e[0],n),e[1]):e}function fB(e){var t;return null==(t=e.__r3f)?void 0:t.root.getState()}const mB={obj:e=>e===Object(e)&&!mB.arr(e)&&"function"!==typeof e,fun:e=>"function"===typeof e,str:e=>"string"===typeof e,num:e=>"number"===typeof e,boo:e=>"boolean"===typeof e,und:e=>void 0===e,nul:e=>null===e,arr:e=>Array.isArray(e),equ(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.arrays,r=void 0===i?"shallow":i,a=n.objects,s=void 0===a?"reference":a,o=n.strict,l=void 0===o||o;if(typeof e!==typeof t||!!e!==!!t)return!1;if(mB.str(e)||mB.num(e)||mB.boo(e))return e===t;const u=mB.obj(e);if(u&&"reference"===s)return e===t;const c=mB.arr(e);if(c&&"reference"===r)return e===t;if((c||u)&&e===t)return!0;let h;for(h in e)if(!(h in t))return!1;if(u&&"shallow"===r&&"shallow"===s){for(h in l?t:e)if(!mB.equ(e[h],t[h],{strict:l,objects:"reference"}))return!1}else for(h in l?t:e)if(e[h]!==t[h])return!1;if(mB.und(h)){if(c&&0===e.length&&0===t.length)return!0;if(u&&0===Object.keys(e).length&&0===Object.keys(t).length)return!0;if(e!==t)return!1}return!0}};function gB(e){const t={nodes:{},materials:{},meshes:{}};return e&&e.traverse(e=>{e.name&&(t.nodes[e.name]=e),e.material&&!t.materials[e.material.name]&&(t.materials[e.material.name]=e.material),e.isMesh&&!t.meshes[e.name]&&(t.meshes[e.name]=e)}),t}const vB=["children","key","ref"];function yB(e){const t={};for(const n in e)vB.includes(n)||(t[n]=e[n]);return t}function _B(e,t,n,i){const r=e;let a=null==r?void 0:r.__r3f;return a||(a={root:t,type:n,parent:null,children:[],props:yB(i),object:r,eventCount:0,handlers:{},isHidden:!1},r&&(r.__r3f=a)),a}function bB(e,t){if(!t.includes("-"))return{root:e,key:t,target:e[t]};if(t in e)return{root:e,key:t,target:e[t]};let n=e;const i=t.split("-");for(const r of i){if("object"!==typeof n||null===n){if(void 0!==n){return{root:n,key:i.slice(i.indexOf(r)).join("-"),target:void 0}}return{root:e,key:t,target:void 0}}e=n,n=n[t=r]}return{root:e,key:t,target:n}}const xB=/-\d+$/;function SB(e,t){if(mB.str(t.props.attach)){if(xB.test(t.props.attach)){const n=t.props.attach.replace(xB,""),i=bB(e.object,n),r=i.root,a=i.key;Array.isArray(r[a])||(r[a]=[])}const n=bB(e.object,t.props.attach),i=n.root,r=n.key;t.previousAttach=i[r],i[r]=t.object}else mB.fun(t.props.attach)&&(t.previousAttach=t.props.attach(e.object,t.object))}function AB(e,t){if(mB.str(t.props.attach)){const n=bB(e.object,t.props.attach),i=n.root,r=n.key,a=t.previousAttach;void 0===a?delete i[r]:i[r]=a}else null==t.previousAttach||t.previousAttach(e.object,t.object);delete t.previousAttach}const MB=[...vB,"args","dispose","attach","object","onUpdate","dispose"],wB=new Map;function EB(e){let t=wB.get(e.constructor);try{t||(t=new e.constructor,wB.set(e.constructor,t))}catch(n){}return t}const TB=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],CB=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function RB(e,t){var n;const i=e.__r3f,r=i&&sB(i).getState(),a=null==i?void 0:i.eventCount;for(const o in t){let n=t[o];if(MB.includes(o))continue;if(i&&CB.test(o)){"function"===typeof n?i.handlers[o]=n:delete i.handlers[o],i.eventCount=Object.keys(i.handlers).length;continue}if(void 0===n)continue;let a=bB(e,o),l=a.root,u=a.key,c=a.target;if(void 0===c&&("object"!==typeof l||null===l))throw Error('R3F: Cannot set "'.concat(o,'". Ensure it is an object before setting "').concat(u,'".'));if(c instanceof Dc&&n instanceof Dc)c.mask=n.mask;else if(c instanceof ih&&lB(n))c.set(n);else if(null!==c&&"object"===typeof c&&"function"===typeof c.set&&"function"===typeof c.copy&&null!=n&&n.constructor&&c.constructor===n.constructor)c.copy(n);else if(null!==c&&"object"===typeof c&&"function"===typeof c.set&&Array.isArray(n))"function"===typeof c.fromArray?c.fromArray(n):c.set(...n);else if(null!==c&&"object"===typeof c&&"function"===typeof c.set&&"number"===typeof n)"function"===typeof c.setScalar?c.setScalar(n):c.set(n);else if(l instanceof _g&&"uniforms"===u&&mB.obj(n)){mB.obj(l.uniforms)||(l.uniforms={});const e=l.uniforms,t=n;for(const n in t){const i=t[n],r=e[n];r?Object.assign(r,i):e[n]=h({},i)}}else{var s;l[u]=n,r&&!r.linear&&TB.includes(u)&&null!=(s=l[u])&&s.isTexture&&l[u].format===fo&&l[u].type===Zs&&(l[u].colorSpace=Tl)}}if(null!=i&&i.parent&&null!=r&&r.internal&&null!=(n=i.object)&&n.isObject3D&&a!==i.eventCount){const e=i.object,t=r.internal.interaction.indexOf(e);t>-1&&r.internal.interaction.splice(t,1),i.eventCount&&null!==e.raycast&&r.internal.interaction.push(e)}return i&&void 0===i.props.attach&&(i.object.isBufferGeometry?i.props.attach="geometry":i.object.isMaterial&&(i.props.attach="material")),i&&PB(i),e}function PB(e){var t;if(!e.parent)return;null==e.props.onUpdate||e.props.onUpdate(e.object);const n=null==(t=e.root)||null==t.getState?void 0:t.getState();n&&0===n.internal.frames&&n.invalidate()}function BB(e,t){e.manual||(oB(e)?(e.left=t.width/-2,e.right=t.width/2,e.top=t.height/2,e.bottom=t.height/-2):e.aspect=t.width/t.height,e.updateProjectionMatrix())}const IB=e=>null==e?void 0:e.isObject3D;function DB(e){return(e.eventObject||e.object).uuid+"/"+e.index+e.instanceId}function FB(e,t,n,i){const r=n.get(t);r&&(n.delete(t),0===n.size&&(e.delete(i),r.target.releasePointerCapture(i)))}function LB(e,t,n){const i=e.getState().internal;for(let r=0;r{if(e.eventObject===t||e.object===t){i.hovered.delete(r);const a=h(h({},e),{},{eventObject:e.eventObject===t?n:e.eventObject,object:e.object===t?n:e.object});i.hovered.set(DB(a),a)}}),i.capturedMap.forEach(e=>{const i=e.get(t);i&&(e.delete(t),e.set(n,i))})}function NB(e){function t(e){return e.filter(e=>["Move","Over","Enter","Out","Leave"].some(t=>{var n;return null==(n=e.__r3f)?void 0:n.handlers["onPointer"+t]}))}function n(t){const n=e.getState().internal;for(const e of n.hovered.values())if(!t.length||!t.find(t=>t.object===e.object&&t.index===e.index&&t.instanceId===e.instanceId)){const i=e.eventObject.__r3f;if(n.hovered.delete(DB(e)),null!=i&&i.eventCount){const n=i.handlers,r=h(h({},e),{},{intersections:t});null==n.onPointerOut||n.onPointerOut(r),null==n.onPointerLeave||n.onPointerLeave(r)}}}function i(e,t){for(let n=0;nn([]);case"onLostPointerCapture":return t=>{const i=e.getState().internal;"pointerId"in t&&i.capturedMap.has(t.pointerId)&&requestAnimationFrame(()=>{i.capturedMap.has(t.pointerId)&&(i.capturedMap.delete(t.pointerId),n([]))})}}return function(a){const s=e.getState(),o=s.onPointerMissed,l=s.internal;l.lastEvent.current=a;const u="onPointerMove"===r,c="onClick"===r||"onContextMenu"===r||"onDoubleClick"===r,d=function(t,n){const i=e.getState(),r=new Set,a=[],s=n?n(i.internal.interaction):i.internal.interaction;for(let e=0;e{const n=fB(e.object),i=fB(t.object);return n&&i&&i.events.priority-n.events.priority||e.distance-t.distance}).filter(e=>{const t=DB(e);return!r.has(t)&&(r.add(t),!0)});i.events.filter&&(o=i.events.filter(o,i));for(const e of o){let t=e.object;for(;t;){var l;null!=(l=t.__r3f)&&l.eventCount&&a.push(h(h({},e),{},{eventObject:t})),t=t.parent}}if("pointerId"in t&&i.internal.capturedMap.has(t.pointerId))for(let e of i.internal.capturedMap.get(t.pointerId).values())r.has(DB(e.intersection))||a.push(e.intersection);return a}(a,u?t:void 0),p=c?function(t){const n=e.getState().internal,i=t.offsetX-n.initialClick[0],r=t.offsetY-n.initialClick[1];return Math.round(Math.sqrt(i*i+r*r))}(a):0;"onPointerDown"===r&&(l.initialClick=[a.offsetX,a.offsetY],l.initialHits=d.map(e=>e.eventObject)),c&&!d.length&&p<=2&&(i(a,l.interaction),o&&o(a)),u&&n(d),function(e,t,i,r){if(e.length){const a={stopped:!1};for(const s of e){let o=fB(s.object);if(o||s.object.traverseAncestors(e=>{const t=fB(e);if(t)return o=t,!1}),o){const l=o,u=l.raycaster,c=l.pointer,d=l.camera,p=l.internal,f=new Yu(c.x,c.y,0).unproject(d),m=e=>{var t,n;return null!=(t=null==(n=p.capturedMap.get(e))?void 0:n.has(s.eventObject))&&t},g=e=>{const n={intersection:s,target:t.target};p.capturedMap.has(e)?p.capturedMap.get(e).set(s.eventObject,n):p.capturedMap.set(e,new Map([[s.eventObject,n]])),t.target.setPointerCapture(e)},v=e=>{const t=p.capturedMap.get(e);t&&FB(p.capturedMap,s.eventObject,t,e)};let y={};for(let e in t){let n=t[e];"function"!==typeof n&&(y[e]=n)}let _=h(h(h({},s),y),{},{pointer:c,intersections:e,stopped:a.stopped,delta:i,unprojectedPoint:f,ray:u.ray,camera:d,stopPropagation(){const i="pointerId"in t&&p.capturedMap.get(t.pointerId);(!i||i.has(s.eventObject))&&(_.stopped=a.stopped=!0,p.hovered.size&&Array.from(p.hovered.values()).find(e=>e.eventObject===s.eventObject))&&n([...e.slice(0,e.indexOf(s)),s])},target:{hasPointerCapture:m,setPointerCapture:g,releasePointerCapture:v},currentTarget:{hasPointerCapture:m,setPointerCapture:g,releasePointerCapture:v},nativeEvent:t});if(r(_),!0===a.stopped)break}}}}(d,a,p,function(e){const t=e.eventObject,n=t.__r3f;if(null==n||!n.eventCount)return;const s=n.handlers;if(u){if(s.onPointerOver||s.onPointerEnter||s.onPointerOut||s.onPointerLeave){const t=DB(e),n=l.hovered.get(t);n?n.stopped&&e.stopPropagation():(l.hovered.set(t,e),null==s.onPointerOver||s.onPointerOver(e),null==s.onPointerEnter||s.onPointerEnter(e))}null==s.onPointerMove||s.onPointerMove(e)}else{const n=s[r];n?c&&!l.initialHits.includes(t)||(i(a,l.interaction.filter(e=>!l.initialHits.includes(e))),n(e)):c&&l.initialHits.includes(t)&&i(a,l.interaction.filter(e=>!l.initialHits.includes(e)))}})}}}}const OB=e=>!(null==e||!e.render),kB=r.createContext(null),UB=(e,t)=>{const n=((e,t)=>e?XP(e,t):XP)((n,i)=>{const a=new Yu,s=new Yu,o=new Yu;function l(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i().camera,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:i().size;const r=n.width,l=n.height,u=n.top,c=n.left,h=r/l;t.isVector3?o.copy(t):o.set(...t);const d=e.getWorldPosition(a).distanceTo(o);if(oB(e))return{width:r/e.zoom,height:l/e.zoom,top:u,left:c,factor:1,distance:d,aspect:h};{const t=e.fov*Math.PI/180,n=2*Math.tan(t/2)*d,i=n*(r/l);return{width:i,height:n,top:u,left:c,factor:r/i,distance:d,aspect:h}}}let u;const c=e=>n(t=>({performance:h(h({},t.performance),{},{current:e})})),d=new Ku,p={set:n,get:i,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return e(i(),t)},advance:(e,n)=>t(e,n,i()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new Gy,pointer:d,mouse:d,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const e=i();u&&clearTimeout(u),e.performance.current!==e.performance.min&&c(e.performance.min),u=setTimeout(()=>c(i().performance.max),e.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:l},setEvents:e=>n(t=>h(h({},t),{},{events:h(h({},t.events),e)})),setSize:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const o=i().camera,u={width:e,height:t,top:r,left:a};n(e=>({size:u,viewport:h(h({},e.viewport),l(o,s,u))}))},setDpr:e=>n(t=>{const n=pB(e);return{viewport:h(h({},t.viewport),{},{dpr:n,initialDpr:t.viewport.initialDpr||n})}}),setFrameloop:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"always";const t=i().clock;t.stop(),t.elapsedTime=0,"never"!==e&&(t.start(),t.elapsedTime=0),n(()=>({frameloop:e}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:r.createRef(),active:!1,frames:0,priority:0,subscribe:(e,t,n)=>{const r=i().internal;return r.priority=r.priority+(t>0?1:0),r.subscribers.push({ref:e,priority:t,store:n}),r.subscribers=r.subscribers.sort((e,t)=>e.priority-t.priority),()=>{const n=i().internal;null!=n&&n.subscribers&&(n.priority=n.priority-(t>0?1:0),n.subscribers=n.subscribers.filter(t=>t.ref!==e))}}}};return p}),i=n.getState();let a=i.size,s=i.viewport.dpr,o=i.camera;return n.subscribe(()=>{const e=n.getState(),t=e.camera,i=e.size,r=e.viewport,l=e.gl,u=e.set;if(i.width!==a.width||i.height!==a.height||r.dpr!==s){a=i,s=r.dpr,BB(t,i),r.dpr>0&&l.setPixelRatio(r.dpr);const e="undefined"!==typeof HTMLCanvasElement&&l.domElement instanceof HTMLCanvasElement;l.setSize(i.width,i.height,e)}t!==o&&(o=t,u(e=>({viewport:h(h({},e.viewport),e.viewport.getCurrentViewport(t))})))}),n.subscribe(t=>e(t)),n};function zB(){const e=r.useContext(kB);if(!e)throw new Error("R3F: Hooks can only be used within the Canvas component!");return e}const GB=new WeakMap;function HB(e,t){return function(n){let i;(e=>{var t;return"function"===typeof e&&(null==e||null==(t=e.prototype)?void 0:t.constructor)===e})(n)?(i=GB.get(n),i||(i=new n,GB.set(n,i))):i=n,e&&e(i);for(var r=arguments.length,a=new Array(r>1?r-1:0),s=1;snew Promise((n,r)=>i.load(e,e=>{IB(null==e?void 0:e.scene)&&Object.assign(e,gB(e.scene)),n(e)},t,t=>r(new Error("Could not load ".concat(e,": ").concat(null==t?void 0:t.message)))))))}}function VB(e,t,n,i){const r=Array.isArray(t)?t:[t],a=((e,t,n)=>qP(e,t,!1,n))(HB(n,i),[e,...r],{equal:mB.equ});return Array.isArray(t)?a:a[0]}VB.preload=function(e,t,n){const i=Array.isArray(t)?t:[t];return((e,t,n)=>{qP(e,t,!0,n)})(HB(n),[e,...i])},VB.clear=function(e,t){return(e=>{if(void 0===e||0===e.length)JP.splice(0,JP.length);else{const t=JP.find(t=>KP(e,t.keys,t.equal));t&&t.remove()}})([e,...Array.isArray(t)?t:[t]])};var jB,WB={exports:{}},XB={exports:{}};function JB(){return jB||(jB=1,(e=XB).exports=function(e){function t(e,t,n,i){return new zr(e,t,n,i)}function n(){}function i(e){var t="https://react.dev/errors/"+e;if(1Xo||(e.current=Wo[Xo],Wo[Xo]=null,Xo--)}function f(e,t){Xo++,Wo[Xo]=e.current,e.current=t}function m(e){var t=42&e;if(0!==t)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return 261888&e;case 262144:case 524288:case 1048576:case 2097152:return 3932160&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function g(e,t,n){var i=e.pendingLanes;if(0===i)return 0;var r=0,a=e.suspendedLanes,s=e.pingedLanes;e=e.warmLanes;var o=134217727&i;return 0!==o?0!==(i=o&~a)?r=m(i):0!==(s&=o)?r=m(s):n||0!==(n=o&~e)&&(r=m(n)):0!==(o=i&~a)?r=m(o):0!==s?r=m(s):n||0!==(n=i&~e)&&(r=m(n)),0===r?0:0!==t&&t!==r&&0===(t&a)&&((a=r&-r)>=(n=t&-t)||32===a&&0!==(4194048&n))?t:r}function v(e,t){return 0===(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)}function y(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;default:return-1}}function _(){var e=$o;return 0===(62914560&($o<<=1))&&($o=4194304),e}function b(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function x(e,t){e.pendingLanes|=t,268435456!==t&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function S(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var i=31-Ko(t);e.entangledLanes|=t,e.entanglements[i]=1073741824|e.entanglements[i]|261930&n}function A(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var i=31-Ko(n),r=1<)":-1<$P.stack.indexOf("@")?"@unknown:0:0":""}return"\n"+xo+e+So}function R(e,t){if(!e||gl)return"";gl=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(n,[])}catch(r){var i=r}Reflect.construct(e,[],n)}else{try{n.call()}catch(r){i=r}e.call(n.prototype)}}else{try{throw Error()}catch(r){i=r}(n=e())&&"function"==typeof n.catch&&n.catch(function(){})}}catch(r){if(r&&i&&"string"==typeof r.stack)return[r.stack,i.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=i.DetermineComponentFrameRoot(),s=a[0],o=a[1];if(s&&o){var l=s.split("\n"),u=o.split("\n");for(r=i=0;i--r||l[i]!==u[r]){var c="\n"+l[i].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}}while(1<=i&&0<=r);break}}}finally{gl=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?C(n):""}function P(e,t){switch(e.tag){case 26:case 27:case 5:return C(e.type);case 16:return C("Lazy");case 13:return e.child!==t&&null!==t?C("Suspense Fallback"):C("Suspense");case 19:return C("SuspenseList");case 0:case 15:return R(e.type,!1);case 11:return R(e.type.render,!1);case 1:return R(e.type,!0);case 31:return C("Activity");default:return""}}function B(e){try{var t="",n=null;do{t+=P(e,n),n=e,e=e.return}while(e);return t}catch(ZP){return"\nError generating stack: "+ZP.message+"\n"+ZP.stack}}function I(e,t){if("object"==typeof e&&null!==e){var n=vl.get(e);return void 0!==n?n:(t={value:e,source:t,stack:B(t)},vl.set(e,t),t)}return{value:e,source:t,stack:B(t)}}function D(e,t){yl[_l++]=xl,yl[_l++]=bl,bl=e,xl=t}function F(e,t,n){Sl[Al++]=wl,Sl[Al++]=El,Sl[Al++]=Ml,Ml=e;var i=wl;e=El;var r=32-Ko(i)-1;i&=~(1<>=s,r-=s,wl=1<<32-Ko(t)+r|n<d?(p=h,h=null):p=h.sibling;var v=m(t,h,s[d],l);if(null===v){null===h&&(h=p);break}e&&h&&null===v.alternate&&n(t,h),i=o(v,i,d),null===c?u=v:c.sibling=v,c=v,h=p}if(d===s.length)return r(t,h),Dl&&D(t,d),u;if(null===h){for(;dp?(v=d,d=null):v=d.sibling;var _=m(t,d,y.value,u);if(null===_){null===d&&(d=v);break}e&&d&&null===_.alternate&&n(t,d),s=o(_,s,p),null===h?c=_:h.sibling=_,h=_,d=v}if(y.done)return r(t,d),Dl&&D(t,p),c;if(null===d){for(;!y.done;p++,y=l.next())null!==(y=f(t,y.value,u))&&(s=o(y,s,p),null===h?c=y:h.sibling=y,h=y);return Dl&&D(t,p),c}for(d=a(d);!y.done;p++,y=l.next())null!==(y=g(d,t,p,y.value,u))&&(e&&null!==y.alternate&&d.delete(null===y.key?p:y.key),s=o(y,s,p),null===h?c=y:h.sibling=y,h=y);return e&&d.forEach(function(e){return n(t,e)}),Dl&&D(t,p),c}(t,u,h=p.call(h),d)}if("function"==typeof h.then)return v(t,u,Ee(h),d);if(h.$$typeof===pa)return v(t,u,ie(t,h),d);Ce(t,h)}return"string"==typeof h&&""!==h||"number"==typeof h||"bigint"==typeof h?(h=""+h,null!==u&&6===u.tag?(r(t,u.sibling),(d=s(u,h)).return=t,t=d):(r(t,u),(d=Xr(h,t.mode,d)).return=t,t=d),l(t)):r(t,u)}return function(e,n,i,r){try{lu=0;var a=v(e,n,i,r);return ou=null,a}catch(o){if(o===nu||o===ru)throw o;var s=t(29,o,null,e.mode);return s.lanes=r,s.return=e,s}}}function Pe(){for(var e=du,t=pu=du=0;ta?a:8);var s=Ma.T,o={};Ma.T=o,hn(e,!1,t,n);try{var l=r(),u=Ma.S;if(null!==u&&u(o,l),null!==l&&"object"==typeof l&&"function"==typeof l.then){var c=function(e,t){var n=[],i={status:"pending",value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){i.status="fulfilled",i.value=t;for(var e=0;eMc&&(t.flags|=128,a=!0,si(r,!1),t.lanes=4194304)}else{if(!a)if(null!==(e=et(s))){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,ai(t,e),si(r,!0),null===r.tail&&"hidden"===r.tailMode&&!s.alternate&&!Dl)return oi(t),null}else 2*rl()-r.renderingStartTime>Mc&&536870912!==n&&(t.flags|=128,a=!0,si(r,!1),t.lanes=4194304);r.isBackwards?(s.sibling=t.child,t.child=s):(null!==(e=r.last)?e.sibling=s:t.child=s,r.last=s)}return null!==r.tail?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=rl(),e.sibling=null,n=bu.current,f(bu,a?1&n|2:1&n),Dl&&D(t,r.treeForkCount),e):(oi(t),null);case 22:case 23:return $e(t),Ke(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?0!==(536870912&n)&&0===(128&t.flags)&&(oi(t),6&t.subtreeFlags&&(t.flags|=8192)):oi(t),null!==(n=t.updateQueue)&&ai(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&p(tu),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Y(Vl),oi(t),null;case 25:case 30:return null}throw Error(i(156,t.tag))}function ui(e,t){switch(N(t),t.tag){case 1:return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 3:return Y(Vl),U(),0!==(65536&(e=t.flags))&&0===(128&e)?(t.flags=-65537&e|128,t):null;case 26:case 27:case 5:return G(t),null;case 31:if(null!==t.memoizedState){if($e(t),null===t.alternate)throw Error(i(340));X()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 13:if($e(t),null!==(e=t.memoizedState)&&null!==e.dehydrated){if(null===t.alternate)throw Error(i(340));X()}return 65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 19:return p(bu),null;case 4:return U(),null;case 10:return Y(t.type),null;case 22:case 23:return $e(t),Ke(),null!==e&&p(tu),65536&(e=t.flags)?(t.flags=-65537&e|128,t):null;case 24:return Y(Vl),null;default:return null}}function ci(e,t){switch(N(t),t.tag){case 3:Y(Vl),U();break;case 26:case 27:case 5:G(t);break;case 4:U();break;case 31:null!==t.memoizedState&&$e(t);break;case 13:$e(t);break;case 19:p(bu);break;case 10:Y(t.type);break;case 22:case 23:$e(t),Ke(),null!==e&&p(tu);break;case 24:Y(Vl)}}function hi(e,t){try{var n=t.updateQueue,i=null!==n?n.lastEffect:null;if(null!==i){var r=i.next;n=r;do{if((n.tag&e)===e){i=void 0;var a=n.create,s=n.inst;i=a(),s.destroy=i}n=n.next}while(n!==r)}}catch(o){Fr(t,t.return,o)}}function di(e,t,n){try{var i=t.updateQueue,r=null!==i?i.lastEffect:null;if(null!==r){var a=r.next;i=a;do{if((i.tag&e)===e){var s=i.inst,o=s.destroy;if(void 0!==o){s.destroy=void 0,r=t;var l=n,u=o;try{u()}catch(zI){Fr(r,l,zI)}}}i=i.next}while(i!==a)}}catch(zI){Fr(t,t.return,zI)}}function pi(e){var t=e.updateQueue;if(null!==t){var n=e.stateNode;try{We(t,n)}catch(ZP){Fr(e,e.return,ZP)}}}function fi(e,t,n){n.props=yn(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(ZP){Fr(e,t,ZP)}}function mi(e,t){try{var n=e.ref;if(null!==n){switch(e.tag){case 26:case 27:case 5:var i=Ca(e.stateNode);break;default:i=e.stateNode}"function"==typeof n?e.refCleanup=n(i):n.current=i}}catch(tB){Fr(e,t,tB)}}function gi(e,t){var n=e.ref,i=e.refCleanup;if(null!==n)if("function"==typeof i)try{i()}catch(tB){Fr(e,t,tB)}finally{e.refCleanup=null,null!=(e=e.alternate)&&(e.refCleanup=null)}else if("function"==typeof n)try{n(null)}catch(tB){Fr(e,t,tB)}else n.current=null}function vi(e){var t=e.type,n=e.memoizedProps,i=e.stateNode;try{xs(i,t,n,e)}catch(tB){Fr(e,e.return,tB)}}function yi(e,t,n){try{Ss(e.stateNode,e.type,n,t,e)}catch(ZP){Fr(e,e.return,ZP)}}function _i(e){return 5===e.tag||3===e.tag||!!wo&&26===e.tag||!!Uo&&27===e.tag&&jo(e.type)||4===e.tag}function bi(e){e:for(;;){for(;null===e.sibling;){if(null===e.return||_i(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;5!==e.tag&&6!==e.tag&&18!==e.tag;){if(Uo&&27===e.tag&&jo(e.type)||2&e.flags||null===e.child||4===e.tag)continue e;e.child.return=e,e=e.child}if(!(2&e.flags))return e.stateNode}}function xi(e,t,n){var i=e.tag;if(5===i||6===i)e=e.stateNode,t?Ms(n,e,t):_s(n,e);else if(4!==i&&(Uo&&27===i&&jo(e.type)&&(n=e.stateNode,t=null),null!==(e=e.child)))for(xi(e,t,n),e=e.sibling;null!==e;)xi(e,t,n),e=e.sibling}function Si(e,t,n){var i=e.tag;if(5===i||6===i)e=e.stateNode,t?As(n,e,t):ys(n,e);else if(4!==i&&(Uo&&27===i&&jo(e.type)&&(n=e.stateNode),null!==(e=e.child)))for(Si(e,t,n),e=e.sibling;null!==e;)Si(e,t,n),e=e.sibling}function Ai(e,t,n){e=e.containerInfo;try{Os(e,n)}catch(ZP){Fr(t,t.return,ZP)}}function Mi(e){var t=e.stateNode,n=e.memoizedProps;try{Go(e.type,n,t,e)}catch(ZP){Fr(e,e.return,ZP)}}function wi(e,t,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:Ni(e,n),4&i&&hi(5,n);break;case 1:if(Ni(e,n),4&i)if(e=n.stateNode,null===t)try{e.componentDidMount()}catch(s){Fr(n,n.return,s)}else{var r=yn(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(s){Fr(n,n.return,s)}}64&i&&pi(n),512&i&&mi(n,n.return);break;case 3:if(Ni(e,n),64&i&&null!==(i=n.updateQueue)){if(e=null,null!==n.child)switch(n.child.tag){case 27:case 5:e=Ca(n.child.stateNode);break;case 1:e=n.child.stateNode}try{We(i,e)}catch(s){Fr(n,n.return,s)}}break;case 27:Uo&&null===t&&4&i&&Mi(n);case 26:case 5:if(Ni(e,n),null===t)if(4&i)vi(n);else if(64&i){e=n.type,t=n.memoizedProps,r=n.stateNode;try{uo(r,e,t,n)}catch(s){Fr(n,n.return,s)}}512&i&&mi(n,n.return);break;case 12:Ni(e,n);break;case 31:Ni(e,n),4&i&&Ri(e,n);break;case 13:Ni(e,n),4&i&&Pi(e,n),64&i&&null!==(i=n.memoizedState)&&null!==(i=i.dehydrated)&&(n=kr.bind(null,n),Vs(i,n));break;case 22:if(!(i=null!==n.memoizedState||zu)){t=null!==t&&null!==t.memoizedState||Gu,r=zu;var a=Gu;zu=i,(Gu=t)&&!a?ki(e,n,0!==(8772&n.subtreeFlags)):Ni(e,n),zu=r,Gu=a}break;case 30:break;default:Ni(e,n)}}function Ei(e){var t=e.alternate;null!==t&&(e.alternate=null,Ei(t)),e.child=null,e.deletions=null,e.sibling=null,5===e.tag&&null!==(t=e.stateNode)&&Qa(t),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ti(e,t,n){for(n=n.child;null!==n;)Ci(e,t,n),n=n.sibling}function Ci(e,t,n){if(dl&&"function"==typeof dl.onCommitFiberUnmount)try{dl.onCommitFiberUnmount(hl,n)}catch(a){}switch(n.tag){case 26:if(wo){Gu||gi(n,t),Ti(e,t,n),n.memoizedState?Po(n.memoizedState):n.stateNode&&Do(n.stateNode);break}case 27:if(Uo){Gu||gi(n,t);var i=Wu,r=Xu;jo(n.type)&&(Wu=n.stateNode,Xu=!1),Ti(e,t,n),Ho(n.stateNode),Wu=i,Xu=r;break}case 5:Gu||gi(n,t);case 6:if(Ha){if(i=Wu,r=Xu,Wu=null,Ti(e,t,n),Xu=r,null!==(Wu=i))if(Xu)try{Es(Wu,n.stateNode)}catch(s){Fr(n,t,s)}else try{ws(Wu,n.stateNode)}catch(s){Fr(n,t,s)}}else Ti(e,t,n);break;case 18:Ha&&null!==Wu&&(Xu?vo(Wu,n.stateNode):go(Wu,n.stateNode));break;case 4:Ha?(i=Wu,r=Xu,Wu=n.stateNode.containerInfo,Xu=!0,Ti(e,t,n),Wu=i,Xu=r):(Va&&Ai(n.stateNode,n,Fs()),Ti(e,t,n));break;case 0:case 11:case 14:case 15:di(2,n,t),Gu||di(4,n,t),Ti(e,t,n);break;case 1:Gu||(gi(n,t),"function"==typeof(i=n.stateNode).componentWillUnmount&&fi(n,t,i)),Ti(e,t,n);break;case 21:Ti(e,t,n);break;case 22:Gu=(i=Gu)||null!==n.memoizedState,Ti(e,t,n),Gu=i;break;default:Ti(e,t,n)}}function Ri(e,t){if(ja&&null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)){e=e.dehydrated;try{ho(e)}catch($P){Fr(t,t.return,$P)}}}function Pi(e,t){if(ja&&null===t.memoizedState&&null!==(e=t.alternate)&&null!==(e=e.memoizedState)&&null!==(e=e.dehydrated))try{po(e)}catch($P){Fr(t,t.return,$P)}}function Bi(e,t){var n=function(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return null===t&&(t=e.stateNode=new Vu),t;case 22:return null===(t=(e=e.stateNode)._retryCache)&&(t=e._retryCache=new Vu),t;default:throw Error(i(435,e.tag))}}(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var i=Ur.bind(null,e,t);t.then(i,i)}})}function Ii(e,t){var n=t.deletions;if(null!==n)for(var r=0;r";case Qu:return":has("+(er(e)||"")+")";case Zu:return'[role="'+e.value+'"]';case ec:return'"'+e.value+'"';case $u:return'[data-testname="'+e.value+'"]';default:throw Error(i(365))}}function tr(e,t){var n=[];e=[e,0];for(var i=0;in?32:n;n=Ma.T;var a=Ka();try{Ja(r),Ma.T=null,r=Ic,Ic=null;var s=Cc,o=Pc;if(Tc=0,Rc=Cc=null,Pc=0,0!==(6&ic))throw Error(i(331));var l=ic;if(ic|=4,qi(s.current),Hi(s,s.current,o,r),ic=l,ue(0,!1),dl&&"function"==typeof dl.onPostCommitFiberRoot)try{dl.onPostCommitFiberRoot(hl,s)}catch(u){}return!0}finally{Ja(a),Ma.T=n,Pr(e,t)}}function Dr(e,t,n){t=I(n,t),null!==(e=Ue(e,t=xn(e.stateNode,t,2),2))&&(x(e,2),le(e))}function Fr(e,t,n){if(3===e.tag)Dr(e,e,n);else for(;null!==t;){if(3===t.tag){Dr(t,e,n);break}if(1===t.tag){var i=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof i.componentDidCatch&&(null===Ec||!Ec.has(i))){e=I(n,e),null!==(i=Ue(t,n=Sn(2),2))&&(An(n,i,t,e),x(i,2),le(i));break}}t=t.return}}function Lr(e,t,n){var i=e.pingCache;if(null===i){i=e.pingCache=new nc;var r=new Set;i.set(t,r)}else void 0===(r=i.get(t))&&(r=new Set,i.set(t,r));r.has(n)||(hc=!0,r.add(n),e=Nr.bind(null,e,t,n),t.then(e,e))}function Nr(e,t,n){var i=e.pingCache;null!==i&&i.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,rc===e&&(sc&n)===n&&(4===pc||3===pc&&(62914560&sc)===sc&&300>rl()-Sc?0===(2&ic)&&dr(e,0):gc|=n,yc===sc&&(yc=0)),le(e)}function Or(e,t){0===t&&(t=_()),null!==(e=De(e,t))&&(x(e,t),le(e))}function kr(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),Or(e,n)}function Ur(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;null!==a&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==r&&r.delete(t),Or(e,n)}function zr(e,t,n,i){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gr(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Hr(e,n){var i=e.alternate;return null===i?((i=t(e.tag,n,e.key,e.mode)).elementType=e.elementType,i.type=e.type,i.stateNode=e.stateNode,i.alternate=e,e.alternate=i):(i.pendingProps=n,i.type=e.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=65011712&e.flags,i.childLanes=e.childLanes,i.lanes=e.lanes,i.child=e.child,i.memoizedProps=e.memoizedProps,i.memoizedState=e.memoizedState,i.updateQueue=e.updateQueue,n=e.dependencies,i.dependencies=null===n?null:{lanes:n.lanes,firstContext:n.firstContext},i.sibling=e.sibling,i.index=e.index,i.ref=e.ref,i.refCleanup=e.refCleanup,i}function Vr(e,t){e.flags&=65011714;var n=e.alternate;return null===n?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function jr(e,n,r,a,s,o){var l=0;if(a=e,"function"==typeof e)Gr(e)&&(l=1);else if("string"==typeof e)l=wo&&Uo?Eo(e,r,Tl.current)?26:Vo(e)?27:5:wo?Eo(e,r,Tl.current)?26:5:Uo&&Vo(e)?27:5;else e:switch(e){case _a:return(e=t(31,r,n,s)).elementType=_a,e.lanes=o,e;case ua:return Wr(r.children,s,o,n);case ca:l=8,s|=24;break;case ha:return(e=t(12,r,n,2|s)).elementType=ha,e.lanes=o,e;case ma:return(e=t(13,r,n,s)).elementType=ma,e.lanes=o,e;case ga:return(e=t(19,r,n,s)).elementType=ga,e.lanes=o,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case pa:l=10;break e;case da:l=9;break e;case fa:l=11;break e;case va:l=14;break e;case ya:l=16,a=null;break e}l=29,r=Error(i(130,null===e?"null":typeof e,"")),a=null}return(n=t(l,r,n,s)).elementType=e,n.type=a,n.lanes=o,n}function Wr(e,n,i,r){return(e=t(7,e,r,n)).lanes=i,e}function Xr(e,n,i){return(e=t(6,e,null,n)).lanes=i,e}function Jr(e){var n=t(18,null,null,0);return n.stateNode=e,n}function Kr(e,n,i){return(n=t(4,null!==e.children?e.children:[],e.key,n)).lanes=i,n.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},n}function qr(e,t,n,i,r,a,s,o,l){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=za,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=b(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=b(0),this.hiddenUpdates=b(null),this.identifierPrefix=i,this.onUncaughtError=r,this.onCaughtError=a,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=l,this.incompleteTransitions=new Map}function Yr(e,n,i,r,a,s,o,l,u,c,h,d){return e=new qr(e,n,i,o,u,c,h,d,l),n=1,!0===s&&(n|=24),s=t(3,null,null,n),e.current=s,s.stateNode=e,(n=ae()).refCount++,e.pooledCache=n,n.refCount++,s.memoizedState={element:r,isDehydrated:i,cache:n},Ne(s),e}function Qr(e){return e?e=Jo:Jo}function Zr(e){var t=e._reactInternals;if(void 0===t)throw"function"==typeof e.render?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return null===(e=null!==(e=o(t))?l(e):null)?null:Ca(e.stateNode)}function $r(e,t,n,i,r,a){r=Qr(r),null===i.context?i.context=r:i.pendingContext=r,(i=ke(t)).payload={element:n},null!==(a=void 0===a?null:a)&&(i.callback=a),null!==(n=Ue(e,i,t))&&(ar(n,0,t),ze(n,e,t))}function ea(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var n=e.retryLane;e.retryLane=0!==n&&n>>=0)?32:31-(qo(e)/Yo|0)|0},qo=Math.log,Yo=Math.LN2,Qo=256,Zo=262144,$o=4194304,el=ra.unstable_scheduleCallback,tl=ra.unstable_cancelCallback,nl=ra.unstable_shouldYield,il=ra.unstable_requestPaint,rl=ra.unstable_now,al=ra.unstable_ImmediatePriority,sl=ra.unstable_UserBlockingPriority,ol=ra.unstable_NormalPriority,ll=ra.unstable_IdlePriority,ul=ra.log,cl=ra.unstable_setDisableYieldValue,hl=null,dl=null,pl="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e===1/t)||e!==e&&t!==t},fl="function"==typeof reportError?reportError:function(e){if("object"==typeof window&&"function"==typeof window.ErrorEvent){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:"object"==typeof e&&null!==e&&"string"==typeof e.message?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if("object"==typeof process&&"function"==typeof process.emit)return void process.emit("uncaughtException",e);console.error(e)},ml=Object.prototype.hasOwnProperty,gl=!1,vl=new WeakMap,yl=[],_l=0,bl=null,xl=0,Sl=[],Al=0,Ml=null,wl=1,El="",Tl=d(null),Cl=d(null),Rl=d(null),Pl=d(null),Bl=null,Il=null,Dl=!1,Fl=null,Ll=!1,Nl=Error(i(519)),Ol=d(null),kl=null,Ul=null,zl=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Gl=ra.unstable_scheduleCallback,Hl=ra.unstable_NormalPriority,Vl={$$typeof:pa,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},jl=null,Wl=null,Xl=!1,Jl=!1,Kl=!1,ql=0,Yl=null,Ql=0,Zl=0,$l=null,eu=Ma.S;Ma.S=function(e,t){Ac=rl(),"object"==typeof t&&null!==t&&"function"==typeof t.then&&function(e,t){if(null===Yl){var n=Yl=[];Ql=0,Zl=me(),$l={status:"pending",value:void 0,then:function(e){n.push(e)}}}Ql++,t.then(ge,ge)}(0,t),null!==eu&&eu(e,t)};var tu=d(null),nu=Error(i(460)),iu=Error(i(474)),ru=Error(i(542)),au={then:function(){}},su=null,ou=null,lu=0,uu=Re(!0),cu=Re(!1),hu=[],du=0,pu=0,fu=!1,mu=!1,gu=d(null),vu=d(0),yu=d(null),_u=null,bu=d(0),xu=0,Su=null,Au=null,Mu=null,wu=!1,Eu=!1,Tu=!1,Cu=0,Ru=0,Pu=null,Bu=0,Iu={readContext:ne,use:pt,useCallback:tt,useContext:tt,useEffect:tt,useImperativeHandle:tt,useLayoutEffect:tt,useInsertionEffect:tt,useMemo:tt,useReducer:tt,useRef:tt,useState:tt,useDebugValue:tt,useDeferredValue:tt,useTransition:tt,useSyncExternalStore:tt,useId:tt,useHostTransitionStatus:tt,useFormState:tt,useActionState:tt,useOptimistic:tt,useMemoCache:tt,useCacheRefresh:tt};Iu.useEffectEvent=tt;var Du={readContext:ne,use:pt,useCallback:function(e,t){return ct().memoizedState=[e,void 0===t?null:t],e},useContext:ne,useEffect:Vt,useImperativeHandle:function(e,t,n){n=null!=n?n.concat([e]):null,Gt(4194308,4,Kt.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Gt(4194308,4,e,t)},useInsertionEffect:function(e,t){Gt(4,2,e,t)},useMemo:function(e,t){var n=ct();t=void 0===t?null:t;var i=e();if(Tu){T(!0);try{e()}finally{T(!1)}}return n.memoizedState=[i,t],i},useReducer:function(e,t,n){var i=ct();if(void 0!==n){var r=n(t);if(Tu){T(!0);try{n(t)}finally{T(!1)}}}else r=t;return i.memoizedState=i.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},i.queue=e,e=e.dispatch=ln.bind(null,Su,e),[i.memoizedState,e]},useRef:function(e){return e={current:e},ct().memoizedState=e},useState:function(e){var t=(e=wt(e)).queue,n=un.bind(null,Su,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Yt,useDeferredValue:function(e,t){return $t(ct(),e,t)},useTransition:function(){var e=wt(!1);return e=tn.bind(null,Su,e.queue,!0,!1),ct().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Su,a=ct();if(Dl){if(void 0===n)throw Error(i(407));n=n()}else{if(n=t(),null===rc)throw Error(i(349));0!==(127&sc)||bt(r,t,n)}a.memoizedState=n;var s={value:n,getSnapshot:t};return a.queue=s,Vt(St.bind(null,r,s,e),[e]),r.flags|=2048,Ut(9,{destroy:void 0},xt.bind(null,r,s,n,t),null),n},useId:function(){var e=ct(),t=rc.identifierPrefix;if(Dl){var n=El;t="_"+t+"R_"+(n=(wl&~(1<<32-Ko(wl)-1)).toString(32)+n),0<(n=Cu++)&&(t+="H"+n.toString(32)),t+="_"}else t="_"+t+"r_"+(n=Bu++).toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:rn,useFormState:Ft,useActionState:Ft,useOptimistic:function(e){var t=ct();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=hn.bind(null,Su,!0,n),n.dispatch=t,[e,t]},useMemoCache:ft,useCacheRefresh:function(){return ct().memoizedState=on.bind(null,Su)},useEffectEvent:function(e){var t=ct(),n={impl:e};return t.memoizedState=n,function(){if(0!==(2&ic))throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Fu={readContext:ne,use:pt,useCallback:Qt,useContext:ne,useEffect:jt,useImperativeHandle:qt,useInsertionEffect:Xt,useLayoutEffect:Jt,useMemo:Zt,useReducer:gt,useRef:zt,useState:function(){return gt(mt)},useDebugValue:Yt,useDeferredValue:function(e,t){return en(ht(),Au.memoizedState,e,t)},useTransition:function(){var e=gt(mt)[0],t=ht().memoizedState;return["boolean"==typeof e?e:dt(e),t]},useSyncExternalStore:_t,useId:an,useHostTransitionStatus:rn,useFormState:Lt,useActionState:Lt,useOptimistic:function(e,t){return Et(ht(),0,e,t)},useMemoCache:ft,useCacheRefresh:sn};Fu.useEffectEvent=Wt;var Lu={readContext:ne,use:pt,useCallback:Qt,useContext:ne,useEffect:jt,useImperativeHandle:qt,useInsertionEffect:Xt,useLayoutEffect:Jt,useMemo:Zt,useReducer:yt,useRef:zt,useState:function(){return yt(mt)},useDebugValue:Yt,useDeferredValue:function(e,t){var n=ht();return null===Au?$t(n,e,t):en(n,Au.memoizedState,e,t)},useTransition:function(){var e=yt(mt)[0],t=ht().memoizedState;return["boolean"==typeof e?e:dt(e),t]},useSyncExternalStore:_t,useId:an,useHostTransitionStatus:rn,useFormState:kt,useActionState:kt,useOptimistic:function(e,t){var n=ht();return null!==Au?Et(n,0,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:ft,useCacheRefresh:sn};Lu.useEffectEvent=Wt;var Nu={enqueueSetState:function(e,t,n){e=e._reactInternals;var i=ir(),r=ke(i);r.payload=t,null!=n&&(r.callback=n),null!==(t=Ue(e,r,i))&&(ar(t,0,i),ze(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var i=ir(),r=ke(i);r.tag=1,r.payload=t,null!=n&&(r.callback=n),null!==(t=Ue(e,r,i))&&(ar(t,0,i),ze(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ir(),i=ke(n);i.tag=2,null!=t&&(i.callback=t),null!==(t=Ue(e,i,n))&&(ar(t,0,n),ze(t,e,n))}},Ou=Error(i(461)),ku=!1,Uu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null},zu=!1,Gu=!1,Hu=!1,Vu="function"==typeof WeakSet?WeakSet:Set,ju=null,Wu=null,Xu=!1,Ju=null,Ku=8192,qu={getCacheForType:function(e){var t=ne(Vl),n=t.data.get(e);return void 0===n&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ne(Vl).controller.signal}},Yu=0,Qu=1,Zu=2,$u=3,ec=4;if("function"==typeof Symbol&&Symbol.for){var tc=Symbol.for;Yu=tc("selector.component"),Qu=tc("selector.has_pseudo_class"),Zu=tc("selector.role"),$u=tc("selector.test_id"),ec=tc("selector.text")}var nc="function"==typeof WeakMap?WeakMap:Map,ic=0,rc=null,ac=null,sc=0,oc=0,lc=null,uc=!1,cc=!1,hc=!1,dc=0,pc=0,fc=0,mc=0,gc=0,vc=0,yc=0,_c=null,bc=null,xc=!1,Sc=0,Ac=0,Mc=1/0,wc=null,Ec=null,Tc=0,Cc=null,Rc=null,Pc=0,Bc=0,Ic=null,Dc=null,Fc=0,Lc=null;return na.attemptContinuousHydration=function(e){if(13===e.tag||31===e.tag){var t=De(e,67108864);null!==t&&ar(t,0,67108864),ta(e,67108864)}},na.attemptHydrationAtCurrentPriority=function(e){if(13===e.tag||31===e.tag){var t=ir(),n=De(e,t=w(t));null!==n&&ar(n,0,t),ta(e,t)}},na.attemptSynchronousHydration=function(e){switch(e.tag){case 3:if((e=e.stateNode).current.memoizedState.isDehydrated){var t=m(e.pendingLanes);if(0!==t){for(e.pendingLanes|=2,e.entangledLanes|=2;t;){var n=1<<31-Ko(t);e.entanglements[1]|=n,t&=~n}le(e),0===(6&ic)&&(Mc=rl()+500,ue(0,!1))}}break;case 31:case 13:null!==(t=De(e,2))&&ar(t,0,2),cr(),ta(e,2)}},na.batchedUpdates=function(e,t){return e(t)},na.createComponentSelector=function(e){return{$$typeof:Yu,value:e}},na.createContainer=function(e,t,n,i,r,a,s,o,l,u){return Yr(e,t,!1,null,0,i,a,null,s,o,l,u)},na.createHasPseudoClassSelector=function(e){return{$$typeof:Qu,value:e}},na.createHydrationContainer=function(e,t,n,i,r,a,s,o,l,u,c,h,d,p){var f;return(e=Yr(n,i,!0,e,0,a,o,p,l,u,c,h)).context=Qr(null),n=e.current,(r=ke(i=w(i=ir()))).callback=null!=(f=t)?f:null,Ue(n,r,i),t=i,e.current.lanes=t,x(e,t),le(e),e},na.createPortal=function(e,t,n){var i=3=c&&s>=d&&a<=h&&o<=p){e.splice(t,1);break}if(!(r!==c||n.width!==u.width||po)){d>s&&(u.height+=d-s,u.y=s),pa)){c>r&&(u.width+=c-r,u.x=r),hn&&(n=l)),l ")+"\n\nNo matching component was found for:\n "+e.join(" > ")}return null},na.getPublicRootInstance=function(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 27:case 5:return Ca(e.child.stateNode);default:return e.child.stateNode}},na.injectIntoDevTools=function(){var e={bundleType:0,version:wa,rendererPackageName:Ea,currentDispatcherRef:Ma,reconcilerVersion:"19.2.0"};if(null!==Ta&&(e.rendererConfig=Ta),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")e=!1;else{var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)e=!0;else{try{hl=t.inject(e),dl=t}catch(n){}e=!!t.checkDCE}}return e},na.isAlreadyRendering=function(){return 0!==(6&ic)},na.observeVisibleRects=function(e,t,n,r){if(!cs)throw Error(i(363));e=nr(e,t);var a=vs(e,n,r).disconnect;return{disconnect:function(){a()}}},na.shouldError=function(){return null},na.shouldSuspend=function(){return!1},na.startHostTransition=function(e,t,r,a){if(5!==e.tag)throw Error(i(476));var s=nn(e).queue;tn(e,s,t,as,null===r?n:function(){var t=nn(e);return null===t.next&&(t=e.alternate.memoizedState),cn(e,t.next.queue,{},ir()),r(a)})},na.updateContainer=function(e,t,n,i){var r=t.current,a=ir();return $r(r,a,e,t,n,i),a},na.updateContainerSync=function(e,t,n,i){return $r(t.current,2,e,t,n,i),2},na},e.exports.default=e.exports,Object.defineProperty(e.exports,"__esModule",{value:!0})),XB.exports;var e}var KB;var qB=(KB||(KB=1,WB.exports=JB()),WB.exports);const YB=(QB=qB)&&QB.__esModule&&Object.prototype.hasOwnProperty.call(QB,"default")?QB.default:QB;var QB;function ZB(e){const t=YB(e);return t.injectIntoDevTools(),t}const $B={},eI=/^three(?=[A-Z])/,tI=e=>"".concat(e[0].toUpperCase()).concat(e.slice(1));let nI=0;function iI(e,t){const n=tI(e),i=$B[n];if("primitive"!==e&&!i)throw new Error("R3F: ".concat(n," is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively"));if("primitive"===e&&!t.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(void 0!==t.args&&!Array.isArray(t.args))throw new Error("R3F: The args prop must be an array!")}function rI(e){var t;e.isHidden&&(e.props.attach&&null!=(t=e.parent)&&t.object?SB(e.parent,e):IB(e.object)&&!1!==e.props.visible&&(e.object.visible=!0),e.isHidden=!1,PB(e))}function aI(e,t,n){const i=t.root.getState();if(e.parent||e.object===i.scene){if(!t.object){var r,a;const e=$B[tI(t.type)];t.object=null!=(r=t.props.object)?r:new e(...null!=(a=t.props.args)?a:[]),t.object.__r3f=t}if(RB(t.object,t.props),t.props.attach)SB(e,t);else if(IB(t.object)&&IB(e.object)){const i=e.object.children.indexOf(null==n?void 0:n.object);if(n&&-1!==i){const n=e.object.children.indexOf(t.object);if(-1!==n){e.object.children.splice(n,1);const r=n{try{e.dispose()}catch(t){}};"undefined"!==typeof IS_REACT_ACT_ENVIRONMENT?t():(0,YP.unstable_scheduleCallback)(YP.unstable_IdlePriority,t)}}function uI(e,t,n){if(!t)return;t.parent=null;const i=e.children.indexOf(t);-1!==i&&e.children.splice(i,1),t.props.attach?AB(e,t):IB(t.object)&&IB(e.object)&&(e.object.remove(t.object),function(e,t){const n=e.getState().internal;n.interaction=n.interaction.filter(e=>e!==t),n.initialHits=n.initialHits.filter(e=>e!==t),n.hovered.forEach((e,i)=>{e.eventObject!==t&&e.object!==t||n.hovered.delete(i)}),n.capturedMap.forEach((e,i)=>{FB(n.capturedMap,t,e,i)})}(sB(t),t.object));const r=null!==t.props.dispose&&!1!==n;for(let a=t.children.length-1;a>=0;a--){uI(t,t.children[a],r)}t.children.length=0,delete t.object.__r3f,r&&"primitive"!==t.type&&"Scene"!==t.object.type&&lI(t.object),void 0===n&&PB(t)}function cI(e,t){for(const n of[e,e.alternate])if(null!==n)if("function"===typeof n.ref){null==n.refCleanup||n.refCleanup();const e=n.ref(t);"function"===typeof e&&(n.refCleanup=e)}else n.ref&&(n.ref.current=t)}const hI=[];const dI=()=>{},pI={};let fI=0;const mI=ZB({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:function(e,t,n){var i;return iI(e=tI(e)in $B?e:e.replace(eI,""),t),"primitive"===e&&null!=(i=t.object)&&i.__r3f&&delete t.object.__r3f,_B(t.object,n,e,t)},removeChild:uI,appendChild:sI,appendInitialChild:sI,insertBefore:oI,appendChildToContainer(e,t){const n=e.getState().scene.__r3f;t&&n&&sI(n,t)},removeChildFromContainer(e,t){const n=e.getState().scene.__r3f;t&&n&&uI(n,t)},insertInContainerBefore(e,t,n){const i=e.getState().scene.__r3f;t&&n&&i&&oI(i,t,n)},getRootHostContext:()=>pI,getChildHostContext:()=>pI,commitUpdate(e,t,n,i,r){var a,s,o;iI(t,i);let l=!1;if(("primitive"===e.type&&n.object!==i.object||(null==(a=i.args)?void 0:a.length)!==(null==(s=n.args)?void 0:s.length)||null!=(o=i.args)&&o.some((e,t)=>{var i;return e!==(null==(i=n.args)?void 0:i[t])}))&&(l=!0),l)hI.push([e,h({},i),r]);else{const t=function(e,t){const n={};for(const i in t)if(!MB.includes(i)&&!mB.equ(t[i],e.props[i])){n[i]=t[i];for(const e in t)e.startsWith("".concat(i,"-"))&&(n[e]=t[e])}for(const i in e.props){if(MB.includes(i)||t.hasOwnProperty(i))continue;const r=bB(e.object,i),a=r.root,s=r.key;if(a.constructor&&0===a.constructor.length){const e=EB(a);mB.und(e)||(n[s]=e[s])}else n[s]=0}return n}(e,i);Object.keys(t).length&&(Object.assign(e.props,t),RB(e.object,t))}(null===r.sibling||0===(4&r.flags))&&function(){for(const i of hI){const e=Ma(i,1)[0],t=e.parent;if(t){e.props.attach?AB(t,e):IB(e.object)&&IB(t.object)&&t.object.remove(e.object);for(const t of e.children)t.props.attach?AB(e,t):IB(t.object)&&IB(e.object)&&e.object.remove(t.object)}e.isHidden&&rI(e),e.object.__r3f&&delete e.object.__r3f,"primitive"!==e.type&&lI(e.object)}for(const i of hI){var e=Ma(i,3);const r=e[0],a=e[1],s=e[2];r.props=a;const o=r.parent;if(o){var t,n;const e=$B[tI(r.type)],i=r.object;r.object=null!=(t=r.props.object)?t:new e(...null!=(n=r.props.args)?n:[]),r.object.__r3f=r,cI(s,r.object),LB(sB(r),i,r.object),RB(r.object,r.props),r.props.attach?SB(o,r):IB(r.object)&&IB(o.object)&&o.object.add(r.object);for(const t of r.children)t.props.attach?SB(r,t):IB(t.object)&&IB(r.object)&&r.object.add(t.object);PB(r)}}hI.length=0}()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:e=>null==e?void 0:e.object,prepareForCommit:()=>null,preparePortalMount:e=>_B(e.getState().scene,e,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:function(e){var t;e.isHidden||(e.props.attach&&null!=(t=e.parent)&&t.object?AB(e.parent,e):IB(e.object)&&(e.object.visible=!1),e.isHidden=!0,PB(e))},unhideInstance:rI,createTextInstance:dI,hideTextInstance:dI,unhideTextInstance:dI,scheduleTimeout:"function"===typeof setTimeout?setTimeout:void 0,cancelTimeout:"function"===typeof clearTimeout?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:r.createContext(null),setCurrentUpdatePriority(e){fI=e},getCurrentUpdatePriority:()=>fI,resolveUpdatePriority(){var e;if(0!==fI)return fI;switch("undefined"!==typeof window&&(null==(e=window.event)?void 0:e.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return 2;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return 8;default:return 32}},resetFormInstance(){},rendererPackageName:"@react-three/fiber",rendererVersion:"9.6.1",applyViewTransitionName(e,t,n){},restoreViewTransitionName(e,t){},cancelViewTransitionName(e,t,n){},cancelRootViewTransitionName(e){},restoreRootViewTransitionName(e){},InstanceMeasurement:null,measureInstance:e=>null,wasInstanceInViewport:e=>!0,hasInstanceChanged:(e,t)=>!1,hasInstanceAffectedParent:(e,t)=>!1,suspendOnActiveViewTransition(e,t){},startGestureTransition:()=>null,startViewTransition:()=>null,stopViewTransition(e){},createViewTransitionInstance:e=>null,getCurrentGestureOffset(e){throw new Error("startGestureTransition is not yet supported in react-three-fiber.")},cloneMutableInstance:(e,t)=>e,cloneMutableTextInstance:e=>e,cloneRootViewTransitionContainer(e){throw new Error("Not implemented.")},removeRootViewTransitionClone(e,t){throw new Error("Not implemented.")},createFragmentInstance:e=>null,updateFragmentInstanceFiber(e,t){},commitNewChildToFragmentInstance(e,t){},deleteChildFromFragmentInstance(e,t){},measureClonedInstance:e=>null,maySuspendCommitOnUpdate:(e,t,n)=>!1,maySuspendCommitInSyncRender:(e,t)=>!1,startSuspendingCommit:()=>null,getSuspendedCommitReason:(e,t)=>null}),gI=new Map,vI={objects:"shallow",strict:!1};function yI(e){const t=gI.get(e),n=null==t?void 0:t.fiber,i=null==t?void 0:t.store;t&&console.warn("R3F.createRoot should only be called once!");const r="function"===typeof reportError?reportError:console.error,a=i||UB(LI,NI),s=n||mI.createContainer(a,1,null,!1,null,"",r,r,r,null);let o,l;t||gI.set(e,{fiber:s,store:a});let u=!1,c=null;return{async configure(){let t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};c=new Promise(e=>t=e);let i=n.gl,r=n.size,s=n.scene,d=n.events,p=n.onCreated,f=n.shadows,m=void 0!==f&&f,g=n.linear,v=void 0!==g&&g,y=n.flat,_=void 0!==y&&y,b=n.legacy,x=void 0!==b&&b,S=n.orthographic,A=void 0!==S&&S,M=n.frameloop,w=void 0===M?"always":M,E=n.dpr,T=void 0===E?[1,2]:E,C=n.performance,R=n.raycaster,P=n.camera,B=n.onPointerMissed,I=a.getState(),D=I.gl;if(!I.gl){const t={canvas:e,powerPreference:"high-performance",antialias:!0,alpha:!0},n="function"===typeof i?await i(t):i;D=OB(n)?n:new VP(h(h({},t),i)),I.set({gl:D})}let F=I.raycaster;F||I.set({raycaster:F=new ky});const L=R||{},N=L.params,O=W_(L,aB);if(mB.equ(O,F,vI)||RB(F,h({},O)),mB.equ(N,F.params,vI)||RB(F,{params:h(h({},F.params),N)}),!I.camera||I.camera===l&&!mB.equ(l,P,vI)){l=P;const e=null==P?void 0:P.isCamera,t=e?P:A?new Pv(0,0,0,0,.1,1e3):new wv(75,0,.1,1e3);e||(t.position.z=5,P&&(RB(t,P),t.manual||("aspect"in P||"left"in P||"right"in P||"bottom"in P||"top"in P)&&(t.manual=!0,t.updateProjectionMatrix())),I.camera||null!=P&&P.rotation||t.lookAt(0,0,0)),I.set({camera:t}),F.camera=t}if(!I.scene){let e;null!=s&&s.isScene?(e=s,_B(e,a,"",{})):(e=new oh,_B(e,a,"",{}),s&&RB(e,s)),I.set({scene:e})}d&&!I.events.handlers&&I.set({events:d(a)});const k=function(e,t){if(!t&&"undefined"!==typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&e.parentElement){const t=e.parentElement.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,left:t.left}}return!t&&"undefined"!==typeof OffscreenCanvas&&e instanceof OffscreenCanvas?{width:e.width,height:e.height,top:0,left:0}:h({width:0,height:0,top:0,left:0},t)}(e,r);if(mB.equ(k,I.size,vI)||I.setSize(k.width,k.height,k.top,k.left),T&&I.viewport.dpr!==pB(T)&&I.setDpr(T),I.frameloop!==w&&I.setFrameloop(w),I.onPointerMissed||I.set({onPointerMissed:B}),C&&!mB.equ(C,I.performance,vI)&&I.set(e=>({performance:h(h({},e.performance),C)})),!I.xr){var U;const e=(e,t)=>{const n=a.getState();"never"!==n.frameloop&&NI(e,!0,n,t)},t=()=>{const t=a.getState();t.gl.xr.enabled=t.gl.xr.isPresenting,t.gl.xr.setAnimationLoop(t.gl.xr.isPresenting?e:null),t.gl.xr.isPresenting||LI(t)},n={connect(){const e=a.getState().gl;e.xr.addEventListener("sessionstart",t),e.xr.addEventListener("sessionend",t)},disconnect(){const e=a.getState().gl;e.xr.removeEventListener("sessionstart",t),e.xr.removeEventListener("sessionend",t)}};"function"===typeof(null==(U=D.xr)?void 0:U.addEventListener)&&n.connect(),I.set({xr:n})}if(D.shadowMap){const e=D.shadowMap.enabled,t=D.shadowMap.type;if(D.shadowMap.enabled=!!m,mB.boo(m))D.shadowMap.type=Fa;else if(mB.str(m)){var z;const e={basic:Ia,percentage:Da,soft:Fa,variance:La};D.shadowMap.type=null!=(z=e[m])?z:Fa}else mB.obj(m)&&Object.assign(D.shadowMap,m);e===D.shadowMap.enabled&&t===D.shadowMap.type||(D.shadowMap.needsUpdate=!0)}return rc.enabled=!x,u||(D.outputColorSpace=v?Cl:Tl,D.toneMapping=_?As:Ts),I.legacy!==x&&I.set(()=>({legacy:x})),I.linear!==v&&I.set(()=>({linear:v})),I.flat!==_&&I.set(()=>({flat:_})),!i||mB.fun(i)||OB(i)||mB.equ(i,D,vI)||RB(D,i),o=p,u=!0,t(),this},render(t){return u||c||this.configure(),c.then(()=>{mI.updateContainer((0,Be.jsx)(_I,{store:a,children:t,onCreated:o,rootElement:e}),s,null,()=>{})}),a},unmount(){bI(e)}}}function _I(e){let t=e.store,n=e.children,i=e.onCreated,r=e.rootElement;return uB(()=>{const e=t.getState();e.set(e=>({internal:h(h({},e.internal),{},{active:!0})})),i&&i(e),t.getState().events.connected||null==e.events.connect||e.events.connect(r)},[]),(0,Be.jsx)(kB.Provider,{value:t,children:n})}function bI(e,t){const n=gI.get(e),i=null==n?void 0:n.fiber;if(i){const r=null==n?void 0:n.store.getState();r&&(r.internal.active=!1),mI.updateContainer(null,i,null,()=>{r&&setTimeout(()=>{try{var n,i,a,s;null==r.events.disconnect||r.events.disconnect(),null==(n=r.gl)||null==(i=n.renderLists)||null==i.dispose||i.dispose(),null==(a=r.gl)||null==a.forceContextLoss||a.forceContextLoss(),null!=(s=r.gl)&&s.xr&&r.xr.disconnect(),function(e){"Scene"!==e.type&&(null==e.dispose||e.dispose());for(const t in e){const n=e[t];"Scene"!==(null==n?void 0:n.type)&&(null==n||null==n.dispose||n.dispose())}}(r.scene),gI.delete(e),t&&t(e)}catch(o){}},500)})}}const xI=new Set,SI=new Set,AI=new Set;function MI(e,t){if(e.size)for(const n of e.values()){(0,n.callback)(t)}}function wI(e,t){switch(e){case"before":return MI(xI,t);case"after":return MI(SI,t);case"tail":return MI(AI,t)}}let EI,TI;function CI(e,t,n){let i=t.clock.getDelta();"never"===t.frameloop&&"number"===typeof e&&(i=e-t.clock.elapsedTime,t.clock.oldTime=t.clock.elapsedTime,t.clock.elapsedTime=e),EI=t.internal.subscribers;for(let r=0;r0)||null!=(t=BI.gl.xr)&&t.isPresenting||(RI+=CI(e,BI))}if(DI=!1,wI("after",e),0===RI)return wI("tail",e),II=!1,cancelAnimationFrame(PI)}function LI(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;var n;if(!e)return gI.forEach(e=>LI(e.store.getState(),t));null!=(n=e.gl.xr)&&n.isPresenting||!e.internal.active||"never"===e.frameloop||(e.internal.frames=t>1?Math.min(60,e.internal.frames+t):DI?2:1,II||(II=!0,requestAnimationFrame(FI)))}function NI(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;if(t&&wI("before",e),n)CI(e,n,i);else for(const r of gI.values())CI(e,r.store.getState());t&&wI("after",e)}const OI={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function kI(e){const t=NB(e).handlePointer;return{priority:1,enabled:!0,compute(e,t,n){t.pointer.set(e.offsetX/t.size.width*2-1,-e.offsetY/t.size.height*2+1),t.raycaster.setFromCamera(t.pointer,t.camera)},connected:void 0,handlers:Object.keys(OI).reduce((e,n)=>h(h({},e),{},{[n]:t(n)}),{}),update:()=>{var t;const n=e.getState(),i=n.events,r=n.internal;null!=(t=r.lastEvent)&&t.current&&i.handlers&&i.handlers.onPointerMove(r.lastEvent.current)},connect:t=>{const n=e.getState(),i=n.set,r=n.events;if(null==r.disconnect||r.disconnect(),i(e=>({events:h(h({},e.events),{},{connected:t})})),r.handlers)for(const e in r.handlers){const n=r.handlers[e],i=Ma(OI[e],2),a=i[0],s=i[1];t.addEventListener(a,n,{passive:s})}},disconnect:()=>{const t=e.getState(),n=t.set,i=t.events;if(i.connected){if(i.handlers)for(const e in i.handlers){const t=i.handlers[e],n=Ma(OI[e],1)[0];i.connected.removeEventListener(n,t)}n(e=>({events:h(h({},e.events),{},{connected:void 0})}))}}}}function UI(e,t){let n;return function(){for(var i=arguments.length,r=new Array(i),a=0;ae(...r),t)}}function zI(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{debounce:0,scroll:!1,offsetSize:!1},t=e.debounce,n=e.scroll,i=e.polyfill,a=e.offsetSize;const s=i||("undefined"==typeof window?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const o=Ma((0,r.useState)({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),2),l=o[0],u=o[1],c=(0,r.useRef)({element:null,scrollContainers:null,resizeObserver:null,lastBounds:l,orientationHandler:null}),h=t?"number"==typeof t?t:t.scroll:null,d=t?"number"==typeof t?t:t.resize:null,p=(0,r.useRef)(!1);(0,r.useEffect)(()=>(p.current=!0,()=>{p.current=!1}));const f=(0,r.useMemo)(()=>{const e=()=>{if(!c.current.element)return;const e=c.current.element.getBoundingClientRect(),t={left:e.left,top:e.top,width:e.width,height:e.height,bottom:e.bottom,right:e.right,x:e.x,y:e.y};c.current.element instanceof HTMLElement&&a&&(t.height=c.current.element.offsetHeight,t.width=c.current.element.offsetWidth),Object.freeze(t),p.current&&!VI(c.current.lastBounds,t)&&u(c.current.lastBounds=t)};return[e,d?UI(e,d):e,h?UI(e,h):e]},[u,a,h,d]),m=Ma(f,3),g=m[0],v=m[1],y=m[2];function _(){c.current.scrollContainers&&(c.current.scrollContainers.forEach(e=>e.removeEventListener("scroll",y,!0)),c.current.scrollContainers=null),c.current.resizeObserver&&(c.current.resizeObserver.disconnect(),c.current.resizeObserver=null),c.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",c.current.orientationHandler))}function b(){c.current.element&&(c.current.resizeObserver=new s(y),c.current.resizeObserver.observe(c.current.element),n&&c.current.scrollContainers&&c.current.scrollContainers.forEach(e=>e.addEventListener("scroll",y,{capture:!0,passive:!0})),c.current.orientationHandler=()=>{y()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",c.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",c.current.orientationHandler))}return function(e,t){(0,r.useEffect)(()=>{if(t){const t=e;return window.addEventListener("scroll",t,{capture:!0,passive:!0}),()=>{window.removeEventListener("scroll",t,!0)}}},[e,t])}(y,!!n),function(e){(0,r.useEffect)(()=>{const t=e;return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t)}},[e])}(v),(0,r.useEffect)(()=>{_(),b()},[n,y,v]),(0,r.useEffect)(()=>_,[]),[e=>{!e||e===c.current.element||(_(),c.current.element=e,c.current.scrollContainers=GI(e),b())},l,g]}function GI(e){const t=[];if(!e||e===document.body)return t;const n=window.getComputedStyle(e);return[n.overflow,n.overflowX,n.overflowY].some(e=>"auto"===e||"scroll"===e)&&t.push(e),[...t,...GI(e.parentElement)]}const HI=["x","y","top","bottom","left","right","width","height"],VI=(e,t)=>HI.every(n=>e[n]===t[n]),jI=["ref","children","fallback","resize","style","gl","events","eventSource","eventPrefix","shadows","linear","flat","legacy","orthographic","frameloop","dpr","performance","raycaster","camera","scene","onPointerMissed","onCreated"];function WI(e){let t=e.ref,n=e.children,a=e.fallback,s=e.resize,o=e.style,l=e.gl,u=e.events,c=void 0===u?kI:u,d=e.eventSource,p=e.eventPrefix,f=e.shadows,m=e.linear,g=e.flat,v=e.legacy,y=e.orthographic,_=e.frameloop,b=e.dpr,x=e.performance,S=e.raycaster,A=e.camera,M=e.scene,w=e.onPointerMissed,E=e.onCreated,T=W_(e,jI);r.useMemo(()=>function(e){if("function"===typeof e){const t="".concat(nI++);return $B[t]=e,t}Object.assign($B,e)}(i),[]);const C=function(){const e=tB(),t=rB();return r.useMemo(()=>n=>{let i=n.children;const a=QP(e,!0,e=>e.type===r.StrictMode)?r.StrictMode:r.Fragment;return(0,Be.jsx)(a,{children:(0,Be.jsx)(t,{children:i})})},[e,t])}(),R=Ma(zI(h({scroll:!0,debounce:{scroll:50,resize:0}},s)),2),P=R[0],B=R[1],I=r.useRef(null),D=r.useRef(null);r.useImperativeHandle(t,()=>I.current);const F=cB(w),L=Ma(r.useState(!1),2),N=L[0],O=L[1],k=Ma(r.useState(!1),2),U=k[0],z=k[1];if(N)throw N;if(U)throw U;const G=r.useRef(null);uB(()=>{const e=I.current;if(B.width>0&&B.height>0&&e){async function t(){await G.current.configure({gl:l,scene:M,events:c,shadows:f,linear:m,flat:g,legacy:v,orthographic:y,frameloop:_,dpr:b,performance:x,raycaster:S,camera:A,size:B,onPointerMissed:function(){return null==F.current?void 0:F.current(...arguments)},onCreated:e=>{var t;null==e.events.connect||e.events.connect(d?(t=d)&&t.hasOwnProperty("current")?d.current:d:D.current),p&&e.setEvents({compute:(e,t)=>{const n=e[p+"X"],i=e[p+"Y"];t.pointer.set(n/t.size.width*2-1,-i/t.size.height*2+1),t.raycaster.setFromCamera(t.pointer,t.camera)}}),null==E||E(e)}}),G.current.render((0,Be.jsx)(C,{children:(0,Be.jsx)(dB,{set:z,children:(0,Be.jsx)(r.Suspense,{fallback:(0,Be.jsx)(hB,{set:O}),children:null!=n?n:null})})}))}G.current||(G.current=yI(e)),t()}}),r.useEffect(()=>{const e=I.current;if(e)return()=>bI(e)},[]);const H=d?"none":"auto";return(0,Be.jsx)("div",h(h({ref:D,style:h({position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:H},o)},T),{},{children:(0,Be.jsx)("div",{ref:P,style:{width:"100%",height:"100%"},children:(0,Be.jsx)("canvas",{ref:I,style:{display:"block"},children:a})})}))}function XI(e){return(0,Be.jsx)(eB,{children:(0,Be.jsx)(WI,h({},e))})}const JI=new WeakMap;class KI extends tv{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const r=new rv(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,e=>{const n={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,n).then(t).catch(i)},n,i)}decodeDracoFile(e,t,n,i){const r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,r).then(t)}decodeGeometry(e,t){for(const o in t.attributeTypes){const e=t.attributeTypes[o];void 0!==e.BYTES_PER_ELEMENT&&(t.attributeTypes[o]=e.name)}const n=JSON.stringify(t);if(JI.has(e)){const t=JI.get(e);if(t.key===n)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const r=this.workerNextTaskID++,a=e.byteLength,s=this._getWorker(r,a).then(n=>(i=n,new Promise((n,a)=>{i._callbacks[r]={resolve:n,reject:a},i.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return s.catch(()=>!0).then(()=>{i&&r&&this._releaseTask(i,r)}),JI.set(e,{key:n,promise:s}),s}_createGeometry(e){const t=new dd;e.index&&t.setIndex(new Wh(e.index.array,1));for(let n=0;n{n.load(e,t,void 0,i)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!==typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{const n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const i=qI.toString(),r=["/* draco decoder */",n,"","/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengtht._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const t=e.draco,s=new t.Decoder,o=new t.DecoderBuffer;o.Init(new Int8Array(i),i.byteLength);try{const e=function(e,t,i,r){const a=r.attributeIDs,s=r.attributeTypes;let o,l;const u=t.GetEncodedGeometryType(i);if(u===e.TRIANGULAR_MESH)o=new e.Mesh,l=t.DecodeBufferToMesh(i,o);else{if(u!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,l=t.DecodeBufferToPointCloud(i,o)}if(!l.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const c={index:null,attributes:[]};for(const h in a){const i=self[s[h]];let l,u;if(r.useUniqueIDs)u=a[h],l=t.GetAttributeByUniqueId(o,u);else{if(u=t.GetAttributeId(o,e[a[h]]),-1===u)continue;l=t.GetAttribute(o,u)}c.attributes.push(n(e,t,o,h,i,l))}u===e.TRIANGULAR_MESH&&(c.index=function(e,t,n){const i=n.num_faces(),r=3*i,a=4*r,s=e._malloc(a);t.GetTrianglesUInt32Array(n,a,s);const o=new Uint32Array(e.HEAPF32.buffer,s,r).slice();return e._free(s),{array:o,itemSize:1}}(e,t,o));return e.destroy(o),c}(t,s,o,a),i=e.attributes.map(e=>e.array.buffer);e.index&&i.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},i)}catch(Du){console.error(Du),self.postMessage({type:"error",id:r.id,error:Du.message})}finally{t.destroy(o),t.destroy(s)}})}}}let YI;const QI=()=>{if(YI)return YI;const e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if("object"!==typeof WebAssembly)return{supported:!1};let n,i="B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB";WebAssembly.validate(e)&&(i="B9h9z9tFBBBFiI9gBB9gLaaaaaFa9gEaaaB9gFaFaEMcBBFBFFGGGEILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBOn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBNI9z9iqlBVc+N9IcIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMk8lLbaE97F9+FaL978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAeDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAeDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAeDeBJAiCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPAPDQBFGENVcMILKOSQfbHeD8dBh+BsxoxoUwN0AeD8dFhxoUwkwk+gUa0sHnhTkAnsHnhNkAnsHn7CgFZHiCEWCxkUUBJDBEBAiCx+YUUBJDBBBHeAeDQBBBBBBBBBBBBBBBBAnhAk7CgFZHiCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAeDeBJAiCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBReCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBH8ZCFD9tA8ZAPD9OD9hD9RH8ZDQBTFtGmEYIPLdKeOnHpAIAQJDBIBHyCFD9tAyAPD9OD9hD9RHyAIASJDBIBH8cCFD9tA8cAPD9OD9hD9RH8cDQBTFtGmEYIPLdKeOnH8dDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAeD9uHeDyBjGBAEAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeApA8dDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNiV8ZcpMyS8cQ8df8eb8fHdAyA8cDQNiV8ZcpMyS8cQ8df8eb8fH8ZDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJHIAeAdA8ZDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHeDyBjGBAIAGJHIAeAPAPDQILKOILKOILKOILKOD9uHeDyBjGBAIAGJHIAeAPAPDQNVcMNVcMNVcMNVcMD9uHeDyBjGBAIAGJHIAeAPAPDQSQfbSQfbSQfbSQfbD9uHeDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/dLEK97FaF97GXGXAGCI9HQBAF9FQFCBRGEXABABDBBBHECiD+rFCiD+sFD/6FHIAECND+rFCiD+sFD/6FAID/gFAECTD+rFCiD+sFD/6FHLD/gFD/kFD/lFHKCBDtD+2FHOAICUUUU94DtHND9OD9RD/kFHI9DBB/+hDYAIAID/mFAKAKD/mFALAOALAND9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHLD/mF9DBBX9LDYHOD/kFCgFDtD9OAECUUU94DtD9OD9QAIALD/mFAOD/kFCND+rFCU/+EDtD9OD9QAKALD/mFAOD/kFCTD+rFCUU/8ODtD9OD9QDMBBABCTJRBAGCIJHGAF9JQBSGMMAF9FQBCBRGEXABCTJHVAVDBBBHECBDtHOCUU98D8cFCUU98D8cEHND9OABDBBBHKAEDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAKAEDQBFGENVcMTtmYi8ZpyHECTD+sFD/6FHID/gFAECTD+rFCTD+sFD/6FHLD/gFD/kFD/lFHE9DB/+g6DYALAEAOD+2FHOALCUUUU94DtHcD9OD9RD/kFHLALD/mFAEAED/mFAIAOAIAcD9OD9RD/kFHEAED/mFD/kFD/kFD/jFD/nFHID/mF9DBBX9LDYHOD/kFCTD+rFALAID/mFAOD/kFCggEDtD9OD9QHLAEAID/mFAOD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHEDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAKAND9OALAEDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM/hEIGaF97FaL978jUUUUBCTlREGXAF9FQBCBRIEXAEABDBBBHLABCTJHKDBBBHODQILKOSQfbPden8c8d8e8fHNCTD+sFHVCID+rFDMIBAB9DBBU8/DY9D/zI818/DYAVCEDtD9QD/6FD/nFHVALAODQBFGENVcMTtmYi8ZpyHLCTD+rFCTD+sFD/6FD/mFHOAOD/mFAVALCTD+sFD/6FD/mFHcAcD/mFAVANCTD+rFCTD+sFD/6FD/mFHNAND/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHVD/mF9DBBX9LDYHLD/kFCggEDtHMD9OAcAVD/mFALD/kFCTD+rFD9QHcANAVD/mFALD/kFCTD+rFAOAVD/mFALD/kFAMD9OD9QHVDQBFTtGEmYILPdKOenHLD8dBAEDBIBDyB+t+J83EBABCNJALD8dFAEDBIBDyF+t+J83EBAKAcAVDQNVi8ZcMpySQ8c8dfb8e8fHVD8dBAEDBIBDyG+t+J83EBABCiJAVD8dFAEDBIBDyE+t+J83EBABCAJRBAICIJHIAF9JQBMMM9jFF97GXAGCGrAF9sHG9FQBCBRFEXABABDBBBHECND+rFCND+sFD/6FAECiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBABCTJRBAFCIJHFAG9JQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB");const r=WebAssembly.instantiate(function(e){const n=new Uint8Array(e.length);for(let t=0;t96?i-71:i>64?i-65:i>47?i+4:i>46?63:62}let i=0;for(let r=0;r{n=e.instance,n.exports.__wasm_call_ctors()});function a(e,t,i,r,a,s){const o=n.exports.sbrk,l=i+3&-4,u=o(l*r),c=o(a.length),h=new Uint8Array(n.exports.memory.buffer);h.set(a,c);const d=e(u,i,r,c,a.length);if(0===d&&s&&s(u,l,r),t.set(h.subarray(u,u+i*r)),o(u-o(0)),0!==d)throw new Error("Malformed buffer data: ".concat(d))}const s={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},o={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return YI={ready:r,supported:!0,decodeVertexBuffer(e,t,i,r,o){a(n.exports.meshopt_decodeVertexBuffer,e,t,i,r,n.exports[s[o]])},decodeIndexBuffer(e,t,i,r){a(n.exports.meshopt_decodeIndexBuffer,e,t,i,r)},decodeIndexSequence(e,t,i,r){a(n.exports.meshopt_decodeIndexSequence,e,t,i,r)},decodeGltfBuffer(e,t,i,r,l,u){a(n.exports[o[l]],e,t,i,r,n.exports[s[u]])}},YI};function ZI(e,t){if(t===vl)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===_l||t===yl){let n=e.getIndex();if(null===n){const t=[],i=e.getAttribute("position");if(void 0===i)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;eparseInt(wa.replace(/\D+/g,"")))();function eD(e){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(e);let t="";for(let i=0,r=e.length;i=2.0 are supported.")));const o=new $D(r,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});o.fileLoader.setRequestHeader(this.requestHeader);for(let l=0;l=0&&void 0===s[e]&&console.warn('THREE.GLTFLoader: Unknown extension "'+e+'".')}}o.setExtensions(a),o.setPlugins(s),o.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,r){n.parse(e,t,i,r)})}}function rD(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const aD={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class sD{constructor(e){this.parser=e,this.name=aD.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,a)}}class bD{constructor(e){this.parser=e,this.name=aD.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],s=i.images[a.source];let o=n.textureLoader;if(s.uri){const e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class xD{constructor(e){this.parser=e,this.name=aD.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,r=i.textures[e];if(!r.extensions||!r.extensions[t])return null;const a=r.extensions[t],s=i.images[a.source];let o=n.textureLoader;if(s.uri){const e=n.options.manager.getHandler(s.uri);null!==e&&(o=e)}return this.detectSupport().then(function(r){if(r)return n.loadTextureImage(e,a.source,o);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}})),this.isSupported}}class SD{constructor(e){this.name=aD.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const e=n.extensions[this.name],i=this.parser.getDependency("buffer",e.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return i.then(function(t){const n=e.byteOffset||0,i=e.byteLength||0,a=e.count,s=e.byteStride,o=new Uint8Array(t,n,i);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(a,s,o,e.mode,e.filter).then(function(e){return e.buffer}):r.ready.then(function(){const t=new ArrayBuffer(a*s);return r.decodeGltfBuffer(new Uint8Array(t),a,s,o,e.mode,e.filter),t})})}return null}}class AD{constructor(e){this.name=aD.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||void 0===n.mesh)return null;const i=t.meshes[n.mesh];for(const o of i.primitives)if(o.mode!==FD.TRIANGLES&&o.mode!==FD.TRIANGLE_STRIP&&o.mode!==FD.TRIANGLE_FAN&&void 0!==o.mode)return null;const r=n.extensions[this.name].attributes,a=[],s={};for(const o in r)a.push(this.parser.getDependency("accessor",r[o]).then(e=>(s[o]=e,s[o])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{const t=e.pop(),n=t.isGroup?t.children:[t],i=e[0].count,r=[];for(const a of n){const e=new Sc,t=new Yu,n=new qu,o=new Yu(1,1,1),l=new Cp(a.geometry,a.material,i);for(let r=0;r=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"}),{},{COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"}),zD={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},GD={CUBICSPLINE:void 0,LINEAR:ul,STEP:ll},HD="OPAQUE",VD="MASK",jD="BLEND";function WD(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new xg({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Na})),e.DefaultMaterial}function XD(e,t,n){for(const i in n.extensions)void 0===e[i]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=n.extensions[i])}function JD(e,t){void 0!==t.extras&&("object"===typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function KD(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let n=0,i=t.weights.length;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new rD,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=!1,r=-1;"undefined"!==typeof navigator&&"undefined"!==typeof navigator.userAgent&&(n=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),i=navigator.userAgent.indexOf("Firefox")>-1,r=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"===typeof createImageBitmap||n||i&&r<98?this.textureLoader=new hv(this.options.manager):this.textureLoader=new Jv(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new rv(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(t){const a={scene:t[0][i.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:i.asset,parser:n,userData:{}};return XD(r,a,i),JD(a,i),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(const e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,r=t.length;i{const n=this.associations.get(e);null!=n&&this.associations.set(t,n);for(const a of e.children.entries()){var i=Ma(a,2);const e=i[0],n=i[1];r(n,t.children[e])}};return r(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,c[e*a+1]),a>=3&&p.setZ(t,c[e*a+2]),a>=4&&p.setW(t,c[e*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return p})}loadTexture(e){const t=this.json,n=this.options,i=t.textures[e].source,r=t.images[i];let a=this.textureLoader;if(r.uri){const e=n.manager.getHandler(r.uri);null!==e&&(a=e)}return this.loadTextureImage(e,i,a)}loadTextureImage(e,t,n){const i=this,r=this.json,a=r.textures[e],s=r.images[t],o=(s.uri||s.bufferView)+":"+a.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||s.name||"",""===t.name&&"string"===typeof s.uri&&!1===s.uri.startsWith("data:image/")&&(t.name=s.uri);const n=(r.samplers||{})[a.sampler]||{};return t.magFilter=ND[n.magFilter]||Js,t.minFilter=ND[n.minFilter]||Ys,t.wrapS=OD[n.wrapS]||Us,t.wrapT=OD[n.wrapT]||Us,i.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(e,t){const n=this,i=this.json,r=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const a=i.images[e],s=self.URL||self.webkitURL;let o=a.uri||"",l=!1;if(void 0!==a.bufferView)o=n.getDependency("bufferView",a.bufferView).then(function(e){l=!0;const t=new Blob([e],{type:a.mimeType});return o=s.createObjectURL(t),o});else if(void 0===a.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(o).then(function(e){return new Promise(function(n,i){let a=n;!0===t.isImageBitmapLoader&&(a=function(e){const t=new fc(e);t.needsUpdate=!0,n(t)}),t.load(kv.resolveURL(e,r.path),a,void 0,i)})}).then(function(e){var t;return!0===l&&s.revokeObjectURL(o),JD(e,a),e.userData.mimeType=a.mimeType||((t=a.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e});return this.sourceCache[e]=u,u}assignTexture(e,t,n,i){const r=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(void 0!==n.texCoord&&n.texCoord>0&&((a=a.clone()).channel=n.texCoord),r.extensions[aD.KHR_TEXTURE_TRANSFORM]){const e=void 0!==n.extensions?n.extensions[aD.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=r.associations.get(a);a=r.extensions[aD.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),r.associations.set(a,t)}}return void 0!==i&&("number"===typeof i&&(i=3001===i?tD:nD),"colorSpace"in a?a.colorSpace=i:a.encoding=i===tD?3001:3e3),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=void 0===t.attributes.tangent,r=void 0!==t.attributes.color,a=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new bf,yd.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){const e="LineBasicMaterial:"+n.uuid;let t=this.cache.get(e);t||(t=new sf,yd.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(i||r||a){let e="ClonedMaterial:"+n.uuid+":";i&&(e+="derivative-tangents:"),r&&(e+="vertex-colors:"),a&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=n.clone(),r&&(t.vertexColors=!0),a&&(t.flatShading=!0),i&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return xg}loadMaterial(e){const t=this,n=this.json,i=this.extensions,r=n.materials[e];let a;const s={},o=[];if((r.extensions||{})[aD.KHR_MATERIALS_UNLIT]){const e=i[aD.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),o.push(e.extendParams(s,r,t))}else{const n=r.pbrMetallicRoughness||{};if(s.color=new ih(1,1,1),s.opacity=1,Array.isArray(n.baseColorFactor)){const e=n.baseColorFactor;s.color.setRGB(e[0],e[1],e[2],nD),s.opacity=e[3]}void 0!==n.baseColorTexture&&o.push(t.assignTexture(s,"map",n.baseColorTexture,tD)),s.metalness=void 0!==n.metallicFactor?n.metallicFactor:1,s.roughness=void 0!==n.roughnessFactor?n.roughnessFactor:1,void 0!==n.metallicRoughnessTexture&&(o.push(t.assignTexture(s,"metalnessMap",n.metallicRoughnessTexture)),o.push(t.assignTexture(s,"roughnessMap",n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),o.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,s)})))}!0===r.doubleSided&&(s.side=ka);const l=r.alphaMode||HD;if(l===jD?(s.transparent=!0,s.depthWrite=!1):(s.transparent=!1,l===VD&&(s.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&a!==Wd&&(o.push(t.assignTexture(s,"normalMap",r.normalTexture)),s.normalScale=new Ku(1,1),void 0!==r.normalTexture.scale)){const e=r.normalTexture.scale;s.normalScale.set(e,e)}if(void 0!==r.occlusionTexture&&a!==Wd&&(o.push(t.assignTexture(s,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(s.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&a!==Wd){const e=r.emissiveFactor;s.emissive=(new ih).setRGB(e[0],e[1],e[2],nD)}return void 0!==r.emissiveTexture&&a!==Wd&&o.push(t.assignTexture(s,"emissiveMap",r.emissiveTexture,tD)),Promise.all(o).then(function(){const n=new a(s);return r.name&&(n.name=r.name),JD(n,r),t.associations.set(n,{materials:e}),r.extensions&&XD(i,n,r),n})}createUniqueName(e){const t=Ey.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function r(e){return n[aD.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return eF(n,e,t)})}const a=[];for(let s=0,o=e.length;s0&&KD(h,r),h.name=t.createUniqueName(r.name||"mesh_"+e),JD(h,r),u.extensions&&XD(i,h,u),t.assignFinalMaterial(h),l.push(h)}for(let i=0,r=l.length;i1?new Yc:1===t.length?t[0]:new qc,s!==t[0])for(let e=0,n=t.length;e{const t=new Map;for(const r of i.associations){var n=Ma(r,2);const e=n[0],i=n[1];(e instanceof yd||e instanceof fc)&&t.set(e,i)}return e.traverse(e=>{const n=i.associations.get(e);null!=n&&t.set(e,n)}),t})(r),r})}_createAnimationTracks(e,t,n,i,r){const a=[],s=e.name?e.name:e.uuid,o=[];let l;switch(zD[r.path]===zD.weights?e.traverse(function(e){e.morphTargetInfluences&&o.push(e.name?e.name:e.uuid)}):o.push(s),zD[r.path]){case zD.weights:l=jg;break;case zD.rotation:l=Xg;break;case zD.position:case zD.scale:l=Kg;break;default:if(1===n.itemSize)l=jg;else l=Kg}const u=void 0!==i.interpolation?GD[i.interpolation]:ul,c=this._getArrayFromAccessor(n);for(let h=0,d=o.length;h0&&void 0!==arguments[0])||arguments[0],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2?arguments[2]:void 0;return i=>{n&&n(i),e&&(tF||(tF=new KI),tF.setDecoderPath("string"===typeof e?e:nF),i.setDRACOLoader(tF)),t&&i.setMeshoptDecoder(QI())}}const rF=(e,t,n,i)=>VB(iD,e,iF(t,n,i));rF.preload=(e,t,n,i)=>VB.preload(iD,e,iF(t,n,i)),rF.clear=e=>VB.clear(iD,e),rF.setDecoderPath=e=>{nF=e};const aF=e=>"".concat(".").concat(e);function sF(){const e=rF(aF("/assets/mp5k-dark.glb")).scene,t=(0,r.useRef)(),n=(0,r.useMemo)(()=>{const t=e.clone(!0),n=(new Sh).setFromObject(t),i=new Yu;n.getCenter(i),t.position.sub(i);const r=new Yu;n.getSize(r);const a=Math.max(r.x,r.y,r.z);t.scale.setScalar(3.7/a);const s=new Wd({color:1184534,toneMapped:!1});return t.traverse(e=>{e.isMesh&&(e.material=s)}),t},[e]);return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const n=zB(),i=n.getState().internal.subscribe,r=cB(e);uB(()=>i(r,t,n),[t,i,n])}((e,n)=>{if(!t.current)return;t.current.rotation.y+=.32*n;const i=e.size.width/Math.max(1,e.size.height),r=6.6*Math.tan(42*Math.PI/180/2)*i,a=Math.min(1,.82*r/1.9);t.current.scale.setScalar(a)}),(0,Be.jsx)("group",{ref:t,rotation:[.08,0,0],children:(0,Be.jsx)("primitive",{object:n})})}function oF(){return(0,Be.jsx)("div",{className:"pointer-events-none absolute inset-0 z-[1]",children:(0,Be.jsx)(XI,{camera:{position:[0,.1,6.6],fov:42},dpr:[1,2],gl:{alpha:!0},style:{background:"transparent"},children:(0,Be.jsx)(r.Suspense,{fallback:null,children:(0,Be.jsx)(sF,{})})})})}rF.preload(aF("/assets/mp5k-dark.glb"));const lF=[.16,1,.3,1];function uF(){const e=Ma((0,r.useState)(""),2),t=e[0],n=e[1],i=Ma((0,r.useState)("idle"),2),a=i[0],s=i[1],o=Ma((0,r.useState)(""),2),l=o[0],u=o[1];return(0,Be.jsxs)("div",{className:"relative h-[100svh] w-full overflow-hidden text-[#1a1a1a]",style:{background:"radial-gradient(80% 60% at 50% 30%, #FFF7EC 0%, #FCEAD3 55%, #F4E5D2 100%)"},children:[(0,Be.jsx)("div",{className:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(40% 26% at 50% 4%, rgba(255,193,110,0.45) 0%, transparent 70%)"}}),(0,Be.jsx)("header",{className:"absolute left-1/2 top-6 z-30 -translate-x-1/2",children:(0,Be.jsx)("span",{className:"font-instrument select-none text-[26px] leading-none tracking-tight text-[#1a1a1a] sm:text-[28px]",children:"SONIQ"})}),(0,Be.jsxs)("main",{className:"relative z-20 mx-auto flex h-[100svh] max-w-2xl flex-col items-center px-6 pb-5 pt-16 text-center sm:pb-10 sm:pt-24",children:[(0,Be.jsxs)(QT.div,{initial:{opacity:0,y:14},animate:{opacity:1,y:0},transition:{duration:.9,ease:lF},className:"flex shrink-0 flex-col items-center",children:[(0,Be.jsx)("span",{className:"font-inter text-[10px] font-semibold uppercase tracking-[0.4em] text-[#f97316] sm:text-[11px] sm:tracking-[0.45em]",children:"/// SONIQ Toys \xb7 Made in India \xb7 2026"}),(0,Be.jsxs)("h1",{className:"font-instrument mt-3 text-[clamp(30px,7vw,64px)] leading-[1.0] tracking-tight text-[#1a1a1a]",children:["Get ready to get",(0,Be.jsx)("span",{className:"text-[#f97316]",children:" drenched."})]})]}),(0,Be.jsxs)("div",{className:"relative my-2 w-full flex-1 min-h-0 overflow-hidden sm:my-4",children:[(0,Be.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,Be.jsxs)("h2",{className:"font-instrument select-none text-center text-[clamp(46px,14vw,230px)] leading-[0.82] tracking-tight text-[#1a1a1a]/[0.12] scale-y-[1.6] sm:scale-y-[1.5] md:scale-y-100",children:["COMING",(0,Be.jsx)("br",{}),"SOON"]})}),(0,Be.jsx)(oF,{})]}),(0,Be.jsxs)(QT.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:1,delay:.3,ease:lF},className:"flex w-full shrink-0 flex-col items-center",children:[(0,Be.jsx)("p",{className:"max-w-xl font-inter text-[13px] leading-relaxed text-[#1a1a1a]/65 sm:text-[16px]",children:"Holi mornings. Farmhouse pools. Rooftop ambushes. Water parks, society lawns and sun-soaked backyard showdowns. A whole new way to play is charging up, and no day, in any season, stays dry again."}),(0,Be.jsxs)("div",{className:"mt-3 w-full max-w-xs sm:mt-5",children:[(0,Be.jsxs)("div",{className:"mb-2 flex items-center justify-between font-nokia text-[10px] uppercase tracking-[0.25em] text-[#1a1a1a]/45",children:[(0,Be.jsx)("span",{children:"Pressure building"}),(0,Be.jsx)("span",{children:"2026"})]}),(0,Be.jsx)("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-[#1a1a1a]/10",children:(0,Be.jsx)(QT.div,{className:"h-full rounded-full bg-[#f97316]",animate:{width:["8%","92%","8%"]},transition:{duration:3.2,repeat:1/0,ease:"easeInOut"}})})]}),"success"===a?(0,Be.jsx)("p",{className:"mt-4 mx-auto max-w-md font-inter text-[15px] font-medium text-[#f97316]",children:"You're in. We'll call you to the frontline the moment it drops, with early-access offers first. \u2713"}):(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsxs)("form",{onSubmit:async function(e){if(e.preventDefault(),t&&"submitting"!==a){s("submitting"),u("");try{const e=await fetch("https://formspree.io/f/mwvjgyor",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({email:t,source:"coming-soon"})});if(e.ok)s("success");else{const t=await e.json().catch(()=>({})),n=t&&t.errors&&t.errors[0]&&t.errors[0].message;u(n||"Something went wrong. Please try again."),s("error")}}catch(n){u("Network error. Please check your connection and try again."),s("error")}}},className:"mt-4 flex w-full max-w-md flex-col items-stretch gap-2.5 sm:mt-6 sm:flex-row sm:items-center sm:gap-3",children:[(0,Be.jsx)("input",{type:"email",name:"email",required:!0,value:t,onChange:e=>n(e.target.value),placeholder:"you@email.com",disabled:"submitting"===a,className:"w-full flex-1 rounded-full border border-black/15 bg-white/70 px-6 py-3 font-inter text-[14px] text-[#1a1a1a] placeholder-[#1a1a1a]/35 outline-none backdrop-blur-sm transition-colors focus:border-[#f97316] disabled:opacity-60"}),(0,Be.jsxs)("button",{type:"submit",disabled:"submitting"===a,className:"group relative w-full shrink-0 overflow-hidden rounded-full bg-[#f97316] px-7 py-3 font-inter text-[13px] font-semibold text-white shadow-[inset_0_-4px_4px_rgba(255,255,255,0.39)] transition-all hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-70 sm:w-auto",children:[(0,Be.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute left-[10%] top-[1px] h-4 w-[80%] rounded-[12px] bg-gradient-to-b from-[#FFD9B8] to-transparent transition-transform duration-200 group-hover:scale-x-105"}),(0,Be.jsx)("span",{className:"relative",children:"submitting"===a?"Joining\u2026":"Get Early Access"})]})]}),"error"===a&&(0,Be.jsx)("p",{className:"mt-3 font-inter text-[13px] text-red-600",children:l}),(0,Be.jsx)("p",{className:"mt-3 max-w-md font-inter text-[11px] leading-relaxed text-[#1a1a1a]/40",children:"We'll only email you about the launch and early-access offers. No spam, unsubscribe anytime."})]})]})]})]})}function cF(){const e=H_(),t=e.progress,n=e.active,i=(0,r.useRef)(!1),a=()=>{i.current||(i.current=!0,document.body.classList.remove("loading"),Sa.to("body",{autoAlpha:1,duration:.45,ease:"power2.inOut"}))};return(0,r.useEffect)(()=>{const e=setTimeout(a,900);return()=>clearTimeout(e)},[]),(0,r.useEffect)(()=>{t>=100&&!n&&requestAnimationFrame(()=>requestAnimationFrame(a))},[t,n]),null}const hF=function(){return(0,Be.jsxs)(Be.Fragment,{children:[(0,Be.jsx)(cF,{}),(0,Be.jsx)(uF,{})]})};const dF=new Pe({defaultOptions:{queries:{staleTime:6e4,refetchOnWindowFocus:!1}}});s.createRoot(document.getElementById("root")).render((0,Be.jsx)(r.StrictMode,{children:(0,Be.jsx)(De,{client:dF,children:(0,Be.jsx)(hF,{})})}))})();